2022-12-25 17:31:31 +11:00
|
|
|
{# DrCr: Web-based double-entry bookkeeping framework
|
2024-04-04 01:55:52 +11:00
|
|
|
Copyright (C) 2022–2024 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/>.
|
|
|
|
#}
|
|
|
|
|
2024-04-04 19:38:59 +11:00
|
|
|
{% extends 'base.html' %}
|
2022-12-25 17:31:31 +11:00
|
|
|
{% block title %}Account transactions{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
2024-04-04 15:39:32 +11:00
|
|
|
<h1 class="text-3xl text-gray-900">
|
|
|
|
Account transactions
|
|
|
|
</h1>
|
2022-12-25 17:31:31 +11:00
|
|
|
|
2024-04-04 15:39:32 +11:00
|
|
|
<div class="my-4 flex gap-x-2">
|
|
|
|
<a href="{{ url_for('journal_new_transaction') }}" class="inline-flex items-center gap-x-1.5 bg-emerald-600 pl-2 pr-3 py-1 text-white shadow-sm hover:bg-emerald-700">
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
|
|
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
|
|
|
|
</svg>
|
|
|
|
New transaction
|
|
|
|
</a>
|
|
|
|
<a href="{{ url_for('account_transactions', account=account) }}" class="px-3 py-1 text-gray-800 ring-1 ring-inset ring-gray-400 hover:bg-gray-50">
|
|
|
|
Hide commodity detail
|
|
|
|
</a>
|
2022-12-25 17:31:31 +11:00
|
|
|
</div>
|
|
|
|
|
2024-04-04 15:39:32 +11:00
|
|
|
<table class="min-w-full">
|
2022-12-25 17:31:31 +11:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2024-04-04 15:39:32 +11:00
|
|
|
<th class="py-0.5 text-gray-900 font-semibold text-start">Date</th>
|
|
|
|
<th class="py-0.5 text-gray-900 font-semibold text-start">Description</th>
|
2022-12-25 17:31:31 +11:00
|
|
|
<th></th>
|
2024-04-04 15:39:32 +11:00
|
|
|
<th class="py-0.5 text-gray-900 font-semibold text-end">Amount</th>
|
|
|
|
<th class="py-0.5 text-gray-900 font-semibold text-end">Balance</th>
|
2022-12-25 17:31:31 +11:00
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for transaction in transactions %}
|
2024-04-04 15:39:32 +11:00
|
|
|
<tr class="border-t border-gray-300">
|
|
|
|
<td class="py-0.5 text-gray-900">{{ transaction.dt.strftime('%Y-%m-%d') }}</td>
|
|
|
|
<td class="py-0.5 text-gray-900">
|
2023-01-04 10:56:17 +11:00
|
|
|
{{ transaction.description }}
|
2024-04-04 15:39:32 +11:00
|
|
|
{% if transaction.id %}
|
|
|
|
<a href="{{ url_for('journal_edit_transaction', id=transaction.id) }}" class="text-gray-500 hover:text-gray-700">
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4 inline align-middle -mt-0.5">
|
|
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125" />
|
|
|
|
</svg>
|
|
|
|
</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>
|
2024-04-04 01:55:52 +11:00
|
|
|
{% for amount in running_totals[transaction].amounts %}
|
2022-12-25 17:31:31 +11:00
|
|
|
{# 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>
|
2024-04-04 15:39:32 +11:00
|
|
|
<td class="py-0.5 text-gray-900 text-end">{{ 'Dr' if posting.quantity >= 0 else 'Cr' }}</td>
|
|
|
|
<td class="py-0.5 text-gray-900 text-end">{{ (posting.amount()|abs).format('force') }}</td>
|
|
|
|
<td class="py-0.5 text-gray-900 text-end">{{ (amount|abs).format('force') }}</td>
|
|
|
|
<td class="py-0.5 pl-1 text-gray-900">{{ 'Dr' if amount.quantity >= 0 else 'Cr' }}</td>
|
2022-12-25 17:31:31 +11:00
|
|
|
</tr>
|
|
|
|
{% else %}
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
2024-04-04 15:39:32 +11:00
|
|
|
<td class="py-0.5 text-gray-900 text-end">{{ (amount|abs).format('force') }}</td>
|
|
|
|
<td class="py-0.5 pl-1 text-gray-900">{{ 'Dr' if amount.quantity >= 0 else 'Cr' }}</td>
|
2022-12-25 17:31:31 +11:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{% endblock %}
|