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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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