forked from joedanz/cf-project-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbilling.cfm
217 lines (195 loc) · 7.5 KB
/
billing.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
<cfsetting enablecfoutputonly="true">
<cfprocessingdirective pageencoding="utf-8">
<cfif not StructKeyExists(url,'p')>
<cfoutput><h2>No Project Selected!</h2></cfoutput><cfabort>
</cfif>
<cfif session.user.admin>
<cfset project = application.project.get(projectID=url.p)>
<cfelse>
<cfset project = application.project.get(session.user.userid,url.p)>
</cfif>
<cfif not session.user.admin and not project.bill_view eq 1>
<cfoutput><h2>You do not have permission to access billing!!!</h2></cfoutput>
<cfabort>
</cfif>
<cfset projectUsers = application.project.projectUsers(url.p,'0','firstName, lastName')>
<cfset milestones_completed = application.milestone.get(projectID=url.p,withRate=true,type='completed')>
<cfset milestones_incomplete = application.milestone.get(projectID=url.p,withRate=true,type='incomplete')>
<cfset timelines = application.timetrack.get(projectID=url.p)>
<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="#project.name# » Billing" project="#project.name#" projectid="#url.p#" svnurl="#project.svnurl#">
<cfhtmlhead text="<script type='text/javascript'>
$(document).ready(function(){
$('.date-pick').datepicker();
});
</script>">
<cfoutput>
<div id="container">
<cfif project.recordCount>
<!--- left column --->
<div class="left full">
<div class="main">
<div class="header">
<h2 class="bill">Billing</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>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>#name#</td>
<td>#firstName# #lastName#</td>
<td>$#NumberFormat(rate,"0")#</td>
<td class="tac"><input type="checkbox" id="b_#milestoneid#" value="1"<cfif billed eq 1> checked="checked"</cfif> onclick="set_bill('#milestoneID#','milestone','b_');" /></td>
<td class="tac"><input type="checkbox" id="p_#milestoneid#" value="1"<cfif paid eq 1> checked="checked"</cfif> onclick="set_bill('#milestoneID#','milestone','p_');" /></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="3">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>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>#name#</td>
<td>#firstName# #lastName#</td>
<td>$#NumberFormat(rate,"0")#</td>
<td class="tac"><input type="checkbox" id="b_#milestoneid#" value="1"<cfif billed eq 1> checked="checked"</cfif> onclick="set_bill('#milestoneID#','milestone','b_');" /></td>
<td class="tac"><input type="checkbox" id="p_#milestoneid#" value="1"<cfif paid eq 1> checked="checked"</cfif> onclick="set_bill('#milestoneid#','milestone','b_');" /></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="3">TOTAL FEE: </td>
<td class="b">$#NumberFormat(totalComMSFee,"0")#</td>
<td colspan="5"> </td>
</tr>
</tfoot>
</table>
</fieldset>
</cfif>
<cfif timelines.recordCount>
<fieldset class="bill">
<legend>Hourly Billing</legend>
<table class="clean full" id="time">
<thead>
<tr>
<th class="first">Date</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>#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")#<cfelse></cfif></td>
<td class="tac"><input type="checkbox" id="b_#timetrackid#" value="1"<cfif billed eq 1> checked="checked"</cfif> onclick="set_bill('#timetrackid#','timetrack','b_');" /></td>
<td class="tac"><input type="checkbox" id="p_#timetrackid#" value="1"<cfif paid eq 1> checked="checked"</cfif> onclick="set_bill('#timetrackid#','timetrack','p_');" /></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="2" 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>
</div>
</div>
</div>
<div class="bottom"> </div>
<div class="footer">
<cfinclude template="footer.cfm">
</div>
</div>
<!--- right column --->
<div class="right">
</div>
<cfelse>
<div class="alert">Project Not Found.</div>
</cfif>
</div>
</cfoutput>
</cfmodule>
<cfsetting enablecfoutputonly="false">