Collection col = dl.executeQuery();
if (col != null)
{
HrExpenseLines hrexpenseLines= new HrExpenseLines();
Iterator it = col.iterator();
int count = 1;
while (it.hasNext())
{
HashMap hm =(HashMap)it.next();
Iterator stemp = hm.keySet().iterator();
Long tmp;
//LineID
tmp = (Long)(hm.get("LineID"));
IntMember LineId = new IntMember("LineID",tmp.intValue(),'D',"",'T',false,20);
//ExpenseItemID
tmp = (Long)(hm.get("ExpenseItemID"));
IntMember ItemId = new IntMember("ExpenseItemID",tmp.intValue(),'D',"",'T',false,20);
//Quantity
tmp = (Long)(hm.get("Quantity"));
FloatMember Quantity = new FloatMember("Quantity",new Float(tmp.floatValue()),'D',"",'T',false,20);
//Price
Double doubleTmp = new Double(hm.get("Price").toString());
FloatMember PriceEach = new FloatMember("Price",new Float(doubleTmp.floatValue()),'D',"",'T',false,20);
//priceextended
doubleTmp = (Double)(hm.get("priceextended"));
FloatMember PriceExtended = new FloatMember("PriceExtended",new Float(doubleTmp.floatValue()),'D',"",'T',false,20);
//project
Long project = (Long)(hm.get("Project"));
IntMember ProjectId = new IntMember("Project",project.intValue(),'D',"",'T',false,20);
//ticket
Long ticket = (Long)(hm.get("Ticket"));
IntMember TicketId = new IntMember("Ticket",project.intValue(),'D',"",'T',false,20);
//opportunity
Long Opportunity = (Long)(hm.get("Opportunity"));
IntMember OpportunityId = new IntMember("Opportunity",project.intValue(),'D',"",'T',false,20);
//sku
StringMember SKU = new StringMember("SKU",(String)(hm.get("SKU")),'D',"",'T',false);
//expenseitem.Description
StringMember Description = new StringMember("Description",(String)(hm.get("Description")),'D',"",'T',false);
IntMember typeID = null;
IntMember ReferenceID = null;
if((project.intValue()) != 0)
{
typeID = new IntMember("TypeId", 2 ,'D',"",'T',false,20);
ReferenceID = new IntMember("ReferenceID",project.intValue(),'D',"",'T',false,20);
}
else if ((ticket.intValue()) !=0)
{
typeID = new IntMember("TypeId", 1 ,'D',"",'T',false,20);
ReferenceID = new IntMember("ReferenceID",ticket.intValue(),'D',"",'T',false,20);
}
else if ((Opportunity.intValue()) != 0)
{
typeID = new IntMember("TypeId", 3 ,'D',"",'T',false,20);
ReferenceID = new IntMember("ReferenceID",Opportunity.intValue(),'D',"",'T',false,20);
}
else
{
typeID = new IntMember("TypeId", 4 ,'D',"",'T',false,20);
ReferenceID = new IntMember("ReferenceID",0,'D',"",'T',false,20);
}
//ExpenseFormID
Integer expenseformid = (Integer)(hm.get("ExpenseFormID"));
IntMember ExpenseFormID = new IntMember("ExpenseFormID",expenseformid.intValue(),'D',"",'T',false,20);
//ExpenseID
Long expenseid = (Long)(hm.get("ExpenseID"));
IntMember ExpenseID = new IntMember("ExpenseID",expenseid.intValue(),'D',"",'T',false,20);
//referenceId
//Long referenceid = (Long)(hm.get("ReferenceId"));
//IntMember ReferenceID = new IntMember("ReferenceID",referenceid.intValue(),'D',"",'T',false,20);
//expense.Description reference
StringMember reference = new StringMember("reference",(String)(hm.get("reference")),'D',"",'T',false);
//Amount
Double amount = new Double(hm.get("Amount").toString());
FloatMember Amount = new FloatMember("Amount",new Float(amount.floatValue()),'D',"",'T',false,20);
HrExpenseLineElement ie = new HrExpenseLineElement(11);
ie.put ("LineId",LineId);
ie.put ("ExpenseFormID",ExpenseFormID);
ie.put ("ExpenseID",ExpenseID);
ie.put ("ExpenseItemID",ItemId);
ie.put ("SKU",SKU);
ie.put ("Description",Description);
ie.put ("Reference",reference);
ie.put ("Quantity",Quantity);
ie.put ("PriceEach",PriceEach);
ie.put ("ReferenceType",typeID);
ie.put ("ReferenceId",ReferenceID);
ie.put ("PriceExtended",PriceExtended);
ie.put ("Amount",Amount);
ie.setLineStatus((String)(hm.get("linestatus")));
//ie.put ("UnitTax",UnitTax);
//ie.put ("UnitTaxrate",TaxRate);
//ie.put ("OrderQuantity",OrderQuantity);
//ie.put ("PendingQuantity",PendingQuantity);
//cw hrexpenseLines.put(""+count,ie);
hrexpenseLines.put(new Integer(count),ie);
count ++;
}
this.expenseFormVO.setHrExpenseLines(hrexpenseLines);
}// end of if
}