/* * 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 gets subReportType for CumulativeBudgetLARateBase by * BudgetPeriod for RateClassType LAB_ALLOCATION */ private SubReportType getCumulativeBudgetLARateBase() { SubReportType subReportType = SubReportType.Factory.newInstance(); String rateClassType = RateClassType.LAB_ALLOCATION.getRateClassType(); List<ReportTypeVO> tempReportTypeVOList = new ArrayList<ReportTypeVO>(); Map<String, ReportType> reportTypeMap = new HashMap<String, ReportType>(); for (BudgetPeriod budgetPeriod : budget.getBudgetPeriods()) { for (BudgetLineItem budgetLineItem : budgetPeriod.getBudgetLineItems()) { setBudgetPersRateAndBaseListForBudgetLARateAndBase(tempReportTypeVOList, budgetLineItem); if (!isBudgetCategoryPersonnel(budgetLineItem)) { setBudgetRateAndBaseListForBudgetLARateAndBase(tempReportTypeVOList, budgetLineItem); } } } setReportTypeMapFromReportTypeVOList(tempReportTypeVOList, reportTypeMap); List<ReportType> reportTypeList = new ArrayList<ReportType>(reportTypeMap.values()); subReportType.setGroupArray(getGroupsType(reportTypeList, rateClassRateType)); return subReportType; }