ddea591af492afc3519c35b6ee01150b435ae1ae
[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('chcost')}<td class="tableHeaderCentered" width="5%">{$i18n.label.cost}</td>{/if}
20       </tr>
21   {foreach $subtotals as $subtotal}
22       <tr class="rowReportSubtotal">
23         <td class="cellLeftAlignedSubtotal">{if $subtotal['name']}{$subtotal['name']|escape}{else}&nbsp;{/if}</td>
24         {if $bean->getAttribute('chduration')}<td class="cellRightAlignedSubtotal">{$subtotal['time']}</td>{/if}
25         {if $bean->getAttribute('chcost')}<td class="cellRightAlignedSubtotal">{if $user->can('manage_invoices') || $user->isClient()}{$subtotal['cost']}{else}{$subtotal['expenses']}{/if}</td>{/if}
26       </tr>
27   {/foreach}
28       <!-- print totals -->
29       <tr><td>&nbsp;</td></tr>
30       <tr class="rowReportSubtotal">
31         <td class="cellLeftAlignedSubtotal">{$i18n.label.total}</td>
32         {if $bean->getAttribute('chduration')}<td nowrap class="cellRightAlignedSubtotal">{$totals['time']}</td>{/if}
33         {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}
34       </tr>
35 {else}
36 <!-- normal report -->
37       <tr>
38         <td class="tableHeader">{$i18n.label.date}</td>
39   {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td class="tableHeader">{$i18n.label.user}</td>{/if}
40   {if $bean->getAttribute('chclient')}<td class="tableHeader">{$i18n.label.client}</td>{/if}
41   {if $bean->getAttribute('chproject')}<td class="tableHeader">{$i18n.label.project}</td>{/if}
42   {if $bean->getAttribute('chtask')}<td class="tableHeader">{$i18n.label.task}</td>{/if}
43   {if $bean->getAttribute('chcf_1')}<td class="tableHeader">{$custom_fields->fields[0]['label']|escape}</td>{/if}
44   {if $bean->getAttribute('chstart')}<td class="tableHeaderCentered" width="5%">{$i18n.label.start}</td>{/if}
45   {if $bean->getAttribute('chfinish')}<td class="tableHeaderCentered" width="5%">{$i18n.label.finish}</td>{/if}
46   {if $bean->getAttribute('chduration')}<td class="tableHeaderCentered" width="5%">{$i18n.label.duration}</td>{/if}
47   {if $bean->getAttribute('chnote')}<td class="tableHeader">{$i18n.label.note}</td>{/if}
48   {if $bean->getAttribute('chcost')}<td class="tableHeaderCentered" width="5%">{$i18n.label.cost}</td>{/if}
49   {if $bean->getAttribute('chpaid')}<td class="tableHeader">{$i18n.label.paid}</td>{/if}
50   {if $bean->getAttribute('chip')}<td class="tableHeaderCentered">{$i18n.label.ip}</td>{/if}
51   {if $bean->getAttribute('chinvoice')}<td class="tableHeader">{$i18n.label.invoice}</td>{/if}
52       </tr>
53   {foreach $report_items as $item}
54     <!-- print subtotal for a block of grouped values -->
55     {$cur_date = $item.date}
56     {if $print_subtotals}
57       {$cur_grouped_by = $item.grouped_by}
58       {if $cur_grouped_by != $prev_grouped_by && !$first_pass}
59       <tr class="rowReportSubtotal">
60         <td class="cellLeftAlignedSubtotal">{$i18n.label.subtotal}
61         {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td class="cellLeftAlignedSubtotal">{if $group_by == 'user'}{$subtotals[$prev_grouped_by]['name']|escape}</td>{/if}{/if}
62         {if $bean->getAttribute('chclient')}<td class="cellLeftAlignedSubtotal">{if $group_by == 'client'}{$subtotals[$prev_grouped_by]['name']|escape}</td>{/if}{/if}
63         {if $bean->getAttribute('chproject')}<td class="cellLeftAlignedSubtotal">{if $group_by == 'project'}{$subtotals[$prev_grouped_by]['name']|escape}</td>{/if}{/if}
64         {if $bean->getAttribute('chtask')}<td class="cellLeftAlignedSubtotal">{if $group_by == 'task'}{$subtotals[$prev_grouped_by]['name']|escape}</td>{/if}{/if}
65         {if $bean->getAttribute('chcf_1')}<td class="cellLeftAlignedSubtotal">{if $group_by == 'cf_1'}{$subtotals[$prev_grouped_by]['name']|escape}</td>{/if}{/if}
66         {if $bean->getAttribute('chstart')}<td></td>{/if}
67         {if $bean->getAttribute('chfinish')}<td></td>{/if}
68         {if $bean->getAttribute('chduration')}<td class="cellRightAlignedSubtotal">{$subtotals[$prev_grouped_by]['time']}</td>{/if}
69         {if $bean->getAttribute('chnote')}<td></td>{/if}
70         {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}
71         {if $bean->getAttribute('chpaid')}<td></td>{/if}
72         {if $bean->getAttribute('chip')}<td></td>{/if}
73         {if $bean->getAttribute('chinvoice')}<td></td>{/if}
74         {if $use_checkboxes}<td></td>{/if}
75       </tr>
76       <tr><td>&nbsp;</td></tr>
77       {/if}
78     {$first_pass = false}
79     {/if}
80       <!--  print regular row --> 
81       {if $cur_date != $prev_date}
82         {if $report_row_class == 'rowReportItem'} {$report_row_class = 'rowReportItemAlt'} {else} {$report_row_class = 'rowReportItem'} {/if}
83       {/if}
84       <tr class="{$report_row_class}">
85         <td class="cellLeftAligned">{$item.date}</td>
86     {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td class="cellLeftAligned">{$item.user|escape}</td>{/if}
87     {if $bean->getAttribute('chclient')}<td class="cellLeftAligned">{$item.client|escape}</td>{/if}
88     {if $bean->getAttribute('chproject')}<td class="cellLeftAligned">{$item.project|escape}</td>{/if}
89     {if $bean->getAttribute('chtask')}<td class="cellLeftAligned">{$item.task|escape}</td>{/if}
90     {if $bean->getAttribute('chcf_1')}<td class="cellLeftAligned">{$item.cf_1|escape}</td>{/if}
91     {if $bean->getAttribute('chstart')}<td nowrap class="cellRightAligned">{$item.start}</td>{/if}
92     {if $bean->getAttribute('chfinish')}<td nowrap class="cellRightAligned">{$item.finish}</td>{/if}
93     {if $bean->getAttribute('chduration')}<td class="cellRightAligned">{$item.duration}</td>{/if}
94     {if $bean->getAttribute('chnote')}<td class="cellLeftAligned">{$item.note|escape}</td>{/if}
95     {if $bean->getAttribute('chcost')}<td class="cellRightAligned">{if $user->can('manage_invoices') || $user->isClient()}{$item.cost}{else}{$item.expense}{/if}</td>{/if}
96     {if $bean->getAttribute('chpaid')}<td class="cellRightAligned">{if $item.paid == 1}{$i18n.label.yes}{else}{$i18n.label.no}{/if}{/if}
97     {if $bean->getAttribute('chip')}<td class="cellRightAligned">{if $item.modified}{$item.modified_ip} {$item.modified}{else}{$item.created_ip} {$item.created}{/if}{/if}
98     {if $bean->getAttribute('chinvoice')}<td class="cellRightAligned">{$item.invoice|escape}</td>{/if}
99     {if $use_checkboxes}
100       {if 1 == $item.type}<td bgcolor="white"><input type="checkbox" name="log_id_{$item.id}"></td>{/if}
101       {if 2 == $item.type}<td bgcolor="white"><input type="checkbox" name="item_id_{$item.id}"></td>{/if}
102     {/if}
103       </tr>
104     {$prev_date = $item.date}
105     {if $print_subtotals} {$prev_grouped_by = $item.grouped_by} {/if}
106   {/foreach}
107   <!-- print a terminating subtotal -->
108   {if $print_subtotals}
109       <tr class="rowReportSubtotal">
110         <td class="cellLeftAlignedSubtotal">{$i18n.label.subtotal}
111     {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td class="cellLeftAlignedSubtotal">{if $group_by == 'user'}{$subtotals[$cur_grouped_by]['name']|escape}</td>{/if}{/if}
112     {if $bean->getAttribute('chclient')}<td class="cellLeftAlignedSubtotal">{if $group_by == 'client'}{$subtotals[$cur_grouped_by]['name']|escape}</td>{/if}{/if}
113     {if $bean->getAttribute('chproject')}<td class="cellLeftAlignedSubtotal">{if $group_by == 'project'}{$subtotals[$cur_grouped_by]['name']|escape}</td>{/if}{/if}
114     {if $bean->getAttribute('chtask')}<td class="cellLeftAlignedSubtotal">{if $group_by == 'task'}{$subtotals[$cur_grouped_by]['name']|escape}</td>{/if}{/if}
115     {if $bean->getAttribute('chcf_1')}<td class="cellLeftAlignedSubtotal">{if $group_by == 'cf_1'}{$subtotals[$cur_grouped_by]['name']|escape}</td>{/if}{/if}
116     {if $bean->getAttribute('chstart')}<td></td>{/if}
117     {if $bean->getAttribute('chfinish')}<td></td>{/if}
118     {if $bean->getAttribute('chduration')}<td class="cellRightAlignedSubtotal">{$subtotals[$cur_grouped_by]['time']}</td>{/if}
119     {if $bean->getAttribute('chnote')}<td></td>{/if}
120     {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}
121     {if $bean->getAttribute('chpaid')}<td></td>{/if}
122     {if $bean->getAttribute('chip')}<td></td>{/if}
123     {if $bean->getAttribute('chinvoice')}<td></td>{/if}
124     {if $use_checkboxes}<td></td>{/if}
125       </tr>
126   {/if}
127   <!-- print totals -->
128       <tr><td>&nbsp;</td></tr>
129       <tr class="rowReportSubtotal">
130         <td class="cellLeftAlignedSubtotal">{$i18n.label.total}</td>
131     {if $user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()}<td></td>{/if}
132     {if $bean->getAttribute('chclient')}<td></td>{/if}
133     {if $bean->getAttribute('chproject')}<td></td>{/if}
134     {if $bean->getAttribute('chtask')}<td></td>{/if}
135     {if $bean->getAttribute('chcf_1')}<td></td>{/if}
136     {if $bean->getAttribute('chstart')}<td></td>{/if}
137     {if $bean->getAttribute('chfinish')}<td></td>{/if}
138     {if $bean->getAttribute('chduration')}<td class="cellRightAlignedSubtotal">{$totals['time']}</td>{/if}
139     {if $bean->getAttribute('chnote')}<td></td>{/if}
140     {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}
141     {if $bean->getAttribute('chpaid')}<td></td>{/if}
142     {if $bean->getAttribute('chip')}<td></td>{/if}
143     {if $bean->getAttribute('chinvoice')}<td></td>{/if}
144     {if $use_checkboxes}<td></td>{/if}
145       </tr>
146 {/if}
147     </table>
148   </td>
149 </tr>
150 </table>
151 {if $report_items && ($use_mark_paid || $use_assign_to_invoice)}
152 <table width="720" cellspacing="0" cellpadding="0" border="0">
153   {if $use_mark_paid}
154   <tr>
155     <td align="right">
156       <table>
157         <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>
158       </table>
159     </td>
160   </tr>
161   {/if}
162   {if $use_assign_to_invoice}
163   <tr>
164     <td align="right">
165       <table>
166         <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>
167       </table>
168     </td>
169   </tr>
170   {/if}
171 </table>
172 {/if}
173 {$forms.reportForm.close}
174
175 <table width="720" cellspacing="4" cellpadding="4" border="0">
176 <tr>
177   <td align="center">
178   <table>
179   <tr>
180     <td><input type="button" onclick="chLocation('report_send.php');" value="{$i18n.button.send_by_email}"></td>
181   </tr>
182   </table>
183   </td>
184 </tr>
185 </table>