{% extends "base.html" %} {% from "_macros.html" import money %} {% block title %}Auswertungs-Builder{% endblock %} {% block heading %}Auswertungs-Builder{% endblock %} {% block content %} {% set GROUPS = [ ('month', 'Monat'), ('customer', 'Kunde'), ('rep', 'Vertriebler'), ('item_type', 'Artikel-Typ'), ] %} {% set METRICS = [ ('revenue', 'Umsatz (Netto)'), ('margin', 'Marge ~30 %'), ('count', 'Anzahl Rechnungen'), ] %}
{{ pivot.date_from }} bis {{ pivot.date_to }} — Gesamtsumme: {% if pivot.metric == 'count' %}{{ pivot.grand_total|int }}{% else %}{{ money(pivot.grand_total) }}{% endif %}
| {{ pivot.x_label }} | {% if pivot.group_y %} {% for y in pivot.y_labels %}{{ y }} | {% endfor %}Summe | {% else %}{% for k, label in METRICS %}{% if pivot.metric == k %}{{ label }}{% endif %}{% endfor %} | {% endif %}
|---|---|---|---|
| {{ x }} | {% if pivot.group_y %} {% for y in pivot.y_labels %} {% set v = pivot.matrix.get(x, {}).get(y, 0) %}{% if v %} {% if pivot.metric == 'count' %}{{ v|int }}{% else %}{{ '%.2f'|format(v) }}{% endif %} {% else %} — {% endif %} | {% endfor %}{% if pivot.metric == 'count' %}{{ pivot.totals_x[x]|int }}{% else %}{{ '%.2f'|format(pivot.totals_x[x]) }}{% endif %} | {% else %}{% if pivot.metric == 'count' %}{{ pivot.totals_x[x]|int }}{% else %}{{ '%.2f'|format(pivot.totals_x[x]) }}{% endif %} | {% endif %}
| Summe | {% for y in pivot.y_labels %}{% if pivot.metric == 'count' %}{{ pivot.totals_y[y]|int }}{% else %}{{ '%.2f'|format(pivot.totals_y[y]) }}{% endif %} | {% endfor %}{% if pivot.metric == 'count' %}{{ pivot.grand_total|int }}{% else %}{{ '%.2f'|format(pivot.grand_total) }}{% endif %} |