diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js index 8834d91bb7..fabf43316f 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.js +++ b/erpnext/selling/doctype/sales_common/sales_common.js @@ -233,99 +233,116 @@ cur_frm.cscript.recalc = function(doc, n) { // ******* Calculation of total amounts of document (item amount + other charges)**************** cur_frm.cscript.calc_doc_values = function(doc, cdt, cdn, tname, fname, other_fname) { - doc = locals[doc.doctype][doc.name]; - var net_total = 0; var other_charges_total = 0; - var cl = getchildren(tname, doc.name, fname); - for(var i = 0; i net_total ? flt(net_total_incl) : flt(net_total); - doc.other_charges_total = flt(other_charges_total); - doc.grand_total = flt(flt(net_total) + flt(other_charges_total)); - doc.rounded_total = Math.round(doc.grand_total); - doc.grand_total_export = flt(flt(doc.grand_total) / flt(doc.conversion_rate)); - doc.rounded_total_export = Math.round(doc.grand_total_export); - doc.total_commission = flt(flt(net_total) * flt(doc.commission_rate) / 100); + + var inclusive_rate = 0 + var d = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype); + for(var j = 0; jCalculation Details for Other Charges:'; + + var cl = getchildren(tname, doc.name, fname); + var tax = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype); - var tax_desc = {}; var tax_desc_rates = []; var net_total = 0; + // Make display table + var otc = make_table(cur_frm.fields_dict['Other Charges Calculation'].disp_area, + cl.length + 1, tax.length + 1, '90%', [], { border:'1px solid #AAA', padding:'2px' }); + $y(otc,{marginTop:'8px'}); + + var tax_desc = {}; var tax_desc_rates = []; var net_total = 0; - for(var i=0;i