if (request.getParameter("buttonpress") != null)
typeOfSave = request.getParameter("buttonpress");
AccountFacade remote =(AccountFacade)accountFacadeHome.create();
remote.setDataSource(dataSource);
InvoiceForm invoiceForm = (InvoiceForm) form;
InvoiceVOX vox = new InvoiceVOX(invoiceForm);
InvoiceVO invoiceVO = vox.getVO();
int jurisdictionID = 0;
int billingAddressID = 0;
if(invoiceForm.getJurisdictionID() != null && !((invoiceForm.getJurisdictionID()).equals(""))){
jurisdictionID = (invoiceForm.getJurisdictionID()).intValue();
}//end of if(invoiceForm.getJurisdictionID() != null && !((invoiceForm.getJurisdictionID()).equals("")))
if(invoiceForm.getBilltoID() != null && !((invoiceForm.getBilltoID()).equals(""))){
billingAddressID = Integer.parseInt(invoiceForm.getBilltoID());
}//end of if(invoiceForm.getBilltoID() != null && !((invoiceForm.getBilltoID()).equals("")))
if(billingAddressID != 0 && jurisdictionID != 0){
remote.setJurisdictionForAddress(billingAddressID,jurisdictionID);
}//end of if(billingAddressID != 0 && jurisdictionID != 0)
invoiceVO = remote.createInvoice(invoiceVO,userId);
if (typeOfSave.equals("save"))
{
FORWARD_final = FORWARD_save;
int invoiceid = invoiceVO.getInvoiceId();//getInvoiceId
InvoiceForm newinvoiceform=new InvoiceForm();
newinvoiceform.setInvoiceid(invoiceVO.getInvoiceId()+"");
newinvoiceform.setOrderid(invoiceVO.getOrderId()+"");
newinvoiceform.setCustomerId(invoiceVO.getCustomerId()+"");
newinvoiceform.setBillto(invoiceVO.getBillToAddress()+"");
newinvoiceform.setBilltoID(invoiceVO.getBillToId()+"");
newinvoiceform.setShiptoID(invoiceVO.getShipToId()+"");
newinvoiceform.setShipto(invoiceVO.getShipToAddress()+"");
newinvoiceform.setStatusid(invoiceVO.getStatusId()+"");
newinvoiceform.setInvoiceDate(invoiceVO.getInvoiceDate());
newinvoiceform.setExternalid(invoiceVO.getExternalId());
newinvoiceform.setPoid(invoiceVO.getPo());
newinvoiceform.setTermid(invoiceVO.getTermId()+"");
newinvoiceform.setAccountmanagerid(invoiceVO.getAccountManagerId()+"");
newinvoiceform.setProjectid(invoiceVO.getProjectId()+"");
newinvoiceform.setNotes(invoiceVO.getDescription()+"");
newinvoiceform.setProjectName(invoiceVO.getProjectName());
newinvoiceform.setAccountmanagerName(invoiceVO.getAccountManagerName());
newinvoiceform.setItemLines(invoiceVO.getItemLines());
newinvoiceform.setOrdername(invoiceVO.getCustomerName());
java.sql.Date invDate = invoiceVO.getInvoiceDate();
if (invDate != null)
{
int month = invDate.getMonth();
month=month+1;
newinvoiceform.setMonth(month+"");
int date = invDate.getDate();
newinvoiceform.setDate(date+"");
int year= invDate.getYear();
newinvoiceform.setYear(year+"");
}// end of if (invDate != null)
request.setAttribute("newinvoiceform",newinvoiceform);
request.setAttribute(AccountConstantKeys.TYPEOFOPERATION, AccountConstantKeys.EDIT);
}// end of if (typeOfSave.equals("save"))
else if (typeOfSave.equals("savenew"))
{
Vector taxJurisdiction = remote.getTaxJurisdiction();
invoiceform.setJurisdictionVec(taxJurisdiction);
FORWARD_final = FORWARD_savenew;
request.setAttribute(AccountConstantKeys.TYPEOFOPERATION, AccountConstantKeys.ADD);
request.setAttribute("clearform", "true");