Search in sources :

Example 1 with OpenBalanceActionForm

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());
}
Also used : OpenBalanceActionForm(org.mifos.accounting.struts.actionform.OpenBalanceActionForm) GlBalancesBO(org.mifos.application.accounting.business.GlBalancesBO) BigDecimal(java.math.BigDecimal)

Example 2 with OpenBalanceActionForm

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");
}
Also used : OpenBalanceActionForm(org.mifos.accounting.struts.actionform.OpenBalanceActionForm) UserContext(org.mifos.security.util.UserContext) GlBalancesBO(org.mifos.application.accounting.business.GlBalancesBO) BigDecimal(java.math.BigDecimal)

Example 3 with OpenBalanceActionForm

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());
}
Also used : GLCodeDto(org.mifos.dto.domain.GLCodeDto) OpenBalanceActionForm(org.mifos.accounting.struts.actionform.OpenBalanceActionForm) FinancialYearBO(org.mifos.application.accounting.business.FinancialYearBO)

Example 4 with OpenBalanceActionForm

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());
}
Also used : OpenBalanceActionForm(org.mifos.accounting.struts.actionform.OpenBalanceActionForm)

Example 5 with OpenBalanceActionForm

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());
}
Also used : OfficeGlobalDto(org.mifos.dto.domain.OfficeGlobalDto) OpenBalanceActionForm(org.mifos.accounting.struts.actionform.OpenBalanceActionForm)

Aggregations

OpenBalanceActionForm (org.mifos.accounting.struts.actionform.OpenBalanceActionForm)5 BigDecimal (java.math.BigDecimal)2 GlBalancesBO (org.mifos.application.accounting.business.GlBalancesBO)2 FinancialYearBO (org.mifos.application.accounting.business.FinancialYearBO)1 GLCodeDto (org.mifos.dto.domain.GLCodeDto)1 OfficeGlobalDto (org.mifos.dto.domain.OfficeGlobalDto)1 UserContext (org.mifos.security.util.UserContext)1