iterator = orderItemDetail.getInvoiceDetails().iterator();
int invoiceQty = 0;
float invoiceAmount = 0;
while (iterator.hasNext()) {
InvoiceDetail invoiceDetail = (InvoiceDetail) iterator.next();
InvoiceHeader header = invoiceDetail.getInvoiceHeader();
if (header.getInvoiceHeaderId() == null) {
continue;
}
if (header.getInvoiceStatus().equals(Constants.ORDERSTATUS_CANCELLED) || header.getInvoiceStatus().equals(Constants.ORDERSTATUS_VOIDED)) {
continue;
}
if (invoiceHeader != null) {
if (header.getInvoiceHeaderId().equals(invoiceHeader.getInvoiceHeaderId())) {
continue;
}
}
invoiceQty += invoiceDetail.getItemInvoiceQty().intValue();
invoiceAmount += invoiceDetail.getItemInvoiceAmount().floatValue();
Iterator<?> invoiceTaxes = invoiceDetail.getInvoiceDetailTaxes().iterator();
while (invoiceTaxes.hasNext()) {
InvoiceDetailTax invoiceDetailTax = (InvoiceDetailTax) invoiceTaxes.next();
ItemTaxBalance itemTax = locateItemTax(invoiceDetailTax.getTax(), invoiceDetailTax.getTaxName(), taxBalances);
float taxAmount = itemTax.getInvoiceTaxAmount() + invoiceDetailTax.getTaxAmount();
itemTax.setInvoiceTaxAmount(taxAmount);