001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.kfs.module.bc.document.service.impl; 017 018 import java.math.BigDecimal; 019 import java.util.ArrayList; 020 import java.util.Collection; 021 import java.util.HashMap; 022 import java.util.List; 023 import java.util.Map; 024 025 import org.apache.commons.lang.StringUtils; 026 import org.apache.ojb.broker.PersistenceBrokerException; 027 import org.kuali.kfs.module.bc.BCConstants; 028 import org.kuali.kfs.module.bc.BCKeyConstants; 029 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionAccountBalance; 030 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionOrgAccountObjectDetailReport; 031 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionOrgAccountObjectDetailReportTotal; 032 import org.kuali.kfs.module.bc.document.dataaccess.BudgetConstructionAccountObjectDetailReportDao; 033 import org.kuali.kfs.module.bc.document.service.BudgetConstructionAccountObjectDetailReportService; 034 import org.kuali.kfs.module.bc.document.service.BudgetConstructionOrganizationReportsService; 035 import org.kuali.kfs.module.bc.report.BudgetConstructionReportHelper; 036 import org.kuali.kfs.sys.KFSPropertyConstants; 037 import org.kuali.rice.kns.service.BusinessObjectService; 038 import org.kuali.rice.kns.service.KualiConfigurationService; 039 import org.springframework.transaction.annotation.Transactional; 040 041 /** 042 * Service implementation of BudgetConstructionAccountSummaryReportService. 043 */ 044 @Transactional 045 public class BudgetConstructionAccountObjectDetailReportServiceImpl implements BudgetConstructionAccountObjectDetailReportService { 046 047 private BudgetConstructionAccountObjectDetailReportDao budgetConstructionAccountObjectDetailReportDao; 048 private KualiConfigurationService kualiConfigurationService; 049 private BudgetConstructionOrganizationReportsService budgetConstructionOrganizationReportsService; 050 private BusinessObjectService businessObjectService; 051 052 /** 053 * @see org.kuali.kfs.module.bc.document.service.BudgetReportsControlListService#updateSubFundSummaryReport(java.lang.String) 054 */ 055 public void updateAccountObjectDetailReport(String principalName, boolean consolidated) { 056 if (consolidated) { 057 budgetConstructionAccountObjectDetailReportDao.updateReportsAccountObjectConsolidatedTable(principalName); 058 } 059 else { 060 budgetConstructionAccountObjectDetailReportDao.updateReportsAccountObjectDetailTable(principalName); 061 } 062 } 063 064 public Collection<BudgetConstructionOrgAccountObjectDetailReport> buildReports(Integer universityFiscalYear, String principalName, boolean consolidated) { 065 Collection<BudgetConstructionOrgAccountObjectDetailReport> reportSet = new ArrayList(); 066 Collection<BudgetConstructionAccountBalance> accountObjectDetailList; 067 068 // build searchCriteria 069 Map searchCriteria = new HashMap(); 070 searchCriteria.put(KFSPropertyConstants.KUALI_USER_PERSON_UNIVERSAL_IDENTIFIER, principalName); 071 072 // build order list 073 List<String> orderList = buildOrderByList(); 074 accountObjectDetailList = budgetConstructionOrganizationReportsService.getBySearchCriteriaOrderByList(BudgetConstructionAccountBalance.class, searchCriteria, orderList); 075 076 077 // BudgetConstructionReportHelper.deleteDuplicated((List) positionFundingDetailList, fieldsForSubFundTotal()) 078 List listForCalculateObject = BudgetConstructionReportHelper.deleteDuplicated((List) accountObjectDetailList, fieldsForObject()); 079 List listForCalculateLevel = BudgetConstructionReportHelper.deleteDuplicated((List) accountObjectDetailList, fieldsForLevel()); 080 List listForCalculateGexpAndType = BudgetConstructionReportHelper.deleteDuplicated((List) accountObjectDetailList, fieldsForGexpAndType()); 081 List listForCalculateAccountTotal = BudgetConstructionReportHelper.deleteDuplicated((List) accountObjectDetailList, fieldsForAccountTotal()); 082 List listForCalculateSubFundTotal = BudgetConstructionReportHelper.deleteDuplicated((List) accountObjectDetailList, fieldsForSubFundTotal()); 083 084 // Calculate Total Section 085 List<BudgetConstructionOrgAccountObjectDetailReportTotal> accountObjectDetailTotalObjectList; 086 List<BudgetConstructionOrgAccountObjectDetailReportTotal> accountObjectDetailTotalLevelList; 087 List<BudgetConstructionOrgAccountObjectDetailReportTotal> accountObjectDetailTotalGexpAndTypeList; 088 List<BudgetConstructionOrgAccountObjectDetailReportTotal> accountObjectDetailAccountTotalList; 089 List<BudgetConstructionOrgAccountObjectDetailReportTotal> accountObjectDetailSubFundTotalList; 090 091 accountObjectDetailTotalObjectList = calculateObjectTotal((List) accountObjectDetailList, listForCalculateObject); 092 accountObjectDetailTotalLevelList = calculateLevelTotal((List) accountObjectDetailList, listForCalculateLevel); 093 accountObjectDetailTotalGexpAndTypeList = calculateGexpAndTypeTotal((List) accountObjectDetailList, listForCalculateGexpAndType); 094 accountObjectDetailAccountTotalList = calculateAccountTotal((List) accountObjectDetailList, listForCalculateAccountTotal); 095 accountObjectDetailSubFundTotalList = calculateSubFundTotal((List) accountObjectDetailList, listForCalculateSubFundTotal); 096 097 for (BudgetConstructionAccountBalance accountObjectDetailEntry : accountObjectDetailList) { 098 BudgetConstructionOrgAccountObjectDetailReport accountObjectDetailReport = new BudgetConstructionOrgAccountObjectDetailReport(); 099 buildReportsHeader(universityFiscalYear, accountObjectDetailReport, accountObjectDetailEntry, consolidated); 100 buildReportsBody(universityFiscalYear, accountObjectDetailReport, accountObjectDetailEntry); 101 buildReportsTotal(accountObjectDetailReport, accountObjectDetailEntry, accountObjectDetailTotalObjectList, accountObjectDetailTotalLevelList, accountObjectDetailTotalGexpAndTypeList, accountObjectDetailAccountTotalList, accountObjectDetailSubFundTotalList); 102 reportSet.add(accountObjectDetailReport); 103 } 104 return reportSet; 105 } 106 107 108 /** 109 * builds report Header 110 * 111 * @param BudgetConstructionObjectSummary bcas 112 */ 113 protected void buildReportsHeader(Integer universityFiscalYear, BudgetConstructionOrgAccountObjectDetailReport orgAccountObjectDetailReportEntry, BudgetConstructionAccountBalance accountBalance, boolean consolidated) { 114 String orgChartDesc = accountBalance.getOrganizationChartOfAccounts().getFinChartOfAccountDescription(); 115 String chartDesc = accountBalance.getChartOfAccounts().getFinChartOfAccountDescription(); 116 String orgName = ""; 117 try { 118 orgName = accountBalance.getOrganization().getOrganizationName(); 119 } 120 catch (PersistenceBrokerException e) { 121 } 122 String reportChartDesc = accountBalance.getChartOfAccounts().getReportsToChartOfAccounts().getFinChartOfAccountDescription(); 123 String subFundGroupName = accountBalance.getSubFundGroup().getSubFundGroupCode(); 124 String subFundGroupDes = accountBalance.getSubFundGroup().getSubFundGroupDescription(); 125 String fundGroupName = accountBalance.getSubFundGroup().getFundGroupCode(); 126 String fundGroupDes = accountBalance.getSubFundGroup().getFundGroup().getName(); 127 128 Integer prevFiscalyear = universityFiscalYear - 1; 129 orgAccountObjectDetailReportEntry.setFiscalYear(prevFiscalyear.toString() + "-" + universityFiscalYear.toString().substring(2, 4)); 130 orgAccountObjectDetailReportEntry.setOrgChartOfAccountsCode(accountBalance.getOrganizationChartOfAccountsCode()); 131 132 if (orgChartDesc == null) { 133 orgAccountObjectDetailReportEntry.setOrgChartOfAccountDescription(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_CHART_DESCRIPTION)); 134 } 135 else { 136 orgAccountObjectDetailReportEntry.setOrgChartOfAccountDescription(orgChartDesc); 137 } 138 139 orgAccountObjectDetailReportEntry.setOrganizationCode(accountBalance.getOrganizationCode()); 140 if (orgName == null) { 141 orgAccountObjectDetailReportEntry.setOrganizationName(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_ORGANIZATION_NAME)); 142 } 143 else { 144 orgAccountObjectDetailReportEntry.setOrganizationName(orgName); 145 } 146 147 orgAccountObjectDetailReportEntry.setChartOfAccountsCode(accountBalance.getChartOfAccountsCode()); 148 if (chartDesc == null) { 149 orgAccountObjectDetailReportEntry.setChartOfAccountDescription(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_CHART_DESCRIPTION)); 150 } 151 else { 152 orgAccountObjectDetailReportEntry.setChartOfAccountDescription(chartDesc); 153 } 154 155 orgAccountObjectDetailReportEntry.setFundGroupCode(accountBalance.getSubFundGroup().getFundGroupCode()); 156 if (fundGroupDes == null) { 157 orgAccountObjectDetailReportEntry.setFundGroupName(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_FUNDGROUP_NAME)); 158 } 159 else { 160 orgAccountObjectDetailReportEntry.setFundGroupName(fundGroupDes); 161 } 162 163 orgAccountObjectDetailReportEntry.setSubFundGroupCode(accountBalance.getSubFundGroupCode()); 164 if (subFundGroupDes == null) { 165 orgAccountObjectDetailReportEntry.setSubFundGroupDescription(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_SUBFUNDGROUP_DESCRIPTION)); 166 } 167 else { 168 orgAccountObjectDetailReportEntry.setSubFundGroupDescription(subFundGroupDes); 169 } 170 171 Integer prevPrevFiscalyear = prevFiscalyear - 1; 172 orgAccountObjectDetailReportEntry.setBaseFy(prevPrevFiscalyear.toString() + "-" + prevFiscalyear.toString().substring(2, 4) + " Base"); 173 orgAccountObjectDetailReportEntry.setReqFy(prevFiscalyear.toString() + "-" + universityFiscalYear.toString().substring(2, 4) + " Request"); 174 if (consolidated) { 175 orgAccountObjectDetailReportEntry.setConsHdr(BCConstants.Report.CONSOLIIDATED); 176 } 177 else { 178 orgAccountObjectDetailReportEntry.setConsHdr(BCConstants.Report.BLANK); 179 } 180 181 orgAccountObjectDetailReportEntry.setAccountNumber(accountBalance.getAccountNumber()); 182 String accountName = accountBalance.getAccount().getAccountName(); 183 if (accountName == null) { 184 orgAccountObjectDetailReportEntry.setAccountName(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_ACCOUNT_DESCRIPTION)); 185 } 186 else { 187 orgAccountObjectDetailReportEntry.setAccountName(accountName); 188 } 189 190 orgAccountObjectDetailReportEntry.setSubAccountNumber(accountBalance.getSubAccountNumber()); 191 192 String subAccountName = StringUtils.EMPTY; 193 String subAccountNumberAndName = StringUtils.EMPTY; 194 String divider = StringUtils.EMPTY; 195 // set accountNumber and name, subAccountNumber and name 196 if (accountBalance.getAccount() != null) { 197 orgAccountObjectDetailReportEntry.setAccountNumberAndName(accountBalance.getAccountNumber() + " " + accountBalance.getAccount().getAccountName()); 198 orgAccountObjectDetailReportEntry.setAccountName(accountBalance.getAccount().getAccountName()); 199 } 200 201 if (!accountBalance.getSubAccountNumber().equals(BCConstants.Report.DASHES_SUB_ACCOUNT_CODE)) { 202 divider = BCConstants.Report.DIVIDER; 203 try { 204 subAccountName = accountBalance.getSubAccount().getSubAccountName(); 205 subAccountNumberAndName = accountBalance.getSubAccount().getSubAccountNumber() + " " + accountBalance.getSubAccount().getSubAccountName(); 206 } 207 catch (PersistenceBrokerException e) { 208 subAccountName = kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_SUB_ACCOUNT_DESCRIPTION); 209 subAccountNumberAndName = subAccountName; 210 } 211 } 212 213 orgAccountObjectDetailReportEntry.setSubAccountName(subAccountName); 214 orgAccountObjectDetailReportEntry.setSubAccountNumberAndName(subAccountNumberAndName); 215 orgAccountObjectDetailReportEntry.setDivider(divider); 216 217 // For group 218 orgAccountObjectDetailReportEntry.setSubAccountNumber(accountBalance.getSubAccountNumber() + accountBalance.getAccountNumber()); 219 orgAccountObjectDetailReportEntry.setFinancialObjectCode(accountBalance.getFinancialObjectCode()); 220 orgAccountObjectDetailReportEntry.setFinancialSubObjectCode(accountBalance.getFinancialSubObjectCode()); 221 // orgAccountObjectDetailReportEntry.setFinancialObjectLevelCode(accountBalance.getFinancialObjectLevelCode()); 222 orgAccountObjectDetailReportEntry.setIncomeExpenseCode(accountBalance.getIncomeExpenseCode()); 223 // orgAccountObjectDetailReportEntry.setFinancialConsolidationSortCode(accountBalance.getFinancialConsolidationSortCode()); 224 orgAccountObjectDetailReportEntry.setFinancialLevelSortCode(accountBalance.getFinancialLevelSortCode()); 225 226 // page break 227 228 // page break org_fin_coa_cd, org_cd, sub_fund_grp_cd)%\ 229 orgAccountObjectDetailReportEntry.setPageBreak(accountBalance.getOrganizationChartOfAccountsCode() + accountBalance.getOrganizationCode() + accountBalance.getSubFundGroupCode()); 230 } 231 232 233 /** 234 * builds report body 235 * 236 * @param BudgetConstructionLevelSummary bcas 237 */ 238 protected void buildReportsBody(Integer universityFiscalYear, BudgetConstructionOrgAccountObjectDetailReport orgAccountObjectDetailReportEntry, BudgetConstructionAccountBalance accountBalance) { 239 if (accountBalance.getFinancialSubObjectCode().equals(BCConstants.DASH_SUB_OBJECT_CODE)) { 240 orgAccountObjectDetailReportEntry.setFinancialObjectName(accountBalance.getFinancialObject().getFinancialObjectCodeName()); 241 } 242 else { 243 orgAccountObjectDetailReportEntry.setFinancialObjectName(accountBalance.getFinancialSubObject().getFinancialSubObjectCodeName()); 244 } 245 246 orgAccountObjectDetailReportEntry.setPositionCsfLeaveFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(accountBalance.getPositionCsfLeaveFteQuantity(), 2, true)); 247 248 orgAccountObjectDetailReportEntry.setPositionFullTimeEquivalencyQuantity(BudgetConstructionReportHelper.setDecimalDigit(accountBalance.getPositionFullTimeEquivalencyQuantity(), 2, true)); 249 250 orgAccountObjectDetailReportEntry.setAppointmentRequestedCsfFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(accountBalance.getAppointmentRequestedCsfFteQuantity(), 2, true)); 251 252 orgAccountObjectDetailReportEntry.setAppointmentRequestedFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(accountBalance.getAppointmentRequestedFteQuantity(), 2, true)); 253 254 orgAccountObjectDetailReportEntry.setAccountLineAnnualBalanceAmount(BudgetConstructionReportHelper.convertKualiInteger(accountBalance.getAccountLineAnnualBalanceAmount())); 255 256 orgAccountObjectDetailReportEntry.setFinancialBeginningBalanceLineAmount(BudgetConstructionReportHelper.convertKualiInteger(accountBalance.getFinancialBeginningBalanceLineAmount())); 257 258 Integer changeAmount = BudgetConstructionReportHelper.convertKualiInteger(accountBalance.getAccountLineAnnualBalanceAmount()) - BudgetConstructionReportHelper.convertKualiInteger(accountBalance.getFinancialBeginningBalanceLineAmount()); 259 orgAccountObjectDetailReportEntry.setAmountChange(changeAmount); 260 orgAccountObjectDetailReportEntry.setPercentChange(BudgetConstructionReportHelper.calculatePercent(orgAccountObjectDetailReportEntry.getAmountChange(), orgAccountObjectDetailReportEntry.getFinancialBeginningBalanceLineAmount())); 261 } 262 263 /** 264 * builds report total 265 */ 266 267 protected void buildReportsTotal(BudgetConstructionOrgAccountObjectDetailReport orgObjectSummaryReportEntry, BudgetConstructionAccountBalance accountBalance, List<BudgetConstructionOrgAccountObjectDetailReportTotal> accountObjectDetailTotalObjectList, List<BudgetConstructionOrgAccountObjectDetailReportTotal> accountObjectDetailTotalLevelList, List<BudgetConstructionOrgAccountObjectDetailReportTotal> accountObjectDetailTotalGexpAndTypeList, List<BudgetConstructionOrgAccountObjectDetailReportTotal> accountObjectDetailAccountTotalList, List<BudgetConstructionOrgAccountObjectDetailReportTotal> accountObjectDetailSubFundTotalList) { 268 269 for (BudgetConstructionOrgAccountObjectDetailReportTotal objectTotal : accountObjectDetailTotalObjectList) { 270 if (BudgetConstructionReportHelper.isSameEntry(accountBalance, objectTotal.getBudgetConstructionAccountBalance(), fieldsForObject())) { 271 orgObjectSummaryReportEntry.setTotalObjectDescription(accountBalance.getFinancialObject().getFinancialObjectCodeName()); 272 273 orgObjectSummaryReportEntry.setTotalObjectPositionCsfLeaveFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(objectTotal.getTotalObjectPositionCsfLeaveFteQuantity(), 2, true)); 274 orgObjectSummaryReportEntry.setTotalObjectPositionFullTimeEquivalencyQuantity(BudgetConstructionReportHelper.setDecimalDigit(objectTotal.getTotalObjectPositionFullTimeEquivalencyQuantity(), 2, true)); 275 orgObjectSummaryReportEntry.setTotalObjectFinancialBeginningBalanceLineAmount(objectTotal.getTotalObjectFinancialBeginningBalanceLineAmount()); 276 orgObjectSummaryReportEntry.setTotalObjectAppointmentRequestedCsfFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(objectTotal.getTotalObjectAppointmentRequestedCsfFteQuantity(), 2, true)); 277 orgObjectSummaryReportEntry.setTotalObjectAppointmentRequestedFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(objectTotal.getTotalObjectAppointmentRequestedFteQuantity(), 2, true)); 278 orgObjectSummaryReportEntry.setTotalObjectAccountLineAnnualBalanceAmount(objectTotal.getTotalObjectAccountLineAnnualBalanceAmount()); 279 280 Integer totalObjectAmountChange = objectTotal.getTotalObjectAccountLineAnnualBalanceAmount() - objectTotal.getTotalObjectFinancialBeginningBalanceLineAmount(); 281 orgObjectSummaryReportEntry.setTotalObjectAmountChange(totalObjectAmountChange); 282 orgObjectSummaryReportEntry.setTotalObjectPercentChange(BudgetConstructionReportHelper.calculatePercent(totalObjectAmountChange, objectTotal.getTotalObjectFinancialBeginningBalanceLineAmount())); 283 } 284 } 285 286 for (BudgetConstructionOrgAccountObjectDetailReportTotal levelTotal : accountObjectDetailTotalLevelList) { 287 if (BudgetConstructionReportHelper.isSameEntry(accountBalance, levelTotal.getBudgetConstructionAccountBalance(), fieldsForLevel())) { 288 orgObjectSummaryReportEntry.setTotalLevelDescription(accountBalance.getFinancialObjectLevel().getFinancialObjectLevelName()); 289 290 orgObjectSummaryReportEntry.setTotalLevelPositionCsfLeaveFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(levelTotal.getTotalLevelPositionCsfLeaveFteQuantity(), 2, true)); 291 orgObjectSummaryReportEntry.setTotalLevelPositionFullTimeEquivalencyQuantity(BudgetConstructionReportHelper.setDecimalDigit(levelTotal.getTotalLevelPositionFullTimeEquivalencyQuantity(), 2, true)); 292 orgObjectSummaryReportEntry.setTotalLevelFinancialBeginningBalanceLineAmount(levelTotal.getTotalLevelFinancialBeginningBalanceLineAmount()); 293 orgObjectSummaryReportEntry.setTotalLevelAppointmentRequestedCsfFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(levelTotal.getTotalLevelAppointmentRequestedCsfFteQuantity(), 2, true)); 294 orgObjectSummaryReportEntry.setTotalLevelAppointmentRequestedFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(levelTotal.getTotalLevelAppointmentRequestedFteQuantity(), 2, true)); 295 orgObjectSummaryReportEntry.setTotalLevelAccountLineAnnualBalanceAmount(levelTotal.getTotalLevelAccountLineAnnualBalanceAmount()); 296 297 Integer totalLevelAmountChange = levelTotal.getTotalLevelAccountLineAnnualBalanceAmount() - levelTotal.getTotalLevelFinancialBeginningBalanceLineAmount(); 298 orgObjectSummaryReportEntry.setTotalLevelAmountChange(totalLevelAmountChange); 299 orgObjectSummaryReportEntry.setTotalLevelPercentChange(BudgetConstructionReportHelper.calculatePercent(totalLevelAmountChange, levelTotal.getTotalLevelFinancialBeginningBalanceLineAmount())); 300 } 301 } 302 303 304 for (BudgetConstructionOrgAccountObjectDetailReportTotal gexpAndTypeTotal : accountObjectDetailTotalGexpAndTypeList) { 305 if (BudgetConstructionReportHelper.isSameEntry(accountBalance, gexpAndTypeTotal.getBudgetConstructionAccountBalance(), fieldsForGexpAndType())) { 306 307 orgObjectSummaryReportEntry.setGrossFinancialBeginningBalanceLineAmount(gexpAndTypeTotal.getGrossFinancialBeginningBalanceLineAmount()); 308 orgObjectSummaryReportEntry.setGrossAccountLineAnnualBalanceAmount(gexpAndTypeTotal.getGrossAccountLineAnnualBalanceAmount()); 309 Integer grossAmountChange = gexpAndTypeTotal.getGrossAccountLineAnnualBalanceAmount() - gexpAndTypeTotal.getGrossFinancialBeginningBalanceLineAmount(); 310 orgObjectSummaryReportEntry.setGrossAmountChange(grossAmountChange); 311 orgObjectSummaryReportEntry.setGrossPercentChange(BudgetConstructionReportHelper.calculatePercent(grossAmountChange, gexpAndTypeTotal.getGrossFinancialBeginningBalanceLineAmount())); 312 313 if (accountBalance.getIncomeExpenseCode().equals(BCConstants.Report.INCOME_EXP_TYPE_A)) { 314 orgObjectSummaryReportEntry.setTypeDesc(kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_INCOME_EXP_DESC_UPPERCASE_REVENUE)); 315 } 316 else { 317 orgObjectSummaryReportEntry.setTypeDesc(kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_INCOME_EXP_DESC_EXPENDITURE_NET_TRNFR)); 318 } 319 320 orgObjectSummaryReportEntry.setTypePositionCsfLeaveFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(gexpAndTypeTotal.getTypePositionCsfLeaveFteQuantity(), 2, true)); 321 orgObjectSummaryReportEntry.setTypePositionFullTimeEquivalencyQuantity(BudgetConstructionReportHelper.setDecimalDigit(gexpAndTypeTotal.getTypePositionFullTimeEquivalencyQuantity(), 2, true)); 322 orgObjectSummaryReportEntry.setTypeFinancialBeginningBalanceLineAmount(gexpAndTypeTotal.getTypeFinancialBeginningBalanceLineAmount()); 323 orgObjectSummaryReportEntry.setTypeAppointmentRequestedCsfFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(gexpAndTypeTotal.getTypeAppointmentRequestedCsfFteQuantity(), 2, true)); 324 orgObjectSummaryReportEntry.setTypeAppointmentRequestedFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(gexpAndTypeTotal.getTypeAppointmentRequestedFteQuantity(), 2, true)); 325 326 orgObjectSummaryReportEntry.setTypeAccountLineAnnualBalanceAmount(gexpAndTypeTotal.getTypeAccountLineAnnualBalanceAmount()); 327 Integer typeAmountChange = gexpAndTypeTotal.getTypeAccountLineAnnualBalanceAmount() - gexpAndTypeTotal.getTypeFinancialBeginningBalanceLineAmount(); 328 orgObjectSummaryReportEntry.setTypeAmountChange(typeAmountChange); 329 orgObjectSummaryReportEntry.setTypePercentChange(BudgetConstructionReportHelper.calculatePercent(typeAmountChange, gexpAndTypeTotal.getTypeFinancialBeginningBalanceLineAmount())); 330 } 331 } 332 333 for (BudgetConstructionOrgAccountObjectDetailReportTotal accountTotal : accountObjectDetailAccountTotalList) { 334 if (BudgetConstructionReportHelper.isSameEntry(accountBalance, accountTotal.getBudgetConstructionAccountBalance(), fieldsForAccountTotal())) { 335 336 if (orgObjectSummaryReportEntry.getSubAccountName().equals(BCConstants.Report.BLANK)) { 337 orgObjectSummaryReportEntry.setAccountNameForAccountTotal(orgObjectSummaryReportEntry.getAccountName()); 338 } 339 else { 340 orgObjectSummaryReportEntry.setAccountNameForAccountTotal(orgObjectSummaryReportEntry.getSubAccountName()); 341 } 342 343 orgObjectSummaryReportEntry.setAccountPositionCsfLeaveFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(accountTotal.getAccountPositionCsfLeaveFteQuantity(), 2, true)); 344 orgObjectSummaryReportEntry.setAccountPositionFullTimeEquivalencyQuantity(BudgetConstructionReportHelper.setDecimalDigit(accountTotal.getAccountPositionFullTimeEquivalencyQuantity(), 2, true)); 345 orgObjectSummaryReportEntry.setAccountAppointmentRequestedCsfFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(accountTotal.getAccountAppointmentRequestedCsfFteQuantity(), 2, true)); 346 orgObjectSummaryReportEntry.setAccountAppointmentRequestedFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(accountTotal.getAccountAppointmentRequestedFteQuantity(), 2, true)); 347 348 orgObjectSummaryReportEntry.setAccountRevenueFinancialBeginningBalanceLineAmount(accountTotal.getAccountRevenueFinancialBeginningBalanceLineAmount()); 349 orgObjectSummaryReportEntry.setAccountRevenueAccountLineAnnualBalanceAmount(accountTotal.getAccountRevenueAccountLineAnnualBalanceAmount()); 350 351 Integer accountRevenueAmountChange = accountTotal.getAccountRevenueAccountLineAnnualBalanceAmount() - accountTotal.getAccountRevenueFinancialBeginningBalanceLineAmount(); 352 orgObjectSummaryReportEntry.setAccountRevenueAmountChange(accountRevenueAmountChange); 353 orgObjectSummaryReportEntry.setAccountRevenuePercentChange(BudgetConstructionReportHelper.calculatePercent(accountRevenueAmountChange, accountTotal.getAccountRevenueFinancialBeginningBalanceLineAmount())); 354 355 Integer accountGrossFinancialBeginningBalanceLineAmount = accountTotal.getAccountExpenditureFinancialBeginningBalanceLineAmount() - accountTotal.getAccountTrnfrInFinancialBeginningBalanceLineAmount(); 356 Integer accountGrossAccountLineAnnualBalanceAmount = accountTotal.getAccountExpenditureAccountLineAnnualBalanceAmount() - accountTotal.getAccountTrnfrInAccountLineAnnualBalanceAmount(); 357 orgObjectSummaryReportEntry.setAccountGrossFinancialBeginningBalanceLineAmount(accountGrossFinancialBeginningBalanceLineAmount); 358 orgObjectSummaryReportEntry.setAccountGrossAccountLineAnnualBalanceAmount(accountGrossAccountLineAnnualBalanceAmount); 359 Integer accountGrossAmountChange = accountGrossAccountLineAnnualBalanceAmount - accountGrossFinancialBeginningBalanceLineAmount; 360 orgObjectSummaryReportEntry.setAccountGrossAmountChange(accountGrossAmountChange); 361 orgObjectSummaryReportEntry.setAccountGrossPercentChange(BudgetConstructionReportHelper.calculatePercent(accountGrossAmountChange, accountGrossFinancialBeginningBalanceLineAmount)); 362 363 orgObjectSummaryReportEntry.setAccountTrnfrInFinancialBeginningBalanceLineAmount(accountTotal.getAccountTrnfrInFinancialBeginningBalanceLineAmount()); 364 orgObjectSummaryReportEntry.setAccountTrnfrInAccountLineAnnualBalanceAmount(accountTotal.getAccountTrnfrInAccountLineAnnualBalanceAmount()); 365 366 Integer accountTrnfrInAmountChange = accountTotal.getAccountTrnfrInAccountLineAnnualBalanceAmount() - accountTotal.getAccountTrnfrInFinancialBeginningBalanceLineAmount(); 367 orgObjectSummaryReportEntry.setAccountTrnfrInAmountChange(accountTrnfrInAmountChange); 368 orgObjectSummaryReportEntry.setAccountTrnfrInPercentChange(BudgetConstructionReportHelper.calculatePercent(accountTrnfrInAmountChange, accountTotal.getAccountTrnfrInFinancialBeginningBalanceLineAmount())); 369 370 orgObjectSummaryReportEntry.setAccountExpenditureFinancialBeginningBalanceLineAmount(accountTotal.getAccountExpenditureFinancialBeginningBalanceLineAmount()); 371 orgObjectSummaryReportEntry.setAccountExpenditureAccountLineAnnualBalanceAmount(accountTotal.getAccountExpenditureAccountLineAnnualBalanceAmount()); 372 373 Integer accountExpenditureAmountChange = accountTotal.getAccountExpenditureAccountLineAnnualBalanceAmount() - accountTotal.getAccountExpenditureFinancialBeginningBalanceLineAmount(); 374 orgObjectSummaryReportEntry.setAccountExpenditureAmountChange(accountExpenditureAmountChange); 375 orgObjectSummaryReportEntry.setAccountExpenditurePercentChange(BudgetConstructionReportHelper.calculatePercent(accountExpenditureAmountChange, accountTotal.getAccountExpenditureFinancialBeginningBalanceLineAmount())); 376 377 Integer accountDifferenceFinancialBeginningBalanceLineAmount = accountTotal.getAccountRevenueFinancialBeginningBalanceLineAmount() - accountTotal.getAccountExpenditureFinancialBeginningBalanceLineAmount(); 378 Integer accountDifferenceAccountLineAnnualBalanceAmount = accountTotal.getAccountRevenueAccountLineAnnualBalanceAmount() - accountTotal.getAccountExpenditureAccountLineAnnualBalanceAmount(); 379 380 orgObjectSummaryReportEntry.setAccountDifferenceFinancialBeginningBalanceLineAmount(accountDifferenceFinancialBeginningBalanceLineAmount); 381 orgObjectSummaryReportEntry.setAccountDifferenceAccountLineAnnualBalanceAmount(accountDifferenceAccountLineAnnualBalanceAmount); 382 383 orgObjectSummaryReportEntry.setAccountDifferenceFinancialBeginningBalanceLineAmount(accountDifferenceFinancialBeginningBalanceLineAmount); 384 orgObjectSummaryReportEntry.setAccountDifferenceAccountLineAnnualBalanceAmount(accountDifferenceAccountLineAnnualBalanceAmount); 385 386 Integer accountDifferenceAmountChange = accountDifferenceAccountLineAnnualBalanceAmount - accountDifferenceFinancialBeginningBalanceLineAmount; 387 orgObjectSummaryReportEntry.setAccountDifferenceAmountChange(accountDifferenceAmountChange); 388 orgObjectSummaryReportEntry.setAccountDifferencePercentChange(BudgetConstructionReportHelper.calculatePercent(accountDifferenceAmountChange, accountDifferenceFinancialBeginningBalanceLineAmount)); 389 } 390 } 391 392 for (BudgetConstructionOrgAccountObjectDetailReportTotal subFundTotal : accountObjectDetailSubFundTotalList) { 393 if (BudgetConstructionReportHelper.isSameEntry(accountBalance, subFundTotal.getBudgetConstructionAccountBalance(), fieldsForSubFundTotal())) { 394 395 orgObjectSummaryReportEntry.setSubFundPositionCsfLeaveFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(subFundTotal.getSubFundPositionCsfLeaveFteQuantity(), 2, true)); 396 orgObjectSummaryReportEntry.setSubFundPositionFullTimeEquivalencyQuantity(BudgetConstructionReportHelper.setDecimalDigit(subFundTotal.getSubFundPositionFullTimeEquivalencyQuantity(), 2, true)); 397 orgObjectSummaryReportEntry.setSubFundAppointmentRequestedCsfFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(subFundTotal.getSubFundAppointmentRequestedCsfFteQuantity(), 2, true)); 398 orgObjectSummaryReportEntry.setSubFundAppointmentRequestedFteQuantity(BudgetConstructionReportHelper.setDecimalDigit(subFundTotal.getSubFundAppointmentRequestedFteQuantity(), 2, true)); 399 400 orgObjectSummaryReportEntry.setSubFundRevenueFinancialBeginningBalanceLineAmount(subFundTotal.getSubFundRevenueFinancialBeginningBalanceLineAmount()); 401 orgObjectSummaryReportEntry.setSubFundRevenueAccountLineAnnualBalanceAmount(subFundTotal.getSubFundRevenueAccountLineAnnualBalanceAmount()); 402 403 Integer subFundRevenueAmountChange = subFundTotal.getSubFundRevenueAccountLineAnnualBalanceAmount() - subFundTotal.getSubFundRevenueFinancialBeginningBalanceLineAmount(); 404 orgObjectSummaryReportEntry.setSubFundRevenueAmountChange(subFundRevenueAmountChange); 405 orgObjectSummaryReportEntry.setSubFundRevenuePercentChange(BudgetConstructionReportHelper.calculatePercent(subFundRevenueAmountChange, subFundTotal.getSubFundRevenueFinancialBeginningBalanceLineAmount())); 406 407 Integer subFundGrossFinancialBeginningBalanceLineAmount = subFundTotal.getSubFundExpenditureFinancialBeginningBalanceLineAmount() - subFundTotal.getSubFundTrnfrInFinancialBeginningBalanceLineAmount(); 408 Integer subFundGrossAccountLineAnnualBalanceAmount = subFundTotal.getSubFundExpenditureAccountLineAnnualBalanceAmount() - subFundTotal.getSubFundTrnfrInAccountLineAnnualBalanceAmount(); 409 orgObjectSummaryReportEntry.setSubFundGrossFinancialBeginningBalanceLineAmount(subFundGrossFinancialBeginningBalanceLineAmount); 410 orgObjectSummaryReportEntry.setSubFundGrossAccountLineAnnualBalanceAmount(subFundGrossAccountLineAnnualBalanceAmount); 411 Integer subFundGrossAmountChange = subFundGrossAccountLineAnnualBalanceAmount - subFundGrossFinancialBeginningBalanceLineAmount; 412 orgObjectSummaryReportEntry.setSubFundGrossAmountChange(subFundGrossAmountChange); 413 orgObjectSummaryReportEntry.setSubFundGrossPercentChange(BudgetConstructionReportHelper.calculatePercent(subFundGrossAmountChange, subFundGrossFinancialBeginningBalanceLineAmount)); 414 415 orgObjectSummaryReportEntry.setSubFundTrnfrInFinancialBeginningBalanceLineAmount(subFundTotal.getSubFundTrnfrInFinancialBeginningBalanceLineAmount()); 416 orgObjectSummaryReportEntry.setSubFundTrnfrInAccountLineAnnualBalanceAmount(subFundTotal.getSubFundTrnfrInAccountLineAnnualBalanceAmount()); 417 418 Integer subFundTrnfrInAmountChange = subFundTotal.getSubFundTrnfrInAccountLineAnnualBalanceAmount() - subFundTotal.getSubFundTrnfrInFinancialBeginningBalanceLineAmount(); 419 orgObjectSummaryReportEntry.setSubFundTrnfrInAmountChange(subFundTrnfrInAmountChange); 420 orgObjectSummaryReportEntry.setSubFundTrnfrInPercentChange(BudgetConstructionReportHelper.calculatePercent(subFundTrnfrInAmountChange, subFundTotal.getSubFundTrnfrInFinancialBeginningBalanceLineAmount())); 421 422 orgObjectSummaryReportEntry.setSubFundExpenditureFinancialBeginningBalanceLineAmount(subFundTotal.getSubFundExpenditureFinancialBeginningBalanceLineAmount()); 423 orgObjectSummaryReportEntry.setSubFundExpenditureAccountLineAnnualBalanceAmount(subFundTotal.getSubFundExpenditureAccountLineAnnualBalanceAmount()); 424 425 Integer subFundExpenditureAmountChange = subFundTotal.getSubFundExpenditureAccountLineAnnualBalanceAmount() - subFundTotal.getSubFundExpenditureFinancialBeginningBalanceLineAmount(); 426 orgObjectSummaryReportEntry.setSubFundExpenditureAmountChange(subFundExpenditureAmountChange); 427 orgObjectSummaryReportEntry.setSubFundExpenditurePercentChange(BudgetConstructionReportHelper.calculatePercent(subFundExpenditureAmountChange, subFundTotal.getSubFundExpenditureFinancialBeginningBalanceLineAmount())); 428 429 Integer subFundDifferenceFinancialBeginningBalanceLineAmount = subFundTotal.getSubFundRevenueFinancialBeginningBalanceLineAmount() - subFundTotal.getSubFundExpenditureFinancialBeginningBalanceLineAmount(); 430 Integer subFundDifferenceAccountLineAnnualBalanceAmount = subFundTotal.getSubFundRevenueAccountLineAnnualBalanceAmount() - subFundTotal.getSubFundExpenditureAccountLineAnnualBalanceAmount(); 431 432 orgObjectSummaryReportEntry.setSubFundDifferenceFinancialBeginningBalanceLineAmount(subFundDifferenceFinancialBeginningBalanceLineAmount); 433 orgObjectSummaryReportEntry.setSubFundDifferenceAccountLineAnnualBalanceAmount(subFundDifferenceAccountLineAnnualBalanceAmount); 434 435 orgObjectSummaryReportEntry.setSubFundDifferenceFinancialBeginningBalanceLineAmount(subFundDifferenceFinancialBeginningBalanceLineAmount); 436 orgObjectSummaryReportEntry.setSubFundDifferenceAccountLineAnnualBalanceAmount(subFundDifferenceAccountLineAnnualBalanceAmount); 437 438 Integer subFundDifferenceAmountChange = subFundDifferenceAccountLineAnnualBalanceAmount - subFundDifferenceFinancialBeginningBalanceLineAmount; 439 orgObjectSummaryReportEntry.setSubFundDifferenceAmountChange(subFundDifferenceAmountChange); 440 orgObjectSummaryReportEntry.setSubFundDifferencePercentChange(BudgetConstructionReportHelper.calculatePercent(subFundDifferenceAmountChange, subFundDifferenceFinancialBeginningBalanceLineAmount)); 441 } 442 } 443 444 445 } 446 447 protected List calculateObjectTotal(List<BudgetConstructionAccountBalance> bcosList, List<BudgetConstructionAccountBalance> simpleList) { 448 449 BigDecimal totalObjectPositionCsfLeaveFteQuantity = BigDecimal.ZERO; 450 BigDecimal totalObjectPositionFullTimeEquivalencyQuantity = BigDecimal.ZERO; 451 Integer totalObjectFinancialBeginningBalanceLineAmount = new Integer(0); 452 BigDecimal totalObjectAppointmentRequestedCsfFteQuantity = BigDecimal.ZERO; 453 BigDecimal totalObjectAppointmentRequestedFteQuantity = BigDecimal.ZERO; 454 Integer totalObjectAccountLineAnnualBalanceAmount = new Integer(0); 455 456 List returnList = new ArrayList(); 457 458 for (BudgetConstructionAccountBalance simpleBcosEntry : simpleList) { 459 460 BudgetConstructionOrgAccountObjectDetailReportTotal bcObjectTotal = new BudgetConstructionOrgAccountObjectDetailReportTotal(); 461 for (BudgetConstructionAccountBalance bcosListEntry : bcosList) { 462 if (BudgetConstructionReportHelper.isSameEntry(simpleBcosEntry, bcosListEntry, fieldsForObject())) { 463 totalObjectFinancialBeginningBalanceLineAmount += new Integer(bcosListEntry.getFinancialBeginningBalanceLineAmount().intValue()); 464 totalObjectAccountLineAnnualBalanceAmount += new Integer(bcosListEntry.getAccountLineAnnualBalanceAmount().intValue()); 465 totalObjectPositionCsfLeaveFteQuantity = totalObjectPositionCsfLeaveFteQuantity.add(bcosListEntry.getPositionCsfLeaveFteQuantity()); 466 totalObjectPositionFullTimeEquivalencyQuantity = totalObjectPositionFullTimeEquivalencyQuantity.add(bcosListEntry.getPositionFullTimeEquivalencyQuantity()); 467 totalObjectAppointmentRequestedCsfFteQuantity = totalObjectAppointmentRequestedCsfFteQuantity.add(bcosListEntry.getAppointmentRequestedCsfFteQuantity()); 468 totalObjectAppointmentRequestedFteQuantity = totalObjectAppointmentRequestedFteQuantity.add(bcosListEntry.getAppointmentRequestedFteQuantity()); 469 } 470 } 471 bcObjectTotal.setBudgetConstructionAccountBalance(simpleBcosEntry); 472 bcObjectTotal.setTotalObjectPositionCsfLeaveFteQuantity(totalObjectPositionCsfLeaveFteQuantity); 473 bcObjectTotal.setTotalObjectPositionFullTimeEquivalencyQuantity(totalObjectPositionFullTimeEquivalencyQuantity); 474 bcObjectTotal.setTotalObjectFinancialBeginningBalanceLineAmount(totalObjectFinancialBeginningBalanceLineAmount); 475 bcObjectTotal.setTotalObjectAppointmentRequestedCsfFteQuantity(totalObjectAppointmentRequestedCsfFteQuantity); 476 bcObjectTotal.setTotalObjectAppointmentRequestedFteQuantity(totalObjectAppointmentRequestedFteQuantity); 477 bcObjectTotal.setTotalObjectAccountLineAnnualBalanceAmount(totalObjectAccountLineAnnualBalanceAmount); 478 479 returnList.add(bcObjectTotal); 480 481 totalObjectPositionCsfLeaveFteQuantity = BigDecimal.ZERO; 482 totalObjectPositionFullTimeEquivalencyQuantity = BigDecimal.ZERO; 483 totalObjectFinancialBeginningBalanceLineAmount = new Integer(0); 484 totalObjectAppointmentRequestedCsfFteQuantity = BigDecimal.ZERO; 485 totalObjectAppointmentRequestedFteQuantity = BigDecimal.ZERO; 486 totalObjectAccountLineAnnualBalanceAmount = new Integer(0); 487 } 488 return returnList; 489 490 } 491 492 public void setBusinessObjectService(BusinessObjectService businessObjectService) { 493 this.businessObjectService = businessObjectService; 494 } 495 496 protected List calculateLevelTotal(List<BudgetConstructionAccountBalance> bcosList, List<BudgetConstructionAccountBalance> simpleList) { 497 498 BigDecimal totalLevelPositionCsfLeaveFteQuantity = BigDecimal.ZERO; 499 BigDecimal totalLevelPositionFullTimeEquivalencyQuantity = BigDecimal.ZERO; 500 Integer totalLevelFinancialBeginningBalanceLineAmount = new Integer(0); 501 BigDecimal totalLevelAppointmentRequestedCsfFteQuantity = BigDecimal.ZERO; 502 BigDecimal totalLevelAppointmentRequestedFteQuantity = BigDecimal.ZERO; 503 Integer totalLevelAccountLineAnnualBalanceAmount = new Integer(0); 504 505 List returnList = new ArrayList(); 506 507 for (BudgetConstructionAccountBalance simpleBcosEntry : simpleList) { 508 509 BudgetConstructionOrgAccountObjectDetailReportTotal bcObjectTotal = new BudgetConstructionOrgAccountObjectDetailReportTotal(); 510 for (BudgetConstructionAccountBalance bcosListEntry : bcosList) { 511 if (BudgetConstructionReportHelper.isSameEntry(simpleBcosEntry, bcosListEntry, fieldsForLevel())) { 512 totalLevelFinancialBeginningBalanceLineAmount += new Integer(bcosListEntry.getFinancialBeginningBalanceLineAmount().intValue()); 513 totalLevelAccountLineAnnualBalanceAmount += new Integer(bcosListEntry.getAccountLineAnnualBalanceAmount().intValue()); 514 totalLevelPositionCsfLeaveFteQuantity = totalLevelPositionCsfLeaveFteQuantity.add(bcosListEntry.getPositionCsfLeaveFteQuantity()); 515 totalLevelPositionFullTimeEquivalencyQuantity = totalLevelPositionFullTimeEquivalencyQuantity.add(bcosListEntry.getPositionFullTimeEquivalencyQuantity()); 516 totalLevelAppointmentRequestedCsfFteQuantity = totalLevelAppointmentRequestedCsfFteQuantity.add(bcosListEntry.getAppointmentRequestedCsfFteQuantity()); 517 totalLevelAppointmentRequestedFteQuantity = totalLevelAppointmentRequestedFteQuantity.add(bcosListEntry.getAppointmentRequestedFteQuantity()); 518 } 519 } 520 bcObjectTotal.setBudgetConstructionAccountBalance(simpleBcosEntry); 521 bcObjectTotal.setTotalLevelPositionCsfLeaveFteQuantity(totalLevelPositionCsfLeaveFteQuantity); 522 bcObjectTotal.setTotalLevelPositionFullTimeEquivalencyQuantity(totalLevelPositionFullTimeEquivalencyQuantity); 523 bcObjectTotal.setTotalLevelFinancialBeginningBalanceLineAmount(totalLevelFinancialBeginningBalanceLineAmount); 524 bcObjectTotal.setTotalLevelAppointmentRequestedCsfFteQuantity(totalLevelAppointmentRequestedCsfFteQuantity); 525 bcObjectTotal.setTotalLevelAppointmentRequestedFteQuantity(totalLevelAppointmentRequestedFteQuantity); 526 bcObjectTotal.setTotalLevelAccountLineAnnualBalanceAmount(totalLevelAccountLineAnnualBalanceAmount); 527 528 returnList.add(bcObjectTotal); 529 530 totalLevelPositionCsfLeaveFteQuantity = BigDecimal.ZERO; 531 totalLevelPositionFullTimeEquivalencyQuantity = BigDecimal.ZERO; 532 totalLevelFinancialBeginningBalanceLineAmount = new Integer(0); 533 totalLevelAppointmentRequestedCsfFteQuantity = BigDecimal.ZERO; 534 totalLevelAppointmentRequestedFteQuantity = BigDecimal.ZERO; 535 totalLevelAccountLineAnnualBalanceAmount = new Integer(0); 536 } 537 return returnList; 538 } 539 540 541 protected List calculateGexpAndTypeTotal(List<BudgetConstructionAccountBalance> bcabList, List<BudgetConstructionAccountBalance> simpleList) { 542 543 Integer grossFinancialBeginningBalanceLineAmount = new Integer(0); 544 Integer grossAccountLineAnnualBalanceAmount = new Integer(0); 545 546 BigDecimal typePositionCsfLeaveFteQuantity = BigDecimal.ZERO; 547 BigDecimal typePositionFullTimeEquivalencyQuantity = BigDecimal.ZERO; 548 Integer typeFinancialBeginningBalanceLineAmount = new Integer(0); 549 BigDecimal typeAppointmentRequestedCsfFteQuantity = BigDecimal.ZERO; 550 BigDecimal typeAppointmentRequestedFteQuantity = BigDecimal.ZERO; 551 Integer typeAccountLineAnnualBalanceAmount = new Integer(0); 552 553 List returnList = new ArrayList(); 554 for (BudgetConstructionAccountBalance simpleBcosEntry : simpleList) { 555 BudgetConstructionOrgAccountObjectDetailReportTotal bcObjectTotal = new BudgetConstructionOrgAccountObjectDetailReportTotal(); 556 for (BudgetConstructionAccountBalance bcabListEntry : bcabList) { 557 if (BudgetConstructionReportHelper.isSameEntry(simpleBcosEntry, bcabListEntry, fieldsForGexpAndType())) { 558 559 typeFinancialBeginningBalanceLineAmount += new Integer(bcabListEntry.getFinancialBeginningBalanceLineAmount().intValue()); 560 typeAccountLineAnnualBalanceAmount += new Integer(bcabListEntry.getAccountLineAnnualBalanceAmount().intValue()); 561 typePositionCsfLeaveFteQuantity = typePositionCsfLeaveFteQuantity.add(bcabListEntry.getPositionCsfLeaveFteQuantity()); 562 typePositionFullTimeEquivalencyQuantity = typePositionFullTimeEquivalencyQuantity.add(bcabListEntry.getPositionFullTimeEquivalencyQuantity()); 563 typeAppointmentRequestedCsfFteQuantity = typeAppointmentRequestedCsfFteQuantity.add(bcabListEntry.getAppointmentRequestedCsfFteQuantity()); 564 typeAppointmentRequestedFteQuantity = typeAppointmentRequestedFteQuantity.add(bcabListEntry.getAppointmentRequestedFteQuantity()); 565 566 if (bcabListEntry.getIncomeExpenseCode().equals("B") && !bcabListEntry.getFinancialObjectLevelCode().equals("CORI") && !bcabListEntry.getFinancialObjectLevelCode().equals("TRIN")) { 567 grossFinancialBeginningBalanceLineAmount += new Integer(bcabListEntry.getFinancialBeginningBalanceLineAmount().intValue()); 568 grossAccountLineAnnualBalanceAmount += new Integer(bcabListEntry.getAccountLineAnnualBalanceAmount().intValue()); 569 } 570 } 571 } 572 bcObjectTotal.setBudgetConstructionAccountBalance(simpleBcosEntry); 573 574 bcObjectTotal.setGrossFinancialBeginningBalanceLineAmount(grossFinancialBeginningBalanceLineAmount); 575 bcObjectTotal.setGrossAccountLineAnnualBalanceAmount(grossAccountLineAnnualBalanceAmount); 576 577 bcObjectTotal.setTypePositionCsfLeaveFteQuantity(typePositionCsfLeaveFteQuantity); 578 bcObjectTotal.setTypePositionFullTimeEquivalencyQuantity(typePositionFullTimeEquivalencyQuantity); 579 bcObjectTotal.setTypeFinancialBeginningBalanceLineAmount(typeFinancialBeginningBalanceLineAmount); 580 bcObjectTotal.setTypeAppointmentRequestedCsfFteQuantity(typeAppointmentRequestedCsfFteQuantity); 581 bcObjectTotal.setTypeAppointmentRequestedFteQuantity(typeAppointmentRequestedFteQuantity); 582 bcObjectTotal.setTypeAccountLineAnnualBalanceAmount(typeAccountLineAnnualBalanceAmount); 583 584 returnList.add(bcObjectTotal); 585 586 grossFinancialBeginningBalanceLineAmount = new Integer(0); 587 grossAccountLineAnnualBalanceAmount = new Integer(0); 588 589 typePositionCsfLeaveFteQuantity = BigDecimal.ZERO; 590 typePositionFullTimeEquivalencyQuantity = BigDecimal.ZERO; 591 typeFinancialBeginningBalanceLineAmount = new Integer(0); 592 typeAppointmentRequestedCsfFteQuantity = BigDecimal.ZERO; 593 typeAppointmentRequestedFteQuantity = BigDecimal.ZERO; 594 typeAccountLineAnnualBalanceAmount = new Integer(0); 595 } 596 return returnList; 597 } 598 599 protected List calculateAccountTotal(List<BudgetConstructionAccountBalance> bcabList, List<BudgetConstructionAccountBalance> simpleList) { 600 BigDecimal accountPositionCsfLeaveFteQuantity = BigDecimal.ZERO; 601 BigDecimal accountPositionFullTimeEquivalencyQuantity = BigDecimal.ZERO; 602 BigDecimal accountAppointmentRequestedCsfFteQuantity = BigDecimal.ZERO; 603 BigDecimal accountAppointmentRequestedFteQuantity = BigDecimal.ZERO; 604 605 Integer accountRevenueFinancialBeginningBalanceLineAmount = new Integer(0); 606 Integer accountRevenueAccountLineAnnualBalanceAmount = new Integer(0); 607 Integer accountTrnfrInFinancialBeginningBalanceLineAmount = new Integer(0); 608 Integer accountTrnfrInAccountLineAnnualBalanceAmount = new Integer(0); 609 Integer accountExpenditureFinancialBeginningBalanceLineAmount = new Integer(0); 610 Integer accountExpenditureAccountLineAnnualBalanceAmount = new Integer(0); 611 612 List returnList = new ArrayList(); 613 614 for (BudgetConstructionAccountBalance simpleBcosEntry : simpleList) { 615 BudgetConstructionOrgAccountObjectDetailReportTotal bcObjectTotal = new BudgetConstructionOrgAccountObjectDetailReportTotal(); 616 for (BudgetConstructionAccountBalance bcabListEntry : bcabList) { 617 if (BudgetConstructionReportHelper.isSameEntry(simpleBcosEntry, bcabListEntry, fieldsForAccountTotal())) { 618 619 accountPositionCsfLeaveFteQuantity = accountPositionCsfLeaveFteQuantity.add(bcabListEntry.getPositionCsfLeaveFteQuantity()); 620 accountPositionFullTimeEquivalencyQuantity = accountPositionFullTimeEquivalencyQuantity.add(bcabListEntry.getPositionFullTimeEquivalencyQuantity()); 621 accountAppointmentRequestedCsfFteQuantity = accountAppointmentRequestedCsfFteQuantity.add(bcabListEntry.getAppointmentRequestedCsfFteQuantity()); 622 accountAppointmentRequestedFteQuantity = accountAppointmentRequestedFteQuantity.add(bcabListEntry.getAppointmentRequestedFteQuantity()); 623 624 if (bcabListEntry.getIncomeExpenseCode().equals("A")) { 625 accountRevenueFinancialBeginningBalanceLineAmount += new Integer(bcabListEntry.getFinancialBeginningBalanceLineAmount().intValue()); 626 accountRevenueAccountLineAnnualBalanceAmount += new Integer(bcabListEntry.getAccountLineAnnualBalanceAmount().intValue()); 627 } 628 else { 629 accountExpenditureFinancialBeginningBalanceLineAmount += new Integer(bcabListEntry.getFinancialBeginningBalanceLineAmount().intValue()); 630 accountExpenditureAccountLineAnnualBalanceAmount += new Integer(bcabListEntry.getAccountLineAnnualBalanceAmount().intValue()); 631 } 632 633 if (bcabListEntry.getIncomeExpenseCode().equals("B")) { 634 if (bcabListEntry.getFinancialObjectLevelCode().equals("CORI") || bcabListEntry.getFinancialObjectLevelCode().equals("TRIN")) { 635 accountTrnfrInFinancialBeginningBalanceLineAmount += new Integer(bcabListEntry.getFinancialBeginningBalanceLineAmount().intValue()); 636 accountTrnfrInAccountLineAnnualBalanceAmount += new Integer(bcabListEntry.getAccountLineAnnualBalanceAmount().intValue()); 637 } 638 } 639 } 640 } 641 642 bcObjectTotal.setBudgetConstructionAccountBalance(simpleBcosEntry); 643 644 bcObjectTotal.setAccountPositionCsfLeaveFteQuantity(accountPositionCsfLeaveFteQuantity); 645 bcObjectTotal.setAccountPositionFullTimeEquivalencyQuantity(accountPositionFullTimeEquivalencyQuantity); 646 bcObjectTotal.setAccountAppointmentRequestedCsfFteQuantity(accountAppointmentRequestedCsfFteQuantity); 647 bcObjectTotal.setAccountAppointmentRequestedFteQuantity(accountAppointmentRequestedFteQuantity); 648 649 bcObjectTotal.setAccountRevenueFinancialBeginningBalanceLineAmount(accountRevenueFinancialBeginningBalanceLineAmount); 650 bcObjectTotal.setAccountRevenueAccountLineAnnualBalanceAmount(accountRevenueAccountLineAnnualBalanceAmount); 651 bcObjectTotal.setAccountTrnfrInFinancialBeginningBalanceLineAmount(accountTrnfrInFinancialBeginningBalanceLineAmount); 652 bcObjectTotal.setAccountTrnfrInAccountLineAnnualBalanceAmount(accountTrnfrInAccountLineAnnualBalanceAmount); 653 bcObjectTotal.setAccountExpenditureFinancialBeginningBalanceLineAmount(accountExpenditureFinancialBeginningBalanceLineAmount); 654 bcObjectTotal.setAccountExpenditureAccountLineAnnualBalanceAmount(accountExpenditureAccountLineAnnualBalanceAmount); 655 656 returnList.add(bcObjectTotal); 657 658 accountPositionCsfLeaveFteQuantity = BigDecimal.ZERO; 659 accountPositionFullTimeEquivalencyQuantity = BigDecimal.ZERO; 660 accountAppointmentRequestedCsfFteQuantity = BigDecimal.ZERO; 661 accountAppointmentRequestedFteQuantity = BigDecimal.ZERO; 662 663 accountRevenueFinancialBeginningBalanceLineAmount = new Integer(0); 664 accountRevenueAccountLineAnnualBalanceAmount = new Integer(0); 665 accountTrnfrInFinancialBeginningBalanceLineAmount = new Integer(0); 666 accountTrnfrInAccountLineAnnualBalanceAmount = new Integer(0); 667 accountExpenditureFinancialBeginningBalanceLineAmount = new Integer(0); 668 accountExpenditureAccountLineAnnualBalanceAmount = new Integer(0); 669 } 670 return returnList; 671 } 672 673 674 protected List calculateSubFundTotal(List<BudgetConstructionAccountBalance> bcabList, List<BudgetConstructionAccountBalance> simpleList) { 675 676 BigDecimal subFundPositionCsfLeaveFteQuantity = BigDecimal.ZERO; 677 BigDecimal subFundPositionFullTimeEquivalencyQuantity = BigDecimal.ZERO; 678 BigDecimal subFundAppointmentRequestedCsfFteQuantity = BigDecimal.ZERO; 679 BigDecimal subFundAppointmentRequestedFteQuantity = BigDecimal.ZERO; 680 681 Integer subFundRevenueFinancialBeginningBalanceLineAmount = new Integer(0); 682 Integer subFundRevenueAccountLineAnnualBalanceAmount = new Integer(0); 683 Integer subFundTrnfrInFinancialBeginningBalanceLineAmount = new Integer(0); 684 Integer subFundTrnfrInAccountLineAnnualBalanceAmount = new Integer(0); 685 Integer subFundExpenditureFinancialBeginningBalanceLineAmount = new Integer(0); 686 Integer subFundExpenditureAccountLineAnnualBalanceAmount = new Integer(0); 687 688 List returnList = new ArrayList(); 689 690 for (BudgetConstructionAccountBalance simpleBcosEntry : simpleList) { 691 BudgetConstructionOrgAccountObjectDetailReportTotal bcObjectTotal = new BudgetConstructionOrgAccountObjectDetailReportTotal(); 692 for (BudgetConstructionAccountBalance bcabListEntry : bcabList) { 693 if (BudgetConstructionReportHelper.isSameEntry(simpleBcosEntry, bcabListEntry, fieldsForSubFundTotal())) { 694 695 subFundPositionCsfLeaveFteQuantity = subFundPositionCsfLeaveFteQuantity.add(bcabListEntry.getPositionCsfLeaveFteQuantity()); 696 subFundPositionFullTimeEquivalencyQuantity = subFundPositionFullTimeEquivalencyQuantity.add(bcabListEntry.getPositionFullTimeEquivalencyQuantity()); 697 subFundAppointmentRequestedCsfFteQuantity = subFundAppointmentRequestedCsfFteQuantity.add(bcabListEntry.getAppointmentRequestedCsfFteQuantity()); 698 subFundAppointmentRequestedFteQuantity = subFundAppointmentRequestedFteQuantity.add(bcabListEntry.getAppointmentRequestedFteQuantity()); 699 700 if (bcabListEntry.getIncomeExpenseCode().equals("A")) { 701 subFundRevenueFinancialBeginningBalanceLineAmount += new Integer(bcabListEntry.getFinancialBeginningBalanceLineAmount().intValue()); 702 subFundRevenueAccountLineAnnualBalanceAmount += new Integer(bcabListEntry.getAccountLineAnnualBalanceAmount().intValue()); 703 } 704 else { 705 subFundExpenditureFinancialBeginningBalanceLineAmount += new Integer(bcabListEntry.getFinancialBeginningBalanceLineAmount().intValue()); 706 subFundExpenditureAccountLineAnnualBalanceAmount += new Integer(bcabListEntry.getAccountLineAnnualBalanceAmount().intValue()); 707 } 708 709 if (bcabListEntry.getIncomeExpenseCode().equals("B")) { 710 if (bcabListEntry.getFinancialObjectLevelCode().equals("CORI") || bcabListEntry.getFinancialObjectLevelCode().equals("TRIN")) { 711 subFundTrnfrInFinancialBeginningBalanceLineAmount += new Integer(bcabListEntry.getFinancialBeginningBalanceLineAmount().intValue()); 712 subFundTrnfrInAccountLineAnnualBalanceAmount += new Integer(bcabListEntry.getAccountLineAnnualBalanceAmount().intValue()); 713 } 714 } 715 } 716 } 717 718 bcObjectTotal.setBudgetConstructionAccountBalance(simpleBcosEntry); 719 720 bcObjectTotal.setSubFundPositionCsfLeaveFteQuantity(subFundPositionCsfLeaveFteQuantity); 721 bcObjectTotal.setSubFundPositionFullTimeEquivalencyQuantity(subFundPositionFullTimeEquivalencyQuantity); 722 bcObjectTotal.setSubFundAppointmentRequestedCsfFteQuantity(subFundAppointmentRequestedCsfFteQuantity); 723 bcObjectTotal.setSubFundAppointmentRequestedFteQuantity(subFundAppointmentRequestedFteQuantity); 724 725 bcObjectTotal.setSubFundRevenueFinancialBeginningBalanceLineAmount(subFundRevenueFinancialBeginningBalanceLineAmount); 726 bcObjectTotal.setSubFundRevenueAccountLineAnnualBalanceAmount(subFundRevenueAccountLineAnnualBalanceAmount); 727 728 bcObjectTotal.setSubFundTrnfrInFinancialBeginningBalanceLineAmount(subFundTrnfrInFinancialBeginningBalanceLineAmount); 729 bcObjectTotal.setSubFundTrnfrInAccountLineAnnualBalanceAmount(subFundTrnfrInAccountLineAnnualBalanceAmount); 730 731 bcObjectTotal.setSubFundExpenditureFinancialBeginningBalanceLineAmount(subFundExpenditureFinancialBeginningBalanceLineAmount); 732 bcObjectTotal.setSubFundExpenditureAccountLineAnnualBalanceAmount(subFundExpenditureAccountLineAnnualBalanceAmount); 733 734 returnList.add(bcObjectTotal); 735 736 subFundPositionCsfLeaveFteQuantity = BigDecimal.ZERO; 737 subFundPositionFullTimeEquivalencyQuantity = BigDecimal.ZERO; 738 subFundAppointmentRequestedCsfFteQuantity = BigDecimal.ZERO; 739 subFundAppointmentRequestedFteQuantity = BigDecimal.ZERO; 740 741 subFundRevenueFinancialBeginningBalanceLineAmount = new Integer(0); 742 subFundRevenueAccountLineAnnualBalanceAmount = new Integer(0); 743 subFundTrnfrInFinancialBeginningBalanceLineAmount = new Integer(0); 744 subFundTrnfrInAccountLineAnnualBalanceAmount = new Integer(0); 745 subFundExpenditureFinancialBeginningBalanceLineAmount = new Integer(0); 746 subFundExpenditureAccountLineAnnualBalanceAmount = new Integer(0); 747 } 748 return returnList; 749 } 750 751 752 /** 753 * builds list of fields for comparing entry of Object 754 * 755 * @return List<String> 756 */ 757 protected List<String> fieldsForObject() { 758 List<String> fieldList = new ArrayList(); 759 fieldList.addAll(fieldsForLevel()); 760 fieldList.add(KFSPropertyConstants.FINANCIAL_OBJECT_CODE); 761 // fieldList.add(KFSPropertyConstants.FINANCIAL_SUB_OBJECT_CODE); 762 return fieldList; 763 } 764 765 /** 766 * builds list of fields for comparing entry of Level 767 * 768 * @return List<String> 769 */ 770 protected List<String> fieldsForLevel() { 771 List<String> fieldList = new ArrayList(); 772 fieldList.addAll(fieldsForGexpAndType()); 773 fieldList.add(KFSPropertyConstants.FINANCIAL_LEVEL_SORT_CODE); 774 return fieldList; 775 } 776 777 /** 778 * builds list of fields for comparing entry of GexpAndType 779 * 780 * @return List<String> 781 */ 782 protected List<String> fieldsForGexpAndType() { 783 List<String> fieldList = new ArrayList(); 784 fieldList.addAll(fieldsForAccountTotal()); 785 fieldList.add(KFSPropertyConstants.INCOME_EXPENSE_CODE); 786 return fieldList; 787 } 788 789 /** 790 * builds list of fields for comparing entry of AccountTotal 791 * 792 * @return List<String> 793 */ 794 protected List<String> fieldsForAccountTotal() { 795 List<String> fieldList = new ArrayList(); 796 // fieldList.addAll(fieldsForSubFundTotal()); 797 fieldList.add(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE); 798 fieldList.add(KFSPropertyConstants.ACCOUNT_NUMBER); 799 fieldList.add(KFSPropertyConstants.SUB_ACCOUNT_NUMBER); 800 return fieldList; 801 } 802 803 /** 804 * builds list of fields for comparing entry of SubFundTotal total 805 * 806 * @return List<String> 807 */ 808 protected List<String> fieldsForSubFundTotal() { 809 List<String> fieldList = new ArrayList(); 810 811 fieldList.add(KFSPropertyConstants.ORGANIZATION_CHART_OF_ACCOUNTS_CODE); 812 fieldList.add(KFSPropertyConstants.ORGANIZATION_CODE); 813 fieldList.add(KFSPropertyConstants.SUB_FUND_GROUP_CODE); 814 return fieldList; 815 } 816 817 818 public List<String> buildOrderByList() { 819 List<String> returnList = new ArrayList(); 820 returnList.add(KFSPropertyConstants.ORGANIZATION_CHART_OF_ACCOUNTS_CODE); 821 returnList.add(KFSPropertyConstants.ORGANIZATION_CODE); 822 returnList.add(KFSPropertyConstants.SUB_FUND_GROUP_CODE); 823 returnList.add(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR); 824 returnList.add(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE); 825 returnList.add(KFSPropertyConstants.ACCOUNT_NUMBER); 826 returnList.add(KFSPropertyConstants.SUB_ACCOUNT_NUMBER); 827 returnList.add(KFSPropertyConstants.INCOME_EXPENSE_CODE); 828 returnList.add(KFSPropertyConstants.FINANCIAL_CONSOLIDATION_SORT_CODE); 829 returnList.add(KFSPropertyConstants.FINANCIAL_LEVEL_SORT_CODE); 830 returnList.add(KFSPropertyConstants.FINANCIAL_OBJECT_CODE); 831 returnList.add(KFSPropertyConstants.FINANCIAL_SUB_OBJECT_CODE); 832 return returnList; 833 } 834 835 public void setKualiConfigurationService(KualiConfigurationService kualiConfigurationService) { 836 this.kualiConfigurationService = kualiConfigurationService; 837 } 838 839 public KualiConfigurationService getKualiConfigurationService() { 840 return kualiConfigurationService; 841 } 842 843 public void setBudgetConstructionAccountObjectDetailReportDao(BudgetConstructionAccountObjectDetailReportDao budgetConstructionAccountObjectDetailReportDao) { 844 this.budgetConstructionAccountObjectDetailReportDao = budgetConstructionAccountObjectDetailReportDao; 845 } 846 847 public void setBudgetConstructionOrganizationReportsService(BudgetConstructionOrganizationReportsService budgetConstructionOrganizationReportsService) { 848 this.budgetConstructionOrganizationReportsService = budgetConstructionOrganizationReportsService; 849 } 850 851 }