# Small Feature Request on Income Tax Calculation

Hello community!

The current setup for Income Tax calculation is not quite flexible as I expected or rather, doesn’t work for my use case. Here is my situation:

Where we’re considering adopting ERPNext, Income Tax is calculated as demonstrated in the image below:

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.

1. Check field for “amount_dependant_on_formula”
2. 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:

``````(taxable_earnings - (0.8 * taxable_earnings)) - 4500  # <- Additional amount/other expressions.
``````

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.

Regards
Redren.

Hi there,

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.

1 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`.

2 Likes

Once again, thanks for the assistance, much appreciated. Let me get onto it. Will bring back an update on my findings.

Cheers

Thanks a lot Peter. Your suggestion worked like charm!

1 Like