Author: mor
Date: Mon Jul 6 11:38:19 2009 New Revision: 791447 URL: http://svn.apache.org/viewvc?rev=791447&view=rev Log: Product Quick Lookup on Order Entry shopping cart page show additional information for purchase order. Applied slightly modified patch from Sharad Gupta, part of OFBIZ-2701 (https://issues.apache.org/jira/browse/OFBIZ-2701) Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.groovy ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryForms.xml Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.groovy?rev=791447&r1=791446&r2=791447&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.groovy Mon Jul 6 11:38:19 2009 @@ -23,6 +23,7 @@ import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.order.shoppingcart.ShoppingCart; import org.ofbiz.order.shoppingcart.ShoppingCartEvents; +import org.ofbiz.order.order.OrderReadHelper; productId = request.getParameter("productId") ?: ""; supplier = null; @@ -61,4 +62,55 @@ selectedFields.add("availableThruDate"); productList = delegator.findList("SupplierProduct", conditions, selectedFields, ["productId"], null, false); -context.productList = EntityUtil.filterByDate(productList, nowTimestamp, "availableFromDate", "availableThruDate", true); +productList = EntityUtil.filterByDate(productList, nowTimestamp, "availableFromDate", "availableThruDate", true); +newProductList = []; + +productList.each { supplierProduct -> + quantityOnOrder = 0.0; + productId = supplierProduct.productId; + condition = []; // find approved purchase orders + condition = EntityCondition.makeCondition(EntityCondition.makeCondition("orderTypeId", "PURCHASE_ORDER"), EntityOperator.AND, + EntityCondition.makeCondition("statusId", "ORDER_APPROVED")); + + orderHeaders = delegator.findList("OrderHeader", condition, null, ["orderId DESC"], null, false); + orderHeaders.each { orderHeader -> + orderReadHelper = new OrderReadHelper(orderHeader); + orderItems = orderReadHelper.getOrderItems(); + orderItems.each { orderItem -> + if (productId.equals(orderItem.productId) && "ITEM_APPROVED".equals(orderItem.statusId)) { + if (!orderItem.cancelQuantity) { + cancelQuantity = 0.0; + } + shippedQuantity = orderReadHelper.getItemShippedQuantity(orderItem); + quantityOnOrder += orderItem.quantity - cancelQuantity - shippedQuantity; + } + } + } + String facilityId = request.getParameter("facilityId"); + if (facilityId) { + productFacilityList = delegator.findByAnd("ProductFacility", ["productId": productId, "facilityId" : facilityId]); + } else { + productFacilityList = delegator.findByAnd("ProductFacility", ["productId": productId]); + } + productFacilityList.each { productFacility -> + result = dispatcher.runSync("getInventoryAvailableByFacility", ["productId" : productId, "facilityId" : productFacility.facilityId]); + qohAtp = result.quantityOnHandTotal.toString() + "/" + result.availableToPromiseTotal.toString(); + productInfoMap = [:]; + + product = delegator.findOne("Product", ["productId" : productId], false); + productInfoMap.internalName = product.internalName; + + productInfoMap.productId = productId; + productInfoMap.qohAtp = qohAtp; + productInfoMap.quantityOnOrder = quantityOnOrder; + + productInfoMap.supplierProductId = supplierProduct.supplierProductId; + productInfoMap.lastPrice = supplierProduct.lastPrice; + productInfoMap.orderQtyIncrements = supplierProduct.orderQtyIncrements; + + productInfoMap.minimumStock = productFacility.minimumStock; + + newProductList.add(productInfoMap); + } +} +context.productList = newProductList; \ No newline at end of file Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryForms.xml?rev=791447&r1=791446&r2=791447&view=diff ============================================================================== --- ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryForms.xml (original) +++ ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryForms.xml Mon Jul 6 11:38:19 2009 @@ -178,8 +178,12 @@ </field> <field name="supplierProductId"><display/></field> <field name="supplierProductName"><display/></field> + <field name="internalName"><display/></field> <field name="lastPrice"><display/></field> <field name="minimumOrderQuantity"><display/></field> + <field name="minimumStock"><display/></field> + <field name="qohAtp" title="${uiLabelMap.ProductAtpQoh}"><display/></field> + <field name="quantityOnOrder"><display/></field> <field name="quantity" title="${uiLabelMap.OrderQuantity}"> <text size="5" maxlength="10"/> </field> |
Free forum by Nabble | Edit this page |