Revised the template of the income statement and removed the case when there is no data, because there is always data in the accounting application.

This commit is contained in:
依瑪貓 2020-07-20 23:40:12 +08:00
parent bbe4b39fde
commit 59820f65ca

View File

@ -74,152 +74,148 @@ First written: 2020/7/19
{% include "mia_core/include/period-chooser.html" %} {% include "mia_core/include/period-chooser.html" %}
{% if item_list %} {# The table for large screens #}
{# The table for large screens #} <div class="d-none d-sm-block report-block report-block-lg">
<div class="d-none d-sm-block report-block report-block-lg"> <div class="row justify-content-center">
<div class="row justify-content-center"> <h2>{{ title }}</h2>
<h2>{{ title }}</h2> </div>
</div>
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<table class="table table-borderless table-hover table-sm income-statement-table"> <table class="table table-borderless table-hover table-sm income-statement-table">
<thead> <thead>
<tr> <tr>
<th scope="col"></th> <th scope="col"></th>
<th class="amount" colspan="2" scope="col">{% trans "Amount" context "Accounting|" as text %}{{ text|force_escape }}</th> <th class="amount" colspan="2" scope="col">{% trans "Amount" context "Accounting|" as text %}{{ text|force_escape }}</th>
<th scope="col"></th> <th scope="col"></th>
</tr>
</thead>
<tbody>
{% for section in item_list %}
<tr class="section-title">
<td><div>{{ section.title|title|escape }}</div></td>
<td class="amount"></td>
<td class="amount"></td>
<td class="actions"></td>
</tr> </tr>
</thead> {% if section.groups %}
<tbody> {% for group in section.groups %}
{% for section in item_list %} <tr class="group-title">
<tr class="section-title"> <td><div class="group-title">{{ group.title|title|escape }}</div></td>
<td><div>{{ section.title|title|escape }}</div></td> <td class="amount"></td>
<td class="amount"></td> <td class="amount"></td>
<td class="amount"></td> <td class="actions"></td>
<td class="actions"></td> </tr>
</tr> {% for item in group.details %}
{% if section.groups %} <tr>
{% for group in section.groups %} <td><div class="subject">{{ item.title|title|escape }}</div></td>
<tr class="group-title"> <td class="amount {% if item.balance < 0 %} text-danger {% endif %}">{{ item.balance|accounting_amount }}</td>
<td><div class="group-title">{{ group.title|title|escape }}</div></td>
<td class="amount"></td> <td class="amount"></td>
<td class="amount"></td> <td class="actions">
<td class="actions"></td> <a href="{% url "accounting:ledger" item.code period.spec %}" class="btn btn-info" role="button">
</tr> <i class="fas fa-eye"></i>
{% for item in group.details %} <span class="d-none d-lg-inline">{% trans "View" context "Accounting|" as text %}{{ text|force_escape }}</span>
<tr> </a>
<td><div class="subject">{{ item.title|title|escape }}</div></td> </td>
<td class="amount {% if item.balance < 0 %} text-danger {% endif %}">{{ item.balance|accounting_amount }}</td>
<td class="amount"></td>
<td class="actions">
<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>
</td>
</tr>
{% endfor %}
<tr class="total">
<td><div>{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}</div></td>
<td class="amount"></td>
<td class="amount {% if group.total < 0 %} text-danger {% endif %}">{{ group.total|accounting_amount }}</td>
<td class="actions"></td>
</tr> </tr>
{% endfor %} {% endfor %}
{% else %}
<tr class="total"> <tr class="total">
<td><div>{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}</div></td> <td><div>{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}</div></td>
<td class="amount"></td> <td class="amount"></td>
<td class="amount">-</td> <td class="amount {% if group.total < 0 %} text-danger {% endif %}">{{ group.total|accounting_amount }}</td>
<td class="actions"></td> <td class="actions"></td>
</tr> </tr>
{% endif %}
{% if section.cumulative_total is not None %}
<tr class="cumulative-total">
<td><div>{{ section.cumulative_total.title|title|escape }}</div></td>
<td class="amount"></td>
<td class="amount {% if section.cumulative_total.total < 0 %} text-danger {% endif %}">{{ section.cumulative_total.total|accounting_amount }}</td>
<td class="actions"></td>
</tr>
{% endif %}
{% if section.has_next %}
<tr><td colspan="4"></td></tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{# The list for small screens #}
<div class="d-sm-none report-block report-block-sm">
<div class="row justify-content-center">
<h2>{{ title }}</h2>
</div>
<div class="row">
<div class="col-sm-12">
<ul class="list-group income-statement-list">
{% for section in item_list %}
<li class="list-group-item d-flex justify-content-between align-items-center section-title">
{{ section.title|title|escape }}
</li>
{% if section.groups %}
{% for group in section.groups %}
<li class="list-group-item d-flex justify-content-between align-items-center group-title">
{{ group.title|title|escape }}
</li>
{% for item in group.details %}
<li class="list-group-item d-flex justify-content-between align-items-center subject">
<a class="list-group-item-action" href="{% url "accounting:ledger" item.code period.spec %}">
{{ item.title|title|escape }}
<div class="float-right">
<span class="badge {% if item.balance < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ item.balance|accounting_amount }}
</span>
</div>
</a>
</li>
{% endfor %}
<li class="list-group-item d-flex justify-content-between align-items-center total">
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
<div class="float-right">
<span class="badge {% if group.total < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ group.total|accounting_amount }}
</span>
</div>
</li>
{% endfor %} {% endfor %}
{% else %} {% else %}
<tr class="total">
<td><div>{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}</div></td>
<td class="amount"></td>
<td class="amount">-</td>
<td class="actions"></td>
</tr>
{% endif %}
{% if section.cumulative_total is not None %}
<tr class="cumulative-total">
<td><div>{{ section.cumulative_total.title|title|escape }}</div></td>
<td class="amount"></td>
<td class="amount {% if section.cumulative_total.total < 0 %} text-danger {% endif %}">{{ section.cumulative_total.total|accounting_amount }}</td>
<td class="actions"></td>
</tr>
{% endif %}
{% if section.has_next %}
<tr><td colspan="4"></td></tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{# The list for small screens #}
<div class="d-sm-none report-block report-block-sm">
<div class="row justify-content-center">
<h2>{{ title }}</h2>
</div>
<div class="row">
<div class="col-sm-12">
<ul class="list-group income-statement-list">
{% for section in item_list %}
<li class="list-group-item d-flex justify-content-between align-items-center section-title">
{{ section.title|title|escape }}
</li>
{% if section.groups %}
{% for group in section.groups %}
<li class="list-group-item d-flex justify-content-between align-items-center group-title">
{{ group.title|title|escape }}
</li>
{% for item in group.details %}
<li class="list-group-item d-flex justify-content-between align-items-center subject">
<a class="list-group-item-action" href="{% url "accounting:ledger" item.code period.spec %}">
{{ item.title|title|escape }}
<div class="float-right">
<span class="badge {% if item.balance < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ item.balance|accounting_amount }}
</span>
</div>
</a>
</li>
{% endfor %}
<li class="list-group-item d-flex justify-content-between align-items-center total"> <li class="list-group-item d-flex justify-content-between align-items-center total">
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }} {% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
<div class="float-right"> <div class="float-right">
<span class="badge {% if group.total < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">-</span> <span class="badge {% if group.total < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
</div> {{ group.total|accounting_amount }}
</li>
{% endif %}
{% if section.cumulative_total is not None %}
<li class="list-group-item d-flex justify-content-between align-items-center cumulative-total">
{{ section.cumulative_total.title|title|escape }}
<div class="float-right">
<span class="badge {% if section.cumulative_total.total < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ section.cumulative_total.total|accounting_amount }}
</span> </span>
</div> </div>
</li> </li>
{% endif %} {% endfor %}
{% if section.has_next %} {% else %}
<li class="list-group-item d-flex justify-content-between align-items-center"></li> <li class="list-group-item d-flex justify-content-between align-items-center total">
{% endif %} {% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
{% endfor %} <div class="float-right">
</ul> <span class="badge {% if group.total < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">-</span>
</div> </div>
</li>
{% endif %}
{% if section.cumulative_total is not None %}
<li class="list-group-item d-flex justify-content-between align-items-center cumulative-total">
{{ section.cumulative_total.title|title|escape }}
<div class="float-right">
<span class="badge {% if section.cumulative_total.total < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ section.cumulative_total.total|accounting_amount }}
</span>
</div>
</li>
{% endif %}
{% if section.has_next %}
<li class="list-group-item d-flex justify-content-between align-items-center"></li>
{% endif %}
{% endfor %}
</ul>
</div> </div>
</div> </div>
{% else %} </div>
<p>{{ _("There is currently no data.")|force_escape }}</p>
{% endif %}
{% endblock %} {% endblock %}