[Home] [Help]
278: --the query Q_AUDIT
279:
280: --added nvl for bug 7314487
281: IF l_temp_vendor_id is NULL
282: AND nvl(p_invoice_rec.invoice_type_lookup_code,'STANDARD') <> 'PAYMENT REQUEST'
283: THEN UPDATE ap_invoices_interface
284: SET vendor_id = l_vendor_id
285: WHERE invoice_id = p_invoice_rec.invoice_id;
286: END IF;
335: -- the function will return the value of the vendor site.
336: IF ((p_invoice_rec.vendor_site_id is null) and
337: (p_invoice_rec.vendor_site_code is null) and
338: --(p_invoice_rec.invoice_type_lookup_code <> 'PAYMENT REQUEST')) Then .. B# 8528132
339: (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'PAYMENT REQUEST')) Then -- B# 8528132
340:
341: debug_info := '(Check Invoice Validation 3.1) Supplier Site is per PO';
342: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
343: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
509: --Contract Payments: Tolerances Redesign, added the max_amt_ord and max_amt_rec
510: --tolerances.
511: IF (p_invoice_rec.vendor_site_id IS NOT NULL AND
512: --p_invoice_rec.invoice_type_lookup_code <> 'PAYMENT REQUEST') THEN .. B# 8528132
513: nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'PAYMENT REQUEST') Then -- B# 8528132
514: IF ( ap_import_utilities_pkg.get_tolerance_info(
515: p_invoice_rec.vendor_site_id, -- IN
516: p_positive_price_tolerance, -- OUT
517: p_negative_price_tolerance, -- OUT
1459: SELECT closed_date, vendor_id, vendor_site_id, closed_code /* Added closed_code - 1Off Bug 10288184 / 11i Bug 8410175 */
1460: INTO l_closed_date ,l_vendor_id, l_vendor_site_id, l_closed_code /* Added l_closed_code - 1Off Bug 10288184 / 11i Bug 8410175 */
1461: FROM po_headers
1462: WHERE segment1 = p_invoice_rec.po_number
1463: AND type_lookup_code in ('BLANKET', 'PLANNED', 'STANDARD')
1464: /* BUG 2902452 added*/
1465: AND nvl(authorization_status,'INCOMPLETE') in ('APPROVED','REQUIRES REAPPROVAL','IN PROCESS');--Bug5687122 --Added In Process condition
1466:
1467: IF (l_vendor_id IS NOT NULL) Then
3207: END IF;
3208:
3209: p_invoice_type_lookup_code := p_invoice_rec.invoice_type_lookup_code;
3210:
3211: -- We only support importing invoice types 'STANDARD', 'CREDIT',
3212: -- 'PREPAYMENT' -- Contract Payments
3213: -- and 'PO PRICE ADJUST' --Retropricing
3214: -- and 'DEBIT' -- Debit Memo
3215: -- Also we check for invalid lookup code only if it is not null
3212: -- 'PREPAYMENT' -- Contract Payments
3213: -- and 'PO PRICE ADJUST' --Retropricing
3214: -- and 'DEBIT' -- Debit Memo
3215: -- Also we check for invalid lookup code only if it is not null
3216: -- Else we populate STANDARD for invoice amount >=0 and CREDIT for
3217: -- invoice amount <0
3218:
3219: --Bug 4410499 Added EXPENSE REPORT to the list of
3220: --invoice types we support thru open interface import
3223: --Payment Requests : Added 'PAYMENT REQUEST' to the IF condition
3224: --Bug 7299826 EC Subcon Project : Added 'DEBIT' to the IF condition
3225: IF ((p_invoice_rec.invoice_type_lookup_code IS NOT NULL) AND
3226: (p_invoice_rec.invoice_type_lookup_code NOT IN (
3227: 'STANDARD','CREDIT', 'DEBIT', 'PO PRICE ADJUST','PREPAYMENT','EXPENSE REPORT',
3228: 'PAYMENT REQUEST')))
3229: THEN
3230:
3231: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections
3247: ELSIF ((p_invoice_rec.invoice_type_lookup_code IS NULL) AND
3248: (p_invoice_rec.invoice_amount >=0)) THEN
3249:
3250: debug_info := '(Check Invoice Type and Amount 2) Invoice type lookup '
3251: ||'code is null, setting to STANDARD.';
3252: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
3253: AP_IMPORT_UTILITIES_PKG.Print(
3254: AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3255: END IF;
3253: AP_IMPORT_UTILITIES_PKG.Print(
3254: AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3255: END IF;
3256:
3257: p_invoice_type_lookup_code := 'STANDARD';
3258:
3259: ELSIF ((p_invoice_rec.invoice_type_lookup_code IS NULL) AND
3260: (p_invoice_rec.invoice_amount < 0)) THEN
3261:
3316:
3317: --Contract Payments: Modified the IF condition to add 'Prepayment' type
3318: --Payment Requests: Added 'PAYMENT REQUEST' type to the IF condition
3319: IF (((nvl(p_invoice_type_lookup_code,'DUMMY')
3320: IN ('Standard','STANDARD','Prepayment','PREPAYMENT'/*, -- Bug 7002267
3321: 'PAYMENT REQUEST'*/)) AND
3322: (p_invoice_rec.invoice_amount < 0)) OR
3323: ((nvl(p_invoice_type_lookup_code,'DUMMY') IN ('CREDIT', 'DEBIT')) AND --Bug 7299826 - Added DEBIT
3324: (p_invoice_rec.invoice_amount > 0))) THEN -- Bug 2822878
4465: SELECT terms_id
4466: INTO l_term_id
4467: FROM po_headers
4468: WHERE segment1 = p_invoice_rec.po_number
4469: AND type_lookup_code in ('BLANKET', 'PLANNED', 'STANDARD');
4470: END IF;
4471:
4472: -- no term from header level po_number, try lines level po_number
4473: IF (l_term_id is null ) THEN
4480: BEGIN
4481: SELECT p.terms_id
4482: INTO l_term_id
4483: FROM po_headers p, ap_invoice_lines_interface l
4484: WHERE p.type_lookup_code in ('BLANKET', 'PLANNED', 'STANDARD')
4485: AND ((l.po_header_id = p.po_header_id) OR
4486: (l.po_number = p.segment1))
4487: AND l.invoice_id = p_invoice_rec.invoice_id
4488: AND p.terms_id IS NOT NULL
7297: ---------------------------------------------------------
7298:
7299: --Payment Requests: Added IF condition for Payment Requests
7300: --IF (p_invoice_rec.invoice_type_lookup_code <> 'PAYMENT REQUEST') THEN .. B# 8528132
7301: IF (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'PAYMENT REQUEST') THEN -- B# 8528132
7302:
7303: debug_info := '(Check_lines 1) Call Get_employee_id';
7304: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
7305: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
8078: --validation since this is already done in OIE during the creation
8079: --of expense report before populating the records into interface table.
8080: --IF (p_invoice_rec.invoice_type_lookup_code <> 'EXPENSE REPORT') THEN .. B# 8528132
8081: --bugfix :10356162, doing null check condition on project info
8082: IF (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'EXPENSE REPORT'
8083: AND (p_invoice_lines_tab(i).project_id IS NOT NULL OR
8084: p_invoice_lines_tab(i).task_id IS NOT NULL OR
8085: p_invoice_lines_tab(i).expenditure_type IS NOT NULL OR
8086: p_invoice_lines_tab(i).expenditure_item_date IS NOT NULL OR
8819: -- Check if retainage account is available if the po shipment
8820: -- has retainage.
8821: ---------------------------------------------------------
8822: IF (p_invoice_lines_tab(i).po_line_location_id IS NOT NULL AND
8823: nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'PREPAYMENT') THEN
8824:
8825: debug_info := '(Check Lines 26) Checking for retainage account ';
8826: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
8827: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
9214: SELECT 'Y', po_header_id
9215: INTO l_po_is_valid_flag, l_po_header_id
9216: FROM po_headers
9217: WHERE segment1 = p_invoice_rec.po_number
9218: AND type_lookup_code in ('BLANKET', 'PLANNED', 'STANDARD')
9219: /* BUG 2902452 added*/
9220: AND nvl(authorization_status,'INCOMPLETE') in ('APPROVED','REQUIRES REAPPROVAL','IN PROCESS');--Bug5687122 --Added In Process condition
9221:
9222: EXCEPTION
9261: SELECT 'Y'
9262: INTO l_po_is_valid_flag
9263: FROM po_headers ph
9264: WHERE ph.po_header_id = l_po_header_id
9265: AND ph.type_lookup_code in ('BLANKET', 'PLANNED', 'STANDARD')
9266: /* BUG 2902452 added */
9267: AND nvl(authorization_status,'INCOMPLETE') in ('APPROVED','REQUIRES REAPPROVAL','IN PROCESS')--Bug5687122 --Added In Process condition
9268: AND NVL(ph.closed_code, 'X') <> 'FINALLY CLOSED'; --Bug#13867905
9269:
9343: SELECT 'Y', ph.po_header_id
9344: INTO l_po_is_valid_flag, l_po_header_id
9345: FROM po_headers ph
9346: WHERE segment1 = p_invoice_lines_rec.po_number
9347: AND type_lookup_code in ('BLANKET', 'PLANNED', 'STANDARD')
9348: /*BUG 2902452 added*/
9349: AND nvl(authorization_status,'INCOMPLETE') in ('APPROVED','REQUIRES REAPPROVAL','IN PROCESS')--Bug5687122 --Added In Process condition
9350: AND NVL(ph.closed_code, 'X') <> 'FINALLY CLOSED'; --Bug#13867905
9351:
9947: BEGIN
9948: debug_info :=
9949: '(v_check_line_po_info 10.2) Check lines for po_release_id ';
9950: /* For bug 4038403
9951: Removed the 'STANDARD' from the condition from both
9952: the queries as there is no need to validate the release
9953: details for standard PO */
9954:
9955: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
9949: '(v_check_line_po_info 10.2) Check lines for po_release_id ';
9950: /* For bug 4038403
9951: Removed the 'STANDARD' from the condition from both
9952: the queries as there is no need to validate the release
9953: details for standard PO */
9954:
9955: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
9956: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
9957: debug_info);
9969: -- fix for bug 2809177 commented above line and wrote the below one
9970: and poh.po_header_id = l_po_header_id
9971: -- Commented below line as a fix for bug 2809177
9972: -- and poh.segment1 = nvl(p_invoice_lines_rec.po_number, poh.segment1)
9973: and poh.type_lookup_code in ('BLANKET', 'PLANNED') --, 'STANDARD')
9974: and pol.po_line_id = nvl(l_po_line_id, pol.po_line_id)
9975: and pol.line_num = p_invoice_lines_rec.po_line_number )
9976: AND po_release_id = (
9977: select po_release_id
9981: -- fix for bug 2809177 commented above line and wrote the below one
9982: and poh.po_header_id = l_po_header_id
9983: -- Commented below line as a fix for bug 2809177
9984: -- and poh.segment1 = nvl(p_invoice_lines_rec.po_number, poh.segment1)
9985: and poh.type_lookup_code in ('BLANKET', 'PLANNED')--, 'STANDARD')
9986: and por.po_header_id = l_po_header_id -- Added as a fix for bug 2809177
9987: and por.release_num = p_invoice_lines_rec.release_num )
9988: AND rownum <=1;
9989: ELSIF p_invoice_lines_rec.po_number IS NOT NULL THEN
9997: -- and poh.po_header_id = nvl(l_po_header_id, poh.po_header_id)
9998: -- and poh.segment1 = nvl(p_invoice_lines_rec.po_number, poh.segment1)
9999: -- fix for bug 2809177 commented above two lines and wrote the below one
10000: and poh.segment1 = p_invoice_lines_rec.po_number
10001: and poh.type_lookup_code in ('BLANKET', 'PLANNED', 'STANDARD')
10002: and pol.po_line_id = nvl(l_po_line_id, pol.po_line_id)
10003: and pol.line_num = p_invoice_lines_rec.po_line_number )
10004: AND po_release_id = (
10005: select po_release_id
10008: -- and poh.po_header_id = nvl(l_po_header_id, poh.po_header_id)
10009: -- and poh.segment1 = nvl(p_invoice_lines_rec.po_number, poh.segment1)
10010: -- fix for bug 2809177 commented above two line and wrote the below one
10011: and poh.segment1 = p_invoice_lines_rec.po_number
10012: and poh.type_lookup_code in ('BLANKET', 'PLANNED', 'STANDARD')
10013: and por.release_num = p_invoice_lines_rec.release_num )
10014: AND rownum <=1;
10015: END IF ;
10016:
11505: SELECT segment1
11506: INTO l_po_number
11507: FROM po_headers
11508: WHERE po_header_id = l_po_header_id
11509: AND type_lookup_code in ('BLANKET', 'PLANNED', 'STANDARD');
11510: EXCEPTION
11511: WHEN NO_DATA_FOUND THEN
11512: NULL;
11513: END;
11667: SELECT po_header_id
11668: INTO l_po_header_id
11669: FROM po_headers
11670: WHERE segment1 = l_po_number
11671: AND type_lookup_code in ('BLANKET', 'PLANNED', 'STANDARD');
11672:
11673: END IF; -- Step 30: po_number is not null but po_header_id is null
11674:
11675: -- Get other po infomation
11873: | A)Prepayment Invoice,we should not reject if we can derive |
11874: | a single shipment of type 'Prepayment' from the PO line |
11875: | we should not reject it. |
11876: | B)Any other invoice (Std, credit,debit, mixed), we should |
11877: | not reject if we are able to derive a single actual('Standard') |
11878: | shipment. |
11879: +---------------------------------------------------------------------*/
11880:
11881: SELECT line_location_id
11890: (pll.payment_type IS NULL)
11891: )
11892: ) OR
11893: --(p_invoice_rec.invoice_type_lookup_code <> 'PREPAYMENT' and .. B# 8528132
11894: (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'PREPAYMENT' and -- B# 8528132
11895: ((pll.payment_type IS NOT NULL and pll.shipment_type <> 'PREPAYMENT') or
11896: (pll.payment_type IS NULL)
11897: )
11898: )
12762:
12763: END IF;
12764:
12765:
12766: --Unit Price must be always be positive for STANDARD invoices, and negative
12767: --for CREDIT/DEBIT memos, and postive or negative for MIXED type of invoices.
12768: debug_info := '(v_check_line_po_info 34.10) Check the sign of the unit_price against'
12769: ||'the invoice type';
12770: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
12773: END IF;
12774:
12775: --Contract Payments: Modified the IF condition to add 'PREPAYMENT'.
12776:
12777: IF ((p_invoice_rec.invoice_type_lookup_code IN ('STANDARD','PREPAYMENT') and
12778: p_invoice_lines_rec.unit_price < 0) OR
12779: (p_invoice_rec.invoice_type_lookup_code IN ('CREDIT','DEBIT') and
12780: p_invoice_lines_rec.unit_price > 0)) THEN
12781:
13377: SELECT po_header_id
13378: INTO l_po_header_id
13379: FROM po_headers
13380: WHERE segment1 = l_po_number
13381: AND type_lookup_code in ('BLANKET', 'PLANNED', 'STANDARD');
13382: EXCEPTION
13383: when NO_DATA_FOUND then
13384: null;
13385: END;
13446: /*IF (p_invoice_lines_rec.match_option IS NOT NULL AND
13447: p_invoice_lines_rec.match_option <> l_temp_match_option) THEN*/
13448:
13449: If ( p_invoice_lines_rec.match_option is not null
13450: and ((nvl(p_invoice_rec.invoice_type_lookup_code,'STANDARD') = 'PREPAYMENT'
13451: AND p_invoice_lines_rec.match_option = 'R'
13452: AND l_temp_match_option = 'P')
13453: OR
13454: (nvl(p_invoice_rec.invoice_type_lookup_code,'STANDARD') <> 'PREPAYMENT'
13450: and ((nvl(p_invoice_rec.invoice_type_lookup_code,'STANDARD') = 'PREPAYMENT'
13451: AND p_invoice_lines_rec.match_option = 'R'
13452: AND l_temp_match_option = 'P')
13453: OR
13454: (nvl(p_invoice_rec.invoice_type_lookup_code,'STANDARD') <> 'PREPAYMENT'
13455: AND p_invoice_lines_rec.match_option <> l_temp_match_option))) then
13456:
13457: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
13458: AP_IMPORT_INVOICES_PKG.g_invoice_lines_table,
13898: BEGIN
13899:
13900: --Contract Payments: Modified the WHERE condition so that we check for
13901: --'Prepayment' type shipments for complex work pos for Prepayment invoices and otherwise
13902: --Standard/Blanket/Scheduled shipments are valid for Standard/Credit invoices.
13903: SELECT 'X'
13904: INTO l_invalid_shipment_type
13905: FROM po_distributions pd,
13906: po_line_locations pll
13908: AND pd.po_distribution_id = l_po_distribution_id
13909: AND
13910: (
13911: --(p_invoice_rec.invoice_type_lookup_code <> 'PREPAYMENT' and .. B# 8528132
13912: (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'PREPAYMENT' and -- B# 8528132
13913: pll.SHIPMENT_TYPE IN ('STANDARD','BLANKET','SCHEDULED')
13914: ) OR
13915: (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT' and
13916: ((pll.payment_type IS NOT NULL and pll.shipment_type = 'PREPAYMENT') or
13909: AND
13910: (
13911: --(p_invoice_rec.invoice_type_lookup_code <> 'PREPAYMENT' and .. B# 8528132
13912: (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'PREPAYMENT' and -- B# 8528132
13913: pll.SHIPMENT_TYPE IN ('STANDARD','BLANKET','SCHEDULED')
13914: ) OR
13915: (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT' and
13916: ((pll.payment_type IS NOT NULL and pll.shipment_type = 'PREPAYMENT') or
13917: (pll.payment_type IS NULL and pll.shipment_type IN ('STANDARD','BLANKET','SCHEDULED'))
13913: pll.SHIPMENT_TYPE IN ('STANDARD','BLANKET','SCHEDULED')
13914: ) OR
13915: (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT' and
13916: ((pll.payment_type IS NOT NULL and pll.shipment_type = 'PREPAYMENT') or
13917: (pll.payment_type IS NULL and pll.shipment_type IN ('STANDARD','BLANKET','SCHEDULED'))
13918: )
13919: )
13920: )
13921: AND pll.APPROVED_FLAG = 'Y'
13953: END IF;
13954:
13955: --Contract Payments: Modified the WHERE condition so that we check for
13956: --'Prepayment' type shipments for complex work pos for Prepayment invoices and otherwise
13957: --Standard/Blanket/Scheduled shipments are valid for Standard/Credit invoices.
13958: BEGIN
13959: SELECT 'X'
13960: INTO l_invalid_shipment_type
13961: FROM po_line_locations pll
13961: FROM po_line_locations pll
13962: WHERE line_location_id = l_po_line_location_id
13963: AND(
13964: --(p_invoice_rec.invoice_type_lookup_code <> 'PREPAYMENT' and .. B# 8528132
13965: (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'PREPAYMENT' and -- B# 8528132
13966: pll.SHIPMENT_TYPE IN ('STANDARD','BLANKET','SCHEDULED')
13967: ) OR
13968: (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT' and
13969: ((pll.payment_type IS NOT NULL and pll.shipment_type = 'PREPAYMENT') or
13962: WHERE line_location_id = l_po_line_location_id
13963: AND(
13964: --(p_invoice_rec.invoice_type_lookup_code <> 'PREPAYMENT' and .. B# 8528132
13965: (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'PREPAYMENT' and -- B# 8528132
13966: pll.SHIPMENT_TYPE IN ('STANDARD','BLANKET','SCHEDULED')
13967: ) OR
13968: (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT' and
13969: ((pll.payment_type IS NOT NULL and pll.shipment_type = 'PREPAYMENT') or
13970: (pll.payment_type IS NULL and pll.shipment_type IN ('STANDARD','BLANKET','SCHEDULED'))
13966: pll.SHIPMENT_TYPE IN ('STANDARD','BLANKET','SCHEDULED')
13967: ) OR
13968: (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT' and
13969: ((pll.payment_type IS NOT NULL and pll.shipment_type = 'PREPAYMENT') or
13970: (pll.payment_type IS NULL and pll.shipment_type IN ('STANDARD','BLANKET','SCHEDULED'))
13971: )
13972: )
13973: )
13974: AND APPROVED_FLAG = 'Y'
14016: /*IF (p_invoice_lines_rec.match_option IS NOT NULL AND
14017: p_invoice_lines_rec.match_option <> l_temp_match_option) THEN*/
14018:
14019: IF (p_invoice_lines_rec.match_option IS NOT NULL
14020: AND ((nvl(p_invoice_rec.invoice_type_lookup_code,'STANDARD') = 'PREPAYMENT'
14021: AND p_invoice_lines_rec.match_option = 'R'
14022: AND l_temp_match_option = 'P')
14023: OR
14024: (nvl(p_invoice_rec.invoice_type_lookup_code,'STANDARD') <> 'PREPAYMENT'
14020: AND ((nvl(p_invoice_rec.invoice_type_lookup_code,'STANDARD') = 'PREPAYMENT'
14021: AND p_invoice_lines_rec.match_option = 'R'
14022: AND l_temp_match_option = 'P')
14023: OR
14024: (nvl(p_invoice_rec.invoice_type_lookup_code,'STANDARD') <> 'PREPAYMENT'
14025: AND p_invoice_lines_rec.match_option <> l_temp_match_option))) THEN
14026:
14027: -- Reject for invalid Match option
14028: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
14065: WHERE pll.po_line_id = l_po_line_id
14066: AND(
14067: (
14068: --(p_invoice_rec.invoice_type_lookup_code <> 'PREPAYMENT' and .. B# 8528132
14069: (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'PREPAYMENT' and -- B# 8528132
14070: pll.SHIPMENT_TYPE NOT IN ('STANDARD','BLANKET','SCHEDULED')
14071: ) OR
14072: (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT' and
14073: ((pll.payment_type IS NOT NULL and pll.shipment_type <> 'PREPAYMENT') or
14066: AND(
14067: (
14068: --(p_invoice_rec.invoice_type_lookup_code <> 'PREPAYMENT' and .. B# 8528132
14069: (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'PREPAYMENT' and -- B# 8528132
14070: pll.SHIPMENT_TYPE NOT IN ('STANDARD','BLANKET','SCHEDULED')
14071: ) OR
14072: (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT' and
14073: ((pll.payment_type IS NOT NULL and pll.shipment_type <> 'PREPAYMENT') or
14074: (pll.payment_type IS NULL and pll.shipment_type NOT IN ('STANDARD','BLANKET','SCHEDULED'))
14070: pll.SHIPMENT_TYPE NOT IN ('STANDARD','BLANKET','SCHEDULED')
14071: ) OR
14072: (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT' and
14073: ((pll.payment_type IS NOT NULL and pll.shipment_type <> 'PREPAYMENT') or
14074: (pll.payment_type IS NULL and pll.shipment_type NOT IN ('STANDARD','BLANKET','SCHEDULED'))
14075: )
14076: )
14077: )
14078: /* Bug 4038403 removed these two conditions and added the below condition
14375: ------------------------------------------------------
14376: --Contract Payments: Modified the IF condition to add 'PREPAYMENT'.
14377:
14378: IF ((p_invoice_lines_rec.quantity_invoiced) <= 0 AND
14379: (p_invoice_rec.invoice_type_lookup_code IN ('STANDARD','PREPAYMENT'))) Then
14380: debug_info :=
14381: '(v_check_line_po_info2 4) Check for Invalid Line Quantity';
14382: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
14383: AP_IMPORT_UTILITIES_PKG.Print(
14407: END IF;
14408:
14409: ELSIF (p_match_basis = 'AMOUNT') THEN
14410: IF ((p_invoice_lines_rec.amount) <= 0 AND
14411: (p_invoice_rec.invoice_type_lookup_code = 'STANDARD')) Then
14412: debug_info :=
14413: '(v_check_line_po_info2 4) Check for Invalid Line Amount';
14414: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
14415: AP_IMPORT_UTILITIES_PKG.Print(
15409: WHERE pd.line_location_id = pll.line_location_id
15410: AND pll.po_line_id = l_po_line_id
15411: AND(
15412: --(p_invoice_rec.invoice_type_lookup_code <> 'PREPAYMENT' and .. B# 8528132
15413: (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'PREPAYMENT' and -- B# 8528132
15414: pll.SHIPMENT_TYPE IN ('STANDARD','BLANKET','SCHEDULED')
15415: ) OR
15416: (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT' and
15417: ((pll.payment_type IS NOT NULL and pll.shipment_type = 'PREPAYMENT') or
15410: AND pll.po_line_id = l_po_line_id
15411: AND(
15412: --(p_invoice_rec.invoice_type_lookup_code <> 'PREPAYMENT' and .. B# 8528132
15413: (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'PREPAYMENT' and -- B# 8528132
15414: pll.SHIPMENT_TYPE IN ('STANDARD','BLANKET','SCHEDULED')
15415: ) OR
15416: (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT' and
15417: ((pll.payment_type IS NOT NULL and pll.shipment_type = 'PREPAYMENT') or
15418: (pll.payment_type IS NULL and pll.shipment_type IN ('STANDARD','BLANKET','SCHEDULED'))
15414: pll.SHIPMENT_TYPE IN ('STANDARD','BLANKET','SCHEDULED')
15415: ) OR
15416: (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT' and
15417: ((pll.payment_type IS NOT NULL and pll.shipment_type = 'PREPAYMENT') or
15418: (pll.payment_type IS NULL and pll.shipment_type IN ('STANDARD','BLANKET','SCHEDULED'))
15419: )
15420: )
15421: )
15422: AND pll.APPROVED_FLAG = 'Y'
21471: l_current_invoice_status := p_current_invoice_status;
21472:
21473: --Contract Payments: Modified the IF condition to add 'PREPAYMENT'.
21474:
21475: IF ( (p_invoice_rec.invoice_type_lookup_code IN ('STANDARD','PREPAYMENT') and
21476: NVL(p_invoice_rec.control_amount, 0) > NVL(p_invoice_rec.invoice_amount, 0)) OR
21477: (p_invoice_rec.invoice_type_lookup_code IN ('CREDIT', 'DEBIT') and -- bug 7299826
21478: NVL(abs(p_invoice_rec.control_amount), NVL(abs(p_invoice_rec.invoice_amount),0)) > NVL(abs(p_invoice_rec.invoice_amount),0)) --Bug 6925674 (Base bug6905106)
21479: ) THEN
23338: end if;
23339:
23340: -- Bug 7871425.
23341:
23342: IF (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') = 'EXPENSE REPORT'
23343: AND p_invoice_rec.party_site_id is null) THEN
23344:
23345: select vendor_type_lookup_code into l_vendor_type_lookup_code
23346: from ap_suppliers where vendor_id = p_invoice_rec.vendor_id ;
23353: -- EXPENSE REPORT and vendor type is not EMPLOYEE.
23354:
23355: --if we just have vendor info then also populate the party info
23356: if p_invoice_rec.vendor_site_id is not null and p_invoice_rec.party_site_id is null
23357: and (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'EXPENSE REPORT'
23358: or(nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') = 'EXPENSE REPORT'
23359: and nvl(l_vendor_type_lookup_code, 'VENDOR') <> 'EMPLOYEE')) then
23360: Begin
23361: select party_site_id
23354:
23355: --if we just have vendor info then also populate the party info
23356: if p_invoice_rec.vendor_site_id is not null and p_invoice_rec.party_site_id is null
23357: and (nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') <> 'EXPENSE REPORT'
23358: or(nvl(p_invoice_rec.invoice_type_lookup_code, 'STANDARD') = 'EXPENSE REPORT'
23359: and nvl(l_vendor_type_lookup_code, 'VENDOR') <> 'EMPLOYEE')) then
23360: Begin
23361: select party_site_id
23362: into p_invoice_rec.party_site_id