Source Code Cross Referenced for LedgerEntry.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » gl » util » 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.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006-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.util;
017:
018:        import org.kuali.core.util.KualiDecimal;
019:        import org.kuali.kfs.KFSConstants;
020:
021:        /**
022:         * A representation of LedgerEntries, which are summaries that show up on Ledger Reports created by the scrubber and poster.
023:         */
024:        public class LedgerEntry {
025:
026:            private String balanceType;
027:            private String originCode;
028:            private Integer fiscalYear;
029:            private String period;
030:            private int recordCount;
031:            private KualiDecimal debitAmount;
032:            private int debitCount;
033:            private KualiDecimal creditAmount;
034:            private int creditCount;
035:            private KualiDecimal noDCAmount;
036:            private int noDCCount;
037:
038:            /**
039:             * Constructs a LedgerEntry.java.
040:             */
041:            public LedgerEntry() {
042:                this (null, null, null, null);
043:            }
044:
045:            /**
046:             * Constructs a LedgerEntry.java.
047:             * 
048:             * @param fiscalYear
049:             * @param period
050:             * @param balanceType
051:             * @param originCode
052:             */
053:            public LedgerEntry(Integer fiscalYear, String period,
054:                    String balanceType, String originCode) {
055:                this .fiscalYear = fiscalYear;
056:                this .period = period;
057:                this .balanceType = balanceType;
058:                this .originCode = originCode;
059:
060:                this .creditAmount = KualiDecimal.ZERO;
061:                this .debitAmount = KualiDecimal.ZERO;
062:                this .noDCAmount = KualiDecimal.ZERO;
063:            }
064:
065:            /**
066:             * Add the amounts of the given ledger entry into those of current ledger entry, and update the counts of corresponding fields
067:             * 
068:             * @param addend the given ledger entry to be added into current one
069:             */
070:            public void add(LedgerEntry addend) {
071:                this .creditAmount = this .creditAmount.add(addend
072:                        .getCreditAmount());
073:                this .creditCount += addend.getCreditCount();
074:
075:                this .debitAmount = this .debitAmount
076:                        .add(addend.getDebitAmount());
077:                this .debitCount += addend.getDebitCount();
078:
079:                this .noDCAmount = this .noDCAmount.add(addend.getNoDCAmount());
080:                this .noDCCount += addend.getNoDCCount();
081:
082:                this .recordCount = this .creditCount + this .debitCount
083:                        + this .noDCCount;
084:            }
085:
086:            /**
087:             * create or update a ledger entry with the array of information from the given entry summary object
088:             * 
089:             * @param entrySummary an entry summary to turn into a ledger entry
090:             * @return a LedgerEntry created from the entrySummary array
091:             */
092:            public static LedgerEntry buildLedgerEntry(Object[] entrySummary) {
093:                // extract the data from an array and use them to populate a ledger entry
094:                Object oFiscalYear = entrySummary[0];
095:                Object oPeriodCode = entrySummary[1];
096:                Object oBalanceType = entrySummary[2];
097:                Object oOriginCode = entrySummary[3];
098:                Object oDebitCreditCode = entrySummary[4];
099:                Object oAmount = entrySummary[5];
100:                Object oCount = entrySummary[6];
101:
102:                Integer fiscalYear = oFiscalYear != null ? new Integer(
103:                        oFiscalYear.toString()) : null;
104:                String periodCode = oPeriodCode != null ? oPeriodCode
105:                        .toString() : "  ";
106:                String balanceType = oBalanceType != null ? oBalanceType
107:                        .toString() : "  ";
108:                String originCode = oOriginCode != null ? oOriginCode
109:                        .toString() : "  ";
110:                String debitCreditCode = oDebitCreditCode != null ? oDebitCreditCode
111:                        .toString()
112:                        : " ";
113:                KualiDecimal amount = oAmount != null ? new KualiDecimal(
114:                        oAmount.toString()) : KualiDecimal.ZERO;
115:                int count = oCount != null ? Integer
116:                        .parseInt(oCount.toString()) : 0;
117:
118:                // construct a ledger entry with the information fetched from the given array
119:                LedgerEntry ledgerEntry = new LedgerEntry(fiscalYear,
120:                        periodCode, balanceType, originCode);
121:                if (KFSConstants.GL_CREDIT_CODE.equals(debitCreditCode)) {
122:                    ledgerEntry.setCreditAmount(amount);
123:                    ledgerEntry.setCreditCount(count);
124:                } else if (KFSConstants.GL_DEBIT_CODE.equals(debitCreditCode)) {
125:                    ledgerEntry.setDebitAmount(amount);
126:                    ledgerEntry.setDebitCount(count);
127:                } else {
128:                    ledgerEntry.setNoDCAmount(amount);
129:                    ledgerEntry.setNoDCCount(count);
130:                }
131:                ledgerEntry.setRecordCount(count);
132:
133:                return ledgerEntry;
134:            }
135:
136:            /**
137:             * Gets the balanceType attribute.
138:             * 
139:             * @return Returns the balanceType.
140:             */
141:            public String getBalanceType() {
142:                return balanceType;
143:            }
144:
145:            /**
146:             * Sets the balanceType attribute value.
147:             * 
148:             * @param balanceType The balanceType to set.
149:             */
150:            public void setBalanceType(String balanceType) {
151:                this .balanceType = balanceType;
152:            }
153:
154:            /**
155:             * Gets the creditAmount attribute.
156:             * 
157:             * @return Returns the creditAmount.
158:             */
159:            public KualiDecimal getCreditAmount() {
160:                return creditAmount;
161:            }
162:
163:            /**
164:             * Sets the creditAmount attribute value.
165:             * 
166:             * @param creditAmount The creditAmount to set.
167:             */
168:            public void setCreditAmount(KualiDecimal creditAmount) {
169:                this .creditAmount = creditAmount;
170:            }
171:
172:            /**
173:             * Gets the creditCount attribute.
174:             * 
175:             * @return Returns the creditCount.
176:             */
177:            public int getCreditCount() {
178:                return creditCount;
179:            }
180:
181:            /**
182:             * Sets the creditCount attribute value.
183:             * 
184:             * @param creditCount The creditCount to set.
185:             */
186:            public void setCreditCount(int creditCount) {
187:                this .creditCount = creditCount;
188:            }
189:
190:            /**
191:             * Gets the debitAmount attribute.
192:             * 
193:             * @return Returns the debitAmount.
194:             */
195:            public KualiDecimal getDebitAmount() {
196:                return debitAmount;
197:            }
198:
199:            /**
200:             * Sets the debitAmount attribute value.
201:             * 
202:             * @param debitAmount The debitAmount to set.
203:             */
204:            public void setDebitAmount(KualiDecimal debitAmount) {
205:                this .debitAmount = debitAmount;
206:            }
207:
208:            /**
209:             * Gets the debitCount attribute.
210:             * 
211:             * @return Returns the debitCount.
212:             */
213:            public int getDebitCount() {
214:                return debitCount;
215:            }
216:
217:            /**
218:             * Sets the debitCount attribute value.
219:             * 
220:             * @param debitCount The debitCount to set.
221:             */
222:            public void setDebitCount(int debitCount) {
223:                this .debitCount = debitCount;
224:            }
225:
226:            /**
227:             * Gets the fiscalYear attribute.
228:             * 
229:             * @return Returns the fiscalYear.
230:             */
231:            public Integer getFiscalYear() {
232:                return fiscalYear;
233:            }
234:
235:            /**
236:             * Sets the fiscalYear attribute value.
237:             * 
238:             * @param fiscalYear The fiscalYear to set.
239:             */
240:            public void setFiscalYear(Integer fiscalYear) {
241:                this .fiscalYear = fiscalYear;
242:            }
243:
244:            /**
245:             * Gets the noDCAmount attribute.
246:             * 
247:             * @return Returns the noDCAmount.
248:             */
249:            public KualiDecimal getNoDCAmount() {
250:                return noDCAmount;
251:            }
252:
253:            /**
254:             * Sets the noDCAmount attribute value.
255:             * 
256:             * @param noDCAmount The noDCAmount to set.
257:             */
258:            public void setNoDCAmount(KualiDecimal noDCAmount) {
259:                this .noDCAmount = noDCAmount;
260:            }
261:
262:            /**
263:             * Gets the noDCCount attribute.
264:             * 
265:             * @return Returns the noDCCount.
266:             */
267:            public int getNoDCCount() {
268:                return noDCCount;
269:            }
270:
271:            /**
272:             * Sets the noDCCount attribute value.
273:             * 
274:             * @param noDCCount The noDCCount to set.
275:             */
276:            public void setNoDCCount(int noDCCount) {
277:                this .noDCCount = noDCCount;
278:            }
279:
280:            /**
281:             * Gets the originCode attribute.
282:             * 
283:             * @return Returns the originCode.
284:             */
285:            public String getOriginCode() {
286:                return originCode;
287:            }
288:
289:            /**
290:             * Sets the originCode attribute value.
291:             * 
292:             * @param originCode The originCode to set.
293:             */
294:            public void setOriginCode(String originCode) {
295:                this .originCode = originCode;
296:            }
297:
298:            /**
299:             * Gets the period attribute.
300:             * 
301:             * @return Returns the period.
302:             */
303:            public String getPeriod() {
304:                return period;
305:            }
306:
307:            /**
308:             * Sets the period attribute value.
309:             * 
310:             * @param period The period to set.
311:             */
312:            public void setPeriod(String period) {
313:                this .period = period;
314:            }
315:
316:            /**
317:             * Gets the recordCount attribute.
318:             * 
319:             * @return Returns the recordCount.
320:             */
321:            public int getRecordCount() {
322:                return recordCount;
323:            }
324:
325:            /**
326:             * Sets the recordCount attribute value.
327:             * 
328:             * @param recordCount The recordCount to set.
329:             */
330:            public void setRecordCount(int recordCount) {
331:                this .recordCount = recordCount;
332:            }
333:
334:            /**
335:             * @see java.lang.Object#toString()
336:             */
337:            public String toString() {
338:                StringBuffer ledgerEntryDescription = new StringBuffer();
339:
340:                ledgerEntryDescription.append(fiscalYear + "\t");
341:                ledgerEntryDescription.append(period + "\t");
342:                ledgerEntryDescription.append(balanceType + "\t");
343:                ledgerEntryDescription.append(originCode + "\t");
344:                ledgerEntryDescription.append(recordCount + "\t");
345:
346:                ledgerEntryDescription.append(debitAmount + "\t\t");
347:                ledgerEntryDescription.append(debitCount + "\t");
348:
349:                ledgerEntryDescription.append(creditAmount + "\t\t");
350:                ledgerEntryDescription.append(creditCount + "\t");
351:
352:                ledgerEntryDescription.append(noDCAmount + "\t\t");
353:                ledgerEntryDescription.append(noDCCount + "\t");
354:
355:                return ledgerEntryDescription.toString();
356:            }
357:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.