1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.select.businessobject;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.ole.DocumentUniqueIDPrefix;
20 import org.kuali.ole.module.purap.PurapConstants;
21 import org.kuali.ole.module.purap.PurapPropertyConstants;
22 import org.kuali.ole.module.purap.businessobject.PaymentRequestItem;
23 import org.kuali.ole.module.purap.businessobject.PurchaseOrderItem;
24 import org.kuali.ole.module.purap.document.PaymentRequestDocument;
25 import org.kuali.ole.module.purap.document.PurchaseOrderDocument;
26 import org.kuali.ole.module.purap.document.service.PaymentRequestService;
27 import org.kuali.ole.module.purap.document.service.PurapService;
28 import org.kuali.ole.module.purap.util.ExpiredOrClosedAccountEntry;
29 import org.kuali.ole.pojo.OleOrderRecord;
30 import org.kuali.ole.select.OleSelectConstant;
31 import org.kuali.ole.select.bo.OLELinkPurapDonor;
32 import org.kuali.ole.select.document.OlePaymentRequestDocument;
33 import org.kuali.ole.select.document.service.OlePaymentRequestService;
34 import org.kuali.ole.select.lookup.DocData;
35 import org.kuali.ole.sys.businessobject.SourceAccountingLine;
36 import org.kuali.ole.sys.businessobject.UnitOfMeasure;
37 import org.kuali.ole.sys.context.SpringContext;
38 import org.kuali.rice.core.api.util.type.KualiDecimal;
39 import org.kuali.rice.core.api.util.type.KualiInteger;
40 import org.kuali.rice.krad.service.BusinessObjectService;
41 import org.kuali.rice.krad.util.ObjectUtils;
42
43 import java.math.BigDecimal;
44 import java.util.ArrayList;
45 import java.util.HashMap;
46 import java.util.List;
47 import java.util.Map;
48
49 public class OlePaymentRequestItem extends PaymentRequestItem {
50
51 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OlePaymentRequestItem.class);
52
53 protected String itemCurrencyType;
54 protected KualiDecimal itemForeignListPrice;
55 protected KualiDecimal itemForeignDiscount;
56 protected String itemForeignDiscountType;
57 protected KualiDecimal itemForeignDiscountAmt;
58 protected KualiDecimal itemForeignUnitCost;
59 protected KualiDecimal itemExchangeRate;
60 protected KualiDecimal itemUnitCostUSD;
61 protected KualiDecimal foreignCurrencyExtendedPrice;
62 protected String localTitleId;
63 protected Integer formatTypeId;
64 protected KualiInteger itemNoOfParts;
65 protected KualiDecimal itemListPrice;
66 protected KualiDecimal itemDiscount;
67 protected String itemDiscountType;
68 protected BigDecimal itemSurcharge;
69 protected String note;
70 protected List<OlePaymentRequestNote> notes;
71 protected Integer poItemIdentifier;
72
73 private UnitOfMeasure itemUnitOfMeasure;
74 private String donorCode;
75 private List<OLELinkPurapDonor> oleDonors=new ArrayList<>();
76
77 private BibInfoBean bibInfoBean;
78 protected String itemTitleId;
79 protected String bibUUID;
80 private DocData docData;
81 private PaymentRequestDocument paymentRequestDocument;
82 private OleOrderRecord oleOrderRecord;
83 protected Integer receiptStatusId;
84 private OleReceiptStatus oleReceiptStatus;
85
86 private List<OLEPaidCopy> paidCopies = new ArrayList<>();
87 private String docFormat;
88 public String getDocFormat() {
89 return docFormat;
90 }
91
92 public void setDocFormat(String docFormat) {
93 this.docFormat = docFormat;
94 }
95
96
97
98 private KualiInteger oleItemQuantity;
99 private KualiInteger olePoOutstandingQuantity;
100 private List<SourceAccountingLine> sourceAccountingLineList = new ArrayList<SourceAccountingLine>();
101
102 private String purchaseOrderItemID;
103
104
105
106
107
108
109 public Integer getReceiptStatusId() {
110 return receiptStatusId;
111 }
112
113
114
115
116
117
118 public void setReceiptStatusId(Integer receiptStatusId) {
119 this.receiptStatusId = receiptStatusId;
120 }
121
122
123
124
125
126
127 public OleReceiptStatus getOleReceiptStatus() {
128 return oleReceiptStatus;
129 }
130
131
132
133
134
135
136 public void setOleReceiptStatus(OleReceiptStatus oleReceiptStatus) {
137 this.oleReceiptStatus = oleReceiptStatus;
138 }
139
140 public OleOrderRecord getOleOrderRecord() {
141 return oleOrderRecord;
142 }
143
144 public void setOleOrderRecord(OleOrderRecord oleOrderRecord) {
145 this.oleOrderRecord = oleOrderRecord;
146 }
147
148
149 public String getDonorCode() {
150 return donorCode;
151 }
152
153 public void setDonorCode(String donorCode) {
154 this.donorCode = donorCode;
155 }
156
157 public List<OLELinkPurapDonor> getOleDonors() {
158 return oleDonors;
159 }
160
161 public void setOleDonors(List<OLELinkPurapDonor> oleDonors) {
162 this.oleDonors = oleDonors;
163 }
164
165 public String getLocalTitleId() {
166 return localTitleId;
167 }
168
169 public void setLocalTitleId(String localTitleId) {
170 this.localTitleId = localTitleId;
171 }
172
173
174 protected boolean additionalChargeUsd;
175
176
177
178
179 public OlePaymentRequestItem() {
180 this.setItemNoOfParts(new KualiInteger(1));
181 this.setItemUnitOfMeasureCode(PurapConstants.PaymentRequestDocumentStrings.CUSTOMER_INVOICE_DETAIL_UOM_DEFAULT);
182 this.setOleItemQuantity(new KualiInteger(1));
183 if (this.getItemListPrice() == null) {
184 this.setItemListPrice(new KualiDecimal(0.00));
185 }
186 notes = new ArrayList<OlePaymentRequestNote>();
187
188 this.setItemCurrencyType(OleSelectConstant.USD);
189 }
190
191
192
193
194
195
196
197
198 public OlePaymentRequestItem(PurchaseOrderItem poi, PaymentRequestDocument preq, HashMap<String, ExpiredOrClosedAccountEntry> expiredOrClosedAccountList) {
199 super(poi, preq, expiredOrClosedAccountList);
200 this.setPaymentRequestDocument(preq);
201 LOG.debug("Inside OlePaymentRequestItem Constructor");
202 LOG.debug("Setting the Format,Discount and Price Details");
203 notes = new ArrayList<OlePaymentRequestNote>();
204 OlePurchaseOrderItem olePoi = (OlePurchaseOrderItem) poi;
205 olePoi.getItemTypeCode();
206 this.setItemForeignListPrice(olePoi.getItemForeignListPrice());
207 this.setItemForeignDiscount(olePoi.getItemForeignDiscount());
208 this.setItemForeignDiscountType(olePoi.getItemForeignDiscountType());
209 this.setItemForeignDiscountAmt(olePoi.getItemForeignDiscountAmt());
210 this.setItemForeignUnitCost(olePoi.getItemForeignUnitCost());
211 this.setItemExchangeRate(olePoi.getItemExchangeRate());
212 this.setItemUnitCostUSD(olePoi.getItemUnitCostUSD());
213 this.setFormatTypeId(olePoi.getFormatTypeId());
214 this.setItemNoOfParts(olePoi.getItemNoOfParts());
215 this.setItemListPrice(olePoi.getItemListPrice());
216 this.setItemDiscount(olePoi.getItemDiscount());
217 this.setItemDiscountType(olePoi.getItemDiscountType());
218 this.setItemCatalogNumber(olePoi.getItemCatalogNumber());
219 this.setPoItemIdentifier(olePoi.getItemIdentifier());
220 this.setExtendedPrice(olePoi.getExtendedPrice());
221 this.setBibInfoBean(olePoi.getBibInfoBean());
222 this.setItemTitleId(olePoi.getItemTitleId());
223 this.setOleDonors(olePoi.getOleDonors());
224 if(olePoi.getItemTitleId()!=null){
225 this.setDocFormat(DocumentUniqueIDPrefix.getBibFormatType(olePoi.getItemTitleId()));
226 }
227 this.setItemQuantity(olePoi.getItemQuantity());
228
229 this.setItemCurrencyType(OleSelectConstant.USD);
230 this.setReceiptStatusId(olePoi.getReceiptStatusId());
231 }
232
233
234
235
236
237
238
239 public OlePaymentRequestItem(PurchaseOrderItem poi, PaymentRequestDocument preq) {
240 super(poi, preq);
241 this.setPaymentRequestDocument(preq);
242 LOG.debug("Inside OlePaymentRequestItem Constructor");
243 LOG.debug("Setting the Format,Discount and Price Details");
244 notes = new ArrayList<OlePaymentRequestNote>();
245 OlePurchaseOrderItem olePoi = (OlePurchaseOrderItem) poi;
246 this.setItemForeignListPrice(olePoi.getItemForeignListPrice());
247 this.setItemForeignDiscount(olePoi.getItemForeignDiscount());
248 this.setItemForeignDiscountType(olePoi.getItemForeignDiscountType());
249 this.setItemForeignDiscountAmt(olePoi.getItemForeignDiscountAmt());
250 this.setItemForeignUnitCost(olePoi.getItemForeignUnitCost());
251 this.setItemExchangeRate(olePoi.getItemExchangeRate());
252 this.setItemUnitCostUSD(olePoi.getItemUnitCostUSD());
253 this.setFormatTypeId(olePoi.getFormatTypeId());
254 this.setItemNoOfParts(olePoi.getItemNoOfParts());
255 this.setItemListPrice(olePoi.getItemListPrice());
256 this.setItemDiscount(olePoi.getItemDiscount());
257 this.setOleDonors(olePoi.getOleDonors());
258 this.setItemDiscountType(olePoi.getItemDiscountType());
259 this.setItemCatalogNumber(olePoi.getItemCatalogNumber());
260 this.setPoItemIdentifier(olePoi.getItemIdentifier());
261
262 this.setItemCurrencyType(OleSelectConstant.USD);
263 }
264
265 @Override
266 public boolean isConsideredEnteredWithZero() {
267 return isConsideredEntered(true);
268 }
269
270 @Override
271 public boolean isConsideredEnteredWithoutZero() {
272 return isConsideredEntered(false);
273 }
274
275 private boolean isConsideredEntered(boolean allowsZero) {
276 if (getItemType().isLineItemIndicator()) {
277 if ((getItemType().isQuantityBasedGeneralLedgerIndicator())) {
278 if ((ObjectUtils.isNull(getItemQuantity()) || getItemQuantity().isZero()) && (ObjectUtils.isNull(getExtendedPrice()) || (allowsZero && getExtendedPrice().isZero()))) {
279 return false;
280 }
281 } else {
282 if (ObjectUtils.isNull(getExtendedPrice()) || (allowsZero && getExtendedPrice().isZero())) {
283 return false;
284 }
285 }
286 } else {
287 if ((ObjectUtils.isNull(getItemUnitPrice()) || (allowsZero && this.getItemUnitPrice().compareTo(new BigDecimal(0)) == 0)) && (StringUtils.isBlank(getItemDescription()))) {
288 return false;
289 }
290 }
291
292 return true;
293 }
294
295 public String getItemCurrencyType() {
296 return itemCurrencyType;
297 }
298
299 public void setItemCurrencyType(String itemCurrencyType) {
300 this.itemCurrencyType = itemCurrencyType;
301 }
302
303 public KualiDecimal getItemForeignListPrice() {
304 return itemForeignListPrice;
305 }
306
307 public void setItemForeignListPrice(KualiDecimal itemForeignListPrice) {
308 this.itemForeignListPrice = itemForeignListPrice;
309 }
310
311 public KualiDecimal getItemForeignDiscount() {
312 return itemForeignDiscount;
313 }
314
315 public void setItemForeignDiscount(KualiDecimal itemForeignDiscount) {
316 this.itemForeignDiscount = itemForeignDiscount;
317 }
318
319 public String getItemForeignDiscountType() {
320 return itemForeignDiscountType;
321 }
322
323 public void setItemForeignDiscountType(String itemForeignDiscountType) {
324 this.itemForeignDiscountType = itemForeignDiscountType;
325 }
326
327 public KualiDecimal getItemForeignDiscountAmt() {
328 return itemForeignDiscountAmt;
329 }
330
331 public void setItemForeignDiscountAmt(KualiDecimal itemForeignDiscountAmt) {
332 this.itemForeignDiscountAmt = itemForeignDiscountAmt;
333 }
334
335 public KualiDecimal getItemForeignUnitCost() {
336 return itemForeignUnitCost;
337 }
338
339 public void setItemForeignUnitCost(KualiDecimal itemForeignUnitCost) {
340 this.itemForeignUnitCost = itemForeignUnitCost;
341 }
342
343 public KualiDecimal getItemExchangeRate() {
344 return itemExchangeRate;
345 }
346
347 public void setItemExchangeRate(KualiDecimal itemExchangeRate) {
348 this.itemExchangeRate = itemExchangeRate;
349 }
350
351 public KualiDecimal getItemUnitCostUSD() {
352 return itemUnitCostUSD;
353 }
354
355 public void setItemUnitCostUSD(KualiDecimal itemUnitCostUSD) {
356 this.itemUnitCostUSD = itemUnitCostUSD;
357 }
358
359 public Integer getFormatTypeId() {
360 return formatTypeId;
361 }
362
363 public void setFormatTypeId(Integer formatTypeId) {
364 this.formatTypeId = formatTypeId;
365 }
366
367 public KualiInteger getItemNoOfParts() {
368 if (this.itemNoOfParts != null) {
369 return itemNoOfParts;
370 } else {
371 return itemNoOfParts;
372 }
373 }
374
375 public void setItemNoOfParts(KualiInteger itemNoOfParts) {
376 this.itemNoOfParts = itemNoOfParts;
377 }
378
379 public KualiDecimal getItemListPrice() {
380 return itemListPrice;
381 }
382
383 public void setItemListPrice(KualiDecimal itemListPrice) {
384 this.itemListPrice = itemListPrice;
385 }
386
387 public KualiDecimal getItemDiscount() {
388 return itemDiscount;
389 }
390
391 public void setItemDiscount(KualiDecimal itemDiscount) {
392 this.itemDiscount = itemDiscount;
393 }
394
395 public String getItemDiscountType() {
396 return itemDiscountType;
397 }
398
399 public void setItemDiscountType(String itemDiscountType) {
400 this.itemDiscountType = itemDiscountType;
401 }
402
403 public BigDecimal getItemSurcharge() {
404 return itemSurcharge;
405 }
406
407 public void setItemSurcharge(BigDecimal itemSurcharge) {
408 this.itemSurcharge = itemSurcharge;
409 }
410
411 public Integer getPoItemIdentifier() {
412 return poItemIdentifier;
413 }
414
415 public void setPoItemIdentifier(Integer poItemIdentifier) {
416 this.poItemIdentifier = poItemIdentifier;
417 }
418
419 public String getNote() {
420 return note;
421 }
422
423 public void setNote(String note) {
424 this.note = note;
425 }
426
427 public List<OlePaymentRequestNote> getNotes() {
428 return notes;
429 }
430
431 public void setNotes(List<OlePaymentRequestNote> notes) {
432 this.notes = notes;
433 }
434
435 public UnitOfMeasure getItemUnitOfMeasure() {
436 if (ObjectUtils.isNull(itemUnitOfMeasure) || !StringUtils.equalsIgnoreCase(itemUnitOfMeasure.getItemUnitOfMeasureCode(), getItemUnitOfMeasureCode())) {
437 refreshReferenceObject(PurapPropertyConstants.ITEM_UNIT_OF_MEASURE);
438 }
439 return itemUnitOfMeasure;
440 }
441
442 public void setItemUnitOfMeasure(UnitOfMeasure itemUnitOfMeasure) {
443 this.itemUnitOfMeasure = itemUnitOfMeasure;
444 }
445
446 public boolean getIsUnorderedItem() {
447 if (this.getItemTypeCode().equalsIgnoreCase(PurapConstants.ItemTypeCodes.ITEM_TYPE_UNORDERED_ITEM_CODE)) {
448 return false;
449 }
450 return true;
451 }
452
453 public KualiDecimal getForeignCurrencyExtendedPrice() {
454 return foreignCurrencyExtendedPrice;
455 }
456
457 public void setForeignCurrencyExtendedPrice(KualiDecimal foreignCurrencyExtendedPrice) {
458 this.foreignCurrencyExtendedPrice = foreignCurrencyExtendedPrice;
459 }
460
461 public String getItemTitleId() {
462 return itemTitleId;
463 }
464
465 public void setItemTitleId(String itemTitleId) {
466 this.itemTitleId = itemTitleId;
467 }
468
469 public BibInfoBean getBibInfoBean() {
470 return bibInfoBean;
471 }
472
473 public void setBibInfoBean(BibInfoBean bibInfoBean) {
474 this.bibInfoBean = bibInfoBean;
475 }
476
477 public String getBibUUID() {
478 return bibUUID;
479 }
480
481 public void setBibUUID(String bibUUID) {
482 this.bibUUID = bibUUID;
483 }
484
485 public DocData getDocData() {
486 return docData;
487 }
488
489 public void setDocData(DocData docData) {
490 this.docData = docData;
491 }
492
493 public PaymentRequestDocument getPaymentRequestDocument() {
494 return paymentRequestDocument;
495 }
496
497 public void setPaymentRequestDocument(PaymentRequestDocument paymentRequestDocument) {
498 setPurapDocument(paymentRequestDocument);
499 this.paymentRequestDocument = paymentRequestDocument;
500 }
501
502 public boolean isAdditionalChargeUsd() {
503 return additionalChargeUsd;
504 }
505
506 public void setAdditionalChargeUsd(boolean additionalChargeUsd) {
507 this.additionalChargeUsd = additionalChargeUsd;
508 }
509
510
511
512
513
514
515 public KualiInteger getOleItemQuantity() {
516 return new KualiInteger(super.getItemQuantity().intValue());
517 }
518
519
520
521
522
523
524 public void setOleItemQuantity(KualiInteger oleItemQuantity) {
525 super.setItemQuantity(new KualiDecimal(oleItemQuantity.intValue()));
526 }
527
528
529
530
531
532
533 public KualiInteger getOlePoOutstandingQuantity() {
534 return new KualiInteger(super.getPoOutstandingQuantity().intValue());
535 }
536
537
538
539
540
541
542 public void setOlePoOutstandingQuantity(KualiInteger olePoOutstandingQuantity) {
543 super.setPoOutstandingQuantity(new KualiDecimal(olePoOutstandingQuantity.intValue()));
544 }
545
546 public List<SourceAccountingLine> getSourceAccountingLineList() {
547 return sourceAccountingLineList;
548 }
549
550 public void setSourceAccountingLineList(List<SourceAccountingLine> sourceAccountingLineList) {
551 this.sourceAccountingLineList = sourceAccountingLineList;
552 }
553
554
555
556
557
558
559
560
561 public OlePaymentRequestItem(OleInvoiceItem olePoi, OlePaymentRequestDocument preq, HashMap<String, ExpiredOrClosedAccountEntry> expiredOrClosedAccountList) {
562 super(olePoi, preq, expiredOrClosedAccountList);
563
564 this.setPaymentRequestDocument(preq);
565 LOG.debug("Inside OlePaymentRequestItem Constructor");
566 LOG.debug("Setting the Format,Discount and Price Details");
567 notes = new ArrayList<OlePaymentRequestNote>();
568
569 olePoi.getItemTypeCode();
570 this.setItemForeignListPrice(olePoi.getItemForeignListPrice());
571 this.setItemForeignDiscount(olePoi.getItemForeignDiscount());
572 this.setItemForeignDiscountType(olePoi.getItemForeignDiscountType());
573 this.setOleDonors(olePoi.getOleDonors());
574 this.setItemForeignDiscountAmt(olePoi.getItemForeignDiscountAmt());
575 this.setItemForeignUnitCost(olePoi.getItemForeignUnitCost());
576 this.setItemExchangeRate(olePoi.getItemExchangeRate());
577 this.setItemUnitCostUSD(olePoi.getItemUnitCostUSD());
578 this.setFormatTypeId(olePoi.getFormatTypeId());
579 this.setItemNoOfParts(olePoi.getItemNoOfParts());
580 this.setItemListPrice(olePoi.getItemListPrice());
581 this.setItemUnitPrice(olePoi.getItemUnitPrice());
582 this.setItemDiscount(olePoi.getItemDiscount());
583 if(olePoi.getNotes() != null && olePoi.getNotes().size() > 0){
584 List<OlePaymentRequestNote> paymentRequestNotes = new ArrayList<>();
585 for(OleInvoiceNote invoiceNote : olePoi.getNotes()){
586 OlePaymentRequestNote olePaymentRequestNote = new OlePaymentRequestNote();
587 olePaymentRequestNote.setNote(invoiceNote.getNote());
588 paymentRequestNotes.add(olePaymentRequestNote);
589 }
590 this.setNotes(paymentRequestNotes);
591 }
592 if(olePoi.getBibUUID()!=null){
593 this.setDocFormat(DocumentUniqueIDPrefix.getBibFormatType(olePoi.getBibUUID()));
594 }
595 this.setItemDiscountType(olePoi.getItemDiscountType());
596 this.setItemCatalogNumber(olePoi.getItemCatalogNumber());
597 this.setPoItemIdentifier(olePoi.getItemIdentifier());
598 this.setExtendedPrice(olePoi.getExtendedPrice());
599 this.setBibInfoBean(olePoi.getBibInfoBean());
600 this.setItemTitleId(olePoi.getItemTitleId());
601 this.setItemQuantity(olePoi.getItemQuantity());
602 if (preq.getPaymentMethodId() != null) {
603 OlePaymentMethod olePaymentMethod = SpringContext.getBean(BusinessObjectService.class)
604 .findBySinglePrimaryKey(OlePaymentMethod.class, preq.getPaymentMethodId());
605 preq.setPaymentMethod(olePaymentMethod);
606 preq.getPaymentMethod().setPaymentMethodId(olePaymentMethod.getPaymentMethodId());
607 preq.setPaymentMethodId(olePaymentMethod.getPaymentMethodId());
608 }
609 this.setPaidCopies(olePoi.getPaidCopies());
610
611
612 this.setItemCurrencyType(OleSelectConstant.USD);
613 this.setReceiptStatusId(olePoi.getReceiptStatusId());
614 }
615
616
617
618
619
620
621
622 public OlePaymentRequestItem(OleInvoiceItem olePoi, OlePaymentRequestDocument preq) {
623 super(olePoi, preq, new HashMap<String, ExpiredOrClosedAccountEntry>());
624 this.setPaymentRequestDocument(preq);
625 LOG.debug("Inside OlePaymentRequestItem Constructor");
626 LOG.debug("Setting the Format,Discount and Price Details");
627 notes = new ArrayList<OlePaymentRequestNote>();
628
629 this.setItemForeignListPrice(olePoi.getItemForeignListPrice());
630 this.setItemForeignDiscount(olePoi.getItemForeignDiscount());
631 this.setItemForeignDiscountType(olePoi.getItemForeignDiscountType());
632 this.setItemForeignDiscountAmt(olePoi.getItemForeignDiscountAmt());
633 this.setItemForeignUnitCost(olePoi.getItemForeignUnitCost());
634 this.setItemExchangeRate(olePoi.getItemExchangeRate());
635 this.setItemUnitCostUSD(olePoi.getItemUnitCostUSD());
636 this.setFormatTypeId(olePoi.getFormatTypeId());
637 this.setItemNoOfParts(olePoi.getItemNoOfParts());
638 this.setOleDonors(olePoi.getOleDonors());
639 this.setItemListPrice(olePoi.getItemListPrice());
640 this.setItemUnitPrice(olePoi.getItemUnitPrice());
641 if(olePoi.getItemTitleId()!=null){
642 this.setDocFormat(DocumentUniqueIDPrefix.getBibFormatType(olePoi.getItemTitleId()));
643 }
644 this.setItemDiscount(olePoi.getItemDiscount());
645 this.setItemDiscountType(olePoi.getItemDiscountType());
646 this.setItemCatalogNumber(olePoi.getItemCatalogNumber());
647 this.setPoItemIdentifier(olePoi.getItemIdentifier());
648 this.setExtendedPrice(olePoi.getExtendedPrice());
649 this.setBibInfoBean(olePoi.getBibInfoBean());
650 this.setItemTitleId(olePoi.getItemTitleId());
651 this.setItemQuantity(olePoi.getItemQuantity());
652
653 this.setItemCurrencyType(OleSelectConstant.USD);
654 this.setReceiptStatusId(olePoi.getReceiptStatusId());
655 this.setPaidCopies(olePoi.getPaidCopies());
656 }
657
658
659
660
661
662
663
664 @Override
665 public PurchaseOrderItem getPurchaseOrderItem() {
666 if (ObjectUtils.isNotNull(this.getPurapDocumentIdentifier())) {
667 if (ObjectUtils.isNull(this.getPaymentRequest())) {
668 this.refreshReferenceObject(PurapPropertyConstants.PURAP_DOC);
669 }
670 }
671
672
673 if (getPaymentRequest() != null) {
674 PurchaseOrderDocument po = getPaymentRequest().getPurchaseOrderDocument();
675 PurchaseOrderItem poi = null;
676 if (this.getItemType().isLineItemIndicator()) {
677 List<PurchaseOrderItem> items = po.getItems();
678 poi = items.get(this.getItemLineNumber().intValue() - 1);
679 } else {
680 poi = (PurchaseOrderItem) SpringContext.getBean(PurapService.class).getBelowTheLineByType(po, this.getItemType());
681 }
682 if (poi != null) {
683 return poi;
684 } else {
685 if (LOG.isDebugEnabled()) {
686 LOG.debug("getPurchaseOrderItem() Returning null because PurchaseOrderItem object for line number" + getItemLineNumber() + "or itemType " + getItemTypeCode() + " is null");
687 }
688 return null;
689 }
690 }
691 return null;
692 }
693
694 public List<OLEPaidCopy> getPaidCopies() {
695 return paidCopies;
696 }
697
698 public void setPaidCopies(List<OLEPaidCopy> paidCopies) {
699 this.paidCopies = paidCopies;
700 }
701
702 public String getPurchaseOrderItemID() {
703 return purchaseOrderItemID;
704 }
705
706 public void setPurchaseOrderItemID(String purchaseOrderItemID) {
707 this.purchaseOrderItemID = purchaseOrderItemID;
708 }
709 }