[ 
https://issues.apache.org/jira/browse/OFBIZ-12390?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17470599#comment-17470599
 ] 

Ingo Wolfmayr commented on OFBIZ-12390:
---------------------------------------

Is there a definition on how the price should be calculated?

For example:

cartItem 01:
price: 4.535
tax: 0,454
quantity:  1

cartItem 02
price: 0.955
tax: 0,955
quantity: 3

There are three different places where prices are calculated - they must come 
to the same result:

ShoppingCart - basePrice from productPrice (3 digit after comma in database)
Order- basePrice from orderItem (unitPrice - (3 digit after comma in database)
Invoice - basePrice from invoiceItem (price - (3 digit after comma in database)

(basePrice * quanity).scale(orderDecimals)
+ (itemTaxAdjustment * quantity).scale(orderDecimals)
+ (itemOtherAdjustements).scale(orderDecimals)
= total

or

(basePrice.scale(orderDecimals) * quanity)
+ (itemTaxAdjustment.scale(orderDecimals) * quantity)
+ (itemOtherAdjustements).scale(orderDecimals)
= total

or

(basePrice* quanity)
+ (itemTaxAdjustment * quantity)
+ (itemOtherAdjustements)
= total.scale(orderDecimals) 

...

If there is a definition I would like to check the methods cart, order and 
invoice to use the same logic. Having a cent difference in some cases and not 
to be able to rely on the calculation is really annoying.

> Order/Invoice: Item total result diff total result
> --------------------------------------------------
>
>                 Key: OFBIZ-12390
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-12390
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: accounting, order
>    Affects Versions: Trunk, 17.12.08, 18.12.01
>            Reporter: Ingo Wolfmayr
>            Priority: Major
>         Attachments: Orders.xml, image-2021-11-19-09-44-18-759.png, 
> image-2021-11-19-09-44-44-443.png, image-2021-11-19-09-59-07-571.png, 
> pricecheckData-1.xml
>
>
> In some cases the order total is not correct:
> net price: €1.273
> 10% sales tax: € 0.127
> quantity: 1
> grand total: € 1.40
> Now taking the same product and adding it with two order lines:
> grand total: € 2.79
> Right now the grand total is calculated by total all item net prices, total 
> all adjustments and finally adding those two values together.
> The following screenshots are taken from the orderview. Ofbiz request a 
> payment of € 2.80 but will create an invoice with a grand total of € 2.79.
> !image-2021-11-19-09-44-18-759.png!
> !image-2021-11-19-09-44-44-443.png!
> Heres the result with just one orderline:
> !image-2021-11-19-09-59-07-571.png!
>  
> I have created a XML file for testing.  Import the file via XML import and 
> create an order:
> partyId: AUT_CUSTOMER
> productStore: Test GmbH
> product 1: AUT_PRODUCT (quantity 1)
> product 1: AUT_PRODUCT_CP (quantity 1)
> Checkout with default settings.
> From my perspective the calculation should be changed to calculate the total 
> amount for each line and calculate the grand total from these results.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to