# Bug in Sales Taxes and Charges calculation

Hi,

I’m creating a template of taxes and charges to reflect charges from selling on an e-commerce platform. I have 2 charges: one at 2.2% and another at 4%, I created 2 lines and chose the Type: On Net Total. Those charges are cumulated and are included in the Basic Rate.

When selecting the Sales Taxes and Charges Template, I got the 2 lines of charge appear but the amounts seems wrong to me: 2.2% of the Net Total and the 4% of the Net Total are wrong. I couldn’t find how those amounts are calculated. Please see the screenshot.

Can someone help to explain? Thanks

Select Edit on 3rd row and then select reference row for Tax calculation

Thanks. I meant the amount calculated for the 2.2% based on the Net Total is not correct. 2.2% of 230,508.47 is not 5,278.34… It’s also wrong for the 4%…

Could someone let me know if it’s a bug or there is a calculation method that I missed to understand?
It’s also confusing here the way it calculate the charges when setting base on the Net amount. In my case here the total is 244800, and I have 2 charges: one at 2.2% of the Net total and the other at 4% of the Net total. So if I understand the Net total = Total - taxes and charges. But here the charges are based on the Net total… So how it does the calculation?
244800 - (2.2% * 244800) - (4% * 244800) ?

In any case I couldn’t get the amounts the system gave me in the table…

Also is there anyway to add a new option let’s say Based on Grand Total instead of based on Net Total ?

Thanks

Did you fix your issue? I have the same problem now.

No unfortunately. I had to create a template and a table to calculate and deduct charges on my own way.

Hey @Koy , It is fixed. I am new to this ERP and having same issue. Please help me to fix this tax calculation issue…

Hi @Neha_Agarwal, it is NOT fixed. What I did is just to create another template and table of charges to display e-commerce fees included in the sales order so the Accounting department would understand.

Hi Koy,

After reading the code, I found the formula that ERP Next uses when making the calculations and it’s working fine.

Take as an example one item that costs 100 and the tax is 2%
You may say, 98 for the product and 2 for the tax but it doesn’t work like that.

The formula for the tax calculation is price - (price / ( 1+ tax rate percentage))

So with the numbers of the example, 100 - (100/ 1.02) = 1.9607
The 2% of 100 with taxes includes.

It makes sense as you define that the price has the taxes included, so is the price of the item (1) plus the percentage (0.02)

Try to do it but the other way around, as excluded taxes. 98 + 2% taxes = 99.96

So your item can cost 98.04 or 98 and you will pay the same amount of taxes.

I’ve sent this data to the taxes retention department of my country to make electronic invoices and the calculations are right.

I know it’s a little difficult to understand initially but we aren’t accountants I guess and that’s totally fine, all days we can learn something new.

Regards,

Julio Cojom.

I think there’s definitely something wrong here, but I’m not sure what it is. What’s strange is that the screenshot above shows correct numbers for totals but incorrect numbers in the Amount (VND) column. That’s apparent because the numbers don’t even add up:

``````230,508 + 5,278 = 235,786 (not 235,580)
235,580 + 9,597 = 245,177 (not 244,800)
``````

I’m not facing the same problem on my system:

Notice that the totals are the same but the amounts are not. I’m not sure if this is a bug that has been fixed since OP posted or if there’s something odd about how OP’s system is setup. In any case, in keeping with your math above, Net is calculated correctly `244,800 / 1.062`, but the individual amount fields are not correct.

Hello @peterg,

Thanks for reverting back on the topic and for the explanation. The individual amount are indeed the main concern. I’m trying to use this Tax and Charge to apply charge fees from e-commerce platform like Lazada and Shopee, which will help the accounting department to verify numbers against the invoices from those platforms. So I would need the exact matched amounts…

Not sure to fully understand how it works here. Maybe it’s a bug… Anyway, I had to create a work around solution by creating a new template for Taxes and Charges and to use Javascript to calculate charges amounts matching my needs. Then to create an addition row to deduct the total charge in the invoice as it’s already included in the price.

If it is working for you, that’s great. I was not able to produce the odd numbers that you were seeing, which makes me think that the “proper” method should work for you too, but if you’re happy with what you’re doing no need to change of course. Good luck!