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

@ -86,7 +86,7 @@ First written: 2020/7/15
</div>
</div>
{% if records %}
{% if item_list %}
{% include "mia_core/include/pagination.html" %}
{# The table for large screens #}
@ -102,16 +102,16 @@ First written: 2020/7/15
</tr>
</thead>
<tbody>
{% for record in records %}
<tr class="{% if record.balance < 0 %} table-danger {% endif %}">
<td>{{ record.label }}</td>
<td class="amount">{{ record.credit|accounting_amount }}</td>
<td class="amount">{{ record.debit|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 item.balance < 0 %} table-danger {% endif %}">
<td>{{ item.label }}</td>
<td class="amount">{{ item.credit|accounting_amount }}</td>
<td class="amount">{{ item.debit|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:cash" current_subject.code record.month|date:"Y-m" %}">
{% if item.month is not None %}
<a class="btn btn-info" role="button" href="{% url "accounting:cash" 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>
@ -124,41 +124,41 @@ First written: 2020/7/15
{# The list for small screens #}
<ul class="list-group d-sm-none">
{% for record in records %}
<li class="list-group-item {% if 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:cash" current_subject.code record.month|date:"Y-m" %}">
{{ record.label }}
{% for item in item_list %}
<li class="list-group-item {% if 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:cash" current_subject.code item.month|date:"Y-m" %}">
{{ item.label }}
<div>
<span class="badge badge-success badge-pill">
{{ record.credit|accounting_amount }}
{{ item.credit|accounting_amount }}
</span>
<span class="badge badge-warning badge-pill">
{{ record.debit|accounting_amount }}
{{ item.debit|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>
</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.credit|accounting_amount }}
{{ item.credit|accounting_amount }}
</span>
<span class="badge badge-warning badge-pill">
{{ record.debit|accounting_amount }}
{{ item.debit|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>

View File

@ -94,7 +94,7 @@ First written: 2020/7/1
{% include "mia_core/include/period-chooser.html" %}
{% if records %}
{% if item_list %}
{% include "mia_core/include/pagination.html" %}
{# The table for large screens #}
@ -111,27 +111,27 @@ First written: 2020/7/1
</tr>
</thead>
<tbody>
{% for record in records %}
<tr class="{% if not record.is_balanced or record.has_order_hole %} table-danger {% endif %}">
<td>{{ record.transaction.date|smart_date }}</td>
<td>{{ record.subject.title|title }}</td>
<td>{{ record.summary|default:"" }}{% if not record.is_balanced %}
{% for item in item_list %}
<tr class="{% if not item.is_balanced or item.has_order_hole %} table-danger {% endif %}">
<td>{{ item.transaction.date|smart_date }}</td>
<td>{{ item.subject.title|title }}</td>
<td>{{ item.summary|default:"" }}{% if not item.is_balanced %}
<span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}{% if record.has_order_hole %}
{% endif %}{% if item.has_order_hole %}
<span class="badge badge-danger badge-pill">
{% trans "Need Reorder" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}</td>
<td class="amount">{{ record.credit_amount|accounting_amount }}</td>
<td class="amount">{{ record.debit_amount|accounting_amount }}</td>
<td class="amount {% if record.balance < 0 %} text-danger {% endif %}">{{ record.balance|accounting_amount }}</td>
<td class="amount">{{ item.credit_amount|accounting_amount }}</td>
<td class="amount">{{ item.debit_amount|accounting_amount }}</td>
<td class="amount {% if item.balance < 0 %} text-danger {% endif %}">{{ item.balance|accounting_amount }}</td>
<td class="actions">
{% if record.sn is not None %}
<a href="{{ record.transaction.get_absolute_url }}" class="btn btn-info" role="button">
{% if item.sn is not None %}
<a href="{{ item.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>
@ -144,23 +144,23 @@ First written: 2020/7/1
{# The list for small screens #}
<ul class="list-group d-md-none">
{% for record in records %}
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole %} list-group-item-danger {% endif %}">
{% if record.sn is not None %}
<a class="list-group-item-action" href="{{ record.transaction.get_absolute_url }}">
{% for item in item_list %}
<li class="list-group-item {% if not item.is_balanced or item.has_order_hole %} list-group-item-danger {% endif %}">
{% if item.sn is not None %}
<a class="list-group-item-action" href="{{ item.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|title }}
{{ item.transaction.date|smart_date }} {{ item.subject.title|title }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
{{ record.summary|default:"" }}
{% if not record.is_balanced %}
{{ item.summary|default:"" }}
{% if not item.is_balanced %}
<span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}
{% if record.has_order_hole %}
{% if item.has_order_hole %}
<span class="badge badge-danger badge-pill">
{% trans "Need Reorder" context "Accounting|" as text %}
{{ text|force_escape }}
@ -169,41 +169,41 @@ First written: 2020/7/1
</div>
</div>
<div>
{% if record.credit_amount is not None %}
{% if item.credit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ record.credit_amount|intcomma:False }}
{{ item.credit_amount|intcomma:False }}
</span>
{% endif %}
{% if record.debit_amount is not None %}
{% if item.debit_amount is not None %}
<span class="badge badge-warning badge-pill">
-{{ record.debit_amount|intcomma:False }}
-{{ item.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 class="badge {% if item.balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ item.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 }}
{{ item.transaction.date|smart_date }} {{ item.subject.title }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>{{ record.summary|default:"" }}</div>
<div>{{ item.summary|default:"" }}</div>
</div>
<div>
{% if record.credit_amount is not None %}
{% if item.credit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ record.credit_amount|intcomma:False }}
{{ item.credit_amount|intcomma:False }}
</span>
{% endif %}
{% if record.debit_amount is not None %}
{% if item.debit_amount is not None %}
<span class="badge badge-warning badge-pill">
-{{ record.debit_amount|intcomma:False }}
-{{ item.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 class="badge {% if item.balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ item.balance|intcomma:False }}
</span>
</div>
{% endif %}

View File

@ -74,7 +74,7 @@ First written: 2020/7/1
{% include "mia_core/include/period-chooser.html" %}
{% if records %}
{% if item_list %}
{% include "mia_core/include/pagination.html" %}
{# The table for large screens #}
@ -91,27 +91,27 @@ First written: 2020/7/1
</tr>
</thead>
<tbody>
{% for record in records %}
<tr class="{% if not record.is_balanced or record.has_order_hole %} table-danger {% endif %}">
<td>{{ record.transaction.date|smart_date }}</td>
<td>{{ record.subject.title|title }}</td>
<td><div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">{{ record.summary|default:"" }}{% if not record.is_balanced %}
{% for item in item_list %}
<tr class="{% if not item.is_balanced or item.has_order_hole %} table-danger {% endif %}">
<td>{{ item.transaction.date|smart_date }}</td>
<td>{{ item.subject.title|title }}</td>
<td><div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">{{ item.summary|default:"" }}{% if not item.is_balanced %}
<span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}{% if record.has_order_hole %}
{% endif %}{% if item.has_order_hole %}
<span class="badge badge-danger badge-pill">
{% trans "Need Reorder" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}</div></td>
<td class="amount">{{ record.debit_amount|accounting_amount }}</td>
<td class="amount">{{ record.credit_amount|accounting_amount }}</td>
<td>{{ record.transaction.note|default:"" }}</td>
<td class="amount">{{ item.debit_amount|accounting_amount }}</td>
<td class="amount">{{ item.credit_amount|accounting_amount }}</td>
<td>{{ item.transaction.note|default:"" }}</td>
<td class="actions">
{% if record.sn is not None %}
<a href="{{ record.transaction.get_absolute_url }}" class="btn btn-info" role="button">
{% if item.sn is not None %}
<a href="{{ item.transaction.get_absolute_url }}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
{% trans "View" context "Accounting|" as text %}{{ text|force_escape }}
</a>
@ -124,24 +124,24 @@ First written: 2020/7/1
{# The list for small screens #}
<ul class="list-group d-lg-none">
{% for record in records %}
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole %} list-group-item-danger {% endif %}">
{% if record.sn is not None %}
<a class="list-group-item-action" href="{{ record.transaction.get_absolute_url }}">
<div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
{% for item in item_list %}
<li class="list-group-item {% if not item.is_balanced or item.has_order_hole %} list-group-item-danger {% endif %}">
{% if item.sn is not None %}
<a class="list-group-item-action" href="{{ item.transaction.get_absolute_url }}">
<div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
<div class="date-subject-line">
{{ record.transaction.date|smart_date }} {{ record.subject.title|title }}
{{ item.transaction.date|smart_date }} {{ item.subject.title|title }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
{{ record.summary|default:"" }}
{% if not record.is_balanced %}
{{ item.summary|default:"" }}
{% if not item.is_balanced %}
<span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}
{% if record.has_order_hole %}
{% if item.has_order_hole %}
<span class="badge badge-danger badge-pill">
{% trans "Need Reorder" context "Accounting|" as text %}
{{ text|force_escape }}
@ -149,30 +149,30 @@ First written: 2020/7/1
{% endif %}
</div>
<div>
{% if record.debit_amount is not None %}
{% if item.debit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ record.debit_amount|intcomma:False }}
{{ item.debit_amount|intcomma:False }}
</span>
{% endif %}
{% if record.credit_amount is not None %}
{% if item.credit_amount is not None %}
<span class="badge badge-warning badge-pill">
{{ record.credit_amount|intcomma:False }}
{{ item.credit_amount|intcomma:False }}
</span>
{% endif %}
</div>
</div>
<div>{{ record.transaction.note|default:"" }}</div>
<div>{{ item.transaction.note|default:"" }}</div>
</div>
</a>
{% else %}
<div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
<div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
<div class="date-subject-line">
{{ record.transaction.date|smart_date }} {{ record.subject.title|title }}
{{ item.transaction.date|smart_date }} {{ item.subject.title|title }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
{{ record.summary|default:"" }}
{% if not record.is_balanced %}
{{ item.summary|default:"" }}
{% if not item.is_balanced %}
<span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %}
{{ text|force_escape }}
@ -180,19 +180,19 @@ First written: 2020/7/1
{% endif %}
</div>
<div>
{% if record.debit_amount is not None %}
{% if item.debit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ record.debit_amount|intcomma:False }}
{{ item.debit_amount|intcomma:False }}
</span>
{% endif %}
{% if record.credit_amount is not None %}
{% if item.credit_amount is not None %}
<span class="badge badge-warning badge-pill">
{{ record.credit_amount|intcomma:False }}
{{ item.credit_amount|intcomma:False }}
</span>
{% endif %}
</div>
</div>
<div>{{ record.transaction.note|default:"" }}</div>
<div>{{ item.transaction.note|default:"" }}</div>
</div>
{% endif %}
</li>

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>

View File

@ -87,7 +87,7 @@ First written: 2020/7/16
{% include "mia_core/include/period-chooser.html" %}
{% if records %}
{% if item_list %}
{% include "mia_core/include/pagination.html" %}
{# The table for large screens #}
@ -104,37 +104,37 @@ First written: 2020/7/16
</tr>
</thead>
<tbody>
{% for record in records %}
<tr class="{% if not record.is_balanced or record.has_order_hole or not record.is_credit_card_paid %} table-danger {% endif %}{% if record.is_existing_equipment %} table-info {% endif %}">
<td>{{ record.transaction.date|smart_date }}</td>
<td>{{ record.subject.title|title }}</td>
<td>{{ record.summary|default:"" }}{% if not record.is_balanced %}
{% for item in item_list %}
<tr class="{% if not item.is_balanced or item.has_order_hole or not item.is_credit_card_paid %} table-danger {% endif %}{% if item.is_existing_equipment %} table-info {% endif %}">
<td>{{ item.transaction.date|smart_date }}</td>
<td>{{ item.subject.title|title }}</td>
<td>{{ item.summary|default:"" }}{% if not item.is_balanced %}
<span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}{% if record.has_order_hole %}
{% endif %}{% if item.has_order_hole %}
<span class="badge badge-danger badge-pill">
{% trans "Need Reorder" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}{% if not record.is_credit_card_paid %}
{% endif %}{% if not item.is_credit_card_paid %}
<span class="badge badge-danger badge-pill">
{% trans "Unpaid" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}{% if record.is_existing_equipment %}
{% endif %}{% if item.is_existing_equipment %}
<span class="badge badge-info badge-pill">
{% trans "Existing" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}</td>
<td class="amount">{{ record.debit_amount|accounting_amount }}</td>
<td class="amount">{{ record.credit_amount|accounting_amount }}</td>
<td class="amount {% if record.balance < 0 %} text-danger {% endif %}">{{ record.balance|accounting_amount }}</td>
<td class="amount">{{ item.debit_amount|accounting_amount }}</td>
<td class="amount">{{ item.credit_amount|accounting_amount }}</td>
<td class="amount {% if item.balance < 0 %} text-danger {% endif %}">{{ item.balance|accounting_amount }}</td>
<td class="actions">
{% if record.sn is not None %}
<a href="{{ record.transaction.get_absolute_url }}" class="btn btn-info" role="button">
{% if item.sn is not None %}
<a href="{{ item.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>
@ -147,35 +147,35 @@ First written: 2020/7/16
{# The list for small screens #}
<ul class="list-group d-md-none">
{% for record in records %}
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole or not record.is_credit_card_paid %} list-group-item-danger {% endif %}{% if record.is_existing_equipment %} list-group-item-info {% endif %}">
{% if record.sn is not None %}
<a class="list-group-item-action" href="{{ record.transaction.get_absolute_url }}">
{% for item in item_list %}
<li class="list-group-item {% if not item.is_balanced or item.has_order_hole or not item.is_credit_card_paid %} list-group-item-danger {% endif %}{% if item.is_existing_equipment %} list-group-item-info {% endif %}">
{% if item.sn is not None %}
<a class="list-group-item-action" href="{{ item.transaction.get_absolute_url }}">
<div class="date-subject-line">
{{ record.transaction.date|smart_date }} {{ record.subject.title|title }}
{{ item.transaction.date|smart_date }} {{ item.subject.title|title }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
{{ record.summary|default:"" }}
{% if not record.is_balanced %}
{{ item.summary|default:"" }}
{% if not item.is_balanced %}
<span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}
{% if record.has_order_hole %}
{% if item.has_order_hole %}
<span class="badge badge-danger badge-pill">
{% trans "Need Reorder" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}
{% if not record.is_credit_card_paid %}
{% if not item.is_credit_card_paid %}
<span class="badge badge-danger badge-pill">
{% trans "Unpaid" context "Accounting|" as text %}
{{ text|force_escape }}
</span>
{% endif %}
{% if record.is_existing_equipment %}
{% if item.is_existing_equipment %}
<span class="badge badge-info badge-pill">
{% trans "Existing" context "Accounting|" as text %}
{{ text|force_escape }}
@ -183,43 +183,43 @@ First written: 2020/7/16
{% endif %}
</div>
<div>
{% if record.debit_amount is not None %}
{% if item.debit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ record.debit_amount|intcomma:False }}
{{ item.debit_amount|intcomma:False }}
</span>
{% endif %}
{% if record.credit_amount is not None %}
{% if item.credit_amount is not None %}
<span class="badge badge-warning badge-pill">
{{ record.credit_amount|intcomma:False }}
{{ item.credit_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 class="badge {% if item.balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ item.balance|intcomma:False }}
</span>
</div>
</div>
</a>
{% else %}
<div class="date-subject-line">
{{ record.transaction.date|smart_date }} {{ record.subject.title|title }}
{{ item.transaction.date|smart_date }} {{ item.subject.title|title }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
{{ record.summary|default:"" }}
{{ item.summary|default:"" }}
</div>
<div>
{% if record.debit_amount is not None %}
{% if item.debit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ record.debit_amount|intcomma:False }}
{{ item.debit_amount|intcomma:False }}
</span>
{% endif %}
{% if record.credit_amount is not None %}
{% if item.credit_amount is not None %}
<span class="badge badge-warning badge-pill">
{{ record.credit_amount|intcomma:False }}
{{ item.credit_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 class="badge {% if item.balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ item.balance|intcomma:False }}
</span>
</div>
</div>

View File

@ -74,7 +74,7 @@ First written: 2020/7/1
{% include "mia_core/include/period-chooser.html" %}
{% if records %}
{% if item_list %}
{% include "mia_core/include/pagination.html" %}
{# The table for large screens #}
@ -95,13 +95,13 @@ First written: 2020/7/1
</tr>
</thead>
<tbody>
{% for record in records %}
{% for item in item_list %}
<tr>
<td>{{ record.title }}</td>
<td class="amount">{{ record.debit|accounting_amount }}</td>
<td class="amount">{{ record.credit|accounting_amount }}</td>
<td>{{ item.title }}</td>
<td class="amount">{{ item.debit|accounting_amount }}</td>
<td class="amount">{{ item.credit|accounting_amount }}</td>
<td class="actions">
<a href="{% url "accounting:ledger" record.code period.spec %}" class="btn btn-info" role="button">
<a href="{% url "accounting:ledger" item.code period.spec %}" 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>
@ -112,8 +112,8 @@ First written: 2020/7/1
<tfoot>
<tr>
<td>{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}</td>
<td class="amount">{{ record_sum.debit|accounting_amount }}</td>
<td class="amount">{{ record_sum.credit|accounting_amount }}</td>
<td class="amount">{{ total_item.debit|accounting_amount }}</td>
<td class="amount">{{ total_item.credit|accounting_amount }}</td>
<td></td>
</tr>
</tfoot>
@ -131,19 +131,19 @@ First written: 2020/7/1
<div class="row">
<div class="col-sm-12">
<ul class="list-group d-lg-none trial-balance-list">
{% for record in records %}
{% for item in item_list %}
<li class="list-group-item">
<a class="list-group-item-action d-flex justify-content-between align-items-center" href="{% url "accounting:ledger" record.code period.spec %}">
{{ record.title }}
<a class="list-group-item-action d-flex justify-content-between align-items-center" href="{% url "accounting:ledger" item.code period.spec %}">
{{ item.title }}
<div>
{% if record.debit is not None %}
{% if item.debit is not None %}
<span class="badge badge-success badge-pill">
{{ record.debit|intcomma:False }}
{{ item.debit|intcomma:False }}
</span>
{% endif %}
{% if record.credit is not None %}
{% if item.credit is not None %}
<span class="badge badge-warning badge-pill">
{{ record.credit|intcomma:False }}
{{ item.credit|intcomma:False }}
</span>
{% endif %}
</div>
@ -154,10 +154,10 @@ First written: 2020/7/1
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
<div>
<span class="badge badge-success badge-pill">
{{ record_sum.debit|intcomma:False }}
{{ total_item.debit|intcomma:False }}
</span>
<span class="badge badge-warning badge-pill">
{{ record_sum.credit|intcomma:False }}
{{ total_item.credit|intcomma:False }}
</span>
</div>
</li>

View File

@ -221,7 +221,7 @@ def cash(request, subject_code, period_spec):
_find_order_holes(records)
shortcut_subjects = settings.ACCOUNTING["CASH_SHORTCUT_SUBJECTS"]
return render(request, "accounting/cash.html", {
"records": records,
"item_list": records,
"pagination": pagination,
"current_subject": current_subject,
"period": period,
@ -300,7 +300,7 @@ def cash_summary(request, subject_code):
pagination = Pagination(request, records, True)
shortcut_subjects = settings.ACCOUNTING["CASH_SHORTCUT_SUBJECTS"]
return render(request, "accounting/cash-summary.html", {
"records": pagination.records,
"item_list": pagination.records,
"pagination": pagination,
"current_subject": current_subject,
"reports": ReportUrl(cash=current_subject),
@ -379,7 +379,7 @@ def ledger(request, subject_code, period_spec):
_find_imbalanced(records)
_find_order_holes(records)
return render(request, "accounting/ledger.html", {
"records": records,
"item_list": records,
"pagination": pagination,
"current_subject": current_subject,
"period": period,
@ -427,7 +427,7 @@ def ledger_summary(request, subject_code):
))
pagination = Pagination(request, records, True)
return render(request, "accounting/ledger-summary.html", {
"records": pagination.records,
"item_list": pagination.records,
"pagination": pagination,
"current_subject": current_subject,
"reports": ReportUrl(ledger=current_subject),
@ -490,7 +490,7 @@ def journal(request, period_spec):
+ list(records)
pagination = Pagination(request, records, True)
return render(request, "accounting/journal.html", {
"records": pagination.records,
"item_list": pagination.records,
"pagination": pagination,
"period": period,
})
@ -570,8 +570,8 @@ def trial_balance(request, period_spec):
record_sum.credit = sum([x.credit for x in records
if x.credit is not None])
return render(request, "accounting/trial-balance.html", {
"records": records,
"record_sum": record_sum,
"item_list": records,
"total_item": record_sum,
"reports": ReportUrl(period=period),
"period": period,
})