{#- ERPNext's templates/print_formats/includes/total.html, except that with inclusive tax the "Total (Without Tax)" line is the net total before the Additional Discount: net_total already has the discount's net share (item.distributed_discount_amount) taken off, and the taxes include prints that share and Net Total right below this line. -#}
{% if doc.flags.show_inclusive_tax_in_print %} {%- set before_discount = doc.net_total + (doc.get("items")|map(attribute="distributed_discount_amount")|select|sum) -%}
{{ frappe.format_value(before_discount, {"fieldtype": "Currency", "options": "currency"}, doc) }}
{% else %}
{{ doc.get_formatted("total", doc) }}
{% endif %}