forked from joedanz/cf-project-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvoice_detail.cfm
137 lines (133 loc) · 4.28 KB
/
invoice_detail.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
<cfsetting enablecfoutputonly="true">
<cfprocessingdirective pageencoding="utf-8">
<!---
Filename: invoice_project.cfm
Designers: Emilie McGregor
Created: 1/29/2009 11:19:52 AM
Description: Main invoice templated included in both invoice.cfm and invoicePDF.cfm
--->
<cfset timelines = application.timetrack.get(projectID=projectID,userID=form.u,startDate=form.startDate,endDate=form.endDate) />
<cfoutput>
<br/>
<h4>#name# - Work Breakdown</h4>
<br/>
<cfif timelines.RecordCount>
<cfset totalHours = 0>
<cfset totalAmount = 0>
<table class="clean full" id="time" style="border-top:2px solid ##000;">
<cfswitch expression="#invoiceType#">
<cfcase value="date">
<cfquery name="timelinesByDate" dbtype="query">
SELECT SUM(CAST(hours as DECIMAL)) as hours, dateStamp
FROM timelines
GROUP BY dateStamp
</cfquery>
<thead>
<tr>
<th class="first" style="width:88%;">Date</th>
<th class="tar">Hours</th>
</tr>
</thead>
<tbody>
<cfloop query="timelinesByDate">
<tr>
<td class="first">#LSDateFormat(dateStamp,"mmm d, yyyy")#</td>
<td class="tar b">#numberFormat(hours,"0.00")#</td>
</tr>
<cfset totalHours = totalHours + hours>
</cfloop>
</tbody>
<tfoot>
<tr class="last">
<td class="first tar b">TOTAL:</td>
<td class="tar b"><span id="totalhours">#NumberFormat(totalHours,"0.00")#</span></td>
</tr>
</tfoot>
</cfcase>
<cfcase value="category">
<cfquery name="timelinesByCategory" dbtype="query">
SELECT SUM(CAST(hours as DECIMAL)) as hours, category
FROM timelines
GROUP BY category
</cfquery>
<thead>
<tr>
<th class="first" style="width:88%;">Category</th>
<th class="tar">Hours</th>
</tr>
</thead>
<tbody>
<cfloop query="timelinesByCategory">
<tr>
<td class="first">
<cfif category IS NOT "">#category#
<cfelse>
Unfiled
</cfif>
</td>
<td class="tar b">#numberFormat(hours,"0.00")#</td>
</tr>
<cfset totalHours = totalHours + hours>
</cfloop>
</tbody>
<tfoot>
<tr class="last">
<td class="tar b">TOTAL:</td>
<td class="tar b"><span id="totalhours">#NumberFormat(totalHours,"0.00")#</span></td>
</tr>
</tfoot>
</cfcase>
<cfcase value="full">
<thead>
<tr>
<th class="first" style="width:15%;">Date</th>
<th style="width:15%;">Category</th>
<th style="width:50%;">Description</th>
<th style="width:10%;" class="tar">Rate</th>
<th style="width:10%;" class="tar">Hours</th>
</tr>
</thead>
<tbody>
<cfloop query="timelines">
<tr>
<td class="first">#LSDateFormat(dateStamp,"mmm d, yyyy")#</td>
<td>
<cfif compare(category,'')>
#category#
<cfelse>
Unassigned
</cfif>
</td>
<td>
<cfif compare(itemType,'')><span class="catbox #itemtype#">#itemtype#</span>
<cfswitch expression="#itemType#">
<cfcase value="todo,to-do">
<a href="todos.cfm?p=#projectID###id_#replace(todolistID,'-','','all')#">#task#</a>
</cfcase>
<cfcase value="issue">
<a href="issue.cfm?p=#projectID#&i=#itemID#"> #issue#</a>
</cfcase>
</cfswitch>
</cfif>#description#</td>
<td class="tar">#numberFormat(hours,"0.00")#</td>
<td class="tar"><cfif compare(category,'')>#LSCurrencyFormat(rate)#<cfelse>$0.00</cfif></td>
</tr>
<cfset totalHours = totalHours + hours>
<cfif compare(category,'')><cfset totalAmount = totalAmount + (rate * hours)></cfif>
</cfloop>
</tbody>
<tfoot>
<tr class="last">
<td colspan="3" class="tar b">TOTALS:</td>
<td class="b tar"><span id="totalhours">#NumberFormat(totalHours,"0.00")#</span></td>
<td class="b tar"><span id="totalamount">#LSCurrencyFormat(totalAmount)#</span></td>
</tr>
</tfoot>
</cfcase>
</cfswitch>
</table>
<cfelse>
<div class="alert">No detail records found for that <cfif StructKeyExists(form,"startDay")>period<cfelse>project</cfif>.</div><br/>
</cfif>
</cfoutput>
<cfsetting enablecfoutputonly="false">