From 3d5d858933f1b71b9591784b264a7e0ac1e5e4e2 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 21 Sep 2017 16:15:30 +0530 Subject: [PATCH] set total in tax table if category not valuation and consider deductions (#10870) --- erpnext/public/js/controllers/taxes_and_totals.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index d042bb7220..d1eb534b3b 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -285,12 +285,14 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ }, set_cumulative_total: function(row_idx, tax) { + var tax_amount = (in_list(["Valuation and Total", "Total"], tax.category) ? + tax.tax_amount_after_discount_amount : 0); + if (tax.add_deduct_tax == "Deduct") { tax_amount = -1*tax_amount; } + if(row_idx==0) { - tax.total = flt(this.frm.doc.net_total + tax.tax_amount_after_discount_amount, - precision("total", tax)); + tax.total = flt(this.frm.doc.net_total + tax_amount, precision("total", tax)); } else { - tax.total = flt(this.frm.doc["taxes"][row_idx-1].total + tax.tax_amount_after_discount_amount, - precision("total", tax)); + tax.total = flt(this.frm.doc["taxes"][row_idx-1].total + tax_amount, precision("total", tax)); } },