<#-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <#macro displayReturnAdjustment returnAdjustment adjEditable> <#assign returnHeader = returnAdjustment.getRelatedOne("ReturnHeader", false)> <#assign adjReturnType = returnAdjustment.getRelatedOne("ReturnType", false)!> <#if (adjEditable)>   ${returnAdjustment.get("description",locale)?default("N/A")} <#if returnAdjustment.comments?has_content>: ${returnAdjustment.comments} <#if (adjEditable)> <#else> <@ofbizCurrency amount=returnAdjustment.amount?default(0) isoCode=returnHeader.currencyUomId/>  
<#if (!adjEditable)> <#if adjReturnType?has_content> ${adjReturnType.get("description", locale)?default("${uiLabelMap.CommonNA}")} <#else>
<#if (adjEditable)> ${uiLabelMap.CommonRemove} <#else>   <#if (adjEditable)> <#assign rowCount = rowCount + 1> <#assign rowCountForAdjRemove = rowCountForAdjRemove + 1> <#assign returnTotal = returnTotal + returnAdjustment.amount?default(0)> <#if returnHeader?has_content> <#if returnHeader.destinationFacilityId?has_content && returnHeader.statusId == "RETURN_ACCEPTED" && returnHeader.returnHeaderTypeId?starts_with("CUSTOMER_")> <#list returnShipmentIds as returnShipmentId> ${uiLabelMap.ProductShipmentId} ${returnShipmentId.shipmentId} ${uiLabelMap.OrderReceiveReturn} <#elseif returnHeader.statusId == "SUP_RETURN_ACCEPTED" && returnHeader.returnHeaderTypeId == "VENDOR_RETURN"> <#if returnShipmentIds?has_content> <#list returnShipmentIds as returnShipmentId> ${uiLabelMap.ProductShipmentId} ${returnShipmentId.shipmentId} <#else> ${uiLabelMap.OrderCreateReturnShipment}

<#if !requestParameters.orderId?? && returnHeader?has_content>
<#assign readOnly = (returnHeader.statusId != "RETURN_REQUESTED" && returnHeader.statusId != "SUP_RETURN_REQUESTED")> <#-- information about orders and amount refunded/credited on past returns --> <#if orh??> <#if (readOnly)> <#assign returnTotal = 0.0> <#assign rowCount = 0> <#assign rowCountForAdjRemove = 0> <#if returnItems?has_content> <#assign alt_row = false> <#list returnItems as item> <#assign orderItem = item.getRelatedOne("OrderItem", false)!> <#assign orderHeader = item.getRelatedOne("OrderHeader", false)!> <#assign returnReason = item.getRelatedOne("ReturnReason", false)!> <#assign returnType = item.getRelatedOne("ReturnType", false)!> <#assign status = item.getRelatedOne("StatusItem", false)!> <#assign shipmentReceipts = item.getRelated("ShipmentReceipt", null, null, false)!> <#if (item.get("returnQuantity")?? && item.get("returnPrice")??)> <#assign returnTotal = returnTotal + item.get("returnQuantity") * item.get("returnPrice") > <#assign returnItemSubTotal = item.get("returnQuantity") * item.get("returnPrice") > class="alternate-row"> <#if (readOnly)> <#if returnHeader.statusId == "RETURN_REQUESTED" || returnHeader.statusId == "SUP_RETURN_REQUESTED"> <#else> <#assign rowCount = rowCount + 1> <#assign returnItemAdjustments = item.getRelated("ReturnAdjustment", null, null, false)> <#if (returnItemAdjustments?has_content)> <#list returnItemAdjustments as returnItemAdjustment> <@displayReturnAdjustment returnAdjustment=returnItemAdjustment adjEditable=false/> <#-- adjustments of return items should never be editable --> <#-- toggle the row color --> <#assign alt_row = !alt_row> <#else> <#-- these are general return adjustments not associated with a particular item (itemSeqId = "_NA_" --> <#if (returnAdjustments?has_content)> <#list returnAdjustments as returnAdjustment> <#assign adjEditable = !readOnly> <#-- they are editable if the rest of the return items are --> <@displayReturnAdjustment returnAdjustment=returnAdjustment adjEditable=adjEditable/> <#-- show the return total --> <#if (!readOnly) && (rowCount > 0)>

${uiLabelMap.OrderOrderReturn} #${returnId}

${uiLabelMap.OrderOrderTotal} <@ofbizCurrency amount=orh.getOrderGrandTotal() isoCode=orh.getCurrency()/>
${uiLabelMap.OrderAmountAlreadyCredited} <@ofbizCurrency amount=orh.getReturnedCreditTotalWithBillingAccountBd() isoCode=orh.getCurrency()/>
${uiLabelMap.OrderAmountAlreadyRefunded} <@ofbizCurrency amount=orh.getReturnedRefundTotalWithBillingAccountBd() isoCode=orh.getCurrency()/>

${uiLabelMap.OrderOrderItems} ${uiLabelMap.ProductProduct} ${uiLabelMap.CommonDescription} ${uiLabelMap.OrderQuantity} ${uiLabelMap.OrderPrice} ${uiLabelMap.OrderSubTotal} ${uiLabelMap.OrderReturnReason} ${uiLabelMap.OrderItemStatus} ${uiLabelMap.CommonType}${uiLabelMap.OrderReturnResponse}  
${item.orderId} - ${item.orderItemSeqId?default("N/A")}
<#if item.get("productId")??> ${item.productId} <#else> N/A
<#if readOnly> ${item.description?default("N/A")} <#else>
<#if readOnly> ${item.returnQuantity?string.number} <#else> <#if item.receivedQuantity??>
${uiLabelMap.OrderTotalQuantityReceive}: ${item.receivedQuantity} <#list shipmentReceipts! as shipmentReceipt>
${uiLabelMap.OrderQty}: ${shipmentReceipt.quantityAccepted}, ${shipmentReceipt.datetimeReceived}, ${shipmentReceipt.inventoryItemId}
<#if readOnly> <@ofbizCurrency amount=item.returnPrice isoCode=orderHeader.currencyUom/> <#else>
<#if returnItemSubTotal??><@ofbizCurrency amount=returnItemSubTotal isoCode=orderHeader.currencyUom/>
<#if readOnly> ${returnReason.get("description",locale)?default("N/A")} <#else>
<#if status?has_content> ${status.get("description",locale)} <#else> N/A
<#if (readOnly)> ${returnType.get("description",locale)?default("N/A")} <#else>
<#if returnHeader.statusId == "RETURN_COMPLETED" || returnHeader.statusId == "SUP_RETURN_COMPLETED"> <#assign itemResp = item.getRelatedOne("ReturnItemResponse", false)!> <#if itemResp?has_content> <#if itemResp.paymentId?has_content>
${uiLabelMap.AccountingPayment} ${uiLabelMap.CommonNbr}${itemResp.paymentId}
<#elseif itemResp.replacementOrderId?has_content>
${uiLabelMap.OrderOrder} ${uiLabelMap.CommonNbr}${itemResp.replacementOrderId}
<#elseif itemResp.billingAccountId?has_content>
${uiLabelMap.AccountingAccountId} ${uiLabelMap.CommonNbr}${itemResp.billingAccountId}
<#else>
${uiLabelMap.CommonNone}
<#else>
${uiLabelMap.CommonNA}
${uiLabelMap.CommonRemove} 
${uiLabelMap.OrderNoReturnItemsFound}


  ${uiLabelMap.OrderReturnTotal} <@ofbizCurrency amount=returnTotal isoCode=returnHeader.currencyUomId/>

<#if returnItems?has_content> <#list returnItems as item>
<#if returnAdjustments?has_content> <#list returnAdjustments as returnAdjustment>
<#if (returnHeader.statusId == "RETURN_REQUESTED" || returnHeader.statusId == "SUP_RETURN_REQUESTED") && (rowCount > 0)>
<#if returnHeader.returnHeaderTypeId?starts_with("CUSTOMER_")> <#assign statusId = "RETURN_ACCEPTED"> <#else> <#assign statusId = "SUP_RETURN_ACCEPTED">
<#if returnHeader.statusId == "RETURN_REQUESTED" || returnHeader.statusId == "SUP_RETURN_REQUESTED">
<#if partyOrders?has_content> <#else>

${uiLabelMap.OrderReturnItems}

${uiLabelMap.OrderOrderId}  
${uiLabelMap.OrderReturnLoadItems}
${uiLabelMap.OrderNoOrderFoundForParty}: ${partyId?default('[null]')}
${uiLabelMap.OrderOrderId}
 
${uiLabelMap.OrderReturnLoadItems}
  ${uiLabelMap.OrderReturnLoadItems}
<#elseif returnHeader?has_content> <#assign selectAllFormName = "returnItems"/>
<#include "ReturnItemInc.ftl"/>
<#else> ${uiLabelMap.CommonErrorMessage2} : ${uiLabelMap.CommonPleaseSelect}. ${uiLabelMap.CommonUseBackButton}