{#- ERPNext's templates/print_formats/includes/total.html, paired with the taxes include: with inclusive tax and a discount on Grand Total the Total line is the tax-inclusive item total (the discount is printed as entered below it); with inclusive tax otherwise it is the net before the Additional Discount, since net_total already has the discount's net share (item.distributed_discount_amount) taken off. -#} {%- set net_discount = doc.get("items")|map(attribute="distributed_discount_amount")|select|sum -%} {%- set gross_discount = net_discount and doc.apply_discount_on == "Grand Total" and doc.flags.show_inclusive_tax_in_print -%}
{% if doc.flags.show_inclusive_tax_in_print and not gross_discount %}
{{ frappe.format_value(doc.net_total + net_discount, {"fieldtype": "Currency", "options": "currency"}, doc) }}
{% else %}
{{ doc.get_formatted("total", doc) }}
{% endif %}