Author: mor
Date: Tue Jun 30 12:43:47 2009
New Revision: 789696

URL: http://svn.apache.org/viewvc?rev=789696&view=rev
Log:
Added a button Qoh/Atp adjacent to product lookup on cart page on order manager 
which will show QOH and ATP for the entered product. This button will only be 
available for 
Purchase Orders screen. Applied patch from Akash Jain, part of OFBIZ-2670 
(https://issues.apache.org/jira/browse/OFBIZ-2670) 

Modified:
    
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShowCart.groovy
    ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl
    ofbiz/trunk/applications/product/config/ProductUiLabels.xml

Modified: 
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShowCart.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShowCart.groovy?rev=789696&r1=789695&r2=789696&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShowCart.groovy
 (original)
+++ 
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShowCart.groovy
 Tue Jun 30 12:43:47 2009
@@ -24,6 +24,23 @@
 import org.ofbiz.party.party.PartyWorker;
 import org.ofbiz.product.catalog.CatalogWorker;
 
+productId = parameters.productId;
+if (productId) {
+
+    quantityOnHandTotal = parameters.quantityOnHandTotal;
+    if (!quantityOnHandTotal) {
+        quantityOnHandTotal = 0;
+    }
+    context.quantityOnHandTotal = quantityOnHandTotal;
+
+    availableToPromiseTotal = parameters.availableToPromiseTotal;
+    if (!availableToPromiseTotal) {
+        availableToPromiseTotal = 0;
+    }
+    context.availableToPromiseTotal = availableToPromiseTotal;
+}
+context.productId = productId;
+
 // Just in case we are here from the choosecatalog form, the
 // following call will save in the session the new catalogId
 CatalogWorker.getCurrentCatalogId(request);
@@ -75,6 +92,7 @@
 if (productStore) {
     productStoreFacilityId = productStore.inventoryFacilityId;
 }
+context.facilityId = productStoreFacilityId;
 inventorySummary = dispatcher.runSync("getProductInventorySummaryForItems", 
[orderItems : shoppingCart.makeOrderItems(), facilityId : 
productStoreFacilityId]);
 context.availableToPromiseMap = inventorySummary.availableToPromiseMap;
 context.quantityOnHandMap = inventorySummary.quantityOnHandMap;

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl?rev=789696&r1=789695&r2=789696&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl 
(original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl Tue 
Jun 30 12:43:47 2009
@@ -17,21 +17,49 @@
 under the License.
 -->
 
+<script language="JavaScript" type="text/javascript">
+    function showQohAtp() {
+        document.qohAtpForm.productId.value = 
document.quickaddform.add_product_id.value;
+        document.qohAtpForm.submit();
+    }
+</script>
+
 <div class="screenlet">
     <div class="screenlet-body">
+      <div>
+        <#if quantityOnHandTotal?exists && availableToPromiseTotal?exists && 
(productId)?exists>
+          <ul>
+            <li>
+              <label>${uiLabelMap.ProductQuantityOnHand}</label>: 
${quantityOnHandTotal}
+            </li>
+            <li>
+              <label>${uiLabelMap.ProductAvailableToPromise}</label>: 
${availableToPromiseTotal}
+            </li>
+          </ul>
+        </#if>
+      </div>
       <table border="0" cellspacing="0" cellpadding="0">
         <tr>
           <td>
+            <form name="qohAtpForm" method="post" 
action="<@ofbizUrl>getProductInventoryAvailable</@ofbizUrl>">
+              <fieldset>
+                <input type="hidden" name="facilityId" 
value="${facilityId?if_exists}"/>
+                <input type="hidden" name="productId"/>
+              </fieldset>
+            </form>
             <form method="post" action="<@ofbizUrl>additem</@ofbizUrl>" 
name="quickaddform" style="margin: 0;">
               <table border="0">
                 <tr>
                   <td align="right"><div>${uiLabelMap.ProductProductId} 
:</div></td>
-                  <td><input type="text" size="25" name="add_product_id" 
value=""/>
+                  <td><input type="text" size="25" name="add_product_id" 
value="${productId?if_exists}"/>
                     <span class='tabletext'>
                       <a 
href="javascript:quicklookup(document.quickaddform.add_product_id)" 
class="buttontext">${uiLabelMap.OrderQuickLookup}</a>
                       <a 
href="javascript:call_fieldlookup2(document.quickaddform.add_product_id,'<@ofbizUrl><#if
 
orderType=="PURCHASE_ORDER">LookupSupplierProduct?partyId=${partyId?if_exists}<#else>LookupProduct</#if></@ofbizUrl>');">
                         <img 
src="<@ofbizContentUrl>/images/fieldlookup.gif</@ofbizContentUrl>" width="15" 
height="14" border="0" alt="${uiLabelMap.CommonClickHereForFieldLookup}"/>
                       </a>
+                      <#if "PURCHASE_ORDER" == shoppingCart.getOrderType()>
+                        <a href="javascript:showQohAtp()" 
class="buttontext">${uiLabelMap.ProductAtpQoh}</a>
+                      </#if>
                     </span>
                   </td>
                 </tr>

Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.xml?rev=789696&r1=789695&r2=789696&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductUiLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductUiLabels.xml Tue Jun 30 
12:43:47 2009
@@ -7136,6 +7136,9 @@
         <value 
xml:lang="th">ได้ประโยชน์ได้ถึงวันที่</value>
         <value xml:lang="zh">有效截止日期</value>
     </property>
+    <property key="ProductAvailableToPromise">
+        <value xml:lang="en">Available To Promise</value>
+    </property>
     <property key="ProductAverageCost">
         <value xml:lang="de">Durchschnittliche Kosten</value>
         <value xml:lang="en">Average Cost</value>
@@ -16067,6 +16070,9 @@
         <value 
xml:lang="th">ไม่ตั้งค่าจำนวน</value>
         <value xml:lang="zh">未设置数量</value>
     </property>
+    <property key="ProductQuantityOnHand">
+        <value xml:lang="en">Quantity On Hand</value>
+    </property>
     <property key="ProductQuantityRejected">
         <value xml:lang="de">Menge abgelehnt</value>
         <value xml:lang="en">Quantity Rejected</value>


Reply via email to