Formula for Salary Structure

how to give conditon or formula for the following data:
if base <= 2000 calculate base * 0.08
if base >2000 and base <= 3500 calculate base * 0.11
else base >3500 calculate base* 0.15

condition: base <=2000
formula: base * 0.08
condition: base >2000 and base <= 3500
formula: base * 0.11
condition: base >3500
formula: base * 0.15

how can i make codition in only one salary structure

  • Create a Salary Component for your component
  • check amount_based_on_formula
  • set the formula as below
  • use the component in your salary structure.
    e.g.
0 if gross_pay < 6000 else 80 if gross_pay < 9000 else 150 if gross_pay < 12000 else 200
base*0.08 if base <= 2000 else base*0.11 if base <= 3500 else base*0.15
4 Likes

Thank you, worked perfectly.

@vijaywm where can I get the list of terms to be used in Formula and Conditions? I can’t figure this out…

You can use fields in Employee, Salary Structure Assignment doctypes or the Salary Component itself.

You can refer https://github.com/frappe/erpnext/blob/498d933e9ce7c18d6c595d2e0f575645dc020d81/erpnext/payroll/doctype/salary_slip/salary_slip.py#L556

If you are developing locally, you could may be add a line

print(data)

after https://github.com/frappe/erpnext/blob/498d933e9ce7c18d6c595d2e0f575645dc020d81/erpnext/payroll/doctype/salary_slip/salary_slip.py#L516
the actual data will be printed out in the console