Search in sources :

Example 1 with ProcessAccountingTransactionsActionForm

use of org.mifos.accounting.struts.actionform.ProcessAccountingTransactionsActionForm in project head by mifos.

the class ProcessAccountingTransactionsAction method process.

public ActionForward process(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    /*ProcessAccountingTransactionsActionForm actionForm = (ProcessAccountingTransactionsActionForm) form;
		accountingServiceFacade.processMisPostings(
				DateUtils.getDate(actionForm.getLastProcessDate()),
				DateUtils.getDate(actionForm.getProcessTillDate()),getUserContext(request).getId());
		actionForm.setLastProcessDate(accountingServiceFacade
				.getLastProcessDate());
		storingSession(request, "ProcessAccountingTransactionsActionForm", actionForm);*/
    ProcessAccountingTransactionsActionForm actionForm = (ProcessAccountingTransactionsActionForm) form;
    UserContext userContext = getUserContext(request);
    monthClosingServiceFacade.validateTransactionDate(DateUtils.getDate(actionForm.getProcessTillDate()));
    accountingServiceFacade.processMisPostings(DateUtils.getDate(actionForm.getLastProcessDate()), DateUtils.getDate(actionForm.getProcessTillDate()), getUserContext(request).getId(), actionForm.getOffice());
    /*
		 * actionForm.setLastProcessDate(accountingServiceFacade
		 * .getLastProcessDate());
		 */
    actionForm.setLastProcessDate(accountingServiceFacade.getLastProcessUpdatedDate(actionForm.getOffice()));
    storingSession(request, "ProcessAccountingTransactionsActionForm", actionForm);
    return mapping.findForward("submit_success");
}
Also used : UserContext(org.mifos.security.util.UserContext) ProcessAccountingTransactionsActionForm(org.mifos.accounting.struts.actionform.ProcessAccountingTransactionsActionForm)

Example 2 with ProcessAccountingTransactionsActionForm

use of org.mifos.accounting.struts.actionform.ProcessAccountingTransactionsActionForm in project head by mifos.

the class ProcessAccountingTransactionsAction method loadLastUpdatedDate.

public ActionForward loadLastUpdatedDate(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ProcessAccountingTransactionsActionForm actionForm = (ProcessAccountingTransactionsActionForm) form;
    actionForm.setLastProcessDate(accountingServiceFacade.getLastProcessUpdatedDate(actionForm.getOffice()));
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : ProcessAccountingTransactionsActionForm(org.mifos.accounting.struts.actionform.ProcessAccountingTransactionsActionForm)

Example 3 with ProcessAccountingTransactionsActionForm

use of org.mifos.accounting.struts.actionform.ProcessAccountingTransactionsActionForm in project head by mifos.

the class ProcessAccountingTransactionsAction method load.

public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ProcessAccountingTransactionsActionForm actionForm = (ProcessAccountingTransactionsActionForm) form;
    UserContext context = getUserContext(request);
    actionForm.setOfficeLevelId(String.valueOf(context.getOfficeLevelId()));
    actionForm.setOffice("");
    List<OfficesList> offices = new ArrayList<OfficesList>();
    List<DynamicOfficeDto> listOfOffices = null;
    listOfOffices = accountingServiceFacade.getOfficeDetails(String.valueOf(context.getBranchId()), String.valueOf(context.getOfficeLevelId()));
    OfficesList officesList = null;
    OfficeGlobalDto officeGlobalDto = null;
    for (DynamicOfficeDto officeDto : listOfOffices) {
        if (officeDto.getOfficeLevelId() == 5) {
            officesList = new OfficesList(officeDto.getOfficeId(), officeDto.displayName, officeDto.officeLevelId, officeDto.globalOfficeNumber);
            offices.add(officesList);
        }
    }
    if ("1".equals(String.valueOf(getUserContext(request).getOfficeLevelId()))) {
        storingSession(request, "officeLevelId", actionForm.getOfficeLevelId());
        storingSession(request, "DynamicOfficesOnHierarchy", offices);
    } else if ("5".equals(String.valueOf(getUserContext(request).getOfficeLevelId()))) {
        if (offices.size() > 0 && (offices.get(0) != null)) {
            officeGlobalDto = new OfficeGlobalDto(offices.get(0).globalOfficeNumber, offices.get(0).displayName);
        }
        actionForm.setOffice(offices.get(0).globalOfficeNumber);
        storingSession(request, "officeLevelId", actionForm.getOfficeLevelId());
        storingSession(request, "DynamicOfficesOnHierarchy", officeGlobalDto);
        actionForm.setLastProcessDate(accountingServiceFacade.getLastProcessUpdatedDate(getUserContext(request).getBranchGlobalNum()));
    } else {
        storingSession(request, "DynamicOfficesOnHierarchy", offices);
    }
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : OfficeGlobalDto(org.mifos.dto.domain.OfficeGlobalDto) OfficesList(org.mifos.dto.domain.OfficesList) UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) DynamicOfficeDto(org.mifos.dto.domain.DynamicOfficeDto) ProcessAccountingTransactionsActionForm(org.mifos.accounting.struts.actionform.ProcessAccountingTransactionsActionForm)

Aggregations

ProcessAccountingTransactionsActionForm (org.mifos.accounting.struts.actionform.ProcessAccountingTransactionsActionForm)3 UserContext (org.mifos.security.util.UserContext)2 ArrayList (java.util.ArrayList)1 DynamicOfficeDto (org.mifos.dto.domain.DynamicOfficeDto)1 OfficeGlobalDto (org.mifos.dto.domain.OfficeGlobalDto)1 OfficesList (org.mifos.dto.domain.OfficesList)1