From 37e793f34022c80b1981a39e84b465f3a044f169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Mon, 6 Jul 2020 23:58:47 +0800 Subject: [PATCH] Revised the cash report template. --- accounting/models.py | 7 ++ accounting/templates/accounting/cash.html | 94 +++++++++++++++++------ 2 files changed, 77 insertions(+), 24 deletions(-) diff --git a/accounting/models.py b/accounting/models.py index daf340d..6ff2d4e 100644 --- a/accounting/models.py +++ b/accounting/models.py @@ -94,6 +94,13 @@ class Transaction(models.Model): credit_sum = sum([x.amount for x in self.credit_records]) return debit_sum == credit_sum + @property + def has_order_hole(self): + """Whether the order of the transactions on this day is not + 1, 2, 3, 4, 5..., and should be reordered. """ + # TODO: To be done + return False + @property def is_cash_income(self): """Whether this transaction is a cash income transaction.""" diff --git a/accounting/templates/accounting/cash.html b/accounting/templates/accounting/cash.html index 92725f2..9139867 100644 --- a/accounting/templates/accounting/cash.html +++ b/accounting/templates/accounting/cash.html @@ -34,34 +34,80 @@ First written: 2020/7/1

{{ request.resolver_match.app_name }}

{% if records %} - - - - - - - - - - - - - - {% for record in records %} + {# The table for large screens #} +
{% trans "Date" context "Accounting|" %}{% trans "Subject" context "Accounting|" %}{% trans "Summary" context "Accounting|" %}{% trans "Income" context "Accounting|" %}{% trans "Expense" context "Accounting|" %}{% trans "Balance" context "Accounting|" %}{% trans "View" context "Accounting|" %}
+ - - - - - - - + + + + + + + - {% endfor %} - + + + {% for record in records %} + + + + + + + + + + {% endfor %} +
{{ record.transaction.date|smart_date }}{{ record.subject.title_zhtw }}{{ record.summary }}{{ record.credit_amount|default:""|intcomma:False }}{{ record.debit_amount|default:""|intcomma:False }}{{ record.amount|intcomma:False }}{% trans "View" context "Accounting|" %}{% trans "Date" context "Accounting|" %}{% trans "Subject" context "Accounting|" %}{% trans "Summary" context "Accounting|" %}{% trans "Income" context "Accounting|" %}{% trans "Expense" context "Accounting|" %}{% trans "Balance" context "Accounting|" %}{% trans "View" context "Accounting|" %}
{{ record.transaction.date|smart_date }}{{ record.subject.title_zhtw }}{{ record.summary }}{% if not record.transaction.is_balanced %} + + {% trans "Unbalanced" context "Accounting|" %} + + {% endif %}{% if record.transaction.has_order_hole %} + + {% trans "Need Reorder" context "Accounting|" %} + + {% endif %}{{ record.credit_amount|default:""|intcomma:False }}{{ record.debit_amount|default:""|intcomma:False }}{{ record.amount|intcomma:False }} + + + {% trans "View" context "Accounting|" %} + +
+ + {# The list for small screens #} + {% else %} -

No data.

+

{% trans "There is currently no data." %}

{% endif %} {% endblock %}