2020-03-29 22:01:52 +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 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>#}
|
2020-03-31 03:01:27 +11:00
|
|
|
<th style="width: 50%;">Description</th>
|
|
|
|
<th style="width: 50%;">Account</th>
|
|
|
|
<th style="text-align: right; min-width: 4em;">Dr</th> {# Amount #}
|
2020-04-04 04:15:32 +11:00
|
|
|
<th style="min-width: 2em;"></th> {# Commodity #}
|
2020-03-31 03:01:27 +11:00
|
|
|
<th style="min-width: 2em;"></th> {# Price #}
|
|
|
|
<th style="text-align: right; min-width: 4em;">Cr</th>
|
|
|
|
<th style="min-width: 2em;"></th>
|
|
|
|
<th style="min-width: 2em;"></th>
|
2020-03-29 22:01:52 +11:00
|
|
|
</tr>
|
|
|
|
|
|
|
|
{% for posting in transaction.postings %}
|
|
|
|
{% set trn_url = '/transaction?' + {'tid': transaction.id, 'cash': 'on' if cash else ''}|urlencode %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ posting.comment }}</td>
|
2020-04-15 11:09:53 +10:00
|
|
|
<td><a href="/transactions?{{ {'date_end': transaction.date.strftime('%Y-%m-%d'), 'date_beg': transaction.date.strftime('%Y-%m-%d'), 'account': posting.account.name}|urlencode }}">{{ (posting.account.name|e).__str__().replace(':', ':<wbr>')|safe }}</a></td>
|
2020-03-30 19:20:00 +11:00
|
|
|
{% if posting.amount >= 0 %}
|
2020-03-30 19:51:02 +11:00
|
|
|
{{ posting.amount|bt(True) }}
|
|
|
|
<td colspan="3"></td>
|
2020-03-30 19:20:00 +11:00
|
|
|
{% else %}
|
2020-03-30 19:51:02 +11:00
|
|
|
<td colspan="3"></td>
|
|
|
|
{{ -posting.amount|bt(True) }}
|
2020-03-30 19:20:00 +11:00
|
|
|
{% endif %}
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% for dr_amount, cr_amount in totals %}
|
|
|
|
<tr class="total explicit-rules" style="{% if loop.first %}border-top: 1pt solid black;{% endif %}{% if loop.last %}border-bottom: 1pt solid black;{% endif %}">
|
|
|
|
<td>{% if loop.first %}Total{% endif %}</td>
|
|
|
|
<td></td>
|
|
|
|
{% if dr_amount %}
|
2020-03-30 19:51:02 +11:00
|
|
|
{{ dr_amount|bt(True) }}
|
2020-03-30 19:20:00 +11:00
|
|
|
{% else %}
|
2020-03-30 19:51:02 +11:00
|
|
|
<td colspan="3"></td>
|
2020-03-30 19:20:00 +11:00
|
|
|
{% endif %}
|
|
|
|
{% if cr_amount %}
|
2020-03-30 19:51:02 +11:00
|
|
|
{{ -cr_amount|bt(True) }}
|
2020-03-30 19:20:00 +11:00
|
|
|
{% else %}
|
2020-03-30 19:51:02 +11:00
|
|
|
<td colspan="3"></td>
|
2020-03-30 19:20:00 +11:00
|
|
|
{% endif %}
|
2020-03-29 22:01:52 +11:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
2020-03-30 19:20:00 +11:00
|
|
|
|
|
|
|
<tr class="total">
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
2020-03-30 19:51:02 +11:00
|
|
|
{{ total_dr|bt(True) }}
|
|
|
|
{{ -total_cr|bt(True) }}
|
2020-03-30 19:20:00 +11:00
|
|
|
</tr>
|
2020-03-29 22:01:52 +11:00
|
|
|
</table>
|
|
|
|
{% endblock %}
|