DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_AD_WF_P2A

Source


1 PACKAGE BODY igs_ad_wf_p2a AS
2 /* $Header: IGSADD4B.pls 120.2 2005/11/21 05:48:43 appldev noship $ */
3 ---------------------------------------------------------------------------------------------------------------------------------------
4 --  Created By : akadam
5 --  Date Created On : 06-JUL-2005
6 --  Purpose : Bug: Prospect to Applicant Management Build.
7 --  Change History
8 --  Who             When            What
9 --
10 ---------------------------------------------------------------------------------------------------------------------------------------
11 
12   TYPE DFFAttributeSet IS TABLE OF IGS_SS_APP_PGM_STG.attribute1%TYPE;
13   g_dff_attribute DFFAttributeSet;
14   g_dff_attribute_category IGS_SS_APP_PGM_STG.attribute_category%TYPE;
15 
16 
17 
18  PROCEDURE set_return_message(
19             itemtype  in  VARCHAR2,
20 	        itemkey   in  VARCHAR2,
21             message_name in VARCHAR2,
22             message_count in NUMBER,
23             return_status in VARCHAR2,
24             message_token in VARCHAR2 DEFAULT NULL,
25             message_token_text in VARCHAR2 DEFAULT NULL) IS
26 
27  l_msg_idx_start               NUMBER;
28  l_msg_index                   NUMBER;
29  l_app_nme                     VARCHAR2(1000);
30  l_msg_nme                     VARCHAR2(2000);
31  l_msg_txt                     fnd_new_messages.message_text%TYPE;
32 
33   BEGIN
34     wf_engine.setitemattrtext(itemtype,itemkey,'P_RETURN_STATUS',return_status);
35     wf_engine.setitemattrnumber(itemtype,itemkey,'P_MSG_COUNT',message_count);
36 
37     l_msg_index := igs_ge_msg_stack.count_msg;
38     FND_MESSAGE.SET_NAME('IGS',message_name);
39     IF message_token IS NOT NULL THEN
40       FND_MESSAGE.SET_TOKEN(message_token ,message_token_text);
41     END IF;
42     IGS_GE_MSG_STACK.ADD;
43 
44     igs_ge_msg_stack.get(l_msg_index + 1,'T',l_msg_txt,l_msg_idx_start);
45     igs_ge_msg_stack.delete_msg(l_msg_idx_start);
46     fnd_message.parse_encoded (l_msg_txt, l_app_nme, l_msg_nme);
47     fnd_message.set_encoded (l_msg_txt);
48     l_msg_txt := fnd_message.get;
49 
50     wf_engine.setitemattrtext(itemtype,itemkey,'P_MSG_DATA',l_msg_txt);
51   END set_return_message;
52 
53   PROCEDURE call_apl_pre_crt_apis(
54             itemtype  in  VARCHAR2  ,
55 	    itemkey   in  VARCHAR2  ,
56 	    actid     in  NUMBER   ,
57             funcmode  in  VARCHAR2  ,
58 	    resultout   OUT NOCOPY VARCHAR2 )
59 
60   ------------------------------------------------------------------
61     --Created by  : akadam, Oracle IDC
62     --Date created: 10-OCT-2003
63     --
64     --Purpose: Prospect to Applicant Management Build
65     --
66     --Known limitations/enhancements and/or remarks:
67     --
68     --Change History:
69     --Who         When            What
70   -------------------------------------------------------------------
71   IS
72 
73     CURSOR c_app_type_det ( cp_app_type IGS_AD_SS_APPL_TYP.admission_application_type%TYPE) IS
74       SELECT  admission_cat,s_admission_process_type
75       FROM  igs_ad_ss_appl_typ
76       WHERE admission_application_type = cp_app_type;
77 
78     CURSOR c_seq_num IS
79       SELECT IGS_SS_ADM_APPL_S.NEXTVAL
80       FROM sys.dual;
81 
82     l_person_id IGS_PE_HZ_PARTIES.party_id%TYPE;
83     l_login_role VARCHAR2(30);
84     l_acad_cal_type IGS_CA_INST_ALL.cal_type%TYPE;
85     l_acad_cal_seq_number IGS_CA_INST_ALL.sequence_number%TYPE;
86     l_adm_cal_type IGS_CA_INST_ALL.cal_type%TYPE;
87     l_adm_ci_sequence_number IGS_CA_INST_ALL.sequence_number%TYPE;
88     l_application_type IGS_AD_SS_APPL_TYP.admission_application_type%TYPE;
89     l_location_code IGS_SS_APP_PGM_STG.location_cd%TYPE;
90     l_program_type IGS_PS_TYPE_ALL.course_type%TYPE;
91     l_sch_apl_to_id IGS_SS_APP_PGM_STG.sch_apl_to_id%TYPE;
92     l_attendance_type IGS_SS_APP_PGM_STG.attendance_type%TYPE;
93     l_attendance_mode IGS_SS_APP_PGM_STG.attendance_mode%TYPE;
94     l_entry_status IGS_SS_ADM_APPL_STG.entry_status%TYPE;
95     l_entry_level IGS_SS_ADM_APPL_STG.entry_level%TYPE;
96     l_spcl_gr1 IGS_SS_ADM_APPL_STG.spcl_grp_1%TYPE;
97     l_spcl_gr2 IGS_SS_ADM_APPL_STG.spcl_grp_2%TYPE;
98     l_apply_for_finaid IGS_SS_ADM_APPL_STG.apply_for_finaid%TYPE;
99     l_finaid_apply_date IGS_SS_ADM_APPL_STG.finaid_apply_date%TYPE;
100     l_application_fee_amount IGS_SS_ADM_APPL_STG.appl_fee_amt%TYPE;
101 
102 
103     l_admission_cat IGS_AD_SS_APPL_TYP.admission_cat%TYPE;
104     l_s_process_type IGS_AD_SS_APPL_TYP.s_admission_process_type%TYPE;
105     l_seq_val           NUMBER;
106     l_appl_source_id   IGS_AD_CODE_CLASSES.code_id%TYPE;
107 
108     l_return_status VARCHAR2(3);
109     l_msg_count NUMBER;
110     l_msg_data VARCHAR2(2000);
111     l_ss_adm_appl_id NUMBER;
112     l_ss_admappl_pgm_id NUMBER;
113 
114   BEGIN
115 
116     IF funcmode='RUN' THEN
117 
118       l_person_id                     := wf_engine.getitemattrnumber(itemtype,itemkey,'P_PERSON_ID');
119       l_login_role                    := wf_engine.getitemattrtext(itemtype,itemkey,'P_LOGIN_RESP');
120       l_acad_cal_type                 := wf_engine.getitemattrtext(itemtype,itemkey,'P_ACAD_CAL_TYPE');
121       l_acad_cal_seq_number           := wf_engine.getitemattrnumber(itemtype,itemkey,'P_ACAD_CAL_SEQ_NUMBER');
122       l_adm_cal_type                  := wf_engine.getitemattrtext(itemtype,itemkey,'P_ADM_CAL_TYPE');
123       l_adm_ci_sequence_number        := wf_engine.getitemattrnumber(itemtype,itemkey,'P_ADM_CI_SEQUENCE_NUMBER');
124       l_application_type              := wf_engine.getitemattrtext(itemtype,itemkey,'P_APPLICATION_TYPE');
125       l_location_code                 := wf_engine.getitemattrtext(itemtype,itemkey,'P_LOCATION_CODE');
126       l_program_type                  := wf_engine.getitemattrtext(itemtype,itemkey,'P_PROGRAM_TYPE');
127       l_sch_apl_to_id                 := wf_engine.getitemattrnumber(itemtype,itemkey,'P_SCH_APL_TO_ID');
128       l_attendance_type               := wf_engine.getitemattrtext(itemtype,itemkey,'P_ATTENDANCE_TYPE');
129       l_attendance_mode               := wf_engine.getitemattrtext(itemtype,itemkey,'P_ATTENDANCE_MODE');
130       l_entry_status                  := wf_engine.getitemattrtext(itemtype,itemkey,'P_ENTRY_STATUS');
131       l_entry_level                   := wf_engine.getitemattrtext(itemtype,itemkey,'P_ENTRY_LEVEL');
132       l_spcl_gr1                      := wf_engine.getitemattrtext(itemtype,itemkey,'P_SPCL_GR1');
133       l_spcl_gr2                      := wf_engine.getitemattrtext(itemtype,itemkey,'P_SPCL_GR2');
134       l_apply_for_finaid              := wf_engine.getitemattrtext(itemtype,itemkey,'P_APPLY_FOR_FINAID');
135       l_finaid_apply_date             := wf_engine.getitemattrtext(itemtype,itemkey,'P_APPLY_FOR_FINAID');
136       l_application_fee_amount        := wf_engine.getitemattrtext(itemtype,itemkey,'P_APPLICATION_FEE_AMOUNT');
137       l_appl_source_id                := wf_engine.getitemattrtext(itemtype,itemkey,'P_APPL_SOURCE_ID');
138 
139       l_admission_cat := NULL;
140       l_s_process_type := NULL;
141 
142       l_return_status := NULL;
143       l_msg_count := NULL;
144       l_msg_data := NULL;
145       l_ss_adm_appl_id := NULL;
146       l_ss_admappl_pgm_id := NULL;
147 
148       OPEN c_app_type_det(l_application_type);
149       FETCH c_app_type_det INTO l_admission_cat,l_s_process_type;
150       CLOSE c_app_type_det;
151 
152 
153       SAVEPOINT PRE_CREATE_APPLICATION_WF;
154 
155       IGS_PRECREATE_APPL_PUB.PRE_CREATE_APPLICATION(
156         p_api_version => 1.0,
157 	    p_init_msg_list => null,
158 	    p_commit => null,
159 	    p_validation_level => 0,
160 	    x_return_status => l_return_status,
161 	    x_msg_count => l_msg_count,
162 	    x_msg_data => l_msg_data,
163 	    p_person_id => l_person_id,
164 	    p_appl_date => trunc(SYSDATE),
165 	    p_acad_cal_type => l_acad_cal_type,
166 	    p_acad_cal_seq_number => l_acad_cal_seq_number,
167 	    p_adm_cal_type => l_adm_cal_type,
168 	    p_adm_cal_seq_number => l_adm_ci_sequence_number,
169 	    p_entry_status => l_entry_status,
170 	    p_entry_level => l_entry_level,
171 	    p_spcl_gr1 => l_spcl_gr1,
172 	    p_spcl_gr2 => l_spcl_gr2,
173 	    p_apply_for_finaid => l_apply_for_finaid,
174 	    p_finaid_apply_date => l_finaid_apply_date,
175 	    p_admission_application_type => l_application_type,
176 	    p_apsource_id => l_appl_source_id,
177 	    p_application_fee_amount => l_application_fee_amount,
178 	    x_ss_adm_appl_id => l_ss_adm_appl_id
179 	);
180 
181       IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
182 
183           wf_engine.setitemattrtext(itemtype,itemkey,'P_RETURN_STATUS',l_return_status);
184           wf_engine.setitemattrnumber(itemtype,itemkey,'P_MSG_COUNT',1);
185           wf_engine.setitemattrtext(itemtype,itemkey,'P_MSG_DATA',l_msg_data);
186           resultout := 'COMPLETE:ERROR';
187           RETURN;
188       END IF;
189 
190       IF (l_attendance_type IS NOT NULL OR
191          l_location_code   IS NOT NULL OR
192          l_attendance_mode   IS NOT NULL ) AND l_return_status = FND_API.G_RET_STS_SUCCESS THEN
193 
194          l_return_status := NULL;
195          l_msg_count := NULL;
196          l_msg_data := NULL;
197 
198          IGS_PRECREATE_APPL_PUB.PRE_CREATE_APPLICATION_INST(
199 			p_api_version => 1.0,
200 			p_init_msg_list => null,
201 			p_commit => null,
202 			p_validation_level => 0,
203 			x_return_status => l_return_status,
204 			x_msg_count => l_msg_count,
205 			x_msg_data => l_msg_data,
206 			p_ss_adm_appl_id => l_ss_adm_appl_id,
207 			p_sch_apl_to_id => l_sch_apl_to_id,
208 			p_location_cd => l_location_code,
209 			p_attendance_type => l_attendance_type,
210 			p_attendance_mode => l_attendance_mode,
211 			p_attribute_category => g_dff_attribute_category ,
212 			p_attribute1 => g_dff_attribute(1),
213 			p_attribute2 => g_dff_attribute(2),
214 			p_attribute3 => g_dff_attribute(3),
215 			p_attribute4 => g_dff_attribute(4),
216 			p_attribute5 => g_dff_attribute(5),
217 			p_attribute6 => g_dff_attribute(6),
218 			p_attribute7 => g_dff_attribute(7),
219 			p_attribute8 => g_dff_attribute(8),
220 			p_attribute9 => g_dff_attribute(9),
221 			p_attribute10 => g_dff_attribute(10),
222 			p_attribute11 => g_dff_attribute(11),
223 			p_attribute12 => g_dff_attribute(12),
224 			p_attribute13 => g_dff_attribute(13),
225 			p_attribute14 => g_dff_attribute(14),
226 			p_attribute15 => g_dff_attribute(15),
227 			p_attribute16 => g_dff_attribute(16),
228 			p_attribute17 => g_dff_attribute(17),
229 			p_attribute18 => g_dff_attribute(18),
230 			p_attribute19 => g_dff_attribute(19),
231 			p_attribute20 => g_dff_attribute(20),
232 			p_attribute21 => g_dff_attribute(21),
233 			p_attribute22 => g_dff_attribute(22),
234 			p_attribute23 => g_dff_attribute(23),
235 			p_attribute24 => g_dff_attribute(24),
236 			p_attribute25 => g_dff_attribute(25),
237 			p_attribute26 => g_dff_attribute(26),
238 			p_attribute27 => g_dff_attribute(27),
239 			p_attribute28 => g_dff_attribute(28),
240 			p_attribute29 => g_dff_attribute(29),
241 			p_attribute30 => g_dff_attribute(30),
242 			p_attribute31 => g_dff_attribute(31),
243 			p_attribute32 => g_dff_attribute(32),
244 			p_attribute33 => g_dff_attribute(33),
245 			p_attribute34 => g_dff_attribute(34),
246 			p_attribute35 => g_dff_attribute(35),
247 			p_attribute36 => g_dff_attribute(36),
248 			p_attribute37 => g_dff_attribute(37),
249 			p_attribute38 => g_dff_attribute(38),
250 			p_attribute39 => g_dff_attribute(39),
251 			p_attribute40 => g_dff_attribute(40),
252 			x_ss_admappl_pgm_id => l_ss_admappl_pgm_id
253             );
254 
255         IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
256 
257           ROLLBACK TO PRE_CREATE_APPLICATION_WF;
258           wf_engine.setitemattrtext(itemtype,itemkey,'P_RETURN_STATUS',l_return_status);
259           wf_engine.setitemattrnumber(itemtype,itemkey,'P_MSG_COUNT',1);
260           wf_engine.setitemattrtext(itemtype,itemkey,'P_MSG_DATA',l_msg_data);
261           resultout := 'COMPLETE:ERROR';
262           RETURN;
263         END IF;
264 
265       END IF;
266 
267 
268       set_return_message(itemtype,itemkey,null,null,'S');
269       wf_engine.setitemattrtext(itemtype,itemkey,'P_SS_ADM_APPL_ID', l_ss_adm_appl_id);
270 
271       resultout := 'COMPLETE:SUCCESS';
272 
273     END IF;
274 
275     EXCEPTION
276       WHEN OTHERS THEN
277         set_return_message(itemtype,itemkey,'IGS_GE_UNHANDLED_EXP',1,'U','NAME','CALL_APL_PRE_CRT_APIS');
278 
279         WF_CORE.CONTEXT ('IGS_AD_WF_P2A', 'CALL_APL_PRE_CRT_APIS', itemtype,
280                           itemkey, to_char(actid), funcmode);
281         RAISE;
282 
283   END call_apl_pre_crt_apis;
284 
285 
286   PROCEDURE call_drv_usr_hks(
287             itemtype  in  VARCHAR2  ,
288 	    itemkey   in  VARCHAR2  ,
289 	    actid     in  NUMBER   ,
290             funcmode  in  VARCHAR2  ,
291 	    resultout   OUT NOCOPY VARCHAR2 ) IS
292 
293 
294      CURSOR c_appl_fee_amount ( cp_app_type IGS_AD_SS_APPL_TYP.admission_application_type%TYPE) IS
295        SELECT application_fee_amount,admission_application_type
296        FROM igs_ad_ss_appl_typ
297        WHERE admission_application_type = cp_app_type;
298 
299      CURSOR c_appl_type_uhk_prl IS
300        SELECT  FND_PROFILE.VALUE('IGS_AD_APPL_TYPE_UHK') value
301        FROM dual;
302 
303      CURSOR c_appl_fee_uhk_prl IS
304        SELECT  FND_PROFILE.VALUE('IGS_AD_APPL_FEE_UHK') value
305        FROM dual;
306 
307      l_person_id IGS_PE_HZ_PARTIES.party_id%TYPE;
308      l_login_role VARCHAR2(30);
309      l_acad_cal_type IGS_CA_INST_ALL.cal_type%TYPE;
310      l_acad_cal_seq_number IGS_CA_INST_ALL.sequence_number%TYPE;
311      l_adm_cal_type IGS_CA_INST_ALL.cal_type%TYPE;
312      l_adm_ci_sequence_number IGS_CA_INST_ALL.sequence_number%TYPE;
313      l_application_type IGS_AD_SS_APPL_TYP.admission_application_type%TYPE;
314      l_location_code IGS_SS_APP_PGM_STG.location_cd%TYPE;
315      l_program_type IGS_PS_TYPE_ALL.course_type%TYPE;
316      l_sch_apl_to_id IGS_SS_APP_PGM_STG.sch_apl_to_id%TYPE;
317      l_attendance_type IGS_SS_APP_PGM_STG.attendance_type%TYPE;
318      l_attendance_mode IGS_SS_APP_PGM_STG.attendance_mode%TYPE;
319      l_oo_attribute_1 VARCHAR2(1);
320      l_oo_attribute_2 VARCHAR2(1);
321      l_oo_attribute_3 VARCHAR2(1);
322      l_oo_attribute_4 VARCHAR2(1);
323      l_oo_attribute_5 VARCHAR2(1);
324      l_oo_attribute_6 VARCHAR2(1);
325      l_oo_attribute_7 VARCHAR2(1);
326      l_oo_attribute_8 VARCHAR2(1);
327      l_oo_attribute_9 VARCHAR2(1);
328      l_oo_attribute_10 VARCHAR2(1);
329      l_citizenship_residency_ind VARCHAR2(1);
330      l_cit_res_attribute_1 VARCHAR2(1);
331      l_cit_res_attribute_2 VARCHAR2(1);
332      l_cit_res_attribute_3 VARCHAR2(1);
333      l_cit_res_attribute_4 VARCHAR2(1);
334      l_cit_res_attribute_5 VARCHAR2(1);
335      l_cit_res_attribute_6 VARCHAR2(1);
336      l_cit_res_attribute_7 VARCHAR2(1);
337      l_cit_res_attribute_8 VARCHAR2(1);
338      l_cit_res_attribute_9 VARCHAR2(1);
339      l_cit_res_attribute_10 VARCHAR2(1);
340      l_state_of_res_type_code VARCHAR2(30);
341      l_dom_attribute_1 VARCHAR2(1);
342      l_dom_attribute_2 VARCHAR2(1);
343      l_dom_attribute_3 VARCHAR2(1);
344      l_dom_attribute_4 VARCHAR2(1);
345      l_dom_attribute_5 VARCHAR2(1);
346      l_dom_attribute_6 VARCHAR2(1);
347      l_dom_attribute_7 VARCHAR2(1);
348      l_dom_attribute_8 VARCHAR2(1);
349      l_dom_attribute_9 VARCHAR2(1);
350      l_dom_attribute_10 VARCHAR2(1);
351      l_gen_attribute_1 VARCHAR2(1);
352      l_gen_attribute_2 VARCHAR2(1);
353      l_gen_attribute_3 VARCHAR2(1);
354      l_gen_attribute_4 VARCHAR2(1);
355      l_gen_attribute_5 VARCHAR2(1);
356      l_gen_attribute_6 VARCHAR2(1);
357      l_gen_attribute_7 VARCHAR2(1);
358      l_gen_attribute_8 VARCHAR2(1);
359      l_gen_attribute_9 VARCHAR2(1);
360      l_gen_attribute_10 VARCHAR2(1);
361      l_gen_attribute_11 VARCHAR2(1);
362      l_gen_attribute_12 VARCHAR2(1);
363      l_gen_attribute_13 VARCHAR2(1);
364      l_gen_attribute_14 VARCHAR2(1);
365      l_gen_attribute_15 VARCHAR2(1);
366      l_gen_attribute_16 VARCHAR2(1);
367      l_gen_attribute_17 VARCHAR2(1);
368      l_gen_attribute_18 VARCHAR2(1);
369      l_gen_attribute_19 VARCHAR2(1);
370      l_gen_attribute_20 VARCHAR2(1);
371      l_entry_status IGS_SS_ADM_APPL_STG.entry_status%TYPE;
372      l_entry_level IGS_SS_ADM_APPL_STG.entry_level%TYPE;
373      l_spcl_gr1 IGS_SS_ADM_APPL_STG.spcl_grp_1%TYPE;
374      l_spcl_gr2 IGS_SS_ADM_APPL_STG.spcl_grp_2%TYPE;
375      l_apply_for_finaid IGS_SS_ADM_APPL_STG.apply_for_finaid%TYPE;
376      l_finaid_apply_date IGS_SS_ADM_APPL_STG.finaid_apply_date%TYPE;
377      l_application_fee_amount IGS_SS_ADM_APPL_STG.appl_fee_amt%TYPE;
378 
379      l_application_fee_amount_test IGS_SS_ADM_APPL_STG.appl_fee_amt%TYPE;
380 
381      cl_appl_type IGS_AD_SS_APPL_TYP.admission_application_type%TYPE;
382      l_result VARCHAR2(30);
383      l_appl_type_uhk_prl c_appl_type_uhk_prl%ROWTYPE;
384      l_appl_fee_uhk_prl c_appl_fee_uhk_prl%ROWTYPE;
385      l_appl_date DATE;
386      i BINARY_INTEGER;
387   BEGIN
388 
389     IF g_dff_attribute IS NULL THEN
390 
391       g_dff_attribute := DFFAttributeSet(null,null,null,null,null,null,null,null,null,null,
392                                          null,null,null,null,null,null,null,null,null,null,
393                                          null,null,null,null,null,null,null,null,null,null,
394                                          null,null,null,null,null,null,null,null,null,null,null);
395     ELSE
396      FOR i IN g_dff_attribute.FIRST..g_dff_attribute.LAST LOOP
397 
398      g_dff_attribute(i) := null;
399      END LOOP;
400 
401     END IF;
402 
403     g_dff_attribute_category := NULL;
404     cl_appl_type := NULL;
405     l_appl_fee_uhk_prl := NULL;
406     l_appl_type_uhk_prl := NULL;
407 
408     OPEN c_appl_type_uhk_prl;
409     FETCH c_appl_type_uhk_prl INTO l_appl_type_uhk_prl;
410     CLOSE c_appl_type_uhk_prl;
411 
412     l_appl_date := trunc(SYSDATE);
413 
414     IF funcmode='RUN' THEN
415 
416       l_person_id                     := wf_engine.getitemattrnumber(itemtype,itemkey,'P_PERSON_ID');
417       l_login_role                  	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_LOGIN_RESP');
418       l_acad_cal_type               	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_ACAD_CAL_TYPE');
419       l_acad_cal_seq_number         	:= wf_engine.getitemattrnumber(itemtype,itemkey,'P_ACAD_CAL_SEQ_NUMBER');
420       l_adm_cal_type                	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_ADM_CAL_TYPE');
421       l_adm_ci_sequence_number      	:= wf_engine.getitemattrnumber(itemtype,itemkey,'P_ADM_CI_SEQUENCE_NUMBER');
422       l_application_type            	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_APPLICATION_TYPE');
423       l_location_code               	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_LOCATION_CODE');
424       l_program_type                	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_PROGRAM_TYPE');
425       l_sch_apl_to_id               	:= wf_engine.getitemattrnumber(itemtype,itemkey,'P_SCH_APL_TO_ID');
426       l_attendance_type             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_ATTENDANCE_TYPE');
427       l_attendance_mode             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_ATTENDANCE_MODE');
428       l_oo_attribute_1              	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_OO_ATTRIBUTE_1');
429       l_oo_attribute_2              	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_OO_ATTRIBUTE_2');
430       l_oo_attribute_3              	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_OO_ATTRIBUTE_3');
431       l_oo_attribute_4              	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_OO_ATTRIBUTE_4');
432       l_oo_attribute_5              	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_OO_ATTRIBUTE_5');
433       l_oo_attribute_6              	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_OO_ATTRIBUTE_6');
434       l_oo_attribute_7              	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_OO_ATTRIBUTE_7');
435       l_oo_attribute_8                  := wf_engine.getitemattrtext(itemtype,itemkey,'P_OO_ATTRIBUTE_8');
436       l_oo_attribute_9              	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_OO_ATTRIBUTE_9');
437       l_oo_attribute_10             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_OO_ATTRIBUTE_10');
438       l_citizenship_residency_ind   	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_CITIZENSHIP_RESIDENCY_IND');
439       l_cit_res_attribute_1         	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_CIT_RES_ATTRIBUTE_1');
440       l_cit_res_attribute_2         	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_CIT_RES_ATTRIBUTE_2');
441       l_cit_res_attribute_3         	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_CIT_RES_ATTRIBUTE_3');
442       l_cit_res_attribute_4         	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_CIT_RES_ATTRIBUTE_4');
443       l_cit_res_attribute_5         	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_CIT_RES_ATTRIBUTE_5');
444       l_cit_res_attribute_6         	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_CIT_RES_ATTRIBUTE_6');
445       l_cit_res_attribute_7         	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_CIT_RES_ATTRIBUTE_7');
446       l_cit_res_attribute_8         	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_CIT_RES_ATTRIBUTE_8');
447       l_cit_res_attribute_9         	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_CIT_RES_ATTRIBUTE_9');
448       l_cit_res_attribute_10        	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_CIT_RES_ATTRIBUTE_10');
449       l_state_of_res_type_code      	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_STATE_OF_RES_TYPE_CODE');
450       l_dom_attribute_1             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_DOM_ATTRIBUTE_1');
451       l_dom_attribute_2             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_DOM_ATTRIBUTE_2');
452       l_dom_attribute_3             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_DOM_ATTRIBUTE_3');
453       l_dom_attribute_4             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_DOM_ATTRIBUTE_4');
454       l_dom_attribute_5             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_DOM_ATTRIBUTE_5');
455       l_dom_attribute_6                 := wf_engine.getitemattrtext(itemtype,itemkey,'P_DOM_ATTRIBUTE_6');
456       l_dom_attribute_7             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_DOM_ATTRIBUTE_7');
457       l_dom_attribute_8             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_DOM_ATTRIBUTE_8');
458       l_dom_attribute_9             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_DOM_ATTRIBUTE_9');
459       l_dom_attribute_10            	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_DOM_ATTRIBUTE_10');
460       l_gen_attribute_1             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_1');
461       l_gen_attribute_2             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_2');
462       l_gen_attribute_3             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_3');
463       l_gen_attribute_4             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_4');
464       l_gen_attribute_5             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_5');
465       l_gen_attribute_6             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_6');
466       l_gen_attribute_7             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_7');
467       l_gen_attribute_8             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_8');
468       l_gen_attribute_9             	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_9');
469       l_gen_attribute_10            	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_10');
470       l_gen_attribute_11            	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_11');
471       l_gen_attribute_12            	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_12');
472       l_gen_attribute_13            	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_13');
473       l_gen_attribute_14            	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_14');
474       l_gen_attribute_15            	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_15');
475       l_gen_attribute_16            	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_16');
476       l_gen_attribute_17            	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_17');
477       l_gen_attribute_18            	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_18');
478       l_gen_attribute_19            	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_19');
479       l_gen_attribute_20            	:= wf_engine.getitemattrtext(itemtype,itemkey,'P_GEN_ATTRIBUTE_20');
480 
481       IF l_appl_type_uhk_prl.value ='Y' THEN
482 
483         igs_ad_uhk_pre_create_appl_pkg.derive_app_type (
484           p_person_id                     =>   l_person_id,
485           p_login_resp                    =>   l_login_role,
486           p_acad_cal_type                 =>   l_acad_cal_type,
487           p_acad_cal_seq_number           =>   l_acad_cal_seq_number,
488           p_adm_cal_type                  =>   l_adm_cal_type,
489           p_adm_ci_sequence_number        =>   l_adm_ci_sequence_number,
490           p_application_type              =>   l_application_type,
491           p_location_code                 =>   l_location_code,
492           p_program_type                  =>   l_program_type,
493           p_sch_apl_to_id                 =>   l_sch_apl_to_id,
494           p_attendance_type               =>   l_attendance_type,
495           p_attendance_mode               =>   l_attendance_mode,
496           p_oo_attribute_1                =>   l_oo_attribute_1,
497           p_oo_attribute_2                =>   l_oo_attribute_2,
498           p_oo_attribute_3                =>   l_oo_attribute_3,
499           p_oo_attribute_4                =>   l_oo_attribute_4,
500           p_oo_attribute_5                =>   l_oo_attribute_5,
501           p_oo_attribute_6                =>   l_oo_attribute_6,
502           p_oo_attribute_7                =>   l_oo_attribute_7,
503           p_oo_attribute_8                =>   l_oo_attribute_8,
504           p_oo_attribute_9                =>   l_oo_attribute_9,
505           p_oo_attribute_10               =>   l_oo_attribute_10,
506           p_citizenship_residency_ind     =>   l_citizenship_residency_ind,
507           p_cit_res_attribute_1           =>   l_cit_res_attribute_1,
508           p_cit_res_attribute_2           =>   l_cit_res_attribute_2,
509           p_cit_res_attribute_3           =>   l_cit_res_attribute_3,
510           p_cit_res_attribute_4           =>   l_cit_res_attribute_4,
511           p_cit_res_attribute_5           =>   l_cit_res_attribute_5,
512           p_cit_res_attribute_6           =>   l_cit_res_attribute_6,
513           p_cit_res_attribute_7           =>   l_cit_res_attribute_7,
514           p_cit_res_attribute_8           =>   l_cit_res_attribute_8,
515           p_cit_res_attribute_9           =>   l_cit_res_attribute_9,
516           p_cit_res_attribute_10          =>   l_cit_res_attribute_10,
517           p_state_of_res_type_code        =>   l_state_of_res_type_code,
518           p_dom_attribute_1               =>   l_dom_attribute_1,
519           p_dom_attribute_2               =>   l_dom_attribute_2,
520           p_dom_attribute_3               =>   l_dom_attribute_3,
521           p_dom_attribute_4               =>   l_dom_attribute_4,
522           p_dom_attribute_5               =>   l_dom_attribute_5,
523           p_dom_attribute_6               =>   l_dom_attribute_6,
524           p_dom_attribute_7               =>   l_dom_attribute_7,
525           p_dom_attribute_8               =>   l_dom_attribute_8,
526           p_dom_attribute_9               =>   l_dom_attribute_9,
527           p_dom_attribute_10              =>   l_dom_attribute_10,
528           p_gen_attribute_1               =>   l_gen_attribute_1,
529           p_gen_attribute_2               =>   l_gen_attribute_2,
530           p_gen_attribute_3               =>   l_gen_attribute_3,
531           p_gen_attribute_4               =>   l_gen_attribute_4,
532           p_gen_attribute_5               =>   l_gen_attribute_5,
533           p_gen_attribute_6               =>   l_gen_attribute_6,
534           p_gen_attribute_7               =>   l_gen_attribute_7,
535           p_gen_attribute_8               =>   l_gen_attribute_8,
536           p_gen_attribute_9               =>   l_gen_attribute_9,
537           p_gen_attribute_10              =>   l_gen_attribute_10,
538           p_gen_attribute_11              =>   l_gen_attribute_11,
539           p_gen_attribute_12              =>   l_gen_attribute_12,
540           p_gen_attribute_13              =>   l_gen_attribute_13,
541           p_gen_attribute_14              =>   l_gen_attribute_14,
542           p_gen_attribute_15              =>   l_gen_attribute_15,
543           p_gen_attribute_16              =>   l_gen_attribute_16,
544           p_gen_attribute_17              =>   l_gen_attribute_17,
545           p_gen_attribute_18              =>   l_gen_attribute_18,
546           p_gen_attribute_19              =>   l_gen_attribute_19,
547           p_gen_attribute_20              =>   l_gen_attribute_20,
548           p_entry_status                  =>   l_entry_status,
549           p_entry_level                   =>   l_entry_level,
550           p_spcl_gr1                      =>   l_spcl_gr1,
551           p_spcl_gr2                      =>   l_spcl_gr2,
552           p_apply_for_finaid              =>   l_apply_for_finaid,
553           p_finaid_apply_date             =>   l_finaid_apply_date,
554           p_appl_date                     =>   l_appl_date,
555           p_attribute_category            =>   g_dff_attribute_category,
556           p_attribute1                    =>   g_dff_attribute(1),
557           p_attribute2                    =>   g_dff_attribute(2),
558           p_attribute3                    =>   g_dff_attribute(3),
559           p_attribute4                    =>   g_dff_attribute(4),
560           p_attribute5                    =>   g_dff_attribute(5),
561           p_attribute6                    =>   g_dff_attribute(6),
562           p_attribute7                    =>   g_dff_attribute(7),
563           p_attribute8                    =>   g_dff_attribute(8),
564           p_attribute9                    =>   g_dff_attribute(9),
565           p_attribute10                   =>   g_dff_attribute(10),
566           p_attribute11                   =>   g_dff_attribute(11),
567           p_attribute12                   =>   g_dff_attribute(12),
568           p_attribute13                   =>   g_dff_attribute(13),
569           p_attribute14                   =>   g_dff_attribute(14),
570           p_attribute15                   =>   g_dff_attribute(15),
571           p_attribute16                   =>   g_dff_attribute(16),
572           p_attribute17                   =>   g_dff_attribute(17),
573           p_attribute18                   =>   g_dff_attribute(18),
574           p_attribute19                   =>   g_dff_attribute(19),
575           p_attribute20                   =>   g_dff_attribute(20),
576           p_attribute21                   =>   g_dff_attribute(21),
577           p_attribute22                   =>   g_dff_attribute(22),
578           p_attribute23                   =>   g_dff_attribute(23),
579           p_attribute24                   =>   g_dff_attribute(24),
580           p_attribute25                   =>   g_dff_attribute(25),
581           p_attribute26                   =>   g_dff_attribute(26),
582           p_attribute27                   =>   g_dff_attribute(27),
583           p_attribute28                   =>   g_dff_attribute(28),
584           p_attribute29                   =>   g_dff_attribute(29),
585           p_attribute30                   =>   g_dff_attribute(30),
586           p_attribute31                   =>   g_dff_attribute(31),
587           p_attribute32                   =>   g_dff_attribute(32),
588           p_attribute33                   =>   g_dff_attribute(33),
589           p_attribute34                   =>   g_dff_attribute(34),
590           p_attribute35                   =>   g_dff_attribute(35),
591           p_attribute36                   =>   g_dff_attribute(36),
592           p_attribute37                   =>   g_dff_attribute(37),
593           p_attribute38                   =>   g_dff_attribute(38),
594           p_attribute39                   =>   g_dff_attribute(39),
595           p_attribute40                   =>   g_dff_attribute(40)
596           );
597       END IF;
598 
599         OPEN c_appl_fee_amount(l_application_type);
600         FETCH c_appl_fee_amount INTO l_application_fee_amount,cl_appl_type;
601         CLOSE c_appl_fee_amount;
602 
603         IF l_application_fee_amount IS NULL THEN
604              l_application_fee_amount := 0;
605         END IF;
606 
607         OPEN c_appl_fee_uhk_prl;
608         FETCH c_appl_fee_uhk_prl INTO l_appl_fee_uhk_prl;
609         CLOSE c_appl_fee_uhk_prl;
610 
611         IF l_appl_fee_uhk_prl.value = 'Y' THEN
612 
613           igs_ad_uhk_pre_create_appl_pkg.derive_app_fee (
614             p_person_id                     =>   l_person_id,
615             p_login_resp                    =>   l_login_role,
616             p_acad_cal_type                 =>   l_acad_cal_type,
617             p_acad_cal_seq_number           =>   l_acad_cal_seq_number,
618             p_adm_cal_type                  =>   l_adm_cal_type,
619             p_adm_ci_sequence_number        =>   l_adm_ci_sequence_number,
620             p_application_type              =>   l_application_type,
621             p_application_fee_amount        =>   l_application_fee_amount,
622             p_location_code                 =>   l_location_code,
623             p_program_type                  =>   l_program_type,
624             p_sch_apl_to_id                 =>   l_sch_apl_to_id,
625             p_attendance_type               =>   l_attendance_type,
626             p_attendance_mode               =>   l_attendance_mode,
627             p_oo_attribute_1                =>   l_oo_attribute_1,
628             p_oo_attribute_2                =>   l_oo_attribute_2,
629             p_oo_attribute_3                =>   l_oo_attribute_3,
630             p_oo_attribute_4                =>   l_oo_attribute_4,
631             p_oo_attribute_5                =>   l_oo_attribute_5,
632             p_oo_attribute_6                =>   l_oo_attribute_6,
633             p_oo_attribute_7                =>   l_oo_attribute_7,
634             p_oo_attribute_8                =>   l_oo_attribute_8,
635             p_oo_attribute_9                =>   l_oo_attribute_9,
636             p_oo_attribute_10               =>   l_oo_attribute_10,
637             p_citizenship_residency_ind     =>   l_citizenship_residency_ind,
638             p_cit_res_attribute_1           =>   l_cit_res_attribute_1,
639             p_cit_res_attribute_2           =>   l_cit_res_attribute_2,
640             p_cit_res_attribute_3           =>   l_cit_res_attribute_3,
641             p_cit_res_attribute_4           =>   l_cit_res_attribute_4,
642             p_cit_res_attribute_5           =>   l_cit_res_attribute_5,
643             p_cit_res_attribute_6           =>   l_cit_res_attribute_6,
644             p_cit_res_attribute_7           =>   l_cit_res_attribute_7,
645             p_cit_res_attribute_8           =>   l_cit_res_attribute_8,
646             p_cit_res_attribute_9           =>   l_cit_res_attribute_9,
647             p_cit_res_attribute_10          =>   l_cit_res_attribute_10,
648             p_state_of_res_type_code        =>   l_state_of_res_type_code,
649             p_dom_attribute_1               =>   l_dom_attribute_1,
650             p_dom_attribute_2               =>   l_dom_attribute_2,
651             p_dom_attribute_3               =>   l_dom_attribute_3,
652             p_dom_attribute_4               =>   l_dom_attribute_4,
653             p_dom_attribute_5               =>   l_dom_attribute_5,
654             p_dom_attribute_6               =>   l_dom_attribute_6,
655             p_dom_attribute_7               =>   l_dom_attribute_7,
656             p_dom_attribute_8               =>   l_dom_attribute_8,
657             p_dom_attribute_9               =>   l_dom_attribute_9,
658             p_dom_attribute_10              =>   l_dom_attribute_10,
659             p_gen_attribute_1               =>   l_gen_attribute_1,
660             p_gen_attribute_2               =>   l_gen_attribute_2,
661             p_gen_attribute_3               =>   l_gen_attribute_3,
662             p_gen_attribute_4               =>   l_gen_attribute_4,
663             p_gen_attribute_5               =>   l_gen_attribute_5,
664             p_gen_attribute_6               =>   l_gen_attribute_6,
665             p_gen_attribute_7               =>   l_gen_attribute_7,
666             p_gen_attribute_8               =>   l_gen_attribute_8,
667             p_gen_attribute_9               =>   l_gen_attribute_9,
668             p_gen_attribute_10              =>   l_gen_attribute_10,
669             p_gen_attribute_11              =>   l_gen_attribute_11,
670             p_gen_attribute_12              =>   l_gen_attribute_12,
671             p_gen_attribute_13              =>   l_gen_attribute_13,
672             p_gen_attribute_14              =>   l_gen_attribute_14,
673             p_gen_attribute_15              =>   l_gen_attribute_15,
674             p_gen_attribute_16              =>   l_gen_attribute_16,
675             p_gen_attribute_17              =>   l_gen_attribute_17,
676             p_gen_attribute_18              =>   l_gen_attribute_18,
677             p_gen_attribute_19              =>   l_gen_attribute_19,
678             p_gen_attribute_20              =>   l_gen_attribute_20,
679             p_entry_status                  =>   l_entry_status,
680             p_entry_level                   =>   l_entry_level,
681             p_spcl_gr1                      =>   l_spcl_gr1,
682             p_spcl_gr2                      =>   l_spcl_gr2,
683             p_apply_for_finaid              =>   l_apply_for_finaid,
684             p_finaid_apply_date             =>   l_finaid_apply_date,
685             p_appl_date                     =>   l_appl_date,
686             p_attribute_category            =>   g_dff_attribute_category,
687             p_attribute1                    =>   g_dff_attribute(1),
688             p_attribute2                    =>   g_dff_attribute(2),
689             p_attribute3                    =>   g_dff_attribute(3),
690             p_attribute4                    =>   g_dff_attribute(4),
691             p_attribute5                    =>   g_dff_attribute(5),
692             p_attribute6                    =>   g_dff_attribute(6),
693             p_attribute7                    =>   g_dff_attribute(7),
694             p_attribute8                    =>   g_dff_attribute(8),
695             p_attribute9                    =>   g_dff_attribute(9),
696             p_attribute10                   =>   g_dff_attribute(10),
697             p_attribute11                   =>   g_dff_attribute(11),
698             p_attribute12                   =>   g_dff_attribute(12),
699             p_attribute13                   =>   g_dff_attribute(13),
700             p_attribute14                   =>   g_dff_attribute(14),
701             p_attribute15                   =>   g_dff_attribute(15),
702             p_attribute16                   =>   g_dff_attribute(16),
703             p_attribute17                   =>   g_dff_attribute(17),
704             p_attribute18                   =>   g_dff_attribute(18),
705             p_attribute19                   =>   g_dff_attribute(19),
706             p_attribute20                   =>   g_dff_attribute(20),
707             p_attribute21                   =>   g_dff_attribute(21),
708             p_attribute22                   =>   g_dff_attribute(22),
709             p_attribute23                   =>   g_dff_attribute(23),
710             p_attribute24                   =>   g_dff_attribute(24),
711             p_attribute25                   =>   g_dff_attribute(25),
712             p_attribute26                   =>   g_dff_attribute(26),
713             p_attribute27                   =>   g_dff_attribute(27),
714             p_attribute28                   =>   g_dff_attribute(28),
715             p_attribute29                   =>   g_dff_attribute(29),
716             p_attribute30                   =>   g_dff_attribute(30),
717             p_attribute31                   =>   g_dff_attribute(31),
718             p_attribute32                   =>   g_dff_attribute(32),
719             p_attribute33                   =>   g_dff_attribute(33),
720             p_attribute34                   =>   g_dff_attribute(34),
721             p_attribute35                   =>   g_dff_attribute(35),
722             p_attribute36                   =>   g_dff_attribute(36),
723             p_attribute37                   =>   g_dff_attribute(37),
724             p_attribute38                   =>   g_dff_attribute(38),
725             p_attribute39                   =>   g_dff_attribute(39),
726             p_attribute40                   =>   g_dff_attribute(40)
727             );
728 
729           IF l_application_fee_amount IS NULL THEN
730             l_application_fee_amount := 0;
731           END IF;
732 
733         END IF;
734 
735 
736         OPEN c_appl_fee_amount(l_application_type);
737         FETCH c_appl_fee_amount INTO l_application_fee_amount_test,cl_appl_type;
738         CLOSE c_appl_fee_amount;
739 
740         IF l_application_type IS NULL THEN
741           set_return_message(itemtype,itemkey,'IGS_SS_AD_APPL_MUST',1,'E');
742           l_result := 'COMPLETE:ERROR';
743         ELSIF cl_appl_type IS NULL THEN
744           set_return_message(itemtype,itemkey,'IGS_AD_APPL_TYP_NOT_SETUP',1,'E');
745           l_result := 'COMPLETE:ERROR';
746         ELSE
747           l_result := 'COMPLETE:SUCCESS';
748         END IF;
749 
750 
751           wf_engine.setitemattrtext(itemtype,itemkey,'P_APPLICATION_TYPE',  l_application_type);
752           wf_engine.setitemattrtext(itemtype,itemkey,'P_LOCATION_CODE',  l_location_code);
753           wf_engine.setitemattrtext(itemtype,itemkey,'P_PROGRAM_TYPE',   l_program_type);
754           wf_engine.setitemattrnumber(itemtype,itemkey,'P_SCH_APL_TO_ID', l_sch_apl_to_id);
755           wf_engine.setitemattrtext(itemtype,itemkey,'P_ATTENDANCE_TYPE', l_attendance_type);
756           wf_engine.setitemattrtext(itemtype,itemkey,'P_ATTENDANCE_MODE', l_attendance_mode);
757           wf_engine.setitemattrtext(itemtype,itemkey,'P_ENTRY_STATUS', l_entry_status);
758           wf_engine.setitemattrtext(itemtype,itemkey,'P_ENTRY_LEVEL', l_entry_level);
759           wf_engine.setitemattrtext(itemtype,itemkey,'P_SPCL_GR1', l_spcl_gr1);
760           wf_engine.setitemattrtext(itemtype,itemkey,'P_SPCL_GR2', l_spcl_gr2);
761           wf_engine.setitemattrtext(itemtype,itemkey,'P_APPLY_FOR_FINAID', l_apply_for_finaid);
762           wf_engine.setitemattrtext(itemtype,itemkey,'P_APPLY_FOR_FINAID', l_finaid_apply_date);
763           wf_engine.setitemattrtext(itemtype,itemkey,'P_APPLICATION_FEE_AMOUNT', l_application_fee_amount);
764 
765       resultout := l_result;
766     END IF;
767 
768     EXCEPTION
769       WHEN OTHERS THEN
770         set_return_message(itemtype,itemkey,'IGS_GE_UNHANDLED_EXP',1,'U','NAME','CALL_DRV_USR_HKS');
771         WF_CORE.CONTEXT ('IGS_AD_WF_P2A', 'CALL_DRV_USR_HKS', itemtype,
772                           itemkey, to_char(actid), funcmode);
773         RAISE;
774 
775   END call_drv_usr_hks;
776 
777   PROCEDURE drv_par_bef_api_cal(
778             itemtype  in  VARCHAR2  ,
779 	    itemkey   in  VARCHAR2  ,
780 	    actid     in  NUMBER   ,
781             funcmode  in  VARCHAR2  ,
782 	    resultout   OUT NOCOPY VARCHAR2 ) IS
783 
784     CURSOR c_source_id (cp_source IGS_AD_CODE_CLASSES.system_status%TYPE) IS
785       SELECT code_id
786       FROM igs_ad_code_classes
787       WHERE upper(system_status) = cp_source
788             and class = 'SYS_APPL_SOURCE' and system_default = 'Y'
789 	    AND CLASS_TYPE_CODE='ADM_CODE_CLASSES';
790 
791     l_login_role VARCHAR2(30);
792     l_appl_source_id   IGS_AD_CODE_CLASSES.code_id%TYPE;
793     l_app_source IGS_AD_CODE_CLASSES.system_status%TYPE;
794 
795   BEGIN
796 
797     l_appl_source_id := NULL;
798 
799     IF funcmode='RUN' THEN
800 
801       l_login_role := wf_engine.getitemattrtext(itemtype,itemkey,'P_LOGIN_RESP');
802 
803       IF l_login_role = 'ADMIN' THEN
804 
805         l_app_source := 'WEB_STAFF';
806 
807       ELSE
808 
809         l_app_source := 'WEB_APPL';
810 
811       END IF;
812 
813       OPEN c_source_id(l_app_source);
814       FETCH c_source_id INTO l_appl_source_id;
815       CLOSE c_source_id;
816 
817       IF l_appl_source_id IS NULL THEN
818 
819         IF l_app_source = 'WEB_APPL' THEN
820 
821           set_return_message(itemtype,itemkey,'IGS_AD_APL_SRC_WEB_APP',1,'E');
822           resultout := 'COMPLETE:ERROR';
823           RETURN;
824 
825         ELSE
826 
827           set_return_message(itemtype,itemkey,'IGS_AD_APL_SRC_WEB_STAFF',1,'E');
828           resultout := 'COMPLETE:ERROR';
829           RETURN;
830 
831         END IF;
832 
833       END IF;
834 
835       wf_engine.setitemattrtext(itemtype,itemkey,'P_APPL_SOURCE_ID', l_appl_source_id);
836 
837       resultout := 'COMPLETE:SUCCESS';
838     END IF;
839 
840     EXCEPTION
841       WHEN OTHERS THEN
842         set_return_message(itemtype,itemkey,'IGS_GE_UNHANDLED_EXP',1,'U','NAME','DRV_PAR_BEF_API_CAL');
843         WF_CORE.CONTEXT ('IGS_AD_WF_P2A', 'DRV_PAR_BEF_API_CAL', itemtype,
844                           itemkey, to_char(actid), funcmode);
845         RAISE;
846 
847   END drv_par_bef_api_cal;
848 
849 
850   PROCEDURE val_application_type(
851             itemtype  in  VARCHAR2  ,
852 	    itemkey   in  VARCHAR2  ,
853 	    actid     in  NUMBER   ,
854             funcmode  in  VARCHAR2  ,
855 	    resultout   OUT NOCOPY VARCHAR2 ) IS
856     l_result VARCHAR2(30);
857 
858 
859     CURSOR c_app_type_det ( cp_app_type IGS_AD_SS_APPL_TYP.admission_application_type%TYPE) IS
860       SELECT  admission_cat,s_admission_process_type
861       FROM  igs_ad_ss_appl_typ
862       WHERE admission_application_type = cp_app_type;
863 
864    -- Cursor to validate whether the Application Type is available in the current Admission Calendar
865     CURSOR c_apptype_admcal(p_adm_cal_type IGS_AD_PRD_AD_PRC_CA.adm_cal_type%TYPE,p_adm_cal_seq IGS_AD_PRD_AD_PRC_CA.adm_ci_sequence_number%TYPE
866                              , p_admission_cat IGS_AD_PRD_AD_PRC_CA.admission_cat%TYPE, p_s_admission_process_type IGS_AD_PRD_AD_PRC_CA.s_admission_process_type%TYPE) IS
867       SELECT s_admission_process_type
868       FROM IGS_AD_PRD_AD_PRC_CA
869       WHERE adm_cal_type = p_adm_cal_type AND
870             adm_ci_sequence_number = p_adm_cal_seq AND
871             admission_cat = p_admission_cat AND
872             s_admission_process_type = p_s_admission_process_type;
873 
874 
875     l_person_id IGS_PE_HZ_PARTIES.party_id%TYPE;
876     l_login_role VARCHAR2(30);
877     l_acad_cal_type IGS_CA_INST_ALL.cal_type%TYPE;
878     l_acad_cal_seq_number IGS_CA_INST_ALL.sequence_number%TYPE;
879     l_adm_cal_type IGS_CA_INST_ALL.cal_type%TYPE;
880     l_adm_ci_sequence_number IGS_CA_INST_ALL.sequence_number%TYPE;
881     l_application_type IGS_AD_SS_APPL_TYP.admission_application_type%TYPE;
882     l_application_type_test IGS_AD_PRD_AD_PRC_CA.s_admission_process_type%TYPE;
883 
884     l_location_code IGS_SS_APP_PGM_STG.location_cd%TYPE;
885     l_attendance_type IGS_SS_APP_PGM_STG.attendance_type%TYPE;
886     l_attendance_mode IGS_SS_APP_PGM_STG.attendance_mode%TYPE;
887 
888     l_admission_cat IGS_AD_SS_APPL_TYP.admission_cat%TYPE;
889     l_s_process_type IGS_AD_SS_APPL_TYP.s_admission_process_type%TYPE;
890     l_submission_deadline DATE;
891 
892     l_loc_des       IGS_AD_LOCATION.description%TYPE;
893     l_attd_type_des IGS_EN_ATD_TYPE.description%TYPE;
894     l_attd_mode_des IGS_EN_ATD_MODE.description%TYPE;
895     l_parval VARCHAR2(200);
896 
897   BEGIN
898 
899 
900     l_loc_des       := NULL;
901     l_attd_type_des := NULL;
902     l_attd_mode_des := NULL;
903     l_application_type_test := NULL;
904 
905     IF funcmode='RUN' THEN
906       l_person_id                     := wf_engine.getitemattrnumber(itemtype,itemkey,'P_PERSON_ID');
907       l_login_role                    := wf_engine.getitemattrtext(itemtype,itemkey,'P_LOGIN_RESP');
908       l_acad_cal_type                 := wf_engine.getitemattrtext(itemtype,itemkey,'P_ACAD_CAL_TYPE');
909       l_acad_cal_seq_number           := wf_engine.getitemattrnumber(itemtype,itemkey,'P_ACAD_CAL_SEQ_NUMBER');
910       l_adm_cal_type                  := wf_engine.getitemattrtext(itemtype,itemkey,'P_ADM_CAL_TYPE');
911       l_adm_ci_sequence_number        := wf_engine.getitemattrnumber(itemtype,itemkey,'P_ADM_CI_SEQUENCE_NUMBER');
912       l_application_type              := wf_engine.getitemattrtext(itemtype,itemkey,'P_APPLICATION_TYPE');
913       l_location_code                 := wf_engine.getitemattrtext(itemtype,itemkey,'P_LOCATION_CODE');
914       l_attendance_type               := wf_engine.getitemattrtext(itemtype,itemkey,'P_ATTENDANCE_TYPE');
915       l_attendance_mode               := wf_engine.getitemattrtext(itemtype,itemkey,'P_ATTENDANCE_MODE');
916 
917 
918       IF l_person_id IS NULL OR l_acad_cal_type IS NULL OR l_acad_cal_seq_number IS NULL OR
919          l_adm_cal_type IS NULL OR l_adm_ci_sequence_number IS NULL OR l_application_type IS NULL THEN
920          set_return_message(itemtype,itemkey,'IGS_AD_PRECREATE_PARAM_MISSING',1,'E');
921          resultout := 'COMPLETE:ERROR';
922          RETURN;
923       END IF;
924 
925       l_admission_cat := NULL;
926       l_s_process_type := NULL;
927 
928       OPEN c_app_type_det(l_application_type);
929       FETCH c_app_type_det INTO l_admission_cat,l_s_process_type;
930       CLOSE c_app_type_det;
931 
932       OPEN c_apptype_admcal(l_adm_cal_type,l_adm_ci_sequence_number,l_admission_cat,l_s_process_type);
933       FETCH c_apptype_admcal INTO l_application_type_test;
934       CLOSE c_apptype_admcal;
935 
936       IF l_application_type_test IS NULL THEN
937 
938         set_return_message(itemtype,itemkey,'IGS_AD_INVALID_APP_TYPE',1,'E');
939         resultout := 'COMPLETE:ERROR';
940         RETURN;
941 
942       END IF;
943 
944 
945       l_submission_deadline := igs_ad_gen_003.get_apc_date ('SUBMISSION_DEADLINE',
946                                     l_adm_cal_type,
947                                     l_adm_ci_sequence_number,
948                                     l_admission_cat,
949                                     l_s_process_type,
950                                     null,
951                                     null,
952                                     l_acad_cal_type,
953                                     l_location_code,
954                                     l_attendance_mode,
955                                     l_attendance_type
956                                    );
957 
958 
959       IF l_submission_deadline IS NOT NULL AND l_submission_deadline < trunc(SYSDATE) THEN
960 
961         set_return_message(itemtype,itemkey,'IGS_AD_SUB_DEADLINE',1,'E');
962         resultout := 'COMPLETE:ERROR';
963         RETURN;
964 
965       END IF;
966 
967       resultout := 'COMPLETE:SUCCESS';
968     END IF;
969 
970     EXCEPTION
971       WHEN OTHERS THEN
972         set_return_message(itemtype,itemkey,'IGS_GE_UNHANDLED_EXP',1,'U','NAME','VAL_APPLICATION_TYPE');
973         WF_CORE.CONTEXT ('IGS_AD_WF_P2A', 'VAL_APPLICATION_TYPE', itemtype,
974                           itemkey, to_char(actid), funcmode);
975         RAISE;
976 
977   END val_application_type;
978 
979 
980 END igs_ad_wf_p2a;