Files
scripts_serv/ledger/custom/balance_sheet.html
T
2026-10-02 22:35:11 +02:00

412 lines
9.8 KiB
HTML

<?lsmb# This is a comment block; it's ignored by the template engine.
Version: 2.3
Date: 2026-02-19
File: balance_sheet.html
Set: demo
Template version numbers are explicitly not aligned across templates or
releases. No explicit versioning was applied before 2021-01-04.
Version Changes
2.0 Created clickable section heads to collapse parts of hierarchical reports
2.1 Simplify indentation calculations; many values are provided as variables as-of 1.13
2.2 Support sections in the column dimension (used for foreign currency reports)
2.3 Fix company address not showing below company name
-?>
<!DOCTYPE html>
<html>
<head>
<meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.6.0">
<title><?lsmb title ?></title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<style type="text/css">
table.c1 {border-collapse: collapse}
.flat-hierarchy .balancesheet .report-head th {
font-weight: bold;
text-align: right;
white-space: pre;
}
.flat-hierarchy .balancesheet .section1.QL,
.flat-hierarchy .income_statement .section1 {
border: none;
display: none;
}
.flat-hierarchy .balancesheet .section1,
.flat-hierarchy .balancesheet .section2,
.flat-hierarchy .income_statement .section2 {
border-bottom: 3px double black;
font-size: large;
}
.financial-statement.flat-hierarchy .heading1,
.financial-statement.flat-hierarchy .balancesheet .heading2 {
border-top: 1px solid black;
font-weight: bold;
height: 2em;
vertical-align: top;
}
.financial-statement.flat-hierarchy .income_statement .heading2 {
border-top: 1px solid black;
font-size: bigger;
font-style: italic;
height: 2em;
vertical-align: top;
}
.financial-statement.flat-hierarchy table {
margin-top: 3em;
min-width: 60ex;
}
.financial-statement.flat-hierarchy table td,
.financial-statement.flat-hierarchy table th {
padding-bottom: 3px; /* add space for the dashed line underlining hovered amounts */
}
.financial-statement .company-name {
font-family: monospace;
margin-top: 2em;
text-align: center;
}
.financial-statement .company-address {
font-family: monospace;
font-size: smaller;
text-align: center;
}
#PNL a {
background-color: inherit;
color: inherit;
text-decoration: none;
}
#PNL a:link {
background-color: inherit;
color: inherit;
text-decoration: none;
}
#PNL a:visited {
background-color: inherit;
color: inherit;
text-decoration: none;
}
#PNL a:hover {
background-color: inherit;
border-bottom: thin dashed;
color: inherit;
text-decoration: none;
}
#PNL td.amount {
padding-left: 0.5em;
text-align: right;
}
#PNL tr.separator {
min-height: 1em;
}
#PNL tr.sectionhead th {
font-weight: bold;
margin-top: 4em;
padding-top: 2em;
text-align: right;
}
#PNL td.total {
border: 0;
border-color: black;
border-style: solid;
border-top: 1px;
}
#PNL th {
padding-left: 5px;
text-align: left;
vertical-align: top;
}
#PNL table {
margin-left: auto;
margin-right: auto;
}
#PNL h1,
h2 {
text-align: center;
}
#PNL th[colspan="1"].indent {
width: 1em;
}
#PNL th[colspan="2"].indent {
width: 2em;
}
#PNL th[colspan="3"].indent {
width: 3em;
}
#PNL th[colspan="4"].indent {
width: 4em;
}
#PNL th[colspan="5"].indent {
width: 5em;
}
#PNL th[colspan="6"].indent {
width: 6em;
}
#PNL th[colspan="7"].indent {
width: 7em;
}
#PNL th[colspan="8"].indent {
width: 8em;
}
#PNL th[colspan="9"].indent {
width: 9em;
}
#PNL td.heading1,
#PNL th.heading1 {
border-bottom: 1px solid black;
border-top: 1px solid black;
font-weight: bold;
padding-bottom: 1em;
}
#PNL td.heading2,
#PNL th.heading2 {
font-style: italic;
font-weight: bold;
}
#PNL table.balancesheet {
border-top: 1px solid black;
margin-top: 2em;
}
#PNL .amount {
padding-left: 0.5em;
}
.financial-statement h1,
.financial-statement h2 {
text-align: center;
}
.financial-statement table {
margin-left: auto;
margin-right: auto;
}
.financial-statement td.amount {
padding-left: 4em;
text-align: right;
}
.financial-statement tr.total td,
.financial-statement tr.total th {
padding-bottom: 2em;
}
.financial-statement tr.total td.amount {
border-top: thick double black;
}
.financial-statement th {
text-align: left;
}
.financial-statement tr.section-head th,
.financial-statement tr.total th {
text-align: center;
}
.financial-statement a,
.financial-statement a:visited {
color: black;
text-decoration: none;
}
.heading3.H {
padding-bottom: 1em;
}
.heading2.H {
padding-bottom: 1.5em;
}
.heading4.H {
padding-bottom: 0.75em;
}
.section1 {
font-size: 140%;
}
.section2 {
font-size: 120%;
}
.section3 {
font-size: 110%;
}
.H {
font-style: italic;
}
.section4 {
font-size: 105%;
}
th {
font-weight: normal;
}
@media print {
.non-printed {
display: none;
}
}
</style>
<script>
let lvl = {};
function toggle(tgt,cls) {
let elms = document.querySelectorAll(tgt+' .'+cls);
let newState = lvl[cls] ? '' : 'none';
lvl[cls] = !lvl[cls];
for ( var e = elms.length - 1; e >= 0; e-- ) {
elms[e].style.display = newState;
}
}
</script></head><?lsmb
max_col_path_depth = report.cheads.max_path_depth;
max_row_path_depth = report.rheads.max_path_depth;
IF report.legacy_hierarchy ;
hierarchy = 'flat-hierarchy';
ELSE ;
hierarchy = 'full-hierarchy';
END ;
?>
<body class="financial-statement <?lsmb dojo_theme ?> <?lsmb hierarchy ?>">
<div id="PNL" class="financial-statement <?lsmb hierarchy ?> balance-sheet">
<!-- TODO: Find better name!! -->
<h1><?lsmb text('Balance Sheet') ?></h1>
<h2><?lsmb HLINES.1 ?></h2>
<div class="company-name">
<?lsmb SETTINGS.company_name ?>
</div>
<div class="company-address">
<?lsmb SETTINGS.company_address ?>
</div>
<table class="balancesheet c1">
<colgroup class="headings">
<?lsmb i = 1;
WHILE i <= max_row_path_depth;
' <col class="level' _ i _ '" />';
i = i + 1;
END;
?>
</colgroup>
<colgroup class="values">
<?lsmb i = 1;
FOREACH col IN report.sorted_col_ids ;
IF report.cheads.ids.$col.is_leaf;
NEXT;
END;
' <col class="values' _ i _ '" />';
i = i + 1;
END;
?>
</colgroup>
<thead>
<?lsmb head_level = 1;
WHILE head_level <= max_col_path_depth ; ?>
<tr class="report-head">
<th colspan="<?lsmb max_row_path_depth ?>"></th>
<?lsmb 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 -?>
<th data-id="<?lsmb col ?>"
colspan="<?lsmb report.cheads.ids.$col.leaves ?>"
rowspan="<?lsmb report.cheads.ids.$col.is_leaf ? (max_col_path_depth - report.cheads.ids.$col.path.size + 1) : 1 ?>"><?lsmb report.cheads.ids.$col.props.description ?></th>
<?lsmb END -?><?lsmb END ?>
</tr>
<?lsmb head_level = head_level + 1;
END ?>
</thead>
<tbody>
<?lsmb 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;
row_type = 'H';
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;
row_type = 'H';
ELSE;
class = 'class="account"';
clazz = 'account';
row_type = 'A';
END;
?>
<tr class="<?lsmb FOREACH sec IN row_data.path ; IF NOT loop.last(); " sub-" _ sec ; END; END; ?>" <?lsmb IF row_type == 'H' ; ?> onclick="toggle('', 'sub-<?lsmb row_data.path.last ?>')" <?lsmb END ?> >
<?lsmb IF report.legacy_hierarchy ?>
<?lsmb IF path_prefix_len > 0 ?>
<th colspan="<?lsmb path_prefix_len ?>" class="indent">&nbsp;</th>
<?lsmb END ?>
<?lsmb ELSE ?>
<?lsmb FILTER repeat(path_prefix_len) -?>
<th class="indent">&nbsp;</th>
<?lsmb- END -?>
<?lsmb END ?>
<th colspan="<?lsmb path_suffix_len ?>" <?lsmb class ?>>
<?lsmb IF row_data.props.section_for ;
row_data.props.row_description ?></th>
<th colspan="<?lsmb report.cheads.ids.size ?>" <?lsmb class ?>>
<?lsmb ELSE -?>
<?lsmb row_data.props.row_description ?></th><?lsmb FOREACH col IN report.sorted_col_ids;
IF not report.cheads.ids.$col.is_leaf;
NEXT;
END;
-?>
<td class="amount <?lsmb clazz ?>">
<?lsmb report.cells.$row.$col ?>
</td><?lsmb END ?><?lsmb END ?>
</tr><?lsmb END ?><!--
<h2><?lsmb text('Key Ratios'); ?></h2>
<h2><?lsmb text('First column only') ?></h2>
<table>
<tr><th><?lsmb text('Assets to Liabilities') ?></th>
<td><?lsmb report.balance_sheet.ratios.AL ?></td>
</tr>
<tr><th><?lsmb text('Assets to Equity') ?></th>
<td><?lsmb report.balance_sheet.ratios.AQ ?></td>
</tr>
<tr><th><?lsmb text('Equity to Liabilities') ?></th>
<td><?lsmb report.balance_sheet.ratios.QL ?></td>
</tr>
-->
</tbody>
</table>
</div>
<p class="non-printed">Click on the headings to collapse sections.</p>
</body>
</html>