forked from joedanz/cf-project-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimeReport.cfm
191 lines (173 loc) · 7.25 KB
/
timeReport.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
<cfsetting enablecfoutputonly="true">
<cfprocessingdirective pageencoding="utf-8">
<cfparam name="url.p" default="">
<cfparam name="form.u" default="">
<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.timetrack 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')>
<cfif compare(form.u,'')>
<cfset user = application.user.get(form.u)>
</cfif>
<cfif StructKeyExists(form,"startDay")>
<cfset timelines = application.timetrack.get(projectID=url.p,userID=form.u,startDate=CreateDate(form.startYear,form.startMonth,form.startDay),endDate=CreateDate(form.endYear,form.endMonth,form.endDay))>
<cfelse>
<cfset timelines = application.timetrack.get(itemID=url.t)>
</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="time.cfm?p=#url.p#" class="back">Back to full time report</a>
</span>
<h2 class="time">Time Tracking Report</h2>
</div>
<div class="content">
<div class="wrapper">
<cfif StructKeyExists(form,"startDay")>
<h3 class="mb10">
<cfif compare(form.u,'')>#user.firstName# #user.lastName#<cfelse>Everyone</cfif>'s
hours from #Left(MonthAsString(form.startMonth),3)# #form.startDay#, #form.startYear# to
#Left(MonthAsString(form.endMonth),3)# #form.endDay#, #form.endYear#
<span style="font-size:.6em;font-weight:normal;">(<a href="##" onclick="$('##report').slideDown();return false;">Edit This Report</a>)</span>
</h3>
<form action="#cgi.script_name#?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(form.u,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 form.startMonth 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 form.startDay 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 form.startYear eq i> selected="selected"</cfif>>#i#</option>
</cfloop>
</select>
to
<select name="endMonth">
<cfloop from="1" to="12" index="i">
<option value="#i#"<cfif form.endMonth 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 form.endDay 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 form.endYear 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>
<cfelse>
<h3>Time tracking log for #timelines.itemType[1]# item:
<cfswitch expression="#timelines.itemType[1]#">
<cfcase value="todo">#timelines.task[1]#</cfcase>
</cfswitch>
</h3>
</cfif>
<cfif timelines.recordCount>
<table class="clean full" id="time" style="border-top:2px solid ##000;">
<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>
</thead>
<tbody>
<cfloop query="timelines">
<cfset thisUserID = userid>
<tr id="r#replace(timetrackid,'-','','ALL')#">
<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>#category#<cfif compare(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> <a href="todos.cfm?p=#projectID###id_#replace(todolistID,'-','','all')#">#task#</a><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#','','','timereport'); return false;">Edit</a> <a href="##" onclick="delete_time('#projectID#','#timetrackID#','timereport',''); 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_view eq 1)>
<td class="tar b">TOTAL FEE: </td>
<td class="b">$#NumberFormat(totalFee,"0")#</td>
</cfif>
<td colspan="4"> </td>
</tr>
</tfoot>
</table>
<cfelse>
<div class="alert">No time tracking records found for that <cfif StructKeyExists(form,"startDay")>period<cfelse>item</cfif>.</div>
</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">