How to multiple, amount for a number

how can i make a script to multiple, number of days with total amount in item row.
so i can have a total, base on unit price and per day?

i tried this but no success

frappe.ui.form.on(“Purchase Invoice Item”, “rate”, function(frm, doctype, name) {
var d = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, “amount”, d.dias * d.amount);

please share a screen shot of your modified doctype…