[% 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_eca_name=Y' _ '&col_accno=Y&__action=search&col_running_balance=Y'; max_row_path_depth = report.rheads.max_path_depth; max_col_path_depth = report.cheads.max_path_depth; IF report.legacy_hierarchy ; hierarchy = 'flat-hierarchy'; ELSE ; hierarchy = 'full-hierarchy'; END ; %]

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

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

[% i = 1; WHILE i <= max_row_path_depth; ' '; i = i + 1; END; %] [% i = 1; FOREACH col IN report.sorted_col_ids ; IF report.cheads.ids.$col.is_leaf; NEXT; END; ' '; i = i + 1; END; %]
[% head_level = 1; WHILE head_level <= max_col_path_depth ; %]
[% FOREACH col IN report.sorted_col_ids; IF report.cheads.ids.$col.props.section_for; NEXT; END; IF head_level == report.cheads.ids.$col.path.size -%] | [% report.cheads.ids.$col.props.description %] [% END %] [% END -%]
--- | ---
[% head_level = head_level + 1; END %]
[% FOREACH row IN report.sorted_row_ids ; row_data = report.rheads.ids.$row; path_depth = row_data.path_depth; path_prefix_len = row_data.path_prefix_len; path_suffix_len = row_data.path_suffix_len; IF row_data.props.account_type == 'H' ; class = 'class="heading' _ path_depth _ ' ' _ row_data.props.account_type _ '"'; clazz = "heading" _ path_depth _ ' ' _ row_data.props.account_type; ELSIF row_data.props.section_for ; class = 'class="section' _ path_depth _ ' ' _ row_data.heading_props.account_category _ '"'; clazz = "section" _ path_depth _ ' ' _ row_data.heading_props.account_category; ELSE; class = 'class="account"'; clazz = 'account'; END; %]
[% IF report.legacy_hierarchy %] [% IF path_prefix_len > 0 %] [% END %] [% ELSE %] [% FILTER repeat(path_prefix_len) -%] | [%- END -%] [% END %] | [% IF row_data.props.section_for ; row_data.props.row_description %] | [% ELSE -%] [% row_data.props.row_description %] [% FOREACH col IN report.sorted_col_ids; IF not report.cheads.ids.$col.is_leaf; NEXT; END; -%] | [% report.cells.$row.$col %][% END %] [% END %]
[% END %]

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