DrCr/drcr/templates/journal/journal.html

87 lines
3.8 KiB
HTML
Raw Permalink Normal View History

2022-12-24 12:31:45 +11:00
{# DrCr: Web-based double-entry bookkeeping framework
2024-04-04 11:38:31 +11:00
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' %}
2023-01-02 18:08:30 +11:00
{% block title %}Journal{% endblock %}
2022-12-24 12:31:45 +11:00
2022-12-24 16:57:53 +11:00
{% block content %}
<h1 class="page-heading">
2024-04-04 11:38:31 +11:00
Journal
</h1>
2022-12-24 16:57:53 +11:00
2024-04-04 11:38:31 +11:00
<div class="my-4 flex gap-x-2">
<a href="{{ url_for('journal_new_transaction') }}" class="btn-primary pl-2">
2024-04-04 11:38:31 +11:00
<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>
2022-12-25 17:31:31 +11:00
{% if commodity_detail %}
<a href="{{ url_for('journal') }}" class="btn-secondary">
2024-04-04 11:38:31 +11:00
Hide commodity detail
</a>
2022-12-25 17:31:31 +11:00
{% else %}
<a href="{{ url_for('journal', commodity_detail=1) }}" class="btn-secondary">
2024-04-04 11:38:31 +11:00
Show commodity detail
</a>
2022-12-25 17:31:31 +11:00
{% endif %}
</div>
2024-04-04 11:38:31 +11:00
<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 %}
2024-04-04 11:38:31 +11:00
<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">
2024-04-04 11:38:31 +11:00
{{ transaction.description }}
<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>
</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 %}