Source Code Cross Referenced for CreditCardReceiptDocument.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.util.ArrayList;
019:        import java.util.List;
020:
021:        import org.kuali.core.document.AmountTotaling;
022:        import org.kuali.core.document.Copyable;
023:        import org.kuali.core.service.DocumentTypeService;
024:        import org.kuali.core.util.KualiDecimal;
025:        import org.kuali.core.web.format.CurrencyFormatter;
026:        import org.kuali.kfs.KFSConstants;
027:        import org.kuali.kfs.bo.AccountingLineParser;
028:        import org.kuali.kfs.context.SpringContext;
029:        import org.kuali.module.financial.bo.BasicFormatWithLineDescriptionAccountingLineParser;
030:        import org.kuali.module.financial.bo.CreditCardDetail;
031:
032:        /**
033:         * This is the business object that represents the CreditCardReceipt document in Kuali. This is a transactional document that will
034:         * eventually post transactions to the G/L. It integrates with workflow. Since a Credit Card Receipt is a one sided transactional
035:         * document, only accepting funds into the university, the accounting line data will be held in the source accounting line data
036:         * structure only.
037:         */
038:        public class CreditCardReceiptDocument extends CashReceiptFamilyBase
039:                implements  Copyable, AmountTotaling {
040:            // holds details about each credit card receipt
041:            private List<CreditCardDetail> creditCardReceipts = new ArrayList<CreditCardDetail>();
042:
043:            // incrementers for detail lines
044:            private Integer nextCcCrLineNumber = new Integer(1);
045:
046:            // monetary attributes
047:            private KualiDecimal totalCreditCardAmount = new KualiDecimal(0);
048:
049:            /**
050:             * Default constructor that calls super.
051:             */
052:            public CreditCardReceiptDocument() {
053:                super ();
054:            }
055:
056:            @Override
057:            public boolean documentPerformsSufficientFundsCheck() {
058:                return false;
059:            }
060:
061:            /**
062:             * Gets the total credit card amount.
063:             * 
064:             * @return KualiDecimal
065:             */
066:            public KualiDecimal getTotalCreditCardAmount() {
067:                return totalCreditCardAmount;
068:            }
069:
070:            /**
071:             * This method returns the credit card total amount as a currency formatted string.
072:             * 
073:             * @return String
074:             */
075:            public String getCurrencyFormattedTotalCreditCardAmount() {
076:                return (String) new CurrencyFormatter()
077:                        .format(totalCreditCardAmount);
078:            }
079:
080:            /**
081:             * Sets the total credit card amount which is the sum of all credit card receipts on this document.
082:             * 
083:             * @param creditCardAmount
084:             */
085:            public void setTotalCreditCardAmount(KualiDecimal creditCardAmount) {
086:                this .totalCreditCardAmount = creditCardAmount;
087:            }
088:
089:            /**
090:             * Gets the list of credit card receipts which is a list of CreditCardDetail business objects.
091:             * 
092:             * @return List
093:             */
094:            public List<CreditCardDetail> getCreditCardReceipts() {
095:                return creditCardReceipts;
096:            }
097:
098:            /**
099:             * Sets the credit card receipts list.
100:             * 
101:             * @param creditCardReceipts
102:             */
103:            public void setCreditCardReceipts(
104:                    List<CreditCardDetail> creditCardReceipts) {
105:                this .creditCardReceipts = creditCardReceipts;
106:            }
107:
108:            /**
109:             * Adds a new credit card receipt to the list.
110:             * 
111:             * @param creditCardReceiptDetail
112:             */
113:            public void addCreditCardReceipt(
114:                    CreditCardDetail creditCardReceiptDetail) {
115:                // these three make up the primary key for a credit card detail record
116:                prepareNewCreditCardReceipt(creditCardReceiptDetail);
117:
118:                // add the new detail record to the list
119:                this .creditCardReceipts.add(creditCardReceiptDetail);
120:
121:                // increment line number
122:                this .nextCcCrLineNumber = new Integer(this .nextCcCrLineNumber
123:                        .intValue() + 1);
124:
125:                // update the overall amount
126:                this .totalCreditCardAmount = this .totalCreditCardAmount
127:                        .add(creditCardReceiptDetail
128:                                .getCreditCardAdvanceDepositAmount());
129:            }
130:
131:            /**
132:             * This is a helper method that automatically populates document specfic information into the credit card receipt
133:             * (CreditCardDetail) instance.
134:             * 
135:             * @param creditCardReceiptDetail
136:             */
137:            public final void prepareNewCreditCardReceipt(
138:                    CreditCardDetail creditCardReceiptDetail) {
139:                creditCardReceiptDetail
140:                        .setFinancialDocumentLineNumber(this .nextCcCrLineNumber);
141:                creditCardReceiptDetail
142:                        .setFinancialDocumentColumnTypeCode(KFSConstants.CreditCardReceiptConstants.CASH_RECEIPT_CREDIT_CARD_RECEIPT_COLUMN_TYPE_CODE);
143:                creditCardReceiptDetail.setDocumentNumber(this 
144:                        .getDocumentNumber());
145:                creditCardReceiptDetail
146:                        .setFinancialDocumentTypeCode(SpringContext.getBean(
147:                                DocumentTypeService.class)
148:                                .getDocumentTypeCodeByClass(this .getClass()));
149:            }
150:
151:            /**
152:             * Retrieve a particular credit card receipt at a given index in the list of credit card receipts.
153:             * 
154:             * @param index
155:             * @return CreditCardReceiptDetail
156:             */
157:            public CreditCardDetail getCreditCardReceipt(int index) {
158:                while (this .creditCardReceipts.size() <= index) {
159:                    creditCardReceipts.add(new CreditCardDetail());
160:                }
161:                return creditCardReceipts.get(index);
162:            }
163:
164:            /**
165:             * This method removes a credit card receipt from the list and updates the total appropriately.
166:             * 
167:             * @param index
168:             */
169:            public void removeCreditCardReceipt(int index) {
170:                CreditCardDetail creditCardReceiptDetail = creditCardReceipts
171:                        .remove(index);
172:                this .totalCreditCardAmount = this .totalCreditCardAmount
173:                        .subtract(creditCardReceiptDetail
174:                                .getCreditCardAdvanceDepositAmount());
175:            }
176:
177:            /**
178:             * @return Integer
179:             */
180:            public Integer getNextCcCrLineNumber() {
181:                return nextCcCrLineNumber;
182:            }
183:
184:            /**
185:             * @param nextCcCrLineNumber
186:             */
187:            public void setNextCcCrLineNumber(Integer nextCcCrLineNumber) {
188:                this .nextCcCrLineNumber = nextCcCrLineNumber;
189:            }
190:
191:            /**
192:             * This method returns the overall total of the document - the credit card total.
193:             * 
194:             * @see org.kuali.kfs.document.AccountingDocumentBase#getTotalDollarAmount()
195:             * @return KualiDecimal
196:             */
197:            @Override
198:            public KualiDecimal getTotalDollarAmount() {
199:                return this .totalCreditCardAmount;
200:            }
201:
202:            /**
203:             * This method returns the sum of all of the credit card receipts for this document.
204:             * 
205:             * @return KualiDecimal
206:             */
207:            public KualiDecimal calculateCreditCardReceiptTotal() {
208:                KualiDecimal total = KualiDecimal.ZERO;
209:                for (CreditCardDetail detail : getCreditCardReceipts()) {
210:                    if (null != detail.getCreditCardAdvanceDepositAmount()) {
211:                        total = total.add(detail
212:                                .getCreditCardAdvanceDepositAmount());
213:                    }
214:                }
215:                return total;
216:            }
217:
218:            /**
219:             * Overrides super to call super and then also add in the new list of credit card receipts that have to be managed.
220:             * 
221:             * @see org.kuali.core.document.TransactionalDocumentBase#buildListOfDeletionAwareLists()
222:             */
223:            @Override
224:            public List buildListOfDeletionAwareLists() {
225:                List managedLists = super .buildListOfDeletionAwareLists();
226:                managedLists.add(getCreditCardReceipts());
227:
228:                return managedLists;
229:            }
230:
231:            /**
232:             * @see org.kuali.kfs.document.AccountingDocumentBase#getAccountingLineParser()
233:             */
234:            @Override
235:            public AccountingLineParser getAccountingLineParser() {
236:                return new BasicFormatWithLineDescriptionAccountingLineParser();
237:            }
238:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.