From 10393b39d3aad5c80b3a3a6e6d5a0c3c14f57ccc Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 20 Jan 2012 14:29:40 +0530 Subject: [PATCH 1/3] Other Charges total fixed to 2 decimals --- erpnext/selling/doctype/sales_common/sales_common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js index 603a7b2114..8767b2d1cb 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.js +++ b/erpnext/selling/doctype/sales_common/sales_common.js @@ -252,7 +252,7 @@ cur_frm.cscript.calc_doc_values = function(doc, cdt, cdn, tname, fname, other_fn } doc.net_total = inclusive_rate ? flt(net_total_incl) : flt(net_total); - doc.other_charges_total = flt(other_charges_total); + doc.other_charges_total = flt(other_charges_total).toFixed(2); //doc.grand_total = flt(flt(net_total) + flt(other_charges_total)); doc.grand_total = flt((flt(net_total) + flt(other_charges_total)).toFixed(2)); doc.rounded_total = Math.round(doc.grand_total); From 4c923909728ee511b2f6c8688f2d83d77bb68ef4 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 20 Jan 2012 14:32:01 +0530 Subject: [PATCH 2/3] Fix to other charges total --- erpnext/selling/doctype/sales_common/sales_common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js index 8767b2d1cb..5721ea7c7c 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.js +++ b/erpnext/selling/doctype/sales_common/sales_common.js @@ -252,7 +252,7 @@ cur_frm.cscript.calc_doc_values = function(doc, cdt, cdn, tname, fname, other_fn } doc.net_total = inclusive_rate ? flt(net_total_incl) : flt(net_total); - doc.other_charges_total = flt(other_charges_total).toFixed(2); + doc.other_charges_total = flt(flt(other_charges_total).toFixed(2)); //doc.grand_total = flt(flt(net_total) + flt(other_charges_total)); doc.grand_total = flt((flt(net_total) + flt(other_charges_total)).toFixed(2)); doc.rounded_total = Math.round(doc.grand_total); From 60c42d2e1c85364d1622360bd67848cd5b12804b Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 20 Jan 2012 14:44:14 +0530 Subject: [PATCH 3/3] Fix to other charges total --- erpnext/selling/doctype/sales_common/sales_common.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js index 5721ea7c7c..f1d4b71f4c 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.js +++ b/erpnext/selling/doctype/sales_common/sales_common.js @@ -311,7 +311,7 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname) //enter item_wise_tax_detail i.e. tax rate on each item var item_wise_tax_detail = cur_frm.cscript.get_item_wise_tax_detail(doc, rate, cl, i, tax, t); if(tax[t].charge_type != "Actual") tax[t].item_wise_tax_detail += item_wise_tax_detail; - tax[t].total_amount = flt(tax_amount); //stores actual tax amount in virtual field + tax[t].total_amount = roundNumber(flt(tax_amount), 2); //stores actual tax amount in virtual field tax[t].total_tax_amount = flt(prev_total); //stores total amount in virtual field tax[t].tax_amount += flt(tax_amount); var total_amount = flt(tax[t].tax_amount); @@ -329,6 +329,8 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname) } } +function roundNumber(num, dec) { var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec); return result;} + cur_frm.cscript.check_charge_type_and_get_tax_amount = function( doc, tax, t, cl, rate, print_amt) { doc = locals[doc.doctype][doc.name]; if (! print_amt) print_amt = 0;