itr = itemLines.keySet().iterator();
while (itr.hasNext())
{
Object obj = itr.next();
ItemElement ILE = (ItemElement)itemLines.get(obj);
IntMember ItemId = (IntMember)ILE.get("ItemId");
Integer currItemId = (Integer)ItemId.getMemberValue();
if ( currItemId.intValue() == removeToken)
{
String status = ILE.getLineStatus();
if (status.equals("Active") || status.equals(""))
{
ILE.setLineStatus("Deleted");
removeKeys.add(obj);
}
else if (status.equals("New"))
{
removeKeys.add(obj);
}
}
}
}
for(int i=0; i<removeKeys.size(); i++)
{
itemLines.remove(removeKeys.get(i));
}
}
((PromotionDetailListForm)form).setItemLines(itemLines);
}
// ADD item
else if ( (request.getParameter(AccountConstantKeys.TYPEOFOPERATION) != null) && request.getParameter(AccountConstantKeys.TYPEOFOPERATION).equals("ADDITEM") )
{
// added by Sandie for handling custom field values
request.setAttribute("CustomFieldVector",customFieldVec);
// added by Sandie - end
String newItemID = request.getParameter("theitemid");
ItemList IL = null ;
ListGenerator lg = ListGenerator.getListGenerator(dataSource);//get the List Generator object for Listing
IL = (ItemList )lg.getItemList(individualId , 1, 10 , "" , "ItemID");//called when the request for the list is for first time
StringTokenizer st;
String token, nextItr;
Iterator itr = IL.keySet().iterator();
if (newItemID != null)
{
st = new StringTokenizer(newItemID, ",");
itemLines = ((PromotionDetailListForm)form).getItemLines();
if(itemLines == null)
itemLines = new ItemLines();
counter = itemLines.size();
while (st.hasMoreTokens())
{
token = (String)st.nextToken();
int intToken = Integer.parseInt(token);
while (itr.hasNext())
{
nextItr = (String)itr.next();
ListElement ile = (ListElement)IL.get(nextItr);
IntMember smid = (IntMember)ile.get("ItemID");
Integer listItemid = (Integer)smid.getMemberValue();
if ( listItemid.intValue() == intToken )
{
StringMember smName = (StringMember)ile.get("Name"); // name = description
String name = (String) smName.getMemberValue();
StringMember smType = (StringMember)ile.get("Type"); // type
String type = (String) smType.getMemberValue();
StringMember smSku = (StringMember) ile.get("SKU");
String sku = (String)smSku.getMemberValue();
FloatMember smPrice = (FloatMember) ile.get("Price");
float dprice = Float.parseFloat((smPrice.getMemberValue()).toString());
FloatMember smCost = (FloatMember) ile.get("Price");
float dcost = Float.parseFloat((smCost.getMemberValue()).toString());
int id = ile.getElementID();
IntMember LineId = new IntMember("LineId",11,10,"",'T',false,20);
IntMember ItemId = new IntMember("ItemId",id,10,"",'T',false,20);
StringMember SKU = new StringMember("SKU",sku,10,"",'T',false);
StringMember Description = new StringMember("Description",name,10,"",'T',false);
FloatMember Quantity = new FloatMember("Quantity",new Float(0.0f),10,"",'T',false,20);
FloatMember PriceEach = new FloatMember("PriceEach",new Float(0.0f),10,"",'T',false,20);
FloatMember PriceExtended = new FloatMember("PriceExtended",new Float(0.0f),10,"",'T',false,20);
FloatMember UnitTax = new FloatMember("UnitTax",new Float(0.0f),10,"",'T',false,20);
FloatMember TaxRate = new FloatMember("UnitTaxrate",new Float(0.0f),10,"",'T',false,20);
FloatMember OrderQuantity = new FloatMember("OrderQuantity",new Float(0.0f),10,"",'T',false,20);
FloatMember PendingQuantity = new FloatMember("PendingQuantity",new Float(0.0f),10,"",'T',false,20);
IntMember Value = new IntMember("Value",0,10,"",'T',false,20);
StringMember Type = new StringMember("Type",type,10,"",'T',false);
FloatMember DiscountedPrice = new FloatMember("DiscountedPrice",new Float(0.0f),10,"",'T',false,20);
FloatMember price = new FloatMember( "Price" ,new Float(dprice) , 10 , "", 'T' , false , 10 );
FloatMember cost = new FloatMember( "Cost" ,new Float(dcost) , 10 , "", 'T' , false , 10 );