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 2008/12/01 07:51:15 UTC

svn commit: r721986 [13/13] - in /ofbiz/branches/typecheckcleanup200810: applications/accounting/script/org/ofbiz/accounting/olap/ applications/order/entitydef/ applications/order/script/org/ofbiz/order/order/ applications/order/script/org/ofbiz/order/...

Modified: ofbiz/branches/typecheckcleanup200810/applications/product/widget/catalog/ProductScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/applications/product/widget/catalog/ProductScreens.xml?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/applications/product/widget/catalog/ProductScreens.xml (original)
+++ ofbiz/branches/typecheckcleanup200810/applications/product/widget/catalog/ProductScreens.xml Sun Nov 30 22:51:11 2008
@@ -1154,7 +1154,7 @@
                 <property-to-field field="defaultCurrencyUomId" resource="general" property="currency.uom.id.default" default="USD" />
 
                 <set field="productId" from-field="parameters.productId"/>
-                <set field="minimumOrderQuantity" from-field="parameters.minimumOrderQuantity" type="Double"/>
+                <set field="minimumOrderQuantity" from-field="parameters.minimumOrderQuantity" type="BigDecimal"/>
 
                 <set field="orderBy" from-field="parameters.orderBy" default-value="partyId"/>
                 <entity-one entity-name="Product" value-name="product"/>

Modified: ofbiz/branches/typecheckcleanup200810/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java (original)
+++ ofbiz/branches/typecheckcleanup200810/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java Sun Nov 30 22:51:11 2008
@@ -18,6 +18,7 @@
  */
 package org.ofbiz.base.util;
 
+import java.math.BigDecimal;
 import java.text.DateFormat;
 import java.text.DecimalFormat;
 import java.text.ParseException;
@@ -75,7 +76,7 @@
      * @param maximumFractionDigits The maximum number of fraction digits used; if set to -1 than the default value for the locale is used
      * @return A String with the formatted price
      */
-    public static String formatCurrency(double price, String isoCode, Locale locale, int maximumFractionDigits) {
+    public static String formatCurrency(BigDecimal price, String isoCode, Locale locale, int maximumFractionDigits) {
         //Debug.logInfo("formatting currency: " + price + ", isoCode: " + isoCode + ", locale: " + locale, module);
         com.ibm.icu.text.NumberFormat nf = com.ibm.icu.text.NumberFormat.getCurrencyInstance(locale);
         if (isoCode != null && isoCode.length() > 1) {
@@ -95,31 +96,10 @@
      * @param locale The Locale used to format the number
      * @return A String with the formatted price
      */
-    public static String formatCurrency(double price, String isoCode, Locale locale) {
+    public static String formatCurrency(BigDecimal price, String isoCode, Locale locale) {
         return formatCurrency(price, isoCode, locale, -1);
     }
 
-    /** Formats a double into a properly formatted currency string based on isoCode and Locale
-     * @param price The price Double to be formatted
-     * @param isoCode the currency ISO code
-     * @param locale The Locale used to format the number
-     * @param maximumFractionDigits The maximum number of fraction digits used; if set to -1 than the default value for the locale is used
-     * @return A String with the formatted price
-     */
-    public static String formatCurrency(Double price, String isoCode, Locale locale, int maximumFractionDigits) {
-        return formatCurrency(price.doubleValue(), isoCode, locale, maximumFractionDigits);
-    }
-
-    /** Formats a double into a properly formatted currency string based on isoCode and Locale
-     * @param price The price Double to be formatted
-     * @param isoCode the currency ISO code
-     * @param locale The Locale used to format the number
-     * @return A String with the formatted price
-     */
-    public static String formatCurrency(Double price, String isoCode, Locale locale) {
-        return formatCurrency(price.doubleValue(), isoCode, locale, -1);
-    }
-
     /** Formats a Double into a properly spelled out number string based on Locale
      * @param amount The amount Double to be formatted
      * @param locale The Locale used to format the number

Modified: ofbiz/branches/typecheckcleanup200810/framework/base/src/org/ofbiz/base/util/UtilParse.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/framework/base/src/org/ofbiz/base/util/UtilParse.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/framework/base/src/org/ofbiz/base/util/UtilParse.java (original)
+++ ofbiz/branches/typecheckcleanup200810/framework/base/src/org/ofbiz/base/util/UtilParse.java Sun Nov 30 22:51:11 2008
@@ -18,6 +18,8 @@
  *******************************************************************************/
 package org.ofbiz.base.util;
 
+import java.math.BigDecimal;
+
 /**
  * <p/>
  * <p>
@@ -25,25 +27,24 @@
  * </p>
  * <br/>
  * <br/>
- * Created on Oct 2, 2004 by dustin
  */
 public class UtilParse {
 
     /**
      * return nulls for empty strings, as the entity engine can deal with nulls. This will provide blanks
      * in fields where doubles display. Blank meaning null, vs. 0 which means 0
-     * @param doubleString
+     * @param bigDecimalString
      * @return
      */
-    public static Double parseDoubleForEntity(String doubleString) throws NumberFormatException {
-        if (doubleString == null) {
+    public static BigDecimal parseBigDecimalForEntity(String bigDecimalString) throws NumberFormatException {
+        if (bigDecimalString == null) {
             return null;
         }
-        doubleString = doubleString.trim();
-        doubleString = doubleString.replaceAll(",", "");
-        if (doubleString.length() < 1) {
+        bigDecimalString = bigDecimalString.trim();
+        bigDecimalString = bigDecimalString.replaceAll(",", "");
+        if (bigDecimalString.length() < 1) {
             return null;
         }
-        return Double.valueOf(doubleString);
+        return new BigDecimal(bigDecimalString);
     }
 }

Modified: ofbiz/branches/typecheckcleanup200810/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java (original)
+++ ofbiz/branches/typecheckcleanup200810/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java Sun Nov 30 22:51:11 2008
@@ -19,6 +19,7 @@
 package org.ofbiz.base.util.string;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
@@ -317,7 +318,7 @@
             Object obj = fma.get(context, locale);
             if (obj != null) {
                 String currencyCode = this.codeExpr.expandString(context, timeZone, locale);
-                buffer.append(UtilFormatOut.formatCurrency(Double.valueOf(obj.toString()), currencyCode, locale));
+                buffer.append(UtilFormatOut.formatCurrency(new BigDecimal(obj.toString()), currencyCode, locale));
             }
         }
     }

Modified: ofbiz/branches/typecheckcleanup200810/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java (original)
+++ ofbiz/branches/typecheckcleanup200810/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java Sun Nov 30 22:51:11 2008
@@ -220,7 +220,7 @@
     }
     
     public void checkRhsType(ModelEntity modelEntity, GenericDelegator delegator) {
-        if (this.rhs == null || modelEntity == null) return;
+        if (this.rhs == null || this.rhs == GenericEntity.NULL_FIELD || modelEntity == null) return;
 
         Object value = this.rhs;
         if (this.rhs instanceof EntityFunction) {

Modified: ofbiz/branches/typecheckcleanup200810/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java (original)
+++ ofbiz/branches/typecheckcleanup200810/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java Sun Nov 30 22:51:11 2008
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.io.Writer;
+import java.math.BigDecimal;
 import java.util.Locale;
 import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
@@ -63,7 +64,7 @@
         return result;
     }
 
-    private static Double getAmount(Map args, String key) {
+    private static BigDecimal getAmount(Map args, String key) {
         if (args.containsKey(key)) {
             Object o = args.get(key);
 
@@ -73,21 +74,13 @@
             }
             if (Debug.verboseOn()) Debug.logVerbose("Amount Object : " + o.getClass().getName(), module);
 
-            if (o instanceof NumberModel) {
-                NumberModel s = (NumberModel) o;
-                return s.getAsNumber().doubleValue();
-            }
-            if (o instanceof SimpleNumber) {
-                SimpleNumber s = (SimpleNumber) o;
-                return s.getAsNumber().doubleValue();
-            }
             if (o instanceof SimpleScalar) {
                 SimpleScalar s = (SimpleScalar) o;
-                return Double.valueOf( s.getAsString() );
+                return new BigDecimal(s.getAsString());
             }
-            return Double.valueOf( o.toString() );
+            return new BigDecimal(o.toString());
         }
-        return 0.00;
+        return BigDecimal.ZERO;
     }
 
     private static Integer getInteger(Map args, String key) {
@@ -120,7 +113,7 @@
     public Writer getWriter(final Writer out, Map args) {
         final StringBuilder buf = new StringBuilder();
 
-        final Double amount = OfbizCurrencyTransform.getAmount(args, "amount");
+        final BigDecimal amount = OfbizCurrencyTransform.getAmount(args, "amount");
         final String isoCode = OfbizCurrencyTransform.getArg(args, "isoCode");
         final String locale = OfbizCurrencyTransform.getArg(args, "locale");
 
@@ -154,7 +147,7 @@
                             out.write(UtilFormatOut.formatCurrency(amount, isoCode, env.getLocale(), rounding)); // we set the max to 10 digits as an hack to not round numbers in the ui
                         }
                     } else {
-                        out.write(UtilFormatOut.formatCurrency(amount.doubleValue(), isoCode, new Locale(locale), rounding)); // we set the max to 10 digits as an hack to not round numbers in the ui
+                        out.write(UtilFormatOut.formatCurrency(amount, isoCode, new Locale(locale), rounding)); // we set the max to 10 digits as an hack to not round numbers in the ui
                     }
                 } catch (TemplateModelException e) {
                     throw new IOException(e.getMessage());

Modified: ofbiz/branches/typecheckcleanup200810/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
+++ ofbiz/branches/typecheckcleanup200810/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Sun Nov 30 22:51:11 2008
@@ -2145,9 +2145,9 @@
                     isoCode = this.currency.expandString(context);
                 }
                 try {
-                    Double parsedRetVal = (Double) ObjectType.simpleTypeConvert(retVal, "Double", null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true);
+                	BigDecimal parsedRetVal = new BigDecimal(retVal);
                     retVal = UtilFormatOut.formatCurrency(parsedRetVal, isoCode, locale, 10); // we set the max to 10 digits as an hack to not round numbers in the ui
-                } catch (GeneralException e) {
+                } catch (NumberFormatException e) {
                     String errMsg = "Error formatting currency value [" + retVal + "]: " + e.toString();
                     Debug.logError(e, errMsg, module);
                     throw new IllegalArgumentException(errMsg);

Modified: ofbiz/branches/typecheckcleanup200810/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java (original)
+++ ofbiz/branches/typecheckcleanup200810/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java Sun Nov 30 22:51:11 2008
@@ -23,6 +23,7 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
+import java.math.BigDecimal;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.sql.Timestamp;
@@ -740,10 +741,10 @@
             }
             
             String amountStr = (String) parameters.get("amountPaid");
-            Double amountPaid = new Double(0);
+            BigDecimal amountPaid = BigDecimal.ZERO;
             
             if (UtilValidate.isNotEmpty(amountStr)) {
-                amountPaid = new Double(amountStr);
+                amountPaid = new BigDecimal(amountStr);
             } 
             
             // add the payment EXT_BAY for the paid amount
@@ -775,8 +776,8 @@
                 return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.paymentIsStillNotReceived", locale));
             } 
             
-            Double unitPrice = new Double((String) parameters.get("transactionPrice"));
-            double quantity = new Double((String) parameters.get("quantityPurchased")).doubleValue();
+            BigDecimal unitPrice = new BigDecimal((String) parameters.get("transactionPrice"));
+            BigDecimal quantity = new BigDecimal((String) parameters.get("quantityPurchased"));
             cart.addItemToEnd(productId, null, quantity, unitPrice, null, null, null, "PRODUCT_ORDER_ITEM", dispatcher, Boolean.FALSE, Boolean.FALSE);
            
             // set partyId from

Modified: ofbiz/branches/typecheckcleanup200810/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy (original)
+++ ofbiz/branches/typecheckcleanup200810/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy Sun Nov 30 22:51:11 2008
@@ -46,11 +46,11 @@
                                                asOfDate : invoiceDate]);
     
     if (result.convertedValue != null) {
-        context.total = (org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotalBd(delegator,invoiceId)).multiply(new BigDecimal(result.convertedValue.toString())).setScale(decimals, rounding); 
+        context.total = (org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)).multiply(new BigDecimal(result.convertedValue.toString())).setScale(decimals, rounding); 
         context.amountToApply = org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId).multiply(new BigDecimal(result.convertedValue.toString())).setScale(decimals, rounding);
         context.currencyUomId = otherCurrency;
     }
   } else {
-      context.total = (org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotalBd(delegator,invoiceId)); 
+      context.total = (org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)); 
       context.amountToApply = org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId);
   }

Modified: ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java (original)
+++ ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Sun Nov 30 22:51:11 2008
@@ -20,6 +20,7 @@
 
 import java.io.PrintWriter;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -207,26 +208,26 @@
         return this.orderId;
     }
 
-    public double getTaxTotal() {
+    public BigDecimal getTaxTotal() {
         return cart.getTotalSalesTax();
     }
 
-    public double getGrandTotal() {
-        return UtilFormatOut.formatPriceNumber(cart.getGrandTotal()).doubleValue();
+    public BigDecimal getGrandTotal() {
+        return cart.getGrandTotal();
     }
 
     public int getNumberOfPayments() {
         return cart.selectedPayments();
     }
 
-    public double getPaymentTotal() {
-        return UtilFormatOut.formatPriceNumber(cart.getPaymentTotal()).doubleValue();
+    public BigDecimal getPaymentTotal() {
+        return cart.getPaymentTotal();
     }
 
-    public double getTotalDue() {
-        double grandTotal = this.getGrandTotal();
-        double paymentAmt = this.getPaymentTotal();
-        return (grandTotal - paymentAmt);
+    public BigDecimal getTotalDue() {
+    	BigDecimal grandTotal = this.getGrandTotal();
+    	BigDecimal paymentAmt = this.getPaymentTotal();
+        return grandTotal.subtract(paymentAmt);
     }
 
     public int size() {
@@ -238,24 +239,24 @@
         Map itemInfo = new HashMap();
         itemInfo.put("productId", item.getProductId());
         itemInfo.put("description", item.getDescription());
-        itemInfo.put("quantity", UtilFormatOut.formatQuantity(item.getQuantity()));
-        itemInfo.put("subtotal", UtilFormatOut.formatPrice(item.getItemSubTotal()));
+        itemInfo.put("quantity", UtilFormatOut.formatQuantity(item.getQuantity().doubleValue()));
+        itemInfo.put("subtotal", UtilFormatOut.formatPrice(item.getItemSubTotal().doubleValue()));
         itemInfo.put("isTaxable", item.taxApplies() ? "T" : " ");
         
         itemInfo.put("discount", "");
         itemInfo.put("adjustments", "");
-        if (item.getOtherAdjustments() != 0) {
+        if (item.getOtherAdjustments().compareTo(BigDecimal.ZERO) != 0) {
             itemInfo.put("itemDiscount", UtilFormatOut.padString(
                     UtilProperties.getMessage(PosTransaction.resource,"(ItemDiscount)",defaultLocale), Receipt.pridLength[0] + 1, true, ' '));                    
-            itemInfo.put("adjustments", UtilFormatOut.formatPrice(item.getOtherAdjustments()));
+            itemInfo.put("adjustments", UtilFormatOut.formatPrice(item.getOtherAdjustments().doubleValue()));
         }
         
         if (isAggregatedItem(item.getProductId())){
             ProductConfigWrapper pcw = null;
             pcw = item.getConfigWrapper();
-            itemInfo.put("basePrice", UtilFormatOut.formatPrice(pcw.getDefaultPrice()));
+            itemInfo.put("basePrice", UtilFormatOut.formatPrice(pcw.getDefaultPrice().doubleValue()));
         } else {
-            itemInfo.put("basePrice", UtilFormatOut.formatPrice(item.getBasePrice()));
+            itemInfo.put("basePrice", UtilFormatOut.formatPrice(item.getBasePrice().doubleValue()));
         }
         return itemInfo;
     }
@@ -278,8 +279,8 @@
                     itemInfo.put("productId", "");
                     itemInfo.put("sku", "");
                     itemInfo.put("configDescription", configoption.getDescription());
-                    itemInfo.put("configQuantity", UtilFormatOut.formatQuantity(item.getQuantity()));
-                    itemInfo.put("configBasePrice", UtilFormatOut.formatPrice(configoption.getOffsetPrice()));
+                    itemInfo.put("configQuantity", UtilFormatOut.formatQuantity(item.getQuantity().doubleValue()));
+                    itemInfo.put("configBasePrice", UtilFormatOut.formatPrice(configoption.getOffsetPrice().doubleValue()));
                     //itemInfo.put("isTaxable", item.taxApplies() ? "T" : " ");
                     list.add(itemInfo);
                 }
@@ -341,7 +342,7 @@
         if ("PaymentMethodType".equals(infValue.getEntityName())) {
             payInfo.put("description", infValue.getString("description"));
             payInfo.put("payInfo", infValue.getString("description"));
-            payInfo.put("amount", UtilFormatOut.formatPrice(inf.amount));
+            payInfo.put("amount", UtilFormatOut.formatPrice(inf.amount.doubleValue()));
         } else {
             String paymentMethodTypeId = infValue.getString("paymentMethodTypeId");
             GenericValue pmt = null;
@@ -352,7 +353,7 @@
             }
             if (pmt != null) {
                 payInfo.put("description", pmt.getString("description"));
-                payInfo.put("amount", UtilFormatOut.formatPrice(inf.amount));
+                payInfo.put("amount", UtilFormatOut.formatPrice(inf.amount.doubleValue()));
             }
 
             if ("CREDIT_CARD".equals(paymentMethodTypeId)) {
@@ -388,14 +389,14 @@
         return payInfo;
     }
 
-    public double getItemQuantity(String productId) {
+    public BigDecimal getItemQuantity(String productId) {
         trace("request item quantity", productId);
-        ShoppingCartItem item = cart.findCartItem(productId, null, null, null, 0.00);
+        ShoppingCartItem item = cart.findCartItem(productId, null, null, null, BigDecimal.ZERO);
         if (item != null) {
             return item.getQuantity();
         } else {
             trace("item not found", productId);
-            return 0;
+            return BigDecimal.ZERO;
         }
     }
 
@@ -458,7 +459,7 @@
         return pcw;
     }
     
-    public void addItem(String productId, double quantity) throws CartItemModifyException, ItemNotFoundException {
+    public void addItem(String productId, BigDecimal quantity) throws CartItemModifyException, ItemNotFoundException {
         trace("add item", productId + "/" + quantity);
         try {
             GenericDelegator delegator = cart.getDelegator();
@@ -491,7 +492,7 @@
         throws ItemNotFoundException, CartItemModifyException {
         trace("add item with ProductConfigWrapper", productId );
         try {
-            cart.addOrIncreaseItem(productId, null, 1, null, null, null, null, null, null, null, null, pcw, null, null, null, session.getDispatcher());
+            cart.addOrIncreaseItem(productId, null, BigDecimal.ONE, null, null, null, null, null, null, null, null, pcw, null, null, null, session.getDispatcher());
         } catch (ItemNotFoundException e) {
             trace("item not found", e);
             throw e;
@@ -510,7 +511,7 @@
         try {   
             int cartIndexInt = Integer.parseInt(cartIndex);
             ShoppingCartItem cartItem = cart.findCartItem(cartIndexInt);
-            double quantity = cartItem.getQuantity();
+            BigDecimal quantity = cartItem.getQuantity();
             cart.removeCartItem(cartIndexInt, session.getDispatcher());
             cart.addOrIncreaseItem(productId, null, quantity, null, null, null, null, null, null, null, null, pcw, null, null, null, session.getDispatcher());
         } catch (CartItemModifyException e) {
@@ -527,9 +528,9 @@
         return;
     }
     
-    public void modifyQty(String productId, double quantity) throws CartItemModifyException {
+    public void modifyQty(String productId, BigDecimal quantity) throws CartItemModifyException {
         trace("modify item quantity", productId + "/" + quantity);
-        ShoppingCartItem item = cart.findCartItem(productId, null, null, null, 0.00);
+        ShoppingCartItem item = cart.findCartItem(productId, null, null, null, BigDecimal.ZERO);
         if (item != null) {
             try {
                 item.setQuantity(quantity, session.getDispatcher(), cart, true);
@@ -543,9 +544,9 @@
         }
     }
 
-    public void modifyPrice(String productId, double price) {
+    public void modifyPrice(String productId, BigDecimal price) {
         trace("modify item price", productId + "/" + price);
-        ShoppingCartItem item = cart.findCartItem(productId, null, null, null, 0.00);
+        ShoppingCartItem item = cart.findCartItem(productId, null, null, null, BigDecimal.ZERO);
         if (item != null) {
             item.setBasePrice(price);
         } else {
@@ -564,7 +565,7 @@
 
         if (productId != null) {
             trace("add item adjustment");
-            ShoppingCartItem item = cart.findCartItem(productId, null, null, null, 0.00);
+            ShoppingCartItem item = cart.findCartItem(productId, null, null, null, BigDecimal.ZERO);
             Integer itemAdj = (Integer) skuDiscounts.get(productId);
             if (itemAdj != null) {
                 item.removeAdjustment(itemAdj.intValue());
@@ -589,7 +590,7 @@
             Iterator i = skuDiscounts.keySet().iterator();
             while (i.hasNext()) {
                 String productId = (String) i.next();
-                ShoppingCartItem item = cart.findCartItem(productId, null, null, null, 0.00);
+                ShoppingCartItem item = cart.findCartItem(productId, null, null, null, BigDecimal.ZERO);
                 Integer itemAdj = (Integer) skuDiscounts.remove(productId);
                 if (itemAdj != null) {
                     item.removeAdjustment(itemAdj.intValue());
@@ -598,13 +599,13 @@
         }
     }
 
-    public double GetTotalDiscount() {
+    public BigDecimal GetTotalDiscount() {
         return cart.getOrderOtherAdjustmentTotal();
     }
     
     public void voidItem(String productId) throws CartItemModifyException {
         trace("void item", productId);
-        ShoppingCartItem item = cart.findCartItem(productId, null, null, null, 0.00);
+        ShoppingCartItem item = cart.findCartItem(productId, null, null, null, BigDecimal.ZERO);
         if (item != null) {
             try {
                 int itemIdx = cart.getItemIndex(item);
@@ -702,17 +703,17 @@
         }
     }
 
-    public double addPayment(String id, double amount) {
+    public BigDecimal addPayment(String id, BigDecimal amount) {
         return this.addPayment(id, amount, null, null);
     }
 
-    public double addPayment(String id, double amount, String refNum, String authCode) {
+    public BigDecimal addPayment(String id, BigDecimal amount, String refNum, String authCode) {
         trace("added payment", id + "/" + amount);
         if ("CASH".equals(id)) {
             // clear cash payments first; so there is only one
             cart.clearPayment(id);
         }
-        cart.addPaymentAmount(id, new Double(amount), refNum, authCode, true, true, false);
+        cart.addPaymentAmount(id, amount, refNum, authCode, true, true, false);
         return this.getTotalDue();
     }
 
@@ -782,11 +783,11 @@
         currentTx = null;
     }
 
-    public double processSale(Output output) throws GeneralException {
+    public BigDecimal processSale(Output output) throws GeneralException {
         trace("process sale");
-        double grandTotal = this.getGrandTotal();
-        double paymentAmt = this.getPaymentTotal();
-        if (grandTotal > paymentAmt) {
+        BigDecimal grandTotal = this.getGrandTotal();
+        BigDecimal paymentAmt = this.getPaymentTotal();
+        if (grandTotal.compareTo(paymentAmt) > 0) {
             throw new IllegalStateException();
         }
 
@@ -826,10 +827,10 @@
         }
 
         // get the change due
-        double change = (grandTotal - paymentAmt);
+        BigDecimal change = grandTotal.subtract(paymentAmt);
 
         // notify the change due
-        output.print(UtilProperties.getMessage(PosTransaction.resource,"CHANGE",defaultLocale) + " " + UtilFormatOut.formatPrice(this.getTotalDue() * -1));
+        output.print(UtilProperties.getMessage(PosTransaction.resource,"CHANGE",defaultLocale) + " " + UtilFormatOut.formatPrice(this.getTotalDue().negate().doubleValue()));
 
         // threaded drawer/receipt printing
         final PosTransaction currentTrans = this;
@@ -896,16 +897,16 @@
             Iterator i = cart.iterator();
             while (i.hasNext()) {
                 ShoppingCartItem item = (ShoppingCartItem) i.next();
-                double quantity = item.getQuantity();
-                double unitPrice = item.getBasePrice();
-                double subTotal = unitPrice * quantity;
-                double adjustment = item.getOtherAdjustments();
+                BigDecimal quantity = item.getQuantity();
+                BigDecimal unitPrice = item.getBasePrice();
+                BigDecimal subTotal = unitPrice.multiply(quantity);
+                BigDecimal adjustment = item.getOtherAdjustments();
 
                 XModel line = Journal.appendNode(model, "tr", ""+cart.getItemIndex(item), "");
                 Journal.appendNode(line, "td", "sku", item.getProductId());
                 Journal.appendNode(line, "td", "desc", item.getName());
-                Journal.appendNode(line, "td", "qty", UtilFormatOut.formatQuantity(quantity));
-                Journal.appendNode(line, "td", "price", UtilFormatOut.formatPrice(subTotal));
+                Journal.appendNode(line, "td", "qty", UtilFormatOut.formatQuantity(quantity.doubleValue()));
+                Journal.appendNode(line, "td", "price", UtilFormatOut.formatPrice(subTotal.doubleValue()));
                 Journal.appendNode(line, "td", "index", Integer.toString(cart.getItemIndex(item)));
 
                 if (this.isAggregatedItem(item.getProductId())){
@@ -923,19 +924,19 @@
                             Journal.appendNode(option, "td", "sku", "");
                             Journal.appendNode(option, "td", "desc", configoption.getDescription());
                             Journal.appendNode(option, "td", "qty", "");
-                            Journal.appendNode(option, "td", "price", UtilFormatOut.formatPrice(configoption.getPrice()));
+                            Journal.appendNode(option, "td", "price", UtilFormatOut.formatPrice(configoption.getPrice().doubleValue()));
                             Journal.appendNode(option, "td", "index", Integer.toString(cart.getItemIndex(item)));
                         }
                     }
                 }
                   
-                if (adjustment != 0) {
+                if (adjustment.compareTo(BigDecimal.ZERO) != 0) {
                     // append the promo info
                     XModel promo = Journal.appendNode(model, "tr", "itemadjustment", "");
                     Journal.appendNode(promo, "td", "sku", "");
                     Journal.appendNode(promo, "td", "desc", UtilProperties.getMessage(PosTransaction.resource,"(ItemDiscount)",defaultLocale));
                     Journal.appendNode(promo, "td", "qty", "");
-                    Journal.appendNode(promo, "td", "price", UtilFormatOut.formatPrice(adjustment));
+                    Journal.appendNode(promo, "td", "price", UtilFormatOut.formatPrice(adjustment.doubleValue()));
                 }
             }
         }
@@ -943,17 +944,17 @@
 
     public void appendTotalDataModel(XModel model) {
         if (cart != null) {
-            double taxAmount = cart.getTotalSalesTax();
-            double total = cart.getGrandTotal();
+        	BigDecimal taxAmount = cart.getTotalSalesTax();
+        	BigDecimal total = cart.getGrandTotal();
             List adjustments = cart.getAdjustments();            
-            Double itemsAdjustmentsAmount = 0.0; 
+            BigDecimal itemsAdjustmentsAmount = BigDecimal.ZERO; 
 
             Iterator i = cart.iterator();
             while (i.hasNext()) {
                 ShoppingCartItem item = (ShoppingCartItem) i.next();
-                double adjustment = item.getOtherAdjustments();
-                if (adjustment != 0) {
-                    itemsAdjustmentsAmount =+ adjustment;
+                BigDecimal adjustment = item.getOtherAdjustments();
+                if (adjustment.compareTo(BigDecimal.ZERO) != 0) {
+                    itemsAdjustmentsAmount = itemsAdjustmentsAmount.add(adjustment);
                 }
             }
             
@@ -967,20 +968,20 @@
                 iter = adjustments.iterator();
                 while(iter.hasNext()){
                     GenericValue orderAdjustment = (GenericValue) iter.next();
-                    Double amount = orderAdjustment.getDouble("amount");
-                    Double sourcePercentage = orderAdjustment.getDouble("sourcePercentage");
+                    BigDecimal amount = orderAdjustment.getBigDecimal("amount");
+                    BigDecimal sourcePercentage = orderAdjustment.getBigDecimal("sourcePercentage");
                     XModel adjustmentLine = Journal.appendNode(model, "tr", "adjustment", "");
                     Journal.appendNode(adjustmentLine, "td", "sku", "");
                     Journal.appendNode(adjustmentLine, "td", "desc", 
                             UtilProperties.getMessage(PosTransaction.resource, "(SalesDiscount)",defaultLocale));
                     if (UtilValidate.isNotEmpty(amount)) {
                         Journal.appendNode(adjustmentLine, "td", "qty", "");
-                        Journal.appendNode(adjustmentLine, "td", "price", UtilFormatOut.formatPrice(amount));
+                        Journal.appendNode(adjustmentLine, "td", "price", UtilFormatOut.formatPrice(amount.doubleValue()));
                     } else if (UtilValidate.isNotEmpty(sourcePercentage)) {
-                        double percentage = - sourcePercentage.doubleValue()/100; // sourcePercentage is negative and must be show as a positive value (it's a discount not an amount)
-                        Journal.appendNode(adjustmentLine, "td", "qty", UtilFormatOut.formatPercentage(percentage)); 
-                        amount = new Double((cart.getItemTotal() + itemsAdjustmentsAmount) * percentage); // itemsAdjustmentsAmount is negative
-                        Journal.appendNode(adjustmentLine, "td", "price", UtilFormatOut.formatPrice(- amount)); // amount must be shown as a negative value
+                    	BigDecimal percentage = sourcePercentage.movePointLeft(2).negate(); // sourcePercentage is negative and must be show as a positive value (it's a discount not an amount)
+                        Journal.appendNode(adjustmentLine, "td", "qty", UtilFormatOut.formatPercentage(percentage.doubleValue())); 
+                        amount = cart.getItemTotal().add(itemsAdjustmentsAmount).multiply(percentage); // itemsAdjustmentsAmount is negative
+                        Journal.appendNode(adjustmentLine, "td", "price", UtilFormatOut.formatPrice(amount.negate().doubleValue())); // amount must be shown as a negative value
                     }                        
                     Journal.appendNode(adjustmentLine, "td", "index", "-1");
                 }    
@@ -991,14 +992,14 @@
 
             Journal.appendNode(taxLine, "td", "desc", UtilProperties.getMessage(PosTransaction.resource,"Sales_Tax",defaultLocale));
             Journal.appendNode(taxLine, "td", "qty", "");
-            Journal.appendNode(taxLine, "td", "price", UtilFormatOut.formatPrice(taxAmount));
+            Journal.appendNode(taxLine, "td", "price", UtilFormatOut.formatPrice(taxAmount.doubleValue()));
             Journal.appendNode(taxLine, "td", "index", "-1");
             
             XModel totalLine = Journal.appendNode(model, "tr", "total", "");
             Journal.appendNode(totalLine, "td", "sku", "");
             Journal.appendNode(totalLine, "td", "desc", UtilProperties.getMessage(PosTransaction.resource,"Grand_Total",defaultLocale));
             Journal.appendNode(totalLine, "td", "qty", "");
-            Journal.appendNode(totalLine, "td", "price", UtilFormatOut.formatPrice(total));
+            Journal.appendNode(totalLine, "td", "price", UtilFormatOut.formatPrice(total.doubleValue()));
             Journal.appendNode(totalLine, "td", "index", "-1");
         }
     }
@@ -1025,18 +1026,18 @@
 
                 Object desc = paymentMethodType != null ? paymentMethodType.get("description",defaultLocale) : "??";
                 String descString = desc.toString();
-                double amount = 0;
+                BigDecimal amount = BigDecimal.ZERO;
                 if (inf.amount == null) {
-                    amount = cart.getGrandTotal() - cart.getPaymentTotal();
+                    amount = cart.getGrandTotal().subtract(cart.getPaymentTotal());
                 } else {
-                    amount = inf.amount.doubleValue();
+                    amount = inf.amount;
                 }
 
                 XModel paymentLine = Journal.appendNode(model, "tr", Integer.toString(i), "");
                 Journal.appendNode(paymentLine, "td", "sku", "");
                 Journal.appendNode(paymentLine, "td", "desc", descString);
                 Journal.appendNode(paymentLine, "td", "qty", "-");
-                Journal.appendNode(paymentLine, "td", "price", UtilFormatOut.formatPrice(-1 * amount));
+                Journal.appendNode(paymentLine, "td", "price", UtilFormatOut.formatPrice(amount.negate().doubleValue()));
                 Journal.appendNode(paymentLine, "td", "index", Integer.toString(i));
             }
         }
@@ -1044,13 +1045,13 @@
 
     public void appendChangeDataModel(XModel model) {
         if (cart != null) {
-            double changeDue = (-1 * this.getTotalDue());
-            if (changeDue >= 0) {
+        	BigDecimal changeDue = this.getTotalDue().negate();
+            if (changeDue.compareTo(BigDecimal.ZERO) >= 0) {
                 XModel changeLine = Journal.appendNode(model, "tr", "", "");
                 Journal.appendNode(changeLine, "td", "sku", "");
                 Journal.appendNode(changeLine, "td", "desc", "Change");
                 Journal.appendNode(changeLine, "td", "qty", "-");
-                Journal.appendNode(changeLine, "td", "price", UtilFormatOut.formatPrice(changeDue));
+                Journal.appendNode(changeLine, "td", "price", UtilFormatOut.formatPrice(changeDue.doubleValue()));
             }
         }
     }

Modified: ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/component/Operator.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/component/Operator.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/component/Operator.java (original)
+++ ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/component/Operator.java Sun Nov 30 22:51:11 2008
@@ -103,7 +103,7 @@
         if (OPER_TOTAL[0].equals(fieldName)) {
             String total = "0.00";
             if (trans != null) {
-                total = UtilFormatOut.formatPrice(trans.getTotalDue());
+                total = UtilFormatOut.formatPrice(trans.getTotalDue().doubleValue());
             }
             field.setText(total);
         } else if (OPER_DATE[0].equals(fieldName)) {

Modified: ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java (original)
+++ ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java Sun Nov 30 22:51:11 2008
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.math.BigDecimal;
 import java.net.URL;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -466,13 +467,13 @@
         expandMap.put("orderId", trans.getOrderId());
         expandMap.put("dateStamp", dateString);
         expandMap.put("drawerNo", Integer.toString(trans.getDrawerNumber()));
-        expandMap.put("taxTotal", UtilFormatOut.padString(UtilFormatOut.formatPrice(trans.getTaxTotal()), priceLength[type], false, ' '));
-        expandMap.put("grandTotal", UtilFormatOut.padString(UtilFormatOut.formatPrice(trans.getGrandTotal()), priceLength[type], false, ' '));
-        expandMap.put("totalPayments", UtilFormatOut.padString(UtilFormatOut.formatPrice(trans.getPaymentTotal()), priceLength[type], false, ' '));
-        expandMap.put("change", UtilFormatOut.padString((trans.getTotalDue() < 0 ?
-                UtilFormatOut.formatPrice(trans.getTotalDue() * -1) : "0.00"), priceLength[type], false, ' '));
-        expandMap.put("saleDiscount", UtilFormatOut.padString((trans.GetTotalDiscount() != 0 ?
-                UtilFormatOut.formatPrice(trans.GetTotalDiscount()) : "0.00"), priceLength[type], false, ' '));
+        expandMap.put("taxTotal", UtilFormatOut.padString(UtilFormatOut.formatPrice(trans.getTaxTotal().doubleValue()), priceLength[type], false, ' '));
+        expandMap.put("grandTotal", UtilFormatOut.padString(UtilFormatOut.formatPrice(trans.getGrandTotal().doubleValue()), priceLength[type], false, ' '));
+        expandMap.put("totalPayments", UtilFormatOut.padString(UtilFormatOut.formatPrice(trans.getPaymentTotal().doubleValue()), priceLength[type], false, ' '));
+        expandMap.put("change", UtilFormatOut.padString((trans.getTotalDue().compareTo(BigDecimal.ZERO) < 0 ?
+                UtilFormatOut.formatPrice(trans.getTotalDue().negate().doubleValue()) : "0.00"), priceLength[type], false, ' '));
+        expandMap.put("saleDiscount", UtilFormatOut.padString((trans.GetTotalDiscount().compareTo(BigDecimal.ZERO) != 0 ?
+                UtilFormatOut.formatPrice(trans.GetTotalDiscount().doubleValue()) : "0.00"), priceLength[type], false, ' '));
 
         return expandMap;
     }

Modified: ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java (original)
+++ ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java Sun Nov 30 22:51:11 2008
@@ -18,6 +18,7 @@
  */
 package org.ofbiz.pos.event;
 
+import java.math.BigDecimal;
 import java.sql.Timestamp;
 import java.text.DecimalFormat;
 import java.text.ParseException;
@@ -79,16 +80,16 @@
         Input input = pos.getInput();
         String value = input.value();
         if (UtilValidate.isNotEmpty(value)) {
-            double price = 0.00;
+        	BigDecimal price = BigDecimal.ZERO;
             boolean parsed = false;
             try {
-                price = Double.parseDouble(value);
+                price = new BigDecimal(value);
                 parsed = true;
             } catch (NumberFormatException e) {
             }
 
             if (parsed) {
-                price = price / 100;
+                price = price.movePointLeft(2);
                 trans.modifyPrice(sku, price);
 
                 // re-calc tax

Modified: ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/event/MenuEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/event/MenuEvents.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/event/MenuEvents.java (original)
+++ ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/event/MenuEvents.java Sun Nov 30 22:51:11 2008
@@ -18,6 +18,7 @@
  *******************************************************************************/
 package org.ofbiz.pos.event;
 
+import java.math.BigDecimal;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.ListIterator;
@@ -149,12 +150,12 @@
         } else {
 
             // check for quantity
-            double quantity = 1;
+        	BigDecimal quantity = BigDecimal.ONE;
             if (func != null && "QTY".equals(func[0])) {
                 try {
-                    quantity = Double.parseDouble(func[1]);
+                    quantity = new BigDecimal(func[1]);
                 } catch (NumberFormatException e) {
-                    quantity = 1;
+                    quantity = BigDecimal.ONE;
                 }
             }
 
@@ -250,19 +251,19 @@
         String value = input.value();
 
         boolean increment = true;
-        double quantity = 1;
+        BigDecimal quantity = BigDecimal.ONE;
         if (UtilValidate.isNotEmpty(value)) {
             try {
-                quantity = Double.parseDouble(value);
+                quantity = new BigDecimal(value);
             } catch (NumberFormatException e) {
-                quantity = 1;
+                quantity = BigDecimal.ONE;
             }
         } else {
             String[] func = input.getLastFunction();
             if (func != null && "QTY".equals(func[0])) {
                 increment = false;
                 try {
-                    quantity = Double.parseDouble(func[1]);
+                    quantity = new BigDecimal(func[1]);
                 } catch (NumberFormatException e) {
                     quantity = trans.getItemQuantity(sku);
                 }
@@ -270,7 +271,7 @@
         }
 
         // adjust the quantity
-        quantity = (increment ? trans.getItemQuantity(sku) + quantity : quantity);
+        quantity = (increment ? trans.getItemQuantity(sku).add(quantity) : quantity);
 
         try {
             trans.modifyQty(sku, quantity);

Modified: ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/event/PaymentEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/event/PaymentEvents.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/event/PaymentEvents.java (original)
+++ ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/event/PaymentEvents.java Sun Nov 30 22:51:11 2008
@@ -27,6 +27,7 @@
 import org.ofbiz.pos.screen.PosScreen;
 import org.ofbiz.base.util.UtilProperties;
 
+import java.math.BigDecimal;
 import java.util.Locale;
 
 public class PaymentEvents {
@@ -40,7 +41,7 @@
 
         // all cash transactions are NO_PAYMENT; no need to check
         try {
-            double amount = processAmount(trans, pos, null);
+        	BigDecimal amount = processAmount(trans, pos, null);
             Debug.log("Processing [Cash] Amount : " + amount, module);
 
             // add the payment
@@ -212,7 +213,7 @@
                     case 3:
                         firstName = msrInfoArr[2];
                     case 2: // card number & exp date found
-                        double amount = 0;
+                    	BigDecimal amount = BigDecimal.ZERO;
                         try {
                             String[] totalInfo = input.getFunction("TOTAL");
                             amount = processAmount(trans, pos, totalInfo[1]);
@@ -259,7 +260,7 @@
         PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession());
 
         try {
-            double amount = processAmount(trans, pos, null);
+        	BigDecimal amount = processAmount(trans, pos, null);
             Debug.log("Processing [" + paymentMethodTypeId + "] Amount : " + amount, module);
 
             // add the payment
@@ -282,7 +283,7 @@
         input.clearInput();
 
         try {
-            double amount = processAmount(trans, pos, amountStr);
+        	BigDecimal amount = processAmount(trans, pos, amountStr);
             Debug.log("Processing [" + paymentMethodTypeId + "] Amount : " + amount, module);
 
             // add the payment
@@ -356,7 +357,7 @@
         if (trans.isEmpty()) {
             PosScreen newPos = pos.showPage("pospanel");
             newPos.showDialog("dialog/error/noitems");
-        } else if (trans.getTotalDue() > 0) {
+        } else if (trans.getTotalDue().compareTo(BigDecimal.ZERO) > 0) {
             pos.showDialog("dialog/error/notenoughfunds");
         } else {
             // manual locks (not secured; will be unlocked on clear)
@@ -379,27 +380,27 @@
         }
     }
 
-    private static synchronized double processAmount(PosTransaction trans, PosScreen pos, String amountStr) throws GeneralException {
+    private static synchronized BigDecimal processAmount(PosTransaction trans, PosScreen pos, String amountStr) throws GeneralException {
         Input input = pos.getInput();
 
         if (input.isFunctionSet("TOTAL")) {
             String amtStr = amountStr != null ? amountStr : input.value();
-            double amount;
+            BigDecimal amount;
             if (UtilValidate.isNotEmpty(amtStr)) {
                 try {
-                    amount = Double.parseDouble(amtStr);
+                    amount = new BigDecimal(amtStr);
                 } catch (NumberFormatException e) {
                     Debug.logError("Invalid number for amount : " + amtStr, module);
                     pos.getOutput().print("Invalid Amount!");
                     input.clearInput();
                     throw new GeneralException();
                 }
-                amount = amount / 100; // convert to decimal
+                amount = amount.movePointLeft(2); // convert to decimal
                 Debug.log("Set amount / 100 : " + amount, module);
             } else {
                 Debug.log("Amount is empty; assumption is full amount : " + trans.getTotalDue(), module);
                 amount = trans.getTotalDue();
-                if (amount <= 0) {
+                if (amount.compareTo(BigDecimal.ZERO) <= 0) {
                     throw new GeneralException();
                 }
             }

Modified: ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/screen/PosScreen.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/screen/PosScreen.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/screen/PosScreen.java (original)
+++ ofbiz/branches/typecheckcleanup200810/specialpurpose/pos/src/org/ofbiz/pos/screen/PosScreen.java Sun Nov 30 22:51:11 2008
@@ -25,6 +25,7 @@
 import java.awt.event.FocusEvent;
 import java.awt.event.FocusListener;
 
+import java.math.BigDecimal;
 import java.util.*;
 
 import net.xoetrope.xui.XPage;
@@ -216,10 +217,10 @@
             if (updateOutput) {
                 if (input.isFunctionSet("PAID")) {
                     output.print(UtilProperties.getMessage(PosTransaction.resource,"CHANGE",defaultLocale)
-                            + UtilFormatOut.formatPrice(trans.getTotalDue() * -1));
+                            + UtilFormatOut.formatPrice(trans.getTotalDue().negate().doubleValue()));
                 } else if (input.isFunctionSet("TOTAL")) {
-                    if (trans.getTotalDue() > 0) {
-                        output.print(UtilProperties.getMessage(PosTransaction.resource,"TOTALD",defaultLocale) + " " + UtilFormatOut.formatPrice(trans.getTotalDue()));
+                    if (trans.getTotalDue().compareTo(BigDecimal.ZERO) > 0) {
+                        output.print(UtilProperties.getMessage(PosTransaction.resource,"TOTALD",defaultLocale) + " " + UtilFormatOut.formatPrice(trans.getTotalDue().doubleValue()));
                     } else {
                         output.print(UtilProperties.getMessage(PosTransaction.resource,"PAYFIN",defaultLocale));
                     }

Modified: ofbiz/branches/typecheckcleanup200810/specialpurpose/webpos/src/org/ofbiz/webpos/transaction/WebPosTransaction.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/typecheckcleanup200810/specialpurpose/webpos/src/org/ofbiz/webpos/transaction/WebPosTransaction.java?rev=721986&r1=721985&r2=721986&view=diff
==============================================================================
--- ofbiz/branches/typecheckcleanup200810/specialpurpose/webpos/src/org/ofbiz/webpos/transaction/WebPosTransaction.java (original)
+++ ofbiz/branches/typecheckcleanup200810/specialpurpose/webpos/src/org/ofbiz/webpos/transaction/WebPosTransaction.java Sun Nov 30 22:51:11 2008
@@ -18,6 +18,7 @@
  *******************************************************************************/
 package org.ofbiz.webpos.transaction;
 
+import java.math.BigDecimal;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -171,9 +172,9 @@
         }
     }
     
-    public void modifyPrice(String productId, double price) {
+    public void modifyPrice(String productId, BigDecimal price) {
         Debug.logInfo("Modify item price " + productId + "/" + price, module);
-        ShoppingCartItem item = getCart().findCartItem(productId, null, null, null, 0.00);
+        ShoppingCartItem item = getCart().findCartItem(productId, null, null, null, BigDecimal.ZERO);
         if (UtilValidate.isNotEmpty(item)) {
             item.setBasePrice(price);
         } else {
@@ -189,12 +190,12 @@
         }
     }
     
-    public double processSale() throws GeneralException {
+    public BigDecimal processSale() throws GeneralException {
         //TODO insert check if not enough funds
         Debug.log("process sale", module);
-        double grandTotal = this.getGrandTotal();
-        double paymentAmt = this.getPaymentTotal();
-        if (grandTotal > paymentAmt) {
+        BigDecimal grandTotal = this.getGrandTotal();
+        BigDecimal paymentAmt = this.getPaymentTotal();
+        if (grandTotal.compareTo(paymentAmt) > 0) {
             throw new IllegalStateException();
         }
         
@@ -233,7 +234,7 @@
         }
         
         // get the change due
-        double change = (grandTotal - paymentAmt);
+        BigDecimal change = grandTotal.subtract(paymentAmt);
         
         // notify the change due
         //output.print(UtilProperties.getMessage(PosTransaction.resource,"CHANGE",defaultLocale) + " " + UtilFormatOut.formatPrice(this.getTotalDue() * -1));
@@ -355,25 +356,25 @@
         return INTERNAL_PAYMENT;
     }
     
-    public double addPayment(String id, double amount) {
+    public BigDecimal addPayment(String id, BigDecimal amount) {
         return this.addPayment(id, amount, null, null);
     }
     
-    public double addPayment(String id, double amount, String refNum, String authCode) {
+    public BigDecimal addPayment(String id, BigDecimal amount, String refNum, String authCode) {
         Debug.logInfo("Added payment " + id + "/" + amount, module);
         if ("CASH".equals(id)) {
             // clear cash payments first; so there is only one
             getCart().clearPayment(id);
         }
-        getCart().addPaymentAmount(id, new Double(amount), refNum, authCode, true, true, false);
+        getCart().addPaymentAmount(id, amount, refNum, authCode, true, true, false);
         return this.getTotalDue();
     }
     
-    public double processAmount(String amtStr) throws GeneralException {
-        double amount;
+    public BigDecimal processAmount(String amtStr) throws GeneralException {
+    	BigDecimal amount;
         if (UtilValidate.isNotEmpty(amtStr)) {
             try {
-                amount = Double.parseDouble(amtStr);
+                amount = new BigDecimal(amtStr);
             } catch (NumberFormatException e) {
                 Debug.logError("Invalid number for amount : " + amtStr, module);
                 throw new GeneralException();
@@ -381,7 +382,7 @@
         } else {
             Debug.log("Amount is empty; assumption is full amount : " + this.getTotalDue(), module);
             amount = this.getTotalDue();
-            if (amount <= 0) {
+            if (amount.compareTo(BigDecimal.ZERO) <= 0) {
                 throw new GeneralException();
             }
         }
@@ -390,7 +391,7 @@
     
     public synchronized void processNoPayment(String paymentMethodTypeId) {
         try {
-            double amount = processAmount(null);
+        	BigDecimal amount = processAmount(null);
             Debug.log("Processing [" + paymentMethodTypeId + "] Amount : " + amount, module);
             
             // add the payment
@@ -407,7 +408,7 @@
         }
         
         try {
-            double amount = processAmount(amountStr);
+        	BigDecimal amount = processAmount(amountStr);
             Debug.log("Processing [" + paymentMethodTypeId + "] Amount : " + amount, module);
             
             // add the payment
@@ -484,26 +485,26 @@
         inf.postalCode = postalCode;
     }
     
-    public double getTaxTotal() {
+    public BigDecimal getTaxTotal() {
         return getCart().getTotalSalesTax();
     }
     
-    public double getGrandTotal() {
-        return UtilFormatOut.formatPriceNumber(getCart().getGrandTotal()).doubleValue();
+    public BigDecimal getGrandTotal() {
+        return getCart().getGrandTotal();
     }
     
     public int getNumberOfPayments() {
         return getCart().selectedPayments();
     }
     
-    public double getPaymentTotal() {
-        return UtilFormatOut.formatPriceNumber(getCart().getPaymentTotal()).doubleValue();
+    public BigDecimal getPaymentTotal() {
+        return getCart().getPaymentTotal();
     }
     
-    public double getTotalDue() {
-        double grandTotal = this.getGrandTotal();
-        double paymentAmt = this.getPaymentTotal();
-        return (grandTotal - paymentAmt);
+    public BigDecimal getTotalDue() {
+    	BigDecimal grandTotal = this.getGrandTotal();
+    	BigDecimal paymentAmt = this.getPaymentTotal();
+        return grandTotal.subtract(paymentAmt);
     }
     
     public String addProductPromoCode(String code) {