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/10 15:23:33 UTC

svn commit: r610801 - in /ofbiz/trunk/specialpurpose/pos: config/custreceipt.txt src/org/ofbiz/pos/PosTransaction.java src/org/ofbiz/pos/device/impl/Receipt.java

Author: jleroux
Date: Thu Jan 10 06:23:32 2008
New Revision: 610801

URL: http://svn.apache.org/viewvc?rev=610801&view=rev
Log:
A patch from Chris Lombardi "Implement formatting for configurable items in POS receipts" (https://issues.apache.org/jira/browse/OFBIZ-1562) - OFBIZ-1562


Modified:
    ofbiz/trunk/specialpurpose/pos/config/custreceipt.txt
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java

Modified: ofbiz/trunk/specialpurpose/pos/config/custreceipt.txt
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/config/custreceipt.txt?rev=610801&r1=610800&r2=610801&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/config/custreceipt.txt (original)
+++ ofbiz/trunk/specialpurpose/pos/config/custreceipt.txt Thu Jan 10 06:23:32 2008
@@ -36,6 +36,7 @@
 [BEGIN ITEM LOOP]
 ${productId} ${isTaxable}${basePrice} ${quantity}
 ${description} ${adjustments}
+${configDescription} ${configBasePrice} ${configQuantity}
 [END ITEM LOOP]
 
                          SALES TAX: ${taxTotal}
@@ -53,4 +54,5 @@
 [ORDER BARCODE]
 
 ${CENTER}${DOUBLE_HEIGHT}${BOLD}THANK-YOU
+
 

Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java?rev=610801&r1=610800&r2=610801&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Thu Jan 10 06:23:32 2008
@@ -232,12 +232,17 @@
         itemInfo.put("productId", item.getProductId());
         itemInfo.put("description", item.getDescription());
         itemInfo.put("quantity", UtilFormatOut.formatQuantity(item.getQuantity()));
-        itemInfo.put("basePrice", UtilFormatOut.formatPrice(item.getBasePrice()));
         itemInfo.put("subtotal", UtilFormatOut.formatPrice(item.getItemSubTotal()));
         itemInfo.put("isTaxable", item.taxApplies() ? "T" : " ");
         itemInfo.put("adjustments", item.getOtherAdjustments() != 0 ?
                 UtilFormatOut.formatPrice(item.getOtherAdjustments()) : "");
-
+        if (isAggregatedItem(item.getProductId())){
+            ProductConfigWrapper pcw = null;
+            pcw = item.getConfigWrapper();
+            itemInfo.put("basePrice", UtilFormatOut.formatPrice(pcw.getDefaultPrice()));
+        } else {
+            itemInfo.put("basePrice", UtilFormatOut.formatPrice(item.getBasePrice()));
+        }
         return itemInfo;
     }
 
@@ -255,13 +260,13 @@
             while(iter.hasNext()){
                 ConfigOption configoption = (ConfigOption)iter.next();
                 Map itemInfo = new HashMap();
-                if (configoption.isSelected()){
+                if (configoption.isSelected() && !configoption.isDefault()){
                     itemInfo.put("productId", "");
                     itemInfo.put("sku", "");
-                    itemInfo.put("description", configoption.getDescription());
-                    itemInfo.put("quantity", UtilFormatOut.formatQuantity(item.getQuantity()));
-                    itemInfo.put("basePrice", UtilFormatOut.formatPrice(configoption.getPrice()));
-                    itemInfo.put("isTaxable", item.taxApplies() ? "T" : " ");
+                    itemInfo.put("configDescription", configoption.getDescription());
+                    itemInfo.put("configQuantity", UtilFormatOut.formatQuantity(item.getQuantity()));
+                    itemInfo.put("configBasePrice", UtilFormatOut.formatPrice(configoption.getOffsetPrice()));
+                    //itemInfo.put("isTaxable", item.taxApplies() ? "T" : " ");
                     list.add(itemInfo);
                 }
             }

Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java?rev=610801&r1=610800&r2=610801&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java Thu Jan 10 06:23:32 2008
@@ -374,7 +374,7 @@
             // adjust the padding
             expandMap.put("description", UtilFormatOut.padString((String) expandMap.get("description"), descLength[type], true, ' '));
             expandMap.put("productId", UtilFormatOut.padString((String) expandMap.get("productId"), pridLength[type], true, ' '));
-            expandMap.put("basePrice", UtilFormatOut.padString((String) expandMap.get("basePrice"), priceLength[type], false, ' '));
+            expandMap.put("basePrice", UtilFormatOut.padString((String) expandMap.get("basePrice"), priceLength[type], false, ' '));            
             expandMap.put("subtotal", UtilFormatOut.padString((String) expandMap.get("subtotal"), priceLength[type], false, ' '));
             expandMap.put("quantity", UtilFormatOut.padString((String) expandMap.get("quantity"), qtyLength[type], false, ' '));
             expandMap.put("adjustments", UtilFormatOut.padString((String) expandMap.get("adjustments"), priceLength[type], false, ' '));
@@ -397,16 +397,11 @@
                     expandMap = this.makeCodeExpandMap(trans, type);
                     expandMap.putAll(map);
                     // adjust the padding
-                    expandMap.put("description",
-                        UtilFormatOut.padString(this.configPadding[type] + 
-                        (String) expandMap.get("description"), descLength[type], true, ' '));
+                    expandMap.put("configDescription",
+                        UtilFormatOut.padString(this.configPadding[type] + (String) expandMap.get("configDescription"), descLength[type], true, ' '));
                     expandMap.put("productId", UtilFormatOut.padString((String) expandMap.get("productId"), pridLength[type], true, ' '));
-                    //expandMap.put("basePrice", UtilFormatOut.padString((String) expandMap.get("basePrice"), priceLength[type], false, ' '));
-                    expandMap.put("basePrice", UtilFormatOut.padString((String) " ", priceLength[type], false, ' '));
-                    expandMap.put("subtotal", UtilFormatOut.padString((String) expandMap.get("subtotal"), priceLength[type], false, ' '));
-                    //expandMap.put("quantity", UtilFormatOut.padString((String) expandMap.get("quantity"), qtyLength[type], false, ' '));
-                    expandMap.put("quantity", UtilFormatOut.padString((String) " ", qtyLength[type], false, ' '));
-                    expandMap.put("isTaxable", UtilFormatOut.padString((String) " ", priceLength[type], false, ' '));
+                    expandMap.put("configBasePrice", UtilFormatOut.padString((String) expandMap.get("configBasePrice"), priceLength[type], false, ' '));
+                    expandMap.put("configQuantity", UtilFormatOut.padString((String) expandMap.get("configQuantity"), qtyLength[type], false, ' '));
                     toPrint = FlexibleStringExpander.expandString(loopStr, expandMap);
                     if (toPrint.indexOf("\n") > -1) {
                         String[] lines = toPrint.split("\\n");