fix: print Total, Additional Discount, Net Total in that order
Default Standard Sales Invoice and Tax Invoice/Receipt printed the Additional Discount Amount among the charges, after the Total line but with no total after the discount. App copies of ERPNext's totals includes are swapped in via doc.print_templates: - taxes.html: a discount on Net Total is followed by the Net Total line ahead of the charges; a discount on Grand Total stays after them. - total.html: with inclusive tax, "Total (Without Tax)" is the total before the discount (net_total + discount_amount); upstream printed net_total, which already has the discount taken off, so the same figure appeared before and after the discount line.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,31 @@
|
|||||||
|
{#- 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) -%}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-5 {%- if doc.align_labels_right %} text-right{%- endif -%}">
|
||||||
|
<label>{{ label }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-7 text-right">
|
||||||
|
{{ value }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{%- endmacro -%}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-6"></div>
|
||||||
|
<div class="col-xs-6">
|
||||||
|
{%- 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 -%}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{#- ERPNext's templates/print_formats/includes/total.html, except that with inclusive tax the
|
||||||
|
"Total (Without Tax)" line is the total before an Additional Discount on Net Total:
|
||||||
|
net_total already has that discount taken off, so the print would show the same figure
|
||||||
|
before and after the discount line. -#}
|
||||||
|
<div class="row {% if df.bold %}important{% endif %} data-field">
|
||||||
|
{% if doc.flags.show_inclusive_tax_in_print %}
|
||||||
|
{%- set before_discount = doc.net_total + (doc.discount_amount if doc.apply_discount_on == "Net Total" else 0) -%}
|
||||||
|
<div class="col-xs-5 {%- if doc.align_labels_right %} text-right{%- endif -%}">
|
||||||
|
<label>{{ _("Total (Without Tax)") }}</label></div>
|
||||||
|
<div class="col-xs-7 text-right value">
|
||||||
|
{{ frappe.format_value(before_discount, {"fieldtype": "Currency", "options": "currency"}, doc) }}
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="col-xs-5 {%- if doc.align_labels_right %} text-right{%- endif -%}">
|
||||||
|
<label>{{ _(df.label) }}</label></div>
|
||||||
|
<div class="col-xs-7 text-right value">
|
||||||
|
{{ doc.get_formatted("total", doc) }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user