View Javadoc

1   /*
2    * Copyright 2011 The Kuali Foundation.
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.select.businessobject;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.kuali.ole.module.purap.PurapConstants;
20  import org.kuali.ole.module.purap.businessobject.*;
21  import org.kuali.ole.module.purap.document.PurchaseOrderDocument;
22  import org.kuali.ole.pojo.OleOrderRecord;
23  import org.kuali.ole.select.document.OlePurchaseOrderDocument;
24  import org.kuali.ole.select.lookup.DocData;
25  import org.kuali.ole.sys.context.SpringContext;
26  import org.kuali.rice.core.api.util.type.KualiDecimal;
27  import org.kuali.rice.core.api.util.type.KualiInteger;
28  import org.kuali.rice.kim.api.identity.Person;
29  import org.kuali.rice.kim.api.identity.PersonService;
30  import org.kuali.rice.krad.service.SequenceAccessorService;
31  import org.kuali.rice.krad.util.GlobalVariables;
32  import org.kuali.rice.krad.util.ObjectUtils;
33  
34  import java.math.BigDecimal;
35  import java.util.ArrayList;
36  import java.util.List;
37  
38  
39  public class OlePurchaseOrderItem extends PurchaseOrderItem implements OlePurchasingItem {
40  
41      protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OleRequisitionItem.class);
42      private boolean selected;
43      private BibInfoBean bibInfoBean;
44      protected String itemTitleId;
45      protected String itemTitle;
46      protected String itemAuthor;
47      protected String requestorId;
48      protected String requestorFirstName;
49      private DocData docData;
50      protected KualiInteger itemNoOfParts;
51      private String noOfItemParts;
52      protected String internalRequestorId;
53      protected Integer requestorTypeId;
54      protected KualiDecimal itemListPrice;
55      protected KualiDecimal itemDiscount;
56      protected String itemDiscountType;
57      protected String vendorItemPoNumber;
58      protected String itemCurrencyType;
59      protected KualiDecimal itemForeignListPrice;
60      protected KualiDecimal itemForeignDiscount;
61      protected String itemForeignDiscountType;
62      protected KualiDecimal itemForeignDiscountAmt;
63      protected KualiDecimal itemForeignUnitCost;
64      protected KualiDecimal itemExchangeRate;
65      protected KualiDecimal itemUnitCostUSD;
66      protected boolean latestExchangeRate;
67      protected Integer categoryId;
68      protected Integer formatTypeId;
69      protected Integer requestSourceTypeId;
70      protected Integer receiptStatusId;
71      private OleCategory category;
72      private OleFormatType formatTypeName;
73      private OleRequestSourceType oleRequestSourceType;
74      private OleReceiptStatus oleReceiptStatus;
75      protected Integer itemPriceSourceId;
76      private OleItemPriceSource itemPriceSource;
77      protected boolean itemRouteToRequestorIndicator;
78      protected boolean itemPublicViewIndicator;
79      private PurchaseOrderDocument purchaseOrder;
80      private OleOrderRecord oleOrderRecord;
81      private boolean poAdded = false;
82      protected String bibUUID;
83      private String noOfCopiesReceived;
84      private String noOfPartsReceived;
85      private KualiDecimal invoicePrice;
86  
87      private KualiInteger itemPoQty;
88  
89      protected KualiDecimal itemForiegnExtendedPrice;
90      private String itemLocation;
91      /**
92       * For List of copies
93       */
94      private Integer itemCopiesId;
95      private KualiInteger parts;
96      private KualiDecimal itemCopies;
97      private String partEnumeration;
98      private String locationCopies;
99      private KualiInteger startingCopyNumber;
100     private List<OleCopies> copies = new ArrayList<OleCopies>();
101     private List<OleRequisitionCopies> oleCopies = new ArrayList<OleRequisitionCopies>();
102 
103     //For Invoice
104     private String invoiceItemListPrice;
105 
106     /**
107      * For List Payment History
108      */
109     private String paymentHistory;
110     private List<OleRequisitionPaymentHistory> requisitionPaymentHistory = new ArrayList<OleRequisitionPaymentHistory>();
111     private String itemTypeDescription;
112 
113     /**
114      * For Quantity As Integer
115      */
116     private KualiInteger oleItemQuantity;
117     private String copiesOrdered;
118 
119 
120     private OLERequestorPatronDocument olePatronDocument;
121     protected String olePatronId;
122     private String firstName;
123     private String enumeration;
124     private String location;
125     private String copyNumber;
126     private String receiptStatus;
127     private String caption;
128     private String volumeNumber;
129     private List<OleCopy> copyList = new ArrayList<>();
130 
131     private String                               itemStatus;
132 
133     private String vendorName;
134     private OlePurchaseOrderDocument olePurchaseOrderDocument;
135 
136     public OlePurchaseOrderDocument getOlePurchaseOrderDocument() {
137         return olePurchaseOrderDocument;
138     }
139 
140     public void setOlePurchaseOrderDocument(OlePurchaseOrderDocument olePurchaseOrderDocument) {
141         this.olePurchaseOrderDocument = olePurchaseOrderDocument;
142     }
143 
144 
145     // For Invoice Document
146     private boolean itemForInvoice = true;
147     private String openQuantity;
148     private KualiDecimal poOutstandingQuantity;
149     private List<OleInvoiceNote> invoiceNotes = new ArrayList<OleInvoiceNote>();
150 
151 
152     //Invoice Changes
153     private BigDecimal itemSurcharge;
154 
155     public String getItemStatus() {
156         return itemStatus;
157     }
158 
159     public void setItemStatus(String itemStatus) {
160         this.itemStatus = itemStatus;
161     }
162 
163     public BigDecimal getItemSurcharge() {
164         return itemSurcharge;
165     }
166 
167     public void setItemSurcharge(BigDecimal itemSurcharge) {
168         this.itemSurcharge = itemSurcharge;
169     }
170 
171     public List<OleRequisitionCopies> getOleCopies() {
172         return oleCopies;
173     }
174 
175     public void setOleCopies(List<OleRequisitionCopies> oleCopies) {
176         this.oleCopies = oleCopies;
177     }
178 
179     public String getEnumeration() {
180         return enumeration;
181     }
182 
183     public void setEnumeration(String enumeration) {
184         this.enumeration = enumeration;
185     }
186 
187     public String getLocation() {
188         return location;
189     }
190 
191     public void setLocation(String location) {
192         this.location = location;
193     }
194 
195     public String getCopyNumber() {
196         return copyNumber;
197     }
198 
199     public void setCopyNumber(String copyNumber) {
200         this.copyNumber = copyNumber;
201     }
202 
203     public boolean isSelected() {
204         return selected;
205     }
206 
207     public void setSelected(boolean selected) {
208         this.selected = selected;
209     }
210 
211     public String getReceiptStatus() {
212         return receiptStatus;
213     }
214 
215     public void setReceiptStatus(String receiptStatus) {
216         this.receiptStatus = receiptStatus;
217     }
218 
219     public String getCaption() {
220         return caption;
221     }
222 
223     public void setCaption(String caption) {
224         this.caption = caption;
225     }
226 
227     public String getVolumeNumber() {
228         return volumeNumber;
229     }
230 
231     public void setVolumeNumber(String volumeNumber) {
232         this.volumeNumber = volumeNumber;
233     }
234 
235     public List<OleCopy> getCopyList() {
236         return copyList;
237     }
238 
239     public void setCopyList(List<OleCopy> copyList) {
240         this.copyList = copyList;
241     }
242 
243     /**
244      * Gets the value of the receiptStatusId property
245      *
246      * @return receiptStatusId
247      */
248     public Integer getReceiptStatusId() {
249         return receiptStatusId;
250     }
251 
252     /**
253      * Sets the receiptStatusId value
254      *
255      * @param receiptStatusId
256      */
257     public void setReceiptStatusId(Integer receiptStatusId) {
258         this.receiptStatusId = receiptStatusId;
259     }
260 
261     /**
262      * Gets the instance of OleReceiptStatus
263      *
264      * @return oleReceiptStatus
265      */
266     public OleReceiptStatus getOleReceiptStatus() {
267         return oleReceiptStatus;
268     }
269 
270     /**
271      * Sets the instance value for OleReceiptStatus
272      *
273      * @param oleReceiptStatus
274      */
275     public void setOleReceiptStatus(OleReceiptStatus oleReceiptStatus) {
276         this.oleReceiptStatus = oleReceiptStatus;
277     }
278 
279     /**
280      * Gets the poAdded attribute.
281      *
282      * @return Returns the poAdded.
283      */
284     public boolean isPoAdded() {
285         return poAdded;
286     }
287 
288     /**
289      * Sets the poAdded attribute value.
290      *
291      * @param poAdded The poAdded to set.
292      */
293     public void setPoAdded(boolean poAdded) {
294         this.poAdded = poAdded;
295     }
296 
297     /**
298      * This for List of Notes
299      */
300     private List<OleNotes> notes;
301     private Integer noteTypeId;
302     private String note;
303 
304     private KualiDecimal itemReceivedTotalParts; // Added for OLE-2058
305     private KualiDecimal itemDamagedTotalParts; // Adde for OLE-2058
306 
307     /**
308      * This method... for getting NoteType Id
309      *
310      * @return noteTypeId
311      */
312     public Integer getNoteTypeId() {
313         return noteTypeId;
314     }
315 
316     /**
317      * This method... for setting the NoteType Id
318      *
319      * @param noteTypeId
320      */
321     public void setNoteTypeId(Integer noteTypeId) {
322         this.noteTypeId = noteTypeId;
323     }
324 
325     /**
326      * This method... for getting the Note description
327      *
328      * @return note
329      */
330     public String getNote() {
331         return note;
332     }
333 
334     /**
335      * This method... for setting the Note description
336      *
337      * @param note
338      */
339     public void setNote(String note) {
340         this.note = note;
341     }
342 
343     /**
344      * This method... for setting List of notes
345      *
346      * @param notes
347      */
348     public void setNotes(List<OleNotes> notes) {
349         this.notes = notes;
350     }
351 
352     /**
353      * This method... for getting List of Notes
354      *
355      * @return notes
356      */
357     public List<OleNotes> getNotes() {
358         return notes;
359     }
360 
361     public OleOrderRecord getOleOrderRecord() {
362         return oleOrderRecord;
363     }
364 
365     public void setOleOrderRecord(OleOrderRecord oleOrderRecord) {
366         this.oleOrderRecord = oleOrderRecord;
367     }
368 
369     public OlePurchaseOrderItem() {
370         this.setItemNoOfParts(new KualiInteger(1));
371         this.setItemPublicViewIndicator(true);
372         this.setItemUnitOfMeasureCode(PurapConstants.PODocumentsStrings.CUSTOMER_INVOICE_DETAIL_UOM_DEFAULT);
373         this.setOleItemQuantity(new KualiInteger(1));
374         this.setItemListPrice(new KualiDecimal(0.00));
375         this.setNoOfCopiesReceived("");
376         this.getNewSourceLine().setAccountLinePercent(new BigDecimal(0));
377         this.setNoOfPartsReceived("");
378         if (GlobalVariables.getUserSession() != null) {
379             this.internalRequestorId = GlobalVariables.getUserSession().getPrincipalId();
380             this.setRequestorFirstName(getPersonName(GlobalVariables.getUserSession().getPrincipalId()));
381         }
382         /*    if(SpringContext.getBean(OleRequisitionService.class).getRequestor()!=null) {
383             String requestor=SpringContext.getBean(OleRequisitionService.class).getRequestor();
384             this.setRequestorFirstName(requestor);
385         }
386         OleRequisitionService oleRequestionService=new OleRequisitionServiceImpl();
387         if(oleRequestionService.getRequestor()!=null) {
388              String requestor=oleRequestionService.getRequestor();
389              this.setRequestorFirstName(requestor);
390          }*/
391         /**
392          * Initializing poNotes List
393          */
394         LOG.debug("Initializing OlePurchaseOrderNotes List");
395         notes = new ArrayList<OleNotes>();
396     }
397 
398 
399     @Override
400     public PurchaseOrderDocument getPurchaseOrder() {
401         // TODO Auto-generated method stub
402         return super.getPurchaseOrder();
403     }
404 
405 
406     @Override
407     public void setPurchaseOrder(PurchaseOrderDocument purchaseOrder) {
408         // TODO Auto-generated method stub
409         setPurapDocument(purchaseOrder);
410         super.setPurchaseOrder(purchaseOrder);
411     }
412 
413 
414     public OlePurchaseOrderItem(OleRequisitionItem ri, OlePurchaseOrderDocument po, RequisitionCapitalAssetItem reqCamsItem) {
415         this();
416         // po.setVendorPoNumber(ri.getVendorItemPoNumber());
417         this.setPurchaseOrder(po);
418         SequenceAccessorService sas = SpringContext.getBean(SequenceAccessorService.class);
419         Integer itemIdentifier = sas.getNextAvailableSequenceNumber("PO_ITM_ID", PurchaseOrderDocument.class).intValue();
420         this.setItemIdentifier(itemIdentifier);
421         this.setItemLineNumber(ri.getItemLineNumber());
422         this.setItemUnitOfMeasureCode(ri.getItemUnitOfMeasureCode());
423         this.setItemNoOfParts(ri.getItemNoOfParts());
424         this.setItemQuantity(ri.getItemQuantity());
425         this.setItemCatalogNumber(ri.getItemCatalogNumber());
426         this.setItemDescription(ri.getItemDescription());
427         this.setItemUnitPrice(ri.getItemUnitPrice());
428         this.setItemAuxiliaryPartIdentifier(ri.getItemAuxiliaryPartIdentifier());
429         this.setItemAssignedToTradeInIndicator(ri.getItemAssignedToTradeInIndicator());
430         this.setItemTaxAmount(ri.getItemTaxAmount());
431         this.setItemTitleId(ri.getItemTitleId());
432         this.setRequestorId(ri.getRequestorId());
433         this.setInternalRequestorId(ri.getInternalRequestorId());
434         this.setRequestorTypeId(ri.getRequestorTypeId());
435         this.setItemListPrice(ri.getItemListPrice());
436         this.setItemDiscount(ri.getItemDiscount());
437         this.setItemDiscountType(ri.getItemDiscountType());
438         this.setItemRouteToRequestorIndicator(ri.isItemRouteToRequestorIndicator());
439         this.setItemPublicViewIndicator(ri.isItemPublicViewIndicator());
440         this.setVendorItemPoNumber(ri.getVendorItemPoNumber());
441         // Foreign Currency Conversion
442         this.setItemCurrencyType(ri.getItemCurrencyType());
443         this.setItemForeignListPrice(ri.getItemForeignListPrice());
444         this.setItemForeignDiscount(ri.getItemForeignDiscount());
445         this.setItemForeignDiscountAmt(ri.getItemForeignDiscountAmt());
446         this.setItemForeignDiscountType(ri.getItemForeignDiscountType());
447         this.setItemForeignUnitCost(ri.getItemForeignUnitCost());
448         this.setItemExchangeRate(ri.getItemExchangeRate());
449         this.setItemUnitCostUSD(ri.getItemUnitCostUSD());
450         this.setCategory(ri.getCategory());
451         this.setCategoryId(ri.getCategoryId());
452         this.setFormatTypeName(ri.getFormatTypeName());
453         this.setFormatTypeId(ri.getFormatTypeId());
454         this.setOleRequestSourceType(ri.getOleRequestSourceType());
455         this.setRequestSourceTypeId(ri.getRequestSourceTypeId());
456         this.setReceiptStatusId(ri.getReceiptStatusId());
457         this.setItemPriceSource(ri.getItemPriceSource());
458         this.setItemPriceSourceId(ri.getItemPriceSourceId());
459         this.setItemLocation(ri.getItemLocation());
460         this.setItemStatus(ri.getItemStatus());
461 
462 
463         //copy use tax items over, and blank out keys (useTaxId and itemIdentifier)
464         for (PurApItemUseTax useTaxItem : ri.getUseTaxItems()) {
465             PurchaseOrderItemUseTax newItemUseTax = new PurchaseOrderItemUseTax(useTaxItem);
466             newItemUseTax.setItemIdentifier(itemIdentifier);
467             this.getUseTaxItems().add(newItemUseTax);
468 
469         }
470 
471         this.setExternalOrganizationB2bProductReferenceNumber(ri.getExternalOrganizationB2bProductReferenceNumber());
472         this.setExternalOrganizationB2bProductTypeName(ri.getExternalOrganizationB2bProductTypeName());
473 
474         this.setItemReceivedTotalQuantity(org.kuali.rice.core.api.util.type.KualiDecimal.ZERO);
475         this.setItemDamagedTotalQuantity(org.kuali.rice.core.api.util.type.KualiDecimal.ZERO);
476 
477         this.setItemTypeCode(ri.getItemTypeCode());
478 
479         if (ri.getSourceAccountingLines() != null && ri.getSourceAccountingLines().size() > 0 &&
480                 !StringUtils.equals(PurapConstants.ItemTypeCodes.ITEM_TYPE_ORDER_DISCOUNT_CODE, ri.getItemType().getItemTypeCode())) {
481             List accounts = new ArrayList();
482             for (PurApAccountingLine account : ri.getSourceAccountingLines()) {
483                 PurchaseOrderAccount poAccount = new PurchaseOrderAccount(account);
484                 poAccount.setPurchaseOrderItem(this);
485                 accounts.add(poAccount);
486             }
487             this.setSourceAccountingLines(accounts);
488         }
489         /**
490          * Setting the Notes of each item from OleRequisitionNotes to OlePurchaseOrderNotes List
491          */
492         if (ri.getNotes() != null && ri.getNotes().size() > 0 &&
493                 !StringUtils.equals(PurapConstants.ItemTypeCodes.ITEM_TYPE_ORDER_DISCOUNT_CODE, ri.getItemType().getItemTypeCode())) {
494             List notes = new ArrayList();
495             LOG.debug("Adding Notes from RequisitionItem to corresponding PurchaseOrderItem");
496             for (OleNotes note : ri.getNotes()) {
497                 OlePurchaseOrderNotes poNote = new OlePurchaseOrderNotes(note);
498                 poNote.setOlePurchaseOrderItem(this);
499                 poNote.setNoteType(note.getNoteType());
500                 notes.add(poNote);
501             }
502             this.setNotes(notes);
503         }
504         this.setCopyList(ri.getCopyList());
505         // By default, set the item active indicator to true.
506         // In amendment, the user can set it to false when they click on
507         // the inactivate button.
508         this.setItemActiveIndicator(true);
509 
510         this.setPurchasingCommodityCode(ri.getPurchasingCommodityCode());
511         this.setCommodityCode(getCommodityCode());
512 
513         // If the RequisitionItem has a CapitalAssetItem, create a new PurchasingCapitalAssetItem and add it to the PO.
514         if (ObjectUtils.isNotNull(reqCamsItem)) {
515             PurchaseOrderCapitalAssetItem newPOCapitalAssetItem = new PurchaseOrderCapitalAssetItem(reqCamsItem, itemIdentifier);
516             po.getPurchasingCapitalAssetItems().add(newPOCapitalAssetItem);
517         }
518     }
519 
520 
521     @Override
522     public Integer getRequestorTypeId() {
523         return requestorTypeId;
524     }
525 
526 
527     public void setRequestorTypeId(Integer requestorTypeId) {
528         this.requestorTypeId = requestorTypeId;
529     }
530 
531 
532     @Override
533     public String getInternalRequestorId() {
534         return internalRequestorId;
535     }
536 
537 
538     public void setInternalRequestorId(String internalRequestorId) {
539         this.internalRequestorId = internalRequestorId;
540     }
541 
542     @Override
543     public String getItemTitleId() {
544         return itemTitleId;
545     }
546 
547     public void setItemTitleId(String itemTitleId) {
548         this.itemTitleId = itemTitleId;
549     }
550 
551     public String getItemTitle() {
552         return itemTitle;
553     }
554 
555     public void setItemTitle(String itemTitle) {
556         this.itemTitle = itemTitle;
557     }
558 
559     public String getItemAuthor() {
560         return itemAuthor;
561     }
562 
563     public void setItemAuthor(String itemAuthor) {
564         this.itemAuthor = itemAuthor;
565     }
566 
567     @Override
568     public String getRequestorFirstName() {
569         return requestorFirstName;
570     }
571 
572     @Override
573     public void setRequestorFirstName(String requestorFirstName) {
574         this.requestorFirstName = requestorFirstName;
575     }
576 
577     @Override
578     public String getRequestorId() {
579         return requestorId;
580     }
581 
582 
583     public void setRequestorId(String requestorId) {
584         this.requestorId = requestorId;
585     }
586 
587     public BibInfoBean getBibInfoBean() {
588         return bibInfoBean;
589     }
590 
591 
592     @Override
593     public void setBibInfoBean(BibInfoBean bibInfoBean) {
594         this.bibInfoBean = bibInfoBean;
595     }
596 
597     public DocData getDocData() {
598         return docData;
599     }
600 
601     public void setDocData(DocData docData) {
602         this.docData = docData;
603     }
604 
605     public String getNoOfItemParts() {
606         if (this.itemNoOfParts != null) {
607             return String.valueOf(itemNoOfParts);
608         } else {
609             return String.valueOf(itemNoOfParts);
610         }
611     }
612 
613     public void setNoOfItemParts(String noOfItemParts) {
614         this.itemNoOfParts = new KualiInteger(noOfItemParts);
615     }
616 
617     public KualiInteger getItemNoOfParts() {
618         if (this.itemNoOfParts != null) {
619             return itemNoOfParts;
620         } else {
621             return itemNoOfParts;
622         }
623     }
624 
625 
626     public void setItemNoOfParts(KualiInteger itemNoOfParts) {
627         this.itemNoOfParts = itemNoOfParts;
628     }
629 
630     public KualiDecimal getItemListPrice() {
631         return itemListPrice;
632     }
633 
634 
635     public void setItemListPrice(KualiDecimal itemListPrice) {
636         this.itemListPrice = itemListPrice;
637     }
638 
639 
640     public KualiDecimal getItemDiscount() {
641         return itemDiscount;
642     }
643 
644 
645     public void setItemDiscount(KualiDecimal itemDiscount) {
646         this.itemDiscount = itemDiscount;
647     }
648 
649 
650     public String getItemDiscountType() {
651         return itemDiscountType;
652     }
653 
654 
655     public void setItemDiscountType(String itemDiscountType) {
656         this.itemDiscountType = itemDiscountType;
657     }
658 
659     public String getItemCurrencyType() {
660         return itemCurrencyType;
661     }
662 
663     public void setItemCurrencyType(String itemCurrencyType) {
664         this.itemCurrencyType = itemCurrencyType;
665     }
666 
667     public KualiDecimal getItemForeignListPrice() {
668         return itemForeignListPrice;
669     }
670 
671     public void setItemForeignListPrice(KualiDecimal itemForeignListPrice) {
672         this.itemForeignListPrice = itemForeignListPrice;
673     }
674 
675     public KualiDecimal getItemForeignDiscount() {
676         return itemForeignDiscount;
677     }
678 
679     public void setItemForeignDiscount(KualiDecimal itemForeignDiscount) {
680         this.itemForeignDiscount = itemForeignDiscount;
681     }
682 
683     public String getItemForeignDiscountType() {
684         return itemForeignDiscountType;
685     }
686 
687     public void setItemForeignDiscountType(String itemForeignDiscountType) {
688         this.itemForeignDiscountType = itemForeignDiscountType;
689     }
690 
691     public KualiDecimal getItemForeignDiscountAmt() {
692         return itemForeignDiscountAmt;
693     }
694 
695     public void setItemForeignDiscountAmt(KualiDecimal itemForeignDiscountAmt) {
696         this.itemForeignDiscountAmt = itemForeignDiscountAmt;
697     }
698 
699     public KualiDecimal getItemForeignUnitCost() {
700         return itemForeignUnitCost;
701     }
702 
703     public void setItemForeignUnitCost(KualiDecimal itemForeignUnitCost) {
704         this.itemForeignUnitCost = itemForeignUnitCost;
705     }
706 
707     public KualiDecimal getItemExchangeRate() {
708         return itemExchangeRate;
709     }
710 
711     public void setItemExchangeRate(KualiDecimal itemExchangeRate) {
712         this.itemExchangeRate = itemExchangeRate;
713     }
714 
715     public KualiDecimal getItemUnitCostUSD() {
716         return itemUnitCostUSD;
717     }
718 
719     public void setItemUnitCostUSD(KualiDecimal itemUnitCostUSD) {
720         this.itemUnitCostUSD = itemUnitCostUSD;
721     }
722 
723 
724     public Integer getCategoryId() {
725         return categoryId;
726     }
727 
728 
729     public void setCategoryId(Integer categoryId) {
730         this.categoryId = categoryId;
731     }
732 
733 
734     public Integer getFormatTypeId() {
735         return formatTypeId;
736     }
737 
738 
739     public void setFormatTypeId(Integer formatTypeId) {
740         this.formatTypeId = formatTypeId;
741     }
742 
743     public Integer getRequestSourceTypeId() {
744         return requestSourceTypeId;
745     }
746 
747 
748     public void setRequestSourceTypeId(Integer requestSourceTypeId) {
749         this.requestSourceTypeId = requestSourceTypeId;
750     }
751 
752     public OleCategory getCategory() {
753         return category;
754     }
755 
756 
757     public void setCategory(OleCategory category) {
758         this.category = category;
759     }
760 
761 
762     public OleFormatType getFormatTypeName() {
763         return formatTypeName;
764     }
765 
766 
767     public void setFormatTypeName(OleFormatType formatTypeName) {
768         this.formatTypeName = formatTypeName;
769     }
770 
771 
772     public OleRequestSourceType getOleRequestSourceType() {
773         return oleRequestSourceType;
774     }
775 
776 
777     public void setOleRequestSourceType(OleRequestSourceType oleRequestSourceType) {
778         this.oleRequestSourceType = oleRequestSourceType;
779     }
780 
781 
782     public Integer getItemPriceSourceId() {
783         return itemPriceSourceId;
784     }
785 
786 
787     public void setItemPriceSourceId(Integer itemPriceSourceId) {
788         this.itemPriceSourceId = itemPriceSourceId;
789     }
790 
791 
792     public OleItemPriceSource getItemPriceSource() {
793         return itemPriceSource;
794     }
795 
796 
797     public void setItemPriceSource(OleItemPriceSource itemPriceSource) {
798         this.itemPriceSource = itemPriceSource;
799     }
800 
801 
802     // Added for OLE-2058 Starts
803 
804     /**
805      * Gets the total parts received in a purchase order item.
806      *
807      * @return itemReceivedTotalParts.
808      */
809     public KualiDecimal getItemReceivedTotalParts() {
810         return itemReceivedTotalParts;
811     }
812 
813     /**
814      * Sets the total parts received in a purchase order item.
815      *
816      * @param itemReceivedTotalParts to set.
817      */
818     public void setItemReceivedTotalParts(KualiDecimal itemReceivedTotalParts) {
819         this.itemReceivedTotalParts = itemReceivedTotalParts;
820     }
821 
822     /**
823      * Gets the total parts damaged in a purchase order item.
824      *
825      * @return itemDamagedTotalParts.
826      */
827     public KualiDecimal getItemDamagedTotalParts() {
828         return itemDamagedTotalParts;
829     }
830 
831     /**
832      * Sets the total parts damaged in a purchase order item.
833      *
834      * @param itemDamagedTotalParts to set.
835      */
836     public void setItemDamagedTotalParts(KualiDecimal itemDamagedTotalParts) {
837         this.itemDamagedTotalParts = itemDamagedTotalParts;
838     }
839     // Added for OLE-2058 Ends
840 
841     public boolean isItemRouteToRequestorIndicator() {
842         return itemRouteToRequestorIndicator;
843     }
844 
845     public void setItemRouteToRequestorIndicator(boolean itemRouteToRequestorIndicator) {
846         this.itemRouteToRequestorIndicator = itemRouteToRequestorIndicator;
847     }
848 
849     public boolean isItemPublicViewIndicator() {
850         return itemPublicViewIndicator;
851     }
852 
853     public void setItemPublicViewIndicator(boolean itemPublicViewIndicator) {
854         this.itemPublicViewIndicator = itemPublicViewIndicator;
855     }
856 
857     public boolean isLatestExchangeRate() {
858         return latestExchangeRate;
859     }
860 
861     public void setLatestExchangeRate(boolean latestExchangeRate) {
862         this.latestExchangeRate = latestExchangeRate;
863     }
864 
865 
866     /**
867      * @see org.kuali.ole.module.purap.businessobject.PurchasingItemBase#getAccountingLineClass()
868      */
869     @Override
870     public Class getAccountingLineClass() {
871         return OlePurchaseOrderAccount.class;
872     }
873 
874 
875     public String getBibUUID() {
876         return bibUUID;
877     }
878 
879     public void setBibUUID(String bibUUID) {
880         this.bibUUID = bibUUID;
881     }
882 
883     public String getVendorItemPoNumber() {
884         return vendorItemPoNumber;
885     }
886 
887     public void setVendorItemPoNumber(String vendorItemPoNumber) {
888         this.vendorItemPoNumber = vendorItemPoNumber;
889     }
890 
891     @Override
892     public void refresh() {
893         // TODO Auto-generated method stub
894 
895     }
896 
897     public String getPersonName(String principalId) {
898         Person person = SpringContext.getBean(PersonService.class).getPerson(principalId);
899         if (person != null) {
900             return person.getName();
901         } else {
902             return null;
903         }
904     }
905 
906     /**
907      * Gets the no Of CopiesReceived in a purchase order item.
908      *
909      * @return noOfCopiesReceived.
910      */
911     public String getNoOfCopiesReceived() {
912         return noOfCopiesReceived;
913     }
914 
915     /**
916      * Sets the no Of CopiesReceived in a purchase order item.
917      *
918      * @param noOfCopiesReceived to set.
919      */
920     public void setNoOfCopiesReceived(String noOfCopiesReceived) {
921         this.noOfCopiesReceived = noOfCopiesReceived;
922     }
923 
924     /**
925      * Gets the no Of Parts Received in a purchase order item.
926      *
927      * @return noOfPartsReceived.
928      */
929     public String getNoOfPartsReceived() {
930         return noOfPartsReceived;
931     }
932 
933     /**
934      * Sets the no Of Parts Received in a purchase order item.
935      *
936      * @param noOfPartsReceived to set.
937      */
938     public void setNoOfPartsReceived(String noOfPartsReceived) {
939         this.noOfPartsReceived = noOfPartsReceived;
940     }
941 
942     public KualiDecimal getInvoicePrice() {
943         return invoicePrice;
944     }
945 
946     public void setInvoicePrice(KualiDecimal invoicePrice) {
947         this.invoicePrice = invoicePrice;
948     }
949 
950     public KualiInteger getItemPoQty() {
951         if (itemPoQty == null || itemPoQty.equals(KualiInteger.ZERO)) {
952             itemPoQty = new KualiInteger(this.getItemQuantity().bigDecimalValue());
953         }
954         return itemPoQty;
955     }
956 
957     public void setItemPoQty(KualiInteger itemPoQty) {
958         this.itemPoQty = itemPoQty;
959     }
960 
961     /**
962      * Gets the itemForiegnExtendedPrice attribute.
963      *
964      * @return Returns the itemForiegnExtendedPrice.
965      */
966     public KualiDecimal getItemForiegnExtendedPrice() {
967         return itemForiegnExtendedPrice;
968     }
969 
970     /**
971      * Sets the itemForiegnExtendedPrice attribute value.
972      *
973      * @param itemForiegnExtendedPrice The itemForiegnExtendedPrice to set.
974      */
975     public void setItemForiegnExtendedPrice(KualiDecimal itemForiegnExtendedPrice) {
976         this.itemForiegnExtendedPrice = itemForiegnExtendedPrice;
977     }
978 
979     /**
980      * Gets the itemLocation attribute.
981      *
982      * @return Returns the itemLocation.
983      */
984     public String getItemLocation() {
985         return itemLocation;
986     }
987 
988     /**
989      * Sets the itemLocation attribute value.
990      *
991      * @param itemLocation The itemLocation to set.
992      */
993     public void setItemLocation(String itemLocation) {
994         this.itemLocation = itemLocation;
995     }
996 
997     /**
998      * Gets the itemCopiesId attribute.
999      *
1000      * @return Returns the itemCopiesId.
1001      */
1002     public Integer getItemCopiesId() {
1003         return itemCopiesId;
1004     }
1005 
1006     /**
1007      * Sets the itemCopiesId attribute value.
1008      *
1009      * @param itemCopiesId The itemCopiesId to set.
1010      */
1011     public void setItemCopiesId(Integer itemCopiesId) {
1012         this.itemCopiesId = itemCopiesId;
1013     }
1014 
1015     /**
1016      * Gets the parts attribute.
1017      *
1018      * @return Returns the parts.
1019      */
1020     public KualiInteger getParts() {
1021         return parts;
1022     }
1023 
1024     /**
1025      * Sets the parts attribute value.
1026      *
1027      * @param parts The parts to set.
1028      */
1029     public void setParts(KualiInteger parts) {
1030         this.parts = parts;
1031     }
1032 
1033     /**
1034      * Gets the itemCopies attribute.
1035      *
1036      * @return Returns the itemCopies.
1037      */
1038     public KualiDecimal getItemCopies() {
1039         return itemCopies;
1040     }
1041 
1042     /**
1043      * Sets the itemCopies attribute value.
1044      *
1045      * @param itemCopies The itemCopies to set.
1046      */
1047     public void setItemCopies(KualiDecimal itemCopies) {
1048         this.itemCopies = itemCopies;
1049     }
1050 
1051     /**
1052      * Gets the partEnumeration attribute.
1053      *
1054      * @return Returns the partEnumeration.
1055      */
1056     public String getPartEnumeration() {
1057         return partEnumeration;
1058     }
1059 
1060     /**
1061      * Sets the partEnumeration attribute value.
1062      *
1063      * @param partEnumeration The partEnumeration to set.
1064      */
1065     public void setPartEnumeration(String partEnumeration) {
1066         this.partEnumeration = partEnumeration;
1067     }
1068 
1069     /**
1070      * Gets the locationCopies attribute.
1071      *
1072      * @return Returns the locationCopies.
1073      */
1074     public String getLocationCopies() {
1075         return locationCopies;
1076     }
1077 
1078     /**
1079      * Sets the locationCopies attribute value.
1080      *
1081      * @param locationCopies The locationCopies to set.
1082      */
1083     public void setLocationCopies(String locationCopies) {
1084         this.locationCopies = locationCopies;
1085     }
1086 
1087     /**
1088      * Gets the startingCopyNumber attribute.
1089      *
1090      * @return Returns the startingCopyNumber.
1091      */
1092     public KualiInteger getStartingCopyNumber() {
1093         return startingCopyNumber;
1094     }
1095 
1096     /**
1097      * Sets the startingCopyNumber attribute value.
1098      *
1099      * @param startingCopyNumber The startingCopyNumber to set.
1100      */
1101     public void setStartingCopyNumber(KualiInteger startingCopyNumber) {
1102         this.startingCopyNumber = startingCopyNumber;
1103     }
1104 
1105     /**
1106      * Gets the copies attribute.
1107      *
1108      * @return Returns the copies.
1109      */
1110     public List<OleCopies> getCopies() {
1111         return copies;
1112     }
1113 
1114     /**
1115      * Sets the copies attribute value.
1116      *
1117      * @param copies The copies to set.
1118      */
1119     public void setCopies(List<OleCopies> copies) {
1120         this.copies = copies;
1121     }
1122 
1123     /**
1124      * Gets the paymentHistory attribute.
1125      *
1126      * @return Returns the paymentHistory.
1127      */
1128     public String getPaymentHistory() {
1129         return paymentHistory;
1130     }
1131 
1132     /**
1133      * Sets the paymentHistory attribute value.
1134      *
1135      * @param paymentHistory The paymentHistory to set.
1136      */
1137     public void setPaymentHistory(String paymentHistory) {
1138         this.paymentHistory = paymentHistory;
1139     }
1140 
1141     /**
1142      * Gets the requisitionPaymentHistory attribute.
1143      *
1144      * @return Returns the requisitionPaymentHistory.
1145      */
1146     public List<OleRequisitionPaymentHistory> getRequisitionPaymentHistory() {
1147         return requisitionPaymentHistory;
1148     }
1149 
1150     /**
1151      * Sets the requisitionPaymentHistory attribute value.
1152      *
1153      * @param requisitionPaymentHistory The requisitionPaymentHistory to set.
1154      */
1155     public void setRequisitionPaymentHistory(List<OleRequisitionPaymentHistory> requisitionPaymentHistory) {
1156         this.requisitionPaymentHistory = requisitionPaymentHistory;
1157     }
1158 
1159     /**
1160      * Gets the itemTypeDescription attribute.
1161      *
1162      * @return Returns the itemTypeDescription.
1163      */
1164     public String getItemTypeDescription() {
1165         return itemTypeDescription;
1166     }
1167 
1168     /**
1169      * Sets the itemTypeDescription attribute value.
1170      *
1171      * @param itemTypeDescription The itemTypeDescription to set.
1172      */
1173     public void setItemTypeDescription(String itemTypeDescription) {
1174         this.itemTypeDescription = itemTypeDescription;
1175     }
1176 
1177     public String getCopiesOrdered() {
1178         return String.valueOf(super.getItemQuantity().intValue());
1179     }
1180 
1181     public void setCopiesOrdered(String copiesOrdered) {
1182         super.setItemQuantity(new KualiDecimal(copiesOrdered));
1183     }
1184 
1185     /**
1186      * Gets the oleItemQuantity attribute.
1187      *
1188      * @return Returns the oleItemQuantity.
1189      */
1190     public KualiInteger getOleItemQuantity() {
1191         return new KualiInteger(super.getItemQuantity().intValue());
1192     }
1193 
1194     /**
1195      * Sets the oleItemQuantity attribute value.
1196      *
1197      * @param oleItemQuantity The oleItemQuantity to set.
1198      */
1199     public void setOleItemQuantity(KualiInteger oleItemQuantity) {
1200         super.setItemQuantity(new KualiDecimal(oleItemQuantity.intValue()));
1201     }
1202 
1203     /**
1204      * Gets the olePatronDocument attribute.
1205      *
1206      * @return Returns the olePatronDocument.
1207      */
1208     public OLERequestorPatronDocument getOlePatronDocument() {
1209         return olePatronDocument;
1210     }
1211 
1212     /**
1213      * Sets the olePatronDocument attribute value.
1214      *
1215      * @param olePatronDocument The olePatronDocument to set.
1216      */
1217     public void setOlePatronDocument(OLERequestorPatronDocument olePatronDocument) {
1218         this.olePatronDocument = olePatronDocument;
1219     }
1220 
1221     /**
1222      * Gets the olePatronId attribute.
1223      *
1224      * @return Returns the olePatronId.
1225      */
1226     public String getOlePatronId() {
1227         return olePatronId;
1228     }
1229 
1230     /**
1231      * Sets the olePatronId attribute value.
1232      *
1233      * @param olePatronId The olePatronId to set.
1234      */
1235     public void setOlePatronId(String olePatronId) {
1236         this.olePatronId = olePatronId;
1237     }
1238 
1239     /**
1240      * Sets the firstName attribute value.
1241      *
1242      * @param firstName The firstName to set.
1243      */
1244     public void setFirstName(String firstName) {
1245         this.firstName = firstName;
1246     }
1247 
1248     /**
1249      * Gets the firstName attribute.
1250      *
1251      * @return Returns the firstName.
1252      */
1253     public String getFirstName() {
1254         return firstName;
1255     }
1256 
1257 
1258     //Invoice Document
1259     private String copiesInvoicedNumber;
1260     private KualiInteger noOfCopiesInvoiced;
1261     private String partsInvoicedNumber;
1262     private KualiInteger noOfPartsInvoiced;
1263 
1264     public String getPartsInvoicedNumber() {
1265         return String.valueOf(noOfPartsInvoiced);
1266     }
1267 
1268     public void setPartsInvoicedNumber(String partsInvoicedNumber) {
1269         this.noOfPartsInvoiced = new KualiInteger(partsInvoicedNumber);
1270     }
1271 
1272     public String getCopiesInvoicedNumber() {
1273         return String.valueOf(noOfCopiesInvoiced);
1274     }
1275 
1276     public void setCopiesInvoicedNumber(String copiesInvoicedNumber) {
1277        // this.copiesInvoicedNumber = copiesInvoicedNumber;
1278         this.noOfCopiesInvoiced = new KualiInteger(copiesInvoicedNumber);
1279     }
1280 
1281     public KualiInteger getNoOfCopiesInvoiced() {
1282         return noOfCopiesInvoiced;
1283     }
1284 
1285     public void setNoOfCopiesInvoiced(KualiInteger noOfCopiesInvoiced) {
1286         this.noOfCopiesInvoiced = noOfCopiesInvoiced;
1287     }
1288 
1289     public KualiInteger getNoOfPartsInvoiced() {
1290         return noOfPartsInvoiced;
1291     }
1292 
1293     public void setNoOfPartsInvoiced(KualiInteger noOfPartsInvoiced) {
1294         this.noOfPartsInvoiced = noOfPartsInvoiced;
1295     }
1296 
1297     public boolean isItemForInvoice() {
1298         return itemForInvoice;
1299     }
1300 
1301     public void setItemForInvoice(boolean itemForInvoice) {
1302         this.itemForInvoice = itemForInvoice;
1303     }
1304 
1305     public List<OleInvoiceNote> getInvoiceNotes() {
1306         return invoiceNotes;
1307     }
1308 
1309     public void setInvoiceNotes(List<OleInvoiceNote> invoiceNotes) {
1310         this.invoiceNotes = invoiceNotes;
1311     }
1312 
1313     public String getOpenQuantity() {
1314         return String.valueOf(poOutstandingQuantity);
1315     }
1316 
1317     public void setOpenQuantity(String openQuantity) {
1318         this.poOutstandingQuantity = new KualiDecimal(openQuantity);
1319     }
1320 
1321     public KualiDecimal getPoOutstandingQuantity() {
1322         return poOutstandingQuantity;
1323     }
1324 
1325     public void setPoOutstandingQuantity(KualiDecimal poOutstandingQuantity) {
1326         this.poOutstandingQuantity = poOutstandingQuantity;
1327     }
1328 
1329     public String getInvoiceItemListPrice() {
1330         return invoiceItemListPrice;
1331     }
1332 
1333     public void setInvoiceItemListPrice(String invoiceItemListPrice) {
1334         this.invoiceItemListPrice = invoiceItemListPrice;
1335     }
1336 }