diff --git a/gaehsnitz/templates/gaehsnitz/finance.html b/gaehsnitz/templates/gaehsnitz/finance.html
index 1d38bcb..28c4e23 100644
--- a/gaehsnitz/templates/gaehsnitz/finance.html
+++ b/gaehsnitz/templates/gaehsnitz/finance.html
@@ -17,8 +17,11 @@
aktueller Stand
- {% for topic, amount in balance_dict.items %}
- - {{ amount }}€ {{ topic }}
+ {% for topic, amounts in balance_dict.items %}
+ -
+ {{ amounts.total }}€ {{ topic }}
+ {% if amounts.estimated %}(davon {{ amounts.estimated }}€ geschätzt){% endif %}
+
{% endfor %}
Summe: {{ overall_sum }}€
@@ -33,7 +36,10 @@
{{ payment.date|date:"d.m." }} |
{{ payment.amount }}€ |
{{ payment.other_party }} |
- {{ payment.note }} |
+
+ {% if payment.is_estimated %}(geschätzt){% endif %}
+ {{ payment.note }}
+ |
{% endfor %}
diff --git a/gaehsnitz/views.py b/gaehsnitz/views.py
index e1004c4..2952562 100644
--- a/gaehsnitz/views.py
+++ b/gaehsnitz/views.py
@@ -38,13 +38,15 @@ class FinanceView(GaehsnitzTemplateView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
- balance_dict = defaultdict(int)
+ balance_dict = defaultdict(lambda: defaultdict(int))
detailed_payments = defaultdict(list)
overall_sum = 0
for payment in Payment.objects.filter(date__year=timezone.now().year).order_by("topic", "date"):
topic_name = Payment.Topic(payment.topic).label
sign = 1 if payment.is_incoming() else -1
- balance_dict[topic_name] += sign * payment.amount
+ balance_dict[topic_name]["total"] += sign * payment.amount
+ if payment.is_estimated:
+ balance_dict[topic_name]["estimated"] += sign * payment.amount
overall_sum += sign * payment.amount
if payment.is_outgoing() and payment.topic != Payment.Topic.bands:
detailed_payments[topic_name].append(payment)