/**
  * This method will return the budget data periods for calculated amounts.It checks rate type code
  * ,rate class code against list of Budget LineItem Calculated Amounts for each budget line item
  * of each budget period of budget ,if it is equals then add calculated cost of budget LineItem
  * Calculated Amount to period cost.
  *
  * @param rateClassCode
  * @param rateTypeCode
  * @return list of BudgetDataPeriod VO's
  */
 protected List<BudgetDataPeriodVO> getBudgetDataPeriodsForCalculatedAmounts(
     String rateClassCode, String rateTypeCode, boolean includeNonPersonnel) {
   List<BudgetDataPeriodVO> budgetPeriodDataList = new ArrayList<BudgetDataPeriodVO>();
   int budgetPeriodDataId = 0;
   for (BudgetPeriod budgetPeriod : budget.getBudgetPeriods()) {
     BudgetDataPeriodVO budgetPeriodVO = new BudgetDataPeriodVO();
     budgetPeriodVO.setBudgetPeriodId(++budgetPeriodDataId);
     ScaleTwoDecimal periodCost = ScaleTwoDecimal.ZERO;
     for (BudgetLineItem budgetLineItem : budgetPeriod.getBudgetLineItems()) {
       String budgetCategoryType = getBudgetCategoryTypeCode(budgetLineItem);
       if (includeNonPersonnel || isPersonnel(budgetCategoryType)) {
         for (BudgetLineItemCalculatedAmount budgetLineItemCalcAmount :
             budgetLineItem.getBudgetLineItemCalculatedAmounts()) {
           if (budgetLineItemCalcAmount.getRateClassCode() != null
               && budgetLineItemCalcAmount.getRateClassCode().equals(rateClassCode)
               && budgetLineItemCalcAmount.getRateTypeCode() != null
               && budgetLineItemCalcAmount.getRateTypeCode().equals(rateTypeCode)) {
             periodCost = periodCost.add(budgetLineItemCalcAmount.getCalculatedCost());
           }
         }
       }
     }
     budgetPeriodVO.setPeriodCost(periodCost);
     budgetPeriodDataList.add(budgetPeriodVO);
   }
   return budgetPeriodDataList;
 }
示例#2
0
 private List<BudgetDataPeriodVO> getBudgetPeriodData(List<ScaleTwoDecimal> costs) {
   List<BudgetDataPeriodVO> budgetDataList = new ArrayList<BudgetDataPeriodVO>();
   int budgetPeriodId = 1;
   for (ScaleTwoDecimal cost : costs) {
     BudgetDataPeriodVO periodData = new BudgetDataPeriodVO();
     periodData.setBudgetPeriodId(budgetPeriodId++);
     periodData.setPeriodCost(cost);
     budgetDataList.add(periodData);
   }
   return budgetDataList;
 }
 /*
  * This method will get the budget data periods . For a given cost element
  * description from budget get list of budget periods , iterate over budget
  * periods and get list of budget line items ,iterate over budget line items
  * compare with the cost element description which ever matches add line
  * item cost to period cost.finally set period cost to BudgetDataPeriodVO
  *
  */
 private List<BudgetDataPeriodVO> getBudgetDataPeriodVOsForCostElement(String costElementDesc) {
   List<BudgetDataPeriodVO> budgetPeriodDataList = new ArrayList<BudgetDataPeriodVO>();
   int budgetPeriodDataId = 0;
   for (BudgetPeriod budgetPeriod : budget.getBudgetPeriods()) {
     BudgetDataPeriodVO budgetDataPeriodVO = new BudgetDataPeriodVO();
     budgetDataPeriodVO.setBudgetPeriodId(++budgetPeriodDataId);
     ScaleTwoDecimal periodCost = ScaleTwoDecimal.ZERO;
     for (BudgetLineItem lineItem : budgetPeriod.getBudgetLineItems()) {
       if (lineItem.getCostElementBO() != null
           && lineItem.getCostElementBO().getDescription() != null
           && lineItem.getCostElementBO().getDescription().equals(costElementDesc)) {
         periodCost = periodCost.add(lineItem.getLineItemCost());
       }
     }
     budgetDataPeriodVO.setPeriodCost(periodCost);
     budgetPeriodDataList.add(budgetDataPeriodVO);
   }
   return budgetPeriodDataList;
 }