//Rename your Custom Field...
//Replace Your Custom Field with "custom_eobi_salary"
//Replace Custom Field wiht "custom_percentage_of_employeer_contribution"
//Replace Custom Field wiht "calculate_eobi_5_pct_by_employer"
frappe.ui.form.on('Employee', {
custom_eobi_salary: function(frm) {
calculate_eobi_5_pct_by_employer(frm);
},
custom_percentage_of_employeer_contribution: function(frm) {
calculate_eobi_5_pct_by_employer(frm);
}
});
function calculate_eobi_5_pct_by_employer(frm) {
var eobi_salary = frm.doc.custom_eobi_salary;
var employeer_contribution_percentage = frm.doc.custom_percentage_of_employeer_contribution;
if (eobi_salary && employeer_contribution_percentage) {
var eobi_5_pct_by_employer = (eobi_salary * (employeer_contribution_percentage / 100)).toFixed(2);
frm.set_value('custom_eobi_5_pct_by_employer', eobi_5_pct_by_employer);
}
}
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