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.web.struts;
017    
018    import java.util.HashMap;
019    import java.util.Iterator;
020    import java.util.List;
021    
022    import javax.servlet.http.HttpServletRequest;
023    
024    import org.apache.commons.lang.StringUtils;
025    import org.kuali.kfs.coa.businessobject.Organization;
026    import org.kuali.kfs.module.bc.BCConstants;
027    import org.kuali.kfs.module.bc.businessobject.BCKeyLabelPair;
028    import org.kuali.kfs.module.bc.businessobject.BudgetConstructionAccountOrganizationHierarchy;
029    import org.kuali.kfs.module.bc.businessobject.PendingBudgetConstructionGeneralLedger;
030    import org.kuali.kfs.module.bc.document.BudgetConstructionDocument;
031    import org.kuali.kfs.module.bc.document.service.BenefitsCalculationService;
032    import org.kuali.kfs.module.bc.document.service.BudgetConstructionProcessorService;
033    import org.kuali.kfs.module.bc.document.service.BudgetDocumentService;
034    import org.kuali.kfs.module.bc.document.service.BudgetParameterService;
035    import org.kuali.kfs.module.bc.document.service.SalarySettingService;
036    import org.kuali.kfs.module.bc.util.BudgetParameterFinder;
037    import org.kuali.kfs.sys.KFSConstants;
038    import org.kuali.kfs.sys.context.SpringContext;
039    import org.kuali.kfs.sys.document.web.struts.FinancialSystemTransactionalDocumentFormBase;
040    import org.kuali.kfs.sys.service.OptionsService;
041    import org.kuali.rice.kns.service.BusinessObjectDictionaryService;
042    import org.kuali.rice.kns.service.PersistenceService;
043    import org.kuali.rice.kns.util.GlobalVariables;
044    import org.kuali.rice.kns.util.KNSConstants;
045    import org.kuali.rice.kns.util.KualiDecimal;
046    import org.kuali.rice.kns.util.KualiInteger;
047    import org.kuali.rice.kns.util.TypedArrayList;
048    
049    
050    public class BudgetConstructionForm extends FinancialSystemTransactionalDocumentFormBase {
051        protected static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BudgetConstructionForm.class);
052    
053        protected PendingBudgetConstructionGeneralLedger newRevenueLine;
054        protected PendingBudgetConstructionGeneralLedger newExpenditureLine;
055        
056        protected static String revenueObjectTypeCodesLookup = SpringContext.getBean(BudgetParameterService.class).getLookupObjectTypes(true);
057        protected static String expenditureObjectTypeCodesLookup = SpringContext.getBean(BudgetParameterService.class).getLookupObjectTypes(false);
058    
059        protected boolean closingDocument = false;
060    
061        protected boolean hideDetails = false;
062        protected boolean pickListClose = false;
063        protected boolean securityNoAccess = false;
064        protected boolean hideAdjustmentMeasurement = true;
065        protected KualiDecimal revenueAdjustmentAmount;
066        protected KualiDecimal expenditureAdjustmentAmount;
067    
068        protected List<BCKeyLabelPair> pushdownLevelKeyLabels;
069        protected List<BCKeyLabelPair> pullupLevelKeyLabels;
070        protected String pushdownKeyCode;
071        protected String pullupKeyCode;
072        protected List<BudgetConstructionAccountOrganizationHierarchy> accountOrgHierLevels;
073    
074        // a flag set during initial load to force a benefits calc and 2plg adjustment
075        // at the first instance a BC doc becomes editable - which is detected in action execute
076        protected boolean checkTwoPlugAdjustment = false;
077    
078        // holds Salary Setting associated rows as they looked before applying any DB changes from performSalarySetting
079        // this is used to compare before and after state.
080        protected HashMap<String, PendingBudgetConstructionGeneralLedger> preSalarySettingRows;
081    
082        // passed parms
083        protected String backLocation;
084        protected String returnAnchor;
085        protected String returnFormKey;
086        protected Integer universityFiscalYear;
087        protected String chartOfAccountsCode;
088        protected String accountNumber;
089        protected String subAccountNumber;
090        protected boolean pickListMode;
091        protected boolean accountReportsExist;
092        protected boolean mainWindow = false;
093    
094        // holds anchor value to return to when doing doing balance inquiry
095        // it is only set when setting up to do balance inquiry and reset in refresh
096        protected String balanceInquiryReturnAnchor;
097    
098        public BudgetConstructionForm() {
099            super();
100    
101            // create objects used to hold data filled later either from this.populate or Action.loadDocument
102            this.setNewExpenditureLine(new PendingBudgetConstructionGeneralLedger());
103            this.setNewRevenueLine(new PendingBudgetConstructionGeneralLedger());
104            this.setAccountOrgHierLevels(new TypedArrayList(BudgetConstructionAccountOrganizationHierarchy.class));
105            this.setPullupLevelKeyLabels(new TypedArrayList(BCKeyLabelPair.class));
106            this.setPushdownLevelKeyLabels(new TypedArrayList(BCKeyLabelPair.class));
107    
108            LOG.debug("creating BudgetConstructionForm");
109        }
110    
111        @Override
112        protected String getDefaultDocumentTypeName() {
113            return BCConstants.BUDGET_CONSTRUCTION_DOCUMENT_NAME;
114        }
115        
116        /**
117         * calls super.populate, then populates revenue and expenditure lines
118         * 
119         * @see org.kuali.rice.kns.web.struts.form.KualiDocumentFormBase#populate(javax.servlet.http.HttpServletRequest)
120         */
121        @Override
122        public void populate(HttpServletRequest request) {
123    
124            super.populate(request);
125            String methodToCall = this.getMethodToCall();
126    
127            // now run through PBGL rev and exp lines
128            BudgetConstructionDocument bcDoc = this.getBudgetConstructionDocument();
129            if (StringUtils.isNotBlank(methodToCall)) {
130                if (methodToCall.equals(BCConstants.INSERT_REVENUE_LINE_METHOD)) {
131                    PendingBudgetConstructionGeneralLedger revLine = getNewRevenueLine();
132    
133                    // do uppercase on added lines only, since users can only update amounts on existing lines
134                    // this should only affect the line since the DD has auto-update=false on refs and collections
135                    // and only affect fields where xml attribute has forceUppercase="true"
136                    SpringContext.getBean(BusinessObjectDictionaryService.class).performForceUppercase(revLine);
137    
138                    populateRevenueLine(bcDoc, this.getNewRevenueLine());
139    
140                }
141                else {
142                    this.populatePBGLLine(this.getNewRevenueLine());
143                }
144    
145                if (methodToCall.equals(BCConstants.INSERT_EXPENDITURE_LINE_METHOD)) {
146                    PendingBudgetConstructionGeneralLedger expLine = getNewExpenditureLine();
147    
148                    // do uppercase on added lines only, since users can only update amounts on existing lines
149                    // this should only affect the line since the DD has auto-update=false on refs and collections
150                    // and only affect fields where xml attribute has forceUppercase="true"
151                    SpringContext.getBean(BusinessObjectDictionaryService.class).performForceUppercase(expLine);
152    
153                    populateExpenditureLine(bcDoc, this.getNewExpenditureLine());
154    
155                }
156                else {
157                    this.populatePBGLLine(this.getNewExpenditureLine());
158                }
159    
160                // this is needed to retrieve ref objects, esp budgetConstructionMonthly
161                populatePBGLLines();
162    
163                setDocTypeName(discoverDocumentTypeName());
164    
165            }
166    
167        }
168    
169        /**
170         * Sets the persisted request amount to the actual request amount. This is normally used right after a save to the DB If
171         * initSalarySetting is true, this also scrapes the current set of Salary Setting lines, including any 2PLG line into
172         * preSalarySettingRows. preSalarySettingRows is used after return from Salary Setting to allow detection of any changes
173         * 
174         * @param initSalarySetting
175         */
176        public void initializePersistedRequestAmounts(boolean initSalarySetting) {
177    
178            if (initSalarySetting) {
179                this.setPreSalarySettingRows(new HashMap<String, PendingBudgetConstructionGeneralLedger>());
180            }
181    
182            BudgetConstructionDocument bcDoc = this.getBudgetConstructionDocument();
183    
184            Iterator revenueLines = bcDoc.getPendingBudgetConstructionGeneralLedgerRevenueLines().iterator();
185            while (revenueLines.hasNext()) {
186                PendingBudgetConstructionGeneralLedger revenueLine = (PendingBudgetConstructionGeneralLedger) revenueLines.next();
187                revenueLine.setPersistedAccountLineAnnualBalanceAmount(revenueLine.getAccountLineAnnualBalanceAmount());
188            }
189            Iterator expenditureLines = bcDoc.getPendingBudgetConstructionGeneralLedgerExpenditureLines().iterator();
190            while (expenditureLines.hasNext()) {
191                PendingBudgetConstructionGeneralLedger expenditureLine = (PendingBudgetConstructionGeneralLedger) expenditureLines.next();
192                expenditureLine.setPersistedAccountLineAnnualBalanceAmount(expenditureLine.getAccountLineAnnualBalanceAmount());
193    
194                if (initSalarySetting) {
195                    if ((expenditureLine.getLaborObject() != null && expenditureLine.getLaborObject().isDetailPositionRequiredIndicator()) || expenditureLine.getFinancialObjectCode().equalsIgnoreCase(KFSConstants.BudgetConstructionConstants.OBJECT_CODE_2PLG)) {
196                        this.getPreSalarySettingRows().put(expenditureLine.getFinancialObjectCode() + expenditureLine.getFinancialSubObjectCode(), expenditureLine);
197                    }
198                }
199            }
200        }
201    
202        /**
203         * Sets the persisted request amount to the actual request amount. This is normally used right after a save to the DB.
204         */
205        public void initializePersistedRequestAmounts() {
206    
207            this.initializePersistedRequestAmounts(false);
208        }
209    
210        /**
211         * Populates the push or pull selection lists displayed in the drop down controls used by the pullup or pushdown actions. The
212         * population considers the current level of the document and the user's BudgetConstructionDocument type approvals setup in
213         * WorkFlow.
214         * 
215         * @param bcDoc
216         * @param levels
217         * @param isPull
218         */
219        public void populatePushPullLevelKeyLabels(BudgetConstructionDocument bcDoc, List<BudgetConstructionAccountOrganizationHierarchy> levels, boolean isPull) {
220    
221            if (!levels.isEmpty()) {
222                // sanity check
223                if (bcDoc.getOrganizationLevelCode() >= 0 && bcDoc.getOrganizationLevelCode() < levels.size()) {
224                    if (isPull) {
225                        pullupLevelKeyLabels.clear();
226    
227                        // get the keys to search
228                        HashMap<String, BudgetConstructionAccountOrganizationHierarchy> rvwHierMap = new HashMap<String, BudgetConstructionAccountOrganizationHierarchy>();
229    
230                        // start at level above current level and get any levels where the user is an approver
231                        for (int i = (bcDoc.getOrganizationLevelCode() + 1); i < levels.size(); i++) {
232                            BudgetConstructionAccountOrganizationHierarchy rvwHier = levels.get(i);
233                            rvwHierMap.put(rvwHier.getOrganizationChartOfAccountsCode() + rvwHier.getOrganizationCode(), rvwHier);
234                        }
235                        if (!rvwHierMap.isEmpty()) {
236                            try {
237                                List<Organization> povOrgs = SpringContext.getBean(BudgetConstructionProcessorService.class).getProcessorOrgs(GlobalVariables.getUserSession().getPerson());
238                                if (!povOrgs.isEmpty()) {
239                                    for (Organization povOrg : povOrgs) {
240                                        if (rvwHierMap.containsKey(povOrg.getChartOfAccountsCode() + povOrg.getOrganizationCode())) {
241                                            BudgetConstructionAccountOrganizationHierarchy level = rvwHierMap.get(povOrg.getChartOfAccountsCode() + povOrg.getOrganizationCode());
242                                            SpringContext.getBean(PersistenceService.class).retrieveReferenceObject(level, "organization");
243                                            pullupLevelKeyLabels.add(new BCKeyLabelPair(level.getOrganizationLevelCode().toString(), level.getOrganizationLevelCode().toString() + ":" + level.getOrganizationChartOfAccountsCode() + "-" + level.getOrganizationCode() + " " + level.getOrganization().getOrganizationName()));
244                                        }
245                                    }
246                                }
247                            }
248                            catch (Exception e) {
249                                // any exception just leaves an empty pullup list
250                            }
251                        }
252                    }
253                    else {
254                        pushdownLevelKeyLabels.clear();
255    
256                        // start at current doc level and add all that are below current level
257                        for (int i = (bcDoc.getOrganizationLevelCode() - 1); i >= 0; i--) {
258                            BudgetConstructionAccountOrganizationHierarchy level = levels.get(i);
259                            SpringContext.getBean(PersistenceService.class).retrieveReferenceObject(level, "organization");
260                            if (level.getOrganizationLevelCode() == 0) {
261                                // push list level zero case needs special desc
262                                pushdownLevelKeyLabels.add(new BCKeyLabelPair(level.getOrganizationLevelCode().toString(), level.getOrganizationLevelCode().toString() + ":" + level.getOrganizationChartOfAccountsCode() + "-" + level.getOrganizationCode() + " " + "Fiscal Officer Access Level"));
263                            }
264                            else {
265                                pushdownLevelKeyLabels.add(new BCKeyLabelPair(level.getOrganizationLevelCode().toString(), level.getOrganizationLevelCode().toString() + ":" + level.getOrganizationChartOfAccountsCode() + "-" + level.getOrganizationCode() + " " + level.getOrganization().getOrganizationName()));
266                            }
267                        }
268                    }
269                }
270            }
271        }
272    
273    
274        /**
275         * This method iterates over all of the rev and exp lines in the BC document. This is called to refresh ref objects for use by
276         * validation
277         */
278        public void populatePBGLLines() {
279    
280            BudgetConstructionDocument bcDoc = this.getBudgetConstructionDocument();
281            bcDoc.zeroTotals();
282    
283            Iterator revenueLines = bcDoc.getPendingBudgetConstructionGeneralLedgerRevenueLines().iterator();
284            while (revenueLines.hasNext()) {
285                PendingBudgetConstructionGeneralLedger revenueLine = (PendingBudgetConstructionGeneralLedger) revenueLines.next();
286                this.populateRevenueLine(bcDoc, revenueLine);
287            }
288            Iterator expenditureLines = bcDoc.getPendingBudgetConstructionGeneralLedgerExpenditureLines().iterator();
289            while (expenditureLines.hasNext()) {
290                PendingBudgetConstructionGeneralLedger expenditureLine = (PendingBudgetConstructionGeneralLedger) expenditureLines.next();
291                this.populateExpenditureLine(bcDoc, expenditureLine);
292            }
293        }
294    
295        /**
296         * Populates a PBGL revenue line bo using values from the struts form. This is in place to make sure that all of the composite
297         * key objects have the correct values in them. This also adds line amounts to the revenue totals.
298         * 
299         * @param revenueLine
300         */
301        public void populateRevenueLine(BudgetConstructionDocument bcDoc, PendingBudgetConstructionGeneralLedger revenueLine) {
302            populatePBGLLine(revenueLine);
303            if (revenueLine.getFinancialBeginningBalanceLineAmount() != null) {
304                bcDoc.setRevenueFinancialBeginningBalanceLineAmountTotal(bcDoc.getRevenueFinancialBeginningBalanceLineAmountTotal().add(revenueLine.getFinancialBeginningBalanceLineAmount()));
305            }
306            if (revenueLine.getAccountLineAnnualBalanceAmount() != null) {
307                bcDoc.setRevenueAccountLineAnnualBalanceAmountTotal(bcDoc.getRevenueAccountLineAnnualBalanceAmountTotal().add(revenueLine.getAccountLineAnnualBalanceAmount()));
308            }
309        }
310    
311        /**
312         * Populates a PBGL expenditure line bo using values from the struts form. This is in place to make sure that all of the
313         * composite key objects have the correct values in them. This also adds line amounts to the expenditure totals.
314         * 
315         * @param expenditureLine
316         */
317        public void populateExpenditureLine(BudgetConstructionDocument bcDoc, PendingBudgetConstructionGeneralLedger expenditureLine) {
318            populatePBGLLine(expenditureLine);
319            if (expenditureLine.getFinancialBeginningBalanceLineAmount() != null) {
320                bcDoc.setExpenditureFinancialBeginningBalanceLineAmountTotal(bcDoc.getExpenditureFinancialBeginningBalanceLineAmountTotal().add(expenditureLine.getFinancialBeginningBalanceLineAmount()));
321            }
322            if (expenditureLine.getAccountLineAnnualBalanceAmount() != null) {
323                bcDoc.setExpenditureAccountLineAnnualBalanceAmountTotal(bcDoc.getExpenditureAccountLineAnnualBalanceAmountTotal().add(expenditureLine.getAccountLineAnnualBalanceAmount()));
324            }
325            if ((expenditureLine.getFinancialObjectCode() != null) && (expenditureLine.getFinancialObjectCode().contentEquals(KFSConstants.BudgetConstructionConstants.OBJECT_CODE_2PLG))) {
326                // 2plg record exists
327                bcDoc.setContainsTwoPlug(true);
328            }
329        }
330    
331        /**
332         * Populates the dependent fields of objects contained within the PBGL line
333         * 
334         * @param line
335         */
336        protected void populatePBGLLine(PendingBudgetConstructionGeneralLedger line) {
337    
338            SpringContext.getBean(BudgetDocumentService.class).populatePBGLLine(line);
339    
340            // // final List REFRESH_FIELDS = Collections.unmodifiableList(Arrays.asList(new String[] { "financialObject",
341            // // "financialSubObject", "laborObject", "budgetConstructionMonthly"}));
342            // final List REFRESH_FIELDS;
343            // if (StringUtils.isNotBlank(line.getFinancialSubObjectCode())) {
344            // REFRESH_FIELDS = Collections.unmodifiableList(Arrays.asList(new String[] { KFSPropertyConstants.FINANCIAL_OBJECT,
345            // KFSPropertyConstants.FINANCIAL_SUB_OBJECT, BCPropertyConstants.BUDGET_CONSTRUCTION_MONTHLY }));
346            // }
347            // else {
348            // REFRESH_FIELDS = Collections.unmodifiableList(Arrays.asList(new String[] { KFSPropertyConstants.FINANCIAL_OBJECT,
349            // BCPropertyConstants.BUDGET_CONSTRUCTION_MONTHLY }));
350            // }
351            // // SpringContext.getBean(PersistenceService.class).retrieveReferenceObjects(line, REFRESH_FIELDS);
352            // SpringContext.getBean(PersistenceService.class).retrieveReferenceObjects(line, REFRESH_FIELDS);
353    
354        }
355    
356        /**
357         * Gets the budgetConstructionDocument
358         * 
359         * @return
360         */
361        public BudgetConstructionDocument getBudgetConstructionDocument() {
362            return (BudgetConstructionDocument) getDocument();
363        }
364    
365        /**
366         * Sets the budgetConstructionDocument
367         * 
368         * @param budgetConstructionDocument
369         */
370        public void setBudgetConstructionDocument(BudgetConstructionDocument budgetConstructionDocument) {
371            setDocument(budgetConstructionDocument);
372        }
373    
374        /**
375         * Gets the newExpenditureLine attribute.
376         * 
377         * @return Returns the newExpenditureLine.
378         */
379        public PendingBudgetConstructionGeneralLedger getNewExpenditureLine() {
380            return newExpenditureLine;
381        }
382    
383        /**
384         * Sets the newExpenditureLine attribute value.
385         * 
386         * @param newExpenditureLine The newExpenditureLine to set.
387         */
388        public void setNewExpenditureLine(PendingBudgetConstructionGeneralLedger newExpenditureLine) {
389            this.newExpenditureLine = newExpenditureLine;
390        }
391    
392        /**
393         * Gets the newRevenueLine attribute.
394         * 
395         * @return Returns the newRevenueLine.
396         */
397        public PendingBudgetConstructionGeneralLedger getNewRevenueLine() {
398            return newRevenueLine;
399        }
400    
401        /**
402         * Sets the newRevenueLine attribute value.
403         * 
404         * @param newRevenueLine The newRevenueLine to set.
405         */
406        public void setNewRevenueLine(PendingBudgetConstructionGeneralLedger newRevenueLine) {
407            this.newRevenueLine = newRevenueLine;
408        }
409    
410        /**
411         * Sets the defaults for fields not setable by the user for added lines. This assumes the document has been explictly loaded and
412         * contains primary and candidate key values as in BudgetConstructionAction.loadDocument() or that populate reloads the values
413         * from the JSP.
414         * 
415         * @param line
416         * @param isRevenue
417         */
418        public void initNewLine(PendingBudgetConstructionGeneralLedger line, boolean isRevenue) {
419    
420            OptionsService optionsService = SpringContext.getBean(OptionsService.class);
421            BudgetConstructionDocument tdoc = this.getBudgetConstructionDocument();
422    
423            line.setDocumentNumber(tdoc.getDocumentNumber());
424            line.setUniversityFiscalYear(tdoc.getUniversityFiscalYear());
425            line.setChartOfAccountsCode(tdoc.getChartOfAccountsCode());
426            line.setAccountNumber(tdoc.getAccountNumber());
427            line.setSubAccountNumber(tdoc.getSubAccountNumber());
428            line.setFinancialBalanceTypeCode(optionsService.getOptions(tdoc.getUniversityFiscalYear()).getBaseBudgetFinancialBalanceTypeCd());
429            line.setFinancialBeginningBalanceLineAmount(KualiInteger.ZERO);
430            line.setAccountLineAnnualBalanceAmount(KualiInteger.ZERO);
431    
432            if (isRevenue) {
433                line.setFinancialObjectTypeCode(optionsService.getOptions(tdoc.getUniversityFiscalYear()).getFinObjectTypeIncomecashCode());
434            }
435            else {
436                line.setFinancialObjectTypeCode(optionsService.getOptions(tdoc.getUniversityFiscalYear()).getFinObjTypeExpenditureexpCd());
437            }
438    
439        }
440    
441        /**
442         * Gets getBudgetConstructionDocument().isBudgetableDocument attribute.
443         * 
444         * @return Returns getBudgetConstructionDocument().isBudgetableDocument.
445         */
446        public boolean isBudgetableDocument() {
447            return this.getBudgetConstructionDocument().isBudgetableDocument();
448        }
449    
450        /**
451         * Gets the hideDetails attribute.
452         * 
453         * @return Returns the hideDetails.
454         */
455        public boolean isHideDetails() {
456            return hideDetails;
457        }
458    
459        /**
460         * @return hideDetails attribute
461         * @see #isHideDetails()
462         */
463        public boolean getHideDetails() {
464            return isHideDetails();
465        }
466    
467        /**
468         * Sets the hideDetails attribute value.
469         * 
470         * @param hideDetails The hideDetails to set.
471         */
472        public void setHideDetails(boolean hideDetails) {
473            this.hideDetails = hideDetails;
474        }
475    
476        /**
477         * Gets the accountNumber attribute.
478         * 
479         * @return Returns the accountNumber.
480         */
481        public String getAccountNumber() {
482            return accountNumber;
483        }
484    
485        /**
486         * Sets the accountNumber attribute value.
487         * 
488         * @param accountNumber The accountNumber to set.
489         */
490        public void setAccountNumber(String accountNumber) {
491            this.accountNumber = accountNumber;
492        }
493    
494        /**
495         * Gets the chartOfAccountsCode attribute.
496         * 
497         * @return Returns the chartOfAccountsCode.
498         */
499        public String getChartOfAccountsCode() {
500            return chartOfAccountsCode;
501        }
502    
503        /**
504         * Sets the chartOfAccountsCode attribute value.
505         * 
506         * @param chartOfAccountsCode The chartOfAccountsCode to set.
507         */
508        public void setChartOfAccountsCode(String chartOfAccountsCode) {
509            this.chartOfAccountsCode = chartOfAccountsCode;
510        }
511    
512        /**
513         * Gets the subAccountNumber attribute.
514         * 
515         * @return Returns the subAccountNumber.
516         */
517        public String getSubAccountNumber() {
518            return subAccountNumber;
519        }
520    
521        /**
522         * Sets the subAccountNumber attribute value.
523         * 
524         * @param subAccountNumber The subAccountNumber to set.
525         */
526        public void setSubAccountNumber(String subAccountNumber) {
527            this.subAccountNumber = subAccountNumber;
528        }
529    
530        /**
531         * Gets the universityFiscalYear attribute.
532         * 
533         * @return Returns the universityFiscalYear.
534         */
535        public Integer getUniversityFiscalYear() {
536            return universityFiscalYear;
537        }
538    
539        /**
540         * Sets the universityFiscalYear attribute value.
541         * 
542         * @param universityFiscalYear The universityFiscalYear to set.
543         */
544        public void setUniversityFiscalYear(Integer universityFiscalYear) {
545            this.universityFiscalYear = universityFiscalYear;
546        }
547    
548        /**
549         * Gets the hideAdjustmentMeasurement attribute.
550         * 
551         * @return Returns the hideAdjustmentMeasurement.
552         */
553        public boolean isHideAdjustmentMeasurement() {
554            return hideAdjustmentMeasurement;
555        }
556    
557        /**
558         * Sets the hideAdjustmentMeasurement attribute value.
559         * 
560         * @param hideAdjustmentMeasurement The hideAdjustmentMeasurement to set.
561         */
562        public void setHideAdjustmentMeasurement(boolean hideAdjustmentMeasurement) {
563            this.hideAdjustmentMeasurement = hideAdjustmentMeasurement;
564        }
565    
566        /**
567         * Gets the revenueAdjustmentAmount attribute.
568         * 
569         * @return Returns the revenueAdjustmentAmount.
570         */
571        public KualiDecimal getRevenueAdjustmentAmount() {
572            return revenueAdjustmentAmount;
573        }
574    
575        /**
576         * Sets the revenueAdjustmentAmount attribute value.
577         * 
578         * @param revenueAdjustmentAmount The revenueAdjustmentAmount to set.
579         */
580        public void setRevenueAdjustmentAmount(KualiDecimal adjustmentAmount) {
581            this.revenueAdjustmentAmount = adjustmentAmount;
582        }
583    
584        /**
585         * Gets the expenditureAdjustmentAmount attribute.
586         * 
587         * @return Returns the expenditureAdjustmentAmount.
588         */
589        public KualiDecimal getExpenditureAdjustmentAmount() {
590            return expenditureAdjustmentAmount;
591        }
592    
593        /**
594         * Sets the expenditureAdjustmentAmount attribute value.
595         * 
596         * @param expenditureAdjustmentAmount The expenditureAdjustmentAmount to set.
597         */
598        public void setExpenditureAdjustmentAmount(KualiDecimal expenditureAdjustmentAmount) {
599            this.expenditureAdjustmentAmount = expenditureAdjustmentAmount;
600        }
601    
602        /**
603         * Gets the benefitsCalculationDisabled attribute.
604         * 
605         * @return Returns the benefitsCalculationDisabled.
606         */
607        public boolean isBenefitsCalculationDisabled() {
608            return SpringContext.getBean(BenefitsCalculationService.class).isBenefitsCalculationDisabled();
609        }
610    
611        /**
612         * Gets the salarySettingDisabled attribute.
613         * 
614         * @return Returns the salarySettingDisabled.
615         */
616        public boolean isSalarySettingDisabled() {
617            return SpringContext.getBean(SalarySettingService.class).isSalarySettingDisabled();
618        }
619    
620        /**
621         * Gets the pickListMode attribute.
622         * 
623         * @return Returns the pickListMode.
624         */
625        public boolean isPickListMode() {
626            return pickListMode;
627        }
628    
629        /**
630         * Sets the pickListMode attribute value.
631         * 
632         * @param pickListMode The pickListMode to set.
633         */
634        public void setPickListMode(boolean pickListMode) {
635            this.pickListMode = pickListMode;
636        }
637    
638        /**
639         * Gets the accountReportsExist attribute.
640         * 
641         * @return Returns the accountReportsExist.
642         */
643        public boolean isAccountReportsExist() {
644            accountReportsExist = false;
645    
646            if (this.getBudgetConstructionDocument().getDocumentNumber() != null) {
647                if (SpringContext.getBean(BudgetDocumentService.class).isAccountReportsExist(this.getChartOfAccountsCode(), this.getAccountNumber())) {
648                    accountReportsExist = true;
649                }
650            }
651            return accountReportsExist;
652        }
653    
654        /**
655         * Sets the accountReportsExist attribute value.
656         * 
657         * @param accountReportsExist The accountReportsExist to set.
658         */
659        public void setAccountReportsExist(boolean accountReportsExist) {
660            this.accountReportsExist = accountReportsExist;
661        }
662    
663        /**
664         * Gets the pickListClose attribute.
665         * 
666         * @return Returns the pickListClose.
667         */
668        public boolean isPickListClose() {
669            return pickListClose;
670        }
671    
672        /**
673         * Sets the pickListClose attribute value.
674         * 
675         * @param pickListClose The pickListClose to set.
676         */
677        public void setPickListClose(boolean pickListClose) {
678            this.pickListClose = pickListClose;
679        }
680    
681        /**
682         * Gets the securityNoAccess attribute.
683         * 
684         * @return Returns the securityNoAccess.
685         */
686        public boolean isSecurityNoAccess() {
687            return securityNoAccess;
688        }
689    
690        /**
691         * Sets the securityNoAccess attribute value.
692         * 
693         * @param securityNoAccess The securityNoAccess to set.
694         */
695        public void setSecurityNoAccess(boolean securityNoAccess) {
696            this.securityNoAccess = securityNoAccess;
697        }
698    
699        /**
700         * Gets the backLocation attribute.
701         * 
702         * @return Returns the backLocation.
703         */
704        public String getBackLocation() {
705            return backLocation;
706        }
707    
708        /**
709         * Sets the backLocation attribute value.
710         * 
711         * @param backLocation The backLocation to set.
712         */
713        public void setBackLocation(String backLocation) {
714            this.backLocation = backLocation;
715        }
716    
717        /**
718         * Gets the returnAnchor attribute.
719         * 
720         * @return Returns the returnAnchor.
721         */
722        public String getReturnAnchor() {
723            return returnAnchor;
724        }
725    
726        /**
727         * Sets the returnAnchor attribute value.
728         * 
729         * @param returnAnchor The returnAnchor to set.
730         */
731        public void setReturnAnchor(String returnAnchor) {
732            this.returnAnchor = returnAnchor;
733        }
734    
735        /**
736         * Gets the returnFormKey attribute.
737         * 
738         * @return Returns the returnFormKey.
739         */
740        public String getReturnFormKey() {
741            return returnFormKey;
742        }
743    
744        /**
745         * Sets the returnFormKey attribute value.
746         * 
747         * @param returnFormKey The returnFormKey to set.
748         */
749        public void setReturnFormKey(String returnFormKey) {
750            this.returnFormKey = returnFormKey;
751        }
752    
753        /**
754         * Gets the balanceInquiryReturnAnchor attribute.
755         * 
756         * @return Returns the balanceInquiryReturnAnchor.
757         */
758        public String getBalanceInquiryReturnAnchor() {
759            return balanceInquiryReturnAnchor;
760        }
761    
762        /**
763         * Sets the balanceInquiryReturnAnchor attribute value.
764         * 
765         * @param balanceInquiryReturnAnchor The balanceInquiryReturnAnchor to set.
766         */
767        public void setBalanceInquiryReturnAnchor(String balanceInquiryReturnAnchor) {
768            this.balanceInquiryReturnAnchor = balanceInquiryReturnAnchor;
769        }
770    
771        /**
772         * Gets the pullupKeyCode attribute.
773         * 
774         * @return Returns the pullupKeyCode.
775         */
776        public String getPullupKeyCode() {
777            return pullupKeyCode;
778        }
779    
780        /**
781         * Sets the pullupKeyCode attribute value.
782         * 
783         * @param pullupKeyCode The pullupKeyCode to set.
784         */
785        public void setPullupKeyCode(String pullupKeyCode) {
786            this.pullupKeyCode = pullupKeyCode;
787        }
788    
789        /**
790         * Gets the pullupLevelKeyLabels attribute.
791         * 
792         * @return Returns the pullupLevelKeyLabels.
793         */
794        public List<BCKeyLabelPair> getPullupLevelKeyLabels() {
795            return pullupLevelKeyLabels;
796        }
797    
798        /**
799         * Sets the pullupLevelKeyLabels attribute value.
800         * 
801         * @param pullupLevelKeyLabels The pullupLevelKeyLabels to set.
802         */
803        public void setPullupLevelKeyLabels(List<BCKeyLabelPair> pullupLevelKeyLabels) {
804            this.pullupLevelKeyLabels = pullupLevelKeyLabels;
805        }
806    
807        /**
808         * Gets the accountOrgHierLevels attribute.
809         * 
810         * @return Returns the accountOrgHierLevels.
811         */
812        public List<BudgetConstructionAccountOrganizationHierarchy> getAccountOrgHierLevels() {
813            return this.accountOrgHierLevels;
814        }
815    
816        /**
817         * Sets the accountOrgHierLevels attribute value.
818         * 
819         * @param accountOrgHierLevels The accountOrgHierLevels to set.
820         */
821        public void setAccountOrgHierLevels(List<BudgetConstructionAccountOrganizationHierarchy> accountOrgHierLevels) {
822            this.accountOrgHierLevels = accountOrgHierLevels;
823        }
824    
825        /**
826         * Gets the pushdownKeyCode attribute.
827         * 
828         * @return Returns the pushdownKeyCode.
829         */
830        public String getPushdownKeyCode() {
831            return pushdownKeyCode;
832        }
833    
834        /**
835         * Sets the pushdownKeyCode attribute value.
836         * 
837         * @param pushdownKeyCode The pushdownKeyCode to set.
838         */
839        public void setPushdownKeyCode(String pushdownKeyCode) {
840            this.pushdownKeyCode = pushdownKeyCode;
841        }
842    
843        /**
844         * Gets the pushdownLevelKeyLabels attribute.
845         * 
846         * @return Returns the pushdownLevelKeyLabels.
847         */
848        public List<BCKeyLabelPair> getPushdownLevelKeyLabels() {
849            return pushdownLevelKeyLabels;
850        }
851    
852        /**
853         * Sets the pushdownLevelKeyLabels attribute value.
854         * 
855         * @param pushdownLevelKeyLabels The pushdownLevelKeyLabels to set.
856         */
857        public void setPushdownLevelKeyLabels(List<BCKeyLabelPair> pushdownLevelKeyLabels) {
858            this.pushdownLevelKeyLabels = pushdownLevelKeyLabels;
859        }
860    
861        /**
862         * Gets the checkTwoPlugAdjustment attribute.
863         * 
864         * @return Returns the checkTwoPlugAdjustment.
865         */
866        public boolean isCheckTwoPlugAdjustment() {
867            return checkTwoPlugAdjustment;
868        }
869    
870        /**
871         * Sets the checkTwoPlugAdjustment attribute value.
872         * 
873         * @param checkTwoPlugAdjustment The checkTwoPlugAdjustment to set.
874         */
875        public void setCheckTwoPlugAdjustment(boolean checkTwoPlugAdjustment) {
876            this.checkTwoPlugAdjustment = checkTwoPlugAdjustment;
877        }
878    
879        /**
880         * Gets the preSalarySettingRows attribute.
881         * 
882         * @return Returns the preSalarySettingRows.
883         */
884        public HashMap<String, PendingBudgetConstructionGeneralLedger> getPreSalarySettingRows() {
885            return preSalarySettingRows;
886        }
887    
888        /**
889         * Sets the preSalarySettingRows attribute value.
890         * 
891         * @param preSalarySettingRows The preSalarySettingRows to set.
892         */
893        public void setPreSalarySettingRows(HashMap<String, PendingBudgetConstructionGeneralLedger> preSalarySettingRows) {
894            this.preSalarySettingRows = preSalarySettingRows;
895        }
896    
897        /**
898         * Gets the closingDocument attribute.
899         * 
900         * @return Returns the closingDocument.
901         */
902        public boolean isClosingDocument() {
903            return closingDocument;
904        }
905    
906        /**
907         * Sets the closingDocument attribute value.
908         * 
909         * @param closingDocument The closingDocument to set.
910         */
911        public void setClosingDocument(boolean closingDocument) {
912            this.closingDocument = closingDocument;
913        }
914    
915        /**
916         * Helper method to check edit mode Map for system view only entry
917         */
918        public boolean isSystemViewOnly() {
919            return getEditingMode().containsKey(BCConstants.EditModes.SYSTEM_VIEW_ONLY);
920        }
921    
922        /**
923         * Helper method to check document actions Map for can edit entry
924         */
925        public boolean isEditAllowed() {
926            return getDocumentActions().keySet().contains(KNSConstants.KUALI_ACTION_CAN_EDIT);
927        }
928    
929        /**
930         * Gets the mainWindow attribute.
931         * 
932         * @return Returns the mainWindow.
933         */
934        public boolean isMainWindow() {
935            return mainWindow;
936        }
937    
938        /**
939         * Sets the mainWindow attribute value.
940         * 
941         * @param mainWindow The mainWindow to set.
942         */
943        public void setMainWindow(boolean mainWindow) {
944            this.mainWindow = mainWindow;
945        }
946    
947        /**
948         * Gets the revenueObjectTypeCodesLookup attribute. 
949         * @return Returns the revenueObjectTypeCodesLookup.
950         */
951        public static String getRevenueObjectTypeCodesLookup() {
952            return revenueObjectTypeCodesLookup;
953        }
954    
955        /**
956         * Gets the expenditureObjectTypeCodesLookup attribute. 
957         * @return Returns the expenditureObjectTypeCodesLookup.
958         */
959        public static String getExpenditureObjectTypeCodesLookup() {
960            return expenditureObjectTypeCodesLookup;
961        }
962    }