mia-accounting-django/accounting/templates/accounting/report-ledger-summary.html

164 lines
7.2 KiB
HTML

{% extends "base.html" %}
{% comment %}
The Mia Accounting Application
report-ledger-summary.html: The template for the ledger summaries
Copyright (c) 2020 imacat.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: imacat@mail.imacat.idv.tw (imacat)
First written: 2020/7/16
{% endcomment %}
{% load static %}
{% load i18n %}
{% load humanize %}
{% load mia_core %}
{% load accounting %}
{% block settings %}
{% blocktrans asvar title with account=request.resolver_match.kwargs.account.title %}Ledger Summary for {{ account }}{% endblocktrans %}
{% setvar "title" title %}
{% static "accounting/css/report.css" as file %}{% add_css file %}
{% endblock %}
{% block content %}
<div class="btn-group btn-actions">
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<i class="fas fa-edit"></i>
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="{% url "accounting:transactions.create" "expense" as url %}{% url_with_return url %}">
{{ _("Cash Expense")|force_escape }}
</a>
<a class="dropdown-item" href="{% url "accounting:transactions.create" "income" as url %}{% url_with_return url %}">
{{ _("Cash Income")|force_escape }}
</a>
<a class="dropdown-item" href="{% url "accounting:transactions.create" "transfer" as url %}{% url_with_return url %}">
{{ _("Transfer")|force_escape }}
</a>
</div>
</div>
{% with current_report_icon="fas fa-file-invoice-dollar" current_report_title=_("Ledger Summary") ledger_account=request.resolver_match.kwargs.account %}
{% include "accounting/include/report-chooser.html" %}
{% endwith %}
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="d-none d-md-inline">{{ request.resolver_match.kwargs.account.title|title_case }}</span>
<span class="d-md-none">{{ _("Account")|force_escape }}</span>
</button>
<div class="dropdown-menu account-picker">
{% for account in accounts %}
<a class="dropdown-item {% if account.code == request.resolver_match.kwargs.account.code %} active {% endif %}>" href="{% url "accounting:ledger-summary" account %}">
{{ account.title|title_case }}
</a>
{% endfor %}
</div>
</div>
</div>
{% if month_list %}
{% include "mia_core/include/pagination.html" %}
{# The table for large screens #}
<table class="table table-striped table-hover d-none d-sm-table general-journal-table">
<thead>
<tr>
<th scope="col">{{ _("Month")|force_escape }}</th>
<th class="amount" scope="col">{{ _("Debit")|force_escape }}</th>
<th class="amount" scope="col">{{ _("Credit")|force_escape }}</th>
<th class="amount" scope="col">{{ _("Balance")|force_escape }}</th>
<th class="amount" scope="col">{{ _("Cumulative Balance")|force_escape }}</th>
<th class="actions" scope="col">{{ _("View")|force_escape }}</th>
</tr>
</thead>
<tbody>
{% 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 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>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{# The list for small screens #}
<ul class="list-group d-sm-none">
{% 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">
{{ month.debit|accounting_amount }}
</span>
<span class="badge badge-warning badge-pill">
{{ month.credit|accounting_amount }}
</span>
<span class="badge {% if month.balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ month.balance|intcomma:False }}
</span>
<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 month.balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ month.balance|intcomma:False }}
</span>
<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">
{{ month.label }}
<div>
<span class="badge badge-success badge-pill">
{{ month.debit|accounting_amount }}
</span>
<span class="badge badge-warning badge-pill">
{{ month.credit|accounting_amount }}
</span>
<span class="badge {% if month.balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ month.balance|intcomma:False }}
</span>
<span class="badge {% if month.cumulative_balance < 0 %} badge-danger {% else %} badge-primary {% endif %} badge-pill">
{{ month.cumulative_balance|intcomma:False }}
</span>
</div>
</div>
{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
<p>{{ _("There is currently no data.")|force_escape }}</p>
{% endif %}
{% endblock %}