Sales Order total with tax included != grand_total, but should be

Hi there,

I’m testing this great software for our company and results have been spectacular this far! However when mass importing sales orders from an online shop I found a problem.

In my case, alle prices include VAT, so the taxation template is set accordingly. Now if we sum up all sales items in Erpnext we arrive at the same total price as the online shop, let’s say 868.60€. The shop will set this as the grand total amount, as tax is included in the price.

Erpnext does the following: Calculate net price of each item and corresponding VAT amount. Now sum all this and we get the grand_total amount. The problem lies here in the inherent rounding and thus we arrive at a slightly different price (here: 868.63€) because we have a lot of items and big prices.

Is there a way to not round tax for each item or do you have a suggestion how to alleviate this problem?

Thank you very much.



Thanks for elaborating your query.

While trying to replicate this issue, I created following Sales Order from front end. Value entered in the Sales Order were as per scenario explained in your message. I intentionally added tax rate in fractions, so Item’s Net Rate Tax will have value in decimals as well. It still worked just fine for me, Grand Total was exactly the same as tax inclusive price entered for the Item. Check attached link for the reference.

Perhaps you should set precision as three for your ERPNext account. With three decimal points, you are less likely to encounter rounding errors.

You can set float precision from:

Setup > Systems > Global Settings

Set value in Float Precision as 3. This will be applicable for all the field of Type Float. For the Currency field, you can set precision from Customize Form. Check following link to learn more.

Thank you for your swift reply. Your replication is flawed though in regard to the fact that you only have one item. Thus, the rounding will always be correct. I have attached a screenshot showing such a problem. I have played around with float precision set to 3 and 6 places. This does not change the problem.

1 Like

@ppd thanks for reporting

CC @nabinhait

@ppd Can you please create a dummy record in It will help us to dig into it and resolve the issue.

@nabinhait I created a dummy record “SO-00033” in the demo. Title is “grand_total problem”. It shows the same effect as my screenshot. Total is 24.92$, grand total is 24.90$. VAT include in base price.

Thank you for digging into this.

@ppd Thanks, I will check into it and let you know.

Any Updates I have the same issue here in the sales order.

I have concluded that the current system is just not suited for having gross prices and rounding only once in the end (as is customary for a lot of European businesses). I have introduced my own fields and some hooks to calculate taxes and totals independently. This allows me to at least create correct invoices. Sadly I still have “wrong” grand_totals so e.g. matching payments to orders is often a little problematic (a few cents of difference…).

I thus propose a new boolean field that determines how the rounding should take place for a given tax. This way it could be integrated rather cleanly I think. Maybe I’ll get to wrestle around with it a little in the next days…

1 Like