use totals to calc bill totals - should be less work, also improved cosmetics of totals display
This commit is contained in:
@@ -88,19 +88,24 @@
|
||||
<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 %}
|
||||
{{ 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 %}
|
||||
<div class="row">
|
||||
<div class="pt-4 offset-4 col text-end h4">
|
||||
<div class="offset-4 col text-end {{markup}}">
|
||||
Total bills in {{yr}}
|
||||
</div>
|
||||
<div class="pt-4 col h4 text-primary">
|
||||
${{'%.2f'|format(total.sum)}}
|
||||
<div class="col {{markup}} text-primary">
|
||||
${{'%.2f'|format(tot.sum)}}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user