001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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:
017: package org.kuali.module.labor.bo;
018:
019: import java.util.ArrayList;
020: import java.util.List;
021:
022: import org.kuali.core.bo.user.PersonPayrollId;
023: import org.kuali.core.bo.user.UniversalUser;
024: import org.kuali.core.bo.user.UserId;
025: import org.kuali.core.exceptions.UserNotFoundException;
026: import org.kuali.core.service.UniversalUserService;
027: import org.kuali.core.util.KualiDecimal;
028: import org.kuali.kfs.KFSPropertyConstants;
029: import org.kuali.kfs.context.SpringContext;
030: import org.kuali.module.labor.LaborConstants;
031:
032: /**
033: * Labor business object for Account Status (Current Funds).
034: */
035: public class AccountStatusCurrentFunds extends LedgerBalance {
036: private String personName;
037: private KualiDecimal outstandingEncum;
038: private KualiDecimal july1BudgetAmount;
039: private KualiDecimal annualActualAmount;
040: private KualiDecimal variance;
041:
042: /**
043: * Constructs an AccountStatusCurrentFunds.java.
044: */
045: public AccountStatusCurrentFunds() {
046: super ();
047: setMonth1Amount(KualiDecimal.ZERO);
048: this .setOutstandingEncum(KualiDecimal.ZERO);
049: this .setVariance(KualiDecimal.ZERO);
050: this .setJuly1BudgetAmount(KualiDecimal.ZERO);
051: this .setAnnualActualAmount(KualiDecimal.ZERO);
052: }
053:
054: /**
055: * Gets the person name
056: *
057: * @return the person name
058: */
059: public String getPersonName() {
060: UserId empl = new PersonPayrollId(getEmplid());
061: UniversalUser universalUser = null;
062:
063: try {
064: universalUser = SpringContext.getBean(
065: UniversalUserService.class).getUniversalUser(empl);
066: } catch (UserNotFoundException e) {
067: return LaborConstants.BalanceInquiries.UnknownPersonName;
068: }
069:
070: return universalUser.getPersonName();
071: }
072:
073: /**
074: * Sets the persons name
075: *
076: * @param personName
077: */
078: public void setPersonName(String personName) {
079: this .personName = personName;
080: }
081:
082: /**
083: * Gets an outstanding encumberance value
084: *
085: * @return outstanding encumberance value
086: */
087: public KualiDecimal getOutstandingEncum() {
088: return outstandingEncum;
089: }
090:
091: /**
092: * Sets an outstanding encumberance value
093: *
094: * @param outstandingEncum
095: */
096: public void setOutstandingEncum(KualiDecimal outstandingEncum) {
097: this .outstandingEncum = outstandingEncum;
098: }
099:
100: /**
101: * Gets the Jul1BudgerAmount
102: *
103: * @return July1st amount
104: */
105: public KualiDecimal getJuly1BudgetAmount() {
106: return july1BudgetAmount;
107: }
108:
109: /**
110: * Sets the july1BudgetAmount
111: *
112: * @param july1BudgetAmount
113: */
114: public void setJuly1BudgetAmount(KualiDecimal july1BudgetAmount) {
115: this .july1BudgetAmount = july1BudgetAmount;
116: }
117:
118: /**
119: * Gets the variance which is calculated by substracting from July1BudgetAmount the YTD Actual, and outstanding encumbrance.
120: *
121: * @return
122: */
123: public KualiDecimal getVariance() {
124: return this .getJuly1BudgetAmount().subtract(
125: getAnnualActualAmount())
126: .subtract(getOutstandingEncum());
127: }
128:
129: /**
130: * Sets the variance which is calculated by substracting from July1BudgetAmount the YTD Actual, and outstanding encumbrance.
131: *
132: * @param variance
133: */
134: public void setVariance(KualiDecimal variance) {
135: this .variance = variance;
136: }
137:
138: /**
139: * Returns a list of keys used to generate a query.
140: *
141: * @param consolidated
142: * @return a list with the keys needed to generate a query
143: */
144: public List<String> getKeyFieldList(boolean consolidated) {
145: List<String> primaryKeyList = new ArrayList<String>();
146: primaryKeyList.add(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR);
147: primaryKeyList.add(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE);
148: primaryKeyList.add(KFSPropertyConstants.ACCOUNT_NUMBER);
149:
150: if (!consolidated) {
151: primaryKeyList.add(KFSPropertyConstants.SUB_ACCOUNT_NUMBER);
152: }
153:
154: primaryKeyList.add(KFSPropertyConstants.FINANCIAL_OBJECT_CODE);
155:
156: if (!consolidated) {
157: primaryKeyList
158: .add(KFSPropertyConstants.FINANCIAL_SUB_OBJECT_CODE);
159: }
160: primaryKeyList.add(KFSPropertyConstants.POSITION_NUMBER);
161: primaryKeyList.add(KFSPropertyConstants.EMPLID);
162:
163: return primaryKeyList;
164: }
165:
166: /**
167: * Gets the annualActualAmount attribute.
168: *
169: * @return Returns the annualActualAmount.
170: */
171: public KualiDecimal getAnnualActualAmount() {
172: return this .getAccountLineAnnualBalanceAmount().add(
173: this .getContractsGrantsBeginningBalanceAmount());
174: }
175:
176: /**
177: * Sets the annualActualAmount attribute value.
178: *
179: * @param annualActualAmount The annualActualAmount to set.
180: */
181: public void setAnnualActualAmount(KualiDecimal annualActualAmount) {
182: this.annualActualAmount = annualActualAmount;
183: }
184: }
|