You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2008/01/03 07:29:36 UTC

svn commit: r608352 - /ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java

Author: jleroux
Date: Wed Jan  2 22:29:35 2008
New Revision: 608352

URL: http://svn.apache.org/viewvc?rev=608352&view=rev
Log:
Merged by hand from trunk 607359

Modified:
    ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java

Modified: ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java?rev=608352&r1=608351&r2=608352&view=diff
==============================================================================
--- ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java (original)
+++ ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java Wed Jan  2 22:29:35 2008
@@ -53,9 +53,12 @@
 public class TaxAuthorityServices {
 
     public static final String module = TaxAuthorityServices.class.getName();
-    public static final BigDecimal ZERO_BASE = new BigDecimal("0.000"); 
-    public static final BigDecimal ONE_BASE = new BigDecimal("1.000"); 
+    public static final BigDecimal ZERO_BASE = BigDecimal.ZERO; 
+    public static final BigDecimal ONE_BASE = BigDecimal.ONE; 
     public static final BigDecimal PERCENT_SCALE = new BigDecimal("100.000"); 
+    public static int salestaxFinalDecimals = UtilNumber.getBigDecimalScale("salestax.final.decimals");
+    public static int salestaxCalcDecimals = UtilNumber.getBigDecimalScale("salestax.calc.decimals");
+    public static int salestaxRounding = UtilNumber.getBigDecimalRoundingMode("salestax.rounding");
 
     public static Map rateProductTaxCalcForDisplay(DispatchContext dctx, Map context) {
         GenericDelegator delegator = dctx.getDelegator();
@@ -68,9 +71,6 @@
 
         if (quantity == null) quantity = ONE_BASE;
         BigDecimal amount = basePrice.multiply(quantity);
-        int salestaxFinalDecimals=UtilNumber.getBigDecimalScale("salestax.final.decimals");
-        int salestaxCalcDecimals=UtilNumber.getBigDecimalScale("salestax.calc.decimals");
-        int salestaxRounding=UtilNumber.getBigDecimalRoundingMode("salestax.rounding");
         
         BigDecimal taxTotal = ZERO_BASE;
         BigDecimal taxPercentage = ZERO_BASE;
@@ -182,7 +182,7 @@
             // this is an add and not an addAll because we want a List of Lists of GenericValues, one List of Adjustments per item
             itemAdjustments.add(taxList);
         }
-        if (orderShippingAmount.doubleValue() > 0) {
+        if (orderShippingAmount != null && orderShippingAmount.compareTo(BigDecimal.ZERO) > 0) {
             List taxList = getTaxAdjustments(delegator, null, productStore, payToPartyId, billToPartyId, taxAuthoritySet, ZERO_BASE, ZERO_BASE, orderShippingAmount);
             orderAdjustments.addAll(taxList);
         }
@@ -313,7 +313,7 @@
                     taxable = taxable.add(shippingAmount);
                 }
                 
-                if (taxable.doubleValue() == 0) {
+                if (taxable.compareTo(BigDecimal.ZERO) == 0) {
                     // this should make it less confusing if the taxable flag on the product is not Y/true, and there is no shipping and such
                     continue;
                 }