You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2007/12/07 08:37:19 UTC

svn commit: r602011 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

Author: lektran
Date: Thu Dec  6 23:37:10 2007
New Revision: 602011

URL: http://svn.apache.org/viewvc?rev=602011&view=rev
Log:
Round the total rather than the subtotals to avoid prematurely rounding tax adjustments, reported by Rashko Rejmer

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=602011&r1=602010&r2=602011&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Thu Dec  6 23:37:10 2007
@@ -2513,9 +2513,9 @@
         Iterator itemIter = UtilMisc.toIterator(orderItems);
 
         while (itemIter != null && itemIter.hasNext()) {
-            result = result.add(getOrderItemAdjustmentsTotal((GenericValue) itemIter.next(), adjustments, includeOther, includeTax, includeShipping)).setScale(scale, rounding);
+            result = result.add(getOrderItemAdjustmentsTotal((GenericValue) itemIter.next(), adjustments, includeOther, includeTax, includeShipping));
         }
-        return result;
+        return result.setScale(scale, rounding);
     }
 
     /** The passed adjustments can be all adjustments for the order, ie for all line items */



Re: svn commit: r602011 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

Posted by Scott Gray <le...@gmail.com>.
Hi David

Yes that's right, tax is currently rounded to 3 dp per adjustment then
rounded to 2 dp after summing the tax total, that is the case above.  Sorry
I should have been clearer.

Regards
Scott

On 08/12/2007, David E Jones <jo...@undersunconsulting.com> wrote:
>
>
> The rounding should be done per item, but if I remember right
> elsewhere it would have a slightly different scale, ie for most needs
> it would have 3 decimal places instead of 2. I think there is even
> separate configuration and infrastructure in place for that separate
> setting that is used elsewhere.
>
> -David
>
>
> On Dec 7, 2007, at 12:37 AM, lektran@apache.org wrote:
>
> > Author: lektran
> > Date: Thu Dec  6 23:37:10 2007
> > New Revision: 602011
> >
> > URL: http://svn.apache.org/viewvc?rev=602011&view=rev
> > Log:
> > Round the total rather than the subtotals to avoid prematurely
> > rounding tax adjustments, reported by Rashko Rejmer
> >
> > Modified:
> >    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/
> > OrderReadHelper.java
> >
> > Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/
> > OrderReadHelper.java
> > URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=602011&r1=602010&r2=602011&view=diff
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> > ======================================================================
> > --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/
> > OrderReadHelper.java (original)
> > +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/
> > OrderReadHelper.java Thu Dec  6 23:37:10 2007
> > @@ -2513,9 +2513,9 @@
> >         Iterator itemIter = UtilMisc.toIterator(orderItems);
> >
> >         while (itemIter != null && itemIter.hasNext()) {
> > -            result =
> > result.add(getOrderItemAdjustmentsTotal((GenericValue)
> > itemIter.next(), adjustments, includeOther, includeTax,
> > includeShipping)).setScale(scale, rounding);
> > +            result =
> > result.add(getOrderItemAdjustmentsTotal((GenericValue)
> > itemIter.next(), adjustments, includeOther, includeTax,
> > includeShipping));
> >         }
> > -        return result;
> > +        return result.setScale(scale, rounding);
> >     }
> >
> >     /** The passed adjustments can be all adjustments for the order,
> > ie for all line items */
> >
> >
>
>

Re: svn commit: r602011 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

Posted by David E Jones <jo...@undersunconsulting.com>.
The rounding should be done per item, but if I remember right  
elsewhere it would have a slightly different scale, ie for most needs  
it would have 3 decimal places instead of 2. I think there is even  
separate configuration and infrastructure in place for that separate  
setting that is used elsewhere.

-David


On Dec 7, 2007, at 12:37 AM, lektran@apache.org wrote:

> Author: lektran
> Date: Thu Dec  6 23:37:10 2007
> New Revision: 602011
>
> URL: http://svn.apache.org/viewvc?rev=602011&view=rev
> Log:
> Round the total rather than the subtotals to avoid prematurely  
> rounding tax adjustments, reported by Rashko Rejmer
>
> Modified:
>    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/ 
> OrderReadHelper.java
>
> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/ 
> OrderReadHelper.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=602011&r1=602010&r2=602011&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/ 
> OrderReadHelper.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/ 
> OrderReadHelper.java Thu Dec  6 23:37:10 2007
> @@ -2513,9 +2513,9 @@
>         Iterator itemIter = UtilMisc.toIterator(orderItems);
>
>         while (itemIter != null && itemIter.hasNext()) {
> -            result =  
> result.add(getOrderItemAdjustmentsTotal((GenericValue)  
> itemIter.next(), adjustments, includeOther, includeTax,  
> includeShipping)).setScale(scale, rounding);
> +            result =  
> result.add(getOrderItemAdjustmentsTotal((GenericValue)  
> itemIter.next(), adjustments, includeOther, includeTax,  
> includeShipping));
>         }
> -        return result;
> +        return result.setScale(scale, rounding);
>     }
>
>     /** The passed adjustments can be all adjustments for the order,  
> ie for all line items */
>
>


Re: svn commit: r602011 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

Posted by David E Jones <jo...@undersunconsulting.com>.
The rounding should be done per item, but if I remember right  
elsewhere it would have a slightly different scale, ie for most needs  
it would have 3 decimal places instead of 2. I think there is even  
separate configuration and infrastructure in place for that separate  
setting that is used elsewhere.

-David


On Dec 7, 2007, at 12:37 AM, lektran@apache.org wrote:

> Author: lektran
> Date: Thu Dec  6 23:37:10 2007
> New Revision: 602011
>
> URL: http://svn.apache.org/viewvc?rev=602011&view=rev
> Log:
> Round the total rather than the subtotals to avoid prematurely  
> rounding tax adjustments, reported by Rashko Rejmer
>
> Modified:
>    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/ 
> OrderReadHelper.java
>
> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/ 
> OrderReadHelper.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=602011&r1=602010&r2=602011&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/ 
> OrderReadHelper.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/ 
> OrderReadHelper.java Thu Dec  6 23:37:10 2007
> @@ -2513,9 +2513,9 @@
>         Iterator itemIter = UtilMisc.toIterator(orderItems);
>
>         while (itemIter != null && itemIter.hasNext()) {
> -            result =  
> result.add(getOrderItemAdjustmentsTotal((GenericValue)  
> itemIter.next(), adjustments, includeOther, includeTax,  
> includeShipping)).setScale(scale, rounding);
> +            result =  
> result.add(getOrderItemAdjustmentsTotal((GenericValue)  
> itemIter.next(), adjustments, includeOther, includeTax,  
> includeShipping));
>         }
> -        return result;
> +        return result.setScale(scale, rounding);
>     }
>
>     /** The passed adjustments can be all adjustments for the order,  
> ie for all line items */
>
>