mia-accounting-django/accounting/templates/accounting/transaction_detail-expense.html

198 lines
7.0 KiB
HTML

{% extends "base.html" %}
{% comment %}
The Mia Accounting Application
transaction_detail-expense.html: The template for the detail of the
cash-expense transactions
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/23
{% endcomment %}
{% load static %}
{% load i18n %}
{% load mia_core %}
{% load accounting %}
{% block settings %}
{% setvar "title" _("Cash Expense Transaction") %}
{% static "accounting/css/transactions.css" as file %}{% add_css file %}
{% endblock %}
{% block content %}
{% if txn.has_order_hole %}
<div class="alert alert-danger alert-dismissible fade show">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<strong>{{ _("Error:") }}</strong> {{ _("The transactions on this day are not well-ordered. Please reorder them.")|force_escape }}
</div>
{% endif %}
<!-- the delete confirmation dialog -->
<form action="{% url "accounting:transactions.delete" txn as url %}{% url_keep_return url %}" method="post">
{% csrf_token %}
<!-- The Modal -->
<div class="modal" id="del-modal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">{{ _("Cash Expense Transaction Deletion Confirmation")|force_escape }}</h4>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<!-- Modal body -->
<div class="modal-body">{{ _("Do you really want to delete this cash expense transaction?")|force_escape }}</div>
<!-- Modal footer -->
<div class="modal-footer">
<button class="btn btn-danger" type="submit" name="del-confirm">{{ _("Confirm")|force_escape }}</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ _("Cancel")|force_escape }}</button>
</div>
</div>
</div>
</div>
</form>
<div class="btn-group btn-actions">
<a class="btn btn-primary" role="button" href="{% if "r" in request.GET %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
<i class="fas fa-chevron-circle-left"></i>
{{ _("Back")|force_escape }}
</a>
<a class="btn btn-primary" role="button" href="{% url "accounting:transactions.edit" "expense" txn as url %}{% url_keep_return url %}">
<i class="fas fa-edit"></i>
{{ _("Edit")|force_escape }}
</a>
{% if not txn.has_many_same_day %}
<button type="button" class="btn btn-secondary d-none d-sm-inline" disabled="disabled" title="{{ _("There is no other transaction at the same day.")|force_escape }}">
<i class="fas fa-sort"></i>
{{ _("Sort")|force_escape }}
</button>
{% else %}
<a class="btn btn-primary d-none d-sm-inline" role="button" href="{% url "accounting:transactions.sort" txn.date as url %}{% url_with_return url %}">
<i class="fas fa-sort"></i>
{{ _("Sort")|force_escape }}
</a>
{% endif %}
<a class="btn btn-primary d-none d-sm-inline" href="{% url "accounting:transactions.detail" "transfer" txn as url %}{% url_keep_return url %}">
<i class="fas fa-exchange-alt"></i>
{{ _("To Transfer")|force_escape }}
</a>
<div class="btn-group d-sm-none">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
<i class="fas fa-bars"></i>
</button>
<div class="dropdown-menu">
{% if not txn.has_many_same_day %}
<span class="dropdown-item disabled" title="{{ _("There is no other transaction at the same day.")|force_escape }}">
<i class="fas fa-sort"></i>
{{ _("Sort")|force_escape }}
</span>
{% else %}
<a class="dropdown-item" href="{% url "accounting:transactions.sort" txn.date as url %}{% url_with_return url %}">
<i class="fas fa-sort"></i>
{{ _("Sort")|force_escape }}
</a>
{% endif %}
<a class="dropdown-item" href="{% url "accounting:transactions.detail" "transfer" txn as url %}{% url_keep_return url %}">
<i class="fas fa-exchange-alt"></i>
{{ _("To Transfer")|force_escape }}
</a>
</div>
</div>
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#del-modal">
<i class="fas fa-trash"></i>
{{ _("Delete")|force_escape }}
</button>
</div>
<div class="row">
<div class="col-sm-2">{{ _("Date:")|force_escape }}</div>
<div class="col-sm-10">{{ txn.date|smart_date }}</div>
</div>
<table class="table table-striped table-hover d-none d-sm-table">
<thead>
<tr>
<th scope="col">{{ _("Account")|force_escape }}</th>
<th scope="col">{{ _("Summary")|force_escape }}</th>
<th class="amount" scope="col">{{ _("$")|force_escape }}</th>
</tr>
</thead>
<tbody>
{% for x in txn.debit_records %}
<tr>
<td>{{ x.account.title|title_case }}</td>
<td>{{ x.summary|default:"" }}</td>
<td class="amount">{{ x.amount|accounting_amount }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="2">{{ _("Total")|force_escape }}</td>
<td class="amount">{{ txn.debit_total|accounting_amount }}</td>
</tr>
</tfoot>
</table>
<ul class="list-group d-sm-none">
{% for x in txn.debit_records %}
<li class="list-group-item">
<div class="d-flex justify-content-between align-items-center account-line">
{{ x.account.title|title_case }}
<span class="badge badge-info">{{ x.amount|accounting_amount }}</span>
</div>
<div>{{ x.summary|default:"" }}</div>
</li>
{% endfor %}
<li class="list-group-item">
<div class="d-flex justify-content-between align-items-center account-line">
{{ _("Total")|force_escape }}
<span class="badge badge-info">{{ txn.debit_total|accounting_amount }}</span>
</div>
</li>
</ul>
{% if txn.notes %}
<div class="row">
<div class="col-sm-2">{{ _("Notes:")|force_escape }}</div>
<div class="col-sm-10">{{ txn.notes }}</div>
</div>
{% endif %}
<div class="row form-group">
<div class="col-sm-2">{{ _("Created at:")|force_escape }}</div>
<div class="col-sm-10">{{ txn.created_at }}</div>
</div>
<div class="row form-group">
<div class="col-sm-2">{{ _("Created by:")|force_escape }}</div>
<div class="col-sm-10">{{ txn.created_by.name }}</div>
</div>
<div class="row form-group">
<div class="col-sm-2">{{ _("Updated at:")|force_escape }}</div>
<div class="col-sm-10">{{ txn.updated_at }}</div>
</div>
<div class="row form-group">
<div class="col-sm-2">{{ _("Updated by:")|force_escape }}</div>
<div class="col-sm-10">{{ txn.updated_by.name }}</div>
</div>
{% endblock %}