Developer forum

Forum » Ecommerce - Standard features » Wrong Calculation in Order details

Wrong Calculation in Order details

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a situation with DW 9.5.3.

In the Order details in back-end, we see very often differences between total and subtotal. Not big differences, but there are differences and the customer loses confidence in the system.

What I have noticed is that the precision for the calculation of Subtotal is different than the calculation for Total. See the attached example.

The exact total calculated based on the values saved in the database is 58.9878 EUR.

The subtotal displays 58.99 EUR, we have a 1.00 EUR Payment fee and the total is 59.98 EUR.

As you can see, the rounding seems different between Subtotal and Total. I would normally say that Subtotal precision is the right one.

Please have a look and let me know it this can be fixed.

Thank you,

Adrian

order_calculation.png

Replies

 
Nicolai Pedersen
Reply

Hi Adrian

We need a link to the site so we can check your settings. All numbers are rounded by the currency rounding rules and I would like to see the raw price calculations in the database.

BR Nicolai

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

https://dev.allmedia.dotfusion.ro/

The example I gave above, was from the live site but the data should be identical.

I have debugged more into the issue and apparently, the backend interface is somehow misleading, although the math seems right

The payment fee was displayed as 1.00 EUR which is the value with VAT. The value without VAT is 0.996 EUR.
When adding to 58.9878 it returns 59.9838 which is then rounded down to 59.98

The math seems right. I am not sure how it can be made more explicit. I believe the trouble is when NAV and DW use different ways to calculate values or for rounding them. And the smaller the amount, the more visible is the difference.

We are struggling now to match what we send to the Credit card payment processor with the value calculated by NAV. And we are off by 0.1.

Adrian

 
Nicolai Pedersen
Reply

You can change the checkouthandler to send the value by the rules that you are using in NAV. Should be changing how the order is summed in the checkout template.

Will take a look at DW and see if we should support another rounding scheme that will take this into consideration - i.e. round all orderline totals to 2 decimals and have the order total be a sum of the rounded orderline totals instead of real math.

BR Nicolai

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

Thank you.
Adrian

 

You must be logged in to post in the forum