Sales Order price being truncated and not rounded  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Sales Order price being truncated and not rounded

Postby Atronics » Wed Apr 27, 2016 1:46 pm

When there is a debtor discount applicable, the sell price is being truncated to two decimal places. How do I get it to round to two decimals and not truncate. When the client is selling a large number of each (sometimes low unit cost) items this can male a difference. e.g. DefaultPrice = 127.5 with a 3.8% discout --> SellPrice = 122.6550 Currently, Jiwa sets this to 122.65 I want 122.66
Atronics
Frequent Contributor
Frequent Contributor
 
Posts: 119
Joined: Fri Feb 29, 2008 4:40 pm
Topics Solved: 10

Re: Sales Order price being truncated and not rounded  Topic is solved

Postby Mike.Sheen » Thu May 12, 2016 10:26 am

We don't truncate the price - we use Math.Round(Value, DecimalPlaces, MidpointRounding.AwayFromZero)

We calculate the discount amount to the currency decimal places, then subtract that from the price - which is why it appears to be truncated.

3.8% of 127.50 = 4.845. Using our rounding that then turns into 4.85.

127.5 - 4.85 = 122.65

We do it this way because we needed to make the figures reconcile on the screen. If we didn't do it this way, people would ask us why the discount amount on the screen subtracted from the sell price doesn't equal the Ex GST Price.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 1 guest