1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.kuali.ole.module.purap.businessobject;
22
23 import org.apache.commons.lang.StringUtils;
24 import org.apache.commons.lang.builder.ToStringBuilder;
25 import org.kuali.ole.module.purap.PurapConstants;
26 import org.kuali.ole.module.purap.document.ElectronicInvoiceRejectDocument;
27 import org.kuali.ole.module.purap.util.PurApDateFormatUtils;
28 import org.kuali.ole.module.purap.util.cxml.CxmlExtrinsic;
29
30 import java.math.BigDecimal;
31 import java.text.ParseException;
32 import java.text.SimpleDateFormat;
33 import java.util.ArrayList;
34 import java.util.Date;
35 import java.util.List;
36
37
38 public class ElectronicInvoiceItem {
39 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ElectronicInvoiceItem.class);
40
41
42
43
44 private String catalogNumber;
45 private String invoiceLineNumber;
46 private String quantity;
47 private String unitOfMeasure;
48
49 private String unitPrice;
50 private String unitPriceCurrency;
51 private String subTotalAmount;
52 private String subTotalAmountCurrency;
53 private String invoiceLineSpecialHandlingAmount;
54 private String invoiceLineSpecialHandlingAmountCurrency;
55 private String invoiceLineShippingAmount;
56 private String invoiceLineShippingAmountCurrency;
57 private String taxAmount;
58 private String taxAmountCurrency;
59 private String taxDescription;
60
61 private String invoiceLineGrossAmount;
62 private String invoiceLineGrossAmountCurrency;
63 private String invoiceLineDiscountAmount;
64 private String invoiceLineDiscountAmountCurrency;
65 private String invoiceLineDiscountPercentageRate;
66
67 private String invoiceLineNetAmount;
68 private String invoiceLineNetAmountCurrency;
69 private String shippingDateString;
70 private Date shippingDate;
71
72 private List invoiceShippingContacts = new ArrayList();
73 private List comments = new ArrayList();
74 private List extrinsic = new ArrayList();
75
76
77 private String referenceLineNumber;
78 private String referenceSerialNumber;
79 private List<String> referenceSerialNumbers = new ArrayList<String>();
80 private String referenceItemIDSupplierPartID;
81 private String referenceItemIDSupplierPartAuxID;
82 private String referenceDescription;
83 private String referenceManufacturerPartID;
84 private String referenceManufacturerName;
85 private String referenceCountryCode;
86 private String referenceCountryName;
87
88 private ElectronicInvoiceRejectDocument electronicInvoiceRejectDocument;
89
90 public ElectronicInvoiceItem() {
91 }
92
93 public Integer getReferenceLineNumberInteger() {
94 if (this.referenceLineNumber != null) {
95 return new Integer(Integer.parseInt(referenceLineNumber));
96 }
97 return null;
98 }
99
100 public String getInvoiceLineShippingDescription() {
101 return "";
102 }
103
104 public BigDecimal getInvoiceLineQuantityBigDecimal() {
105 if (StringUtils.isNotEmpty(quantity)) {
106 return new BigDecimal(this.quantity);
107 } else {
108 return null;
109 }
110 }
111
112 public BigDecimal getInvoiceLineUnitCostBigDecimal() {
113 BigDecimal unitprice = BigDecimal.ZERO;
114 if (StringUtils.isNotEmpty(unitPrice)) {
115 try {
116 unitprice = new BigDecimal(this.unitPrice);
117 } catch (NumberFormatException nfe) {
118 LOG.info("invalid unit price" + this.unitPrice);
119 }
120 }
121 return unitprice;
122 }
123
124 public BigDecimal getInvoiceLineSubTotalAmountBigDecimal() {
125 BigDecimal subTotalAmount = BigDecimal.ZERO;
126 if (StringUtils.isNotEmpty(this.subTotalAmount)) {
127 try {
128 subTotalAmount = new BigDecimal(this.subTotalAmount);
129 } catch (NumberFormatException nfe) {
130 LOG.info("invalid sub Total Amount " + this.subTotalAmount);
131 }
132 }
133 return subTotalAmount;
134 }
135
136 public BigDecimal getInvoiceLineTaxAmountBigDecimal() {
137 if (StringUtils.isNotEmpty(taxAmount)) {
138 return new BigDecimal(this.taxAmount);
139 } else {
140 return BigDecimal.ZERO;
141 }
142 }
143
144 public BigDecimal getInvoiceLineSpecialHandlingAmountBigDecimal() {
145 if (StringUtils.isNotEmpty(invoiceLineSpecialHandlingAmount)) {
146 return new BigDecimal(this.invoiceLineSpecialHandlingAmount);
147 } else {
148 return BigDecimal.ZERO;
149 }
150 }
151
152 public BigDecimal getInvoiceLineShippingAmountBigDecimal() {
153 if (StringUtils.isNotEmpty(invoiceLineShippingAmount)) {
154 return new BigDecimal(this.invoiceLineShippingAmount);
155 } else {
156 return BigDecimal.ZERO;
157 }
158 }
159
160 public BigDecimal getInvoiceLineGrossAmountBigDecimal() {
161 if (StringUtils.isNotEmpty(invoiceLineGrossAmount)) {
162 return new BigDecimal(this.invoiceLineGrossAmount);
163 } else {
164 return BigDecimal.ZERO;
165 }
166 }
167
168 public BigDecimal getInvoiceLineDiscountAmountBigDecimal() {
169 if (StringUtils.isNotEmpty(invoiceLineDiscountAmount)) {
170 return new BigDecimal(this.invoiceLineDiscountAmount);
171 } else {
172 return BigDecimal.ZERO;
173 }
174 }
175
176 public BigDecimal getInvoiceLineNetAmountBigDecimal() {
177 if (StringUtils.isNotEmpty(invoiceLineNetAmount)) {
178 return new BigDecimal(this.invoiceLineNetAmount);
179 } else {
180 return BigDecimal.ZERO;
181 }
182 }
183
184
185
186
187 public String getShippingDateString() {
188 return shippingDateString;
189 }
190
191
192
193
194 public void setShippingDateString(String shippingDateString) {
195 this.shippingDateString = shippingDateString;
196 if ((shippingDateString != null) && (!("".equals(shippingDateString)))) {
197 SimpleDateFormat sdf = PurApDateFormatUtils.getSimpleDateFormat(PurapConstants.NamedDateFormats.CXML_DATE_FORMAT);
198 try {
199 this.shippingDate = sdf.parse(shippingDateString);
200 } catch (ParseException e) {
201
202 LOG.error("setShippingDateString() SimpleDateFormat parser error attempting to set invalid date string " + shippingDateString + " in ShippingDate field... setting date to null");
203 this.shippingDate = null;
204 }
205 } else {
206 this.shippingDate = null;
207 }
208 }
209
210
211
212
213 public String getCatalogNumber() {
214 return catalogNumber;
215 }
216
217
218
219
220 public void setCatalogNumber(String catalogNumber) {
221 this.catalogNumber = catalogNumber;
222 }
223
224
225
226
227 public List getComments() {
228 return comments;
229 }
230
231
232
233
234 public void setComments(List comments) {
235 this.comments = comments;
236 }
237
238
239
240
241 public List getExtrinsic() {
242 return extrinsic;
243 }
244
245
246
247
248 public void setExtrinsic(List extrinsic) {
249 this.extrinsic = extrinsic;
250 }
251
252
253
254
255 public String getInvoiceLineDiscountAmount() {
256 return invoiceLineDiscountAmount;
257 }
258
259
260
261
262 public void setInvoiceLineDiscountAmount(String invoiceLineDiscountAmount) {
263 this.invoiceLineDiscountAmount = invoiceLineDiscountAmount;
264 }
265
266
267
268
269 public String getInvoiceLineDiscountAmountCurrency() {
270 return invoiceLineDiscountAmountCurrency;
271 }
272
273
274
275
276
277 public void setInvoiceLineDiscountAmountCurrency(String invoiceLineDiscountAmountCurrency) {
278 this.invoiceLineDiscountAmountCurrency = invoiceLineDiscountAmountCurrency;
279 }
280
281
282
283
284 public String getInvoiceLineGrossAmount() {
285 return invoiceLineGrossAmount;
286 }
287
288
289
290
291 public void setInvoiceLineGrossAmount(String invoiceLineGrossAmount) {
292 this.invoiceLineGrossAmount = invoiceLineGrossAmount;
293 }
294
295
296
297
298 public String getInvoiceLineGrossAmountCurrency() {
299 return invoiceLineGrossAmountCurrency;
300 }
301
302
303
304
305 public void setInvoiceLineGrossAmountCurrency(String invoiceLineGrossAmountCurrency) {
306 this.invoiceLineGrossAmountCurrency = invoiceLineGrossAmountCurrency;
307 }
308
309
310
311
312 public String getInvoiceLineNetAmount() {
313 return invoiceLineNetAmount;
314 }
315
316
317
318
319 public void setInvoiceLineNetAmount(String invoiceLineNetAmount) {
320 this.invoiceLineNetAmount = invoiceLineNetAmount;
321 }
322
323
324
325
326 public String getInvoiceLineNetAmountCurrency() {
327 return invoiceLineNetAmountCurrency;
328 }
329
330
331
332
333 public void setInvoiceLineNetAmountCurrency(String invoiceLineNetAmountCurrency) {
334 this.invoiceLineNetAmountCurrency = invoiceLineNetAmountCurrency;
335 }
336
337
338
339
340 public String getInvoiceLineNumber() {
341 return invoiceLineNumber;
342 }
343
344
345
346
347 public void setInvoiceLineNumber(String invoiceLineNumber) {
348 this.invoiceLineNumber = invoiceLineNumber;
349 }
350
351
352
353
354 public String getInvoiceLineShippingAmount() {
355 return invoiceLineShippingAmount;
356 }
357
358
359
360
361 public void setInvoiceLineShippingAmount(String invoiceLineShippingAmount) {
362 this.invoiceLineShippingAmount = invoiceLineShippingAmount;
363 }
364
365
366
367
368 public String getInvoiceLineShippingAmountCurrency() {
369 return invoiceLineShippingAmountCurrency;
370 }
371
372
373
374
375
376 public void setInvoiceLineShippingAmountCurrency(String invoiceLineShippingAmountCurrency) {
377 this.invoiceLineShippingAmountCurrency = invoiceLineShippingAmountCurrency;
378 }
379
380
381
382
383 public String getInvoiceLineSpecialHandlingAmount() {
384 return invoiceLineSpecialHandlingAmount;
385 }
386
387
388
389
390
391 public void setInvoiceLineSpecialHandlingAmount(String invoiceLineSpecialHandlingAmount) {
392 this.invoiceLineSpecialHandlingAmount = invoiceLineSpecialHandlingAmount;
393 }
394
395
396
397
398 public String getInvoiceLineSpecialHandlingAmountCurrency() {
399 return invoiceLineSpecialHandlingAmountCurrency;
400 }
401
402
403
404
405
406 public void setInvoiceLineSpecialHandlingAmountCurrency(
407 String invoiceLineSpecialHandlingAmountCurrency) {
408 this.invoiceLineSpecialHandlingAmountCurrency = invoiceLineSpecialHandlingAmountCurrency;
409 }
410
411
412
413
414 public List getInvoiceShippingContacts() {
415 return invoiceShippingContacts;
416 }
417
418
419
420
421 public void setInvoiceShippingContacts(List invoiceShippingContacts) {
422 this.invoiceShippingContacts = invoiceShippingContacts;
423 }
424
425 public void addInvoiceShippingContacts(ElectronicInvoiceContact contact) {
426 invoiceShippingContacts.add(contact);
427 }
428
429
430
431
432 public String getQuantity() {
433 return quantity;
434 }
435
436
437
438
439 public void setQuantity(String quantity) {
440 this.quantity = quantity;
441 }
442
443
444
445
446 public String getReferenceCountryCode() {
447 return referenceCountryCode;
448 }
449
450
451
452
453 public void setReferenceCountryCode(String referenceCountryCode) {
454 this.referenceCountryCode = referenceCountryCode;
455 }
456
457
458
459
460 public String getReferenceCountryName() {
461 return referenceCountryName;
462 }
463
464
465
466
467 public void setReferenceCountryName(String referenceCountryName) {
468 this.referenceCountryName = referenceCountryName;
469 }
470
471
472
473
474 public String getReferenceDescription() {
475 return referenceDescription;
476 }
477
478
479
480
481 public void setReferenceDescription(String referenceDescription) {
482 this.referenceDescription = referenceDescription;
483 }
484
485
486
487
488 public String getReferenceItemIDSupplierPartAuxID() {
489 return referenceItemIDSupplierPartAuxID;
490 }
491
492
493
494
495
496 public void setReferenceItemIDSupplierPartAuxID(String referenceItemIDSupplierPartAuxID) {
497 this.referenceItemIDSupplierPartAuxID = referenceItemIDSupplierPartAuxID;
498 }
499
500
501
502
503 public String getReferenceItemIDSupplierPartID() {
504 return referenceItemIDSupplierPartID;
505 }
506
507
508
509
510 public void setReferenceItemIDSupplierPartID(String referenceItemIDSupplierPartID) {
511 this.referenceItemIDSupplierPartID = referenceItemIDSupplierPartID;
512 }
513
514
515
516
517 public String getReferenceLineNumber() {
518 return referenceLineNumber;
519 }
520
521
522
523
524 public void setReferenceLineNumber(String referenceLineNumber) {
525 this.referenceLineNumber = referenceLineNumber;
526 }
527
528
529
530
531 public String getReferenceManufacturerName() {
532 return referenceManufacturerName;
533 }
534
535
536
537
538 public void setReferenceManufacturerName(String referenceManufacturerName) {
539 this.referenceManufacturerName = referenceManufacturerName;
540 }
541
542
543
544
545 public String getReferenceManufacturerPartID() {
546 return referenceManufacturerPartID;
547 }
548
549
550
551
552 public void setReferenceManufacturerPartID(String referenceManufacturerPartID) {
553 this.referenceManufacturerPartID = referenceManufacturerPartID;
554 }
555
556
557
558
559 public String getReferenceSerialNumber() {
560 return referenceSerialNumber;
561 }
562
563
564
565
566 public void setReferenceSerialNumber(String referenceSerialNumber) {
567 this.referenceSerialNumber = referenceSerialNumber;
568 }
569
570
571
572
573 public List getReferenceSerialNumbers() {
574 return referenceSerialNumbers;
575 }
576
577
578
579
580 public void setReferenceSerialNumbers(List referenceSerialNumbers) {
581 this.referenceSerialNumbers = referenceSerialNumbers;
582 }
583
584
585
586
587 public Date getShippingDate() {
588 return shippingDate;
589 }
590
591
592
593
594 public void setShippingDate(Date shippingDate) {
595 this.shippingDate = shippingDate;
596 }
597
598
599
600
601 public String getSubTotalAmount() {
602 return subTotalAmount;
603 }
604
605
606
607
608 public void setSubTotalAmount(String subTotalAmount) {
609 this.subTotalAmount = subTotalAmount;
610 }
611
612
613
614
615 public String getSubTotalAmountCurrency() {
616 return subTotalAmountCurrency;
617 }
618
619
620
621
622 public void setSubTotalAmountCurrency(String subTotalAmountCurrency) {
623 this.subTotalAmountCurrency = subTotalAmountCurrency;
624 }
625
626
627
628
629 public String getTaxAmount() {
630 return taxAmount;
631 }
632
633
634
635
636 public void setTaxAmount(String taxAmount) {
637 this.taxAmount = taxAmount;
638 }
639
640
641
642
643 public String getTaxAmountCurrency() {
644 return taxAmountCurrency;
645 }
646
647
648
649
650 public void setTaxAmountCurrency(String taxAmountCurrency) {
651 this.taxAmountCurrency = taxAmountCurrency;
652 }
653
654
655
656
657 public String getTaxDescription() {
658 return taxDescription;
659 }
660
661
662
663
664 public void setTaxDescription(String taxDescription) {
665 this.taxDescription = taxDescription;
666 }
667
668
669
670
671 public String getUnitOfMeasure() {
672 return unitOfMeasure;
673 }
674
675
676
677
678 public void setUnitOfMeasure(String unitOfMeasure) {
679 this.unitOfMeasure = unitOfMeasure;
680 }
681
682
683
684
685 public String getUnitPrice() {
686 return unitPrice;
687 }
688
689
690
691
692 public void setUnitPrice(String unitPrice) {
693 this.unitPrice = unitPrice;
694 }
695
696
697
698
699 public String getUnitPriceCurrency() {
700 return unitPriceCurrency;
701 }
702
703
704
705
706 public void setUnitPriceCurrency(String unitPriceCurrency) {
707 this.unitPriceCurrency = unitPriceCurrency;
708 }
709
710 public ElectronicInvoiceRejectDocument getElectronicInvoiceRejectDocument() {
711 return electronicInvoiceRejectDocument;
712 }
713
714 public void setElectronicInvoiceRejectDocument(ElectronicInvoiceRejectDocument electronicInvoiceRejectDocument) {
715 this.electronicInvoiceRejectDocument = electronicInvoiceRejectDocument;
716 }
717
718
719 public void addReferenceSerialNumber(String referenceSerialNumber) {
720 this.referenceSerialNumbers.add(referenceSerialNumber);
721 }
722
723 public String[] getReferenceSerialNumbersAsArray() {
724 if (referenceSerialNumbers.size() > 0) {
725 String[] serialNumbers = new String[referenceSerialNumbers.size()];
726 referenceSerialNumbers.toArray(serialNumbers);
727 return serialNumbers;
728 }
729 return null;
730 }
731
732 public void addExtrinsic(CxmlExtrinsic extrinsic) {
733 this.extrinsic.add(extrinsic);
734 }
735
736 public CxmlExtrinsic[] getExtrinsicAsArray() {
737 if (extrinsic.size() > 0) {
738 CxmlExtrinsic[] extrinsics = new CxmlExtrinsic[extrinsic.size()];
739 extrinsic.toArray(extrinsics);
740 return extrinsics;
741 }
742 return null;
743 }
744
745 public void addComments(String comment) {
746 this.comments.add(comment);
747 }
748
749 public String getInvoiceLineDiscountPercentageRate() {
750 return invoiceLineDiscountPercentageRate;
751 }
752
753 public void setInvoiceLineDiscountPercentageRate(String invoiceLineDiscountPercentageRate) {
754 this.invoiceLineDiscountPercentageRate = invoiceLineDiscountPercentageRate;
755 }
756
757 public String toString() {
758
759 ToStringBuilder toString = new ToStringBuilder(this);
760
761 toString.append("invoiceLineNumber", getInvoiceLineNumber());
762 toString.append("quantity", getQuantity());
763 toString.append("catalogNumber", getCatalogNumber());
764 toString.append("unitOfMeasure", getUnitOfMeasure());
765 toString.append("unitPrice", getUnitPrice());
766 toString.append("unitPriceCurrency", getUnitPriceCurrency());
767 toString.append("subTotalAmount", getSubTotalAmount());
768 toString.append("subTotalAmountCurrency", getSubTotalAmountCurrency());
769 toString.append("invoiceLineSpecialHandlingAmount", getInvoiceLineSpecialHandlingAmount());
770 toString.append("invoiceLineSpecialHandlingAmountCurrency", getInvoiceLineSpecialHandlingAmountCurrency());
771 toString.append("invoiceLineShippingAmount", getInvoiceLineShippingAmount());
772 toString.append("invoiceLineShippingAmountCurrency", getInvoiceLineShippingAmountCurrency());
773 toString.append("taxAmount", getTaxAmount());
774 toString.append("taxAmountCurrency", getTaxAmountCurrency());
775 toString.append("taxDescription", getTaxDescription());
776 toString.append("invoiceLineGrossAmount", getInvoiceLineGrossAmount());
777 toString.append("invoiceLineGrossAmountCurrency", getInvoiceLineGrossAmountCurrency());
778 toString.append("invoiceLineDiscountAmount", getInvoiceLineDiscountAmount());
779 toString.append("invoiceLineDiscountAmountCurrency", getInvoiceLineDiscountAmountCurrency());
780 toString.append("invoiceLineNetAmount", getInvoiceLineNetAmount());
781 toString.append("invoiceLineNetAmountCurrency", getInvoiceLineNetAmountCurrency());
782 toString.append("shippingDateString", getShippingDateString());
783
784 toString.append("referenceLineNumber", getReferenceLineNumber());
785 toString.append("referenceSerialNumber", getReferenceSerialNumber());
786 toString.append("referenceSerialNumbersList", getReferenceSerialNumbers());
787 toString.append("referenceItemIDSupplierPartID", getReferenceItemIDSupplierPartID());
788 toString.append("referenceItemIDSupplierPartAuxID", getReferenceItemIDSupplierPartAuxID());
789 toString.append("referenceDescription", getReferenceDescription());
790 toString.append("referenceManufacturerPartID", getReferenceManufacturerPartID());
791 toString.append("referenceManufacturerName", getReferenceManufacturerName());
792 toString.append("referenceCountryCode", getReferenceCountryCode());
793 toString.append("referenceCountryName", getReferenceCountryName());
794
795 toString.append("invoiceShippingContacts", getInvoiceShippingContacts());
796 toString.append("comments", getComments());
797 toString.append("extrinsic", getExtrinsic());
798
799 return toString.toString();
800
801 }
802
803
804 }