1 PACKAGE BODY igs_he_extract_fields_pkg AS
2 /* $Header: IGSHE9CB.pls 120.14 2006/09/15 01:49:20 jtmathew noship $ */
3
4 PROCEDURE write_to_log (p_message IN VARCHAR2)
5 IS
6 /***************************************************************
7 Created By :
8 Date Created By :
9 Purpose : This procedures writes onto the log file
10 Known Limitations,Enhancements or Remarks:
11 Change History :
12 Who When What
13 ***************************************************************/
14 BEGIN
15
16 Fnd_File.Put_Line(Fnd_File.Log, p_message);
17
18 END write_to_log;
19
20
21 PROCEDURE get_hesa_inst_id
22 (p_hesa_inst_id OUT NOCOPY VARCHAR2)
23 IS
24 /***************************************************************
25 Created By :
26 Date Created By :
27 Purpose : This procedure gets the HESA Institution Identfier.
28 Known Limitations,Enhancements or Remarks:
29 Change History :
30 Who When What
31 ***************************************************************/
32
33 CURSOR c_get_instid IS
34 SELECT ihp.oi_govt_institution_cd govt_institution_cd
35 FROM igs_pe_hz_parties ihp,
36 igs_or_inst_stat st
37 WHERE ihp.oi_institution_status = st.institution_status AND
38 st.s_institution_status= 'ACTIVE' AND
39 ihp.oi_local_institution_ind = 'Y' AND
40 ihp.inst_org_ind = 'I' AND
41 ihp.oi_govt_institution_cd IS NOT NULL;
42
43 BEGIN
44 OPEN c_get_instid;
45 FETCH c_get_instid INTO p_hesa_inst_id;
46 CLOSE c_get_instid;
47
48 EXCEPTION
49 WHEN OTHERS
50 THEN
51 write_to_log (SQLERRM);
52 IF c_get_instid%ISOPEN
53 THEN
54 CLOSE c_get_instid;
55 END IF;
56
57 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
58 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_hesa_inst_id');
59 IGS_GE_MSG_STACK.ADD;
60 App_Exception.Raise_Exception;
61
62 END get_hesa_inst_id;
63
64
65 PROCEDURE get_campus_id
66 (p_location_cd IN igs_en_stdnt_ps_att.location_cd%TYPE,
67 p_campus_id OUT NOCOPY VARCHAR2)
68 IS
69 /***************************************************************
70 Created By :
71 Date Created By :
72 Purpose : This procedure gets the HESA Campus Identifier
73 Known Limitations,Enhancements or Remarks:
74 Change History :
75 Who When What
76 ***************************************************************/
77
78 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
79
80 BEGIN
81 l_he_code_map_val.association_code := 'OSS_HESA_LOC_CAMP_ASSOC';
82 l_he_code_map_val.map2 := p_location_cd;
83
84 IF p_location_cd IS NOT NULL
85 THEN
86 igs_he_extract2_pkg.get_map_values
87 (p_he_code_map_val => l_he_code_map_val,
88 p_value_from => 'MAP1',
89 p_return_value => p_campus_id);
90
91 END IF;
92
93 EXCEPTION
94 WHEN OTHERS
95 THEN
96 write_to_log(SQLERRM);
97
98 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
99 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_campus_id');
100 IGS_GE_MSG_STACK.ADD;
101 App_Exception.Raise_Exception;
102 END get_campus_id;
103
104
105 PROCEDURE get_alt_pers_id
106 (p_person_id IN igs_pe_person.person_id%TYPE,
107 p_id_type IN igs_pe_alt_pers_id.person_id_type%TYPE,
108 p_api_id OUT NOCOPY VARCHAR2,
109 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
110 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE
111 ) IS
112 /***************************************************************
113 Created By :
114 Date Created By :
115 Purpose : This procedure gets the Alternate Person Id
116 Known Limitations,Enhancements or Remarks:
117 Change History :
118 Who When What
119 smaddali 11-dec-03 Modified for bug#3235753 , added 2 new parameters
120 sjlaport 31-Jan-05 Modified cursor c_api for HE358 to ignore logically deleted records
121 ***************************************************************/
122 -- smaddali modified this cursor to get records which are effective in the HESA submission period, bug#3235753
123 CURSOR c_api IS
124 SELECT api_person_id
125 FROM igs_pe_alt_pers_id
126 WHERE pe_person_id = p_person_id
127 AND person_id_type = p_id_type
128 AND Start_Dt <= p_enrl_end_dt
129 AND ( End_Dt IS NULL OR End_Dt >= p_enrl_start_dt )
130 AND (End_Dt IS NULL OR Start_Dt <> End_Dt)
131 ORDER BY Start_Dt DESC;
132
133 BEGIN
134 OPEN c_api;
135 FETCH c_api INTO p_api_id;
136 CLOSE c_api;
137
138 EXCEPTION
139 WHEN OTHERS
140 THEN
141 write_to_log (SQLERRM);
142 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
143 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_alt_pers_id');
144 IGS_GE_MSG_STACK.ADD;
145 App_Exception.Raise_Exception;
146 END get_alt_pers_id;
147
148
149 PROCEDURE get_stdnt_id
150 (p_person_id IN igs_en_stdnt_ps_att.person_id%TYPE,
151 p_inst_id IN igs_or_institution.govt_institution_cd%TYPE,
152 p_stdnt_id OUT NOCOPY VARCHAR2,
153 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
154 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE)
155
156 IS
157 /***************************************************************
158 Created By :
159 Date Created By :
160 Purpose : This procedure gets the HESA Student Identifier
161 Known Limitations,Enhancements or Remarks:
162 Change History :
163 Who When What
164 Bayadav 24-OCT-2002 Modified this porcedure to get the api personid considering
165 the person id type exisiting as a part of HEFD101(2636897)
166 pmarada 30-May-03 Adding check digit for calculated student ID, bug 2986518
167 smaddali 11-dec-03 Modified for bug#3235753 , added 2 new parameters
168 smaddali 16-jan-04 Modified logic for creating HUSID record , bug#3371259
169 ayedubat 12-05-04 Modified the procedure to consider, if HUSID alternate person ID record
170 overlapping the HESA submission period exist and it is closed for Bug, 3438701
171 sjlaport 31-Jan-05 Modified cursors c_api, c_husid, c_future_husid and c_current_husid for HE358
172 to ignore logically deleted records
173 ***************************************************************/
174
175 CURSOR c_comdt IS
176 SELECT to_char(MIN(commencement_dt),'YY')
177 FROM igs_en_stdnt_ps_att
178 WHERE person_id = p_person_id;
179
180 CURSOR c_sid IS
181 SELECT igs_he_stdnt_id_s.nextval
182 FROM dual;
183
184 --TO select all the alternate person id's with type in (UCASID,NMASID,SWASID,GTTRID)
185 --Cursor to check number of person id types exisitng .
186 -- smaddali modified this cursor to get records which are effective in the HESA submission period, bug#3235753
187 CURSOR c_api IS
188 SELECT api_person_id
189 FROM igs_pe_alt_pers_id
190 WHERE pe_person_id = p_person_id
191 AND person_id_type IN ('UCASID','NMASID','SWASID','GTTRID')
192 AND Start_Dt <= p_enrl_end_dt
193 AND ( End_Dt IS NULL OR End_Dt >= p_enrl_start_dt )
194 AND (End_Dt IS NULL OR Start_Dt <> End_Dt);
195
196 -- smaddali added these cursors for bug#3371259
197 -- get the latest HUSID record for the person
198 CURSOR c_husid IS
199 SELECT api_person_id, start_dt, end_dt
200 FROM igs_pe_alt_pers_id
201 WHERE pe_person_id = p_person_id
202 AND person_id_type = 'HUSID'
203 AND (end_dt IS NULL OR start_dt <> end_dt)
204 ORDER BY start_dt DESC;
205 c_husid_rec c_husid%ROWTYPE ;
206
207 -- get the min start_dt of HUSID records which are starting after the Submission period end date
208 CURSOR c_future_husid IS
209 SELECT start_dt
210 FROM igs_pe_alt_pers_id
211 WHERE pe_person_id = p_person_id
212 AND person_id_type = 'HUSID'
213 AND start_dt > p_enrl_end_dt
214 AND (end_dt IS NULL OR start_Dt <> end_Dt)
215 ORDER BY start_dt ASC;
216 c_future_husid_rec c_future_husid%ROWTYPE ;
217
218 CURSOR current_husid_cur IS
219 SELECT api_person_id, start_dt, end_dt
220 FROM igs_pe_alt_pers_id
221 WHERE pe_person_id = p_person_id
222 AND person_id_type = 'HUSID'
223 AND start_dt <= p_enrl_end_dt
224 AND (end_dt IS NULL OR end_dt >= p_enrl_start_dt)
225 AND (end_dt IS NULL OR start_dt <> end_dt)
226 ORDER BY start_dt DESC;
227 current_husid_rec current_husid_cur%ROWTYPE;
228
229 --sjlaport added for HE358 to check for logically deleted HUSID records
230 CURSOR c_deleted_husid(cp_person_id igs_pe_alt_pers_id.pe_person_id%TYPE,
231 cp_api_person_id igs_pe_alt_pers_id.api_person_id%TYPE,
232 cp_start_dt igs_pe_alt_pers_id.start_dt%TYPE) IS
233 SELECT 'X'
234 FROM igs_pe_alt_pers_id
235 WHERE pe_person_id = cp_person_id
236 AND api_person_id = cp_api_person_id
237 AND start_dt = TRUNC(cp_start_dt)
238 AND person_id_type = 'HUSID'
239 AND start_dt = end_dt;
240
241 c_deleted_husid_rec c_deleted_husid%ROWTYPE ;
242
243
244 l_derive BOOLEAN ;
245 l_cre_husid BOOLEAN ;
246 l_cre_lat_husid BOOLEAN ;
247 l_start_dt igs_pe_alt_pers_id.start_dt%TYPE ;
248 l_end_dt igs_pe_alt_pers_id.end_dt%TYPE ;
249
250 l_stdnt_id igs_pe_alt_pers_id.api_person_id%TYPE;
251 l_year VARCHAR2(2);
252 l_sid VARCHAR2(30);
253 l_index NUMBER := 0;
254 l_chk_sum NUMBER := 0;
255 l_chk_digit NUMBER(2);
256 l_api_rec c_api%ROWTYPE;
257
258 TYPE fldwt IS TABLE OF NUMBER(2)
259 INDEX BY binary_integer;
260 l_fld_weight fldwt;
261
262 BEGIN
263 l_stdnt_id := NULL;
264 l_derive := FALSE;
265 l_cre_husid := FALSE;
266 l_cre_lat_husid := FALSE;
267
268 -- Check if HUS ID already exists
269 igs_he_extract_fields_pkg.get_alt_pers_id
270 (p_person_id => p_person_id,
271 p_id_type => 'HUSID',
272 p_api_id => l_stdnt_id,
273 p_enrl_start_dt => p_enrl_start_dt,
274 p_enrl_end_dt => p_enrl_end_dt);
275
276 IF l_stdnt_id IS NULL
277 THEN
278 -- smaddali added this code to check for past / future husid records before
279 -- deriving new husid, bug#3371259
280 -- check if there are any HUSIDs defined this person
281 c_husid_rec := NULL ;
282 l_cre_husid := TRUE;
283
284 OPEN c_husid;
285 FETCH c_husid INTO c_husid_rec;
286 -- If the student has no HUSID's at all then derive the HUSID and create
287 -- record with start_dt = Hesa submission start_dt and end_dt = NULL
288 IF c_husid%NOTFOUND THEN
289 l_derive := TRUE;
290 l_start_dt := p_enrl_start_dt;
291 l_end_dt := NULL ;
292 -- If there exists a Past HUSID then derive a new HUSID because the old one maybe created incorrectly
293 -- start_dt = end_dt of old husid+1 and end_dt = NULL
294 ELSIF c_husid_rec.end_dt < p_enrl_start_dt THEN
295 l_derive := TRUE ;
296 l_start_dt := c_husid_rec.end_dt + 1;
297 l_end_dt := NULL ;
298 -- If there exists a future HUSID then
299 ELSIF c_husid_rec.start_dt > p_enrl_end_dt THEN
300 -- if the latest future record is open then donot derive a new HUSID but
301 -- create a HUSID record with the api value of the latest furure record and
302 -- start_dt = hesa submission start_dt and end_dt = start_dt of nearest future husid -1
303 c_future_husid_rec := NULL;
304 OPEN c_future_husid;
305 FETCH c_future_husid INTO c_future_husid_rec ;
306 CLOSE c_future_husid;
307 IF c_husid_rec.end_dt IS NULL THEN
308 l_stdnt_id := c_husid_rec.api_person_id ;
309 l_derive := FALSE ;
310 l_start_dt := p_enrl_start_dt;
311 l_end_dt := c_future_husid_rec.start_dt - 1;
312 ELSE
313 -- if future husid is closed then derive a new HUSID and
314 -- create a HUSID record with start_dt = hesa submission start_dt and
315 -- end_dt = start_dt of nearest future husid -1
316 -- Also create another HUSID record starting from latest furure record end_dt + 1 and end_dt = NULL
317 l_derive := TRUE ;
318 l_start_dt := p_enrl_start_dt;
319 l_end_dt := c_future_husid_rec.start_dt - 1 ;
320 -- this flag indicates that an extra husid record needs to be created
321 l_cre_lat_husid := TRUE;
322 END IF ;
323 ELSE
324 -- This case will never arise because if the student has got some HUSID records which donot overlap with the submission period ,
325 -- then the latest record must either have started after submission end date or must have Ended before the Submission start_dt
326 -- |-------Submission period----------|
327 -- |--past----| |-----future1--| |-----future2----
328 -- Anything other than these 2 cases is overlapping with the submission period in which case nothing needs to be done
329 l_stdnt_id := NULL ;
330 l_derive := FALSE ;
331 l_start_dt := NULL;
332 l_end_dt := NULL;
333 END IF ;
334 CLOSE c_husid;
335
336 ELSE -- Student Id exist, but closed with in the Reporting Period. Added for Bug, 3438701
337
338 OPEN current_husid_cur;
339 FETCH current_husid_cur INTO current_husid_rec;
340 IF current_husid_cur%FOUND AND current_husid_rec.end_dt < p_enrl_end_dt THEN
341
342 -- If future alternate person ID record does not exist (i.e. This is the latest record for all the period)
343 OPEN c_future_husid;
344 FETCH c_future_husid INTO c_future_husid_rec ;
345 IF c_future_husid%NOTFOUND THEN
346
347 l_cre_husid := TRUE;
348 l_derive := TRUE;
349 l_start_dt := current_husid_rec.end_dt+1;
350 l_end_dt := NULL;
351
352 -- Future Record exists after the HESA submission period
353 -- Log the Message at the Execption Level
354 ELSIF (FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
355
356 fnd_message.set_name('IGS','IGS_HE_INVAL_HUSID_RECS_WARN');
357 fnd_message.set_token('PERSON_NO',p_person_id );
358 fnd_log.string(FND_LOG.LEVEL_EXCEPTION,'igs.plsql.igs_he_extract_fields_pkg.get_stdnt_id', fnd_message.get);
359
360 END IF;
361 CLOSE c_future_husid;
362
363 END IF;
364 CLOSE current_husid_cur;
365
366 END IF; -- End of Student Id exist check
367
368 IF l_derive THEN
369 OPEN c_api ;
370 FETCH c_api INTO l_stdnt_id ;
371 --1
372 IF c_api%FOUND THEN
373 FETCH c_api INTO l_stdnt_id ;
374 --2
375 IF c_api%ROWCOUNT >1 THEN
376 CLOSE c_api;
377 l_stdnt_id := NULL;
378 --IN case of more than one person id type
379 -- Check if UCAS ID already exists
380 igs_he_extract_fields_pkg.get_alt_pers_id
381 (p_person_id => p_person_id,
382 p_id_type => 'UCASID',
383 p_api_id => l_stdnt_id,
384 p_enrl_start_dt => p_enrl_start_dt,
385 p_enrl_end_dt => p_enrl_end_dt);
386
387 --3
388 -- Check if NMASID already exists
389 IF l_stdnt_id IS NULL THEN
390 igs_he_extract_fields_pkg.get_alt_pers_id
391 (p_person_id => p_person_id,
392 p_id_type => 'NMASID',
393 p_api_id => l_stdnt_id,
394 p_enrl_start_dt => p_enrl_start_dt,
395 p_enrl_end_dt => p_enrl_end_dt);
396 --4
397 -- Check if GTTRID already exists
398 IF l_stdnt_id IS NULL THEN
399 igs_he_extract_fields_pkg.get_alt_pers_id
400 (p_person_id => p_person_id,
401 p_id_type => 'GTTRID',
402 p_api_id => l_stdnt_id,
403 p_enrl_start_dt => p_enrl_start_dt,
404 p_enrl_end_dt => p_enrl_end_dt);
405 --5
406 -- Check if SWASID already exists
407 IF l_stdnt_id IS NULL THEN
408 igs_he_extract_fields_pkg.get_alt_pers_id
409 (p_person_id => p_person_id,
410 p_id_type => 'SWASID',
411 p_api_id => l_stdnt_id,
412 p_enrl_start_dt => p_enrl_start_dt,
413 p_enrl_end_dt => p_enrl_end_dt);
414 --5
415 END IF;
416 --4
417 END IF;
418 --3
419 END IF;
420 --2
421 END IF;
422
423 ELSE
424 CLOSE c_api ;
425 --1
426 END IF;
427 IF c_api%ISOPEN THEN
428 CLOSE c_api;
429 END IF;
430
431 -- If it is still null, then compute it.
432 IF l_stdnt_id IS NOT NULL
433 THEN
434 l_stdnt_id := '0000' || LPAD(l_stdnt_id,8,'0');
435 ELSE
436 -- Get the year of commencement
437 OPEN c_comdt;
438 FETCH c_comdt INTO l_year;
439 CLOSE c_comdt;
440
441 -- Get the unique student id
442 OPEN c_sid;
443 FETCH c_sid INTO l_sid;
444 CLOSE c_sid;
445
446 l_stdnt_id := l_year ||
447 Substr(to_char(p_inst_id + 1000),1,4)||
448 LPAD(l_sid,6,'0');
449
450 END IF;
451 -- Calculate the check digit and add to student ID
452 -- Initialize Weights.
453 l_fld_weight(1) := 1;
454 l_fld_weight(2) := 3;
455 l_fld_weight(3) := 7;
456 l_fld_weight(4) := 9;
457 l_fld_weight(5) := 1;
458 l_fld_weight(6) := 3;
459 l_fld_weight(7) := 7;
460 l_fld_weight(8) := 9;
461 l_fld_weight(9) := 1;
462 l_fld_weight(10) := 3;
463 l_fld_weight(11) := 7;
464 l_fld_weight(12) := 9;
465
466 -- Calculate Check Digit
467 FOR l_index IN 1 .. LENGTH(l_stdnt_id)
468 LOOP
469 l_chk_sum := l_chk_sum +
470 (to_number(Substr(l_stdnt_id,l_index, 1)) *
471 l_fld_weight(l_index));
472
473 END LOOP;
474
475 -- Check digit is 10 last digit of the check sum above
476 l_chk_digit := 10 - to_number(Substr(to_char(l_chk_sum),-1,1));
477
478 -- If l_chk_digit is 10, then set it to 0
479 IF l_chk_digit = 10
480 THEN
481 l_chk_digit := 0;
482 END IF;
483 --Add check digit to the Student ID
484 l_stdnt_id := l_stdnt_id || to_char(l_chk_digit);
485 END IF; -- derive new husid or not
486
487 -- If a value found, insert the HESA Id record
488 -- smaddali modified this insert statement to create a record which
489 -- starts and ends same as the HESA submission period so that there is no date overlapping failure
490 IF l_stdnt_id IS NOT NULL AND l_cre_husid THEN
491
492 -- check for logically deleted records before inserting
493 OPEN c_deleted_husid(p_person_id,l_stdnt_id,l_start_dt);
494 FETCH c_deleted_husid INTO c_deleted_husid_rec;
495
496 IF c_deleted_husid%FOUND THEN
497
498 CLOSE c_deleted_husid;
499
500 -- update existing record
501 UPDATE igs_pe_alt_pers_id
502 SET end_dt = l_end_dt,
503 last_updated_by = Fnd_Global.user_id,
504 last_update_date = Sysdate,
505 last_update_login = Fnd_Global.login_id
506 WHERE pe_person_id = p_person_id
507 AND api_person_id = l_stdnt_id
508 AND person_id_type = 'HUSID'
509 AND start_dt = l_start_dt;
510
511 fnd_message.set_name('IGS','IGS_HE_DEL_REC_OPENED');
512 fnd_Message.Set_Token('PER_ID',p_person_id);
513 fnd_Message.Set_Token('ALT_PID',l_stdnt_id);
514 fnd_Message.Set_Token('PID_TYPE','HUSID');
515 fnd_Message.Set_Token('START_DT',TRUNC(l_start_dt));
516 fnd_file.put_line(fnd_file.log,fnd_message.get());
517
518 ELSE
519
520 CLOSE c_deleted_husid;
521
522 INSERT INTO igs_pe_alt_pers_id
523 (pe_person_id,
524 api_person_id,
525 person_id_type,
526 start_dt,
527 end_dt,
528 created_by,
529 creation_date,
530 last_updated_by,
531 last_update_date,
532 last_update_login)
533 VALUES
534 (p_person_id,
535 l_stdnt_id,
536 'HUSID',
537 l_start_dt ,
538 l_end_dt ,
539 Fnd_Global.user_id,
540 Sysdate,
541 Fnd_Global.user_id,
542 Sysdate,
543 Fnd_Global.login_id);
544
545 END IF;
546
547 IF l_cre_lat_husid THEN
548
549 -- check for logically deleted records before inserting
550 OPEN c_deleted_husid(p_person_id,l_stdnt_id,c_husid_rec.end_dt + 1);
551 FETCH c_deleted_husid INTO c_deleted_husid_rec;
552
553 IF c_deleted_husid%FOUND THEN
554
555 CLOSE c_deleted_husid;
556
557 -- update existing record
558 UPDATE igs_pe_alt_pers_id
559 SET end_dt = NULL,
560 last_updated_by = Fnd_Global.user_id,
561 last_update_date = Sysdate,
562 last_update_login = Fnd_Global.login_id
563 WHERE pe_person_id = p_person_id
564 AND api_person_id = l_stdnt_id
565 AND person_id_type = 'HUSID'
566 AND start_dt = c_husid_rec.end_dt + 1;
567
568 fnd_message.set_name('IGS','IGS_HE_DEL_REC_OPENED');
569 fnd_Message.Set_Token('PER_ID',p_person_id);
570 fnd_Message.Set_Token('ALT_PID',l_stdnt_id);
571 fnd_Message.Set_Token('PID_TYPE','HUSID');
572 fnd_Message.Set_Token('START_DT',TRUNC(c_husid_rec.end_dt + 1));
573 fnd_file.put_line(fnd_file.log,fnd_message.get());
574
575 ELSE
576
577 CLOSE c_deleted_husid;
578
579 INSERT INTO igs_pe_alt_pers_id
580 (pe_person_id,
581 api_person_id,
582 person_id_type,
583 start_dt,
584 end_dt,
585 created_by,
586 creation_date,
587 last_updated_by,
588 last_update_date,
589 last_update_login)
590 VALUES
591 (p_person_id,
592 l_stdnt_id,
593 'HUSID',
594 c_husid_rec.end_dt + 1 ,
595 NULL ,
596 Fnd_Global.user_id,
597 Sysdate,
598 Fnd_Global.user_id,
599 Sysdate,
600 Fnd_Global.login_id);
601
602 END IF;
603
604 END IF ;
605 END IF;
606
607 p_stdnt_id := l_stdnt_id;
608
609 EXCEPTION
610 WHEN OTHERS
611 THEN
612 write_to_log(SQLERRM);
613 IF c_comdt%ISOPEN
614 THEN
615 CLOSE c_comdt;
616 END IF;
617 IF c_api%ISOPEN
618 THEN
619 CLOSE c_api;
620 END IF;
621 IF c_deleted_husid%ISOPEN
622 THEN
623 CLOSE c_deleted_husid;
624 END IF;
625 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
626 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_stdnt_id');
627 IGS_GE_MSG_STACK.ADD;
628 App_Exception.Raise_Exception;
629 END get_stdnt_id;
630
631
632 PROCEDURE get_fe_stdnt_mrker
633 (p_spa_fe_stdnt_mrker IN igs_he_st_spa.fe_student_marker%TYPE,
634 p_fe_program_marker IN igs_he_st_prog.fe_program_marker%TYPE,
635 p_funding_src IN igs_he_ex_rn_dat_fd.value%TYPE,
636 p_fundability_cd IN igs_he_ex_rn_dat_fd.value%TYPE,
637 p_oss_fe_stdnt_mrker OUT NOCOPY VARCHAR2,
638 p_hesa_fe_stdnt_mrker OUT NOCOPY VARCHAR2)
639 IS
640 /***************************************************************
641 Created By :
642 Date Created By :
643 Purpose : This procedure gets the FE Student Marker
644 Known Limitations,Enhancements or Remarks:
645 Change History :
646 Who When What
647 ***************************************************************/
648
649 l_he_code_map_val igs_he_code_map_val%ROWTYPE;
650 l_oss_fe_stdnt_mrker igs_he_code_map_val.map1%TYPE;
651
652 BEGIN
653
654 IF p_spa_fe_stdnt_mrker IS NULL
655 THEN
656 IF p_fe_program_marker IS NOT NULL AND p_funding_src IS NOT NULL AND
657 p_fundability_cd IS NOT NULL
658 THEN
659 l_he_code_map_val.association_code := 'OSS_FESTUMK_ASSOC';
660 l_he_code_map_val.map2 := p_fe_program_marker;
661 l_he_code_map_val.map3 := p_funding_src;
662 l_he_code_map_val.map4 := p_fundability_cd;
663 igs_he_extract2_pkg.get_map_values
664 (p_he_code_map_val => l_he_code_map_val,
665 p_value_from => 'MAP1',
666 p_return_value => l_oss_fe_stdnt_mrker);
667 END IF;
668 ELSE
669 l_oss_fe_stdnt_mrker := p_spa_fe_stdnt_mrker;
670 END IF; -- Value for FE stdnt Marker exists
671
672 -- Now get the HESA Equivalent value
673 IF l_oss_fe_stdnt_mrker IS NOT NULL
674 THEN
675 l_he_code_map_val := NULL;
676 l_he_code_map_val.association_code := 'OSS_HESA_FESTUMK_ASSOC';
677 l_he_code_map_val.map2 := l_oss_fe_stdnt_mrker ;
678 p_oss_fe_stdnt_mrker := l_oss_fe_stdnt_mrker ;
679
680 igs_he_extract2_pkg.get_map_values
681 (p_he_code_map_val => l_he_code_map_val,
682 p_value_from => 'MAP1',
683 p_return_value => p_hesa_fe_stdnt_mrker);
684 END IF; -- If OSS Value exists, get the HESA Value
685
686
687 EXCEPTION
688 WHEN OTHERS
689 THEN
690 write_to_log (SQLERRM);
691 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
692 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_fe_stdnt_mrker');
693 IGS_GE_MSG_STACK.ADD;
694 App_Exception.Raise_Exception;
695 END get_fe_stdnt_mrker;
696
697
698 PROCEDURE get_funding_src
699 (p_course_cd IN igs_ps_ver.course_cd%TYPE,
700 p_version_number IN igs_ps_ver.version_number%TYPE,
701 p_spa_fund_src IN igs_en_stdnt_ps_att.funding_source%TYPE,
702 p_poous_fund_src IN igs_he_poous.funding_source%TYPE,
703 p_oss_fund_src OUT NOCOPY VARCHAR2,
704 p_hesa_fund_src OUT NOCOPY VARCHAR2)
705
706 IS
707 /***************************************************************
708 Created By :
709 Date Created By :
710 Purpose : This procedure gets the Major Source of Funding
711 Known Limitations,Enhancements or Remarks:
712 Change History :
713 Who When What
714 smaddali 25-Aug-03 Modified procedure to add new parameter p_poous_fund_src
715 and its logic for hefd208 bug #2717751
716 jtmathew 01-Feb-05 Modified procedure to add new parameter p_spa_fund_src
717 and its logic for bug #3962575
718 jtmathew 24-Mar-05 Modified procedure to check HESA code mapping first before
719 calling c_gov_fsrc for bug #4218148
720 ***************************************************************/
721
722 l_he_code_map_val igs_he_code_map_val%ROWTYPE;
723 l_oss_fund_src igs_he_code_map_val.map1%TYPE;
724 l_hesa_fund_src igs_he_ex_rn_dat_fd.value%TYPE;
725 l_govt_fund_src igs_he_ex_rn_dat_fd.value%TYPE;
726
727 CURSOR c_fsrc IS
728 SELECT b.govt_funding_source,
729 a.funding_source
730 FROM igs_fi_fnd_src_rstn a,
731 igs_fi_fund_src b
732 WHERE a.course_cd = p_course_cd
733 AND a.version_number = p_version_number
734 AND a.dflt_ind = 'Y'
735 AND a.funding_source = b.funding_source;
736
737 -- smaddali added cursor for hefd208 build, bug#2717751
738 -- to get the govt funding_source for the funding_source set up at Poous level
739 CURSOR c_gov_fsrc(cp_fund_src igs_fi_fund_src.funding_source%TYPE) IS
740 SELECT govt_funding_source,
741 funding_source
742 FROM igs_fi_fund_src
743 WHERE funding_source = cp_fund_src ;
744
745 BEGIN
746
747 IF p_spa_fund_src IS NOT NULL THEN
748 l_oss_fund_src := p_spa_fund_src;
749
750 ELSIF p_poous_fund_src IS NOT NULL THEN
751 l_oss_fund_src := p_poous_fund_src;
752 ELSE
753 -- Retrieve funding_source at program funding source restriction
754 OPEN c_fsrc;
755 FETCH c_fsrc INTO l_govt_fund_src, l_oss_fund_src;
756 CLOSE c_fsrc;
757 END IF;
758
759 IF l_oss_fund_src IS NOT NULL THEN
760 -- Get the HESA Equivalent value
761 l_he_code_map_val := NULL;
762 l_he_code_map_val.association_code := 'OSS_HESA_MSFUND_ASSOC';
763 l_he_code_map_val.map2 := l_oss_fund_src;
764
765 igs_he_extract2_pkg.get_map_values
766 (p_he_code_map_val => l_he_code_map_val,
767 p_value_from => 'MAP1',
768 p_return_value => l_hesa_fund_src);
769
770 IF l_hesa_fund_src IS NULL THEN
771
772 IF l_govt_fund_src IS NULL THEN
773
774 -- If no HESA value get funding source from igs_fi_fund_src
775 OPEN c_gov_fsrc(l_oss_fund_src) ;
776 FETCH c_gov_fsrc INTO l_hesa_fund_src,
777 p_oss_fund_src;
778 CLOSE c_gov_fsrc;
779
780 ELSE
781 l_hesa_fund_src := l_govt_fund_src;
782 END IF;
783
784 END IF;
785
786 p_oss_fund_src := l_oss_fund_src;
787 p_hesa_fund_src := LPAD(l_hesa_fund_src,2,'0');
788
789 END IF;
790
791
792 EXCEPTION
793 WHEN OTHERS
794 THEN
795 write_to_log (SQLERRM);
796 IF c_fsrc%ISOPEN
797 THEN
798 CLOSE c_fsrc;
799 END IF;
800
801 IF c_gov_fsrc%ISOPEN
802 THEN
803 CLOSE c_gov_fsrc;
804 END IF;
805
806 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
807 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_funding_src');
808 IGS_GE_MSG_STACK.ADD;
809 App_Exception.Raise_Exception;
810 END get_funding_src;
811
812
813 PROCEDURE get_fundability_cd
814 (p_person_id IN igs_pe_person.person_id%TYPE,
815 p_susa_fund_cd IN igs_he_en_susa.fundability_code%TYPE,
816 p_spa_funding_source IN igs_en_stdnt_ps_att.funding_source%TYPE,
817 p_poous_fund_cd IN igs_he_poous.fundability_cd%TYPE,
818 p_prg_fund_cd IN igs_he_st_prog.fundability%TYPE,
819 p_prg_funding_source IN igs_fi_fnd_src_rstn.funding_source%TYPE,
820 p_oss_fund_cd OUT NOCOPY VARCHAR2,
821 p_hesa_fund_cd OUT NOCOPY VARCHAR2,
822 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
823 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE)
824
825 IS
826 /***************************************************************
827 Created By :
828 Date Created By :
829 Purpose : This procedure gets Fundability Code
830 Known Limitations,Enhancements or Remarks:
831 Change History :
832 Who When What
833 smaddali 11-Dec-03 Modified for bug#3235753 , added 2 new parameters
834 anwest 09-Dec-04 Modified for HE356 - updated to accommodate
835 Term/Load calendar associated with residency
836 jtmathew 23-May-06 Modified c_res_sts for bug 5210481
837 ***************************************************************/
838
839 -- smaddali modified this cursor for bug 2730388 to get only open code values
840 -- smaddali modified this cursor for bug 2367167 to get records which are effective in the HESA submission period, bug#3235753
841 -- anwest modified this cursor for HE356 to get open and closed values and not restricted to OSS_RESIDENCY_OS
842 -- jtmathew modified this cursor for bug 5210481 to remove igs_pe_res_dtls_v view
843 CURSOR c_res_sts (cp_res_class_cd VARCHAR2) IS
844 SELECT peresdtls.residency_status_cd residency_status
845 FROM igs_pe_res_dtls_all peresdtls,
846 igs_lookup_values cc1,
847 igs_lookup_values cc2,
848 igs_ca_inst_all cainstall
849 WHERE peresdtls.person_id = p_person_id
850 AND peresdtls.residency_class_cd = cc1.lookup_code
851 AND cc1.lookup_type = 'PE_RES_CLASS'
852 AND peresdtls.residency_status_cd = cc2.lookup_code
853 AND cc2.lookup_type = 'PE_RES_STATUS'
854 AND peresdtls.residency_class_cd = cp_res_class_cd
855 AND peresdtls.cal_type = cainstall.cal_type
856 AND peresdtls.sequence_number = cainstall.sequence_number
857 AND cainstall.start_dt <= p_enrl_end_dt
858 ORDER BY cainstall.start_dt DESC;
859
860
861 -- anwest 09-Dec-2004 HE356 - created this new cursor
862 CURSOR cur_res_val (cp_res_stat_cd VARCHAR2) IS
863 SELECT 'X'
864 FROM igs_he_code_values hecodeval
865 WHERE hecodeval.code_type = 'OSS_RESIDENCY_OS'
866 AND hecodeval.value = cp_res_stat_cd
867 AND NVL(hecodeval.closed_ind,'N') = 'N' ;
868
869 l_residency_status igs_pe_res_dtls_v.residency_status%TYPE;
870 l_oss_fund_cd VARCHAR2(30);
871 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
872 l_res_class_cd igs_pe_res_dtls_v.residency_class%TYPE;
873 l_dummy VARCHAR2(1);
874
875 BEGIN
876
877 Fnd_Profile.Get('IGS_FI_RES_CLASS_ID', l_res_class_cd);
878
879 -- anwest 09-Dec-2004 HE356 - check for residency statuses
880 -- and then determine if code
881 -- type of first record is
882 -- OSS_RESIDENCY_OS
883 OPEN c_res_sts(l_res_class_cd);
884 FETCH c_res_sts INTO l_residency_status;
885 IF c_res_sts%NOTFOUND THEN
886 CLOSE c_res_sts;
887 ELSE
888 CLOSE c_res_sts;
889 OPEN cur_res_val(l_residency_status);
890 FETCH cur_res_val INTO l_dummy;
891 IF cur_res_val%NOTFOUND THEN
892 l_residency_status:= NULL;
893 END IF;
894 CLOSE cur_res_val;
895 END IF;
896
897 IF l_residency_status IS NOT NULL
898 THEN
899 -- bug 2366478 smaddali modified the code to set the value of field 65 as 2
900 -- instead of setting the oss funding code as 2 and then finding out NOCOPY the corresponding hesa value
901 p_hesa_fund_cd := '2';
902 ELSE
903 -- Use SUSA Fund Code
904 l_oss_fund_cd := p_susa_fund_cd;
905
906 IF l_oss_fund_cd IS NULL AND p_spa_funding_source IS NOT NULL
907 THEN
908 -- Get Fundability Code from Funding Source
909 l_he_code_map_val := NULL;
910 l_he_code_map_val.association_code := 'OSS_MSFUND_FUNDCODE_ASSOC';
911 l_he_code_map_val.map2 := p_spa_funding_source;
912
913 igs_he_extract2_pkg.get_map_values
914 (p_he_code_map_val => l_he_code_map_val,
915 p_value_from => 'MAP1',
916 p_return_value => l_oss_fund_cd);
917 END IF;
918
919 IF l_oss_fund_cd IS NULL
920 THEN
921 -- Use POOUS fund Cd
922 l_oss_fund_cd := p_poous_fund_cd;
923 END IF;
924
925 IF l_oss_fund_cd IS NULL
926 THEN
927 -- Use Program fund Cd
928 l_oss_fund_cd := p_prg_fund_cd;
929 END IF;
930
931 IF l_oss_fund_cd IS NULL AND p_prg_funding_source IS NOT NULL
932 THEN
933 -- Use Program Funding Source to derive Fund Code
934 l_he_code_map_val := NULL;
935 l_he_code_map_val.association_code := 'OSS_MSFUND_FUNDCODE_ASSOC';
936 l_he_code_map_val.map2 := p_prg_funding_source;
937
938 igs_he_extract2_pkg.get_map_values
939 (p_he_code_map_val => l_he_code_map_val,
940 p_value_from => 'MAP1',
941 p_return_value => l_oss_fund_cd);
942 END IF;
943
944 IF l_oss_fund_cd IS NOT NULL
945 THEN
946 p_oss_fund_cd := l_oss_fund_cd;
947
948 l_he_code_map_val := NULL;
949 l_he_code_map_val.association_code := 'OSS_HESA_FUNDCODE_ASSOC';
950 l_he_code_map_val.map2 := l_oss_fund_cd;
951
952 igs_he_extract2_pkg.get_map_values
953 (p_he_code_map_val => l_he_code_map_val,
954 p_value_from => 'MAP1',
955 p_return_value => p_hesa_fund_cd);
956 END IF; -- If OSS Value exists, get the HESA Value
957
958 END IF; -- residency status is null
959
960 EXCEPTION
961 WHEN OTHERS
962 THEN
963 write_to_log (SQLERRM);
964 IF c_res_sts%ISOPEN
965 THEN
966 CLOSE c_res_sts;
967 END IF;
968
969 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
970 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_fundability_cd');
971 IGS_GE_MSG_STACK.ADD;
972 App_Exception.Raise_Exception;
973 END get_fundability_cd;
974
975
976 PROCEDURE get_fmly_name_on_16_bday
977 (p_person_id IN igs_pe_person.person_id%TYPE,
978 p_fmly_name OUT NOCOPY VARCHAR2,
979 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
980 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE )
981 IS
982 /***************************************************************
983 Created By :
984 Date Created By :
985 Purpose : This procedure gets Family Name on 16th Birthday
986 Known Limitations,Enhancements or Remarks:
987 Change History :
988 Who When What
989 smaddali 11-dec-03 Modified for bug#3235753 , added 2 new parameters
990 ***************************************************************/
991 -- smaddali modified this cursor to get records which are effective in the HESA submission period, bug#3235753
992 CURSOR c_fmly_nm IS
993 SELECT surname
994 FROM igs_pe_person_alias_v
995 WHERE person_id = p_person_id
996 AND alias_type = 'SNAME16'
997 AND ( Start_Dt IS NULL OR Start_Dt <= p_enrl_end_dt )
998 AND ( End_Dt IS NULL OR End_Dt >= p_enrl_start_dt )
999 ORDER BY Start_Dt DESC;
1000
1001 BEGIN
1002
1003 OPEN c_fmly_nm;
1004 FETCH c_fmly_nm INTO p_fmly_name;
1005 CLOSE c_fmly_nm;
1006
1007 EXCEPTION
1008 WHEN OTHERS
1009 THEN
1010 write_to_log (SQLERRM);
1011 IF c_fmly_nm%ISOPEN
1012 THEN
1013 CLOSE c_fmly_nm;
1014 END IF;
1015
1016 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1017 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_fmly_name_on_16_bday');
1018 IGS_GE_MSG_STACK.ADD;
1019 App_Exception.Raise_Exception;
1020 END get_fmly_name_on_16_bday;
1021
1022
1023 PROCEDURE get_gender
1024 (p_gender IN igs_pe_person.sex%TYPE,
1025 p_hesa_gender OUT NOCOPY VARCHAR2)
1026 IS
1027 /***************************************************************
1028 Created By :
1029 Date Created By :
1030 Purpose : This procedure gets the Gender
1031 Known Limitations,Enhancements or Remarks:
1032 Change History :
1033 Who When What
1034 ***************************************************************/
1035
1036 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
1037
1038 BEGIN
1039 l_he_code_map_val.association_code := 'UC_OSS_HE_GEN_ASSOC';
1040 l_he_code_map_val.map2 := p_gender;
1041
1042 IF p_gender IS NOT NULL
1043 THEN
1044 igs_he_extract2_pkg.get_map_values
1045 (p_he_code_map_val => l_he_code_map_val,
1046 p_value_from => 'MAP3',
1047 p_return_value => p_hesa_gender);
1048
1049 END IF;
1050
1051 EXCEPTION
1052 WHEN OTHERS
1053 THEN
1054 write_to_log (SQLERRM);
1055 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1056 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_gender');
1057 IGS_GE_MSG_STACK.ADD;
1058 App_Exception.Raise_Exception;
1059 END get_gender;
1060
1061
1062 PROCEDURE get_domicile
1063 (p_ad_domicile IN igs_he_ad_dtl.domicile_cd%TYPE,
1064 p_spa_domicile IN igs_he_st_spa.domicile_cd%TYPE,
1065 p_hesa_domicile OUT NOCOPY VARCHAR2)
1066 IS
1067 /***************************************************************
1068 Created By :
1069 Date Created By :
1070 Purpose : This procedure gets the Domicile for the Student
1071 Known Limitations,Enhancements or Remarks:
1072 Change History :
1073 Who When What
1074 ***************************************************************/
1075
1076 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
1077
1078 BEGIN
1079 l_he_code_map_val.association_code := 'UC_OSS_HE_DOM_ASSOC';
1080 l_he_code_map_val.map2 := Nvl(p_spa_domicile, p_ad_domicile) ;
1081
1082 IF l_he_code_map_val.map2 IS NOT NULL
1083 THEN
1084 igs_he_extract2_pkg.get_map_values
1085 (p_he_code_map_val => l_he_code_map_val,
1086 p_value_from => 'MAP3',
1087 p_return_value => p_hesa_domicile);
1088
1089 END IF;
1090
1091 EXCEPTION
1092 WHEN OTHERS
1093 THEN
1094 write_to_log (SQLERRM);
1095 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1096 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_domicile');
1097 IGS_GE_MSG_STACK.ADD;
1098 App_Exception.Raise_Exception;
1099 END get_domicile;
1100
1101
1102 PROCEDURE get_nationality
1103 (p_person_id IN igs_pe_person.person_id%TYPE,
1104 p_nationality OUT NOCOPY VARCHAR2,
1105 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE)
1106
1107 IS
1108 /***************************************************************
1109 Created By :
1110 Date Created By :
1111 Purpose : This procedure gets the Nationality
1112 Known Limitations,Enhancements or Remarks:
1113 Change History :
1114 Who When What
1115 smaddali 11-dec-03 Modified for bug#3235753 , added 1 new parameter
1116 ***************************************************************/
1117
1118 -- smaddali modified this cursor to get replace system date with HESA submission end date, bug#3235753
1119 CURSOR c_ntnl (p_hesa_code VARCHAR2) IS
1120 SELECT b.map3
1121 FROM igs_pe_citizenship_v a,
1122 igs_he_code_map_val b
1123 WHERE a.party_id = p_person_id
1124 AND Nvl(End_Date, p_enrl_start_dt) >= p_enrl_start_dt
1125 AND b.map2 = a.country_code
1126 AND b.map3 = Nvl(p_hesa_code, b.map3)
1127 AND b.association_code = 'UC_OSS_HE_NAT_ASSOC'
1128 ORDER BY b.map3 DESC;
1129
1130 l_nationality VARCHAR2(30);
1131 l_hesa_cd VARCHAR2(30);
1132
1133 BEGIN
1134
1135 l_hesa_cd := '2826';
1136
1137 -- Check if there exists a country code as '2826' - 'UK'
1138 OPEN c_ntnl (l_hesa_cd);
1139 FETCH c_ntnl INTO l_nationality ;
1140 CLOSE c_ntnl;
1141
1142 IF l_nationality IS NULL
1143 THEN
1144 l_hesa_cd := NULL;
1145 OPEN c_ntnl (l_hesa_cd);
1146 FETCH c_ntnl INTO l_nationality ;
1147 CLOSE c_ntnl;
1148 END IF;
1149
1150 p_nationality := l_nationality;
1151
1152 EXCEPTION
1153 WHEN OTHERS
1154 THEN
1155 write_to_log (SQLERRM);
1156 IF c_ntnl%ISOPEN
1157 THEN
1158 CLOSE c_ntnl;
1159 END IF;
1160
1161 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1162 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_nationality');
1163 IGS_GE_MSG_STACK.ADD;
1164 App_Exception.Raise_Exception;
1165 END get_nationality;
1166
1167
1168 PROCEDURE get_ethnicity (
1169 p_person_id IN igs_pe_person.person_id%TYPE,
1170 p_oss_eth IN igs_pe_stat_v.ethnic_origin_id%TYPE,
1171 p_hesa_eth OUT NOCOPY VARCHAR2) IS
1172 /***************************************************************
1173 Created By :
1174 Date Created By :
1175 Purpose : This procedure gets the Ethnicity
1176 Known Limitations,Enhancements or Remarks:
1177 Change History :
1178 WHO WHEN WHAT
1179 AYEDUBAT 17-MAR-04 Modified the procedure to remove the parameter, p_domicile
1180 and remove its reference as part of HEFD311 - July 2004
1181 Changes enhancement bug, 2956444
1182 ***************************************************************/
1183
1184 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
1185
1186 BEGIN
1187
1188 IF p_oss_eth IS NOT NULL THEN
1189
1190 l_he_code_map_val.association_code := 'UC_OSS_HE_ETH_ASSOC';
1191 l_he_code_map_val.map2 := p_oss_eth;
1192
1193 igs_he_extract2_pkg.get_map_values
1194 (p_he_code_map_val => l_he_code_map_val,
1195 p_value_from => 'MAP3',
1196 p_return_value => p_hesa_eth);
1197
1198 END IF;
1199
1200 EXCEPTION
1201 WHEN OTHERS THEN
1202 write_to_log (SQLERRM);
1203 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1204 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_ethnicity');
1205 IGS_GE_MSG_STACK.ADD;
1206 App_Exception.Raise_Exception;
1207
1208 END get_ethnicity;
1209
1210
1211 PROCEDURE get_disablity_allow
1212 (p_oss_dis_allow IN igs_he_en_susa.disability_allow%TYPE,
1213 p_hesa_dis_allow OUT NOCOPY VARCHAR2)
1214
1215 IS
1216 /***************************************************************
1217 Created By :
1218 Date Created By :
1219 Purpose : This procedure gets the Disability Allowance
1220 Known Limitations,Enhancements or Remarks:
1221 Change History :
1222 Who When What
1223 ***************************************************************/
1224
1225 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
1226 BEGIN
1227
1228 l_he_code_map_val.association_code := 'OSS_HESA_DIS_ALLOW_ASSOC';
1229 l_he_code_map_val.map2 := p_oss_dis_allow;
1230
1231 IF p_oss_dis_allow IS NOT NULL
1232 THEN
1233 igs_he_extract2_pkg.get_map_values
1234 (p_he_code_map_val => l_he_code_map_val,
1235 p_value_from => 'MAP1',
1236 p_return_value => p_hesa_dis_allow);
1237
1238 END IF;
1239
1240 EXCEPTION
1241 WHEN OTHERS
1242 THEN
1243 write_to_log (SQLERRM);
1244 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1245 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_disability_allow');
1246 IGS_GE_MSG_STACK.ADD;
1247 App_Exception.Raise_Exception;
1248 END get_disablity_allow;
1249
1250
1251 PROCEDURE get_disablity
1252 (p_person_id IN igs_pe_person.person_id%TYPE,
1253 p_disability OUT NOCOPY VARCHAR2,
1254 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
1255 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE)
1256
1257 IS
1258 /***************************************************************
1259 Created By :
1260 Date Created By :
1261 Purpose : This procedure gets the Disability
1262 Known Limitations,Enhancements or Remarks:
1263 Change History :
1264 Who When What
1265 smaddali 11-dec-03 Modified for bug#3235753 , added 2 new parameters
1266 jbaber 20-sep-04 Changes for HEFD350 - Stat changes for 2004/05
1267 Use new mapping OSS_HESA_DISABILITY_ASSOC
1268 jbaber 18-oct-05 Ignore disabilities which map to HESA value NONE when
1269 determining if student has multiple disabilities - bug 4584532
1270 ***************************************************************/
1271
1272 -- smaddali modified this cursor to get records which are effective in the HESA submission period, bug#3235753
1273 CURSOR c_dis IS
1274 SELECT disability_type
1275 FROM igs_pe_pers_disablty_v
1276 WHERE person_id = p_person_id
1277 AND ( Start_Date IS NULL OR Start_Date <= p_enrl_end_dt )
1278 AND ( End_Date IS NULL OR End_Date >= p_enrl_start_dt )
1279 ORDER BY Start_Date DESC;
1280
1281 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
1282 l_disability igs_pe_pers_disablty_v.disability_type%TYPE;
1283 l_hesa_disability igs_he_ex_rn_dat_fd.value%TYPE;
1284
1285 BEGIN
1286 -- jbaber modified association code, HEFD350
1287 l_he_code_map_val.association_code := 'OSS_HESA_DISABILITY_ASSOC';
1288 p_disability := NULL;
1289
1290
1291 OPEN c_dis;
1292 LOOP
1293 FETCH c_dis INTO l_disability;
1294 EXIT WHEN c_dis%NOTFOUND;
1295
1296 l_he_code_map_val.map2 := l_disability;
1297
1298 IF l_he_code_map_val.map2 IS NOT NULL
1299 THEN
1300 igs_he_extract2_pkg.get_map_values
1301 (p_he_code_map_val => l_he_code_map_val,
1302 p_value_from => 'MAP1',
1303 p_return_value => l_hesa_disability);
1304 END IF;
1305
1306
1307 IF (p_disability IS NULL OR p_disability = '00') AND l_hesa_disability IS NOT NULL THEN
1308 -- Student has one disability or one which matches to NONE
1309 p_disability := l_hesa_disability;
1310
1311 ELSIF l_hesa_disability <> '00' THEN
1312 -- Student has multiple disabilities which do not map to NONE
1313 p_disability := '08';
1314 EXIT;
1315 END IF;
1316
1317
1318 END LOOP;
1319 CLOSE c_dis;
1320
1321 EXCEPTION
1322 WHEN OTHERS
1323 THEN
1324 write_to_log (SQLERRM);
1325 IF c_dis%ISOPEN
1326 THEN
1327 CLOSE c_dis;
1328 END IF;
1329
1330 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1331 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_disability');
1332 IGS_GE_MSG_STACK.ADD;
1333 App_Exception.Raise_Exception;
1334 END get_disablity;
1335
1336
1337 PROCEDURE get_addnl_supp_band
1338 (p_oss_supp_band IN igs_he_en_susa.additional_sup_band%TYPE,
1339 p_hesa_supp_band OUT NOCOPY VARCHAR2)
1340
1341 IS
1342 /***************************************************************
1343 Created By :
1344 Date Created By :
1345 Purpose : This procedure gets the Additional Support Band
1346 Known Limitations,Enhancements or Remarks:
1347 Change History :
1348 Who When What
1349 ***************************************************************/
1350
1351 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
1352 BEGIN
1353
1354 l_he_code_map_val.association_code := 'OSS_HESA_SUP_BAND_ASSOC';
1355 l_he_code_map_val.map2 := p_oss_supp_band;
1356
1357 IF p_oss_supp_band IS NOT NULL
1358 THEN
1359 igs_he_extract2_pkg.get_map_values
1360 (p_he_code_map_val => l_he_code_map_val,
1361 p_value_from => 'MAP1',
1362 p_return_value => p_hesa_supp_band);
1363
1364 END IF;
1365
1366 EXCEPTION
1367 WHEN OTHERS
1368 THEN
1369 write_to_log (SQLERRM);
1370 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1371 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_addnl_supp_band');
1372 IGS_GE_MSG_STACK.ADD;
1373 App_Exception.Raise_Exception;
1374 END get_addnl_supp_band;
1375
1376
1377 PROCEDURE get_yr_left_last_inst
1378 (p_person_id IN igs_pe_person.person_id%TYPE,
1379 p_com_dt IN DATE,
1380 p_hesa_gen_qaim IN VARCHAR2,
1381 p_ucasnum IN igs_pe_alt_pers_id.api_person_id%TYPE,
1382 p_year OUT NOCOPY VARCHAR2)
1383
1384 IS
1385 /***************************************************************
1386 Created By :
1387 Date Created By :
1388 Purpose : This procedure gets Year left last Institute
1389 Known Limitations,Enhancements or Remarks:
1390 Change History :
1391 Who When What
1392 rbezawad 17-Sep-03 Modified the process to derive the "Year left last institution" field from Academic History
1393 rather than from Attendence Hisotry w.r.t. UCFD210 Build, Bug 289354.
1394 ***************************************************************/
1395
1396 CURSOR c_yr IS
1397 SELECT MAX(TO_NUMBER(TO_CHAR(end_date,'YYYY')))
1398 FROM igs_ad_acad_history_v
1399 WHERE person_id = p_person_id
1400 AND end_date < p_com_dt;
1401
1402 l_end_date NUMBER(4);
1403
1404 BEGIN
1405
1406 l_end_date := NULL;
1407 OPEN c_yr;
1408 FETCH c_yr INTO l_end_date;
1409 CLOSE c_yr;
1410
1411 IF l_end_date IS NOT NULL THEN
1412 p_year := TO_CHAR(l_end_date);
1413 ELSE
1414 IF (SUBSTR(p_ucasnum,3,6) BETWEEN 1 AND 599999) AND ((p_hesa_gen_qaim BETWEEN 18 AND 52) OR (p_hesa_gen_qaim = 61 OR p_hesa_gen_qaim = 97)) THEN
1415 p_year := '9999';
1416 END IF;
1417 END IF;
1418
1419 EXCEPTION
1420 WHEN OTHERS
1421 THEN
1422 write_to_log (SQLERRM);
1423 IF c_yr%ISOPEN
1424 THEN
1425 CLOSE c_yr;
1426 END IF;
1427
1428 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1429 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_yr_left_last_inst');
1430 IGS_GE_MSG_STACK.ADD;
1431 App_Exception.Raise_Exception;
1432 END get_yr_left_last_inst;
1433
1434
1435 PROCEDURE get_new_ent_to_he
1436 (p_fe_stdnt_mrker IN igs_he_st_spa.fe_student_marker%TYPE,
1437 p_susa_new_ent_to_he IN igs_he_en_susa.new_he_entrant_cd%TYPE,
1438 p_yop IN VARCHAR2,
1439 p_high_qual_on_ent IN igs_he_st_spa.highest_qual_on_entry%TYPE,
1440 p_domicile IN igs_he_st_spa.domicile_cd%TYPE,
1441 p_hesa_new_ent_to_he OUT NOCOPY VARCHAR2)
1442
1443 IS
1444 /***************************************************************
1445 Created By :
1446 Date Created By :
1447 Purpose : This procedure gets the New Entrant to HE Code
1448 Known Limitations,Enhancements or Remarks:
1449 Change History :
1450 Who When What
1451 ***************************************************************/
1452
1453 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
1454 BEGIN
1455
1456 -- IF p_fe_stdnt_mrker IS NOT NULL
1457 -- Amended for Bug 2353094
1458 IF p_fe_stdnt_mrker <> '2'
1459 THEN
1460 p_hesa_new_ent_to_he := NULL;
1461 ELSE
1462 IF p_susa_new_ent_to_he IS NOT NULL
1463 THEN
1464 -- smaddali corrected usage of map1 and map2 for bug 2728744
1465 l_he_code_map_val.association_code := 'OSS_HESA_HEENT_ASSOC';
1466 l_he_code_map_val.map1 := p_susa_new_ent_to_he;
1467
1468 igs_he_extract2_pkg.get_map_values
1469 (p_he_code_map_val => l_he_code_map_val,
1470 p_value_from => 'MAP2',
1471 p_return_value => p_hesa_new_ent_to_he);
1472
1473 ELSE
1474 -- SUSA New Ent to HE is null
1475 IF to_number(p_yop) > 1
1476 THEN
1477 p_hesa_new_ent_to_he := '9';
1478 ELSE
1479 -- smaddali modified 14 to 11 in the list for bug2353094
1480 IF p_high_qual_on_ent IN ('01','03','04','10','11','15',
1481 '21','22','25','26','27','29')
1482 OR (p_high_qual_on_ent IN ('02','05','16','23','24','28','30')
1483 AND p_domicile IN ('3826','4826','5826', '6826', '7826','8826'))
1484 THEN
1485 p_hesa_new_ent_to_he := '4';
1486 ELSE
1487 p_hesa_new_ent_to_he := '1';
1488 END IF;
1489
1490 END IF; -- YOP > 1
1491
1492 END IF; -- SUSA New Ent to HE is null
1493 END IF; -- FE Stdnt Marker is not null
1494
1495 EXCEPTION
1496 WHEN OTHERS
1497 THEN
1498 write_to_log (SQLERRM);
1499 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1500 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_new_ent_to_he');
1501 IGS_GE_MSG_STACK.ADD;
1502 App_Exception.Raise_Exception;
1503 END get_new_ent_to_he;
1504
1505
1506 PROCEDURE get_year_of_prog
1507 (p_unit_set_cd IN igs_he_en_susa.unit_set_cd%TYPE,
1508 p_year_of_prog OUT NOCOPY VARCHAR2)
1509
1510 IS
1511 /***************************************************************
1512 Created By :
1513 Date Created By :
1514 Purpose : This procedure gets the Year of Program
1515 Known Limitations,Enhancements or Remarks:
1516 Change History :
1517 Who When What
1518 ***************************************************************/
1519
1520 CURSOR c_yop IS
1521 SELECT sequence_no
1522 FROM igs_ps_us_prenr_cfg
1523 WHERE unit_set_cd = p_unit_set_cd;
1524
1525 BEGIN
1526
1527 OPEN c_yop;
1528 FETCH c_yop INTO p_year_of_prog;
1529 CLOSE c_yop;
1530
1531 EXCEPTION
1532 WHEN OTHERS
1533 THEN
1534 write_to_log (SQLERRM);
1535 IF c_yop%ISOPEN
1536 THEN
1537 CLOSE c_yop;
1538 END IF;
1539
1540 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1541 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_year_of_prog');
1542 IGS_GE_MSG_STACK.ADD;
1543 App_Exception.Raise_Exception;
1544 END get_year_of_prog;
1545
1546
1547 PROCEDURE get_special_student
1548 (p_ad_special_student IN igs_he_ad_dtl.special_student_cd%TYPE,
1549 p_spa_special_student IN igs_he_st_spa.special_student%TYPE,
1550 p_oss_special_student OUT NOCOPY VARCHAR2,
1551 p_hesa_special_student OUT NOCOPY VARCHAR2)
1552 IS
1553 /***************************************************************
1554 Created By :
1555 Date Created By :
1556 Purpose : This procedure gets the Special Student Code for the Student
1557 Known Limitations,Enhancements or Remarks:
1558 Change History :
1559 Who When What
1560 ***************************************************************/
1561
1562 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
1563
1564 BEGIN
1565 l_he_code_map_val.association_code := 'OSS_HESA_SPEC_STUD_ASSOC';
1566 l_he_code_map_val.map2 := Nvl(p_spa_special_student, p_ad_special_student) ;
1567
1568 IF l_he_code_map_val.map2 IS NOT NULL
1569 THEN
1570 p_oss_special_student := l_he_code_map_val.map2;
1571 igs_he_extract2_pkg.get_map_values
1572 (p_he_code_map_val => l_he_code_map_val,
1573 p_value_from => 'MAP1',
1574 p_return_value => p_hesa_special_student);
1575
1576 END IF;
1577
1578 EXCEPTION
1579 WHEN OTHERS
1580 THEN
1581 write_to_log (SQLERRM);
1582 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1583 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_special_student');
1584 IGS_GE_MSG_STACK.ADD;
1585 App_Exception.Raise_Exception;
1586 END get_special_student;
1587
1588
1589 PROCEDURE get_year_of_student
1590 (p_person_id IN igs_he_en_susa.person_id%TYPE,
1591 p_course_cd IN igs_he_en_susa.course_cd%TYPE,
1592 p_unit_set_cd IN igs_he_en_susa.unit_set_cd%TYPE,
1593 p_sequence_number IN igs_he_en_susa.sequence_number%TYPE,
1594 p_year_of_student OUT NOCOPY VARCHAR2,
1595 p_enrl_end_dt IN DATE,
1596 p_susa_year_of_student IN igs_he_en_susa.year_stu%TYPE)
1597 IS
1598 /***************************************************************
1599 Created By :
1600 Date Created By :
1601 Purpose : This procedure gets the Year of the student
1602 Known Limitations,Enhancements or Remarks:
1603 Change History :
1604 Who When What
1605 smaddali 24-Mar-03 Modified for Build HEFD209 - Bug#2717755 , modified cursor c_yos to derive the acad_perds for
1606 all the program attempts belonging to the current student instance number , so as to facilitate
1607 manual transfers.
1608 smaddali Added c_acad_cal and c_selection_dt cursors and modified cursor c_yos for HEFD209 build , bug#2717755
1609 smaddali 29-Oct-03 Modified procedure get_year_of_student to add 1 new parameter for bug#3224246
1610 jbaber 20-Sep-04 Changes for HEFD350 - Stat changes for 2004/05
1611 Added new parameter p_yop_year_of_student. Use YoP year of student value if it exists.
1612 jbaber 04-Nov-04 Modified c_yos to discount future dated transfers as per HE354 - Program Transfer
1613 jbaber 15-Apr-05 Modified c_yos to include records where future_dated_trans_flag = N or S as per bug #4179106
1614 jchakrab 03-Feb-06 Modified c_yos to exclude academic calendar instances if its start date > the HESA reporting period end date.
1615 ***************************************************************/
1616
1617 -- Get the academic calendar type and student instance number of the current program attempt.
1618 CURSOR c_acad_cal IS
1619 SELECT a.cal_type,b.student_inst_number
1620 FROM igs_en_stdnt_ps_att_all a , igs_he_st_spa_all b
1621 WHERE a.person_id = p_person_id AND
1622 a.course_cd = p_course_cd AND
1623 a.person_id = b.person_id AND
1624 a.course_cd = b.course_cd ;
1625 c_acad_cal_rec c_acad_cal%ROWTYPE;
1626
1627 -- Get number of distinct academic calendar instances spanned by all the Unit attempts
1628 -- belonging to all the Program attempts of the student which have the
1629 -- same student instance number and calendar type as the current program .
1630 -- Here we are not counting program attempts in different calendar type because we are assuming
1631 -- that when the student is transfering into a program in a different calendar type then he will
1632 -- mandatorily transfer all his unit and unit set attempts , Thus they will be counted in the
1633 -- latest calendar.
1634 -- smaddali 29-oct-03 modified to add condition enrolled_dt <= p_enr_end_dt for bug#3224246
1635 CURSOR c_yos (p_student_inst_number igs_he_st_spa_all.student_inst_number%TYPE,
1636 p_cal_type igs_en_stdnt_ps_att_all.cal_type%TYPE ) IS
1637 SELECT COUNT (DISTINCT cir.sup_ci_sequence_number || cir.sup_cal_type)
1638 FROM igs_he_st_spa_all spa ,
1639 igs_en_stdnt_ps_att sca,
1640 igs_en_su_attempt sua,
1641 igs_ca_inst_rel cir,
1642 igs_ca_inst_all ca
1643 WHERE SPA.person_id = p_person_id and
1644 SPA.student_inst_number = p_student_inst_number AND
1645 SCA.person_id = SPA.person_id AND
1646 SCA.course_cd = SPA.course_cd AND
1647 SCA.Cal_type = p_cal_type AND
1648 NVL(sca.future_dated_trans_flag,'N') IN ('N','S') AND
1649 SUA.person_id = SCA.person_id AND
1650 SUA.course_cd = SCA.course_cd AND
1651 SUA.unit_attempt_status IN ('ENROLLED', 'COMPLETED', 'DISCONTIN') AND
1652 CIR.sub_cal_type = SUA.cal_type AND
1653 CIR.sub_ci_sequence_number = SUA.ci_sequence_number AND
1654 CIR.sup_cal_type = SCA.cal_type AND
1655 SUA.ci_start_dt <= p_enrl_end_dt AND
1656 CIR.sup_cal_type = CA.cal_type AND
1657 CIR.sup_ci_sequence_number = CA.sequence_number AND
1658 CA.start_dt <= p_enrl_end_dt;
1659
1660 BEGIN
1661
1662 -- jbaber HEFD350 - Stat changes 2004/05
1663 -- Use Student YoP year of student if value exists.
1664 IF p_susa_year_of_student IS NOT NULL THEN
1665 p_year_of_student := p_susa_year_of_student;
1666 ELSE
1667 -- smaddali added the cursor code c_acad_cal for bug 2717755 , HEFD209 build
1668 -- Get the academic calendar type of the passed program attempt
1669 OPEN c_acad_cal;
1670 FETCH c_acad_cal INTO c_acad_cal_rec;
1671 CLOSE c_acad_cal;
1672
1673 OPEN c_yos(c_acad_cal_rec.student_inst_number,c_acad_cal_rec.cal_type);
1674 FETCH c_yos INTO p_year_of_student;
1675 CLOSE c_yos;
1676 END IF;
1677
1678 EXCEPTION
1679 WHEN OTHERS
1680 THEN
1681 write_to_log (SQLERRM);
1682 IF c_yos%ISOPEN
1683 THEN
1684 CLOSE c_yos;
1685 END IF;
1686
1687 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1688 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_year_of_student');
1689 IGS_GE_MSG_STACK.ADD;
1690 App_Exception.Raise_Exception;
1691 END get_year_of_student;
1692
1693
1694 PROCEDURE get_study_location
1695 (p_susa_study_location IN igs_he_en_susa.study_location%TYPE,
1696 p_poous_study_location IN igs_he_poous.location_of_study%TYPE,
1697 p_prg_study_location IN igs_he_st_prog.location_of_study%TYPE,
1698 p_oss_study_location OUT NOCOPY VARCHAR2,
1699 p_hesa_study_location OUT NOCOPY VARCHAR2)
1700 IS
1701 /***************************************************************
1702 Created By :
1703 Date Created By :
1704 Purpose : This procedure gets the Study Location for the Student
1705 Known Limitations,Enhancements or Remarks:
1706 Change History :
1707 Who When What
1708 ***************************************************************/
1709
1710 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
1711
1712 BEGIN
1713 l_he_code_map_val.association_code := 'OSS_HESA_LOCSDY_ASSOC';
1714 l_he_code_map_val.map2 := Nvl(Nvl(p_susa_study_location,
1715 p_poous_study_location),
1716 p_prg_study_location) ;
1717
1718 IF l_he_code_map_val.map2 IS NOT NULL
1719 THEN
1720 p_oss_study_location := l_he_code_map_val.map2;
1721
1722 igs_he_extract2_pkg.get_map_values
1723 (p_he_code_map_val => l_he_code_map_val,
1724 p_value_from => 'MAP1',
1725 p_return_value => p_hesa_study_location);
1726
1727 END IF;
1728
1729 EXCEPTION
1730 WHEN OTHERS
1731 THEN
1732 write_to_log (SQLERRM);
1733
1734 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1735 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_study_location');
1736 IGS_GE_MSG_STACK.ADD;
1737 App_Exception.Raise_Exception;
1738 END get_study_location;
1739
1740
1741
1742 PROCEDURE get_term_time_acc
1743 (p_person_id IN igs_pe_person.person_id%TYPE,
1744 p_susa_term_time_acc IN igs_he_en_susa.term_time_accom%TYPE,
1745 p_study_location IN VARCHAR2,
1746 p_hesa_term_time_acc OUT NOCOPY VARCHAR2,
1747 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
1748 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE)
1749
1750 IS
1751 /***************************************************************
1752 Created By :
1753 Date Created By :
1754 Purpose : This procedure gets Term Time Accomodation
1755 Known Limitations,Enhancements or Remarks:
1756 Change History :
1757 Who When What
1758 smaddali Modified for bug# 2950834 , to add active = 'A' check in cursor c_addrus
1759 gmaheswa 14-Nov-03 Bug 3227107 , address changes. Modified c_address cursor to select active records.
1760 smaddali 11-dec-03 Modified for bug#3235753 , added 2 new parameters
1761 jtmathew 23-may-06 Modified c_addrus for bug 5210481
1762 ***************************************************************/
1763
1764 -- smaddali modified this cursor for bug 2730388 to get only open code values
1765 -- smaddali modified this cursor for bug#2950834 to get only active partysiteuses
1766 -- smaddali modified this cursor to get records which are effective in the HESA submission period, bug#3235753
1767 -- jtmathew modified this cursor for bug 5210481 to remove igs_pe_addr_v view
1768 CURSOR c_addrus IS
1769 SELECT MAX( site_use_type)
1770 FROM igs_pe_partysiteuse_v a,
1771 hz_party_sites b,
1772 igs_pe_hz_pty_sites c,
1773 igs_he_code_values d
1774 WHERE a.party_site_id = b.party_site_id
1775 AND b.party_site_id = c.party_site_id(+)
1776 AND (b.status = 'A'
1777 AND ( c.Start_Date IS NULL OR c.Start_Date <= p_enrl_end_dt )
1778 AND ( c.End_Date IS NULL OR c.End_Date >= p_enrl_start_dt )
1779 )
1780 AND b.party_id = p_person_id
1781 AND d.code_type = 'TERM_TIME_ADDR'
1782 AND d.value = a.site_use_type
1783 AND NVL(d.closed_ind,'N') = 'N'
1784 AND a.active = 'A'
1785 ORDER BY c.Start_Date DESC;
1786
1787
1788 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
1789 l_oss_term_time_acc igs_he_en_susa.term_time_accom%TYPE;
1790 l_address_usage igs_he_code_map_val.map1%TYPE;
1791
1792 BEGIN
1793
1794 IF p_susa_term_time_acc IS NOT NULL
1795 THEN
1796 l_oss_term_time_acc := p_susa_term_time_acc;
1797 ELSE
1798 -- Use Location of Study to get TTA
1799 l_he_code_map_val.association_code := 'OSS_TTA_LOCSDY_ASSOC';
1800 l_he_code_map_val.map2 := p_study_location;
1801
1802 IF l_he_code_map_val.map2 IS NOT NULL
1803 THEN
1804 igs_he_extract2_pkg.get_map_values
1805 (p_he_code_map_val => l_he_code_map_val,
1806 p_value_from => 'MAP1',
1807 p_return_value => l_oss_term_time_acc);
1808
1809 END IF;
1810 END IF;
1811
1812 IF l_oss_term_time_acc IS NULL
1813 THEN
1814 -- Get the TTA from the Address Usage
1815 OPEN c_addrus;
1816 FETCH c_addrus INTO l_address_usage;
1817 CLOSE c_addrus;
1818
1819 IF l_address_usage IS NOT NULL
1820 THEN
1821 l_he_code_map_val := NULL;
1822 l_he_code_map_val.association_code := 'OSS_ADDRUS_TTA_ASSOC';
1823 l_he_code_map_val.map2 := l_address_usage;
1824
1825 igs_he_extract2_pkg.get_map_values
1826 (p_he_code_map_val => l_he_code_map_val,
1827 p_value_from => 'MAP1',
1828 p_return_value => l_oss_term_time_acc);
1829 END IF;
1830 END IF;
1831
1832 -- Now get the HESA equivalent value
1833 IF l_oss_term_time_acc IS NOT NULL
1834 THEN
1835 l_he_code_map_val := NULL;
1836 l_he_code_map_val.association_code := 'OSS_HESA_TTA_ASSOC';
1837 l_he_code_map_val.map2 := l_oss_term_time_acc;
1838
1839 igs_he_extract2_pkg.get_map_values
1840 (p_he_code_map_val => l_he_code_map_val,
1841 p_value_from => 'MAP1',
1842 p_return_value => p_hesa_term_time_acc);
1843 END IF;
1844
1845 EXCEPTION
1846 WHEN OTHERS
1847 THEN
1848 write_to_log (SQLERRM);
1849 IF c_addrus%ISOPEN
1850 THEN
1851 CLOSE c_addrus;
1852 END IF;
1853
1854 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1855 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_term_time_acc');
1856 IGS_GE_MSG_STACK.ADD;
1857 App_Exception.Raise_Exception;
1858 END get_term_time_acc;
1859
1860
1861 /***************************************************************
1862 Created By : jtmathew
1863 Date Created By : 28-Dec-2005
1864 Purpose : This procedure retrieves the award conferral dates for a particular
1865 submission. It will return the program level dates if defined, else
1866 the program type level dates if defined, otherwise the HESA submission
1867 reporting period dates.
1868 it will use
1869 Known Limitations,Enhancements or Remarks:
1870 Change History :
1871 Who When What
1872 ***************************************************************/
1873 PROCEDURE get_awd_conferral_dates
1874 (p_awd_table IN awd_table,
1875 p_submission_name IN igs_he_ext_run_dtls.submission_name%TYPE,
1876 p_search_prog IN BOOLEAN,
1877 p_search_prog_type IN BOOLEAN,
1878 p_course_cd IN igs_ps_ver_all.course_cd%TYPE,
1879 p_course_type IN igs_ps_ver_all.course_type%TYPE,
1880 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
1881 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE,
1882 p_awd_conf_start_dt OUT NOCOPY igs_he_submsn_awd.award_start_date%TYPE,
1883 p_awd_conf_end_dt OUT NOCOPY igs_he_submsn_awd.award_end_date%TYPE)
1884 IS
1885 BEGIN
1886
1887 IF p_search_prog = FALSE and p_search_prog_type = FALSE THEN
1888 -- If award conferral dates are not defined at the program type level
1889 -- Use HESA Submission reporting period start and end dates
1890 -- Note: This condition will happen in most customer environments.
1891 p_awd_conf_start_dt := p_enrl_start_dt;
1892 p_awd_conf_end_dt := p_enrl_end_dt;
1893 RETURN;
1894 END IF;
1895
1896 IF p_search_prog = TRUE AND p_course_cd IS NOT NULL
1897 THEN
1898 -- get award conferral dates at the program level
1899 FOR i IN 1..p_awd_table.COUNT LOOP
1900 IF p_awd_table(i).type = 'PROGRAM' AND p_awd_table(i).key1 = p_course_cd
1901 THEN
1902 p_awd_conf_start_dt := p_awd_table(i).award_start_date;
1903 p_awd_conf_end_dt := p_awd_table(i).award_end_date;
1904 EXIT;
1905 END IF;
1906 END LOOP;
1907
1908 END IF;
1909
1910 IF p_awd_conf_start_dt IS NULL
1911 THEN -- If award conferral dates are not defined at the program level
1912
1913 IF p_search_prog_type = TRUE AND p_course_type IS NOT NULL
1914 THEN
1915 -- Get award conferral dates at the program type level
1916 FOR i IN 1..p_awd_table.COUNT LOOP
1917 IF p_awd_table(i).type = 'PROGRAM_TYPE' AND p_awd_table(i).key1 = p_course_type
1918 THEN
1919 p_awd_conf_start_dt := p_awd_table(i).award_start_date;
1920 p_awd_conf_end_dt := p_awd_table(i).award_end_date;
1921 EXIT;
1922 END IF;
1923 END LOOP;
1924 END IF;
1925
1926 IF p_awd_conf_start_dt IS NULL
1927 THEN
1928 -- Use HESA reporting period dates
1929 p_awd_conf_start_dt := p_enrl_start_dt;
1930 p_awd_conf_end_dt := p_enrl_end_dt;
1931 END IF;
1932
1933 END IF;
1934
1935 EXCEPTION
1936 WHEN OTHERS
1937 THEN
1938 write_to_log (SQLERRM);
1939 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
1940 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_awd_conferral_dates');
1941 IGS_GE_MSG_STACK.ADD;
1942 App_Exception.Raise_Exception;
1943 END get_awd_conferral_dates;
1944
1945 PROCEDURE get_min_max_awd_dates
1946 (p_submission_name IN igs_he_submsn_header.submission_name%TYPE,
1947 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
1948 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE,
1949 p_min_start_dt OUT NOCOPY igs_he_submsn_awd.award_start_date%TYPE,
1950 p_max_start_dt OUT NOCOPY igs_he_submsn_awd.award_end_date%TYPE)
1951 IS
1952 /***************************************************************
1953 Created By : jtmathew
1954 Date Created By : 28-Dec-2005
1955 Purpose : This procedure retrieves the broadest range of dates out of the
1956 program type award conferral, program award conferral and HESA submission
1957 reporting period dates.
1958 Known Limitations,Enhancements or Remarks:
1959 Change History :
1960 Who When What
1961 ***************************************************************/
1962
1963 CURSOR c_get_min_awd_conf_dt (cp_type igs_he_submsn_awd.type%TYPE) IS
1964 SELECT min(award_start_date)
1965 FROM igs_he_submsn_awd
1966 WHERE submission_name = p_submission_name;
1967
1968 CURSOR c_get_max_awd_conf_dt (cp_type igs_he_submsn_awd.type%TYPE) IS
1969 SELECT max(award_end_date)
1970 FROM igs_he_submsn_awd
1971 WHERE submission_name = p_submission_name;
1972
1973 l_min_dt DATE;
1974 l_max_dt DATE;
1975
1976 BEGIN
1977
1978 OPEN c_get_min_awd_conf_dt(p_submission_name);
1979 FETCH c_get_min_awd_conf_dt INTO l_min_dt;
1980 CLOSE c_get_min_awd_conf_dt;
1981
1982 OPEN c_get_max_awd_conf_dt(p_submission_name);
1983 FETCH c_get_max_awd_conf_dt INTO l_max_dt;
1984 CLOSE c_get_max_awd_conf_dt;
1985
1986 p_min_start_dt := LEAST(p_enrl_start_dt, NVL(l_min_dt, p_enrl_start_dt));
1987 p_max_start_dt := GREATEST(p_enrl_end_dt, NVL(l_max_dt, p_enrl_end_dt));
1988
1989 EXCEPTION
1990 WHEN OTHERS
1991 THEN
1992 write_to_log(SQLERRM);
1993
1994 IF c_get_min_awd_conf_dt%ISOPEN
1995 THEN
1996 CLOSE c_get_min_awd_conf_dt;
1997 END IF;
1998
1999 IF c_get_max_awd_conf_dt%ISOPEN
2000 THEN
2001 CLOSE c_get_max_awd_conf_dt;
2002 END IF;
2003
2004 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
2005 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_min_max_awd_dates');
2006 IGS_GE_MSG_STACK.ADD;
2007 App_Exception.Raise_Exception;
2008
2009 END get_min_max_awd_dates;
2010
2011
2012 PROCEDURE get_awd_dtls (p_submission_name IN igs_he_submsn_awd.submission_name%TYPE,
2013 p_awd_table OUT NOCOPY awd_table,
2014 p_search_prog OUT NOCOPY BOOLEAN,
2015 p_search_prog_type OUT NOCOPY BOOLEAN)
2016 IS
2017 /***************************************************************
2018 Created By : jtmathew
2019 Date Created By : 28-Dec-2005
2020 Purpose : This procedure checks whether award details are
2021 defined at the Program and Program Type levels
2022 and stores the results in a temporary structure.
2023 Known Limitations,Enhancements or Remarks:
2024 Change History :
2025 Who When What
2026 ***************************************************************/
2027 CURSOR c_get_awdcount (cp_type igs_he_submsn_awd.type%TYPE) IS
2028 SELECT 'X'
2029 FROM igs_he_submsn_awd
2030 WHERE submission_name = p_submission_name
2031 AND type = cp_type;
2032
2033 CURSOR c_get_awd_dtls IS
2034 SELECT type, key1, award_start_date, award_end_date
2035 FROM igs_he_submsn_awd
2036 WHERE submission_name = p_submission_name
2037 ORDER BY type;
2038
2039 l_dummy VARCHAR2(1);
2040 l_count NUMBER;
2041
2042 BEGIN
2043
2044 -- Check if there are any program award conferral date records for the submission
2045 OPEN c_get_awdcount('PROGRAM');
2046 FETCH c_get_awdcount INTO l_dummy;
2047
2048 -- If there are any records, then mark p_search_prog as TRUE
2049 IF c_get_awdcount%FOUND THEN
2050 p_search_prog := TRUE;
2051 END IF;
2052
2053 CLOSE c_get_awdcount;
2054
2055 -- Check if there are any program type award conferral date records for the submission
2056 OPEN c_get_awdcount('PROGRAM_TYPE');
2057 FETCH c_get_awdcount INTO l_dummy;
2058
2059 -- If there are any records, then mark p_search_prog_type as TRUE
2060 IF c_get_awdcount%FOUND THEN
2061 p_search_prog_type := TRUE;
2062 END IF;
2063
2064 CLOSE c_get_awdcount;
2065
2066 IF p_search_prog OR p_search_prog_type
2067 THEN
2068
2069 l_count := 1;
2070
2071 FOR awd_rec IN c_get_awd_dtls LOOP
2072 p_awd_table(l_count).type := awd_rec.type;
2073 p_awd_table(l_count).key1 := awd_rec.key1;
2074 p_awd_table(l_count).award_start_date := awd_rec.award_start_date;
2075 p_awd_table(l_count).award_end_date := awd_rec.award_end_date;
2076 l_count := l_count + 1;
2077 END LOOP;
2078
2079 END IF;
2080
2081
2082 EXCEPTION
2083 WHEN OTHERS
2084 THEN
2085 write_to_log(SQLERRM);
2086
2087 IF c_get_awdcount%ISOPEN
2088 THEN
2089 CLOSE c_get_awdcount;
2090 END IF;
2091
2092 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
2093 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_awd_dtls');
2094 IGS_GE_MSG_STACK.ADD;
2095 App_Exception.Raise_Exception;
2096
2097 END get_awd_dtls;
2098
2099
2100 PROCEDURE get_rsn_inst_left
2101 (p_person_id IN igs_he_en_susa.person_id%TYPE,
2102 p_course_cd IN igs_he_en_susa.course_cd%TYPE,
2103 p_crs_req_comp_ind IN igs_en_stdnt_ps_att.course_rqrmnt_complete_ind%TYPE,
2104 p_crs_req_comp_dt IN igs_en_stdnt_ps_att.course_rqrmnts_complete_dt%TYPE,
2105 p_disc_reason_cd IN igs_en_stdnt_ps_att.discontinuation_reason_cd%TYPE,
2106 p_disc_dt IN igs_en_stdnt_ps_att.discontinued_dt%TYPE,
2107 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
2108 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE,
2109 p_rsn_inst_left OUT NOCOPY VARCHAR2)
2110 IS
2111 /***************************************************************
2112 Created By :
2113 Date Created By :
2114 Purpose :This procedure gets the reason why the student left the institution
2115 Known Limitations,Enhancements or Remarks:
2116 Change History :
2117 Who When What
2118 Bayadav 16-Dec-02 Included two new paramters and validation to check the value of conferral date at graduation level
2119 and progression level as a part of bug 2702100
2120 smaddali 03-Dec-03 Removed cursor c_gr_approval_status and its code for HECR210 program completion validation Build, bug#2874542
2121 jtmathew 07-Sep-06 Ensured that this field only gets derived when student
2122 completes/discontinues during current reporting period.
2123 ***************************************************************/
2124
2125 --To check if award has been made in progression
2126 -- smaddali added conndition a.complete_ind = 'Y', for HECR210 build bug#2874542
2127 CURSOR c_pr_approval_status
2128 IS
2129 SELECT COUNT(a.person_id)
2130 FROM IGS_EN_SPA_AWD_AIM a
2131 WHERE a.person_id = p_person_id
2132 AND a.course_cd = p_course_cd
2133 AND a.conferral_date BETWEEN p_enrl_start_dt and p_enrl_end_dt
2134 AND a.complete_ind = 'Y';
2135
2136
2137
2138
2139 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
2140 l_graduand_count NUMBER := 0;
2141
2142 BEGIN
2143
2144 -- smaddali removed code checking if conferal date exists at graduand level,
2145 -- for HECR210 program completion validation build bug#2874542
2146 IF p_crs_req_comp_ind = 'Y' AND p_crs_req_comp_dt <= p_enrl_end_dt THEN
2147 --Check if the conferral_date exists at the progression level
2148 OPEN c_pr_approval_status ;
2149 FETCH c_pr_approval_status INTO l_graduand_count;
2150 CLOSE c_pr_approval_status;
2151 --If exists then success
2152 IF l_graduand_count >= 1 THEN
2153 --Set 01 as Successful completion of course.
2154 p_rsn_inst_left := '01';
2155 ELSE
2156 --Set 98 as completion of course but result unknowm as the conferral date is not set at any level
2157 p_rsn_inst_left := '98';
2158 END IF;
2159 ELSIF p_disc_reason_cd IS NOT NULL AND p_disc_dt <= p_enrl_end_dt THEN
2160
2161 l_he_code_map_val.association_code := 'OSS_HESA_RSNLEAVE_ASSOC';
2162 l_he_code_map_val.map2 := p_disc_reason_cd;
2163
2164 igs_he_extract2_pkg.get_map_values
2165 (p_he_code_map_val => l_he_code_map_val,
2166 p_value_from => 'MAP1',
2167 p_return_value => p_rsn_inst_left);
2168
2169 END IF;
2170
2171 EXCEPTION
2172 WHEN OTHERS
2173 THEN
2174 write_to_log (SQLERRM);
2175 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
2176 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_rsn_inst_left');
2177 IGS_GE_MSG_STACK.ADD;
2178 App_Exception.Raise_Exception;
2179 END get_rsn_inst_left;
2180
2181
2182
2183 PROCEDURE get_completion_status
2184 (p_person_id IN igs_pe_person.person_id%TYPE,
2185 p_course_cd IN igs_he_st_spa.course_cd%TYPE ,
2186 p_susa_comp_status IN igs_he_en_susa.completion_status%TYPE,
2187 p_fe_stdnt_mrker IN igs_he_st_spa.fe_student_marker%TYPE,
2188 p_crs_req_comp_ind IN igs_en_stdnt_ps_att.course_rqrmnt_complete_ind%TYPE,
2189 p_discont_date IN igs_en_stdnt_ps_att.discontinued_dt%TYPE,
2190 p_hesa_comp_status OUT NOCOPY VARCHAR2)
2191 IS
2192 /***************************************************************
2193 Created By :
2194 Date Created By :
2195 Purpose : This procedure gets the completion status
2196 Known Limitations,Enhancements or Remarks:
2197 Change History :
2198 Who When What
2199 ***************************************************************/
2200
2201 -- smaddali modified this cursor to check transfer table instead of stdnt_ps_att table for bug 2396174
2202 CURSOR c_chk_trn IS
2203 SELECT course_cd
2204 FROM igs_ps_stdnt_trn
2205 WHERE person_id = p_person_id
2206 AND transfer_course_cd = p_course_cd
2207 ORDER BY transfer_dt DESC ;
2208
2209 -- smaddali added this cursor to get the student instance number of an spa record for bug 2396174
2210 CURSOR c_sin ( cp_course_cd igs_he_st_spa.course_cd%TYPE ) IS
2211 SELECT student_inst_number
2212 FROM igs_he_st_spa
2213 WHERE person_id = p_person_id
2214 AND course_cd = cp_course_cd ;
2215
2216 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
2217 l_to_course_cd igs_he_st_spa.course_cd%TYPE := NULL ;
2218 l_from_sin igs_he_st_spa.student_inst_number%TYPE := NULL ;
2219 l_to_sin igs_he_st_spa.student_inst_number%TYPE := NULL ;
2220
2221 BEGIN
2222 IF p_fe_stdnt_mrker IN ('1','3','4')
2223 THEN
2224
2225 IF p_susa_comp_status IS NOT NULL
2226 THEN
2227
2228 l_he_code_map_val.association_code := 'OSS_HESA_CSTAT_ASSOC';
2229 l_he_code_map_val.map2 := p_susa_comp_status ;
2230
2231 igs_he_extract2_pkg.get_map_values
2232 (p_he_code_map_val => l_he_code_map_val,
2233 p_value_from => 'MAP1',
2234 p_return_value => p_hesa_comp_status);
2235
2236 ELSE
2237 IF p_discont_date IS NULL
2238 AND p_crs_req_comp_ind = 'N'
2239 THEN
2240 p_hesa_comp_status := '1';
2241
2242 ELSIF p_crs_req_comp_ind = 'Y'
2243 THEN
2244 p_hesa_comp_status := '2';
2245
2246 ELSIF p_discont_date IS NOT NULL
2247 THEN
2248 --smaddali added this code for bug 2396174
2249 -- Check if Student has transfered to any other course
2250 OPEN c_chk_trn;
2251 FETCH c_chk_trn INTO l_to_course_cd ;
2252 IF c_chk_trn%FOUND
2253 THEN
2254 -- Get the Student instance number of the current program attempt
2255 OPEN c_sin(p_course_cd) ;
2256 FETCH c_sin INTO l_from_sin ;
2257 CLOSE c_sin ;
2258 -- Get the student instance number of the New program attempt transfered into
2259 OPEN c_sin( l_to_course_cd) ;
2260 FETCH c_sin INTO l_to_sin ;
2261 CLOSE c_sin ;
2262
2263 -- If student has transfered into a new qualification aim then completion status=4 else 3
2264 IF l_from_sin <> l_to_sin THEN
2265 p_hesa_comp_status := '4';
2266 END IF;
2267 --end bug 2396174
2268 -- if student has simply discontinued from current program attempt then completion status = 3
2269 ELSE
2270 p_hesa_comp_status := '3';
2271 END IF;
2272 CLOSE c_chk_trn;
2273
2274 END IF;
2275
2276 END IF; -- SUSA Completion Status provided.
2277 END IF; -- FE Student Marker
2278
2279 EXCEPTION
2280 WHEN OTHERS
2281 THEN
2282 write_to_log (SQLERRM);
2283 IF c_chk_trn%ISOPEN
2284 THEN
2285 CLOSE c_chk_trn;
2286 END IF;
2287
2288 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
2289 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_completion_status');
2290 IGS_GE_MSG_STACK.ADD;
2291 App_Exception.Raise_Exception;
2292 END get_completion_status;
2293
2294
2295
2296 PROCEDURE get_good_stand_mrkr
2297 (p_susa_good_st_mk IN igs_he_en_susa.good_stand_marker%TYPE,
2298 p_fe_stdnt_mrker IN igs_he_st_spa.fe_student_marker%TYPE,
2299 p_crs_req_comp_ind IN igs_en_stdnt_ps_att.course_rqrmnt_complete_ind%TYPE,
2300 p_discont_date IN igs_en_stdnt_ps_att.discontinued_dt%TYPE,
2301 p_hesa_good_st_mk OUT NOCOPY VARCHAR2)
2302 IS
2303 /***************************************************************
2304 Created By :
2305 Date Created By :
2306 Purpose : This procedure gets the Good Standing Marker
2307 Known Limitations,Enhancements or Remarks:
2308 Change History :
2309 Who When What
2310 ***************************************************************/
2311
2312 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
2313
2314 BEGIN
2315 IF p_fe_stdnt_mrker IN ('1','3','4')
2316 THEN
2317 IF p_discont_date IS NULL
2318 AND p_crs_req_comp_ind = 'N'
2319 THEN
2320 p_hesa_good_st_mk := '9';
2321
2322 ELSIF p_susa_good_st_mk IS NOT NULL
2323 THEN
2324
2325 l_he_code_map_val.association_code := 'OSS_HESA_PROGRESS_ASSOC';
2326 l_he_code_map_val.map2 := p_susa_good_st_mk ;
2327
2328 igs_he_extract2_pkg.get_map_values
2329 (p_he_code_map_val => l_he_code_map_val,
2330 p_value_from => 'MAP1',
2331 p_return_value => p_hesa_good_st_mk);
2332
2333 END IF;
2334 END IF; -- FE Student Marker
2335
2336 EXCEPTION
2337 WHEN OTHERS
2338 THEN
2339 write_to_log (SQLERRM);
2340 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
2341 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_good_stand_mrkr');
2342 IGS_GE_MSG_STACK.ADD;
2343 App_Exception.Raise_Exception;
2344 END get_good_stand_mrkr;
2345
2346
2347 PROCEDURE get_qual_obtained
2348 (p_person_id IN igs_pe_person.person_id%TYPE,
2349 p_course_cd IN igs_he_st_spa.course_cd%TYPE,
2350 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
2351 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE,
2352 p_oss_qual_obt1 OUT NOCOPY VARCHAR2,
2353 p_oss_qual_obt2 OUT NOCOPY VARCHAR2,
2354 p_hesa_qual_obt1 OUT NOCOPY VARCHAR2,
2355 p_hesa_qual_obt2 OUT NOCOPY VARCHAR2,
2356 p_classification OUT NOCOPY VARCHAR2)
2357
2358 IS
2359 /***************************************************************
2360 Created By :
2361 Date Created By :
2362 Purpose :This procedure gets the value of Qualification Obtained Fields
2363 Known Limitations,Enhancements or Remarks:
2364 Change History :
2365 Who When What
2366 Bayadav 16-DEC-02 Included two new paramters and validation to check the value of conferral date at graduation level and progression level as a part of bug 2702117
2367 smaddali 5-dec-03 removed cursor c_gr_awd and its code for HECR210 program completion validation build, bug#2874542
2368 ***************************************************************/
2369
2370 -- Get the award and grade details from the Program attempt awards
2371 CURSOR c_pr_awd IS
2372 SELECT a.award_cd,
2373 a.award_grade ,
2374 c.map1,
2375 a.grading_schema_cd
2376 FROM igs_en_spa_awd_aim a ,
2377 igs_he_code_map_val c
2378 WHERE a.person_id = p_person_id
2379 AND a.course_cd = p_course_cd
2380 AND a.conferral_date BETWEEN p_enrl_start_dt and p_enrl_end_dt
2381 AND a.complete_ind ='Y'
2382 AND a.award_cd = c.map2
2383 AND c.association_code = 'OSS_HESA_AWD_ASSOC'
2384 ORDER BY c.map1 ASC;
2385
2386
2387 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
2388 l_awd1 igs_en_spa_awd_aim.award_cd%TYPE;
2389 l_awd2 igs_en_spa_awd_aim.award_cd%TYPE;
2390 l_grade1 igs_en_spa_awd_aim.award_grade%TYPE;
2391 l_grade2 igs_en_spa_awd_aim.award_grade%TYPE;
2392 l_grading_schema1 igs_en_spa_awd_aim.grading_schema_cd%TYPE;
2393 l_grading_schema2 igs_en_spa_awd_aim.grading_schema_cd%TYPE;
2394 l_classification1 igs_he_code_map_val.map1%TYPE;
2395 l_classification2 igs_he_code_map_val.map1%TYPE;
2396
2397 BEGIN
2398 -- smaddali removed code checking for graduand awards,
2399 -- for HECR210 program completion validation build, bug#2874542
2400
2401 -- get the conferral date from progression level
2402 OPEN c_pr_awd;
2403 -- Fetch first set of qualifications
2404 FETCH c_pr_awd INTO l_awd1,
2405 l_grade1,
2406 p_hesa_qual_obt1,
2407 l_grading_schema1 ;
2408
2409 IF c_pr_awd%FOUND THEN
2410 -- Fetch second set of qualifications
2411 FETCH c_pr_awd INTO l_awd2,
2412 l_grade2,
2413 p_hesa_qual_obt2 ,
2414 l_grading_schema2 ;
2415 END IF;
2416 CLOSE c_pr_awd;
2417
2418 -- smaddali modified the code for deriving HESA classification , for HECR210 build bug#2874542
2419 -- replaced OSS_HESA_HONORS_ASSOC with OSS_HESA_CLASS_ASSOC
2420 -- Get the HESA Classification code using the Qualification1 obtained using the Associtaion code OSS_HESA_CLASS_ASSOC
2421
2422 IF l_grading_schema1 IS NOT NULL
2423 AND l_grade1 IS NOT NULL
2424 THEN
2425 -- get the classification using the Awards and honours level.
2426 l_he_code_map_val := NULL ;
2427 l_he_code_map_val.association_code := 'OSS_HESA_CLASS_ASSOC';
2428 l_he_code_map_val.map2 := l_grading_schema1 ;
2429 l_he_code_map_val.map3 := l_grade1 ;
2430 igs_he_extract2_pkg.get_map_values
2431 (p_he_code_map_val => l_he_code_map_val,
2432 p_value_from => 'MAP1',
2433 p_return_value => l_classification1);
2434 END IF;
2435
2436 -- Get the HESA Classification code using the Qualification2 obtained using the Associtaion code OSS_HESA_CLASS_ASSOC
2437 IF l_grading_schema2 IS NOT NULL
2438 AND l_grade2 IS NOT NULL
2439 THEN
2440 -- get the classification using the Awards and honours level.
2441 l_he_code_map_val := NULL ;
2442 l_he_code_map_val.association_code := 'OSS_HESA_CLASS_ASSOC';
2443 l_he_code_map_val.map2 := l_grading_schema2 ;
2444 l_he_code_map_val.map3 := l_grade2 ;
2445 igs_he_extract2_pkg.get_map_values
2446 (p_he_code_map_val => l_he_code_map_val,
2447 p_value_from => 'MAP1',
2448 p_return_value => l_classification2);
2449 END IF;
2450
2451 -- return oss award codes and classification
2452 p_oss_qual_obt1 := l_awd1;
2453 p_oss_qual_obt2 := l_awd2;
2454 -- Return the Least classification among classification 1 and 2 as the HESA value
2455 IF l_classification1 IS NULL OR l_classification2 IS NULL THEN
2456 p_classification := NVL(l_classification1,l_classification2) ;
2457 ELSE
2458 p_classification := LEAST(l_classification1,l_classification2) ;
2459 END IF ;
2460
2461
2462
2463 EXCEPTION
2464 WHEN OTHERS
2465 THEN
2466 write_to_log (SQLERRM);
2467 IF c_pr_awd%ISOPEN
2468 THEN
2469 CLOSE c_pr_awd;
2470 END IF;
2471
2472 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
2473 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_qual_obtained ');
2474 IGS_GE_MSG_STACK.ADD;
2475 App_Exception.Raise_Exception;
2476 END get_qual_obtained ;
2477
2478
2479 PROCEDURE get_fe_qual_aim
2480 (p_spa_fe_qual_aim IN igs_he_st_spa.student_fe_qual_aim%TYPE,
2481 p_fe_stdnt_mrker IN igs_he_st_spa.fe_student_marker%TYPE,
2482 p_course_cd IN igs_he_st_spa.course_cd%TYPE,
2483 p_version_number IN igs_he_st_spa.version_number%TYPE,
2484 p_hesa_fe_qual_aim OUT NOCOPY VARCHAR2)
2485
2486 IS
2487 /***************************************************************
2488 Created By :
2489 Date Created By :
2490 Purpose : This procedure gets FE Qualification Aim
2491 Known Limitations,Enhancements or Remarks:
2492 Change History :
2493 Who When What
2494 smvk 03-Jun-2003 Bug # 2858436. Modified the cursor c_get_feq to select open program awards only.
2495 smaddali 29-jan-04 Bug#3360646 modified cursor c_get_feq to remove condition default_ind=Y
2496 ***************************************************************/
2497
2498 CURSOR c_get_feq IS
2499 SELECT map1
2500 FROM igs_ps_award , igs_he_code_map_val
2501 WHERE course_cd = p_course_cd
2502 AND version_number = p_version_number
2503 AND closed_ind = 'N'
2504 AND map2 = award_cd
2505 AND association_code = 'OSS_HESA_FEQAIM_ASSOC'
2506 ORDER BY default_ind DESC , map1 ASC;
2507
2508 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
2509
2510 BEGIN
2511
2512 IF p_fe_stdnt_mrker IN ('1','3','4')
2513 THEN
2514 IF p_spa_fe_qual_aim IS NULL
2515 THEN
2516 OPEN c_get_feq;
2517 FETCH c_get_feq INTO p_hesa_fe_qual_aim;
2518 CLOSE c_get_feq;
2519 ELSE
2520 l_he_code_map_val.association_code := 'OSS_HESA_FEQAIM_ASSOC';
2521 l_he_code_map_val.map2 := p_spa_fe_qual_aim ;
2522
2523 igs_he_extract2_pkg.get_map_values
2524 (p_he_code_map_val => l_he_code_map_val,
2525 p_value_from => 'MAP1',
2526 p_return_value => p_hesa_fe_qual_aim);
2527
2528 END IF;
2529
2530 END IF; -- FE Stdnt Marker
2531
2532 EXCEPTION
2533 WHEN OTHERS
2534 THEN
2535 write_to_log (SQLERRM);
2536 IF c_get_feq%ISOPEN
2537 THEN
2538 CLOSE c_get_feq;
2539 END IF;
2540
2541 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
2542 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_fe_qual_aim');
2543 IGS_GE_MSG_STACK.ADD;
2544 App_Exception.Raise_Exception;
2545 END get_fe_qual_aim;
2546
2547 PROCEDURE get_qual_aim_sbj1
2548 (p_qual_aim_subj1 IN igs_he_st_spa.qual_aim_subj1%TYPE,
2549 p_qual_aim_subj2 IN igs_he_st_spa.qual_aim_subj2%TYPE,
2550 p_qual_aim_subj3 IN igs_he_st_spa.qual_aim_subj3%TYPE,
2551 p_oss_qualaim_sbj IN igs_he_code_values.value%TYPE,
2552 p_hesa_qualaim_sbj OUT NOCOPY igs_he_code_values.value%TYPE
2553 )
2554 IS
2555 /***************************************************************
2556 Created By : bayadav
2557 Date Created By : 25-OCT-2002
2558 Purpose :This procedure gets the value of HESA mapped qualification aim proportion for field 46
2559 Known Limitations,Enhancements or Remarks:
2560 Change History :
2561 Who When What
2562 Bayadav 25-OCT-02 Included new procedure as a part of HEFD101
2563 ***************************************************************/
2564
2565 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
2566 BEGIN
2567
2568 IF p_qual_aim_subj1 IS NOT NULL
2569 AND p_qual_aim_subj2 IS NULL
2570 AND p_qual_aim_subj3 IS NULL
2571 THEN -- Single
2572 p_hesa_qualaim_sbj := '0';
2573 ELSIF p_qual_aim_subj2 IS NOT NULL AND p_qual_aim_subj3 IS NULL
2574 THEN
2575
2576 l_he_code_map_val.association_code := 'OSS_HESA_PROPORTION_ASSOC';
2577 l_he_code_map_val.map2 := p_oss_qualaim_sbj;
2578
2579 IF l_he_code_map_val.map2 IS NOT NULL
2580 THEN
2581 igs_he_extract2_pkg.get_map_values
2582 (p_he_code_map_val => l_he_code_map_val,
2583 p_value_from => 'MAP1',
2584 p_return_value => p_hesa_qualaim_sbj);
2585
2586 END IF;
2587
2588 ELSIF p_qual_aim_subj3 IS NOT NULL
2589 THEN -- Triple or more
2590 p_hesa_qualaim_sbj := '3';
2591 END IF;
2592
2593 EXCEPTION
2594 WHEN OTHERS
2595 THEN
2596 write_to_log (SQLERRM);
2597 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
2598 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_qual_aim_sbj1');
2599 IGS_GE_MSG_STACK.ADD;
2600 App_Exception.Raise_Exception;
2601
2602 END get_qual_aim_sbj1;
2603
2604 PROCEDURE get_qual_aim_sbj
2605 ( p_course_cd IN igs_he_st_spa.course_cd%TYPE,
2606 p_version_number IN igs_he_st_spa.version_number%TYPE,
2607 p_subject1 OUT NOCOPY VARCHAR2,
2608 p_subject2 OUT NOCOPY VARCHAR2,
2609 p_subject3 OUT NOCOPY VARCHAR2,
2610 p_prop_ind OUT NOCOPY VARCHAR2)
2611
2612 IS
2613 /***************************************************************
2614 Created By :
2615 Date Created By :
2616 Purpose : This procedure gets Subjects of Qualification Aim
2617 Known Limitations,Enhancements or Remarks:
2618 Change History :
2619 Who When What
2620 jtmathew 02-Feb-06 Modified derivation to include values 0 and 3
2621 ***************************************************************/
2622
2623 CURSOR c_sbj1 IS
2624 SELECT b.govt_field_of_study,
2625 a.percentage
2626 FROM igs_ps_field_study a,
2627 igs_ps_fld_of_study b
2628 WHERE a.course_cd = p_course_cd
2629 AND a.version_number = p_version_number
2630 AND a.major_field_ind = 'Y'
2631 AND a.field_of_study = b.field_of_study;
2632
2633 CURSOR c_sbj23 IS
2634 SELECT b.govt_field_of_study,
2635 a.percentage
2636 FROM igs_ps_field_study a,
2637 igs_ps_fld_of_study b
2638 WHERE a.course_cd = p_course_cd
2639 AND a.version_number = p_version_number
2640 AND a.major_field_ind = 'N'
2641 AND a.field_of_study = b.field_of_study
2642 ORDER BY percentage DESC ;
2643
2644 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
2645 l_percentage1 igs_ps_field_study.percentage%TYPE;
2646 l_percentage2 igs_ps_field_study.percentage%TYPE;
2647 l_percentage3 igs_ps_field_study.percentage%TYPE;
2648
2649 BEGIN
2650 -- Get Subject 1, Major
2651 OPEN c_sbj1;
2652 FETCH c_sbj1 INTO p_subject1,
2653 l_percentage1;
2654 CLOSE c_sbj1;
2655
2656 -- Get Subject 2
2657 OPEN c_sbj23;
2658 FETCH c_sbj23 INTO p_subject2,
2659 l_percentage2;
2660 -- Get Subject 3
2661 FETCH c_sbj23 INTO p_subject3,
2662 l_percentage3;
2663 CLOSE c_sbj23;
2664
2665 p_prop_ind := NULL;
2666
2667 IF l_percentage1 IS NOT NULL
2668 AND l_percentage2 IS NULL
2669 AND l_percentage3 IS NULL
2670 THEN -- Single
2671 p_prop_ind := '0';
2672 ELSE
2673 IF l_percentage2 IS NOT NULL
2674 AND l_percentage3 IS NULL
2675 THEN
2676 IF l_percentage2 = 50
2677 THEN
2678 -- Balanced Combination
2679 p_prop_ind := '1';
2680 ELSE
2681 -- Major, Minor
2682 p_prop_ind := '2';
2683 END IF;
2684 ELSIF l_percentage3 IS NOT NULL
2685 THEN -- Triple or more
2686 p_prop_ind := '3';
2687 END IF;
2688
2689 END IF;
2690
2691 EXCEPTION
2692 WHEN OTHERS
2693 THEN
2694 write_to_log (SQLERRM);
2695 IF c_sbj1%ISOPEN
2696 THEN
2697 CLOSE c_sbj1;
2698 END IF;
2699
2700 IF c_sbj23%ISOPEN
2701 THEN
2702 CLOSE c_sbj23;
2703 END IF;
2704
2705 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
2706 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_qual_aim_sbj ');
2707 IGS_GE_MSG_STACK.ADD;
2708 App_Exception.Raise_Exception;
2709 END get_qual_aim_sbj;
2710
2711 FUNCTION is_ucas_ftug (p_hesa_qual_aim IN igs_he_ex_rn_dat_fd.value%TYPE,
2712 p_hesa_commdate IN igs_he_ex_rn_dat_fd.value%TYPE,
2713 p_ucasnum IN igs_he_ex_rn_dat_fd.value%TYPE,
2714 p_min_commdate IN DATE) RETURN BOOLEAN
2715 IS
2716 /***************************************************************
2717 Created By : Jay Mathew
2718 Date Created By : 15-Mar-2005
2719 Purpose : This function checks whether a student is a UCAS (FTUG, NMAS or SWAS)
2720 student. The criteria for returning true depends on the following:
2721 The student's qual_aim must be between 18 and 52 or must equal
2722 either 61 or 97. The student also has to have a commencement
2723 date that is greater than p_min_commdate. Used by various tariff
2724 level fields in both a student and combined return.
2725 Known Limitations,Enhancements or Remarks:
2726 Change History :
2727 Who When What
2728 ***************************************************************/
2729 BEGIN
2730
2731 RETURN (TO_DATE(p_hesa_commdate, 'DD/MM/YYYY') > p_min_commdate AND
2732 (p_hesa_qual_aim IN ('18', '19', '20', '21', '22', '23', '24', '25', '26', '27',
2733 '28', '29', '30', '31', '32', '33', '34', '35', '36', '37',
2734 '38', '39', '40', '41', '42', '43', '44', '45', '46', '47',
2735 '48', '49', '50', '51', '52') OR p_hesa_qual_aim IN ('61','97')) AND
2736 p_ucasnum >= 1 );
2737
2738 EXCEPTION
2739 WHEN OTHERS
2740 THEN
2741 write_to_log (SQLERRM);
2742 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
2743 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.is_ucas_ftug');
2744 IGS_GE_MSG_STACK.ADD;
2745 App_Exception.Raise_Exception;
2746
2747 END is_ucas_ftug;
2748
2749 PROCEDURE limit_no_of_qual(p_field_number IN NUMBER,
2750 p_person_number IN igs_pe_person.person_number%TYPE,
2751 p_course_cd IN igs_he_st_spa.course_cd%TYPE,
2752 p_hesa_qual IN VARCHAR2,
2753 p_no_of_qual IN OUT NOCOPY NUMBER)
2754 IS
2755 /***************************************************************
2756 Created By :
2757 Date Created By : 15-Mar-2005
2758 Purpose : This procedure checks whether the number of qualifications for
2759 a student at a particular qualification level is within the
2760 range of values allowed (0 to 9). If p_no_of_qual exceeds the max
2761 value which HESA currently specifies as 9, then the value is set
2762 to l_max_no_of_qual and a warning message is logged.
2763 Pre-condition : p_no_of_qual IS NOT NULL.
2764 Known Limitations,Enhancements or Remarks:
2765 Change History :
2766 Who When What
2767 ***************************************************************/
2768 l_max_no_of_qual NUMBER;
2769 l_old_no_of_qual NUMBER; -- only necessary for logging
2770
2771 BEGIN
2772
2773 l_max_no_of_qual := 9;
2774 l_old_no_of_qual := p_no_of_qual;
2775
2776 IF p_no_of_qual > l_max_no_of_qual
2777 THEN
2778 p_no_of_qual := l_max_no_of_qual;
2779
2780 FND_MESSAGE.SET_NAME('IGS','IGS_HE_MAX_TARIFF');
2781 FND_MESSAGE.SET_TOKEN('FIELD_NUM', p_field_number);
2782 FND_MESSAGE.SET_TOKEN('PER_NUM', p_person_number);
2783 FND_MESSAGE.SET_TOKEN('OLD_NUM', l_old_no_of_qual);
2784 FND_MESSAGE.SET_TOKEN('COURSE_CD',p_course_cd);
2785 FND_MESSAGE.SET_TOKEN('FIELD_NAME',p_hesa_qual);
2786 FND_MESSAGE.SET_TOKEN('MAX_NUM',l_max_no_of_qual);
2787 FND_FILE.PUT_LINE(FND_FILE.LOG,FND_MESSAGE.GET());
2788
2789 END IF;
2790
2791 EXCEPTION
2792 WHEN OTHERS
2793 THEN
2794 write_to_log (SQLERRM);
2795
2796 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
2797 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.limit_no_of_qual');
2798 IGS_GE_MSG_STACK.ADD;
2799 App_Exception.Raise_Exception;
2800 END limit_no_of_qual;
2801
2802 PROCEDURE limit_tariff_score(p_field_number IN NUMBER,
2803 p_person_number IN igs_pe_person.person_number%TYPE,
2804 p_course_cd IN igs_he_st_spa.course_cd%TYPE,
2805 p_hesa_qual IN VARCHAR2,
2806 p_tariff_score IN OUT NOCOPY igs_he_ex_rn_dat_fd.value%TYPE)
2807 IS
2808 /***************************************************************
2809 Created By :
2810 Date Created By : 15-Mar-2005
2811 Purpose : This procedure checks whether the tariff score for a student at
2812 a particular qualification level is within the range of values
2813 allowed (0 to 998). If p_tariff_score exceeds the max
2814 value which HESA currently specifies as 998, then the value is
2815 set to l_max_tariff_score and a warning message is logged.
2816 Pre-condition : p_tariff_score exists.
2817 Known Limitations,Enhancements or Remarks:
2818 Change History :
2819 Who When What
2820 ***************************************************************/
2821 l_max_tariff_score NUMBER;
2822 l_old_tariff_score NUMBER; -- only necessary for logging
2823
2824 BEGIN
2825
2826 l_max_tariff_score := 998;
2827 l_old_tariff_score := TO_NUMBER(p_tariff_score);
2828
2829 IF l_old_tariff_score > l_max_tariff_score
2830 THEN
2831 p_tariff_score := TO_CHAR(l_max_tariff_score);
2832
2833 FND_MESSAGE.SET_NAME('IGS','IGS_HE_MAX_TARIFF');
2834 FND_MESSAGE.SET_TOKEN('FIELD_NUM', p_field_number);
2835 FND_MESSAGE.SET_TOKEN('PER_NUM', p_person_number);
2836 FND_MESSAGE.SET_TOKEN('OLD_NUM', l_old_tariff_score);
2837 FND_MESSAGE.SET_TOKEN('COURSE_CD',p_course_cd);
2838 FND_MESSAGE.SET_TOKEN('FIELD_NAME',p_hesa_qual);
2839 FND_MESSAGE.SET_TOKEN('MAX_NUM',l_max_tariff_score);
2840 FND_FILE.PUT_LINE(FND_FILE.LOG,FND_MESSAGE.GET());
2841
2842 END IF;
2843
2844 p_tariff_score := LPAD(p_tariff_score, 3, '0');
2845
2846 EXCEPTION
2847 WHEN OTHERS
2848 THEN
2849 write_to_log (SQLERRM);
2850
2851 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
2852 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.limit_tariff_score');
2853 IGS_GE_MSG_STACK.ADD;
2854 App_Exception.Raise_Exception;
2855 END limit_tariff_score;
2856
2857 PROCEDURE get_gen_qual_aim
2858 (p_person_id IN igs_pe_person.person_id%TYPE,
2859 p_course_cd IN igs_he_st_spa.course_cd%TYPE,
2860 p_version_number IN igs_he_st_spa.version_number%TYPE,
2861 p_spa_gen_qaim IN igs_he_st_spa.student_qual_aim%TYPE,
2862 p_hesa_gen_qaim OUT NOCOPY VARCHAR2,
2863 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
2864 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE,
2865 p_awd_conf_start_dt IN igs_he_submsn_awd.award_start_date%TYPE)
2866
2867 IS
2868 /***************************************************************
2869 Created By :
2870 Date Created By :
2871 Purpose : This procedure gets General Qualification Aim of Student
2872 Known Limitations,Enhancements or Remarks:
2873 Change History :
2874 Who When What
2875 smvk 03-Jun-2003 Bug # 2858436. Modified the cursor c_prgawd to select open program awards only.
2876 smaddali 21-jan-04 Modified cursor c_prgawd and c_spawd for bug#3360646
2877 ***************************************************************/
2878
2879 --smaddali modified this cursor for bug 2392702
2880 -- smaddali Modified for bug#3360646, to check for dates overlapping with submission period
2881 -- and to exclude awards which are conferred before the submission start_date
2882 CURSOR c_spawd IS
2883 SELECT map1
2884 FROM igs_en_spa_awd_aim , igs_he_code_map_val
2885 WHERE person_id = p_person_id
2886 AND course_cd = p_course_cd
2887 AND start_dt <= NVL(p_enrl_end_dt,start_dt)
2888 AND ( end_dt IS NULL OR end_dt >= NVL(p_enrl_start_dt,end_dt) )
2889 AND ( (complete_ind = 'Y' AND conferral_date >= NVL(p_awd_conf_start_dt,conferral_date) ) OR
2890 complete_ind = 'N'
2891 )
2892 AND map2 = award_cd
2893 AND association_code = 'OSS_HESA_AWD_ASSOC'
2894 ORDER BY map1 ASC ;
2895
2896 --smaddali modified this cursor for bug 2392702
2897 -- smaddali Modified for bug#3360646, to remove default_ind=Y check and add default_ind in order by clause
2898 CURSOR c_prgawd IS
2899 SELECT map1
2900 FROM igs_ps_award , igs_he_code_map_val
2901 WHERE course_cd = p_course_cd
2902 AND version_number = p_version_number
2903 AND closed_ind = 'N'
2904 AND map2 = award_cd
2905 AND association_code = 'OSS_HESA_AWD_ASSOC'
2906 ORDER BY default_ind DESC, map1 ASC ;
2907
2908 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
2909 l_oss_gen_qaim igs_ps_award.award_cd%TYPE;
2910
2911 BEGIN
2912
2913 IF p_spa_gen_qaim IS NOT NULL
2914 THEN
2915 l_oss_gen_qaim := p_spa_gen_qaim;
2916 --smaddali added this code for bug 2392702
2917 -- If some value found, get HESA equivalent value
2918 l_he_code_map_val.association_code := 'OSS_HESA_AWD_ASSOC';
2919 l_he_code_map_val.map2 := l_oss_gen_qaim ;
2920
2921 igs_he_extract2_pkg.get_map_values
2922 (p_he_code_map_val => l_he_code_map_val,
2923 p_value_from => 'MAP1',
2924 p_return_value => p_hesa_gen_qaim);
2925
2926 ELSE
2927
2928 OPEN c_spawd;
2929 FETCH c_spawd INTO p_hesa_gen_qaim ;
2930 CLOSE c_spawd;
2931
2932 IF p_hesa_gen_qaim IS NULL
2933 THEN
2934 -- If still null, use the one at Program Level
2935 OPEN c_prgawd;
2936 FETCH c_prgawd INTO p_hesa_gen_qaim ;
2937 CLOSE c_prgawd;
2938 END IF;
2939
2940 END IF;
2941
2942
2943 EXCEPTION
2944 WHEN OTHERS
2945 THEN
2946 write_to_log (SQLERRM);
2947 IF c_spawd%ISOPEN
2948 THEN
2949 CLOSE c_spawd;
2950 END IF;
2951
2952 IF c_prgawd%ISOPEN
2953 THEN
2954 CLOSE c_prgawd;
2955 END IF;
2956
2957 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
2958 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_gen_qual_aim');
2959 IGS_GE_MSG_STACK.ADD;
2960 App_Exception.Raise_Exception;
2961 END get_gen_qual_aim;
2962
2963
2964
2965 PROCEDURE get_awd_body_12
2966 (p_course_cd IN igs_he_st_spa.course_cd%TYPE,
2967 p_version_number IN igs_he_st_spa.version_number%TYPE,
2968 p_awd1 IN VARCHAR2,
2969 p_awd2 IN VARCHAR2,
2970 p_awd_body1 OUT NOCOPY VARCHAR2,
2971 p_awd_body2 OUT NOCOPY VARCHAR2)
2972
2973 IS
2974 /***************************************************************
2975 Created By :
2976 Date Created By :
2977 Purpose : This procedure gets Awarding Bodies 1 and 2
2978 Known Limitations,Enhancements or Remarks:
2979 Change History :
2980 Who When What
2981 JBaber 20-Sept-04 Changes for bug 3830986
2982 anwest 09-Jun-04 Changes for bug #4401841
2983 ***************************************************************/
2984
2985 -- jbaber 20-Sept-04
2986 -- updated cursor to group by institution code and order by sum(percentage)
2987 -- this guarantees distinct institution codes ordered by the total % contribution
2988 -- anwest 09-Jun-05
2989 -- updated cursor for HZ_PARTIES.PARTY_NUMBER issue - bug #4401841
2990 CURSOR c_awdbdy (p_award_cd VARCHAR2) IS
2991 SELECT ihpinst.oi_govt_institution_cd govt_institution_cd
2992 FROM igs_ps_awd_own a,
2993 igs_pe_hz_parties ihpou,
2994 igs_pe_hz_parties ihpinst
2995 WHERE a.course_cd = p_course_cd
2996 AND a.version_number = p_version_number
2997 AND a.award_cd = p_award_cd
2998 AND a.org_unit_cd = ihpou.oss_org_unit_cd
2999 AND ihpou.institution_cd = ihpinst.oss_org_unit_cd
3000 GROUP BY ihpinst.oi_govt_institution_cd
3001 ORDER BY SUM(a.percentage) DESC;
3002
3003 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
3004 BEGIN
3005
3006 OPEN c_awdbdy (p_awd1);
3007 FETCH c_awdbdy INTO p_awd_body1;
3008
3009 IF p_awd2 IS NULL
3010 THEN
3011 -- Use the next record in the cursor c_awdbdy
3012 FETCH c_awdbdy INTO p_awd_body2;
3013 CLOSE c_awdbdy;
3014 ELSE
3015 IF c_awdbdy%ISOPEN
3016 THEN
3017 CLOSE c_awdbdy;
3018 END IF;
3019
3020 OPEN c_awdbdy (p_awd2);
3021 FETCH c_awdbdy INTO p_awd_body2;
3022 CLOSE c_awdbdy;
3023 END IF;
3024
3025 EXCEPTION
3026 WHEN OTHERS
3027 THEN
3028 write_to_log(SQLERRM);
3029 IF c_awdbdy%ISOPEN
3030 THEN
3031 CLOSE c_awdbdy;
3032 END IF;
3033
3034 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
3035 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_awd_body_12');
3036 IGS_GE_MSG_STACK.ADD;
3037 App_Exception.Raise_Exception;
3038 END get_awd_body_12;
3039
3040
3041
3042 PROCEDURE get_prog_length
3043 (p_spa_attendance_type IN igs_en_stdnt_ps_att.attendance_type%TYPE,
3044 p_ft_compl_time IN igs_ps_ver.std_ft_completion_time%TYPE,
3045 p_pt_compl_time IN igs_ps_ver.std_pt_completion_time%TYPE,
3046 p_length OUT NOCOPY VARCHAR2,
3047 p_units OUT NOCOPY VARCHAR2)
3048 IS
3049 /***************************************************************
3050 Created By :
3051 Date Created By :
3052 Purpose : This procedure gets the Expected Length and Units of meausrement of length
3053 Known Limitations,Enhancements or Remarks:
3054 Change History :
3055 Who When What
3056 ***************************************************************/
3057
3058 l_length NUMBER;
3059 l_year NUMBER;
3060 l_months NUMBER;
3061 l_weeks NUMBER;
3062
3063 BEGIN
3064
3065 IF p_spa_attendance_type LIKE 'F%'
3066 THEN
3067 l_length := p_ft_compl_time;
3068 ELSE
3069 l_length := p_pt_compl_time;
3070 END IF;
3071
3072 l_year := l_length / 10;
3073
3074 IF l_year = ROUND(l_year)
3075 THEN
3076 -- Its a whole number so return the year
3077 p_length := l_year;
3078 p_units := '1';
3079 ELSE
3080 l_months := l_year * 12;
3081 IF l_months = ROUND(l_months)
3082 THEN
3083 -- Months is a whole number, so return the months
3084 IF l_months < 99
3085 THEN
3086 p_length := l_months;
3087 p_units := '2';
3088 ELSE
3089 -- Return the Years
3090 p_length := ROUND(l_year);
3091 p_units := '1';
3092 END IF; -- Months less than 99
3093 ELSE
3094 l_weeks := ROUND(l_year * 52);
3095 IF l_weeks < 99
3096 THEN
3097 p_length := l_weeks;
3098 p_units := '3';
3099 ELSE
3100 p_length := ROUND(l_months);
3101 p_units := '2';
3102 END IF;
3103 END IF; -- Months is a whole number
3104 END IF;
3105
3106 EXCEPTION
3107 WHEN OTHERS
3108 THEN
3109 write_to_log (SQLERRM);
3110 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
3111 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_prog_length');
3112 IGS_GE_MSG_STACK.ADD;
3113 App_Exception.Raise_Exception;
3114 END get_prog_length;
3115
3116 PROCEDURE get_teach_train_crs_id
3117 (p_prg_ttcid IN igs_he_st_prog.teacher_train_prog_id%TYPE,
3118 p_spa_ttcid IN igs_he_st_spa.teacher_train_prog_id%TYPE,
3119 p_hesa_ttcid OUT NOCOPY VARCHAR2)
3120 IS
3121 /***************************************************************
3122 Created By :
3123 Date Created By :
3124 Purpose : This procedure gets the Teacher Training Course Identifier
3125 Known Limitations,Enhancements or Remarks:
3126 Change History :
3127 Who When What
3128 ***************************************************************/
3129
3130 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
3131
3132 BEGIN
3133 l_he_code_map_val.association_code := 'OSS_HESA_TTCID_ASSOC';
3134 l_he_code_map_val.map2 := Nvl(p_spa_ttcid, p_prg_ttcid) ;
3135
3136 IF l_he_code_map_val.map2 IS NOT NULL
3137 THEN
3138 igs_he_extract2_pkg.get_map_values
3139 (p_he_code_map_val => l_he_code_map_val,
3140 p_value_from => 'MAP1',
3141 p_return_value => p_hesa_ttcid);
3142
3143 END IF;
3144
3145 EXCEPTION
3146 WHEN OTHERS
3147 THEN
3148 write_to_log (SQLERRM);
3149 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
3150 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_teach_train_crs_id');
3151 IGS_GE_MSG_STACK.ADD;
3152 App_Exception.Raise_Exception;
3153 END get_teach_train_crs_id;
3154
3155
3156 PROCEDURE get_itt_phsc
3157 (p_prg_itt_phsc IN igs_he_st_prog.itt_phase%TYPE,
3158 p_spa_itt_phsc IN igs_he_st_spa.itt_phase%TYPE,
3159 p_hesa_itt_phsc OUT NOCOPY VARCHAR2)
3160 IS
3161 /***************************************************************
3162 Created By :
3163 Date Created By :
3164 Purpose : This procedure gets the ITT Phase / Scope
3165 Known Limitations,Enhancements or Remarks:
3166 Change History :
3167 Who When What
3168 ***************************************************************/
3169
3170 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
3171
3172 BEGIN
3173 l_he_code_map_val.association_code := 'OSS_HESA_ITTPHSC_ASSOC';
3174 l_he_code_map_val.map2 := Nvl(p_spa_itt_phsc, p_prg_itt_phsc) ;
3175
3176 IF l_he_code_map_val.map2 IS NOT NULL
3177 THEN
3178 igs_he_extract2_pkg.get_map_values
3179 (p_he_code_map_val => l_he_code_map_val,
3180 p_value_from => 'MAP1',
3181 p_return_value => p_hesa_itt_phsc);
3182
3183 END IF;
3184
3185 EXCEPTION
3186 WHEN OTHERS
3187 THEN
3188 write_to_log (SQLERRM);
3189 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
3190 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_itt_phsc');
3191 IGS_GE_MSG_STACK.ADD;
3192 App_Exception.Raise_Exception;
3193 END get_itt_phsc;
3194
3195
3196 PROCEDURE get_itt_mrker
3197 (p_prg_itt_mrker IN igs_he_st_prog.bilingual_itt_marker%TYPE,
3198 p_spa_itt_mrker IN igs_he_st_spa.bilingual_itt_marker%TYPE,
3199 p_hesa_itt_mrker OUT NOCOPY VARCHAR2)
3200 IS
3201 /***************************************************************
3202 Created By :
3203 Date Created By :
3204 Purpose : This procedure gets the Billingual ITT Marker
3205 Known Limitations,Enhancements or Remarks:
3206 Change History :
3207 Who When What
3208 ***************************************************************/
3209
3210 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
3211
3212 BEGIN
3213 l_he_code_map_val.association_code := 'OSS_HESA_BITTM_ASSOC';
3214 l_he_code_map_val.map2 := Nvl(p_spa_itt_mrker, p_prg_itt_mrker) ;
3215
3216 IF l_he_code_map_val.map2 IS NOT NULL
3217 THEN
3218 igs_he_extract2_pkg.get_map_values
3219 (p_he_code_map_val => l_he_code_map_val,
3220 p_value_from => 'MAP1',
3221 p_return_value => p_hesa_itt_mrker);
3222
3223 END IF;
3224
3225 EXCEPTION
3226 WHEN OTHERS
3227 THEN
3228 write_to_log (SQLERRM);
3229 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
3230 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_itt_mrker');
3231 IGS_GE_MSG_STACK.ADD;
3232 App_Exception.Raise_Exception;
3233 END get_itt_mrker;
3234
3235
3236
3237 PROCEDURE get_teach_qual_sect
3238 (p_oss_teach_qual_sect IN igs_he_st_prog.teaching_qual_sought_sector%TYPE,
3239 p_hesa_teach_qual_sect OUT NOCOPY VARCHAR2)
3240 IS
3241 /***************************************************************
3242 Created By :
3243 Date Created By :
3244 Purpose : This procedure gets the Teaching Qualification Sought Sector and Teaching Qualification Gained Sector
3245 Known Limitations,Enhancements or Remarks:
3246 Change History :
3247 Who When What
3248 ***************************************************************/
3249
3250 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
3251
3252 BEGIN
3253 l_he_code_map_val.association_code := 'OSS_HESA_TQSEC_ASSOC';
3254 l_he_code_map_val.map2 := p_oss_teach_qual_sect;
3255
3256 IF l_he_code_map_val.map2 IS NOT NULL
3257 THEN
3258 igs_he_extract2_pkg.get_map_values
3259 (p_he_code_map_val => l_he_code_map_val,
3260 p_value_from => 'MAP1',
3261 p_return_value => p_hesa_teach_qual_sect);
3262
3263 END IF;
3264
3265 EXCEPTION
3266 WHEN OTHERS
3267 THEN
3268 write_to_log (SQLERRM);
3269 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
3270 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_teach_qual_sect');
3271 IGS_GE_MSG_STACK.ADD;
3272 App_Exception.Raise_Exception;
3273 END get_teach_qual_sect;
3274
3275
3276
3277 PROCEDURE get_teach_qual_sbj
3278 (p_oss_teach_qual_sbj IN igs_he_st_prog.teaching_qual_sought_subj1%TYPE,
3279 p_hesa_teach_qual_sbj OUT NOCOPY VARCHAR2)
3280 IS
3281 /***************************************************************
3282 Created By :
3283 Date Created By :
3284 Purpose : This procedure gets the Teaching Qualification Sought Subject and Teaching Qualification Gained Subject
3285 Known Limitations,Enhancements or Remarks:
3286 Change History :
3287 Who When What
3288 ***************************************************************/
3289
3290 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
3291
3292 BEGIN
3293 l_he_code_map_val.association_code := 'OSS_HESA_TQSUB123_ASSOC';
3294 l_he_code_map_val.map2 := p_oss_teach_qual_sbj;
3295
3296 IF l_he_code_map_val.map2 IS NOT NULL
3297 THEN
3298 igs_he_extract2_pkg.get_map_values
3299 (p_he_code_map_val => l_he_code_map_val,
3300 p_value_from => 'MAP1',
3301 p_return_value => p_hesa_teach_qual_sbj);
3302
3303 END IF;
3304
3305 EXCEPTION
3306 WHEN OTHERS
3307 THEN
3308 write_to_log (SQLERRM);
3309 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
3310 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_teach_qual_sbj');
3311 IGS_GE_MSG_STACK.ADD;
3312 App_Exception.Raise_Exception;
3313 END get_teach_qual_sbj;
3314
3315
3316 PROCEDURE get_fee_elig
3317 (p_person_id IN igs_pe_person.person_id%TYPE,
3318 p_susa_fee_elig IN igs_he_en_susa.fee_eligibility%TYPE,
3319 p_fe_stdnt_mrker IN igs_he_st_spa.fe_student_marker%TYPE,
3320 p_study_mode IN VARCHAR2,
3321 p_special_student IN VARCHAR2,
3322 p_hesa_fee_elig OUT NOCOPY VARCHAR2,
3323 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
3324 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE)
3325
3326 IS
3327 /***************************************************************
3328 Created By :
3329 Date Created By :
3330 Purpose : This procedure gets the Fee Eligibility
3331 Known Limitations,Enhancements or Remarks:
3332 Change History :
3333 Who When What
3334 smaddali 11-dec-03 Modified for bug#3235753 , added 2 new parameters
3335 anwest 09-Dec-03 Modified for HE356 - updated to accommodate
3336 Term/Load calendar associated with residency
3337 jtmathew 23-May-06 Modified c_res_sts for bug 5210481
3338 ***************************************************************/
3339
3340 -- smaddali modified this cursor for bug 2367167 to get records which are effective in the HESA submission period, bug#3235753
3341 -- anwest modified this cursor for HE356 to accommodate Term/Load Calendar for Residency Status
3342 -- jtmathew modified this cursor for bug 5210481 to remove igs_pe_res_dtls_v view
3343 CURSOR c_res_sts (cp_res_class_cd VARCHAR2) IS
3344 SELECT peresdtls.residency_status_cd residency_status
3345 FROM igs_pe_res_dtls_all peresdtls,
3346 igs_lookup_values cc1,
3347 igs_lookup_values cc2,
3348 igs_ca_inst_all cainstall
3349 WHERE peresdtls.person_id = p_person_id
3350 AND peresdtls.residency_class_cd = cc1.lookup_code
3351 AND cc1.lookup_type = 'PE_RES_CLASS'
3352 AND peresdtls.residency_status_cd = cc2.lookup_code
3353 AND cc2.lookup_type = 'PE_RES_STATUS'
3354 AND peresdtls.residency_class_cd = cp_res_class_cd
3355 AND peresdtls.cal_type = cainstall.cal_type
3356 AND peresdtls.sequence_number = cainstall.sequence_number
3357 AND cainstall.start_dt <= p_enrl_end_dt
3358 ORDER BY cainstall.start_dt DESC;
3359
3360 l_residency_status igs_pe_res_dtls_v.residency_status%TYPE;
3361 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
3362 l_oss_fee_elig igs_he_code_map_val.map1%TYPE;
3363 l_res_class_cd igs_pe_res_dtls_v.residency_class%TYPE;
3364
3365 BEGIN
3366
3367 IF p_susa_fee_elig IS NOT NULL
3368 THEN
3369 l_oss_fee_elig := p_susa_fee_elig;
3370 ELSE
3371 -- Get the Fee Eligibility using special student code.
3372 l_he_code_map_val.association_code := 'OSS_SPCSTU_FEEELIG_ASSOC';
3373 l_he_code_map_val.map2 := p_special_student;
3374
3375 IF l_he_code_map_val.map2 IS NOT NULL
3376 THEN
3377 igs_he_extract2_pkg.get_map_values
3378 (p_he_code_map_val => l_he_code_map_val,
3379 p_value_from => 'MAP1',
3380 p_return_value => l_oss_fee_elig);
3381
3382 END IF;
3383 END IF;
3384
3385 IF l_oss_fee_elig IS NULL
3386 THEN
3387 -- Try getting it using FE Student Marker
3388 l_he_code_map_val.association_code := 'OSS_FESTUMK_FEEELIG_ASSOC';
3389 l_he_code_map_val.map2 := p_fe_stdnt_mrker;
3390
3391 IF l_he_code_map_val.map2 IS NOT NULL
3392 THEN
3393 igs_he_extract2_pkg.get_map_values
3394 (p_he_code_map_val => l_he_code_map_val,
3395 p_value_from => 'MAP1',
3396 p_return_value => l_oss_fee_elig);
3397
3398 END IF;
3399 END IF;
3400
3401 IF l_oss_fee_elig IS NULL
3402 THEN
3403 -- Try getting it using Study Location
3404 l_he_code_map_val.association_code := 'OSS_MODE_FEEELIG_ASSOC';
3405 l_he_code_map_val.map2 := p_study_mode;
3406
3407 IF l_he_code_map_val.map2 IS NOT NULL
3408 THEN
3409 igs_he_extract2_pkg.get_map_values
3410 (p_he_code_map_val => l_he_code_map_val,
3411 p_value_from => 'MAP1',
3412 p_return_value => l_oss_fee_elig);
3413
3414 END IF;
3415 END IF;
3416
3417 IF l_oss_fee_elig IS NULL
3418 THEN
3419 -- Try getting it using residency Status / Fee Category
3420 Fnd_Profile.Get('IGS_FI_RES_CLASS_ID', l_res_class_cd);
3421
3422 -- anwest HE356 - If residency statuses are returned get the mapped
3423 -- value of the first record
3424 OPEN c_res_sts (l_res_class_cd);
3425 FETCH c_res_sts INTO l_residency_status;
3426 IF c_res_sts%NOTFOUND THEN
3427 CLOSE c_res_sts;
3428 ELSE
3429 CLOSE c_res_sts;
3430 l_he_code_map_val.association_code := 'OSS_FEECAT_FEEELIG_ASSOC';
3431 l_he_code_map_val.map2 := l_residency_status;
3432 igs_he_extract2_pkg.get_map_values
3433 (p_he_code_map_val => l_he_code_map_val,
3434 p_value_from => 'MAP1',
3435 p_return_value => l_oss_fee_elig);
3436 END IF;
3437 END IF;
3438
3439 IF l_oss_fee_elig IS NOT NULL
3440 THEN
3441 -- We have a value, get the HESA equivalent
3442
3443 l_he_code_map_val.association_code := 'OSS_HESA_FEEELIG_ASSOC';
3444 l_he_code_map_val.map2 := l_oss_fee_elig;
3445
3446 igs_he_extract2_pkg.get_map_values
3447 (p_he_code_map_val => l_he_code_map_val,
3448 p_value_from => 'MAP1',
3449 p_return_value => p_hesa_fee_elig);
3450
3451 END IF;
3452
3453
3454 EXCEPTION
3455 WHEN OTHERS
3456 THEN
3457 write_to_log (SQLERRM);
3458 IF c_res_sts%ISOPEN
3459 THEN
3460 CLOSE c_res_sts;
3461 END IF;
3462
3463 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
3464 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_fee_elig');
3465 IGS_GE_MSG_STACK.ADD;
3466 App_Exception.Raise_Exception;
3467 END get_fee_elig;
3468
3469
3470
3471 PROCEDURE get_fee_band
3472 (p_hesa_fee_elig IN igs_he_en_susa.fee_eligibility%TYPE,
3473 p_susa_fee_band IN igs_he_en_susa.fee_band%TYPE,
3474 p_poous_fee_band IN igs_he_poous.fee_band%TYPE,
3475 p_prg_fee_band IN igs_he_st_prog.fee_band%TYPE,
3476 p_hesa_fee_band OUT NOCOPY VARCHAR2)
3477 IS
3478 /***************************************************************
3479 Created By :
3480 Date Created By :
3481 Purpose : This procedure gets the Fee Band
3482 Known Limitations,Enhancements or Remarks:
3483 Change History :
3484 Who When What
3485 jtmathew 25-Jan-2006 Modifications for bug 4416467
3486 ***************************************************************/
3487
3488 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
3489
3490 BEGIN
3491
3492 IF p_hesa_fee_elig = '2' THEN
3493 -- for all overseas students
3494 p_hesa_fee_band := '99';
3495
3496 ELSE
3497
3498 l_he_code_map_val.association_code := 'OSS_HESA_FEEBAND_ASSOC';
3499 l_he_code_map_val.map2 := Nvl(Nvl(p_susa_fee_band,
3500 p_poous_fee_band),
3501 p_prg_fee_band) ;
3502
3503 IF l_he_code_map_val.map2 IS NOT NULL
3504 THEN
3505 igs_he_extract2_pkg.get_map_values
3506 (p_he_code_map_val => l_he_code_map_val,
3507 p_value_from => 'MAP1',
3508 p_return_value => p_hesa_fee_band);
3509
3510 END IF;
3511
3512 END IF;
3513
3514 EXCEPTION
3515 WHEN OTHERS
3516 THEN
3517 write_to_log (SQLERRM);
3518 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
3519 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_fee_band');
3520 IGS_GE_MSG_STACK.ADD;
3521 App_Exception.Raise_Exception;
3522 END get_fee_band;
3523
3524
3525 PROCEDURE get_amt_tuition_fees
3526 (p_person_id IN igs_pe_person.person_id%TYPE,
3527 p_course_cd IN igs_he_st_spa.course_cd%TYPE,
3528 p_cal_type IN igs_en_stdnt_ps_att.cal_type%TYPE,
3529 p_fe_prg_mrker IN igs_he_st_prog.fe_program_marker%TYPE,
3530 p_fe_stdnt_mrker IN igs_he_st_spa.fe_student_marker%TYPE,
3531 p_oss_amt OUT NOCOPY NUMBER,
3532 p_hesa_amt OUT NOCOPY VARCHAR2,
3533 p_enrl_start_dt IN DATE,
3534 p_enrl_end_dt IN DATE)
3535
3536 IS
3537 /***************************************************************
3538 Created By :
3539 Date Created By :
3540 Purpose : This procedure gets Amount of tuition Fees
3541 Known Limitations,Enhancements or Remarks:
3542 Change History :
3543 Who When What
3544 smaddali Modified this procedure for bug 2716038
3545 dsridhar 10-Sep-03 Bug No: 2911678. Modified the cursor c_fees by replacing the
3546 view igs_fi_fee_ass_debt_v with the view igs_fi_fee_as. This is done
3547 as the view igs_fi_fee_ass_debt_v has performance issues and is being
3548 obsoleted.
3549 smaddali 13-Oct-03 Modified procedure to add 2 new parameters and modified cursor c_fees for bug# 3179544
3550 jtmathew 04-Jul-06 Modifications for bug 5283519. Modified procedure to run for all students,
3551 and also sets tuition fees to zero if c_fees returns NULL
3552 ***************************************************************/
3553
3554 -- smaddali modified this cursor to remove the obsoleted table igs_fi_chg_mth_app reference
3555 -- as part of bug 2421778
3556 -- Bug No: 2911678. Replacing the view igs_fi_fee_ass_debt_v with the view igs_fi_fee_as.
3557 -- smaddali modified this cursor for bug#3179544 , filtering based on Submission periods
3558 CURSOR c_fees IS
3559 SELECT SUM(chg.transaction_amount) tuition_fees
3560 FROM igs_fi_fee_type ft, igs_fi_fee_as chg
3561 WHERE ft.s_fee_type = 'TUTNFEE'
3562 AND chg.person_id = p_person_id
3563 AND (chg.course_cd IS NULL OR chg.course_cd = p_course_cd)
3564 AND chg.fee_type = ft.fee_type
3565 AND (chg.effective_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt);
3566
3567 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
3568 l_tuition_fees NUMBER;
3569
3570 l_hesa_feprmk igs_he_code_map_val.map1%TYPE := NULL;
3571
3572 BEGIN
3573
3574 OPEN c_fees;
3575 FETCH c_fees INTO l_tuition_fees;
3576 CLOSE c_fees;
3577 p_oss_amt := l_tuition_fees;
3578
3579 IF p_fe_prg_mrker IS NOT NULL
3580 THEN
3581 -- Get the HESA equivalent value for oss_feprmk ,
3582 -- smaddali added this conversion for bug 2716038
3583 l_he_code_map_val.association_code := 'OSS_HESA_FEPRMK_ASSOC';
3584 l_he_code_map_val.map2 := p_fe_prg_mrker;
3585 igs_he_extract2_pkg.get_map_values
3586 (p_he_code_map_val => l_he_code_map_val,
3587 p_value_from => 'MAP1',
3588 p_return_value => l_hesa_feprmk);
3589
3590 END IF;
3591
3592 IF l_tuition_fees IS NULL THEN
3593 l_tuition_fees := 0;
3594 p_oss_amt := 0;
3595 END IF;
3596
3597 IF l_hesa_feprmk IN ('A','W') THEN
3598 p_hesa_amt := l_hesa_feprmk ||LPAD(l_tuition_fees,5,0);
3599 END IF;
3600
3601 EXCEPTION
3602 WHEN OTHERS
3603 THEN
3604 write_to_log (SQLERRM);
3605 IF c_fees%ISOPEN
3606 THEN
3607 CLOSE c_fees;
3608 END IF;
3609
3610 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
3611 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_amt_tuition_fees');
3612 IGS_GE_MSG_STACK.ADD;
3613 App_Exception.Raise_Exception;
3614 END get_amt_tuition_fees;
3615
3616
3617 PROCEDURE get_maj_src_tu_fee
3618 (p_person_id IN igs_pe_person.person_id%TYPE,
3619 p_enrl_start_dt IN DATE,
3620 p_enrl_end_dt IN DATE,
3621 p_special_stdnt IN VARCHAR2,
3622 p_study_mode IN VARCHAR2,
3623 p_amt_tu_fee IN NUMBER,
3624 p_susa_mstufee IN igs_he_en_susa.student_fee%TYPE,
3625 p_hesa_mstufee OUT NOCOPY VARCHAR2)
3626 IS
3627 /***************************************************************
3628 Created By :
3629 Date Created By :
3630 Purpose : This procedure gets Major Source of Tuition Fees
3631 Known Limitations,Enhancements or Remarks:
3632 Change History :
3633 Who When What
3634 rbezawad 08-Apr-03 Modified w.r.t. HECR009 Build - MSTUFEE derivation, Bug 2881348.
3635 rbezawad 24-Jun-03 Modified for Bug 2961802 - Back porting MNT bug fixes(2958935, 2958973)
3636 1) Add the Closed Indicator check in cursors cur_slc_spnsr
3637 and cur_slc_ld_cal when SLC code is retrived from Hesa Code Type: OSS_SLC_SPONSOR.
3638 2) Modified procedure get_maj_src_tu_fee to handle the senario when Student who sponsored
3639 by SLC don't have any SLC LEA Code defined.
3640 smaddali 11-dec-03 Modified for bug#3235753 , added 2 new parameters
3641 ayedubat 14-Jan-04 Modified the cursor, cur_spnsr to add a new condition
3642 award_status IN ('ACCEPTED','OFFERED') for bug, 2911746
3643 sjlaport 31-Jan-05 Modified cursor cur_slc_lea_cd for HE358 to ignore logically deleted records
3644 jchakrab 02-Feb-06 Modified logic such that a value 98 is derived when tution fee amount=0
3645 ***************************************************************/
3646
3647 --Query to get all Sponsor records for student within the given HESA reporting period.
3648 CURSOR cur_spnsr IS
3649 SELECT SUM (a.disb_net_amt) sponsor_amount,
3650 d.map1 sponsor
3651 FROM igf_aw_awd_disb a,
3652 igf_aw_award b,
3653 igf_aw_fund_mast fmast,
3654 igf_ap_fa_base_rec c,
3655 igs_he_code_map_val d,
3656 igs_ca_inst ca
3657 WHERE a.award_id = b.award_id
3658 AND b.fund_id = fmast.fund_id
3659 AND b.base_id = c.base_id
3660 AND a.ld_cal_type = ca.cal_type
3661 AND a.ld_sequence_number = ca.sequence_number
3662 AND d.association_code = 'OSS_SPONSOR_MSTUFEE_ASSOC'
3663 AND d.map2 = fmast.fund_code
3664 AND c.person_id = p_person_id
3665 AND a.fee_class = 'TUITION'
3666 AND a.trans_type IN ('A' , 'P')
3667 AND b.award_status IN ('ACCEPTED','OFFERED')
3668 AND ca.start_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt
3669 GROUP BY d.map1
3670 ORDER BY sponsor_amount DESC, sponsor ASC;
3671
3672 l_spnsr_rec cur_spnsr%ROWTYPE ;
3673
3674 --Query to get the fund amount sponsored by the SLC.
3675 CURSOR cur_slc_spnsr IS
3676 SELECT SUM (a.disb_net_amt) sponsor_amount,
3677 fmast.fund_code
3678 FROM igf_aw_awd_disb a,
3679 igf_aw_award b,
3680 igf_aw_fund_mast fmast,
3681 igf_ap_fa_base_rec c,
3682 igs_he_code_values d,
3683 igs_ca_inst ca
3684 WHERE a.award_id = b.award_id
3685 AND b.fund_id = fmast.fund_id
3686 AND b.base_id = c.base_id
3687 AND a.ld_cal_type = ca.cal_type
3688 AND a.ld_sequence_number = ca.sequence_number
3689 AND d.code_type = 'OSS_SLC_SPONSOR'
3690 AND d.value = fmast.fund_code
3691 AND NVL(d.closed_ind, 'N') = 'N'
3692 AND c.person_id = p_person_id
3693 AND a.fee_class = 'TUITION'
3694 AND a.trans_type IN ('A' , 'P')
3695 AND ca.start_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt
3696 GROUP BY fmast.fund_code;
3697
3698 l_slc_spnsr_rec cur_slc_spnsr%ROWTYPE;
3699
3700 -- Get the SLC LEA Code
3701 -- smaddali modified this cursor to get records which are effective in the HESA submission period, bug#3235753
3702 CURSOR cur_slc_lea_cd IS
3703 SELECT SUBSTR (api.api_person_id,1,4)
3704 FROM igs_pe_alt_pers_id_v api,
3705 igs_pe_person_id_typ pit
3706 WHERE api.person_id_type = pit.Person_id_type
3707 AND pit.s_person_id_type = 'SLC'
3708 AND api.pe_person_id = p_person_id
3709 AND NVL (api.start_dt, p_enrl_end_dt ) <= p_enrl_end_dt
3710 AND NVL (api.end_dt, p_enrl_start_dt ) >= p_enrl_start_dt
3711 AND (api.end_dt IS NULL OR api.start_dt <> api.end_dt)
3712 ORDER BY api.start_dt DESC;
3713
3714 --Query to get Load Calendars of SLC sponsored fund
3715 CURSOR cur_slc_ld_cal IS
3716 SELECT DISTINCT a.ld_cal_type, a.ld_sequence_number
3717 FROM igf_aw_awd_disb a,
3718 igf_aw_award b,
3719 igf_aw_fund_mast fmast,
3720 igf_ap_fa_base_rec c,
3721 igs_he_code_values d,
3722 igs_ca_inst ca
3723 WHERE a.award_id = b.award_id
3724 AND b.fund_id = fmast.fund_id
3725 AND b.base_id = c.base_id
3726 AND a.ld_cal_type = ca.cal_type
3727 AND a.ld_sequence_number = ca.sequence_number
3728 AND d.code_type = 'OSS_SLC_SPONSOR'
3729 AND d.value = fmast.fund_code
3730 AND NVL(d.closed_ind, 'N') = 'N'
3731 AND c.person_id = p_person_id
3732 AND a.fee_class = 'TUITION'
3733 AND a.trans_type IN ('A' , 'P')
3734 AND ca.start_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt;
3735
3736 --Query to get the Invoice amount for the student tution fees
3737 CURSOR cur_inv_amt (cp_fee_cal_type igs_ca_inst.cal_type%TYPE,
3738 cp_fee_ci_sequence_number igs_ca_inst.sequence_number%TYPE)
3739 IS
3740 SELECT NVL(SUM(inv.invoice_amount),0) invoice_amount
3741 FROM igs_fi_inv_int inv,
3742 igs_fi_fee_type ft
3743 WHERE inv.fee_type = ft.fee_type
3744 AND person_id = p_person_id
3745 AND inv.fee_cal_type = cp_fee_cal_type
3746 AND inv.fee_ci_sequence_number = cp_fee_ci_sequence_number
3747 AND ft.s_fee_type = 'TUTNFEE';
3748
3749 l_value igs_he_ex_rn_dat_fd.value%TYPE;
3750 l_slc_lea_cd igs_pe_alt_pers_id.api_person_id%TYPE;
3751 l_he_code_map_val igs_he_code_map_val%ROWTYPE;
3752 l_invoice_amt igs_fi_inv_int.invoice_amount%TYPE;
3753 l_tot_invoice_amt igs_fi_inv_int.invoice_amount%TYPE;
3754 l_message_name fnd_new_messages.message_name%TYPE;
3755 l_fee_cal_type igs_ca_inst.cal_type%TYPE;
3756 l_fee_ci_sequence_number igs_ca_inst.sequence_number%TYPE;
3757
3758 BEGIN
3759
3760 l_value := NULL;
3761 l_he_code_map_val := NULL;
3762
3763 IF p_susa_mstufee IS NOT NULL THEN
3764 -- Get the HESA equivalent value for SUSA MSTUFEE
3765 l_he_code_map_val.association_code := 'OSS_HESA_MSTUFEE_ASSOC';
3766 l_he_code_map_val.map2 := p_susa_mstufee;
3767
3768 igs_he_extract2_pkg.get_map_values
3769 (p_he_code_map_val => l_he_code_map_val,
3770 p_value_from => 'MAP1',
3771 p_return_value => p_hesa_mstufee);
3772
3773 ELSE
3774
3775 IF p_special_stdnt IS NOT NULL THEN
3776 -- Get the HESA equivalent value Special Student
3777 l_he_code_map_val.association_code := 'HESA_SPCSTU_MSTUFEE_ASSOC';
3778 l_he_code_map_val.map2 := p_special_stdnt;
3779 igs_he_extract2_pkg.get_map_values
3780 (p_he_code_map_val => l_he_code_map_val,
3781 p_value_from => 'MAP1',
3782 p_return_value => l_value);
3783 END IF;
3784
3785 --Check if MSTUFEE is available at Special Student Level
3786 IF l_value IS NOT NULL THEN
3787 p_hesa_mstufee := l_value;
3788 ELSE
3789
3790 IF p_study_mode IS NOT NULL THEN
3791 -- Get the HESA equivalent value for Special Student
3792 l_he_code_map_val.association_code := 'HESA_MODE_MSTUFEE_ASSOC';
3793 l_he_code_map_val.map2 := p_study_mode;
3794 igs_he_extract2_pkg.get_map_values
3795 (p_he_code_map_val => l_he_code_map_val,
3796 p_value_from => 'MAP1',
3797 p_return_value => l_value);
3798
3799 END IF;
3800
3801 --Check if MSTUFEE is available at Mode of Study Level
3802 IF l_value IS NOT NULL THEN
3803 p_hesa_mstufee := l_value;
3804 ELSE
3805 --jchakrab added for 4873515
3806 IF p_amt_tu_fee = 0 THEN
3807 p_hesa_mstufee := '98';
3808 ELSE
3809
3810 -- Get the Sponsor information
3811 OPEN cur_spnsr ;
3812 FETCH cur_spnsr INTO l_spnsr_rec ;
3813
3814 --If there are no Sponsor records available
3815 IF cur_spnsr%NOTFOUND THEN
3816 CLOSE cur_spnsr;
3817 p_hesa_mstufee := '01';
3818 ELSE
3819 --When Sponsor records are available
3820 CLOSE cur_spnsr;
3821
3822 --Get the SLC sponsor record information
3823 OPEN cur_slc_spnsr;
3824 FETCH cur_slc_spnsr INTO l_slc_spnsr_rec;
3825
3826 --If SLC Sponsor record exists.
3827 IF cur_slc_spnsr%FOUND THEN
3828
3829 CLOSE cur_slc_spnsr;
3830 --Get the SLC LEA Code i.e., First 4 characters of the SLC Student Identifier, which is Alternate Person ID with System Type "SLC".
3831 OPEN cur_slc_lea_cd;
3832 FETCH cur_slc_lea_cd INTO l_slc_lea_cd;
3833
3834 IF l_slc_lea_cd IS NOT NULL THEN
3835 -- Get the HESA equivalent value for SLC LEA Code
3836 l_he_code_map_val.association_code := 'OSS_HESA_SLCID_MSTUFEE_ASSOC';
3837 l_he_code_map_val.map2 := l_slc_lea_cd;
3838 igs_he_extract2_pkg.get_map_values
3839 (p_he_code_map_val => l_he_code_map_val,
3840 p_value_from => 'MAP1',
3841 p_return_value => l_value);
3842 END IF;
3843 CLOSE cur_slc_lea_cd;
3844
3845 l_tot_invoice_amt := 0;
3846 --To Calculate the total Invoice Amount.
3847 FOR l_slc_ld_cal_rec IN cur_slc_ld_cal
3848 LOOP
3849 --Derive the related Fee Calendar Instance for the passed Load Calendar Instance by using Student Finance API
3850 IF igs_fi_gen_001.finp_get_lfci_reln( p_cal_type => l_slc_ld_cal_rec.ld_cal_type,
3851 p_ci_sequence_number => l_slc_ld_cal_rec.ld_sequence_number,
3852 p_cal_category => 'LOAD',
3853 p_ret_cal_type => l_fee_cal_type,
3854 p_ret_ci_sequence_number => l_fee_ci_sequence_number,
3855 p_message_name => l_message_name ) THEN
3856 l_invoice_amt := 0;
3857
3858 --To get the invoice amount charged for the Tution Fee in the given Fee Calendar.
3859 OPEN cur_inv_amt(l_fee_cal_type, l_fee_ci_sequence_number);
3860 FETCH cur_inv_amt INTO l_invoice_amt;
3861
3862 --Sum the amount to get the total Invoice amount charged for Tution Fee.
3863 l_tot_invoice_amt := l_tot_invoice_amt + l_invoice_amt;
3864
3865 CLOSE cur_inv_amt;
3866 END IF;
3867 END LOOP;
3868
3869 --Check if SLC pays full Tution Fee or not.
3870 IF l_slc_spnsr_rec.sponsor_amount = l_tot_invoice_amt THEN
3871 p_hesa_mstufee := l_value;
3872 ELSIF l_value = '02' THEN
3873 p_hesa_mstufee := '52';
3874 ELSIF l_value = '03' THEN
3875 p_hesa_mstufee := '53';
3876 ELSIF l_value = '04' THEN
3877 p_hesa_mstufee := '54';
3878 END IF;
3879
3880 ELSE
3881 --When Sponsors other than SLC exists.
3882 CLOSE cur_slc_spnsr;
3883 p_hesa_mstufee := l_spnsr_rec.sponsor;
3884
3885 END IF; --End of Check for SLC sponsor record exits. i.e., it pays tutuion fee or not
3886
3887 END IF ; -- End of Check for Sponsor Records of Student
3888
3889 END IF; -- End of check for tuition-fees = 0
3890
3891 END IF; -- End of Check for MSTUFEE at Mode of Study
3892
3893 END IF; -- End of Check for MSTUFEE at Special Student
3894
3895 END IF; -- End of check for SUSA Major Source of Tuition Fee is null.
3896
3897 EXCEPTION
3898 WHEN OTHERS THEN
3899 write_to_log (SQLERRM);
3900 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
3901 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.GET_MAJ_SRC_TU_FEE - '||SQLERRM);
3902 IGS_GE_MSG_STACK.ADD;
3903 App_Exception.Raise_Exception;
3904 END get_maj_src_tu_fee;
3905
3906
3907
3908 PROCEDURE get_religion
3909 (p_oss_religion IN igs_pe_stat_v.religion%TYPE,
3910 p_hesa_religion OUT NOCOPY VARCHAR2)
3911 IS
3912 /***************************************************************
3913 Created By :
3914 Date Created By :
3915 Purpose : This procedure gets the Religion
3916 Known Limitations,Enhancements or Remarks:
3917 Change History :
3918 Who When What
3919 ***************************************************************/
3920
3921 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
3922
3923 BEGIN
3924 l_he_code_map_val.association_code := 'OSS_HESA_RELIG_ASSOC';
3925 l_he_code_map_val.map2 := p_oss_religion;
3926
3927 IF l_he_code_map_val.map2 IS NOT NULL
3928 THEN
3929 igs_he_extract2_pkg.get_map_values
3930 (p_he_code_map_val => l_he_code_map_val,
3931 p_value_from => 'MAP1',
3932 p_return_value => p_hesa_religion);
3933
3934 END IF;
3935
3936 EXCEPTION
3937 WHEN OTHERS
3938 THEN
3939 write_to_log (SQLERRM);
3940 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
3941 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_religion');
3942 IGS_GE_MSG_STACK.ADD;
3943 App_Exception.Raise_Exception;
3944 END get_religion;
3945
3946
3947
3948 PROCEDURE get_sldd_disc_prv
3949 (p_oss_sldd_disc_prv IN igs_he_en_susa.sldd_discrete_prov%TYPE,
3950 p_fe_stdnt_mrker IN igs_he_st_spa.fe_student_marker%TYPE,
3951 p_hesa_sldd_disc_prv OUT NOCOPY VARCHAR2)
3952 IS
3953 /***************************************************************
3954 Created By :
3955 Date Created By :
3956 Purpose : This procedure gets the SLDD Discrete Provision
3957 Known Limitations,Enhancements or Remarks:
3958 Change History :
3959 Who When What
3960 ***************************************************************/
3961
3962 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
3963
3964 BEGIN
3965 IF p_fe_stdnt_mrker IN ('1','3','4')
3966 AND p_oss_sldd_disc_prv IS NOT NULL
3967 THEN
3968 l_he_code_map_val.association_code := 'OSS_HESA_ST13_ASSOC';
3969 l_he_code_map_val.map2 := p_oss_sldd_disc_prv;
3970
3971 igs_he_extract2_pkg.get_map_values
3972 (p_he_code_map_val => l_he_code_map_val,
3973 p_value_from => 'MAP1',
3974 p_return_value => p_hesa_sldd_disc_prv);
3975
3976 END IF;
3977
3978 EXCEPTION
3979 WHEN OTHERS
3980 THEN
3981 write_to_log (SQLERRM);
3982 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
3983 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_sldd_disc_prv');
3984 IGS_GE_MSG_STACK.ADD;
3985 App_Exception.Raise_Exception;
3986 END get_sldd_disc_prv;
3987
3988
3989
3990 PROCEDURE get_non_payment_rsn
3991 (p_oss_non_payment_rsn IN igs_he_en_susa.non_payment_reason%TYPE,
3992 p_fe_stdnt_mrker IN igs_he_st_spa.fe_student_marker%TYPE,
3993 p_hesa_non_payment_rsn OUT NOCOPY VARCHAR2)
3994 IS
3995 /***************************************************************
3996 Created By :
3997 Date Created By :
3998 Purpose : This procedure gets the Non Payment Reason
3999 Known Limitations,Enhancements or Remarks:
4000 Change History :
4001 Who When What
4002 ***************************************************************/
4003
4004 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
4005
4006 BEGIN
4007 l_he_code_map_val.association_code := 'OSS_HESA_NONPAY_ASSOC';
4008 l_he_code_map_val.map2 := p_oss_non_payment_rsn;
4009 IF p_fe_stdnt_mrker IN ('1','3','4') THEN
4010 IF l_he_code_map_val.map2 IS NOT NULL
4011 THEN
4012 igs_he_extract2_pkg.get_map_values
4013 (p_he_code_map_val => l_he_code_map_val,
4014 p_value_from => 'MAP1',
4015 p_return_value => p_hesa_non_payment_rsn);
4016
4017 END IF;
4018
4019 END IF;
4020
4021 EXCEPTION
4022 WHEN OTHERS
4023 THEN
4024 write_to_log (SQLERRM);
4025 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
4026 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_non_payment_rsn');
4027 IGS_GE_MSG_STACK.ADD;
4028 App_Exception.Raise_Exception;
4029 END get_non_payment_rsn;
4030
4031
4032 PROCEDURE get_oth_teach_inst
4033 (p_person_id IN igs_pe_person.person_id%TYPE,
4034 p_course_cd IN igs_he_st_spa.course_cd%TYPE,
4035 p_program_calc IN igs_he_st_prog.program_calc%TYPE,
4036 p_susa_inst1 IN igs_he_en_susa.teaching_inst1%TYPE,
4037 p_poous_inst1 IN igs_he_poous.other_instit_teach1%TYPE,
4038 p_prog_inst1 IN igs_he_st_prog.other_inst_prov_teaching1%TYPE,
4039 p_susa_inst2 IN igs_he_en_susa.teaching_inst1%TYPE,
4040 p_poous_inst2 IN igs_he_poous.other_instit_teach1%TYPE,
4041 p_prog_inst2 IN igs_he_st_prog.other_inst_prov_teaching1%TYPE,
4042 p_hesa_inst1 OUT NOCOPY VARCHAR2,
4043 p_hesa_inst2 OUT NOCOPY VARCHAR2,
4044 p_enrl_start_dt IN DATE,
4045 p_enrl_end_dt IN DATE)
4046
4047 IS
4048 /***************************************************************
4049 Created By :
4050 Date Created By :
4051 Purpose : This procedure gets Other Institution Providing Teaching 1 and 2
4052 Known Limitations,Enhancements or Remarks:
4053 Change History :
4054 Who When What
4055 anwest 09-Jun-04 Changes for bug #4401841
4056 jbaber 19-Jan-2006 Exclude flagged units for HE305 - Extract Improvements
4057 ***************************************************************/
4058
4059 -- anwest 09-Jun-05
4060 -- updated cursor for HZ_PARTIES.PARTY_NUMBER issue - bug #4401841
4061 CURSOR c_inst (p_inst_cd VARCHAR2) IS
4062 SELECT ihp.oi_govt_institution_cd govt_institution_cd
4063 FROM igs_pe_hz_parties ihp
4064 WHERE ihp.oss_org_unit_cd = p_inst_cd;
4065
4066 CURSOR c_un_inst IS
4067 SELECT ihpinst.oi_govt_institution_cd govt_institution_cd
4068 FROM igs_en_su_attempt a,
4069 igs_ps_tch_resp b,
4070 igs_pe_hz_parties ihpou,
4071 igs_pe_hz_parties ihpinst,
4072 igs_he_st_unt_vs_all hunt
4073 WHERE a.course_cd = p_course_cd
4074 AND a.person_id = p_person_id
4075 AND b.unit_cd = a.unit_cd
4076 AND b.version_number = a.version_number
4077 AND a.unit_cd = hunt.unit_cd (+)
4078 AND a.version_number = hunt.version_number (+)
4079 AND NVL(hunt.exclude_flag, 'N') = 'N'
4080 AND a.unit_attempt_status IN ('ENROLLED','DISCONTIN','COMPLETED')
4081 AND a.ci_start_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt
4082 AND b.org_unit_cd = ihpou.oss_org_unit_cd
4083 AND ihpou.institution_cd = ihpinst.oss_org_unit_cd
4084 AND NVL(ihpinst.oi_local_institution_ind,'N') = 'N'
4085 ORDER BY b.percentage DESC;
4086
4087 l_un_inst c_un_inst%ROWTYPE := NULL ;
4088 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
4089 l_oss_inst VARCHAR2(30);
4090
4091 BEGIN
4092
4093 IF p_program_calc = 'Y'
4094 THEN
4095 -- Program Based Calculations
4096 -- Get HESA value for Institute 1
4097 l_oss_inst := Nvl(Nvl(p_susa_inst1, p_poous_inst1), p_prog_inst1);
4098 OPEN c_inst (l_oss_inst);
4099 FETCH c_inst INTO p_hesa_inst1;
4100 CLOSE c_inst;
4101
4102 -- Get HESA value for Institute 2
4103 l_oss_inst := NULL;
4104 l_oss_inst := Nvl(Nvl(p_susa_inst2, p_poous_inst2), p_prog_inst2);
4105 OPEN c_inst (l_oss_inst);
4106 FETCH c_inst INTO p_hesa_inst2;
4107 CLOSE c_inst;
4108
4109 ELSE
4110 -- Unit Based Calculations
4111 OPEN c_un_inst ;
4112 FETCH c_un_inst INTO p_hesa_inst1;
4113 --smaddali added this code to loop thru until a different institution is obtained for bug 2411691
4114 LOOP
4115 FETCH c_un_inst INTO l_un_inst;
4116 EXIT WHEN c_un_inst%NOTFOUND ;
4117 IF l_un_inst.govt_institution_cd <> p_hesa_inst1 THEN
4118 p_hesa_inst2 := l_un_inst.govt_institution_cd ;
4119 EXIT;
4120 END IF;
4121 END LOOP ;
4122 CLOSE c_un_inst;
4123
4124 END IF; -- Program / unit based calculations
4125
4126 EXCEPTION
4127 WHEN OTHERS
4128 THEN
4129 write_to_log (SQLERRM);
4130 IF c_inst%ISOPEN
4131 THEN
4132 CLOSE c_inst;
4133 END IF;
4134
4135 IF c_un_inst%ISOPEN
4136 THEN
4137 CLOSE c_un_inst;
4138 END IF;
4139
4140 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
4141 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_oth_teach_inst');
4142 IGS_GE_MSG_STACK.ADD;
4143 App_Exception.Raise_Exception;
4144 END get_oth_teach_inst;
4145
4146
4147 PROCEDURE get_prop_not_taught
4148 (p_person_id IN igs_pe_person.person_id%TYPE,
4149 p_course_cd IN igs_he_st_spa.course_cd%TYPE,
4150 p_enrl_start_dt IN DATE,
4151 p_enrl_end_dt IN DATE,
4152 p_program_calc IN igs_he_st_prog.program_calc%TYPE,
4153 p_susa_prop IN igs_he_en_susa.pro_not_taught%TYPE,
4154 p_poous_prop IN igs_he_poous.prop_not_taught%TYPE,
4155 p_prog_prop IN igs_he_st_prog.prop_not_taught%TYPE,
4156 p_hesa_prop OUT NOCOPY VARCHAR2)
4157
4158 IS
4159 /***************************************************************
4160 Created By :
4161 Date Created By :
4162 Purpose : This procedure gets Proportion not taught
4163 Known Limitations,Enhancements or Remarks:
4164 Change History :
4165 Who When What
4166 sarakshi 27-Jun-2003 Enh#2930935,modified cursors c_other_inst_cp,c_total_cp such that enrolled
4167 credit points are looked at unit section level if exists else at unit level
4168 smaddali Modified cursor c_un_prop for bug 2411740
4169 smaddali Added new parameters p_enrl_start_dt , p_enrl_end_dt for bug 2437081
4170 anwest 09-Jun-04 Changes for bug #4401841
4171 jbaber 19-Jan-2006 Exclude flagged units for HE305 - Extract Improvements
4172 ***************************************************************/
4173
4174 --smaddali replaced the old cursor c_unt_prop with these two cursors c_other_inst_cp and c_total_cp
4175 -- for bug 2437081
4176 -- anwest 09-Jun-05
4177 -- updated cursor for HZ_PARTIES.PARTY_NUMBER issue - bug #4401841
4178 CURSOR c_other_inst_cp IS
4179 SELECT SUM( NVL(override_enrolled_cp,NVL(cps.enrolled_credit_points,e.enrolled_credit_points)) * b.percentage / 100 ) other_inst_cp
4180 FROM igs_en_su_attempt a,
4181 igs_ps_tch_resp b,
4182 igs_pe_hz_parties ihpou,
4183 igs_pe_hz_parties ihpinst,
4184 igs_ps_unit_ver e,
4185 igs_ps_usec_cps cps,
4186 igs_he_st_unt_vs_all hunt
4187 WHERE a.course_cd = p_course_cd
4188 AND a.person_id = p_person_id
4189 AND b.unit_cd = a.unit_cd
4190 AND b.version_number = a.version_number
4191 AND b.org_unit_cd = ihpou.oss_org_unit_cd
4192 AND a.unit_cd = hunt.unit_cd (+)
4193 AND a.version_number = hunt.version_number (+)
4194 AND NVL(hunt.exclude_flag, 'N') = 'N'
4195 AND ihpou.institution_cd = ihpinst.oss_org_unit_cd
4196 AND NVL(ihpinst.oi_local_institution_ind,'N') = 'N'
4197 AND e.unit_cd = a.unit_cd
4198 AND e.version_number = a.version_number
4199 AND a.uoo_id = cps.uoo_id(+)
4200 AND a.unit_attempt_status IN ('ENROLLED','DISCONTIN','COMPLETED')
4201 AND a.ci_start_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt ;
4202
4203 CURSOR c_total_cp IS
4204 SELECT SUM( NVL(override_enrolled_cp,NVL(cps.enrolled_credit_points,e.enrolled_credit_points))) Total_credit_points
4205 FROM igs_en_su_attempt a,
4206 igs_ps_unit_ver e,
4207 igs_ps_usec_cps cps,
4208 igs_he_st_unt_vs_all hunt
4209 WHERE a.course_cd = p_course_cd
4210 AND a.person_id = p_person_id
4211 AND a.unit_cd = hunt.unit_cd (+)
4212 AND a.version_number = hunt.version_number (+)
4213 AND NVL(hunt.exclude_flag, 'N') = 'N'
4214 AND e.unit_cd = a.unit_cd
4215 AND e.version_number = a.version_number
4216 AND a.uoo_id = cps.uoo_id(+)
4217 AND a.unit_attempt_status IN ('ENROLLED','DISCONTIN','COMPLETED')
4218 AND a.ci_start_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt ;
4219
4220 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
4221 l_other_inst c_other_inst_cp%ROWTYPE ;
4222 l_total_cp c_total_cp%ROWTYPE ;
4223
4224 BEGIN
4225 l_total_cp:= NULL;
4226 l_other_inst := NULL;
4227
4228 IF p_program_calc = 'Y'
4229 THEN
4230 -- Program Based Calculations
4231 p_hesa_prop := Nvl(Nvl(p_susa_prop, p_poous_prop), p_prog_prop);
4232
4233 ELSE
4234 -- Unit Based Calculations
4235 OPEN c_other_inst_cp ;
4236 FETCH c_other_inst_cp INTO l_other_inst;
4237 CLOSE c_other_inst_cp;
4238
4239 OPEN c_total_cp ;
4240 FETCH c_total_cp INTO l_total_cp;
4241 CLOSE c_total_cp;
4242
4243 -- smaddali added the condition that total_credit_points should not be 0 for bug 2716038
4244 IF l_total_cp.total_credit_points <> 0 THEN
4245 p_hesa_prop := (l_other_inst.other_inst_cp * 100 )/ l_total_cp.total_credit_points ;
4246 END IF ;
4247
4248 END IF; -- Program / unit based calculations
4249
4250 EXCEPTION
4251 WHEN OTHERS
4252 THEN
4253 write_to_log (SQLERRM);
4254 IF c_other_inst_cp%ISOPEN
4255 THEN
4256 CLOSE c_other_inst_cp;
4257 END IF;
4258
4259 IF c_total_cp%ISOPEN
4260 THEN
4261 CLOSE c_total_cp;
4262 END IF;
4263
4264 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
4265 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_prop_not_taught');
4266 IGS_GE_MSG_STACK.ADD;
4267 App_Exception.Raise_Exception;
4268 END get_prop_not_taught;
4269
4270
4271
4272 PROCEDURE get_credit_trans_sch
4273 (p_oss_credit_trans_sch IN igs_he_st_prog.credit_transfer_scheme%TYPE,
4274 p_hesa_credit_trans_sch OUT NOCOPY VARCHAR2)
4275 IS
4276 /***************************************************************
4277 Created By :
4278 Date Created By :
4279 Purpose : This procedure gets the Credit Transfer Scheme
4280 Known Limitations,Enhancements or Remarks:
4281 Change History :
4282 Who When What
4283 fmak 19-Jan-05 Modified association code reference from OSS_HESA_CRDSTCM_ASSOC
4284 to OSS_HESA_CRDTSCM_ASSOC for bug 3842077
4285 ***************************************************************/
4286
4287 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
4288
4289 BEGIN
4290 -- fmak modified for bug 3842077
4291 l_he_code_map_val.association_code := 'OSS_HESA_CRDTSCM_ASSOC';
4292 l_he_code_map_val.map2 := p_oss_credit_trans_sch;
4293
4294 IF l_he_code_map_val.map2 IS NOT NULL
4295 THEN
4296 igs_he_extract2_pkg.get_map_values
4297 (p_he_code_map_val => l_he_code_map_val,
4298 p_value_from => 'MAP1',
4299 p_return_value => p_hesa_credit_trans_sch);
4300
4301 END IF;
4302
4303 EXCEPTION
4304 WHEN OTHERS
4305 THEN
4306 write_to_log (SQLERRM);
4307 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
4308 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_credit_trans_sch');
4309 IGS_GE_MSG_STACK.ADD;
4310 App_Exception.Raise_Exception;
4311 END get_credit_trans_sch;
4312
4313
4314
4315 PROCEDURE get_credit_level
4316 (p_susa_credit_level IN igs_he_en_susa.credit_level1%TYPE ,
4317 p_poous_credit_level IN igs_he_poous.level_credit1%TYPE,
4318 p_hesa_credit_level OUT NOCOPY VARCHAR2)
4319 IS
4320 /***************************************************************
4321 Created By :
4322 Date Created By :
4323 Purpose : This procedure gets the level of Credit
4324 Known Limitations,Enhancements or Remarks:
4325 Change History :
4326 Who When What
4327 smaddali Added extra parameter p_susa_credit_level for bug 2415879
4328 ***************************************************************/
4329
4330 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
4331
4332 BEGIN
4333 l_he_code_map_val.association_code := 'OSS_HESA_LEVLCRD_ASSOC';
4334 l_he_code_map_val.map2 := NVL(p_susa_credit_level,p_poous_credit_level);
4335
4336 IF l_he_code_map_val.map2 IS NOT NULL
4337 THEN
4338 igs_he_extract2_pkg.get_map_values
4339 (p_he_code_map_val => l_he_code_map_val,
4340 p_value_from => 'MAP1',
4341 p_return_value => p_hesa_credit_level);
4342
4343 END IF;
4344
4345 EXCEPTION
4346 WHEN OTHERS
4347 THEN
4348 write_to_log (SQLERRM);
4349 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
4350 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_credit_level');
4351 IGS_GE_MSG_STACK.ADD;
4352 App_Exception.Raise_Exception;
4353 END get_credit_level;
4354
4355
4356 PROCEDURE get_credit_obtained
4357 (p_person_id IN igs_pe_person.person_id%TYPE,
4358 p_course_cd IN igs_he_st_spa.course_cd%TYPE,
4359 p_prog_calc IN igs_he_st_prog.program_calc%TYPE,
4360 p_susa_crd_pt1 IN igs_he_en_susa.credit_pt_achieved1%TYPE,
4361 p_susa_crd_pt2 IN igs_he_en_susa.credit_pt_achieved2%TYPE,
4362 p_susa_crd_pt3 IN igs_he_en_susa.credit_pt_achieved3%TYPE,
4363 p_susa_crd_pt4 IN igs_he_en_susa.credit_pt_achieved4%TYPE,
4364 p_susa_crd_lvl1 IN igs_he_en_susa.credit_level_achieved1%TYPE,
4365 p_susa_crd_lvl2 IN igs_he_en_susa.credit_level_achieved2%TYPE,
4366 p_susa_crd_lvl3 IN igs_he_en_susa.credit_level_achieved3%TYPE,
4367 p_susa_crd_lvl4 IN igs_he_en_susa.credit_level_achieved4%TYPE,
4368 p_no_crd_pt1 OUT NOCOPY VARCHAR2,
4369 p_no_crd_pt2 OUT NOCOPY VARCHAR2,
4370 p_no_crd_pt3 OUT NOCOPY VARCHAR2,
4371 p_no_crd_pt4 OUT NOCOPY VARCHAR2,
4372 p_lvl_crd_pt1 OUT NOCOPY VARCHAR2,
4373 p_lvl_crd_pt2 OUT NOCOPY VARCHAR2,
4374 p_lvl_crd_pt3 OUT NOCOPY VARCHAR2,
4375 p_lvl_crd_pt4 OUT NOCOPY VARCHAR2,
4376 p_enrl_start_dt IN DATE,
4377 p_enrl_end_dt IN DATE)
4378
4379 IS
4380 /***************************************************************
4381 Created By :
4382 Date Created By :
4383 Purpose : This procedure gets Number of Credit Points obtained, level of credit points obtained
4384 Known Limitations,Enhancements or Remarks:
4385 Change History :
4386 Who When What
4387 sarakshi 27-Jun-2003 Enh#2930935,modified the cursor c_cp to include the usec level enrolled credit
4388 points if exists else from the unit level
4389 smaddali added extra parameter p_susa_credit_level for bug 2415879
4390 jbaber 20-Sep-2004 HEFD350 - Stat changes for 2004/05
4391 Expanded to derive new fields CPOBTN3, CPOBTN4, LCPOBTN3 and LCPOBTN4
4392 jbaber 19-Jan-2006 Exclude flagged units for HE305 - Extract Improvements
4393 ***************************************************************/
4394
4395 --smaddali modified this cursor to consider unit level credit points also for bug 2415811
4396 CURSOR c_cp IS
4397 SELECT SUM( NVL(override_enrolled_cp,NVL(cps.enrolled_credit_points,b.enrolled_credit_points)) ) credit_points, b.unit_level
4398 FROM igs_en_su_attempt a ,
4399 igs_ps_unit_ver b,
4400 igs_ps_usec_cps cps,
4401 igs_he_st_unt_vs_all hunt
4402 WHERE a.course_cd = p_course_cd
4403 AND a.person_id = p_person_id
4404 AND a.unit_cd = b.unit_cd
4405 AND a.version_number = b.version_number
4406 AND a.unit_cd = hunt.unit_cd (+)
4407 AND a.version_number = hunt.version_number (+)
4408 AND NVL(hunt.exclude_flag, 'N') = 'N'
4409 AND a.uoo_id = cps.uoo_id(+)
4410 AND a.unit_attempt_status = 'COMPLETED'
4411 AND a.ci_start_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt
4412 GROUP BY b.unit_level
4413 ORDER BY credit_points DESC;
4414
4415 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
4416 l_lvl1 igs_ps_unit_ver.unit_level%TYPE;
4417 l_lvl2 igs_ps_unit_ver.unit_level%TYPE;
4418 l_lvl3 igs_ps_unit_ver.unit_level%TYPE;
4419 l_lvl4 igs_ps_unit_ver.unit_level%TYPE;
4420
4421 BEGIN
4422 IF p_prog_calc = 'N'
4423 THEN
4424 OPEN c_cp;
4425 FETCH c_cp INTO p_no_crd_pt1, l_lvl1;
4426 FETCH c_cp INTO p_no_crd_pt2, l_lvl2;
4427 FETCH c_cp INTO p_no_crd_pt3, l_lvl3;
4428 FETCH c_cp INTO p_no_crd_pt4, l_lvl4;
4429 CLOSE c_cp;
4430
4431 -- Level of Credit Points obtained 1
4432 igs_he_extract_fields_pkg.get_credit_level
4433 (p_susa_credit_level => NULL ,
4434 p_poous_credit_level => l_lvl1,
4435 p_hesa_credit_level => p_lvl_crd_pt1);
4436
4437 -- Level of Credit Points obtained 2
4438 igs_he_extract_fields_pkg.get_credit_level
4439 (p_susa_credit_level => NULL ,
4440 p_poous_credit_level => l_lvl2,
4441 p_hesa_credit_level => p_lvl_crd_pt2);
4442
4443 -- Level of Credit Points obtained 3
4444 igs_he_extract_fields_pkg.get_credit_level
4445 (p_susa_credit_level => NULL ,
4446 p_poous_credit_level => l_lvl3,
4447 p_hesa_credit_level => p_lvl_crd_pt3);
4448
4449 -- Level of Credit Points obtained 4
4450 igs_he_extract_fields_pkg.get_credit_level
4451 (p_susa_credit_level => NULL ,
4452 p_poous_credit_level => l_lvl4,
4453 p_hesa_credit_level => p_lvl_crd_pt4);
4454
4455 ELSE
4456 -- Unit Based Calculations
4457 p_no_crd_pt1 := p_susa_crd_pt1;
4458 p_no_crd_pt2 := p_susa_crd_pt2;
4459 p_no_crd_pt3 := p_susa_crd_pt3;
4460 p_no_crd_pt4 := p_susa_crd_pt4;
4461
4462 -- Level of Credit Points obtained 1
4463 igs_he_extract_fields_pkg.get_credit_level
4464 (p_susa_credit_level => NULL ,
4465 p_poous_credit_level => p_susa_crd_lvl1,
4466 p_hesa_credit_level => p_lvl_crd_pt1);
4467
4468 -- Level of Credit Points obtained 2
4469 igs_he_extract_fields_pkg.get_credit_level
4470 (p_susa_credit_level => NULL ,
4471 p_poous_credit_level => p_susa_crd_lvl2,
4472 p_hesa_credit_level => p_lvl_crd_pt2);
4473
4474 -- Level of Credit Points obtained 3
4475 igs_he_extract_fields_pkg.get_credit_level
4476 (p_susa_credit_level => NULL ,
4477 p_poous_credit_level => p_susa_crd_lvl3,
4478 p_hesa_credit_level => p_lvl_crd_pt3);
4479
4480 -- Level of Credit Points obtained 4
4481 igs_he_extract_fields_pkg.get_credit_level
4482 (p_susa_credit_level => NULL ,
4483 p_poous_credit_level => p_susa_crd_lvl4,
4484 p_hesa_credit_level => p_lvl_crd_pt4);
4485
4486 END IF ; -- Program / Unit Based calculations
4487
4488 EXCEPTION
4489 WHEN OTHERS
4490 THEN
4491 write_to_log (SQLERRM);
4492 IF c_cp%ISOPEN
4493 THEN
4494 CLOSE c_cp;
4495 END IF;
4496
4497 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
4498 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_credit_obtained');
4499 IGS_GE_MSG_STACK.ADD;
4500 App_Exception.Raise_Exception;
4501 END get_credit_obtained;
4502
4503
4504 PROCEDURE get_cost_centres
4505 (p_person_id IN igs_pe_person.person_id%TYPE,
4506 p_course_cd IN igs_en_stdnt_ps_att.course_cd%TYPE,
4507 p_version_number IN igs_en_stdnt_ps_att.version_number%TYPE,
4508 p_unit_set_cd IN igs_he_poous.unit_set_cd%TYPE,
4509 p_us_version_number IN igs_he_poous.us_version_number%TYPE,
4510 p_cal_type IN igs_he_poous.cal_type%TYPE,
4511 p_attendance_mode IN igs_he_poous.attendance_mode%TYPE,
4512 p_attendance_type IN igs_he_poous.attendance_type%TYPE,
4513 p_location_cd IN igs_he_poous.location_cd%TYPE,
4514 p_program_calc IN igs_he_st_prog.program_calc%TYPE,
4515 p_unit_cd IN igs_he_st_unt_vs.unit_cd%TYPE,
4516 p_uv_version_number IN igs_he_st_unt_vs.version_number%TYPE,
4517 p_return_type IN VARCHAR2,
4518 p_cost_ctr_rec IN OUT NOCOPY cc_rec,
4519 p_total_recs OUT NOCOPY NUMBER,
4520 p_enrl_start_dt IN DATE,
4521 p_enrl_end_dt IN DATE,
4522 p_sequence_number IN NUMBER,
4523 p_validation_country IN igs_he_submsn_header.validation_country%TYPE) IS
4524 /***************************************************************
4525 Created By :
4526 Date Created By :
4527 Purpose : This procedure gets the Cost Centres, Subjects for each and their proportions.
4528 This procedure is used for Combined Return and Module Return
4529 Known Limitations,Enhancements or Remarks:
4530 Change History :
4531 WHO WHEN WHAT
4532 smaddali Bug 241745 modified the dynamic cursors for unit cost centres , to consider enrolled credit points as per the HLD
4533 smaddali Modified procedure to remove use of enrolled_credit points ,for bug 2668966
4534 ayedubat 26-AUG-2003 Changed the the procedure to use the Cost Centers defined at
4535 Program Level, Student Program Attempt Level and Student Unit Set Attempt Level
4536 as part of HE207FD - Override Cost Center Enhancement bug, 2717753
4537 jbaber 20-Sep-2004 Changes as per HEFD350 - Stat changes for 2004/05
4538 Added p_validation_country parameter
4539 jbaber 27-Jan-2005 Changes as per HEFD355 - Org Unit Cost Center Link
4540 jbaber 19-Jan-2006 Exclude flagged units for HE305 - Extract Improvements
4541 jchakrab 21-Feb-2006 Modified for R12 Performance Enhs(4950293) - removed literal SQL
4542 ***************************************************************/
4543
4544 l_sql_stmt VARCHAR2(2000);
4545 l_index NUMBER;
4546 l_total_prop NUMBER := 0;
4547 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
4548 l_poous_cc igs_he_poous_ou_cc%ROWTYPE;
4549 l_max_recs NUMBER;
4550
4551 TYPE cur_cc IS REF CURSOR;
4552 c_cc cur_cc;
4553
4554 --smaddali added this cursor for bug 2417454 to get the govt code for oss field of study
4555 CURSOR c_field_of_study(p_subject igs_he_poous_ou_cc.subject%TYPE) IS
4556 SELECT govt_field_of_study
4557 FROM IGS_PS_FLD_OF_STUDY PFS
4558 WHERE field_of_study = p_subject;
4559
4560 -- Cost Centers at Student Unit Set Attempt Level
4561 CURSOR susa_cc_dtls_cur(cp_person_id IGS_HE_EN_SUSA_CC.person_id%TYPE,
4562 cp_course_cd IGS_HE_EN_SUSA_CC.course_cd%TYPE,
4563 cp_unit_set_cd IGS_HE_EN_SUSA_CC.unit_set_cd%TYPE,
4564 cp_sequence_number IGS_HE_EN_SUSA_CC.sequence_number%TYPE) IS
4565 SELECT 'X'
4566 FROM IGS_HE_EN_SUSA_CC
4567 WHERE person_id = cp_person_id
4568 AND course_cd = cp_course_cd
4569 AND unit_set_cd = cp_unit_set_cd
4570 AND sequence_number = cp_sequence_number;
4571
4572 -- Cost Centers at Student Program Attempt Level
4573 CURSOR spa_cc_dtls_cur(cp_person_id IGS_HE_ST_SPA_CC.person_id%TYPE,
4574 cp_course_cd IGS_HE_ST_SPA_CC.course_cd%TYPE) IS
4575 SELECT 'X'
4576 FROM IGS_HE_ST_SPA_CC
4577 WHERE person_id = cp_person_id
4578 AND course_cd = cp_course_cd;
4579
4580 -- Cost Centers at Program Offering Option Level
4581 CURSOR poo_cc_dtls_cur( cp_course_cd IGS_HE_POOUS_OU_ALL.course_cd%TYPE,
4582 cp_crv_version_number IGS_HE_POOUS_OU_ALL.crv_version_number%TYPE,
4583 cp_unit_set_cd IGS_HE_POOUS_OU_ALL.unit_set_cd%TYPE,
4584 cp_us_version_number IGS_HE_POOUS_OU_ALL.us_version_number%TYPE,
4585 cp_cal_type IGS_HE_POOUS_OU_ALL.cal_type%TYPE,
4586 cp_attendance_mode IGS_HE_POOUS_OU_ALL.attendance_mode%TYPE,
4587 cp_attendance_type IGS_HE_POOUS_OU_ALL.attendance_type%TYPE,
4588 cp_location_cd IGS_HE_POOUS_OU_ALL.location_cd%TYPE ) IS
4589 SELECT 'X'
4590 FROM IGS_HE_POOUS_OU_CC pocc,
4591 IGS_HE_POOUS_OU_ALL poou
4592 WHERE poou.hesa_poous_ou_id = pocc.hesa_poous_ou_id
4593 AND poou.course_cd = cp_course_cd
4594 AND poou.crv_version_number = cp_crv_version_number
4595 AND poou.unit_set_cd = cp_unit_set_cd
4596 AND poou.us_version_number = cp_us_version_number
4597 AND poou.cal_type = cp_cal_type
4598 AND poou.attendance_mode = cp_attendance_mode
4599 AND poou.attendance_type = cp_attendance_type
4600 AND poou.location_cd = cp_location_cd;
4601
4602 -- Cost Centers at POOUS / ORG Level
4603 CURSOR poo_org_cc_dtls_cur IS
4604 SELECT 'X'
4605 FROM
4606 igs_he_ou_cc org,
4607 igs_he_poous_ou_all poo
4608 WHERE
4609 org.org_unit_cd = poo.organization_unit
4610 AND poo.course_cd = p_course_cd
4611 AND poo.crv_version_number = p_version_number
4612 AND poo.unit_set_cd = p_unit_set_cd
4613 AND poo.us_version_number = p_us_version_number
4614 AND poo.cal_type = p_cal_type
4615 AND poo.attendance_mode = p_attendance_mode
4616 AND poo.attendance_type = p_attendance_type
4617 AND poo.location_cd = p_location_cd;
4618
4619
4620 -- Cost Centers at Program Version Level
4621 CURSOR prg_cc_dtls_cur( cp_course_cd IGS_HE_PROG_OU_CC.course_cd%TYPE,
4622 cp_version_number IGS_HE_PROG_OU_CC.version_number%TYPE) IS
4623 SELECT 'X'
4624 FROM
4625 IGS_HE_PROG_OU_CC pcc,
4626 IGS_PS_OWN pown
4627 WHERE
4628 pcc.course_cd = p_course_cd
4629 AND pcc.version_number = p_version_number
4630 AND pcc.course_cd = pown.course_cd
4631 AND pcc.version_number = pown.version_number
4632 AND pcc.org_unit_cd = pown.org_unit_cd;
4633
4634
4635 -- Cost Centers at Program / Org Level
4636 CURSOR prg_org_cc_dtls_cur IS
4637 SELECT 'X'
4638 FROM
4639 igs_he_ou_cc org,
4640 igs_ps_own ps
4641 WHERE
4642 org.org_unit_cd = ps.org_unit_cd
4643 AND ps.course_cd = p_course_cd
4644 AND ps.version_number = p_version_number;
4645
4646
4647 -- Cost Centers at Unit Level
4648 CURSOR unit_cc_dtls_cur IS
4649 SELECT 'X'
4650 FROM igs_he_unt_ou_cc a,
4651 igs_en_su_attempt_all b,
4652 igs_ps_tch_resp c,
4653 igs_he_st_unt_vs_all hunt
4654 WHERE b.course_cd = p_course_cd
4655 AND b.person_id = p_person_id
4656 AND a.unit_cd = b.unit_cd
4657 AND a.version_number = b.version_number
4658 AND b.unit_cd = hunt.unit_cd (+)
4659 AND b.version_number = hunt.version_number (+)
4660 AND NVL(hunt.exclude_flag, 'N') = 'N'
4661 AND b.unit_attempt_status IN ('ENROLLED','DISCONTIN','COMPLETED')
4662 AND c.unit_cd = a.unit_cd
4663 AND c.version_number = a.version_number
4664 AND c.org_unit_cd = a.org_unit_cd
4665 AND b.ci_start_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt;
4666
4667 -- Cost Centers at Unit / Org Level
4668 CURSOR unit_org_cc_dtls_cur IS
4669 SELECT 'X'
4670 FROM
4671 igs_he_ou_cc org,
4672 igs_ps_tch_resp ps,
4673 igs_en_su_attempt_all su
4674 WHERE
4675 org.org_unit_cd = ps.org_unit_cd
4676 AND ps.unit_cd = su.unit_cd
4677 AND ps.version_number = su.version_number
4678 AND su.person_id = p_person_id
4679 AND su.course_cd = p_course_cd
4680 AND su.unit_attempt_status IN ('ENROLLED','DISCONTIN','COMPLETED')
4681 AND su.ci_start_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt;
4682
4683 -- Cost Centers at Module Level
4684 CURSOR module_cc_dtls_cur IS
4685 SELECT 'X'
4686 FROM igs_he_unt_ou_cc ucc,
4687 igs_ps_tch_resp ptr
4688 WHERE ucc.unit_cd = p_unit_cd
4689 AND ucc.version_number = p_uv_version_number
4690 AND ucc.unit_cd = ptr.unit_cd
4691 AND ucc.version_number = ptr.version_number
4692 AND ucc.org_unit_cd = ptr.org_unit_cd;
4693
4694 -- Cost Centers at Module / Org Level
4695 CURSOR module_org_cc_dtls_cur IS
4696 SELECT 'X'
4697 FROM igs_he_ou_cc org,
4698 igs_ps_tch_resp ptr
4699 WHERE ptr.unit_cd = p_unit_cd
4700 AND ptr.version_number = p_uv_version_number
4701 AND ptr.org_unit_cd = org.org_unit_cd;
4702
4703 l_dummy VARCHAR2(1);
4704
4705 BEGIN
4706
4707 l_index := 1;
4708 p_total_recs := 0;
4709 l_sql_stmt := NULL;
4710
4711 IF p_return_type IN ('S','C') AND p_program_calc = 'Y' THEN
4712
4713 -- Student Combined, Non Modular program
4714 -- get the 16 highest proportions from poous cost centres
4715 l_max_recs := 16;
4716
4717 -- Check whether the Cost Center details are defined at Student Unit Set Attempt Level
4718 -- If Cost Centers are defined at this level
4719 OPEN susa_cc_dtls_cur( p_person_id, p_course_cd, p_unit_set_cd, p_sequence_number );
4720 FETCH susa_cc_dtls_cur INTO l_dummy;
4721
4722 IF susa_cc_dtls_cur%FOUND THEN
4723 CLOSE susa_cc_dtls_cur;
4724
4725 OPEN c_cc FOR
4726 SELECT cost_centre, subject, proportion
4727 FROM igs_he_en_susa_cc
4728 WHERE person_id = p_person_id
4729 AND course_cd = p_course_cd
4730 AND unit_set_cd = p_unit_set_cd
4731 AND sequence_number = p_sequence_number
4732 ORDER BY proportion DESC;
4733
4734 ELSE /* If cost centers are not defined at student unit set attempt level */
4735 CLOSE susa_cc_dtls_cur;
4736
4737 --Check whether the Cost Center details are defined at Student Program Attempt Level
4738 OPEN spa_cc_dtls_cur( p_person_id, p_course_cd );
4739 FETCH spa_cc_dtls_cur INTO l_dummy;
4740
4741 IF spa_cc_dtls_cur%FOUND THEN
4742 CLOSE spa_cc_dtls_cur;
4743
4744 OPEN c_cc FOR
4745 SELECT cost_centre, subject, proportion
4746 FROM igs_he_st_spa_cc
4747 WHERE person_id = p_person_id
4748 AND course_cd = p_course_cd
4749 ORDER BY proportion DESC;
4750
4751 ELSE /* If cost centers are not defined at Student Program Attempt level */
4752 CLOSE spa_cc_dtls_cur;
4753
4754 --Check whether the Cost Center details are defined at Program Offering Option Level
4755 OPEN poo_cc_dtls_cur( p_course_cd, p_version_number, p_unit_set_cd, p_us_version_number,
4756 p_cal_type, p_attendance_mode, p_attendance_type, p_location_cd );
4757 FETCH poo_cc_dtls_cur INTO l_dummy;
4758
4759 IF poo_cc_dtls_cur%FOUND THEN
4760 CLOSE poo_cc_dtls_cur;
4761
4762 OPEN c_cc FOR
4763 SELECT cost_centre, subject, SUM (pocc.proportion*NVL(poou.proportion,0)/100) proportion
4764 FROM igs_he_poous_ou_cc pocc,
4765 igs_he_poous_ou_all poou
4766 WHERE poou.hesa_poous_ou_id = pocc.hesa_poous_ou_id
4767 AND poou.course_cd = p_course_cd
4768 AND poou.crv_version_number = p_version_number
4769 AND poou.unit_set_cd = p_unit_set_cd
4770 AND poou.us_version_number = p_us_version_number
4771 AND poou.cal_type = p_cal_type
4772 AND poou.attendance_mode = p_attendance_mode
4773 AND poou.attendance_type = p_attendance_type
4774 AND poou.location_cd = p_location_cd
4775 GROUP BY cost_centre, subject
4776 ORDER BY proportion DESC;
4777
4778 ELSE /* If cost centers are not defined at Program Offering Option level */
4779 CLOSE poo_cc_dtls_cur;
4780
4781
4782 --Check whether the Cost Center details are defined at POOUS / Org Level
4783 OPEN poo_org_cc_dtls_cur;
4784 FETCH poo_org_cc_dtls_cur INTO l_dummy;
4785
4786 IF poo_org_cc_dtls_cur%FOUND THEN
4787 CLOSE poo_org_cc_dtls_cur;
4788
4789 OPEN c_cc FOR
4790 SELECT org.cost_centre,
4791 org.subject,
4792 SUM((NVL(poo.proportion,0) * org.proportion / 100)) proportion
4793 FROM igs_he_ou_cc org,
4794 igs_he_poous_ou_all poo
4795 WHERE org.org_unit_cd = poo.organization_unit
4796 AND poo.course_cd = p_course_cd
4797 AND poo.crv_version_number = p_version_number
4798 AND poo.unit_set_cd = p_unit_set_cd
4799 AND poo.us_version_number = p_us_version_number
4800 AND poo.cal_type = p_cal_type
4801 AND poo.attendance_mode = p_attendance_mode
4802 AND poo.attendance_type = p_attendance_type
4803 AND poo.location_cd = p_location_cd
4804 GROUP BY org.cost_centre, org.subject
4805 ORDER BY proportion DESC;
4806
4807 ELSE /* If cost centers are not defined at POOUS / Org level */
4808 CLOSE poo_org_cc_dtls_cur ;
4809
4810 --Check whether the Cost Center details are defined at Program Level
4811 OPEN prg_cc_dtls_cur( p_course_cd, p_version_number );
4812 FETCH prg_cc_dtls_cur INTO l_dummy;
4813
4814 IF prg_cc_dtls_cur%FOUND THEN
4815 CLOSE prg_cc_dtls_cur;
4816
4817 OPEN c_cc FOR
4818 SELECT cost_centre, subject, SUM(proportion*percentage/100) proportion
4819 FROM igs_he_prog_ou_cc pcc,
4820 igs_ps_own pown
4821 WHERE pcc.course_cd = p_course_cd
4822 AND pcc.version_number = p_version_number
4823 AND pcc.course_cd = pown.course_cd
4824 AND pcc.version_number = pown.version_number
4825 AND pcc.org_unit_cd = pown.org_unit_cd
4826 GROUP BY cost_centre, subject
4827 ORDER BY proportion DESC;
4828
4829 ELSE /* If cost centers are not defined at Program level */
4830 CLOSE prg_cc_dtls_cur;
4831
4832 --Check whether the Cost Center details are defined at Program Level
4833 OPEN prg_org_cc_dtls_cur;
4834 FETCH prg_org_cc_dtls_cur INTO l_dummy;
4835
4836 IF prg_org_cc_dtls_cur%FOUND THEN
4837
4838 OPEN c_cc FOR
4839 SELECT org.cost_centre,
4840 org.subject,
4841 SUM(ps.percentage * org.proportion / 100) proportion
4842 FROM igs_he_ou_cc org,
4843 igs_ps_own ps
4844 WHERE org.org_unit_cd = ps.org_unit_cd
4845 AND ps.course_cd = p_course_cd
4846 AND ps.version_number = p_version_number
4847 GROUP BY org.cost_centre, org.subject
4848 ORDER BY proportion DESC;
4849
4850 END IF;
4851 CLOSE prg_org_cc_dtls_cur;
4852
4853 END IF;
4854 END IF;
4855 END IF;
4856 END IF;
4857 END IF;
4858
4859 ELSIF p_return_type IN ('S','C') AND p_program_calc = 'N' THEN
4860
4861 --- Unit Based calculation , get 16 highest proportions from unit cost centres
4862 -- consider unique cost centre ,subject combinations only
4863 l_max_recs := 16;
4864
4865 -- Check whether the Cost Center details are defined at Unit Level
4866 -- If Cost Centers are defined at this level
4867 OPEN unit_cc_dtls_cur;
4868 FETCH unit_cc_dtls_cur INTO l_dummy;
4869
4870 IF unit_cc_dtls_cur%FOUND THEN
4871 CLOSE unit_cc_dtls_cur;
4872
4873 -- smaddali modified this cursor to include unit credit points and taking proportion of unit credit
4874 --points instead of directly the proportion field of cost centre
4875 OPEN c_cc FOR
4876 SELECT a.cost_centre,
4877 a.subject,
4878 SUM(proportion*percentage/100) proportion
4879 FROM igs_he_unt_ou_cc a,
4880 igs_en_su_attempt_all b,
4881 igs_ps_tch_resp c,
4882 igs_he_st_unt_vs_all hunt
4883 WHERE b.course_cd = p_course_cd
4884 AND b.person_id = p_person_id
4885 AND a.unit_cd = b.unit_cd
4886 AND a.version_number = b.version_number
4887 AND c.unit_cd = a.unit_cd
4888 AND c.version_number = a.version_number
4889 AND c.org_unit_cd = a.org_unit_cd
4890 AND b.unit_cd = hunt.unit_cd(+)
4891 AND b.version_number = hunt.version_number(+)
4892 AND NVL(hunt.exclude_flag, 'N') = 'N'
4893 AND b.unit_attempt_status IN ('ENROLLED','DISCONTIN','COMPLETED')
4894 AND b.ci_start_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt
4895 GROUP BY a.cost_centre, a.subject
4896 ORDER BY proportion DESC;
4897
4898
4899 ELSE /* If cost centers are not defined at unit level */
4900 CLOSE unit_cc_dtls_cur;
4901
4902 OPEN unit_org_cc_dtls_cur;
4903 FETCH unit_org_cc_dtls_cur INTO l_dummy;
4904
4905 IF unit_org_cc_dtls_cur%FOUND THEN
4906
4907 OPEN c_cc FOR
4908 SELECT org.cost_centre,
4909 org.subject,
4910 SUM(ps.percentage * org.proportion / 100) proportion
4911 FROM igs_he_ou_cc org,
4912 igs_ps_tch_resp ps,
4913 igs_en_su_attempt_all su
4914 WHERE org.org_unit_cd = ps.org_unit_cd
4915 AND ps.unit_cd = su.unit_cd
4916 AND ps.version_number = su.version_number
4917 AND su.person_id = p_person_id
4918 AND su.course_cd = p_course_cd
4919 AND su.unit_attempt_status IN ('ENROLLED','DISCONTIN','COMPLETED')
4920 AND su.ci_start_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt
4921 GROUP BY org.cost_centre, org.subject
4922 ORDER BY proportion DESC;
4923 END IF;
4924 CLOSE unit_org_cc_dtls_cur;
4925
4926 END IF;
4927
4928
4929 ELSIF p_return_type = 'M' THEN
4930 --- Module Return, get 2 highest proportions from unit cost centres
4931 -- jbaber - HEFD350 get 4 highest proportions if validation country is SCOTLAND
4932 IF p_validation_country IN ('SCOTLAND') THEN
4933 l_max_recs := 4;
4934 ELSE
4935 l_max_recs := 2;
4936 END IF;
4937
4938
4939 OPEN module_cc_dtls_cur;
4940 FETCH module_cc_dtls_cur INTO l_dummy;
4941 IF module_cc_dtls_cur%FOUND THEN
4942
4943 CLOSE module_cc_dtls_cur;
4944
4945 -- smaddali modified this cursor to include unit credit points and taking proportion of unit credit points
4946 -- instead of directly the proportion field of cost centre
4947 -- jbaber modified to use igs_he_unt_ou_cc
4948 OPEN c_cc FOR
4949 SELECT cost_centre,
4950 subject,
4951 SUM(proportion*percentage/100) proportion
4952 FROM igs_he_unt_ou_cc ucc,
4953 igs_ps_tch_resp ptr
4954 WHERE ucc.unit_cd = p_unit_cd
4955 AND ucc.version_number = p_uv_version_number
4956 AND ucc.unit_cd = ptr.unit_cd
4957 AND ucc.version_number = ptr.version_number
4958 AND ucc.org_unit_cd = ptr.org_unit_cd
4959 GROUP BY cost_centre, subject
4960 ORDER BY proportion DESC;
4961
4962 ELSE
4963 CLOSE module_cc_dtls_cur;
4964
4965 OPEN module_org_cc_dtls_cur;
4966 FETCH module_org_cc_dtls_cur INTO l_dummy;
4967
4968 IF module_org_cc_dtls_cur%FOUND THEN
4969
4970 OPEN c_cc FOR
4971 SELECT cost_centre,
4972 subject,
4973 SUM(proportion*percentage/100) proportion
4974 FROM igs_he_ou_cc org,
4975 igs_ps_tch_resp ptr
4976 WHERE ptr.unit_cd = p_unit_cd
4977 AND ptr.version_number = p_uv_version_number
4978 AND ptr.org_unit_cd = org.org_unit_cd
4979 GROUP BY cost_centre, subject
4980 ORDER BY proportion DESC;
4981
4982 END IF;
4983 CLOSE module_org_cc_dtls_cur;
4984
4985 END IF;
4986 END IF;
4987
4988 -- Check whether the c_cc cursor has been opened for a query or its closed as no cost centers are defined
4989 IF c_cc%ISOPEN THEN
4990
4991 LOOP
4992 FETCH c_cc INTO l_poous_cc.cost_centre,
4993 l_poous_cc.subject,
4994 l_poous_cc.proportion;
4995 EXIT WHEN c_cc%NOTFOUND OR l_index > l_max_recs ;
4996
4997 l_he_code_map_val.association_code := 'OSS_HESA_COSTCN_ASSOC';
4998 l_he_code_map_val.map2 := l_poous_cc.cost_centre;
4999
5000 igs_he_extract2_pkg.get_map_values
5001 (p_he_code_map_val => l_he_code_map_val,
5002 p_value_from => 'MAP1',
5003 p_return_value => p_cost_ctr_rec.cost_centre(l_index));
5004
5005 -- smaddali replaced the code using association code 'OSS_HESA_SBJ_ASSOC' with this cursor for bug 2417454
5006 OPEN c_field_of_study(l_poous_cc.subject);
5007 FETCH c_field_of_study INTO p_cost_ctr_rec.subject(l_index) ;
5008 CLOSE c_field_of_study;
5009
5010 p_cost_ctr_rec.proportion(l_index) := l_poous_cc.proportion;
5011 -- keep a total of the proportions
5012 l_total_prop := l_total_prop + l_poous_cc.proportion;
5013 l_index := l_index + 1;
5014 END LOOP;
5015 CLOSE c_cc;
5016
5017 END IF;
5018
5019 -- Decrease count as it would be one more than total recs
5020 l_index := l_index - 1;
5021
5022 -- Apportion the proportions so that their sum will be 100
5023 FOR i IN 1 .. l_index
5024 LOOP
5025 p_cost_ctr_rec.proportion(i) :=
5026 (p_cost_ctr_rec.proportion(i) * 100 ) / l_total_prop;
5027 END LOOP;
5028 -- total cost centres found
5029 p_total_recs := l_index ;
5030
5031 EXCEPTION
5032 WHEN OTHERS THEN
5033 write_to_log (SQLERRM);
5034
5035 IF c_cc%ISOPEN THEN
5036 CLOSE c_cc;
5037 END IF;
5038
5039 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5040 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_cost_centres');
5041 IGS_GE_MSG_STACK.ADD;
5042 App_Exception.Raise_Exception;
5043
5044 END get_cost_centres;
5045
5046 PROCEDURE get_studies_susp
5047 (p_person_id IN igs_pe_person.person_id%TYPE,
5048 p_course_cd IN igs_he_st_spa.course_cd%TYPE,
5049 p_version_number IN igs_he_st_spa.version_number%TYPE,
5050 p_enrl_start_dt IN DATE,
5051 p_enrl_end_dt IN DATE,
5052 p_susp_act_std OUT NOCOPY VARCHAR2)
5053
5054 IS
5055 /***************************************************************
5056 Created By :
5057 Date Created By :
5058 Purpose : This procedure gets Suspension of Active Studies flag
5059 Known Limitations,Enhancements or Remarks:
5060 Change History :
5061 Who When What
5062 AYEDUBAT 29-04-04 Changed the cursor, c_susp to add a new condition to check
5063 for approved intermissions, if approval is required for Bug, 3494224
5064 rnirwani 13-09-04 Changed the cursor, c_susp to exclude logically deleted intermission
5065 records as per Bug# 3885804
5066 jbaber 30-11-04 Consider mutiple intermission records for bug# 4037237
5067 Now calls isDormant function
5068 ***************************************************************/
5069
5070 CURSOR c_susp IS
5071 SELECT start_dt,
5072 end_dt
5073 FROM igs_en_stdnt_ps_intm spi
5074 WHERE spi.person_id = p_person_id
5075 AND spi.course_cd = p_course_cd
5076 AND spi.start_dt <= p_enrl_end_dt
5077 AND spi.end_dt >= p_enrl_end_dt
5078 AND spi.logical_delete_date = TO_DATE('31-12-4712','DD-MM-YYYY')
5079 AND (spi.approved = 'Y' OR
5080 EXISTS( SELECT 1 FROM igs_en_intm_types
5081 WHERE intermission_type = spi.intermission_type AND
5082 appr_reqd_ind = 'N' ));
5083
5084 CURSOR c_spa_dt IS
5085 SELECT commencement_dt,
5086 discontinued_dt,
5087 course_rqrmnts_complete_dt
5088 FROM igs_en_stdnt_ps_att_all
5089 WHERE person_id = p_person_id
5090 AND course_cd = p_course_cd
5091 AND version_number = p_version_number;
5092
5093 l_spa_dt c_spa_dt%ROWTYPE;
5094
5095 l_intm_start_dt DATE;
5096 l_intm_end_dt DATE;
5097
5098 BEGIN
5099
5100 -- Return 1 if the student begins intermission during the reporting period
5101 -- and is intermitted during the reporting period end date.
5102 -- Student must not be dormant throughout entire period.
5103 -- Course requirements complete date and discontinued date must be greater than
5104 -- reporting period end date.
5105
5106 IF isDormant
5107 (p_person_id => p_person_id,
5108 p_course_cd => p_course_cd,
5109 p_version_number => p_version_number,
5110 p_enrl_start_dt => p_enrl_start_dt,
5111 p_enrl_end_dt => p_enrl_end_dt)
5112 THEN
5113 p_susp_act_std := NULL;
5114 ELSE
5115
5116 OPEN c_spa_dt;
5117 FETCH c_spa_dt INTO l_spa_dt;
5118 CLOSE c_spa_dt;
5119
5120 IF (NVL(l_spa_dt.discontinued_dt, p_enrl_end_dt) < p_enrl_end_dt)
5121 OR (NVL(l_spa_dt.course_rqrmnts_complete_dt, p_enrl_end_dt) < p_enrl_end_dt)
5122 THEN
5123 p_susp_act_std := NULL;
5124 ELSE
5125
5126
5127 OPEN c_susp;
5128 FETCH c_susp INTO l_intm_start_dt,
5129 l_intm_end_dt;
5130
5131 IF c_susp%FOUND
5132 THEN
5133 -- smaddali making p_susp_act_std =1 when student started intermission in the
5134 -- submission period but did not complete within the submission period
5135 -- and null otherwise, for bug#3306455
5136 p_susp_act_std := '1';
5137 ELSE
5138 p_susp_act_std := NULL;
5139 END IF;
5140
5141 CLOSE c_susp ;
5142
5143 END IF;
5144
5145 END IF; -- isDormant
5146
5147
5148 EXCEPTION
5149 WHEN OTHERS
5150 THEN
5151 write_to_log (SQLERRM);
5152 IF c_susp%ISOPEN
5153 THEN
5154 CLOSE c_susp;
5155 END IF;
5156
5157 IF c_spa_dt%ISOPEN
5158 THEN
5159 CLOSE c_susp;
5160 END IF;
5161
5162 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5163 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_studies_susp');
5164 IGS_GE_MSG_STACK.ADD;
5165 App_Exception.Raise_Exception;
5166 END get_studies_susp;
5167
5168
5169 PROCEDURE get_pyr_type
5170 (p_oss_pyr_type IN igs_he_poous.type_of_year%TYPE,
5171 p_hesa_pyr_type OUT NOCOPY VARCHAR2)
5172 IS
5173 /***************************************************************
5174 Created By :
5175 Date Created By :
5176 Purpose : This procedure gets the type of program year
5177 Known Limitations,Enhancements or Remarks:
5178 Change History :
5179 Who When What
5180 ***************************************************************/
5181
5182 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
5183
5184 BEGIN
5185 l_he_code_map_val.association_code := 'OSS_HESA_TYPEYR_ASSOC';
5186 l_he_code_map_val.map2 := p_oss_pyr_type;
5187
5188 IF l_he_code_map_val.map2 IS NOT NULL
5189 THEN
5190 igs_he_extract2_pkg.get_map_values
5191 (p_he_code_map_val => l_he_code_map_val,
5192 p_value_from => 'MAP1',
5193 p_return_value => p_hesa_pyr_type);
5194
5195 END IF;
5196
5197 EXCEPTION
5198 WHEN OTHERS
5199 THEN
5200 write_to_log (SQLERRM);
5201 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5202 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_pyr_type');
5203 IGS_GE_MSG_STACK.ADD;
5204 App_Exception.Raise_Exception;
5205 END get_pyr_type;
5206
5207
5208 PROCEDURE get_lvl_appl_to_fund
5209 (p_poous_lvl_appl_fund IN igs_he_poous.level_applicable_to_funding%TYPE,
5210 p_prg_lvl_appl_fund IN igs_he_st_prog.level_applicable_to_funding%TYPE,
5211 p_hesa_lvl_appl_fund OUT NOCOPY VARCHAR2)
5212 IS
5213 /***************************************************************
5214 Created By :
5215 Date Created By :
5216 Purpose : This procedure gets the Level applicable to HESA Funding Council
5217 Known Limitations,Enhancements or Remarks:
5218 Change History :
5219 Who When What
5220 ***************************************************************/
5221
5222 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
5223
5224 BEGIN
5225 l_he_code_map_val.association_code := 'OSS_HESA_FUNDLEV_ASSOC';
5226 l_he_code_map_val.map2 := Nvl(p_poous_lvl_appl_fund,
5227 p_prg_lvl_appl_fund);
5228
5229 IF l_he_code_map_val.map2 IS NOT NULL
5230 THEN
5231 igs_he_extract2_pkg.get_map_values
5232 (p_he_code_map_val => l_he_code_map_val,
5233 p_value_from => 'MAP1',
5234 p_return_value => p_hesa_lvl_appl_fund);
5235
5236 END IF;
5237
5238 EXCEPTION
5239 WHEN OTHERS
5240 THEN
5241 write_to_log (SQLERRM);
5242 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5243 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_lvl_appl_to_fund');
5244 IGS_GE_MSG_STACK.ADD;
5245 App_Exception.Raise_Exception;
5246 END get_lvl_appl_to_fund;
5247
5248
5249 PROCEDURE get_comp_pyr_study(
5250 p_susa_comp_pyr_study IN igs_he_en_susa.complete_pyr_study_cd%TYPE,
5251 p_fundlev IN VARCHAR2,
5252 p_spcstu IN VARCHAR2,
5253 p_notact IN VARCHAR2,
5254 p_mode IN VARCHAR2,
5255 p_typeyr IN VARCHAR2,
5256 p_crse_rqr_complete_ind IN igs_en_stdnt_ps_att.course_rqrmnt_complete_ind%TYPE,
5257 p_crse_req_complete_dt IN igs_en_stdnt_ps_att.course_rqrmnts_complete_dt%TYPE,
5258 p_disc_reason_cd IN igs_en_stdnt_ps_att.discontinuation_reason_cd%TYPE,
5259 p_discont_dt IN igs_en_stdnt_ps_att.discontinued_dt%TYPE,
5260 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
5261 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE,
5262 p_person_id IN igs_en_stdnt_ps_att.person_id%TYPE,
5263 p_course_cd IN igs_en_stdnt_ps_att.course_cd%TYPE,
5264 p_hesa_comp_pyr_study OUT NOCOPY VARCHAR2) IS
5265 /***************************************************************
5266 Created By :
5267 Date Created By :
5268 Purpose : This procedure gets completion of year of program of study
5269 Known Limitations,Enhancements or Remarks:
5270 Change History :
5271 WHO WHEN WHAT
5272 ayedubat 16-MAR-04 Changed the whole logic for FUNDCOMP field derivation as
5273 part of HEFD311 - July 2004 Changes enhancement Bug, 2956444
5274 ayedubat 15-JUN-04 Changed the logic to derive the latest progression outcome
5275 type for the student program attempt Bug, 3675471
5276 jtmathew 01-FEB-06 Modified procedure to return 1 if student completed requirements
5277 of program before or during the HESA reporting period
5278 ***************************************************************/
5279
5280 l_he_code_map_val IGS_HE_CODE_MAP_VAL%ROWTYPE := NULL;
5281 l_progression_out_type IGS_PR_STDNT_PR_OU.progression_outcome_type%TYPE;
5282 l_prev_start_dt IGS_CA_INST.start_dt%TYPE;
5283 l_prev_applied_dt IGS_PR_STDNT_PR_OU.applied_dt%TYPE;
5284 l_prev_decision_dt IGS_PR_STDNT_PR_OU.decision_dt%TYPE;
5285 l_minimum_date DATE;
5286
5287 -- Cursor to fetch the STudent Progression Outcome Type
5288 CURSOR cur_prog_out_type (cp_person_id igs_en_stdnt_ps_att.person_id%TYPE,
5289 cp_course_cd igs_en_stdnt_ps_att.course_cd%TYPE,
5290 cp_enrl_start_dt igs_he_submsn_header.enrolment_start_date%TYPE,
5291 cp_enrl_end_dt igs_he_submsn_header.enrolment_end_date%TYPE) IS
5292 SELECT progression_outcome_type,ca.start_dt , spo.decision_dt, spo.applied_dt
5293 FROM IGS_PR_STDNT_PR_OU spo,
5294 IGS_CA_INST ca
5295 WHERE spo.person_id = cp_person_id AND
5296 spo.course_cd = cp_course_cd AND
5297 -- Select Approved Progression Outcomes
5298 spo.decision_status = 'APPROVED' AND
5299 -- Select Progression Outcome records that overlap the HESA reporting period
5300 spo.prg_cal_type = ca. cal_type AND
5301 spo.prg_ci_sequence_number = ca.sequence_number AND
5302 ca.start_dt <= cp_enrl_end_dt AND
5303 ca.end_dt >= cp_enrl_start_dt
5304 -- If multiple outcome types records exist overlapping the HESA reporting period then use the progression
5305 -- record with latest progression calendar.
5306 -- If there are multiple approved outcome types for the same Period that have been applied then
5307 -- use the one with the latest Applied date and
5308 -- If multiple approved outcome types exist for the same Period that have been applied and
5309 -- have the same applied Applied date use the one with the latest Decision Date
5310 ORDER BY ca.start_dt DESC, spo.applied_dt DESC, spo.decision_dt DESC;
5311
5312 BEGIN
5313
5314 -- If Value exists for the completion of program year field at
5315 -- Student Unit Set Attempt HESA details Level
5316 IF p_susa_comp_pyr_study IS NOT NULL THEN
5317
5318 l_he_code_map_val := NULL;
5319 l_he_code_map_val.association_code := 'OSS_HESA_FUNDCOMP_ASSOC';
5320 l_he_code_map_val.map2 := p_susa_comp_pyr_study;
5321
5322 igs_he_extract2_pkg.get_map_values(
5323 p_he_code_map_val => l_he_code_map_val,
5324 p_value_from => 'MAP1',
5325 p_return_value => p_hesa_comp_pyr_study);
5326
5327 ELSE
5328
5329 -- If the value of the field 154 - Level Applicable to Funding Council HESES (FUNDLEV) is '99'
5330 IF p_fundlev = '99' THEN
5331 p_hesa_comp_pyr_study := '9';
5332
5333 ELSE
5334
5335 -- To cater for reporting requirements for visiting and exchange students
5336 -- If value exists for the field 28 - Special Students (SPCSTU) then
5337 IF p_spcstu IS NOT NULL THEN
5338
5339 -- Get HESA mapped value from the mapping between SPCSTU and FUNDCOMP
5340 l_he_code_map_val := NULL;
5341 l_he_code_map_val.association_code := 'HESA_FUNDCOMP_SPCSTU_ASSOC';
5342 l_he_code_map_val.map2 := p_spcstu;
5343
5344 igs_he_extract2_pkg.get_map_values(
5345 p_he_code_map_val => l_he_code_map_val,
5346 p_value_from => 'MAP1',
5347 p_return_value => p_hesa_comp_pyr_study);
5348
5349 END IF;
5350
5351 -- If no value derived and value exists for the field 152 - Suspension of Active Studies (NOTACT)
5352 -- and field 153 - Type of Programme year(TYPEYR) then
5353 -- To cater for reporting requirements for suspended students
5354 IF p_hesa_comp_pyr_study IS NULL AND p_notact IS NOT NULL AND p_typeyr IS NOT NULL THEN
5355
5356 -- Get HESA mapped value from the mapping between NOTACT, TYPEYR and FUNDCOMP
5357 l_he_code_map_val := NULL;
5358 l_he_code_map_val.association_code := 'HESA_FUNDCOMP_NOTACT_ASSOC';
5359 l_he_code_map_val.map2 := p_typeyr;
5360 l_he_code_map_val.map3 := p_notact;
5361
5362 igs_he_extract2_pkg.get_map_values(
5363 p_he_code_map_val => l_he_code_map_val,
5364 p_value_from => 'MAP1',
5365 p_return_value => p_hesa_comp_pyr_study);
5366
5367 END IF;
5368
5369 -- If no value derived for the FUNDCOMP field and value exists for field 70 - MODE and 153 - TYPEYR
5370 -- To cater for reporting requirements for dormant students
5371 IF p_hesa_comp_pyr_study IS NULL AND p_mode IS NOT NULL AND p_typeyr IS NOT NULL THEN
5372
5373 -- Get HESA mapped value from the mapping between MODE, TYPEYR and FUNDCOMP
5374 l_he_code_map_val := NULL;
5375 l_he_code_map_val.association_code := 'HESA_FUNDCOMP_MODE_ASSOC';
5376 l_he_code_map_val.map2 := p_typeyr;
5377 l_he_code_map_val.map3 := p_mode;
5378
5379 igs_he_extract2_pkg.get_map_values(
5380 p_he_code_map_val => l_he_code_map_val,
5381 p_value_from => 'MAP1',
5382 p_return_value => p_hesa_comp_pyr_study);
5383
5384 END IF;
5385
5386 -- If no value derived for the FUNDCOMP field then
5387 IF p_hesa_comp_pyr_study IS NULL THEN
5388
5389 -- If student has completed requirements of program before or during the HESA reporting period
5390 IF p_crse_rqr_complete_ind = 'Y' AND
5391 p_crse_req_complete_dt <= p_enrl_end_dt THEN
5392
5393 p_hesa_comp_pyr_study := '1';
5394
5395 -- If the student has left but has not completed the requirements of the program
5396 ELSIF p_typeyr IS NOT NULL THEN
5397
5398 IF p_discont_dt IS NOT NULL THEN
5399
5400 -- Get HESA mapped value from mapping between leaving reason, TYPEYR field and FUNDCOMP
5401 l_he_code_map_val := NULL;
5402 l_he_code_map_val.association_code := 'OSS_FUNDCOMP_RSNLEAVE_ASSOC';
5403 l_he_code_map_val.map2 := p_typeyr;
5404 l_he_code_map_val.map3 := p_disc_reason_cd;
5405
5406 igs_he_extract2_pkg.get_map_values(
5407 p_he_code_map_val => l_he_code_map_val,
5408 p_value_from => 'MAP1',
5409 p_return_value => p_hesa_comp_pyr_study);
5410
5411 ELSE
5412
5413 l_progression_out_type := NULL;
5414 l_prev_start_dt := NULL;
5415 l_prev_applied_dt := NULL;
5416 l_prev_decision_dt := NULL;
5417 l_minimum_date := igs_ge_date.igsdate('1900/01/01');
5418
5419 FOR prog_out_type_rec IN cur_prog_out_type(p_person_id, p_course_cd, p_enrl_start_dt, p_enrl_end_dt) LOOP
5420
5421 -- Compare the current row whether better then the previous row in the order by
5422 -- Calendar Start Date, Applied Date and Decision Date
5423
5424 -- If the current Caledar Start Date is greater than the previous Calendar Start Date
5425 -- Then consider the current
5426 IF NVL(l_prev_start_dt, l_minimum_date ) < NVL(prog_out_type_rec.start_dt, l_minimum_date ) THEN
5427 l_progression_out_type := prog_out_type_rec.progression_outcome_type;
5428
5429 -- If the Calendar Start Date is equal for both the records then
5430 -- Check for the Applied Date
5431 ELSIF NVL(l_prev_start_dt, l_minimum_date) = NVL(prog_out_type_rec.start_dt,l_minimum_date ) THEN
5432
5433 -- If the current Applied Date is greater than the previous Applied Date
5434 IF NVL(l_prev_applied_dt, l_minimum_date) < NVL(prog_out_type_rec.applied_dt,l_minimum_date ) THEN
5435 l_progression_out_type := prog_out_type_rec.progression_outcome_type;
5436
5437 -- If the Applied Date is equal for both the records then
5438 -- Check the Decision Date
5439 ELSIF NVL(l_prev_applied_dt,l_minimum_date ) = NVL(prog_out_type_rec.applied_dt,l_minimum_date ) THEN
5440
5441 IF NVL(l_prev_decision_dt,l_minimum_date ) <= NVL(prog_out_type_rec.decision_dt, l_minimum_date) THEN
5442 l_progression_out_type := prog_out_type_rec.progression_outcome_type;
5443 END IF;
5444
5445 END IF;
5446
5447 END IF;
5448
5449 -- Assigning the current record values
5450 l_prev_start_dt := prog_out_type_rec.start_dt;
5451 l_prev_applied_dt := prog_out_type_rec.applied_dt;
5452 l_prev_decision_dt := prog_out_type_rec.decision_dt;
5453
5454 END LOOP;
5455
5456 -- If a progression outcome type exists for the student program attempt then
5457 IF l_progression_out_type IS NOT NULL THEN
5458
5459 -- GET HESA mapped value from the mapping between TYPEYR and progression outcome type to FUNDCOMP
5460 l_he_code_map_val := NULL;
5461 l_he_code_map_val.association_code := 'OSS_FUNDCOMP_PROGOUT_ASSOC';
5462 l_he_code_map_val.map2 := p_typeyr;
5463 l_he_code_map_val.map3 := l_progression_out_type;
5464
5465 igs_he_extract2_pkg.get_map_values(
5466 p_he_code_map_val => l_he_code_map_val,
5467 p_value_from => 'MAP1',
5468 p_return_value => p_hesa_comp_pyr_study);
5469
5470 ELSE
5471
5472 -- student has not left and no progression outcome type exists,
5473 -- so the assumption is that the student has completed the year successfully
5474 -- Get HESA mapped value from the mapping between TYPEYR and FUNDCOMP
5475 l_he_code_map_val := NULL;
5476 l_he_code_map_val.association_code := 'OSS_FUNDCOMP_TYPEYR_ASSOC';
5477 l_he_code_map_val.map2 := p_typeyr;
5478
5479 igs_he_extract2_pkg.get_map_values(
5480 p_he_code_map_val => l_he_code_map_val,
5481 p_value_from => 'MAP1',
5482 p_return_value => p_hesa_comp_pyr_study);
5483
5484 END IF;
5485
5486 END IF;
5487
5488 END IF; -- p_typeyr IS NOT NULL
5489
5490 END IF; -- p_hesa_comp_pyr_study IS NULL
5491
5492 END IF; -- p_fundlev = '99'
5493
5494 END IF; -- p_susa_comp_pyr_study IS NULL
5495
5496 EXCEPTION
5497 WHEN OTHERS THEN
5498 write_to_log (SQLERRM);
5499 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5500 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_comp_pyr_study');
5501 IGS_GE_MSG_STACK.ADD;
5502 App_Exception.Raise_Exception;
5503
5504 END get_comp_pyr_study;
5505
5506
5507
5508 PROCEDURE get_destination
5509 (p_oss_destination IN igs_he_st_spa.destination%TYPE,
5510 p_hesa_destination OUT NOCOPY VARCHAR2)
5511 IS
5512 /***************************************************************
5513 Created By :
5514 Date Created By :
5515 Purpose : This procedure gets the destination
5516 Known Limitations,Enhancements or Remarks:
5517 Change History :
5518 Who When What
5519 ***************************************************************/
5520
5521 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
5522
5523 BEGIN
5524 l_he_code_map_val.association_code := 'OSS_HESA_DESTIN_ASSOC';
5525 l_he_code_map_val.map2 := p_oss_destination;
5526
5527 IF l_he_code_map_val.map2 IS NOT NULL
5528 THEN
5529 igs_he_extract2_pkg.get_map_values
5530 (p_he_code_map_val => l_he_code_map_val,
5531 p_value_from => 'MAP1',
5532 p_return_value => p_hesa_destination);
5533
5534 END IF;
5535
5536 EXCEPTION
5537 WHEN OTHERS
5538 THEN
5539 write_to_log (SQLERRM);
5540 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5541 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_destination');
5542 IGS_GE_MSG_STACK.ADD;
5543 App_Exception.Raise_Exception;
5544 END get_destination;
5545
5546
5547
5548 PROCEDURE get_itt_outcome
5549 (p_oss_itt_outcome IN igs_he_st_spa.itt_prog_outcome%TYPE,
5550 p_teach_train_prg IN igs_he_st_spa.teacher_train_prog_id%TYPE,
5551 p_hesa_itt_outcome OUT NOCOPY VARCHAR2)
5552 IS
5553 /***************************************************************
5554 Created By :
5555 Date Created By :
5556 Purpose : This procedure gets the Outcome of ITT Programme
5557 Known Limitations,Enhancements or Remarks:
5558 Change History :
5559 Who When What
5560 ***************************************************************/
5561
5562 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
5563
5564 BEGIN
5565
5566 IF p_oss_itt_outcome IS NOT NULL
5567 AND p_teach_train_prg IN ('1','6','7')
5568 THEN
5569 l_he_code_map_val.association_code := 'OSS_HESA_OUTCOME_ASSOC';
5570 l_he_code_map_val.map2 := p_oss_itt_outcome;
5571 igs_he_extract2_pkg.get_map_values
5572 (p_he_code_map_val => l_he_code_map_val,
5573 p_value_from => 'MAP1',
5574 p_return_value => p_hesa_itt_outcome);
5575
5576 END IF;
5577
5578 EXCEPTION
5579 WHEN OTHERS
5580 THEN
5581 write_to_log (SQLERRM);
5582 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5583 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_itt_outcome');
5584 IGS_GE_MSG_STACK.ADD;
5585 App_Exception.Raise_Exception;
5586 END get_itt_outcome;
5587
5588
5589 PROCEDURE get_ufi_place
5590 (p_oss_ufi_place IN igs_he_st_spa.ufi_place%TYPE,
5591 p_hesa_ufi_place OUT NOCOPY VARCHAR2)
5592 IS
5593 /***************************************************************
5594 Created By :
5595 Date Created By :
5596 Purpose : This procedure gets the ufi place
5597 Known Limitations,Enhancements or Remarks:
5598 Change History :
5599 Who When What
5600 ***************************************************************/
5601
5602 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
5603
5604 BEGIN
5605 l_he_code_map_val.association_code := 'OSS_HESA_UFI_ASSOC';
5606 l_he_code_map_val.map2 := p_oss_ufi_place;
5607
5608 IF l_he_code_map_val.map2 IS NOT NULL
5609 THEN
5610 igs_he_extract2_pkg.get_map_values
5611 (p_he_code_map_val => l_he_code_map_val,
5612 p_value_from => 'MAP1',
5613 p_return_value => p_hesa_ufi_place);
5614
5615 END IF;
5616
5617 EXCEPTION
5618 WHEN OTHERS
5619 THEN
5620 write_to_log (SQLERRM);
5621 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5622 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_ufi_place');
5623 IGS_GE_MSG_STACK.ADD;
5624 App_Exception.Raise_Exception;
5625 END get_ufi_place;
5626
5627
5628
5629 PROCEDURE get_franchising_activity
5630 (p_susa_franch_activity IN igs_he_en_susa.franchising_activity%TYPE,
5631 p_poous_franch_activity IN igs_he_poous.franchising_activity%TYPE,
5632 p_prog_franch_activity IN igs_he_st_prog.franchising_activity%TYPE,
5633 p_hesa_franch_activity OUT NOCOPY VARCHAR2)
5634 IS
5635 /***************************************************************
5636 Created By :
5637 Date Created By :
5638 Purpose : This procedure gets the Franchising activity
5639 Known Limitations,Enhancements or Remarks:
5640 Change History :
5641 Who When What
5642 ***************************************************************/
5643
5644 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
5645
5646 BEGIN
5647 l_he_code_map_val.association_code := 'OSS_HESA_FRAN_ASSOC';
5648 l_he_code_map_val.map2 := Nvl(Nvl(p_susa_franch_activity,
5649 p_poous_franch_activity),
5650 p_prog_franch_activity);
5651
5652 IF l_he_code_map_val.map2 IS NOT NULL
5653 THEN
5654 igs_he_extract2_pkg.get_map_values
5655 (p_he_code_map_val => l_he_code_map_val,
5656 p_value_from => 'MAP1',
5657 p_return_value => p_hesa_franch_activity);
5658
5659 END IF;
5660
5661 EXCEPTION
5662 WHEN OTHERS
5663 THEN
5664 write_to_log (SQLERRM);
5665 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5666 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_franchising_activity');
5667 IGS_GE_MSG_STACK.ADD;
5668 App_Exception.Raise_Exception;
5669 END get_franchising_activity;
5670
5671
5672
5673 PROCEDURE get_social_class_ind
5674 (p_spa_social_class_ind IN igs_he_st_spa.social_class_ind%TYPE,
5675 p_adm_social_class_ind IN igs_he_ad_dtl.social_class_cd%TYPE,
5676 p_hesa_social_class_ind OUT NOCOPY VARCHAR2)
5677 IS
5678 /***************************************************************
5679 Created By :
5680 Date Created By :
5681 Purpose : This procedure gets the Social Class Indicator
5682 Known Limitations,Enhancements or Remarks:
5683 Change History :
5684 Who When What
5685 ***************************************************************/
5686
5687 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
5688
5689 BEGIN
5690 l_he_code_map_val.association_code := 'UC_OSS_HE_SOC_ASSOC';
5691 l_he_code_map_val.map2 := Nvl(p_spa_social_class_ind,
5692 p_adm_social_class_ind) ;
5693
5694 IF l_he_code_map_val.map2 IS NOT NULL
5695 THEN
5696 igs_he_extract2_pkg.get_map_values
5697 (p_he_code_map_val => l_he_code_map_val,
5698 p_value_from => 'MAP3',
5699 p_return_value => p_hesa_social_class_ind);
5700
5701 END IF;
5702
5703 EXCEPTION
5704 WHEN OTHERS
5705 THEN
5706 write_to_log (SQLERRM);
5707 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5708 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_social_class_ind');
5709 IGS_GE_MSG_STACK.ADD;
5710 App_Exception.Raise_Exception;
5711 END get_social_class_ind;
5712
5713
5714
5715 PROCEDURE get_occupation_code
5716 (p_spa_occupation_code IN igs_he_st_spa.occupation_code%TYPE,
5717 p_hesa_occupation_code OUT NOCOPY VARCHAR2)
5718 IS
5719 /***************************************************************
5720 Created By :
5721 Date Created By :
5722 Purpose : This procedure gets the Occupation Codes
5723 Known Limitations,Enhancements or Remarks:
5724 Change History :
5725 Who When What
5726 ***************************************************************/
5727
5728 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
5729
5730 BEGIN
5731 l_he_code_map_val.association_code := 'UC_OSS_HE_OCC_ASSOC';
5732 l_he_code_map_val.map2 := p_spa_occupation_code;
5733
5734 IF l_he_code_map_val.map2 IS NOT NULL
5735 THEN
5736 igs_he_extract2_pkg.get_map_values
5737 (p_he_code_map_val => l_he_code_map_val,
5738 p_value_from => 'MAP3',
5739 p_return_value => p_hesa_occupation_code);
5740
5741 END IF;
5742
5743 EXCEPTION
5744 WHEN OTHERS
5745 THEN
5746 write_to_log (SQLERRM);
5747 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5748 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_occupation_code');
5749 IGS_GE_MSG_STACK.ADD;
5750 App_Exception.Raise_Exception;
5751 END get_occupation_code;
5752
5753
5754
5755 PROCEDURE get_inst_last_attended
5756 (p_person_id IN igs_pe_person.person_id%TYPE,
5757 p_com_date IN DATE,
5758 p_inst_last_att OUT NOCOPY VARCHAR2,
5759 p_enrl_start_dt igs_he_submsn_header.enrolment_start_date%TYPE,
5760 p_enrl_end_dt igs_he_submsn_header.enrolment_end_date%TYPE
5761 )
5762
5763 IS
5764 /***************************************************************
5765 Created By :
5766 Date Created By :
5767 Purpose : This procedure gets the School / Inst Last attended.
5768 Known Limitations,Enhancements or Remarks:
5769 Change History :
5770 Who When What
5771 rbezawad 17-Sep-03 Modified the process to derive the "institution last Attended" field from Academic History
5772 rather than from Attendence Hisotry w.r.t. UCFD210 Build, Bug 289354.
5773 AYEDUBAT 17-Oct-03 Added a logic to appened p_inst_last_att with 'H',
5774 if it holds the govt_institution_cd value for bug, 3125475
5775 uudayapr 02-Dec-2003 ENH#3291662 modified get_inst_last_attended procedure added two new parameters and also the cursor c_heinst
5776 as a part of HECR212 -SSEDED ORGANIZATIONAL ALTERNATE IDENTIFIERS INTEGRATION build.
5777 jtmathew 21-Apr-2005 Modifications to c_inst for bug 4043591
5778 anwest 09-Jun-04 Changes for bug #4401841
5779 sjlaport 07-Jun-2005 Modifications for bug 4407917
5780 ***************************************************************/
5781
5782 --Get the institute last attended from Academic History
5783 -- Modified the cusor to add a new condition, end_date IS NULL
5784 -- to fetch the record, even if end_date column is NULL for bug, 3125475
5785
5786 CURSOR c_inst IS
5787 SELECT institution_code,
5788 NVL(end_date, TO_DATE('01-01-1500', 'DD-MM-YYYY')) end_date_al,
5789 creation_date
5790 FROM igs_ad_acad_history_v
5791 WHERE person_id = p_person_id
5792 AND (end_date IS NULL OR end_date < p_com_date)
5793 ORDER BY end_date_al DESC, creation_date DESC;
5794
5795 -- MODIFIED THE CURSOR ASA PART OF ENH#3291662 BUILD.
5796 CURSOR c_heinst (p_inst_cd VARCHAR2 ) IS
5797 SELECT org_alternate_id
5798 FROM igs_or_org_alt_ids oai,igs_or_org_alt_idtyp oait
5799 WHERE oai.org_structure_id = p_inst_cd
5800 AND oai.org_structure_type = 'INSTITUTE'
5801 AND oai.org_alternate_id_type = oait.org_alternate_id_type
5802 AND oait.system_id_type = 'HESA_INST'
5803 AND ( oai.start_date <= p_enrl_end_dt
5804 AND
5805 (oai.end_date IS NULL OR oai.end_date >=p_enrl_start_dt)
5806 )
5807 ORDER BY oai.start_date DESC;
5808
5809 -- anwest 09-Jun-05
5810 -- updated cursor for HZ_PARTIES.PARTY_NUMBER issue - bug #4401841
5811 CURSOR c_gvinst (p_inst_cd VARCHAR2) IS
5812 SELECT ihp.oi_govt_institution_cd govt_institution_cd
5813 FROM igs_pe_hz_parties ihp
5814 WHERE ihp.oss_org_unit_cd = p_inst_cd;
5815
5816 l_oss_inst_cd igs_ad_acad_history_v.institution_code%TYPE;
5817 l_year DATE;
5818 l_creation_date DATE;
5819 l_org_alternate_id igs_or_org_alt_ids_v.org_alternate_id%TYPE;
5820 l_govt_institution_cd igs_pe_hz_parties.oi_govt_institution_cd%TYPE;
5821 l_he_code_map_val igs_he_code_map_val%ROWTYPE;
5822
5823 BEGIN
5824
5825 --Get the institute last attended from Academic History
5826 OPEN c_inst;
5827 FETCH c_inst INTO l_oss_inst_cd, l_year, l_creation_date;
5828
5829 CLOSE c_inst;
5830
5831 IF l_oss_inst_cd IS NOT NULL
5832 THEN
5833 --Get the the current alternate institution code with type "HESA_INST" for OSS institution code.
5834 OPEN c_heinst (p_inst_cd => l_oss_inst_cd ) ;
5835 FETCH c_heinst INTO l_org_alternate_id;
5836
5837 IF c_heinst%FOUND THEN
5838 p_inst_last_att := l_org_alternate_id;
5839 ELSE
5840 --Get the Government Institution Code for the Institution.
5841 OPEN c_gvinst (l_oss_inst_cd) ;
5842 FETCH c_gvinst INTO l_govt_institution_cd;
5843 CLOSE c_gvinst;
5844 IF l_govt_institution_cd IS NOT NULL THEN
5845 p_inst_last_att := l_govt_institution_cd;
5846
5847 IF p_inst_last_att NOT IN ('4901', '4911', '4921', '4931', '4941') THEN
5848
5849 IF SUBSTR(p_inst_last_att,1,1) <> 'H' THEN
5850 p_inst_last_att := 'H' || p_inst_last_att;
5851 END IF;
5852
5853 END IF;
5854
5855 ELSE
5856 --Get the UCAS mapped value for the Institution Code if exists
5857 l_he_code_map_val := NULL ;
5858 l_he_code_map_val.association_code := 'UC_OSS_HE_INS_ASSOC';
5859 l_he_code_map_val.map2 := l_oss_inst_cd;
5860 igs_he_extract2_pkg.get_map_values
5861 (p_he_code_map_val => l_he_code_map_val,
5862 p_value_from => 'MAP1',
5863 p_return_value => p_inst_last_att);
5864 IF p_inst_last_att IS NOT NULL THEN
5865 p_inst_last_att := 'U'||p_inst_last_att;
5866 END IF;
5867 END IF;
5868 END IF;
5869
5870 CLOSE c_heinst;
5871
5872 END IF; -- Institute Cd
5873
5874 EXCEPTION
5875 WHEN OTHERS
5876 THEN
5877 write_to_log (SQLERRM);
5878 IF c_inst%ISOPEN
5879 THEN
5880 CLOSE c_inst;
5881 END IF;
5882
5883 IF c_heinst%ISOPEN
5884 THEN
5885 CLOSE c_heinst;
5886 END IF;
5887
5888 IF c_gvinst%ISOPEN
5889 THEN
5890 CLOSE c_gvinst;
5891 END IF;
5892
5893 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5894 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_inst_last_attended');
5895 IGS_GE_MSG_STACK.ADD;
5896 App_Exception.Raise_Exception;
5897 END get_inst_last_attended;
5898
5899
5900
5901 PROCEDURE get_regulatory_body
5902 (p_course_cd IN igs_he_st_spa.course_cd%TYPE,
5903 p_version_number IN igs_he_st_spa.version_number%TYPE,
5904 p_hesa_regulatory_body OUT NOCOPY VARCHAR2)
5905 IS
5906 /***************************************************************
5907 Created By :
5908 Date Created By :
5909 Purpose : This procedure gets the Regulatory Body
5910 Known Limitations,Enhancements or Remarks:
5911 Change History :
5912 Who When What
5913 ***************************************************************/
5914
5915 CURSOR c_regbdy IS
5916 SELECT reference_cd
5917 FROM igs_ps_ref_cd
5918 WHERE reference_cd_type = 'REGBODY'
5919 AND course_cd = p_course_cd
5920 AND version_number = p_version_number;
5921
5922 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
5923
5924 BEGIN
5925 OPEN c_regbdy;
5926 FETCH c_regbdy INTO l_he_code_map_val.map2;
5927 CLOSE c_regbdy;
5928
5929 l_he_code_map_val.association_code := 'OSS_HESA_REG_BODY_ASSOC';
5930
5931 IF l_he_code_map_val.map2 IS NOT NULL
5932 THEN
5933 igs_he_extract2_pkg.get_map_values
5934 (p_he_code_map_val => l_he_code_map_val,
5935 p_value_from => 'MAP1',
5936 p_return_value => p_hesa_regulatory_body);
5937
5938 END IF;
5939
5940 EXCEPTION
5941 WHEN OTHERS
5942 THEN
5943 write_to_log (SQLERRM);
5944 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5945 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_regulatory_body');
5946 IGS_GE_MSG_STACK.ADD;
5947 App_Exception.Raise_Exception;
5948 END get_regulatory_body;
5949
5950
5951
5952 PROCEDURE get_nhs_fund_src
5953 (p_spa_nhs_fund_src IN igs_he_st_spa.nhs_funding_source%TYPE,
5954 p_prg_nhs_fund_src IN igs_he_st_spa.nhs_funding_source%TYPE,
5955 p_hesa_nhs_fund_src OUT NOCOPY VARCHAR2)
5956 IS
5957 /***************************************************************
5958 Created By :
5959 Date Created By :
5960 Purpose : This procedure gets the Source of NHS Funding
5961 Known Limitations,Enhancements or Remarks:
5962 Change History :
5963 Who When What
5964 ***************************************************************/
5965
5966 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
5967
5968 BEGIN
5969 l_he_code_map_val.association_code := 'OSS_HESA_NHS_FUND_ASSOC';
5970 l_he_code_map_val.map2 := Nvl(p_spa_nhs_fund_src,
5971 p_prg_nhs_fund_src);
5972
5973 IF l_he_code_map_val.map2 IS NOT NULL
5974 THEN
5975 igs_he_extract2_pkg.get_map_values
5976 (p_he_code_map_val => l_he_code_map_val,
5977 p_value_from => 'MAP1',
5978 p_return_value => p_hesa_nhs_fund_src);
5979
5980 END IF;
5981
5982 EXCEPTION
5983 WHEN OTHERS
5984 THEN
5985 write_to_log (SQLERRM);
5986 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
5987 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_nhs_fund_src');
5988 IGS_GE_MSG_STACK.ADD;
5989 App_Exception.Raise_Exception;
5990 END get_nhs_fund_src;
5991
5992
5993
5994 PROCEDURE get_nhs_employer
5995 (p_spa_nhs_employer IN igs_he_st_spa.nhs_employer%TYPE,
5996 p_hesa_nhs_employer OUT NOCOPY VARCHAR2)
5997 IS
5998 /***************************************************************
5999 Created By :
6000 Date Created By :
6001 Purpose : This procedure gets the NHS Employer
6002 Known Limitations,Enhancements or Remarks:
6003 Change History :
6004 Who When What
6005 ***************************************************************/
6006
6007 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
6008
6009 BEGIN
6010 l_he_code_map_val.association_code := 'OSS_HESA_NHS_EMPLOY_ASSOC';
6011 l_he_code_map_val.map2 := p_spa_nhs_employer;
6012
6013 IF l_he_code_map_val.map2 IS NOT NULL
6014 THEN
6015 igs_he_extract2_pkg.get_map_values
6016 (p_he_code_map_val => l_he_code_map_val,
6017 p_value_from => 'MAP1',
6018 p_return_value => p_hesa_nhs_employer);
6019
6020 END IF;
6021
6022 EXCEPTION
6023 WHEN OTHERS
6024 THEN
6025 write_to_log (SQLERRM);
6026 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
6027 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_nhs_employer');
6028 IGS_GE_MSG_STACK.ADD;
6029 App_Exception.Raise_Exception;
6030 END get_nhs_employer;
6031
6032
6033 PROCEDURE get_qual_dets
6034 (p_person_id IN igs_pe_person.person_id%TYPE,
6035 p_course_cd IN igs_he_st_spa.course_cd%TYPE,
6036 p_hesa_qual IN VARCHAR2,
6037 p_no_of_qual OUT NOCOPY NUMBER,
6038 p_tariff_score OUT NOCOPY NUMBER)
6039 IS
6040 /***************************************************************
6041 Created By :
6042 Date Created By :
6043 Purpose : This procedure gets Number of Qualifications and Tariff Score
6044 Known Limitations,Enhancements or Remarks:
6045 Change History :
6046 Who When What
6047 smaddali Modified this cursor to take SUM of number_of_qual and tariff_score for bug 2671022
6048 Get the sum of the number of qualifications and tariff score for all the OSS qualifications
6049 mapped to the HESA qualification passed as a parameter.
6050 Bayadav 17-Feb-2003 Modified cursor c_qde to consider new UCAS tariff tables for referring to set up instead of
6051 refering to mapping tables as a part of UCAS tariff Build Bug #2717744
6052 ***************************************************************/
6053
6054 CURSOR c_qdet IS
6055 SELECT SUM(number_of_qual),
6056 SUM(tariff_score)
6057 FROM igs_he_st_spa_ut a,
6058 igs_he_ut_lvl_award b,
6059 igs_he_ut_calc_type c
6060 WHERE a.person_id = p_person_id
6061 AND a.course_cd = p_course_cd
6062 AND b.Tariff_calc_type_cd = c.Tariff_calc_type_cd
6063 AND a.qualification_level = b.award_cd
6064 AND b.tariff_level_cd = p_hesa_qual
6065 AND b.closed_ind = 'N'
6066 AND c.External_calc_ind = 'Y'
6067 And c.closed_ind = 'N';
6068
6069
6070 BEGIN
6071 OPEN c_qdet;
6072 FETCH c_qdet INTO p_no_of_qual,
6073 p_tariff_score ;
6074 CLOSE c_qdet;
6075
6076 EXCEPTION
6077 WHEN OTHERS
6078 THEN
6079 write_to_log (SQLERRM);
6080 IF c_qdet%ISOPEN
6081 THEN
6082 CLOSE c_qdet;
6083 END IF;
6084
6085 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
6086 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_qual_dets');
6087 IGS_GE_MSG_STACK.ADD;
6088 App_Exception.Raise_Exception;
6089 END get_qual_dets;
6090
6091
6092
6093 PROCEDURE get_module_dets
6094 (p_person_id IN igs_pe_person.person_id%TYPE,
6095 p_course_cd IN igs_en_stdnt_ps_att.course_cd%TYPE,
6096 p_version_number IN igs_en_stdnt_ps_att.version_number%TYPE,
6097 p_student_inst_number IN igs_he_st_spa.student_inst_number%TYPE,
6098 p_cal_type IN igs_en_stdnt_ps_att.cal_type%TYPE,
6099 p_enrl_start_dt IN DATE,
6100 p_enrl_end_dt IN DATE,
6101 p_offset_days IN NUMBER,
6102 p_module_rec IN OUT NOCOPY mod_rec,
6103 p_total_recs OUT NOCOPY NUMBER)
6104
6105 IS
6106 /***************************************************************
6107 Created By :
6108 Date Created By :
6109 Purpose : This procedure gets the Module Identifiers, the proportion of teaching in welsh for each and the result in each
6110 Known Limitations,Enhancements or Remarks:
6111 Change History :
6112 Who When What
6113 Bayadav 11-DEC-2002 As a part of bug #2694623 Included validation in case the result type returned from assessemnt procedure
6114 is NULL to return mi=odule result as 8 or 9
6115 smaddali 27-dec-2002 modified cursor c_mod to add condition that status in (enrolled,discontin,completed) ,bug 2702100
6116 smaddali 12-Mar-03 Modified cursor c_mod for performance issue , Bug#2839289 . Replaced Exists with a Union
6117 smaddali 27-Mar-03 Modified cursor c_mod for HEFD209, Bug#2717755 .
6118 knaraset 09-May-03 Modified cursor c_mod and c_outdt for multiple unit section build bug 2829262
6119 smaddali 23-Jun-03 Modified cursor c_mod,c_outdt for bug# 2950851,2950848 to get distinct units
6120 sarakshi 27-jun-03 Enh#2930935,modified cursor c_mod such that it picks up usec level enrolled
6121 credit points if exists else from the unit level
6122 jbaber 19-Jan-06 Exclude flagged units for HE305 - Extract Improvements
6123 ***************************************************************/
6124
6125 -- smaddali restructured the cursor for performance issue Bug#2839289
6126 -- smaddali replaced igs_as_suaai_v with igs_as_su_stmptout and added condition finalised_ind='Y' , Bug#2717755
6127 CURSOR c_mod IS
6128 SELECT DISTINCT a.unit_cd,
6129 a.version_number,
6130 d.prop_of_teaching_in_welsh,
6131 NVL(cps.enrolled_credit_points,b.enrolled_credit_points) enrolled_credit_point
6132 FROM igs_en_su_attempt_all a,
6133 igs_ps_unit_ver_all b,
6134 igs_he_st_spa_all c,
6135 igs_he_st_unt_vs_all d,
6136 igs_ps_usec_cps cps
6137 WHERE a.unit_cd = b.unit_cd
6138 AND a.version_number = b.version_number
6139 AND c.person_id = a.person_id
6140 AND c.course_cd = a.course_cd
6141 AND c.student_inst_number = p_student_inst_number
6142 AND b.unit_cd = d.unit_cd
6143 AND b.version_number = d.version_number
6144 AND a.person_id = p_person_id
6145 AND a.uoo_id = cps.uoo_id(+)
6146 AND NVL(d.exclude_flag, 'N') = 'N'
6147 AND a.unit_attempt_status IN ('ENROLLED','DISCONTIN','COMPLETED')
6148 AND a.ci_start_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt
6149 UNION
6150 SELECT DISTINCT a.unit_cd,
6151 a.version_number,
6152 d.prop_of_teaching_in_welsh,
6153 NVL(cps.enrolled_credit_points,b.enrolled_credit_points) enrolled_credit_point
6154 FROM igs_en_su_attempt_all a,
6155 igs_ps_unit_ver_all b,
6156 igs_he_st_spa_all c,
6157 igs_he_st_unt_vs_all d,
6158 igs_as_su_stmptout e,
6159 igs_ps_usec_cps cps
6160 WHERE a.unit_cd = b.unit_cd
6161 AND a.version_number = b.version_number
6162 AND c.person_id = a.person_id
6163 AND c.course_cd = a.course_cd
6164 AND c.student_inst_number = p_student_inst_number
6165 AND b.unit_cd = d.unit_cd
6166 AND b.version_number = d.version_number
6167 AND a.person_id = p_person_id
6168 AND e.person_id = a.person_id
6169 AND e.course_cd = a.course_cd
6170 AND e.uoo_id = a.uoo_id
6171 AND a.uoo_id = cps.uoo_id(+)
6172 AND e.outcome_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt
6173 AND e.finalised_outcome_ind = 'Y'
6174 AND NVL(d.exclude_flag, 'N') = 'N'
6175 AND a.unit_attempt_status IN ('ENROLLED','DISCONTIN','COMPLETED')
6176 ORDER BY enrolled_credit_point DESC;
6177
6178 CURSOR c_outdt (p_unit_cd igs_en_su_attempt.unit_cd%TYPE)
6179 IS
6180 SELECT sua.course_cd,
6181 sua.cal_type,
6182 sua.ci_sequence_number,
6183 sua.ci_end_dt,
6184 sua.unit_attempt_status,
6185 sua.no_assessment_ind,
6186 suo.outcome_dt,
6187 sua.uoo_id
6188 FROM igs_as_su_stmptout suo,
6189 igs_en_su_attempt_all sua,
6190 igs_he_st_spa_all spa
6191 WHERE suo.person_id = sua.person_id
6192 AND suo.course_cd = sua.course_cd
6193 AND suo.uoo_id = sua.uoo_id
6194 AND sua.person_id = spa.person_id
6195 AND sua.course_cd = spa.course_cd
6196 AND spa.student_inst_number = p_student_inst_number
6197 AND suo.outcome_dt BETWEEN p_enrl_start_dt AND p_enrl_end_dt
6198 AND suo.unit_cd = p_unit_cd
6199 AND suo.person_id = p_person_id
6200 AND suo.finalised_outcome_ind = 'Y'
6201 AND sua.unit_attempt_status IN ('ENROLLED','DISCONTIN','COMPLETED')
6202 ORDER BY suo.outcome_dt DESC ;
6203 c_outdt_rec c_outdt%ROWTYPE ;
6204
6205
6206 l_index NUMBER;
6207 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
6208 l_grading_schema_cd igs_as_suaai_v.grading_schema_cd%TYPE;
6209 l_gs_version_number igs_as_suaai_v.gs_version_number%TYPE;
6210 l_grade igs_as_suaai_v.grade%TYPE;
6211 l_s_result_type igs_as_grd_sch_grade.s_result_type%TYPE;
6212
6213 BEGIN
6214
6215 l_index := 1;
6216 p_total_recs := 0;
6217 -- loop thru each distinct unit of this person among all his program attempts with same instance number
6218 FOR l_c_mod IN c_mod
6219 LOOP
6220 -- store the Unit cd ,version number and proportion of teaching in welsh in the array
6221 p_module_rec.module_id(l_index) := l_c_mod.unit_cd || '.' ||To_Char(l_c_mod.version_number);
6222 p_module_rec.prop_in_welsh(l_index) := l_c_mod.prop_of_teaching_in_welsh;
6223
6224
6225 -- get the latest outcome for this unit among all the program attempts of this person with the same student instance number
6226 c_outdt_rec := NULL ;
6227 OPEN c_outdt (l_c_mod.unit_cd);
6228 FETCH c_outdt INTO c_outdt_rec ;
6229 CLOSE c_outdt;
6230
6231 l_s_result_type := NULL ;
6232 -- Get the result type , grading schema and grade for the identified unit attempt outcome for this person
6233 l_s_result_type := Igs_As_Gen_003.assp_get_sua_grade
6234 (p_person_id => p_person_id,
6235 p_course_cd => c_outdt_rec.course_cd,
6236 p_unit_cd => l_c_mod.unit_cd,
6237 p_cal_type => c_outdt_rec.cal_type,
6238 p_ci_sequence_number => c_outdt_rec.ci_sequence_number,
6239 p_unit_attempt_status => c_outdt_rec.unit_attempt_status,
6240 p_finalised_ind => 'Y',
6241 p_grading_schema_cd => l_grading_schema_cd,
6242 p_gs_version_number => l_gs_version_number,
6243 p_grade => l_grade,
6244 p_uoo_id => c_outdt_rec.uoo_id);
6245
6246 --To check for result type.In case result type is NULL ,then whether that unit is assessible or not
6247 IF l_s_result_type IS NULL THEN
6248 IF c_outdt_rec.no_assessment_ind = 'Y' THEN
6249 p_module_rec.module_result(l_index) := 9;
6250 ELSE
6251 p_module_rec.module_result(l_index) := 8;
6252 END IF;
6253 ELSE
6254 l_he_code_map_val := NULL ;
6255 l_he_code_map_val.association_code := 'GRADING_HESA_MODRES_ASSOC';
6256 l_he_code_map_val.map2 := l_grade;
6257 l_he_code_map_val.map3 := l_grading_schema_cd;
6258 igs_he_extract2_pkg.get_map_values
6259 (p_he_code_map_val => l_he_code_map_val,
6260 p_value_from => 'MAP1',
6261 p_return_value => p_module_rec.module_result(l_index));
6262
6263 IF c_outdt_rec.ci_end_dt < p_enrl_start_dt
6264 AND c_outdt_rec.outcome_dt > p_enrl_start_dt
6265 THEN
6266 IF p_module_rec.module_result(l_index) IS NOT NULL THEN
6267 -- Late Result
6268 -- smaddali initializing variable for bug 2950851
6269 l_he_code_map_val := NULL ;
6270 l_he_code_map_val.association_code := 'HESA_LATE_MODRES_ASSOC';
6271 l_he_code_map_val.map2 := p_module_rec.module_result(l_index);
6272 igs_he_extract2_pkg.get_map_values
6273 (p_he_code_map_val => l_he_code_map_val,
6274 p_value_from => 'MAP1',
6275 p_return_value => p_module_rec.module_result(l_index) );
6276 END IF ;
6277 END IF; -- Late result
6278 END IF; -- result type found
6279
6280 l_index := l_index + 1;
6281 IF l_index > 16
6282 THEN
6283 -- We dont want more than 16 modules.
6284 EXIT;
6285 END IF;
6286 END LOOP;
6287
6288 IF c_mod%ISOPEN
6289 THEN
6290 CLOSE c_mod;
6291 END IF;
6292
6293 -- Decrease count as it would be one more than total recs
6294 l_index := l_index - 1;
6295 IF l_index > 16
6296 THEN
6297 -- total modules found more than 16
6298 p_total_recs := 16 ;
6299 ELSE
6300 -- total modules found <= 16
6301 p_total_recs := l_index ;
6302 END IF;
6303
6304 EXCEPTION
6305 WHEN OTHERS
6306 THEN
6307 write_to_log (SQLERRM);
6308 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
6309 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_module_dets');
6310 IGS_GE_MSG_STACK.ADD;
6311 App_Exception.Raise_Exception;
6312 END get_module_dets;
6313
6314
6315
6316 PROCEDURE get_mode_of_study
6317 (p_person_id IN igs_pe_person.person_id%TYPE,
6318 p_course_cd IN igs_he_st_spa.course_cd%TYPE,
6319 p_version_number IN igs_he_st_spa.version_number%TYPE,
6320 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
6321 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE,
6322 p_susa_study_mode IN igs_he_en_susa.study_mode%TYPE,
6323 p_poous_study_mode IN igs_he_poous.attendance_mode%TYPE,
6324 p_attendance_type IN igs_en_stdnt_ps_att.attendance_type%TYPE,
6325 p_mode_of_study OUT NOCOPY VARCHAR2)
6326
6327 IS
6328 /***************************************************************
6329 Created By :
6330 Date Created By :
6331 Purpose : This procedure gets Mode of Study
6332 Known Limitations,Enhancements or Remarks:
6333 Change History :
6334 Who When What
6335 AYEDUBAT 29-04-04 Changed the cursor, c_drm to add a new condition to check
6336 for approved intermissions, if approval is required for Bug, 3494224
6337 rnirwani 13-09-04 Changed the cursor, c_drm to exclude logically deleted intermission
6338 records as per Bug# 3885804
6339 jbaber 30-11-04 Consider mutiple intermission records for bug# 4037237
6340 Now calls isDormant function
6341 jbaber 26-01-06 Check if student is dormant even if source is susa or poous
6342 ***************************************************************/
6343
6344
6345
6346 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
6347 l_hesa_mode igs_he_code_map_val.map1%TYPE;
6348
6349 BEGIN
6350 l_he_code_map_val.association_code := 'OSS_HESA_MODE_ASSOC';
6351 l_he_code_map_val.map2 := Nvl(p_susa_study_mode,
6352 p_poous_study_mode);
6353
6354 IF l_he_code_map_val.map2 IS NOT NULL
6355 THEN
6356 igs_he_extract2_pkg.get_map_values
6357 (p_he_code_map_val => l_he_code_map_val,
6358 p_value_from => 'MAP1',
6359 p_return_value => l_hesa_mode);
6360
6361 ELSE
6362 l_he_code_map_val.association_code := 'OSS_HESA_ATTEND_MODE_ASSOC';
6363 l_he_code_map_val.map2 := p_attendance_type;
6364
6365 igs_he_extract2_pkg.get_map_values
6366 (p_he_code_map_val => l_he_code_map_val,
6367 p_value_from => 'MAP1',
6368 p_return_value => l_hesa_mode);
6369
6370 END IF; -- SPA / POOUS Study Mode check
6371
6372
6373 -- Check for Intermission
6374 IF NOT isDormant
6375 (p_person_id => p_person_id,
6376 p_course_cd => p_course_cd,
6377 p_version_number => p_version_number,
6378 p_enrl_start_dt => p_enrl_start_dt,
6379 p_enrl_end_dt => p_enrl_end_dt)
6380 THEN
6381 p_mode_of_study := l_hesa_mode;
6382
6383 ELSE
6384 -- Student Intermission exists
6385 IF l_hesa_mode IN ('01','02','12','13','14','23','24','25')
6386 THEN
6387 -- previously Full Time
6388 p_mode_of_study := '63';
6389 ELSE
6390 p_mode_of_study := '64';
6391 END IF;
6392 END IF;
6393
6394
6395 EXCEPTION
6396 WHEN OTHERS
6397 THEN
6398 write_to_log (SQLERRM);
6399
6400 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
6401 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_mode_of_study');
6402 IGS_GE_MSG_STACK.ADD;
6403 App_Exception.Raise_Exception;
6404 END get_mode_of_study;
6405
6406
6407
6408 FUNCTION isDormant
6409 (p_person_id IN igs_pe_person.person_id%TYPE,
6410 p_course_cd IN igs_he_st_spa.course_cd%TYPE,
6411 p_version_number IN igs_he_st_spa.version_number%TYPE,
6412 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
6413 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE)
6414 RETURN BOOLEAN IS
6415 /***************************************************************
6416 Created By : Jonathan Baber
6417 Date Created By : 29th November 2004
6418 Purpose : Determines if a student has been dormant over the reporting
6419 period. Multiple intermission records are accounted for.
6420 Known Limitations,Enhancements or Remarks:
6421 Change History
6422 Who When What
6423 jbaber 29-Nov-04 Created
6424 jbaber 26-Jan-06 Student is dormant if l_end_dt < l_start_dt for bug 4459794
6425 ***************************************************************/
6426
6427 CURSOR c_spa_dt IS
6428 SELECT commencement_dt,
6429 discontinued_dt,
6430 course_rqrmnts_complete_dt
6431 FROM igs_en_stdnt_ps_att_all
6432 WHERE person_id = p_person_id
6433 AND course_cd = p_course_cd
6434 AND version_number = p_version_number;
6435
6436 CURSOR c_drm(cp_start_dt DATE, cp_end_dt DATE) IS
6437 SELECT start_dt,
6438 end_dt
6439 FROM igs_en_stdnt_ps_intm spi
6440 WHERE spi.person_id = p_person_id
6441 AND spi.course_cd = p_course_cd
6442 AND spi.logical_delete_date = TO_DATE('31-12-4712','DD-MM-YYYY')
6443 AND spi.start_dt<= cp_end_dt
6444 AND NVL(spi.end_dt,cp_end_dt) >= cp_start_dt
6445 AND (spi.approved = 'Y' OR
6446 EXISTS( SELECT 1 FROM igs_en_intm_types
6447 WHERE intermission_type = spi.intermission_type AND
6448 appr_reqd_ind = 'N' ))
6449 ORDER BY start_dt;
6450
6451 l_spa_dt c_spa_dt%ROWTYPE;
6452 l_start_dt DATE;
6453 l_end_dt DATE;
6454 l_full_intermission BOOLEAN := FALSE;
6455
6456 BEGIN
6457
6458 -- Get course requirements complete, commencement and discontinued date
6459 OPEN c_spa_dt;
6460 FETCH c_spa_dt INTO l_spa_dt;
6461 CLOSE c_spa_dt;
6462
6463 -- Start date is greatest of reporting start date and course commencement date
6464 l_start_dt := TRUNC(GREATEST(p_enrl_start_dt, NVL(l_spa_dt.commencement_dt,p_enrl_start_dt)));
6465
6466 -- End date is least of reporting start date, course discontinued date and course requirements complete date
6467 l_end_dt := TRUNC(LEAST(p_enrl_end_dt, NVL(l_spa_dt.discontinued_dt,p_enrl_end_dt), NVL(l_spa_dt.course_rqrmnts_complete_dt,p_enrl_end_dt)));
6468
6469 -- End date prior to start date implies course_rqrmnts_complete_dt or discontinue_dt is earlier than enrl_start_dt
6470 -- therefore student is dormant
6471 IF l_end_dt < l_start_dt THEN
6472 RETURN TRUE;
6473 END IF;
6474
6475 -- Check for Intermission
6476 FOR v_drm IN c_drm(l_start_dt, l_end_dt)
6477 LOOP
6478
6479 -- Record start date is AFTER period start date
6480 -- Therefor NOT full intermission
6481 IF v_drm.start_dt > l_start_dt THEN
6482 EXIT;
6483 END IF;
6484
6485 -- Record end date is AFTER period end date
6486 -- Therefore IS full intermission
6487 IF v_drm.end_dt >= l_end_dt THEN
6488 l_full_intermission := TRUE;
6489 EXIT;
6490 END IF;
6491
6492 l_start_dt := v_drm.end_dt+1;
6493
6494 END LOOP;
6495
6496 RETURN l_full_intermission;
6497
6498 EXCEPTION
6499 WHEN OTHERS
6500 THEN
6501 write_to_log (SQLERRM);
6502 IF c_drm%ISOPEN
6503 THEN
6504 CLOSE c_drm;
6505 END IF;
6506
6507 IF c_spa_dt%ISOPEN
6508 THEN
6509 CLOSE c_spa_dt;
6510 END IF;
6511
6512 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
6513 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.isDormant');
6514 IGS_GE_MSG_STACK.ADD;
6515 App_Exception.Raise_Exception;
6516 END isDormant;
6517
6518
6519 PROCEDURE get_mod_prop_fte
6520 (p_enrolled_credit_points IN igs_ps_unit_ver_v.enrolled_credit_points%TYPE,
6521 p_unit_level IN igs_ps_unit_ver_v.unit_level%TYPE,
6522 p_prop_of_fte OUT NOCOPY VARCHAR2)
6523
6524 IS
6525 /***************************************************************
6526 Created By :
6527 Date Created By :
6528 Purpose : This procedure gets the Proportion of FTE for Module Return
6529 Known Limitations,Enhancements or Remarks:
6530 Change History :
6531 Who When What
6532 smaddali Modified this procedure to check if l_annual_credit is a number before calculating fte , bug 2668966
6533 ***************************************************************/
6534
6535 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
6536 l_annual_credit NUMBER;
6537 l_credit igs_he_code_map_val.map1%TYPE ;
6538
6539 NOT_NUMBER_EXCEP EXCEPTION ;
6540
6541 BEGIN
6542
6543 l_he_code_map_val.association_code := 'LEVEL_ANNUAL_CREDIT_ASSOC';
6544 l_he_code_map_val.map2 := p_unit_level;
6545
6546 IF l_he_code_map_val.map2 IS NOT NULL
6547 THEN
6548 -- Get Annual Credit
6549 igs_he_extract2_pkg.get_map_values
6550 (p_he_code_map_val => l_he_code_map_val,
6551 p_value_from => 'MAP1',
6552 p_return_value => l_credit);
6553
6554 -- smaddali added the condition to check that l_annual_credit is a number field before calculating fte , bug 2668966
6555 BEGIN
6556 l_annual_credit := l_credit ;
6557 EXCEPTION
6558 WHEN VALUE_ERROR THEN
6559 RAISE NOT_NUMBER_EXCEP ;
6560 END ;
6561
6562 p_prop_of_fte := (p_enrolled_credit_points / l_annual_credit) * 100;
6563
6564 END IF;
6565
6566 EXCEPTION
6567 WHEN NOT_NUMBER_EXCEP THEN
6568 NULL ;
6569 WHEN OTHERS THEN
6570 write_to_log (SQLERRM);
6571 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
6572 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_mod_prop_fte');
6573 IGS_GE_MSG_STACK.ADD;
6574 App_Exception.Raise_Exception;
6575 END get_mod_prop_fte;
6576
6577
6578 PROCEDURE get_mod_prop_not_taught
6579 (p_unit_cd IN igs_he_st_unt_vs.unit_cd%TYPE,
6580 p_version_number IN igs_he_st_unt_vs.version_number%TYPE,
6581 p_prop_not_taught OUT NOCOPY VARCHAR2)
6582
6583 IS
6584 /***************************************************************
6585 Created By :
6586 Date Created By :
6587 Purpose : This procedure gets Proportion not taught by institution for a module
6588 Known Limitations,Enhancements or Remarks:
6589 Change History :
6590 Who When What
6591 anwest 09-Jun-04 Changes for bug #4401841
6592 ***************************************************************/
6593
6594 -- anwest 09-Jun-05
6595 -- updated cursor for HZ_PARTIES.PARTY_NUMBER issue - bug #4401841
6596 CURSOR c_perc IS
6597 SELECT SUM(percentage)
6598 FROM igs_ps_tch_resp a,
6599 igs_pe_hz_parties ihpou,
6600 igs_pe_hz_parties ihpinst
6601 WHERE a.unit_cd = p_unit_cd
6602 AND a.version_number = p_version_number
6603 AND a.org_unit_cd = ihpou.oss_org_unit_cd
6604 AND ihpou.institution_cd = ihpinst.oss_org_unit_cd
6605 AND NVL(ihpinst.oi_local_institution_ind,'N') = 'N' ;
6606
6607 BEGIN
6608
6609 OPEN c_perc ;
6610 FETCH c_perc INTO p_prop_not_taught;
6611 CLOSE c_perc ;
6612
6613 EXCEPTION
6614 WHEN OTHERS
6615 THEN
6616 write_to_log (SQLERRM);
6617 IF c_perc%ISOPEN
6618 THEN
6619 CLOSE c_perc;
6620 END IF;
6621
6622 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
6623 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_mod_prop_not_taught');
6624 IGS_GE_MSG_STACK.ADD;
6625 App_Exception.Raise_Exception;
6626 END get_mod_prop_not_taught;
6627
6628
6629
6630 PROCEDURE get_mod_oth_teach_inst
6631 (p_unit_cd IN igs_he_st_unt_vs.unit_cd%TYPE,
6632 p_version_number IN igs_he_st_unt_vs.version_number%TYPE,
6633 p_oth_teach_inst OUT NOCOPY VARCHAR2)
6634
6635 IS
6636 /***************************************************************
6637 Created By :
6638 Date Created By :
6639 Purpose : This procedure gets Proportion Other Insitution Providing Teaching
6640 Known Limitations,Enhancements or Remarks:
6641 Change History :
6642 Who When What
6643 smaddali Modified local_institution_ind='Y' to 'N' for bug 2427601
6644 anwest 09-Jun-04 Changes for bug #4401841
6645 ***************************************************************/
6646
6647 -- anwest 09-Jun-05
6648 -- updated cursor for HZ_PARTIES.PARTY_NUMBER issue - bug #4401841
6649 CURSOR c_oinst IS
6650 SELECT SUM(percentage) percentage,
6651 ihpinst.oi_govt_institution_cd govt_institution_cd
6652 FROM igs_ps_tch_resp a,
6653 igs_pe_hz_parties ihpou,
6654 igs_pe_hz_parties ihpinst
6655 WHERE a.unit_cd = p_unit_cd
6656 AND a.version_number = p_version_number
6657 AND a.org_unit_cd = ihpou.oss_org_unit_cd
6658 AND ihpou.institution_cd = ihpinst.oss_org_unit_cd
6659 AND NVL(ihpinst.oi_local_institution_ind,'N') = 'N'
6660 GROUP BY ihpinst.oi_govt_institution_cd
6661 ORDER BY percentage DESC;
6662
6663 l_percentage NUMBER;
6664
6665 BEGIN
6666
6667 OPEN c_oinst ;
6668 FETCH c_oinst INTO l_percentage,
6669 p_oth_teach_inst;
6670 CLOSE c_oinst ;
6671
6672 EXCEPTION
6673 WHEN OTHERS
6674 THEN
6675 write_to_log (SQLERRM);
6676 IF c_oinst%ISOPEN
6677 THEN
6678 CLOSE c_oinst;
6679 END IF;
6680
6681 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
6682 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_mod_oth_teach_inst');
6683 IGS_GE_MSG_STACK.ADD;
6684 App_Exception.Raise_Exception;
6685 END get_mod_oth_teach_inst;
6686
6687
6688 PROCEDURE get_pgce_class
6689 (p_person_id IN igs_pe_person.person_id%TYPE,
6690 p_pgce_class OUT NOCOPY VARCHAR2)
6691
6692 IS
6693 /***************************************************************
6694 Created By :
6695 Date Created By :
6696 Purpose : This procedure gets PGCE classification of undergraduate degree
6697 Known Limitations,Enhancements or Remarks:
6698 Change History :
6699 Who When What
6700 smaddali Modified this cursor for bug 2730388 to get only open code values
6701 smaddali 3-dec-03 Modified logic for HECR210 program completion validation build bug#2874542
6702 ***************************************************************/
6703
6704 -- smaddali selecting grading_schema_cd for HECR210 build
6705 CURSOR c_pgce_cls IS
6706 SELECT a.approved_result, a.grading_schema_cd
6707 FROM igs_uc_qual_dets a
6708 WHERE a.person_id = p_person_id
6709 AND EXISTS (SELECT 'X'
6710 FROM igs_he_code_values b
6711 WHERE b.value = a.exam_level
6712 AND b.code_type = 'OSS_QUAL_1ST_DEGREE'
6713 AND NVL(b.closed_ind,'N') = 'N' )
6714 ORDER BY a.year DESC;
6715
6716 l_pgce_class igs_he_code_map_val.map1%TYPE;
6717 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
6718 l_grading_schema igs_uc_qual_dets.grading_schema_cd%TYPE;
6719
6720 BEGIN
6721
6722 OPEN c_pgce_cls ;
6723 FETCH c_pgce_cls INTO l_pgce_class, l_grading_schema;
6724 CLOSE c_pgce_cls;
6725
6726 IF l_pgce_class IS NULL
6727 THEN
6728 p_pgce_class := '99';
6729 ELSE
6730 -- smaddali modified associarion code to OSS_HESA_CLASS_ASSOC for HECR210 build
6731 l_he_code_map_val.association_code := 'OSS_HESA_CLASS_ASSOC';
6732 l_he_code_map_val.map2 := l_grading_schema ;
6733 l_he_code_map_val.map3 := l_pgce_class ;
6734
6735 igs_he_extract2_pkg.get_map_values
6736 (p_he_code_map_val => l_he_code_map_val,
6737 p_value_from => 'MAP1',
6738 p_return_value => p_pgce_class);
6739 END IF;
6740
6741 EXCEPTION
6742 WHEN OTHERS
6743 THEN
6744 write_to_log (SQLERRM);
6745 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
6746 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_pgce_class');
6747 IGS_GE_MSG_STACK.ADD;
6748 App_Exception.Raise_Exception;
6749 END get_pgce_class;
6750
6751
6752
6753 PROCEDURE get_commencement_dt
6754 ( p_hesa_commdate IN igs_he_st_spa_all.commencement_dt%TYPE ,
6755 p_enstdnt_commdate IN igs_en_stdnt_ps_att.commencement_dt%TYPE,
6756 p_person_id IN igs_pe_person.person_id%TYPE ,
6757 p_course_cd IN igs_he_st_spa_all.course_cd%TYPE,
6758 p_version_number IN igs_he_st_spa_all.version_number%TYPE,
6759 p_student_inst_number IN igs_he_st_spa_all.student_inst_number%TYPE,
6760 p_final_commdate OUT NOCOPY igs_he_ex_rn_dat_fd.value%TYPE)
6761
6762 IS
6763 /***************************************************************
6764 Created By : bayadav
6765 Date Created By : 25-Mar-2002
6766 Purpose : This procedure gets the value of commencement date for combined/stduent field 26.
6767 First IGS_HE_ST_SPA_ALL.commencement date is cinsidered.If NULL then it is checked if program transfer has taken palce
6768 If yes ,then assign get the value of first program in chain for that person
6769 (For the person having the same student instance number for the different program transfer are said to be in same chain)
6770 and assign the corresponding IGS_EN_STDNT_PS_ATT.commencement_dt value to it
6771 else if the program transfer has not taken palce then get the IGS_EN_STDNT_PS_ATT.commencement_dt value
6772 of course in context and assign it to field
6773 Known Limitations,Enhancements or Remarks:
6774 Change History :
6775 Who When What
6776 Bayadav 26-Mar-02 Included new procedure get_commencement_dt as a part of HECR002(bug 2278825 )
6777 smaddali 24-mar-03 modified for Build HEFD209 - Bug#2717755 , removed cursor c_course_trn and its code
6778 ***************************************************************/
6779
6780 --Cursor to get the commencement date of the first porgram in chain for the context person from
6781 -- IGS_HE_ST_SPA having same instance number
6782 CURSOR c_list_crs_trn IS
6783 SELECT MIN(sca.commencement_dt) commencement_dt
6784 FROM igs_en_stdnt_ps_att_all sca,
6785 igs_he_st_spa_all hspa
6786 WHERE hspa.person_id = p_person_id
6787 AND hspa.student_inst_number = p_student_inst_number
6788 AND sca.person_id = hspa.person_id
6789 AND sca.course_cd = hspa.course_cd;
6790
6791 l_list_crs_trn c_list_crs_trn%ROWTYPE;
6792 BEGIN
6793
6794 IF p_hesa_commdate IS NOT NULL THEN
6795 -- Commencement Date
6796 p_final_commdate := To_Char(p_hesa_commdate,'DD/MM/YYYY');
6797 ELSE
6798 -- smaddali removed the code to check that a transfer record is present in the
6799 -- enrollment transfer table as part of HEFD209 build, bug#2717755
6800 --IF the program transfer has taken palce ,then get the commencement date of the
6801 -- first first program in chain
6802 OPEN c_list_crs_trn;
6803 FETCH c_list_crs_trn INTO l_list_crs_trn;
6804 IF c_list_crs_trn%FOUND THEN
6805 p_final_commdate := To_Char(l_list_crs_trn.commencement_dt,'DD/MM/YYYY');
6806 END IF;
6807 CLOSE c_list_crs_trn ;
6808 END IF;
6809 EXCEPTION
6810 WHEN OTHERS
6811 THEN
6812 write_to_log (SQLERRM);
6813 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
6814 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_commencement_dt');
6815 IGS_GE_MSG_STACK.ADD;
6816 App_Exception.Raise_Exception;
6817
6818 END get_commencement_dt;
6819
6820 PROCEDURE get_ucasnum(p_person_id IN igs_pe_person.person_id%TYPE,
6821 p_ucasnum OUT NOCOPY igs_pe_alt_pers_id.api_person_id%TYPE,
6822 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
6823 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE)
6824
6825 IS
6826 /***************************************************************
6827 Created By : bayadav
6828 Date Created By : 25-OCT-2002
6829 Purpose : This procedure gets the value of ucas number for combined field 148
6830 Known Limitations,Enhancements or Remarks:
6831 Change History :
6832 Who When What
6833 Bayadav 25-OCT-02 Included new procedure as a part of HEFD101
6834 bayadav 09-DEC-02 Inlcluded excpetion handling block in this as a part of a part of 2685091
6835 bayadav 12-DEC-02 Included l_stdnt_id not null check as a part of a part of 2706787
6836 pmarada 30-May-03 If Student ID is not able to derive using UCASID then trying derive using
6837 NMASID or GTTRID, or SWASID, bug 2986518
6838 smaddali 11-dec-03 Modified for bug#3235753 , added 2 new parameters
6839 ***************************************************************/
6840
6841 l_stdnt_id igs_pe_alt_pers_id.api_person_id%TYPE;
6842 l_sid VARCHAR2(30);
6843 l_index NUMBER := 0;
6844 l_chk_sum NUMBER := 0;
6845 l_chk_digit NUMBER(2);
6846
6847 TYPE fldwt IS TABLE OF NUMBER(2)
6848 INDEX BY binary_integer;
6849 l_fld_weight fldwt;
6850
6851 BEGIN
6852 --get the api_id from the UCASID
6853 -- smaddali 11-dec-03 Modified for bug#3235753 , added 2 new parameters
6854 igs_he_extract_fields_pkg.get_alt_pers_id
6855 (p_person_id => p_person_id,
6856 p_id_type => 'UCASID',
6857 p_api_id => l_stdnt_id,
6858 p_enrl_start_dt => p_enrl_start_dt,
6859 p_enrl_end_dt => p_enrl_end_dt);
6860
6861 -- If Student ID is not derived using UCASID the try to get the student id using NMASID
6862 IF l_stdnt_id IS NULL THEN --0
6863 igs_he_extract_fields_pkg.get_alt_pers_id
6864 (p_person_id => p_person_id,
6865 p_id_type => 'NMASID',
6866 p_api_id => l_stdnt_id,
6867 p_enrl_start_dt => p_enrl_start_dt,
6868 p_enrl_end_dt => p_enrl_end_dt);
6869
6870 -- If Student ID is not derived using UCASID or NMASID then try to get the student id using GTTRID
6871 IF l_stdnt_id IS NULL THEN --1
6872 igs_he_extract_fields_pkg.get_alt_pers_id
6873 (p_person_id => p_person_id,
6874 p_id_type => 'GTTRID',
6875 p_api_id => l_stdnt_id,
6876 p_enrl_start_dt => p_enrl_start_dt,
6877 p_enrl_end_dt => p_enrl_end_dt);
6878
6879 -- If Student ID is not derived using UCASID or NMASID or GTTRID then try to get the student id using SWASID
6880 IF l_stdnt_id IS NULL THEN
6881 igs_he_extract_fields_pkg.get_alt_pers_id
6882 (p_person_id => p_person_id,
6883 p_id_type => 'SWASID',
6884 p_api_id => l_stdnt_id,
6885 p_enrl_start_dt => p_enrl_start_dt,
6886 p_enrl_end_dt => p_enrl_end_dt);
6887 END IF;
6888
6889 END IF; --1
6890
6891 END IF; --0
6892
6893 --IF Student ID is less than 8 characters lpad with leading 0s
6894 IF l_stdnt_id IS NOT NULL THEN
6895
6896 IF LENGTH(l_stdnt_id) < 8 THEN
6897 l_stdnt_id := LPAD(l_stdnt_id,8,'0');
6898 END IF;
6899
6900 -- Initialize Weights.
6901 l_fld_weight(1) := 1;
6902 l_fld_weight(2) := 3;
6903 l_fld_weight(3) := 7;
6904 l_fld_weight(4) := 9;
6905 l_fld_weight(5) := 1;
6906 l_fld_weight(6) := 3;
6907 l_fld_weight(7) := 7;
6908 l_fld_weight(8) := 9;
6909
6910 -- Calculate Check Digit
6911 FOR l_index IN 1 .. LENGTH(l_stdnt_id)
6912 LOOP
6913 l_chk_sum := l_chk_sum +
6914 (to_number(Substr(l_stdnt_id,l_index, 1)) *
6915 l_fld_weight(l_index));
6916 END LOOP;
6917
6918 -- Check digit is 10 - last digit of the check sum above
6919 l_chk_digit := 10 - to_number(Substr(to_char(l_chk_sum),-1,1));
6920
6921 -- If l_chk_digit is 10, then set it to 0
6922 IF l_chk_digit = 10
6923 THEN
6924 l_chk_digit := 0;
6925 END IF;
6926
6927 -- Return the UCAS Number field value
6928 p_ucasnum := l_stdnt_id||to_char(l_chk_digit);
6929 END IF;
6930
6931 EXCEPTION
6932 WHEN OTHERS THEN
6933 write_to_log (SQLERRM);
6934 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
6935 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_ucasnum');
6936 IGS_GE_MSG_STACK.ADD;
6937 App_Exception.Raise_Exception;
6938
6939 END get_ucasnum ;
6940
6941 PROCEDURE get_new_prog_length
6942 (p_spa_attendance_type IN igs_en_stdnt_ps_att.attendance_type%TYPE,
6943 p_program_length IN igs_ps_ofr_opt_all.program_length%TYPE,
6944 p_program_length_measurement IN igs_ps_ofr_opt_all.program_length_measurement%TYPE,
6945 p_length OUT NOCOPY NUMBER,
6946 p_units OUT NOCOPY NUMBER)
6947 IS
6948 /***************************************************************
6949 Created By : bayadav
6950 Date Created By : 25-OCT-2002
6951 Purpose :This procedure gets the value of program length(49) and unit of length 50
6952 Known Limitations,Enhancements or Remarks:
6953 Change History :
6954 Who When What
6955 Bayadav 26-Oct-2002 Included new procedure as a part of HEFD101(bug 2636897)
6956 Bayadav 20-Jan-2003 Corrected HOURS to 5 as a part of 2744808
6957 Jbaber 01-Feb-2005 Included checks for "NOT_APPLICABLE" for bug 3199529/4154993
6958 ***************************************************************/
6959
6960
6961 l_length NUMBER(12,2);
6962 l_year NUMBER(12,2);
6963 l_months NUMBER(12,2);
6964 l_weeks NUMBER(12,2);
6965 l_days NUMBER(12,2);
6966 l_hours NUMBER(12,2);
6967 --Decimal is required to capture the decimal values in case whle conversion
6968 l_program_length NUMBER(12,2);
6969 l_program_length_measurement igs_ps_ofr_opt_all.program_length_measurement%TYPE;
6970 BEGIN
6971
6972
6973 -- Check for 'NOT_APPLICABLE'
6974 IF p_program_length_measurement = 'NOT_APPLICABLE' THEN
6975
6976 -- length is 99, unit is 9
6977 p_length := 99;
6978 p_units := 9;
6979
6980 RETURN;
6981
6982 END IF;
6983
6984
6985 IF p_program_length_measurement = 'MINUTES' THEN
6986
6987 --Convert the program length to HOURS
6988
6989 l_program_length := ROUND( (p_program_length/60) );
6990 l_program_length_measurement := 'HOURS';
6991 ELSIF p_program_length_measurement = '10TH OF A YEAR' THEN
6992
6993 --Convert the program length to YEARS
6994
6995 l_program_length := (p_program_length/10);
6996 l_program_length_measurement := 'YEAR';
6997
6998
6999 ELSE
7000
7001 l_program_length := p_program_length;
7002 l_program_length_measurement := p_program_length_measurement;
7003 END IF;
7004
7005
7006
7007 IF l_program_length_measurement = 'YEAR'
7008 THEN
7009 --Here we need to consider the decimal value as above in case of 10th of a year value is divided by 10 to get in YEAR
7010 --1
7011 IF l_program_length = ROUND(l_program_length) THEN
7012 --It's a whole number so return the correpsonding unit of length and SPLENGTH
7013 p_length := l_program_length;
7014 p_units := 1;
7015
7016
7017
7018 --1
7019 ELSE
7020 --No need to check for greater than 99 as it is for the larget unit so in case it is lessthan 99 and not inetger value need to convert it into smaller unit
7021 --Converting it to MONTH as YEAR is not a whole number
7022 l_months := (l_program_length *12);
7023
7024
7025 -- Months is a whole number, so return the months
7026 --Return the Years by rounding as it greater than 99
7027 --2
7028 IF l_months >99 THEN
7029 --as on converting it is coming >99 so dont proceed further
7030
7031 p_length := ROUND(l_program_length);
7032 p_units := 1;
7033 --2
7034 ELSE
7035
7036 -- Months less than 99
7037 --3
7038 IF l_months = ROUND(l_months) THEN
7039 p_length := l_months;
7040 p_units := 2;
7041 --3
7042 ELSE
7043 --Converted month is not a whole number ,so convert into 'weeks
7044 l_weeks := ROUND(l_program_length * 52);
7045 --4
7046 IF l_weeks > 99 THEN
7047 --value is greater then 99, so store it in the original unit of length
7048
7049 p_length := ROUND(l_months);
7050 p_units := 2;
7051 --4
7052 ELSE
7053 --5
7054 IF l_weeks = ROUND(l_weeks) THEN
7055 p_length := l_weeks;
7056 p_units := 3;
7057 --5
7058 ELSE
7059 --Converted weeks is not a whole number ,so convert into days
7060 l_days := ROUND(l_program_length * 365);
7061 --6
7062
7063 IF l_weeks > 99 THEN
7064 p_length := ROUND(l_weeks);
7065 p_units := 3;
7066 --6
7067 ELSE
7068 --7
7069 IF l_days = ROUND(l_days) THEN
7070
7071 p_length := l_days;
7072 p_units := 4;
7073 --7
7074 ELSE
7075 --Converted days is not a whole number ,so convert into HOURS
7076 l_hours := ROUND(l_program_length*365*12);
7077 --8
7078 IF l_hours < 99 THEN
7079 p_length := l_hours;
7080 p_units := 5;
7081 --8
7082 ELSE
7083 p_length := ROUND(l_days);
7084 p_units := 4 ;
7085 --8
7086 END IF;
7087 --7
7088 END IF;
7089 --6
7090 END IF ;
7091 --5
7092 END IF;
7093 --4
7094 END IF;
7095 --3
7096 END IF;
7097 --2
7098 END IF;
7099 --1
7100 END IF;
7101
7102 END IF;
7103
7104
7105
7106
7107
7108 IF l_program_length_measurement = 'MONTHS' THEN
7109 --Here we need not consider the decimal value as in PSP the program length is a integer column and as such
7110 --we are not converting the value set in PSP to any other value in case of MONTH unit
7111 --2
7112 IF l_program_length < 99 THEN
7113 p_length := l_program_length ;
7114 P_units := 2;
7115
7116 --2
7117 ELSE
7118 --Here we need not consider any case as YEAR is the biggest unit and it can not be converted further to bigger unit
7119 l_year := (l_program_length/12);
7120 p_length := ROUND(l_year);
7121 p_units := 1;
7122
7123 --2
7124 END IF;
7125 --1
7126 END IF;
7127
7128
7129
7130 --1
7131 IF l_program_length_measurement = 'WEEKS' THEN
7132
7133 --Here we need not consider the decimal value as in PSP the
7134 --program length is a integer column and as such we are not converting the value set in PSP to any other value in case of WEEKS unit
7135
7136
7137 --2
7138 IF l_program_length < 99 THEN
7139 p_length := l_program_length ;
7140 p_units := 3;
7141
7142 --2
7143 ELSE
7144 l_months := (l_program_length*12)/52 ;
7145
7146
7147 --3
7148
7149 --4
7150 IF l_months < 99 THEN
7151
7152 p_length := ROUND(l_months) ;
7153 p_units := 2;
7154
7155 --4
7156 ELSE
7157 --as it is greater than 99 convert it to larger unit YEARS
7158 l_year := (l_program_length/52) ;
7159
7160 --We cannot check further for greater than 99 as YEAR is the largest unit
7161 p_length := ROUND(l_year);
7162 p_units := 1;
7163
7164
7165 --4
7166
7167 --3
7168 END IF;
7169 --2
7170 END IF;
7171 --1
7172 END IF;
7173
7174
7175
7176
7177 --1
7178 IF L_program_length_measurement = 'DAYS' THEN
7179 --Here we need not consider the decimal value as in PSP the
7180 --program length is a integer column and as such we are not converting the value set in PSP to any other value in case of DAYS unit
7181 --2
7182 IF l_program_length < 99 THEN
7183 p_length := ROUND(l_program_length) ;
7184 P_units := 4;
7185 --2
7186 ELSE
7187 l_weeks := (l_program_length/7) ;
7188 --3
7189 IF l_weeks < 99 THEN
7190
7191 p_length := ROUND(l_weeks) ;
7192 p_units := 3 ;
7193 --3
7194 ELSE
7195
7196 l_months := ((l_program_length*12)/(52*7));
7197
7198 --4
7199 IF l_months < 99 THEN
7200
7201 p_length := ROUND(l_months) ;
7202 p_units := 2 ;
7203 --4
7204 ELSE
7205 --as it is greater than 99 convert it to larger unit YEARS
7206 l_year := (l_program_length/365) ;
7207 --We cannot check further for greater than 99 as YEAR is the largest unit
7208 p_length := ROUND(l_year);
7209 p_units := 1;
7210 --4
7211 END IF;
7212 --3
7213 END IF;
7214 --2
7215 END IF;
7216 --1
7217 END IF;
7218
7219
7220
7221
7222
7223 --1
7224 IF l_program_length_measurement = 'HOURS' THEN
7225
7226 --Here we will consider the decimal value as above we have converted minutes to HOURS .
7227 --But since HOURS is the smallest so we will round it off in case it is integer
7228 --2
7229 IF l_program_length < 99 THEN
7230
7231 p_length := ROUND(l_program_length);
7232 p_units := 5;
7233 --2
7234 ELSE
7235 l_days := (l_program_length /24);
7236 --3
7237
7238 IF (l_days < 99) THEN
7239 --It is less than 99 so return the correpsonding unit of length and SPLENGTH
7240 p_length := ROUND(l_days);
7241 p_units := 4 ;
7242 --3
7243 ELSE
7244 l_weeks := (l_program_length/(24*7));
7245 --4
7246 IF l_weeks < 99 THEN
7247 --It is less than 99 so return the correpsonding unit of length and SPLENGTH
7248
7249 p_length := ROUND(l_weeks);
7250 p_units := 3;
7251 --4
7252 ELSE
7253 l_months := (l_program_length/(14*52));
7254 --5
7255 IF l_months < 99 THEN
7256 --It's a whole number and less than 99 so return the correpsonding unit of length and SPLENGTH
7257
7258 p_length := ROUND(l_months) ;
7259 p_units := 2 ;
7260 --5
7261 ELSE
7262 l_year := (l_program_length/(7*24*52) ) ;
7263 --As it is the largest unit so will not check for whole number so return the correpsonding unit of length and SPLENGTH
7264 p_length := ROUND(l_year);
7265 p_units := 1;
7266 --5
7267 END IF;
7268
7269
7270 --4
7271 END IF;
7272
7273 --3
7274 END IF;
7275
7276 --2
7277 END IF;
7278
7279 --1
7280 END IF;
7281
7282 EXCEPTION
7283 WHEN OTHERS
7284 THEN
7285 write_to_log (SQLERRM);
7286 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7287 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_new_prog_length');
7288 IGS_GE_MSG_STACK.ADD;
7289 App_Exception.Raise_Exception;
7290
7291 END get_new_prog_length;
7292
7293 PROCEDURE get_marital_status
7294 (p_oss_marital_status IN igs_pe_stat_v.marital_status%TYPE,
7295 p_hesa_marital_status OUT NOCOPY VARCHAR2)
7296 IS
7297 /***************************************************************
7298 Created By : Jonathan Baber
7299 Date Created By : 20-September-2004
7300 Purpose : This procedure gets the marital status
7301 Known Limitations,Enhancements or Remarks:
7302 Change History :
7303 Who When What
7304 ***************************************************************/
7305
7306 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
7307
7308 BEGIN
7309 l_he_code_map_val.association_code := 'OSS_HESA_MARSTAT_ASSOC';
7310 l_he_code_map_val.map2 := p_oss_marital_status;
7311
7312 IF l_he_code_map_val.map2 IS NOT NULL
7313 THEN
7314 igs_he_extract2_pkg.get_map_values
7315 (p_he_code_map_val => l_he_code_map_val,
7316 p_value_from => 'MAP1',
7317 p_return_value => p_hesa_marital_status);
7318
7319 END IF;
7320
7321 EXCEPTION
7322 WHEN OTHERS
7323 THEN
7324 write_to_log (SQLERRM);
7325 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7326 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_marital_status');
7327 IGS_GE_MSG_STACK.ADD;
7328 App_Exception.Raise_Exception;
7329 END get_marital_status;
7330
7331 PROCEDURE get_dependants
7332 (p_oss_dependants IN igs_he_st_spa.dependants_cd%TYPE,
7333 p_hesa_dependants OUT NOCOPY VARCHAR2)
7334 IS
7335 /***************************************************************
7336 Created By : Jonathan Baber
7337 Date Created By : 20-September-2004
7338 Purpose : This procedure gets the dependants cd
7339 Known Limitations,Enhancements or Remarks:
7340 Change History :
7341 Who When What
7342 ***************************************************************/
7343
7344 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
7345
7346 BEGIN
7347 l_he_code_map_val.association_code := 'OSS_HESA_DEPEND_ASSOC';
7348 l_he_code_map_val.map2 := p_oss_dependants;
7349
7350 IF l_he_code_map_val.map2 IS NOT NULL
7351 THEN
7352 igs_he_extract2_pkg.get_map_values
7353 (p_he_code_map_val => l_he_code_map_val,
7354 p_value_from => 'MAP1',
7355 p_return_value => p_hesa_dependants);
7356
7357 END IF;
7358
7359 EXCEPTION
7360 WHEN OTHERS
7361 THEN
7362 write_to_log (SQLERRM);
7363 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7364 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_dependants');
7365 IGS_GE_MSG_STACK.ADD;
7366 App_Exception.Raise_Exception;
7367 END get_dependants;
7368
7369
7370 PROCEDURE get_enh_fund_elig
7371 (p_susa_enh_fund_elig IN igs_he_en_susa.enh_fund_elig_cd%TYPE ,
7372 p_spa_enh_fund_elig IN igs_he_st_spa.enh_fund_elig_cd%TYPE,
7373 p_hesa_enh_fund_elig OUT NOCOPY VARCHAR2)
7374 IS
7375 /***************************************************************
7376 Created By : Jonathan Baber
7377 Date Created By : 20 September 2004
7378 Purpose : This procedure gets the eligibility for enhanced funding
7379 Known Limitations,Enhancements or Remarks:
7380 Change History :
7381 Who When What
7382 ***************************************************************/
7383
7384 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
7385
7386 BEGIN
7387 l_he_code_map_val.association_code := 'OSS_HESA_ELIGENFD_ASSOC';
7388 l_he_code_map_val.map2 := NVL(p_susa_enh_fund_elig,p_spa_enh_fund_elig);
7389
7390 IF l_he_code_map_val.map2 IS NOT NULL
7391 THEN
7392 igs_he_extract2_pkg.get_map_values
7393 (p_he_code_map_val => l_he_code_map_val,
7394 p_value_from => 'MAP1',
7395 p_return_value => p_hesa_enh_fund_elig);
7396
7397 END IF;
7398
7399 EXCEPTION
7400 WHEN OTHERS
7401 THEN
7402 write_to_log (SQLERRM);
7403 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7404 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_enh_fund_elig');
7405 IGS_GE_MSG_STACK.ADD;
7406 App_Exception.Raise_Exception;
7407 END get_enh_fund_elig;
7408
7409
7410 PROCEDURE get_learn_dif
7411 (p_person_id IN igs_pe_person.person_id%TYPE,
7412 p_enrl_start_dt IN igs_he_submsn_header.enrolment_start_date%TYPE,
7413 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE,
7414 p_hesa_disability_type OUT NOCOPY VARCHAR2)
7415 IS
7416 /***************************************************************
7417 Created By : Jonathan Baber
7418 Date Created By : 20 September 2004
7419 Purpose : This procedure gets the learning difficulty
7420 Known Limitations,Enhancements or Remarks:
7421 Change History :
7422 Who When What
7423 ***************************************************************/
7424
7425 l_map1 igs_he_code_map_val.map1%TYPE;
7426
7427 CURSOR c_hesa_dis_types IS
7428 SELECT map1
7429 FROM igs_he_code_map_val a, igs_pe_pers_disablty b
7430 WHERE a.map2 = b.disability_type
7431 AND a.association_code = 'OSS_HESA_LEARNDIF_ASSOC'
7432 AND NOT NVL(b.start_date, p_enrl_end_dt) > p_enrl_end_dt
7433 AND NOT NVL(b.end_date, p_enrl_start_dt) < p_enrl_start_dt
7434 AND b.person_id = p_person_id
7435 GROUP BY map1;
7436
7437 BEGIN
7438
7439 OPEN c_hesa_dis_types;
7440 FETCH c_hesa_dis_types into l_map1;
7441 FETCH c_hesa_dis_types into l_map1;
7442
7443 -- If more than one disability type exists return 90
7444 -- Otherwise return disability type
7445 IF (c_hesa_dis_types%FOUND) THEN
7446 p_hesa_disability_type := '90';
7447 ELSE
7448 p_hesa_disability_type := l_map1;
7449 END IF;
7450
7451 CLOSE c_hesa_dis_types;
7452
7453 EXCEPTION
7454 WHEN OTHERS
7455 THEN
7456 write_to_log (SQLERRM);
7457 IF c_hesa_dis_types%ISOPEN
7458 THEN
7459 CLOSE c_hesa_dis_types;
7460 END IF;
7461 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7462 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_learn_dif');
7463 IGS_GE_MSG_STACK.ADD;
7464 App_Exception.Raise_Exception;
7465 END get_learn_dif;
7466
7467
7468
7469
7470 PROCEDURE get_gov_init
7471 (p_spa_gov_initiatives_cd IN igs_he_st_spa.gov_initiatives_cd%TYPE,
7472 p_prog_gov_initiatives_cd IN igs_he_st_prog.gov_initiatives_cd%TYPE,
7473 p_hesa_gov_initiatives_cd OUT NOCOPY VARCHAR2)
7474 IS
7475 /***************************************************************
7476 Created By : Jonathan Baber
7477 Date Created By : 20 September 2004
7478 Purpose : This procedure gets the government initiatives
7479 Known Limitations,Enhancements or Remarks:
7480 Change History :
7481 Who When What
7482 ***************************************************************/
7483
7484 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
7485
7486 BEGIN
7487 l_he_code_map_val.association_code := 'OSS_HESA_GOVINIT_ASSOC';
7488 l_he_code_map_val.map2 := NVL(p_spa_gov_initiatives_cd,p_prog_gov_initiatives_cd);
7489
7490 IF l_he_code_map_val.map2 IS NOT NULL
7491 THEN
7492 igs_he_extract2_pkg.get_map_values
7493 (p_he_code_map_val => l_he_code_map_val,
7494 p_value_from => 'MAP1',
7495 p_return_value => p_hesa_gov_initiatives_cd);
7496
7497 p_hesa_gov_initiatives_cd := p_hesa_gov_initiatives_cd || '99';
7498
7499 END IF;
7500
7501 EXCEPTION
7502 WHEN OTHERS
7503 THEN
7504 write_to_log (SQLERRM);
7505 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7506 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_gov_init');
7507 IGS_GE_MSG_STACK.ADD;
7508 App_Exception.Raise_Exception;
7509 END get_gov_init;
7510
7511 PROCEDURE get_units_completed
7512 (p_person_id IN igs_pe_person.person_id%TYPE,
7513 p_course_cd IN igs_ps_ver.course_cd%TYPE,
7514 p_enrl_end_dt IN igs_he_submsn_header.enrolment_end_date%TYPE,
7515 p_spa_units_completed IN igs_he_st_spa.units_completed%TYPE,
7516 p_hesa_units_completed OUT NOCOPY VARCHAR2)
7517 IS
7518 /***************************************************************
7519 Created By : Jonathan Baber
7520 Date Created By : 20 September 2004
7521 Purpose : This procedure gets the number of completed units
7522 Known Limitations,Enhancements or Remarks:
7523 Change History :
7524 Who When What
7525 ***************************************************************/
7526
7527 -- This query counts the number of units completed by getting all the course codes
7528 -- attempted by the student from the igs_he_st_spa table with the same student inst number
7529 -- as the course given in the parameter p_course_cd.
7530 -- The associated "COMPLETED' unit attempts are then selected where the outcome date is less
7531 -- than or equal to the reporting period end date.
7532 CURSOR c_unit_count IS
7533 SELECT count(*)
7534 FROM
7535 igs_en_su_attempt_all su, igs_as_su_stmptout_all suo1,
7536 igs_he_st_spa spa1, igs_he_st_spa spa2, igs_as_grd_sch_grade gsg
7537 WHERE su.person_id = suo1.person_id
7538 AND su.course_cd = suo1.course_cd
7539 AND su.unit_cd = suo1.unit_cd
7540 AND su.unit_attempt_status = 'COMPLETED'
7541 AND su.person_id = spa2.person_id
7542 AND su.course_cd = spa2.course_cd
7543 AND suo1.outcome_dt <= p_enrl_end_dt
7544 AND spa1.person_id = spa2.person_id
7545 AND spa1.student_inst_number = spa2.student_inst_number
7546 AND spa1.person_id = p_person_id
7547 AND spa1.course_cd = p_course_cd
7548 AND gsg.s_result_type = 'PASS'
7549 AND gsg.grading_schema_cd = suo1.grading_schema_cd
7550 AND gsg.grade = suo1.grade
7551 AND gsg.version_number = suo1.version_number
7552 AND suo1.outcome_dt IN
7553 (SELECT MAX(suo2.outcome_dt)
7554 FROM igs_as_su_stmptout_all suo2
7555 WHERE suo2.person_id = suo1.person_id
7556 AND suo2.course_cd = suo1.course_cd
7557 AND suo2.finalised_outcome_ind = 'Y'
7558 AND suo2.unit_cd = suo1.unit_cd);
7559
7560 BEGIN
7561
7562 IF p_spa_units_completed IS NOT NULL
7563 THEN
7564 p_hesa_units_completed := p_spa_units_completed;
7565 ELSE
7566
7567 OPEN c_unit_count;
7568 FETCH c_unit_count INTO p_hesa_units_completed;
7569 CLOSE c_unit_count;
7570
7571 END IF;
7572
7573 EXCEPTION
7574 WHEN OTHERS
7575 THEN
7576 write_to_log (SQLERRM);
7577 IF c_unit_count%ISOPEN
7578 THEN
7579 CLOSE c_unit_count;
7580 END IF;
7581 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7582 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_units_completed');
7583 IGS_GE_MSG_STACK.ADD;
7584 App_Exception.Raise_Exception;
7585 END get_units_completed;
7586
7587 PROCEDURE get_disadv_uplift_elig
7588 (p_spa_disadv_uplift_elig_cd IN igs_he_st_spa.disadv_uplift_elig_cd%TYPE,
7589 p_prog_disadv_uplift_elig_cd IN igs_he_st_prog.disadv_uplift_elig_cd%TYPE,
7590 p_hesa_disadv_uplift_elig_cd OUT NOCOPY VARCHAR2)
7591 IS
7592 /***************************************************************
7593 Created By : Jonathan Baber
7594 Date Created By : 20 September 2004
7595 Purpose : This procedure gets the eligibility for disability uplift
7596 Known Limitations,Enhancements or Remarks:
7597 Change History :
7598 Who When What
7599 ***************************************************************/
7600
7601 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
7602
7603 BEGIN
7604 l_he_code_map_val.association_code := 'OSS_HESA_ELIDISUP_ASSOC';
7605 l_he_code_map_val.map2 := NVL(p_spa_disadv_uplift_elig_cd,p_prog_disadv_uplift_elig_cd);
7606
7607 IF l_he_code_map_val.map2 IS NOT NULL
7608 THEN
7609 igs_he_extract2_pkg.get_map_values
7610 (p_he_code_map_val => l_he_code_map_val,
7611 p_value_from => 'MAP1',
7612 p_return_value => p_hesa_disadv_uplift_elig_cd);
7613
7614 END IF;
7615
7616 EXCEPTION
7617 WHEN OTHERS
7618 THEN
7619 write_to_log (SQLERRM);
7620 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7621 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_disadv_uplift_elig');
7622 IGS_GE_MSG_STACK.ADD;
7623 App_Exception.Raise_Exception;
7624 END get_disadv_uplift_elig;
7625
7626 PROCEDURE get_franch_out_arr
7627 (p_spa_franch_out_arr_cd IN igs_he_st_spa.franch_out_arr_cd%TYPE,
7628 p_prog_franch_out_arr_cd IN igs_he_st_prog.franch_out_arr_cd%TYPE,
7629 p_hesa_franch_out_arr_cd OUT NOCOPY VARCHAR2)
7630 IS
7631 /***************************************************************
7632 Created By : Jonathan Baber
7633 Date Created By : 20 September 2004
7634 Purpose : This procedure gets the franchised out arrangements
7635 Known Limitations,Enhancements or Remarks:
7636 Change History :
7637 Who When What
7638 ***************************************************************/
7639
7640 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
7641
7642 BEGIN
7643 l_he_code_map_val.association_code := 'OSS_HESA_FROUTARR_ASSOC';
7644 l_he_code_map_val.map2 := NVL(p_spa_franch_out_arr_cd,p_prog_franch_out_arr_cd );
7645
7646 IF l_he_code_map_val.map2 IS NOT NULL
7647 THEN
7648 igs_he_extract2_pkg.get_map_values
7649 (p_he_code_map_val => l_he_code_map_val,
7650 p_value_from => 'MAP1',
7651 p_return_value => p_hesa_franch_out_arr_cd);
7652
7653 END IF;
7654
7655 EXCEPTION
7656 WHEN OTHERS
7657 THEN
7658 write_to_log (SQLERRM);
7659 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7660 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_franch_out_arr');
7661 IGS_GE_MSG_STACK.ADD;
7662 App_Exception.Raise_Exception;
7663 END get_franch_out_arr;
7664
7665 PROCEDURE get_employer_role
7666 (p_spa_employer_role_cd IN igs_he_st_spa.employer_role_cd%TYPE,
7667 p_hesa_employer_role_cd OUT NOCOPY VARCHAR2)
7668 IS
7669 /***************************************************************
7670 Created By : Jonathan Baber
7671 Date Created By : 20 September 2004
7672 Purpose : This procedure gets the employer role
7673 Known Limitations,Enhancements or Remarks:
7674 Change History :
7675 Who When What
7676 ***************************************************************/
7677
7678 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
7679
7680 BEGIN
7681 l_he_code_map_val.association_code := 'OSS_HESA_EMPROLE_ASSOC';
7682 l_he_code_map_val.map2 := p_spa_employer_role_cd;
7683
7684 IF l_he_code_map_val.map2 IS NOT NULL
7685 THEN
7686 igs_he_extract2_pkg.get_map_values
7687 (p_he_code_map_val => l_he_code_map_val,
7688 p_value_from => 'MAP1',
7689 p_return_value => p_hesa_employer_role_cd);
7690
7691 END IF;
7692
7693 EXCEPTION
7694 WHEN OTHERS
7695 THEN
7696 write_to_log (SQLERRM);
7697 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7698 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_employer_role');
7699 IGS_GE_MSG_STACK.ADD;
7700 App_Exception.Raise_Exception;
7701 END get_employer_role;
7702
7703
7704 PROCEDURE get_franchise_partner
7705 (p_spa_franch_partner_cd IN igs_he_st_spa.franch_partner_cd%TYPE,
7706 p_hesa_franch_partner_cd OUT NOCOPY VARCHAR2)
7707 IS
7708 /***************************************************************
7709 Created By : Jonathan Baber
7710 Date Created By : 20 September 2004
7711 Purpose : This procedure gets the franchise partner
7712 Known Limitations,Enhancements or Remarks:
7713 Change History :
7714 Who When What
7715 ***************************************************************/
7716
7717 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
7718
7719 BEGIN
7720 l_he_code_map_val.association_code := 'OSS_HESA_FRANPART_ASSOC';
7721 l_he_code_map_val.map2 := p_spa_franch_partner_cd;
7722
7723 IF l_he_code_map_val.map2 IS NOT NULL
7724 THEN
7725 igs_he_extract2_pkg.get_map_values
7726 (p_he_code_map_val => l_he_code_map_val,
7727 p_value_from => 'MAP1',
7728 p_return_value => p_hesa_franch_partner_cd);
7729
7730 END IF;
7731
7732 EXCEPTION
7733 WHEN OTHERS
7734 THEN
7735 write_to_log (SQLERRM);
7736 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7737 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_franchise_partner');
7738 IGS_GE_MSG_STACK.ADD;
7739 App_Exception.Raise_Exception;
7740 END get_franchise_partner;
7741
7742
7743 PROCEDURE get_welsh_speaker_ind
7744 (p_person_id IN igs_pe_person.person_id%TYPE,
7745 p_hesa_welsh_speaker_ind OUT NOCOPY VARCHAR2)
7746 IS
7747 /***************************************************************
7748 Created By : Jonathan Baber
7749 Date Created By : 20 September 2004
7750 Purpose : This procedure gets the welsh speaker indicator
7751 Known Limitations,Enhancements or Remarks:
7752 Change History :
7753 Who When What
7754 ***************************************************************/
7755
7756 CURSOR c_lang IS
7757 SELECT speaks_level
7758 FROM igs_pe_languages_v
7759 WHERE party_id = p_person_id
7760 AND language_name = 'WS';
7761
7762 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
7763
7764 BEGIN
7765 l_he_code_map_val.association_code := 'OSS_HESA_WELSSP_ASSOC';
7766
7767 OPEN c_lang;
7768 FETCH c_lang into l_he_code_map_val.map2;
7769 CLOSE c_lang;
7770
7771 IF l_he_code_map_val.map2 IS NOT NULL
7772 THEN
7773
7774 igs_he_extract2_pkg.get_map_values
7775 (p_he_code_map_val => l_he_code_map_val,
7776 p_value_from => 'MAP1',
7777 p_return_value => p_hesa_welsh_speaker_ind);
7778
7779 END IF;
7780
7781 EXCEPTION
7782 WHEN OTHERS
7783 THEN
7784 write_to_log (SQLERRM);
7785 IF c_lang%ISOPEN
7786 THEN
7787 CLOSE c_lang;
7788 END IF;
7789 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7790 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_welsh_speaker_ind');
7791 IGS_GE_MSG_STACK.ADD;
7792 App_Exception.Raise_Exception;
7793 END get_welsh_speaker_ind;
7794
7795 PROCEDURE get_national_id
7796 (p_person_id IN igs_pe_person.person_id%TYPE,
7797 p_hesa_national_id1 OUT NOCOPY VARCHAR2,
7798 p_hesa_national_id2 OUT NOCOPY VARCHAR2)
7799
7800 IS
7801 /***************************************************************
7802 Created By : Jonathan Baber
7803 Date Created By : 20 September 2004
7804 Purpose : This procedure gets the national id 1 and 2
7805 Known Limitations,Enhancements or Remarks:
7806 Change History :
7807 Who When What
7808 ***************************************************************/
7809
7810 CURSOR c_race IS
7811 SELECT race_cd
7812 FROM igs_pe_race
7813 WHERE person_id = p_person_id;
7814
7815
7816 l_he_code_map_val igs_he_code_map_val%ROWTYPE := NULL;
7817
7818 BEGIN
7819 l_he_code_map_val.association_code := 'OSS_HESA_NATIOND_ASSOC';
7820
7821 OPEN c_race;
7822
7823 FETCH c_race into l_he_code_map_val.map2;
7824 If c_race%FOUND THEN
7825 igs_he_extract2_pkg.get_map_values
7826 (p_he_code_map_val => l_he_code_map_val,
7827 p_value_from => 'MAP1',
7828 p_return_value => p_hesa_national_id1);
7829 END IF;
7830
7831 FETCH c_race into l_he_code_map_val.map2;
7832 If c_race%FOUND THEN
7833 igs_he_extract2_pkg.get_map_values
7834 (p_he_code_map_val => l_he_code_map_val,
7835 p_value_from => 'MAP1',
7836 p_return_value => p_hesa_national_id2);
7837 END IF;
7838
7839 CLOSE c_race;
7840
7841 EXCEPTION
7842 WHEN OTHERS
7843 THEN
7844 write_to_log (SQLERRM);
7845 IF c_race%ISOPEN
7846 THEN
7847 CLOSE c_race;
7848 END IF;
7849 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7850 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_national_id');
7851 IGS_GE_MSG_STACK.ADD;
7852 App_Exception.Raise_Exception;
7853 END get_national_id;
7854
7855
7856 -- anwest 19-Dec-05 Changes as per (4731723) HE360 - HESA REQUIREMENTS FOR 2005/06 REPORTING
7857 PROCEDURE get_welsh_bacc_qual
7858 (p_person_id IN igs_pe_person.person_id%TYPE,
7859 p_welsh_bacc OUT NOCOPY VARCHAR2) IS
7860
7861 /******************************************************************************
7862 Created By : Andrew West
7863 Date Created By : 19 December 2005
7864 Purpose : This procedure gets the Welsh Baccalaureate Advanced
7865 Diploma qualification value
7866 Known Limitations,Enhancements or Remarks:
7867 Change History :
7868 Who When What
7869 ******************************************************************************/
7870
7871 CURSOR c_welsh_bacc_qual IS
7872 SELECT 'X'
7873 FROM igs_uc_qual_dets iuqd,
7874 igs_he_code_map_val ihcmv
7875 WHERE iuqd.person_id = p_person_id
7876 AND ihcmv.association_code = 'UCAS_OSS_AWD_ASSOC'
7877 AND ihcmv.map1 = 'WB'
7878 AND ihcmv.map2 = iuqd.exam_level;
7879
7880 CURSOR c_welsh_bacc_pass_grd IS
7881 SELECT 'X'
7882 FROM igs_uc_qual_dets iuqd,
7883 igs_he_code_map_val ihcmv,
7884 igs_as_grd_sch_grade iagsg
7885 WHERE iuqd.person_id = p_person_id
7886 AND iuqd.exam_level = ihcmv.map2
7887 AND iuqd.grading_schema_cd = iagsg.grading_schema_cd
7888 AND iuqd.version_number = iagsg.version_number
7889 AND iuqd.approved_result = iagsg.grade
7890 AND iagsg.s_result_type = 'PASS'
7891 AND ihcmv.association_code = 'UCAS_OSS_AWD_ASSOC'
7892 AND ihcmv.map1 = 'WB';
7893
7894 l_dummy VARCHAR2(1);
7895
7896 BEGIN
7897
7898 OPEN c_welsh_bacc_qual;
7899 FETCH c_welsh_bacc_qual INTO l_dummy;
7900 IF c_welsh_bacc_qual%FOUND THEN
7901 OPEN c_welsh_bacc_pass_grd;
7902 FETCH c_welsh_bacc_pass_grd INTO l_dummy;
7903 IF c_welsh_bacc_pass_grd%FOUND THEN
7904 p_welsh_bacc := '1';
7905 ELSE
7906 p_welsh_bacc := '2';
7907 END IF;
7908 CLOSE c_welsh_bacc_pass_grd;
7909 ELSE
7910 p_welsh_bacc := '3';
7911 END IF;
7912 CLOSE c_welsh_bacc_qual;
7913
7914 EXCEPTION
7915 WHEN OTHERS THEN
7916 write_to_log (SQLERRM);
7917 IF c_welsh_bacc_qual%ISOPEN THEN
7918 CLOSE c_welsh_bacc_qual;
7919 END IF;
7920 IF c_welsh_bacc_pass_grd%ISOPEN THEN
7921 CLOSE c_welsh_bacc_pass_grd;
7922 END IF;
7923 Fnd_Message.Set_Name('IGS','IGS_GE_UNHANDLED_EXP');
7924 Fnd_Message.Set_Token('NAME','IGS_HE_EXTRACT_FIELDS_PKG.get_welsh_bacc_qual');
7925 IGS_GE_MSG_STACK.ADD;
7926 App_Exception.Raise_Exception;
7927
7928 END get_welsh_bacc_qual;
7929
7930
7931 END igs_he_extract_fields_pkg;