forked from joedanz/cf-project-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtime.cfm
205 lines (189 loc) · 7.77 KB
/
time.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
<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.time_view eq 1>
<cfoutput><h2>You do not have permission to access time tracking!!!</h2></cfoutput>
<cfabort>
</cfif>
<cfset projectUsers = application.project.projectUsers(url.p,'0','firstName, lastName')>
<cfset timelines = application.timetrack.get(projectID=url.p)>
<cfif project.tab_billing and (session.user.admin or project.bill_edit eq 1)>
<cfset rates = application.client.getRates(clientID=project.clientID,allowDefaultRates=project.allow_def_rates)>
</cfif>
<cfset totalHours = 0>
<cfset totalFee = 0>
<!--- Loads header/footer --->
<cfmodule template="#application.settings.mapping#/tags/layout.cfm" templatename="main" title="#project.name# » Time Tracking" 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">
<span class="rightmenu">
<a href="##" onclick="$('##report').slideDown();return false;" class="report">Create Report</a>
</span>
<h2 class="time">Time Tracking</h2>
</div>
<div class="content">
<div class="wrapper">
<cfif session.user.admin or project.time_edit eq 1>
<form action="timeReport.cfm?p=#url.p#" method="post" class="frm">
<div id="report" class="p10" style="display:none;">
<span class="b">
Show <select name="u">
<option value="">everyone</option>
<cfloop query="projectUsers">
<option value="#userid#"<cfif not compare(session.user.userid,userid)> selected="selected"</cfif>>#firstName# #lastName#</option>
</cfloop>
</select>'s hours from
<select name="startMonth">
<cfloop from="1" to="12" index="i">
<option value="#i#"<cfif Month(Now()) eq i> selected="selected"</cfif>>#Left(MonthAsString(i),3)#</option>
</cfloop>
</select>
<select name="startDay">
<cfloop from="1" to="31" index="i">
<option value="#i#"<cfif Day(Now()) eq i> selected="selected"</cfif>>#i#</option>
</cfloop>
</select>
<select name="startYear">
<cfloop from="#Year(Now())#" to="#Year(Now())-5#" index="i" step="-1">
<option value="#i#"<cfif Year(Now()) eq i> selected="selected"</cfif>>#i#</option>
</cfloop>
</select>
to
<select name="endMonth">
<cfloop from="1" to="12" index="i">
<option value="#i#"<cfif Month(Now()) eq i> selected="selected"</cfif>>#Left(MonthAsString(i),3)#</option>
</cfloop>
</select>
<select name="endDay">
<cfloop from="1" to="31" index="i">
<option value="#i#"<cfif Day(Now()) eq i> selected="selected"</cfif>>#i#</option>
</cfloop>
</select>
<select name="endYear">
<cfloop from="#Year(Now())#" to="#Year(Now())-5#" index="i" step="-1">
<option value="#i#"<cfif Year(Now()) eq i> selected="selected"</cfif>>#i#</option>
</cfloop>
</select>
</span>
<input type="submit" value="Create Report" /> or <a href="##" onclick="$('##report').slideUp();return false;">Cancel</a>
</div>
</form>
</cfif>
<table class="clean full" id="time">
<thead>
<tr>
<th class="first">Date</th>
<th>Person</th>
<th>Hours</th>
<cfif project.tab_billing and (session.user.admin or project.bill_edit eq 1)>
<th>Billing Category</th>
<th>Fee</th>
</cfif>
<th>Description</th>
<cfif session.user.admin or project.time_edit eq 1><th></th></cfif>
</tr>
<cfif session.user.admin or project.time_edit eq 1>
<tr class="input">
<td class="first"><input type="text" name="datestamp" id="datestamp" class="shortest date-pick" /></td>
<td>
<select name="userID" id="userid">
<cfloop query="projectUsers">
<option value="#userid#"<cfif not compare(session.user.userid,userid)> selected="selected"</cfif>>#firstName# #lastName#</option>
</cfloop>
</select>
</td>
<td><input type="text" name="hours" id="hrs" class="tiny" /></td>
<cfif project.tab_billing and (session.user.admin or project.bill_edit eq 1)>
<td>
<select name="rateID" id="rateID">
<option value="">None</option>
<cfloop query="rates">
<option value="#rateID#">#category# ($#NumberFormat(rate,"0")#/hr)</option>
</cfloop>
</select>
</td>
<td> </td>
<cfelse>
<input type="hidden" name="rateID" id="rateID" value="" />
</cfif>
<td><input type="text" name="description" id="desc" class="short" /></td>
<td class="tac"><input type="submit" value="Add to log" onclick="add_time_row('#url.p#','','','time');" /></td>
</tr>
</cfif>
</thead>
<tbody>
<cfloop query="timelines">
<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>
<cfif project.tab_billing and (session.user.admin or project.bill_view eq 1)>
<td><cfif compare(rateID,'')>#category# ($#NumberFormat(rate,"0")#/hr)</cfif></td>
<td><cfif isNumeric(rate)>$#NumberFormat(rate*hours,"0")#</cfif></td>
</cfif>
<td><cfif compare(itemType,'')><span class="catbox #itemtype#">#itemtype#</span>
<cfswitch expression="#itemtype#">
<cfcase value="issue"><a href="issue.cfm?p=#projectID#&i=#itemID#">#shortID#</a></cfcase>
<cfcase value="todo"><a href="todos.cfm?p=#projectID###id_#replace(todolistID,'-','','all')#">#task#</a></cfcase>
</cfswitch>
<cfif compare(description,'')> - </cfif>
</cfif>
#description#</td>
<cfif session.user.admin or project.time_edit eq 1>
<td class="tac"><a href="##" onclick="edit_time_row('#projectid#','#timetrackid#','#project.tab_billing#','#project.bill_edit#','#project.clientID#','','','time'); return false;">Edit</a> <a href="##" onclick="delete_time('#projectID#','#timetrackID#','time',''); return false;" class="delete"></a></td>
</cfif>
</tr>
<cfset totalHours = totalHours + hours>
<cfif isNumeric(rate)>
<cfset totalFee = totalFee + (rate*hours)>
</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>
<cfif project.tab_billing and (session.user.admin or project.bill_edit eq 1)>
<td class="tar b">TOTAL FEE: </td>
<td class="b"><span id="totalrate">$#NumberFormat(totalFee,"0")#</span></td>
</cfif>
<td colspan="4"> </td>
</tr>
</tfoot>
</table>
</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">