{% extends "base.html" %} {% import "_ledger.html" as ledger_row with context %} {% block title %}{{ statement.identification or statement.statement_id }} — painfree{% endblock %} {% block body %} {# An account statement, drawn the way an account statement has been drawn for a century: two amount columns, a running balance, and the entries in the order the bank sent them. Debit and credit are the payload's `credit_debit` turned back into the two columns it came from, rather than into a signed number. The balance column is arithmetic this console does (`painfree.ui.ledger`), and it says so: no `camt` message carries one. #} {% set account = payload.get('account') or {} %}

{{ account.get('owner') or account.get('iban') or statement.statement_id }}

{% if account.get('iban') %}{{ account.get('iban') }} · {% endif %} {%- if account.get('currency') %}{{ account.get('currency') }} · {% endif %} {%- if account.get('servicer_bic') %}{{ account.get('servicer_bic') }}{% endif %}
{{ statement.message_type }}, {%- if payload.get('kind') == 'report' %} {{ t('account.kind_report') }} {%- elif payload.get('kind') == 'notification' %} {{ t('account.kind_notification') }} {%- else %} {{ t('account.kind_statement') }}{% endif %} · {{ t('statements.entry_count', count=statement.entry_count) }} {%- if statement.from_datetime %}
{{ statement.from_datetime | moment }} → {{ statement.to_datetime | moment }} {%- endif %}

{# The four figures a statement is read for, and the one check worth doing on them. `reconciles` is exact: the arithmetic is decimal, over the digits the bank sent, against the closing balance the bank stated. #} {% set opening = payload.get('opening_balance') or {} %} {% set closing = payload.get('closing_balance') or {} %}
{{ t('statement.opening_balance') }}
{{ statement.opening_balance | amount(statement.currency) }}
{{ opening.get('date') | day }}{% if opening.get('type') %} · {{ opening.get('type') }}{% endif %}
{{ t('account.money_in') }}
{{ ledger.credited | amount(statement.currency) }}
{{ t('statements.entry_count', count=ledger.credits) }}
{{ t('account.money_out') }}
{{ ledger.debited | amount(statement.currency) }}
{{ t('statements.entry_count', count=ledger.debits) }}
{{ t('statements.closing_balance') }}
{{ statement.closing_balance | amount(statement.currency) }}
{{ closing.get('date') | day }}{% if closing.get('type') %} · {{ closing.get('type') }}{% endif %}

{%- if ledger.reconciles %} {{ t('account.reconciles') }} {%- elif ledger.reconciles is none %}{{ t('account.no_opening') }} {%- else %}× {{ t('account.does_not_reconcile') }}{% endif %}

{% if ledger.lines %} {# The filter is four links rather than a form, so it works with scripting off and each state is a URL an operator can keep. #}

{{ t('account.show') }} {{ t('account.show_all') }} {{ t('account.money_out') }} {{ t('account.money_in') }} {% if ledger.ours %} {{ t('account.show_ours') }} {% endif %}

{# Not yet booked, above the ledger and outside it. A `PDNG` entry has not moved the balance, so it has no balance beside it. #} {% if ledger.pending %} {% for line in ledger.pending %} {{ ledger_row.row(line, false) }} {% endfor %} {% endif %} {% for line in lines %} {{ ledger_row.row(line, ledger.running) }} {% else %} {% endfor %}
{{ t('account.booked') }} {{ t('account.value_date') }} {{ t('account.counterparty') }} {{ t('account.money_out') }} {{ t('account.money_in') }} {{ t('account.balance') }}
{{ t('account.not_booked') }} {{ t('account.not_booked_note') }}
{{ t('account.no_entries') }}
{% if ledger.running %}

{{ t('account.balance_derived') }}

{% endif %}
{% endif %}
{{ t('statement.normalised') }}
{{ t('common.connection') }}{{ statement.connection_id }}
{{ t('statement.identification') }}{{ statement.identification or '—' }}
{{ t('statement.currency') }}{{ statement.currency or '—' }}
{{ t('statement.sequence') }}{{ statement.sequence_number or '—' }}
{{ t('statement.period') }} {{ statement.from_datetime | moment }} → {{ statement.to_datetime | moment }}
{{ t('statement.download_run') }}{{ statement.run_id or '—' }}
{{ t('order.ingested') }}{{ statement.ingested_at | moment }}
{{ t('statement.content_hash') }}{{ statement.content_hash }}
{{ statement.payload | pretty_json }}
{% endblock %}