use of org.mifos.accounting.struts.actionform.OpenBalanceActionForm in project head by mifos.
the class OpenBalanceAction method loadOpenBalance.
public ActionForward loadOpenBalance(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
OpenBalanceActionForm actionForm = (OpenBalanceActionForm) form;
GlBalancesBO balancesBO = accountingServiceFacade.loadExistedGlBalancesBO(new Integer(actionForm.getOfficeHierarchy()), actionForm.getOffice(), actionForm.getCoaName(), new Integer(actionForm.getFinancialYearId()));
if (balancesBO != null) {
BigDecimal openBalance = balancesBO.getOpeningBalance();
if (openBalance.compareTo(new BigDecimal(0.0)) < 0)
actionForm.setAmountAction("-");
else
actionForm.setAmountAction("+");
actionForm.setOpenBalance(openBalance.abs().toString());
}
return mapping.findForward(ActionForwards.load_success.toString());
}
use of org.mifos.accounting.struts.actionform.OpenBalanceActionForm in project head by mifos.
the class OpenBalanceAction method submit.
public ActionForward submit(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
OpenBalanceActionForm actionForm = (OpenBalanceActionForm) form;
UserContext context = getUserContext(request);
//
GlBalancesBO glBalancesBO = new GlBalancesBO();
String finacialYearId = (String) (actionForm.getFinancialYearId() == "" ? "0" : actionForm.getFinancialYearId());
glBalancesBO.setFinancialYearBO(accountingServiceFacade.getFinancialYearBO(new Integer(finacialYearId)));
glBalancesBO.setCreatedBy(context.getId());
glBalancesBO.setCreatedDate(DateUtils.getCurrentDateWithoutTimeStamp());
glBalancesBO.setOfficeLevel(new Integer(actionForm.getOfficeHierarchy()));
glBalancesBO.setOfficeId(actionForm.getOffice());
glBalancesBO.setGlCodeValue(actionForm.getCoaName());
glBalancesBO.setOpeningBalance(new BigDecimal(actionForm.getAmountAction() + actionForm.getOpenBalance()));
glBalancesBO.setClosingBalance(new BigDecimal(actionForm.getAmountAction() + actionForm.getOpenBalance()));
glBalancesBO.setTransactionDebitSum(new BigDecimal(0.0));
glBalancesBO.setTransactionCreditSum(new BigDecimal(0.0));
accountingServiceFacade.savingOpeningBalances(glBalancesBO);
return mapping.findForward("submit_success");
}
use of org.mifos.accounting.struts.actionform.OpenBalanceActionForm in project head by mifos.
the class OpenBalanceAction method load.
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
OpenBalanceActionForm actionForm = (OpenBalanceActionForm) form;
FinancialYearBO financialYearBO = accountingServiceFacade.getFinancialYear();
actionForm.setFinancialYear(DateUtils.format(financialYearBO.getFinancialYearStartDate()) + "-" + DateUtils.format(financialYearBO.getFinancialYearEndDate()));
actionForm.setFinancialYearId(new Integer(financialYearBO.getFinancialYearId()).toString());
List<GLCodeDto> accountingDtos = accountingServiceFacade.findTotalGlAccounts();
storingSession(request, "TotalGlCodes", accountingDtos);
return mapping.findForward(ActionForwards.load_success.toString());
}
use of org.mifos.accounting.struts.actionform.OpenBalanceActionForm in project head by mifos.
the class OpenBalanceAction method preview.
public ActionForward preview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
OpenBalanceActionForm actionForm = (OpenBalanceActionForm) form;
storingSession(request, "OpenBalanceActionForm", actionForm);
return mapping.findForward(ActionForwards.preview_success.toString());
}
use of org.mifos.accounting.struts.actionform.OpenBalanceActionForm in project head by mifos.
the class OpenBalanceAction method loadOffices.
public ActionForward loadOffices(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
OpenBalanceActionForm actionForm = (OpenBalanceActionForm) form;
List<OfficeGlobalDto> officeDetailsDtos = null;
if (actionForm.getOfficeHierarchy().equals("")) {
officeDetailsDtos = null;
} else if (actionForm.getOfficeHierarchy().equals("6")) {
officeDetailsDtos = accountingServiceFacade.loadCustomerForLevel(new Short("3"));
} else if (actionForm.getOfficeHierarchy().equals("7")) {
officeDetailsDtos = accountingServiceFacade.loadCustomerForLevel(new Short("2"));
} else {
officeDetailsDtos = accountingServiceFacade.loadOfficesForLevel(Short.valueOf(actionForm.getOfficeHierarchy()));
}
storingSession(request, "OfficesOnHierarchy", officeDetailsDtos);
return mapping.findForward(ActionForwards.load_success.toString());
}
Aggregations