Suggestion: rounding of tax

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 年 前
Hi Andrei,

Seems like currently the tax calculation of NC doesn't include rounding based on the sub-total. Here is an example:

If the Sales Order Sub-total is: $100.05
Tax percentage is: 10%

The calculation result from current NC is: $10.00, while if we consider the the most frequently used rounding (rounding to 1 when great than 0.5), it should be $10.01

Can we please add a option to support this rounding for the tax calculation?

Thanks.
9 年 前
Hi,

All rounding is handled in the "RoundPrice" method of \Libraries\Nop.Services\Catalog\RoundingHelper.cs class. As you may see it uses the "Math.Round" method (.NET functionality). Please find more info at http://stackoverflow.com/questions/977796/why-does-math-round2-5-return-2-instead-of-3-in-c:

So you can simply replace
value = Math.Round(value, 2);

with
value = Math.Round(value, 2, MidpointRounding.AwayFromZero);


I've just also created a work item
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.