Invoice Amount Rounding

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
Hi folks,

Had a question on rounding rules for Order Processing.  I just had an ERP service reject an invoice for totals not adding up.  I took a look at the invoice and its a very simple breakdown;

product X cost 28.95.  10 were bought... giving a total of 289.50
Shipping via FedEx was calculated to be 40.61
Tax @ 13% was calculated to be 37.64

The order total is 367.74... NOT 367.75.  So of course many ERP's will send this to the error dept.

Now when I do 13% against 289.50, I get 37.635 which rounds to 37.64
I am not sure what Fedex is doing, but its possible it rounded to 40.61.

So... the question is... The order total field is clearly not using the rounded values of the lines + tax + shipping, but instead is doing another calculation of it's own.  

I then looked in the settings, and I see shoppingcartsettings.roundpricesduringcalculation is set to false.  Can I get more details on what this is doing. Will this round all values and therefore totals will come out correct in all cases? If so, rather than the default being false, wouldn't it be better to have this true out of the box?

Note: using 3.2...not that it probably matters in this case.

Thanks
9 years ago
Bump
9 years ago
\Libraries\Nop.Services\Orders\OrderTotalCalculationService.cs

I ended up changing the
   //taxValue = Math.Round(taxValue, 2)
to
    taxValue = Math.Round(taxValue, 2, MidpointRounding.AwayFromZero);

It appears to have fixed for us.

Here is some information explaining the default Math.Round using what is called banker rounding (to nearest even number)

I hope it helps.
9 years ago
I began to use nopCommerce 2 weeks ago and I noticed that  the program is running very slowly everytime I want to process an order. Any information is appreciated.
4 years ago
Photo 1
https://subefotos.com/ver/?c6f49692495e8e212b4888e1bff4181eo.jpg


Photo 2
https://subefotos.com/ver/?ed9592e1f578a3d98ac49097183da6e0o.png



In the picture 1 we can see the options of rounding of decimals that brings nopcommerce. Which I have set in redodeo by default.

In photo 2 I show on the checkout page the calculation that nopcommerce performs:

1- Two products that count 15 each in total add up to 30.
2- 16% of 30 is 4.8.
3- 30 + 4.8 should give me exactly 34.8

The point is that in my nopcommerce I can not show or charge invoices with rounded amounts, I must charge what exactly of the sum of the totals and sub totals without any type of rounding.

what should I do?
can you help me?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.