Hi,
I’ve a Doctype named “Payroll Reporting Form” & under it i have Child Table named “Payroll Table”
I want to calculate Child tables Fields name “hours” & “rate” and result should be in “gross”
NOTE: above three mentioned fields are child table fields.
I’ve tried this script on Doctype “Payroll Reporting Form” but its not calculating the result and this error popups when function runs.
Script :
NOTE: I’ve wrote this script on Doctype “Payroll Reporting Form” as well as also used with Child Table “Payroll Table” but not working
frappe.ui.form.on("Payroll Table", {
hours: function(frm){
calculate_total(frm);
},
overtime_hours: function(frm){
calculate_total(frm);
}
});
var calculate_total = function(frm) {
frm.set_value("gross", frm.doc.hours * frm.doc.rate);
}