From be826155984a5a458b5c4e16a650ef653447cc54 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Fri, 20 Mar 2020 18:54:01 +1100 Subject: [PATCH] Minor tweaks --- ledger_pyreport/jinja2/balance.html | 3 +-- ledger_pyreport/jinja2/transactions.html | 16 +++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ledger_pyreport/jinja2/balance.html b/ledger_pyreport/jinja2/balance.html index 0549a50..7e1ef07 100644 --- a/ledger_pyreport/jinja2/balance.html +++ b/ledger_pyreport/jinja2/balance.html @@ -38,9 +38,8 @@ {% macro do_accounts(root, label, invert, year_headers) %} {% for account_class in balance_sheets[0].get_account(root).children if account_class in accounts %} - {% set isfirst = (loop.index0 == 0) %} - {% if isfirst and year_headers %} + {% if loop.first and year_headers %} {{ account_class.bits[-1] }} {{ label }} {% for balance_sheet in balance_sheets %}{{ balance_sheet.date.strftime('%Y') }} {% endfor %} {% else %} diff --git a/ledger_pyreport/jinja2/transactions.html b/ledger_pyreport/jinja2/transactions.html index e81f450..aba5c84 100644 --- a/ledger_pyreport/jinja2/transactions.html +++ b/ledger_pyreport/jinja2/transactions.html @@ -53,18 +53,20 @@ {% for transaction in transactions %} - {% for posting in transaction.postings %} + {% for posting in transaction.postings if posting.amount >= 0.05 or posting.amount < -0.05 %} - {% if loop.index0 == 0 %}{{ transaction.date.strftime('%Y-%m-%d') }}{% endif %} - {% if loop.index0 == 0 %}{{ transaction.payee }}{% endif %} + {% if loop.first %}{{ transaction.date.strftime('%Y-%m-%d') }}{% endif %} + {% if loop.first %}{{ transaction.payee }}{% endif %} {{ (posting.account|e).__str__().replace(':', ':')|safe }} {% if posting.amount > 0 %}{{ posting.amount|b }}{% endif %} {% if posting.amount < 0 %}{{ -posting.amount|b }}{% endif %} - {% if posting.balance >= 0 %} - {{ posting.balance|b }} Dr - {% else %} - {{ -posting.balance|b }} Cr + {% if loop.last %} + {% if posting.balance >= 0 %} + {{ posting.balance|b }} Dr + {% else %} + {{ -posting.balance|b }} Cr + {% endif %} {% endif %}