{% extends "_base.html" %} {% block heading %}{{ doc.title or doc.heading }}{% endblock %} {% block subheading %} {% if doc.subtitle %}
{{ doc.subtitle }}
{% endif %} {% endblock %} {% block header_meta %} {% if doc.generated_at %}
Gerado em {{ doc.generated_at | data }}
{% endif %}
{{ doc.rows | length }} registro(s)
{% endblock %} {% block content %} {% if not doc.rows %}
Nenhum registro no período.
{% else %} {# thead repeats on every page: display: table-header-group in the stylesheet. #} {% for column in doc.columns %} {% endfor %} {% for row in doc.rows %} {% for column in doc.columns %} {# A missing key prints empty: a report is often assembled from partial data, and failing the whole document over one absent cell helps nobody. #} {% endfor %} {% endfor %} {% if doc.totals %} {# The grand total is the last row of the body, not a . A tfoot is `table-footer-group`, which repeats on every page — and a total printed at the foot of page 2 does not match the rows above it, which is worse than not printing it there at all. As a body row it lands once, after the last record, and still lines up with its columns. #} {% for column in doc.columns %} {% endfor %} {% endif %}
{{ column.header }}
{%- set value = row.get(column.key) -%} {%- if value is none -%} {%- elif column.money -%}{{ value | brl }} {%- else -%}{{ value }} {%- endif -%}
{%- if loop.first and column.key not in doc.totals -%}Total {%- elif column.key in doc.totals -%} {%- if column.money -%}{{ doc.totals[column.key] | brl }} {%- else -%}{{ doc.totals[column.key] }} {%- endif -%} {%- endif -%}
{% endif %} {% endblock %}