1 PACKAGE BODY IGC_CC_WF_ACCOUNTS_PKG AS
2 /* $Header: IGCCWFCB.pls 120.2.12000000.1 2007/08/20 12:15:10 mbremkum ship $ */
3 --
4 -- is_encumbrance_on
5 --
6
7 procedure is_encumbrance_on ( itemtype in varchar2,
8 itemkey in varchar2,
9 actid in number,
10 funcmode in varchar2,
11 result out NOCOPY varchar2 )
12 is
13 cc_encumbrance_flag varchar2(4);
14 l_error_msg varchar2(200);
15 begin
16
17 l_error_msg := 'IGC_CC_WF_ACCOUNTS_PKG.is_encumbrance_on: 01';
18
19 -- Do nothing in cancel or timeout mode
20 --
21 if (funcmode = 'CANCEL') then
22
23 null;
24 return;
25
26 end if;
27
28 if (funcmode = 'TIMEOUT') then
29
30 null;
31 return;
32
33 end if;
34
35 if (funcmode = 'RUN') then
36
37 cc_encumbrance_flag := wf_engine.GetItemAttrText ( itemtype => itemtype,
38 itemkey => itemkey,
39 aname => 'CC_ENCUMBRANCE_FLAG');
40
41 if (cc_encumbrance_flag = 'Y' ) then
42 result := 'COMPLETE:TRUE';
43 else
44 result := 'COMPLETE:FALSE';
45 end if;
46
47 l_error_msg := 'IGC_CC_WF_ACCOUNTS_PKG.is_encumbrance_on: result = ' || result;
48
49 end if;
50
51 return;
52
53 EXCEPTION
54 WHEN OTHERS THEN
55 wf_core.context('IGC_CC_WF_ACCOUNTS_PKG','is_encumbrace_on', l_error_msg);
56 raise;
57
58 end is_encumbrance_on;
59
60 -- * **************************************************** *
61
62 --
63 -- is_cc_project_related
64 --
65 -- This is a dummy function that should be replaced by the customized function
66 -- activity in the workflow that return TRUE or FALSE based on whether you want to
67 -- use the default CC charge account generation rules or use "CUSTOMIZED"
68 -- project accounting rules.
69
70 procedure is_cc_project_related ( itemtype in varchar2,
71 itemkey in varchar2,
72 actid in number,
73 funcmode in varchar2,
74 result out NOCOPY varchar2 )
75 is
76
77 cc_project_id Number;
78
79 begin
80
81 -- Do nothing in cancel or timeout mode
82 --
83 if (funcmode = 'CANCEL') then
84
85 null;
86 return;
87
88 end if;
89
90 if (funcmode = 'TIMEOUT') then
91
92 null;
93 return;
94
95 end if;
96
97 if (funcmode = 'RUN') then
98
99 cc_project_id := wf_engine.GetItemAttrNumber ( itemtype => itemtype,
100 itemkey => itemkey,
101 aname => 'PROJECT_ID');
102 If (cc_project_id IS NOT NULL ) Then
103
104 result := 'COMPLETE:TRUE';
105 Else
106 result := 'COMPLETE:FALSE';
107
108 End If;
109
110 end if;
111
112 return;
113
114 end is_cc_project_related;
115
116 --
117 --
118 procedure get_charge_account ( itemtype in varchar2,
119 itemkey in varchar2,
120 actid in number,
121 funcmode in varchar2,
122 result out NOCOPY varchar2 )
123 is
124 l_ccid NUMBER;
125 l_error_msg varchar2(100);
126 begin
127
128 -- get code_combination_id from item attribute
129
130 l_ccid := wf_engine.GetItemAttrNumber ( itemtype => itemtype,
131 itemkey => itemkey,
132 aname => 'CHARGE_ACCOUNT_ID');
133
134 if (l_ccid IS NOT NULL) then
135
136 wf_engine.SetItemAttrNumber ( itemtype=>itemtype,
137 itemkey=>itemkey,
138 aname=>'TEMP_ACCOUNT_ID',
139 avalue=>l_ccid );
140
141 result := 'COMPLETE:SUCCESS';
142 else
143 result := 'COMPLETE:FAILURE';
144 end if;
145
146 l_error_msg := 'IGC_CC_WF_ACCOUNTS_PKG.get_charge_account : result = ' || result;
147
148 return;
149
150 EXCEPTION
151 WHEN OTHERS THEN
152 wf_core.context('IGC_CC_WF_ACCOUNTS_PKG','get_charge_account',l_error_msg);
153 raise;
154 end get_charge_account;
155
156 ----
157 --
158 -- This API is called from the CC default account generator process. This
159 -- API simply returns an error message specifying that the default process is
160 -- being used without proper customization.
161 --
162
163 procedure No_Process_Defined ( itemtype IN VARCHAR2,
164 itemkey IN VARCHAR2,
165 actid IN NUMBER,
166 funcmode IN VARCHAR2,
167 result OUT NOCOPY VARCHAR2 )
168 IS
169 --
170 l_error_msg VARCHAR2(2000);
171 --
172 BEGIN
173
174 IF funcmode <> 'RUN' THEN
175 result := null;
176 RETURN;
177 END IF;
178
179 fnd_message.set_name('IGC', 'IGC_NO_AG_PROCESS_DEFINED') ;
180 l_error_msg := fnd_message.get_encoded ;
181
182 wf_engine.SetItemAttrText( itemtype => itemtype,
183 itemkey => itemkey,
184 aname => 'ERROR_MESSAGE',
185 avalue => l_error_msg
186 );
187
188 result := 'COMPLETE:FAILURE';
189 RETURN;
190
191 EXCEPTION
192 WHEN OTHERS THEN
193 wf_core.context('IGC_CC_WF_ACCOUNTS_PKG','No_Process_Defined', l_error_msg);
194 raise;
195
196 END No_Process_Defined ;
197
198
199 END IGC_CC_WF_ACCOUNTS_PKG;