[% FORMATS = LIST_FORMATS(); DRILLBASE = 'journal.pl?sort=transdate&&category=X' _ '&col_transdate=Y&col_reference=Y&col_description=Y' _ '&col_debits=Y&col_credits=Y&col_source=Y' _ '&col_accno=Y&__action=search&col_running_balance=Y'; max_path_depth = 0; FOREACH row IN report.sorted_row_ids ; IF max_path_depth < report.rheads.ids.$row.path.size ; max_path_depth = report.rheads.ids.$row.path.size; END; END; IF report.legacy_hierarchy ; hierarchy = 'flat-hierarchy'; ELSE ; hierarchy = 'full-hierarchy'; END ; %]

# [% text('Balance Sheet') %]

[% SETTINGS.company_name %]
[% company_address %]

[% i = 1; WHILE i <= max_path_depth; ' '; i = i + 1; END; %] [% i = 1; WHILE i <= report.cheads.ids.keys.size; ' '; i = i + 1; END; %]
[% FOREACH col IN report.sorted_col_ids -%] | [% report.cheads.ids.$col.props.description %] [% END -%]
--- | ---
[% FOREACH row IN report.sorted_row_ids ; path_depth = report.rheads.ids.$row.path.size; path_prefix_len = path_depth - 1; path_suffix_len = max_path_depth - path_prefix_len; IF report.rheads.ids.$row.props.account_type == 'H' ; class = 'class="heading' _ path_depth _ ' ' _ report.rheads.ids.$row.props.account_type _ '"'; clazz = "heading" _ path_depth _ ' ' _ report.rheads.ids.$row.props.account_type; ELSIF report.rheads.ids.$row.props.section_for ; row_id = report.rheads.ids.$row.props.section_for ; class = 'class="section' _ path_depth _ ' ' _ report.rheads.ids.$row_id.props.account_category _ '"'; clazz = "section" _ path_depth _ ' ' _ report.rheads.ids.$row_id.props.account_category; ELSE; class = 'class="account"'; clazz = 'account'; END; %]
[% IF report.legacy_hierarchy %] [% IF path_prefix_len > 0 %] [% END %] [% ELSE %] [% colspan = 0; WHILE colspan < path_prefix_len; colspan = colspan + 1; -%] | [%- END -%] [% END %] | [% IF report.rheads.ids.$row.props.section_for ; head_id = report.rheads.ids.$row.props.section_for; report.rheads.ids.$head_id.props.account_description; %] | [% ELSE -%] [% IF report.rheads.ids.$row.props.account_number && report.incl_accnos; -%] [% report.rheads.ids.$row.props.account_number %] - [% END; -%] [% report.rheads.ids.$row.props.account_description %] [% FOREACH col IN report.sorted_col_ids -%] | [% report.cells.$row.$col %][% END %] [% END %]
[% END %]

[% IF FORMATS.grep('PDF').size() %]
[[% text('PDF') %]]
[[% text('HTML') %]]
[[% text('CSV') %]]
[% END %]