diff --git a/accounting/templates/accounting/income-statement.html b/accounting/templates/accounting/income-statement.html index 08f200e..70fb0d5 100644 --- a/accounting/templates/accounting/income-statement.html +++ b/accounting/templates/accounting/income-statement.html @@ -87,7 +87,7 @@ First written: 2020/7/1 - {% trans "Amount" context "Period|" as text %}{{ text|force_escape }} + {% trans "Amount" context "Accounting|" as text %}{{ text|force_escape }} @@ -99,33 +99,42 @@ First written: 2020/7/1 - {% for group in section.groups %} - -
{{ group.title|title|escape }}
- - - - - {% for item in group.details %} - -
{{ item.title|title|escape }}
- {{ item.balance|accounting_amount }} + {% if section.groups %} + {% for group in section.groups %} + +
{{ group.title|title|escape }}
- - - - {% trans "View" context "Accounting|" as text %}{{ text|force_escape }} - - + + + + {% for item in group.details %} + +
{{ item.title|title|escape }}
+ {{ item.balance|accounting_amount }} + + + + + {% trans "View" context "Accounting|" as text %}{{ text|force_escape }} + + + + {% endfor %} + +
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
+ + {{ group.total|accounting_amount }} + {% endfor %} + {% else %} -
{% trans "Total" context "Period|" as text %}{{ text|force_escape }}
+
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
- {{ group.total|accounting_amount }} + - - {% endfor %} + {% endif %} {% if section.cumulative_total is not None %}
{{ section.cumulative_total.title|title|escape }}
@@ -134,6 +143,9 @@ First written: 2020/7/1 {% endif %} + {% if section.has_next %} + + {% endif %} {% endfor %} diff --git a/accounting/views/__init__.py b/accounting/views/__init__.py index f8266f5..8286729 100644 --- a/accounting/views/__init__.py +++ b/accounting/views/__init__.py @@ -602,7 +602,6 @@ def income_statement(request, period_spec): Q(code="4") | Q(code="5") | Q(code="6") | Q(code="7") | Q(code="8") | Q(code="9")).order_by("code")) cumulative_accounts = { - "4": None, "5": Subject(title=pgettext("Accounting|", "Gross Income")), "6": Subject(title=pgettext("Accounting|", "Operating Income")), "7": Subject(title=pgettext("Accounting|", "Before Tax Income")), @@ -623,13 +622,14 @@ def income_statement(request, period_spec): section.total = sum([x.total for x in section.groups]) cumulative_total = cumulative_total + section.total if section.code in cumulative_accounts: - if cumulative_accounts[section.code] is None: - section.cumulative_total = None - else: - section.cumulative_total\ - = cumulative_accounts[section.code] - section.cumulative_total.balance = None - section.cumulative_total.total = cumulative_total + section.cumulative_total\ + = cumulative_accounts[section.code] + section.cumulative_total.balance = None + section.cumulative_total.total = cumulative_total + else: + section.cumulative_total = None + section.has_next = True + sections[-1].has_next = False return render(request, "accounting/income-statement.html", { "item_list": sections, "reports": ReportUrl(period=period),