DrCr/drcr/templates/general_ledger.html

74 lines
2.9 KiB
HTML
Raw Permalink Normal View History

2022-12-24 12:31:45 +11:00
{# DrCr: Web-based double-entry bookkeeping framework
Copyright (C) 2022–2024 Lee Yingtong Li (RunasSudo)
2022-12-24 12:31:45 +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-24 12:31:45 +11:00
{% block title %}General ledger{% endblock %}
2022-12-24 16:57:53 +11:00
{% block content %}
<h1 class="page-heading">
General ledger
</h1>
2022-12-24 16:57:53 +11:00
<div class="my-4 flex">
2022-12-25 17:31:31 +11:00
{% if commodity_detail %}
<a href="{{ url_for('general_ledger') }}" class="btn-secondary">
Hide commodity detail
</a>
2022-12-25 17:31:31 +11:00
{% else %}
<a href="{{ url_for('general_ledger', commodity_detail=1) }}" class="btn-secondary">
Show commodity detail
</a>
2022-12-25 17:31:31 +11:00
{% endif %}
</div>
<table class="min-w-full">
2022-12-24 16:57:53 +11:00
<thead>
<tr>
2024-04-06 02:28:52 +11:00
<th class="py-0.5 pr-1 text-gray-900 font-semibold text-start">Date</th>
<th class="py-0.5 px-1 text-gray-900 font-semibold text-start" colspan="3">Description</th>
<th class="py-0.5 px-1 text-gray-900 font-semibold text-end">Dr</th>
<th class="py-0.5 pl-1 text-gray-900 font-semibold text-end">Cr</th>
2022-12-24 16:57:53 +11:00
</tr>
</thead>
<tbody>
{% for transaction in transactions %}
<tr class="border-t border-gray-300">
2024-04-06 02:28:52 +11:00
<td class="py-0.5 pr-1 text-gray-900">{{ transaction.dt.strftime('%Y-%m-%d') }}</td>
<td class="py-0.5 px-1 text-gray-900" colspan="3">{{ transaction.description }}</td>
2022-12-24 16:57:53 +11:00
<td></td>
<td></td>
2022-12-24 12:31:45 +11:00
</tr>
2022-12-24 16:57:53 +11:00
{% for posting in transaction.postings %}
2022-12-24 12:31:45 +11:00
<tr>
<td></td>
2024-04-06 02:28:52 +11:00
<td class="py-0.5 px-1 text-gray-900">{{ posting.description or '' }}</td>
<td class="py-0.5 px-1 text-gray-900 text-end"><i>{{ 'Dr' if posting.quantity >= 0 else 'Cr' }}</i></td>
<td class="py-0.5 px-1 text-gray-900">{{ posting.account }}</td>
2022-12-25 17:31:31 +11:00
{% if commodity_detail %}
2024-04-06 02:28:52 +11:00
<td class="py-0.5 px-1 text-gray-900 text-end">{{ posting.amount().format('force') if posting.quantity >= 0 else '' }}</td>
<td class="py-0.5 pl-1 text-gray-900 text-end">{{ (posting.amount()|abs).format('force') if posting.quantity < 0 else '' }}</td>
2022-12-25 17:31:31 +11:00
{% else %}
2024-04-06 02:28:52 +11:00
<td class="py-0.5 px-1 text-gray-900 text-end">{{ posting.amount().as_cost().format() if posting.quantity >= 0 else '' }}</td>
<td class="py-0.5 pl-1 text-gray-900 text-end">{{ (posting.amount()|abs).as_cost().format() if posting.quantity < 0 else '' }}</td>
2022-12-25 17:31:31 +11:00
{% endif %}
2022-12-24 12:31:45 +11:00
</tr>
{% endfor %}
2022-12-24 16:57:53 +11:00
{% endfor %}
</tbody>
</table>
2022-12-24 12:31:45 +11:00
{% endblock %}