DBA Data[Home] [Help]

PACKAGE BODY: APPS.AMW_ASSERTIONS_PKG

Source


1 PACKAGE BODY AMW_ASSERTIONS_PKG as
2 /* $Header: amwtastb.pls 120.0 2005/05/31 19:51:29 appldev noship $ */
3 
4 -- ===============================================================
5 -- Function name
6 --          ACCT_ASSERTIONS_PRESENT
7 -- Purpose
8 -- 		    return non translated character (Y/N) to indicate the
9 --          selected(associated) Assertion
10 -- ===============================================================
11 FUNCTION ACCT_ASSERTIONS_PRESENT (
12     p_natural_account_id  IN         NUMBER,
13     p_assertion_code      IN         VARCHAR2
14 ) RETURN VARCHAR2
15 IS
16 n     number;
17 BEGIN
18    select count(*)
19    into n
20    from amw_account_assertions
21    where natural_account_id = p_natural_account_id
22    and   assertion_code = p_assertion_code;
23 
24    if n > 0 then
25        return 'Y';
26    else
27        return 'N';
28    end if;
29 END   ACCT_ASSERTIONS_PRESENT;
30 
31 
32 -- ===============================================================
33 -- Function name
34 --          ACCT_ASSERTIONS_PRESENT_MEAN
35 -- Purpose
36 -- 		    return translated meaning (Yes/No) to indicate the
37 --          selected(associated) Compliance Environment
38 -- ===============================================================
39 FUNCTION ACCT_ASSERTIONS_PRESENT_MEAN (
40     p_natural_account_id  IN         NUMBER,
41     p_assertion_code      IN         VARCHAR2
42 ) RETURN VARCHAR2
43 IS
44 n     number;
45 yes   varchar2(80);
46 no    varchar2(80);
47 BEGIN
48    select count(*)
49    into n
50    from amw_account_assertions
51    where natural_account_id = p_natural_account_id
52    and   assertion_code = p_assertion_code;
53 
54    select meaning
55    into yes
56    from fnd_lookups
57    where lookup_type='YES_NO'
58    and lookup_code='Y';
59 
60    select meaning
61    into no
62    from fnd_lookups
63    where lookup_type='YES_NO'
64    and lookup_code='N';
65 
66    if n > 0 then
67        ---return 'Y';
68        return yes;
69    else
70        ---return 'N';
71        return no;
72    end if;
73 END   ACCT_ASSERTIONS_PRESENT_MEAN;
74 
75 
76 -- ===============================================================
77 -- Procedure name
78 --          PROCESS_ACCT_ASSERTION_ASSOCS
79 -- Purpose
80 -- 		    Update the Account Assertion associations depending
81 --          on the specified p_select_flag .
82 -- ===============================================================
83 PROCEDURE PROCESS_ACCT_ASSERTION_ASSOCS (
84                    p_select_flag         IN         VARCHAR2,
85                    p_natural_account_id  IN         NUMBER,
86                    p_assertion_code      IN         VARCHAR2
87 )
88 IS
89       l_creation_date         date;
90       l_created_by            number;
91       l_last_update_date      date;
92       l_last_updated_by       number;
93       l_last_update_login     number;
94       l_account_assertion_id  number;
95       l_object_version_number number;
96 
97 BEGIN
98       delete from amw_account_assertions
99       where natural_account_id = p_natural_account_id
100 	  and   assertion_code = p_assertion_code;
101 
102       if (p_select_flag = 'Y') then
103 
104           l_creation_date := SYSDATE;
105           l_created_by := FND_GLOBAL.USER_ID;
106           l_last_update_date := SYSDATE;
107           l_last_updated_by := FND_GLOBAL.USER_ID;
108           l_last_update_login := FND_GLOBAL.USER_ID;
109           l_object_version_number := 1;
110 
111           select amw_account_assertion_s.nextval into l_account_assertion_id from dual;
112 
113           insert into amw_account_assertions (account_assertion_id,
114                                               natural_account_id,
115                                               assertion_code,
116                                               creation_date,
117                                               created_by,
118                                               last_update_date,
119                                               last_updated_by,
120                                               last_update_login,
121                                               object_version_number)
122           values (l_account_assertion_id,
123                   p_natural_account_id,
124                   p_assertion_code,
125                   l_creation_date,
126                   l_created_by,
127                   l_last_update_date,
128                   l_last_updated_by,
129                   l_last_update_login,
130                   l_object_version_number);
131 
132        end if;
133   EXCEPTION
134   WHEN OTHERS THEN
135     null;
136 
137 END PROCESS_ACCT_ASSERTION_ASSOCS;
138 
139 -- ----------------------------------------------------------------------
140 END AMW_ASSERTIONS_PKG;
141