Source Code Cross Referenced for AccountBalance.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » gl » bo » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » Kuali Financial System » org.kuali.module.gl.bo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-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:        package org.kuali.module.gl.bo;
017:
018:        import java.math.BigDecimal;
019:        import java.sql.Date;
020:        import java.util.LinkedHashMap;
021:        import java.util.Map;
022:
023:        import org.kuali.core.bo.PersistableBusinessObjectBase;
024:        import org.kuali.core.util.KualiDecimal;
025:        import org.kuali.kfs.KFSPropertyConstants;
026:        import org.kuali.kfs.bo.Options;
027:        import org.kuali.module.chart.bo.A21SubAccount;
028:        import org.kuali.module.chart.bo.Account;
029:        import org.kuali.module.chart.bo.Chart;
030:        import org.kuali.module.chart.bo.ObjectCode;
031:        import org.kuali.module.chart.bo.SubAccount;
032:        import org.kuali.module.chart.bo.SubObjCd;
033:        import org.kuali.module.gl.GLConstants;
034:        import org.kuali.module.gl.web.Constant;
035:
036:        /**
037:         * Just as Balance is a summarization of Entry, so AccountBalance is a summarization of Balance.
038:         * Specifically, it stores the current budget, actual, and encumbrance totals in one record.
039:         */
040:        public class AccountBalance extends PersistableBusinessObjectBase {
041:            static final long serialVersionUID = 6873573726961704771L;
042:
043:            private Integer universityFiscalYear;
044:            private String chartOfAccountsCode;
045:            private String accountNumber;
046:            private String subAccountNumber;
047:            private String objectCode;
048:            private String subObjectCode;
049:            private KualiDecimal currentBudgetLineBalanceAmount;
050:            private KualiDecimal accountLineActualsBalanceAmount;
051:            private KualiDecimal accountLineEncumbranceBalanceAmount;
052:            private Date timestamp;
053:
054:            private Chart chart;
055:            private Account account;
056:            private SubAccount subAccount;
057:            private ObjectCode financialObject;
058:            private SubObjCd financialSubObject;
059:            private A21SubAccount a21SubAccount;
060:            private TransientBalanceInquiryAttributes dummyBusinessObject;
061:            private Options option;
062:            private String title;
063:
064:            public static final String TYPE_CONSOLIDATION = "Consolidation";
065:            public static final String TYPE_LEVEL = "Level";
066:            public static final String TYPE_OBJECT = "Object";
067:
068:            public AccountBalance() {
069:                super ();
070:                this .dummyBusinessObject = new TransientBalanceInquiryAttributes();
071:                this .financialObject = new ObjectCode();
072:            }
073:
074:            public AccountBalance(Transaction t) {
075:                this ();
076:                universityFiscalYear = t.getUniversityFiscalYear();
077:                chartOfAccountsCode = t.getChartOfAccountsCode();
078:                accountNumber = t.getAccountNumber();
079:                subAccountNumber = t.getSubAccountNumber();
080:                objectCode = t.getFinancialObjectCode();
081:                subObjectCode = t.getFinancialSubObjectCode();
082:                currentBudgetLineBalanceAmount = KualiDecimal.ZERO;
083:                accountLineActualsBalanceAmount = KualiDecimal.ZERO;
084:                accountLineEncumbranceBalanceAmount = KualiDecimal.ZERO;
085:            }
086:
087:            public AccountBalance(String type, Map data,
088:                    Integer universityFiscalYear, String chartOfAccountsCode,
089:                    String accountNumber) {
090:                this ();
091:
092:                this .universityFiscalYear = universityFiscalYear;
093:                this .chartOfAccountsCode = chartOfAccountsCode;
094:                this .accountNumber = accountNumber;
095:                subAccountNumber = (String) data
096:                        .get(GLConstants.ColumnNames.SUB_ACCOUNT_NUMBER);
097:
098:                currentBudgetLineBalanceAmount = new KualiDecimal(
099:                        (BigDecimal) data
100:                                .get(GLConstants.ColumnNames.CURRENT_BDLN_BALANCE_AMOUNT));
101:                accountLineActualsBalanceAmount = new KualiDecimal(
102:                        (BigDecimal) data
103:                                .get(GLConstants.ColumnNames.ACCOUNTING_LINE_ACTUALS_BALANCE_AMOUNT));
104:                accountLineEncumbranceBalanceAmount = new KualiDecimal(
105:                        (BigDecimal) data
106:                                .get(GLConstants.ColumnNames.ACCOUNTING_LINE_ENCUMBRANCE_BALANCE_AMOUNT));
107:
108:                financialObject
109:                        .getFinancialObjectLevel()
110:                        .setFinancialConsolidationObjectCode(
111:                                (String) data
112:                                        .get(GLConstants.ColumnNames.CONSOLIDATION_OBJECT_CODE));
113:                financialObject
114:                        .getFinancialObjectLevel()
115:                        .getFinancialConsolidationObject()
116:                        .setFinConsolidationObjectCode(
117:                                (String) data
118:                                        .get(GLConstants.ColumnNames.CONSOLIDATION_OBJECT_CODE));
119:
120:                if (TYPE_CONSOLIDATION.equals(type)) {
121:                    financialObject
122:                            .getFinancialObjectType()
123:                            .setFinancialReportingSortCode(
124:                                    (String) data
125:                                            .get(GLConstants.ColumnNames.REPORT_SORT_CODE));
126:                    financialObject
127:                            .getFinancialObjectLevel()
128:                            .getFinancialConsolidationObject()
129:                            .setFinancialReportingSortCode(
130:                                    (String) data
131:                                            .get(GLConstants.ColumnNames.CONSOLIDATION_REPORT_SORT_CODE));
132:                    fixVariance();
133:                } else if (TYPE_LEVEL.equals(type)) {
134:                    financialObject
135:                            .getFinancialObjectLevel()
136:                            .setFinancialReportingSortCode(
137:                                    (String) data
138:                                            .get(GLConstants.ColumnNames.REPORT_SORT_CODE));
139:                    financialObject.setFinancialObjectLevelCode((String) data
140:                            .get(GLConstants.ColumnNames.OBJECT_LEVEL_CODE2));
141:                    financialObject
142:                            .getFinancialObjectLevel()
143:                            .setFinancialObjectLevelCode(
144:                                    (String) data
145:                                            .get(GLConstants.ColumnNames.OBJECT_LEVEL_CODE2));
146:
147:                    // tricking it so getVariance() works
148:                    financialObject
149:                            .getFinancialObjectType()
150:                            .setFinancialReportingSortCode(
151:                                    Constant.START_CHAR_OF_REPORTING_SORT_CODE_B);
152:                    fixVariance();
153:                } else if (TYPE_OBJECT.equals(type)) {
154:                    objectCode = (String) data
155:                            .get(GLConstants.ColumnNames.OBJECT_CODE);
156:                    financialObject.setFinancialObjectLevelCode((String) data
157:                            .get(GLConstants.ColumnNames.OBJECT_LEVEL_CODE));
158:                    financialObject
159:                            .getFinancialObjectLevel()
160:                            .setFinancialObjectLevelCode(
161:                                    (String) data
162:                                            .get(GLConstants.ColumnNames.OBJECT_LEVEL_CODE));
163:
164:                    // tricking it so getVariance() works
165:                    financialObject
166:                            .getFinancialObjectType()
167:                            .setFinancialReportingSortCode(
168:                                    Constant.START_CHAR_OF_REPORTING_SORT_CODE_B);
169:                    fixVariance();
170:                } else {
171:                    throw new RuntimeException("Unknown type: " + type);
172:                }
173:            }
174:
175:            public AccountBalance(String title) {
176:                this ();
177:                this .title = title;
178:                // financialObject.getFinancialObjectLevel().setFinancialConsolidationObjectCode(title);
179:                currentBudgetLineBalanceAmount = KualiDecimal.ZERO;
180:                accountLineActualsBalanceAmount = KualiDecimal.ZERO;
181:                accountLineEncumbranceBalanceAmount = KualiDecimal.ZERO;
182:            }
183:
184:            public void fixVariance() {
185:                dummyBusinessObject.setGenericAmount(getVariance());
186:            }
187:
188:            public KualiDecimal getVariance() {
189:
190:                KualiDecimal variance = KualiDecimal.ZERO;
191:
192:                // get the reporting sort code
193:                String reportingSortCode = financialObject
194:                        .getFinancialObjectType()
195:                        .getFinancialReportingSortCode();
196:
197:                // calculate the variance based on the starting character of reporting sort code
198:                if (reportingSortCode
199:                        .startsWith(Constant.START_CHAR_OF_REPORTING_SORT_CODE_B)) {
200:                    variance = currentBudgetLineBalanceAmount
201:                            .subtract(accountLineActualsBalanceAmount);
202:                    variance = variance
203:                            .subtract(accountLineEncumbranceBalanceAmount);
204:                } else {
205:                    variance = accountLineActualsBalanceAmount
206:                            .subtract(currentBudgetLineBalanceAmount);
207:                }
208:                return variance;
209:            }
210:
211:            public void add(AccountBalance ab) {
212:                currentBudgetLineBalanceAmount = currentBudgetLineBalanceAmount
213:                        .add(ab.currentBudgetLineBalanceAmount);
214:                accountLineActualsBalanceAmount = accountLineActualsBalanceAmount
215:                        .add(ab.accountLineActualsBalanceAmount);
216:                accountLineEncumbranceBalanceAmount = accountLineEncumbranceBalanceAmount
217:                        .add(ab.accountLineEncumbranceBalanceAmount);
218:            }
219:
220:            /*
221:             * (non-Javadoc)
222:             * 
223:             * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
224:             */
225:            protected LinkedHashMap toStringMapper() {
226:
227:                LinkedHashMap map = new LinkedHashMap();
228:                map.put(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR,
229:                        getUniversityFiscalYear());
230:                map.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE,
231:                        getChartOfAccountsCode());
232:                map
233:                        .put(KFSPropertyConstants.ACCOUNT_NUMBER,
234:                                getAccountNumber());
235:                map.put(KFSPropertyConstants.SUB_ACCOUNT_NUMBER,
236:                        getSubAccountNumber());
237:                map.put(KFSPropertyConstants.OBJECT_CODE, getObjectCode());
238:                map.put(KFSPropertyConstants.SUB_OBJECT_CODE,
239:                        getSubObjectCode());
240:                return map;
241:            }
242:
243:            public String getTitle() {
244:                return title;
245:            }
246:
247:            public A21SubAccount getA21SubAccount() {
248:                return a21SubAccount;
249:            }
250:
251:            public void setA21SubAccount(A21SubAccount subAccount) {
252:                a21SubAccount = subAccount;
253:            }
254:
255:            public Options getOption() {
256:                return option;
257:            }
258:
259:            public void setOption(Options option) {
260:                this .option = option;
261:            }
262:
263:            public KualiDecimal getAccountLineActualsBalanceAmount() {
264:                return accountLineActualsBalanceAmount;
265:            }
266:
267:            public void setAccountLineActualsBalanceAmount(
268:                    KualiDecimal accountLineActualsBalanceAmount) {
269:                this .accountLineActualsBalanceAmount = accountLineActualsBalanceAmount;
270:            }
271:
272:            public KualiDecimal getAccountLineEncumbranceBalanceAmount() {
273:                return accountLineEncumbranceBalanceAmount;
274:            }
275:
276:            public void setAccountLineEncumbranceBalanceAmount(
277:                    KualiDecimal accountLineEncumbranceBalanceAmount) {
278:                this .accountLineEncumbranceBalanceAmount = accountLineEncumbranceBalanceAmount;
279:            }
280:
281:            public String getAccountNumber() {
282:                return accountNumber;
283:            }
284:
285:            public void setAccountNumber(String accountNumber) {
286:                this .accountNumber = accountNumber;
287:            }
288:
289:            public String getChartOfAccountsCode() {
290:                return chartOfAccountsCode;
291:            }
292:
293:            public void setChartOfAccountsCode(String chartOfAccountsCode) {
294:                this .chartOfAccountsCode = chartOfAccountsCode;
295:            }
296:
297:            public KualiDecimal getCurrentBudgetLineBalanceAmount() {
298:                return currentBudgetLineBalanceAmount;
299:            }
300:
301:            public void setCurrentBudgetLineBalanceAmount(
302:                    KualiDecimal currentBudgetLineBalanceAmount) {
303:                this .currentBudgetLineBalanceAmount = currentBudgetLineBalanceAmount;
304:            }
305:
306:            public String getObjectCode() {
307:                return objectCode;
308:            }
309:
310:            public void setObjectCode(String objectCode) {
311:                this .objectCode = objectCode;
312:            }
313:
314:            public String getSubAccountNumber() {
315:                return subAccountNumber;
316:            }
317:
318:            public void setSubAccountNumber(String subAccountNumber) {
319:                this .subAccountNumber = subAccountNumber;
320:            }
321:
322:            public String getSubObjectCode() {
323:                return subObjectCode;
324:            }
325:
326:            public void setSubObjectCode(String subObjectCode) {
327:                this .subObjectCode = subObjectCode;
328:            }
329:
330:            public Date getTimestamp() {
331:                return timestamp;
332:            }
333:
334:            public void setTimestamp(Date timestamp) {
335:                this .timestamp = timestamp;
336:            }
337:
338:            public Integer getUniversityFiscalYear() {
339:                return universityFiscalYear;
340:            }
341:
342:            public void setUniversityFiscalYear(Integer universityFiscalYear) {
343:                this .universityFiscalYear = universityFiscalYear;
344:            }
345:
346:            /**
347:             * Gets the account attribute.
348:             * 
349:             * @return Returns the account.
350:             */
351:            public Account getAccount() {
352:                return account;
353:            }
354:
355:            /**
356:             * Sets the account attribute value.
357:             * 
358:             * @param account The account to set.
359:             */
360:            public void setAccount(Account account) {
361:                this .account = account;
362:            }
363:
364:            /**
365:             * Gets the chart attribute.
366:             * 
367:             * @return Returns the chart.
368:             */
369:            public Chart getChart() {
370:                return chart;
371:            }
372:
373:            /**
374:             * Sets the chart attribute value.
375:             * 
376:             * @param chart The chart to set.
377:             */
378:            public void setChart(Chart chart) {
379:                this .chart = chart;
380:            }
381:
382:            /**
383:             * Gets the financialObject attribute.
384:             * 
385:             * @return Returns the financialObject.
386:             */
387:            public ObjectCode getFinancialObject() {
388:                return financialObject;
389:            }
390:
391:            /**
392:             * Sets the financialObject attribute value.
393:             * 
394:             * @param financialObject The financialObject to set.
395:             */
396:            public void setFinancialObject(ObjectCode financialObject) {
397:                this .financialObject = financialObject;
398:            }
399:
400:            /**
401:             * Gets the dummyBusinessObject attribute.
402:             * 
403:             * @return Returns the dummyBusinessObject.
404:             */
405:            public TransientBalanceInquiryAttributes getDummyBusinessObject() {
406:                return dummyBusinessObject;
407:            }
408:
409:            /**
410:             * Sets the dummyBusinessObject attribute value.
411:             * 
412:             * @param dummyBusinessObject The dummyBusinessObject to set.
413:             */
414:            public void setDummyBusinessObject(
415:                    TransientBalanceInquiryAttributes dummyBusinessObject) {
416:                this .dummyBusinessObject = dummyBusinessObject;
417:            }
418:
419:            /**
420:             * Gets the subAccount attribute.
421:             * 
422:             * @return Returns the subAccount.
423:             */
424:            public SubAccount getSubAccount() {
425:                return subAccount;
426:            }
427:
428:            /**
429:             * Sets the subAccount attribute value.
430:             * 
431:             * @param subAccount The subAccount to set.
432:             */
433:            public void setSubAccount(SubAccount subAccount) {
434:                this .subAccount = subAccount;
435:            }
436:
437:            /**
438:             * Gets the subObject
439:             * 
440:             * @return
441:             */
442:            public SubObjCd getFinancialSubObject() {
443:                return financialSubObject;
444:            }
445:
446:            /**
447:             * Sets the subObject.
448:             * 
449:             * @param financialSubObject
450:             */
451:            public void setFinancialSubObject(SubObjCd financialSubObject) {
452:                this.financialSubObject = financialSubObject;
453:            }
454:
455:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.