Sum to custom fields

plz help to do that
doctype sales order item ( all fields type = currency )

1- Rate with shipping =(1+2)
2- Total amount with shipping = (Rate with shipping * quantity)
3- the total amount of fob = ( total of freight )

1 Like

@Ashraf_El_Sharqawy

Try This

frappe.ui.form.on(“DocType Name”, {
refresh: function(frm) {
// calculation
var shipping_rate = frm.doc.rate + frm.doc.freight;
var total_amount = frm.doc.rate_with_shipping * frm.doc.quantity;
frm.set_value(“total_amount_with_shipping”, total_amount );
frm.refresh_field(“total_amount_with_shipping”);
frm.set_value(“rate_with_shipping”, shipping_rate );
frm.refresh_field(“rate_with_shipping”);
}
});