Source Code Cross Referenced for PurchaseOrderItem.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » purap » 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.purap.bo 
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:
017:        package org.kuali.module.purap.bo;
018:
019:        import java.math.BigDecimal;
020:        import java.util.ArrayList;
021:        import java.util.LinkedHashMap;
022:        import java.util.List;
023:
024:        import org.kuali.core.util.KualiDecimal;
025:        import org.kuali.core.util.ObjectUtils;
026:        import org.kuali.module.purap.PurapPropertyConstants;
027:        import org.kuali.module.purap.document.PurchaseOrderDocument;
028:
029:        /**
030:         * Purchase Order Item Business Object.
031:         */
032:        public class PurchaseOrderItem extends PurchasingItemBase {
033:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
034:                    .getLogger(PurchaseOrderItem.class);
035:
036:            private String documentNumber;
037:            private KualiDecimal itemInvoicedTotalQuantity;
038:            private KualiDecimal itemInvoicedTotalAmount;
039:            private KualiDecimal itemReceivedTotalQuantity;
040:            private KualiDecimal itemReturnedTotalQuantity;
041:            private KualiDecimal itemOutstandingEncumberedQuantity;
042:            private KualiDecimal itemOutstandingEncumberedAmount;
043:            private boolean itemActiveIndicator = true;
044:            private String purchaseOrderCommodityCd;
045:
046:            private PurchaseOrderDocument purchaseOrder;
047:
048:            // Not persisted to DB
049:            private boolean itemSelectedForRetransmitIndicator;
050:
051:            /**
052:             * Default constructor.
053:             */
054:            public PurchaseOrderItem() {
055:
056:            }
057:
058:            /**
059:             * Constructor.
060:             * 
061:             * @param ri - Requisition Item
062:             * @param po - Purchase Order Document
063:             */
064:            public PurchaseOrderItem(RequisitionItem ri,
065:                    PurchaseOrderDocument po) {
066:                super ();
067:
068:                this .setPurchaseOrder(po);
069:
070:                this .setItemLineNumber(ri.getItemLineNumber());
071:                this .setItemUnitOfMeasureCode(ri.getItemUnitOfMeasureCode());
072:                this .setItemQuantity(ri.getItemQuantity());
073:                this .setItemCatalogNumber(ri.getItemCatalogNumber());
074:                this .setItemDescription(ri.getItemDescription());
075:                this .setItemCapitalAssetNoteText(ri
076:                        .getItemCapitalAssetNoteText());
077:                this .setItemUnitPrice(ri.getItemUnitPrice());
078:                this .setItemAuxiliaryPartIdentifier(ri
079:                        .getItemAuxiliaryPartIdentifier());
080:                this .setItemAssignedToTradeInIndicator(ri
081:                        .getItemAssignedToTradeInIndicator());
082:
083:                this .setExternalOrganizationB2bProductReferenceNumber(ri
084:                        .getExternalOrganizationB2bProductReferenceNumber());
085:                this .setExternalOrganizationB2bProductTypeName(ri
086:                        .getExternalOrganizationB2bProductTypeName());
087:
088:                this .setCapitalAssetTransactionTypeCode(ri
089:                        .getCapitalAssetTransactionTypeCode());
090:                this .setItemTypeCode(ri.getItemTypeCode());
091:
092:                if (ri.getSourceAccountingLines() != null
093:                        && ri.getSourceAccountingLines().size() > 0) {
094:                    List accounts = new ArrayList();
095:                    for (PurApAccountingLine account : ri
096:                            .getSourceAccountingLines()) {
097:                        PurchaseOrderAccount poAccount = new PurchaseOrderAccount(
098:                                account);
099:                        poAccount.setPurchaseOrderItem(this );
100:                        accounts.add(poAccount);
101:                    }
102:                    this .setSourceAccountingLines(accounts);
103:                }
104:                // By default, set the item active indicator to true.
105:                // In amendment, the user can set it to false when they click on
106:                // the inactivate button.
107:                this .setItemActiveIndicator(true);
108:            }
109:
110:            public boolean isItemActiveIndicator() {
111:                return itemActiveIndicator;
112:            }
113:
114:            public void setItemActiveIndicator(boolean itemActiveIndicator) {
115:                this .itemActiveIndicator = itemActiveIndicator;
116:            }
117:
118:            public KualiDecimal getItemInvoicedTotalAmount() {
119:                return itemInvoicedTotalAmount;
120:            }
121:
122:            public void setItemInvoicedTotalAmount(
123:                    KualiDecimal itemInvoicedTotalAmount) {
124:                this .itemInvoicedTotalAmount = itemInvoicedTotalAmount;
125:            }
126:
127:            public KualiDecimal getItemInvoicedTotalQuantity() {
128:                return itemInvoicedTotalQuantity;
129:            }
130:
131:            public void setItemInvoicedTotalQuantity(
132:                    KualiDecimal itemInvoicedTotalQuantity) {
133:                this .itemInvoicedTotalQuantity = itemInvoicedTotalQuantity;
134:            }
135:
136:            public KualiDecimal getItemOutstandingEncumberedQuantity() {
137:                return itemOutstandingEncumberedQuantity;
138:            }
139:
140:            public void setItemOutstandingEncumberedQuantity(
141:                    KualiDecimal itemOutstandingEncumberedQuantity) {
142:                this .itemOutstandingEncumberedQuantity = itemOutstandingEncumberedQuantity;
143:            }
144:
145:            public KualiDecimal getItemOutstandingEncumberedAmount() {
146:                return itemOutstandingEncumberedAmount;
147:            }
148:
149:            public void setItemOutstandingEncumberedAmount(
150:                    KualiDecimal itemOutstandingEncumbranceAmount) {
151:                this .itemOutstandingEncumberedAmount = itemOutstandingEncumbranceAmount;
152:            }
153:
154:            public KualiDecimal getItemReceivedTotalQuantity() {
155:                return itemReceivedTotalQuantity;
156:            }
157:
158:            public void setItemReceivedTotalQuantity(
159:                    KualiDecimal itemReceivedTotalQuantity) {
160:                this .itemReceivedTotalQuantity = itemReceivedTotalQuantity;
161:            }
162:
163:            public KualiDecimal getItemReturnedTotalQuantity() {
164:                return itemReturnedTotalQuantity;
165:            }
166:
167:            public void setItemReturnedTotalQuantity(
168:                    KualiDecimal itemReturnedTotalQuantity) {
169:                this .itemReturnedTotalQuantity = itemReturnedTotalQuantity;
170:            }
171:
172:            public PurchaseOrderDocument getPurchaseOrder() {
173:                if (ObjectUtils.isNull(purchaseOrder)) {
174:                    refreshReferenceObject(PurapPropertyConstants.PURCHASE_ORDER);
175:                }
176:                return purchaseOrder;
177:            }
178:
179:            public void setPurchaseOrder(PurchaseOrderDocument purchaseOrder) {
180:                this .purchaseOrder = purchaseOrder;
181:            }
182:
183:            public String getPurchaseOrderCommodityCd() {
184:                return purchaseOrderCommodityCd;
185:            }
186:
187:            public void setPurchaseOrderCommodityCd(
188:                    String purchaseOrderCommodityCd) {
189:                this .purchaseOrderCommodityCd = purchaseOrderCommodityCd;
190:            }
191:
192:            public String getDocumentNumber() {
193:                return documentNumber;
194:            }
195:
196:            public void setDocumentNumber(String documentNumber) {
197:                this .documentNumber = documentNumber;
198:            }
199:
200:            public boolean isItemSelectedForRetransmitIndicator() {
201:                return itemSelectedForRetransmitIndicator;
202:            }
203:
204:            public void setItemSelectedForRetransmitIndicator(
205:                    boolean itemSelectedForRetransmitIndicator) {
206:                this .itemSelectedForRetransmitIndicator = itemSelectedForRetransmitIndicator;
207:            }
208:
209:            /**
210:             * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
211:             */
212:            @Override
213:            protected LinkedHashMap toStringMapper() {
214:                LinkedHashMap m = new LinkedHashMap();
215:                m.put("documentNumber", this .documentNumber);
216:                if (this .getItemIdentifier() != null) {
217:                    m
218:                            .put("itemIdentifier", this .getItemIdentifier()
219:                                    .toString());
220:                }
221:                return m;
222:            }
223:
224:            /**
225:             * @see org.kuali.module.purap.bo.PurApItem#getAccountingLineClass()
226:             */
227:            public Class getAccountingLineClass() {
228:                return PurchaseOrderAccount.class;
229:            }
230:
231:            /**
232:             * 
233:             * This method returns the total item paid amount
234:             * @return
235:             */
236:            public KualiDecimal getItemPaidAmount() {
237:                if (!(this .isItemActiveIndicator())) {
238:                    return KualiDecimal.ZERO;
239:                }
240:                return this .getItemInvoicedTotalAmount();
241:            }
242:
243:            public KualiDecimal getItemEncumbranceRelievedAmount() {
244:                // check that it is active else return zero
245:                if (this  == null || !this .isItemActiveIndicator()) {
246:                    return KualiDecimal.ZERO;
247:                }
248:                // setup outstanding amount and get totalEncumberance from this.getExtendedCost()
249:                KualiDecimal outstandingAmount = KualiDecimal.ZERO;
250:                KualiDecimal totalEncumberance = this .getExtendedPrice();
251:
252:                ItemType iT = this .getItemType();
253:                // if service add the po outstanding amount to outstandingamount
254:                if (!iT.isQuantityBasedGeneralLedgerIndicator()) {
255:                    outstandingAmount = outstandingAmount.add(this 
256:                            .getItemOutstandingEncumberedAmount());
257:                } else {
258:                    // else add outstanding quantity * unitprice
259:                    BigDecimal qty = new BigDecimal(this 
260:                            .getOutstandingQuantity().toString());
261:                    outstandingAmount = outstandingAmount.add(new KualiDecimal(
262:                            this .getItemUnitPrice().multiply(qty)));
263:                }
264:
265:                // return the total encumberance subtracted by the outstandingamount from above
266:                return totalEncumberance.subtract(outstandingAmount);
267:            }
268:
269:            public KualiDecimal getOutstandingQuantity() {
270:                KualiDecimal outstandingQuantity = (this .getItemQuantity() != null) ? this 
271:                        .getItemQuantity()
272:                        : KualiDecimal.ZERO;
273:                KualiDecimal invoicedQuantity = (this 
274:                        .getItemInvoicedTotalQuantity() != null) ? this 
275:                        .getItemInvoicedTotalQuantity() : KualiDecimal.ZERO;
276:                return outstandingQuantity.subtract(invoicedQuantity);
277:            }
278:
279:            public boolean isCanInactivateItem() {
280:                if (versionNumber == null) {
281:                    // don't allow newly added item to be inactivatable.
282:                    return false;
283:                } else if (versionNumber != null
284:                        && itemActiveIndicator
285:                        && !getPurchaseOrder()
286:                                .getContainsUnpaidPaymentRequestsOrCreditMemos()) {
287:                    return true;
288:                }
289:                return false;
290:            }
291:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.