With the current setup. I can add the ranges and add the % percentage deductions (inverted). E.g In the given example in the image above, I’d subtract 80%.

But as you can see, the calculation does not end there, there still needs to be deducted another amount from the result of the first deduction.

My request is if there could be a way to make the final amount on each taxable_salary_slab dependant on a formula as we do with Salary Components.

Check field for “amount_dependant_on_formula”

Have “amount” or “taxable_earnings” available in the context for use in the formula

With this, I’d then go on to adding a formula such as:

This is the problem I’m currently faced with, there is no way to add a formula. Now, I’m still a newbie to ERPNext and Frappe, but not to Python. I have seen how flexible ERPNext is, so if someone can point me to where I can add some tweaks to achieve this desired result, whether by custom scrips, or server scripts, or any other way possible.

Tax slabs are used to estimate withholding on deductions that are assessed across multiple pay periods (i.e., most typically annual income tax and monthly/weekly pay). If income tax is being assessed per pay period, you should be using Salary Component formulas to calculate it. With Salary Components, you can have as many stages or nested levels as you’d like.

Thanks for the respose Peter. I’ve been thinking about implementing this as Salary Components as you suggest. So say I was to calculate the Tax Component based on for example:

taxable_amount =

Gross Salary - Exempt Income (from other components)

Less certain deductions (from other components)

Then apply the tax based on ranges, probably via nested ifs to avoid a handful of components. Is this possible? To make deduction after making other deductions as my example scenario.

Yes, it’s definitely possible. The calculation formulas need to be limited to a single eval statement, but you nest a bunch of conditional operators in there if you need to. It works but can get a bit messy. Alternately, you can use statistical components, which are calculated like any other component but don’t show up by themselves on a pay slip. For your case, to get income tax, you might define each bracket individually as statistical components b0 – b5, each with its own condition, and then create a single income tax component (non-statistical) that is just b0 + b1 + b2 + b3 + b4 + b5.

Hello, everyone I have successfully, made formulas and I have succeeded in generating payroll, can some help how I can put the amount and percentage in tax slabs? as erpnext just takes the percentage

Taxable Income

Income Tax Rate in Pakistan

Where taxable income does not exceed Rs600,000

The tax rate is zero

Where taxable income exceeds Rs. 600,000 but does not exceed Rs. 1,200,000

2.5 per cent of the amount exceeding Rs 600,000

Where taxable income exceed Rs1,200,000 but does not exceed Rs2,400,000

Rs15,000 + 12.5 per cent of the amount exceeding Rs1,200,000

If taxable income exceeds Rs2,400,000 but does not exceed Rs3,600,000

Rs165,000 + 20% of the amount exceeding Rs2,400,000

Where taxable income exceeds Rs3,600,000 but does not exceed Rs6,000,000

Rs405,000 + 25 per cent of the amount exceeding Rs3,600,000

If taxable income exceeds Rs6,000,000 but does not exceed Rs12,000,000

Rs1,005,000 + 32.5 per cent of the amount exceeding Rs6,000,000

Where taxable income exceeds Rs12,000,000

Rs2,955,000 + 35 per cent of the amount exceeding Rs12,000,000