Good Day every one can anyone here know how to sum column in child table and show up the total in parent field using customization in client scrip the code of mine below thank you im newbie here in ERP
frappe.ui.form.on(“Stock Entry Detail”, {
srp1:function(frm, cdt, cdn){
var d = locals[cdt][cdn];
var total = 0;
frm.doc.items.forEach(function(d) { total += d.srp1; });
frm.set_value(“total_srp”, total);
refresh_field(“total_srp”);
},
items_remove:function(frm, cdt, cdn){
var d = locals[cdt][cdn];
var total = 0;
frm.doc.items.forEach(function(d) { total += d.srp1; });
frm.set_value(“total_srp”, total);
refresh_field(“total_srp”);
}
});
!
SRP FIELD IN CHILD TABLE IS THE ONE I NEED TO COMPUTE
TOTAL SRP IN PARENT FIELD IS THE ONE I NEED TO PRODUCE OUTPUT
parent doctype name is: Stock Entry
parent total field is: total_srp
child table name is: Stock Entry Detal
child table name in parent doctype is: items
column to be sum name in child table is: srp1