Author: mor
Date: Sat Jul 4 11:20:54 2009 New Revision: 791106 URL: http://svn.apache.org/viewvc?rev=791106&view=rev Log: Applied fix from trunk for revision: 791105 Remaining and Outstanding quantity on Order detail page and edit order page were wrong. Modified: ofbiz/branches/release09.04/applications/order/webapp/ordermgr/order/editorderitems.ftl ofbiz/branches/release09.04/applications/order/webapp/ordermgr/order/orderitems.ftl Modified: ofbiz/branches/release09.04/applications/order/webapp/ordermgr/order/editorderitems.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/order/webapp/ordermgr/order/editorderitems.ftl?rev=791106&r1=791105&r2=791106&view=diff ============================================================================== --- ofbiz/branches/release09.04/applications/order/webapp/ordermgr/order/editorderitems.ftl (original) +++ ofbiz/branches/release09.04/applications/order/webapp/ordermgr/order/editorderitems.ftl Sat Jul 4 11:20:54 2009 @@ -143,7 +143,26 @@ </#if> </td> <td class="align-text" valign="top" nowrap="nowrap"> - <#assign remainingQuantity = (orderItem.quantity?default(0) - orderItem.cancelQuantity?default(0))> + <#assign shippedQuantity = orderReadHelper.getItemShippedQuantity(orderItem)> + <#assign shipmentReceipts = delegator.findByAnd("ShipmentReceipt", {"orderId" : orderHeader.getString("orderId"), "orderItemSeqId" : orderItem.orderItemSeqId})/> + <#assign totalReceived = 0.0> + <#if shipmentReceipts?exists && shipmentReceipts?has_content> + <#list shipmentReceipts as shipmentReceipt> + <#if shipmentReceipt.quantityAccepted?exists && shipmentReceipt.quantityAccepted?has_content> + <#assign quantityAccepted = shipmentReceipt.quantityAccepted> + <#assign totalReceived = quantityAccepted + totalReceived> + </#if> + <#if shipmentReceipt.quantityRejected?exists && shipmentReceipt.quantityRejected?has_content> + <#assign quantityRejected = shipmentReceipt.quantityRejected> + <#assign totalReceived = quantityRejected + totalReceived> + </#if> + </#list> + </#if> + <#if orderHeader.orderTypeId == "PURCHASE_ORDER"> + <#assign remainingQuantity = ((orderItem.quantity?default(0) - orderItem.cancelQuantity?default(0)) - totalReceived?double)> + <#else> + <#assign remainingQuantity = ((orderItem.quantity?default(0) - orderItem.cancelQuantity?default(0)) - shippedQuantity?double)> + </#if> ${uiLabelMap.OrderOrdered} ${orderItem.quantity?default(0)?string.number} <br/> ${uiLabelMap.OrderCancelled}: ${orderItem.cancelQuantity?default(0)?string.number} <br/> ${uiLabelMap.OrderRemaining}: ${remainingQuantity} <br/> Modified: ofbiz/branches/release09.04/applications/order/webapp/ordermgr/order/orderitems.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/order/webapp/ordermgr/order/orderitems.ftl?rev=791106&r1=791105&r2=791106&view=diff ============================================================================== --- ofbiz/branches/release09.04/applications/order/webapp/ordermgr/order/orderitems.ftl (original) +++ ofbiz/branches/release09.04/applications/order/webapp/ordermgr/order/orderitems.ftl Sat Jul 4 11:20:54 2009 @@ -145,7 +145,25 @@ <table> <tr valign="top"> <#assign shippedQuantity = orderReadHelper.getItemShippedQuantity(orderItem)> - <#assign remainingQuantity = (orderItem.quantity?default(0) - orderItem.cancelQuantity?default(0) - shippedQuantity)> + <#assign shipmentReceipts = delegator.findByAnd("ShipmentReceipt", {"orderId" : orderHeader.getString("orderId"), "orderItemSeqId" : orderItem.orderItemSeqId})/> + <#assign totalReceived = 0.0> + <#if shipmentReceipts?exists && shipmentReceipts?has_content> + <#list shipmentReceipts as shipmentReceipt> + <#if shipmentReceipt.quantityAccepted?exists && shipmentReceipt.quantityAccepted?has_content> + <#assign quantityAccepted = shipmentReceipt.quantityAccepted> + <#assign totalReceived = quantityAccepted + totalReceived> + </#if> + <#if shipmentReceipt.quantityRejected?exists && shipmentReceipt.quantityRejected?has_content> + <#assign quantityRejected = shipmentReceipt.quantityRejected> + <#assign totalReceived = quantityRejected + totalReceived> + </#if> + </#list> + </#if> + <#if orderHeader.orderTypeId == "PURCHASE_ORDER"> + <#assign remainingQuantity = ((orderItem.quantity?default(0) - orderItem.cancelQuantity?default(0)) - totalReceived?double)> + <#else> + <#assign remainingQuantity = ((orderItem.quantity?default(0) - orderItem.cancelQuantity?default(0)) - shippedQuantity?double)> + </#if> <#-- to compute shortfall amount, sum up the orderItemShipGrpInvRes.quantityNotAvailable --> <#assign shortfalledQuantity = 0/> <#list orderItemShipGrpInvResList as orderItemShipGrpInvRes> @@ -188,7 +206,10 @@ <#-- Make sure digital goods without shipments don't always remainn "outstanding": if item is completed, it must have no outstanding quantity. --> <#if (orderItem.statusId != null) && (orderItem.statusId == "ITEM_COMPLETED")> 0 - <#else>${orderItem.quantity?default(0) - orderItem.cancelQuantity?default(0) - shippedQuantity} + <#elseif orderHeader.orderTypeId == "PURCHASE_ORDER"> + ${(orderItem.quantity?default(0) - orderItem.cancelQuantity?default(0)) - totalReceived?double} + <#elseif orderHeader.orderTypeId == "SALES_ORDER"> + ${(orderItem.quantity?default(0) - orderItem.cancelQuantity?default(0)) - shippedQuantity?double} </#if> </td> </tr> |
Free forum by Nabble | Edit this page |