From 24c581a35a30794e21da8edc8ce7a4aa89cb6f29 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Sat, 30 Aug 2025 14:29:31 +1000 Subject: [PATCH] use totals to calc bill totals - should be less work, also improved cosmetics of totals display --- templates/bills.html | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/templates/bills.html b/templates/bills.html index 37a6ff7..2961500 100644 --- a/templates/bills.html +++ b/templates/bills.html @@ -88,19 +88,24 @@ {% endfor %} + {{ total[2][2025] }} {% for yr in range( this_year, END_YEAR) %} - {% set total=namespace( sum=0 ) %} - {% for bd in bill_data %} - {% if yr|string in bd['bill_date'] %} - {% set total.sum = total.sum + bd['amount'] %} + {% set tot=namespace( sum=0 ) %} + {% for bt in bill_types %} + {% if bt.id in total %} + {% set tot.sum = tot.sum + total[bt.id][yr] %} {% endif %} {% endfor %} + {% set markup="h5" %} + {% if yr == this_year %} + {% set markup="h4 pt-4" %} + {% endif %}
-
+
Total bills in {{yr}}
-
- ${{'%.2f'|format(total.sum)}} +
+ ${{'%.2f'|format(tot.sum)}}
{% endfor %}