Get Total Amount error

I am Trying to calculate total amount on the base of rate and qty.
This is my Parent Doctype[Product Bundle]:-

this is my child doctype[Product Bundle Item]:-

This is my Custom script:-

But its not working.

try this:
frappe.model.set_value(cdt,cdn,“total_rate”,parseFloat(d.qty)*parseFloat(d.rate))

[quote=“Maheshwari_Bhavesh, post:2, topic:58540”]
frappe.model.set_value(cdt,cdn,“total_rate”,parseFloat(d.qty)*parseFloat(d.rate))
[/quote

Thank You for replying…
Now after this

getting this error:-

frappe.model.set_value(cdt,cdn,"total_rate",parseFloat(d.qty)*parseFloat(d.rate))

use this

Not Working Giving Nan error

Please help…

Try below code:
frappe.ui.form.on(“Product Bundle Item”, {
qty: function(frm,cdt, cdn){
calculate_total(frm, cdt, cdn);
},
rate: function(frm, cdt, cdn){
calculate_total(frm, cdt, cdn);
}
});
var calculate_total = function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, “total_rate”, flt(d.qty * d.rate));
}

1 Like

Thank u so much Manjunath_Sajjan…it worked

@PKumavat Mark it as solution, it will be helpful for others.