Search in sources :

Example 1 with CoaBranchBO

use of org.mifos.application.accounting.business.CoaBranchBO in project head by mifos.

the class CoaBranchMappingAction method submit.

public ActionForward submit(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    CoaBranchMappingActionForm coaBranchMappingActionForm = (CoaBranchMappingActionForm) form;
    List<GLCodeDto> glcodelist = new ArrayList<GLCodeDto>();
    List<GLCodeDto> accountingglnames = accountingServiceFacade.coaBranchAccountHead();
    int accinggl = accountingServiceFacade.deleteGlobalNumRelatedCoaNames(coaBranchMappingActionForm.getBranchoffice());
    List<OfficeGlobalDto> officeDetailsDtos = null;
    short branches = 5;
    officeDetailsDtos = accountingServiceFacade.loadOfficesForLevel(branches);
    List<Integer> glcodeint = new ArrayList<Integer>();
    CoaBranchBO coabranchbo = null;
    if (coaBranchMappingActionForm.getBranchoffice().equalsIgnoreCase("All")) {
        for (String glname : coaBranchMappingActionForm.getCoaBranchMainHeadglcode()) {
            String glcode = glname;
            for (GLCodeDto accountinggln : accountingglnames) {
                if (accountinggln.getGlcode().equalsIgnoreCase(glcode)) {
                    for (OfficeGlobalDto officeGlobalDto : officeDetailsDtos) {
                        coabranchbo = new CoaBranchBO();
                        coabranchbo.setCoaname(accountinggln.getGlname());
                        coabranchbo.setGlcode(accountinggln.getGlcode());
                        coabranchbo.setGlobalofficenum(officeGlobalDto.getGlobalOfficeNum());
                        accountingServiceFacade.savingCoaBranchTransactions(coabranchbo);
                    }
                }
            }
        }
    } else {
        for (String glname : coaBranchMappingActionForm.getCoaBranchMainHeadglcode()) {
            String glcode = glname;
            for (GLCodeDto accountinggln : accountingglnames) {
                if (accountinggln.getGlcode().equalsIgnoreCase(glcode)) {
                    coabranchbo = new CoaBranchBO();
                    coabranchbo.setCoaname(accountinggln.getGlname());
                    coabranchbo.setGlcode(accountinggln.getGlcode());
                    coabranchbo.setGlobalofficenum(coaBranchMappingActionForm.getBranchoffice());
                    accountingServiceFacade.savingCoaBranchTransactions(coabranchbo);
                }
            }
        }
    }
    List<GLCodeDto> coabranchvalues = accountingServiceFacade.loadCoaBranchNames(coaBranchMappingActionForm.getBranchoffice());
    List<GLCodeDto> accountingDtos = null;
    CoaBranchMappingActionForm acti = (CoaBranchMappingActionForm) form;
    accountingDtos = accountingServiceFacade.coaBranchAccountHead();
    List<GLCodeDto> emptyaccountingDtos = new ArrayList<GLCodeDto>();
    storingSession(request, "CoaNamesList", accountingDtos);
    storingSession(request, "emptycoanames", coabranchvalues);
    return mapping.findForward(ActionForwards.submit_success.toString());
}
Also used : OfficeGlobalDto(org.mifos.dto.domain.OfficeGlobalDto) GLCodeDto(org.mifos.dto.domain.GLCodeDto) CoaBranchBO(org.mifos.application.accounting.business.CoaBranchBO) ArrayList(java.util.ArrayList) CoaBranchMappingActionForm(org.mifos.accounting.struts.actionform.CoaBranchMappingActionForm)

Aggregations

ArrayList (java.util.ArrayList)1 CoaBranchMappingActionForm (org.mifos.accounting.struts.actionform.CoaBranchMappingActionForm)1 CoaBranchBO (org.mifos.application.accounting.business.CoaBranchBO)1 GLCodeDto (org.mifos.dto.domain.GLCodeDto)1 OfficeGlobalDto (org.mifos.dto.domain.OfficeGlobalDto)1