$statement_label

$start_date - $end_date

{% if invoices is defined and invoices is not empty %}

{{ t('invoices') }}

{% for invoice in invoices %} {% endfor %} {% set sum_balance = invoices|sum('balance_raw') %} {% if sum_balance > 0 %} {% endif %}
{{ t('invoice') }} # {{ t('invoice_date') }} {{ t('invoice_due_date') }} {{ t('total') }} {{ t('balance') }}
{{ invoice.number }} {{ invoice.date }} {{ invoice.due_date }} {{ invoice.amount }} {{ invoice.balance }}
$balance_label {{ sum_balance|format_currency(currency_code) }}

{% endif %}
{% if invoices is defined and invoices is not empty and show_payments %}

{{ t('payments') }}

{% set net_refunds = 0 %} {% set total_payments = 0%} {% for invoice in invoices %} {% if invoice.payments|e %} {% set parent_payment = invoice.payments|first %} {% for payment in invoice.payments %} {% set currency_code = payment.currency %} {% for pivot in payment.paymentables %} {%if pivot.is_credit %} {%else%} {%endif%} {% if pivot.refunded_raw > 0 %} {% set net_refunds = net_refunds + pivot.refunded_raw %} {% endif %} {% set total_payments = total_payments + pivot.amount_raw %} {% endfor %} {% endfor %} {% endif %} {% endfor %} {% if net_refunds > 0 %} {% endif %}
{{ t('invoice') }} # {{ t('payment_date') }} {{ t('method') }} {{ t('amount') }}
{{ pivot.invoice }} {{ pivot.created_at }} $credit_label {{ pivot.number }}{{ payment.method }}{{ pivot.amount }}
{{ pivot.invoice }} {{ pivot.updated_at }} $refund_label ({{ pivot.refunded }})
{{ currency_code }} $payments_label {{ total_payments|format_currency(currency_code) }}
$refunded_label ({{ net_refunds|format_currency(currency_code) }})
$net_label {{ (total_payments-net_refunds)|format_currency(currency_code) }}

{% endif %}
{% if credits is defined and credits is not empty and show_credits %}

{{ t('credits') }}

{% for credit in credits %} {% endfor %}
{{ t('credit') }} # {{ t('credit_date') }} {{ t('total') }} {{ t('balance') }}
{{ credit.number }} {{ credit.date }} {{ credit.amount }} {{ credit.balance }}

{% endif %}
{% if aging and show_aging %}

{{ t('aging') }}

{% for key, age in aging %} {% endfor %} {% for key, age in aging %} {% endfor %}
{{ key }}
{{ age }}

{% endif %}