private void setupDropdownsInHeader() { EgovMasterDataCaching masterCache = EgovMasterDataCaching.getInstance(); setupDropdownDataExcluding(Constants.SUB_SCHEME); dropdownData.put("budgetGroupList", masterCache.get("egf-budgetGroup")); dropdownData.put("executingDepartmentList", masterCache.get("egi-department")); addDropdownData("financialYearList", budgetService.getFYForNonApprovedBudgets()); List<String> isbereList = new ArrayList<String>(); isbereList.add("BE"); isbereList.add("RE"); dropdownData.put("isbereList", isbereList); }
@ValidationErrorPage(value = "form") public String generateReport() { showResults = true; CFinancialYear finYear = budgetService .find("from Budget where id=?", budgetDetail.getBudget().getId()) .getFinancialYear(); List<BudgetDetail> currentYearBeList = new ArrayList<BudgetDetail>(); List<BudgetDetail> nextYearBeList = new ArrayList<BudgetDetail>(); List<BudgetDetail> lastYearBe = new ArrayList<BudgetDetail>(); List<BudgetDetail> lastYearRe = new ArrayList<BudgetDetail>(); Budget b = budgetService.findById(budgetDetail.getBudget().getId(), false); if ("BE".equalsIgnoreCase(b.getIsbere())) { CFinancialYear previousYear = budgetDetailHelper.getPreviousYearFor(finYear); if (previousYear != null) { lastYearBe = budgetDetailService.findAllBy( "from BudgetDetail where budget.financialYear.id=? and budget.isPrimaryBudget=1 and " + "budget.isActiveBudget=1 and budget.isbere='BE'", previousYear.getId()); lastYearRe = budgetDetailService.findAllBy( "from BudgetDetail where budget.financialYear.id=? and budget.isPrimaryBudget=1 and " + "budget.isActiveBudget=1 and budget.isbere='RE'", previousYear.getId()); } } else { nextYearBeList = populateNextYearBe(finYear); } List<BudgetDetail> results = budgetDetailService.findAllBudgetDetailsForParent( budgetDetail.getBudget(), budgetDetail, persistenceService); for (BudgetDetail detail : results) { BudgetReportView view = new BudgetReportView(); view.setId(detail.getId()); view.setDepartmentCode(detail.getExecutingDepartment().getCode()); view.setFunctionCode(detail.getFunction().getCode()); view.setBudgetGroupName(detail.getBudgetGroup().getName()); if ("BE".equalsIgnoreCase(detail.getBudget().getIsbere())) { view.setBeNextYearApproved(detail.getApprovedAmount()); view.setBeNextYearOriginal(detail.getOriginalAmount()); for (BudgetDetail budgetDetail : lastYearBe) { if (compareDetails(budgetDetail, detail)) { view.setBeCurrentYearApproved(budgetDetail.getApprovedAmount()); } } for (BudgetDetail budgetDetail : lastYearRe) { if (compareDetails(budgetDetail, detail)) { view.setReCurrentYearApproved(budgetDetail.getApprovedAmount()); view.setReCurrentYearOriginal(budgetDetail.getOriginalAmount()); } } } else { view.setReCurrentYearApproved(detail.getApprovedAmount()); view.setReCurrentYearOriginal(detail.getOriginalAmount()); currentYearBeList = populateCurrentYearBe(); for (BudgetDetail budgetDetail : currentYearBeList) { if (compareDetails(budgetDetail, detail)) { view.setBeCurrentYearApproved(budgetDetail.getApprovedAmount()); } } } for (BudgetDetail nextYear : nextYearBeList) { if (compareDetails(nextYear, detail)) { view.setBeNextYearApproved(nextYear.getApprovedAmount()); view.setBeNextYearOriginal(nextYear.getOriginalAmount()); } } budgetDetailsList.add(view); } populatePreviousYearActuals(results, budgetDetail.getBudget().getFinancialYear()); ajaxLoadBudgets(); populateYearRange(); canViewREApprovedAmount = canViewApprovedAmount(budgetDetail.getBudget()); canViewBEApprovedAmount = canViewApprovedAmount(budgetService.getReferenceBudgetFor(budgetDetail.getBudget())); return "form"; }