I have solved the problem upto a stage see my code below:
var a=0;
frappe.ui.form.on("Salary Structure Deduction","d_type", function(frm, cdt, cdn) {
var d =locals[cdt][cdn]
var item=frappe.get_doc(cdt,cdn);
if(d.d_type == "Provident Fund"){
frappe.model.set_value(cdt, cdn, "d_modified_amt", a*12/100);
//cur_frm.refresh_fields();
}
});
frappe.ui.form.on("Salary Structure Earning","e_type", function(frm, cdt, cdn) {
var d =locals[cdt][cdn]
var item=frappe.get_doc(cdt,cdn);
if(d.e_type=="Basic")
{
a=d.modified_value;
}
});
Now the only problem I am facing is, I need to select the Earning Type (“Basic”) from the list to get the value of “Basic” in variable, Similarly, I need to select the Deduction Type (“Provident Fund”) from the to update the value in “Provident Fund”