{# 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 %} Balance Sheet as at {{ date.strftime('%d %B %Y') }}

Balance Sheet

As at {{ date.strftime('%d %B %Y') }}

{% for asset_class in assets.children %} {{ walk_children(asset_class.children, acc_level=1) }} {% endfor %} {% if not cash %} {% for liability_class in liabilities.children %} {{ walk_children(liability_class.children, acc_level=1, invert=True) }} {% endfor %} {% endif %} {{ walk_children(equity.children, invert=True) }}
Assets
{{ asset_class.name_parts[-1] }} Assets
Total {{ asset_class.name_parts[-1] }} Assets {{ asset_class.total()|a }}
 
Total Assets {{ assets.total()|a }}
 
Liabilities
{{ liability_class.name_parts[-1] }} Liabilities
Total {{ liability_class.name_parts[-1] }} Liabilities {{ -liability_class.total()|a }}
 
Total Liabilities {{ -liabilities.total()|a }}
Net Assets {{ (assets.total() + liabilities.total())|a }}
 
Equity
Total Equity {{ -equity.total()|a }}