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());
}
Aggregations