{# 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>#} <th>Description</th> <th style="max-width: 8em;">Account</th> <th style="text-align: right; width: 5em;">Dr</th> <th style="width: 4em;"></th> <th style="text-align: right; width: 5em;">Cr</th> <th style="width: 4em;"></th> </tr> {% for posting in transaction.postings %} {% 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> {% if posting.amount >= 0 %} <td style="text-align: right;"><span title="{{ posting.amount.tostr(False) }}">{{ posting.amount|abs|bc }}</span></td> <td>{% if posting.amount.currency.price %}<span title="{{ posting.amount.tostr(False) }}">{{ '{' + posting.amount.currency.price|bc + '}' }}</span>{% endif %}</td> <td></td> <td></td> {% else %} <td></td> <td></td> <td style="text-align: right;"><span title="{{ posting.amount.tostr(False) }}">{{ -posting.amount|abs|bc }}</span></td> <td>{% if posting.amount.currency.price %}<span title="{{ posting.amount.tostr(False) }}">{{ '{' + posting.amount.currency.price|bc + '}' }}</span>{% endif %}</td> {% 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 %} <td style="text-align: right;"><span title="{{ dr_amount.tostr(False) }}">{{ dr_amount|abs|bc }}</span></td> <td>{% if dr_amount.currency.price %}<span title="{{ dr_amount.tostr(False) }}">{{ '{' + dr_amount.currency.price|bc + '}' }}</span>{% endif %}</td> {% else %} <td></td> <td></td> {% endif %} {% if cr_amount %} <td style="text-align: right;"><span title="{{ cr_amount.tostr(False) }}">{{ -cr_amount|abs|bc }}</span></td> <td>{% if cr_amount.currency.price %}<span title="{{ cr_amount.tostr(False) }}">{{ '{' + cr_amount.currency.price|bc + '}' }}</span>{% endif %}</td> {% else %} <td></td> <td></td> {% endif %} </tr> {% endfor %} <tr class="total"> <td></td> <td></td> <td style="text-align: right;"><span title="{{ total_dr.tostr(False) }}">{{ total_dr|abs|bc }}</span></td> <td></td> <td style="text-align: right;"><span title="{{ total_cr.tostr(False) }}">{{ -total_cr|abs|bc }}</span></td> <td></td> </tr> </table> {% endblock %}