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

   Version:  1.3
   Date:     2025-08-30
   File:     PNL.tex
   Set:      demo

Template version numbers are explicitly not aligned across templates or
releases. No explicit versioning was applied before 2021-01-04.

Version   Changes
1.1       Merged xelatex targetting templates with those targetting pdflatex
1.2       Fixed company address not showing
1.3       Simplify indentation calculations; as of 1.13, many pre-calculated
          values are provided as variables

-?>
<?lsmb FILTER latex { format="$FORMAT($PROCESSOR)" } ?>

<?lsmb
  max_path_depth = report.rheads.max_path_depth;
  last_col_no = max_path_depth + 1 + report.sorted_col_ids.size;
  IF report.legacy_hierarchy ;
     hierarchy = 'flat-hierarchy';
  ELSE ;
     hierarchy = 'full-hierarchy';
  END ;

 -?>

\documentclass[10pt]{article}
\usepackage{longtable}
\usepackage[<?lsmb SETTINGS.papersize ?>paper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\begin{document}
\renewcommand\baselinestretch{1.2}\selectfont
\begin{center}
\Huge{<?lsmb text('Income Statement') ?>}

\small{
\texttt{<?lsmb SETTINGS.company_name ?>}


\texttt{<?lsmb SETTINGS.company_address ?>}
}
\end{center}


\begin{longtable}{@{\extracolsep{'0pt}}<?lsmb l = 'l'; l.repeat(max_path_depth);
 -?>p{2cm}<?lsmb l = 'r'; l.repeat(report.sorted_col_ids.size); ?>}
\\
\multicolumn{<?lsmb max_path_depth ?>}{l}{} &%
<?lsmb
 FOREACH col IN report.sorted_col_ids;
     ' & \shortstack{';
     report.cheads.ids.$col.props.description ;
     '} ';
 END;
 ?> \\
\\
<?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.section_for;
     IF row_data.heading_props.account_category == 'Q';
       NEXT;
     END;
   END;


   desc = row_data.props.row_description;
   IF row_data.props.account_type != 'A';
    IF row_data.props.section_for ;
       desc = '\Large{' _ row_data.props.row_description _ '}';
    ELSE;
      '\cline{' _ path_depth _ '-' _ last_col_no _ '} ';
    END;
    desc = '\textbf{\emph{' _ desc _ '}}';
  END ;
-?>%
%
<?lsmb amp = '& '; amp.repeat(path_prefix_len); -?>
<?lsmb IF path_suffix_len > 1 -?>
\multicolumn{<?lsmb path_suffix_len ?>}{l}{<?lsmb desc ?>}%
<?lsmb ELSE -?>
<?lsmb desc ?>
<?lsmb END -?>
%
 & %
<?lsmb FOREACH col IN report.sorted_col_ids;
  ' & '; report.cells.$row.$col;
END; -?>
%
\\
%
<?lsmb IF row_data.props.account_type != 'A'; -?>
  <?lsmb IF row_data.props.section_for; -?>
\cline{<?lsmb path_depth ?>-<?lsmb last_col_no ?>}
\noalign{\vskip 2pt}
\cline{<?lsmb path_depth ?>-<?lsmb last_col_no ?>}
  <?lsmb ELSE -?>
\\
  <?lsmb END -?>

<?lsmb END -?>
<?lsmb END -?>

\end{longtable}
\end{document}

<?lsmb END -?>
