// String expenseFormIDString =(String)hrexpenseForm.getExpenseFormID();
expenseFormID = hrexpenseForm.getExpenseFormID();
//get("expenseFormID");
}
ExpenseFormVO expenseformVo = null;
//Put all item to ItemLines
if (expenseFormID == 0)
{
hrexpenseForm.convertItemLines();
}
ExpenseFormVOX vox = new ExpenseFormVOX(userobjectd, hrexpenseForm);
ExpenseFormVO expenseFormVO = vox.getVO();
HrFacadeHome hm = (HrFacadeHome)CVUtility.getHomeObject("com.centraview.hr.hrfacade.HrFacadeHome", "HrFacade");
HrFacade remote = (HrFacade)hm.create();
remote.setDataSource(dataSource);
if (expenseFormID > 0 && request.getParameter("DUPLICATE") != null)
{
hrexpenseForm.convertItemLines();
expenseFormVO = remote.createExpense(expenseFormVO, individualID);
hrexpenseForm.setExpenseFormID((new Integer(expenseFormVO.getExpenseFormID())).intValue());
//set("expenseFormID",(new Integer(expenseFormVO.getExpenseFormID())).toString());
java.sql.Timestamp date = expenseFormVO.getCreatedDate();
if (date != null)
{
hrexpenseForm.setCreatedDate(date.toString());
}
hrexpenseForm.setItemLines(expenseFormVO.getHrExpenseLines());
request.setAttribute("HrExpenseLines", expenseFormVO.getHrExpenseLines());
}
else if (expenseFormID > 0)
{
expenseFormVO.setExpenseFormID(expenseFormID);
remote.updateExpense(expenseFormVO, individualID);
expenseFormVO = remote.getExpenseFormVO(expenseFormID);
//Set all elements in form.
hrexpenseForm.setExpenseFormID(expenseFormID);
java.sql.Timestamp date = expenseFormVO.getCreatedDate();
//set values on hrexpenseForm
hrexpenseForm.setCreatedDate(date.toString());
//set("CreatedDate",dForm.format(date));
//expenseForm.setCreatedDate(date);
hrexpenseForm.setExpenseFormID(expenseFormID);
hrexpenseForm.setFormDescription(expenseFormVO.getDescription());
hrexpenseForm.setEmployee(expenseFormVO.getEmployee());
hrexpenseForm.setEmployeeID(expenseFormVO.getEmployeeId());
hrexpenseForm.setReportto(expenseFormVO.getReportingTo());
hrexpenseForm.setReporttoID(expenseFormVO.getReportingId());
hrexpenseForm.setStatus(expenseFormVO.getStatus());
hrexpenseForm.setNotes(expenseFormVO.getNotes());
if (expenseFormVO.getFrom() != null)
{
java.sql.Date fromDate = expenseFormVO.getFrom();
String sfromDate = fromDate.toString();
Vector fromDateSplitUp = getDate(sfromDate);
hrexpenseForm.setFromyear((String)fromDateSplitUp.get(0));
hrexpenseForm.setFrommonth((String)fromDateSplitUp.get(1));
hrexpenseForm.setFromday((String)fromDateSplitUp.get(2));
}
if (expenseFormVO.getTo() != null)
{
java.sql.Date toDate = expenseFormVO.getTo();
String stoDate = toDate.toString();
//String[] sTokenizedDate = getDate(stoDate);
Vector toDateSplitUp = getDate(stoDate);
hrexpenseForm.setToyear((String)toDateSplitUp.get(0));
hrexpenseForm.setTomonth((String)toDateSplitUp.get(1));
hrexpenseForm.setToday((String)toDateSplitUp.get(2));
}
hrexpenseForm.setItemLines(expenseFormVO.getHrExpenseLines());
// @@@@@COMMENNTED ON 30/10/03
//hrexpenseForm.setItemLines(expenseFormVO.getHrExpenseLines());
request.setAttribute("HrExpenseLines", expenseFormVO.getHrExpenseLines());
}
else if (expenseFormID == 0)
{
expenseFormVO = remote.createExpense(expenseFormVO, individualID);
hrexpenseForm.setExpenseFormID((new Integer(expenseFormVO.getExpenseFormID())).intValue());
//set("expenseFormID",(new Integer(expenseFormVO.getExpenseFormID())).toString());
java.sql.Timestamp date = expenseFormVO.getCreatedDate();
if (date != null)
{
hrexpenseForm.setCreatedDate(date.toString());
}
}
if (typeOfSave != null)
{
if (typeOfSave.equals("savenew") || typeOfSave.equals("saveandnew"))
{
// forward to jsp page
FORWARD_final = FORWARD_savenew;
request.setAttribute("body", "EDIT");
request.setAttribute("HrExpenseForm", new HrExpenseForm());
session.setAttribute("HrExpenseForm", new HrExpenseForm());
//changed now request.setAttribute("hrexpenseform",new HrExpenseForm());
}
if (typeOfSave.equals("saveandclose"))
{
// forward to jsp page
request.setAttribute("HrExpenseForm", hrexpenseForm);
session.setAttribute("HrExpenseForm", hrexpenseForm);
request.setAttribute("ExpenseFormVO", expenseFormVO);
session.setAttribute("ExpenseFormVO", expenseFormVO);
FORWARD_final = FORWARD_saveclose;
request.setAttribute("body", "list");
}
if (typeOfSave.equals("save"))
{
// forward to jsp page
FORWARD_final = FORWARD_save;
request.setAttribute("body", "EDIT");
if (expenseFormID > 0)
{
hrexpenseForm.setCreatedDate(expenseFormVO.getCreatedDate().toString());
//set("CreatedDate",(expenseFormVO.getCreatedDate()).toString());
}
session.setAttribute("HrExpenseForm", hrexpenseForm);
request.setAttribute("HrExpenseform", hrexpenseForm);
request.setAttribute("ExpenseFormVO", expenseFormVO);