{# Shared reconciliation table helpers. fmt(v) — format one cell: integers with thousands separators, other numbers to 2dp, everything else verbatim (blank for null). render_table(t) — a plain {columns, rows} table rendered with fmt(). drill_table(...) — like render_table, but the cell in `key_col` becomes a link to `link_base?param=` (segment → explorer drill-down, or a key → single-loan link). #} {% macro fmt(v) -%} {%- if v is integer -%}{{ "{:,}".format(v) }}{%- elif v is number -%}{{ "{:,.2f}".format(v) }}{%- else -%}{{ v if v is not none else "" }}{%- endif -%} {%- endmacro %} {% macro render_table(table) %}
{% for c in table.columns %}{% endfor %} {% for row in table.rows %} {% for c in table.columns %}{% endfor %} {% endfor %}
{{ c }}
{{ fmt(row[c]) }}
{% endmacro %} {% macro drill_table(table, key_col, link_base, param) %}
{% for c in table.columns %}{% endfor %} {% for row in table.rows %} {% for c in table.columns %} {% endfor %} {% endfor %}
{{ c }}
{% if c == key_col and row[c] is not none %}{{ fmt(row[c]) }}{% else %}{{ fmt(row[c]) }}{% endif %}
{% endmacro %}