2261: /*-----------------------------------------------------------------------------------------+
2262: --For the case of complex works, following scenarios are possible:
2263: 1.Matching Basis at PO Line = 'AMOUNT' and
2264: shipments could have matching_basis of 'QUANTITY'/'AMOUNT'. And within that
2265: shipment_type could be 'PREPAYMENT' or 'STANDARD'. For 'PREPAYMENT'
2266: we need to go off of financed columns and
2267: for 'STANDARD' we need to go off of Billed columns.
2268: 2.Matching Basis at PO Line = 'QUANTITY'
2269: and then shipments can have the matching basis of only 'QUANTITY'. And within that
2263: 1.Matching Basis at PO Line = 'AMOUNT' and
2264: shipments could have matching_basis of 'QUANTITY'/'AMOUNT'. And within that
2265: shipment_type could be 'PREPAYMENT' or 'STANDARD'. For 'PREPAYMENT'
2266: we need to go off of financed columns and
2267: for 'STANDARD' we need to go off of Billed columns.
2268: 2.Matching Basis at PO Line = 'QUANTITY'
2269: and then shipments can have the matching basis of only 'QUANTITY'. And within that
2270: shipment_type could be 'PREPAYMENT' or 'STANDARD'. For 'PREPAYMENT'
2271: we need to go off of financed columns and
2266: we need to go off of financed columns and
2267: for 'STANDARD' we need to go off of Billed columns.
2268: 2.Matching Basis at PO Line = 'QUANTITY'
2269: and then shipments can have the matching basis of only 'QUANTITY'. And within that
2270: shipment_type could be 'PREPAYMENT' or 'STANDARD'. For 'PREPAYMENT'
2271: we need to go off of financed columns and
2272: for 'STANDARD' we need to go off of Billed columns.
2273: +------------------------------------------------------------------------------------------*/
2274:
2268: 2.Matching Basis at PO Line = 'QUANTITY'
2269: and then shipments can have the matching basis of only 'QUANTITY'. And within that
2270: shipment_type could be 'PREPAYMENT' or 'STANDARD'. For 'PREPAYMENT'
2271: we need to go off of financed columns and
2272: for 'STANDARD' we need to go off of Billed columns.
2273: +------------------------------------------------------------------------------------------*/
2274:
2275: SELECT
2276: DECODE(pl.matching_basis, 'QUANTITY',
2768: invoice will be rejected for 'Override Disabled', if the user populates
2769: AP_INVOICES_INTERFACE.DOC_CATEGORY_CODE (and override is "No").
2770:
2771: If the profile value is "Always" and no document category is specified
2772: by the user, then "Standard Invoices" category will be used for
2773: standard invoices and "Credit Memo Invoices" category will be used
2774: for credits.
2775: We assume that a valid automatic sequence exists for such categories.
2776:
2769: AP_INVOICES_INTERFACE.DOC_CATEGORY_CODE (and override is "No").
2770:
2771: If the profile value is "Always" and no document category is specified
2772: by the user, then "Standard Invoices" category will be used for
2773: standard invoices and "Credit Memo Invoices" category will be used
2774: for credits.
2775: We assume that a valid automatic sequence exists for such categories.
2776:
2777: If the payables option of Invoice Document Category override is
2790: 'REC INV',
2791: 'WIRE PAY',
2792: 'EXP REP INV')
2793:
2794: If the document category is "Standard Invoices" and the invoice amount
2795: is less than zero, or, the document category is "Credit Memo Invoices"
2796: and the invoice amount is greated than zero then the invoice will be
2797: rejected for 'Invalid Category'.
2798:
2901: -- Contract Payments: Modified the below IF condition to add logic for
2902: -- 'Prepayment' type invoices.
2903:
2904: IF ( ( p_invoice_rec.doc_category_code = 'STD INV' and
2905: p_invoice_rec.invoice_type_lookup_code <> 'STANDARD')
2906: OR
2907: ( p_invoice_rec.doc_category_code = 'PAY REQ INV' and
2908: p_invoice_rec.invoice_type_lookup_code <> 'PAYMENT REQUEST')
2909: OR
3035: --Contract Payments: Modified the IF condition to look at the invoice_type
3036: --rather than the sign of the invoice_amount in deciding which category to
3037: --apply, and also added the logic for 'PREPAYMENT' invoices.
3038:
3039: IF (p_invoice_rec.invoice_type_lookup_code = 'STANDARD') THEN
3040: l_doc_category_code := 'STD INV';
3041: ELSIF (p_invoice_rec.invoice_type_lookup_code = 'PAYMENT REQUEST') THEN
3042: l_doc_category_code := 'PAY REQ INV';
3043: ELSIF (p_invoice_rec.invoice_type_lookup_code = 'CREDIT') THEN
3860: --p_invoice_rec.exclusive_payment_flag, -- **exclusive_payment_flag
3861: DECODE(p_invoice_rec.invoice_type_lookup_code, 'CREDIT', 'N', p_invoice_rec.exclusive_payment_flag), -- BUG 7195865
3862: (select po_header_id from po_headers where segment1 =p_invoice_rec.po_number
3863: /* Added for bug#11702161 Start */
3864: AND type_lookup_code in ('BLANKET', 'PLANNED', 'STANDARD')
3865: AND nvl(authorization_status,'INCOMPLETE') in ('APPROVED','REQUIRES REAPPROVAL','IN PROCESS')
3866: /* Added for bug#11702161 End */
3867: ), /* Bug 8556975 Changed po_headers_all to po_headers for * bug#9577089 */
3868: p_invoice_rec.awt_group_id, -- awt_group_id