Source Code Cross Referenced for CashReceiptFamilyBase.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » financial » document » 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.financial.document 
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.financial.document;
017:
018:        import java.sql.Timestamp;
019:        import java.util.Iterator;
020:
021:        import org.kuali.core.service.KualiRuleService;
022:        import org.kuali.core.util.KualiDecimal;
023:        import org.kuali.kfs.KFSConstants;
024:        import org.kuali.kfs.bo.AccountingLineBase;
025:        import org.kuali.kfs.bo.AccountingLineParser;
026:        import org.kuali.kfs.context.SpringContext;
027:        import org.kuali.kfs.document.AccountingDocumentBase;
028:        import org.kuali.kfs.rule.AccountingLineRule;
029:        import org.kuali.module.financial.bo.BasicFormatWithLineDescriptionAccountingLineParser;
030:        import org.kuali.module.financial.rules.CashReceiptFamilyRule;
031:
032:        /**
033:         * Abstract class which defines behavior common to CashReceipt-like documents.
034:         */
035:        abstract public class CashReceiptFamilyBase extends
036:                AccountingDocumentBase {
037:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
038:                    .getLogger(CashReceiptFamilyBase.class);
039:            private String campusLocationCode; // TODO Needs to be an actual object - also need to clarify this
040:            private Timestamp depositDate;
041:
042:            /**
043:             * Constructs a CashReceiptFamilyBase
044:             */
045:            public CashReceiptFamilyBase() {
046:                setCampusLocationCode(KFSConstants.CashReceiptConstants.DEFAULT_CASH_RECEIPT_CAMPUS_LOCATION_CODE);
047:            }
048:
049:            /**
050:             * Documents in the CashReceiptFamily do not perform Sufficient Funds checking
051:             * 
052:             * @see org.kuali.kfs.document.AccountingDocumentBase#documentPerformsSufficientFundsCheck()
053:             */
054:            @Override
055:            public boolean documentPerformsSufficientFundsCheck() {
056:                return false;
057:            }
058:
059:            /**
060:             * Gets the campusLocationCode attribute.
061:             * 
062:             * @return Returns the campusLocationCode.
063:             */
064:            public String getCampusLocationCode() {
065:                return campusLocationCode;
066:            }
067:
068:            /**
069:             * Sets the campusLocationCode attribute value.
070:             * 
071:             * @param campusLocationCode The campusLocationCode to set.
072:             */
073:            public void setCampusLocationCode(String campusLocationCode) {
074:                this .campusLocationCode = campusLocationCode;
075:            }
076:
077:            /**
078:             * Gets the depositDate attribute.
079:             * 
080:             * @return Returns the depositDate.
081:             */
082:            public Timestamp getDepositDate() {
083:                return depositDate;
084:            }
085:
086:            /**
087:             * Sets the depositDate attribute value.
088:             * 
089:             * @param depositDate The depositDate to set.
090:             */
091:            public void setDepositDate(Timestamp depositDate) {
092:                this .depositDate = depositDate;
093:            }
094:
095:            /**
096:             * Total for a Cash Receipt according to the spec should be the sum of the amounts on accounting lines belonging to object codes
097:             * having the 'income' object type, less the sum of the amounts on accounting lines belonging to object codes having the
098:             * 'expense' object type.
099:             * 
100:             * @see org.kuali.kfs.document.AccountingDocument#getSourceTotal()
101:             */
102:            @Override
103:            public KualiDecimal getSourceTotal() {
104:                CashReceiptFamilyRule crFamilyRule = (CashReceiptFamilyRule) SpringContext
105:                        .getBean(KualiRuleService.class)
106:                        .getBusinessRulesInstance(this ,
107:                                AccountingLineRule.class);
108:                KualiDecimal total = KualiDecimal.ZERO;
109:                AccountingLineBase al = null;
110:                Iterator iter = sourceAccountingLines.iterator();
111:                while (iter.hasNext()) {
112:                    al = (AccountingLineBase) iter.next();
113:                    try {
114:                        KualiDecimal amount = al.getAmount().abs();
115:                        if (amount != null && amount.isNonZero()) {
116:                            if (crFamilyRule.isDebit(this , al)) {
117:                                total = total.subtract(amount);
118:                            } else if (crFamilyRule.isCredit(al, this )) {
119:                                total = total.add(amount);
120:                            } else {
121:                                LOG
122:                                        .error("could not determine credit/debit for accounting line");
123:                                return KualiDecimal.ZERO;
124:                            }
125:                        }
126:                    } catch (Exception e) {
127:                        // Possibly caused by accounting lines w/ bad data
128:                        LOG
129:                                .error(
130:                                        "Error occured trying to compute Cash receipt total, returning 0",
131:                                        e);
132:                        return KualiDecimal.ZERO;
133:                    }
134:                }
135:                return total;
136:            }
137:
138:            /**
139:             * Cash Receipts only have source lines, so this should always return 0.
140:             * 
141:             * @see org.kuali.kfs.document.AccountingDocument#getTargetTotal()
142:             */
143:            @Override
144:            public KualiDecimal getTargetTotal() {
145:                return KualiDecimal.ZERO;
146:            }
147:
148:            /**
149:             * Overrides the base implementation to return an empty string.
150:             * 
151:             * @see org.kuali.kfs.document.AccountingDocument#getSourceAccountingLinesSectionTitle()
152:             */
153:            @Override
154:            public String getSourceAccountingLinesSectionTitle() {
155:                return KFSConstants.EMPTY_STRING;
156:            }
157:
158:            /**
159:             * Overrides the base implementation to return an empty string.
160:             * 
161:             * @see org.kuali.kfs.document.AccountingDocument#getTargetAccountingLinesSectionTitle()
162:             */
163:            @Override
164:            public String getTargetAccountingLinesSectionTitle() {
165:                return KFSConstants.EMPTY_STRING;
166:            }
167:
168:            /**
169:             * @see org.kuali.kfs.document.AccountingDocumentBase#getAccountingLineParser()
170:             */
171:            @Override
172:            public AccountingLineParser getAccountingLineParser() {
173:                return new BasicFormatWithLineDescriptionAccountingLineParser();
174:            }
175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.