[
https://issues.apache.org/jira/browse/OFBIZ-6436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14579020#comment-14579020 ]
Ingo Wolfmayr commented on OFBIZ-6436:
--------------------------------------
Hi Scott,
what do you think about adding something like
price.calc.decimals = 2
price.calc.rounding = ROUND_HALF_UP
to the arithmetic properties. This way you would be able define the price calculation rules.
For example: I have customers that would never show their customers prices with more then 2 digits after comma (8,526). With the above case I have to round the unit price to 8,53 (this price is displayed in the onlineshop, catalogs ...). Therefore the sales price for one unit will become 8,53. Using 8,53 in the invoice would then be most accurate as 8,526 is not valid anymore.
Short: the above mentioned price rule calculates prices with more then 2 digits after comma. I need max. 2 digits after comma.
About invoice items are calculating to 2dp: this is done in invoiceservices.java
BigDecimal billingAmount = orderItem.getBigDecimal("unitPrice").setScale(invoiceTypeDecimals, ROUNDING);
Ingo
> Different price Order vs. Invoice due rounding
> ----------------------------------------------
>
> Key: OFBIZ-6436
> URL:
https://issues.apache.org/jira/browse/OFBIZ-6436> Project: OFBiz
> Issue Type: Improvement
> Affects Versions: Release Branch 13.07, Release Branch 14.12, Trunk
> Reporter: Ingo Wolfmayr
> Assignee: Michael Brohl
> Attachments: priceservices.patch
>
>
> When creating an order with the following data, invoice and order calculates different prices due to different rounding strategies:
> Example:
> Net price: 8,70
> Price Rule: 2 %
> Calc price: 8,526
> Order quantity: 2
> Rounding order: 2 dec
> Rounding invoice: 2 dec
> Both: ROUND_HALF_UP
> Calculation for order price:
> 8,526 * 2 = 17,052 --> Rouning = 17,05 (rounding takes place after multipying with the order quantity )
> Calculation for invoice price:
> 8,53 * 2 = 17,06 (rounding takes place before multipying with the order quantity)
> Rounding takes place on different places and leads to (from my understanding) misscalculation.
> I create a patch that applies rounding on PriceCalculation level. Therefore:
> 1) get singe unit price and do all calculations on it (Price rules ...)
> 2) before forwarding the price, apply rounding (ORDER SETTINGS) on single unit price
> As the invoice calculation uses the unit price (if invoice is associate with order) from ORDER_ITEM it will calculate with the already rounded value.
> Result: Order Price = Invoice Price
> I would appreciate any thought on it.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)