# Calculating income tax using a salary component instead of using the income slabs

I’m trying to implement income taxes (for the Philippines in this case). But more importantly I would like to match the tax calculations that have been used previously before we roll out ERPNext - in this case tax is calculated monthly, and all the tax slab functionality seems to be based around annual tax, and the numbers seem to come out differently. So I would simply like to ignore the salary slabs functionality in ERPNext and compute the tax using a salary component formula

I’ve already implemented a formula in a salary component deduction which can compute the correct amount. This works fine for us in terms of calculating the correct deduction. However, whenever you create a salary slip, you receive a message "Added tax components from the Salary Component master as the salary structure didn’t have any tax component.'.

From checking the code, it seems like this is done when there is no deduction with `variable_based_on_taxable_salary` set. I’ve worked around it by setting a fake tax slab and setting the income tax rate as zero, but it still shows a line on the payslip which is confusing.

Does anyone have any thoughts about how to avoid this? One thing that springs to mind is just add a ‘fake’ salary component that has `variable_based_on_taxable_salary` set, with a 0% rate, and then to customise the print format to hide the ‘fake’ income tax deduction, but is there any cleaner solution I am missing?

Hi @jonathonsim, I created mine, here is my formula.

(((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) - 10417) * 0.15 if ((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) > 10417 and ((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) < 16666 else
(((((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) - 16667) * 0.20) + 937.50) if ((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) > 16667 and ((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) < 33332 else
(((((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) - 33333) * 0.25) + 4270.70) if ((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) > 33333 and ((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) < 983332 else
(((((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) - 83333) * 0.30) + 16770.70) if ((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) > 83333 and ((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) < 333332 else
(((((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) - 333333) * 0.35) + 91770.70) if ((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) > 333333 and ((base - WISP - PHIC - HDMF - SSS - LWOP - abs - NADJ) + SI + ADJ) < 999999999 else 0

I created a different salary component for Income Tax. My taxes computation is bi monthly. you just need to tweak it when you create a salary structure.

Hope this helps.

Thats what I did too (as a tip, I found it useful to create a salary component called ‘Net Taxable Pay’, which you can set as a ‘Statistical Component’ which sums up the taxable salary, so that the formula for the tax itself can be a little simpler).

However I still find that when you create a salary slip it still gives you the message ‘Added tax components from the Salary Component master as the salary structure didn’t have any tax component.’, which is what I’d love to turn off. In the end I made a salary component called ‘IGNORE’ and set that as ‘variable based on taxable salary’, along with income tax slabs that set 0% as the tax rate.

That gets rid of the error but its obviously a little confusing.