Hi Guys,
I am trying to Calculate Amount field in “Sales Taxes and Charges” Item Table based on the current total value of TAX multiply by 0.02, as you can see from the screenshot below the amount is 0 not calculated. my goal is override the Amount value field.
Here’s my Custom Script:
frappe.ui.form.on(“Sales Order”, {
before_save: function (frm) {
var totalx = 0;
$.each(frm.doc.taxes_and_charges || , function (i, d) {
if (d.type == “Actual”) {
totalx = d.rate * 0.02;
}
totalx = totalx.toFixed(2); // Set recurring decimal limit
d.tax_amount = totalx;
});
cur_frm.refresh_field(“taxes_and_charges”);
}
});
My setup is Tax Inclussive that need to print,
Total without TAX = 8,695.65
TAX @ 15%= 1,304.35
Grand Total = 10,000.00
OTHERTAX= -173.91 Calculate 10000/1.15*0.02
Rounded Total = 9,826.09
My goal is to come-up the negative value of Amount field in “Sales Taxes and Charges”
Thanks