{{ paginator.render|raw }}
{% set sum_min =0 %} {% set sum_max =0 %} {% set expected_total = 0 %} {% set count = 0 %} {% for entry in bills %} {% if entry.active %} {% set count = count + 1 %} {% set sum_min = sum_min + entry.amount_min %} {% set sum_max = sum_min + entry.amount_max %} {% set expected_total = expected_total + ((entry.amount_min + entry.amount_max) / 2) %} {% endif %} {# paidDates = 0 (bill not paid in period) pay_dates = 0 (bill not expected to be paid in this period) bill is active. #} {% if entry.paid_dates|length == 0 and entry.pay_dates|length == 0 and entry.active %} {% endif %} {# paid_dates = 0 (bill not paid in period) pay_dates > 0 (bill IS expected to be paid in this period) bill is active #} {% if entry.paid_dates|length == 0 and entry.pay_dates|length > 0 and entry.active %} {% endif %} {# paid_dates >= 0 (bill is paid X times). Don't care about pay_dates. #} {% if entry.paid_dates|length > 0 and entry.active %} {% endif %} {# bill is not active #} {% if not entry.active %} {% endif %} {% endfor %} {# calculate total#} {% if count > 0 %} {% set avg_min = (sum_min / count) %} {% set avg_max = (sum_max / count) %} {% else %} {% set avg_min = 0 %} {% set avg_max = 0 %} {% endif %}
{{ trans('list.name') }} {{ trans('list.matchingAmount') }}
{% if not entry.active %} {% endif %} {{ entry.name }} {# count attachments #} {% if entry.attachments_count > 0 %} {% endif %} ~ {{ formatAmountByCurrency(entry.currency, (entry.amount_max + entry.amount_min)/2) }}
{{ 'sum'|_ }} ({{ 'active_bills_only'|_ }}) {{ formatAmountBySymbol(sum_min,'¤') }} {{ formatAmountBySymbol(sum_max,'¤') }}  
{{ 'average_per_bill'|_ }} ({{ 'active_bills_only'|_ }}) {{ formatAmountBySymbol(avg_min,'¤') }} {{ formatAmountBySymbol(avg_max,'¤') }}  
{{ 'expected_total'|_ }} ({{ 'active_bills_only'|_ }}) ~ {{ formatAmountBySymbol(expected_total,'¤') }}  
{{ paginator.render|raw }}