feat: Salden-Seite mit Stichtag und Monatsuebersicht

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 21:53:23 +02:00
parent ea4858c4de
commit 7a0f71aa8c
5 changed files with 220 additions and 4 deletions

View File

@@ -0,0 +1,67 @@
{% extends "base.html" %}
{% block title %}Salden Finanzberatung{% endblock %}
{% block content %}
<h1>Salden</h1>
<h2>Salden am {{ stichtag.strftime('%d.%m.%Y') }}</h2>
<form method="get" action="/salden" class="inline-form">
<input type="date" name="stichtag" value="{{ stichtag.isoformat() }}">
<button type="submit">Anzeigen</button>
</form>
<table>
<thead>
<tr><th>Konto</th><th>Saldo</th></tr>
</thead>
<tbody>
{% for account, balance in balances %}
<tr>
<td class="account">{{ account.name }}</td>
<td class="amount {{ 'neg' if balance < 0 else '' }}">{{ '%.2f'|format(balance) }} €</td>
</tr>
{% else %}
<tr><td colspan="2">Keine Konten angelegt.</td></tr>
{% endfor %}
<tr class="total-row">
<td><strong>Gesamt</strong></td>
<td class="amount {{ 'neg' if total < 0 else '' }}"><strong>{{ '%.2f'|format(total) }} €</strong></td>
</tr>
</tbody>
</table>
<h2>Monatsanfangs-Übersicht</h2>
<p class="hint">
Stand: Ende des Vortags (letzter Tag des Vormonats) — Buchungen am 1. eines
Monats zählen bewusst noch nicht zum "Anfangs"-Saldo, sonst würde der
Monatsanfang durch Buchungen des laufenden Monats verzerrt.
</p>
<table>
<thead>
<tr>
<th>Monat</th>
{% for account in accounts %}<th>{{ account.name }}</th>{% endfor %}
<th>Gesamt</th>
</tr>
</thead>
<tbody>
{% for row in months %}
<tr data-month="{{ row['month'].isoformat() }}">
<td>{{ row['month'].strftime('%m.%Y') }}</td>
{% for account, value in row['values'] %}
<td class="amount {{ 'neg' if value < 0 else '' }}">{{ '%.2f'|format(value) }} €</td>
{% endfor %}
<td class="amount {{ 'neg' if row['total'] < 0 else '' }}">{{ '%.2f'|format(row['total']) }} €</td>
</tr>
{% else %}
<tr><td colspan="{{ accounts|length + 2 }}">Keine bestätigten Buchungen vorhanden.</td></tr>
{% endfor %}
</tbody>
</table>
{% if accounts_without_anchor %}
<p class="hint">
Fußnote „ohne Anker — relative Werte" (Basis 0 statt Datei-Kontostand) gilt für:
{{ accounts_without_anchor|map(attribute='name')|join(', ') }}.
</p>
{% endif %}
{% endblock %}