DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_AR_TRX_PURGE

Source


1 PACKAGE BODY pa_ar_trx_purge AS
2 -- $Header: PAXARPGB.pls 115.3 2002/07/22 04:59:47 mumohan ship $
3 
4   FUNCTION transaction_flex_context RETURN VARCHAR2 IS
5   flex_context CHAR(50);
6   BEGIN
7     SELECT r.name
8     INTO   flex_context
9     FROM   ra_batch_sources r,
10            pa_implementations p
11     WHERE  p.invoice_batch_source_id = r.batch_source_id;
12 
13     RETURN flex_context;
14    EXCEPTION
15         WHEN NO_DATA_FOUND THEN
16              RETURN NULL;
17         WHEN OTHERS THEN
18              RETURN SQLERRM;
19    END;
20 
21 
22   FUNCTION client_purgeable(p_customer_trx_id IN NUMBER) RETURN BOOLEAN IS
23    cursor c1 is
24           select 'x'
25           from dual
26           where exists (
27                         select 'x'
28                         from  pa_draft_invoices di
29                         where di.system_reference = p_customer_trx_id
30                        );
31    dummy varchar2(1);
32    allow_purge BOOLEAN := FALSE;
33   BEGIN
34 
35     -- Place your logic here. Set the value of allow_purge to TRUE if
36     -- you want this invoice to be purged, or FALSE if you don't want it
37     -- purged
38     open c1;
39     fetch c1 into dummy;
40 
41     if c1%found then
42        allow_purge := FALSE;
43     else
44        allow_purge := TRUE;
45     end if;
46 
47     close c1;
48 
49     RETURN allow_purge;
50 
51   END;
52 
53 
54   FUNCTION purgeable(p_customer_trx_id IN NUMBER) RETURN BOOLEAN IS
55    allow_purge BOOLEAN := FALSE;
56   BEGIN
57      allow_purge := client_purgeable(p_customer_trx_id);
58 
59      IF  (allow_purge = TRUE) THEN
60          return TRUE;
61      ELSE
62          return FALSE;
63      END IF;
64 
65   END;
66 
67 
68 END pa_ar_trx_purge;