ItemLines itemLines = (ItemLines) hm.get("itemLines");
if (itemLines != null)
{
itemLines.calculate();
DecimalFormat currencyFormat = new DecimalFormat("#,##0.00");
DecimalFormat rawCurrencyFormat = new DecimalFormat("#0.00");
DecimalFormat wholeNumberFormat = new DecimalFormat("#0");
java.util.Set listkey = itemLines.keySet();
java.util.Iterator it = listkey.iterator();
int i=1;
int itemNum = 0;
if(!it.hasNext()){
Items = Items + "<tr>\n";
Items = Items + "<td colspan=\"5\" align=\"center\">No items found</td>\n";
Items = Items + "</tr>\n";
}
while (it.hasNext())
{
ItemElement ele = (ItemElement)itemLines.get(it.next());
String lineStatus = ele.getLineStatus();
if (lineStatus == null)
{
lineStatus = "";
} //end of if statement (lineStatus == null)
if (!lineStatus.equals("Deleted")) {
IntMember lineid = (IntMember)ele.get("LineId");
IntMember itemid = (IntMember)ele.get("ItemId");
StringMember sku = (StringMember)ele.get("SKU");
IntMember qty = (IntMember)ele.get("Quantity");
FloatMember priceEach = (FloatMember)ele.get("Price");
FloatMember priceExe = (FloatMember)ele.get("PriceExtended");
StringMember desc = (StringMember)ele.get("Description");
FloatMember taxAmount = (FloatMember)ele.get("TaxAmount");
String quantity;
String priceEachString;
try
{
float tempFloat = (currencyFormat.parse(qty.getDisplayString())).floatValue();
quantity = wholeNumberFormat.format(new Float(tempFloat));
} //end of try block
catch (Exception exception)
{
quantity = "0";
} //end of catch block (Exception)
try
{
float priceEachValue = ((Float) priceEach.getMemberValue()).floatValue();
priceEachString = rawCurrencyFormat.format(new Float(priceEachValue));
} //end of try block
catch (Exception exception)
{
priceEachString = "0.00";
} //end of catch block (Exception)
Items = Items + "<tr>\n";
Items = Items + "<td width=\"15%\"> "+sku.getDisplayString()+"</td>\n";
Items = Items + "<td width=\"40%\"> "+desc.getDisplayString()+"</td>\n";
Items = Items + "<td width=\"15%\"> "+quantity+"</td>\n";
Items = Items + "<td width=\"15%\" align=\"right\"> $"+priceEachString+"</td>\n";
Items = Items + "<td width=\"15%\" align=\"right\"> $"+priceExe.getDisplayString()+"</td>\n";
Items = Items + "</tr>\n";
}
}//end of while
String totalItems;
try
{
totalItems = wholeNumberFormat.format(new Float(itemLines.getTotalItems()));
} //end of try block
catch (Exception exception)
{
totalItems = "0";
}