mia-accounting-django/accounting/templates/accounting/balance-sheet.html

324 lines
12 KiB
HTML
Raw Normal View History

{% extends "base.html" %}
{% comment %}
The Mia Accounting Application
cash.html: The template for the cash account reports
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/20
{% endcomment %}
{% load static %}
{% load i18n %}
{% load humanize %}
{% load mia_core %}
{% load accounting %}
{% block settings %}
{% blocktrans asvar title with prep_period=request.resolver_match.kwargs.period.prep_desc %}Balance Sheet {{ prep_period }}{% endblocktrans %}
{% setvar "title" title %}
{% setvar "use_period_chooser" True %}
{% 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>
{{ _("New")|force_escape }}
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "expense" %}">
{{ _("Cash Expense")|force_escape }}
</a>
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "income" %}">
{{ _("Cash Income")|force_escape }}
</a>
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "transfer" %}">
{{ _("Transfer")|force_escape }}
</a>
</div>
</div>
{% with current_report_icon="fas fa-balance-scale" current_report_title=_("Balance Sheet") period=request.resolver_match.kwargs.period %}
{% include "accounting/include/report-chooser.html" %}
{% endwith %}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#period-modal">
<i class="far fa-calendar-alt"></i>
<span class="d-none d-md-inline">{{ request.resolver_match.kwargs.period.description }}</span>
<span class="d-md-none">{{ _("Period")|force_escape }}</span>
</button>
</div>
{% with period=request.resolver_match.kwargs.period %}
{% include "mia_core/include/period-chooser.html" %}
{% endwith %}
{# The table for large screens #}
<div class="d-none d-lg-block report-block report-block-lg">
<div class="row justify-content-center">
<h2>{{ title|title_case }}</h2>
</div>
<div class="row">
<div class="col-sm-6">
<table class="table table-borderless table-hover table-sm balance-sheet-table">
<thead>
<tr>
<th colspan="3" scope="col">{{ assets.title|title_case }}</th>
</tr>
</thead>
<tbody>
{% for group in assets.groups %}
<tr class="group-title">
<td><div>{{ group.title|title_case }}</div></td>
<td class="amount"></td>
<td class="actions"></td>
</tr>
{% for account in group.details %}
<tr>
<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="{{ account.url }}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
{{ _("View")|force_escape }}
</a>
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
</div>
<div class="col-sm-6">
<table class="table table-borderless table-hover table-sm balance-sheet-table">
<thead>
<tr>
<th colspan="3" scope="col">{{ liabilities.title|title_case }}</th>
</tr>
</thead>
<tbody>
{% for group in liabilities.groups %}
<tr class="group-title">
<td><div>{{ group.title|title_case }}</div></td>
<td class="amount"></td>
<td class="actions"></td>
</tr>
{% for account in group.details %}
<tr>
<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="{{ account.url }}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
{{ _("View")|force_escape }}
</a>
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
<tfoot>
<tr class="total">
<td>{{ _("Total")|force_escape }}</td>
<td class="amount {% if liabilities.amount < 0 %} text-danger {% endif %}">
{{ liabilities.amount|accounting_amount }}
</td>
</tr>
</tfoot>
</table>
<table class="table table-borderless table-hover table-sm balance-sheet-table">
<thead>
<tr>
<th colspan="3" scope="col">{{ owners_equity.title|title_case }}</th>
</tr>
</thead>
<tbody>
{% for group in owners_equity.groups %}
<tr class="group-title">
<td><div>{{ group.title|title_case }}</div></td>
<td class="amount"></td>
<td class="actions"></td>
</tr>
{% for account in group.details %}
<tr>
<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="{{ account.url }}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
{{ _("View")|force_escape }}
</a>
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
<tfoot>
<tr class="total">
<td>{{ _("Total")|force_escape }}</td>
<td class="amount {% if owners_equity.amount < 0 %} text-danger {% endif %}">
{{ owners_equity.amount|accounting_amount }}
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="row">
<div class="col-sm-6 assets-total">
<table class="table table-borderless table-hover table-sm balance-sheet-total-table">
<tfoot>
<tr class="total">
<td class="align-middle">{{ _("Total")|force_escape }}</td>
<td class="text-right align-middle font-italic {% if assets.amount < 0 %} text-danger {% endif %}">
{{ assets.amount|accounting_amount }}
</td>
</tr>
</tfoot>
</table>
</div>
<div class="col-sm-6 liabilities-total">
<table class="table table-borderless table-hover table-sm balance-sheet-total-table">
<tfoot>
<tr class="total">
<td class="align-middle">{{ _("Total")|force_escape }}</td>
<td class="text-right align-middle font-italic {% if liabilities.amount|add:owners_equity.amount < 0 %} text-danger {% endif %}">
{{ liabilities.amount|add:owners_equity.amount|accounting_amount }}
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
{# The list for small screens #}
<div class="d-lg-none report-block report-block-sm">
<div class="row justify-content-center">
<h2>{{ title|escape }}</h2>
</div>
<div class="row">
<div class="col-sm-6">
<ul class="list-group balance-sheet-list">
<li class="list-group-item section-title">
{{ assets.title|title_case }}
</li>
{% for group in assets.groups %}
<li class="list-group-item d-flex justify-content-between align-items-center group-title">
{{ group.title|title_case }}
</li>
{% 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="{{ account.url }}">
{{ account.title|title_case }}
<div class="float-right">
<span class="badge {% if account.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ account.amount|accounting_amount }}
</span>
</div>
</a>
</li>
{% endfor %}
{% endfor %}
<li class="list-group-item d-flex justify-content-between align-items-center grand-total">
{{ _("Total")|force_escape }}
<span class="badge {% if assets.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ assets.amount|accounting_amount }}
</span>
</li>
</ul>
</div>
<div class="col-sm-6">
<ul class="list-group balance-sheet-list">
<li class="list-group-item section-title">
{{ liabilities.title|title_case }}
</li>
{% for group in liabilities.groups %}
<li class="list-group-item d-flex justify-content-between align-items-center group-title">
{{ group.title|title_case }}
</li>
{% 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="{{ account.url }}">
{{ account.title|title_case }}
<div class="float-right">
<span class="badge {% if account.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ account.amount|accounting_amount }}
</span>
</div>
</a>
</li>
{% endfor %}
{% endfor %}
<li class="list-group-item d-flex justify-content-between align-items-center total">
{{ _("Total")|force_escape }}
<span class="badge {% if liabilities.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ liabilities.amount|accounting_amount }}
</span>
</li>
</ul>
<ul class="list-group balance-sheet-list">
<li class="list-group-item section-title">
{{ owners_equity.title|title_case }}
</li>
{% for group in owners_equity.groups %}
<li class="list-group-item d-flex justify-content-between align-items-center group-title">
{{ group.title|title_case }}
</li>
{% 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="{{ account.url }}">
{{ account.title|title_case }}
<div class="float-right">
<span class="badge {% if account.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ account.amount|accounting_amount }}
</span>
</div>
</a>
</li>
{% endfor %}
{% endfor %}
<li class="list-group-item d-flex justify-content-between align-items-center total">
{{ _("Total")|force_escape }}
<span class="badge {% if owners_equity.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ owners_equity.amount|accounting_amount }}
</span>
</li>
</ul>
<ul class="list-group balance-sheet-list">
<li class="list-group-item d-flex justify-content-between align-items-center grand-total">
{{ _("Total")|force_escape }}
<span class="badge {% if liabilities.amount|add:owners_equity.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ liabilities.amount|add:owners_equity.amount|accounting_amount }}
</span>
</li>
</ul>
</div>
</div>
</div>
{% endblock %}