Work in progress on configurable display options.
[timetracker.git] / WEB-INF / templates / report.tpl
1 <script>
2   function chLocation(newLocation) { document.location = newLocation; }
3 </script>
4
5 {$forms.reportViewForm.open}
6 <table width="720">
7   <td valign="top">
8     <table border="0" cellpadding="3" cellspacing="1" width="100%">
9       <tr>
10         <td valign="top" class="sectionHeaderNoBorder" align="center">{$i18n.form.report.export} {if file_exists('WEB-INF/lib/tcpdf')}<a href="topdf.php">PDF</a>,{/if} <a href="tofile.php?type=xml">XML</a> {$i18n.label.or} <a href="tofile.php?type=csv">CSV</a></td>
11       </tr>
12     </table>
13     <table border="0" cellpadding="3" cellspacing="1" width="100%">
14 <!-- totals only report -->
15 {if $bean->getAttribute('chtotalsonly')}
16       <tr>
17         <td class="tableHeader">{$group_by_header|escape}</td>
18         {if $bean->getAttribute('chduration')}<td class="tableHeaderCentered" width="5%">{$i18n.label.duration}</td>{/if}
19         {if $bean->getAttribute('chunits')}<td class="tableHeaderCentered" width="5%">{$i18n.label.work_units_short}</td>{/if}
20         {if $bean->getAttribute('chcost')}<td class="tableHeaderCentered" width="5%">{$i18n.label.cost}</td>{/if}
21       </tr>
22   {foreach $subtotals as $subtotal}
23       <tr class="rowReportSubtotal">
24         <td class="cellLeftAlignedSubtotal">{if $subtotal['name']}{$subtotal['name']|escape}{else}&nbsp;{/if}</td>
25         {if $bean->getAttribute('chduration')}<td class="cellRightAlignedSubtotal">{$subtotal['time']}</td>{/if}
26         {if $bean->getAttribute('chunits')}<td class="cellRightAlignedSubtotal">{$subtotal['units']}</td>{/if}
27         {if $bean->getAttribute('chcost')}<td class="cellRightAlignedSubtotal">{if $user->can('manage_invoices') || $user->isClient()}{$subtotal['cost']}{else}{$subtotal['expenses']}{/if}</td>{/if}
28       </tr>
29   {/foreach}
30       <!-- print totals -->
31       <tr><td>&nbsp;</td></tr>
32       <tr class="rowReportSubtotal">
33         <td class="cellLeftAlignedSubtotal">{$i18n.label.total}</td>
34         {if $bean->getAttribute('chduration')}<td nowrap class="cellRightAlignedSubtotal">{$totals['time']}</td>{/if}
35         {if $bean->getAttribute('chunits')}<td nowrap class="cellRightAlignedSubtotal">{$totals['units']}</td>{/if}
36         {if $bean->getAttribute('chcost')}<td nowrap class="cellRightAlignedSubtotal">{$user->currency|escape} {if $user->can('manage_invoices') || $user->isClient()}{$totals['cost']}{else}{$totals['expenses']}{/if}</td>{/if}
37       </tr>
38 {else}
39 <!-- normal report -->
40       <tr>
41         <td class="tableHeader">{$i18n.label.date}</td>
42   {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td class="tableHeader">{$i18n.label.user}</td>{/if}
43   {if $bean->getAttribute('chclient')}<td class="tableHeader">{$i18n.label.client}</td>{/if}
44   {if $bean->getAttribute('chproject')}<td class="tableHeader">{$i18n.label.project}</td>{/if}
45   {if $bean->getAttribute('chtask')}<td class="tableHeader">{$i18n.label.task}</td>{/if}
46   {if $bean->getAttribute('chcf_1')}<td class="tableHeader">{$custom_fields->fields[0]['label']|escape}</td>{/if}
47   {if $bean->getAttribute('chstart')}<td class="tableHeaderCentered" width="5%">{$i18n.label.start}</td>{/if}
48   {if $bean->getAttribute('chfinish')}<td class="tableHeaderCentered" width="5%">{$i18n.label.finish}</td>{/if}
49   {if $bean->getAttribute('chduration')}<td class="tableHeaderCentered" width="5%">{$i18n.label.duration}</td>{/if}
50   {if $bean->getAttribute('chunits')}<td class="tableHeaderCentered" width="5%">{$i18n.label.work_units_short}</td>{/if}
51   {if $bean->getAttribute('chnote') && !$note_on_separate_row}<td class="tableHeader">{$i18n.label.note}</td>{/if}
52   {if $bean->getAttribute('chcost')}<td class="tableHeaderCentered" width="5%">{$i18n.label.cost}</td>{/if}
53   {if $bean->getAttribute('chapproved')}<td class="tableHeader">{$i18n.label.approved}</td>{/if}
54   {if $bean->getAttribute('chpaid')}<td class="tableHeader">{$i18n.label.paid}</td>{/if}
55   {if $bean->getAttribute('chip')}<td class="tableHeaderCentered">{$i18n.label.ip}</td>{/if}
56   {if $bean->getAttribute('chinvoice')}<td class="tableHeader">{$i18n.label.invoice}</td>{/if}
57   {if $bean->getAttribute('chtimesheet')}<td class="tableHeader">{$i18n.label.timesheet}</td>{/if}
58   {if $bean->getAttribute('chfiles')}<td></td>{/if}
59       </tr>
60   {foreach $report_items as $item}
61     <!-- print subtotal for a block of grouped values -->
62     {$cur_date = $item.date}
63     {if $print_subtotals}
64       {$cur_grouped_by = $item.grouped_by}
65       {if $cur_grouped_by != $prev_grouped_by && !$first_pass}
66       <tr class="rowReportSubtotal">
67         <td class="cellLeftAlignedSubtotal">{$i18n.label.subtotal}
68         {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td class="cellLeftAlignedSubtotal">{$subtotals[$prev_grouped_by]['user']|escape}</td>{/if}
69         {if $bean->getAttribute('chclient')}<td class="cellLeftAlignedSubtotal">{$subtotals[$prev_grouped_by]['client']|escape}</td>{/if}
70         {if $bean->getAttribute('chproject')}<td class="cellLeftAlignedSubtotal">{$subtotals[$prev_grouped_by]['project']|escape}</td>{/if}
71         {if $bean->getAttribute('chtask')}<td class="cellLeftAlignedSubtotal">{$subtotals[$prev_grouped_by]['task']|escape}</td>{/if}
72         {if $bean->getAttribute('chcf_1')}<td class="cellLeftAlignedSubtotal">{$subtotals[$prev_grouped_by]['cf_1']|escape}</td>{/if}
73         {if $bean->getAttribute('chstart')}<td></td>{/if}
74         {if $bean->getAttribute('chfinish')}<td></td>{/if}
75         {if $bean->getAttribute('chduration')}<td class="cellRightAlignedSubtotal">{$subtotals[$prev_grouped_by]['time']}</td>{/if}
76         {if $bean->getAttribute('chunits')}<td class="cellRightAlignedSubtotal">{$subtotals[$prev_grouped_by]['units']}</td>{/if}
77         {if $bean->getAttribute('chnote') && !$note_on_separate_row}<td></td>{/if}
78         {if $bean->getAttribute('chcost')}<td class="cellRightAlignedSubtotal">{if $user->can('manage_invoices') || $user->isClient()}{$subtotals[$prev_grouped_by]['cost']}{else}{$subtotals[$prev_grouped_by]['expenses']}{/if}</td>{/if}
79         {if $bean->getAttribute('chapproved')}<td></td>{/if}
80         {if $bean->getAttribute('chpaid')}<td></td>{/if}
81         {if $bean->getAttribute('chip')}<td></td>{/if}
82         {if $bean->getAttribute('chinvoice')}<td></td>{/if}
83         {if $bean->getAttribute('chtimesheet')}<td></td>{/if}
84         {if $bean->getAttribute('chfiles')}<td></td>{/if}
85         {if $use_checkboxes}<td></td>{/if}
86       </tr>
87       <tr><td>&nbsp;</td></tr>
88       {/if}
89     {$first_pass = false}
90     {/if}
91       <!--  print regular row --> 
92       {if $cur_date != $prev_date}
93         {if $report_row_class == 'rowReportItem'} {$report_row_class = 'rowReportItemAlt'} {else} {$report_row_class = 'rowReportItem'} {/if}
94       {/if}
95       <tr class="{$report_row_class}">
96         <td class="cellLeftAligned">{$item.date}</td>
97     {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td class="cellLeftAligned">{$item.user|escape}</td>{/if}
98     {if $bean->getAttribute('chclient')}<td class="cellLeftAligned">{$item.client|escape}</td>{/if}
99     {if $bean->getAttribute('chproject')}<td class="cellLeftAligned">{$item.project|escape}</td>{/if}
100     {if $bean->getAttribute('chtask')}<td class="cellLeftAligned">{$item.task|escape}</td>{/if}
101     {if $bean->getAttribute('chcf_1')}<td class="cellLeftAligned">{$item.cf_1|escape}</td>{/if}
102     {if $bean->getAttribute('chstart')}<td nowrap class="cellRightAligned">{$item.start}</td>{/if}
103     {if $bean->getAttribute('chfinish')}<td nowrap class="cellRightAligned">{$item.finish}</td>{/if}
104     {if $bean->getAttribute('chduration')}<td class="cellRightAligned">{$item.duration}</td>{/if}
105     {if $bean->getAttribute('chunits')}<td class="cellRightAligned">{$item.units}</td>{/if}
106     {if $bean->getAttribute('chnote') && !$note_on_separate_row}<td class="cellLeftAligned">{$item.note|escape}</td>{/if}
107     {if $bean->getAttribute('chcost')}<td class="cellRightAligned">{if $user->can('manage_invoices') || $user->isClient()}{$item.cost}{else}{$item.expense}{/if}</td>{/if}
108     {if $bean->getAttribute('chapproved')}<td class="cellRightAligned">{if $item.approved == 1}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td>{/if}
109     {if $bean->getAttribute('chpaid')}<td class="cellRightAligned">{if $item.paid == 1}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td>{/if}
110     {if $bean->getAttribute('chip')}<td class="cellRightAligned">{if $item.modified}{$item.modified_ip} {$item.modified}{else}{$item.created_ip} {$item.created}{/if}</td>{/if}
111     {if $bean->getAttribute('chinvoice')}<td class="cellRightAligned">{$item.invoice|escape}</td>{/if}
112     {if $bean->getAttribute('chtimesheet')}<td class="cellRightAligned">{$item.timesheet_name|escape}</td>{/if}
113     {if $bean->getAttribute('chfiles')}<td class="cellRightAligned">{if $item.has_files}<a href="time_files.php?id={$item.id}"><img class="table_icon" alt="{$i18n.label.files}" src="images/icon_files.png"></a>{/if}</td>{/if}
114     {if $use_checkboxes}
115       {if 1 == $item.type}<td bgcolor="white"><input type="checkbox" name="log_id_{$item.id}"></td>{/if}
116       {if 2 == $item.type}<td bgcolor="white"><input type="checkbox" name="item_id_{$item.id}"></td>{/if}
117     {/if}
118       </tr>
119     {if $note_on_separate_row && $bean->getAttribute('chnote') && $item.note}
120       <tr>
121         <td class="cellRightAligned">{$i18n.label.note}:</td>
122         <td colspan="{$colspan}">{$item.note|escape}</td>
123       </tr>
124     {/if}
125     {$prev_date = $item.date}
126     {if $print_subtotals} {$prev_grouped_by = $item.grouped_by} {/if}
127   {/foreach}
128   <!-- print a terminating subtotal -->
129   {if $print_subtotals}
130       <tr class="rowReportSubtotal">
131         <td class="cellLeftAlignedSubtotal">{$i18n.label.subtotal}
132     {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td class="cellLeftAlignedSubtotal">{$subtotals[$cur_grouped_by]['user']|escape}</td>{/if}
133     {if $bean->getAttribute('chclient')}<td class="cellLeftAlignedSubtotal">{$subtotals[$cur_grouped_by]['client']|escape}</td>{/if}
134     {if $bean->getAttribute('chproject')}<td class="cellLeftAlignedSubtotal">{$subtotals[$cur_grouped_by]['project']|escape}</td>{/if}
135     {if $bean->getAttribute('chtask')}<td class="cellLeftAlignedSubtotal">{$subtotals[$cur_grouped_by]['task']|escape}</td>{/if}
136     {if $bean->getAttribute('chcf_1')}<td class="cellLeftAlignedSubtotal">{$subtotals[$cur_grouped_by]['cf_1']|escape}</td>{/if}
137     {if $bean->getAttribute('chstart')}<td></td>{/if}
138     {if $bean->getAttribute('chfinish')}<td></td>{/if}
139     {if $bean->getAttribute('chduration')}<td class="cellRightAlignedSubtotal">{$subtotals[$cur_grouped_by]['time']}</td>{/if}
140     {if $bean->getAttribute('chunits')}<td class="cellRightAlignedSubtotal">{$subtotals[$cur_grouped_by]['units']}</td>{/if}
141     {if $bean->getAttribute('chnote') && !$note_on_separate_row}<td></td>{/if}
142     {if $bean->getAttribute('chcost')}<td class="cellRightAlignedSubtotal">{if $user->can('manage_invoices') || $user->isClient()}{$subtotals[$cur_grouped_by]['cost']}{else}{$subtotals[$cur_grouped_by]['expenses']}{/if}</td>{/if}
143     {if $bean->getAttribute('chapproved')}<td></td>{/if}
144     {if $bean->getAttribute('chpaid')}<td></td>{/if}
145     {if $bean->getAttribute('chip')}<td></td>{/if}
146     {if $bean->getAttribute('chinvoice')}<td></td>{/if}
147     {if $bean->getAttribute('chtimesheet')}<td></td>{/if}
148     {if $bean->getAttribute('chfiles')}<td></td>{/if}
149     {if $use_checkboxes}<td></td>{/if}
150       </tr>
151   {/if}
152   <!-- print totals -->
153       <tr><td>&nbsp;</td></tr>
154       <tr class="rowReportSubtotal">
155         <td class="cellLeftAlignedSubtotal">{$i18n.label.total}</td>
156     {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td></td>{/if}
157     {if $bean->getAttribute('chclient')}<td></td>{/if}
158     {if $bean->getAttribute('chproject')}<td></td>{/if}
159     {if $bean->getAttribute('chtask')}<td></td>{/if}
160     {if $bean->getAttribute('chcf_1')}<td></td>{/if}
161     {if $bean->getAttribute('chstart')}<td></td>{/if}
162     {if $bean->getAttribute('chfinish')}<td></td>{/if}
163     {if $bean->getAttribute('chduration')}<td class="cellRightAlignedSubtotal">{$totals['time']}</td>{/if}
164     {if $bean->getAttribute('chunits')}<td class="cellRightAlignedSubtotal">{$totals['units']}</td>{/if}
165     {if $bean->getAttribute('chnote') && !$note_on_separate_row}<td></td>{/if}
166     {if $bean->getAttribute('chcost')}<td nowrap class="cellRightAlignedSubtotal">{$user->currency|escape} {if $user->can('manage_invoices') || $user->isClient()}{$totals['cost']}{else}{$totals['expenses']}{/if}</td>{/if}
167     {if $bean->getAttribute('chapproved')}<td></td>{/if}
168     {if $bean->getAttribute('chpaid')}<td></td>{/if}
169     {if $bean->getAttribute('chip')}<td></td>{/if}
170     {if $bean->getAttribute('chinvoice')}<td></td>{/if}
171     {if $bean->getAttribute('chtimesheet')}<td></td>{/if}
172     {if $bean->getAttribute('chfiles')}<td></td>{/if}
173     {if $use_checkboxes}<td></td>{/if}
174       </tr>
175 {/if}
176     </table>
177   </td>
178 </tr>
179 </table>
180 {if $report_items && ($use_mark_approved || $use_mark_paid || $use_assign_to_invoice || $use_assign_to_timesheet)}
181 <table width="720" cellspacing="0" cellpadding="0" border="0">
182   {if $use_mark_approved}
183   <tr>
184     <td align="right">
185       <table>
186         <tr><td>{$i18n.label.mark_approved}: {$forms.reportViewForm.mark_approved_select_options.control} {$forms.reportViewForm.mark_approved_action_options.control} {$forms.reportViewForm.btn_mark_approved.control}</td></tr>
187       </table>
188     </td>
189   </tr>
190   {/if}
191   {if $use_mark_paid}
192   <tr>
193     <td align="right">
194       <table>
195         <tr><td>{$i18n.label.mark_paid}: {$forms.reportViewForm.mark_paid_select_options.control} {$forms.reportViewForm.mark_paid_action_options.control} {$forms.reportViewForm.btn_mark_paid.control}</td></tr>
196       </table>
197     </td>
198   </tr>
199   {/if}
200   {if $use_assign_to_invoice}
201   <tr>
202     <td align="right">
203       <table>
204         <tr><td>{$i18n.form.report.assign_to_invoice}: {$forms.reportViewForm.assign_invoice_select_options.control} {$forms.reportViewForm.recent_invoice.control} {$forms.reportViewForm.btn_assign_invoice.control}</td></tr>
205       </table>
206     </td>
207   </tr>
208   {/if}
209   {if $use_assign_to_timesheet}
210   <tr>
211     <td align="right">
212       <table>
213         <tr><td>{$i18n.form.report.assign_to_timesheet}: {$forms.reportViewForm.assign_timesheet_select_options.control} {$forms.reportViewForm.timesheet.control} {$forms.reportViewForm.btn_assign_timesheet.control}</td></tr>
214       </table>
215     </td>
216   </tr>
217   {/if}
218 </table>
219 {/if}
220 {$forms.reportViewForm.close}
221
222 <table width="720" cellspacing="4" cellpadding="4" border="0">
223 <tr>
224   <td align="center">
225   <table>
226   <tr>
227     <td><input type="button" onclick="chLocation('report_send.php');" value="{$i18n.button.send_by_email}"></td>
228   </tr>
229   </table>
230   </td>
231 </tr>
232 </table>