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.Iterator;
022 import java.util.List;
023
024 import org.apache.ojb.broker.PersistenceBrokerException;
025 import org.kuali.kfs.module.bc.BCConstants;
026 import org.kuali.kfs.module.bc.BCKeyConstants;
027 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionAccountSummary;
028 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionOrgAccountSummaryReport;
029 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionOrgAccountSummaryReportTotal;
030 import org.kuali.kfs.module.bc.document.dataaccess.BudgetConstructionAccountSummaryReportDao;
031 import org.kuali.kfs.module.bc.document.service.BudgetConstructionAccountSummaryReportService;
032 import org.kuali.kfs.module.bc.document.service.BudgetConstructionReportsServiceHelper;
033 import org.kuali.kfs.module.bc.report.BudgetConstructionReportHelper;
034 import org.kuali.kfs.sys.KFSPropertyConstants;
035 import org.kuali.rice.kns.service.KualiConfigurationService;
036 import org.springframework.transaction.annotation.Transactional;
037
038 /**
039 * Service implementation of BudgetConstructionAccountSummaryReportService.
040 */
041 @Transactional
042 public class BudgetConstructionAccountSummaryReportServiceImpl implements BudgetConstructionAccountSummaryReportService {
043
044 private BudgetConstructionAccountSummaryReportDao budgetConstructionAccountSummaryReportDao;
045 private KualiConfigurationService kualiConfigurationService;
046 private BudgetConstructionReportsServiceHelper budgetConstructionReportsServiceHelper;
047 private boolean trExist = false;
048
049 /**
050 * @see org.kuali.kfs.module.bc.document.service.BudgetReportsControlListService#updateRepotsAccountSummaryTable(java.lang.String)
051 */
052 public void updateReportsAccountSummaryTable(String principalName) {
053 budgetConstructionAccountSummaryReportDao.cleanReportsAccountSummaryTable(principalName);
054 budgetConstructionAccountSummaryReportDao.updateReportsAccountSummaryTable(principalName);
055 }
056
057 /**
058 * @see org.kuali.kfs.module.bc.document.service.BudgetReportsControlListService#updateRepotsAccountSummaryTableWithConsolidation(java.lang.String)
059 */
060 public void updateReportsAccountSummaryTableWithConsolidation(String principalName) {
061 budgetConstructionAccountSummaryReportDao.cleanReportsAccountSummaryTable(principalName);
062 budgetConstructionAccountSummaryReportDao.updateReportsAccountSummaryTableWithConsolidation(principalName);
063 }
064
065 /**
066 * @see org.kuali.kfs.module.bc.document.service.BudgetConstructionAccountSummaryReportService#updateReportsAccountSummaryTable(java.lang.String,
067 * boolean)
068 */
069 public void updateReportsAccountSummaryTable(String principalName, boolean consolidated) {
070 if (consolidated) {
071 updateReportsAccountSummaryTableWithConsolidation(principalName);
072 }
073 else {
074 updateReportsAccountSummaryTable(principalName);
075 }
076 }
077
078 /**
079 * sets budgetConstructionAccountSummaryReportDao
080 *
081 * @param budgetConstructionAccountSummaryReportDao
082 */
083 public void setBudgetConstructionAccountSummaryReportDao(BudgetConstructionAccountSummaryReportDao budgetConstructionAccountSummaryReportDao) {
084 this.budgetConstructionAccountSummaryReportDao = budgetConstructionAccountSummaryReportDao;
085 }
086
087 /**
088 * @see org.kuali.kfs.module.bc.document.service.BudgetConstructionAccountSummaryReportService#buildReports(java.lang.Integer,
089 * java.util.Collection)
090 */
091 public Collection<BudgetConstructionOrgAccountSummaryReport> buildReports(Integer universityFiscalYear, String principalName, boolean consolidated) {
092 Collection<BudgetConstructionOrgAccountSummaryReport> reportSet = new ArrayList();
093 Collection<BudgetConstructionAccountSummary> accountSummaryList = budgetConstructionReportsServiceHelper.getDataForBuildingReports(BudgetConstructionAccountSummary.class, principalName, buildOrderByList());
094
095 // Making a list with same organizationChartOfAccountsCode, organizationCode, chartOfAccountsCode, subFundGroupCode
096 List totalList = BudgetConstructionReportHelper.deleteDuplicated((List) accountSummaryList, fieldsForTotal());
097
098 // Calculate Total Section
099 List<BudgetConstructionOrgAccountSummaryReportTotal> orgAccountSummaryReportTotalList = calculateTotal((List) accountSummaryList, totalList);
100
101 // builds report
102 for (BudgetConstructionAccountSummary accountSummaryEntry : accountSummaryList) {
103 BudgetConstructionOrgAccountSummaryReport orgAccountSummaryReportEntry = new BudgetConstructionOrgAccountSummaryReport();
104 buildReportsHeader(universityFiscalYear, orgAccountSummaryReportEntry, accountSummaryEntry, consolidated);
105 buildReportsBody(orgAccountSummaryReportEntry, accountSummaryEntry);
106 buildReportsTotal(orgAccountSummaryReportEntry, accountSummaryEntry, orgAccountSummaryReportTotalList);
107 reportSet.add(orgAccountSummaryReportEntry);
108 }
109
110 return reportSet;
111 }
112
113 /**
114 * builds report Header
115 *
116 * @param BudgetConstructionAccountSummary bcas
117 */
118 protected void buildReportsHeader(Integer universityFiscalYear, BudgetConstructionOrgAccountSummaryReport orgAccountSummaryReportEntry, BudgetConstructionAccountSummary accountSummary, boolean consolidated) {
119 String orgChartDesc = accountSummary.getOrganizationChartOfAccounts().getFinChartOfAccountDescription();
120 String chartDesc = accountSummary.getChartOfAccounts().getFinChartOfAccountDescription();
121 String orgName = accountSummary.getOrganization().getOrganizationName();
122 String reportChartDesc = accountSummary.getChartOfAccounts().getReportsToChartOfAccounts().getFinChartOfAccountDescription();
123 String subFundGroupName = accountSummary.getFundGroup().getName();
124 String subFundGroupDes = accountSummary.getSubFundGroup().getSubFundGroupDescription();
125 Integer prevFiscalyear = universityFiscalYear - 1;
126 orgAccountSummaryReportEntry.setFiscalYear(prevFiscalyear.toString() + "-" + universityFiscalYear.toString().substring(2, 4));
127 orgAccountSummaryReportEntry.setOrgChartOfAccountsCode(accountSummary.getOrganizationChartOfAccountsCode());
128
129 if (orgChartDesc == null) {
130 orgAccountSummaryReportEntry.setOrgChartOfAccountDescription(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_CHART_DESCRIPTION));
131 }
132 else {
133 orgAccountSummaryReportEntry.setOrgChartOfAccountDescription(orgChartDesc);
134 }
135
136 orgAccountSummaryReportEntry.setOrganizationCode(accountSummary.getOrganizationCode());
137 if (orgName == null) {
138 orgAccountSummaryReportEntry.setOrganizationName(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_ORGANIZATION_NAME));
139 }
140 else {
141 orgAccountSummaryReportEntry.setOrganizationName(orgName);
142 }
143
144 orgAccountSummaryReportEntry.setChartOfAccountsCode(accountSummary.getChartOfAccountsCode());
145 if (chartDesc == null) {
146 orgAccountSummaryReportEntry.setChartOfAccountDescription(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_CHART_DESCRIPTION));
147 }
148 else {
149 orgAccountSummaryReportEntry.setChartOfAccountDescription(chartDesc);
150 }
151
152 orgAccountSummaryReportEntry.setFundGroupCode(accountSummary.getFundGroupCode());
153 if (subFundGroupName == null) {
154 orgAccountSummaryReportEntry.setFundGroupName(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_FUNDGROUP_NAME));
155 }
156 else {
157 orgAccountSummaryReportEntry.setFundGroupName(subFundGroupName);
158 }
159
160 orgAccountSummaryReportEntry.setSubFundGroupCode(accountSummary.getSubFundGroupCode());
161 if (subFundGroupName == null) {
162 orgAccountSummaryReportEntry.setSubFundGroupDescription(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_SUBFUNDGROUP_DESCRIPTION));
163 }
164 else {
165 orgAccountSummaryReportEntry.setSubFundGroupDescription(subFundGroupDes);
166 }
167
168 Integer prevPrevFiscalyear = prevFiscalyear - 1;
169 orgAccountSummaryReportEntry.setBaseFy(prevPrevFiscalyear.toString() + "-" + prevFiscalyear.toString().substring(2, 4));
170 orgAccountSummaryReportEntry.setReqFy(prevFiscalyear.toString() + "-" + universityFiscalYear.toString().substring(2, 4));
171 orgAccountSummaryReportEntry.setHeader1(kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_HEADER_ACCOUNT_SUB));
172 orgAccountSummaryReportEntry.setHeader2(kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_HEADER_ACCOUNT_SUB_NAME));
173 orgAccountSummaryReportEntry.setHeader3(kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_HEADER_BASE_AMOUNT));
174 orgAccountSummaryReportEntry.setHeader4(kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_HEADER_REQ_AMOUNT));
175 orgAccountSummaryReportEntry.setHeader5(kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_HEADER_CHANGE));
176 orgAccountSummaryReportEntry.setHeader6(kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_HEADER_CHANGE));
177 if (consolidated) {
178 orgAccountSummaryReportEntry.setConsHdr(BCConstants.Report.CONSOLIIDATED);
179 }
180 else {
181 orgAccountSummaryReportEntry.setConsHdr(BCConstants.Report.BLANK);
182 }
183 }
184
185 /**
186 * builds report body
187 *
188 * @param BudgetConstructionAccountSummary bcas
189 */
190 protected void buildReportsBody(BudgetConstructionOrgAccountSummaryReport orgAccountSummaryReportEntry, BudgetConstructionAccountSummary accountSummary) {
191 orgAccountSummaryReportEntry.setAccountNumber(accountSummary.getAccountNumber());
192 orgAccountSummaryReportEntry.setSubAccountNumber(accountSummary.getSubAccountNumber());
193
194 if (accountSummary.getSubAccountNumber().equals(BCConstants.Report.DASHES_SUB_ACCOUNT_CODE)) {
195 if (accountSummary.getAccount().getAccountName() == null) {
196 orgAccountSummaryReportEntry.setAccountNameAndSubAccountName(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_ACCOUNT_DESCRIPTION));
197 }
198 else
199 orgAccountSummaryReportEntry.setAccountNameAndSubAccountName(accountSummary.getAccount().getAccountName());
200 }
201 else {
202 try {
203 if (accountSummary.getSubAccount().getSubAccountName() == null) {
204 orgAccountSummaryReportEntry.setAccountNameAndSubAccountName(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_SUB_ACCOUNT_DESCRIPTION));
205 }
206 else
207 orgAccountSummaryReportEntry.setAccountNameAndSubAccountName(accountSummary.getSubAccount().getSubAccountName());
208 }
209 catch (PersistenceBrokerException e) {
210 orgAccountSummaryReportEntry.setAccountNameAndSubAccountName(kualiConfigurationService.getPropertyString(BCKeyConstants.ERROR_REPORT_GETTING_SUB_ACCOUNT_DESCRIPTION));
211 }
212 }
213
214 // build income expense description
215 if (accountSummary.getIncomeExpenseCode().equals(BCConstants.Report.INCOME_EXP_TYPE_A)) {
216 orgAccountSummaryReportEntry.setIncExpDesc(kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_INCOME_EXP_DESC_REVENUE));
217 }
218 else if (accountSummary.getIncomeExpenseCode().equals(BCConstants.Report.INCOME_EXP_TYPE_E)) {
219 orgAccountSummaryReportEntry.setIncExpDesc(kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_INCOME_EXP_DESC_EXP_GROSS));
220 }
221 else if (accountSummary.getIncomeExpenseCode().equals(BCConstants.Report.INCOME_EXP_TYPE_T)) {
222 trExist = true;
223 orgAccountSummaryReportEntry.setIncExpDesc(kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_INCOME_EXP_DESC_TRNFR_IN));
224 }
225 else {
226 if (trExist) {
227 trExist = false;
228 orgAccountSummaryReportEntry.setIncExpDesc(kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_INCOME_EXP_DESC_EXP_NET_TRNFR));
229 }
230 else {
231 orgAccountSummaryReportEntry.setIncExpDesc(kualiConfigurationService.getPropertyString(BCKeyConstants.MSG_REPORT_INCOME_EXP_DESC_EXPENDITURE));
232 }
233 }
234
235 Integer beginingBalanceLineAmt = 0;
236 Integer accountLineAnnualBalAmt = 0;
237 if (accountSummary.getFinancialBeginningBalanceLineAmount() != null) {
238 beginingBalanceLineAmt = BudgetConstructionReportHelper.convertKualiInteger(accountSummary.getFinancialBeginningBalanceLineAmount());
239 }
240
241 if (accountSummary.getFinancialBeginningBalanceLineAmount() != null) {
242 accountLineAnnualBalAmt = BudgetConstructionReportHelper.convertKualiInteger(accountSummary.getAccountLineAnnualBalanceAmount());
243 }
244
245 orgAccountSummaryReportEntry.setBaseAmount(beginingBalanceLineAmt);
246 orgAccountSummaryReportEntry.setReqAmount(accountLineAnnualBalAmt);
247 orgAccountSummaryReportEntry.setAmountChange(accountLineAnnualBalAmt - beginingBalanceLineAmt);
248
249 orgAccountSummaryReportEntry.setPercentChange(BudgetConstructionReportHelper.calculatePercent(orgAccountSummaryReportEntry.getAmountChange(), beginingBalanceLineAmt));
250
251 }
252
253 /**
254 * builds report total
255 *
256 * @param BudgetConstructionAccountSummary bcas
257 * @param List reportTotalList
258 */
259 protected void buildReportsTotal(BudgetConstructionOrgAccountSummaryReport orgAccountSummaryReportEntry, BudgetConstructionAccountSummary accountSummary, List reportTotalList) {
260 Iterator totalListIter = reportTotalList.iterator();
261 while (totalListIter.hasNext()) {
262 BudgetConstructionOrgAccountSummaryReportTotal bcasTotalEntry = (BudgetConstructionOrgAccountSummaryReportTotal) totalListIter.next();
263 if (BudgetConstructionReportHelper.isSameEntry(accountSummary, bcasTotalEntry.getBcas(), fieldsForTotal())) {
264 BigDecimal percentChange = BigDecimal.ZERO;
265 orgAccountSummaryReportEntry.setTotalRevenueBaseAmount(bcasTotalEntry.getTotalRevenueBaseAmount());
266 orgAccountSummaryReportEntry.setTotalGrossBaseAmount(bcasTotalEntry.getTotalGrossBaseAmount());
267 orgAccountSummaryReportEntry.setTotalTransferInBaseAmount(bcasTotalEntry.getTotalTransferInBaseAmount());
268 orgAccountSummaryReportEntry.setTotalNetTransferBaseAmount(bcasTotalEntry.getTotalNetTransferBaseAmount());
269
270 orgAccountSummaryReportEntry.setTotalRevenueReqAmount(bcasTotalEntry.getTotalRevenueReqAmount());
271 orgAccountSummaryReportEntry.setTotalGrossReqAmount(bcasTotalEntry.getTotalGrossReqAmount());
272 orgAccountSummaryReportEntry.setTotalTransferInReqAmount(bcasTotalEntry.getTotalTransferInReqAmount());
273 orgAccountSummaryReportEntry.setTotalNetTransferReqAmount(bcasTotalEntry.getTotalNetTransferReqAmount());
274
275 orgAccountSummaryReportEntry.setTotalRevenueAmountChange(orgAccountSummaryReportEntry.getTotalRevenueReqAmount() - orgAccountSummaryReportEntry.getTotalRevenueBaseAmount());
276 percentChange = BudgetConstructionReportHelper.calculatePercent(orgAccountSummaryReportEntry.getTotalRevenueAmountChange(), orgAccountSummaryReportEntry.getTotalRevenueBaseAmount());
277 orgAccountSummaryReportEntry.setTotalRevenuePercentChange(percentChange);
278
279 orgAccountSummaryReportEntry.setTotalGrossAmountChange(orgAccountSummaryReportEntry.getTotalGrossReqAmount() - orgAccountSummaryReportEntry.getTotalGrossBaseAmount());
280 percentChange = BudgetConstructionReportHelper.calculatePercent(orgAccountSummaryReportEntry.getTotalGrossAmountChange(), orgAccountSummaryReportEntry.getTotalGrossBaseAmount());
281 orgAccountSummaryReportEntry.setTotalGrossPercentChange(percentChange);
282
283 orgAccountSummaryReportEntry.setTotalTransferAmountChange(orgAccountSummaryReportEntry.getTotalTransferInReqAmount() - orgAccountSummaryReportEntry.getTotalTransferInBaseAmount());
284 percentChange = BudgetConstructionReportHelper.calculatePercent(orgAccountSummaryReportEntry.getTotalTransferAmountChange(), orgAccountSummaryReportEntry.getTotalTransferInBaseAmount());
285 orgAccountSummaryReportEntry.setTotalTransferInPercentChange(percentChange);
286
287 orgAccountSummaryReportEntry.setTotalNetTransferAmountChange(orgAccountSummaryReportEntry.getTotalNetTransferReqAmount() - orgAccountSummaryReportEntry.getTotalNetTransferBaseAmount());
288 percentChange = BudgetConstructionReportHelper.calculatePercent(orgAccountSummaryReportEntry.getTotalNetTransferAmountChange(), orgAccountSummaryReportEntry.getTotalNetTransferBaseAmount());
289 orgAccountSummaryReportEntry.setTotalNetTransferPercentChange(percentChange);
290
291 orgAccountSummaryReportEntry.setRevExpDifferenceBaseAmount(orgAccountSummaryReportEntry.getTotalRevenueBaseAmount() - orgAccountSummaryReportEntry.getTotalNetTransferBaseAmount());
292 orgAccountSummaryReportEntry.setRevExpDifferenceReqAmount(orgAccountSummaryReportEntry.getTotalRevenueReqAmount() - orgAccountSummaryReportEntry.getTotalNetTransferReqAmount());
293 orgAccountSummaryReportEntry.setRevExpDifferenceAmountChange(orgAccountSummaryReportEntry.getRevExpDifferenceReqAmount() - orgAccountSummaryReportEntry.getRevExpDifferenceBaseAmount());
294 percentChange = BudgetConstructionReportHelper.calculatePercent(orgAccountSummaryReportEntry.getRevExpDifferenceAmountChange(), orgAccountSummaryReportEntry.getRevExpDifferenceBaseAmount());
295 orgAccountSummaryReportEntry.setRevExpDifferencePercentChange(percentChange);
296 }
297 }
298 }
299
300 /**
301 * Calculates total part of report
302 *
303 * @param List bcasList
304 * @param List simpleList
305 */
306 protected List calculateTotal(List bcasList, List simpleList) {
307
308 Integer totalRevenueBaseAmount = 0;
309 Integer totalGrossBaseAmount = 0;
310 Integer totalTransferInBaseAmount = 0;
311 Integer totalNetTransferBaseAmount = 0;
312 Integer totalRevenueReqAmount = 0;
313 Integer totalGrossReqAmount = 0;
314 Integer totalTransferInReqAmount = 0;
315 Integer totalNetTransferReqAmount = 0;
316
317 List returnList = new ArrayList();
318 Iterator simpleListIterator = simpleList.iterator();
319 boolean prev = false;
320 while (simpleListIterator.hasNext()) {
321 BudgetConstructionAccountSummary simpleBcasEntry = (BudgetConstructionAccountSummary) simpleListIterator.next();
322 Iterator bcasListIterator = bcasList.iterator();
323 while (bcasListIterator.hasNext()) {
324 BudgetConstructionAccountSummary bcasListEntry = (BudgetConstructionAccountSummary) bcasListIterator.next();
325 if (BudgetConstructionReportHelper.isSameEntry(simpleBcasEntry, bcasListEntry, fieldsForTotal())) {
326 if (bcasListEntry.getIncomeExpenseCode().equals(BCConstants.Report.INCOME_EXP_TYPE_A)) {
327 prev = false;
328 totalRevenueBaseAmount += BudgetConstructionReportHelper.convertKualiInteger(bcasListEntry.getFinancialBeginningBalanceLineAmount());
329 totalRevenueReqAmount += BudgetConstructionReportHelper.convertKualiInteger(bcasListEntry.getAccountLineAnnualBalanceAmount());
330 }
331 else if (bcasListEntry.getIncomeExpenseCode().equals(BCConstants.Report.INCOME_EXP_TYPE_E)) {
332 prev = false;
333 totalGrossBaseAmount += BudgetConstructionReportHelper.convertKualiInteger(bcasListEntry.getFinancialBeginningBalanceLineAmount());
334 totalGrossReqAmount += BudgetConstructionReportHelper.convertKualiInteger(bcasListEntry.getAccountLineAnnualBalanceAmount());
335
336 }
337 else if (bcasListEntry.getIncomeExpenseCode().equals(BCConstants.Report.INCOME_EXP_TYPE_T)) {
338 prev = true;
339 totalTransferInBaseAmount += BudgetConstructionReportHelper.convertKualiInteger(bcasListEntry.getFinancialBeginningBalanceLineAmount());
340 totalTransferInReqAmount += BudgetConstructionReportHelper.convertKualiInteger(bcasListEntry.getAccountLineAnnualBalanceAmount());
341 }
342 else if (bcasListEntry.getIncomeExpenseCode().equals(BCConstants.Report.INCOME_EXP_TYPE_X)) {
343 totalNetTransferBaseAmount += BudgetConstructionReportHelper.convertKualiInteger(bcasListEntry.getFinancialBeginningBalanceLineAmount());
344 totalNetTransferReqAmount += BudgetConstructionReportHelper.convertKualiInteger(bcasListEntry.getAccountLineAnnualBalanceAmount());
345 if (!prev) {
346 prev = false;
347 totalGrossBaseAmount += BudgetConstructionReportHelper.convertKualiInteger(bcasListEntry.getFinancialBeginningBalanceLineAmount());
348 totalGrossReqAmount += BudgetConstructionReportHelper.convertKualiInteger(bcasListEntry.getAccountLineAnnualBalanceAmount());
349 }
350 }
351 }
352 }
353 BudgetConstructionOrgAccountSummaryReportTotal bcoasrTotal = new BudgetConstructionOrgAccountSummaryReportTotal();
354 bcoasrTotal.setBcas(simpleBcasEntry);
355 bcoasrTotal.setTotalGrossBaseAmount(totalGrossBaseAmount);
356 bcoasrTotal.setTotalGrossReqAmount(totalGrossReqAmount);
357 bcoasrTotal.setTotalNetTransferBaseAmount(totalNetTransferBaseAmount);
358 bcoasrTotal.setTotalNetTransferReqAmount(totalNetTransferReqAmount);
359 bcoasrTotal.setTotalRevenueBaseAmount(totalRevenueBaseAmount);
360 bcoasrTotal.setTotalRevenueReqAmount(totalRevenueReqAmount);
361 bcoasrTotal.setTotalTransferInBaseAmount(totalTransferInBaseAmount);
362 bcoasrTotal.setTotalTransferInReqAmount(totalTransferInReqAmount);
363 returnList.add(bcoasrTotal);
364 totalGrossBaseAmount = 0;
365 totalGrossReqAmount = 0;
366 totalNetTransferBaseAmount = 0;
367 totalNetTransferReqAmount = 0;
368 totalRevenueBaseAmount = 0;
369 totalRevenueReqAmount = 0;
370 totalTransferInBaseAmount = 0;
371 totalTransferInReqAmount = 0;
372 }
373
374 return returnList;
375 }
376
377 protected List<String> fieldsForTotal() {
378
379 List<String> fieldList = new ArrayList();
380 fieldList.add(KFSPropertyConstants.ORGANIZATION_CHART_OF_ACCOUNTS_CODE);
381 fieldList.add(KFSPropertyConstants.ORGANIZATION_CODE);
382 fieldList.add(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE);
383 fieldList.add(KFSPropertyConstants.SUB_FUND_GROUP_CODE);
384
385 return fieldList;
386 }
387
388 /**
389 * builds orderByList for sort order.
390 *
391 * @return returnList
392 */
393 public List<String> buildOrderByList() {
394 List<String> returnList = new ArrayList();
395 returnList.add(KFSPropertyConstants.ORGANIZATION_CHART_OF_ACCOUNTS_CODE);
396 returnList.add(KFSPropertyConstants.ORGANIZATION_CODE);
397 returnList.add(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE);
398 returnList.add(KFSPropertyConstants.SUB_FUND_SORT_CODE);
399 returnList.add(KFSPropertyConstants.FUND_GROUP_CODE);
400 returnList.add(KFSPropertyConstants.SUB_FUND_GROUP_CODE);
401 returnList.add(KFSPropertyConstants.ACCOUNT_NUMBER);
402 returnList.add(KFSPropertyConstants.SUB_ACCOUNT_NUMBER);
403 returnList.add(KFSPropertyConstants.INCOME_EXPENSE_CODE);
404
405 return returnList;
406 }
407
408 public void setKualiConfigurationService(KualiConfigurationService kualiConfigurationService) {
409 this.kualiConfigurationService = kualiConfigurationService;
410 }
411
412 public void setBudgetConstructionReportsServiceHelper(BudgetConstructionReportsServiceHelper budgetConstructionReportsServiceHelper) {
413 this.budgetConstructionReportsServiceHelper = budgetConstructionReportsServiceHelper;
414 }
415 }