This repository has been archived on 2024-11-09. You can view files and clone it, but cannot push or open issues or pull requests.
ledger-pyreport/ledger_pyreport/jinja2/transaction.html

72 lines
2.4 KiB
HTML
Raw Normal View History

2020-03-29 21:46:55 +11:00
{#
ledger-pyreport
Copyright © 2020 Lee Yingtong Li (RunasSudo)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
#}
{% extends 'base_report.html' %}
{% block title %}{{ transaction.description }}{% endblock %}
{% block links %}
{{ super() }}
<a href="/transaction?{{ {'tid': transaction.id, 'cash': 'on' if cash else '', 'commodity': 'on'}|urlencode }}">Show commodity detail</a>
{% endblock %}
2020-03-29 21:46:55 +11:00
{% block report %}
<h1 style="margin-bottom: 1em;">Transaction</h1>
<table class="ledger" style="margin-bottom: 1em;">
<tr>
<th style="width: 5em;">Date</th>
<th style="width: 5em;">Code</th>
<th>Description</th>
</tr>
<tr>
<td>{{ transaction.date.strftime('%Y-%m-%d') }}</td>
<td>{{ transaction.code }}</td>
<td>{{ transaction.description }}</td>
</tr>
</table>
<table class="ledger">
<tr>
{#<th style="width: 5em;">Date</th>#}
<th style="width: 50%;">Description</th>
<th style="width: 50%;">Account</th>
<th style="text-align: right; min-width: 5em;">Dr</th>
<th style="text-align: right; min-width: 5em;">Cr</th>
2020-03-29 21:46:55 +11:00
</tr>
{% for posting in transaction.postings %}
{% set amount = posting.exchange(report_commodity, transaction.date) %}
2020-03-29 21:46:55 +11:00
{% set trn_url = '/transaction?' + {'tid': transaction.id, 'cash': 'on' if cash else ''}|urlencode %}
<tr>
<td>{{ posting.comment }}</td>
<td>{{ (posting.account.name|e).__str__().replace(':', ':<wbr>')|safe }}</td>
<td style="text-align: right;">{% if amount > 0 %}{{ amount|b }}{% endif %}</td>
<td style="text-align: right;">{% if amount < 0 %}{{ -amount|b }}{% endif %}</td>
2020-03-29 21:46:55 +11:00
</tr>
{% endfor %}
<tr class="total">
<td>Total</td>
<td></td>
<td style="text-align: right;">{{ total_dr|b }}</td>
<td style="text-align: right;">{{ -total_cr|b }}</td>
</tr>
</table>
{% endblock %}