Added the balance-before record and the sum record to the cash account report. Moved the SqlQuery utility from the accounting application to the Mia core application.

This commit is contained in:
2020-07-13 19:54:27 +08:00
parent fa7416d0f3
commit 39c75f772a
4 changed files with 150 additions and 41 deletions

View File

@ -95,7 +95,7 @@ First written: 2020/7/1
<tr class="{% if not record.transaction.is_balanced or record.transaction.has_order_hole %} table-danger {% endif %}">
<td>{{ record.transaction.date|smart_date }}</td>
<td>{{ record.subject.title_zhtw }}</td>
<td>{{ record.summary }}{% if not record.transaction.is_balanced %}
<td>{{ record.summary|default:"" }}{% if not record.transaction.is_balanced %}
<span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %}
{{ text|force_escape }}
@ -106,14 +106,16 @@ First written: 2020/7/1
{{ text|force_escape }}
</span>
{% endif %}</td>
<td class="amount">{{ record.credit_amount|default:""|intcomma:False }}</td>
<td class="amount">{{ record.debit_amount|default:""|intcomma:False }}</td>
<td class="amount">{{ record.amount|intcomma:False }}</td>
<td class="amount">{% if record.credit_amount is not None %}{{ record.credit_amount|intcomma:False }}{% endif %}</td>
<td class="amount">{% if record.debit_amount is not None %}{{ record.debit_amount|intcomma:False }}{% endif %}</td>
<td class="amount">{{ record.balance|intcomma:False }}</td>
<td class="actions">
<a href="{{ record.transaction.get_absolute_url }}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
<span class="d-none d-lg-inline">{% trans "View" context "Accounting|" as text %}{{ text|force_escape }}</span>
</a>
{% if record.sn is not None %}
<a href="{{ record.transaction.get_absolute_url }}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
<span class="d-none d-lg-inline">{% trans "View" context "Accounting|" as text %}{{ text|force_escape }}</span>
</a>
{% endif %}
</td>
</tr>
{% endfor %}
@ -124,32 +126,47 @@ First written: 2020/7/1
<ul class="list-group d-md-none">
{% for record in records %}
<li class="list-group-item {% if not record.transaction.is_balanced or record.transaction.has_order_hole %} list-group-item-danger {% endif %}">
<a class="list-group-item-action" href="{{ record.transaction.get_absolute_url }}">
{% if record.sn is not None %}
<a class="list-group-item-action" href="{{ record.transaction.get_absolute_url }}">
<div class="date-subject-line d-flex justify-content-between align-items-center">
{{ record.transaction.date|smart_date }} {{ record.subject.title_zhtw }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
{{ record.summary|default:"" }}
{% if not record.transaction.is_balanced %}
<span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}
{% if record.transaction.has_order_hole %}
<span class="badge badge-danger badge-pill">
{% trans "Need Reorder" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}
</div>
</div>
<div>
{% if record.credit_amount is not None %}<span class="badge badge-success badge-pill">{{ record.credit_amount|intcomma:False }}</span>{% endif %}
{% if record.debit_amount is not None %}<span class="badge badge-warning badge-pill">-{{ record.debit_amount|intcomma:False }}</span>{% endif %}
<span class="badge {% if record.balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">{{ record.balance|intcomma:False }}</span>
</div>
</a>
{% else %}
<div class="date-subject-line d-flex justify-content-between align-items-center">
{{ record.transaction.date|smart_date }} {{ record.subject.title_zhtw }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
{{ record.summary }}
{% if not record.transaction.is_balanced %}
<span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}
{% if record.transaction.has_order_hole %}
<span class="badge badge-danger badge-pill">
{% trans "Need Reorder" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}
</div>
<div>{{ record.summary|default:"" }}</div>
</div>
<div>
<span class="badge {% if not record.is_credit %} badge-warning {% else %} badge-success {% endif %} badge-pill">{{ record.amount|intcomma:False }}</span>
{% if record.credit_amount is not None %}<span class="badge badge-success badge-pill">{{ record.credit_amount|intcomma:False }}</span>{% endif %}
{% if record.debit_amount is not None %}<span class="badge badge-warning badge-pill">-{{ record.debit_amount|intcomma:False }}</span>{% endif %}
<span class="badge {% if record.balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">{{ record.balance|intcomma:False }}</span>
</div>
</a>
{% endif %}
</li>
{% endfor %}
</ul>