Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderTotal Rounding #1424

Closed
AndreiMaz opened this issue May 19, 2016 · 2 comments
Closed

OrderTotal Rounding #1424

AndreiMaz opened this issue May 19, 2016 · 2 comments

Comments

@AndreiMaz
Copy link
Member

AndreiMaz commented May 19, 2016

Would be nice to have the ability to configure OrderTotal rounding.
Eg. in Sweden decimals (ören/cents) are not used anymore, and when using discount codes with percentage, the order total get decimals.

i want the order totals (only) to look like this:
Sub-total: 10,00
Tax 2,50

Rounding: 0,50

Total: 13,00

See discussion at http://www.nopcommerce.com/boards/t/41958/suggestion-ordertotal-rounding.aspx (waiting for reply)

and https://en.wikipedia.org/wiki/Cash_rounding

See related work item - #677

Contribution: #1983 and #1992

@mfalkao
Copy link

mfalkao commented Mar 1, 2017

My I suggest a slightly different implementation.
Instead of using the suggested RoundingType it would be sufficient to state the precision as decimal (like 0.01, 0.05, 0.5) and a rounding type that states midpoint rounding (to even, AwayFromZero).

Rounding could then be implemented as:
v: the value to round
p: precision as decimal
m: midpoint rounding

q = Math.Truncate(v/p);
r = Math.Round(v/p - q, m);
result = (q + r) * p;

Furthermore, I would suggest to have two rounding settings per currency. One for Price and one for Amount. Additionally, there might be the need to have a separate rounding scheme for order total only.

@skoshelev
Copy link
Contributor

Closed #1424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants