int itemShipTotal = 0;
float itemDetailAmount = 0;
float itemDetailDiscountAmount = 0;
float itemDetailSubTotal = 0;
while (iterator.hasNext()) {
OrderItemDetail orderItemDetail = (OrderItemDetail) iterator.next();
OrderItemDetailDisplayForm itemDisplay = new OrderItemDetailDisplayForm();
itemDisplay.setOrderItemDetailId(orderItemDetail.getOrderItemDetailId().toString());
Item item = orderItemDetail.getItem();
itemDisplay.setItemId("");
itemDisplay.setItemNum(orderItemDetail.getItemNum());
itemDisplay.setItemSkuCd(orderItemDetail.getItemSkuCd());
itemDisplay.setItemShortDesc(orderItemDetail.getItemShortDesc());
itemDisplay.setItemTierQty(Format.getInt(orderItemDetail.getItemTierQty()));
itemDisplay.setItemTierPrice(Format.getFloat(orderItemDetail.getItemTierPrice()));
itemDisplay.setItemOrderQty(Format.getInt(orderItemDetail.getItemOrderQty()));
itemDisplay.setItemDetailAmount(Format.getFloat(orderItemDetail.getItemDetailAmount()));
itemDisplay.setItemDetailDiscountAmount(Format.getFloat(orderItemDetail.getItemDetailDiscountAmount()));
float total = orderItemDetail.getItemDetailAmount() - orderItemDetail.getItemDetailDiscountAmount();
itemDisplay.setItemDetailSubTotal(Format.getFloat(total));
if (item != null) {
itemDisplay.setItemId(item.getItemId().toString());
itemDisplay.setItemShortDesc(orderItemDetail.getItem().getItemLanguage().getItemShortDesc());
}
Vector<OrderItemAttributeBean> orderItemAttributes = new Vector<OrderItemAttributeBean>();
if (item != null && item.getItemTypeCd().equals(Constants.ITEM_TYPE_SKU)) {
for (ItemAttributeDetail itemAttributeDetail : item.getItemAttributeDetails()) {
CustomAttribute customAttribute = itemAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
if (customAttribute.getCustomAttribTypeCode() != Constants.CUSTOM_ATTRIBUTE_TYPE_SKU_MAKEUP) {
continue;
}
OrderItemAttributeBean orderItemAttributeBean = new OrderItemAttributeBean();
orderItemAttributeBean.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
CustomAttributeOption customAttributeOption = itemAttributeDetail.getCustomAttributeOption();
orderItemAttributeBean.setCustomAttribValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
orderItemAttributes.add(orderItemAttributeBean);
}
}
for (OrderAttributeDetail orderAttributeDetail : orderItemDetail.getOrderAttributeDetails()) {
OrderItemAttributeBean orderItemAttributeBean = new OrderItemAttributeBean();
CustomAttribute customAttribute = orderAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
orderItemAttributeBean.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_CUST_INPUT) {
orderItemAttributeBean.setCustomAttribValue(orderAttributeDetail.getOrderAttribValue());
}
else {
CustomAttributeOption customAttributeOption = orderAttributeDetail.getCustomAttributeOption();
orderItemAttributeBean.setCustomAttribValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
}
orderItemAttributes.add(orderItemAttributeBean);
}
itemDisplay.setOrderItemAttributes(orderItemAttributes);
Iterator<?> invoiceIterator = orderItemDetail.getInvoiceDetails().iterator();
int itemInvoiceQty = 0;
while (invoiceIterator.hasNext()) {
InvoiceDetail invoiceDetail = (InvoiceDetail) invoiceIterator.next();
InvoiceHeader iHeader = invoiceDetail.getInvoiceHeader();
if (iHeader.getInvoiceHeaderId() == null) {
continue;
}
if (invoiceHeader != null) {
if (iHeader.getInvoiceHeaderId().equals(invoiceHeader.getInvoiceHeaderId())) {
continue;
}
}
String status = iHeader.getInvoiceStatus();
if (status.equals(Constants.ORDERSTATUS_CANCELLED) || status.equals(Constants.ORDERSTATUS_VOIDED)) {
continue;
}
itemInvoiceQty += invoiceDetail.getItemInvoiceQty();
itemInvoiceTotal += invoiceDetail.getItemInvoiceQty();
}
itemDisplay.setItemInvoiceQty(Format.getInt(itemInvoiceQty));
Iterator<?> creditIterator = orderItemDetail.getCreditDetails().iterator();
int itemCreditQty = 0;
while (creditIterator.hasNext()) {
CreditDetail creditDetail = (CreditDetail) creditIterator.next();
CreditHeader cHeader = creditDetail.getCreditHeader();
if (cHeader.getCreditHeaderId() == null) {
continue;
}
if (creditHeader != null) {
if (cHeader.getCreditHeaderId().equals(creditHeader.getCreditHeaderId())) {
continue;
}
}
String status = cHeader.getCreditStatus();
if (status.equals(Constants.ORDERSTATUS_CANCELLED) || status.equals(Constants.ORDERSTATUS_VOIDED)) {
continue;
}
itemCreditQty += creditDetail.getItemCreditQty();
itemCreditTotal += creditDetail.getItemCreditQty();
}
itemDisplay.setItemCreditQty(Format.getInt(itemCreditQty));
Iterator<?> shipIterator = orderItemDetail.getShipDetails().iterator();
int itemShipQty = 0;
while (shipIterator.hasNext()) {
ShipDetail shipDetail = (ShipDetail) shipIterator.next();
ShipHeader sHeader = shipDetail.getShipHeader();
if (sHeader.getShipHeaderId() == null) {
continue;
}
if (shipHeader != null) {
if (sHeader.getShipHeaderId().equals(shipHeader.getShipHeaderId())) {
continue;
}
}
String status = sHeader.getShipStatus();
if (status.equals(Constants.ORDERSTATUS_CANCELLED) || status.equals(Constants.ORDERSTATUS_VOIDED)) {
continue;
}
itemShipQty += shipDetail.getItemShipQty();
itemShipTotal += shipDetail.getItemShipQty();
}
itemDisplay.setItemShipQty(Format.getInt(itemShipQty));
itemOrderTotal += orderItemDetail.getItemOrderQty();
itemDetailAmount += orderItemDetail.getItemDetailAmount();
itemDetailDiscountAmount += orderItemDetail.getItemDetailDiscountAmount();
itemDetailSubTotal += total;
int itemSuggestInvoiceQty = orderItemDetail.getItemOrderQty() - itemInvoiceQty + itemCreditQty;
int itemSuggestShipQty = orderItemDetail.getItemOrderQty() - itemShipQty;
int itemSuggestCreditQty = itemInvoiceQty - itemCreditQty;
itemDisplay.setItemSuggestInvoiceQty(itemSuggestInvoiceQty);
itemDisplay.setItemSuggestShipQty(itemSuggestShipQty);
itemDisplay.setItemSuggestCreditQty(itemSuggestCreditQty);