Renamed records to item_list, and record to item in the report templates in the accounting application.

This commit is contained in:
2020-07-19 20:27:00 +08:00
parent 65afcd08d3
commit a62d5df9a3
7 changed files with 191 additions and 191 deletions

View File

@ -79,7 +79,7 @@ First written: 2020/7/17
</div>
</div>
{% if records %}
{% if item_list %}
{% include "mia_core/include/pagination.html" %}
{# The table for large screens #}
@ -95,16 +95,16 @@ First written: 2020/7/17
</tr>
</thead>
<tbody>
{% for record in records %}
<tr class="{% if current_subject.code|first in "12" and record.balance < 0 %} table-danger {% endif %}">
<td>{{ record.label }}</td>
<td class="amount">{{ record.debit|accounting_amount }}</td>
<td class="amount">{{ record.credit|accounting_amount }}</td>
<td class="amount {% if record.balance < 0 %} text-danger {% endif %}">{{ record.balance|accounting_amount }}</td>
<td class="amount {% if record.cumulative_balance < 0 %} text-danger {% endif %}">{{ record.cumulative_balance|accounting_amount }}</td>
{% for item in item_list %}
<tr class="{% if current_subject.code|first in "12" and item.balance < 0 %} table-danger {% endif %}">
<td>{{ item.label }}</td>
<td class="amount">{{ item.debit|accounting_amount }}</td>
<td class="amount">{{ item.credit|accounting_amount }}</td>
<td class="amount {% if item.balance < 0 %} text-danger {% endif %}">{{ item.balance|accounting_amount }}</td>
<td class="amount {% if item.cumulative_balance < 0 %} text-danger {% endif %}">{{ item.cumulative_balance|accounting_amount }}</td>
<td class="actions">
{% if record.month is not None %}
<a class="btn btn-info" role="button" href="{% url "accounting:ledger" current_subject.code record.month|date:"Y-m" %}">
{% if item.month is not None %}
<a class="btn btn-info" role="button" href="{% url "accounting:ledger" current_subject.code item.month|date:"Y-m" %}">
<i class="fas fa-eye"></i>
<span class="d-none d-lg-inline">{% trans "View" context "Accounting|" as text %}{{ text|force_escape }}</span>
</a>
@ -117,47 +117,47 @@ First written: 2020/7/17
{# The list for small screens #}
<ul class="list-group d-sm-none">
{% for record in records %}
<li class="list-group-item {% if current_subject.code|first in "12" and record.balance < 0 %} list-group-item-danger {% endif %}">
{% if record.month is not None %}
<a class="list-group-item-action d-flex justify-content-between align-items-center" href="{% url "accounting:ledger" current_subject.code record.month|date:"Y-m" %}">
{{ record.label }}
{% for item in item_list %}
<li class="list-group-item {% if current_subject.code|first in "12" and item.balance < 0 %} list-group-item-danger {% endif %}">
{% if item.month is not None %}
<a class="list-group-item-action d-flex justify-content-between align-items-center" href="{% url "accounting:ledger" current_subject.code item.month|date:"Y-m" %}">
{{ item.label }}
<div>
<span class="badge badge-success badge-pill">
{{ record.debit|accounting_amount }}
{{ item.debit|accounting_amount }}
</span>
<span class="badge badge-warning badge-pill">
{{ record.credit|accounting_amount }}
{{ item.credit|accounting_amount }}
</span>
<span class="badge {% if record.balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ record.balance|intcomma:False }}
<span class="badge {% if item.balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ item.balance|intcomma:False }}
</span>
<span class="badge {% if record.cumulative_balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ record.cumulative_balance|intcomma:False }}
<span class="badge {% if item.cumulative_balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ item.cumulative_balance|intcomma:False }}
</span>
<span class="badge {% if record.balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ record.balance|intcomma:False }}
<span class="badge {% if item.balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ item.balance|intcomma:False }}
</span>
<span class="badge {% if record.cumulative_balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ record.cumulative_balance|intcomma:False }}
<span class="badge {% if item.cumulative_balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ item.cumulative_balance|intcomma:False }}
</span>
</div>
</a>
{% else %}
<div class="d-flex justify-content-between align-items-center">
{{ record.label }}
{{ item.label }}
<div>
<span class="badge badge-success badge-pill">
{{ record.debit|accounting_amount }}
{{ item.debit|accounting_amount }}
</span>
<span class="badge badge-warning badge-pill">
{{ record.credit|accounting_amount }}
{{ item.credit|accounting_amount }}
</span>
<span class="badge {% if record.balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ record.balance|intcomma:False }}
<span class="badge {% if item.balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ item.balance|intcomma:False }}
</span>
<span class="badge {% if record.cumulative_balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ record.cumulative_balance|intcomma:False }}
<span class="badge {% if item.cumulative_balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ item.cumulative_balance|intcomma:False }}
</span>
</div>
</div>