DrCr/drcr/templates/general_journal/general_journal.html
RunasSudo 7b8f060308
Tidy display
Show all amounts in reporting currency so can hide commodity symbol
Use narrow non-breaking spaces rather than commas
Right align all amounts
Consistently separate "Dr/Cr" into own column
2023-01-02 16:15:20 +11:00

59 lines
2.0 KiB
HTML

{# DrCr: Web-based double-entry bookkeeping framework
Copyright (C) 2022 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.html' %}
{% block title %}General journal{% endblock %}
{% block content %}
<h1 class="h2 my-4">General journal</h1>
<div class="mb-2">
<a href="/general-journal/new" class="btn btn-primary"><i class="bi bi-plus-lg"></i> New transaction</a>
</div>
<table class="table">
<thead>
<tr>
<th>Date</th>
<th colspan="3">Description</th>
<th class="text-end">Dr</th>
<th class="text-end">Cr</th>
</tr>
</thead>
<tbody>
{% for transaction in transactions %}
<tr>
<td>{{ transaction.dt.strftime('%Y-%m-%d') }}</td>
<td colspan="3">{{ transaction.description }} <a href="/general-journal/edit?id={{ transaction.id }}"><i class="bi bi-pencil text-muted"></i></a></td>
<td></td>
<td></td>
</tr>
{% for posting in transaction.postings %}
<tr>
<td></td>
<td>{{ posting.description or '' }}</td>
<td class="text-end"><i>{{ 'Dr' if posting.quantity >= 0 else 'Cr' }}</i></td>
<td>{{ posting.account }}</td>
<td class="text-end">{{ posting.amount().as_cost().format() if posting.quantity >= 0 else '' }}</td>
<td class="text-end">{{ (posting.amount()|abs).as_cost().format() if posting.quantity < 0 else '' }}</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
{% endblock %}