Hello;
I have method in .js file and this method is associated with button (it will be run when clicking on the button).
Can I use this method within the script from another method? How to call it?
I tried to call it using payments_calculate (frm); but nothing happened.
payments_calculate: function(frm) { cur_frm.set_value("total_paid_amount", flt(cur_frm.doc.q1_amount) + flt(cur_frm.doc.q2_amount) + flt(cur_frm.doc.q3_amount) + flt(cur_frm.doc.q4_amount)); cur_frm.set_value("total_paid_value", flt(cur_frm.doc.total_paid_amount)); var net_payment; net_payment = flt(cur_frm.doc.total_paid_amount) - flt(cur_frm.doc.total_payable_tax) + flt(cur_frm.doc.balance); if (net_payment < 0) { net_payment = 0 - net_payment; cur_frm.set_value("balance_to_be_paid", net_payment); cur_frm.set_value("balance_to_be_returned", 0); } else if (net_payment > 0) { cur_frm.set_value("balance_to_be_returned", net_payment); cur_frm.set_value("balance_to_be_paid", 0); } else { cur_frm.set_value("balance_to_be_paid", net_payment); cur_frm.set_value("balance_to_be_returned", net_payment); } }
Regards
Bilal