/* * This method gets reportTypeVO for BudgetCumulativeNonPersonnel by setting * parameters data to reportType */ private ReportTypeVO getReportTypeVOForBudgetCumulativeNonPersonnel( BudgetLineItem budgetLineItem) { ReportTypeVO reportTypeVO = new ReportTypeVO(); reportTypeVO.setBudgetCategoryDesc(budgetLineItem.getBudgetCategory().getDescription()); reportTypeVO.setCostElementDesc(getCostElementDescription(budgetLineItem)); reportTypeVO.setCalculatedCost(budgetLineItem.getLineItemCost()); return reportTypeVO; }
public BudgetPersonnelDetails(BudgetLineItem personnelBudgetSummaryLineItem) { initializeBudgetPersonnelDetails(); this.budgetLineItem = personnelBudgetSummaryLineItem; this.startDate = personnelBudgetSummaryLineItem.getStartDate(); this.endDate = personnelBudgetSummaryLineItem.getEndDate(); this.budgetPeriod = personnelBudgetSummaryLineItem.getBudgetPeriod(); this.budgetId = personnelBudgetSummaryLineItem.getBudgetId(); this.salaryRequested = personnelBudgetSummaryLineItem.getLineItemCost(); this.personSequenceNumber = BudgetConstants.BudgetPerson.SUMMARYPERSON.getPersonSequenceNumber(); this.personId = BudgetConstants.BudgetPerson.SUMMARYPERSON.getPersonId(); }
/* * 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; }
/** * In order to decrease or increase, the change amount is used, so this can be sent as is without * subtracting from previous budget. * * @return */ public HashMap<String, ScaleTwoDecimal> getNonPersonnelCost( Budget currentBudget, AwardBudgetExt previousBudget) { HashMap<String, ScaleTwoDecimal> netCost = new HashMap<String, ScaleTwoDecimal>(); // only do for one period, assume it is the first int period = currentBudget.getBudgetPeriods().size() - 1; List<BudgetLineItem> currentLineItems = currentBudget.getBudgetPeriods().get(period).getBudgetLineItems(); HashMap<String, ScaleTwoDecimal> currentLineItemCosts = new HashMap<String, ScaleTwoDecimal>(); for (BudgetLineItem currentLineItem : currentLineItems) { if (!StringUtils.equalsIgnoreCase( currentLineItem.getBudgetCategory().getBudgetCategoryTypeCode(), "P")) { currentLineItemCosts.put( currentLineItem.getCostElement(), currentLineItem.getLineItemCost()); } } return currentLineItemCosts; }
protected void assertExpectedResults(List<Map<String, ScaleTwoDecimal>> results) { int index = 0; for (BudgetPeriod period : budget.getBudgetPeriods()) { for (BudgetLineItem lineItem : period.getBudgetLineItems()) { Assert.assertEquals(subAward.getSubAwardNumber(), lineItem.getSubAwardNumber()); Assert.assertEquals( results.get(index).get(lineItem.getCostElement()), lineItem.getLineItemCost()); } for (Map.Entry<String, ScaleTwoDecimal> entry : results.get(index).entrySet()) { final List<BudgetLineItem> lineItemsByCostElement = findLineItemsByCostElement(period.getBudgetLineItems(), entry.getKey()); if (entry.getValue().isZero()) { Assert.assertTrue(lineItemsByCostElement.size() == 0); } else { Assert.assertEquals(entry.getValue(), lineItemsByCostElement.get(0).getLineItemCost()); } } index++; } }