From 8c10f1e96a1f7917a3e16dec64686ff6438e6e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sat, 18 Mar 2023 19:34:03 +0800 Subject: [PATCH] Revised the ledger not to show the accumulated balance of the nominal accounts. The accumulated balance does not make sense for nominal accounts. --- src/accounting/report/reports/ledger.py | 2 ++ src/accounting/static/css/style.css | 10 ++++++++-- .../accounting/report/include/ledger-row-desktop.html | 4 +++- .../accounting/report/include/ledger-row-mobile.html | 4 +++- src/accounting/templates/accounting/report/ledger.html | 10 +++++++--- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/accounting/report/reports/ledger.py b/src/accounting/report/reports/ledger.py index d525f15..b452c67 100644 --- a/src/accounting/report/reports/ledger.py +++ b/src/accounting/report/reports/ledger.py @@ -178,6 +178,8 @@ class EntryCollector: :return: None. """ + if self.__account.is_nominal: + return None balance: Decimal = 0 if self.brought_forward is None \ else self.brought_forward.balance for entry in self.entries: diff --git a/src/accounting/static/css/style.css b/src/accounting/static/css/style.css index b735eff..4713fbb 100644 --- a/src/accounting/static/css/style.css +++ b/src/accounting/static/css/style.css @@ -221,12 +221,18 @@ a.accounting-report-table-row { .accounting-journal-table .accounting-report-table-row { grid-template-columns: 1fr 1fr 2fr 4fr 1fr 1fr; } -.accounting-ledger-table .accounting-report-table-row { +.accounting-ledger-real-table .accounting-report-table-row { grid-template-columns: 1fr 4fr 1fr 1fr 1fr; } -.accounting-ledger-table .accounting-report-table-footer .accounting-report-table-row { +.accounting-ledger-real-table .accounting-report-table-footer .accounting-report-table-row { grid-template-columns: 5fr 1fr 1fr 1fr; } +.accounting-ledger-nominal-table .accounting-report-table-row { + grid-template-columns: 1fr 4fr 1fr 1fr; +} +.accounting-ledger-nominal-table .accounting-report-table-footer .accounting-report-table-row { + grid-template-columns: 5fr 1fr 1fr; +} .accounting-income-expenses-table .accounting-report-table-row { grid-template-columns: 1fr 2fr 4fr 1fr 1fr 1fr; } diff --git a/src/accounting/templates/accounting/report/include/ledger-row-desktop.html b/src/accounting/templates/accounting/report/include/ledger-row-desktop.html index b50a1cd..30ffd1e 100644 --- a/src/accounting/templates/accounting/report/include/ledger-row-desktop.html +++ b/src/accounting/templates/accounting/report/include/ledger-row-desktop.html @@ -23,4 +23,6 @@ First written: 2023/3/8
{{ entry.summary|accounting_default }}
{{ entry.debit|accounting_format_amount|accounting_default }}
{{ entry.credit|accounting_format_amount|accounting_default }}
-
{{ entry.balance|accounting_report_format_amount }}
+{% if report.account.is_real %} +
{{ entry.balance|accounting_report_format_amount }}
+{% endif %} diff --git a/src/accounting/templates/accounting/report/include/ledger-row-mobile.html b/src/accounting/templates/accounting/report/include/ledger-row-mobile.html index 2a970ee..03dff3e 100644 --- a/src/accounting/templates/accounting/report/include/ledger-row-mobile.html +++ b/src/accounting/templates/accounting/report/include/ledger-row-mobile.html @@ -37,5 +37,7 @@ First written: 2023/3/5 {% if entry.credit %} -{{ entry.credit|accounting_format_amount }} {% endif %} - {{ entry.balance|accounting_format_amount }} + {% if report.account.is_real %} + {{ entry.balance|accounting_format_amount }} + {% endif %} diff --git a/src/accounting/templates/accounting/report/ledger.html b/src/accounting/templates/accounting/report/ledger.html index 4706c07..ed1a43a 100644 --- a/src/accounting/templates/accounting/report/ledger.html +++ b/src/accounting/templates/accounting/report/ledger.html @@ -49,14 +49,16 @@ First written: 2023/3/5 {% include "accounting/include/pagination.html" %} {% endwith %} -
+
{{ A_("Date") }}
{{ A_("Summary") }}
{{ A_("Debit") }}
{{ A_("Credit") }}
-
{{ A_("Balance") }}
+ {% if report.account.is_real %} +
{{ A_("Balance") }}
+ {% endif %}
@@ -80,7 +82,9 @@ First written: 2023/3/5
{{ A_("Total") }}
{{ entry.debit|accounting_format_amount|accounting_default }}
{{ entry.credit|accounting_format_amount|accounting_default }}
-
{{ entry.balance|accounting_report_format_amount }}
+ {% if report.account.is_real %} +
{{ entry.balance|accounting_report_format_amount }}
+ {% endif %}
{% endwith %}