#
# stuff missing from the original implementation:
# - bold stuff
-# - format (2 places, varying signs of negative amounts)
-# - rounding (might not be necessary)
-# - accno and subdescription
+# - subdescription
# - proper testing for heading charts
# - transmission from $form to TMPL realm is not as clear as i'd like
sub balance_sheet {
$auth->assert('report');
+ $form->{decimalplaces} = $form->{decimalplaces} * 1 || 2;
$form->{padding} = " ";
$form->{bold} = "<b>";
$form->{endbold} = "</b>";
<tr>
<td> </td>
<td>[% row.accno _ ' - ' IF l_accno %][% row.description %]</td>
- <td align="right">[% LxERP.format_amount(row.this,2) %]</td>
+ <td align="right">[% LxERP.format_amount(row.this, decimalplaces) %]</td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(row.last,2) %]</td>
+ <td align="right">[% LxERP.format_amount(row.last, decimalplaces) %]</td>
[%- END %]
</tr>
[% END %]
<tr valign="top">
<th align="left" colspan="2">TOTAL</th>
- <td align="right">[% LxERP.format_amount(total.A.this,2) %]<hr noshade size="2"></td>
+ <td align="right">[% LxERP.format_amount(total.A.this, decimalplaces) %]<hr noshade size="2"></td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(total.A.last,2) %]<hr noshade size="2"></td>
+ <td align="right">[% LxERP.format_amount(total.A.last, decimalplaces) %]<hr noshade size="2"></td>
[%- END %]
</tr>
[% END %]
<tr>
<td></td>
<td>[% row.accno _ ' - ' IF l_accno %][% row.description %]</td>
- <td align="right">[% LxERP.format_amount(row.this,2) %]</td>
+ <td align="right">[% LxERP.format_amount(row.this, decimalplaces) %]</td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(row.last,2) %]</td>
+ <td align="right">[% LxERP.format_amount(row.last, decimalplaces) %]</td>
[%- END %]
</tr>
[% END %]
<tr valign="top">
<td></td>
<th align="left">TOTAL</th>
- <td align="right">[% LxERP.format_amount(total.L.this,2) %]<br><hr noshade size="2"</td>
+ <td align="right">[% LxERP.format_amount(total.L.this, decimalplaces) %]<br><hr noshade size="2"</td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(total.L.last,2) %]<br><hr noshade size="2"</td>
+ <td align="right">[% LxERP.format_amount(total.L.last, decimalplaces) %]<br><hr noshade size="2"</td>
[%- END %]
</tr>
[% END %]
[% FOREACH row = Q %]
<tr>
<td></td>
- <td>[% row.accno _ ' - ' IF l_accno %][% row.description %]</td>
- <td align="right">[% LxERP.format_amount(row.this,2) %]</td>
+ <td>[% row.description %]</td>
+ <td align="right">[% LxERP.format_amount(row.this, decimalplaces) %]</td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(row.last,2) %]</td>
+ <td align="right">[% LxERP.format_amount(row.last, decimalplaces) %]</td>
[%- END %]
</tr>
[% END %]
<tr valign="top">
<td></td>
<th align="left">TOTAL</th>
- <td align="right">[% LxERP.format_amount(total.Q.this,2) %]<br><hr noshade size="2"</td>
+ <td align="right">[% LxERP.format_amount(total.Q.this, decimalplaces) %]<br><hr noshade size="2"</td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(total.Q.last,2) %]<br><hr noshade size="2"</td>
+ <td align="right">[% LxERP.format_amount(total.Q.last, decimalplaces) %]<br><hr noshade size="2"</td>
[%- END %]
</tr>
[% END %]
<tr valign="top">
<th align="left" colspan="2">TOTAL PASSIVA & EIGENTUM</th>
- <td align="right">[% LxERP.format_amount(total.this,2) %]<br><hr noshade size="2"></td>
+ <td align="right">[% LxERP.format_amount(total.this, decimalplaces) %]<br><hr noshade size="2"></td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(total.last,2) %]<br><hr noshade size="2"></td>
+ <td align="right">[% LxERP.format_amount(total.last, decimalplaces) %]<br><hr noshade size="2"></td>
[%- END %]
</tr>
</table>
<tr>
<td> </td>
<td>[% row.accno _ ' - ' IF l_accno %][% row.description %]</td>
- <td align="right">[% LxERP.format_amount(row.this,2) %]</td>
+ <td align="right">[% LxERP.format_amount(row.this, decimalplaces) %]</td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(row.last,2) %]</td>
+ <td align="right">[% LxERP.format_amount(row.last, decimalplaces) %]</td>
[%- END %]
</tr>
[% END %]
<tr valign="top">
<th align="left" colspan="2"><translate>TOTAL</translate></th>
- <td align="right">[% LxERP.format_amount(total.A.this,2) %]<hr noshade size="2"></td>
+ <td align="right">[% LxERP.format_amount(total.A.this, decimalplaces) %]<hr noshade size="2"></td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(total.A.last,2) %]<hr noshade size="2"></td>
+ <td align="right">[% LxERP.format_amount(total.A.last, decimalplaces) %]<hr noshade size="2"></td>
[%- END %]
</tr>
[% END %]
<tr>
<td></td>
<td>[% row.accno _ ' - ' IF l_accno %][% row.description %]</td>
- <td align="right">[% LxERP.format_amount(row.this,2) %]</td>
+ <td align="right">[% LxERP.format_amount(row.this, decimalplaces) %]</td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(row.last,2) %]</td>
+ <td align="right">[% LxERP.format_amount(row.last, decimalplaces) %]</td>
[%- END %]
</tr>
[% END %]
<tr valign="top">
<td></td>
<th align="left"><translate>TOTAL</translate></th>
- <td align="right">[% LxERP.format_amount(total.L.this,2) %]<br><hr noshade size="2"</td>
+ <td align="right">[% LxERP.format_amount(total.L.this, decimalplaces) %]<br><hr noshade size="2"</td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(total.L.last,2) %]<br><hr noshade size="2"</td>
+ <td align="right">[% LxERP.format_amount(total.L.last, decimalplaces) %]<br><hr noshade size="2"</td>
[%- END %]
</tr>
[% END %]
<tr>
<td></td>
<td>[% row.description %]</td>
- <td align="right">[% LxERP.format_amount(row.this,2) %]</td>
+ <td align="right">[% LxERP.format_amount(row.this, decimalplaces) %]</td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(row.last,2) %]</td>
+ <td align="right">[% LxERP.format_amount(row.last, decimalplaces) %]</td>
[%- END %]
</tr>
[% END %]
<tr valign="top">
<td></td>
<th align="left"><translate>TOTAL</translate></th>
- <td align="right">[% LxERP.format_amount(total.Q.this,2) %]<br><hr noshade size="2"</td>
+ <td align="right">[% LxERP.format_amount(total.Q.this, decimalplaces) %]<br><hr noshade size="2"</td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(total.Q.last,2) %]<br><hr noshade size="2"</td>
+ <td align="right">[% LxERP.format_amount(total.Q.last, decimalplaces) %]<br><hr noshade size="2"</td>
[%- END %]
</tr>
[% END %]
<tr valign="top">
<th align="left" colspan="2"><translate>TOTAL</translate> <translate>LIABILITIES</translate> & <translate>EQUITY</translate></th>
- <td align="right">[% LxERP.format_amount(total.this,2) %]<br><hr noshade size="2"></td>
+ <td align="right">[% LxERP.format_amount(total.this, decimalplaces) %]<br><hr noshade size="2"></td>
[%- IF last_period %]
- <td align="right">[% LxERP.format_amount(total.last,2) %]<br><hr noshade size="2"></td>
+ <td align="right">[% LxERP.format_amount(total.last, decimalplaces) %]<br><hr noshade size="2"></td>
[%- END %]
</tr>
</table>