DrCr/drcr/templates/report.html

80 lines
2.8 KiB
HTML
Raw Permalink Normal View History

{# DrCr: Web-based double-entry bookkeeping framework
2024-04-04 00:24:09 +11:00
Copyright (C) 2022–2024 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/>.
#}
2024-04-04 19:38:59 +11:00
{% extends 'base.html' %}
{% block title %}{{ report.title }}{% endblock %}
{% macro render_section(section) %}
2023-01-04 18:03:08 +11:00
{% if section.title %}
<tr>
2024-04-06 02:28:52 +11:00
<th class="py-0.5 pr-1 text-gray-900 font-semibold text-start">{{ section.title }}</th>
2023-01-04 18:03:08 +11:00
<th></th>
</tr>
{% endif %}
{% for entry in section.entries %}
{{ render_entry(entry) }}
{% endfor %}
{% endmacro %}
{% macro render_entry(entry) %}
{% if entry.visible %}
{% if entry.__class__.__name__ == 'Section' %}
{{ render_section(entry) }}
{% elif entry.__class__.__name__ == 'Subtotal' %}
<tr{% if entry.bordered %} class="border-y border-gray-300"{% endif %}>
2024-04-06 02:28:52 +11:00
<th class="py-0.5 pr-1 text-gray-900 font-semibold text-start">{{ entry.text }}</th>
<th class="py-0.5 pl-1 text-gray-900 font-semibold text-end">{{ entry.amount.format_accounting() }}</th>
2023-01-04 18:03:08 +11:00
</tr>
{% elif entry.__class__.__name__ == 'Spacer' %}
2024-04-04 00:24:09 +11:00
<tr><td colspan="2" class="py-0.5">&nbsp;</td></tr>
{% else %}
<tr{% if entry.bordered %} class="border-y border-gray-300"{% endif %}>
2024-04-06 02:28:52 +11:00
{% if entry.heading %}<th class="py-0.5 pr-1 text-gray-900 font-semibold text-start">{% else %}<td class="py-0.5 pr-1 text-gray-900 text-start">{% endif %}
{% if entry.link %}
2024-04-04 00:24:09 +11:00
<a href="{{ entry.link }}" class="hover:text-blue-700 hover:underline">{{ entry.text }}</a>
{% else %}
{{ entry.text }}
{% endif %}
</{{ 'th' if entry.heading else 'td' }}>
2024-04-06 02:28:52 +11:00
{% if entry.heading %}<th class="py-0.5 pl-1 text-gray-900 font-semibold text-end">{% else %}<td class="py-0.5 pl-1 text-gray-900 text-end">{% endif %}
2024-04-04 00:24:09 +11:00
{{ entry.amount.format_accounting() }}
</{{ 'th' if entry.heading else 'td' }}>
</tr>
2023-01-04 18:03:08 +11:00
{% endif %}
{% endif %}
{% endmacro %}
{% block content %}
<h1 class="page-heading">
2024-04-04 00:24:09 +11:00
{{ report.title }}
</h1>
2024-04-04 00:24:09 +11:00
<table class="min-w-full">
<thead>
2024-04-04 00:24:09 +11:00
<tr class="border-b border-gray-300">
<th></th>
2024-04-06 02:28:52 +11:00
<th class="py-0.5 pl-1 text-gray-900 font-semibold text-end">$&nbsp;</th>
</tr>
</thead>
<tbody>
{% for entry in report.entries %}
{{ render_entry(entry) }}
{% endfor %}
</tbody>
</table>
{% endblock %}