/* * This method get CumulativeBudgetLAExclusions for a BudgetPeriod. It first * check size of BudgetProposalLARates if it's it create ReportTypeList with * sortId 1,2,3,4 */ private SubReportType getCumulativeBudgetLAExclusions() { List<ReportType> reportTypeList = new ArrayList<ReportType>(); SubReportType subReportType = SubReportType.Factory.newInstance(); int sortId; String categoryDesc = null; ScaleTwoDecimal calculatedCost = ScaleTwoDecimal.ZERO; if (budget.getBudgetLaRates().size() > 0) { sortId = 1; categoryDesc = ALLOCATED_ADMINISTRATIVE_SUPPORT; calculatedCost = getCalculatedCostForBudgetExclusionsSortId1ForCumulativeReport(); ReportType reportTypeForSortId1 = getReportTypeForExclusions(sortId, categoryDesc, calculatedCost); reportTypeList.add(reportTypeForSortId1); sortId = 2; categoryDesc = TOTAL_EMPLOYEE_BENEFITS; calculatedCost = getCalculatedCostForBudgetLAExclusionsSortId2ForCumulativeReport(); ReportType reportTypeForSortId2 = getReportTypeForExclusions(sortId, categoryDesc, calculatedCost); reportTypeList.add(reportTypeForSortId2); setReportTypeForBudgetLAExclusionsSortId3ForCumulativeReport(reportTypeList); sortId = 4; categoryDesc = ALLOCATED_LAB_EXPENSE; calculatedCost = getCalculatedCostForBudgetExclusionsSortId4ForCumulativeReport(); ReportType reportTypeForSortId4 = getReportTypeForExclusions(sortId, categoryDesc, calculatedCost); if (calculatedCost.doubleValue() > 0.0d) { reportTypeList.add(reportTypeForSortId4); } } subReportType.setGroupArray(getGroupsType(reportTypeList)); return subReportType; }
/* * This method gets subReportType for BudgetCumulativeIDCForReport by * BudgetPeriod. It get the sum of calculatedCost based on BudgetLineItem * OnOffCampusFlag and RateClassType */ private SubReportType getBudgetCumulativeIDCForReport() { SubReportType subReportType = SubReportType.Factory.newInstance(); List<ReportType> reportTypeList = new ArrayList<ReportType>(); ScaleTwoDecimal calculatedCostForOn = ScaleTwoDecimal.ZERO; ScaleTwoDecimal calculatedCostForOff = ScaleTwoDecimal.ZERO; for (BudgetPeriod budgetPeriod : budget.getBudgetPeriods()) { for (BudgetLineItem budgetLineItem : budgetPeriod.getBudgetLineItems()) { if (budgetLineItem.getOnOffCampusFlag().booleanValue()) { calculatedCostForOn = calculatedCostForOn.add( getTotalCalculatedCostByRateClassTypeFromLineItem( RateClassType.OVERHEAD.getRateClassType(), budgetLineItem)); } else { calculatedCostForOff = calculatedCostForOff.add( getTotalCalculatedCostByRateClassTypeFromLineItem( RateClassType.OVERHEAD.getRateClassType(), budgetLineItem)); } } } if (!calculatedCostForOn.equals(ScaleTwoDecimal.ZERO)) { ReportType reportTypeForOn = getReportTypeForBudgetIndirectCostsForReport(Boolean.TRUE, calculatedCostForOn, null); reportTypeList.add(reportTypeForOn); } if (!calculatedCostForOff.equals(ScaleTwoDecimal.ZERO)) { ReportType reportTypeForOff = getReportTypeForBudgetIndirectCostsForReport(Boolean.FALSE, calculatedCostForOff, null); reportTypeList.add(reportTypeForOff); } subReportType.setGroupArray(getGroupsType(reportTypeList)); return subReportType; }
/* * This method set ReportType data to ReportTypeList for * BudgetCumulativeNonPersonnel */ private void setReportTypeForBudgetCumulativeNonPersonnel(List<ReportType> reportTypeList) { Map<String, ReportTypeVO> reportTypeMap = new HashMap<String, ReportTypeVO>(); List<ReportTypeVO> tempReportTypeVOList = new ArrayList<ReportTypeVO>(); for (BudgetPeriod budgetPeriod : budget.getBudgetPeriods()) { for (BudgetLineItem budgetLineItem : budgetPeriod.getBudgetLineItems()) { if (!isBudgetCategoryPersonnel(budgetLineItem)) { ReportTypeVO tempReportTypeVO = getReportTypeVOForBudgetCumulativeNonPersonnel(budgetLineItem); tempReportTypeVOList.add(tempReportTypeVO); } } } for (ReportTypeVO reportTypeVO : tempReportTypeVOList) { String cumulativeNonPersKey = reportTypeVO.getCostElementDesc(); if (reportTypeMap.containsKey(cumulativeNonPersKey)) { continue; } ScaleTwoDecimal calculatedCost = ScaleTwoDecimal.ZERO; for (ReportTypeVO reportTypeVO1 : tempReportTypeVOList) { String cumulativeNonPersTempKey = reportTypeVO1.getCostElementDesc(); if (cumulativeNonPersTempKey.equals(cumulativeNonPersKey)) { calculatedCost = calculatedCost.add(reportTypeVO1.getCalculatedCost()); } } ReportType reportType = getReportTypeForBudgetCumulativeNonPersonnel(calculatedCost, reportTypeVO); reportTypeMap.put(cumulativeNonPersKey, reportTypeVO); reportTypeList.add(reportType); } }
/* * This method gets SubreportType for BudgetCumulativeSummaryNonPersonnel * from List of BudgetLineItem by checking unitUmber */ private SubReportType getBudgetCumulativeSummaryNonPersonnel() { SubReportType subReportType = SubReportType.Factory.newInstance(); List<ReportType> reportTypeList = new ArrayList<ReportType>(); ScaleTwoDecimal calculatedCost = ScaleTwoDecimal.ZERO; String categoryDesc = OTHER_DIRECT_COSTS; String costElementDesc = ALLOCATED_LAB_EXPENSE; for (BudgetPeriod budgetPeriod : budget.getBudgetPeriods()) { this.budgetPeriod = budgetPeriod; if (getUnitNumber() > 0) { for (BudgetLineItem budgetLineItem : budgetPeriod.getBudgetLineItems()) { calculatedCost = calculatedCost.add( getTotalCalculatedCostByRateClassTypeFromLineItem( RateClassType.LAB_ALLOCATION.getRateClassType(), budgetLineItem)); } } } ReportType reportType = getReportTypeForNonPersonnel(categoryDesc, costElementDesc, calculatedCost, null); if (calculatedCost.doubleValue() > 0.0) { reportTypeList.add(reportType); } setReportTypeForBudgetCumulativeNonPersonnel(reportTypeList); Collections.sort( reportTypeList, new Comparator<ReportType>() { public int compare(ReportType reportType1, ReportType reportType2) { return reportType1 .getBudgetCategoryDescription() .compareTo(reportType2.getBudgetCategoryDescription()); } }); subReportType.setGroupArray(getGroupsType(reportTypeList, category)); return subReportType; }
/* * This method sets reportType For CumulativeBudgetSalary in reportTypeList * for a BudgetPeriod based on RateClassCode and RateTypeCode */ protected void setReportTypeForCumulativeBudgetSalary(List<ReportType> reportTypeList) { List<ReportTypeVO> reportTypeVOList = new ArrayList<ReportTypeVO>(); for (BudgetPeriod budgetPeriod : budget.getBudgetPeriods()) { reportTypeVOList.addAll(getReportTypeVOList(budgetPeriod)); } setReportTypeListFromReportTypeVoListForCumulativeBudgetSalary( reportTypeList, reportTypeVOList); }
/* * This method sets reportTypeVO to ReportTypeList for * CumulativeBudgetSalary by groping reportTypeVo based on * cumulativeBudgetSalaryKey and gets sum of fringe also get calculated * vacationRate, empBenefitRate */ private void setReportTypeListFromReportTypeVoListForCumulativeBudgetSalary( List<ReportType> reportTypeList, List<ReportTypeVO> reportTypeVOList) { Map<String, ReportTypeVO> reportTypeMap = new HashMap<String, ReportTypeVO>(); for (ReportTypeVO reportTypeVO : reportTypeVOList) { String cumulativeBudgetSalaryKey = getKeyForBudgetSalarySummary(reportTypeVO); if (reportTypeMap.containsKey(cumulativeBudgetSalaryKey)) { continue; } ScaleTwoDecimal vacationRate = ScaleTwoDecimal.ZERO; ScaleTwoDecimal empBenefitRate = ScaleTwoDecimal.ZERO; ScaleTwoDecimal fringe = ScaleTwoDecimal.ZERO; for (ReportTypeVO tempReportTypeVO : reportTypeVOList) { String cumulativeBudgetSalaryTempKey = getKeyForBudgetSalarySummary(tempReportTypeVO); if (cumulativeBudgetSalaryTempKey.equals(cumulativeBudgetSalaryKey)) { if (vacationRate.isLessThan(tempReportTypeVO.getVacationRate())) { vacationRate = tempReportTypeVO.getVacationRate(); } if (empBenefitRate.isLessThan(tempReportTypeVO.getEmployeeBenefitRate())) { empBenefitRate = tempReportTypeVO.getEmployeeBenefitRate(); } fringe = fringe.add(tempReportTypeVO.getFringe()); } } ReportType reportType = getReportTypeForCumulativeBudgetSalary( vacationRate, empBenefitRate, fringe, reportTypeVO); reportTypeMap.put(cumulativeBudgetSalaryKey, reportTypeVO); reportTypeList.add(reportType); } }