* @return boolean status of operation
*/
public boolean addInvoices(ArrayList IVOs, int indId)
{
InvoiceVO ivo = null;
AccountFacadeLocal invoiceL = null;
ContactHelperLocal chl = null;
try
{
InitialContext ic = CVUtility.getInitialContext();
AccountFacadeLocalHome home = (AccountFacadeLocalHome)ic.lookup("local/AccountFacade");
invoiceL = home.create();
invoiceL.setDataSource(this.dataSource);
ContactHelperLocalHome chlh = (ContactHelperLocalHome) ic.lookup("local/ContactHelper");
chl = chlh.create();
OrderForm of = new OrderForm();
int primAddId = 0;
for ( int i=0;i<IVOs.size();i++)
{
ivo = (InvoiceVO) IVOs.get(i);
if (ivo.getDescription()== null)
ivo.setDescription("");
of.setItemLines(ivo.getItemLines());
of.setCustomerIdValue(ivo.getCustomerId());
primAddId = ((AddressVO)chl.getPrimaryAddressForContact(indId,ivo.getCustomerId(),1)).getAddressID();
of.setBillToAddIdValue(primAddId);
of.setShipToAddIdValue(1);
of.setOrderDate(ivo.getInvoiceDate());
of.setInvoiceIsGenerated(true);
of = invoiceL.createOrder(of,indId);
ivo.setOrderId(of.getOrderIdValue());
ivo.setBillToId(primAddId);
invoiceL.createInvoice(ivo,indId);
logger.info("Added " +/* ivo.getInvoiceId()*/ 1+ " invoice record");
}
}catch(Exception e)
{
logger.debug("Error in adding Invoices : "+e);