Hello Community,
I am writing Client Script to calculate OT and shortfall hours.
To calculate “Total Working Hours” and “Total Holidays” I already applied Server Script Type : API
Now, to calculate OT and shortfall hours I am writing below client script which is not working.
May I know what I am missing?
frappe.ui.form.on('Salary Slip', {
refresh: function(frm) {
var twh = frm.doc.custom_total_working_hours;
var th = frm.doc.custom_total_holidays;
var pd = doc.payment_days - th;
var awh = pd * 9;
if(twh > awh) {
frm.set_value("custom_ot_hours", twh - awh);
} else if (awh < twh) {
frm.set_value("custom_shortfall_hours", awh - twh);
} else {
frm.set_value("custom_ot_hours", 0);
frm.set_value("custom_shortfall_hours", 0);
}
}
});