Hullo members,
thanks for the great support, am using this script to compute and its working well but can some one explain to me the purpose of the last 2 lines in the script. I need this for learning purposes, the lines are cur_frm.cscript.custom_invoice_amount = compute; & cur_frm.cscript.custom_total_amount_paid = compute; as shown in script below, thanks in advance.
function compute(doc, cdt, cdn){
if (doc.invoice_amount && doc.total_amount_paid){ //it checks if the fields contains a value
doc.pending_payment = doc.invoice_amount + doc.total_amount_paid * 10;
refresh_field(“pending_payment”);
}
else {
doc.pending_payment = doc.invoice_amount;
refresh_field(“pending_payment”);
}
}
cur_frm.cscript.custom_invoice_amount = compute;
cur_frm.cscript.custom_total_amount_paid = compute;