format totals per year and based on dates/END_YEAR
This commit is contained in:
@@ -86,20 +86,22 @@
|
||||
<button id="bill-type-canc-{{bt.id}}" class="px-0 col-1 btn btn-danger bg-danger-subtle text-danger d-none" onClick="CancelUpdateBillType({{bt.id}}, '{{bt.name}}')"><span class="bi bi-x"> Cancel</button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% set total=namespace( sum=0 ) %}
|
||||
{% for bd in bill_data %}
|
||||
{% if '2025' in bd['bill_date'] %}
|
||||
{% set total.sum = total.sum + bd['amount'] %}
|
||||
{% endif %}
|
||||
{% 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'] %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<div class="row">
|
||||
<div class="pt-4 col text-end display-6">
|
||||
Total bills in {{yr}}
|
||||
</div>
|
||||
<div class="pt-4 col display-6 text-primary">
|
||||
${{'%.2f'|format(total.sum)}}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="row">
|
||||
<div class="pt-4 col text-end display-6">
|
||||
Total bills in 2025:
|
||||
</div>
|
||||
<div class="pt-4 col display-6 text-primary">
|
||||
${{total.sum}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- right-hand-side, bill types (e.g. gas, phone, etc.) -->
|
||||
|
||||
Reference in New Issue
Block a user