<?lsmb#   This is a comment block; it's ignored by the template engine.

   Version:  2.0
   Date:     2023-11-17
   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

-?>
<!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;
}

#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_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 ;
 ?>
<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 company_address ?>
    </div>
    <table class="balancesheet c1">
      <colgroup class="headings">
        <?lsmb i = 1;
        WHILE i <= max_path_depth;
        '  <col class="level' _ i _ '" />';
        i = i + 1;
        END;
        ?>
      </colgroup>
      <colgroup class="values">
        <?lsmb i = 1;
        WHILE i <= report.cheads.ids.keys.size;
        '  <col class="values' _ i _ '" />';
        i = i + 1;
        END;
        ?>
      </colgroup>
      <tbody>
        <tr class="report-head">
          <th colspan="<?lsmb max_path_depth ?>">
          </th><?lsmb FOREACH col IN report.sorted_col_ids -?>
          <th><?lsmb report.cheads.ids.$col.props.description ?></th><?lsmb END -?>
        </tr><?lsmb 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;
        row_type = 'H';
        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;
        row_type = 'H';
        ELSE;
        class = 'class="account"';
        clazz = 'account';
        row_type = 'A';
        END;
        ?>
        <tr class="<?lsmb FOREACH sec IN report.rheads.ids.$row.path ; IF NOT loop.last(); " sub-" _ sec ; END; END; ?>" <?lsmb IF row_type == 'H' ; ?>  onclick="toggle('', 'sub-<?lsmb report.rheads.ids.$row.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
              colspan = 0;
              WHILE colspan < path_prefix_len;
                colspan = colspan + 1;
            -?>
            <th class="indent">&nbsp;</th>
            <?lsmb- END -?>
          <?lsmb END ?>
          <th colspan="<?lsmb path_suffix_len ?>" <?lsmb class ?>>
          <?lsmb 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; ?></th>
          <th colspan="<?lsmb report.cheads.ids.keys.size ?>" <?lsmb class ?>>
          <?lsmb ELSE -?><?lsmb IF report.rheads.ids.$row.props.account_number && report.incl_accnos; -?><?lsmb report.rheads.ids.$row.props.account_number ?>&nbsp;-&nbsp;<?lsmb END; -?>
          <?lsmb report.rheads.ids.$row.props.account_description ?></th><?lsmb FOREACH col IN report.sorted_col_ids -?>
          <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>
