{%- macro add_header(page_num, max_pages, doc, letter_head, no_letterhead, footer, print_settings=None, print_heading_template=None) -%} {% if letter_head and not no_letterhead %}
{{ letter_head }}
{% endif %} {% if print_heading_template %} {{ frappe.render_template(print_heading_template, {"doc":doc}) }} {% endif %} {%- if doc.meta.is_submittable and doc.docstatus==2 -%}

{{ _("CANCELLED") }}

{%- endif -%} {%- endmacro -%} {% for page in layout %}
{{ add_header(loop.index, layout|len, doc, letter_head, no_letterhead, footer, print_settings) }}
Customer Name:
Bill to:
{{ doc.customer_name }}
{{ doc.address_display or "" }}
Invoice Number:
Invoice Date:
Payment Due Date:
{{ doc.name }}
{{ frappe.utils.format_date(doc.posting_date) }}
{{ frappe.utils.format_date(doc.due_date) }}
{% for item in doc.items %} {% endfor %}
{{ _("No") }} {{ _("Item") }} {{ _("HSN/SAC") }} {{ _("Quantity") }} {{ _("Rate") }} {{ _("Amount") }}
{{ loop.index }}
{% if item.image %}
{{ item.item_name }}
{% endif %}
{{ item.item_name }}
{{ item.gst_hsn_code }} {{ item.get_formatted("qty", 0) }} {{ item.uom }} {{ item.get_formatted("net_rate", doc) }} {{ item.get_formatted("net_amount", doc) }}
  {% set tax_rate = doc.taxes | selectattr("tax_amount") | sum(attribute="rate") %} {% if tax_rate > 0 %} {% endif %}
{{ _("Sub Total:") }} {{ doc.get_formatted("total", doc) }}
{{ _("Discount") }} ({{ doc.additional_discount_percentage or 0 }}%): {{ doc.get_formatted("discount_amount", doc) }}
{{ _("Tax") }} ({{ tax_rate }}%): {{ doc.get_formatted("total_taxes_and_charges", doc) }}
{{ _("In Words: ") }}{{ doc.in_words }}
{{ _("Grand Total:") }} {{ doc.get_formatted("grand_total", doc) }}
{% if doc.taxes_and_charges %}
{{ _("Tax Breakup") }}
{% for row in doc.taxes %} {% endfor %} {% for item in doc.items %} {% for row in doc.taxes %} {% set tax_amount = item.base_net_amount * (row.rate / 100) %} {% endfor %} {% endfor %}
{{ _("HSN/SAC") }} {{ _("Taxable Amount") }}{{ row.description }} ({{ row.rate }}%)
{{ item.gst_hsn_code }} {{ item.get_formatted("base_net_amount", doc) }} {{ frappe.format_value(tax_amount, {"fieldtype": "Currency"}, doc) }}
{% endif %} {% if doc.terms %}
{{ _("Terms and Conditions") }}
{{ doc.terms}}
{% endif %}
{% endfor %}