mia-accounting-django/accounting/templates/accounting/income-statement.html

213 lines
8.5 KiB
HTML

{% 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/19
{% endcomment %}
{% load static %}
{% load i18n %}
{% load humanize %}
{% load mia_core %}
{% load accounting %}
{% block settings %}
{% blocktrans asvar title with prep_period=period.prep_desc %}Income Statement {{ 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-file-invoice" current_report_title=_("Income Statement") %}
{% 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">{{ period.description }}</span>
<span class="d-md-none">{% trans "Period" context "Period|" as text %}{{ text|force_escape }}</span>
</button>
</div>
{% include "mia_core/include/period-chooser.html" %}
{# The table for large screens #}
<div class="d-none d-sm-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-12">
<table class="table table-borderless table-hover table-sm income-statement-table">
<thead>
<tr>
<th scope="col"></th>
<th class="amount" colspan="2" scope="col">{{ _("Amount") }}</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{% for section in item_list %}
<tr class="section-title">
<td><div>{{ section.title|title_case }}</div></td>
<td class="amount"></td>
<td class="amount"></td>
<td class="actions"></td>
</tr>
{% if section.groups %}
{% for group in section.groups %}
<tr class="group-title">
<td><div class="group-title">{{ group.title|title_case }}</div></td>
<td class="amount"></td>
<td class="amount"></td>
<td class="actions"></td>
</tr>
{% for item 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 class="amount"></td>
<td class="actions">
<a href="{% url "accounting:ledger" item period %}" class="btn btn-info" role="button">
<i class="fas fa-eye"></i>
<span class="d-none d-lg-inline">{{ _("View") }}</span>
</a>
</td>
</tr>
{% endfor %}
<tr class="total">
<td><div>{{ _("Total") }}</div></td>
<td class="amount"></td>
<td class="amount {% if group.amount < 0 %} text-danger {% endif %}">{{ group.amount|accounting_amount }}</td>
<td class="actions"></td>
</tr>
{% endfor %}
{% else %}
<tr class="total">
<td><div>{{ _("Total") }}</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_case }}</div></td>
<td class="amount"></td>
<td class="amount {% if section.cumulative_total.amount < 0 %} text-danger {% endif %}">{{ section.cumulative_total.amount|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_case }}
</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_case }}
</li>
{% for item 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 period %}">
{{ item.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>
</div>
</a>
</li>
{% endfor %}
<li class="list-group-item d-flex justify-content-between align-items-center total">
{{ _("Total") }}
<div class="float-right">
<span class="badge {% if group.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ group.amount|accounting_amount }}
</span>
</div>
</li>
{% endfor %}
{% else %}
<li class="list-group-item d-flex justify-content-between align-items-center total">
{{ _("Total") }}
<div class="float-right">
<span class="badge {% if group.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">-</span>
</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_case }}
<div class="float-right">
<span class="badge {% if section.cumulative_total.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ section.cumulative_total.amount|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>
{% endblock %}