How to calculate provident fund in salary structure

Hi all. I want to calculate provident fund in a salary structure. i am able to do it in salary slip but for CTC i want it in salary structure too.
i have added one custom script but it is not working.

frappe.ui.form.on(“Salary Detail”,“refresh”, function(frm, cdt, cdn) {
var d =locals[cdt][cdn];
var item=frappe.get_doc(cdt,cdn);
if(d.component == “Provident Fund”){
frappe.model.set_value(cdt, cdn, “ctc_deductions”, gross_pay*12/100);

i have added the total of earnings as gross pay in parent field and i want provident fund calculated value ctc deductions. please help

Hi @SonalD,

Please try it.

frappe.ui.form.on("Salary Detail", {
    salary_component: function(frm,cdt,cdn) {
        var d = locals[cdt][cdn];
        if (d.salary_component == "Provident Fund") {
            frappe.model.set_value(cdt, cdn, 'ctc_deductions', (gross_pay*12)/100);
            // please set you condition and field name according.

Please check your table field name.
Then reload and check it.

Thank You!