Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / yearend / _charts.html
1 [%- USE LxERP -%]
2 [%- USE T8    -%]
3 [%- USE L     -%]
4 [%- USE HTML  -%]
5 [%- USE P     -%]
6
7
8 [%- SET dec = 2 %]
9
10 <h2>[% 'Balance accounts' | $T8 %]</h2>
11 <table cellpadding="3px">
12  <tr class="listheading">
13   <th            >[%- 'Account'          | $T8 %]</th>
14   <th            >[%- 'Description'      | $T8 %]</th>
15   <th colspan="2">[%- 'Starting Balance' | $T8 %]</th>
16   <th colspan="2">[%- 'Balance with CB'  | $T8 %]</th>
17   <th colspan="2">[%- 'Closing Balance'  | $T8 %]</th>
18  </tr>
19  <tr class="listheading">
20   <th></th>
21   <th></th>
22   <th>[%- 'Debit'  | $T8 %]</th>
23   <th>[%- 'Credit' | $T8 %]</th>
24   <th>[%- 'Debit'  | $T8 %]</th>
25   <th>[%- 'Credit' | $T8 %]</th>
26   <th>[%- 'Debit'  | $T8 %]</th>
27   <th>[%- 'Credit' | $T8 %]</th>
28  </tr>
29  [% FOREACH chart = charts %]
30    [%- NEXT UNLESS chart.account_type == 'asset_account' -%]
31  <tr id="tr_[% loop.count %]" class="listrow[% loop.count % 2 %]">
32   <td>                 [% chart.accno | html %]</td>
33   <td>                 [% chart.description | html %]</td>
34   <td class="numeric"> [% IF chart.ob_amount < 0      %]  [% LxERP.format_amount(chart.ob_amount * -1, dec)       %] [% END %]</td>
35   <td class="numeric"> [% IF chart.ob_amount > 0      %]  [% LxERP.format_amount(chart.ob_amount, dec)            %] [% END %]</td>
36   <td class="numeric"> [% IF chart.amount_with_cb < 0 %]  [% LxERP.format_amount(chart.amount_with_cb * -1, dec)  %] [% END %]</td>
37   <td class="numeric"> [% IF chart.amount_with_cb > 0 %]  [% LxERP.format_amount(chart.amount_with_cb, dec)       %] [% END %]</td>
38   [% # cb amounts: >/< are switched and cb_amounts are multiplied with -1. The closing balance as calculated by cb_amount negates the actual balance, but when displaying it as the closing balance we want to display it in the same form as the actual balance %]
39   <td class="numeric"> [% IF chart.cb_amount > 0 %]  [% LxERP.format_amount(chart.cb_amount *  1, dec) %] [% END %]</td>
40   <td class="numeric"> [% IF chart.cb_amount < 0 %]  [% LxERP.format_amount(chart.cb_amount * -1, dec) %] [% END %]</td>
41  </tr>
42  [% END %]
43 </table>
44
45 <h2>[% 'Profit and loss accounts' | $T8 %]</h2>
46
47 <p>
48 [% IF profit_loss_sum < 0 %] [% THEN %][% 'Loss' | $T8 %] [% ELSE %] [% 'Profit' | $T8 %] [% END %]:   
49 [% LxERP.format_amount(profit_loss_sum, dec) %]
50 </p>
51
52 <table cellpadding="3px">
53  <tr class="listheading">
54   <th          >[%- 'Account'         | $T8 %]</th>
55   <th          >[%- 'Description'     | $T8 %]</th>
56   <th colspan=2>[%- 'Balance with CB' | $T8 %]</th>
57   <th colspan=2>[%- 'Closing Balance' | $T8 %]</th>
58  </tr>
59  <tr class="listheading">
60   <th></th>
61   <th></th>
62   <th>[%- 'Debit'  | $T8 %]</th>
63   <th>[%- 'Credit' | $T8 %]</th>
64   <th>[%- 'Debit'  | $T8 %]</th>
65   <th>[%- 'Credit' | $T8 %]</th>
66  </tr>
67  [% FOREACH chart = charts %]
68    [%- NEXT UNLESS chart.account_type == 'profit_loss_account' -%]
69  <tr id="tr_[% loop.count %]" class="listrow[% loop.count % 2 %]">
70   <td                >[% chart.accno | html %]</td>
71   <td                >[% chart.description | html %]</td>
72   <td class="numeric">[% IF chart.amount_with_cb < 0 %] [% LxERP.format_amount(chart.amount_with_cb * -1, dec) %] [% END %]</td>
73   <td class="numeric">[% IF chart.amount_with_cb > 0 %] [% LxERP.format_amount(chart.amount_with_cb, dec)      %] [% END %]</td>
74   <td class="numeric">[% IF chart.cb_amount > 0 %] [% LxERP.format_amount(chart.cb_amount *  1, dec) %] [% END %]</td>
75   <td class="numeric">[% IF chart.cb_amount < 0 %] [% LxERP.format_amount(chart.cb_amount * -1, dec)      %] [% END %]</td>
76  </tr>
77  [% END %]
78 </table>
79 [% # L.dump(charts) %]