form.setOrderTaxes(orderTaxes);
iterator = orderHeader.getOrderTrackings().iterator();
Vector<OrderTrackingDisplayForm> orderTrackings = new Vector<OrderTrackingDisplayForm>();
while (iterator.hasNext()) {
OrderTracking orderTracking = (OrderTracking) iterator.next();
if (orderTracking.getCreditHeader() != null) {
continue;
}
if (orderTracking.getInvoiceHeader() != null) {
continue;
}
OrderTrackingDisplayForm orderTrackingDisplayForm = new OrderTrackingDisplayForm();
orderTrackingDisplayForm.setOrderTrackingId(orderTracking.getOrderTrackingId().toString());
orderTrackingDisplayForm.setOrderTrackingMessage(orderTracking.getOrderTrackingMessage());
orderTrackingDisplayForm.setOrderTrackingInternal(false);
if (orderTracking.getOrderTrackingInternal().equals(String.valueOf(Constants.VALUE_YES))) {
orderTrackingDisplayForm.setOrderTrackingInternal(true);
}
orderTrackingDisplayForm.setRecUpdateDatetime(Format.getFullDatetime(orderTracking.getRecUpdateDatetime()));
orderTrackings.add(orderTrackingDisplayForm);
}
orderHeaderDisplayForm.setOrderTrackings(orderTrackings);
Vector<InvoiceHeaderDisplayForm> invoiceHeaders = new Vector<InvoiceHeaderDisplayForm>();
iterator = orderHeader.getInvoiceHeaders().iterator();
while (iterator.hasNext()) {
InvoiceHeader iHeader = (InvoiceHeader) iterator.next();
// invoiceHeader might have been updated. eg.capture
if (invoiceHeader != null) {
if (iHeader.getInvoiceHeaderId().equals(invoiceHeader.getInvoiceHeaderId())) {
iHeader = invoiceHeader;
}
}
InvoiceHeaderDisplayForm invoiceHeaderDisplayForm = new InvoiceHeaderDisplayForm();
if (iHeader.getInvoiceHeaderId() != null) {
invoiceHeaderDisplayForm.setInvoiceHeaderId(iHeader.getInvoiceHeaderId().toString());
}
invoiceHeaderDisplayForm.setInvoiceNum(iHeader.getInvoiceNum());
invoiceHeaderDisplayForm.setShippingTotal(Format.getFloat(iHeader.getShippingTotal()));
invoiceHeaderDisplayForm.setInvoiceTotal(Format.getFloat(iHeader.getInvoiceTotal()));
invoiceHeaderDisplayForm.setInvoiceStatus(resources.getMessage("order.status." + iHeader.getInvoiceStatus()));
invoiceHeaderDisplayForm.setInvoiceDate(Format.getFullDate(iHeader.getInvoiceDate()));
Iterator<?> trackingIterator = iHeader.getInvoiceTrackings().iterator();
Vector<OrderTrackingDisplayForm> invoiceTrackings = new Vector<OrderTrackingDisplayForm>();
while (trackingIterator.hasNext()) {
OrderTracking orderTracking = (OrderTracking) trackingIterator.next();
OrderTrackingDisplayForm orderTrackingDisplayForm = new OrderTrackingDisplayForm();
orderTrackingDisplayForm.setOrderTrackingId(orderTracking.getOrderTrackingId().toString());
orderTrackingDisplayForm.setOrderTrackingMessage(orderTracking.getOrderTrackingMessage());
orderTrackingDisplayForm.setOrderTrackingInternal(false);
if (orderTracking.getOrderTrackingInternal().equals(String.valueOf(Constants.VALUE_YES))) {
orderTrackingDisplayForm.setOrderTrackingInternal(true);
}
orderTrackingDisplayForm.setRecUpdateDatetime(Format.getFullDatetime(orderTracking.getRecUpdateDatetime()));
invoiceTrackings.add(orderTrackingDisplayForm);
}
invoiceHeaderDisplayForm.setOrderTrackings(invoiceTrackings);
if (iHeader.getPaymentTran() != null) {
PaymentTran paymentTran = iHeader.getPaymentTran();
PaymentTranDisplayForm paymentForm = new PaymentTranDisplayForm();
paymentForm.setAuthCode(paymentTran.getAuthCode());
paymentForm.setPaymentReference1(paymentTran.getPaymentReference1());
paymentForm.setPaymentReference2(paymentTran.getPaymentReference2());
paymentForm.setPaymentReference3(paymentTran.getPaymentReference3());
paymentForm.setPaymentReference4(paymentTran.getPaymentReference4());
paymentForm.setPaymentReference5(paymentTran.getPaymentReference5());
invoiceHeaderDisplayForm.setPaymentTran(paymentForm);
}
if (iHeader.getVoidPaymentTran() != null) {
PaymentTran paymentTran = iHeader.getVoidPaymentTran();
PaymentTranDisplayForm paymentForm = new PaymentTranDisplayForm();
paymentForm.setAuthCode(paymentTran.getAuthCode());
paymentForm.setPaymentReference1(paymentTran.getPaymentReference1());
paymentForm.setPaymentReference2(paymentTran.getPaymentReference2());
paymentForm.setPaymentReference3(paymentTran.getPaymentReference3());
paymentForm.setPaymentReference4(paymentTran.getPaymentReference4());
paymentForm.setPaymentReference5(paymentTran.getPaymentReference5());
invoiceHeaderDisplayForm.setVoidPaymentTran(paymentForm);
}
invoiceHeaders.add(invoiceHeaderDisplayForm);
}
form.setInvoiceHeaders(invoiceHeaders);
Vector<CreditHeaderDisplayForm> creditHeaders = new Vector<CreditHeaderDisplayForm>();
iterator = orderHeader.getCreditHeaders().iterator();
while (iterator.hasNext()) {
CreditHeader iHeader = (CreditHeader) iterator.next();
// creditHeader might have been updated. eg.capture
if (creditHeader != null) {
if (iHeader.getCreditHeaderId().equals(creditHeader.getCreditHeaderId())) {
iHeader = creditHeader;
}
}
CreditHeaderDisplayForm creditHeaderDisplayForm = new CreditHeaderDisplayForm();
if (iHeader.getCreditHeaderId() != null) {
creditHeaderDisplayForm.setCreditHeaderId(iHeader.getCreditHeaderId().toString());
}
creditHeaderDisplayForm.setCreditNum(iHeader.getCreditNum());
creditHeaderDisplayForm.setUpdateInventory(false);
if (iHeader.getUpdateInventory().equals(String.valueOf(Constants.VALUE_YES))) {
creditHeaderDisplayForm.setUpdateInventory(true);
}
creditHeaderDisplayForm.setShippingTotal(Format.getFloat(iHeader.getShippingTotal()));
creditHeaderDisplayForm.setCreditTotal(Format.getFloat(iHeader.getCreditTotal()));
creditHeaderDisplayForm.setCreditStatus(resources.getMessage("order.status." + iHeader.getCreditStatus()));
creditHeaderDisplayForm.setCreditDate(Format.getFullDate(iHeader.getCreditDate()));
Iterator<?> trackingIterator = iHeader.getCreditTrackings().iterator();
Vector<OrderTrackingDisplayForm> creditTrackings = new Vector<OrderTrackingDisplayForm>();
while (trackingIterator.hasNext()) {
OrderTracking orderTracking = (OrderTracking) trackingIterator.next();
OrderTrackingDisplayForm orderTrackingDisplayForm = new OrderTrackingDisplayForm();
orderTrackingDisplayForm.setOrderTrackingId(orderTracking.getOrderTrackingId().toString());
orderTrackingDisplayForm.setOrderTrackingMessage(orderTracking.getOrderTrackingMessage());
orderTrackingDisplayForm.setOrderTrackingInternal(false);
if (orderTracking.getOrderTrackingInternal().equals(String.valueOf(Constants.VALUE_YES))) {
orderTrackingDisplayForm.setOrderTrackingInternal(true);
}
orderTrackingDisplayForm.setRecUpdateDatetime(Format.getFullDatetime(orderTracking.getRecUpdateDatetime()));
creditTrackings.add(orderTrackingDisplayForm);
}
creditHeaderDisplayForm.setOrderTrackings(creditTrackings);
if (iHeader.getPaymentTran() != null) {
PaymentTran paymentTran = iHeader.getPaymentTran();
PaymentTranDisplayForm paymentForm = new PaymentTranDisplayForm();
paymentForm.setAuthCode(paymentTran.getAuthCode());
paymentForm.setPaymentReference1(paymentTran.getPaymentReference1());
paymentForm.setPaymentReference2(paymentTran.getPaymentReference2());
paymentForm.setPaymentReference3(paymentTran.getPaymentReference3());
paymentForm.setPaymentReference4(paymentTran.getPaymentReference4());
paymentForm.setPaymentReference5(paymentTran.getPaymentReference5());
creditHeaderDisplayForm.setPaymentTran(paymentForm);
}
if (iHeader.getVoidPaymentTran() != null) {
PaymentTran paymentTran = iHeader.getVoidPaymentTran();
PaymentTranDisplayForm paymentForm = new PaymentTranDisplayForm();
paymentForm.setAuthCode(paymentTran.getAuthCode());
paymentForm.setPaymentReference1(paymentTran.getPaymentReference1());
paymentForm.setPaymentReference2(paymentTran.getPaymentReference2());
paymentForm.setPaymentReference3(paymentTran.getPaymentReference3());
paymentForm.setPaymentReference4(paymentTran.getPaymentReference4());
paymentForm.setPaymentReference5(paymentTran.getPaymentReference5());
creditHeaderDisplayForm.setVoidPaymentTran(paymentForm);
}
creditHeaders.add(creditHeaderDisplayForm);
}
form.setCreditHeaders(creditHeaders);
Vector<ShipHeaderDisplayForm> shipHeaders = new Vector<ShipHeaderDisplayForm>();
iterator = orderHeader.getShipHeaders().iterator();
while (iterator.hasNext()) {
ShipHeader iHeader = (ShipHeader) iterator.next();
// shipHeader might have been updated. eg.capture
if (shipHeader != null) {
if (iHeader.getShipHeaderId().equals(shipHeader.getShipHeaderId())) {
iHeader = shipHeader;
}
}
ShipHeaderDisplayForm shipHeaderDisplayForm = new ShipHeaderDisplayForm();
if (iHeader.getShipHeaderId() != null) {
shipHeaderDisplayForm.setShipHeaderId(iHeader.getShipHeaderId().toString());
}
shipHeaderDisplayForm.setShipNum(iHeader.getShipNum());
shipHeaderDisplayForm.setUpdateInventory(false);
if (iHeader.getUpdateInventory().equals(String.valueOf(Constants.VALUE_YES))) {
shipHeaderDisplayForm.setUpdateInventory(true);
}
shipHeaderDisplayForm.setShipStatus(resources.getMessage("order.status." + iHeader.getShipStatus()));
shipHeaderDisplayForm.setShipDate(Format.getFullDate(iHeader.getShipDate()));
Iterator<?> trackingIterator = iHeader.getShipTrackings().iterator();
Vector<OrderTrackingDisplayForm> shipTrackings = new Vector<OrderTrackingDisplayForm>();
while (trackingIterator.hasNext()) {
OrderTracking orderTracking = (OrderTracking) trackingIterator.next();
OrderTrackingDisplayForm orderTrackingDisplayForm = new OrderTrackingDisplayForm();
orderTrackingDisplayForm.setOrderTrackingId(orderTracking.getOrderTrackingId().toString());
orderTrackingDisplayForm.setOrderTrackingMessage(orderTracking.getOrderTrackingMessage());
orderTrackingDisplayForm.setOrderTrackingInternal(false);
if (orderTracking.getOrderTrackingInternal().equals(String.valueOf(Constants.VALUE_YES))) {
orderTrackingDisplayForm.setOrderTrackingInternal(true);
}
orderTrackingDisplayForm.setRecUpdateDatetime(Format.getFullDatetime(orderTracking.getRecUpdateDatetime()));
shipTrackings.add(orderTrackingDisplayForm);
}
shipHeaderDisplayForm.setOrderTrackings(shipTrackings);
shipHeaders.add(shipHeaderDisplayForm);
}