Hi every one
i’m new her but i hope to find help in my issu
i created this form but i can’t make row no. 3 calculat row 1 + row 2
so please i need help
thanks
You can use a client script to calculate the new_salary
based on the previous_salary
and increase_amount
(adjust the field names and the doctype):
frappe.ui.form.on(‘Your Doctype Name’, {
before_save: function(frm) {
if (frm.doc.previous_salary && frm.doc.increase_amount) {
// Calculate the new salary
frm.doc.new_salary = frm.doc.previous_salary + (frm.doc.previous_salary * (frm.doc.increase_amount / 100));
// Refresh the field to update the UI
frm.refresh_field(‘new_salary’);
}
}
});
It is set to be updated before_save. You can change the trigger to your liking. I have tested it and it works fine.
Please apply it.
frappe.ui.form.on('Salary development stages', {
increase_amount: function(frm) {
frm.set_value("previous_salary", frm.doc.increase_amount + frm.doc.new_salary);
},
new_salary: function(frm) {
frm.set_value("previous_salary", frm.doc.increase_amount + frm.doc.new_salary);
}
});
Please check your doctype name and field name and set it in the script according.