Renamed the template variables in the accounting reports to be more meaningful in the accounting application.

This commit is contained in:
依瑪貓 2020-08-08 13:53:48 +08:00
parent c7e1fd323d
commit fe1e4a40be
10 changed files with 250 additions and 250 deletions

View File

@ -88,12 +88,12 @@ First written: 2020/7/20
<td class="amount"></td>
<td class="actions"></td>
</tr>
{% for item in group.details %}
{% for account in group.details %}
<tr>
<td><div class="account">{{ item.title|title_case }}</div></td>
<td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td>
<td><div class="account">{{ account.title|title_case }}</div></td>
<td class="amount {% if account.amount < 0 %} text-danger {% endif %}">{{ account.amount|accounting_amount }}</td>
<td class="actions">
<a href="{{ item.url }}" class="btn btn-info" role="button">
<a href="{{ account.url }}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
{{ _("View")|force_escape }}
</a>
@ -119,12 +119,12 @@ First written: 2020/7/20
<td class="amount"></td>
<td class="actions"></td>
</tr>
{% for item in group.details %}
{% for account in group.details %}
<tr>
<td><div class="account">{{ item.title|title_case }}</div></td>
<td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td>
<td><div class="account">{{ account.title|title_case }}</div></td>
<td class="amount {% if account.amount < 0 %} text-danger {% endif %}">{{ account.amount|accounting_amount }}</td>
<td class="actions">
<a href="{{ item.url }}" class="btn btn-info" role="button">
<a href="{{ account.url }}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
{{ _("View")|force_escape }}
</a>
@ -156,12 +156,12 @@ First written: 2020/7/20
<td class="amount"></td>
<td class="actions"></td>
</tr>
{% for item in group.details %}
{% for account in group.details %}
<tr>
<td><div class="account">{{ item.title|title_case }}</div></td>
<td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td>
<td><div class="account">{{ account.title|title_case }}</div></td>
<td class="amount {% if account.amount < 0 %} text-danger {% endif %}">{{ account.amount|accounting_amount }}</td>
<td class="actions">
<a href="{{ item.url }}" class="btn btn-info" role="button">
<a href="{{ account.url }}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
{{ _("View")|force_escape }}
</a>
@ -227,13 +227,13 @@ First written: 2020/7/20
<li class="list-group-item d-flex justify-content-between align-items-center group-title">
{{ group.title|title_case }}
</li>
{% for item in group.details %}
{% for account in group.details %}
<li class="list-group-item d-flex justify-content-between align-items-center account">
<a class="list-group-item-action" href="{{ item.url }}">
{{ item.title|title_case }}
<a class="list-group-item-action" href="{{ account.url }}">
{{ account.title|title_case }}
<div class="float-right">
<span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ item.amount|accounting_amount }}
<span class="badge {% if account.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ account.amount|accounting_amount }}
</span>
</div>
</a>
@ -258,13 +258,13 @@ First written: 2020/7/20
<li class="list-group-item d-flex justify-content-between align-items-center group-title">
{{ group.title|title_case }}
</li>
{% for item in group.details %}
{% for account in group.details %}
<li class="list-group-item d-flex justify-content-between align-items-center account">
<a class="list-group-item-action" href="{{ item.url }}">
{{ item.title|title_case }}
<a class="list-group-item-action" href="{{ account.url }}">
{{ account.title|title_case }}
<div class="float-right">
<span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ item.amount|accounting_amount }}
<span class="badge {% if account.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ account.amount|accounting_amount }}
</span>
</div>
</a>
@ -287,13 +287,13 @@ First written: 2020/7/20
<li class="list-group-item d-flex justify-content-between align-items-center group-title">
{{ group.title|title_case }}
</li>
{% for item in group.details %}
{% for account in group.details %}
<li class="list-group-item d-flex justify-content-between align-items-center account">
<a class="list-group-item-action" href="{{ item.url }}">
{{ item.title|title_case }}
<a class="list-group-item-action" href="{{ account.url }}">
{{ account.title|title_case }}
<div class="float-right">
<span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ item.amount|accounting_amount }}
<span class="badge {% if account.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ account.amount|accounting_amount }}
</span>
</div>
</a>

View File

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

View File

@ -87,7 +87,7 @@ First written: 2020/7/1
{% include "mia_core/include/period-chooser.html" %}
{% endwith %}
{% if item_list %}
{% if record_list %}
{% include "mia_core/include/pagination.html" %}
{# The table for large screens #}
@ -104,25 +104,25 @@ First written: 2020/7/1
</tr>
</thead>
<tbody>
{% 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.account.title|title_case }}</td>
<td>{{ item.summary|default:"" }}{% if not item.is_balanced %}
{% for record in record_list %}
<tr class="{% if not record.is_balanced or record.has_order_hole %} table-danger {% endif %}">
<td>{{ record.transaction.date|smart_date }}</td>
<td>{{ record.account.title|title_case }}</td>
<td>{{ record.summary|default:"" }}{% if not record.is_balanced %}
<span class="badge badge-danger badge-pill">
{{ _("Unbalanced")|force_escape }}
</span>
{% endif %}{% if item.has_order_hole %}
{% endif %}{% if record.has_order_hole %}
<span class="badge badge-danger badge-pill">
{{ _("Need Reorder")|force_escape }}
</span>
{% endif %}</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="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="actions">
{% if item.pk is not None %}
<a href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}" class="btn btn-info" role="button">
{% if record.pk is not None %}
<a href="{% url_with_return "accounting:transactions.show" record.transaction.type record.transaction %}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
<span class="d-none d-lg-inline">{{ _("View")|force_escape }}</span>
</a>
@ -135,22 +135,22 @@ First written: 2020/7/1
{# The list for small screens #}
<ul class="list-group d-md-none">
{% 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.pk is not None %}
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}">
{% for record in record_list %}
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole %} list-group-item-danger {% endif %}">
{% if record.pk is not None %}
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" record.transaction.type record.transaction %}">
<div class="date-account-line d-flex justify-content-between align-items-center">
{{ item.transaction.date|smart_date }} {{ item.account.title|title_case }}
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
{{ item.summary|default:"" }}
{% if not item.is_balanced %}
{{ record.summary|default:"" }}
{% if not record.is_balanced %}
<span class="badge badge-danger badge-pill">
{{ _("Unbalanced")|force_escape }}
</span>
{% endif %}
{% if item.has_order_hole %}
{% if record.has_order_hole %}
<span class="badge badge-danger badge-pill">
{{ _("Need Reorder")|force_escape }}
</span>
@ -158,41 +158,41 @@ First written: 2020/7/1
</div>
</div>
<div>
{% if item.credit_amount is not None %}
{% if record.credit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ item.credit_amount|intcomma:False }}
{{ record.credit_amount|intcomma:False }}
</span>
{% endif %}
{% if item.debit_amount is not None %}
{% if record.debit_amount is not None %}
<span class="badge badge-warning badge-pill">
-{{ item.debit_amount|intcomma:False }}
-{{ record.debit_amount|intcomma:False }}
</span>
{% endif %}
<span class="badge {% if item.balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ item.balance|intcomma:False }}
<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-account-line d-flex justify-content-between align-items-center">
{{ item.transaction.date|smart_date }} {{ item.account.title }}
{{ record.transaction.date|smart_date }} {{ record.account.title }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>{{ item.summary|default:"" }}</div>
<div>{{ record.summary|default:"" }}</div>
</div>
<div>
{% if item.credit_amount is not None %}
{% if record.credit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ item.credit_amount|intcomma:False }}
{{ record.credit_amount|intcomma:False }}
</span>
{% endif %}
{% if item.debit_amount is not None %}
{% if record.debit_amount is not None %}
<span class="badge badge-warning badge-pill">
-{{ item.debit_amount|intcomma:False }}
-{{ record.debit_amount|intcomma:False }}
</span>
{% endif %}
<span class="badge {% if item.balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ item.balance|intcomma:False }}
<span class="badge {% if record.balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ record.balance|intcomma:False }}
</span>
</div>
{% endif %}

View File

@ -84,7 +84,7 @@ First written: 2020/7/19
</tr>
</thead>
<tbody>
{% for section in item_list %}
{% for section in section_list %}
<tr class="section-title">
<td><div>{{ section.title|title_case }}</div></td>
<td class="amount"></td>
@ -99,13 +99,13 @@ First written: 2020/7/19
<td class="amount"></td>
<td class="actions"></td>
</tr>
{% for item in group.details %}
{% for account in group.details %}
<tr>
<td><div class="account">{{ item.title|title_case }}</div></td>
<td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td>
<td><div class="account">{{ account.title|title_case }}</div></td>
<td class="amount {% if account.amount < 0 %} text-danger {% endif %}">{{ account.amount|accounting_amount }}</td>
<td class="amount"></td>
<td class="actions">
<a href="{% url "accounting:ledger" item request.resolver_match.kwargs.period %}" class="btn btn-info" role="button">
<a href="{% url "accounting:ledger" account request.resolver_match.kwargs.period %}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
<span class="d-none d-lg-inline">{{ _("View")|force_escape }}</span>
</a>
@ -154,7 +154,7 @@ First written: 2020/7/19
<div class="row">
<div class="col-sm-12">
<ul class="list-group income-statement-list">
{% for section in item_list %}
{% for section in section_list %}
<li class="list-group-item d-flex justify-content-between align-items-center section-title">
{{ section.title|title_case }}
</li>
@ -163,13 +163,13 @@ First written: 2020/7/19
<li class="list-group-item d-flex justify-content-between align-items-center group-title">
{{ group.title|title_case }}
</li>
{% for item in group.details %}
{% for account in group.details %}
<li class="list-group-item d-flex justify-content-between align-items-center account">
<a class="list-group-item-action" href="{% url "accounting:ledger" item request.resolver_match.kwargs.period %}">
{{ item.title|title_case }}
<a class="list-group-item-action" href="{% url "accounting:ledger" account request.resolver_match.kwargs.period %}">
{{ account.title|title_case }}
<div class="float-right">
<span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ item.amount|accounting_amount }}
<span class="badge {% if account.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ account.amount|accounting_amount }}
</span>
</div>
</a>

View File

@ -67,7 +67,7 @@ First written: 2020/7/17
{% include "mia_core/include/period-chooser.html" %}
{% endwith %}
{% if item_list %}
{% if record_list %}
{% include "mia_core/include/pagination.html" %}
{# The table for large screens #}
@ -84,25 +84,25 @@ First written: 2020/7/17
</tr>
</thead>
<tbody>
{% 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.account.title|title_case }}</td>
<td><div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">{{ item.summary|default:"" }}{% if not item.is_balanced %}
{% for record in record_list %}
<tr class="{% if not record.is_balanced or record.has_order_hole %} table-danger {% endif %}">
<td>{{ record.transaction.date|smart_date }}</td>
<td>{{ record.account.title|title_case }}</td>
<td><div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">{{ record.summary|default:"" }}{% if not record.is_balanced %}
<span class="badge badge-danger badge-pill">
{{ _("Unbalanced")|force_escape }}
</span>
{% endif %}{% if item.has_order_hole %}
{% endif %}{% if record.has_order_hole %}
<span class="badge badge-danger badge-pill">
{{ _("Need Reorder")|force_escape }}
</span>
{% endif %}</div></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="amount">{{ record.debit_amount|accounting_amount }}</td>
<td class="amount">{{ record.credit_amount|accounting_amount }}</td>
<td>{{ record.transaction.note|default:"" }}</td>
<td class="actions">
{% if item.pk is not None %}
<a href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}" class="btn btn-info" role="button">
{% if record.pk is not None %}
<a href="{% url_with_return "accounting:transactions.show" record.transaction.type record.transaction %}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
{{ _("View")|force_escape }}
</a>
@ -115,72 +115,72 @@ First written: 2020/7/17
{# The list for small screens #}
<ul class="list-group d-lg-none">
{% 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.pk is not None %}
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}">
<div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
{% for record in record_list %}
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole %} list-group-item-danger {% endif %}">
{% if record.pk is not None %}
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" record.transaction.type record.transaction %}">
<div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
<div class="date-account-line">
{{ item.transaction.date|smart_date }} {{ item.account.title|title_case }}
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
{{ item.summary|default:"" }}
{% if not item.is_balanced %}
{{ record.summary|default:"" }}
{% if not record.is_balanced %}
<span class="badge badge-danger badge-pill">
{{ _("Unbalanced")|force_escape }}
</span>
{% endif %}
{% if item.has_order_hole %}
{% if record.has_order_hole %}
<span class="badge badge-danger badge-pill">
{{ _("Need Reorder")|force_escape }}
</span>
{% endif %}
</div>
<div>
{% if item.debit_amount is not None %}
{% if record.debit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ item.debit_amount|intcomma:False }}
{{ record.debit_amount|intcomma:False }}
</span>
{% endif %}
{% if item.credit_amount is not None %}
{% if record.credit_amount is not None %}
<span class="badge badge-warning badge-pill">
{{ item.credit_amount|intcomma:False }}
{{ record.credit_amount|intcomma:False }}
</span>
{% endif %}
</div>
</div>
<div>{{ item.transaction.note|default:"" }}</div>
<div>{{ record.transaction.note|default:"" }}</div>
</div>
</a>
{% else %}
<div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
<div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
<div class="date-account-line">
{{ item.transaction.date|smart_date }} {{ item.account.title|title_case }}
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
{{ item.summary|default:"" }}
{% if not item.is_balanced %}
{{ record.summary|default:"" }}
{% if not record.is_balanced %}
<span class="badge badge-danger badge-pill">
{{ _("Unbalanced")|force_escape }}
</span>
{% endif %}
</div>
<div>
{% if item.debit_amount is not None %}
{% if record.debit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ item.debit_amount|intcomma:False }}
{{ record.debit_amount|intcomma:False }}
</span>
{% endif %}
{% if item.credit_amount is not None %}
{% if record.credit_amount is not None %}
<span class="badge badge-warning badge-pill">
{{ item.credit_amount|intcomma:False }}
{{ record.credit_amount|intcomma:False }}
</span>
{% endif %}
</div>
</div>
<div>{{ item.transaction.note|default:"" }}</div>
<div>{{ record.transaction.note|default:"" }}</div>
</div>
{% endif %}
</li>

View File

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

View File

@ -80,7 +80,7 @@ First written: 2020/7/16
{% include "mia_core/include/period-chooser.html" %}
{% endwith %}
{% if item_list %}
{% if record_list %}
{% include "mia_core/include/pagination.html" %}
{# The table for large screens #}
@ -97,33 +97,33 @@ First written: 2020/7/16
</tr>
</thead>
<tbody>
{% for item in item_list %}
<tr class="{% if not item.is_balanced or item.has_order_hole or item.is_payable %} table-danger {% endif %}{% if item.is_existing_equipment %} table-info {% endif %}">
<td>{{ item.transaction.date|smart_date }}</td>
<td>{{ item.account.title|title_case }}</td>
<td>{{ item.summary|default:"" }}{% if not item.is_balanced %}
{% for record in record_list %}
<tr class="{% if not record.is_balanced or record.has_order_hole or record.is_payable %} table-danger {% endif %}{% if record.is_existing_equipment %} table-info {% endif %}">
<td>{{ record.transaction.date|smart_date }}</td>
<td>{{ record.account.title|title_case }}</td>
<td>{{ record.summary|default:"" }}{% if not record.is_balanced %}
<span class="badge badge-danger badge-pill">
{{ _("Unbalanced")|force_escape }}
</span>
{% endif %}{% if item.has_order_hole %}
{% endif %}{% if record.has_order_hole %}
<span class="badge badge-danger badge-pill">
{{ _("Need Reorder")|force_escape }}
</span>
{% endif %}{% if item.is_payable %}
{% endif %}{% if record.is_payable %}
<span class="badge badge-danger badge-pill">
{{ _("Payable")|force_escape }}
</span>
{% endif %}{% if item.is_existing_equipment %}
{% endif %}{% if record.is_existing_equipment %}
<span class="badge badge-info badge-pill">
{{ _("Existing")|force_escape }}
</span>
{% endif %}</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="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="actions">
{% if item.pk is not None %}
<a href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}" class="btn btn-info" role="button">
{% if record.pk is not None %}
<a href="{% url_with_return "accounting:transactions.show" record.transaction.type record.transaction %}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
<span class="d-none d-lg-inline">{{ _("View")|force_escape }}</span>
</a>
@ -136,75 +136,75 @@ First written: 2020/7/16
{# The list for small screens #}
<ul class="list-group d-md-none">
{% for item in item_list %}
<li class="list-group-item {% if not item.is_balanced or item.has_order_hole or item.is_payable %} list-group-item-danger {% endif %}{% if item.is_existing_equipment %} list-group-item-info {% endif %}">
{% if item.pk is not None %}
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}">
{% for record in record_list %}
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole or record.is_payable %} list-group-item-danger {% endif %}{% if record.is_existing_equipment %} list-group-item-info {% endif %}">
{% if record.pk is not None %}
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" record.transaction.type record.transaction %}">
<div class="date-account-line">
{{ item.transaction.date|smart_date }} {{ item.account.title|title_case }}
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
{{ item.summary|default:"" }}
{% if not item.is_balanced %}
{{ record.summary|default:"" }}
{% if not record.is_balanced %}
<span class="badge badge-danger badge-pill">
{{ _("Unbalanced")|force_escape }}
</span>
{% endif %}
{% if item.has_order_hole %}
{% if record.has_order_hole %}
<span class="badge badge-danger badge-pill">
{{ _("Need Reorder")|force_escape }}
</span>
{% endif %}
{% if item.is_payable %}
{% if record.is_payable %}
<span class="badge badge-danger badge-pill">
{{ _("Payable")|force_escape }}
</span>
{% endif %}
{% if item.is_existing_equipment %}
{% if record.is_existing_equipment %}
<span class="badge badge-info badge-pill">
{{ _("Existing")|force_escape }}
</span>
{% endif %}
</div>
<div>
{% if item.debit_amount is not None %}
{% if record.debit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ item.debit_amount|intcomma:False }}
{{ record.debit_amount|intcomma:False }}
</span>
{% endif %}
{% if item.credit_amount is not None %}
{% if record.credit_amount is not None %}
<span class="badge badge-warning badge-pill">
{{ item.credit_amount|intcomma:False }}
{{ record.credit_amount|intcomma:False }}
</span>
{% endif %}
<span class="badge {% if item.balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ item.balance|intcomma:False }}
<span class="badge {% if record.balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ record.balance|intcomma:False }}
</span>
</div>
</div>
</a>
{% else %}
<div class="date-account-line">
{{ item.transaction.date|smart_date }} {{ item.account.title|title_case }}
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
{{ item.summary|default:"" }}
{{ record.summary|default:"" }}
</div>
<div>
{% if item.debit_amount is not None %}
{% if record.debit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ item.debit_amount|intcomma:False }}
{{ record.debit_amount|intcomma:False }}
</span>
{% endif %}
{% if item.credit_amount is not None %}
{% if record.credit_amount is not None %}
<span class="badge badge-warning badge-pill">
{{ item.credit_amount|intcomma:False }}
{{ record.credit_amount|intcomma:False }}
</span>
{% endif %}
<span class="badge {% if item.balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ item.balance|intcomma:False }}
<span class="badge {% if record.balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ record.balance|intcomma:False }}
</span>
</div>
</div>

View File

@ -66,7 +66,7 @@ First written: 2020/7/21
</form>
</div>
{% if item_list %}
{% if record_list %}
{% include "mia_core/include/pagination.html" %}
{# The table for large screens #}
@ -83,24 +83,24 @@ First written: 2020/7/21
</tr>
</thead>
<tbody>
{% 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.account.title|title_case }}</td>
<td><div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">{{ item.summary|default:"" }}{% if not item.is_balanced %}
{% for record in record_list %}
<tr class="{% if not record.is_balanced or record.has_order_hole %} table-danger {% endif %}">
<td>{{ record.transaction.date|smart_date }}</td>
<td>{{ record.account.title|title_case }}</td>
<td><div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">{{ record.summary|default:"" }}{% if not record.is_balanced %}
<span class="badge badge-danger badge-pill">
{{ _("Unbalanced")|force_escape }}
</span>
{% endif %}{% if item.has_order_hole %}
{% endif %}{% if record.has_order_hole %}
<span class="badge badge-danger badge-pill">
{{ _("Need Reorder")|force_escape }}
</span>
{% endif %}</div></td>
<td class="amount">{{ item.debit_amount|accounting_amount }}</td>
<td class="amount">{{ item.credit_amount|accounting_amount }}</td>
<td>{{ item.transaction.notes|default:"" }}</td>
<td class="amount">{{ record.debit_amount|accounting_amount }}</td>
<td class="amount">{{ record.credit_amount|accounting_amount }}</td>
<td>{{ record.transaction.notes|default:"" }}</td>
<td class="actions">
<a href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}" class="btn btn-info" role="button">
<a href="{% url_with_return "accounting:transactions.show" record.transaction.type record.transaction %}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
{{ _("View")|force_escape }}
</a>
@ -112,41 +112,41 @@ First written: 2020/7/21
{# The list for small screens #}
<ul class="list-group d-md-none">
{% 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 %}">
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}">
<div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
{% for record in record_list %}
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole %} list-group-item-danger {% endif %}">
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" record.transaction.type record.transaction %}">
<div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
<div class="date-account-line">
{{ item.transaction.date|smart_date }} {{ item.account.title|title_case }}
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
{{ item.summary|default:"" }}
{% if not item.is_balanced %}
{{ record.summary|default:"" }}
{% if not record.is_balanced %}
<span class="badge badge-danger badge-pill">
{{ _("Unbalanced")|force_escape }}
</span>
{% endif %}
{% if item.has_order_hole %}
{% if record.has_order_hole %}
<span class="badge badge-danger badge-pill">
{{ _("Need Reorder")|force_escape }}
</span>
{% endif %}
</div>
<div>
{% if item.debit_amount is not None %}
{% if record.debit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ item.debit_amount|intcomma:False }}
{{ record.debit_amount|intcomma:False }}
</span>
{% endif %}
{% if item.credit_amount is not None %}
{% if record.credit_amount is not None %}
<span class="badge badge-warning badge-pill">
{{ item.credit_amount|intcomma:False }}
{{ record.credit_amount|intcomma:False }}
</span>
{% endif %}
</div>
</div>
<div>{{ item.transaction.note|default:"" }}</div>
<div>{{ record.transaction.note|default:"" }}</div>
</div>
</a>
</li>

View File

@ -67,7 +67,7 @@ First written: 2020/7/19
{% include "mia_core/include/period-chooser.html" %}
{% endwith %}
{% if item_list %}
{% if account_list %}
{% include "mia_core/include/pagination.html" %}
{# The table for large screens #}
@ -88,13 +88,13 @@ First written: 2020/7/19
</tr>
</thead>
<tbody>
{% for item in item_list %}
{% for account in account_list %}
<tr>
<td>{{ item.title|title_case }}</td>
<td class="amount">{{ item.debit_amount|accounting_amount }}</td>
<td class="amount">{{ item.credit_amount|accounting_amount }}</td>
<td>{{ account.title|title_case }}</td>
<td class="amount">{{ account.debit_amount|accounting_amount }}</td>
<td class="amount">{{ account.credit_amount|accounting_amount }}</td>
<td class="actions">
<a href="{% url "accounting:ledger" item request.resolver_match.kwargs.period %}" class="btn btn-info" role="button">
<a href="{% url "accounting:ledger" account request.resolver_match.kwargs.period %}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
<span class="d-none d-lg-inline">{{ _("View")|force_escape }}</span>
</a>
@ -124,19 +124,19 @@ First written: 2020/7/19
<div class="row">
<div class="col-sm-12">
<ul class="list-group d-lg-none trial-balance-list">
{% for item in item_list %}
{% for account in account_list %}
<li class="list-group-item">
<a class="list-group-item-action d-flex justify-content-between align-items-center" href="{% url "accounting:ledger" item request.resolver_match.kwargs.period %}">
{{ item.title|title_case }}
<a class="list-group-item-action d-flex justify-content-between align-items-center" href="{% url "accounting:ledger" account request.resolver_match.kwargs.period %}">
{{ account.title|title_case }}
<div>
{% if item.debit_amount is not None %}
{% if account.debit_amount is not None %}
<span class="badge badge-success badge-pill">
{{ item.debit_amount|intcomma:False }}
{{ account.debit_amount|intcomma:False }}
</span>
{% endif %}
{% if item.credit_amount is not None %}
{% if account.credit_amount is not None %}
<span class="badge badge-warning badge-pill">
{{ item.credit_amount|intcomma:False }}
{{ account.credit_amount|intcomma:False }}
</span>
{% endif %}
</div>

View File

@ -160,7 +160,7 @@ def cash(request, account, period):
accounts = get_cash_accounts()
shortcut_accounts = settings.ACCOUNTING["CASH_SHORTCUT_ACCOUNTS"]
return render(request, "accounting/cash.html", {
"item_list": records,
"record_list": records,
"pagination": pagination,
"shortcut_accounts": [x for x in accounts
if x.code in shortcut_accounts],
@ -258,7 +258,7 @@ def cash_summary(request, account):
return HttpResponseRedirect(e.url)
shortcut_accounts = settings.ACCOUNTING["CASH_SHORTCUT_ACCOUNTS"]
return render(request, "accounting/cash-summary.html", {
"item_list": pagination.items,
"month_list": pagination.items,
"pagination": pagination,
"shortcut_accounts": [x for x in accounts if
x.code in shortcut_accounts],
@ -339,7 +339,7 @@ def ledger(request, account, period):
find_payable_records(account, records)
find_existing_equipments(account, records)
return render(request, "accounting/ledger.html", {
"item_list": records,
"record_list": records,
"pagination": pagination,
"accounts": get_ledger_accounts(),
})
@ -402,7 +402,7 @@ def ledger_summary(request, account):
except PaginationException as e:
return HttpResponseRedirect(e.url)
return render(request, "accounting/ledger-summary.html", {
"item_list": pagination.items,
"month_list": pagination.items,
"pagination": pagination,
"accounts": get_ledger_accounts(),
})
@ -485,7 +485,7 @@ def journal(request, period):
except PaginationException as e:
return HttpResponseRedirect(e.url)
return render(request, "accounting/journal.html", {
"item_list": pagination.items,
"record_list": pagination.items,
"pagination": pagination,
})
@ -588,7 +588,7 @@ def trial_balance(request, period):
total_account.credit_amount = sum([x.credit_amount for x in accounts
if x.credit_amount is not None])
return render(request, "accounting/trial-balance.html", {
"item_list": accounts,
"account_list": accounts,
"total_item": total_account,
})
@ -664,7 +664,7 @@ def income_statement(request, period):
section.has_next = True
sections[-1].has_next = False
return render(request, "accounting/income-statement.html", {
"item_list": sections,
"section_list": sections,
})
@ -794,7 +794,7 @@ def search(request):
except PaginationException as e:
return HttpResponseRedirect(e.url)
return render(request, "accounting/search.html", {
"item_list": pagination.items,
"record_list": pagination.items,
"pagination": pagination,
})