2022-12-25 17:31:31 +11:00
|
|
|
{# DrCr: Web-based double-entry bookkeeping framework
|
2023-01-07 02:05:21 +11:00
|
|
|
Copyright (C) 2022–2023 Lee Yingtong Li (RunasSudo)
|
2022-12-25 17:31:31 +11:00
|
|
|
|
|
|
|
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.html' %}
|
|
|
|
{% block title %}Account transactions{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
<h1 class="h2 my-4">Account transactions</h1>
|
|
|
|
|
|
|
|
<div class="mb-2">
|
2023-01-07 19:01:05 +11:00
|
|
|
<a href="{{ url_for('account_transactions', account=account) }}" class="btn btn-outline-secondary">Hide commodity detail</a>
|
2022-12-25 17:31:31 +11:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<table class="table table-sm table-borderless">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Date</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th></th>
|
|
|
|
<th class="text-end">Amount</th>
|
|
|
|
<th class="text-end">Balance</th>
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for transaction in transactions %}
|
|
|
|
<tr style="border-width:1px 0 0 0">
|
|
|
|
<td>{{ transaction.dt.strftime('%Y-%m-%d') }}</td>
|
2023-01-04 10:56:17 +11:00
|
|
|
<td>
|
|
|
|
{{ transaction.description }}
|
2023-01-07 19:01:05 +11:00
|
|
|
{% if transaction.id %}<a href="{{ url_for('journal_edit_transaction', id=transaction.id) }}"><i class="bi bi-pencil text-muted"></i></a>{% endif %}
|
2023-01-04 10:56:17 +11:00
|
|
|
</td>
|
2022-12-25 17:31:31 +11:00
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
</tr>
|
|
|
|
{% for posting in transaction.postings if posting.account == account %}
|
|
|
|
{% set _ = running_total.add(posting.amount()) %}
|
|
|
|
{% endfor %}
|
|
|
|
{% for amount in running_total.amounts %}
|
|
|
|
{# FIXME: Assumes at most one posting per commodity #}
|
|
|
|
{% for posting in transaction.postings if posting.commodity == amount.commodity and posting.account == account %}
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
<td>{{ 'Dr' if posting.quantity >= 0 else 'Cr' }}</td>
|
2023-01-07 02:05:21 +11:00
|
|
|
<td class="text-end">{{ (posting.amount()|abs).format('force') }}</td>
|
|
|
|
<td class="text-end">{{ (amount|abs).format('force') }}</td>
|
2022-12-25 17:31:31 +11:00
|
|
|
<td>{{ 'Dr' if amount.quantity >= 0 else 'Cr' }}</td>
|
|
|
|
</tr>
|
|
|
|
{% else %}
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
2023-01-07 02:05:21 +11:00
|
|
|
<td class="text-end">{{ (amount|abs).format('force') }}</td>
|
2022-12-25 17:31:31 +11:00
|
|
|
<td>{{ 'Dr' if amount.quantity >= 0 else 'Cr' }}</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
{% set _ = running_total.clean() %}
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{% endblock %}
|