Phase 4: SEPA-Validierung (schwifty), Globale Suche (Cmd+K) & Jahresbericht-Modul

- SEPA-Export: IBAN/BIC-Validierung via schwifty, Schuldner-Konto aus StiftungsKonto
- Globale Suche: Cmd+K Modal über Destinatäre, Pächter, Ländereien, Förderungen, Dokumente
- Jahresbericht: Vollständige Jahresbilanz mit Einnahmen/Ausgaben/Netto, Unterstützungen,
  Landabrechnungen, Verwaltungskosten nach Kategorie, PDF-Export

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
SysAdmin Agent
2026-03-11 12:57:36 +00:00
parent a79a0989d6
commit 2be72c3990
8 changed files with 695 additions and 160 deletions

View File

@@ -4,12 +4,13 @@
<meta charset="utf-8">
<title>Stiftung Jahresbericht {{ jahr }}</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
margin: 0;
padding: 20px;
color: #333;
font-size: 14px;
}
.header {
text-align: center;
@@ -17,129 +18,200 @@
padding-bottom: 20px;
margin-bottom: 30px;
}
.header h1 {
color: #2c3e50;
margin: 0;
font-size: 2.5em;
}
.header .subtitle {
color: #7f8c8d;
font-size: 1.2em;
margin-top: 10px;
}
.section {
margin-bottom: 30px;
page-break-inside: avoid;
}
.header h1 { color: #2c3e50; margin: 0; font-size: 2.2em; }
.header .subtitle { color: #7f8c8d; font-size: 1.1em; margin-top: 8px; }
.section { margin-bottom: 30px; page-break-inside: avoid; }
.section h2 {
color: #34495e;
border-bottom: 2px solid #3498db;
padding-bottom: 10px;
margin-bottom: 20px;
color: #1a4a2e;
border-bottom: 2px solid #2c7a4b;
padding-bottom: 8px;
margin-bottom: 16px;
font-size: 1.2em;
}
.section h3 { color: #34495e; font-size: 1em; margin-top: 16px; margin-bottom: 8px; }
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
gap: 16px;
margin-bottom: 20px;
}
.stat-card {
background: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 8px;
padding: 20px;
padding: 16px;
text-align: center;
}
.stat-card .value {
font-size: 2em;
font-weight: bold;
color: #2c3e50;
}
.stat-card .label {
color: #7f8c8d;
margin-top: 5px;
}
table {
border-collapse: collapse;
width: 100%;
.stat-card .value { font-size: 1.6em; font-weight: bold; color: #1a4a2e; }
.stat-card .label { color: #7f8c8d; margin-top: 4px; font-size: 0.85em; }
.bilanz-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
margin-bottom: 20px;
}
th, td {
border: 1px solid #dee2e6;
padding: 12px;
text-align: left;
.bilanz-card {
border-radius: 8px;
padding: 16px;
text-align: center;
}
th {
background-color: #f8f9fa;
font-weight: 600;
color: #2c3e50;
}
tr:nth-child(even) {
background-color: #f8f9fa;
}
.amount {
text-align: right;
font-family: 'Courier New', monospace;
}
.status-badge {
padding: 4px 8px;
border-radius: 4px;
.bilanz-card.einnahmen { background: #d4edda; border: 1px solid #c3e6cb; }
.bilanz-card.ausgaben { background: #f8d7da; border: 1px solid #f5c6cb; }
.bilanz-card.netto-positiv { background: #d1ecf1; border: 1px solid #bee5eb; }
.bilanz-card.netto-negativ { background: #fff3cd; border: 1px solid #ffeeba; }
.bilanz-card .value { font-size: 1.5em; font-weight: bold; }
.bilanz-card .label { font-size: 0.85em; margin-top: 4px; color: #555; }
table {
border-collapse: collapse;
width: 100%;
margin-bottom: 16px;
font-size: 0.9em;
}
th, td { border: 1px solid #dee2e6; padding: 8px 10px; text-align: left; }
th { background-color: #f0f7f4; font-weight: 600; color: #1a4a2e; }
tr:nth-child(even) { background-color: #f8f9fa; }
.amount { text-align: right; font-family: 'Courier New', monospace; }
.status-badge {
padding: 3px 7px;
border-radius: 4px;
font-size: 0.8em;
font-weight: 500;
}
.status-beantragt { background-color: #fff3cd; color: #856404; }
.status-genehmigt { background-color: #d1ecf1; color: #0c5460; }
.status-ausgezahlt { background-color: #d4edda; color: #155724; }
.status-abgelehnt { background-color: #f8d7da; color: #721c24; }
.status-storniert { background-color: #e2e3e5; color: #383d41; }
.status-ausgezahlt, .status-abgeschlossen { background-color: #d4edda; color: #155724; }
.status-abgelehnt, .status-storniert { background-color: #f8d7da; color: #721c24; }
.status-geplant, .status-faellig { background-color: #e2e3e5; color: #383d41; }
.footer {
margin-top: 40px;
padding-top: 20px;
padding-top: 16px;
border-top: 1px solid #dee2e6;
text-align: center;
color: #7f8c8d;
font-size: 0.9em;
font-size: 0.85em;
}
@media print {
body { margin: 0; padding: 15px; }
body { margin: 0; padding: 10px; }
.section { page-break-inside: avoid; }
.no-print { display: none; }
}
.print-btn {
display: inline-block;
padding: 8px 20px;
background: #1a4a2e;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 0.9em;
text-decoration: none;
margin-right: 8px;
}
</style>
</head>
<body>
<div class="header">
<h1>Stiftung Jahresbericht {{ jahr }}</h1>
<div class="subtitle">Jahresübersicht über Förderungen und Verpachtungen</div>
<div class="subtitle">Erstellt am {{ "now"|date:"d.m.Y" }}</div>
<!-- Aktionsleiste (nur Bildschirm, nicht Druck) -->
<div class="no-print" style="margin-bottom: 20px; display: flex; align-items: center; gap: 12px;">
<a href="{% url 'stiftung:bericht_list' %}" style="color: #1a4a2e;">&#8592; Berichte</a>
<span style="color: #dee2e6;">|</span>
<a href="{% url 'stiftung:jahresbericht_pdf' jahr=jahr %}" class="print-btn">
PDF herunterladen
</a>
<button onclick="window.print()" class="print-btn" style="background: #34495e;">
Drucken
</button>
</div>
<!-- Executive Summary -->
<!-- Kopfzeile -->
<div class="header">
<h1>Jahresbericht {{ jahr }}</h1>
<div class="subtitle">van Hees-Theyssen-Vogel'sche Familienstiftung</div>
<div class="subtitle">Erstellt am {% now "d.m.Y" %}</div>
</div>
<!-- 1. Gesamtübersicht / Bilanz -->
<div class="section">
<h2>Zusammenfassung</h2>
<h2>1. Jahresbilanz {{ jahr }}</h2>
<div class="bilanz-grid">
<div class="bilanz-card einnahmen">
<div class="value">&#8364;{{ total_einnahmen|floatformat:2 }}</div>
<div class="label">Einnahmen (Pacht)</div>
</div>
<div class="bilanz-card ausgaben">
<div class="value">&#8364;{{ total_ausgaben|floatformat:2 }}</div>
<div class="label">Ausgaben gesamt</div>
</div>
<div class="bilanz-card {% if netto >= 0 %}netto-positiv{% else %}netto-negativ{% endif %}">
<div class="value">{% if netto >= 0 %}+{% endif %}&#8364;{{ netto|floatformat:2 }}</div>
<div class="label">Nettosaldo</div>
</div>
</div>
<div class="stats-grid">
<div class="stat-card">
<div class="value">€{{ total_foerderungen|floatformat:2 }}</div>
<div class="label">Gesamtförderungen</div>
<div class="value">&#8364;{{ total_ausgaben_foerderung|floatformat:2 }}</div>
<div class="label">Förderausgaben</div>
</div>
<div class="stat-card">
<div class="value">€{{ total_pachtzins|floatformat:2 }}</div>
<div class="label">Gesamtpachtzins</div>
<div class="value">&#8364;{{ total_verwaltungskosten|floatformat:2 }}</div>
<div class="label">Verwaltungskosten</div>
</div>
<div class="stat-card">
<div class="value">{{ foerderungen.count }}</div>
<div class="label">Förderungen</div>
<div class="value">&#8364;{{ pacht_vereinnahmt|floatformat:2 }}</div>
<div class="label">Pacht vereinnahmt</div>
</div>
<div class="stat-card">
<div class="value">{{ verpachtungen.count }}</div>
<div class="label">Aktive Verpachtungen</div>
<div class="value">&#8364;{{ grundsteuer_gesamt|floatformat:2 }}</div>
<div class="label">Grundsteuer</div>
</div>
</div>
</div>
<!-- Förderungen Section -->
<!-- 2. Unterstützungen (Zahlungs-Pipeline) -->
{% if unterstuetzungen %}
<div class="section">
<h2>2. Unterstützungszahlungen {{ jahr }}</h2>
<p style="color: #666; margin-bottom: 12px;">
{{ unterstuetzungen.count }} Unterstützung(en) geplant/ausgezahlt &middot;
{{ unterstuetzungen_ausgezahlt.count }} überwiesen (&#8364;{{ total_unterstuetzungen|floatformat:2 }})
</p>
<table>
<thead>
<tr>
<th>Destinatär</th>
<th>Betrag</th>
<th>Fällig am</th>
<th>Status</th>
<th>Verwendungszweck</th>
</tr>
</thead>
<tbody>
{% for u in unterstuetzungen %}
<tr>
<td>{{ u.destinataer.get_full_name }}</td>
<td class="amount">&#8364;{{ u.betrag|floatformat:2 }}</td>
<td>{{ u.faellig_am|date:"d.m.Y" }}</td>
<td>
<span class="status-badge status-{{ u.status }}">{{ u.get_status_display }}</span>
</td>
<td>{{ u.beschreibung|default:"-" }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr style="font-weight: bold; background: #f0f7f4;">
<td>Summe ausgezahlt</td>
<td class="amount">&#8364;{{ total_unterstuetzungen|floatformat:2 }}</td>
<td colspan="3"></td>
</tr>
</tfoot>
</table>
</div>
{% endif %}
<!-- 3. Förderungen (legacy Foerderung-Modell) -->
{% if foerderungen %}
<div class="section">
<h2>Förderungen im Jahr {{ jahr }}</h2>
<h2>3. Förderungen {{ jahr }}</h2>
<table>
<thead>
<tr>
@@ -151,77 +223,144 @@
</tr>
</thead>
<tbody>
{% for foerderung in foerderungen %}
{% for f in foerderungen %}
<tr>
<td>{{ foerderung.person.get_full_name }}</td>
<td>{{ foerderung.get_kategorie_display }}</td>
<td class="amount">€{{ foerderung.betrag|floatformat:2 }}</td>
<td>
<span class="status-badge status-{{ foerderung.status }}">
{{ foerderung.get_status_display }}
</span>
{% if f.destinataer %}{{ f.destinataer.get_full_name }}
{% elif f.person %}{{ f.person.get_full_name }}
{% else %}{% endif %}
</td>
<td>{{ foerderung.antragsdatum|date:"d.m.Y" }}</td>
<td>{{ f.get_kategorie_display }}</td>
<td class="amount">&#8364;{{ f.betrag|floatformat:2 }}</td>
<td>
<span class="status-badge status-{{ f.status }}">{{ f.get_status_display }}</span>
</td>
<td>{{ f.antragsdatum|date:"d.m.Y" }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr style="font-weight: bold; background: #f0f7f4;">
<td colspan="2">Summe</td>
<td class="amount">&#8364;{{ total_foerderungen_legacy|floatformat:2 }}</td>
<td colspan="2"></td>
</tr>
</tfoot>
</table>
</div>
{% endif %}
<!-- Verpachtungen Section -->
{% if verpachtungen %}
<!-- 4. Grundstücksverwaltung -->
<div class="section">
<h2>Aktive Verpachtungen im Jahr {{ jahr }}</h2>
<h2>4. Grundstücksverwaltung</h2>
{% if verpachtungen %}
<h3>Aktive Verpachtungen</h3>
<table>
<thead>
<tr>
<th>Länderei</th>
<th>Pächter</th>
<th>Vertragsnummer</th>
<th>Verpachtete Fläche</th>
<th>Jährlicher Pachtzins</th>
<th>Jahrespachtzins</th>
<th>Pachtende</th>
</tr>
</thead>
<tbody>
{% for verpachtung in verpachtungen %}
{% for v in verpachtungen %}
<tr>
<td>{{ verpachtung.land }}</td>
<td>{{ verpachtung.paechter.get_full_name }}</td>
<td>{{ verpachtung.vertragsnummer }}</td>
<td>{{ verpachtung.verpachtete_flaeche|floatformat:2 }} qm</td>
<td class="amount">€{{ verpachtung.pachtzins_jaehrlich|floatformat:2 }}</td>
<td>{{ verpachtung.pachtende|date:"d.m.Y" }}</td>
<td>{{ v.land }}</td>
<td>{{ v.paechter.get_full_name }}</td>
<td class="amount">{{ v.verpachtete_flaeche|floatformat:0 }} qm</td>
<td class="amount">&#8364;{{ v.pachtzins_pauschal|floatformat:2 }}</td>
<td>{% if v.pachtende %}{{ v.pachtende|date:"d.m.Y" }}{% else %}unbefristet{% endif %}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr style="font-weight: bold; background: #f0f7f4;">
<td colspan="3">Gesamtpachtzins (kalkuliert)</td>
<td class="amount">&#8364;{{ total_pachtzins|floatformat:2 }}</td>
<td></td>
</tr>
</tfoot>
</table>
{% endif %}
{% if landabrechnungen %}
<h3>Landabrechnungen {{ jahr }}</h3>
<table>
<thead>
<tr>
<th>Länderei</th>
<th>Pacht vereinnahmt</th>
<th>Umlagen</th>
<th>Grundsteuer</th>
<th>Sonstige Einnahmen</th>
</tr>
</thead>
<tbody>
{% for a in landabrechnungen %}
<tr>
<td>{{ a.land }}</td>
<td class="amount">&#8364;{{ a.pacht_vereinnahmt|floatformat:2 }}</td>
<td class="amount">&#8364;{{ a.umlagen_vereinnahmt|floatformat:2 }}</td>
<td class="amount">&#8364;{{ a.grundsteuer_betrag|floatformat:2 }}</td>
<td class="amount">&#8364;{{ a.sonstige_einnahmen|floatformat:2 }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr style="font-weight: bold; background: #f0f7f4;">
<td>Summe</td>
<td class="amount">&#8364;{{ pacht_vereinnahmt|floatformat:2 }}</td>
<td></td>
<td class="amount">&#8364;{{ grundsteuer_gesamt|floatformat:2 }}</td>
<td></td>
</tr>
</tfoot>
</table>
{% endif %}
{% if not verpachtungen and not landabrechnungen %}
<p style="color: #999;">Keine Verpachtungs- oder Abrechnungsdaten für {{ jahr }} vorhanden.</p>
{% endif %}
</div>
<!-- 5. Verwaltungskosten -->
{% if verwaltungskosten_nach_kategorie %}
<div class="section">
<h2>5. Verwaltungskosten {{ jahr }}</h2>
<table>
<thead>
<tr>
<th>Kategorie</th>
<th>Anzahl</th>
<th>Betrag</th>
</tr>
</thead>
<tbody>
{% for k in verwaltungskosten_nach_kategorie %}
<tr>
<td>{{ k.kategorie|capfirst }}</td>
<td>{{ k.anzahl }}</td>
<td class="amount">&#8364;{{ k.summe|floatformat:2 }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr style="font-weight: bold; background: #f0f7f4;">
<td colspan="2">Gesamt</td>
<td class="amount">&#8364;{{ total_verwaltungskosten|floatformat:2 }}</td>
</tr>
</tfoot>
</table>
</div>
{% endif %}
<!-- Financial Summary -->
<div class="section">
<h2>Finanzielle Übersicht</h2>
<div class="stats-grid">
<div class="stat-card">
<div class="value">€{{ total_foerderungen|floatformat:2 }}</div>
<div class="label">Ausgaben (Förderungen)</div>
</div>
<div class="stat-card">
<div class="value">€{{ total_pachtzins|floatformat:2 }}</div>
<div class="label">Einnahmen (Pachtzins)</div>
</div>
<div class="stat-card">
<div class="value">€{{ total_pachtzins|add:total_foerderungen|floatformat:2 }}</div>
<div class="label">Netto-Position</div>
</div>
</div>
</div>
<div class="footer">
<p>Dieser Bericht wurde automatisch generiert von der Stiftungsverwaltung.</p>
<p>Bei Fragen wenden Sie sich bitte an die Verwaltung.</p>
<p>Jahresbericht {{ jahr }} &mdash; automatisch generiert von der Stiftungsverwaltung</p>
<p>van Hees-Theyssen-Vogel'sche Familienstiftung &middot; Vertraulich</p>
</div>
</body>
</html>
</html>