05/31 Phase 6

This commit is contained in:
2026-05-31 16:55:43 -04:00
parent b3d495e57c
commit 46a604a73a
8 changed files with 1172 additions and 1 deletions
+147
View File
@@ -0,0 +1,147 @@
{% extends "base.html" %}
{% block title %}Tax Summary {{ report.year }}{% endblock %}
{% block page_title %}Tax Year Summary{% endblock %}
{% block topbar_actions %}
<a href="{{ url_for('reports.export_csv', year=selected_year) }}" class="btn btn-sm btn-outline-secondary" style="font-size:12px;">
<i class="bi bi-filetype-csv me-1"></i>Export CSV
</a>
{% endblock %}
{% block content %}
<!-- Year selector -->
<div class="d-flex align-items-center gap-3 mb-4">
<form method="GET" action="{{ url_for('reports.tax') }}" class="d-flex gap-2">
<select name="year" class="form-select form-select-sm" style="width:auto;">
{% for y in years %}
<option value="{{ y }}" {% if y == selected_year %}selected{% endif %}>{{ y }}</option>
{% endfor %}
</select>
<button type="submit" class="btn btn-sm btn-primary" style="font-size:12px;">Go</button>
</form>
<span class="text-muted" style="font-size:12px;">{{ report.date_from.strftime('%b %d, %Y') }} {{ report.date_to.strftime('%b %d, %Y') }}</span>
</div>
<!-- Summary -->
<div class="row g-3 mb-4">
<div class="col-6 col-md-3">
<div class="stat-card">
<div class="stat-label">Total Income</div>
<div class="stat-value text-income">{{ report.total_income | currency }}</div>
</div>
</div>
<div class="col-6 col-md-3">
<div class="stat-card">
<div class="stat-label">Total Expenses</div>
<div class="stat-value text-expense">{{ report.total_expense | currency }}</div>
</div>
</div>
<div class="col-6 col-md-3">
<div class="stat-card">
<div class="stat-label">Net for Year</div>
<div class="stat-value {% if report.net >= 0 %}text-income{% else %}text-expense{% endif %}">{{ report.net | currency }}</div>
</div>
</div>
<div class="col-6 col-md-3">
<div class="stat-card">
<div class="stat-label">Income Sources</div>
<div class="stat-value text-invest">{{ report.income_categories | length }}</div>
</div>
</div>
</div>
<div class="row g-3">
<!-- Income by category -->
<div class="col-12 col-lg-6">
<div class="pcard p-0">
<div class="px-4 py-3" style="border-bottom:1px solid var(--border);">
<span class="pcard-title mb-0">Income by Source</span>
</div>
<table class="pfm-table">
<thead><tr><th style="padding-left:20px;">Category</th><th class="text-end" style="padding-right:20px;">Total</th></tr></thead>
<tbody>
{% if report.income_categories %}
{% for cat in report.income_categories %}
<tr>
<td style="padding-left:20px;">
<div class="d-flex align-items-center gap-2">
<div style="width:8px;height:8px;border-radius:2px;background:{{ cat.color }};"></div>
<span style="font-size:13px;">{{ cat.name }}</span>
</div>
</td>
<td class="text-end mono text-income" style="font-size:13px;font-weight:500;padding-right:20px;">{{ cat.total | currency }}</td>
</tr>
{% endfor %}
<tr style="font-weight:700;background:#f8fafc;">
<td style="padding-left:20px;font-size:13px;">Total</td>
<td class="text-end mono text-income" style="font-size:13px;padding-right:20px;">{{ report.total_income | currency }}</td>
</tr>
{% else %}
<tr><td colspan="2" class="text-muted text-center py-3" style="font-size:13px;">No income recorded</td></tr>
{% endif %}
</tbody>
</table>
</div>
</div>
<!-- Expense by category -->
<div class="col-12 col-lg-6">
<div class="pcard p-0">
<div class="px-4 py-3" style="border-bottom:1px solid var(--border);">
<span class="pcard-title mb-0">Expenses by Category</span>
</div>
<table class="pfm-table">
<thead><tr><th style="padding-left:20px;">Category</th><th class="text-end" style="padding-right:20px;">Total</th></tr></thead>
<tbody>
{% if report.expense_categories %}
{% for cat in report.expense_categories %}
<tr>
<td style="padding-left:20px;">
<div class="d-flex align-items-center gap-2">
<div style="width:8px;height:8px;border-radius:2px;background:{{ cat.color }};"></div>
<span style="font-size:13px;">{{ cat.name }}</span>
</div>
</td>
<td class="text-end mono text-expense" style="font-size:13px;font-weight:500;padding-right:20px;">{{ cat.total | currency }}</td>
</tr>
{% endfor %}
<tr style="font-weight:700;background:#f8fafc;">
<td style="padding-left:20px;font-size:13px;">Total</td>
<td class="text-end mono text-expense" style="font-size:13px;padding-right:20px;">{{ report.total_expense | currency }}</td>
</tr>
{% else %}
<tr><td colspan="2" class="text-muted text-center py-3" style="font-size:13px;">No expenses recorded</td></tr>
{% endif %}
</tbody>
</table>
</div>
</div>
</div>
<!-- All income transactions for tax year -->
{% if report.income_transactions %}
<div class="pcard p-0 mt-3">
<div class="d-flex justify-content-between align-items-center px-4 py-3" style="border-bottom:1px solid var(--border);">
<span class="pcard-title mb-0">All Income — {{ report.year }}</span>
<span class="text-muted" style="font-size:12px;">{{ report.income_transactions | length }} transactions</span>
</div>
<table class="pfm-table">
<thead><tr><th style="padding-left:20px;">Date</th><th>Description</th><th>Category</th><th class="text-end" style="padding-right:20px;">Amount</th></tr></thead>
<tbody>
{% for txn in report.income_transactions %}
<tr>
<td style="padding-left:20px;font-size:12px;color:var(--muted);white-space:nowrap;">{{ txn.date.strftime('%b %d, %Y') }}</td>
<td style="font-size:13px;">{{ txn.description }}</td>
<td style="font-size:12px;color:var(--muted);">{{ txn.category.name if txn.category else '—' }}</td>
<td class="text-end mono text-income" style="font-size:13px;font-weight:500;padding-right:20px;">+{{ txn.amount | currency }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
<div class="mt-3">
<a href="{{ url_for('reports.index') }}" class="btn btn-sm btn-outline-secondary"><i class="bi bi-arrow-left me-1"></i>Back to Reports</a>
</div>
{% endblock %}