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;
017    
018    import java.math.BigDecimal;
019    import java.util.ArrayList;
020    import java.util.HashMap;
021    import java.util.LinkedHashMap;
022    import java.util.List;
023    import java.util.ListIterator;
024    import java.util.Map;
025    
026    import org.kuali.kfs.coa.businessobject.Account;
027    import org.kuali.kfs.coa.businessobject.Chart;
028    import org.kuali.kfs.coa.businessobject.Organization;
029    import org.kuali.kfs.coa.businessobject.SubAccount;
030    import org.kuali.kfs.module.bc.BCConstants;
031    import org.kuali.kfs.module.bc.BCConstants.AccountSalarySettingOnlyCause;
032    import org.kuali.kfs.module.bc.businessobject.BudgetConstructionAccountReports;
033    import org.kuali.kfs.module.bc.businessobject.PendingBudgetConstructionGeneralLedger;
034    import org.kuali.kfs.module.bc.document.service.BudgetParameterService;
035    import org.kuali.kfs.sys.KFSConstants;
036    import org.kuali.kfs.sys.KFSPropertyConstants;
037    import org.kuali.kfs.sys.context.SpringContext;
038    import org.kuali.kfs.sys.document.FinancialSystemTransactionalDocumentBase;
039    import org.kuali.rice.kew.dto.DocumentRouteStatusChangeDTO;
040    import org.kuali.rice.kim.bo.Person;
041    import org.kuali.rice.kns.service.BusinessObjectService;
042    import org.kuali.rice.kns.util.KualiDecimal;
043    import org.kuali.rice.kns.util.KualiInteger;
044    import org.kuali.rice.kns.util.TypedArrayList;
045    
046    public class BudgetConstructionDocument extends FinancialSystemTransactionalDocumentBase {
047    
048        protected static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BudgetConstructionDocument.class);
049    
050        protected Integer universityFiscalYear;
051        protected String chartOfAccountsCode;
052        protected String accountNumber;
053        protected String subAccountNumber;
054        protected Integer organizationLevelCode;
055        protected String organizationLevelChartOfAccountsCode;
056        protected String organizationLevelOrganizationCode;
057        protected String budgetLockUserIdentifier;
058        protected String budgetTransactionLockUserIdentifier;
059    
060        protected Chart chartOfAccounts;
061        protected Account account;
062        protected SubAccount subAccount;
063        protected Person budgetLockUser;
064        protected Person budgetTransactionLockUser;
065        protected Organization organizationLevelOrganization;
066        protected BudgetConstructionAccountReports budgetConstructionAccountReports;
067    
068        protected List pendingBudgetConstructionGeneralLedgerRevenueLines;
069        protected List pendingBudgetConstructionGeneralLedgerExpenditureLines;
070    
071        protected Integer previousUniversityFiscalYear;
072    
073        // revenue and expenditure line totals
074        protected KualiInteger revenueAccountLineAnnualBalanceAmountTotal;
075        protected KualiInteger revenueFinancialBeginningBalanceLineAmountTotal;
076        protected KualiDecimal revenuePercentChangeTotal;
077        protected KualiInteger expenditureAccountLineAnnualBalanceAmountTotal;
078        protected KualiInteger expenditureFinancialBeginningBalanceLineAmountTotal;
079        protected KualiDecimal expenditurePercentChangeTotal;
080    
081        // benefits calculation state flags
082        // these are set when a change is detected in the request and the line
083        // is involved in the benefits calculation - ie exists in
084        protected boolean isBenefitsCalcNeeded;
085        protected boolean isMonthlyBenefitsCalcNeeded;
086    
087        protected boolean isSalarySettingOnly;
088        protected AccountSalarySettingOnlyCause accountSalarySettingOnlyCause;
089        protected boolean containsTwoPlug = false;
090        protected boolean budgetableDocument = false;
091    
092        // This property supports a hack to indicate to the rules framework
093        // the user is performing an action (save) that forces rules check on nonZero request amounts
094        // while still allowing the user to do salary setting cleanup when a document becomes not budgetable
095        protected boolean cleanupModeActionForceCheck = false;
096    
097        public BudgetConstructionDocument() {
098            super();
099            // setPendingBudgetConstructionGeneralLedgerExpenditureLines(new ArrayList());
100            // setPendingBudgetConstructionGeneralLedgerRevenueLines(new ArrayList());
101            setPendingBudgetConstructionGeneralLedgerExpenditureLines(new TypedArrayList(PendingBudgetConstructionGeneralLedger.class));
102            setPendingBudgetConstructionGeneralLedgerRevenueLines(new TypedArrayList(PendingBudgetConstructionGeneralLedger.class));
103            zeroTotals();
104        }
105    
106        /**
107         * This zeros revenue and expenditure totals displayed on the BC document screen
108         */
109        public void zeroTotals() {
110    
111            revenueAccountLineAnnualBalanceAmountTotal = new KualiInteger(BigDecimal.ZERO);
112            revenueFinancialBeginningBalanceLineAmountTotal = new KualiInteger(BigDecimal.ZERO);
113            revenuePercentChangeTotal = new KualiDecimal(0);
114            expenditureAccountLineAnnualBalanceAmountTotal = new KualiInteger(BigDecimal.ZERO);
115            expenditureFinancialBeginningBalanceLineAmountTotal = new KualiInteger(BigDecimal.ZERO);
116            expenditurePercentChangeTotal = new KualiDecimal(0);
117        }
118    
119        /**
120         * move stuff from constructor to here so as to get out of fred's way initiateDocument would be called from
121         * BudgetConstructionAction
122         */
123        public void initiateDocument() {
124    
125    
126            Map fieldValues = new HashMap();
127            // fieldValues.put("UNIV_FISCAL_YR", new Integer(2008));
128            // fieldValues.put("FIN_COA_CD", "BA");
129            // fieldValues.put("ACCOUNT_NBR", "6044906");
130            // fieldValues.put("SUB_ACCT_NBR", "-----");
131            // fieldValues.put("UNIV_FISCAL_YR", budgetConstructionHeader.getUniversityFiscalYear());
132            // fieldValues.put("FIN_COA_CD", budgetConstructionHeader.getChartOfAccountsCode());
133            // fieldValues.put("ACCOUNT_NBR", budgetConstructionHeader.getAccountNumber());
134            // fieldValues.put("SUB_ACCT_NBR", budgetConstructionHeader.getSubAccountNumber());
135            fieldValues.put("UNIV_FISCAL_YR", getUniversityFiscalYear());
136            fieldValues.put("FIN_COA_CD", getChartOfAccountsCode());
137            fieldValues.put("ACCOUNT_NBR", getAccountNumber());
138            fieldValues.put("SUB_ACCT_NBR", getSubAccountNumber());
139    
140            // this needs to do query FIN_OBJ_TYP_CD IN ('IN','IC','IN') or equivalent
141            fieldValues.put("FIN_OBJ_TYP_CD", "IN");
142    
143            pendingBudgetConstructionGeneralLedgerRevenueLines = (ArrayList) SpringContext.getBean(BusinessObjectService.class).findMatchingOrderBy(PendingBudgetConstructionGeneralLedger.class, fieldValues, "FIN_OBJECT_CD", true);
144            if (LOG.isDebugEnabled()) {
145                LOG.debug("pendingBudgetConstructionGeneralLedgerRevenue is: " + pendingBudgetConstructionGeneralLedgerRevenueLines);
146            }
147    
148            // this needs to do query FIN_OBJ_TYP_CD IN ('EE','ES','EX') or equivalent
149            fieldValues.remove("FIN_OBJ_TYP_CD");
150            fieldValues.put("FIN_OBJ_TYP_CD", "EX");
151    
152            pendingBudgetConstructionGeneralLedgerExpenditureLines = (ArrayList) SpringContext.getBean(BusinessObjectService.class).findMatchingOrderBy(PendingBudgetConstructionGeneralLedger.class, fieldValues, "FIN_OBJECT_CD", true);
153            if (LOG.isDebugEnabled()) {
154                LOG.debug("pendingBudgetConstructionGeneralLedgerExpenditure is: " + pendingBudgetConstructionGeneralLedgerExpenditureLines);
155            }
156            // Iterator<PendingBudgetConstructionGeneralLedger> iter =
157            // pendingBudgetConstructionGeneralLedgerExpenditureLines.iterator();
158            // while (iter.hasNext()){
159            // iter.next().refreshReferenceObject("budgetConstructionMonthly");
160            // }
161    
162        }
163    
164        /**
165         * This adds a revenue or expenditure line to the appropriate list
166         * 
167         * @param isRevenue
168         * @param line
169         */
170        public int addPBGLLine(PendingBudgetConstructionGeneralLedger line, boolean isRevenue) {
171            int insertPoint = 0;
172            ListIterator pbglLines;
173            if (isRevenue) {
174                pbglLines = this.getPendingBudgetConstructionGeneralLedgerRevenueLines().listIterator();
175            }
176            else {
177                pbglLines = this.getPendingBudgetConstructionGeneralLedgerExpenditureLines().listIterator();
178            }
179            while (pbglLines.hasNext()) {
180                PendingBudgetConstructionGeneralLedger pbglLine = (PendingBudgetConstructionGeneralLedger) pbglLines.next();
181                if (pbglLine.getFinancialObjectCode().compareToIgnoreCase(line.getFinancialObjectCode()) < 0) {
182                    insertPoint++;
183                }
184                else {
185                    if (pbglLine.getFinancialObjectCode().compareToIgnoreCase(line.getFinancialObjectCode()) > 0) {
186                        break;
187                    }
188                    else {
189                        if ((pbglLine.getFinancialObjectCode().compareToIgnoreCase(line.getFinancialObjectCode()) == 0) && (pbglLine.getFinancialSubObjectCode().compareToIgnoreCase(line.getFinancialSubObjectCode()) < 0)) {
190                            insertPoint++;
191                        }
192                        else {
193                            break;
194                        }
195                    }
196                }
197            }
198            if (isRevenue) {
199                this.pendingBudgetConstructionGeneralLedgerRevenueLines.add(insertPoint, line);
200            }
201            else {
202                this.pendingBudgetConstructionGeneralLedgerExpenditureLines.add(insertPoint, line);
203            }
204            return insertPoint;
205    
206        }
207    
208        /**
209         * Gets the universityFiscalYear attribute.
210         * 
211         * @return Returns the universityFiscalYear
212         */
213        public Integer getUniversityFiscalYear() {
214            return universityFiscalYear;
215        }
216    
217        /**
218         * Sets the universityFiscalYear attribute.
219         * 
220         * @param universityFiscalYear The universityFiscalYear to set.
221         */
222        public void setUniversityFiscalYear(Integer universityFiscalYear) {
223            this.universityFiscalYear = universityFiscalYear;
224            setPreviousUniversityFiscalYear(universityFiscalYear - 1);
225        }
226    
227    
228        /**
229         * Gets the chartOfAccountsCode attribute.
230         * 
231         * @return Returns the chartOfAccountsCode
232         */
233        public String getChartOfAccountsCode() {
234            return chartOfAccountsCode;
235        }
236    
237        /**
238         * Sets the chartOfAccountsCode attribute.
239         * 
240         * @param chartOfAccountsCode The chartOfAccountsCode to set.
241         */
242        public void setChartOfAccountsCode(String chartOfAccountsCode) {
243            this.chartOfAccountsCode = chartOfAccountsCode;
244        }
245    
246    
247        /**
248         * Gets the accountNumber attribute.
249         * 
250         * @return Returns the accountNumber
251         */
252        public String getAccountNumber() {
253            return accountNumber;
254        }
255    
256        /**
257         * Sets the accountNumber attribute.
258         * 
259         * @param accountNumber The accountNumber to set.
260         */
261        public void setAccountNumber(String accountNumber) {
262            this.accountNumber = accountNumber;
263        }
264    
265    
266        /**
267         * Gets the subAccountNumber attribute.
268         * 
269         * @return Returns the subAccountNumber
270         */
271        public String getSubAccountNumber() {
272            return subAccountNumber;
273        }
274    
275        /**
276         * Sets the subAccountNumber attribute.
277         * 
278         * @param subAccountNumber The subAccountNumber to set.
279         */
280        public void setSubAccountNumber(String subAccountNumber) {
281            this.subAccountNumber = subAccountNumber;
282        }
283    
284    
285        /**
286         * Gets the organizationLevelCode attribute.
287         * 
288         * @return Returns the organizationLevelCode
289         */
290        public Integer getOrganizationLevelCode() {
291            return organizationLevelCode;
292        }
293    
294        /**
295         * Sets the organizationLevelCode attribute.
296         * 
297         * @param organizationLevelCode The organizationLevelCode to set.
298         */
299        public void setOrganizationLevelCode(Integer organizationLevelCode) {
300            this.organizationLevelCode = organizationLevelCode;
301        }
302    
303    
304        /**
305         * Gets the organizationLevelChartOfAccountsCode attribute.
306         * 
307         * @return Returns the organizationLevelChartOfAccountsCode
308         */
309        public String getOrganizationLevelChartOfAccountsCode() {
310            return organizationLevelChartOfAccountsCode;
311        }
312    
313        /**
314         * Sets the organizationLevelChartOfAccountsCode attribute.
315         * 
316         * @param organizationLevelChartOfAccountsCode The organizationLevelChartOfAccountsCode to set.
317         */
318        public void setOrganizationLevelChartOfAccountsCode(String organizationLevelChartOfAccountsCode) {
319            this.organizationLevelChartOfAccountsCode = organizationLevelChartOfAccountsCode;
320        }
321    
322    
323        /**
324         * Gets the organizationLevelOrganizationCode attribute.
325         * 
326         * @return Returns the organizationLevelOrganizationCode
327         */
328        public String getOrganizationLevelOrganizationCode() {
329            return organizationLevelOrganizationCode;
330        }
331    
332        /**
333         * Sets the organizationLevelOrganizationCode attribute.
334         * 
335         * @param organizationLevelOrganizationCode The organizationLevelOrganizationCode to set.
336         */
337        public void setOrganizationLevelOrganizationCode(String organizationLevelOrganizationCode) {
338            this.organizationLevelOrganizationCode = organizationLevelOrganizationCode;
339        }
340    
341    
342        /**
343         * Gets the budgetLockUserIdentifier attribute.
344         * 
345         * @return Returns the budgetLockUserIdentifier
346         */
347        public String getBudgetLockUserIdentifier() {
348            return budgetLockUserIdentifier;
349        }
350    
351        /**
352         * Sets the budgetLockUserIdentifier attribute.
353         * 
354         * @param budgetLockUserIdentifier The budgetLockUserIdentifier to set.
355         */
356        public void setBudgetLockUserIdentifier(String budgetLockUserIdentifier) {
357            this.budgetLockUserIdentifier = budgetLockUserIdentifier;
358        }
359    
360    
361        /**
362         * Gets the budgetTransactionLockUserIdentifier attribute.
363         * 
364         * @return Returns the budgetTransactionLockUserIdentifier
365         */
366        public String getBudgetTransactionLockUserIdentifier() {
367            return budgetTransactionLockUserIdentifier;
368        }
369    
370        /**
371         * Sets the budgetTransactionLockUserIdentifier attribute.
372         * 
373         * @param budgetTransactionLockUserIdentifier The budgetTransactionLockUserIdentifier to set.
374         */
375        public void setBudgetTransactionLockUserIdentifier(String budgetTransactionLockUserIdentifier) {
376            this.budgetTransactionLockUserIdentifier = budgetTransactionLockUserIdentifier;
377        }
378    
379    
380        /**
381         * Gets the chartOfAccounts attribute.
382         * 
383         * @return Returns the chartOfAccounts
384         */
385        public Chart getChartOfAccounts() {
386            return chartOfAccounts;
387        }
388    
389        /**
390         * Sets the chartOfAccounts attribute.
391         * 
392         * @param chartOfAccounts The chartOfAccounts to set.
393         * @deprecated
394         */
395        public void setChartOfAccounts(Chart chartOfAccounts) {
396            this.chartOfAccounts = chartOfAccounts;
397        }
398    
399        /**
400         * Gets the account attribute.
401         * 
402         * @return Returns the account
403         */
404        public Account getAccount() {
405            return account;
406        }
407    
408        /**
409         * Sets the account attribute.
410         * 
411         * @param account The account to set.
412         * @deprecated
413         */
414        public void setAccount(Account account) {
415            this.account = account;
416        }
417    
418        public Person getBudgetLockUser() {
419            budgetLockUser = SpringContext.getBean(org.kuali.rice.kim.service.PersonService.class).updatePersonIfNecessary(budgetLockUserIdentifier, budgetLockUser);
420            return budgetLockUser;
421        }
422    
423        /**
424         * Sets the budgetLockUser attribute.
425         * 
426         * @param budgetLockUser The budgetLockUser to set.
427         * @deprecated
428         */
429        public void setBudgetLockUser(Person budgetLockUser) {
430            this.budgetLockUser = budgetLockUser;
431        }
432    
433        public Person getBudgetTransactionLockUser() {
434            budgetTransactionLockUser = SpringContext.getBean(org.kuali.rice.kim.service.PersonService.class).updatePersonIfNecessary(budgetTransactionLockUserIdentifier, budgetTransactionLockUser);
435            return budgetTransactionLockUser;
436        }
437    
438        /**
439         * Sets the budgetTransactionLockUser attribute value.
440         * 
441         * @param budgetTransactionLockUser The budgetTransactionLockUser to set.
442         * @deprecated
443         */
444        public void setBudgetTransactionLockUser(Person budgetTransactionLockUser) {
445            this.budgetTransactionLockUser = budgetTransactionLockUser;
446        }
447    
448        /**
449         * Gets the organizationLevelOrganization attribute.
450         * 
451         * @return Returns the organizationLevelOrganization.
452         */
453        public Organization getOrganizationLevelOrganization() {
454            return organizationLevelOrganization;
455        }
456    
457        /**
458         * Sets the organizationLevelOrganization attribute value.
459         * 
460         * @param organizationLevelOrganization The organizationLevelOrganization to set.
461         * @deprecated
462         */
463        public void setOrganizationLevelOrganization(Organization organizationLevelOrganization) {
464            this.organizationLevelOrganization = organizationLevelOrganization;
465        }
466    
467        /**
468         * Gets the subAccount attribute.
469         * 
470         * @return Returns the subAccount.
471         */
472        public SubAccount getSubAccount() {
473            return subAccount;
474        }
475    
476        /**
477         * Sets the subAccount attribute value.
478         * 
479         * @param subAccount The subAccount to set.
480         */
481        public void setSubAccount(SubAccount subAccount) {
482            this.subAccount = subAccount;
483        }
484    
485        /**
486         * Gets the previousUniversityFiscalYear attribute.
487         * 
488         * @return Returns the previousUniversityFiscalYear.
489         */
490        public Integer getPreviousUniversityFiscalYear() {
491            if (previousUniversityFiscalYear == null) {
492                this.previousUniversityFiscalYear = this.getUniversityFiscalYear() - 1;
493            }
494            return previousUniversityFiscalYear;
495        }
496    
497        /**
498         * Sets the previousUniversityFiscalYear attribute value.
499         * 
500         * @param previousUniversityFiscalYear The previousUniversityFiscalYear to set.
501         */
502        public void setPreviousUniversityFiscalYear(Integer previousUniversityFiscalYear) {
503            this.previousUniversityFiscalYear = previousUniversityFiscalYear;
504        }
505    
506        /**
507         * Gets the budgetConstructionAccountReports attribute.
508         * 
509         * @return Returns the budgetConstructionAccountReports.
510         */
511        public BudgetConstructionAccountReports getBudgetConstructionAccountReports() {
512            return budgetConstructionAccountReports;
513        }
514    
515        /**
516         * Sets the budgetConstructionAccountReports attribute value.
517         * 
518         * @param budgetConstructionAccountReports The budgetConstructionAccountReports to set.
519         * @deprecated
520         */
521        public void setBudgetConstructionAccountReports(BudgetConstructionAccountReports budgetConstructionAccountReports) {
522            this.budgetConstructionAccountReports = budgetConstructionAccountReports;
523        }
524    
525        /**
526         * @see org.kuali.rice.kns.document.DocumentBase#buildListOfDeletionAwareLists()
527         */
528        @Override
529        public List buildListOfDeletionAwareLists() {
530            // return new ArrayList();
531            List managedLists = super.buildListOfDeletionAwareLists();
532    
533            managedLists.add(getPendingBudgetConstructionGeneralLedgerRevenueLines());
534            managedLists.add(getPendingBudgetConstructionGeneralLedgerExpenditureLines());
535            // managedLists.add(getSourceAccountingLines());
536            // managedLists.add(getTargetAccountingLines());
537    
538            return managedLists;
539        }
540    
541        public List<PendingBudgetConstructionGeneralLedger> getPendingBudgetConstructionGeneralLedgerRevenueLines() {
542            return pendingBudgetConstructionGeneralLedgerRevenueLines;
543        }
544    
545        public void setPendingBudgetConstructionGeneralLedgerRevenueLines(List pendingBudgetConstructionGeneralLedgerRevenueLines) {
546            this.pendingBudgetConstructionGeneralLedgerRevenueLines = pendingBudgetConstructionGeneralLedgerRevenueLines;
547        }
548    
549        public List<PendingBudgetConstructionGeneralLedger> getPendingBudgetConstructionGeneralLedgerExpenditureLines() {
550            return pendingBudgetConstructionGeneralLedgerExpenditureLines;
551        }
552    
553        public void setPendingBudgetConstructionGeneralLedgerExpenditureLines(List pendingBudgetConstructionGeneralLedgerExpenditureLines) {
554            this.pendingBudgetConstructionGeneralLedgerExpenditureLines = pendingBudgetConstructionGeneralLedgerExpenditureLines;
555        }
556    
557        /**
558         * Gets the expenditureAccountLineAnnualBalanceAmountTotal attribute.
559         * 
560         * @return Returns the expenditureAccountLineAnnualBalanceAmountTotal.
561         */
562        public KualiInteger getExpenditureAccountLineAnnualBalanceAmountTotal() {
563            return expenditureAccountLineAnnualBalanceAmountTotal;
564        }
565    
566        /**
567         * Sets the expenditureAccountLineAnnualBalanceAmountTotal attribute value.
568         * 
569         * @param expenditureAccountLineAnnualBalanceAmountTotal The expenditureAccountLineAnnualBalanceAmountTotal to set.
570         */
571        public void setExpenditureAccountLineAnnualBalanceAmountTotal(KualiInteger expenditureAccountLineAnnualBalanceAmountTotal) {
572            this.expenditureAccountLineAnnualBalanceAmountTotal = expenditureAccountLineAnnualBalanceAmountTotal;
573        }
574    
575        /**
576         * Gets the expenditureFinancialBeginningBalanceLineAmountTotal attribute.
577         * 
578         * @return Returns the expenditureFinancialBeginningBalanceLineAmountTotal.
579         */
580        public KualiInteger getExpenditureFinancialBeginningBalanceLineAmountTotal() {
581            return expenditureFinancialBeginningBalanceLineAmountTotal;
582        }
583    
584        /**
585         * Sets the expenditureFinancialBeginningBalanceLineAmountTotal attribute value.
586         * 
587         * @param expenditureFinancialBeginningBalanceLineAmountTotal The expenditureFinancialBeginningBalanceLineAmountTotal to set.
588         */
589        public void setExpenditureFinancialBeginningBalanceLineAmountTotal(KualiInteger expenditureFinancialBeginningBalanceLineAmountTotal) {
590            this.expenditureFinancialBeginningBalanceLineAmountTotal = expenditureFinancialBeginningBalanceLineAmountTotal;
591        }
592    
593        /**
594         * Gets the revenueAccountLineAnnualBalanceAmountTotal attribute.
595         * 
596         * @return Returns the revenueAccountLineAnnualBalanceAmountTotal.
597         */
598        public KualiInteger getRevenueAccountLineAnnualBalanceAmountTotal() {
599            return revenueAccountLineAnnualBalanceAmountTotal;
600        }
601    
602        /**
603         * Sets the revenueAccountLineAnnualBalanceAmountTotal attribute value.
604         * 
605         * @param revenueAccountLineAnnualBalanceAmountTotal The revenueAccountLineAnnualBalanceAmountTotal to set.
606         */
607        public void setRevenueAccountLineAnnualBalanceAmountTotal(KualiInteger revenueAccountLineAnnualBalanceAmountTotal) {
608            this.revenueAccountLineAnnualBalanceAmountTotal = revenueAccountLineAnnualBalanceAmountTotal;
609        }
610    
611        /**
612         * Gets the revenueFinancialBeginningBalanceLineAmountTotal attribute.
613         * 
614         * @return Returns the revenueFinancialBeginningBalanceLineAmountTotal.
615         */
616        public KualiInteger getRevenueFinancialBeginningBalanceLineAmountTotal() {
617            return revenueFinancialBeginningBalanceLineAmountTotal;
618        }
619    
620        /**
621         * Sets the revenueFinancialBeginningBalanceLineAmountTotal attribute value.
622         * 
623         * @param revenueFinancialBeginningBalanceLineAmountTotal The revenueFinancialBeginningBalanceLineAmountTotal to set.
624         */
625        public void setRevenueFinancialBeginningBalanceLineAmountTotal(KualiInteger revenueFinancialBeginningBalanceLineAmountTotal) {
626            this.revenueFinancialBeginningBalanceLineAmountTotal = revenueFinancialBeginningBalanceLineAmountTotal;
627        }
628    
629        /**
630         * Gets the expenditurePercentChangeTotal attribute.
631         * 
632         * @return Returns the expenditurePercentChangeTotal.
633         */
634        public KualiDecimal getExpenditurePercentChangeTotal() {
635            if (expenditureFinancialBeginningBalanceLineAmountTotal == null || expenditureFinancialBeginningBalanceLineAmountTotal.isZero()) {
636                this.expenditurePercentChangeTotal = null;
637            }
638            else {
639                BigDecimal diffRslt = (expenditureAccountLineAnnualBalanceAmountTotal.bigDecimalValue().setScale(4)).subtract(expenditureFinancialBeginningBalanceLineAmountTotal.bigDecimalValue().setScale(4));
640                BigDecimal divRslt = diffRslt.divide((expenditureFinancialBeginningBalanceLineAmountTotal.bigDecimalValue().setScale(4)), KualiDecimal.ROUND_BEHAVIOR);
641                this.expenditurePercentChangeTotal = new KualiDecimal(divRslt.multiply(BigDecimal.valueOf(100)).setScale(2));
642            }
643            return expenditurePercentChangeTotal;
644        }
645    
646        /**
647         * Sets the expenditurePercentChangeTotal attribute value.
648         * 
649         * @param expenditurePercentChangeTotal The expenditurePercentChangeTotal to set.
650         */
651        public void setExpenditurePercentChangeTotal(KualiDecimal expenditurePercentChangeTotal) {
652            this.expenditurePercentChangeTotal = expenditurePercentChangeTotal;
653        }
654    
655        /**
656         * Gets the revenuePercentChangeTotal attribute.
657         * 
658         * @return Returns the revenuePercentChangeTotal.
659         */
660        public KualiDecimal getRevenuePercentChangeTotal() {
661            if (revenueFinancialBeginningBalanceLineAmountTotal == null || revenueFinancialBeginningBalanceLineAmountTotal.isZero()) {
662                this.revenuePercentChangeTotal = null;
663            }
664            else {
665                BigDecimal diffRslt = (revenueAccountLineAnnualBalanceAmountTotal.bigDecimalValue().setScale(4)).subtract(revenueFinancialBeginningBalanceLineAmountTotal.bigDecimalValue().setScale(4));
666                BigDecimal divRslt = diffRslt.divide((revenueFinancialBeginningBalanceLineAmountTotal.bigDecimalValue().setScale(4)), KualiDecimal.ROUND_BEHAVIOR);
667                this.revenuePercentChangeTotal = new KualiDecimal(divRslt.multiply(BigDecimal.valueOf(100)).setScale(2));
668            }
669            return revenuePercentChangeTotal;
670        }
671    
672        /**
673         * Sets the revenuePercentChangeTotal attribute value.
674         * 
675         * @param revenuePercentChangeTotal The revenuePercentChangeTotal to set.
676         */
677        public void setRevenuePercentChangeTotal(KualiDecimal revenuePercentChangeTotal) {
678            this.revenuePercentChangeTotal = revenuePercentChangeTotal;
679        }
680    
681        /**
682         * Gets the isBenefitsCalcNeeded attribute.
683         * 
684         * @return Returns the isBenefitsCalcNeeded.
685         */
686        public boolean isBenefitsCalcNeeded() {
687            return isBenefitsCalcNeeded;
688        }
689    
690        /**
691         * Sets the isBenefitsCalcNeeded attribute value.
692         * 
693         * @param isBenefitsCalcNeeded The isBenefitsCalcNeeded to set.
694         */
695        public void setBenefitsCalcNeeded(boolean isBenefitsCalcNeeded) {
696            this.isBenefitsCalcNeeded = isBenefitsCalcNeeded;
697        }
698    
699        /**
700         * Gets the isMonthlyBenefitsCalcNeeded attribute.
701         * 
702         * @return Returns the isMonthlyBenefitsCalcNeeded.
703         */
704        public boolean isMonthlyBenefitsCalcNeeded() {
705            return isMonthlyBenefitsCalcNeeded;
706        }
707    
708        /**
709         * Sets the isMonthlyBenefitsCalcNeeded attribute value.
710         * 
711         * @param isMonthlyBenefitsCalcNeeded The isMonthlyBenefitsCalcNeeded to set.
712         */
713        public void setMonthlyBenefitsCalcNeeded(boolean isMonthlyBenefitsCalcNeeded) {
714            this.isMonthlyBenefitsCalcNeeded = isMonthlyBenefitsCalcNeeded;
715        }
716    
717        /**
718         * Gets the isSalarySettingOnly attribute.
719         * 
720         * @return Returns the isSalarySettingOnly.
721         */
722        public boolean isSalarySettingOnly() {
723            if (this.getAccountSalarySettingOnlyCause() == AccountSalarySettingOnlyCause.MISSING_PARAM || this.getAccountSalarySettingOnlyCause() == AccountSalarySettingOnlyCause.NONE) {
724                isSalarySettingOnly = false;
725            }
726            else {
727                isSalarySettingOnly = true;
728            }
729            return isSalarySettingOnly;
730        }
731    
732        /**
733         * Sets the isSalarySettingOnly attribute value.
734         * 
735         * @param isSalarySettingOnly The isSalarySettingOnly to set.
736         */
737        public void setSalarySettingOnly(boolean isSalarySettingOnly) {
738            this.isSalarySettingOnly = isSalarySettingOnly;
739        }
740    
741        /**
742         * Gets the accountSalarySettingOnlyCause attribute.
743         * 
744         * @return Returns the accountSalarySettingOnlyCause.
745         */
746        public AccountSalarySettingOnlyCause getAccountSalarySettingOnlyCause() {
747            if (accountSalarySettingOnlyCause == null) {
748                accountSalarySettingOnlyCause = SpringContext.getBean(BudgetParameterService.class).isSalarySettingOnlyAccount(this);
749            }
750    
751            return accountSalarySettingOnlyCause;
752        }
753    
754        /**
755         * Sets the accountSalarySettingOnlyCause attribute value.
756         * 
757         * @param accountSalarySettingOnlyCause The accountSalarySettingOnlyCause to set.
758         */
759        public void setAccountSalarySettingOnlyCause(AccountSalarySettingOnlyCause accountSalarySettingOnlyCause) {
760            this.accountSalarySettingOnlyCause = accountSalarySettingOnlyCause;
761        }
762    
763        /**
764         * Gets the containsTwoPlug attribute.
765         * 
766         * @return Returns the containsTwoPlug.
767         */
768        public boolean isContainsTwoPlug() {
769            return containsTwoPlug;
770        }
771    
772        /**
773         * Sets the containsTwoPlug attribute value.
774         * 
775         * @param containsTwoPlug The containsTwoPlug to set.
776         */
777        public void setContainsTwoPlug(boolean containsTwoPlug) {
778            this.containsTwoPlug = containsTwoPlug;
779        }
780    
781        /**
782         * Gets the budgetableDocument attribute.
783         * 
784         * @return Returns the budgetableDocument.
785         */
786        public boolean isBudgetableDocument() {
787            return budgetableDocument;
788        }
789    
790        /**
791         * Sets the budgetableDocument attribute value.
792         * 
793         * @param budgetableDocument The budgetableDocument to set.
794         */
795        public void setBudgetableDocument(boolean budgetableDocument) {
796            this.budgetableDocument = budgetableDocument;
797        }
798    
799        /**
800         * Gets the cleanupModeActionForceCheck attribute.
801         * 
802         * @return Returns the cleanupModeActionForceCheck.
803         */
804        public boolean isCleanupModeActionForceCheck() {
805            return cleanupModeActionForceCheck;
806        }
807    
808        /**
809         * Sets the cleanupModeActionForceCheck attribute value.
810         * 
811         * @param cleanupModeActionForceCheck The cleanupModeActionForceCheck to set.
812         */
813        public void setCleanupModeActionForceCheck(boolean cleanupModeActionForceCheck) {
814            this.cleanupModeActionForceCheck = cleanupModeActionForceCheck;
815        }
816    
817        /**
818         * the budget construction document never appears in anyone's in-box budget construction controls access by a
819         * "pull-up/push-down" mechanism instead but, a budget construction document is routed so that the routing hierarchy can be used
820         * to trace who has modified the document we override the routine below from Document we record the processed document state. a
821         * budget construction document will never be "cancelled" or "disapproved"
822         * 
823         * @see org.kuali.rice.kns.document.Document#doRouteStatusChange()
824         */
825        @Override
826        public void doRouteStatusChange(DocumentRouteStatusChangeDTO statusChangeEvent) {
827            if (getDocumentHeader().getWorkflowDocument().stateIsEnroute()) {
828                getDocumentHeader().setFinancialDocumentStatusCode(KFSConstants.DocumentStatusCodes.ENROUTE);
829            }
830            /* the status below is comparable to "approved" status for other documents */
831            if (getDocumentHeader().getWorkflowDocument().stateIsProcessed()) {
832                getDocumentHeader().setFinancialDocumentStatusCode(BCConstants.BUDGET_CONSTRUCTION_DOCUMENT_INITIAL_STATUS);
833            }
834            LOG.info("Status is: " + getDocumentHeader().getFinancialDocumentStatusCode());
835        }
836    
837    
838        /**
839         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
840         */
841        protected LinkedHashMap toStringMapper() {
842            LinkedHashMap m = new LinkedHashMap();
843            m.put(KFSPropertyConstants.DOCUMENT_NUMBER, this.documentNumber);
844            if (this.universityFiscalYear != null) {
845                m.put("universityFiscalYear", this.universityFiscalYear.toString());
846            }
847            m.put("chartOfAccountsCode", this.chartOfAccountsCode);
848            m.put("accountNumber", this.accountNumber);
849            m.put("subAccountNumber", this.subAccountNumber);
850            return m;
851        }
852    
853    }