Some refactoring and cleanup in ttRegistrator class.
[timetracker.git] / WEB-INF / templates / report.tpl
1 <script>
2   function chLocation(newLocation) { document.location = newLocation; }
3 </script>
4
5 {$forms.reportForm.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')}<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('chpaid')}<td class="tableHeader">{$i18n.label.paid}</td>{/if}
54   {if $bean->getAttribute('chip')}<td class="tableHeaderCentered">{$i18n.label.ip}</td>{/if}
55   {if $bean->getAttribute('chinvoice')}<td class="tableHeader">{$i18n.label.invoice}</td>{/if}
56       </tr>
57   {foreach $report_items as $item}
58     <!-- print subtotal for a block of grouped values -->
59     {$cur_date = $item.date}
60     {if $print_subtotals}
61       {$cur_grouped_by = $item.grouped_by}
62       {if $cur_grouped_by != $prev_grouped_by && !$first_pass}
63       <tr class="rowReportSubtotal">
64         <td class="cellLeftAlignedSubtotal">{$i18n.label.subtotal}
65         {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td class="cellLeftAlignedSubtotal">{$subtotals[$prev_grouped_by]['user']|escape}</td>{/if}
66         {if $bean->getAttribute('chclient')}<td class="cellLeftAlignedSubtotal">{$subtotals[$prev_grouped_by]['client']|escape}</td>{/if}
67         {if $bean->getAttribute('chproject')}<td class="cellLeftAlignedSubtotal">{$subtotals[$prev_grouped_by]['project']|escape}</td>{/if}
68         {if $bean->getAttribute('chtask')}<td class="cellLeftAlignedSubtotal">{$subtotals[$prev_grouped_by]['task']|escape}</td>{/if}
69         {if $bean->getAttribute('chcf_1')}<td class="cellLeftAlignedSubtotal">{$subtotals[$prev_grouped_by]['cf_1']|escape}</td>{/if}
70         {if $bean->getAttribute('chstart')}<td></td>{/if}
71         {if $bean->getAttribute('chfinish')}<td></td>{/if}
72         {if $bean->getAttribute('chduration')}<td class="cellRightAlignedSubtotal">{$subtotals[$prev_grouped_by]['time']}</td>{/if}
73         {if $bean->getAttribute('chunits')}<td class="cellRightAlignedSubtotal">{$subtotals[$prev_grouped_by]['units']}</td>{/if}
74         {if $bean->getAttribute('chnote')}<td></td>{/if}
75         {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}
76         {if $bean->getAttribute('chpaid')}<td></td>{/if}
77         {if $bean->getAttribute('chip')}<td></td>{/if}
78         {if $bean->getAttribute('chinvoice')}<td></td>{/if}
79         {if $use_checkboxes}<td></td>{/if}
80       </tr>
81       <tr><td>&nbsp;</td></tr>
82       {/if}
83     {$first_pass = false}
84     {/if}
85       <!--  print regular row --> 
86       {if $cur_date != $prev_date}
87         {if $report_row_class == 'rowReportItem'} {$report_row_class = 'rowReportItemAlt'} {else} {$report_row_class = 'rowReportItem'} {/if}
88       {/if}
89       <tr class="{$report_row_class}">
90         <td class="cellLeftAligned">{$item.date}</td>
91     {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td class="cellLeftAligned">{$item.user|escape}</td>{/if}
92     {if $bean->getAttribute('chclient')}<td class="cellLeftAligned">{$item.client|escape}</td>{/if}
93     {if $bean->getAttribute('chproject')}<td class="cellLeftAligned">{$item.project|escape}</td>{/if}
94     {if $bean->getAttribute('chtask')}<td class="cellLeftAligned">{$item.task|escape}</td>{/if}
95     {if $bean->getAttribute('chcf_1')}<td class="cellLeftAligned">{$item.cf_1|escape}</td>{/if}
96     {if $bean->getAttribute('chstart')}<td nowrap class="cellRightAligned">{$item.start}</td>{/if}
97     {if $bean->getAttribute('chfinish')}<td nowrap class="cellRightAligned">{$item.finish}</td>{/if}
98     {if $bean->getAttribute('chduration')}<td class="cellRightAligned">{$item.duration}</td>{/if}
99     {if $bean->getAttribute('chunits')}<td class="cellRightAligned">{$item.units}</td>{/if}
100     {if $bean->getAttribute('chnote')}<td class="cellLeftAligned">{$item.note|escape}</td>{/if}
101     {if $bean->getAttribute('chcost')}<td class="cellRightAligned">{if $user->can('manage_invoices') || $user->isClient()}{$item.cost}{else}{$item.expense}{/if}</td>{/if}
102     {if $bean->getAttribute('chpaid')}<td class="cellRightAligned">{if $item.paid == 1}{$i18n.label.yes}{else}{$i18n.label.no}{/if}{/if}
103     {if $bean->getAttribute('chip')}<td class="cellRightAligned">{if $item.modified}{$item.modified_ip} {$item.modified}{else}{$item.created_ip} {$item.created}{/if}{/if}
104     {if $bean->getAttribute('chinvoice')}<td class="cellRightAligned">{$item.invoice|escape}</td>{/if}
105     {if $use_checkboxes}
106       {if 1 == $item.type}<td bgcolor="white"><input type="checkbox" name="log_id_{$item.id}"></td>{/if}
107       {if 2 == $item.type}<td bgcolor="white"><input type="checkbox" name="item_id_{$item.id}"></td>{/if}
108     {/if}
109       </tr>
110     {$prev_date = $item.date}
111     {if $print_subtotals} {$prev_grouped_by = $item.grouped_by} {/if}
112   {/foreach}
113   <!-- print a terminating subtotal -->
114   {if $print_subtotals}
115       <tr class="rowReportSubtotal">
116         <td class="cellLeftAlignedSubtotal">{$i18n.label.subtotal}
117     {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td class="cellLeftAlignedSubtotal">{$subtotals[$cur_grouped_by]['user']|escape}</td>{/if}
118     {if $bean->getAttribute('chclient')}<td class="cellLeftAlignedSubtotal">{$subtotals[$cur_grouped_by]['client']|escape}</td>{/if}
119     {if $bean->getAttribute('chproject')}<td class="cellLeftAlignedSubtotal">{$subtotals[$cur_grouped_by]['project']|escape}</td>{/if}
120     {if $bean->getAttribute('chtask')}<td class="cellLeftAlignedSubtotal">{$subtotals[$cur_grouped_by]['task']|escape}</td>{/if}
121     {if $bean->getAttribute('chcf_1')}<td class="cellLeftAlignedSubtotal">{$subtotals[$cur_grouped_by]['cf_1']|escape}</td>{/if}
122     {if $bean->getAttribute('chstart')}<td></td>{/if}
123     {if $bean->getAttribute('chfinish')}<td></td>{/if}
124     {if $bean->getAttribute('chduration')}<td class="cellRightAlignedSubtotal">{$subtotals[$cur_grouped_by]['time']}</td>{/if}
125     {if $bean->getAttribute('chunits')}<td class="cellRightAlignedSubtotal">{$subtotals[$cur_grouped_by]['units']}</td>{/if}
126     {if $bean->getAttribute('chnote')}<td></td>{/if}
127     {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}
128     {if $bean->getAttribute('chpaid')}<td></td>{/if}
129     {if $bean->getAttribute('chip')}<td></td>{/if}
130     {if $bean->getAttribute('chinvoice')}<td></td>{/if}
131     {if $use_checkboxes}<td></td>{/if}
132       </tr>
133   {/if}
134   <!-- print totals -->
135       <tr><td>&nbsp;</td></tr>
136       <tr class="rowReportSubtotal">
137         <td class="cellLeftAlignedSubtotal">{$i18n.label.total}</td>
138     {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td></td>{/if}
139     {if $bean->getAttribute('chclient')}<td></td>{/if}
140     {if $bean->getAttribute('chproject')}<td></td>{/if}
141     {if $bean->getAttribute('chtask')}<td></td>{/if}
142     {if $bean->getAttribute('chcf_1')}<td></td>{/if}
143     {if $bean->getAttribute('chstart')}<td></td>{/if}
144     {if $bean->getAttribute('chfinish')}<td></td>{/if}
145     {if $bean->getAttribute('chduration')}<td class="cellRightAlignedSubtotal">{$totals['time']}</td>{/if}
146     {if $bean->getAttribute('chunits')}<td class="cellRightAlignedSubtotal">{$totals['units']}</td>{/if}
147     {if $bean->getAttribute('chnote')}<td></td>{/if}
148     {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}
149     {if $bean->getAttribute('chpaid')}<td></td>{/if}
150     {if $bean->getAttribute('chip')}<td></td>{/if}
151     {if $bean->getAttribute('chinvoice')}<td></td>{/if}
152     {if $use_checkboxes}<td></td>{/if}
153       </tr>
154 {/if}
155     </table>
156   </td>
157 </tr>
158 </table>
159 {if $report_items && ($use_mark_paid || $use_assign_to_invoice)}
160 <table width="720" cellspacing="0" cellpadding="0" border="0">
161   {if $use_mark_paid}
162   <tr>
163     <td align="right">
164       <table>
165         <tr><td>{$i18n.label.mark_paid}: {$forms.reportForm.mark_paid_select_options.control} {$forms.reportForm.mark_paid_action_options.control} {$forms.reportForm.btn_mark_paid.control}</td></tr>
166       </table>
167     </td>
168   </tr>
169   {/if}
170   {if $use_assign_to_invoice}
171   <tr>
172     <td align="right">
173       <table>
174         <tr><td>{$i18n.form.report.assign_to_invoice}: {$forms.reportForm.assign_invoice_select_options.control} {$forms.reportForm.recent_invoice.control} {$forms.reportForm.btn_assign.control}</td></tr>
175       </table>
176     </td>
177   </tr>
178   {/if}
179 </table>
180 {/if}
181 {$forms.reportForm.close}
182
183 <table width="720" cellspacing="4" cellpadding="4" border="0">
184 <tr>
185   <td align="center">
186   <table>
187   <tr>
188     <td><input type="button" onclick="chLocation('report_send.php');" value="{$i18n.button.send_by_email}"></td>
189   </tr>
190   </table>
191   </td>
192 </tr>
193 </table>