From the table i got the balance in a text
here is the code …
frappe.ui.form.on(‘Supplier’, {
validate: function(frm) {
var dca = 0;
$.each(frm.doc.payment_details, function(i, d) {
dca += flt(d.collected_amount);
});
frm.set_value(“debt_collected_amount”, dca);
}
});
i need to add condition … if payment mode is cash or online transfer it will calculate the amount but if payment mode is cheque, the cheque status should be clear then it should calculate the balance