{# ledger-pyreport Copyright © 2020 Lee Yingtong Li (RunasSudo) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . #} {% macro do_account(account, acc_level=0, disp_level=0, invert=False) %} {{ ':'.join(account.name_parts[acc_level+1:]) }} {% if account.balance != 0 %}{{ (account.balance * (-1 if invert else 1))|a }}{% endif %} {{ walk_children(account.children, acc_level + 1, disp_level + 1, invert) }} {% endmacro %} {% macro walk_children(children, acc_level=0, disp_level=0, invert=False) %} {% for account in children %} {{ do_account(account, acc_level, disp_level, invert) }} {% endfor %} {% endmacro %} Income Statement for the {{ period }}

Income Statement

For the {{ period }}

{{ walk_children(income.children, invert=True) }} {{ walk_children(expenses.children) }}
Income
Total Income {{ -income.total()|a }}
 
Expenses
Total Expenses {{ expenses.total()|a }}
 
Net Surplus (Loss) {{ -(income.total() + expenses.total())|a }}