{# 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 . #} {% extends 'base_report.html' %} {% block title %}Account Transactions as at {{ date.strftime('%d %B %Y') }}{% endblock %} {% block report %}

Account Transactions

For {{ account.name }}

For the {{ period }}

{##} {% set ns = namespace(balance=None) %} {% set prevlink = '/transactions_commodity?' + {'date': (pstart - timedelta(days=1)).strftime('%Y-%m-%d'), 'pstart': pstart.replace(year=pstart.year-1).strftime('%Y-%m-%d'), 'account': account.name, 'cash': 'on' if cash else ''}|urlencode %} {% for amount in opening_balance.amounts %} {##} {% endfor %} {% set ns.balance = opening_balance %} {% for transaction in transactions %} {% for posting in transaction.postings if posting.account == account %} {% set ns.balance = ns.balance + posting.amount %} {% endfor %} {% for amount in ns.balance.amounts %} {% set posting = matching_posting(transaction, amount) %} {% if posting %} {##} {% else %} {% endif %} {% endfor %} {% set ns.balance = ns.balance.clean() %} {% endfor %} {% for amount in closing_balance.amounts %} {##} {% endfor %}
Date Description AmountBalance
{% if loop.first %}{{ pstart.strftime('%Y-%m-%d') }}{% endif %} {% if loop.first %}Opening Balance{% endif %} {{ amount|abs|bc }} {% if amount.currency.price %}{{ '{' + amount.currency.price|bc + '}' }}{% endif %} {% if amount >= 0 %}Dr{% else %}Cr{% endif %}
{% if loop.first %}{{ transaction.date.strftime('%Y-%m-%d') }}{% endif %} {% if loop.first %}{{ transaction.description }}{% endif %}{% if posting.amount >= 0 %}Dr{% else %}Cr{% endif %} {{ posting.amount|abs|bc }}{% if posting.amount.currency.price %}{{ '{' + posting.amount.currency.price|bc + '}' }}{% endif %}{{ amount|abs|bc }} {% if amount.currency.price %}{{ '{' + amount.currency.price|bc + '}' }}{% endif %} {% if amount >= 0 %}Dr{% else %}Cr{% endif %}
{% if loop.first %}{{ date.strftime('%Y-%m-%d') }}{% endif %} {% if loop.first %}Closing Balance{% endif %} {{ amount|abs|bc }} {% if amount.currency.price %}{{ '{' + amount.currency.price|bc + '}' }}{% endif %} {% if amount >= 0 %}Dr{% else %}Cr{% endif %}
{% endblock %}