forked from joedanz/cf-project-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathallbilling.cfm
297 lines (267 loc) · 10.7 KB
/
allbilling.cfm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<cfsetting enablecfoutputonly="true">
<cfprocessingdirective pageencoding="utf-8">
<cfparam name="form.projectIDfilter" default="">
<cfparam name="form.type" default="">
<cfparam name="form.severity" default="">
<cfparam name="form.status" default="New|Accepted|Assigned">
<cfparam name="form.assignedTo" default="">
<cfif session.user.admin>
<cfset projects = application.project.get()>
<cfelse>
<cfset projects = application.project.get(session.user.userid)>
</cfif>
<cfquery name="active_projects" dbtype="query">
select * from projects where status = 'Active'
</cfquery>
<cfquery name="onhold_projects" dbtype="query">
select * from projects where status = 'On-Hold'
</cfquery>
<cfquery name="arch_projects" dbtype="query">
select * from projects where status = 'Archived'
</cfquery>
<cfif not projects.recordCount>
<cfset QueryAddRow(projects)>
<cfset QuerySetCell(projects, "projectID", "0")>
</cfif>
<cfset visible_project_list = "">
<cfloop query="projects">
<cfif bill_view eq 1>
<cfset visible_project_list = listAppend(visible_project_list,projectID)>
</cfif>
</cfloop>
<cfif not listLen(visible_project_list)>
<cfset visible_project_list = "NONE">
</cfif>
<cfset projectUsers = application.project.allProjectUsers(visible_project_list)>
<cfset milestones_completed = application.milestone.get(withRate=true,type='completed',projectIDlist=visible_project_list,forID=session.assignedTo)>
<cfset milestones_incomplete = application.milestone.get(withRate=true,type='incomplete',projectIDlist=visible_project_list,forID=session.assignedTo)>
<cfset timelines = application.timetrack.get(projectIDlist=visible_project_list,userID=session.assignedTo)>
<cfset totalIncMSFee = 0>
<cfset totalComMSFee = 0>
<cfset totalHours = 0>
<cfset totalFee = 0>
<!--- Loads header/footer --->
<cfmodule template="#application.settings.mapping#/tags/layout.cfm" templatename="main" title="#application.settings.app_title# » All Billing">
<cfoutput>
<div id="container">
<!--- left column --->
<div class="left">
<div class="main">
<div class="header">
<h2 class="milestone">Billing across all your projects</h2>
</div>
<div class="content">
<div class="wrapper">
<cfif milestones_incomplete.recordCount>
<fieldset class="bill mb15">
<legend>Incomplete Milestones</legend>
<table class="clean full" id="msinc">
<thead>
<tr>
<th class="first">Due Date</th>
<th>Project</th>
<th>Name</th>
<th>Person</th>
<th>Fee</th>
<th class="tac">Billed</th>
<th class="tac">Paid</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<cfloop query="milestones_incomplete">
<cfif isNumeric(rate)>
<cfset thisUserID = userid>
<tr id="r#milestoneid#">
<td class="first"><cfif isDate(dueDate)>#LSDateFormat(dueDate,"mmm d, yyyy")#</cfif></td>
<td>#projName#</td>
<td>#name#</td>
<td>#firstName# #lastName#</td>
<td>$#NumberFormat(rate,"0")#</td>
<td class="tac"><cfif billed eq 1><img src="./images/ok_16x16.gif" height="16" width="16" border="0" alt="Yes" title="Yes" /><cfelse><img src="./images/delete.gif" height="16" width="16" border="0" alt="No" title="No" /></cfif></td>
<td class="tac"><cfif paid eq 1><img src="./images/ok_16x16.gif" height="16" width="16" border="0" alt="Yes" title="Yes" /><cfelse><img src="./images/delete.gif" height="16" width="16" border="0" alt="No" title="No" /></cfif></td>
<td>#description#</td>
</tr>
<cfif isNumeric(rate)>
<cfset totalIncMSFee = totalIncMSFee + rate>
</cfif>
</cfif>
</cfloop>
</tbody>
<tfoot>
<tr class="last">
<td class="tar b" colspan="4">TOTAL FEE: </td>
<td class="b">$#NumberFormat(totalIncMSFee,"0")#</td>
<td colspan="5"> </td>
</tr>
</tfoot>
</table>
</fieldset>
</cfif>
<cfif milestones_completed.recordCount>
<fieldset class="bill mb15">
<legend>Completed Milestones</legend>
<table class="clean full" id="mscomp">
<thead>
<tr>
<th class="first">Due Date</th>
<th>Project</th>
<th>Name</th>
<th>Person</th>
<th>Fee</th>
<th class="tac">Billed</th>
<th class="tac">Paid</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<cfloop query="milestones_completed">
<cfif isNumeric(rate)>
<cfset thisUserID = userid>
<tr id="r#milestoneid#">
<td class="first"><cfif isDate(dueDate)>#LSDateFormat(dueDate,"mmm d, yyyy")#</cfif></td>
<td>#projName#</td>
<td>#name#</td>
<td>#firstName# #lastName#</td>
<td>$#NumberFormat(rate,"0")#</td>
<td class="tac"><cfif billed eq 1><img src="./images/ok_16x16.gif" height="16" width="16" border="0" alt="Yes" title="Yes" /><cfelse><img src="./images/delete.gif" height="16" width="16" border="0" alt="No" title="No" /></cfif></td>
<td class="tac"><cfif paid eq 1><img src="./images/ok_16x16.gif" height="16" width="16" border="0" alt="Yes" title="Yes" /><cfelse><img src="./images/delete.gif" height="16" width="16" border="0" alt="No" title="No" /></cfif></td>
<td>#description#</td>
</tr>
<cfif isNumeric(rate)>
<cfset totalComMSFee = totalComMSFee + rate>
</cfif>
</cfif>
</cfloop>
</tbody>
<tfoot>
<tr class="last">
<td class="tar b" colspan="4">TOTAL FEE: </td>
<td class="b">$#NumberFormat(totalComMSFee,"0")#</td>
<td colspan="5"> </td>
</tr>
</tfoot>
</table>
</fieldset>
</cfif>
<cfset showTimelines = false>
<cfloop query="timelines">
<cfif not showTimelines and isNumeric(rate)>
<cfset showTimelines = true>
</cfif>
</cfloop>
<cfif timelines.recordCount and showTimelines>
<fieldset class="bill">
<legend>Hourly Billing</legend>
<table class="clean full" id="time">
<thead>
<tr>
<th class="first">Date</th>
<th>Project</th>
<th>Person</th>
<th>Hours</th>
<th>Billing Category</th>
<th>Fee</th>
<th class="tac">Billed</th>
<th class="tac">Paid</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<cfloop query="timelines">
<cfif isNumeric(rate)>
<cfset thisUserID = userid>
<tr id="r#timetrackid#">
<td class="first">#LSDateFormat(dateStamp,"mmm d, yyyy")#</td>
<td>#name#</td>
<td>#firstName# #lastName#</td>
<td class="b">#numberFormat(hours,"0.00")#</td>
<td>#category#<cfif compare(category,'')> ($#NumberFormat(rate,"0")#/hr)</cfif></td>
<td><cfif isNumeric(rate)>$#NumberFormat(rate*hours,"0")#</cfif></td>
<td class="tac"><cfif billed eq 1><img src="./images/ok_16x16.gif" height="16" width="16" border="0" alt="Yes" title="Yes" /><cfelse><img src="./images/delete.gif" height="16" width="16" border="0" alt="No" title="No" /></cfif></td>
<td class="tac"><cfif paid eq 1><img src="./images/ok_16x16.gif" height="16" width="16" border="0" alt="Yes" title="Yes" /><cfelse><img src="./images/delete.gif" height="16" width="16" border="0" alt="No" title="No" /></cfif></td>
<td><cfif compare(itemType,'')><span class="catbox #itemtype#">#itemtype#</span> <a href="todos.cfm?p=#projectID###id_#replace(todolistID,'-','','all')#">#task#</a><cfif compare(description,'')> - </cfif></cfif>#description#</td>
</tr>
<cfset totalHours = totalHours + hours>
<cfif isNumeric(rate)>
<cfset totalFee = totalFee + (rate*hours)>
</cfif>
</cfif>
</cfloop>
</tbody>
<tfoot>
<tr class="last">
<td colspan="3" class="tar b">TOTAL: </td>
<td class="b"><span id="totalhours">#NumberFormat(totalHours,"0.00")#</span></td>
<td class="tar b">TOTAL FEE: </td>
<td class="b">$#NumberFormat(totalFee,"0")#</td>
<td colspan="3"> </td>
</tr>
</tfoot>
</table>
</fieldset>
</cfif>
<cfif milestones_incomplete.recordCount eq 0 and milestones_completed.recordCount eq 0 and (timelines.recordCount eq 0 or not showTimelines)>
<div class="warn">No billing information is available<cfif compare(session.assignedTo,'')> for this user</cfif>.</div>
</cfif>
</div>
</div>
</div>
<div class="bottom"> </div>
<div class="footer">
<cfinclude template="footer.cfm">
</div>
</div>
<!--- right column --->
<div class="right">
<cfif compare(application.settings.company_logo,'')>
<img src="#application.settings.userFilesMapping#/company/#application.settings.company_logo#" border="0" alt="#application.settings.company_name#" /><br />
</cfif>
<form action="#cgi.script_name#" method="post">
<div class="b">Show billing for:</div>
<select name="assignedTo" onchange="this.form.submit();">
<option value="">Anyone</option>
<option value="#session.user.userid#"<cfif not compare(session.assignedTo,session.user.userID)> selected="selected"</cfif>>Me (#session.user.firstName# #session.user.lastName#)</option>
<cfloop query="projectUsers">
<cfif compare(session.user.userid,userID)>
<option value="#userID#"<cfif not compare(session.assignedTo,userID)> selected="selected"</cfif>>#lastName#, #firstName#</option>
</cfif>
</cfloop>
</select>
</form><br />
<h3><a href="editProject.cfm" class="add">Create a new project</a></h3><br />
<cfif active_projects.recordCount>
<div class="header"><h3>Your projects</h3></div>
<div class="content">
<ul>
<cfloop query="active_projects">
<li><a href="project.cfm?p=#projectID#">#name#</a></li>
</cfloop>
</ul>
</div>
</cfif>
<cfif onhold_projects.recordCount>
<div class="header"><h3>On-Hold projects</h3></div>
<div class="content">
<ul>
<cfloop query="onhold_projects">
<li><a href="project.cfm?p=#projectID#">#name#</a></li>
</cfloop>
</ul>
</div>
</cfif>
<cfif arch_projects.recordCount>
<div class="header"><h3>Archived projects</h3></div>
<div class="content">
<ul>
<cfloop query="arch_projects">
<li><a href="project.cfm?p=#projectID#">#name#</a></li>
</cfloop>
</ul>
</div>
</cfif>
</div>
</div>
</cfoutput>
</cfmodule>
<cfsetting enablecfoutputonly="false">