I have been able to achieve this using Salary Structure component (basically nested if statements)
I wanted to know if this can be achieved using tax slabs. We will have multiple salary structures and I don’t want to maintain this on every salary structure. If tax rules changes, then we have to make a lot of changes.
This is how all marginal tax brackets work. ERPNext understands that and does the calculation automatically. This is exactly the situation the Income Tax Bracket doctype was designed to cover, no formulas needed!
Similar question for Zambian tax brackets, I’m new to this forum so please excuse the formatting.
0 to 4000 at 0%
4001 to 4800 at 25%
4801 to 6900 at 30
6901 and above at 37.5 (this last slab is calculated at anything in excess of 6900 - 6900 * 37.5%)
If I get a salary of 12000 and use ERPNext tax slabs, I get calculated tax of 4353.62 when my tax calculator says I should pay taxes of 2742.5. I’ve read the discussions involving income tax calculations and the responses are not helpful to anyone who doesn’t have a coding background and doesn’t understand the syntax.
Thanks for the response, Peter. The closest I’ve gotten to getting the PAYE salary component to work is with this formula which I gathered after reading several discussions:
gross_pay * 0 if (gross_pay < 4000) else 800 * 0.25 if (gross_pay > 4000.01 and gross_pay <= 4800) else 2100 * 0.30 if (gross_pay > 4800.01 and gross_pay <= 6900) else (gross_pay - 6900) * 0.375 if (gross_pay > 6900) else 0.
With this formula when I add the PAYE component to any salary structure, it only returns a single value that meets the given conditions so I thought the income tax slabs could help with this problem but they’re not returning the right value either so either I give up or learn python it seems 🥲
The syntax for conditions and formulas is pretty basic. I think that’s the issue you might be running into here. It’s possible to do everything you’re trying to do in a single salary component with a giant formula, but it’s messy. Far simpler would be to just create three different salary components, each with a different condition:
base>4000 and base<=4800
base>4800 and base<=6900
(base-4800)*0.300 + 200
(base-6900)*0.375 + 830
Stick them all in a salary structure and you’re good to go. I just tested on my local system and, assigning 12000 base salary, got 2742.5 income tax. There are other ways to do it, but if you’re not comfortable with complex/nested logic this is by far the simplest.
I agree. Nested formulas in the salary structure itself is the way to go. Tax slabs seems to be geared towards annual calculations and it’s pretty confusing to apply it to monthly calculations especially for countries that have non-taxable income within their base pay.