{% include 'header.html' %}

{{ _('Processed results') }}

{% from '_statistical_controls.html' import render_statistical_controls %} {{ render_statistical_controls(result_id) }} {% for account in accounts_data.accounts %} {% set dt_response = account.dt_response %} {% set urls = drilldown_urls_by_account[account.id] %}
{% set months = [] %} {% for agg_row in dt_response.data %} {% set _month_field = agg_row.date %} {% if (_month_field.display, _month_field.timestamp) not in months %} {% set _ = months.append((_month_field.display, _month_field.timestamp)) %} {% endif %} {% endfor %} {% for month_display, month_ts in months | sort(attribute='1', reverse=True) %} {% endfor %} {% set cat_month_map = {} %} {% for agg_row in dt_response.data %} {% if agg_row.category not in cat_month_map %} {% set _ = cat_month_map.update({agg_row.category: {}}) %} {% endif %} {% set _month_field = agg_row.date %} {% set _month_key = _month_field.timestamp %} {% set _ = cat_month_map[agg_row.category].update({_month_key: agg_row}) %} {% endfor %} {% for category in cat_month_map.keys() | sort %} {% for month_display, month_ts in months | sort(attribute='1', reverse=True) %} {% set agg_row_data = cat_month_map[category].get(month_ts) %} {% if agg_row_data %} {% set details_list = [] %} {% for detail in agg_row_data.details %} {% set _ = details_list.append(detail.date.display ~ ': ' ~ detail.amount.display ~ ' - ' ~ detail.merchant) %} {% endfor %} {% set details_str = details_list | join('
') %} {% else %} {% endif %} {% endfor %} {% endfor %}
{{ _('Categories') }}{{ month_display }}
{{ category }}{{ agg_row_data.total.display }}
{% endfor %}