{% if pdf_state_notice %}
{{ pdf_state_notice }}
{% endif %} {# ---- Header ---- #}
{{ company_name or doc.company or "" }}

{{ title }}{% if doc.is_return %} RETURN{% endif %}

{{ doc.name }}
{{ doc.posting_date or doc.transaction_date or "" }}
{# ---- Parties ---- #}

From

{{ company_name or doc.company or "" }}
{% if company_info %} {% if company_info.get("address") %}
{{ company_info.address }}
{% endif %} {% if company_info.get("city") or company_info.get("zip_code") or company_info.get("country") %}
{{ company_info.get("city", "") }}{% if company_info.get("zip_code") %} {{ company_info.zip_code }}{% endif %}{% if company_info.get("country") %}, {{ company_info.country }}{% endif %}
{% endif %} {% if company_info.get("email") %}
{{ company_info.email }}
{% endif %} {% if company_info.get("phone") %}
{{ company_info.phone }}
{% endif %} {% if company_info.get("tax_id") %}
Tax ID: {{ company_info.tax_id }}
{% endif %} {% endif %}

{{ party_label }}

{{ address_lines[0] if address_lines else party_name }}
{% if party_info %} {% if address_lines %} {# The document's own address (lambda_erp/addresses.py); its first line is the recipient. #} {% for line in address_lines[1:] %}
{{ line }}
{% endfor %} {% else %} {% if party_info.get("address") %}
{{ party_info.address }}
{% endif %} {% if party_info.get("city") or party_info.get("zip_code") or party_info.get("country") %}
{{ party_info.get("city", "") }}{% if party_info.get("zip_code") %} {{ party_info.zip_code }}{% endif %}{% if party_info.get("country") %}, {{ party_info.country }}{% endif %}
{% endif %} {% endif %} {% if party_info.get("email") %}
{{ party_info.email }}
{% endif %} {% if party_info.get("phone") %}
{{ party_info.phone }}
{% endif %} {% if party_info.get("tax_id") %}
Tax ID: {{ party_info.tax_id }}
{% endif %} {% endif %} {% if delivery_lines %}
{{ delivery_label }}
{% for line in delivery_lines %}
{{ line }}
{% endfor %} {% endif %} {% if delivery_instructions %}
{{ delivery_instructions }}
{% endif %}
{# ---- Meta fields ---- #} {% if meta_fields %}
{% for m in meta_fields %}
{{ m.label }}
{{ m.value }}
{% endfor %}
{% endif %} {# ---- Intro text (offers) ---- #} {% if intro_html is defined and intro_html %}
{{ intro_html | safe }}
{% endif %} {# ---- Items table ---- #} {% if show_warehouse %}{% endif %} {% for item in items %} {% if show_warehouse %}{% endif %} {# A line ordered in a further unit prints that unit and its price; the stock quantity below. #} {% if item.discount_total %} {% if show_warehouse %}{% endif %} {% else %} {% endif %} {% endfor %}
# Item DescriptionWarehouseQty Rate Amount
{{ loop.index }} {{ item.item_code or "" }} {{ item.item_name or item.description or "" }}{% if item.frequency %}
{{ item.frequency }}{% endif %}
{{ item.warehouse or "" }}{% if item.ordered_in_unit %}{{ "%g"|format(item.order_qty or 0) }} {{ item.order_uom }}
= {{ "%g"|format(item.qty or 0) }} {{ item.uom or "" }}{% else %}{{ item.qty }}{% endif %}
{{ "%.2f"|format(item.order_gross_rate if item.ordered_in_unit else item.gross_rate) }} {{ "%.2f"|format(item.gross_amount) }}
{{ item.discount_label }} −{{ "%.2f"|format(item.discount_total) }}{{ "%.2f"|format(item.order_rate if item.ordered_in_unit else (item.rate or 0)) }} {{ "%.2f"|format(item.amount) }}
{# ---- Taxes ---- #} {% if taxes %}

Taxes & Charges

{% for tax in taxes %} {% endfor %}
Description Rate Amount
{{ tax.description or tax.account_head or "" }} {{ "%.1f"|format(tax.rate or 0) }}% {{ "%.2f"|format(tax.tax_amount or 0) }}
{% endif %} {% for grp in recurring_summary %}

{{ grp.frequency }}: {{ currency }} {{ "%.2f"|format(grp.net_total) }} + {{ "%.2f"|format(grp.total_taxes_and_charges) }} Tax = {{ "%.2f"|format(grp.grand_total) }}

{% endfor %} {# ---- Totals ---- #}
{% if doc.total_taxes_and_charges %} {% endif %} {% if doc.outstanding_amount is defined and doc.outstanding_amount is not none %} {% endif %}
Net Total {{ currency }} {{ "%.2f"|format(doc.net_total or 0) }}
Tax {{ currency }} {{ "%.2f"|format(doc.total_taxes_and_charges or 0) }}
Grand Total {{ currency }} {{ "%.2f"|format(doc.grand_total or 0) }}
Outstanding {{ currency }} {{ "%.2f"|format(doc.outstanding_amount or 0) }}
{# ---- Remarks ---- #} {% if remarks_html is defined and remarks_html %}
{{ remarks_html | safe }}
{% elif doc.remarks %}
Remarks: {{ doc.remarks }}
{% endif %} {# ---- Footer ---- #}