DBA Data[Home] [Help]

PACKAGE BODY: APPS.AP_PO_UTILITIES_PKG

Source


1 PACKAGE BODY AP_PO_UTILITIES_PKG AS
2 /* $Header: appoutlb.pls 120.0 2006/05/06 01:44:19 mswamina noship $ */
3 
4   -- This procedure will return maximum invoice date based on the
5   -- line location information passed to us. Depending on the type
6   -- of the shipment this procedure will include/exclude prepayments.
7   -- refer to bug 4549985 for details.
8 
9   PROCEDURE Get_Invoice_Close_Date
10                 (P_Line_Location_ID          IN         NUMBER,
11                  P_Shipment_Type             IN         VARCHAR2,
12                  P_Invoice_Date              OUT NOCOPY DATE) IS
13 
14   BEGIN
15 
16     IF P_Shipment_Type = 'PREPAYMENT' THEN
17 
18        SELECT MAX(AI.invoice_date)
19        INTO   P_Invoice_Date
20        FROM   AP_Invoices_All AI,
21               AP_Invoice_Lines_All AIL
22        WHERE  AI.invoice_id = AIL.invoice_id
23          AND  AIL.po_line_location_id = P_Line_Location_ID
24          AND  NVL(AIL.discarded_flag,'N') <> 'N'
25          AND  AI.invoice_type_lookup_code = 'PREPAYMENT';
26 
27        RETURN;
28 
29     END IF;
30 
31     IF P_Shipment_Type = 'STANDARD' THEN
32 
33        SELECT MAX(AI.invoice_date)
34        INTO   P_Invoice_Date
35        FROM   AP_Invoices_All AI,
36               AP_Invoice_Lines_All AIL
37        WHERE  AI.invoice_id = AIL.invoice_id
38          AND  AIL.po_line_location_id = P_Line_Location_ID
39          AND  NVL(AIL.discarded_flag,'N') <> 'N'
40          AND  AI.invoice_type_lookup_code = 'STANDARD';
41 
42        RETURN;
43 
44     END IF;
45 
46   EXCEPTION
47 
48     WHEN OTHERS THEN
49       P_Invoice_Date := NULL;
50   END Get_Invoice_Close_Date;
51 
52 
53 END AP_PO_UTILITIES_PKG;