use of org.kuali.kfs.module.purap.businessobject.ElectronicInvoiceRejectReason in project cu-kfs by CU-CommunityApps.
the class CuElectronicInvoiceMatchingServiceImpl method validateNonQtyBasedItem.
protected void validateNonQtyBasedItem(ElectronicInvoiceItemHolder itemHolder) {
PurchaseOrderItem poItem = itemHolder.getPurchaseOrderItem();
String fileName = itemHolder.getInvoiceOrderHolder().getFileName();
ElectronicInvoiceOrderHolder orderHolder = itemHolder.getInvoiceOrderHolder();
// Only validation is that the invoice amount (amount of PayReq) can not be greater than the extended cost minus amount paid
if (itemHolder.getInvoiceItemSubTotalAmount().setScale(KualiDecimal.SCALE, KualiDecimal.ROUND_BEHAVIOR).compareTo(poItem.getExtendedPrice().subtract(poItem.getItemInvoicedTotalAmount()).bigDecimalValue()) > 0) {
String extraDescription = "Invoice Item Line Number:" + itemHolder.getInvoiceItemLineNumber();
ElectronicInvoiceRejectReason rejectReason = createRejectReason(PurapConstants.ElectronicInvoice.PO_ITEM_AMT_LESSTHAN_INVOICE_ITEM_AMT, extraDescription, orderHolder.getFileName());
orderHolder.addInvoiceOrderRejectReason(rejectReason, PurapConstants.ElectronicInvoice.RejectDocumentFields.INVOICE_ITEM_LINE_NUMBER, PurapKeyConstants.ERROR_REJECT_POITEM_LESS_OUTSTANDING_EMCUMBERED_AMOUNT);
return;
}
if ((KualiDecimal.ZERO.compareTo(poItem.getItemOutstandingEncumberedAmount())) >= 0) {
// we have no dollars left encumbered on the po item
String extraDescription = "Invoice Item Line Number:" + itemHolder.getInvoiceItemLineNumber();
ElectronicInvoiceRejectReason rejectReason = createRejectReason(PurapConstants.ElectronicInvoice.OUTSTANDING_ENCUMBERED_AMT_AVAILABLE, extraDescription, orderHolder.getFileName());
orderHolder.addInvoiceOrderRejectReason(rejectReason, PurapConstants.ElectronicInvoice.RejectDocumentFields.INVOICE_ITEM_LINE_NUMBER, PurapKeyConstants.ERROR_REJECT_POITEM_OUTSTANDING_EMCUMBERED_AMOUNT);
return;
} else {
// KFSUPGRADE-485
if (((itemHolder.getInvoiceItemSubTotalAmount().setScale(KualiDecimal.SCALE, KualiDecimal.ROUND_BEHAVIOR)).compareTo(poItem.getItemOutstandingEncumberedAmount().bigDecimalValue())) > 0 || ((getItemTotalAmount(itemHolder).setScale(KualiDecimal.SCALE, KualiDecimal.ROUND_BEHAVIOR)).compareTo(poItem.getItemOutstandingEncumberedAmount().bigDecimalValue())) > 0) {
String extraDescription = "Invoice Item Line Number:" + itemHolder.getInvoiceItemLineNumber();
ElectronicInvoiceRejectReason rejectReason = createRejectReason(PurapConstants.ElectronicInvoice.PO_ITEM_AMT_LESSTHAN_INVOICE_ITEM_AMT, extraDescription, orderHolder.getFileName());
orderHolder.addInvoiceOrderRejectReason(rejectReason, PurapConstants.ElectronicInvoice.RejectDocumentFields.INVOICE_ITEM_LINE_NUMBER, PurapKeyConstants.ERROR_REJECT_POITEM_LESS_OUTSTANDING_EMCUMBERED_AMOUNT);
return;
}
}
}
Aggregations