//Rename your Custom Field... //Replace Your Custom Field with "custom_eobi_salary" //Replace Custom Field wiht "custom_percentage_of_employee_contribution" //Replace Custom Field wiht "custom_eobi_1_pct_by_employee" ____________________________________________________________ frappe.ui.form.on('Employee', { custom_eobi_salary: function(frm) { calculate_eobi_1_pct_by_employee(frm); }, custom_percentage_of_employee_contribution: function(frm) { calculate_eobi_1_pct_by_employee(frm); } }); function calculate_eobi_1_pct_by_employee(frm) { var eobi_salary = frm.doc.custom_eobi_salary; var employee_contribution_percentage = frm.doc.custom_percentage_of_employee_contribution; if (eobi_salary && employee_contribution_percentage) { var eobi_1_pct_by_employee = (eobi_salary * (employee_contribution_percentage / 100)).toFixed(2); frm.set_value('custom_eobi_1_pct_by_employee', eobi_1_pct_by_employee); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter