{% if letter_head.content %}
{{ letter_head.content }}

{% endif %}

{{ _("STATEMENT OF ACCOUNTS") }}

{% if filters.party[0] == filters.party_name[0] %}
{{ _("Customer: ") }} {{ filters.party_name[0] }}
{% else %}
{{ _("Customer: ") }} {{ filters.party[0] }}
{{ _("Customer Name: ") }} {{filters.party_name[0] }}
{% endif %}
{{ _("Date: {0} to {1}").format( frappe.format(filters.from_date, "Date"), frappe.format(filters.to_date, 'Date') ) }}

{% for row in data %} {% if(row.posting_date) %} {% else %} {% endif %} {% endfor %}
{{ _("Date") }} {{ _("Reference") }} {{ _("Remarks") }} {{ _("Debit") }} {{ _("Credit") }} {{ _("Balance (Dr - Cr)") }}
{{ frappe.format(row.posting_date, 'Date') }} {{ row.voucher_type }}
{{ row.voucher_no }}
{% if not (filters.party or filters.account) %} {{ row.party or row.account }}
{% endif %}
{{ _("Remarks:") }} {{ row.remarks }} {% if row.bill_no %}
{{ _("Supplier Invoice No") }}: {{ row.bill_no }} {% endif %}
{{ frappe.utils.fmt_money(row.debit, currency=filters.presentation_currency) }} {{ frappe.utils.fmt_money(row.credit, currency=filters.presentation_currency) }} {{ frappe.format(row.account, {fieldtype: "Link"}) or " " }} {{ row.get('account', '') and frappe.utils.fmt_money(row.debit, currency=filters.presentation_currency) }} {{ row.get('account', '') and frappe.utils.fmt_money(row.credit, currency=filters.presentation_currency) }} {{ frappe.utils.fmt_money(row.balance, currency=filters.presentation_currency) }}

{% if ageing %}

{{ _("Ageing Report based on {0} up to {1}").format( ageing.ageing_based_on, frappe.format(filters.to_date, "Date") ) }}

{{ _("0 - 30 Days") }} {{ _("30 - 60 Days") }} {{ _("60 - 90 Days") }} {{ _("90 - 120 Days") }} {{ _("Above 120 Days") }}
{{ frappe.utils.fmt_money(ageing.range1, currency=filters.presentation_currency) }} {{ frappe.utils.fmt_money(ageing.range2, currency=filters.presentation_currency) }} {{ frappe.utils.fmt_money(ageing.range3, currency=filters.presentation_currency) }} {{ frappe.utils.fmt_money(ageing.range4, currency=filters.presentation_currency) }} {{ frappe.utils.fmt_money(ageing.range5, currency=filters.presentation_currency) }}
{% endif %} {% if terms_and_conditions %}
{{ terms_and_conditions }}
{% endif %}