Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / yearend / _charts.html
diff --git a/templates/webpages/yearend/_charts.html b/templates/webpages/yearend/_charts.html
new file mode 100644 (file)
index 0000000..20f7621
--- /dev/null
@@ -0,0 +1,79 @@
+[%- USE LxERP -%]
+[%- USE T8    -%]
+[%- USE L     -%]
+[%- USE HTML  -%]
+[%- USE P     -%]
+
+
+[%- SET dec = 2 %]
+
+<h2>[% 'Balance accounts' | $T8 %]</h2>
+<table cellpadding="3px">
+ <tr class="listheading">
+  <th            >[%- 'Account'          | $T8 %]</th>
+  <th            >[%- 'Description'      | $T8 %]</th>
+  <th colspan="2">[%- 'Starting Balance' | $T8 %]</th>
+  <th colspan="2">[%- 'Balance with CB'  | $T8 %]</th>
+  <th colspan="2">[%- 'Closing Balance'  | $T8 %]</th>
+ </tr>
+ <tr class="listheading">
+  <th></th>
+  <th></th>
+  <th>[%- 'Debit'  | $T8 %]</th>
+  <th>[%- 'Credit' | $T8 %]</th>
+  <th>[%- 'Debit'  | $T8 %]</th>
+  <th>[%- 'Credit' | $T8 %]</th>
+  <th>[%- 'Debit'  | $T8 %]</th>
+  <th>[%- 'Credit' | $T8 %]</th>
+ </tr>
+ [% FOREACH chart = charts %]
+   [%- NEXT UNLESS chart.account_type == 'asset_account' -%]
+ <tr id="tr_[% loop.count %]" class="listrow[% loop.count % 2 %]">
+  <td>                 [% chart.accno | html %]</td>
+  <td>                 [% chart.description | html %]</td>
+  <td class="numeric"> [% IF chart.ob_amount < 0      %]  [% LxERP.format_amount(chart.ob_amount * -1, dec)       %] [% END %]</td>
+  <td class="numeric"> [% IF chart.ob_amount > 0      %]  [% LxERP.format_amount(chart.ob_amount, dec)            %] [% END %]</td>
+  <td class="numeric"> [% IF chart.amount_with_cb < 0 %]  [% LxERP.format_amount(chart.amount_with_cb * -1, dec)  %] [% END %]</td>
+  <td class="numeric"> [% IF chart.amount_with_cb > 0 %]  [% LxERP.format_amount(chart.amount_with_cb, dec)       %] [% END %]</td>
+  [% # 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 %]
+  <td class="numeric"> [% IF chart.cb_amount > 0 %]  [% LxERP.format_amount(chart.cb_amount *  1, dec) %] [% END %]</td>
+  <td class="numeric"> [% IF chart.cb_amount < 0 %]  [% LxERP.format_amount(chart.cb_amount * -1, dec) %] [% END %]</td>
+ </tr>
+ [% END %]
+</table>
+
+<h2>[% 'Profit and loss accounts' | $T8 %]</h2>
+
+<p>
+[% IF profit_loss_sum < 0 %] [% THEN %][% 'Loss' | $T8 %] [% ELSE %] [% 'Profit' | $T8 %] [% END %]:   
+[% LxERP.format_amount(profit_loss_sum, dec) %]
+</p>
+
+<table cellpadding="3px">
+ <tr class="listheading">
+  <th          >[%- 'Account'         | $T8 %]</th>
+  <th          >[%- 'Description'     | $T8 %]</th>
+  <th colspan=2>[%- 'Balance with CB' | $T8 %]</th>
+  <th colspan=2>[%- 'Closing Balance' | $T8 %]</th>
+ </tr>
+ <tr class="listheading">
+  <th></th>
+  <th></th>
+  <th>[%- 'Debit'  | $T8 %]</th>
+  <th>[%- 'Credit' | $T8 %]</th>
+  <th>[%- 'Debit'  | $T8 %]</th>
+  <th>[%- 'Credit' | $T8 %]</th>
+ </tr>
+ [% FOREACH chart = charts %]
+   [%- NEXT UNLESS chart.account_type == 'profit_loss_account' -%]
+ <tr id="tr_[% loop.count %]" class="listrow[% loop.count % 2 %]">
+  <td                >[% chart.accno | html %]</td>
+  <td                >[% chart.description | html %]</td>
+  <td class="numeric">[% IF chart.amount_with_cb < 0 %] [% LxERP.format_amount(chart.amount_with_cb * -1, dec) %] [% END %]</td>
+  <td class="numeric">[% IF chart.amount_with_cb > 0 %] [% LxERP.format_amount(chart.amount_with_cb, dec)      %] [% END %]</td>
+  <td class="numeric">[% IF chart.cb_amount > 0 %] [% LxERP.format_amount(chart.cb_amount *  1, dec) %] [% END %]</td>
+  <td class="numeric">[% IF chart.cb_amount < 0 %] [% LxERP.format_amount(chart.cb_amount * -1, dec)      %] [% END %]</td>
+ </tr>
+ [% END %]
+</table>
+[% # L.dump(charts) %]