Need Help for rounding problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Need Help for rounding problem

Abhishake Agarwal
Hi,

We are showing products with VAT included.

Following are the details:

*Price of product without Tax:* 34.78

*% Vat:* 15%

*Price of Product after Tax:*  39.997

*Price of Product after Tax on product detail screen when rounded to 2
decimals:* 40 (as last decimal is 7 its rounded up)

*Suppose user add 2 products to cart, then the total price of product will
be:* 79.994

*Price shown on Cart screen and Checkout screen is*: 79.99 (as last decimal
is 4).

In the above example if customer add single product to cart price will be 40
but for 2 product it will be 79.99.

What is required is that first single product price is calculated and then
quantity should be multiplied so that customer can see the price in multiple
of 40.

Please help me  on this.


Regards,
Abhishake
Reply | Threaded
Open this post in threaded view
|

RE: Need Help for rounding problem

Bhupendra
Use Bigdecimal toScale method.


-----Original Message-----
From: Abhishake Agarwal [mailto:[hidden email]]
Sent: Monday, October 26, 2009 1:38 PM
To: [hidden email]
Subject: Need Help for rounding problem

Hi,

We are showing products with VAT included.

Following are the details:

*Price of product without Tax:* 34.78

*% Vat:* 15%

*Price of Product after Tax:*  39.997

*Price of Product after Tax on product detail screen when rounded to 2
decimals:* 40 (as last decimal is 7 its rounded up)

*Suppose user add 2 products to cart, then the total price of product will
be:* 79.994

*Price shown on Cart screen and Checkout screen is*: 79.99 (as last decimal
is 4).

In the above example if customer add single product to cart price will be 40
but for 2 product it will be 79.99.

What is required is that first single product price is calculated and then
quantity should be multiplied so that customer can see the price in multiple
of 40.

Please help me  on this.


Regards,
Abhishake

http://www.mindtree.com/email/disclaimer.html
Reply | Threaded
Open this post in threaded view
|

Re: Need Help for rounding problem

Abhishake Agarwal
Hi,

Actually toScale of bigdecimal is already implemented which take value from
arithmetic.properties.

I have tried various combination in arithmetic.properties its not working,
The reason is what ofbiz does is first calculate the total price of same
product(i.e. if there are 2 same items ) and then its add the tax.

Regards,
Abhishake


On Mon, Oct 26, 2009 at 1:41 PM, Bhupendra Shivade <
[hidden email]> wrote:

> Use Bigdecimal toScale method.
>
>
> -----Original Message-----
> From: Abhishake Agarwal [mailto:[hidden email]]
> Sent: Monday, October 26, 2009 1:38 PM
> To: [hidden email]
> Subject: Need Help for rounding problem
>
> Hi,
>
> We are showing products with VAT included.
>
> Following are the details:
>
> *Price of product without Tax:* 34.78
>
> *% Vat:* 15%
>
> *Price of Product after Tax:*  39.997
>
> *Price of Product after Tax on product detail screen when rounded to 2
> decimals:* 40 (as last decimal is 7 its rounded up)
>
> *Suppose user add 2 products to cart, then the total price of product will
> be:* 79.994
>
> *Price shown on Cart screen and Checkout screen is*: 79.99 (as last decimal
> is 4).
>
> In the above example if customer add single product to cart price will be
> 40
> but for 2 product it will be 79.99.
>
> What is required is that first single product price is calculated and then
> quantity should be multiplied so that customer can see the price in
> multiple
> of 40.
>
> Please help me  on this.
>
>
> Regards,
> Abhishake
>
> http://www.mindtree.com/email/disclaimer.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Need Help for rounding problem

Jacques Le Roux
Administrator
In reply to this post by Abhishake Agarwal
Not much time, but maybe related to
https://issues.apache.org/jira/browse/OFBIZ-224
https://issues.apache.org/jira/browse/OFBIZ-1007

HTH

Jacques

From: "Abhishake Agarwal" <[hidden email]>

> Hi,
>
> We are showing products with VAT included.
>
> Following are the details:
>
> *Price of product without Tax:* 34.78
>
> *% Vat:* 15%
>
> *Price of Product after Tax:*  39.997
>
> *Price of Product after Tax on product detail screen when rounded to 2
> decimals:* 40 (as last decimal is 7 its rounded up)
>
> *Suppose user add 2 products to cart, then the total price of product will
> be:* 79.994
>
> *Price shown on Cart screen and Checkout screen is*: 79.99 (as last decimal
> is 4).
>
> In the above example if customer add single product to cart price will be 40
> but for 2 product it will be 79.99.
>
> What is required is that first single product price is calculated and then
> quantity should be multiplied so that customer can see the price in multiple
> of 40.
>
> Please help me  on this.
>
>
> Regards,
> Abhishake
>