{#- ERPNext's templates/print_formats/includes/taxes.html, but a discount on Net Total is followed by the Net Total line so the print reads Total, discount, Net Total, charges. A discount on Grand Total stays after the charges, as upstream. -#} {%- macro amount_row(label, value) -%}
{{ value }}
{%- endmacro -%}
{%- if doc.discount_amount and doc.apply_discount_on == "Net Total" -%} {{ amount_row(_(doc.meta.get_label("discount_amount")), "- " ~ doc.get_formatted("discount_amount", doc)) }} {{ amount_row(_(doc.meta.get_label("net_total")), doc.get_formatted("net_total", doc)) }} {%- endif -%} {%- for charge in data -%} {%- if (charge.tax_amount or print_settings.print_taxes_with_zero_amount) and (not charge.included_in_print_rate or doc.flags.show_inclusive_tax_in_print) -%} {{ amount_row(charge.get_formatted("description"), charge.get_formatted("tax_amount", doc)) }} {%- endif -%} {%- endfor -%} {%- if doc.discount_amount and doc.apply_discount_on == "Grand Total" -%} {{ amount_row(_(doc.meta.get_label("discount_amount")), "- " ~ doc.get_formatted("discount_amount", doc)) }} {%- endif -%}