001 /*
002 * Copyright 2011 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 2.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/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.kfs.module.purap.document;
017
018 import java.math.BigDecimal;
019 import java.sql.Timestamp;
020 import java.text.MessageFormat;
021 import java.text.ParseException;
022 import java.util.ArrayList;
023 import java.util.Date;
024 import java.util.Iterator;
025 import java.util.List;
026
027 import org.apache.commons.lang.StringUtils;
028 import org.apache.commons.lang.math.NumberUtils;
029 import org.kuali.kfs.module.purap.PurapParameterConstants;
030 import org.kuali.kfs.module.purap.businessobject.ElectronicInvoice;
031 import org.kuali.kfs.module.purap.businessobject.ElectronicInvoiceContact;
032 import org.kuali.kfs.module.purap.businessobject.ElectronicInvoiceItem;
033 import org.kuali.kfs.module.purap.businessobject.ElectronicInvoiceLoadSummary;
034 import org.kuali.kfs.module.purap.businessobject.ElectronicInvoiceOrder;
035 import org.kuali.kfs.module.purap.businessobject.ElectronicInvoicePostalAddress;
036 import org.kuali.kfs.module.purap.businessobject.ElectronicInvoiceRejectItem;
037 import org.kuali.kfs.module.purap.businessobject.ElectronicInvoiceRejectReason;
038 import org.kuali.kfs.module.purap.businessobject.PurchaseOrderView;
039 import org.kuali.kfs.module.purap.document.service.PurchaseOrderService;
040 import org.kuali.kfs.module.purap.service.ElectronicInvoiceMappingService;
041 import org.kuali.kfs.module.purap.util.ElectronicInvoiceUtils;
042 import org.kuali.kfs.module.purap.util.PurApRelatedViews;
043 import org.kuali.kfs.module.purap.util.PurapSearchUtils;
044 import org.kuali.kfs.sys.KFSConstants.AdHocPaymentIndicator;
045 import org.kuali.kfs.sys.ObjectUtil;
046 import org.kuali.kfs.sys.context.SpringContext;
047 import org.kuali.kfs.sys.document.FinancialSystemTransactionalDocumentBase;
048 import org.kuali.kfs.sys.service.impl.KfsParameterConstants;
049 import org.kuali.kfs.vnd.businessobject.CampusParameter;
050 import org.kuali.kfs.vnd.businessobject.VendorDetail;
051 import org.kuali.kfs.vnd.document.service.VendorService;
052 import org.kuali.rice.kew.dto.DocumentRouteStatusChangeDTO;
053 import org.kuali.rice.kns.bo.Note;
054 import org.kuali.rice.kns.document.SessionDocument;
055 import org.kuali.rice.kns.service.DateTimeService;
056 import org.kuali.rice.kns.service.ParameterService;
057 import org.kuali.rice.kns.util.KualiDecimal;
058 import org.kuali.rice.kns.util.ObjectUtils;
059
060 public class ElectronicInvoiceRejectDocument extends FinancialSystemTransactionalDocumentBase implements SessionDocument
061 {
062 protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ElectronicInvoiceRejectDocument.class);
063 protected static BigDecimal zero = new BigDecimal(0);
064
065 // NOT NULL FIELDS
066 protected Integer purapDocumentIdentifier;
067 protected Integer accountsPayablePurchasingDocumentLinkIdentifier;
068 protected Integer invoiceLoadSummaryIdentifier;
069 protected Timestamp invoiceProcessTimestamp;
070 protected Boolean invoiceFileHeaderTypeIndicator = Boolean.FALSE;
071 protected Boolean invoiceFileInformationOnlyIndicator = Boolean.FALSE;
072 protected Boolean invoiceFileTaxInLineIndicator = Boolean.FALSE;
073 protected Boolean invoiceFileSpecialHandlingInLineIndicator = Boolean.FALSE;
074 protected Boolean invoiceFileShippingInLineIndicator = Boolean.FALSE;
075 protected Boolean invoiceFileDiscountInLineIndicator = Boolean.FALSE;
076
077 protected String invoiceFileName;
078 protected String vendorDunsNumber;
079 protected Integer vendorHeaderGeneratedIdentifier;
080 protected Integer vendorDetailAssignedIdentifier;
081 protected String invoiceFileDate;
082 protected String invoiceFileNumber;
083 protected String invoiceFilePurposeIdentifier;
084 protected String invoiceFileOperationIdentifier;
085 protected String invoiceFileDeploymentModeValue;
086 protected String invoiceOrderReferenceOrderIdentifier;
087 protected String invoiceOrderReferenceDocumentReferencePayloadIdentifier;
088 protected String invoiceOrderReferenceDocumentReferenceText;
089 protected String invoiceOrderMasterAgreementReferenceIdentifier;
090 protected String invoiceOrderMasterAgreementReferenceDate;
091 protected String invoiceOrderMasterAgreementInformationIdentifier;
092 protected String invoiceOrderMasterAgreementInformationDate;
093 protected String invoiceOrderPurchaseOrderIdentifier;
094 protected String invoiceOrderPurchaseOrderDate;
095 protected String invoiceOrderSupplierOrderInformationIdentifier;
096 protected String invoiceShipDate;
097 protected String invoiceShipToAddressName;
098 protected String invoiceShipToAddressType;
099 protected String invoiceShipToAddressLine1;
100 protected String invoiceShipToAddressLine2;
101 protected String invoiceShipToAddressLine3;
102 protected String invoiceShipToAddressCityName;
103 protected String invoiceShipToAddressStateCode;
104 protected String invoiceShipToAddressPostalCode;
105 protected String invoiceShipToAddressCountryCode;
106 protected String invoiceShipToAddressCountryName;
107 protected String invoiceBillToAddressName;
108 protected String invoiceBillToAddressType;
109 protected String invoiceBillToAddressLine1;
110 protected String invoiceBillToAddressLine2;
111 protected String invoiceBillToAddressLine3;
112 protected String invoiceBillToAddressCityName;
113 protected String invoiceBillToAddressStateCode;
114 protected String invoiceBillToAddressPostalCode;
115 protected String invoiceBillToAddressCountryCode;
116 protected String invoiceBillToAddressCountryName;
117 protected String invoiceRemitToAddressName;
118 protected String invoiceRemitToAddressType;
119 protected String invoiceRemitToAddressLine1;
120 protected String invoiceRemitToAddressLine2;
121 protected String invoiceRemitToAddressLine3;
122 protected String invoiceRemitToAddressCityName;
123 protected String invoiceRemitToAddressStateCode;
124 protected String invoiceRemitToAddressPostalCode;
125 protected String invoiceRemitToAddressCountryCode;
126 protected String invoiceRemitToAddressCountryName;
127
128 protected Integer paymentRequestIdentifier;
129
130 protected String invoiceCustomerNumber;
131 protected String invoicePurchaseOrderNumber;
132 protected Integer purchaseOrderIdentifier;
133 protected String purchaseOrderDeliveryCampusCode;
134
135 protected String invoiceItemSubTotalCurrencyCode;
136 protected String invoiceItemSpecialHandlingCurrencyCode;
137 protected String invoiceItemSpecialHandlingDescription;
138 protected String invoiceItemShippingCurrencyCode;
139 protected String invoiceItemShippingDescription;
140 protected String invoiceItemTaxCurrencyCode;
141 protected String invoiceItemTaxDescription;
142 protected String invoiceItemGrossCurrencyCode;
143 protected String invoiceItemDiscountCurrencyCode;
144 protected String invoiceItemNetCurrencyCode;
145
146 protected BigDecimal invoiceItemSubTotalAmount;
147 protected BigDecimal invoiceItemSpecialHandlingAmount;
148 protected BigDecimal invoiceItemShippingAmount;
149 protected BigDecimal invoiceItemTaxAmount;
150 protected BigDecimal invoiceItemGrossAmount;
151 protected BigDecimal invoiceItemDiscountAmount;
152 protected BigDecimal invoiceItemNetAmount;
153
154 protected boolean invoiceNumberAcceptIndicator = false;
155 protected boolean invoiceResearchIndicator = false;
156 protected Timestamp invoiceFileTimeStampForSearch;
157
158 protected Timestamp accountsPayableApprovalTimestamp;
159
160 protected transient PurApRelatedViews relatedViews;
161 protected PurchaseOrderDocument currentPurchaseOrderDocument;
162
163 protected VendorDetail vendorDetail;
164 protected ElectronicInvoiceLoadSummary invoiceLoadSummary;
165 protected List<ElectronicInvoiceRejectItem> invoiceRejectItems = new ArrayList<ElectronicInvoiceRejectItem>();
166 protected List<ElectronicInvoiceRejectReason> invoiceRejectReasons = new ArrayList<ElectronicInvoiceRejectReason>();
167
168 protected boolean isDocumentCreationInProgress = false;
169
170 protected String vendorNumber;
171
172 protected CampusParameter purchaseOrderDeliveryCampus;
173
174 /**
175 *
176 */
177 public ElectronicInvoiceRejectDocument() {
178 super();
179 }
180
181 public void setFileLevelData(ElectronicInvoice ei) {
182 DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
183 this.invoiceProcessTimestamp = dateTimeService.getCurrentTimestamp();
184 this.invoiceFileHeaderTypeIndicator = new Boolean(ei.getInvoiceDetailRequestHeader().isHeaderInvoiceIndicator());
185 this.invoiceFileInformationOnlyIndicator = new Boolean(ei.getInvoiceDetailRequestHeader().isInformationOnly());
186 this.invoiceFileTaxInLineIndicator = new Boolean(ei.getInvoiceDetailRequestHeader().isTaxInLine());
187 this.invoiceFileSpecialHandlingInLineIndicator = new Boolean(ei.getInvoiceDetailRequestHeader().isSpecialHandlingInLine());
188 this.invoiceFileShippingInLineIndicator = new Boolean(ei.getInvoiceDetailRequestHeader().isShippingInLine());
189 this.invoiceFileDiscountInLineIndicator = new Boolean(ei.getInvoiceDetailRequestHeader().isDiscountInLine());
190
191 this.invoiceFileName = ei.getFileName();
192 this.vendorDunsNumber = ei.getDunsNumber();
193 this.vendorHeaderGeneratedIdentifier = ei.getVendorHeaderID();
194 this.vendorDetailAssignedIdentifier = ei.getVendorDetailID();
195 this.invoiceFileDate = ei.getInvoiceDateDisplayText();
196 this.invoiceFileNumber = ei.getInvoiceDetailRequestHeader().getInvoiceId();
197 this.invoiceFilePurposeIdentifier = ei.getInvoiceDetailRequestHeader().getPurpose();
198 this.invoiceFileOperationIdentifier = ei.getInvoiceDetailRequestHeader().getOperation();
199 this.invoiceFileDeploymentModeValue = ei.getDeploymentMode();
200 this.invoiceCustomerNumber = ei.getCustomerNumber();
201
202 for (ElectronicInvoiceRejectReason eirr : ei.getFileRejectReasons()) {
203 ElectronicInvoiceRejectReason newReason = new ElectronicInvoiceRejectReason();
204 ObjectUtil.buildObject(newReason, eirr);
205 this.invoiceRejectReasons.add(newReason);
206 }
207 }
208
209 public void setInvoiceOrderLevelData(ElectronicInvoice ei, ElectronicInvoiceOrder eio) {
210 this.invoiceOrderReferenceOrderIdentifier = eio.getOrderReferenceOrderID();
211 this.invoiceOrderReferenceDocumentReferencePayloadIdentifier = eio.getOrderReferenceDocumentRefPayloadID();
212 this.invoiceOrderReferenceDocumentReferenceText = eio.getOrderReferenceDocumentRef();
213 this.invoiceOrderMasterAgreementReferenceIdentifier = eio.getMasterAgreementReferenceID();
214 this.invoiceOrderMasterAgreementReferenceDate = ei.getMasterAgreementReferenceDateDisplayText(eio);
215 this.invoiceOrderMasterAgreementInformationIdentifier = eio.getMasterAgreementIDInfoID();
216 this.invoiceOrderMasterAgreementInformationDate = ei.getMasterAgreementIDInfoDateDisplayText(eio);
217 this.invoiceOrderPurchaseOrderIdentifier = eio.getOrderIDInfoID();
218 this.invoiceOrderPurchaseOrderDate = ei.getOrderIDInfoDateDisplayText(eio);
219 this.invoiceOrderSupplierOrderInformationIdentifier = eio.getSupplierOrderInfoID();
220 this.invoiceShipDate = ei.getShippingDateDisplayText(eio);
221
222 ElectronicInvoiceContact shipToContact = ei.getCxmlContact(eio, ElectronicInvoiceMappingService.CXML_ADDRESS_SHIP_TO_ROLE_ID);
223 ElectronicInvoicePostalAddress shipToAddress = this.getCxmlPostalAddressByAddressName(shipToContact, ElectronicInvoiceMappingService.CXML_ADDRESS_SHIP_TO_NAME);
224 // ElectronicInvoicePostalAddress shipToAddress =
225 // ei.getCxmlPostalAddress(eio,ElectronicInvoiceMappingService.CXML_ADDRESS_SHIP_TO_ROLE_ID,
226 // ElectronicInvoiceMappingService.CXML_ADDRESS_SHIP_TO_NAME);
227 if (shipToAddress != null) {
228 this.invoiceShipToAddressName = shipToContact.getName();
229 this.invoiceShipToAddressType = shipToAddress.getType();
230 this.invoiceShipToAddressLine1 = shipToAddress.getLine1();
231 this.invoiceShipToAddressLine2 = shipToAddress.getLine2();
232 this.invoiceShipToAddressLine3 = shipToAddress.getLine3();
233 this.invoiceShipToAddressCityName = shipToAddress.getCityName();
234 this.invoiceShipToAddressStateCode = shipToAddress.getStateCode();
235 this.invoiceShipToAddressPostalCode = shipToAddress.getPostalCode();
236 this.invoiceShipToAddressCountryCode = shipToAddress.getCountryCode();
237 this.invoiceShipToAddressCountryName = shipToAddress.getCountryName();
238 }
239
240 ElectronicInvoiceContact billToContact = ei.getCxmlContact(eio, ElectronicInvoiceMappingService.CXML_ADDRESS_BILL_TO_ROLE_ID);
241 ElectronicInvoicePostalAddress billToAddress = this.getCxmlPostalAddressByAddressName(billToContact, ElectronicInvoiceMappingService.CXML_ADDRESS_BILL_TO_NAME);
242 // ElectronicInvoicePostalAddress billToAddress =
243 // ei.getCxmlPostalAddress(eio,ElectronicInvoiceMappingService.CXML_ADDRESS_BILL_TO_ROLE_ID,
244 // ElectronicInvoiceMappingService.CXML_ADDRESS_BILL_TO_NAME);
245 if (billToAddress != null) {
246 this.invoiceBillToAddressName = billToContact.getName();
247 this.invoiceBillToAddressType = billToAddress.getType();
248 this.invoiceBillToAddressLine1 = billToAddress.getLine1();
249 this.invoiceBillToAddressLine2 = billToAddress.getLine2();
250 this.invoiceBillToAddressLine3 = billToAddress.getLine3();
251 this.invoiceBillToAddressCityName = billToAddress.getCityName();
252 this.invoiceBillToAddressStateCode = billToAddress.getStateCode();
253 this.invoiceBillToAddressPostalCode = billToAddress.getPostalCode();
254 this.invoiceBillToAddressCountryCode = billToAddress.getCountryCode();
255 this.invoiceBillToAddressCountryName = billToAddress.getCountryName();
256 }
257
258 ElectronicInvoiceContact remitToContact = ei.getCxmlContact(eio, ElectronicInvoiceMappingService.CXML_ADDRESS_REMIT_TO_ROLE_ID);
259 ElectronicInvoicePostalAddress remitToAddress = this.getCxmlPostalAddressByAddressName(remitToContact, ElectronicInvoiceMappingService.CXML_ADDRESS_REMIT_TO_NAME);
260 // ElectronicInvoicePostalAddress remitToAddress =
261 // ei.getCxmlPostalAddress(eio,ElectronicInvoiceMappingService.CXML_ADDRESS_REMIT_TO_ROLE_ID,
262 // ElectronicInvoiceMappingService.CXML_ADDRESS_REMIT_TO_NAME);
263 if (remitToAddress != null) {
264 this.invoiceRemitToAddressName = remitToContact.getName();
265 this.invoiceRemitToAddressType = remitToAddress.getType();
266 this.invoiceRemitToAddressLine1 = remitToAddress.getLine1();
267 this.invoiceRemitToAddressLine2 = remitToAddress.getLine2();
268 this.invoiceRemitToAddressLine3 = remitToAddress.getLine3();
269 this.invoiceRemitToAddressCityName = remitToAddress.getCityName();
270 this.invoiceRemitToAddressStateCode = remitToAddress.getStateCode();
271 this.invoiceRemitToAddressPostalCode = remitToAddress.getPostalCode();
272 this.invoiceRemitToAddressCountryCode = remitToAddress.getCountryCode();
273 this.invoiceRemitToAddressCountryName = remitToAddress.getCountryName();
274 }
275 this.invoicePurchaseOrderNumber = eio.getInvoicePurchaseOrderID();
276 this.purchaseOrderIdentifier = eio.getPurchaseOrderID();
277 this.purchaseOrderDeliveryCampusCode = eio.getPurchaseOrderCampusCode();
278
279 try {
280 this.invoiceItemSubTotalAmount = ei.getInvoiceSubTotalAmount(eio);
281 this.invoiceItemSubTotalCurrencyCode = ei.getInvoiceSubTotalCurrencyIfNotValid(eio);
282 }
283 catch (Exception e) {
284 this.invoiceItemSubTotalAmount = null;
285 this.invoiceItemSubTotalCurrencyCode = "INVALID Amount";
286 }
287 try {
288 this.invoiceItemSpecialHandlingAmount = ei.getInvoiceSpecialHandlingAmount(eio);
289 this.invoiceItemSpecialHandlingCurrencyCode = ei.getInvoiceSpecialHandlingCurrencyIfNotValid(eio);
290 }
291 catch (Exception e) {
292 this.invoiceItemSpecialHandlingAmount = null;
293 this.invoiceItemSpecialHandlingCurrencyCode = "INVALID AMOUNT";
294 }
295 this.invoiceItemSpecialHandlingDescription = ei.getInvoiceSpecialHandlingDescription(eio);
296 try {
297 this.invoiceItemShippingAmount = ei.getInvoiceShippingAmount(eio);
298 this.invoiceItemShippingCurrencyCode = ei.getInvoiceShippingCurrencyIfNotValid(eio);
299 }
300 catch (Exception e) {
301 this.invoiceItemShippingAmount = null;
302 this.invoiceItemShippingCurrencyCode = "INVALID AMOUNT";
303 }
304 this.invoiceItemShippingDescription = ei.getInvoiceShippingDescription(eio);
305 try {
306 this.invoiceItemTaxAmount = ei.getInvoiceTaxAmount(eio);
307 this.invoiceItemTaxCurrencyCode = ei.getInvoiceTaxCurrencyIfNotValid(eio);
308 }
309 catch (Exception e) {
310 this.invoiceItemTaxAmount = null;
311 this.invoiceItemTaxCurrencyCode = "INVALID AMOUNT";
312 }
313 this.invoiceItemTaxDescription = ei.getInvoiceTaxDescription(eio);
314 try {
315 this.invoiceItemGrossAmount = ei.getInvoiceGrossAmount(eio);
316 this.invoiceItemGrossCurrencyCode = ei.getInvoiceGrossCurrencyIfNotValid(eio);
317 }
318 catch (Exception e) {
319 this.invoiceItemGrossAmount = null;
320 this.invoiceItemGrossCurrencyCode = "INVALID AMOUNT";
321 }
322 try {
323 this.invoiceItemDiscountAmount = ei.getInvoiceDiscountAmount(eio);
324 this.invoiceItemDiscountCurrencyCode = ei.getInvoiceDiscountCurrencyIfNotValid(eio);
325 }
326 catch (Exception e) {
327 this.invoiceItemDiscountAmount = null;
328 this.invoiceItemDiscountCurrencyCode = "INVALID AMOUNT";
329 }
330 try {
331 this.invoiceItemNetAmount = ei.getInvoiceNetAmount(eio);
332 this.invoiceItemNetCurrencyCode = ei.getInvoiceNetCurrencyIfNotValid(eio);
333 }
334 catch (Exception e) {
335 this.invoiceItemNetAmount = null;
336 this.invoiceItemNetCurrencyCode = "INVALID AMOUNT";
337 }
338
339 for (ElectronicInvoiceItem eii : eio.getInvoiceItems()) {
340 ElectronicInvoiceRejectItem eiri = new ElectronicInvoiceRejectItem(this, eii);
341 this.invoiceRejectItems.add(eiri);
342 }
343
344 for (ElectronicInvoiceRejectReason eirr : eio.getOrderRejectReasons()) {
345 eirr.setElectronicInvoiceRejectDocument(this);
346 this.invoiceRejectReasons.add(eirr);
347 }
348 }
349
350 /**
351 * @see org.kuali.rice.kns.document.DocumentBase#getDocumentTitle()
352 */
353 @Override
354 public String getDocumentTitle() {
355 if (SpringContext.getBean(ParameterService.class).getIndicatorParameter(ElectronicInvoiceRejectDocument.class, PurapParameterConstants.PURAP_OVERRIDE_EIRT_DOC_TITLE)) {
356 return getCustomDocumentTitle();
357 }
358
359 return this.buildDocumentTitle(super.getDocumentTitle());
360 }
361
362 /**
363 * Returns a custom document title based on the properties of current document..
364 *
365 * @return - Customized document title.
366 */
367 protected String getCustomDocumentTitle() {
368 String poID = StringUtils.isEmpty(getInvoicePurchaseOrderNumber()) ? "UNKNOWN" : getInvoicePurchaseOrderNumber();
369 String researchInd = isInvoiceResearchIndicator() ? "Y" : "N";
370
371 // if this method is called when EIRT doc is just created, vendorDetail is not set yet, need to retrieve from DB
372 VendorDetail vendorDetail = getVendorDetail();
373 Integer headerId = getVendorHeaderGeneratedIdentifier();
374 Integer detailId = getVendorDetailAssignedIdentifier();
375 if (vendorDetail == null && headerId != null && detailId != null) {
376 vendorDetail = SpringContext.getBean(VendorService.class).getVendorDetail(headerId, detailId);
377 }
378 String vendorName = vendorDetail == null || StringUtils.isEmpty(vendorDetail.getVendorName()) ? "UNKNOWN" : vendorDetail.getVendorName();
379
380 //set title to: Vendor: <Vendor's Name> PO: <PO#> <Research Indicator>
381 String documentTitle = "Vendor: " + vendorName + " PO: " + poID + " " + researchInd;
382 return documentTitle;
383 }
384
385 /**
386 * Builds document title based on the properties of current document.
387 *
388 * @param the default document title
389 * @return the combine information of the given title and additional payment indicators
390 */
391 protected String buildDocumentTitle(String title) {
392 if(this.getVendorDetail() == null) {
393 return title;
394 }
395
396 Integer vendorHeaderGeneratedIdentifier = this.getVendorDetail().getVendorHeaderGeneratedIdentifier();
397 VendorService vendorService = SpringContext.getBean(VendorService.class);
398
399 Object[] indicators = new String[2];
400
401 boolean isEmployeeVendor = vendorService.isVendorInstitutionEmployee(vendorHeaderGeneratedIdentifier);
402 indicators[0] = isEmployeeVendor ? AdHocPaymentIndicator.EMPLOYEE_VENDOR : AdHocPaymentIndicator.OTHER;
403
404 boolean isVendorForeign = vendorService.isVendorForeign(vendorHeaderGeneratedIdentifier);
405 indicators[1] = isVendorForeign ? AdHocPaymentIndicator.ALIEN_VENDOR : AdHocPaymentIndicator.OTHER;
406
407 for(Object indicator : indicators) {
408 if(!AdHocPaymentIndicator.OTHER.equals(indicator)) {
409 String titlePattern = title + " [{0}:{1}]";
410 return MessageFormat.format(titlePattern, indicators);
411 }
412 }
413
414 return title;
415 }
416
417 protected ElectronicInvoicePostalAddress getCxmlPostalAddressByAddressName(ElectronicInvoiceContact contact, String addressName) {
418 if (contact != null) {
419 for (ElectronicInvoicePostalAddress cpa : contact.getPostalAddresses()) {
420 if (addressName == null) {
421 return cpa;
422 }
423 else {
424 if (addressName.equalsIgnoreCase(cpa.getName())) {
425 return cpa;
426 }
427 }
428 }
429 }
430 return null;
431 }
432
433 public KualiDecimal getTotalAmount() {
434 KualiDecimal returnValue = new KualiDecimal(zero);
435 try {
436 for (ElectronicInvoiceRejectItem eiri : this.invoiceRejectItems) {
437 BigDecimal toAddAmount1 = eiri.getInvoiceItemSubTotalAmount();
438 KualiDecimal toAddAmount = KualiDecimal.ZERO;
439 if (toAddAmount1 != null) {
440 toAddAmount = new KualiDecimal(toAddAmount1.setScale(KualiDecimal.SCALE, KualiDecimal.ROUND_BEHAVIOR));
441 }
442 LOG.debug("getTotalAmount() setting returnValue with arithmatic => '" + returnValue.doubleValue() + "' + '" + toAddAmount.doubleValue() + "'");
443 returnValue = returnValue.add(toAddAmount);
444 }
445 LOG.debug("getTotalAmount() returning amount " + returnValue.doubleValue());
446 return returnValue;
447 }
448 catch (NumberFormatException n) {
449 // do nothing this is already rejected
450 LOG.error("getTotalAmount() Error attempting to calculate total amount for invoice with filename " + this.invoiceFileName);
451 return new KualiDecimal(zero);
452 }
453 }
454
455 public void setTotalAmount(KualiDecimal amount) {
456 // ignore this
457 }
458
459 public KualiDecimal getGrandTotalAmount() {
460 KualiDecimal returnValue = new KualiDecimal(zero);
461 try {
462 for (ElectronicInvoiceRejectItem eiri : this.invoiceRejectItems) {
463 KualiDecimal toAddAmount = new KualiDecimal(eiri.getInvoiceItemNetAmount());
464 LOG.debug("getTotalAmount() setting returnValue with arithmatic => '" + returnValue.doubleValue() + "' + '" + toAddAmount.doubleValue() + "'");
465 returnValue = returnValue.add(toAddAmount);
466 }
467 LOG.debug("getTotalAmount() returning amount " + returnValue.doubleValue());
468
469 if (this.getInvoiceItemSpecialHandlingAmount() != null && zero.compareTo(this.getInvoiceItemSpecialHandlingAmount()) != 0) {
470 returnValue = returnValue.add(new KualiDecimal(this.getInvoiceItemSpecialHandlingAmount()));
471 }
472 if (this.getInvoiceItemShippingAmount() != null && zero.compareTo(this.getInvoiceItemShippingAmount()) != 0) {
473 returnValue = returnValue.add(new KualiDecimal(this.getInvoiceItemShippingAmount()));
474 }
475 // if (this.getInvoiceItemTaxAmount() != null && zero.compareTo(this.getInvoiceItemTaxAmount()) != 0) {
476 // returnValue = returnValue.add(new KualiDecimal(this.getInvoiceItemTaxAmount()));
477 // }
478 if (this.getInvoiceItemDiscountAmount() != null && zero.compareTo(this.getInvoiceItemDiscountAmount()) != 0) {
479 returnValue = returnValue.subtract(new KualiDecimal(this.getInvoiceItemDiscountAmount()));
480 }
481 LOG.debug("getGrandTotalAmount() returning amount " + returnValue.doubleValue());
482 return returnValue;
483 }
484 catch (NumberFormatException n) {
485 // do nothing this is already rejected
486 LOG.error("getTotalAmount() Error attempting to calculate total amount for invoice with filename " + this.invoiceFileName);
487 return new KualiDecimal(zero);
488 }
489 }
490
491 public void setGrandTotalAmount(KualiDecimal amount) {
492 // ignore this
493 }
494
495 /**
496 * @return Returns the invoiceLoadSummaryIdentifier.
497 */
498 public Integer getInvoiceLoadSummaryIdentifier() {
499 return invoiceLoadSummaryIdentifier;
500 }
501
502 /**
503 * @param invoiceLoadSummaryIdentifier The invoiceLoadSummaryIdentifier to set.
504 */
505 public void setInvoiceLoadSummaryIdentifier(Integer loadSummaryId) {
506 this.invoiceLoadSummaryIdentifier = loadSummaryId;
507 }
508
509 public PurchaseOrderDocument getCurrentPurchaseOrderDocument() {
510
511 if (StringUtils.isEmpty(getInvoicePurchaseOrderNumber()) ||
512 !NumberUtils.isDigits(getInvoicePurchaseOrderNumber())){
513 currentPurchaseOrderDocument = null;
514 }else if (currentPurchaseOrderDocument == null) {
515 currentPurchaseOrderDocument = SpringContext.getBean(PurchaseOrderService.class).getCurrentPurchaseOrder(new Integer(getInvoicePurchaseOrderNumber()));
516 }else if (!StringUtils.equals(getInvoicePurchaseOrderNumber(), currentPurchaseOrderDocument.getPurapDocumentIdentifier().toString())){
517 currentPurchaseOrderDocument = SpringContext.getBean(PurchaseOrderService.class).getCurrentPurchaseOrder(new Integer(getInvoicePurchaseOrderNumber()));
518 }
519
520 return currentPurchaseOrderDocument;
521 }
522
523 public VendorDetail getVendorDetail() {
524 return vendorDetail;
525 }
526
527 public void setVendorDetail(VendorDetail vendorDetail) {
528 this.vendorDetail = vendorDetail;
529 }
530
531 /**
532 * @return Returns the invoiceLoadSummary.
533 */
534 public ElectronicInvoiceLoadSummary getInvoiceLoadSummary() {
535 return invoiceLoadSummary;
536 }
537
538 /**
539 * @param invoiceLoadSummary The invoiceLoadSummary to set.
540 */
541 public void setInvoiceLoadSummary(ElectronicInvoiceLoadSummary electronicInvoiceLoadSummary) {
542 this.invoiceLoadSummary = electronicInvoiceLoadSummary;
543 this.invoiceLoadSummaryIdentifier = electronicInvoiceLoadSummary.getInvoiceLoadSummaryIdentifier();
544 }
545
546 /**
547 * @return Returns the invoiceBillToAddressCityName.
548 */
549 public String getInvoiceBillToAddressCityName() {
550 return invoiceBillToAddressCityName;
551 }
552
553 /**
554 * @param invoiceBillToAddressCityName The invoiceBillToAddressCityName to set.
555 */
556 public void setInvoiceBillToAddressCityName(String billToAddressCityName) {
557 this.invoiceBillToAddressCityName = billToAddressCityName;
558 }
559
560 /**
561 * @return Returns the invoiceBillToAddressCountryCode.
562 */
563 public String getInvoiceBillToAddressCountryCode() {
564 return invoiceBillToAddressCountryCode;
565 }
566
567 /**
568 * @param invoiceBillToAddressCountryCode The invoiceBillToAddressCountryCode to set.
569 */
570 public void setInvoiceBillToAddressCountryCode(String billToAddressCountryCode) {
571 this.invoiceBillToAddressCountryCode = billToAddressCountryCode;
572 }
573
574 /**
575 * @return Returns the invoiceBillToAddressCountryName.
576 */
577 public String getInvoiceBillToAddressCountryName() {
578 return invoiceBillToAddressCountryName;
579 }
580
581 /**
582 * @param invoiceBillToAddressCountryName The invoiceBillToAddressCountryName to set.
583 */
584 public void setInvoiceBillToAddressCountryName(String billToAddressCountryName) {
585 this.invoiceBillToAddressCountryName = billToAddressCountryName;
586 }
587
588 /**
589 * @return Returns the invoiceBillToAddressLine1.
590 */
591 public String getInvoiceBillToAddressLine1() {
592 return invoiceBillToAddressLine1;
593 }
594
595 /**
596 * @param invoiceBillToAddressLine1 The invoiceBillToAddressLine1 to set.
597 */
598 public void setInvoiceBillToAddressLine1(String billToAddressLine1) {
599 this.invoiceBillToAddressLine1 = billToAddressLine1;
600 }
601
602 /**
603 * @return Returns the invoiceBillToAddressLine2.
604 */
605 public String getInvoiceBillToAddressLine2() {
606 return invoiceBillToAddressLine2;
607 }
608
609 /**
610 * @param invoiceBillToAddressLine2 The invoiceBillToAddressLine2 to set.
611 */
612 public void setInvoiceBillToAddressLine2(String billToAddressLine2) {
613 this.invoiceBillToAddressLine2 = billToAddressLine2;
614 }
615
616 /**
617 * @return Returns the invoiceBillToAddressLine3.
618 */
619 public String getInvoiceBillToAddressLine3() {
620 return invoiceBillToAddressLine3;
621 }
622
623 /**
624 * @param invoiceBillToAddressLine3 The invoiceBillToAddressLine3 to set.
625 */
626 public void setInvoiceBillToAddressLine3(String billToAddressLine3) {
627 this.invoiceBillToAddressLine3 = billToAddressLine3;
628 }
629
630 /**
631 * @return Returns the invoiceBillToAddressName.
632 */
633 public String getInvoiceBillToAddressName() {
634 return invoiceBillToAddressName;
635 }
636
637 /**
638 * @param invoiceBillToAddressName The invoiceBillToAddressName to set.
639 */
640 public void setInvoiceBillToAddressName(String billToAddressName) {
641 this.invoiceBillToAddressName = billToAddressName;
642 }
643
644 /**
645 * @return Returns the invoiceBillToAddressPostalCode.
646 */
647 public String getInvoiceBillToAddressPostalCode() {
648 return invoiceBillToAddressPostalCode;
649 }
650
651 /**
652 * @param invoiceBillToAddressPostalCode The invoiceBillToAddressPostalCode to set.
653 */
654 public void setInvoiceBillToAddressPostalCode(String billToAddressPostalCode) {
655 this.invoiceBillToAddressPostalCode = billToAddressPostalCode;
656 }
657
658 /**
659 * @return Returns the invoiceBillToAddressStateCode.
660 */
661 public String getInvoiceBillToAddressStateCode() {
662 return invoiceBillToAddressStateCode;
663 }
664
665 /**
666 * @param invoiceBillToAddressStateCode The invoiceBillToAddressStateCode to set.
667 */
668 public void setInvoiceBillToAddressStateCode(String billToAddressStateCode) {
669 this.invoiceBillToAddressStateCode = billToAddressStateCode;
670 }
671
672 /**
673 * @return Returns the invoiceBillToAddressType.
674 */
675 public String getInvoiceBillToAddressType() {
676 return invoiceBillToAddressType;
677 }
678
679 /**
680 * @param invoiceBillToAddressType The invoiceBillToAddressType to set.
681 */
682 public void setInvoiceBillToAddressType(String billToAddressType) {
683 this.invoiceBillToAddressType = billToAddressType;
684 }
685
686 /**
687 * @return Returns the invoiceFileDeploymentModeValue.
688 */
689 public String getInvoiceFileDeploymentModeValue() {
690 return invoiceFileDeploymentModeValue;
691 }
692
693 /**
694 * @param invoiceFileDeploymentModeValue The invoiceFileDeploymentModeValue to set.
695 */
696 public void setInvoiceFileDeploymentModeValue(String deploymentMode) {
697 this.invoiceFileDeploymentModeValue = deploymentMode;
698 }
699
700 /**
701 * @return Returns the invoiceRejectItems.
702 */
703 public List<ElectronicInvoiceRejectItem> getInvoiceRejectItems() {
704 return invoiceRejectItems;
705 }
706
707 /**
708 * @param invoiceRejectItems The invoiceRejectItems to set.
709 */
710 public void setInvoiceRejectItems(List<ElectronicInvoiceRejectItem> electronicInvoiceRejectItems) {
711 this.invoiceRejectItems = electronicInvoiceRejectItems;
712 }
713
714 public ElectronicInvoiceRejectItem getInvoiceRejectItem(int index) {
715 while (getInvoiceRejectItems().size() <= index) {
716 getInvoiceRejectItems().add(new ElectronicInvoiceRejectItem());
717 }
718 return (ElectronicInvoiceRejectItem) getInvoiceRejectItems().get(index);
719 }
720
721 /**
722 * @return Returns the invoiceRejectReasons.
723 */
724 public List<ElectronicInvoiceRejectReason> getInvoiceRejectReasons() {
725 return invoiceRejectReasons;
726 }
727
728 /**
729 * @param invoiceRejectReasons The invoiceRejectReasons to set.
730 */
731 public void setInvoiceRejectReasons(List<ElectronicInvoiceRejectReason> electronicInvoiceRejectReasons) {
732 this.invoiceRejectReasons = electronicInvoiceRejectReasons;
733 }
734
735 public ElectronicInvoiceRejectReason getInvoiceRejectReason(int index) {
736 while (getInvoiceRejectReasons().size() <= index) {
737 getInvoiceRejectReasons().add(new ElectronicInvoiceRejectReason());
738 }
739 return (ElectronicInvoiceRejectReason) getInvoiceRejectReasons().get(index);
740 }
741
742 /**
743 * Gets the paymentRequestIdentifier attribute.
744 * @return Returns the paymentRequestIdentifier.
745 */
746 public Integer getPaymentRequestIdentifier() {
747 return paymentRequestIdentifier;
748 }
749
750 /**
751 * Sets the paymentRequestIdentifier attribute value.
752 * @param paymentRequestIdentifier The paymentRequestIdentifier to set.
753 */
754 public void setPaymentRequestIdentifier(Integer paymentRequestIdentifier) {
755 this.paymentRequestIdentifier = paymentRequestIdentifier;
756 }
757
758 /**
759 * @return Returns the purchaseOrderDeliveryCampusCode.
760 */
761 public String getPurchaseOrderDeliveryCampusCode() {
762 return purchaseOrderDeliveryCampusCode;
763 }
764
765 /**
766 * @param purchaseOrderDeliveryCampusCode The purchaseOrderDeliveryCampusCode to set.
767 */
768 public void setPurchaseOrderDeliveryCampusCode(String poDeliveryCampusCode) {
769 this.purchaseOrderDeliveryCampusCode = poDeliveryCampusCode;
770 }
771
772 /**
773 * @return Returns the purchaseOrderIdentifier.
774 */
775 public Integer getPurchaseOrderIdentifier() {
776 return purchaseOrderIdentifier;
777 }
778
779 /**
780 * @param purchaseOrderIdentifier The purchaseOrderIdentifier to set.
781 */
782 public void setPurchaseOrderIdentifier(Integer purchaseOrderId) {
783 this.purchaseOrderIdentifier = purchaseOrderId;
784 }
785
786 /**
787 * @return Returns the invoiceFileDiscountInLineIndicator.
788 */
789 public Boolean getInvoiceFileDiscountInLineIndicator() {
790 return invoiceFileDiscountInLineIndicator;
791 }
792
793 public Boolean isInvoiceFileDiscountInLineIndicator() {
794 return invoiceFileDiscountInLineIndicator;
795 }
796
797 /**
798 * @param invoiceFileDiscountInLineIndicator The invoiceFileDiscountInLineIndicator to set.
799 */
800 public void setInvoiceFileDiscountInLineIndicator(Boolean fileDiscountInLineIndicator) {
801 this.invoiceFileDiscountInLineIndicator = fileDiscountInLineIndicator;
802 }
803
804 /**
805 * @return Returns the invoiceFileHeaderTypeIndicator.
806 */
807 public Boolean getInvoiceFileHeaderTypeIndicator() {
808 return invoiceFileHeaderTypeIndicator;
809 }
810
811 public Boolean isInvoiceFileHeaderTypeIndicator() {
812 return invoiceFileHeaderTypeIndicator;
813 }
814
815 /**
816 * @param invoiceFileHeaderTypeIndicator The invoiceFileHeaderTypeIndicator to set.
817 */
818 public void setInvoiceFileHeaderTypeIndicator(Boolean fileHeaderTypeIndicator) {
819 this.invoiceFileHeaderTypeIndicator = fileHeaderTypeIndicator;
820 }
821
822 /**
823 * @return Returns the invoiceFileInformationOnlyIndicator.
824 */
825 public Boolean getInvoiceFileInformationOnlyIndicator() {
826 return invoiceFileInformationOnlyIndicator;
827 }
828
829 public Boolean isInvoiceFileInformationOnlyIndicator() {
830 return invoiceFileInformationOnlyIndicator;
831 }
832
833 /**
834 * @param invoiceFileInformationOnlyIndicator The invoiceFileInformationOnlyIndicator to set.
835 */
836 public void setInvoiceFileInformationOnlyIndicator(Boolean fileInformationOnlyIndicator) {
837 this.invoiceFileInformationOnlyIndicator = fileInformationOnlyIndicator;
838 }
839
840 /**
841 * @return Returns the invoiceFileOperationIdentifier.
842 */
843 public String getInvoiceFileOperationIdentifier() {
844 return invoiceFileOperationIdentifier;
845 }
846
847 /**
848 * @param invoiceFileOperationIdentifier The invoiceFileOperationIdentifier to set.
849 */
850 public void setInvoiceFileOperationIdentifier(String fileOperationId) {
851 this.invoiceFileOperationIdentifier = fileOperationId;
852 }
853
854 /**
855 * @return Returns the invoiceFilePurposeIdentifier.
856 */
857 public String getInvoiceFilePurposeIdentifier() {
858 return invoiceFilePurposeIdentifier;
859 }
860
861 /**
862 * @param invoiceFilePurposeIdentifier The invoiceFilePurposeIdentifier to set.
863 */
864 public void setInvoiceFilePurposeIdentifier(String filePurposeId) {
865 this.invoiceFilePurposeIdentifier = filePurposeId;
866 }
867
868 /**
869 * @return Returns the invoiceFileShippingInLineIndicator.
870 */
871 public Boolean getInvoiceFileShippingInLineIndicator() {
872 return invoiceFileShippingInLineIndicator;
873 }
874
875 public Boolean isInvoiceFileShippingInLineIndicator() {
876 return invoiceFileShippingInLineIndicator;
877 }
878
879 /**
880 * @param invoiceFileShippingInLineIndicator The invoiceFileShippingInLineIndicator to set.
881 */
882 public void setInvoiceFileShippingInLineIndicator(Boolean fileShippingInLineIndicator) {
883 this.invoiceFileShippingInLineIndicator = fileShippingInLineIndicator;
884 }
885
886 /**
887 * @return Returns the invoiceFileSpecialHandlingInLineIndicator.
888 */
889 public Boolean getInvoiceFileSpecialHandlingInLineIndicator() {
890 return invoiceFileSpecialHandlingInLineIndicator;
891 }
892
893 public Boolean isInvoiceFileSpecialHandlingInLineIndicator() {
894 return invoiceFileSpecialHandlingInLineIndicator;
895 }
896
897 /**
898 * @param invoiceFileSpecialHandlingInLineIndicator The invoiceFileSpecialHandlingInLineIndicator to set.
899 */
900 public void setInvoiceFileSpecialHandlingInLineIndicator(Boolean fileSpecHandlingInLineIndicator) {
901 this.invoiceFileSpecialHandlingInLineIndicator = fileSpecHandlingInLineIndicator;
902 }
903
904 /**
905 * @return Returns the invoiceFileTaxInLineIndicator.
906 */
907 public Boolean getInvoiceFileTaxInLineIndicator() {
908 return invoiceFileTaxInLineIndicator;
909 }
910
911 public Boolean isInvoiceFileTaxInLineIndicator() {
912 return invoiceFileTaxInLineIndicator;
913 }
914
915 /**
916 * @param invoiceFileTaxInLineIndicator The invoiceFileTaxInLineIndicator to set.
917 */
918 public void setInvoiceFileTaxInLineIndicator(Boolean fileTaxInLineIndicator) {
919 this.invoiceFileTaxInLineIndicator = fileTaxInLineIndicator;
920 }
921
922 /**
923 * @return Returns the purapDocumentIdentifier.
924 */
925 public Integer getPurapDocumentIdentifier() {
926 return purapDocumentIdentifier;
927 }
928
929 /**
930 * @param purapDocumentIdentifier The purapDocumentIdentifier to set.
931 */
932 public void setPurapDocumentIdentifier(Integer id) {
933 this.purapDocumentIdentifier = id;
934 }
935
936 public Integer getAccountsPayablePurchasingDocumentLinkIdentifier() {
937 return accountsPayablePurchasingDocumentLinkIdentifier;
938 }
939
940 public void setAccountsPayablePurchasingDocumentLinkIdentifier(Integer accountsPayablePurchasingDocumentLinkIdentifier) {
941 this.accountsPayablePurchasingDocumentLinkIdentifier = accountsPayablePurchasingDocumentLinkIdentifier;
942 }
943
944 /**
945 * @return Returns the invoiceCustomerNumber.
946 */
947 public String getInvoiceCustomerNumber() {
948 return invoiceCustomerNumber;
949 }
950
951 /**
952 * @param invoiceCustomerNumber The invoiceCustomerNumber to set.
953 */
954 public void setInvoiceCustomerNumber(String invoiceCustomerNumber) {
955 this.invoiceCustomerNumber = invoiceCustomerNumber;
956 }
957
958 /**
959 * @return Returns the invoiceFileDate.
960 */
961 public String getInvoiceFileDate() {
962 return invoiceFileDate;
963 }
964
965 /**
966 * @param invoiceFileDate The invoiceFileDate to set.
967 */
968 public void setInvoiceFileDate(String invoiceDate) {
969 this.invoiceFileDate = invoiceDate;
970 }
971
972 /**
973 * @return Returns the invoiceItemDiscountAmount.
974 */
975 public BigDecimal getInvoiceItemDiscountAmount() {
976 if (this.isInvoiceFileDiscountInLineIndicator()) {
977 BigDecimal returnValue = zero;
978 try {
979 for (ElectronicInvoiceRejectItem eiri : this.invoiceRejectItems) {
980 BigDecimal toAddAmount = eiri.getInvoiceItemDiscountAmount();
981 LOG.debug("getTotalAmount() setting returnValue with arithmatic => '" + returnValue.doubleValue() + "' + '" + toAddAmount.doubleValue() + "'");
982 returnValue = returnValue.add(toAddAmount);
983 }
984 LOG.debug("getTotalAmount() returning amount " + returnValue.doubleValue());
985 return returnValue;
986 }
987 catch (NumberFormatException n) {
988 // do nothing this is already rejected
989 LOG.error("getTotalAmount() Error attempting to calculate total amount for invoice with filename " + this.invoiceFileName);
990 return zero;
991 }
992 }
993 else {
994 return invoiceItemDiscountAmount;
995 }
996 }
997
998 /**
999 * @param invoiceItemDiscountAmount The invoiceItemDiscountAmount to set.
1000 */
1001 public void setInvoiceItemDiscountAmount(BigDecimal invoiceDiscountAmount) {
1002 this.invoiceItemDiscountAmount = invoiceDiscountAmount;
1003 }
1004
1005 /**
1006 * @return Returns the invoiceItemDiscountCurrencyCode.
1007 */
1008 public String getInvoiceItemDiscountCurrencyCode() {
1009 return invoiceItemDiscountCurrencyCode;
1010 }
1011
1012 /**
1013 * @param invoiceItemDiscountCurrencyCode The invoiceItemDiscountCurrencyCode to set.
1014 */
1015 public void setInvoiceItemDiscountCurrencyCode(String invoiceDiscountAmountCurrency) {
1016 this.invoiceItemDiscountCurrencyCode = invoiceDiscountAmountCurrency;
1017 }
1018
1019 /**
1020 * @return Returns the invoiceFileName.
1021 */
1022 public String getInvoiceFileName() {
1023 return invoiceFileName;
1024 }
1025
1026 /**
1027 * @param invoiceFileName The invoiceFileName to set.
1028 */
1029 public void setInvoiceFileName(String invoiceFileName) {
1030 this.invoiceFileName = invoiceFileName;
1031 }
1032
1033 /**
1034 * @return Returns the invoiceItemGrossAmount.
1035 */
1036 public BigDecimal getInvoiceItemGrossAmount() {
1037 return invoiceItemGrossAmount;
1038 }
1039
1040 /**
1041 * @param invoiceItemGrossAmount The invoiceItemGrossAmount to set.
1042 */
1043 public void setInvoiceItemGrossAmount(BigDecimal invoiceGrossAmount) {
1044 this.invoiceItemGrossAmount = invoiceGrossAmount;
1045 }
1046
1047 /**
1048 * @return Returns the invoiceItemGrossCurrencyCode.
1049 */
1050 public String getInvoiceItemGrossCurrencyCode() {
1051 return invoiceItemGrossCurrencyCode;
1052 }
1053
1054 /**
1055 * @param invoiceItemGrossCurrencyCode The invoiceItemGrossCurrencyCode to set.
1056 */
1057 public void setInvoiceItemGrossCurrencyCode(String invoiceGrossAmountCurrency) {
1058 this.invoiceItemGrossCurrencyCode = invoiceGrossAmountCurrency;
1059 }
1060
1061 /**
1062 * @return Returns the invoiceItemNetAmount.
1063 */
1064 public BigDecimal getInvoiceItemNetAmount() {
1065 return invoiceItemNetAmount;
1066 }
1067
1068 /**
1069 * @param invoiceItemNetAmount The invoiceItemNetAmount to set.
1070 */
1071 public void setInvoiceItemNetAmount(BigDecimal invoiceNetAmount) {
1072 this.invoiceItemNetAmount = invoiceNetAmount;
1073 }
1074
1075 public boolean isInvoiceNumberAcceptIndicator() {
1076 return invoiceNumberAcceptIndicator;
1077 }
1078
1079 public void setInvoiceNumberAcceptIndicator(boolean invoiceNumberAcceptIndicator) {
1080 this.invoiceNumberAcceptIndicator = invoiceNumberAcceptIndicator;
1081 }
1082
1083 public boolean isInvoiceResearchIndicator() {
1084 return invoiceResearchIndicator;
1085 }
1086
1087 public boolean getInvoiceResearchIndicator() {
1088 return invoiceResearchIndicator;
1089 }
1090
1091 public void setInvoiceResearchIndicator(boolean invoiceResearchIndicator) {
1092 this.invoiceResearchIndicator = invoiceResearchIndicator;
1093 }
1094
1095 public Timestamp getAccountsPayableApprovalTimestamp() {
1096 return accountsPayableApprovalTimestamp;
1097 }
1098
1099 public void setAccountsPayableApprovalTimestamp(Timestamp accountsPayableApprovalTimestamp) {
1100 this.accountsPayableApprovalTimestamp = accountsPayableApprovalTimestamp;
1101 }
1102
1103 /**
1104 * @return Returns the invoiceItemNetCurrencyCode.
1105 */
1106 public String getInvoiceItemNetCurrencyCode() {
1107 return invoiceItemNetCurrencyCode;
1108 }
1109
1110 /**
1111 * @param invoiceItemNetCurrencyCode The invoiceItemNetCurrencyCode to set.
1112 */
1113 public void setInvoiceItemNetCurrencyCode(String invoiceNetAmountCurrency) {
1114 this.invoiceItemNetCurrencyCode = invoiceNetAmountCurrency;
1115 }
1116
1117 /**
1118 * @return Returns the invoiceFileNumber.
1119 */
1120 public String getInvoiceFileNumber() {
1121 return invoiceFileNumber;
1122 }
1123
1124 /**
1125 * @param invoiceFileNumber The invoiceFileNumber to set.
1126 */
1127 public void setInvoiceFileNumber(String invoiceNumber) {
1128 this.invoiceFileNumber = invoiceNumber;
1129 }
1130
1131 /**
1132 * @return Returns the invoiceOrderPurchaseOrderDate.
1133 */
1134 public String getInvoiceOrderPurchaseOrderDate() {
1135 return invoiceOrderPurchaseOrderDate;
1136 }
1137
1138 /**
1139 * @param invoiceOrderPurchaseOrderDate The invoiceOrderPurchaseOrderDate to set.
1140 */
1141 public void setInvoiceOrderPurchaseOrderDate(String invoiceOrderDate) {
1142 this.invoiceOrderPurchaseOrderDate = invoiceOrderDate;
1143 }
1144
1145 /**
1146 * @return Returns the invoiceOrderPurchaseOrderIdentifier.
1147 */
1148 public String getInvoiceOrderPurchaseOrderIdentifier() {
1149 return invoiceOrderPurchaseOrderIdentifier;
1150 }
1151
1152 /**
1153 * @param invoiceOrderPurchaseOrderIdentifier The invoiceOrderPurchaseOrderIdentifier to set.
1154 */
1155 public void setInvoiceOrderPurchaseOrderIdentifier(String invoiceOrderId) {
1156 this.invoiceOrderPurchaseOrderIdentifier = invoiceOrderId;
1157 }
1158
1159 /**
1160 * @return Returns the invoiceProcessTimestamp.
1161 */
1162 public Timestamp getInvoiceProcessTimestamp() {
1163 return invoiceProcessTimestamp;
1164 }
1165
1166 /**
1167 * @param invoiceProcessTimestamp The invoiceProcessTimestamp to set.
1168 */
1169 public void setInvoiceProcessTimestamp(Timestamp invoiceProcessTimestamp) {
1170 this.invoiceProcessTimestamp = invoiceProcessTimestamp;
1171 }
1172
1173 /**
1174 * @return Returns the invoicePurchaseOrderNumber.
1175 */
1176 public String getInvoicePurchaseOrderNumber() {
1177 return invoicePurchaseOrderNumber;
1178 }
1179
1180 /**
1181 * @param invoicePurchaseOrderNumber The invoicePurchaseOrderNumber to set.
1182 */
1183 public void setInvoicePurchaseOrderNumber(String invoicePurchaseOrderId) {
1184 this.invoicePurchaseOrderNumber = invoicePurchaseOrderId;
1185 }
1186
1187 /**
1188 * @return Returns the invoiceShipDate.
1189 */
1190 public String getInvoiceShipDate() {
1191 return invoiceShipDate;
1192 }
1193
1194 /**
1195 * @param invoiceShipDate The invoiceShipDate to set.
1196 */
1197 public void setInvoiceShipDate(String invoiceShipDate) {
1198 this.invoiceShipDate = invoiceShipDate;
1199 }
1200
1201 /**
1202 * @return Returns the invoiceItemShippingAmount.
1203 */
1204 public BigDecimal getInvoiceItemShippingAmount() {
1205 if (this.isInvoiceFileShippingInLineIndicator()) {
1206 BigDecimal returnValue = zero;
1207 try {
1208 for (ElectronicInvoiceRejectItem eiri : this.invoiceRejectItems) {
1209 BigDecimal toAddAmount = eiri.getInvoiceItemShippingAmount();
1210 LOG.debug("getTotalAmount() setting returnValue with arithmatic => '" + returnValue.doubleValue() + "' + '" + toAddAmount.doubleValue() + "'");
1211 returnValue = returnValue.add(toAddAmount);
1212 }
1213 LOG.debug("getTotalAmount() returning amount " + returnValue.doubleValue());
1214 return returnValue;
1215 }
1216 catch (NumberFormatException n) {
1217 // do nothing this is already rejected
1218 LOG.error("getTotalAmount() Error attempting to calculate total amount for invoice with filename " + this.invoiceFileName);
1219 return zero;
1220 }
1221 }
1222 else {
1223 return invoiceItemShippingAmount;
1224 }
1225 }
1226
1227 /**
1228 * @param invoiceItemShippingAmount The invoiceItemShippingAmount to set.
1229 */
1230 public void setInvoiceItemShippingAmount(BigDecimal invoiceShippingAmount) {
1231 this.invoiceItemShippingAmount = invoiceShippingAmount;
1232 }
1233
1234 /**
1235 * @return Returns the invoiceItemShippingCurrencyCode.
1236 */
1237 public String getInvoiceItemShippingCurrencyCode() {
1238 return invoiceItemShippingCurrencyCode;
1239 }
1240
1241 /**
1242 * @param invoiceItemShippingCurrencyCode The invoiceItemShippingCurrencyCode to set.
1243 */
1244 public void setInvoiceItemShippingCurrencyCode(String invoiceShippingAmountCurrency) {
1245 this.invoiceItemShippingCurrencyCode = invoiceShippingAmountCurrency;
1246 }
1247
1248 /**
1249 * @return Returns the invoiceItemShippingDescription.
1250 */
1251 public String getInvoiceItemShippingDescription() {
1252 return invoiceItemShippingDescription;
1253 }
1254
1255 /**
1256 * @param invoiceItemShippingDescription The invoiceItemShippingDescription to set.
1257 */
1258 public void setInvoiceItemShippingDescription(String invoiceShippingDescription) {
1259 this.invoiceItemShippingDescription = invoiceShippingDescription;
1260 }
1261
1262 /**
1263 * @return Returns the invoiceItemSpecialHandlingAmount.
1264 */
1265 public BigDecimal getInvoiceItemSpecialHandlingAmount() {
1266 if (this.isInvoiceFileSpecialHandlingInLineIndicator()) {
1267 BigDecimal returnValue = zero;
1268 try {
1269 for (ElectronicInvoiceRejectItem eiri : this.invoiceRejectItems) {
1270 BigDecimal toAddAmount = eiri.getInvoiceItemSpecialHandlingAmount();
1271 LOG.debug("getTotalAmount() setting returnValue with arithmatic => '" + returnValue.doubleValue() + "' + '" + toAddAmount.doubleValue() + "'");
1272 returnValue = returnValue.add(toAddAmount);
1273 }
1274 LOG.debug("getTotalAmount() returning amount " + returnValue.doubleValue());
1275 return returnValue;
1276 }
1277 catch (NumberFormatException n) {
1278 // do nothing this is already rejected
1279 LOG.error("getTotalAmount() Error attempting to calculate total amount for invoice with filename " + this.invoiceFileName);
1280 return zero;
1281 }
1282 }
1283 else {
1284 return invoiceItemSpecialHandlingAmount;
1285 }
1286 }
1287
1288 /**
1289 * @param invoiceItemSpecialHandlingAmount The invoiceItemSpecialHandlingAmount to set.
1290 */
1291 public void setInvoiceItemSpecialHandlingAmount(BigDecimal invoiceSpecialHandlingAmount) {
1292 this.invoiceItemSpecialHandlingAmount = invoiceSpecialHandlingAmount;
1293 }
1294
1295 /**
1296 * @return Returns the invoiceItemSpecialHandlingCurrencyCode.
1297 */
1298 public String getInvoiceItemSpecialHandlingCurrencyCode() {
1299 return invoiceItemSpecialHandlingCurrencyCode;
1300 }
1301
1302 /**
1303 * @param invoiceItemSpecialHandlingCurrencyCode The invoiceItemSpecialHandlingCurrencyCode to set.
1304 */
1305 public void setInvoiceItemSpecialHandlingCurrencyCode(String invoiceSpecialHandlingAmountCurrency) {
1306 this.invoiceItemSpecialHandlingCurrencyCode = invoiceSpecialHandlingAmountCurrency;
1307 }
1308
1309 /**
1310 * @return the invoiceItemSpecialHandlingDescription
1311 */
1312 public String getInvoiceItemSpecialHandlingDescription() {
1313 return invoiceItemSpecialHandlingDescription;
1314 }
1315
1316 /**
1317 * @param invoiceItemSpecialHandlingDescription the invoiceItemSpecialHandlingDescription to set
1318 */
1319 public void setInvoiceItemSpecialHandlingDescription(String invoiceSpecialHandlingDescription) {
1320 this.invoiceItemSpecialHandlingDescription = invoiceSpecialHandlingDescription;
1321 }
1322
1323 /**
1324 * @return Returns the invoiceItemSubTotalAmount.
1325 */
1326 public BigDecimal getInvoiceItemSubTotalAmount() {
1327
1328 return invoiceItemSubTotalAmount;
1329 }
1330
1331 /**
1332 * @param invoiceItemSubTotalAmount The invoiceItemSubTotalAmount to set.
1333 */
1334 public void setInvoiceItemSubTotalAmount(BigDecimal invoiceSubTotalAmount) {
1335 this.invoiceItemSubTotalAmount = invoiceSubTotalAmount;
1336 }
1337
1338 /**
1339 * @return Returns the invoiceItemSubTotalCurrencyCode.
1340 */
1341 public String getInvoiceItemSubTotalCurrencyCode() {
1342 return invoiceItemSubTotalCurrencyCode;
1343 }
1344
1345 /**
1346 * @param invoiceItemSubTotalCurrencyCode The invoiceItemSubTotalCurrencyCode to set.
1347 */
1348 public void setInvoiceItemSubTotalCurrencyCode(String invoiceSubTotalAmountCurrency) {
1349 this.invoiceItemSubTotalCurrencyCode = invoiceSubTotalAmountCurrency;
1350 }
1351
1352 /**
1353 * @return Returns the invoiceItemTaxAmount.
1354 */
1355 public BigDecimal getInvoiceItemTaxAmount() {
1356 BigDecimal returnValue = zero;
1357 boolean enableSalesTaxInd = SpringContext.getBean(ParameterService.class).getIndicatorParameter(KfsParameterConstants.PURCHASING_DOCUMENT.class, PurapParameterConstants.ENABLE_SALES_TAX_IND);
1358
1359 try {
1360 //if sales tax enabled, calculate total by totaling items
1361 if(enableSalesTaxInd){
1362 for (ElectronicInvoiceRejectItem eiri : this.invoiceRejectItems) {
1363 BigDecimal toAddAmount = eiri.getInvoiceItemTaxAmount();
1364 LOG.debug("getTotalAmount() setting returnValue with arithmatic => '" + returnValue.doubleValue() + "' + '" + toAddAmount.doubleValue() + "'");
1365 returnValue = returnValue.add(toAddAmount);
1366 }
1367 }else{ //else take the total, which should be the summary tax total
1368 returnValue = returnValue.add(this.invoiceItemTaxAmount);
1369 }
1370
1371 LOG.debug("getTotalAmount() returning amount " + returnValue.doubleValue());
1372 return returnValue;
1373 }
1374 catch (NumberFormatException n) {
1375 // do nothing this is already rejected
1376 LOG.error("getTotalAmount() Error attempting to calculate total amount for invoice with filename " + this.invoiceFileName);
1377 return zero;
1378 }
1379 // return invoiceItemTaxAmount;
1380 }
1381
1382 /**
1383 * @param invoiceItemTaxAmount The invoiceItemTaxAmount to set.
1384 */
1385 public void setInvoiceItemTaxAmount(BigDecimal invoiceTaxAmount) {
1386 this.invoiceItemTaxAmount = invoiceTaxAmount;
1387 }
1388
1389 /**
1390 * @return Returns the invoiceItemTaxCurrencyCode.
1391 */
1392 public String getInvoiceItemTaxCurrencyCode() {
1393 return invoiceItemTaxCurrencyCode;
1394 }
1395
1396 /**
1397 * @param invoiceItemTaxCurrencyCode The invoiceItemTaxCurrencyCode to set.
1398 */
1399 public void setInvoiceItemTaxCurrencyCode(String invoiceTaxAmountCurrency) {
1400 this.invoiceItemTaxCurrencyCode = invoiceTaxAmountCurrency;
1401 }
1402
1403 /**
1404 * @return Returns the invoiceItemTaxDescription.
1405 */
1406 public String getInvoiceItemTaxDescription() {
1407 return invoiceItemTaxDescription;
1408 }
1409
1410 /**
1411 * @param invoiceItemTaxDescription The invoiceItemTaxDescription to set.
1412 */
1413 public void setInvoiceItemTaxDescription(String invoiceTaxDescription) {
1414 this.invoiceItemTaxDescription = invoiceTaxDescription;
1415 }
1416
1417 /**
1418 * @return Returns the invoiceOrderMasterAgreementInformationDate.
1419 */
1420 public String getInvoiceOrderMasterAgreementInformationDate() {
1421 return invoiceOrderMasterAgreementInformationDate;
1422 }
1423
1424 /**
1425 * @param invoiceOrderMasterAgreementInformationDate The invoiceOrderMasterAgreementInformationDate to set.
1426 */
1427 public void setInvoiceOrderMasterAgreementInformationDate(String masterAgreementInfoDate) {
1428 this.invoiceOrderMasterAgreementInformationDate = masterAgreementInfoDate;
1429 }
1430
1431 /**
1432 * @return Returns the invoiceOrderMasterAgreementInformationIdentifier.
1433 */
1434 public String getInvoiceOrderMasterAgreementInformationIdentifier() {
1435 return invoiceOrderMasterAgreementInformationIdentifier;
1436 }
1437
1438 /**
1439 * @param invoiceOrderMasterAgreementInformationIdentifier The invoiceOrderMasterAgreementInformationIdentifier to set.
1440 */
1441 public void setInvoiceOrderMasterAgreementInformationIdentifier(String masterAgreementInfoId) {
1442 this.invoiceOrderMasterAgreementInformationIdentifier = masterAgreementInfoId;
1443 }
1444
1445 /**
1446 * @return Returns the invoiceOrderMasterAgreementReferenceDate.
1447 */
1448 public String getInvoiceOrderMasterAgreementReferenceDate() {
1449 return invoiceOrderMasterAgreementReferenceDate;
1450 }
1451
1452 /**
1453 * @param invoiceOrderMasterAgreementReferenceDate The invoiceOrderMasterAgreementReferenceDate to set.
1454 */
1455 public void setInvoiceOrderMasterAgreementReferenceDate(String masterAgreementReferenceDate) {
1456 this.invoiceOrderMasterAgreementReferenceDate = masterAgreementReferenceDate;
1457 }
1458
1459 /**
1460 * @return Returns the invoiceOrderMasterAgreementReferenceIdentifier.
1461 */
1462 public String getInvoiceOrderMasterAgreementReferenceIdentifier() {
1463 return invoiceOrderMasterAgreementReferenceIdentifier;
1464 }
1465
1466 /**
1467 * @param invoiceOrderMasterAgreementReferenceIdentifier The invoiceOrderMasterAgreementReferenceIdentifier to set.
1468 */
1469 public void setInvoiceOrderMasterAgreementReferenceIdentifier(String masterAgreementReferenceId) {
1470 this.invoiceOrderMasterAgreementReferenceIdentifier = masterAgreementReferenceId;
1471 }
1472
1473 /**
1474 * @return Returns the invoiceOrderReferenceDocumentReferencePayloadIdentifier.
1475 */
1476 public String getInvoiceOrderReferenceDocumentReferencePayloadIdentifier() {
1477 return invoiceOrderReferenceDocumentReferencePayloadIdentifier;
1478 }
1479
1480 /**
1481 * @param invoiceOrderReferenceDocumentReferencePayloadIdentifier The invoiceOrderReferenceDocumentReferencePayloadIdentifier to
1482 * set.
1483 */
1484 public void setInvoiceOrderReferenceDocumentReferencePayloadIdentifier(String referenceDocumentRefPayloadId) {
1485 this.invoiceOrderReferenceDocumentReferencePayloadIdentifier = referenceDocumentRefPayloadId;
1486 }
1487
1488 /**
1489 * @return Returns the invoiceOrderReferenceDocumentReferenceText.
1490 */
1491 public String getInvoiceOrderReferenceDocumentReferenceText() {
1492 return invoiceOrderReferenceDocumentReferenceText;
1493 }
1494
1495 /**
1496 * @param invoiceOrderReferenceDocumentReferenceText The invoiceOrderReferenceDocumentReferenceText to set.
1497 */
1498 public void setInvoiceOrderReferenceDocumentReferenceText(String referenceDocumentRefText) {
1499 this.invoiceOrderReferenceDocumentReferenceText = referenceDocumentRefText;
1500 }
1501
1502 /**
1503 * @return Returns the invoiceOrderReferenceOrderIdentifier.
1504 */
1505 public String getInvoiceOrderReferenceOrderIdentifier() {
1506 return invoiceOrderReferenceOrderIdentifier;
1507 }
1508
1509 /**
1510 * @param invoiceOrderReferenceOrderIdentifier The invoiceOrderReferenceOrderIdentifier to set.
1511 */
1512 public void setInvoiceOrderReferenceOrderIdentifier(String referenceOrderId) {
1513 this.invoiceOrderReferenceOrderIdentifier = referenceOrderId;
1514 }
1515
1516 /**
1517 * @return Returns the invoiceRemitToAddressCityName.
1518 */
1519 public String getInvoiceRemitToAddressCityName() {
1520 return invoiceRemitToAddressCityName;
1521 }
1522
1523 /**
1524 * @param invoiceRemitToAddressCityName The invoiceRemitToAddressCityName to set.
1525 */
1526 public void setInvoiceRemitToAddressCityName(String remitToAddressCityName) {
1527 this.invoiceRemitToAddressCityName = remitToAddressCityName;
1528 }
1529
1530 /**
1531 * @return Returns the invoiceRemitToAddressCountryCode.
1532 */
1533 public String getInvoiceRemitToAddressCountryCode() {
1534 return invoiceRemitToAddressCountryCode;
1535 }
1536
1537 /**
1538 * @param invoiceRemitToAddressCountryCode The invoiceRemitToAddressCountryCode to set.
1539 */
1540 public void setInvoiceRemitToAddressCountryCode(String remitToAddressCountryCode) {
1541 this.invoiceRemitToAddressCountryCode = remitToAddressCountryCode;
1542 }
1543
1544 /**
1545 * @return Returns the invoiceRemitToAddressCountryName.
1546 */
1547 public String getInvoiceRemitToAddressCountryName() {
1548 return invoiceRemitToAddressCountryName;
1549 }
1550
1551 /**
1552 * @param invoiceRemitToAddressCountryName The invoiceRemitToAddressCountryName to set.
1553 */
1554 public void setInvoiceRemitToAddressCountryName(String remitToAddressCountryName) {
1555 this.invoiceRemitToAddressCountryName = remitToAddressCountryName;
1556 }
1557
1558 /**
1559 * @return Returns the invoiceRemitToAddressLine1.
1560 */
1561 public String getInvoiceRemitToAddressLine1() {
1562 return invoiceRemitToAddressLine1;
1563 }
1564
1565 /**
1566 * @param invoiceRemitToAddressLine1 The invoiceRemitToAddressLine1 to set.
1567 */
1568 public void setInvoiceRemitToAddressLine1(String remitToAddressLine1) {
1569 this.invoiceRemitToAddressLine1 = remitToAddressLine1;
1570 }
1571
1572 /**
1573 * @return Returns the invoiceRemitToAddressLine2.
1574 */
1575 public String getInvoiceRemitToAddressLine2() {
1576 return invoiceRemitToAddressLine2;
1577 }
1578
1579 /**
1580 * @param invoiceRemitToAddressLine2 The invoiceRemitToAddressLine2 to set.
1581 */
1582 public void setInvoiceRemitToAddressLine2(String remitToAddressLine2) {
1583 this.invoiceRemitToAddressLine2 = remitToAddressLine2;
1584 }
1585
1586 /**
1587 * @return Returns the invoiceRemitToAddressLine3.
1588 */
1589 public String getInvoiceRemitToAddressLine3() {
1590 return invoiceRemitToAddressLine3;
1591 }
1592
1593 /**
1594 * @param invoiceRemitToAddressLine3 The invoiceRemitToAddressLine3 to set.
1595 */
1596 public void setInvoiceRemitToAddressLine3(String remitToAddressLine3) {
1597 this.invoiceRemitToAddressLine3 = remitToAddressLine3;
1598 }
1599
1600 /**
1601 * @return Returns the invoiceRemitToAddressName.
1602 */
1603 public String getInvoiceRemitToAddressName() {
1604 return invoiceRemitToAddressName;
1605 }
1606
1607 /**
1608 * @param invoiceRemitToAddressName The invoiceRemitToAddressName to set.
1609 */
1610 public void setInvoiceRemitToAddressName(String remitToAddressName) {
1611 this.invoiceRemitToAddressName = remitToAddressName;
1612 }
1613
1614 /**
1615 * @return Returns the invoiceRemitToAddressPostalCode.
1616 */
1617 public String getInvoiceRemitToAddressPostalCode() {
1618 return invoiceRemitToAddressPostalCode;
1619 }
1620
1621 /**
1622 * @param invoiceRemitToAddressPostalCode The invoiceRemitToAddressPostalCode to set.
1623 */
1624 public void setInvoiceRemitToAddressPostalCode(String remitToAddressPostalCode) {
1625 this.invoiceRemitToAddressPostalCode = remitToAddressPostalCode;
1626 }
1627
1628 /**
1629 * @return Returns the invoiceRemitToAddressStateCode.
1630 */
1631 public String getInvoiceRemitToAddressStateCode() {
1632 return invoiceRemitToAddressStateCode;
1633 }
1634
1635 /**
1636 * @param invoiceRemitToAddressStateCode The invoiceRemitToAddressStateCode to set.
1637 */
1638 public void setInvoiceRemitToAddressStateCode(String remitToAddressStateCode) {
1639 this.invoiceRemitToAddressStateCode = remitToAddressStateCode;
1640 }
1641
1642 /**
1643 * @return Returns the invoiceRemitToAddressType.
1644 */
1645 public String getInvoiceRemitToAddressType() {
1646 return invoiceRemitToAddressType;
1647 }
1648
1649 /**
1650 * @param invoiceRemitToAddressType The invoiceRemitToAddressType to set.
1651 */
1652 public void setInvoiceRemitToAddressType(String remitToAddressType) {
1653 this.invoiceRemitToAddressType = remitToAddressType;
1654 }
1655
1656 /**
1657 * @return Returns the invoiceShipToAddressCityName.
1658 */
1659 public String getInvoiceShipToAddressCityName() {
1660 return invoiceShipToAddressCityName;
1661 }
1662
1663 /**
1664 * @param invoiceShipToAddressCityName The invoiceShipToAddressCityName to set.
1665 */
1666 public void setInvoiceShipToAddressCityName(String shipToAddressCityName) {
1667 this.invoiceShipToAddressCityName = shipToAddressCityName;
1668 }
1669
1670 /**
1671 * @return Returns the invoiceShipToAddressCountryCode.
1672 */
1673 public String getInvoiceShipToAddressCountryCode() {
1674 return invoiceShipToAddressCountryCode;
1675 }
1676
1677 /**
1678 * @param invoiceShipToAddressCountryCode The invoiceShipToAddressCountryCode to set.
1679 */
1680 public void setInvoiceShipToAddressCountryCode(String shipToAddressCountryCode) {
1681 this.invoiceShipToAddressCountryCode = shipToAddressCountryCode;
1682 }
1683
1684 /**
1685 * @return Returns the invoiceShipToAddressCountryName.
1686 */
1687 public String getInvoiceShipToAddressCountryName() {
1688 return invoiceShipToAddressCountryName;
1689 }
1690
1691 /**
1692 * @param invoiceShipToAddressCountryName The invoiceShipToAddressCountryName to set.
1693 */
1694 public void setInvoiceShipToAddressCountryName(String shipToAddressCountryName) {
1695 this.invoiceShipToAddressCountryName = shipToAddressCountryName;
1696 }
1697
1698 /**
1699 * @return Returns the invoiceShipToAddressLine1.
1700 */
1701 public String getInvoiceShipToAddressLine1() {
1702 return invoiceShipToAddressLine1;
1703 }
1704
1705 /**
1706 * @param invoiceShipToAddressLine1 The invoiceShipToAddressLine1 to set.
1707 */
1708 public void setInvoiceShipToAddressLine1(String shipToAddressLine1) {
1709 this.invoiceShipToAddressLine1 = shipToAddressLine1;
1710 }
1711
1712 /**
1713 * @return Returns the invoiceShipToAddressLine2.
1714 */
1715 public String getInvoiceShipToAddressLine2() {
1716 return invoiceShipToAddressLine2;
1717 }
1718
1719 /**
1720 * @param invoiceShipToAddressLine2 The invoiceShipToAddressLine2 to set.
1721 */
1722 public void setInvoiceShipToAddressLine2(String shipToAddressLine2) {
1723 this.invoiceShipToAddressLine2 = shipToAddressLine2;
1724 }
1725
1726 /**
1727 * @return Returns the invoiceShipToAddressLine3.
1728 */
1729 public String getInvoiceShipToAddressLine3() {
1730 return invoiceShipToAddressLine3;
1731 }
1732
1733 /**
1734 * @param invoiceShipToAddressLine3 The invoiceShipToAddressLine3 to set.
1735 */
1736 public void setInvoiceShipToAddressLine3(String shipToAddressLine3) {
1737 this.invoiceShipToAddressLine3 = shipToAddressLine3;
1738 }
1739
1740 /**
1741 * @return Returns the invoiceShipToAddressName.
1742 */
1743 public String getInvoiceShipToAddressName() {
1744 return invoiceShipToAddressName;
1745 }
1746
1747 /**
1748 * @param invoiceShipToAddressName The invoiceShipToAddressName to set.
1749 */
1750 public void setInvoiceShipToAddressName(String shipToAddressName) {
1751 this.invoiceShipToAddressName = shipToAddressName;
1752 }
1753
1754 /**
1755 * @return Returns the invoiceShipToAddressPostalCode.
1756 */
1757 public String getInvoiceShipToAddressPostalCode() {
1758 return invoiceShipToAddressPostalCode;
1759 }
1760
1761 /**
1762 * @param invoiceShipToAddressPostalCode The invoiceShipToAddressPostalCode to set.
1763 */
1764 public void setInvoiceShipToAddressPostalCode(String shipToAddressPostalCode) {
1765 this.invoiceShipToAddressPostalCode = shipToAddressPostalCode;
1766 }
1767
1768 /**
1769 * @return Returns the invoiceShipToAddressStateCode.
1770 */
1771 public String getInvoiceShipToAddressStateCode() {
1772 return invoiceShipToAddressStateCode;
1773 }
1774
1775 /**
1776 * @param invoiceShipToAddressStateCode The invoiceShipToAddressStateCode to set.
1777 */
1778 public void setInvoiceShipToAddressStateCode(String shipToAddressStateCode) {
1779 this.invoiceShipToAddressStateCode = shipToAddressStateCode;
1780 }
1781
1782 /**
1783 * @return Returns the invoiceShipToAddressType.
1784 */
1785 public String getInvoiceShipToAddressType() {
1786 return invoiceShipToAddressType;
1787 }
1788
1789 /**
1790 * @param invoiceShipToAddressType The invoiceShipToAddressType to set.
1791 */
1792 public void setInvoiceShipToAddressType(String shipToAddressType) {
1793 this.invoiceShipToAddressType = shipToAddressType;
1794 }
1795
1796 /**
1797 * @return Returns the invoiceOrderSupplierOrderInformationIdentifier.
1798 */
1799 public String getInvoiceOrderSupplierOrderInformationIdentifier() {
1800 return invoiceOrderSupplierOrderInformationIdentifier;
1801 }
1802
1803 /**
1804 * @param invoiceOrderSupplierOrderInformationIdentifier The invoiceOrderSupplierOrderInformationIdentifier to set.
1805 */
1806 public void setInvoiceOrderSupplierOrderInformationIdentifier(String supplierOrderInfoId) {
1807 this.invoiceOrderSupplierOrderInformationIdentifier = supplierOrderInfoId;
1808 }
1809
1810 /**
1811 * @return Returns the vendorDetailAssignedIdentifier.
1812 */
1813 public Integer getVendorDetailAssignedIdentifier() {
1814 return vendorDetailAssignedIdentifier;
1815 }
1816
1817 /**
1818 * @param vendorDetailAssignedIdentifier The vendorDetailAssignedIdentifier to set.
1819 */
1820 public void setVendorDetailAssignedIdentifier(Integer vendorDetailID) {
1821 this.vendorDetailAssignedIdentifier = vendorDetailID;
1822 }
1823
1824 /**
1825 * @return Returns the vendorDunsNumber.
1826 */
1827 public String getVendorDunsNumber() {
1828 return vendorDunsNumber;
1829 }
1830
1831 /**
1832 * @param vendorDunsNumber The vendorDunsNumber to set.
1833 */
1834 public void setVendorDunsNumber(String vendorDunsNumber) {
1835 this.vendorDunsNumber = vendorDunsNumber;
1836 }
1837
1838 /**
1839 * @return Returns the vendorHeaderGeneratedIdentifier.
1840 */
1841 public Integer getVendorHeaderGeneratedIdentifier() {
1842 return vendorHeaderGeneratedIdentifier;
1843 }
1844
1845 /**
1846 * @param vendorHeaderGeneratedIdentifier The vendorHeaderGeneratedIdentifier to set.
1847 */
1848 public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderID) {
1849 this.vendorHeaderGeneratedIdentifier = vendorHeaderID;
1850 }
1851
1852 public void addRejectItem(ElectronicInvoiceRejectItem item) {
1853 // int itemLinePosition = getItemLinePosition();
1854 // if (ObjectUtils.isNotNull(item.getItemLineNumber()) && (item.getItemLineNumber() > 0) && (item.getItemLineNumber() <=
1855 // itemLinePosition)) {
1856 // itemLinePosition = item.getItemLineNumber().intValue() - 1;
1857 // }
1858
1859 item.setPurapDocumentIdentifier(this.purapDocumentIdentifier);
1860 item.setElectronicInvoiceRejectDocument(this);
1861
1862 invoiceRejectItems.add(item);
1863 // renumberItems(itemLinePosition);
1864 }
1865
1866 public void addRejectReason(ElectronicInvoiceRejectReason reason) {
1867 // int itemLinePosition = getItemLinePosition();
1868 // if (ObjectUtils.isNotNull(item.getItemLineNumber()) && (item.getItemLineNumber() > 0) && (item.getItemLineNumber() <=
1869 // itemLinePosition)) {
1870 // itemLinePosition = item.getItemLineNumber().intValue() - 1;
1871 // }
1872
1873 reason.setPurapDocumentIdentifier(this.purapDocumentIdentifier);
1874 reason.setElectronicInvoiceRejectDocument(this);
1875
1876 invoiceRejectReasons.add(reason);
1877 // renumberItems(itemLinePosition);
1878 }
1879
1880 public PurApRelatedViews getRelatedViews() {
1881 if (relatedViews == null) {
1882 relatedViews = new PurApRelatedViews(this.documentNumber, this.accountsPayablePurchasingDocumentLinkIdentifier);
1883 }
1884 return relatedViews;
1885 }
1886
1887 public void setRelatedViews(PurApRelatedViews relatedViews) {
1888 this.relatedViews = relatedViews;
1889 }
1890
1891 @Override
1892 public boolean isBoNotesSupport() {
1893 return true;
1894 }
1895
1896 public boolean isDocumentCreationInProgress() {
1897 return isDocumentCreationInProgress;
1898 }
1899
1900 public void setDocumentCreationInProgress(boolean isDocumentCreationInProgress) {
1901 this.isDocumentCreationInProgress = isDocumentCreationInProgress;
1902 }
1903
1904 /**
1905 * Returns the vendor number for this document.
1906 *
1907 * @return the vendor number for this document.
1908 */
1909 public String getVendorNumber() {
1910 if (StringUtils.isNotEmpty(vendorNumber)) {
1911 return vendorNumber;
1912 }
1913 else if (ObjectUtils.isNotNull(vendorDetail)) {
1914 return vendorDetail.getVendorNumber();
1915 } else if (getVendorHeaderGeneratedIdentifier() != null && getVendorDetailAssignedIdentifier() != null){
1916 VendorDetail vendorDetail = new VendorDetail();
1917 vendorDetail.setVendorHeaderGeneratedIdentifier(getVendorHeaderGeneratedIdentifier());
1918 vendorDetail.setVendorDetailAssignedIdentifier(getVendorDetailAssignedIdentifier());
1919 return vendorDetail.getVendorNumber();
1920 }
1921 else
1922 return "";
1923 }
1924
1925 public void setVendorNumber(String vendorNumber) {
1926 this.vendorNumber = vendorNumber;
1927 }
1928
1929 /**
1930 * Always returns false.
1931 * This method is needed here because it's called by some tag files shared with PurAp documents.
1932 */
1933 public boolean getIsATypeOfPurAPRecDoc() {
1934 return false;
1935 }
1936
1937 /**
1938 * Always returns false.
1939 * This method is needed here because it's called by some tag files shared with PurAp documents.
1940 */
1941 public boolean getIsATypeOfPurDoc() {
1942 return false;
1943 }
1944
1945 /**
1946 * Always returns false.
1947 * This method is needed here because it's called by some tag files shared with PurAp documents.
1948 */
1949 public boolean getIsATypeOfPODoc() {
1950 return false;
1951 }
1952
1953 /**
1954 * Always returns false.
1955 * This method is needed here because it's called by some tag files shared with PurAp documents.
1956 */
1957 public boolean getIsPODoc() {
1958 return false;
1959 }
1960
1961 /**
1962 * Always returns false.
1963 * This method is needed here because it's called by some tag files shared with PurAp documents.
1964 */
1965 public boolean getIsReqsDoc() {
1966 return false;
1967 }
1968
1969 public boolean isInvoiceResearchIndicatorForSearching() {
1970 return invoiceResearchIndicator;
1971 }
1972
1973 public String getInvoiceResearchIndicatorForResult(){
1974 if (isInvoiceResearchIndicator()){
1975 return "Yes";
1976 }else{
1977 return "No";
1978 }
1979 }
1980
1981 public String getPurchaseOrderDeliveryCampusCodeForSearch(){
1982 return getPurchaseOrderDeliveryCampusCode();
1983 }
1984
1985 public CampusParameter getPurchaseOrderDeliveryCampus() {
1986 return purchaseOrderDeliveryCampus;
1987 }
1988
1989 public Date getAccountsPayableApprovalDateForSearch(){
1990 if (getAccountsPayableApprovalTimestamp() != null){
1991 DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
1992 try {
1993 return dateTimeService.convertToSqlDate(getAccountsPayableApprovalTimestamp());
1994 }
1995 catch (ParseException e) {
1996 throw new RuntimeException("ParseException thrown when trying to convert Timestamp to sqlDate.", e);
1997 }
1998 }
1999 return null;
2000 }
2001
2002 public Timestamp getInvoiceFileTimeStampForSearch() {
2003 Date invoiceDate = ElectronicInvoiceUtils.getDate(getInvoiceFileDate());
2004 if (invoiceDate != null){
2005 return new Timestamp(invoiceDate.getTime());
2006 }else{
2007 return null;
2008 }
2009 }
2010
2011 public void setInvoiceFileTimeStampForSearch(Timestamp invoiceFileTimeStamp) {
2012 //Not needed
2013 }
2014
2015 public String getWorkflowStatusForResult(){
2016 return PurapSearchUtils.getWorkFlowStatusString(getDocumentHeader());
2017 }
2018
2019 /**
2020 * Checks whether the related purchase order views need a warning to be displayed,
2021 * i.e. if at least one of the purchase orders has never been opened.
2022 * @return true if at least one related purchase order needs a warning; false otherwise
2023 */
2024 public boolean getNeedWarningRelatedPOs() {
2025 List<PurchaseOrderView> poViews = getRelatedViews().getRelatedPurchaseOrderViews();
2026 for (PurchaseOrderView poView : poViews) {
2027 if (poView.getNeedWarning())
2028 return true;
2029 }
2030 return false;
2031 }
2032
2033 /**
2034 * @see org.kuali.rice.kns.document.DocumentBase#doRouteStatusChange()
2035 */
2036 @Override
2037 public void doRouteStatusChange(DocumentRouteStatusChangeDTO statusChangeEvent) {
2038 LOG.debug("doRouteStatusChange() started");
2039 super.doRouteStatusChange(statusChangeEvent);
2040 if (this.getDocumentHeader().getWorkflowDocument().stateIsApproved()){
2041 //Set the current date as approval timestamp
2042 this.setAccountsPayableApprovalTimestamp(SpringContext.getBean(DateTimeService.class).getCurrentTimestamp());
2043 }
2044
2045 }
2046
2047 /**
2048 * @see org.kuali.rice.kns.bo.PersistableBusinessObjectBase#getBoNotes()
2049 */
2050 @Override
2051 public List getBoNotes() {
2052 List notes = super.getBoNotes();
2053 if (!StringUtils.isBlank(this.getObjectId())) {
2054 for (Iterator iterator = notes.iterator(); iterator.hasNext();) {
2055 Note note = (Note) iterator.next();
2056 if (!StringUtils.isBlank(note.getObjectId())) {
2057 note.refresh();
2058 }
2059 }
2060 }
2061
2062 return super.getBoNotes();
2063 }
2064
2065 }