{% set cur = inv.currency or branch.currency %} {% set seller_is_us = kind.startswith('out_') %}

{{ company.name_en }}

{{ branch.name_en }}
{{ branch.address_en or company.address_en or '' }}
VAT No: {{ branch.vat_no or company.vat_no or '—' }}{% if company.cr_no %} · CR: {{ company.cr_no }}{% endif %}

{{ company.name_ar or company.name_en }}

{{ branch.name_ar or branch.name_en }}
{{ branch.address_ar or company.address_ar or '' }}
الرقم الضريبي: {{ branch.vat_no or company.vat_no or '—' }}
{{ doc_title[0] }}  |  {{ doc_title[1] }} {% if inv.invoice_type == 'proforma' %}
This is not a tax invoice · هذه ليست فاتورة ضريبية
{% endif %}
{{ 'Customer' if seller_is_us else 'Vendor' }} / {{ 'العميل' if seller_is_us else 'المورد' }}
{{ inv.pname_en }}
{% if inv.pname_ar %}
{{ inv.pname_ar }}
{% endif %} {% if inv.paddress %}
{{ inv.paddress }}
{% endif %}
VAT No / الرقم الضريبي{{ inv.pvat or '—' }}
Number / الرقم{{ inv.number or 'DRAFT' }}
Date / التاريخ{{ inv.date }}
Due date / تاريخ الاستحقاق{{ inv.due_date or inv.date }}
{% if inv.ref %}
Reference / المرجع{{ inv.ref }}
{% endif %} {% if inv.invoice_type == 'debit_note' and origin %}
Original invoice / الفاتورة الأصلية{{ origin.number }}
{% if inv.note_reason %}
Reason / السبب{{ inv.note_reason }}
{% endif %}{% endif %}
Currency / العملة{{ cur }}
{% for l in lines %} {% endfor %}
#DescriptionالوصفQtyالكمية Unit priceسعر الوحدةTaxable amountالمبلغ الخاضع للضريبة VAT %نسبة الضريبةVATمبلغ الضريبةTotalالإجمالي
{{ loop.index }}{{ l.description or '' }}{{ '%g' % l.quantity }} {{ l.price_unit|money(cur) }}{{ l.subtotal|money(cur) }} {{ '%g' % (l.trate or 0) }}%{{ l.tax_amount|money(cur) }} {{ (l.subtotal + l.tax_amount)|money(cur) }}
{% if einv %}
{{ einv_qr|safe }}
{% if einv.status in ('cleared', 'reported') %}{{ 'Cleared by ZATCA / معتمدة من هيئة الزكاة والضريبة والجمارك' if einv.status == 'cleared' else 'Reported to ZATCA / تم الإبلاغ عنها لهيئة الزكاة والضريبة والجمارك' }} {% else %}Not yet {{ 'cleared' if einv.subtype == 'standard' else 'reported' }} by ZATCA / لم تعتمد بعد{% endif %}
UUID: {{ einv.uuid }}
{{ einv.issued_at|replace('T', ' ') }} · ICV {{ einv.icv }}
{% endif %} {% if inv.currency %}{% endif %} {% if inv.state == 'posted' and residual != inv.amount_total %} {% endif %}
Total excluding VAT / الإجمالي غير شامل الضريبة{{ inv.amount_untaxed|money(cur) }}
Total VAT / إجمالي ضريبة القيمة المضافة{{ inv.amount_tax|money(cur) }}
Total amount due / إجمالي المبلغ المستحق ({{ cur }}){{ inv.amount_total|money(cur) }}
VAT in {{ branch.currency }} / الضريبة بـ{{ branch.currency }} (1 {{ inv.currency }} = {{ inv.rate }}){{ (inv.amount_tax * inv.rate)|round|int|money(branch.currency) }}
Balance due / الرصيد المستحق{{ residual|money(cur) }}
{% if inv.notes %}
{{ inv.notes }}
{% endif %} {% if inv.terms %}
Terms & Conditions / الشروط والأحكام
{{ inv.terms }}
{% endif %}
{{ company.phone or '' }} {{ company.email or '' }} {{ inv.number }}