[Home] [Help]
PACKAGE BODY: APPS.GHR_SF52_DO_UPDATE
Source
1 PACKAGE BODY GHR_SF52_DO_UPDATE AS
2 /* $Header: gh52doup.pkb 120.83.12020000.13 2013/01/16 06:53:40 vmididho ship $ */
3 g_effective_date date;
4 g_old_user_status per_assignment_status_types.user_status%type;
5 --
6 -- Removed all cursors required to fetch noa_code, as it is already passed from ghr_pa_requests (FRONT END)
7 --
8 -- *******************************
9 -- procedure Generic_Update_Extra_Info
10 -- *******************************
11 --
12
13 -- This procedure call the appropriate API to update DDF extra information.
14
15 Procedure Generic_Update_Extra_Info
16 (P_PA_REQUEST_REC IN GHR_PA_REQUESTS%ROWTYPE
17 ,p_l_information_type IN varchar2
18 ,p_extra_info_id IN number
19 ,p_l_object_version_number IN out nocopy number
20 ,p_information1 IN varchar2 default hr_api.g_varchar2
21 ,p_information2 IN varchar2 default hr_api.g_varchar2
22 ,p_information3 IN varchar2 default hr_api.g_varchar2
23 ,p_information4 IN varchar2 default hr_api.g_varchar2
24 ,p_information5 IN varchar2 default hr_api.g_varchar2
25 ,p_information6 IN varchar2 default hr_api.g_varchar2
26 ,p_Information7 IN varchar2 default hr_api.g_varchar2
27 ,p_information8 IN varchar2 default hr_api.g_varchar2
28 ,p_information9 IN varchar2 default hr_api.g_varchar2
29 ,p_information10 IN varchar2 default hr_api.g_varchar2
30 ,p_information11 IN varchar2 default hr_api.g_varchar2
31 ,p_information12 IN varchar2 default hr_api.g_varchar2
32 ,p_information13 IN varchar2 default hr_api.g_varchar2
33 ,p_information14 IN varchar2 default hr_api.g_varchar2
34 ,p_information15 IN varchar2 default hr_api.g_varchar2
35 ,p_information16 IN varchar2 default hr_api.g_varchar2
36 ,p_information17 IN varchar2 default hr_api.g_varchar2
37 ,p_information18 IN varchar2 default hr_api.g_varchar2
38 ,p_information19 IN varchar2 default hr_api.g_varchar2
39 ,p_information20 IN varchar2 default hr_api.g_varchar2
40 ,p_information21 IN varchar2 default hr_api.g_varchar2
41 ,p_information22 IN varchar2 default hr_api.g_varchar2
42 ,p_information23 IN varchar2 default hr_api.g_varchar2
43 ,p_information24 IN varchar2 default hr_api.g_varchar2
44 ,p_information25 IN varchar2 default hr_api.g_varchar2
45 ,p_information26 IN varchar2 default hr_api.g_varchar2
46 ,p_information27 IN varchar2 default hr_api.g_varchar2
47 ,p_information28 IN varchar2 default hr_api.g_varchar2
48 ,p_information29 IN varchar2 default hr_api.g_varchar2
49 ,p_information30 IN varchar2 default hr_api.g_varchar2) is
50
51 --
52 l_proc varchar2(70) := 'Generic Update Extra Info';
53 l_id number;
54 l_ovn number;
55 l_initial_ovn number;
56 l_index varchar2(10);
57 l_extra_info_id number(15);
58 l_extra_info_rec ghr_api.extra_info_rec_type;
59 --
60 l_asg_cre_extra_info_id per_assignment_extra_info.assignment_extra_info_id%type;
61 l_asg_cre_ovn per_assignment_extra_info.object_version_number%type;
62 l_per_cre_extra_info_id per_people_extra_info.person_extra_info_id%type;
63 l_per_cre_ovn per_people_extra_info.object_version_number%type;
64 l_pos1_cre_extra_info_id per_position_extra_info.position_extra_info_id%type;
65 l_pos1_cre_ovn per_position_extra_info.object_version_number%type;
66 --
67 l_information1 varchar2(150);
68 l_information2 varchar2(150);
69 l_information3 varchar2(150);
70 l_information4 varchar2(150);
71 l_information5 varchar2(150);
72 l_information6 varchar2(150);
73 l_information7 varchar2(150);
74 l_information8 varchar2(150);
75 l_information9 varchar2(150);
76 l_information10 varchar2(150);
77 l_information11 varchar2(150);
78 l_information12 varchar2(150);
79 l_information13 varchar2(150);
80 l_information14 varchar2(150);
81 l_information15 varchar2(150);
82 l_information16 varchar2(150);
83 l_information17 varchar2(150);
84 l_information18 varchar2(150);
85 l_information19 varchar2(150);
86 l_information20 varchar2(150);
87 l_information21 varchar2(150);
88 l_information22 varchar2(150);
89 l_information23 varchar2(150);
90 l_information24 varchar2(150);
91 l_information25 varchar2(150);
92 l_information26 varchar2(150);
93 l_information27 varchar2(150);
94 l_information28 varchar2(150);
95 l_information29 varchar2(150);
96 l_information30 varchar2(150);
97 --
98
99 --Bug # 9646565
100 l_session ghr_history_api.g_session_var_type;
101
102 -- Cursor to select the primary key of the respective Extra info tables for the specific
103 -- entity Id and the InformationType
104
105 Cursor c_asg_ei is
106 select assignment_extra_info_id,
107 object_version_number
108 from per_assignment_extra_info
109 where assignment_id = l_id
110 and information_type = p_l_information_type;
111
112 Cursor c_per_ei is
113 select person_extra_info_id,
114 object_version_number
115 from per_people_extra_info
116 where person_id = l_id
117 and information_type = p_l_information_type;
118
119 Cursor c_pos_ei is
120 select position_extra_info_id,
121 object_version_number
122 from per_position_extra_info
123 where position_id = l_id
124 and information_type = p_l_information_type;
125
126 begin
127 --
128 hr_utility.set_location('Entering ' || l_proc,5);
129 l_initial_ovn := p_l_object_version_number;
130
131 l_extra_info_id := NULL;
132
133 --Bug # 9646565
134 ghr_history_api.get_g_session_var(l_session);
135
136 If upper(substr(P_l_Information_Type,8,3)) = 'ASG' then
137 l_index := 'aei';
138 l_id := P_Pa_request_rec.Employee_Assignment_id;
139 l_extra_info_id := p_extra_info_id;
140 hr_utility.set_location('Assignment id is ' ||l_id || ' ' || l_proc,6);
141 hr_utility.set_location('l_extra_info_id is ' ||l_extra_info_id || ' ' || l_proc,7);
142 Elsif upper(substr(P_l_Information_Type,8,3)) = 'PER' then
143 l_index := 'pei';
144 l_id := P_Pa_request_rec.person_id;
145 l_extra_info_id := p_extra_info_id;
146 Elsif upper(substr(P_l_Information_Type,8,3)) = 'POS' then
147 l_index := 'poei';
148 l_id := nvl(P_Pa_request_rec.to_position_id,p_pa_request_rec.from_position_id);
149 hr_utility.set_location('EXTRA INFO ID '|| to_char(p_extra_info_id),1);
150 l_extra_info_id := p_extra_info_id;
151 -- Rohini
152 Elsif upper(p_l_information_type )= 'GHR_US_RETAINED_GRADE' then
153 l_index := 'pei';
154 l_id := P_Pa_request_rec.person_id;
155 l_extra_info_id := p_extra_info_id;
156 -- Rohini
157
158 Else
159 hr_utility.set_message(8301,'GHR_38132_INVALID_INFO_TYPE');
160 hr_utility.raise_error;
161 End if;
162
163 hr_utility.set_location(l_proc,10);
164
165 -- The foll. code sets the information<n> to null , if they get passed in as null
166 -- and is then used in case of create Extr Info .This was done so that
167 -- we could work with just one procedure for both update as well as create of
168 -- extra information, with all the parameters defaulted to hr_api.g_varchar2
169 -- therby ensuring that while updating, none of the existing data gets over-written.
170
171 l_extra_info_id := p_extra_info_id;
172 hr_utility.set_location('l_extra_info_id is ' ||l_extra_info_id || ' ' || l_proc,8);
173 If p_information1 = hr_api.g_varchar2 THEN
174 l_information1 := null;
175 Else
176 l_information1 := p_information1;
177 End if;
178 IF p_information2 = hr_api.g_varchar2 THEN
179 l_information2 := null;
180 Else
181 l_information2 := p_information2;
182 End if;
183 IF p_information3 = hr_api.g_varchar2 THEN
184 l_information3 := null;
185 ELSE
186 l_information3 := p_information3;
187 END IF;
188 IF p_information4 = hr_api.g_varchar2 THEN
189 l_information4 := null;
190 ELSE
191 l_information4 := p_information4;
192 END IF;
193 IF p_information5 = hr_api.g_varchar2 THEN
194 l_information5 := null;
195 ELSE
196 l_information5 := p_information5;
197 END IF;
198 IF p_information6 = hr_api.g_varchar2 THEN
199 l_information6 := null;
200 ELSE
201 l_information6 := p_information6;
202 END IF;
203 IF p_information7 = hr_api.g_varchar2 THEN
204 l_information7 := null;
205 ELSE
206 l_information7 := p_information7;
207 END IF;
208 IF p_information8 = hr_api.g_varchar2 THEN
209 l_information8 := null;
210 ELSE
211 l_information8 := p_information8;
212 END IF;
213 IF p_information9 = hr_api.g_varchar2 THEN
214 l_information9 := null;
215 ELSE
216 l_information9 := p_information9;
217 END IF;
218 IF p_information10 = hr_api.g_varchar2 THEN
219 l_information10 := null;
220 ELSE
221 l_information10 := p_information10;
222 END IF;
223 IF p_information11 = hr_api.g_varchar2 THEN
224 l_information11 := null;
225 ELSE
226 l_information11 := p_information11;
227 END IF;
228 IF p_information12 = hr_api.g_varchar2 THEN
229 l_information12 := null;
230 ELSE
231 l_information12 := p_information12;
232 END IF;
233 IF p_information13 = hr_api.g_varchar2 THEN
234 l_information13 := null;
235 ELSE
236 l_information13 := p_information13;
237 END IF;
238 IF p_information14 = hr_api.g_varchar2 THEN
239 l_information14 := null;
240 ELSE
241 l_information14 := p_information14;
242 END IF;
243 IF p_information15 = hr_api.g_varchar2 THEN
244 l_information15 := null;
245 ELSE
246 l_information15 := p_information15;
247 END IF;
248 IF p_information16 = hr_api.g_varchar2 THEN
249 l_information16 := null;
250 ELSE
251 l_information16 := p_information16;
252 END IF;
253 IF p_information17 = hr_api.g_varchar2 THEN
254 l_information17 := null;
255 ELSE
256 l_information17 := p_information17;
257 END IF;
258 IF p_information18 = hr_api.g_varchar2 THEN
259 l_information18 := null;
260 ELSE
261 l_information18 := p_information18;
262 END IF;
263 IF p_information19 = hr_api.g_varchar2 THEN
264 l_information19 := null;
265 ELSE
266 l_information19 := p_information19;
267 END IF;
268 IF p_information20 = hr_api.g_varchar2 THEN
269 l_information20 := null;
270 ELSE
271 l_information20 := p_information20;
272 END IF;
273 IF p_information21 = hr_api.g_varchar2 THEN
274 l_information21 := null;
275 ELSE
276 l_information21 := p_information21;
277 END IF;
278 IF p_information22 = hr_api.g_varchar2 THEN
279 l_information22 := null;
280 ELSE
281 l_information22 := p_information22;
282 END IF;
283 IF p_information23 = hr_api.g_varchar2 THEN
284 l_information23 := null;
285 ELSE
286 l_information23 := p_information23;
287 END IF;
288 IF p_information24 = hr_api.g_varchar2 THEN
289 l_information24 := null;
290 ELSE
291 l_information24 := p_information24;
292 END IF;
293 IF p_information25 = hr_api.g_varchar2 THEN
294 l_information25 := null;
295 ELSE
296 l_information25 := p_information25;
297 END IF;
298 IF p_information26 = hr_api.g_varchar2 THEN
299 l_information26 := null;
300 ELSE
301 l_information26 := p_information26;
302 END IF;
303 IF p_information27 = hr_api.g_varchar2 THEN
304 l_information27 := null;
305 ELSE
306 l_information27 := p_information27;
307 END IF;
308 IF p_information28 = hr_api.g_varchar2 THEN
309 l_information28 := null;
310 ELSE
311 l_information28 := p_information28;
312 END IF;
313 IF p_information29 = hr_api.g_varchar2 THEN
314 l_information29 := null;
315 ELSE
316 l_information29 := p_information29;
317 END IF;
318 IF p_information30 = hr_api.g_varchar2 THEN
319 l_information30 := null;
320 ELSE
321 l_information30 := p_information30;
322 END IF;
323
324 If l_index = 'aei' then
325 -- There are chances that the history table didn't have date corresponding to an
326 -- Extra info, as of the given effective_date , but the extra info table itself might have
327 -- the data. This cursor fetches the extra info id of the information_type to be updated
328 -- to ensure that the correct procedure is then called to create/udpate EI.
329 hr_utility.set_location('l_extra_info_id is ' ||l_extra_info_id || ' ' || l_proc,9);
330
331
332 If l_Extra_Info_Id is null then
333 for asg_ei in c_asg_ei loop
334 l_extra_info_id := asg_ei.assignment_extra_info_id;
335 l_ovn := asg_ei.object_version_number;
336 end loop;
337 hr_utility.set_location('l_extra_info_id is ' ||l_extra_info_id || ' ' || l_proc,10);
338 Else
339 l_ovn := p_l_object_version_number;
340 hr_utility.set_location('l_extra_info_id is ' ||l_extra_info_id || ' ' || l_proc,11);
341 End if;
342
343 -- Bug#9646565
344 IF P_l_Information_Type = 'GHR_US_ASG_DET_INFO' and (P_PA_REQUEST_REC.first_noa_code in ('930','730') and l_session.noa_id_correct is null) THEN
345 l_extra_info_id := NULL;
346 END IF;
347 --Bug#9646565
348
349
350 If l_extra_info_id is null then
351 hr_utility.set_location(l_proc,15);
352 hr_assignment_extra_info_api.create_assignment_extra_info
353 ( p_assignment_id => P_Pa_request_rec.Employee_Assignment_id
354 ,p_Information_type => p_l_information_type
355 ,p_aei_information_category => p_l_information_type
356 , p_aei_information1 => l_information1
357 , p_aei_information2 => l_information2
358 , p_aei_information3 => l_information3
359 , p_aei_information4 => l_information4
360 , p_aei_information5 => l_information5
361 , p_aei_information6 => l_information6
362 , p_aei_information7 => l_information7
363 , p_aei_information8 => l_information8
364 , p_aei_information9 => l_information9
365 , p_aei_information10 => l_information10
366 , p_aei_information11 => l_information11
367 , p_aei_information12 => l_information12
368 , p_aei_information13 => l_information13
369 , p_aei_information14 => l_information14
370 , p_aei_information15 => l_information15
371 , p_aei_information16 => l_information16
372 , p_aei_information17 => l_information17
373 , p_aei_information18 => l_information18
374 , p_aei_information19 => l_information19
375 , p_aei_information20 => l_information20
376 , p_aei_information21 => l_information21
377 , p_aei_information22 => l_information22
378 , p_aei_information23 => l_information23
379 , p_aei_information24 => l_information24
380 , p_aei_information25 => l_information25
381 , p_aei_information26 => l_information26
382 , p_aei_information27 => l_information27
383 , p_aei_information28 => l_information28
384 , p_aei_information29 => l_information29
385 , p_aei_information30 => l_information30
386 , p_assignment_extra_info_id => l_asg_cre_extra_info_id
387 , p_object_version_number => l_asg_cre_ovn );
388 Else
389 hr_utility.set_location(l_proc,20);
390 hr_assignment_extra_info_api.update_assignment_extra_info
391 ( p_assignment_extra_info_id => l_Extra_Info_Id
392 , p_object_version_number => l_ovn
393 , p_aei_information1 => p_information1
394 , p_aei_information2 => p_information2
395 , p_aei_information3 => p_information3
396 , p_aei_information4 => p_information4
397 , p_aei_information5 => p_information5
398 , p_aei_information6 => p_information6
399 , p_aei_information7 => p_information7
400 , p_aei_information8 => p_information8
401 , p_aei_information9 => p_information9
402 , p_aei_information10 => p_information10
403 , p_aei_information11 => p_information11
404 , p_aei_information12 => p_information12
405 , p_aei_information13 => p_information13
406 , p_aei_information14 => p_information14
407 , p_aei_information15 => p_information15
408 , p_aei_information16 => p_information16
409 , p_aei_information17 => p_information17
410 , p_aei_information18 => p_information18
411 , p_aei_information19 => p_information19
412 , p_aei_information20 => p_information20
413 , p_aei_information21 => p_information21
414 , p_aei_information22 => p_information22
415 , p_aei_information23 => p_information23
416 , p_aei_information24 => p_information24
417 , p_aei_information25 => p_information25
418 , p_aei_information26 => p_information26
419 , p_aei_information27 => p_information27
420 , p_aei_information28 => p_information28
421 , p_aei_information29 => p_information29
422 , p_aei_information30 => p_information30);
423 --
424 End if;
425 End if;
426 --
427
428 -- Update/Create Person Extra Info
429 --
430 --
431 If l_index = 'pei' then
432 hr_utility.set_location(l_proc,25);
433
434 If l_Extra_Info_Id is null then
435 hr_utility.set_location(to_char(l_id),1);
436 hr_utility.set_location(p_l_information_type,2);
437 for per_ei in c_per_ei loop
438 l_extra_info_id := per_ei.person_extra_info_id;
439 l_ovn := per_ei.object_version_number;
440 end loop;
441 Else
442 l_ovn := p_l_object_version_number;
443 End if;
444 hr_utility.set_location('pei_ovn is ' || to_char(l_ovn),1);
445 -- Bug#5045806 For Service Obligation EIT, Always create new EIT Record.
446 IF P_l_Information_Type = 'GHR_US_PER_SERVICE_OBLIGATION' THEN
447 l_extra_info_id := NULL;
448 END IF;
449 -- Bug#5045806
450 If l_extra_info_id is null then
451 hr_utility.set_location(l_proc,30);
452 hr_person_extra_info_api.create_person_extra_info
453 (p_Person_id => P_Pa_request_rec.Person_id
454 ,p_Information_type => p_l_information_type
455 ,p_pei_information_category => p_l_information_type
456 ,p_pei_information1 => l_information1
457 , p_pei_information2 => l_information2
458 , p_pei_information3 => l_information3
459 , p_pei_information4 => l_information4
460 , p_pei_information5 => l_information5
461 , p_pei_information6 => l_information6
462 , p_pei_information7 => l_information7
463 , p_pei_information8 => l_information8
464 , p_pei_information9 => l_information9
465 , p_pei_information10 => l_information10
466 , p_pei_information11 => l_information11
467 , p_pei_information12 => l_information12
468 , p_pei_information13 => l_information13
469 , p_pei_information14 => l_information14
470 , p_pei_information15 => l_information15
471 , p_pei_information16 => l_information16
472 , p_pei_information17 => l_information17
473 , p_pei_information18 => l_information18
474 , p_pei_information19 => l_information19
475 , p_pei_information20 => l_information20
476 , p_pei_information21 => l_information21
477 , p_pei_information22 => l_information22
478 , p_pei_information23 => l_information23
479 , p_pei_information24 => l_information24
480 , p_pei_information25 => l_information25
481 , p_pei_information26 => l_information26
482 , p_pei_information27 => l_information27
483 , p_pei_information28 => l_information28
484 , p_pei_information29 => l_information29
485 , p_pei_information30 => l_information30
486 ,p_person_extra_info_id => l_per_cre_extra_info_id
487 ,p_object_version_number => l_per_cre_ovn );
488 Else
489 --
490 hr_utility.set_location(l_proc,35);
491 hr_person_extra_info_api.update_person_extra_info
492 ( p_person_extra_info_id => l_Extra_Info_Id
493 , p_object_version_number => l_ovn
494 , p_pei_information1 => p_information1
495 , p_pei_information2 => p_information2
496 , p_pei_information3 => p_information3
497 , p_pei_information4 => p_information4
498 , p_pei_information5 => p_information5
499 , p_pei_information6 => p_information6
500 , p_pei_information7 => p_information7
501 , p_pei_information8 => p_information8
502 , p_pei_information9 => p_information9
503 , p_pei_information10 => p_information10
504 , p_pei_information11 => p_information11
505 , p_pei_information12 => p_information12
506 , p_pei_information13 => p_information13
507 , p_pei_information14 => p_information14
508 , p_pei_information15 => p_information15
509 , p_pei_information16 => p_information16
510 , p_pei_information17 => p_information17
511 , p_pei_information18 => p_information18
512 , p_pei_information19 => p_information19
513 , p_pei_information20 => p_information20
514 , p_pei_information21 => p_information21
515 , p_pei_information22 => p_information22
516 , p_pei_information23 => p_information23
517 , p_pei_information24 => p_information24
518 , p_pei_information25 => p_information25
519 , p_pei_information26 => p_information26
520 , p_pei_information27 => p_information27
521 , p_pei_information28 => p_information28
522 , p_pei_information29 => p_information29
523 , p_pei_information30 => p_information30);
524 --
525 End if;
526 End if;
527 --
528 --
529 -- Update/Create Position group1 Extra Info
530 --
531 --
532 If l_index = 'poei' then
533 hr_utility.set_location(l_proc,40);
534 If l_Extra_Info_Id is null then
535 for pos_ei in c_pos_ei loop
536 l_extra_info_id := pos_ei.position_extra_info_id;
537 l_ovn := pos_ei.object_version_number;
538 end loop;
539 Else
540 l_ovn := p_l_object_version_number;
541 End if;
542 hr_utility.set_location(l_proc,45);
543 If l_extra_info_id is null then
544 hr_position_extra_info_api.create_position_extra_info
545 ( p_position_id => P_Pa_request_rec.to_position_id
546 , p_Information_type => p_l_information_type
547 , p_poei_information_category => p_l_information_type
548 , p_poei_information1 => l_information1
549 , p_poei_information2 => l_information2
550 , p_poei_information3 => l_information3
551 , p_poei_information4 => l_information4
552 , p_poei_information5 => l_information5
553 , p_poei_information6 => l_information6
554 , p_poei_information7 => l_information7
555 , p_poei_information8 => l_information8
556 , p_poei_information9 => l_information9
557 , p_poei_information10 => l_information10
558 , p_poei_information11 => l_information11
559 , p_poei_information12 => l_information12
560 , p_poei_information13 => l_information13
561 , p_poei_information14 => l_information14
562 , p_poei_information15 => l_information15
563 , p_poei_information16 => l_information16
564 , p_poei_information17 => l_information17
565 , p_poei_information18 => l_information18
566 , p_poei_information19 => l_information19
567 , p_poei_information20 => l_information20
568 , p_poei_information21 => l_information21
569 , p_poei_information22 => l_information22
570 , p_poei_information23 => l_information23
571 , p_poei_information24 => l_information24
572 , p_poei_information25 => l_information25
573 , p_poei_information26 => l_information26
574 , p_poei_information27 => l_information27
575 , p_poei_information28 => l_information28
576 , p_poei_information29 => l_information29
577 , p_poei_information30 => l_information30
578 ,p_position_extra_info_id => l_pos1_cre_extra_info_id
579 ,p_object_version_number => l_pos1_cre_ovn
580 );
581 --
582 Else
583 --
584 hr_utility.set_location(l_proc,50);
585 hr_utility.set_location('GEN UPD' || to_char(l_Extra_Info_Id ),1);
586 hr_utility.set_location('GEN UPD' || to_char(p_l_Object_Version_Number ),1);
587
588 hr_position_extra_info_api.update_position_extra_info
589 ( p_position_extra_info_id => l_Extra_Info_Id
590 , p_object_version_number => l_ovn
591 , p_poei_information1 => p_information1
592 , p_poei_information2 => p_information2
593 , p_poei_information3 => p_information3
594 , p_poei_information4 => p_information4
595 , p_poei_information5 => p_information5
596 , p_poei_information6 => p_information6
597 , p_poei_information7 => p_information7
598 , p_poei_information8 => p_information8
599 , p_poei_information9 => p_information9
600 , p_poei_information10 => p_information10
601 , p_poei_information11 => p_information11
602 , p_poei_information12 => p_information12
603 , p_poei_information13 => p_information13
604 , p_poei_information14 => p_information14
605 , p_poei_information15 => p_information15
606 , p_poei_information16 => p_information16
607 , p_poei_information17 => p_information17
608 , p_poei_information18 => p_information18
609 , p_poei_information19 => p_information19
610 , p_poei_information20 => p_information20
611 , p_poei_information21 => p_information21
612 , p_poei_information22 => p_information22
613 , p_poei_information23 => p_information23
614 , p_poei_information24 => p_information24
615 , p_poei_information25 => p_information25
616 , p_poei_information26 => p_information26
617 , p_poei_information27 => p_information27
618 , p_poei_information28 => p_information28
619 , p_poei_information29 => p_information29
620 , p_poei_information30 => p_information30
621 );
622 --
623 End if;
624 End if;
625 --
626 --
627 hr_utility.set_location('Leaving ' ||l_proc,60);
628 Exception when others then
629 --
630 -- Reset IN OUT parameters and set OUT parameters
631 --
632 p_l_object_version_number := l_initial_ovn;
633 raise;
634
635 End Generic_Update_Extra_Info;
636
637 Procedure Update_Retained_Grade
638 (P_PA_REQUEST_REC IN GHR_PA_REQUESTS%ROWTYPE ,
639 P_Per_retained_grade IN OUT NOCOPY GHR_API.Per_retained_grade_TYPE) IS
640 --
641 --
642 cursor c_702_rec is
643 select rei_information3,pei_information1,
644 pei.object_version_number ovn
645 from ghr_pa_request_extra_info rei,
646 per_people_extra_info pei
647 where pa_request_id = p_pa_request_rec.pa_request_id
648 and pei.person_extra_info_id = rei.rei_information3
649 and pei.information_type = 'GHR_US_RETAINED_GRADE'
650 and rei.information_type = 'GHR_US_PAR_TERM_RG_PROMO'
651 and nvl(rei.rei_information30,hr_api.g_varchar2) <> 'Original RPA';
652 --
653 cursor c_740_rec is
654 select rei_information3,pei_information1,
655 pei.object_version_number ovn
656 from ghr_pa_request_extra_info rei,
657 per_people_extra_info pei
658 where pa_request_id = p_pa_request_rec.pa_request_id
659 and pei.person_extra_info_id = rei.rei_information3
660 and pei.information_type = 'GHR_US_RETAINED_GRADE'
661 and rei.information_type = 'GHR_US_PAR_TERM_RG_POSN_CHG'
662 and (rei.rei_information5 is null or rei.rei_information5 = 'Y')
663 and nvl(rei.rei_information30,hr_api.g_varchar2) <> 'Original RPA';
664
665
666 l_retained_grade_rec ghr_pay_calc.retained_grade_rec_type;
667 l_ret_grade_rec ghr_pay_calc.retained_grade_rec_type;
668 -- Bug#4698321 created l_cur_date_from variable.
669 l_cur_date_from per_people_extra_info.pei_information1%type;
670 l_new_date_to per_people_extra_info.pei_information1%type;
671 l_new_grade_or_level per_people_extra_info.pei_information3%type;
672 l_new_pay_plan per_people_extra_info.pei_information3%type;
673 l_new_pay_table per_people_extra_info.pei_information3%type;
674 l_new_loc_percent per_people_extra_info.pei_information3%type;
675 l_new_pay_basis per_people_extra_info.pei_information3%type;
676 l_temp_step per_people_extra_info.pei_information9%type;
677 l_new_temp_step per_people_extra_info.pei_information9%type;
678 l_new_step_or_rate per_people_extra_info.pei_information4%type;
679 l_step_or_rate per_people_extra_info.pei_information4%type;
680 l_ret_object_version_number ghr_pa_requests.object_version_number%type;
681 l_ovn ghr_pa_requests.object_version_number%type;
682
683
684 CURSOR cur_temp_step
685 IS
686 SELECT rei_information3 temp_step
687 FROM ghr_pa_request_extra_info
688 WHERE pa_request_id = p_pa_request_rec.pa_request_id
689 AND information_type = 'GHR_US_PAR_RG_TEMP_PROMO';
690
691 l_session ghr_history_api.g_session_var_type;
692 l_proc varchar2(70) := 'Update_Retained_Grade';
693 l_per_retained_grade GHR_API.Per_retained_grade_TYPE;
694 -- Bug#4698321 Added pei_information1 to the cursor.
695 Cursor c_retained_grade_ovn is
696 select object_version_number,
697 pei_information1,
698 pei_information2,
699 pei_information3,
700 pei_information4,
701 pei_information5,
702 pei_information6,
703 pei_information7,
704 pei_information8,
705 pei_information9
706 from per_people_extra_info
707 where person_extra_info_id = l_retained_grade_rec.person_extra_info_id;
708
709 l_effective_date Date;
710 BEGIN
711 hr_utility.set_location('Entering '||l_proc,5);
712 l_per_retained_grade := P_Per_retained_grade;
713 ghr_history_api.get_g_session_var(l_session); -- Bug 3021003
714 hr_utility.set_location('Effective Date '||p_pa_request_rec.effective_date,1);
715 IF p_pa_request_rec.first_noa_code = '702' THEN
716 --702 Processing
717 hr_utility.set_location('702 RG Processing '||l_proc,10);
718 FOR rg_rec in c_702_rec LOOP
719 hr_utility.set_location('Effective Date '||p_pa_request_rec.effective_date,1);
720 hr_utility.set_location('702 RG Processing '||rg_rec.rei_information3,11);
721 IF fnd_date.canonical_to_date(rg_rec.pei_information1) >
722 (p_pa_request_rec.effective_date - 1) THEN
723 hr_utility.set_message(8301,'GHR_38692_RG_TO_DATE_LESSER');
724 hr_utility.raise_error;
725 END IF;
726 Generic_Update_Extra_Info
727 (p_pa_request_rec => P_PA_REQUEST_REC
728 ,p_l_information_type => 'GHR_US_RETAINED_GRADE'
729 ,p_extra_info_id => rg_rec.rei_information3
730 ,p_l_object_version_number => rg_rec.ovn
731 ,p_information2 => fnd_date.date_to_canonical(p_pa_request_rec.effective_date - 1)
732 );
733 END LOOP;
734 ELSIF p_pa_request_rec.first_noa_code = '740' THEN
735 --740 Processing
736 hr_utility.set_location('740 RG Processing '||l_proc,15);
737 FOR rg_rec in c_740_rec LOOP
738 hr_utility.set_location('Effective Date '||p_pa_request_rec.effective_date,1);
739 hr_utility.set_location('740 RG Processing '||rg_rec.rei_information3,12);
740 IF fnd_date.canonical_to_date(rg_rec.pei_information1) >
741 (p_pa_request_rec.effective_date - 1) THEN
742 hr_utility.set_message(8301,'GHR_38692_RG_TO_DATE_LESSER');
743 hr_utility.raise_error;
744 END IF;
745 Generic_Update_Extra_Info
746 (p_pa_request_rec => P_PA_REQUEST_REC
747 ,p_l_information_type => 'GHR_US_RETAINED_GRADE'
748 ,p_extra_info_id => rg_rec.rei_information3
749 ,p_l_object_version_number => rg_rec.ovn
750 ,p_information2 => fnd_date.date_to_canonical(p_pa_request_rec.effective_date - 1)
751 );
752 END LOOP;
753 -------Bug 5913362 -- Adding 890
754 ELSIF p_pa_request_rec.first_noa_code IN ('866', '890') THEN
755 -- 866 Processing
756 IF p_per_retained_grade.per_retained_grade_flag = 'Y' THEN
757 IF p_pa_request_rec.first_noa_code = '890' THEN
758 l_effective_date := p_pa_request_rec.effective_date - 1;
759 ELSE
760 l_effective_date := p_pa_request_rec.effective_date;
761 END IF;
762 --
763 hr_utility.set_location('866 RG Processing '||l_proc,15);
764 hr_utility.set_location('Inside 866 processing '||p_per_retained_grade.person_extra_info_id,1);
765 Generic_Update_Extra_Info
766 (p_pa_request_rec => P_PA_REQUEST_REC
767 ,p_l_information_type => 'GHR_US_RETAINED_GRADE'
768 ,p_extra_info_id => p_per_retained_grade.person_extra_info_id
769 ,p_l_object_version_number => p_per_retained_grade.object_version_number
770 ,p_information2 => fnd_date.date_to_canonical(l_effective_date)
771 );
772 FOR cur_temp_step_rec IN cur_temp_step LOOP
773 l_new_temp_step := cur_temp_step_rec.temp_step;
774 END LOOP;
775 IF l_new_temp_step is not null THEN
776 l_retained_grade_rec :=
777 ghr_pc_basic_pay.get_retained_grade_details
778 (p_person_id => p_pa_request_rec.person_id,
779 p_effective_date => p_pa_request_rec.effective_date,
780 p_pa_request_id => p_pa_request_rec.pa_request_id
781 );
782 IF l_retained_grade_rec.person_extra_info_id is not null then
783 hr_utility.set_location('Inside 866 processing '||l_retained_grade_rec.person_extra_info_id,1);
784 FOR retained_grade_ovn IN c_retained_grade_ovn LOOP
785 l_ret_object_version_number := retained_grade_ovn.object_version_number;
786 l_new_date_to := retained_grade_ovn.pei_information2;
787 l_new_grade_or_level := retained_grade_ovn.pei_information3;
788 l_new_step_or_rate := retained_grade_ovn.pei_information4;
789 l_new_pay_plan := retained_grade_ovn.pei_information5;
790 l_new_pay_table := retained_grade_ovn.pei_information6;
791 l_new_loc_percent := retained_grade_ovn.pei_information7;
792 l_new_pay_basis := retained_grade_ovn.pei_information8;
793 exit;
794 END LOOP;
795 ghr_history_api.get_g_session_var(l_session);
796 hr_utility.set_location('Inside 866 processing ',2);
797 IF l_session.noa_id_correct is null then
798 -- End date the existing RG record
799 hr_person_extra_info_api.update_person_extra_info
800 (p_person_extra_info_id => l_retained_grade_rec.person_extra_info_id,
801 p_object_version_number => l_ret_object_version_number,
802 p_pei_information2 => fnd_date.date_to_canonical(p_pa_request_rec.effective_date )
803 );
804 hr_utility.set_location('Inside 866 processing ',3);
805 -- Create the new RG Record with Temporary Promotion Step Value
806 hr_person_extra_info_api.create_person_extra_info
807 (p_person_id => p_pa_request_rec.person_id,
808 p_information_type => 'GHR_US_RETAINED_GRADE',
809 p_pei_information_category => 'GHR_US_RETAINED_GRADE',
810 p_person_extra_info_id => l_ret_grade_rec.person_extra_info_id,
811 p_object_version_number => l_ret_object_version_number,
812 p_pei_information1 =>
813 fnd_date.date_to_canonical(p_pa_request_rec.effective_date + 1),
814 p_pei_information2 => l_new_date_to,
815 p_pei_information3 => l_new_grade_or_level,
816 p_pei_information4 => l_new_step_or_rate,
817 p_pei_information5 => l_new_pay_plan,
818 p_pei_information6 => l_new_pay_table,
819 p_pei_information7 => l_new_loc_percent,
820 p_pei_information8 => l_new_pay_basis,
821 p_pei_information9 => l_new_temp_step
822 );
823 hr_utility.set_location('Inside 866 processing ',3);
824 ELSE
825 -- Update the TPS in Retain Grade record
826 hr_person_extra_info_api.update_person_extra_info
827 (p_person_extra_info_id => l_retained_grade_rec.person_extra_info_id,
828 p_object_version_number => l_ret_object_version_number,
829 p_pei_information9 => l_new_temp_step
830 );
831 END IF;
832 END IF;
833 END IF;
834 END IF;
835 -- Sundar 3021003 Need to update Person EI with the retained grade for WGI, QSI actions, if Step is different
836 -- from Person EI.
837 ELSIF p_pa_request_rec.first_noa_code IN ('867','892','893') AND l_session.noa_id_correct IS NOT NULL
838 AND p_pa_request_rec.PAY_RATE_DETERMINANT in ('A','B','E','F','U','V') THEN -- Bug 3500132
839 l_retained_grade_rec :=
840 ghr_pc_basic_pay.get_retained_grade_details
841 (p_person_id => p_pa_request_rec.person_id,
842 p_effective_date => p_pa_request_rec.effective_date,
843 p_pa_request_id => p_pa_request_rec.altered_pa_request_id
844 );
845 hr_utility.set_location('Inside Sun processing '||l_retained_grade_rec.person_extra_info_id,1);
846 IF l_retained_grade_rec.person_extra_info_id IS NOT NULL THEN
847 FOR retained_grade_ovn IN c_retained_grade_ovn LOOP
848 l_ret_object_version_number := retained_grade_ovn.object_version_number;
849 EXIT;
850 END LOOP;
851 hr_utility.set_location('P_Per_retained_grade.step_or_rate '||P_Per_retained_grade.retain_step_or_rate,1);
852 hr_utility.set_location('l_retained_grade_rec.step_or_rate '||l_retained_grade_rec.step_or_rate,1);
853 IF (NVL(P_Per_retained_grade.retain_step_or_rate,-1) <> NVL(l_retained_grade_rec.step_or_rate,-1)) THEN
854 hr_person_extra_info_api.update_person_extra_info
855 (p_person_extra_info_id => l_retained_grade_rec.person_extra_info_id,
856 p_object_version_number => l_ret_object_version_number,
857 p_pei_information4 => P_Per_retained_grade.retain_step_or_rate
858 );
859 END IF;
860 hr_utility.set_location('P_Per_retained_grade.temp_step '||P_Per_retained_grade.temp_step,1);
861 hr_utility.set_location('l_retained_grade_rec.temp_step '||l_retained_grade_rec.temp_step,1);
862 IF (NVL(P_Per_retained_grade.temp_step,-1) <> NVL(l_retained_grade_rec.temp_step,-1)) THEN
863 hr_person_extra_info_api.update_person_extra_info
864 (p_person_extra_info_id => l_retained_grade_rec.person_extra_info_id,
865 p_object_version_number => l_ret_object_version_number,
866 p_pei_information9 => P_Per_retained_grade.temp_step
867 );
868 END IF;
869 END IF;
870 END IF;
871 --
872 -- SKIP the following process for NOA Code 866 as it is already handled in the above code.
873 -- However, don't skip NOACs 702,740 as they may not terminate RG. In some cases, they
874 -- may have effective RG record.
875 -------Bug 5913362 -- Adding 890
876 IF (ghr_pay_calc.g_fwfa_pay_calc_flag) and
877 p_pa_request_rec.first_noa_code NOT IN ('866', '890')THEN
878
879 BEGIN
880 -- FWFA Changes Bug#4444609 Added the IF Condition.
881 l_retained_grade_rec := ghr_pc_basic_pay.get_retained_grade_details
882 (p_person_id => p_pa_request_rec.person_id,
883 p_effective_date => p_pa_request_rec.effective_date,
884 p_pa_request_id => p_pa_request_rec.pa_request_id
885 );
886
887 IF l_retained_grade_rec.person_extra_info_id is not null then
888 hr_utility.set_location('Inside FWFA RG processing '||l_retained_grade_rec.person_extra_info_id,1);
889 FOR retained_grade_ovn IN c_retained_grade_ovn LOOP
890 l_ret_object_version_number := retained_grade_ovn.object_version_number;
891 l_cur_date_from := retained_grade_ovn.pei_information1;
892 l_new_date_to := retained_grade_ovn.pei_information2;
893 l_new_grade_or_level := retained_grade_ovn.pei_information3;
894 l_new_step_or_rate := retained_grade_ovn.pei_information4;
895 l_new_pay_plan := retained_grade_ovn.pei_information5;
896 l_new_pay_table := retained_grade_ovn.pei_information6;
897 l_new_loc_percent := retained_grade_ovn.pei_information7;
898 l_new_pay_basis := retained_grade_ovn.pei_information8;
899 l_new_temp_step := retained_grade_ovn.pei_information9;
900 exit;
901 END LOOP;
902
903 IF ghr_pay_calc.g_pay_table_upd_flag THEN
904 l_new_pay_table := p_per_retained_grade.retain_pay_table_id;
905 p_per_retained_grade.per_retained_grade_flag := 'Y';
906 END IF;
907
908 IF p_pa_request_rec.first_noa_code in ('867','892','893') AND
909 l_session.noa_id_correct IS NULL THEN
910 -- Handled the retained step and temp.step cases separately
911 p_per_retained_grade.per_retained_grade_flag := 'Y';
912
913 IF l_new_temp_step IS NOT NULL THEN
914 IF TO_NUMBER(l_new_temp_step) < 9 THEN
915 l_temp_step := '0' ||(l_new_temp_step + 1 );
916 l_new_temp_step := l_temp_step;
917 ELSE
918 l_temp_step := l_new_temp_step + 1 ;
919 l_new_temp_step := l_temp_step;
920 END IF;
921 ELSE -- For Retained Grade
922 if to_number(l_new_step_or_rate) < 9 then
923 l_step_or_rate := '0' ||(l_new_step_or_rate + 1 );
924 l_new_step_or_rate := l_step_or_rate;
925 ELSE
926 l_step_or_rate := l_new_step_or_rate + 1;
927 l_new_step_or_rate := l_step_or_rate;
928 END IF;
929 END IF; -- If l_retained_grade_rec.temp_step is not null
930 hr_utility.set_location('FWFA New Step or Rate for Ret Grd Rec. is ' || l_new_step_or_rate,3);
931 hr_utility.set_location('FWFA temp_step is ' || l_new_temp_step,2);
932 END IF;
933
934 ---BUG# 4999237 HANDLED FOR 894 TERMINATION OF PAY RETENTION
935 -- Bug#5679022 Pass the g_step_or_rate in case of 894 for pay retention termination.
936 IF p_pa_request_rec.first_noa_code = '894' THEN
937 IF ghr_process_sf52.g_step_or_rate IS NOT NULL THEN
938 l_new_step_or_rate := ghr_process_sf52.g_step_or_rate;
939 p_per_retained_grade.per_retained_grade_flag := 'Y';
940 END IF;
941 END IF;
942 --END BUG 4999237
943
944 hr_utility.set_location('new Pay table id :'||p_per_retained_grade.retain_pay_table_id,20);
945 -- Bug#4698321 IF the retained grade record starts on the same day of the action,
946 -- update the same record. Otherwise, end date current record and create new record.
947 -- Bug#4719037 RG record created unnecessarily where g_pay_table_upd_flag is FALSE.
948 -- So, added the per_retained_grade_flag condition to avoid it.
949 IF p_per_retained_grade.per_retained_grade_flag = 'Y' THEN
950 IF TRUNC(fnd_date.canonical_to_date(l_cur_date_from)) = TRUNC(p_pa_request_rec.effective_date) THEN
951 hr_utility.set_location('RG Start date Equal to RPA Effective Date ',22);
952 Generic_Update_Extra_Info
953 (p_pa_request_rec => P_PA_REQUEST_REC
954 ,p_l_information_type => 'GHR_US_RETAINED_GRADE'
955 ,p_extra_info_id => l_retained_grade_rec.person_extra_info_id
956 ,p_l_object_version_number => l_ret_object_version_number
957 ,p_information1 => l_cur_date_from
958 ,p_information2 => l_new_date_to
959 ,p_information3 => l_new_grade_or_level
960 ,p_information4 => l_new_step_or_rate
961 ,p_information5 => l_new_pay_plan
962 ,p_information6 => l_new_pay_table
963 ,p_Information7 => l_new_loc_percent
964 ,p_information8 => l_new_pay_basis
965 ,p_information9 => l_new_temp_step
966 );
967 ELSE
968 hr_utility.set_location('RG Start date NOT EQUAL to RPA Effective Date ',27);
969 Generic_Update_Extra_Info
970 (p_pa_request_rec => P_PA_REQUEST_REC
971 ,p_l_information_type => 'GHR_US_RETAINED_GRADE'
972 ,p_extra_info_id => l_retained_grade_rec.person_extra_info_id
973 ,p_l_object_version_number => l_ret_object_version_number
974 ,p_information2 => fnd_date.date_to_canonical(p_pa_request_rec.effective_date - 1)
975 );
976
977 -- Create the new RG Record with Temporary Promotion Step Value
978 hr_person_extra_info_api.create_person_extra_info
979 (p_person_id => p_pa_request_rec.person_id,
980 p_information_type => 'GHR_US_RETAINED_GRADE',
981 p_pei_information_category => 'GHR_US_RETAINED_GRADE',
982 p_person_extra_info_id => l_ret_grade_rec.person_extra_info_id,
983 p_object_version_number => l_ovn,
984 p_pei_information1 =>
985 fnd_date.date_to_canonical(p_pa_request_rec.effective_date),
986 p_pei_information2 => l_new_date_to,
987 p_pei_information3 => l_new_grade_or_level,
988 p_pei_information4 => l_new_step_or_rate,
989 p_pei_information5 => l_new_pay_plan,
990 p_pei_information6 => l_new_pay_table,
991 p_pei_information7 => l_new_loc_percent,
992 p_pei_information8 => l_new_pay_basis,
993 p_pei_information9 => l_new_temp_step
994 );
995 END IF;
996 hr_utility.set_location('Inside FWFA processing ',3);
997 END IF; -- per_retained_grade_flag
998 END IF; -- l_retained_grade_rec.person_extra_info_id NOT NULL
999 EXCEPTION
1000 -- IF No RG Record Exists, skip this updation.
1001 WHEN ghr_pay_calc.pay_calc_message THEN
1002 NULL;
1003 WHEN OTHERS THEN
1004 RAISE;
1005 END;
1006 END IF;
1007 -- FWFA Changes
1008 Exception when others then
1009 --
1010 -- Reset IN OUT parameters and set OUT parameters
1011 --
1012 P_Per_retained_grade := l_per_retained_grade;
1013 raise;
1014
1015 END Update_Retained_Grade;
1016 --
1017 ------------------------------
1018 -- Procedure Update_edu_sit -- To create/Update Education Sp. Info Type
1019 -------------------------------
1020
1021 Procedure update_edu_sit
1022 (p_pa_request_rec in ghr_pa_requests%rowtype
1023 ) is
1024
1025 l_proc varchar2(72) := 'Generic Sit';
1026 l_business_group_id per_people_f.business_group_id%type;
1027 l_id_flex_num fnd_id_flex_structures.id_flex_num%type;
1028 l_analysis_criteria_id per_analysis_criteria.analysis_criteria_id%type;
1029 l_personal_analysis_id per_person_analyses.person_analysis_id%type;
1030 l_education_level ghr_pa_requests.education_level%type;
1031 l_year_degree_attained ghr_pa_requests.year_degree_attained%type;
1032 l_academic_discipline ghr_pa_requests.academic_discipline%type;
1033 l_object_version_number number(9);
1034 l_multiple varchar2(1);
1035 l_session ghr_history_api.g_session_var_type;
1036 l_special_info ghr_api.special_information_type;
1037
1038
1039
1040 -- Cursor to fetch the id_flex_num for the "US Fed Education" structure
1041
1042 Cursor c_flex_num is
1043 select id_flex_num
1044 from fnd_id_flex_structures_tl
1045 where id_flex_structure_name = 'US Fed Education'
1046 and language = 'US';
1047 -- and id_flex_code = 'PEA' --??
1048 -- and application_id = 800 --??
1049
1050 -- Cursor to check if the Special info type record already exists for the person
1051
1052 Cursor c_person_sit is
1053 select analysis_criteria_id ,
1054 person_analysis_id ,
1055 object_version_number
1056 from per_person_analyses
1057 where person_id = p_pa_request_rec.person_id
1058 and id_flex_num = l_id_flex_num;
1059
1060 -- Cursor to return the record with the highest education level (segment1) for the person for the specific id_flex_num
1061
1062 Cursor c_special_info is
1063 select pea.analysis_criteria_id,
1064 pea.segment1 education_level,
1065 pea.segment2 academic_discipline,
1066 pea.segment3 year_degree_attained,
1067 pan.person_analysis_id,
1068 pan.object_version_number
1069 from per_analysis_criteria pea,
1070 per_person_analyses pan
1071 where pan.person_id = p_pa_request_rec.person_id
1072 and pan.id_flex_num = l_id_flex_num
1073 and pea.id_flex_num = pan.id_flex_num
1074 and p_pa_request_rec.effective_date
1075 between nvl(pan.date_from,p_pa_request_rec.effective_date)
1076 and nvl(pan.date_to,p_pa_request_rec.effective_date)
1077 and p_pa_request_rec.effective_date
1078 between nvl(pea.start_date_active,p_pa_request_rec.effective_date)
1079 and nvl(pea.end_date_active,p_pa_request_rec.effective_date)
1080 and pan.analysis_criteria_id = pea.analysis_criteria_id
1081 order by pea.segment1 desc;
1082
1083
1084 --
1085 Cursor c_edu_sit is
1086 select segment1 education_level,
1087 segment2 academic_discipline,
1088 segment3 year_degree_attained
1089 from per_analysis_criteria
1090 where analysis_criteria_id = l_analysis_criteria_id
1091 and id_flex_num = l_id_flex_num;
1092
1093 -- Cursor to select the business_group_id that the person belongs to
1094
1095 Cursor c_bgpid is
1096 select business_group_id
1097 from per_all_people_f
1098 where person_id = p_pa_request_rec.person_id
1099 and p_pa_request_rec.effective_date
1100 between effective_start_date and effective_end_date;
1101
1102 -- Cursor to check if the specific special info. type is Multiple Occurring, depending on which
1103 -- we can then determine whether a record has to be created / Updated
1104
1105 Cursor c_multiple_occur is
1106 select multiple_occurrences_flag
1107 from per_special_info_types sit
1108 where business_group_id = l_business_group_id
1109 and id_flex_num = l_id_flex_num;
1110
1111
1112 -- determine whether to create or update sit
1113 -- 1 Get the id_flex_num for the id_flex_structure 'US Fed Education'
1114
1115 begin
1116 hr_utility.set_location('Entering ' || l_proc,5);
1117
1118 for bgp in c_bgpid loop
1119 hr_utility.set_location(l_proc,10);
1120 l_business_group_id := bgp.business_group_id;
1121 End loop;
1122
1123 for flex_num in c_flex_num loop
1124 hr_utility.set_location(l_proc,12);
1125 l_id_flex_num := flex_num.id_flex_num;
1126 end loop;
1127 hr_utility.set_location(l_proc,15);
1128
1129 -- Check to see if the person already has an entry for the SIT
1130
1131 for person_sit in c_person_sit loop
1132 hr_utility.set_location(l_proc,20);
1133 l_analysis_criteria_id := person_sit.analysis_criteria_id;
1134 l_personal_analysis_id := person_sit.person_analysis_id;
1135 l_object_version_number := person_sit.object_version_number;
1136 End loop;
1137
1138 -- If l_analysis_Criteria_id is null, then create a sit.
1139 -- If it exists, and multiple_occurences allowed
1140 -- If it exists check if the values have to updated at all. If they are the same do not update
1141 -- else update_sit
1142
1143
1144 -- Note : If multiple_occurences are allowed, for the special_info_type, then
1145 -- Update only in case of a 'CORRECTION' ,else create new rows in pan and pea
1146 -- Also while retrieving , fetch the row that has the highest education level -??
1147
1148
1149 If l_analysis_criteria_id is null then
1150 hr_utility.set_location(l_proc,25);
1151 hr_sit_api.create_sit
1152 (p_person_id => p_pa_request_rec.person_id,
1153 p_business_group_id => l_business_group_id,
1154 p_id_flex_num => l_id_flex_num,
1155 p_effective_date => p_pa_request_rec.effective_date,
1156 p_date_from => p_pa_request_rec.effective_date,
1157 p_segment1 => p_pa_request_rec.education_level,
1158 p_segment2 => p_pa_request_rec.academic_discipline,
1159 p_segment3 => p_pa_request_rec.year_degree_attained,
1160 p_analysis_criteria_id => l_analysis_criteria_id, --out
1161 p_person_analysis_id => l_personal_analysis_id,
1162 p_pea_object_version_number => l_object_version_number
1163 );
1164 hr_utility.set_location(l_proc,30);
1165
1166 Else
1167 -- If sit already exists for the person and it can be multiple occurring, then
1168 -- if it is not a correction, then create a new one, else update
1169 hr_utility.set_location(l_proc,35);
1170 /*
1171 Commented out nocopy by skutteti for bug # 655203 as multiple occurences flag need not be checked for edu sit.
1172 for multiple_occur in c_multiple_occur loop
1173 hr_utility.set_location(l_proc,36);
1174 l_multiple := multiple_occur.multiple_occurrences_flag;
1175 end loop;
1176 */
1177
1178 ghr_history_api.get_g_session_var(l_session);
1179 If l_session.noa_id_correct is null then
1180 l_personal_analysis_id := Null;
1181 for special_info in c_special_info loop
1182 hr_utility.set_location(l_proc,40);
1183 l_education_level := special_info.education_level;
1184 l_academic_discipline := special_info.academic_discipline;
1185 l_year_degree_attained := special_info.year_degree_attained;
1186 l_personal_analysis_id := special_info.person_analysis_id;
1187 l_object_version_number := special_info.object_version_number;
1188 exit;
1189 End loop;
1190 Else -- read from history
1191 l_personal_analysis_id := Null;
1192 ghr_history_fetch.return_special_information
1193 (p_person_id => p_pa_request_rec.person_id,
1194 p_structure_name => 'US Fed Education',
1195 p_effective_date => p_pa_request_rec.effective_date,
1196 p_special_info => l_special_info
1197 );
1198 l_education_level := l_special_info.segment1;
1199 l_academic_discipline := l_special_info.segment2;
1200 l_year_degree_attained := l_special_info.segment3;
1201 l_personal_analysis_id := l_special_info.person_analysis_id;
1202 l_object_version_number := l_special_info.object_version_number;
1203 End if;
1204
1205 hr_utility.set_location(l_proc,45);
1206 hr_utility.set_location('l_education_level is '||l_education_level,46);
1207 hr_utility.set_location('l_academic_discipline is '||l_academic_discipline,47);
1208 hr_utility.set_location('l_year_degree_attained is '||l_year_degree_attained,48);
1209
1210 hr_utility.set_location('p_pa_request_rec.education_level is '||p_pa_request_rec.education_level,46);
1211 hr_utility.set_location('p_pa_request_rec.academic_discipline is '||p_pa_request_rec.academic_discipline,46);
1212 hr_utility.set_location('p_pa_request_rec.year_degree_attained is '||p_pa_request_rec.year_degree_attained,46);
1213
1214 If nvl(l_education_level,hr_api.g_varchar2) <> nvl(p_pa_request_rec.education_level,hr_api.g_varchar2) or
1215 nvl(l_academic_discipline,hr_api.g_varchar2) <> nvl(p_pa_request_rec.academic_discipline,hr_api.g_varchar2) or
1216 to_char(nvl(l_year_degree_attained,hr_api.g_number)) <> to_char(nvl(p_pa_request_rec.year_degree_attained,hr_api.g_number)) then
1217
1218 -- Commented out by skutteti for bug # 655203 as multiple occurences flag need not be checked for edu sit.
1219 -- If nvl(l_multiple,'Y') = 'Y' and l_session.noa_id_correct is null then
1220
1221 If l_session.noa_id_correct is null or l_personal_analysis_id is null then
1222 hr_utility.set_location(l_proc,37);
1223 l_analysis_criteria_id := null;
1224 hr_sit_api.create_sit
1225 (p_person_id => p_pa_request_rec.person_id,
1226 p_business_group_id => l_business_group_id,
1227 p_id_flex_num => l_id_flex_num,
1228 p_effective_date => p_pa_request_rec.effective_date,
1229 p_date_from => p_pa_request_rec.effective_date,
1230 p_segment1 => p_pa_request_rec.education_level,
1231 p_segment2 => p_pa_request_rec.academic_discipline,
1232 p_segment3 => to_char(p_pa_request_rec.year_degree_attained),
1233 p_analysis_criteria_id => l_analysis_criteria_id, --out
1234 p_person_analysis_id => l_personal_analysis_id,
1235 p_pea_object_version_number => l_object_version_number
1236 );
1237 Else
1238 l_analysis_criteria_id := null;
1239 hr_sit_api.update_sit
1240 (p_person_analysis_id => l_personal_analysis_id,
1241 p_pea_object_version_number => l_object_version_number,
1242 p_date_from => p_pa_request_rec.effective_date, ---??
1243 p_segment1 => p_pa_request_rec.education_level,
1244 p_segment2 => p_pa_request_rec.academic_discipline,
1245 p_segment3 => p_pa_request_rec.year_degree_attained,
1246 p_analysis_criteria_id => l_analysis_criteria_id
1247 );
1248 hr_utility.set_location(l_proc,55);
1249 End if;
1250 End if;
1251 End if;
1252 End update_edu_sit;
1253 --
1254
1255
1256 --
1257
1258
1259 -- *************************
1260 -- Procedure call_extra_info_api
1261 -- *************************
1262 --
1263 Procedure call_extra_info_api
1264 (P_PA_REQUEST_REC IN GHR_PA_REQUESTS%ROWTYPE,
1265 P_Asg_Sf52 IN OUT NOCOPY GHR_API.Asg_Sf52_TYPE,
1266 P_Asg_non_Sf52 IN OUT NOCOPY GHR_API.Asg_non_Sf52_TYPE,
1267 P_Asg_nte_dates IN OUT NOCOPY GHR_API.Asg_nte_dates_TYPE,
1268 p_asg_detail_info in OUT nocopy ghr_api.asg_detail_info_type, --Bug# 8653508
1269 P_Per_Sf52 IN OUT NOCOPY GHR_API.Per_Sf52_TYPE,
1270 P_Per_Group1 IN OUT NOCOPY GHR_API.Per_Group1_TYPE,
1271 P_Per_Group2 IN OUT NOCOPY GHR_API.Per_Group2_TYPE,
1272 P_Per_scd_info IN OUT NOCOPY GHR_API.Per_scd_info_TYPE,
1273 P_Per_retained_grade IN OUT NOCOPY GHR_API.Per_retained_grade_TYPE,
1274 P_Per_probations IN OUT NOCOPY GHR_API.Per_probations_TYPE,
1275 P_Per_sep_retire IN OUT NOCOPY GHR_API.Per_sep_retire_TYPE,
1276 P_Per_security IN OUT NOCOPY GHR_API.Per_security_TYPE,
1277 --Bug#4486823 RRR Changes
1278 p_per_service_oblig IN OUT NOCOPY GHR_API.Per_service_oblig_TYPE,
1279 P_Per_conversions IN OUT NOCOPY GHR_API.Per_conversions_TYPE,
1280 -- BEN_EIT Changes
1281 p_per_benefit_info IN OUT nocopy ghr_api.per_benefit_info_type,
1282 P_Per_uniformed_services IN OUT NOCOPY GHR_API.Per_uniformed_services_TYPE,
1283 P_Pos_oblig IN OUT NOCOPY GHR_API.Pos_oblig_TYPE,
1284 P_Pos_Grp2 IN OUT NOCOPY GHR_API.Pos_Grp2_TYPE,
1285 P_Pos_Grp1 IN OUT NOCOPY GHR_API.Pos_Grp1_TYPE,
1286 P_Pos_valid_grade IN OUT NOCOPY GHR_API.Pos_valid_grade_TYPE,
1287 P_Pos_car_prog IN OUT NOCOPY GHR_API.Pos_car_prog_TYPE,
1288 p_Perf_appraisal IN out nocopy ghr_api.performance_appraisal_type,
1289 p_conduct_performance IN out nocopy ghr_api.conduct_performance_type,
1290 P_Loc_Info IN OUT NOCOPY GHR_API.Loc_Info_TYPE,
1291 P_generic_Extra_Info_Rec IN out nocopy GHR_api.generic_Extra_Info_Rec_Type,
1292 P_par_term_retained_grade IN out nocopy GHR_api.par_term_retained_grade_type,
1293 p_per_race_ethnic_info IN out nocopy ghr_api.per_race_ethnic_type,
1294 -- Bug #6312144 New RPA EIT Benefits
1295 p_ipa_benefits_cont IN out nocopy ghr_api.per_ipa_ben_cont_info_type,
1296 p_retirement_info IN out nocopy ghr_api.per_retirement_info_type) is
1297
1298 --
1299 l_proc varchar2(70) := 'Call Extra Info';
1300 l_segment_rec ghr_api.special_information_type;
1301 l_form_field_name varchar2(50);
1302 l_posn_title_pm varchar2(50);
1303 l_WS_pm varchar2(50);
1304 l_DS_pm varchar2(50);
1305 l_personnel_office_id ghr_pa_requests.personnel_office_id%type; --\
1306 l_org_structure_id per_position_extra_info.poei_information5%type; -------bug#2623692
1307 l_Organ_Component per_position_extra_info.poei_information5%type; --/
1308 -- JH Get To Position Title PM for Noa Code being updated. Bug 773851
1309 Cursor get_to_posn_title_pm is
1310 select fpm.process_method_code
1311 from ghr_noa_families nof
1312 ,ghr_families fam
1313 ,ghr_noa_fam_proc_methods fpm
1314 ,ghr_pa_data_fields pdf
1315 where nof.nature_of_action_id = p_pa_request_rec.first_noa_id
1316 and nof.noa_family_code = fam.noa_family_code
1317 and nof.enabled_flag = 'Y'
1318 and p_pa_request_rec.effective_date between nvl(nof.start_date_active,p_pa_request_rec.effective_date)
1319 and nvl(nof.end_date_active,p_pa_request_rec.effective_date )
1320 and fam.proc_method_flag = 'Y'
1321 and fam.enabled_flag = 'Y'
1322 and p_pa_request_rec.effective_date between nvl(fam.start_date_active,p_pa_request_rec.effective_date)
1323 and nvl(fam.end_date_active,p_pa_request_rec.effective_date)
1324 and fam.noa_family_code = fpm.noa_family_code
1325 and fpm.pa_data_field_id = pdf.pa_data_field_id
1326 and fpm.enabled_flag = 'Y'
1327 and p_pa_request_rec.effective_date between nvl(fpm.start_date_active,p_pa_request_rec.effective_date)
1328 and nvl(fpm.end_date_active,p_pa_request_rec.effective_date)
1329 and pdf.form_field_name = l_form_field_name
1330 and pdf.enabled_flag = 'Y'
1331 and p_pa_request_rec.effective_date between nvl(pdf.date_from,p_pa_request_rec.effective_date)
1332 and nvl(pdf.date_to,p_pa_request_rec.effective_date );
1333
1334 ------------------ cursor created to handle Null Org Struct id for MRE Correction
1335 Cursor c_pei_null_OPM(p_position_id number) is
1336 select poei_information5 l_org_structure_id
1337 from per_position_extra_info
1338 where information_type='GHR_US_POS_GRP1' and position_id=p_position_id;
1339
1340 ----------------------------------- cursor to handle changes to LAC codes for Correction to Apptmt action 1274541
1341 Cursor c_Corr_LAC_Codes(p_pa_request_id number) is
1342 select second_action_la_code1,second_action_la_code2,first_noa_code,second_noa_code,
1343 second_action_la_desc1,second_action_la_desc2 --Bug# 4941984(AFHR2)
1344 from ghr_pa_requests
1345 where pa_request_id=p_pa_request_id and first_noa_code='002';
1346
1347
1348 Cursor fam_code(p_second_noa_id number) is
1349 select noa_family_code from ghr_noa_families
1350 where nature_of_action_id=p_second_noa_id and noa_family_code='APP'
1351 AND
1352 nature_of_action_id not in (select nature_of_action_id from ghr_noa_families
1353 where noa_family_code='APPT_TRANS');
1354
1355 --
1356 -- 2839332
1357 --
1358 Cursor Cur_Par_Asg(p_ssn VARCHAR2) is
1359 select par.first_noa_code
1360 from
1361 ghr_pa_requests par,
1362 per_Assignments_f asg
1363 where asg.assignment_id=par.employee_assignment_id
1364 and par.employee_national_identifier=p_ssn
1365 and noa_family_code not in
1366 ('NON_PAY_DUTY_STATUS','RETURN_TO_DUTY','CANCEL','CORRECT')
1367 and par.effective_date=asg.effective_start_date
1368 Order by effective_date asc;
1369
1370 -- 2839332 Madhuri
1371 -- 3263014 Sundar Datatype of the parameters have been changed to table.column_name%type
1372 /*Cursor Cur_NTE_dates(p_ssn ghr_pa_requests.employee_national_identifier%type, p_noa_code ghr_pa_requests.first_noa_code%type) is
1373 select first_noa_information1 NTE_Dates
1374 from ghr_pa_requests
1375 where first_noa_code=p_noa_code
1376 and noa_family_code not in
1377 ('NON_PAY_DUTY_STATUS','RETURN_TO_DUTY','CANCEL','CORRECT')
1378 and employee_national_identifier=p_ssn;
1379 */
1380 -- Sundar Bug 3390876
1381 -- Get the effective date of Non-Pay duty status
1382 CURSOR cur_eff_date_non_pay(c_person_id ghr_pa_requests.person_id%type,c_eff_date ghr_pa_requests.effective_date%type)
1383 IS
1384 SELECT
1385 MAX(par.effective_date) eff_date
1386 FROM
1387 ghr_pa_requests par
1388 WHERE
1389 par.person_id= c_person_id AND
1390 par.noa_family_code = 'NON_PAY_DUTY_STATUS' AND
1391 par.pa_notification_id IS NOT NULL AND
1392 NVL(par.first_noa_cancel_or_correct,'NULL') <> 'CANCEL' AND
1393 par.effective_date < c_eff_date;
1394
1395 CURSOR cur_nte_date_aft_np(c_person_id ghr_pa_requests.person_id%type,
1396 c_eff_date ghr_pa_requests.effective_date%type, c_rtd_date ghr_pa_requests.effective_date%type)
1397 IS
1398 SELECT
1399 par.first_noa_information1 nte_date
1400 FROM
1401 ghr_pa_requests par
1402 WHERE
1403 par.person_id= c_person_id AND
1404 par.effective_date BETWEEN c_eff_date AND c_rtd_date AND
1405 par.pa_notification_id IS NOT NULL AND
1406 NVL(par.first_noa_cancel_or_correct, 'NULL') <> 'CANCEL' AND
1407 par.first_noa_code IN ('508','515','517','522','548','549','553','554','571','590','750','760','761','762','765','769','770');
1408
1409 /*CURSOR Cur_NTE_date_bef_np(c_person_id ghr_pa_requests.person_id%type,c_eff_date ghr_pa_requests.effective_date%type)
1410 IS
1411 SELECT
1412 first_noa_information1 NTE_Dates
1413 FROM
1414 ghr_pa_requests par,
1415 per_Assignments_f asg
1416 WHERE
1417 asg.assignment_id= par.employee_assignment_id AND
1418 asg.effective_start_date = par.effective_date AND
1419 par.person_id= c_person_id AND
1420 par.effective_date < c_eff_date AND
1421 par.noa_family_code NOT IN ('NON_PAY_DUTY_STATUS','RETURN_TO_DUTY','CANCEL','CORRECT') AND
1422 par.pa_notification_id IS NOT NULL AND
1423 NVL(par.first_noa_cancel_or_correct, 'NULL') <> 'CANCEL'
1424 ORDER BY effective_date ASC;
1425 */
1426 l_noa_code VARCHAR2(80);
1427 l_NTE_Dates per_assignment_extra_info.aei_information4%TYPE;
1428
1429 --
1430 -- for bug 3191704
1431 CURSOR cur_rei_poi(p_par_id in NUMBER)
1432 IS
1433 SELECT rei_information5
1434 FROM ghr_pa_request_extra_info
1435 WHERE pa_request_id=p_par_id
1436 AND information_type='GHR_US_PAR_REALIGNMENT';
1437
1438 target_poi ghr_pa_requests.personnel_office_id%type;
1439 -- for bug 3191704
1440
1441 --l_NTE_Dates per_assignment_extra_info.aei_information4%TYPE;
1442 ---------------------------------------------------------- added 2 cursors for 1274541
1443 --Begin Bug 5919705
1444 l_grade_or_level ghr_pa_requests.to_grade_or_level%type;
1445 l_pay_plan ghr_pa_requests.to_pay_plan%type;
1446
1447 CURSOR cur_grd1 IS
1448 SELECT gdf.segment1 pay_plan,
1449 gdf.segment2 grade_or_level
1450 FROM per_grade_definitions gdf,
1451 per_grades grd
1452 WHERE grd.grade_id = p_pos_valid_grade.target_grade
1453 AND grd.grade_definition_id = gdf.grade_definition_id
1454 AND grd.business_group_id = FND_PROFILE.value('PER_BUSINESS_GROUP_ID');
1455
1456 CURSOR cur_grd2 IS
1457 SELECT grd.grade_id
1458 FROM per_grade_definitions gdf,
1459 per_grades grd
1460 WHERE grd.grade_definition_id = gdf.grade_definition_id
1461 and gdf.segment1 = l_pay_plan
1462 and gdf.segment2 = l_grade_or_level
1463 and grd.business_group_id = FND_PROFILE.value('PER_BUSINESS_GROUP_ID');
1464 --End Bug 5919705
1465 l_first_noa_code ghr_pa_requests.first_noa_code%type;
1466 l_second_noa_code ghr_pa_requests.second_noa_code%type;
1467 l_fam_code ghr_pa_requests.noa_family_code%type;
1468
1469 l_Cur_Appt_Auth_1 per_people_extra_info.pei_information8%type;
1470 l_Cur_Appt_Auth_2 per_people_extra_info.pei_information9%type;
1471 --Bug# 4941984(AFHR2)
1472 l_Cur_Appt_Auth_desc1 per_people_extra_info.pei_information22%type;
1473 l_Cur_Appt_Auth_desc2 per_people_extra_info.pei_information23%type;
1474 --Bug# 4941984(AFHR2)
1475 --Begin Bug# 12557463, commented below cursor
1476 --bug# 12596901,12994100
1477 /*l_scd_tsp per_people_extra_info.pei_information6%type;
1478 cursor c_scd_tsp(c_person_id ghr_pa_requests.person_id%type,eff_date ghr_pa_requests.effective_date%type) is
1479 select information12
1480 from ghr_pa_history
1481 where person_id = c_person_id
1482 and information5 = 'GHR_US_PER_SCD_INFORMATION'
1483 and table_name = 'PER_PEOPLE_EXTRA_INFO'
1484 and effective_date = eff_date
1485 order by pa_history_id desc;
1486 */
1487 --bug# 12596901,12994100
1488 --End Bug# 12557463
1489
1490 -- No copy Changes variables.
1491 l_Asg_Sf52 GHR_API.Asg_Sf52_TYPE;
1492 l_Asg_non_Sf52 GHR_API.Asg_non_Sf52_TYPE;
1493 l_Asg_nte_dates GHR_API.Asg_nte_dates_TYPE;
1494 l_Asg_detail_info GHR_API.asg_detail_info_type;-- Bug# 8653508
1495 l_Per_Sf52 GHR_API.Per_Sf52_TYPE;
1496 l_Per_Group1 GHR_API.Per_Group1_TYPE;
1497 l_Per_Group2 GHR_API.Per_Group2_TYPE;
1498 l_Per_scd_info GHR_API.Per_scd_info_TYPE;
1499 l_Per_retained_grade GHR_API.Per_retained_grade_TYPE;
1500 l_Per_probations GHR_API.Per_probations_TYPE;
1501 l_Per_sep_retire GHR_API.Per_sep_retire_TYPE;
1502 l_Per_security GHR_API.Per_security_TYPE;
1503 --Bug#4486823 RRR Changes
1504 l_per_service_oblig GHR_API.Per_service_oblig_TYPE;
1505 l_Per_conversions GHR_API.Per_conversions_TYPE;
1506 l_per_race_ethnic_info ghr_api.per_race_ethnic_type; -- Race or National Origin changes
1507 -- BEN_EIT Changes
1508 l_per_benefit_info GHR_API.per_benefit_info_type;
1509 l_Per_uniformed_services GHR_API.Per_uniformed_services_TYPE;
1510 l_Pos_oblig GHR_API.Pos_oblig_TYPE;
1511 l_Pos_Grp2 GHR_API.Pos_Grp2_TYPE;
1512 l_Pos_Grp1 GHR_API.Pos_Grp1_TYPE;
1513 l_Pos_valid_grade GHR_API.Pos_valid_grade_TYPE;
1514 l_Pos_car_prog GHR_API.Pos_car_prog_TYPE;
1515 l_Perf_appraisal ghr_api.performance_appraisal_type;
1516 l_conduct_performance ghr_api.conduct_performance_type;
1517 l_Loc_Info GHR_API.Loc_Info_TYPE;
1518 l_generic_Extra_Info_Rec GHR_api.generic_Extra_Info_Rec_Type;
1519 l_par_term_retained_grade GHR_api.par_term_retained_grade_type;
1520 ---for bug 3267632
1521 l_agency_code_transfer_to ghr_pa_requests.agency_code%type;
1522 --
1523 -- Bug 3390876
1524 l_np_eff_date ghr_pa_requests.effective_date%type;
1525 l_asg_ei_data per_assignment_extra_info%rowtype;
1526 Begin
1527 --
1528 hr_utility.set_location('Entering ' ||l_proc,5);
1529 hr_utility.set_location('CALL EXT INFOper_serv_oblig_flag '||p_per_service_oblig.per_service_oblig_flag,10);
1530 --
1531 -- Remember IN OUT parameter IN values
1532 --
1533 l_Asg_Sf52 := P_Asg_Sf52;
1534 l_Asg_non_Sf52 := P_Asg_non_Sf52;
1535 l_Asg_nte_dates := P_Asg_nte_dates;
1536 l_asg_detail_info := p_asg_detail_info;--Bug# 8653508
1537 l_Per_Sf52 := P_Per_Sf52;
1538 l_Per_Group1 := P_Per_Group1;
1539 l_Per_Group2 := P_Per_Group2;
1540 l_Per_scd_info := P_Per_scd_info;
1541 l_Per_retained_grade := P_Per_retained_grade;
1542 l_Per_probations := P_Per_probations;
1543 l_Per_sep_retire := P_Per_sep_retire;
1544 l_Per_security := P_Per_security;
1545 -- Bug#4486823 RRR changes
1546 l_per_service_oblig := P_per_service_oblig;
1547 l_Per_conversions := P_Per_conversions;
1548 -- BEN_EIT Changes
1549 l_per_benefit_info := P_Per_benefit_info;
1550 l_Per_uniformed_services := P_Per_uniformed_services;
1551 l_Pos_oblig := P_Pos_oblig;
1552 l_Pos_Grp2 := P_Pos_Grp2;
1553 l_Pos_Grp1 := P_Pos_Grp1;
1554 l_Pos_valid_grade := P_Pos_valid_grade;
1555 l_Pos_car_prog := P_Pos_car_prog;
1556 l_Perf_appraisal := P_Perf_appraisal;
1557 l_conduct_performance := P_conduct_performance;
1558 l_Loc_Info := P_Loc_Info;
1559 l_generic_Extra_Info_Rec := P_generic_Extra_Info_Rec;
1560 l_par_term_retained_grade := P_par_term_retained_grade;
1561 l_per_race_ethnic_info := p_per_race_ethnic_info;
1562
1563 IF P_asg_sf52.asg_sf52_flag = 'Y'
1564 OR ghr_process_sf52.g_prd is not null THEN
1565 -- FWFA Changes
1566 --
1567 hr_utility.set_location(l_proc,10);
1568 Generic_Update_Extra_Info
1569 (
1570 p_pa_request_rec => P_PA_REQUEST_REC
1571 ,p_l_information_type => 'GHR_US_ASG_SF52'
1572 ,p_extra_info_id => p_asg_sf52.assignment_extra_info_id
1573 ,p_l_object_version_number => p_asg_sf52.object_version_number
1574 ,p_information3 => p_asg_sf52.step_or_rate
1575 ,p_information4 => p_asg_sf52.tenure
1576 ,p_information5 => p_asg_sf52.annuitant_indicator
1577 ,p_information6 => nvl(ghr_process_sf52.g_prd,p_asg_sf52.pay_rate_determinant)
1578 ,p_information7 => p_asg_sf52.work_schedule
1579 ,p_information8 => p_asg_sf52.part_time_hours
1580 -- FWFA Changes Bug#4444609. Added NVL condition to handle the families that doesn't trigger pay calc.
1581 ,p_information9 => P_Asg_Sf52.calc_pay_table
1582 -- FWFA Changes
1583 );
1584 End if;
1585 --
1586 If P_asg_non_sf52.asg_non_sf52_flag = 'Y' then
1587 --
1588 hr_utility.set_location(l_proc,15);
1589 Generic_Update_Extra_Info
1590 (
1591 p_pa_request_rec => P_PA_REQUEST_REC
1592 ,p_l_information_type => 'GHR_US_ASG_NON_SF52'
1593 ,p_extra_info_id => p_asg_non_sf52.assignment_extra_info_id
1594 ,p_l_object_version_number => p_asg_non_sf52.object_version_number
1595 ,p_information3 => p_asg_non_sf52.date_arr_personnel_office
1596 -- ,p_information4 => p_asg_non_sf52.duty_status
1597 ,p_information5 => p_asg_non_sf52.key_emer_essential_empl
1598 ,p_information6 => p_asg_non_sf52.non_disc_agmt_status
1599 -- ,p_information7 => p_asg_non_sf52.date_wtop_exemp_expires
1600 ,p_information8 => p_asg_non_sf52.parttime_indicator
1601 ,p_information9 => p_asg_non_sf52.qualification_standard_waiver
1602 -- ,p_information10 => p_asg_non_sf52.trainee_promotion_id
1603 -- ,p_information11 => p_asg_non_sf52.date_trainee_promotion_expt
1604 --Bug # 12652438
1605 ,p_information14 => p_asg_non_sf52.pay_status_userra_status
1606 );
1607 End if;
1608 --
1609 --Begin Bug# 8653508
1610 IF p_asg_detail_info.asg_detail_info_flag = 'Y' THEN
1611
1612 hr_utility.set_location(l_proc,10);
1613 Generic_Update_Extra_Info
1614 (
1615 p_pa_request_rec => P_PA_REQUEST_REC
1616 ,p_l_information_type => 'GHR_US_ASG_DET_INFO'
1617 ,p_extra_info_id => p_asg_detail_info.assignment_extra_info_id
1618 ,p_l_object_version_number => p_asg_detail_info.object_version_number
1619 ,p_information1 => p_asg_detail_info.detail_begin_date
1620 ,p_information2 => p_asg_detail_info.detail_end_date
1621 ,p_information3 => p_asg_detail_info.detail_type
1622 ,p_information4 => p_asg_detail_info.unclss_duty_ind
1623 ,p_information5 => p_asg_detail_info.position_name
1624 ,p_information6 => p_asg_detail_info.valid_grade
1625 ,p_information7 => p_asg_detail_info.occ_series
1626 ,p_information8 => p_asg_detail_info.appropriation_code
1627 ,p_information9 => p_asg_detail_info.flsa_category
1628 ,p_information10 => p_asg_detail_info.bargaining_unit_status
1629 ,p_information11 => p_asg_detail_info.work_schedule
1630 ,p_information12 => p_asg_detail_info.duty_location
1631 ,p_information13 => p_asg_detail_info.organization
1632 );
1633 End if;
1634 --End Bug# 8653508
1635
1636 hr_utility.set_location('NTE DATES FLAG ' || p_asg_nte_dates.asg_nte_dates_flag,1);
1637 If p_asg_nte_dates.asg_nte_dates_flag = 'Y' then
1638 --
1639 --
1640
1641 IF (p_pa_request_rec.noa_family_code = 'RETURN_TO_DUTY') THEN
1642 /* For PAR_ASG in Cur_Par_Asg(p_pa_request_rec.employee_national_identifier)
1643 Loop
1644 hr_utility.trace('Inside EMP SSN CURSOR');
1645 l_noa_code := PAR_ASG.first_noa_code;
1646 End Loop;
1647
1648 hr_utility.set_location('NOA Code for NTE' || l_noa_code , 38);
1649 FOR NTE_Dates_rec in Cur_NTE_Dates(p_pa_request_rec.employee_national_identifier,l_noa_code) LOOP
1650 l_NTE_Dates := NTE_Dates_rec.NTE_Dates;
1651 END LOOP; */
1652 -- Above Commented by Sundar Replaced it by the below code - Bug 3390876
1653 -- Get effective date of the Non-Pay duty action.
1654 FOR l_cur_eff_date_non_pay IN cur_eff_date_non_pay(p_pa_request_rec.person_id, NVL(p_pa_request_rec.effective_date,sysdate)) LOOP
1655 l_np_eff_date := l_cur_eff_date_non_pay.eff_date;
1656 END LOOP;
1657 -- Get NTE Date (i.e. first_noa_information1) If any extension actions are done
1658 -- after Non-Pay duty status
1659 FOR l_cur_nte_date IN cur_nte_date_aft_np(p_pa_request_rec.person_id, l_np_eff_date, NVL(p_pa_request_rec.effective_date,sysdate)) LOOP
1660 l_NTE_Dates := l_cur_nte_date.nte_date;
1661 END LOOP;
1662 -- If No record is found in the above cursor, then take NTE date from the assignment
1663 -- prior to Non-pay-duty status
1664 IF l_NTE_Dates IS NULL THEN
1665 /* FOR l_Cur_NTE_date_bef_np in Cur_NTE_date_bef_np(p_pa_request_rec.person_id,l_np_eff_date) LOOP
1666 l_NTE_Dates := l_Cur_NTE_date_bef_np.NTE_Dates;
1667 END LOOP; */
1668 ghr_history_fetch.fetch_asgei ( p_assignment_id => p_pa_request_rec.employee_assignment_id,
1669 p_information_type => 'GHR_US_ASG_NTE_DATES',
1670 p_date_effective => (l_np_eff_date-1),
1671 p_asg_ei_data => l_asg_ei_data
1672 );
1673 -- Bug 3655891 Need to fetch Asg. NTE date from information 4 for Asg. NTE date.
1674 -- l_NTE_Dates := l_asg_ei_data.aei_information3;
1675 l_NTE_Dates := l_asg_ei_data.aei_information4;
1676 END IF;
1677 -- End Bug 3390876
1678 IF l_NTE_Dates IS NOT NULL THEN
1679 p_asg_nte_dates.assignment_nte := l_NTE_Dates;
1680 END IF;
1681 END IF;
1682 --
1683 --
1684 hr_utility.set_location(l_proc,20);
1685 Generic_Update_Extra_Info
1686 (
1687 p_pa_request_rec => P_PA_REQUEST_REC
1688 ,p_l_information_type => 'GHR_US_ASG_NTE_DATES'
1689 ,p_extra_info_id => p_asg_nte_dates.assignment_extra_info_id
1690 ,p_l_object_version_number => p_asg_nte_dates.object_version_number
1691 ,p_information3 => p_asg_nte_dates.asg_nte_start_date
1692 ,p_information4 => p_asg_nte_dates.assignment_nte
1693 ,p_information5 => p_asg_nte_dates.lwop_nte_start_date
1694 ,p_information6 => p_asg_nte_dates.lwop_nte
1695 ,p_information7 => p_asg_nte_dates.suspension_nte_start_date
1696 ,p_information8 => p_asg_nte_dates.suspension_nte
1697 ,p_information9 => p_asg_nte_dates.furlough_nte_start_date
1698 ,p_information10 => p_asg_nte_dates.furlough_nte
1699 ,p_information11 => p_asg_nte_dates.lwp_nte_start_date
1700 ,p_information12 => p_asg_nte_dates.lwp_nte
1701 ,p_information13 => p_asg_nte_dates.sabatical_nte_start_date
1702 ,p_information14 => p_asg_nte_dates.sabatical_nte
1703 -- ,p_information15 => p_asg_nte_dates.assignment_number
1704 -- ,p_information16 => p_asg_nte_dates.position_nte
1705 );
1706 --
1707 end if;
1708 --
1709 --
1710 --
1711 If p_per_sf52.per_sf52_flag = 'Y' then
1712 --
1713 hr_utility.set_location(l_proc,30);
1714 Generic_Update_Extra_Info
1715 (
1716 p_pa_request_rec => P_PA_REQUEST_REC
1717 ,p_l_information_type => 'GHR_US_PER_SF52'
1718 ,p_extra_info_id => p_per_sf52.person_extra_info_id
1719 ,p_l_object_version_number => p_per_sf52.object_version_number
1720 ,p_information3 => p_per_sf52.citizenship
1721 ,p_information4 => p_per_sf52.veterans_preference
1722 ,p_information5 => p_per_sf52.veterans_preference_for_rif
1723 ,p_information6 => p_per_sf52.veterans_status
1724 );
1725 --
1726 end if;
1727 --
1728
1729 ----------------------------------------------------------------------------------- code added for 1274541
1730
1731 FOR corr_lac IN c_Corr_LAC_Codes(p_pa_request_rec.pa_request_id) LOOP
1732 l_first_noa_code := corr_lac.first_noa_code;
1733 l_second_noa_code:= corr_lac.second_noa_code;
1734 END LOOP;
1735 IF l_first_noa_code = '002' then
1736 If l_second_noa_code = p_pa_request_rec.first_noa_code then
1737 FOR fam_code_rec IN fam_code(p_pa_request_rec.first_noa_id)
1738 LOOP
1739 l_fam_code := fam_code_rec.noa_family_code;
1740 END LOOP;
1741 end if;
1742 end if;
1743
1744 If p_per_group1.per_group1_flag = 'Y' then
1745 --
1746
1747 IF (l_first_noa_code='002' AND l_fam_code='APP') THEN
1748
1749 FOR corr_lac_rec in c_Corr_LAC_Codes(p_pa_request_rec.pa_request_id)
1750 LOOP
1751
1752 l_Cur_Appt_Auth_1 :=corr_lac_rec.second_action_la_code1;
1753 l_Cur_Appt_Auth_2 :=corr_lac_rec.second_action_la_code2;
1754 --Bug# 4941984(AFHR2)
1755 l_Cur_Appt_Auth_desc1 :=corr_lac_rec.second_action_la_desc1;
1756 l_Cur_Appt_Auth_desc2 :=corr_lac_rec.second_action_la_desc2;
1757 --Bug# 4941984(AFHR2)
1758 END LOOP;
1759 ELSE
1760 l_Cur_Appt_Auth_1 :=p_per_group1.org_appointment_auth_code1;
1761 l_Cur_Appt_Auth_2 :=p_per_group1.org_appointment_auth_code2;
1762 --Bug# 4941984(AFHR2)
1763 l_Cur_Appt_Auth_desc1 :=p_per_group1.org_appointment_desc1;
1764 l_Cur_Appt_Auth_desc2 :=p_per_group1.org_appointment_desc2;
1765 --Bug# 4941984(AFHR2)
1766 END IF;
1767
1768 ---------------------------------------------------------------------------------- code added for 1274541
1769
1770
1771 hr_utility.set_location(l_proc,35);
1772 Generic_Update_Extra_Info
1773 (
1774 p_pa_request_rec => P_PA_REQUEST_REC
1775 ,p_l_information_type => 'GHR_US_PER_GROUP1'
1776 ,p_extra_info_id => p_per_group1.person_extra_info_id
1777 ,p_l_object_version_number => p_per_group1.object_version_number
1778 ,p_information3 => p_per_group1.appointment_type
1779 ,p_information4 => p_per_group1.type_of_employment
1780 ,p_information5 => p_per_group1.race_national_origin
1781 --,p_information6 => p_per_group1.date_last_promotion
1782 ,p_information29 => p_per_group1.promotion_eligibility_date -- Bug# 13942237,16023085
1783 ,p_information7 => p_per_group1.agency_code_transfer_from
1784 ,p_information8 => l_Cur_Appt_Auth_1
1785 ,p_information22 => l_Cur_Appt_Auth_desc1--Bug# 4941984(AFHR2)
1786 ,p_information9 => l_Cur_Appt_Auth_2
1787 ,p_information23 => l_Cur_Appt_Auth_desc2--Bug# 4941984(AFHR2)
1788 --,p_information10 => p_per_group1.country_world_citizenship
1789 ,p_information11 => p_per_group1.handicap_code
1790 --,p_information12 => p_per_group1.consent_id
1791 --,p_information13 => p_per_group1.date_fehb_eligibility_expires
1792 --,p_information14 => p_per_group1.date_temp_eligibility_fehb
1793 --,p_information15 => p_per_group1.date_febh_dependent_cert_exp
1794 --,p_information16 => p_per_group1.family_member_emp_pref
1795 --,p_information17 => p_per_group1.family_member_status
1796 ,p_information21 => p_per_group1.retention_inc_review_date
1797 );
1798 --
1799 end if;
1800 --
1801
1802 /* Note : Since none of this data is currently being updated, why call the generic_update at all ??? */
1803
1804 --Bug #14276354 removed the comments as we need to update Pathways segments
1805
1806 If p_per_group2.per_group2_flag = 'Y' then
1807
1808 hr_utility.set_location(l_proc,40);
1809 Generic_Update_Extra_Info
1810 (
1811 p_pa_request_rec => P_PA_REQUEST_REC
1812 ,p_l_information_type => 'GHR_US_PER_GROUP2'
1813 ,p_extra_info_id => p_per_group2.person_extra_info_id
1814 ,p_l_object_version_number => p_per_group2.object_version_number
1815 ,p_information3 => p_per_group2.obligated_position_number
1816 ,p_information4 => p_per_group2.obligated_position_type
1817 ,p_information5 => p_per_group2.date_overseas_tour_expires
1818 ,p_information6 => p_per_group2.date_return_rights_expires
1819 ,p_information7 => p_per_group2.date_stat_return_rights_expir
1820 ,p_information8 => p_per_group2.civilian_duty_stat_contigency
1821 ,p_information9 => p_per_group2.date_travel_agmt_pcs_expires
1822 ,p_information10 => p_per_group2.draw_down_action_id
1823 ,p_information11 => p_per_group2.pathways_program_start_date
1824 ,p_information12 => p_per_group2.pathways_program_extn_date
1825 ,p_information13 => p_per_group2.pathways_program_end_date
1826 );
1827
1828 end if;
1829
1830 --
1831 If p_per_scd_info.per_scd_info_flag = 'Y' then
1832 --
1833 hr_utility.set_location(l_proc,45);
1834 --Bug# 12596901
1835 --Begin Bug# 12557463, commented changes done for bug 12596901
1836 --IF (p_pa_request_rec.noa_family_code = 'CHG_SCD') THEN
1837
1838 Generic_Update_Extra_Info
1839 (
1840 p_pa_request_rec => P_PA_REQUEST_REC
1841 ,p_l_information_type => 'GHR_US_PER_SCD_INFORMATION'
1842 ,p_extra_info_id => p_per_scd_info.person_extra_info_id
1843 ,p_l_object_version_number => p_per_scd_info.object_version_number
1844 ,p_information3 => p_per_scd_info.scd_leave
1845 ,p_information4 => p_per_scd_info.scd_civilian
1846 ,p_information5 => p_per_scd_info.scd_rif
1847 ,p_information6 => p_per_scd_info.scd_tsp
1848 ,p_information7 => p_per_scd_info.scd_retirement
1849 -- Bug 4164083 eHRI New Attribution Changes
1850 ,p_information8 => p_per_scd_info.scd_ses
1851 ,p_information9 => p_per_scd_info.scd_spl_retirement
1852 -- End eHRI New Attribution Changes
1853 --bug 4443968
1854 ,p_information12 => p_per_scd_info.scd_creditable_svc_annl_leave
1855 ,p_information13 => p_per_scd_info.scd_Length_of_Service --Bug# 14514445
1856 );
1857 --Begin Bug# 12557463, commented changes done for bug 12596901
1858 --Begin Bug# 12596901
1859 /*ELSE
1860 IF (l_first_noa_code='002') THEN
1861 FOR cur_scd_tsp IN c_scd_tsp(p_pa_request_rec.person_id,p_pa_request_rec.effective_date) LOOP
1862 l_scd_tsp :=cur_scd_tsp.information12;--Bug# 12994100
1863 EXIT;
1864 END LOOP;
1865 ELSE
1866 l_scd_tsp := p_per_scd_info.scd_tsp;
1867 END IF;
1868 Generic_Update_Extra_Info
1869 (
1870 p_pa_request_rec => P_PA_REQUEST_REC
1871 ,p_l_information_type => 'GHR_US_PER_SCD_INFORMATION'
1872 ,p_extra_info_id => p_per_scd_info.person_extra_info_id
1873 ,p_l_object_version_number => p_per_scd_info.object_version_number
1874 ,p_information3 => p_per_scd_info.scd_leave
1875 ,p_information6 => l_scd_tsp
1876 ,p_information12 => p_per_scd_info.scd_creditable_svc_annl_leave
1877 );
1878
1879 END IF;
1880 */
1881 --End Bug# 12596901
1882 --End Bug# 12557463
1883 --
1884 end if;
1885 --
1886 If p_per_probations.per_probation_flag = 'Y' then
1887 --
1888 hr_utility.set_location(l_proc,50);
1889
1890 Generic_Update_Extra_Info
1891 (
1892 p_pa_request_rec => P_PA_REQUEST_REC
1893 ,p_l_information_type => 'GHR_US_PER_PROBATIONS'
1894 ,p_extra_info_id => p_per_probations.person_extra_info_id
1895 ,p_l_object_version_number => p_per_probations.object_version_number
1896 ,p_information3 => p_per_probations.date_prob_trial_period_begin
1897 ,p_information4 => p_per_probations.date_prob_trial_period_ends
1898 --,p_information8 => p_per_probations.date_spvr_mgr_prob_begins --Bug 4588575
1899 ,p_information5 => p_per_probations.date_spvr_mgr_prob_ends
1900 ,p_information6 => p_per_probations.spvr_mgr_prob_completion
1901 ,p_information7 => p_per_probations.date_ses_prob_expires
1902 );
1903 --
1904 end if;
1905 --
1906 -- added for 3267632
1907 If ( p_pa_request_rec.noa_family_code in ('APP','CONV_APP') ) Then
1908 l_agency_code_transfer_to := NULL;
1909 p_per_sep_retire.per_sep_retire_flag := 'Y';
1910 else
1911 l_agency_code_transfer_to := p_per_sep_retire.agency_code_transfer_to;
1912 End if;
1913 -- added for 3267632
1914 --
1915 If p_per_sep_retire.per_sep_retire_flag = 'Y' then
1916 --
1917 hr_utility.set_location(l_proc,55);
1918 Generic_Update_Extra_Info
1919 (
1920 p_pa_request_rec => P_PA_REQUEST_REC
1921 ,p_l_information_type => 'GHR_US_PER_SEPARATE_RETIRE'
1922 ,p_extra_info_id => p_per_sep_retire.person_extra_info_id
1923 ,p_l_object_version_number => p_per_sep_retire.object_version_number
1924 ,p_information3 => p_per_sep_retire.fers_coverage
1925 ,p_information4 => p_per_sep_retire.prev_retirement_coverage
1926 ,p_information5 => p_per_sep_retire.frozen_service
1927 ,p_information6 => p_per_sep_retire.naf_retirement_indicator
1928 ,p_information7 => p_per_sep_retire.reason_for_separation
1929 ,p_information8 => l_agency_code_transfer_to
1930 --,p_information9 => p_per_sep_retire.date_projected_retirement
1931 --,p_information10 => p_per_sep_retire.mandatory_retirement_date
1932 ,p_information11 => p_per_sep_retire.separate_pkg_status_indicator -- Bug 1359482
1933 --,p_information12 => p_per_sep_retire.separate_pkg_register_number
1934 --,p_information13 => p_per_sep_retire.separate_pkg_pay_office_id
1935 --,p_information14 => p_per_sep_retire.date_ret_appl_received
1936 --,p_information15 => p_per_sep_retire.date_ret_pkg_sent_to_payroll
1937 --,p_information16 => p_per_sep_retire.date_ret_pkg_recv_payroll
1938 --,p_information17 => p_per_sep_retire.date_ret_pkg_to_opm
1939 );
1940 --
1941 end if;
1942 --
1943
1944 /* Note : Since none of this data is currently being updated, why call the generic_update at all ??? */
1945
1946 /*If p_per_security.per_security_flag = 'Y' then
1947 --
1948 hr_utility.set_location(l_proc,60);
1949 Generic_Update_Extra_Info(
1950 p_pa_request_rec => P_PA_REQUEST_REC
1951 ,p_l_information_type => 'GHR_US_PER_SECURITY'
1952 ,p_extra_info_id => p_per_security.person_extra_info_id
1953 ,p_l_object_version_number => p_per_security.object_version_number
1954 ,p_information3 => p_per_security.sec_investigation_basis
1955 ,p_information4 => p_per_security.type_of_sec_investigation
1956 ,p_information5 => p_per_security.date_sec_invest_required
1957 ,p_information6 => p_per_security.date_sec_invest_completed
1958 ,p_information7 => p_per_security.personnel_sec_clearance
1959 ,p_information8 => p_per_security.sec_clearance_eligilb_date
1960 ,p_information9 => p_per_security.prp_sci_status_employment
1961 );
1962 --
1963 end if;
1964 */
1965 hr_utility.set_location('2. CALL EXT INFOper_serv_oblig_flag '||p_per_service_oblig.per_service_oblig_flag,20);
1966 -- Bug#4486823 RRR Changes
1967 IF p_per_service_oblig.per_service_oblig_flag = 'Y' THEN
1968 --
1969 hr_utility.set_location('NAR'||l_proc,60);
1970 Generic_Update_Extra_Info(
1971 p_pa_request_rec => P_PA_REQUEST_REC
1972 ,p_l_information_type => 'GHR_US_PER_SERVICE_OBLIGATION'
1973 ,p_extra_info_id => p_per_service_oblig.person_extra_info_id
1974 ,p_l_object_version_number => p_per_service_oblig.object_version_number
1975 ,p_information3 => p_per_service_oblig.service_oblig_type_code
1976 ,p_information4 => p_per_service_oblig.service_oblig_end_date
1977 ,p_information5 => p_per_service_oblig.service_oblig_start_date
1978 );
1979 --
1980 END IF;
1981 --
1982 -- Added for a patch -- ( for the enhancement)
1983 If p_per_conversions.per_conversions_flag = 'Y' then
1984 --
1985 hr_utility.set_location(l_proc,65);
1986
1987 Generic_Update_Extra_Info
1988 (
1989 p_pa_request_rec => P_PA_REQUEST_REC
1990 ,p_l_information_type => 'GHR_US_PER_CONVERSIONS'
1991 ,p_extra_info_id => p_per_conversions.person_extra_info_id
1992 ,p_l_object_version_number => p_per_conversions.object_version_number
1993 ,p_information3 => p_per_conversions.date_conv_career_begins
1994 ,p_information4 => p_per_conversions.date_conv_career_due
1995 ,p_information5 => p_per_conversions.date_recmd_conv_begins
1996 ,p_information7 => p_per_conversions.date_recmd_conv_due
1997 ,p_information6 => p_per_conversions.date_vra_conv_due
1998 );
1999 --
2000 end if;
2001 --
2002 -- BEN_EIT Changes
2003 If p_per_benefit_info.per_benefit_info_flag = 'Y' then
2004 --
2005 hr_utility.set_location(l_proc,65);
2006
2007 Generic_Update_Extra_Info
2008 (
2009 p_pa_request_rec => P_PA_REQUEST_REC
2010 ,p_l_information_type => 'GHR_US_PER_BENEFIT_INFO'
2011 ,p_extra_info_id => p_per_benefit_info.person_extra_info_id
2012 ,p_l_object_version_number => p_per_benefit_info.object_version_number
2013 ,p_information3 => p_per_benefit_info.FEGLI_Date_Eligibility_Expires
2014 ,p_information4 => p_per_benefit_info.FEHB_Date_Eligibility_expires
2015 ,p_information5 => p_per_benefit_info.FEHB_Date_temp_eligibility
2016 ,p_information6 => p_per_benefit_info.FEHB_Date_dependent_cert_expir
2017 ,p_information7 => p_per_benefit_info.FEHB_LWOP_contingency_st_date
2018 ,p_information8 => p_per_benefit_info.FEHB_LWOP_contingency_end_date
2019 ,p_information10 => p_per_benefit_info.FEHB_Child_equiry_court_date
2020 ,p_information11 => p_per_benefit_info.FERS_Date_eligibility_expires
2021 ,p_information12 => p_per_benefit_info.FERS_Election_Date
2022 ,p_information13 => p_per_benefit_info.FERS_Election_Indicator
2023 ,p_information14 => p_per_benefit_info.TSP_Agncy_Contrib_Elig_date
2024 ,p_information15 => p_per_benefit_info.TSP_Emp_Contrib_Elig_date
2025 -- 6312144 Added the following RPA -- EIT Benefits segments
2026 ,p_information16 => p_per_benefit_info.FEGLI_Assignment_Ind
2027 ,p_information17 => p_per_benefit_info.FEGLI_Post_Elec_Basic_Ins_Amt
2028 ,p_information18 => p_per_benefit_info.FEGLI_Court_Order_Ind
2029 ,p_information19 => p_per_benefit_info.Desg_FEGLI_Benf_Ind
2030 ,p_information20 => p_per_benefit_info.FEHB_Event_Code
2031 );
2032 --
2033 end if;
2034
2035 -- Race or National Origin changes
2036 If p_per_race_ethnic_info.p_race_ethnic_info_flag = 'Y' then
2037 --
2038 hr_utility.set_location(l_proc,68);
2039
2040 Generic_Update_Extra_Info
2041 (
2042 p_pa_request_rec => P_PA_REQUEST_REC
2043 ,p_l_information_type => 'GHR_US_PER_ETHNICITY_RACE'
2044 ,p_extra_info_id => p_per_race_ethnic_info.person_extra_info_id
2045 ,p_l_object_version_number => p_per_race_ethnic_info.object_version_number
2046 ,p_information3 => p_per_race_ethnic_info.p_hispanic
2047 ,p_information4 => p_per_race_ethnic_info.p_american_indian
2048 ,p_information5 => p_per_race_ethnic_info.p_asian
2049 ,p_information6 => p_per_race_ethnic_info.p_black_afr_american
2050 ,p_information7 => p_per_race_ethnic_info.p_hawaiian_pacific
2051 ,p_information8 => p_per_race_ethnic_info.p_white
2052 );
2053 --
2054 end if;
2055
2056
2057
2058 --
2059 If p_per_uniformed_services.per_uniformed_services_flag = 'Y' then
2060 --
2061 hr_utility.set_location(l_proc,70);
2062
2063 Generic_Update_Extra_Info
2064 (
2065 p_pa_request_rec => P_PA_REQUEST_REC
2066 ,p_l_information_type => 'GHR_US_PER_UNIFORMED_SERVICES'
2067 ,p_extra_info_id => p_per_uniformed_services.person_extra_info_id
2068 ,p_l_object_version_number => p_per_uniformed_services.object_version_number
2069 --,p_information3 => p_per_uniformed_services.reserve_category
2070 --,p_information4 => p_per_uniformed_services.military_recall_status
2071 ,p_information5 => p_per_uniformed_services.creditable_military_service
2072 --,p_information6 => p_per_uniformed_services.date_retired_uniform_service
2073 --,p_information7 => p_per_uniformed_services.uniform_service_component
2074 --,p_information8 => p_per_uniformed_services.uniform_service_designation
2075 --,p_information9 => p_per_uniformed_services.retirement_grade
2076 --,p_information10 => p_per_uniformed_services.military_retire_waiver_ind
2077 --,p_information11 => p_per_uniformed_services.exception_retire_pay_ind
2078 );
2079 --
2080 end if;
2081 --
2082 If p_pos_valid_grade.pos_valid_grade_flag = 'Y' then
2083 --
2084 hr_utility.set_location(l_proc,75);
2085 --Begin Bug 5919705
2086 FOR p_cur_grd1 in cur_grd1 LOOP
2087 l_grade_or_level := p_cur_grd1.grade_or_level;
2088 l_pay_plan := p_cur_grd1.pay_plan;
2089 END LOOP;
2090 --BEGIN Bug# 7499540
2091 /*IF (p_pa_request_rec.first_noa_code ='890' OR p_pa_request_rec.second_noa_code ='890') AND
2092 p_pa_request_rec.from_pay_plan ='GM' and p_pa_request_rec.to_pay_plan='GS' AND
2093 l_pay_plan ='GM' THEN
2094
2095 l_pay_plan := 'GS';*/
2096 IF (substr(p_pa_request_rec.first_noa_code,1,2) ='89' OR
2097 SUBSTR(p_pa_request_rec.second_noa_code,1,2) ='89') AND
2098 p_pa_request_rec.from_pay_plan = l_pay_plan AND
2099 p_pa_request_rec.from_pay_plan <> p_pa_request_rec.to_pay_plan AND
2100 SUBSTR(p_pa_request_rec.from_pay_plan,1,1) = SUBSTR(p_pa_request_rec.to_pay_plan,1,1) AND
2101 SUBSTR(p_pa_request_rec.from_pay_plan,1,1) IN('W','G','Y') THEN
2102
2103 l_pay_plan := p_pa_request_rec.to_pay_plan;
2104 --END Bug# 7499540
2105 FOR p_cur_grd2 in cur_grd2 LOOP
2106 p_pos_valid_grade.target_grade := p_cur_grd2.grade_id;
2107 END LOOP;
2108 END IF;
2109 --End Bug 5919705
2110 Generic_Update_Extra_Info
2111 (
2112 p_pa_request_rec => P_PA_REQUEST_REC
2113 ,p_l_information_type => 'GHR_US_POS_VALID_GRADE'
2114 ,p_extra_info_id => p_pos_valid_grade.position_extra_info_id
2115 ,p_l_object_version_number => p_pos_valid_grade.object_version_number
2116 ,p_information3 => p_pos_valid_grade.valid_grade
2117 ,p_information4 => p_pos_valid_grade.target_grade
2118 ,p_information5 => p_pos_valid_grade.pay_table_id
2119 ,p_information6 => p_pos_valid_grade.pay_basis
2120 ,p_information7 => p_pos_valid_grade.employment_category_group
2121 );
2122 -- Bug#4699682
2123 IF ghr_pay_calc.g_pay_table_upd_flag THEN
2124 ghr_mlc_pkg.position_history_update (p_position_id => P_PA_REQUEST_REC.to_position_id,
2125 p_effective_date => P_PA_REQUEST_REC.effective_date,
2126 p_table_id => P_PA_REQUEST_REC.from_pay_table_identifier,
2127 p_upd_tableid => p_pos_valid_grade.pay_table_id);
2128 END IF;
2129
2130 --
2131 end if;
2132 --
2133
2134 If p_Pos_grp1.pos_grp1_flag = 'Y' then
2135 --
2136 hr_utility.set_location(l_proc,80);
2137 hr_utility.set_location('bef upd ' || 'PEID' || to_char(p_pos_grp1.position_extra_info_id),1);
2138 hr_utility.set_location('bef upd ' || 'PEOVN' || to_char(p_pos_grp1.object_version_number),1);
2139
2140 -- JH Include WS/PTH if To Position PM is UE or APUE and to_posn <> from_posn. Bug 773851
2141 -- Bug 2462929 If WS pm in APUE or UE then update WS/PTH.
2142 hr_utility.set_location('To Posn ID ' || p_pa_request_rec.to_position_id ,81);
2143 hr_utility.set_location('From Posn ID ' || p_pa_request_rec.from_position_id ,81);
2144
2145 l_form_field_name := 'TO_POSITION_TITLE';
2146 FOR pm_rec in get_to_posn_title_pm LOOP
2147 l_posn_title_pm := pm_rec.process_method_code;
2148 END Loop;
2149
2150 l_form_field_name := 'WORK_SCHEDULE';
2151 FOR pm_rec in get_to_posn_title_pm LOOP
2152 l_WS_pm := pm_rec.process_method_code;
2153 END Loop;
2154
2155 hr_utility.set_location('To Posn PM ' || l_posn_title_pm ,81);
2156 IF p_pa_request_rec.to_position_id IS NOT NULL AND l_posn_title_pm in ('APUE','UE')
2157 AND nvl(p_pa_request_rec.to_position_id,hr_api.g_number) <>
2158 nvl(p_pa_request_rec.from_position_id,hr_api.g_number)
2159 OR p_pa_request_rec.to_position_id IS NOT NULL AND l_WS_pm in ('APUE','UE')
2160 OR nvl(p_pa_request_rec.first_noa_code,hr_api.g_number) = '782'
2161 OR nvl(p_pa_request_rec.second_noa_code,hr_api.g_number) = '782'
2162 THEN
2163 hr_utility.set_location('Posn Update With WS/PTH' || l_posn_title_pm ,81);
2164
2165 ---------------------------- bug#2623692
2166
2167 if( p_pos_grp1.organization_structure_id is null) then
2168 FOR OPM_CUR IN c_pei_null_OPM(p_pa_request_rec.from_position_id) LOOP
2169 l_Organ_Component :=OPM_CUR.l_org_structure_id;
2170 END LOOP;
2171 else
2172 l_Organ_Component :=p_pos_grp1.organization_structure_id;
2173 end if;
2174
2175 if (p_pa_request_rec.first_noa_code='790' or p_pa_request_rec.second_noa_code='790') then
2176 --l_personnel_office_id:=p_pa_request_rec.personnel_office_id;
2177 -- bug 3191704
2178 FOR poi_rec IN cur_rei_poi(p_pa_request_rec.pa_request_id)
2179 LOOP
2180 target_poi := poi_rec.rei_information5;
2181 END LOOP;
2182 --
2183 IF target_poi IS NOT NULL THEN
2184 l_personnel_office_id:=target_poi;
2185 ELSE
2186 l_personnel_office_id:=p_pa_request_rec.personnel_office_id;
2187 END IF;
2188 -- IF target POI is not null check
2189 else
2190 l_personnel_office_id:=p_pos_grp1.personnel_office_id;
2191 end if;
2192 ---------------------------------- bug#2623692
2193
2194 Generic_Update_Extra_Info
2195 (p_pa_request_rec => P_PA_REQUEST_REC
2196 ,p_l_information_type => 'GHR_US_POS_GRP1'
2197 ,p_extra_info_id => p_pos_grp1.position_extra_info_id
2198 ,p_l_object_version_number => p_pos_grp1.object_version_number
2199 ,p_information3 => l_personnel_office_id
2200 ,p_information4 => p_pos_grp1.office_symbol
2201 ,p_information5 => l_Organ_Component
2202 -- Bug#3816651 Uncommented p_information6.
2203 ,p_information6 => p_pos_grp1.occupation_category_code -- This is actually the occ_series on the DDf and not occ_code
2204 ,p_information7 => p_pos_grp1.flsa_category
2205 ,p_information8 => p_pos_grp1.bargaining_unit_status
2206 --Bug #6356058
2207 -- ,p_information9 => p_pos_grp1.competitive_level
2208 ,p_information10 => p_pos_grp1.work_schedule
2209 ,p_information11 => p_pos_grp1.functional_class
2210 ,p_information12 => p_pos_grp1.position_working_title
2211 --,p_information13 => p_pos_grp1.position_sensitivity
2212 --,p_information14 => p_pos_grp1.security_access
2213 --,p_information15 => p_pos_grp1.prp_sci
2214 ,p_information16 => p_pos_grp1.supervisory_status
2215 --,p_information17 => p_pos_grp1.type_employee_supervised
2216 ,p_information18 => p_pos_grp1.payroll_office_id
2217 --,p_information19 => p_pos_grp1.timekeeper
2218 --,p_information20 => p_pos_grp1.competitive_area
2219 ,p_information21 => p_pos_grp1.positions_organization
2220 ,p_information23 => p_pos_grp1.part_time_hours
2221 );
2222 ELSE
2223 -- Standard Update
2224 hr_utility.set_location('Posn Update Without WS/PTH' || l_posn_title_pm ,81);
2225 Generic_Update_Extra_Info
2226 (p_pa_request_rec => P_PA_REQUEST_REC
2227 ,p_l_information_type => 'GHR_US_POS_GRP1'
2228 ,p_extra_info_id => p_pos_grp1.position_extra_info_id
2229 ,p_l_object_version_number => p_pos_grp1.object_version_number
2230 ,p_information3 => p_pos_grp1.personnel_office_id
2231 ,p_information4 => p_pos_grp1.office_symbol
2232 ,p_information5 => p_pos_grp1.organization_structure_id
2233 -- Bug#3816651 Uncommented p_information6
2234 ,p_information6 => p_pos_grp1.occupation_category_code -- This is actually the occ_series on the DDf and not occ_code
2235 ,p_information7 => p_pos_grp1.flsa_category
2236 ,p_information8 => p_pos_grp1.bargaining_unit_status
2237 --Bug #6356058
2238 -- ,p_information9 => p_pos_grp1.competitive_level
2239 --,p_information10 => p_pos_grp1.work_schedule
2240 ,p_information11 => p_pos_grp1.functional_class
2241 ,p_information12 => p_pos_grp1.position_working_title
2242 --,p_information13 => p_pos_grp1.position_sensitivity
2243 --,p_information14 => p_pos_grp1.security_access
2244 --,p_information15 => p_pos_grp1.prp_sci
2245 ,p_information16 => p_pos_grp1.supervisory_status
2246 --,p_information17 => p_pos_grp1.type_employee_supervised
2247 ,p_information18 => p_pos_grp1.payroll_office_id
2248 --,p_information19 => p_pos_grp1.timekeeper
2249 --,p_information20 => p_pos_grp1.competitive_area
2250 ,p_information21 => p_pos_grp1.positions_organization
2251 --,p_information23 => p_pos_grp1.part_time_hours
2252 );
2253 END IF;
2254 --
2255 end if;
2256
2257 If p_pos_grp2.pos_grp2_flag = 'Y' then
2258 --
2259 hr_utility.set_location('bef upd ' || 'PEID 2 ' || to_char(p_pos_grp2.position_extra_info_id),1);
2260 hr_utility.set_location('bef upd ' || 'PEOVN 2' || to_char(p_pos_grp2.object_version_number),1);
2261
2262 Generic_Update_Extra_Info
2263 (
2264 p_pa_request_rec => P_PA_REQUEST_REC
2265 ,p_l_information_type => 'GHR_US_POS_GRP2'
2266 ,p_extra_info_id => p_pos_grp2.position_extra_info_id
2267 ,p_l_object_version_number => p_pos_grp2.object_version_number
2268 ,p_information3 => p_pos_grp2.position_occupied
2269 ,p_information4 => p_pos_grp2.organization_function_code
2270 --,p_information5 => p_pos_grp2.date_position_classified
2271 --,p_information6 => p_pos_grp2.date_last_position_audit
2272 --,p_information7 => p_pos_grp2.classification_official
2273 --,p_information8 => p_pos_grp2.language_required
2274 --,p_information9 => p_pos_grp2.drug_test
2275 --,p_information10 => p_pos_grp2.financial_statement
2276 --,p_information11 => p_pos_grp2.training_program_id
2277 --,p_information12 => p_pos_grp2.key_emergency_essential
2278 ,p_information13 => p_pos_grp2.appropriation_code1
2279 ,p_information14 => p_pos_grp2.appropriation_code2
2280 --,p_information15 => p_pos_grp2.intelligence_position_ind
2281 --,p_information16 => p_pos_grp2.leo_position_indicator
2282 );
2283 --
2284 end if;
2285 --
2286 /* Note : Since none of this data is currently being updated, why call the generic_update at all ??? */
2287
2288 /*
2289 If p_pos_oblig.pos_oblig_flag = 'Y' then
2290 --
2291 hr_utility.set_location(l_proc,90);
2292 Generic_Update_Extra_Info
2293 (
2294 p_pa_request_rec => P_PA_REQUEST_REC
2295 ,p_l_information_type => 'GHR_US_POS_OBLIG'
2296 ,p_extra_info_id => p_pos_oblig.position_extra_info_id
2297 ,p_l_object_version_number => p_pos_oblig.object_version_number
2298 ,p_information3 => p_pos_oblig.expiration_date
2299 ,p_information4 => p_pos_oblig.obligation_type
2300 ,p_information5 => p_pos_oblig.employee_ssn
2301 );
2302 --
2303 end if;
2304 */
2305 --
2306
2307 /* Note : Since none of this data is currently being updated, why call the generic_update at all ??? */
2308
2309 /*
2310 If p_pos_car_prog.pos_car_prog_flag = 'Y' then
2311 --
2312 hr_utility.set_location(l_proc,95);
2313 Generic_Update_Extra_Info(
2314 p_pa_request_rec => P_PA_REQUEST_REC
2315 ,p_l_information_type => 'GHR_US_POS_CAR_PROG'
2316 ,p_extra_info_id => p_pos_car_prog.position_extra_info_id
2317 ,p_l_object_version_number => p_pos_car_prog.object_version_number
2318 ,p_information3 => p_pos_car_prog.career_program_id
2319 ,p_information4 => p_pos_car_prog.career_program_type
2320 ,p_information5 => p_pos_car_prog.change_reasons
2321 ,p_information6 => p_pos_car_prog.career_field_id
2322 ,p_information7 => p_pos_car_prog.career_program_code
2323 ,p_information8 => p_pos_car_prog.acteds_key_position);
2324 --
2325 end if;
2326 */
2327
2328 hr_utility.set_location(l_proc,100);
2329
2330
2331 -- Bug # 6312144 changes related to benefits continuation
2332 If p_ipa_benefits_cont.per_ben_cont_info_flag = 'Y' then
2333 hr_utility.set_location(l_proc,65);
2334
2335 Generic_Update_Extra_Info
2336 (
2337 p_pa_request_rec => P_PA_REQUEST_REC
2338 ,p_l_information_type => 'GHR_US_PER_BENEFITS_CONT'
2339 ,p_extra_info_id => p_ipa_benefits_cont.person_extra_info_id
2340 ,p_l_object_version_number => p_ipa_benefits_cont.object_version_number
2341 ,p_information1 => p_ipa_benefits_cont.FEGLI_Indicator
2342 ,p_information2 => p_ipa_benefits_cont.FEGLI_Election_Date
2343 ,p_information3 => p_ipa_benefits_cont.FEGLI_Elec_Not_Date
2344 ,p_information4 => p_ipa_benefits_cont.FEHB_Indicator
2345 ,p_information5 => p_ipa_benefits_cont.FEHB_Election_Date
2346 ,p_information6 => p_ipa_benefits_cont.FEHB_Elec_Notf_Date
2347 ,p_information7 => p_ipa_benefits_cont.Retirement_Indicator
2348 ,p_information12 => p_ipa_benefits_cont.Retirement_Elec_Date
2349 ,p_information8 => p_ipa_benefits_cont.Retirement_Elec_Notf_Date
2350 ,p_information9 => p_ipa_benefits_cont.Cont_Term_Insuff_Pay_Elec_Date
2351 ,p_information10 => p_ipa_benefits_cont.Cont_Term_Insuff_Pay_Notf_Date
2352 ,p_information11 => p_ipa_benefits_cont.Cont_Term_Insuff_Pmt_Type_Code);
2353
2354 End IF;
2355
2356 -- Bug # 6312144 changes related to retirement system information
2357 If p_retirement_info.per_retirement_info_flag = 'Y' then
2358 hr_utility.set_location(l_proc,65);
2359
2360 Generic_Update_Extra_Info
2361 (
2362 p_pa_request_rec => P_PA_REQUEST_REC
2363 ,p_l_information_type => 'GHR_US_PER_RETIRMENT_SYS_INFO'
2364 ,p_extra_info_id => p_retirement_info.person_extra_info_id
2365 ,p_l_object_version_number => p_retirement_info.object_version_number
2366 ,p_information1 => p_retirement_info.special_population_code
2367 ,p_information2 => p_retirement_info.App_Exc_CSRS_Ind
2368 ,p_information3 => p_retirement_info.App_Exc_FERS_Ind
2369 ,p_information4 => p_retirement_info.FICA_Coverage_Ind1
2370 ,p_information5 => p_retirement_info.FICA_Coverage_Ind2);
2371
2372 End IF;
2373 --
2374
2375 -- Call special info type api to update education details
2376
2377 If p_pa_request_rec.education_level is not null or
2378 p_pa_request_rec.academic_discipline is not null or
2379 p_pa_request_rec.year_degree_attained is not null then
2380
2381 hr_utility.set_location(l_proc,102);
2382 update_edu_sit(p_pa_request_rec => p_pa_request_rec);
2383
2384 End if;
2385
2386 --
2387 -- Call special info type api to update performance_appraisal details
2388 --
2389 If p_perf_appraisal.perf_appr_flag = 'Y' then
2390
2391 hr_utility.set_location(l_proc,104);
2392 l_segment_rec.segment1 := p_perf_appraisal.appraisal_type;
2393 l_segment_rec.segment2 := p_perf_appraisal.rating_rec;
2394 l_segment_rec.segment3 := p_perf_appraisal.date_effective;
2395 l_segment_rec.segment4 := p_perf_appraisal.rating_rec_pattern;
2396 l_segment_rec.segment5 := p_perf_appraisal.rating_rec_level;
2397 l_segment_rec.segment6 := p_perf_appraisal.date_appr_ends;
2398 --Bug# 4753117 28-Feb-07 Veeramani assigning appraisal start date
2399 l_segment_rec.segment17 := p_perf_appraisal.date_appr_starts;
2400 l_segment_rec.segment7 := p_perf_appraisal.unit;
2401 l_segment_rec.segment8 := p_perf_appraisal.org_structure_id;
2402 l_segment_rec.segment9 := p_perf_appraisal.office_symbol;
2403 l_segment_rec.segment10 := p_perf_appraisal.pay_plan;
2404 l_segment_rec.segment11 := p_perf_appraisal.grade;
2405 l_segment_rec.segment12 := p_perf_appraisal.date_due;
2406 l_segment_rec.segment13 := p_perf_appraisal.appraisal_system_identifier;
2407 l_segment_rec.segment14 := p_perf_appraisal.date_init_appr_due;
2408 l_segment_rec.segment15 := p_perf_appraisal.optional_information;
2409 l_segment_rec.person_analysis_id := p_perf_appraisal.person_analysis_id;
2410 l_segment_rec.object_version_number := p_perf_appraisal.object_version_number;
2411 l_segment_rec.segment16 := p_perf_appraisal.performance_rating_points;
2412
2413 hr_utility.set_location(l_proc||' l_segment_rec.segment16 '|| l_segment_rec.segment16,101);
2414
2415 generic_update_sit
2416 (p_segment_rec => l_segment_rec,
2417 p_special_information_type => 'US Fed Perf Appraisal',
2418 p_pa_request_rec => p_pa_request_rec
2419 );
2420
2421 End if;
2422
2423 -- Call special info type api to update conduct_performance details
2424
2425 If p_conduct_performance.cond_perf_flag = 'Y' then
2426
2427 l_segment_rec.segment1 := p_conduct_performance.cause_of_disc_action;
2428 l_segment_rec.segment2 := p_conduct_performance.date_of_adverse_action;
2429 l_segment_rec.segment3 := p_conduct_performance.days_suspended;
2430 l_segment_rec.segment4 := p_conduct_performance.date_suspension_over_30;
2431 l_segment_rec.segment5 := p_conduct_performance.date_suspension_under_30;
2432 l_segment_rec.segment6 := p_conduct_performance.pip_action_taken;
2433 l_segment_rec.segment7 := p_conduct_performance.pip_begin_date;
2434 l_segment_rec.segment8 := p_conduct_performance.pip_end_date;
2435 l_segment_rec.segment9 := p_conduct_performance.pip_extensions;
2436 l_segment_rec.segment10 := p_conduct_performance.pip_length;
2437 l_segment_rec.segment11 := p_conduct_performance.date_reprimand_expires;
2438 l_segment_rec.segment12 := p_conduct_performance.adverse_action_noac;
2439 l_segment_rec.person_analysis_id := p_conduct_performance.person_analysis_id;
2440 l_segment_rec.object_version_number := p_conduct_performance.object_version_number;
2441
2442 generic_update_sit
2443 (p_pa_request_rec => p_pa_request_rec,
2444 p_special_information_type => 'US Fed Conduct Perf',
2445 p_segment_rec => l_segment_rec
2446 );
2447 End if;
2448 --
2449 --
2450 update_retained_grade
2451 (p_pa_request_rec => p_pa_request_rec,
2452 p_per_retained_grade => p_per_retained_grade );
2453 --
2454 --
2455 hr_utility.set_location('Leaving ' || l_proc,110);
2456 Exception when others then
2457 --
2458 -- Reset IN OUT parameters and set OUT parameters
2459 --
2460 P_Asg_Sf52 := l_Asg_Sf52;
2461 P_Asg_non_Sf52 := l_Asg_non_Sf52;
2462 P_Asg_nte_dates := l_Asg_nte_dates;
2463 p_asg_detail_info := l_asg_detail_info;--Bug# 8653508
2464 P_Per_Sf52 := l_Per_Sf52;
2465 P_Per_Group1 := l_Per_Group1;
2466 P_Per_Group2 := l_Per_Group2;
2467 P_Per_scd_info := l_Per_scd_info;
2468 P_Per_retained_grade := l_Per_retained_grade;
2469 P_Per_probations := l_Per_probations;
2470 P_Per_sep_retire := l_Per_sep_retire;
2471 P_Per_security := l_Per_security;
2472 --Bug#4486823
2473 P_per_service_oblig := l_per_service_oblig;
2474 P_Per_conversions := l_Per_conversions;
2475 P_Per_uniformed_services := l_Per_uniformed_services;
2476 P_Pos_oblig := l_Pos_oblig;
2477 P_Pos_Grp2 := l_Pos_Grp2;
2478 P_Pos_Grp1 := l_Pos_Grp1;
2479 P_Pos_valid_grade := l_Pos_valid_grade;
2480 P_Pos_car_prog := l_Pos_car_prog;
2481 P_Perf_appraisal := l_Perf_appraisal;
2482 P_conduct_performance := l_conduct_performance;
2483 P_Loc_Info := l_Loc_Info;
2484 P_generic_Extra_Info_Rec := l_generic_Extra_Info_Rec;
2485 P_par_term_retained_grade := l_par_term_retained_grade;
2486 p_per_race_ethnic_info := l_per_race_ethnic_info; -- Race or National Origin changes
2487 raise;
2488
2489 end call_extra_info_api;
2490
2491
2492
2493 -- ********************************
2494 -- Function get_asg_status_type
2495 -- ********************************
2496 --- Bug# 4672772 added Parameter p_assignment_id
2497 Procedure get_asg_status_type
2498 (p_noa_code in ghr_nature_of_actions.code%type,
2499 p_business_group_id in per_people_f.business_group_id%type,
2500 p_assignment_id in number,
2501 p_pa_request_id in ghr_pa_requests.pa_request_id%type, --Bug# 8724192
2502 p_status_type_id out nocopy per_assignment_status_types.assignment_status_type_id%type,
2503 p_activate_flag out nocopy varchar2,
2504 p_suspend_flag out nocopy varchar2,
2505 p_terminate_flag out nocopy varchar2
2506 )
2507 is
2508
2509 l_proc varchar2(70) := 'get_asg_status_type';
2510 l_system_status per_assignment_status_types.per_system_status%type;
2511 l_user_status per_assignment_status_types.user_status%type;
2512 l_asg_status_type_id number;
2513 l_active_flag varchar2(1) := 'N';
2514
2515
2516 cursor c_asg_status_type is
2517 select ast.assignment_status_type_id,
2518 ast.active_flag
2519 from per_assignment_status_types ast
2520 where ast.per_system_status = l_system_status
2521 and ast.user_status like '%' || l_user_status || '%'
2522 and nvl(ast.business_group_id,hr_api.g_number) = hr_api.g_number
2523 and ast.legislation_code = 'US';
2524
2525 cursor c_asg_status_type_471 is
2526 select ast.assignment_status_type_id,
2527 ast.active_flag
2528 from per_assignment_status_types ast
2529 where ast.per_system_status = l_system_status
2530 and ast.user_status like '%' || l_user_status || '%'
2531 and instr(ast.user_status,'NTE') = 0
2532 and nvl(ast.business_group_id,hr_api.g_number) = hr_api.g_number
2533 and ast.legislation_code = 'US';
2534 -- Bug# 4672772 Begin
2535 l_user_apnt_status per_assignment_status_types.user_status%type;
2536 l_user_apnt_eff_date date;
2537 CURSOR c_user_apnt_status IS
2538 select ast.user_status,asg.effective_start_date
2539 from per_assignment_status_types ast,
2540 per_all_assignments_f asg
2541 where ast.assignment_status_type_id = asg.assignment_status_type_id
2542 and asg.assignment_id = p_assignment_id
2543 and asg.primary_flag = 'Y'
2544 order by asg.effective_start_date;
2545
2546 -- Bug# 4672772 End
2547 --Begin Bug# 6083404
2548 l_user_actv_apnt_status per_assignment_status_types.user_status%type;
2549 CURSOR c_user_actv_appt IS
2550 select ast.user_status
2551 from per_assignment_status_types ast,
2552 per_all_assignments_f asg
2553 where ast.assignment_status_type_id = asg.assignment_status_type_id
2554 and asg.assignment_id = p_assignment_id
2555 and asg.primary_flag = 'Y'
2556 and user_status='Active Appointment';
2557 --end Bug# 6083404
2558 --Begin Bug# 8724192
2559 l_appointment_type varchar2(10);
2560 CURSOR cur_get_app_type IS
2561 SELECT rei_information4 appointment_type
2562 FROM ghr_pa_request_extra_info
2563 WHERE rei_information_category='GHR_US_PAR_APPT_TRANSFER'
2564 AND pa_request_id = p_pa_request_id;
2565 --End Bug# 8724192
2566
2567 --Begin Bug# 8653508
2568 old_status_start_date date;
2569
2570 Cursor c_cur_detail_user_status is
2571 select asg.effective_start_date
2572 from per_assignment_status_types ast,
2573 per_all_assignments_f asg
2574 where asg.assignment_id = p_assignment_id
2575 and ast.assignment_status_type_id = asg.assignment_status_type_id
2576 and ast.user_status='Detail NTE'
2577 and g_effective_date
2578 between asg.effective_start_date
2579 and asg.effective_end_date;
2580
2581 --Begin Bug# 10182526 , modified following cursor to handle the detail assignment if
2582 --user processes detail action on next day of detail termination.
2583 -- 13014948,13023669 modified the cursor to handle the same day Detail and other actions
2584 Cursor c_old_user_status is
2585 select ast.user_status,ast.per_system_status
2586 from per_assignment_status_types ast,
2587 ghr_pa_history gph
2588 where gph.assignment_id = p_assignment_id
2589 and ghr_general.return_number(gph.information5) = ast.assignment_status_type_id
2590 and ast.user_status <> 'Detail NTE'
2591 and ast.per_system_status <> 'SUSP_ASSIGN' --Bug# 13087709
2592 and gph.table_name = 'PER_ASSIGNMENTS_F'
2593 and gph.effective_date < =
2594 (select asg.effective_start_date
2595 from per_assignment_status_types ast,
2596 per_all_assignments_f asg
2597 where asg.assignment_id = p_assignment_id
2598 and ast.assignment_status_type_id = asg.assignment_status_type_id
2599 and ast.user_status='Detail NTE'
2600 and g_effective_date
2601 between asg.effective_start_date
2602 and asg.effective_end_date)
2603 order by gph.pa_history_id desc;
2604
2605 /* select ast.user_status,ast.per_system_status
2606 from per_assignment_status_types ast,
2607 per_all_assignments_f asg
2608 where asg.assignment_id = p_assignment_id
2609 and ast.assignment_status_type_id = asg.assignment_status_type_id
2610 and ast.user_status <> 'Detail NTE'
2611 and asg.effective_start_date <
2612 (select asg.effective_start_date
2613 from per_assignment_status_types ast,
2614 per_all_assignments_f asg
2615 where asg.assignment_id = p_assignment_id
2616 and ast.assignment_status_type_id = asg.assignment_status_type_id
2617 and ast.user_status='Detail NTE'
2618 and g_effective_date
2619 between asg.effective_start_date
2620 and asg.effective_end_date)
2621 order by asg.effective_start_date desc;*/
2622 --End Bug# 8653508
2623
2624 -- to include , the dates and active_flag in the where clause -- ??
2625
2626 -- The follwing code , decides the User status and the System Status for
2627 -- the person's assignment depending on the NOA, and then identifies the
2628 -- Assignment_status_type_id associated with it. Also it passes the
2629 -- respective flag parameters to indicate whether the assignment has to be
2630 -- activated, terminated or suspended
2631
2632 begin
2633 If p_noa_code is not null then
2634 if p_noa_code in
2635 ('100','101','107','120','124','130','132','140','141','142','143','145','146','147','150','151','155',
2636 '156','157','170','198','199','280','292','293','500','501','507','520','524','540','541','542','543',
2637 '546','550','551','555','570','702','713') then
2638
2639 IF ( p_noa_code in ('702','713') AND g_old_user_status = 'Term Limited Appt' ) THEN
2640 --Bug# 4602352 Modified Temp. Appointment NTE to Term Limited Appt
2641 l_system_status := 'ACTIVE_ASSIGN'; -- 'ACTIVE'
2642 l_user_status := g_old_user_status;
2643 p_activate_flag := 'Y';
2644 --Fix for 3698464
2645 -- Begin Bug# 4672772
2646 ELSIF ( p_noa_code in ('702','713') AND g_old_user_status = 'Temp. Promotion NTE' ) THEN
2647 FOR user_apnt_status_rec IN c_user_apnt_status
2648 LOOP
2649 l_user_apnt_status := user_apnt_status_rec.user_status;
2650 l_user_apnt_eff_date := user_apnt_status_rec.effective_start_date;
2651 EXIT;
2652 END LOOP;
2653 --Begin Bug#6083404
2654 FOR user_actv_appt_rec IN c_user_actv_appt
2655 LOOP
2656 l_user_actv_apnt_status := user_actv_appt_rec.user_status;
2657 EXIT;
2658 END LOOP;
2659 --End Bug# 6083404
2660 IF l_user_apnt_status = 'Temp. Appointment NTE'
2661 and nvl(l_user_actv_apnt_status,'XXX') <>'Active Appointment' THEN
2662 --Bug# 6083404 added l_user_actv_apnt_status condition
2663 l_system_status := 'ACTIVE_ASSIGN'; -- 'ACTIVE'
2664 l_user_status := l_user_apnt_status;
2665 p_activate_flag := 'Y';
2666 ELSE
2667 l_system_status := 'ACTIVE_ASSIGN'; -- 'ACTIVE'
2668 l_user_status := 'Active Appointment'; -- Active Appointment'
2669 p_activate_flag := 'Y';
2670 END IF;
2671 -- End Bug# 4672772
2672 --Begin Bug# 8724192
2673 ELSIF p_noa_code in ('132') THEN
2674 FOR l_cur_get_app_type IN cur_get_app_type LOOP
2675 l_appointment_type := l_cur_get_app_type.appointment_type;
2676 END LOOP;
2677 hr_utility.set_location('Appointment Type ' || l_appointment_type,11);
2678 IF l_appointment_type IN ('20','40','41','42','43','44','45','46','47','48') THEN
2679 l_system_status := 'ACTIVE_ASSIGN';
2680 l_user_status := 'Temp. Appointment NTE';
2681 p_activate_flag := 'Y';
2682 ELSIF l_appointment_type IN ('60','61','62','63','64','65') THEN
2683 l_system_status := 'ACTIVE_ASSIGN';
2684 l_user_status := 'Term Limited Appt';
2685 p_activate_flag := 'Y';
2686 ELSE
2687 l_system_status := 'ACTIVE_ASSIGN';
2688 l_user_status := 'Active Appointment';
2689 p_activate_flag := 'Y';
2690 END IF;
2691 --End Bug# 8724192
2692
2693 ELSE -- 3698464 Madhuri
2694 l_system_status := 'ACTIVE_ASSIGN'; -- 'ACTIVE'
2695 l_user_status := 'Active Appointment'; -- Active Appointment'
2696 p_activate_flag := 'Y';
2697 END IF;
2698
2699 elsif p_noa_code = '471' then
2700 l_system_status := 'SUSP_ASSIGN';
2701 l_user_status := 'Furlough';
2702 p_suspend_flag := 'Y';
2703 elsif p_noa_code = '472' then
2704 l_system_status := 'SUSP_ASSIGN';
2705 l_user_status := 'Furlough NTE';
2706 p_suspend_flag := 'Y';
2707 elsif p_noa_code = '462' then
2708 l_system_status := 'ACTIVE_ASSIGN';
2709 l_user_status := 'Leave With Pay NTE';
2710 p_activate_flag := 'Y';
2711 elsif p_noa_code = '460' then
2712 l_system_status := 'SUSP_ASSIGN';
2713 l_user_status := 'Leave Without Pay NTE';
2714 p_suspend_flag := 'Y';
2715 elsif p_noa_code = '473' then
2716 l_system_status := 'SUSP_ASSIGN';
2717 l_user_status := 'Leave Without Pay US'; --instead of Mil
2718 p_suspend_flag := 'Y';
2719 elsif p_noa_code = '430' then
2720 l_system_status := 'SUSP_ASSIGN';
2721 l_user_status := 'Non Pay';
2722 p_suspend_flag := 'Y';
2723 elsif p_noa_code = '480' then
2724 l_system_status := 'ACTIVE_ASSIGN';
2725 l_user_status := 'Sabbatical NTE';
2726 p_activate_flag := 'Y';
2727 --Begin Bug# 8653508
2728 elsif p_noa_code in ('730','930') then
2729 l_system_status := 'ACTIVE_ASSIGN';
2730 l_user_status := 'Detail NTE';
2731 p_activate_flag := 'Y';
2732 elsif p_noa_code in ('732','932') then
2733 BEGIN
2734 --Begin Bug# 10182526 commented following for loop
2735 /*FOR l_cur_detail_user_status in c_cur_detail_user_status LOOP
2736 old_status_start_date := l_cur_detail_user_status.effective_start_date-1;
2737 END LOOP;*/
2738 FOR l_old_user_status in c_old_user_status LOOP
2739 l_user_status := l_old_user_status.user_status;
2740 l_system_status := l_old_user_status.per_system_status;
2741 p_activate_flag := 'Y';
2742 EXIT; -- Bug# 10182526
2743 END LOOP;
2744 END;
2745 --End Bug# 8653508
2746 elsif p_noa_code in
2747 ('300','301','302','303','304','312','317','330','350','356','390') then
2748 l_system_status := 'TERM_ASSIGN';
2749 l_user_status := 'Separated';
2750 p_terminate_flag := 'Y';
2751 elsif p_noa_code = '450' then
2752 l_system_status := 'SUSP_ASSIGN';
2753 l_user_status := 'Suspension NTE';
2754 p_suspend_flag := 'Y';
2755 elsif p_noa_code = '452' then
2756 l_system_status := 'SUSP_ASSIGN';
2757 l_user_status := 'Suspension Indefinite';
2758 p_suspend_flag := 'Y';
2759 elsif p_noa_code in --Bug# 4602352 Removed 108,508
2760 ('112','115','117','122','148','149','153','154','171','190',
2761 '512','515','517','522','548','549','553','554','571','590','750') then
2762 l_system_status := 'ACTIVE_ASSIGN';
2763 l_user_status := 'Temp. Appointment NTE';
2764 p_activate_flag := 'Y';
2765 --Begin Bug# 4602352
2766 elsif p_noa_code in ('108','508') then
2767 l_system_status := 'ACTIVE_ASSIGN';
2768 l_user_status := 'Term Limited Appt';
2769 p_activate_flag := 'Y';
2770 --End Bug# 4602352
2771 elsif p_noa_code = '703' then
2772 --Begin Bug# 4602352
2773 IF (g_old_user_status = 'Term Limited Appt' ) THEN
2774 l_system_status := 'ACTIVE_ASSIGN';
2775 l_user_status := 'Term Limited Appt';
2776 p_activate_flag := 'Y';
2777 ELSE --End Bug# 4602352
2778 l_system_status := 'ACTIVE_ASSIGN';
2779 l_user_status := 'Temp. Promotion NTE';
2780 p_activate_flag := 'Y';
2781 END IF;--Bug# 4602352
2782 elsif p_noa_code in ('351','352','353','355','357','385') then
2783 l_system_status := 'TERM_ASSIGN'; -- TERM_???????
2784 l_user_status := 'Terminate Appointment'; -- 'Termination Appointment'
2785 p_terminate_flag := 'Y';
2786 -- Start Bug 3048114
2787 elsif p_noa_code in ('740') THEN
2788 IF g_old_user_status = 'Temp. Promotion NTE' THEN
2789 l_system_status := 'ACTIVE_ASSIGN'; -- 'ACTIVE'
2790 l_user_status := 'Active Appointment'; -- Active Appointment'
2791 p_activate_flag := 'Y';
2792 -- End Bug 3048114
2793 ELSIF g_old_user_status = 'Term Limited Appt' THEN --Bug# 4602352
2794 l_system_status := 'ACTIVE_ASSIGN'; -- 'ACTIVE'
2795 l_user_status := g_old_user_status;
2796 p_activate_flag := 'Y';
2797 END IF; --Fix for 3698464
2798 elsif p_noa_code = '721' then -- for Temp Appointmt NTE, bug# 3215526
2799 l_system_status := 'ACTIVE_ASSIGN'; -- 'ACTIVE'
2800 l_user_status := g_old_user_status;
2801 p_activate_flag := 'Y';
2802 end if;
2803 end if;
2804 If l_system_status is not null and
2805 l_user_status is not null then
2806 hr_utility.set_location('user_status ' || l_user_status,1);
2807 hr_utility.set_location('System status ' || l_system_status,2);
2808 If p_noa_code = '471' then
2809 ----------- changed cursor name from c_Asg_status_type to c_Asg_status_type_471 for bug#2139010
2810 for asg_status_type_471 in c_asg_status_type_471 loop
2811 l_asg_status_type_id := asg_status_type_471.assignment_status_type_id;
2812 l_active_flag := asg_status_type_471.active_flag;
2813 end loop;
2814 Else
2815 for asg_status_type in c_asg_status_type loop
2816 l_asg_status_type_id := asg_status_type.assignment_status_type_id;
2817 l_active_flag := asg_status_type.active_flag;
2818 end loop;
2819 End if;
2820 If l_asg_status_type_id is null then
2821 hr_utility.set_message(8301,'GHR_38180_STATUS_TYPE_UNDEF');
2822 hr_utility.raise_error;
2823 End if;
2824 If l_active_flag = 'N' then
2825 hr_utility.set_message(8301,'GHR_38181_STATUS_TYPE_INACTIVE');
2826 hr_utility.raise_error;
2827 End if;
2828 End if;
2829 p_status_type_id := l_asg_status_type_id;
2830 Exception when others then
2831 --
2832 -- Reset IN OUT parameters and set OUT parameters
2833 --
2834 p_status_type_id := null;
2835 p_activate_flag := null;
2836 p_suspend_flag := null;
2837 p_terminate_flag := null;
2838 raise;
2839
2840 End get_asg_status_type;
2841
2842
2843 ------------------------------------------------------------------------------------------
2844 -------------------------------- < return_update_mode > ----------------------------------
2845 ------------------------------------------------------------------------------------------
2846
2847 --This function returns the update_mode to be used while calling the apis, depending on
2848 -- the effective_date the SF52 is processed.
2849
2850
2851 Function return_update_mode
2852 (p_id in per_people_f.person_id%type,
2853 p_effective_date in date,
2854 p_table_name in varchar2
2855 ) return varchar2 is
2856
2857 l_proc varchar2(72) := 'return_update_mode';
2858 l_eed date;
2859 l_esd date;
2860 l_mode varchar2(20) := 'CORRECTION';
2861 l_exists boolean := FALSE;
2862
2863
2864 cursor c_update_mode_p is
2865 select per.effective_start_date ,
2866 per.effective_end_date
2867 from per_all_people_f per
2868 where per.person_id = p_id
2869 and p_effective_date
2870 between per.effective_start_date
2871 and per.effective_end_date;
2872
2873 cursor c_update_mode_p1 is
2874 select per.effective_start_date ,
2875 per.effective_end_date
2876 from per_all_people_f per
2877 where per.person_id = p_id
2878 and p_effective_date < per.effective_start_date;
2879
2880
2881 cursor c_update_mode_a is
2882 select asg.effective_start_date ,
2883 asg.effective_end_date
2884 from per_all_assignments_f asg
2885 where asg.assignment_id = p_id
2886 and p_effective_date
2887 between asg.effective_start_date
2888 and asg.effective_end_date;
2889
2890 cursor c_update_mode_a1 is
2891 select asg.effective_start_date ,
2892 asg.effective_end_date
2893 from per_all_assignments_f asg
2894 where asg.assignment_id = p_id
2895 and p_effective_date < asg.effective_start_date;
2896
2897
2898
2899 cursor c_update_mode_pos is
2900 select pos.effective_start_date ,
2901 pos.effective_end_date
2902 from hr_all_positions_f pos
2903 where pos.position_id = p_id
2904 and p_effective_date
2905 between pos.effective_start_date
2906 and pos.effective_end_date;
2907
2908 cursor c_update_mode_pos1 is
2909 select pos.effective_start_date ,
2910 pos.effective_end_date
2911 from hr_all_positions_f pos
2912 where pos.position_id = p_id
2913 and p_effective_date < pos.effective_start_date;
2914
2915
2916 Begin
2917 hr_utility.set_location('Entering ' || l_proc,5);
2918 If p_table_name = 'PER_PEOPLE_F' then --per
2919 hr_utility.set_location(l_proc,10);
2920 for update_mode in c_update_mode_p loop
2921 hr_utility.set_location(l_proc,15);
2922 l_esd := update_mode.effective_start_date;
2923 l_eed := update_mode.effective_end_date;
2924 end loop;
2925 hr_utility.set_location(l_proc,20);
2926 If l_esd = p_effective_date then
2927 hr_utility.set_location(l_proc,25);
2928 l_mode := 'CORRECTION';
2929 Elsif l_esd < p_effective_date and
2930 to_char(l_eed,'YYYY/MM/DD') = '4712/12/31' then
2931 hr_utility.set_location(l_proc,30);
2932 l_mode := 'UPDATE';
2933 -- end if;
2934 Elsif l_esd < p_effective_date then
2935 hr_utility.set_location(l_proc,35);
2936 for update_mode1 in c_update_mode_p1 loop
2937 hr_utility.set_location(l_proc,40);
2938 l_exists := true;
2939 exit;
2940 end loop;
2941 If l_exists then
2942 hr_utility.set_location(l_proc,45);
2943 l_mode := 'UPDATE_CHANGE_INSERT';
2944 Else
2945 hr_utility.set_location(l_proc,50);
2946 l_mode := 'CORRECTION';
2947 End if;
2948 End if;
2949 If l_mode is null then
2950 hr_utility.set_message(8301,'GHR_GET_DATE_TRACK_FAILED');
2951 hr_utility.set_message_token('TABLE_NAME','per_people_f');
2952 hr_utility.raise_error;
2953 End if;
2954 hr_utility.set_location(l_proc,55);
2955 Elsif p_table_name = 'PER_ASSIGNMENTS_F' then
2956 hr_utility.set_location(l_proc,60);
2957 for update_mode in c_update_mode_a loop
2958 hr_utility.set_location(l_proc,65);
2959 l_esd := update_mode.effective_start_date;
2960 l_eed := update_mode.effective_end_date;
2961 end loop;
2962 If l_esd = p_effective_date then
2963 hr_utility.set_location(l_proc,70);
2964 l_mode := 'CORRECTION';
2965 Elsif l_esd < p_effective_date and
2966 to_char(l_eed,'YYYY/MM/DD') = '4712/12/31' then
2967 hr_utility.set_location(l_proc,75);
2968 l_mode := 'UPDATE'; -- to end date a row and then create a new row
2969 Elsif l_esd < p_effective_date then
2970 hr_utility.set_location(l_proc,80);
2971 for update_mode1 in c_update_mode_a1 loop
2972 hr_utility.set_location(l_proc,85);
2973 l_exists := true;
2974 exit;
2975 end loop;
2976 If l_exists then
2977 hr_utility.set_location(l_proc,90);
2978 l_mode := 'UPDATE_CHANGE_INSERT'; -- to insert a row between 2 existing rows
2979 Else
2980 hr_utility.set_location(l_proc,95);
2981 l_mode := 'CORRECTION';
2982 End if;
2983 hr_utility.set_location(l_proc,100);
2984 End if;
2985 hr_utility.set_location(l_proc,105);
2986 hr_utility.set_location('UPDATE_MODE : ' || l_mode,2);
2987 If l_mode is null then
2988 hr_utility.set_message(8301,'GHR_GET_DATE_TRACK_FAILED');
2989 hr_utility.set_message_token('TABLE_NAME','per_assignments_f');
2990 hr_utility.raise_error;
2991 End if;
2992 Elsif p_table_name = 'HR_ALL_POSITIONS_F' then
2993 hr_utility.set_location(l_proc,110);
2994 for update_mode in c_update_mode_pos loop
2995 hr_utility.set_location(l_proc,115);
2996 l_esd := update_mode.effective_start_date;
2997 l_eed := update_mode.effective_end_date;
2998 end loop;
2999 If l_esd = p_effective_date then
3000 hr_utility.set_location(l_proc,120);
3001 l_mode := 'CORRECTION';
3002 Elsif l_esd < p_effective_date and
3003 to_char(l_eed,'YYYY/MM/DD') = '4712/12/31' then
3004 hr_utility.set_location(l_proc,125);
3005 l_mode := 'UPDATE'; -- to end date a row and then create a new row
3006 Elsif l_esd < p_effective_date then
3007 hr_utility.set_location(l_proc,130);
3008 for update_mode1 in c_update_mode_pos1 loop
3009 hr_utility.set_location(l_proc,135);
3010 l_exists := true;
3011 exit;
3012 end loop;
3013 If l_exists then
3014 hr_utility.set_location(l_proc,140);
3015 l_mode := 'UPDATE_CHANGE_INSERT'; -- to insert a row between 2 existing rows
3016 Else
3017 hr_utility.set_location(l_proc,145);
3018 l_mode := 'CORRECTION';
3019 End if;
3020 hr_utility.set_location(l_proc,150);
3021 End if;
3022 hr_utility.set_location(l_proc,155);
3023 hr_utility.set_location('UPDATE_MODE : ' || l_mode,2);
3024 If l_mode is null then
3025 hr_utility.set_message(8301,'GHR_GET_DATE_TRACK_FAILED');
3026 hr_utility.set_message_token('TABLE_NAME','HR_ALL_POSITIONS_F');
3027 hr_utility.raise_error;
3028 End if;
3029 End if;
3030 return l_mode;
3031 hr_utility.set_location('Leaving ' ||l_proc,160);
3032 End return_update_mode;
3033
3034
3035
3036
3037 -- ***********************
3038 -- procedure Process_Family
3039 -- ***********************
3040 --
3041 procedure Process_Family
3042 (P_PA_REQUEST_REC IN OUT NOCOPY GHR_PA_REQUESTS%ROWTYPE,
3043 P_AGENCY_CODE IN varchar2 ) is
3044
3045 l_noa_code ghr_nature_of_actions.code%type;
3046 --
3047 l_pa_request_rec ghr_pa_requests%rowtype;
3048 l_proc varchar2(70) := 'Process_family';
3049 l_hr_person_api_update varchar2(1) := 'N';
3050 l_hr_applicant_api_hire varchar2(1) := 'N';
3051 l_employee_api_update_criteria varchar2(1) := 'N';
3052 l_hr_employee_api_hire_ex varchar2(1) := 'N';
3053 l_hr_applicant_api_create_sec varchar2(1) := 'N';
3054 l_hire_employee varchar2(1) := 'N';
3055 l_create_address varchar2(1) := 'N';
3056 l_update_address varchar2(1) := 'N';
3057 l_update_person varchar2(1) := 'N';
3058 l_secondary_asg varchar2(1) := 'N';
3059 l_address_line1 per_addresses.address_line1%type;
3060 l_address_line2 per_addresses.address_line2%type;
3061 l_address_line3 per_addresses.address_line3%type;
3062 l_town_or_city per_addresses.town_or_city%type;
3063 l_region_2 per_addresses.region_2%type;
3064 l_city per_addresses.town_or_city%type;
3065 l_state per_addresses.region_2%type;
3066 l_postal_code per_addresses.postal_code%type;
3067 l_country per_addresses.country%type;
3068 l_noa_family_name varchar2(60);
3069 l_noa_family_code ghr_noa_families.noa_family_code%type;
3070 --
3071 -- hr_person_api.update_person out variables
3072 --
3073 l_per_upd_employee_number per_people_f.employee_number%type;
3074 l_per_upd_effective_start_date per_people_f.effective_start_date%type;
3075 l_per_upd_effective_end_date per_people_f.effective_end_date%type;
3076 l_per_upd_full_name per_people_f.full_name%type;
3077 l_per_upd_comment_id per_people_f.comment_id%type;
3078 l_per_upd_name_comb_warn boolean;
3079 l_per_upd_assgn_payroll_warn boolean;
3080 l_per_person_type_id per_people_f.person_type_id%type;
3081 l_per_national_identifier per_people_f.national_identifier%type;
3082 l_per_first_name per_people_f.first_name%type;
3083 l_per_last_name per_people_f.last_name%type;
3084 l_per_middle_names per_people_f.middle_names%type;
3085 l_per_date_of_birth per_people_f.date_of_birth%type;
3086
3087 --
3088 l_concatenated_segments hr_soft_coding_keyflex.concatenated_segments%type;
3089 l_asg_upd_effective_start_date per_assignments_f.effective_start_date%type;
3090 l_asg_upd_effective_end_date per_assignments_f.effective_end_date%type;
3091 l_asg_upd_special_ceil_step_id per_assignments_f.special_ceiling_step_id%type;
3092 l_asg_upd_people_group_id per_assignments_f.people_group_id%type;
3093 l_asg_upd_group_name pay_people_groups.group_name%type;
3094 l_asg_upd_org_now_man_warn boolean;
3095 l_asg_upd_other_manager_warn boolean ;
3096 l_asg_upd_spp_delete_warning boolean;
3097 l_asg_upd_entries_chan_warn varchar2(10);
3098 l_asg_upd_tax_dist_chan_warn boolean;
3099 --
3100 -- Hire applicant out variables
3101
3102 --
3103 l_per_hire_employee_number per_people_f.employee_number%type;
3104 l_per_hire_eff_start_date per_people_f.effective_start_date%type;
3105 l_per_hire_eff_end_date per_people_f.effective_end_date%type;
3106 l_per_hire_un_asg_del_warn boolean;
3107 l_per_hire_asg_pay_warn boolean;
3108 l_per_hire_oversubs_vac_id number;
3109 --
3110
3111 -- Return to duty (active) out variables
3112 --
3113 l_asg_act_eff_start_date per_assignments_f.effective_start_date%type;
3114 l_asg_act_eff_end_date per_assignments_f.effective_end_date%type;
3115 --
3116 --Suspend employee out variables
3117 --
3118 l_asg_sus_eff_start_date per_assignments_f.effective_start_date%type;
3119 l_asg_sus_eff_end_date per_assignments_f.effective_end_date%type;--
3120
3121 -- Create addresses out variables
3122 --
3123 l_per_add_address_id per_addresses.address_id%type;
3124 l_per_add_ovr_number per_addresses.object_version_number%type;
3125 --
3126
3127 -- Final Process out variables
3128 --
3129 l_asg_fnl_eff_start_date per_assignments_f.effective_start_date%type;
3130 l_asg_fnl_eff_end_date per_assignments_f.effective_end_date%type;
3131 l_asg_fnl_org_now_no_manager boolean;
3132 l_asg_fnl_future_chan_warn boolean;
3133 l_asg_fnl_entries_chan_warn varchar2(1);
3134 --
3135 --
3136 l_per_object_version_number per_people_f.object_version_number%type;
3137 l_asg_object_version_number per_assignments_f.object_version_number%type;
3138 l_add_object_version_number per_addresses.object_version_number%type;
3139 l_person_id per_people_f.person_id%type;
3140 l_person_type_id per_people_f.person_type_id%type;
3141 l_date1 ghr_pa_requests.effective_date%type;
3142 l_address_id per_addresses.address_id%type;
3143 l_person_type per_person_types.system_person_type%type;
3144 --l_sec_assignmemt_id per_assignments_f.assignment_id%type;
3145 --l_assignment_status_type_id per_assignment_status_types.assignment_status_type_id%type;
3146 --
3147 l_asg_trm_eff_start_date per_assignments_f.effective_start_date%type;
3148 l_asg_trm_eff_end_date per_assignments_f.effective_end_date%type;
3149 l_emp_trm_eff_end_date per_assignments_f.effective_end_date%type;
3150 l_asg_future_changes_warning boolean;
3151 l_supervisor_warning boolean;
3152 l_event_warning boolean;
3153 l_interview_warning boolean;
3154 l_review_warning boolean;
3155 l_recruiter_warning boolean;
3156 l_entries_changed_warning varchar2(1);
3157 l_dod_warning boolean;
3158 l_pay_proposal_warning boolean;
3159 l_org_now_no_manager_warning boolean;
3160 --asg_future_changes_warning boolean;
3161 --l_entries_changed_warning boolean;
3162 l_pds_object_version_number number;
3163
3164 l_assignment_id per_assignments_f.assignment_id%type;
3165 l_asg_status_type_id number(9);
3166 l_update_mode varchar2(30) := 'UPDATE';
3167 l_activate_flag varchar2(1) := 'N';
3168 l_suspend_flag varchar2(1) := 'N';
3169 l_terminate_flag varchar2(1) := 'N';
3170 l_employee_update_flag varchar2(1) := 'N';
3171 l_update_gre varchar2(1) := 'N';
3172 l_rehire_ex_emp varchar2(1 ) := 'N';
3173 l_period_of_service_id number;
3174 l_payroll_id pay_payrolls_f.payroll_id%type;
3175 l_payroll_name pay_payrolls_f.payroll_name%type;
3176 l_business_group_id per_people_f.business_group_id%type;
3177 l_orig_hire_warning boolean;
3178
3179 l_working_hours per_assignments_f.normal_hours%type;
3180
3181 l_SOFT_CODING_KEYFLEX_ID NUMBER;
3182 l_COMMENT_ID NUMBER;
3183 l_EFFECTIVE_START_DATE DATE ;
3184 l_EFFECTIVE_END_DATE DATE ;
3185 l_CONCATENNATED_SEGMENTS VARCHAR2(150) ;
3186 l_NO_MANAGERS_WARNING BOOLEAN ;
3187 l_OTHER_MANAGER_WARNING BOOLEAN ;
3188 l_tax_unit_id number;
3189
3190 l_del_ovn number(9);
3191 l_asg_id number(15);
3192 l_v_start_date date;
3193 l_v_end_date date;
3194 l_county_name per_addresses.region_1%type;
3195 l_count_rec number;
3196
3197 l_session ghr_history_api.g_session_var_type;
3198
3199 -- POSITION ABOLISH out parameters
3200 l_val_grd_chg_wng boolean;
3201 l_pos_definition_id number;
3202 l_name varchar2(240);
3203 l_pos_object_version_number per_addresses.object_version_number%type;
3204
3205
3206 l_asg_payroll_id number;
3207 -- added for ds change
3208 l_asg_location_id number;
3209 l_temp_asg_loc_id number;
3210 l_dum_char varchar2(240);
3211 l_dum_number number;
3212 l_position_data_rec_type ghr_sf52_pos_update.position_data_rec_type;
3213 -- Variables used for Update GRE
3214 l_from_org_id hr_organization_units.organization_id%type;
3215 l_to_org_id hr_organization_units.organization_id%type;
3216 l_result_code varchar2(100);
3217 l_address_data per_addresses%rowtype;
3218 l_hr_user_type varchar2(20);
3219
3220 l_old_system_status per_assignment_status_types.per_system_status%type;
3221
3222 l_remark_id ghr_remarks.remark_id%type;
3223 l_remark_description ghr_remarks.description%type;
3224 l_pa_remark_id ghr_pa_remarks.pa_remark_id%type;
3225 l_rem_ovn ghr_pa_remarks.OBJECT_VERSION_NUMBER%type;
3226 l_form_field_name varchar2(50);
3227 l_posn_title_pm varchar2(50);
3228 l_WS_pm varchar2(50);
3229 l_DS_pm varchar2(50);
3230 l_old_effective_start_date date;
3231
3232 -- Cursors declaration
3233 --
3234 -- Family Code
3235
3236 Cursor c_noa_family_code IS
3237 Select fam.noa_family_code
3238 from ghr_noa_families nfa,
3239 ghr_families fam
3240 where nfa.nature_of_action_id = p_pa_request_rec.first_noa_id
3241 and nfa.noa_family_code = fam.noa_family_code
3242 and fam.update_hr_flag = 'Y';
3243
3244 -- Business group of the person
3245
3246 Cursor c_bus_gp is
3247 select per.business_group_id
3248 from per_all_people_f per
3249 where per.person_id = p_pa_request_rec.person_id
3250 and g_effective_date between
3251 per.effective_start_date
3252 and per.effective_end_date;
3253
3254 -- Period of service
3255
3256 Cursor c_pds is
3257 select pds.period_of_service_id,
3258 pds.object_version_number
3259 from per_periods_of_service pds
3260 where pds.person_id = p_pa_request_rec.person_id
3261 and pds.date_start <= g_effective_date
3262 and pds.actual_termination_date is null
3263 order by 1 asc;
3264
3265
3266 -- Person Type
3267
3268 cursor c_person_type is
3269 Select ppt.system_person_type,
3270 ppf.person_type_id
3271 from per_person_types ppt,
3272 per_all_people_f ppf
3273 where ppf.person_id = P_pa_request_rec.person_id
3274 and ppt.person_type_id = ppf.person_type_id
3275 and g_effective_date between ppf.effective_start_date
3276 and ppf.effective_end_date;
3277
3278
3279 -- Cursor to fetch all the assignment (pertaining to applications) records,
3280 -- except the one that gets passed from the Form
3281 -- The foll. cursor is currently not being used.
3282
3283 Cursor c_other_asg is
3284 select asg.assignment_id,
3285 asg.object_version_number
3286 from per_all_assignments_f asg
3287 where asg.person_id = p_pa_request_rec.person_id
3288 and asg.assignment_id <> p_pa_request_rec.employee_assignment_id;
3289
3290
3291 -- EX_Employee person type
3292
3293 Cursor c_ex_emp_per_type is
3294 select ppt.person_type_id
3295 from per_person_types ppt
3296 where ppt.business_group_id = l_business_group_id
3297 and ppt.system_person_type = 'EX_EMP'
3298 -- and ppt.user_person_type = 'Ex-employee'
3299 and ppt.active_flag = 'Y'
3300 order by ppt.person_type_id asc;
3301
3302 --
3303
3304 -- Person Address
3305 --
3306 --May have to read from History depending on the action and effective date
3307 cursor c_address_type is
3308 select
3309 pad.address_id,
3310 pad.object_version_number,
3311 pad.address_line1,
3312 pad.address_line2,
3313 pad.address_line3,
3314 pad.town_or_city,
3315 pad.region_2,
3316 pad.postal_code,
3317 pad.country
3318 from
3319 per_addresses pad
3320 where
3321 pad.person_id = p_pa_request_rec.person_id
3322 and g_effective_date + 1
3323 between pad.date_from and nvl(pad.date_to,g_effective_date + 1)
3324 and pad.primary_flag = 'Y';
3325 --
3326 -- Start Bug 1316321
3327 -- Cursor for selecting corresponding secondary addresses for the primay
3328 -- address for end dating -- same cursor used for creating new secondary addresses
3329 cursor c_sec_address is
3330 select
3331 pad.address_id,
3332 pad.object_version_number,
3333 pad.address_line1 ,
3334 pad.address_line2 ,
3335 pad.address_line3 ,
3336 pad.town_or_city ,
3337 pad.region_2 ,
3338 pad.region_1 ,
3339 pad.postal_code ,
3340 pad.country ,
3341 pad.address_type,
3342 pad.primary_flag
3343 from
3344 per_addresses pad
3345 where
3346 pad.person_id = p_pa_request_rec.person_id
3347 and g_effective_date
3348 between pad.date_from and nvl(pad.date_to,g_effective_date)
3349 and pad.primary_flag <> 'Y';
3350
3351 cursor c_upd_primary_address(p_pa_request_id IN NUMBER,
3352 p_address_id IN NUMBER)
3353 is
3354 SELECT pah.information1
3355 FROM ghr_pa_history pah
3356 WHERE pah.table_name = 'PER_ADDRESSES'
3357 AND pah.information1 = p_address_id
3358 AND pah.pa_request_id IN
3359 (
3360 SELECT pa_request_id
3361 FROM ghr_pa_requests
3362 CONNECT BY prior pa_request_id = altered_pa_request_id
3363 START WITH pa_request_id = p_pa_request_id
3364 );
3365 --
3366 cursor county_name is
3367 select c.county_name
3368 from pay_us_counties c ,
3369 pay_us_city_names t ,
3370 pay_us_states s,
3371 pay_us_zip_codes z
3372 where s.state_abbrev = p_pa_request_rec.forwarding_region_2
3373 and t.city_name = p_pa_request_rec.forwarding_town_or_city
3374 and t.state_code = s.state_code
3375 and t.state_code = c.state_code
3376 and t.county_code = c.county_code
3377 and z.city_code = t.city_code
3378 and substr(p_pa_request_rec.forwarding_postal_code,1,5)
3379 between z.zip_start and z.zip_end
3380 and z.state_code = t.state_code
3381 and z.county_code = t.county_code;
3382
3383 --
3384
3385 -- Object_version_number and Normal Hours - Asg
3386 --BUG # 8258924 added job id to the list
3387 cursor asg_ovn(p_assignment_id in number) is
3388 select paf.object_version_number,
3389 paf.business_group_id,
3390 paf.normal_hours,
3391 paf.location_id,
3392 paf.payroll_id,
3393 paf.job_id
3394 from per_all_assignments_f paf
3395 where paf.assignment_id = p_assignment_id
3396 and g_effective_date
3397 between paf.effective_start_date
3398 and paf.effective_end_date;
3399
3400 -- Object_version_number - Person
3401
3402 cursor per_ovn is
3403 select ppf.object_version_number,
3404 ppf.business_group_id ,
3405 ppf.employee_number,
3406 ppf.national_identifier,
3407 ppf.date_of_birth,
3408 ppf.first_name,
3409 ppf.last_name,
3410 ppf.middle_names
3411 from per_all_people_f ppf
3412 where ppf.person_id = P_pa_request_rec.person_id
3413 and g_effective_date between ppf.effective_start_date
3414 and ppf.effective_end_date;
3415
3416 -- payroll id
3417
3418 Cursor c_payroll_name is
3419 select rei_information3 payroll_id
3420 from ghr_pa_request_extra_info
3421 where pa_request_id = p_pa_request_rec.pa_request_id
3422 and information_type = 'GHR_US_PAR_PAYROLL_TYPE';
3423
3424 Cursor c_payroll_id is
3425 select payroll_id
3426 from pay_payrolls_f
3427 where period_type = 'Bi-Week'
3428 and payroll_name = l_payroll_name
3429 and business_group_id = l_business_group_id
3430 and p_pa_request_rec.effective_date
3431 between effective_start_date and effective_end_date;
3432
3433 Cursor c_bw_payroll is
3434 select pay.payroll_id
3435 from pay_payrolls_f pay
3436 where pay.payroll_name = 'Biweekly Payroll'
3437 and g_effective_date
3438 between pay.effective_start_date and pay.effective_end_date
3439 and business_group_id = l_business_group_id;
3440
3441 -- position object_version_number
3442
3443 Cursor c_pos_ovn is
3444 select pos.object_version_number
3445 from hr_all_positions_f pos -- Venkat
3446 where pos.position_id = p_pa_request_rec.from_position_id
3447 and p_pa_request_rec.effective_date between
3448 pos.effective_start_date and pos.effective_end_date;
3449
3450 -- Tax Unit Id - GRE
3451
3452 Cursor c_tax_unit_org is
3453 select tax.tax_unit_id
3454 from hr_tax_units_v tax
3455 where tax_unit_id = p_pa_request_rec.to_organization_id;
3456
3457 Cursor c_tax_unit_bg is
3458 select tax.tax_unit_id
3459 from hr_tax_units_v tax
3460 where tax_unit_id = l_business_group_id;
3461
3462 -- Getting from Organization_id
3463
3464 Cursor c_from_org_id is
3465 select pos.organization_id
3466 from hr_all_positions_f pos
3467 where pos.position_id = p_pa_request_rec.from_position_id
3468 and p_pa_request_rec.effective_date between
3469 pos.effective_start_date and pos.effective_end_date;
3470
3471 -- Getting to Organization_id
3472
3473 Cursor c_to_org_id is
3474 select pos.organization_id
3475 from hr_all_positions_f pos
3476 where pos.position_id = p_pa_request_rec.to_position_id
3477 and p_pa_request_rec.effective_date between
3478 pos.effective_start_date and pos.effective_end_date;
3479
3480 -- Getting Old User Status
3481
3482 Cursor c_user_status is
3483 select ast.user_status,
3484 ast.per_system_status,
3485 asg.effective_start_date
3486 from
3487 per_assignment_status_types ast,
3488 per_all_assignments_f asg
3489 where asg.assignment_id = l_assignment_id
3490 and ast.assignment_status_type_id = asg.assignment_status_type_id
3491 and g_effective_date
3492 between asg.effective_start_date
3493 and asg.effective_end_date;
3494
3495 -- Bug#2839332 Cursor to get the Assignment Status
3496 -- before NON_PAY_DUTY_STATUS Action for "RETURN TO DUTY" action.
3497
3498 /****** Bug 5923426 Commented the cursor and wrote a modified one.
3499 Cursor c_user_old_status is
3500 Select asg.assignment_status_type_id
3501 from per_assignments_f asg
3502 where asg.assignment_id = l_assignment_id
3503 and l_old_effective_start_date between asg.effective_start_date
3504 and asg.effective_end_date;
3505 ********/
3506 --- Bug 5923426 start
3507 /****** Bug 13057211 Commented the cursor and wrote a modified one.
3508 Cursor c_user_old_status is
3509 Select past.per_system_status ,asg.assignment_status_type_id
3510 from per_assignments_f asg,per_assignment_status_types past
3511 where asg.assignment_id = l_assignment_id
3512 and asg.assignment_status_type_id = past.assignment_status_type_id
3513 order by asg.effective_start_date desc;
3514 ********/
3515 --- Bug 5923426 end
3516
3517 --- Bug 13057211 start
3518 Cursor c_user_old_status is
3519 select ast.per_system_status ,ast.assignment_status_type_id
3520 from per_assignment_status_types ast,
3521 ghr_pa_history gph
3522 where gph.assignment_id = l_assignment_id
3523 and ghr_general.return_number(gph.information5) = ast.assignment_status_type_id
3524 and gph.table_name = 'PER_ASSIGNMENTS_F'
3525 and gph.effective_date < = l_old_effective_start_date
3526 order by gph.pa_history_id desc;
3527 --- Bug 13057211 end
3528
3529 -- JH Get To Position Title PM for Noa Code being updated.
3530 Cursor get_to_posn_title_pm is
3531 select fpm.process_method_code
3532 from ghr_noa_families nof
3533 ,ghr_families fam
3534 ,ghr_noa_fam_proc_methods fpm
3535 ,ghr_pa_data_fields pdf
3536 where nof.nature_of_action_id = p_pa_request_rec.first_noa_id
3537 and nof.noa_family_code = fam.noa_family_code
3538 and nof.enabled_flag = 'Y'
3539 and p_pa_request_rec.effective_date between nvl(nof.start_date_active,p_pa_request_rec.effective_date)
3540 and nvl(nof.end_date_active,p_pa_request_rec.effective_date)
3541 and fam.proc_method_flag = 'Y'
3542 and fam.enabled_flag = 'Y'
3543 and p_pa_request_rec.effective_date between nvl(fam.start_date_active,p_pa_request_rec.effective_date)
3544 and nvl(fam.end_date_active,p_pa_request_rec.effective_date)
3545 and fam.noa_family_code = fpm.noa_family_code
3546 and fpm.pa_data_field_id = pdf.pa_data_field_id
3547 and fpm.enabled_flag = 'Y'
3548 and p_pa_request_rec.effective_date between nvl(fpm.start_date_active,p_pa_request_rec.effective_date)
3549 and nvl(fpm.end_date_active,p_pa_request_rec.effective_date)
3550 and pdf.form_field_name = l_form_field_name
3551 and pdf.enabled_flag = 'Y'
3552 and p_pa_request_rec.effective_date between nvl(pdf.date_from,p_pa_request_rec.effective_date)
3553 and nvl(pdf.date_to,p_pa_request_rec.effective_date);
3554 --
3555 -- 3324737
3556 CURSOR RTD_asg_status( p_asg_id NUMBER,
3557 p_eff_date DATE )
3558 IS
3559 SELECT effective_date
3560 FROM ghr_pa_Requests
3561 WHERE effective_date <= p_eff_Date
3562 and person_id = p_pa_request_rec.person_id
3563 --and employee_assignment_id = p_Asg_id
3564 -- for performance reasons
3565 and pa_notification_id is not null
3566 and noa_family_code = 'NON_PAY_DUTY_STATUS'
3567 ORDER BY pa_request_id desc;
3568
3569 l_rtd_date DATE;
3570 --3324737
3571 --
3572 --
3573 l_assgn_id NUMBER;
3574 l_eff_date DATE;
3575 l_NTE_Dates per_assignment_extra_info.aei_information4%TYPE;
3576 l_active_flag varchar2(1);
3577 l_RTD_noa_code VARCHAR2(80);
3578 l_bg_id NUMBER;
3579 -- BUG #8258924
3580 l_asg_job_id NUMBER;
3581
3582
3583 --
3584 -- 2839332
3585 --
3586
3587 -- Bug 3215139
3588 CURSOR get_occ_code(c_position_id hr_all_positions_f.position_id%type, c_effective_date hr_all_positions_f.effective_start_date%type) IS
3589 SELECT pos.job_id
3590 FROM hr_all_positions_f pos
3591 WHERE pos.position_id = c_position_id
3592 AND c_effective_date BETWEEN pos.effective_start_date and pos.effective_end_date;
3593
3594 CURSOR get_segment(c_business_group_id per_people_f.business_group_id%type) IS
3595 SELECT ORG_INFORMATION5
3596 FROM HR_ORGANIZATION_INFORMATION
3597 WHERE ORG_INFORMATION_CONTEXT = 'GHR_US_ORG_INFORMATION'
3598 AND ORGANIZATION_ID = c_business_group_id;
3599
3600 l_agency_segment hr_organization_information.org_information5%type;
3601 l_pos_agency_code VARCHAR2(30);
3602
3603 CURSOR c_get_agency_code(c_segment hr_organization_information.org_information5%type,
3604 c_position_id hr_all_positions_f.position_id%type,
3605 c_effective_date hr_all_positions_f.effective_start_date%type) IS
3606 SELECT DECODE(c_segment,'SEGMENT1',SEGMENT1,
3607 'SEGMENT2',SEGMENT2,
3608 'SEGMENT3',SEGMENT3,
3609 'SEGMENT4',SEGMENT4,
3610 'SEGMENT5',SEGMENT5,
3611 'SEGMENT6',SEGMENT6,
3612 'SEGMENT7',SEGMENT7,
3613 'SEGMENT8',SEGMENT8,
3614 'SEGMENT9',SEGMENT9,
3615 'SEGMENT10',SEGMENT10,
3616 'SEGMENT11',SEGMENT11,
3617 'SEGMENT12',SEGMENT12,
3618 'SEGMENT13',SEGMENT13,
3619 'SEGMENT14',SEGMENT14,
3620 'SEGMENT15',SEGMENT15,
3621 'SEGMENT16',SEGMENT16,
3622 'SEGMENT17',SEGMENT17,
3623 'SEGMENT18',SEGMENT18,
3624 'SEGMENT19',SEGMENT19,
3625 'SEGMENT20',SEGMENT20,
3626 'SEGMENT21',SEGMENT21,
3627 'SEGMENT22',SEGMENT22,
3628 'SEGMENT23',SEGMENT23,
3629 'SEGMENT24',SEGMENT24,
3630 'SEGMENT25',SEGMENT25,
3631 'SEGMENT26',SEGMENT26,
3632 'SEGMENT27',SEGMENT27,
3633 'SEGMENT28',SEGMENT28,
3634 'SEGMENT29',SEGMENT29,
3635 'SEGMENT30',SEGMENT30) agency_code
3636 FROM per_position_definitions ppd, hr_all_positions_f pos
3637 WHERE pos.position_definition_id = ppd.position_definition_id
3638 AND pos.position_id = c_position_id
3639 AND c_effective_date BETWEEN pos.effective_start_date AND pos.effective_end_date;
3640
3641 ------------------------
3642
3643 l_update_occ_code VARCHAR2(1) := 'N';
3644 l_pos_job_id hr_all_positions_f.job_id%type;
3645
3646
3647 --Bug 3381960
3648 -- Get Assignment position for the person
3649 CURSOR c_get_asg_position(c_assignment_id per_all_assignments_f.assignment_id%type,
3650 c_effective_date per_all_assignments_f.effective_start_date%type) IS
3651 SELECT position_id
3652 FROM per_all_assignments_f asg
3653 WHERE asg.assignment_id = c_assignment_id
3654 AND c_effective_date BETWEEN asg.effective_start_date AND asg.effective_end_date;
3655 l_asg_position per_all_assignments_f.position_id%type;
3656
3657
3658 --Pradeep
3659 CURSOR cur_get_nte_date IS
3660 SELECT rei_information12 nte_date, rei_information11 amount
3661 FROM ghr_pa_request_extra_info
3662 WHERE rei_information_category='GHR_US_PAR_MD_DDS_PAY'
3663 AND pa_request_id = p_pa_request_rec.pa_request_id;
3664
3665 CURSOR check_remarks is
3666 SELECT remark_id
3667 FROM ghr_pa_remarks
3668 WHERE pa_request_id = p_pa_request_rec.pa_request_id
3669 AND remark_id =
3670 (select remark_id from ghr_remarks
3671 where code = 'BBB');
3672
3673 Cursor cur_get_remark_code(p_remark_id ghr_remarks.remark_id%TYPE) is
3674 select rem.code
3675 from ghr_remarks rem
3676 where rem.remark_id = p_remark_id
3677 and rem.enabled_flag = 'Y'
3678 and nvl(p_pa_request_rec.effective_date,sysdate)
3679 between rem.date_from and nvl(rem.date_to,nvl(p_pa_request_rec.effective_date, trunc(sysdate)));
3680
3681 l_mddds_special_pay_nte_date ghr_pa_request_extra_info.rei_information12%TYPE;
3682 l_mddds_total_special_pay ghr_pa_request_extra_info.rei_information11%TYPE;
3683 l_check_remarks BOOLEAN := FALSE;
3684 l_rpa_remark_code ghr_remarks.code%TYPE;
3685 l_rpa_remark_id ghr_remarks.remark_id%TYPE;
3686
3687 --bug 4542437
3688 l_position_id ghr_pa_requests.from_position_id%TYPE :=NULL;
3689 l_job_id per_all_assignments_f.job_id%TYPE :=NULL;
3690 l_org_id per_all_assignments_f.organization_id%TYPE :=NULL;
3691 l_grade_id per_position_extra_info.poei_information3%TYPE :=NULL;
3692 l_pos_ei_data per_position_extra_info%ROWTYPE;
3693
3694 --Bug # 6127620
3695 --l_curr_sess_date fnd_sessions.effective_date%type;
3696 Begin
3697 --
3698 -- Remember IN OUT parameter IN values
3699 --
3700 l_pa_request_rec := p_pa_request_rec;
3701
3702 g_effective_date := nvl(p_pa_request_rec.effective_date,sysdate);
3703 hr_utility.set_location('g_eff_date ' || to_char(g_effective_date),1);
3704
3705 -- if Realignment then change the organization name in position
3706 if p_pa_request_rec.first_noa_code = '790' then
3707 l_position_data_rec_type.position_id := p_pa_request_rec.to_position_id;
3708 l_position_data_rec_type.organization_id := p_pa_request_rec.to_organization_id;
3709 l_position_data_rec_type.agency_code_subelement := p_agency_code;
3710 l_position_data_rec_type.effective_date := g_effective_date;
3711 hr_utility.set_location('realign -pos ' || p_pa_request_rec.to_organization_id,1);
3712 ----l_position_data_rec_type.datetrack_mode := return_update_mode
3713 ---- (p_id => p_pa_request_rec.to_position_id,
3714 ---- p_effective_date => p_pa_request_rec.effective_date,
3715 ---- p_table_name => 'HR_ALL_POSITIONS_F'
3716 ---- );
3717 -- Start Bug 1613367
3718 For ovn in asg_ovn(p_pa_request_rec.employee_assignment_id) loop
3719 l_temp_asg_loc_id := ovn.location_id;
3720 End loop;
3721 IF nvl(p_pa_request_rec.duty_station_location_id,hr_api.g_number)
3722 <> nvl(l_temp_asg_loc_id,hr_api.g_number) then
3723 l_position_data_rec_type.location_id := p_pa_request_rec.duty_station_location_id;
3724 ELSE
3725 l_position_data_rec_type.location_id := NULL;
3726 END IF;
3727 -- End Bug 1613367
3728
3729 ghr_sf52_pos_update.update_position_info
3730 (p_pos_data_rec => l_position_data_rec_type
3731 );
3732 /* -- SEt flag to update assignment with the targer org.
3733 l_employee_api_update_criteria := 'Y';
3734 */
3735
3736 end if;
3737
3738 -- Start Inserting AAA Remark
3739
3740 hr_utility.set_location('Before the Remark creation - From PB '||p_pa_request_rec.from_pay_basis,3);
3741 hr_utility.set_location('Before the Remark creation - To PB '||p_pa_request_rec.to_pay_basis,3);
3742 hr_utility.set_location('Before the Remark creation - PRD '||p_pa_request_rec.pay_rate_determinant,3);
3743
3744 IF p_pa_request_rec.from_pay_basis <> p_pa_request_rec.to_pay_basis and
3745 p_pa_request_rec.pay_rate_determinant in ('A','B','E','F','U','V') THEN
3746
3747 hr_utility.set_location('Inside the Remark creation ',3);
3748 ghr_mass_actions_pkg.get_remark_id_desc
3749 (p_remark_code => 'AAA',
3750 p_effective_date => g_effective_date,
3751 p_remark_id => l_remark_id,
3752 p_remark_desc => l_remark_description
3753 );
3754
3755
3756 ghr_pa_remarks_api.create_pa_remarks
3757 (
3758 p_PA_REQUEST_ID => p_pa_request_rec.pa_request_id,
3759 p_REMARK_ID => l_remark_id,
3760 p_DESCRIPTION => l_remark_description,
3761 P_PA_REMARK_ID => l_pa_remark_id,
3762 p_OBJECT_VERSION_NUMBER => l_rem_ovn
3763 );
3764 END IF;
3765 hr_utility.set_location('Passed Remark creation ',5);
3766 -- End Inserting AAA Remark
3767
3768 -- Start Populating BBB Remark
3769 IF p_pa_request_rec.first_noa_code = '850' THEN
3770 hr_utility.set_location('Inside the Remark creation ',3);
3771 --Check if user has entered any comments. If so do not populate BBB.
3772 hr_utility.set_location('Pa Request Id'||p_pa_request_rec.pa_request_id,3);
3773
3774 FOR check_remarks_rec in check_remarks
3775 LOOP
3776 l_check_remarks := TRUE;
3777 l_rpa_remark_id := check_remarks_rec.remark_id;
3778 EXIT;
3779 END LOOP;
3780
3781 FOR cur_get_nte_date_rec IN cur_get_nte_date
3782 LOOP
3783 l_mddds_special_pay_nte_date := cur_get_nte_date_rec.nte_date;
3784 l_mddds_total_special_pay := cur_get_nte_date_rec.amount;
3785 END LOOP;
3786
3787 IF NOT l_check_remarks THEN
3788
3789 ghr_mass_actions_pkg.get_remark_id_desc
3790 (p_remark_code => 'BBB',
3791 p_effective_date => g_effective_date,
3792 p_remark_id => l_remark_id,
3793 p_remark_desc => l_remark_description
3794 );
3795
3796 l_remark_description := replace(l_remark_description,'_')
3797 ||to_char(fnd_date.canonical_to_date(l_mddds_special_pay_nte_date),'DD-MON-RRRR');
3798
3799 --while terminating the MDDDS_SPECIAL_PAY element it should delete the remarks also.
3800 IF ( l_mddds_total_special_pay <> 0 )
3801 and ( l_mddds_total_special_pay IS NOT NULL ) THEN
3802
3803 ghr_pa_remarks_api.create_pa_remarks
3804 (
3805 p_PA_REQUEST_ID => p_pa_request_rec.pa_request_id,
3806 p_REMARK_ID => l_remark_id,
3807 p_DESCRIPTION => l_remark_description,
3808 P_PA_REMARK_ID => l_pa_remark_id,
3809 p_OBJECT_VERSION_NUMBER => l_rem_ovn,
3810 p_remark_code_information1 => l_mddds_special_pay_nte_date
3811 );
3812
3813
3814 END IF;
3815 ELSE
3816 --while terminating the MDDDS_SPECIAL_PAY element it should delete the remarks also.
3817 IF ( l_mddds_total_special_pay = 0 )
3818 OR ( l_mddds_total_special_pay IS NULL ) THEN
3819
3820 hr_utility.set_location('Inside else'||l_rpa_remark_id ,10);
3821 FOR get_remark_code_rec IN cur_get_remark_code(l_rpa_remark_id)
3822 LOOP
3823 l_rpa_remark_code := get_remark_code_rec.code;
3824 END LOOP;
3825 hr_utility.set_location('Remark Code already entered ' ||l_rpa_remark_code,11);
3826 IF l_rpa_remark_code='BBB' THEN
3827 -- While terminating the element if BBB remark is present then
3828 hr_utility.set_message(8301,'GHR_38877_850_REMARK');
3829 hr_utility.raise_error;
3830 END IF;
3831 END IF;
3832
3833 END IF;
3834 END IF;
3835 --End of Populating BBB remark.
3836
3837 hr_utility.set_location('Entering ' ||l_proc,5);
3838
3839 l_noa_family_code := null;
3840 for family_code in c_noa_family_code loop
3841 l_noa_family_code := family_code.noa_family_code;
3842 End loop;
3843
3844 l_person_type := null;
3845
3846 -- fetch person_type
3847 l_person_type := null;
3848 for person_type in c_person_type loop
3849 l_person_type := person_type.system_person_type;
3850 l_person_type_id := person_type.person_type_id;
3851 exit;
3852 end loop;
3853
3854 if l_person_type is null then
3855 hr_utility.set_message(8301,'GHR_38133_INVALID_PERSON');
3856 hr_utility.raise_error;
3857 end if;
3858 hr_utility.set_location(l_proc,10);
3859
3860 --
3861
3862 for bus_gp in c_bus_gp loop
3863 l_business_group_id := bus_gp.business_group_id;
3864 end loop;
3865
3866 -- if Change in data element then change the job id in position
3867 if p_pa_request_rec.first_noa_code = '800' then
3868 -- Bug 3786467
3869 -- Get Agency code segment from ORG EI
3870 FOR l_get_segment IN get_segment(l_business_group_id) LOOP
3871 l_agency_segment := l_get_segment.org_information5;
3872 END LOOP;
3873 -- Get Agency code from Position
3874 FOR l_get_agency_code IN c_get_agency_code(l_agency_segment,p_pa_request_rec.to_position_id,p_pa_request_rec.effective_date) LOOP
3875 l_pos_agency_code := l_get_agency_code.agency_code;
3876 END LOOP;
3877 -- Get Job id value from the Core Position form
3878 -- Bug 3215139 Sundar
3879 FOR l_get_occ_code IN get_occ_code(p_pa_request_rec.to_position_id,nvl(p_pa_request_rec.effective_date,trunc(sysdate))) LOOP
3880 l_pos_job_id := l_get_occ_code.job_id;
3881 END LOOP;
3882 hr_utility.set_location('p_agency_code' ||p_agency_code,1);
3883 hr_utility.set_location('Position agency_code' ||l_pos_agency_code,1);
3884 -- Need to update Position only if OCC_CODE is different in RPA form than the Position.
3885 -- Commented for testing
3886 IF (p_pa_request_rec.to_job_id <> l_pos_job_id) OR (p_agency_code <> l_pos_agency_code) THEN
3887 l_position_data_rec_type.position_id := p_pa_request_rec.to_position_id;
3888 l_position_data_rec_type.job_id := p_pa_request_rec.to_job_id;
3889 l_position_data_rec_type.agency_code_subelement := p_agency_code;
3890 l_position_data_rec_type.effective_date := g_effective_date;
3891 hr_utility.set_location('change in data element-pos ' || p_pa_request_rec.to_job_id,1);
3892 l_position_data_rec_type.datetrack_mode := return_update_mode
3893 (p_id => p_pa_request_rec.to_position_id,
3894 p_effective_date => p_pa_request_rec.effective_date,
3895 p_table_name => 'HR_ALL_POSITIONS_F'
3896 );
3897
3898 --Bug# 6127620
3899 --GHR_HISTORY_API.get_session_date(l_curr_sess_date);
3900 -- ghr_session.set_fnd_session_date(p_pa_request_rec.effective_date);
3901 --Bug# 6127620
3902
3903
3904 ghr_sf52_pos_update.update_position_info
3905 (p_pos_data_rec => l_position_data_rec_type
3906 );
3907
3908 --Bug# 6127620
3909 --ghr_session.set_fnd_session_date(l_curr_sess_date);
3910 --Bug# 6127620
3911
3912 l_update_occ_code := 'Y';
3913 END IF; -- If p_pa_request_rec.to_job_id <> l_pos_job_id
3914 -- End 3215139
3915 end if;
3916
3917
3918
3919 ghr_history_api.get_g_session_var(l_session);
3920 hr_utility.set_location('NOA ID CORRECT : ' || l_session.noa_id_correct,1);
3921
3922 If l_noa_family_code = 'APP' then
3923 hr_utility.set_location(l_proc,15);
3924 l_per_object_version_number := null;
3925 for ovn in per_ovn loop
3926 l_business_group_id := ovn.business_group_id;
3927 l_per_object_version_number := ovn.object_version_number;
3928 l_per_upd_employee_number := ovn.employee_number;
3929 end loop;
3930 if l_per_object_version_number is null then
3931 hr_utility.set_message(8301,'GHR_38133_INVALID_PERSON');
3932 hr_utility.raise_error;
3933 end if;
3934
3935 If l_person_type = 'APL' then -- and the action is not correction
3936 hr_utility.set_location(l_proc,20);
3937 l_hr_applicant_api_hire := 'Y';
3938 l_update_mode := 'CORRECTION';
3939 l_activate_flag := 'Y';
3940 End if;
3941 --Bug# 6711759 Included the person type EX_EMP_APL
3942 If l_person_type in ('EX_EMP','EX_EMP_APL') then
3943 hr_utility.set_location(l_proc,21);
3944 l_rehire_ex_emp := 'Y';
3945 l_activate_flag := 'Y';
3946 End if;
3947
3948 -- Code added by skutteti on 13-jul-98 bug #699856
3949 If nvl(p_pa_request_rec.From_Position_Id, hr_api.g_number) <>
3950 nvl(p_pa_request_rec.to_position_id, hr_api.g_number) then
3951 l_employee_api_update_criteria := 'Y';
3952 l_update_gre := 'Y';
3953 end if;
3954
3955 --End of cases exclusive case for Appointment family
3956 Else -- If noa_family_code <> 'APP'
3957 If l_person_type = 'EX_EMP' then
3958 hr_utility.set_location(l_proc,25);
3959 l_rehire_ex_emp := 'Y';
3960 l_activate_flag := 'Y';
3961 l_employee_api_update_criteria := 'Y';
3962 l_update_gre := 'Y'; -- Added Venkat Bug # 1239688
3963 End if;
3964 If p_pa_request_rec.to_position_id is not null then
3965 If nvl(p_pa_request_rec.From_Position_Id,hr_api.g_number) <> P_pa_request_rec.to_position_id
3966 then
3967 hr_utility.set_location('Non Appointment -- To pos <> From Pos - GRE ' ||l_proc,41);
3968 l_employee_api_update_criteria := 'Y';
3969 l_update_gre := 'Y';
3970 l_update_mode := 'UPDATE'; -- If action is Correction,then update_mode = 'CORRECTION'
3971 end if;
3972 End if;
3973
3974 -- Bug 3381960
3975 IF p_pa_request_rec.to_position_id IS NOT NULL THEN
3976 -- Get Assignment Position. If it's not equal to To position of RPA, then assignment
3977 -- should be updated
3978
3979 FOR l_get_asg_position IN c_get_asg_position(p_pa_request_rec.employee_assignment_id,
3980 p_pa_request_rec.effective_date) LOOP
3981 l_asg_position := l_get_asg_position.position_id;
3982 END LOOP;
3983 hr_utility.set_location('Assg Pos ' ||l_asg_position,41);
3984 IF l_asg_position IS NOT NULL AND (p_pa_request_rec.to_position_id <> l_asg_position) THEN
3985 hr_utility.set_location('To pos <> Assg Pos ' ||l_proc,41);
3986 l_employee_api_update_criteria := 'Y';
3987 END IF;
3988
3989 END IF;
3990
3991 --
3992 -- Added by subbu on 25-Feb-98. Assignment information has to be updated irrespective
3993 -- of the change in position for REALIGNMENT
3994 --
3995 if l_noa_family_code = 'REALIGNMENT' then
3996 hr_utility.set_location('realign' || p_pa_request_rec.to_organization_id,1);
3997 l_employee_api_update_criteria := 'Y';
3998 l_update_gre := 'Y';
3999 end if;
4000 --
4001 -- Added by subbu on 13-Jul-98. Assignment information has to be updated irrespective
4002 -- of the change in position for NOA 713 (change to lower grade)
4003 --
4004 --if l_noa_family_code = 'SALARY_CHG' then
4005 if p_pa_request_rec.to_grade_or_level is not null and
4006 nvl(p_pa_request_rec.from_grade_or_level,hr_api.g_varchar2) <> p_pa_request_rec.to_grade_or_level then
4007 l_employee_api_update_criteria := 'Y';
4008 end if;
4009 --
4010 -- Update of Pay Plan GG to Assignmentn 855 processing.
4011 -- Added by AVR on 07-APR-2004.
4012 -- Bug#5089732 Added the l_noa_family_code condition.
4013 IF p_pa_request_rec.first_noa_code = '855'
4014 OR
4015 p_pa_request_rec.second_noa_code = '855'
4016 OR
4017 l_noa_family_code = 'REASSIGNMENT' --Bug# 7209120
4018 OR
4019 l_noa_family_code like 'GHR_SAL%' THEN
4020
4021 IF nvl(p_pa_request_rec.from_pay_plan,hr_api.g_varchar2) <> p_pa_request_rec.to_pay_plan then
4022 l_employee_api_update_criteria := 'Y';
4023 END IF;
4024 END IF;
4025 --
4026 -- Added by Dan on 09-Jun-98. Assignment information has to be updated irrespective
4027 -- of the change in position for NOA 800 (change in data element)
4028 --
4029 if l_noa_family_code = 'CHG_DATA_ELEMENT' then
4030 hr_utility.set_location('realign' || p_pa_request_rec.to_job_id,3);
4031 IF (l_update_occ_code = 'Y') THEN -- Sundar 3215139 Need to update assignment only if position is updated
4032 l_employee_api_update_criteria := 'Y';
4033 END IF;
4034 end if;
4035
4036 --BUG 4542437
4037 if l_noa_family_code = 'NON_PAY_DUTY_STATUS' then
4038 hr_utility.set_location('Family code Non pay duty status ',500);
4039 IF p_pa_request_rec.to_position_id IS NULL THEN
4040 hr_utility.set_location('To position id is null but position id is changed by a retro',519);
4041 l_position_id := p_pa_request_rec.from_position_id;
4042 hr_utility.set_location('l_position id '||l_position_id,525);
4043 --Getting job id
4044 FOR l_get_occ_code IN get_occ_code(p_pa_request_rec.from_position_id,nvl(p_pa_request_rec.effective_date,trunc(sysdate))) LOOP
4045 l_job_id := l_get_occ_code.job_id;
4046 END LOOP;
4047 hr_utility.set_location('job_id '||l_job_id,545);
4048 ---Getting organization id
4049 for get_org_id in c_from_org_id loop
4050 l_org_id := get_org_id.organization_id;
4051 end loop;
4052 hr_utility.set_location('l_oraganization id '||l_org_id,575);
4053 -- Get Assignment Position. If it's not equal to To position of RPA, then assignment
4054 -- should be updated
4055 FOR l_get_asg_position IN c_get_asg_position(p_pa_request_rec.employee_assignment_id, p_pa_request_rec.effective_date) LOOP
4056 l_asg_position := l_get_asg_position.position_id;
4057 END LOOP;
4058 hr_utility.set_location('Assg Pos ' ||l_asg_position,599);
4059
4060 --Getting Grade id
4061 ghr_history_fetch.fetch_positionei
4062 (p_position_id => l_position_id
4063 ,p_information_type => 'GHR_US_POS_VALID_GRADE'
4064 ,p_date_effective => p_pa_request_rec.effective_date
4065 ,p_pos_ei_data => l_pos_ei_data);
4066
4067 l_grade_id := l_pos_ei_data.poei_information3;
4068
4069 hr_utility.set_location('l_grade id for the new position '||l_grade_id,875);
4070 --Bug# 6010971, added grade_id condition
4071 IF l_asg_position IS NOT NULL
4072 AND ((l_position_id <> l_asg_position)
4073 OR (nvl(P_pa_request_rec.to_grade_id,hr_api.g_number) <> nvl(l_grade_id,hr_api.g_number)))
4074 THEN
4075 hr_utility.set_location('To pos <> Assg Pos ' ||l_proc,650);
4076 l_employee_api_update_criteria := 'Y';
4077 END IF;
4078 --Bug# 6010971
4079
4080 END IF; --p_pa_request_rec.to_position_id IS NULL
4081 END IF; --l_noa_family_code = 'NON_PAY_DUTY_STATUS'
4082
4083 -- Name change
4084 if l_noa_family_code = 'CHG_NAME' then
4085 l_update_person := 'Y';
4086 elsif l_noa_family_code = 'RETURN_TO_DUTY' then
4087 hr_utility.set_location(l_proc,45);
4088 l_activate_flag := 'Y';
4089 elsif l_noa_family_code = 'NON_PAY_DUTY_STATUS' then
4090 hr_utility.set_location(l_proc,50);
4091 l_suspend_flag := 'Y';
4092 elsif l_noa_family_code = 'SEPARATION' then
4093 hr_utility.set_location(l_proc,55);
4094 l_terminate_flag := 'Y';
4095 IF P_pa_request_rec.FORWARDING_ADDRESS_LINE1 is not null or
4096 P_pa_request_rec.FORWARDING_ADDRESS_LINE2 is not null or
4097 P_pa_request_rec.FORWARDING_ADDRESS_LINE3 is not null or
4098 P_pa_request_rec.FORWARDING_TOWN_OR_CITY is not null or
4099 P_pa_request_rec.FORWARDING_REGION_2 is not null or
4100 P_pa_request_rec.FORWARDING_POSTAL_CODE is not null or
4101 P_pa_request_rec.FORWARDING_COUNTRY is not null THEN
4102 hr_utility.set_location(l_proc,60);
4103 FOR address in c_address_type LOOP
4104 l_address_id := address.address_id;
4105 l_add_object_version_number := address.object_version_number;
4106 l_address_line1 := address.address_line1;
4107 l_address_line2 := address.address_line2;
4108 l_address_line3 := address.address_line3;
4109 l_town_or_city := address.town_or_city;
4110 l_region_2 := address.region_2;
4111 l_postal_code := address.postal_code;
4112 l_country := address.country;
4113 END LOOP;
4114 hr_utility.set_location('Dump Address data' || l_proc,61);
4115 hr_utility.set_location('p_pa_request_rec.FORWARDING_ADDRESS_LINE1 ' ||substr(p_pa_request_rec.FORWARDING_ADDRESS_LINE1,1,40),62 );
4116 hr_utility.set_location('p_pa_request_rec.FORWARDING_ADDRESS_LINE2 ' ||substr(p_pa_request_rec.FORWARDING_ADDRESS_LINE2,1,40),63 );
4117 hr_utility.set_location('p_pa_request_rec.FORWARDING_ADDRESS_LINE3 ' ||substr(p_pa_request_rec.FORWARDING_ADDRESS_LINE3,1,40),64 );
4118 hr_utility.set_location('p_pa_request_rec.FORWARDING_TOWN_OR_CITY ' ||p_pa_request_rec.FORWARDING_TOWN_OR_CITY,65 );
4119 hr_utility.set_location('p_pa_request_rec.FORWARDING_REGION_2 ' ||substr(p_pa_request_rec.FORWARDING_REGION_2,1,40),66 );
4120 hr_utility.set_location('p_pa_request_rec.FORWARDING_POSTAL_CODE ' ||p_pa_request_rec.FORWARDING_POSTAL_CODE,67 );
4121 hr_utility.set_location('p_pa_request_rec.FORWARDING_COUNTRY ' ||substr(p_pa_request_rec.FORWARDING_COUNTRY,1,40),68 );
4122 hr_utility.set_location('l_ADDRESS_LINE1 ' ||substr(l_ADDRESS_LINE1,1,40),69 );
4123 hr_utility.set_location('l_ADDRESS_LINE2 ' ||substr(l_ADDRESS_LINE2,1,40),70 );
4124 hr_utility.set_location('l_ADDRESS_LINE3 ' ||substr(l_ADDRESS_LINE3,1,40),71 );
4125 hr_utility.set_location('l_TOWN_OR_CITY ' ||l_TOWN_OR_CITY,72 );
4126 hr_utility.set_location('l_REGION_2 ' ||substr(l_REGION_2,1,40),73 );
4127 hr_utility.set_location('l_POSTAL_CODE ' ||l_POSTAL_CODE,74 );
4128 hr_utility.set_location('l_COUNTRY ' ||substr(l_COUNTRY,1,40),75 );
4129 IF l_session.noa_id_correct is null THEN
4130 IF nvl(p_pa_request_rec.FORWARDING_ADDRESS_LINE1,hr_api.g_varchar2) = nvl(l_address_line1 ,hr_api.g_varchar2) and
4131 nvl(p_pa_request_rec.FORWARDING_ADDRESS_LINE2 ,hr_api.g_varchar2)= nvl(l_address_line2 ,hr_api.g_varchar2) and
4132 nvl(p_pa_request_rec.FORWARDING_ADDRESS_LINE3 ,hr_api.g_varchar2)= nvl(l_address_line3 ,hr_api.g_varchar2) and
4133 nvl(p_pa_request_rec.FORWARDING_TOWN_OR_CITY ,hr_api.g_varchar2) = nvl(l_town_or_city ,hr_api.g_varchar2) and
4134 nvl(p_pa_request_rec.FORWARDING_REGION_2 ,hr_api.g_varchar2) = nvl(l_region_2 ,hr_api.g_varchar2) and
4135 nvl(p_pa_request_rec.FORWARDING_POSTAL_CODE ,hr_api.g_varchar2) = nvl(l_postal_code ,hr_api.g_varchar2) and
4136 nvl(P_pa_request_rec.FORWARDING_COUNTRY ,hr_api.g_varchar2) = nvl(l_country ,hr_api.g_varchar2) THEN
4137 null;
4138 hr_utility.set_location('Non Correction -- No Action ' || l_proc,76);
4139 ELSE
4140 l_create_address := 'Y';
4141 hr_utility.set_location('Non Correction -- Create Address ' || l_proc,77);
4142 END IF;
4143 ELSE
4144 hr_utility.set_location('altered_pa_request_id is ' ||l_session.altered_pa_request_id ,65);
4145 hr_utility.set_location('noa_id_correct is ' ||l_session.noa_id_correct ,66);
4146 hr_utility.set_location('address_id is ' || l_address_id, 66);
4147 open c_upd_primary_address(l_session.altered_pa_request_id, l_address_id);
4148 fetch c_upd_primary_address into l_address_id;
4149 hr_utility.set_location('address_id is ' || l_address_id, 66);
4150
4151 IF c_upd_primary_address%NOTFOUND then
4152 IF nvl(p_pa_request_rec.FORWARDING_ADDRESS_LINE1,hr_api.g_varchar2) = nvl(l_address_line1 ,hr_api.g_varchar2) and
4153 nvl(p_pa_request_rec.FORWARDING_ADDRESS_LINE2 ,hr_api.g_varchar2)= nvl(l_address_line2 ,hr_api.g_varchar2) and
4154 nvl(p_pa_request_rec.FORWARDING_ADDRESS_LINE3 ,hr_api.g_varchar2)= nvl(l_address_line3 ,hr_api.g_varchar2) and
4155 nvl(p_pa_request_rec.FORWARDING_TOWN_OR_CITY ,hr_api.g_varchar2) = nvl(l_town_or_city ,hr_api.g_varchar2) and
4156 nvl(p_pa_request_rec.FORWARDING_REGION_2 ,hr_api.g_varchar2) = nvl(l_region_2 ,hr_api.g_varchar2) and
4157 nvl(p_pa_request_rec.FORWARDING_POSTAL_CODE ,hr_api.g_varchar2) = nvl(l_postal_code ,hr_api.g_varchar2) and
4158 nvl(P_pa_request_rec.FORWARDING_COUNTRY ,hr_api.g_varchar2) = nvl(l_country ,hr_api.g_varchar2) THEN
4159 NULL;
4160 hr_utility.set_location('Correction -- No Action ' || l_proc,69);
4161 ELSE
4162 l_create_address := 'Y';
4163 hr_utility.set_location('Correction -- Create Address ' || l_proc,71);
4164 END IF;
4165 ELSE
4166 l_update_address := 'Y';
4167 hr_utility.set_location('Correction -- Update Address ' || l_proc,68);
4168 END IF;
4169 close c_upd_primary_address;
4170 END IF;
4171 END IF;
4172 ELSE
4173 hr_utility.set_location(l_proc,78);
4174 END IF;
4175 END IF;
4176
4177
4178 -- ***********
4179 -- Calling APIs
4180 -- ***********
4181
4182 -- Fetch OVN for per_people_f, while processing hire_applicant and name change
4183
4184 If l_hr_applicant_api_hire = 'Y' or
4185 l_rehire_ex_emp = 'Y' or
4186 l_update_person = 'Y' then
4187 l_per_object_version_number := null;
4188 For ovn in per_ovn loop
4189 l_business_group_id := ovn.business_group_id;
4190 l_per_object_version_number := ovn.object_version_number;
4191 l_per_upd_employee_number := ovn.employee_number;
4192 End loop;
4193 If l_per_object_version_number is null then
4194 hr_utility.set_message(8301,'GHR_38133_INVALID_PERSON');
4195 hr_utility.raise_error;
4196 End if;
4197 End if;
4198 --
4199 -- An Appointment Family can now only have 'APL's and hence only hire_applicants can be called.
4200
4201 -- Before calling the hire_applicant, should delete all the other assignments for the person
4202 -- except the one that has been passed in. Call per_asg_del.del in 'ZAP' mode.
4203 -- If it's a CORRECTION to an Appointment , then should not call it
4204
4205 -- Hire Applicant
4206
4207
4208 If l_hr_applicant_api_hire = 'Y' and l_session.noa_id_correct is null then
4209 hr_utility.set_location(l_proc,75);
4210 hr_utility.set_location('Emp number is ' || l_per_hire_employee_number,1);
4211 begin
4212 savepoint hire_app;
4213 hr_applicant_api.hire_applicant
4214 (P_HIRE_DATE => g_effective_date
4215 ,P_PERSON_ID => p_pa_request_rec.person_id
4216 ,P_ASSIGNMENT_ID => l_assignment_id
4217 ,P_PER_OBJECT_VERSION_NUMBER => l_per_object_version_number
4218 ,P_EMPLOYEE_NUMBER => l_per_hire_employee_number
4219 ,P_PER_EFFECTIVE_START_DATE => l_per_hire_eff_start_date
4220 ,P_PER_EFFECTIVE_END_DATE => l_per_hire_eff_end_date
4221 ,P_UNACCEPTED_ASG_DEL_WARNING => l_per_hire_un_asg_del_warn
4222 ,P_ASSIGN_PAYROLL_WARNING => l_per_hire_asg_pay_warn
4223 , p_oversubscribed_vacancy_id => l_per_hire_oversubs_vac_id -- Bug# 1316490 -- Venkat --6/19
4224 );
4225 Exception
4226 when others then
4227 if substr(sqlerrm(sqlcode),1,19) = 'ORA-20001: APP-7975' then
4228 rollback to hire_app;
4229 hr_utility.set_message(8301,'GHR_38555_HIRE_ON_ACC_DATE') ;
4230 hr_utility.raise_error;
4231 Else
4232 rollback to hire_app;
4233 raise;
4234 End if;
4235 End;
4236 End if;
4237
4238 l_assignment_id := p_pa_request_rec.employee_assignment_id;
4239
4240 If l_rehire_ex_emp = 'Y' and l_session.noa_id_correct is null then
4241 hr_utility.set_location(l_proc,76);
4242 Begin
4243 savepoint rehire_ex;
4244 hr_employee_api.re_hire_ex_employee
4245 (p_hire_date => p_pa_request_rec.effective_date
4246 ,p_person_id => p_pa_request_rec.person_id
4247 ,p_per_object_version_number => l_per_object_version_number
4248 -- ,p_person_type_id =>
4249 ,p_rehire_reason => 'Rehire'
4250 ,p_assignment_id => l_assignment_id
4251 ,p_asg_object_version_number => l_asg_object_version_number
4252 ,p_per_effective_start_date => l_per_hire_eff_start_date
4253 ,p_per_effective_end_date => l_per_hire_eff_end_date
4254 ,p_assignment_sequence => l_dum_number
4255 ,p_assignment_number => l_dum_char
4256 ,p_assign_payroll_warning => l_per_hire_asg_pay_warn
4257 );
4258 -- Fix for 655045
4259 -- Start Changes for 3150551
4260 /*
4261 delete from per_person_list_changes
4262 where person_id = p_pa_request_rec.person_id
4263 and nvl(termination_flag,hr_api.g_varchar2) = 'Y';
4264 */
4265 hr_security_internal.clear_from_person_list_changes
4266 ( p_person_id => p_pa_request_rec.person_id );
4267 -- End Changes for 3150551
4268 Exception
4269 when others then
4270 rollback to rehire_ex;
4271 raise;
4272 End;
4273 End if;
4274
4275 --Note : It looks like if the person_type_id is not passed in, then it defaults to the system_person_type of 'EMP' anyway .
4276 -- and therefore not passing it in.
4277 p_pa_request_rec.employee_assignment_id := l_assignment_id;
4278 -- Bug# 1235958: Update of l_assignment_id for history records.
4279 ghr_history_api.get_g_session_var(l_session);
4280 l_session.assignment_id := l_assignment_id;
4281 ghr_history_api.set_g_session_var(l_session);
4282
4283
4284 -- fetch assignment Business_group, Object_version_number and Normal Hours
4285
4286 l_asg_object_version_number := null;
4287 For ovn in asg_ovn(l_assignment_id) loop
4288 l_business_group_id := ovn.business_group_id;
4289 l_asg_object_version_number := ovn.object_version_number;
4290 l_working_hours := ovn.normal_hours;
4291 l_asg_payroll_id := ovn.payroll_id;
4292 -- added for duty_station change
4293 l_asg_location_id := ovn.location_id;
4294 --bug # 8258924 added for occupation code change
4295 l_asg_job_id := ovn.job_id;
4296 End loop;
4297 hr_utility.set_location(l_proc,95);
4298 If l_asg_object_version_number is null then
4299 hr_utility.set_message(8301,'GHR_38135_INVALID_ASGN');
4300 hr_utility.raise_error;
4301 End if;
4302
4303 -- Bug 2082615
4304 -- Store the old Asg Status Type in g_old_user_status for using in later stages
4305
4306 for asg_stat_rec in c_user_status loop
4307 g_old_user_status := asg_stat_rec.user_status;
4308 l_old_system_status := asg_stat_rec.per_system_status;
4309 l_old_effective_start_date := asg_stat_rec.effective_start_date -1; --bug 2839332
4310 hr_utility.set_location('Old User status is '||g_old_user_status,96);
4311 hr_utility.set_location('Old system status '|| l_old_system_status,999);
4312 exit;
4313 end loop;
4314
4315 If l_old_system_status <> 'SUSP_ASSIGN' or
4316 (l_noa_family_code = 'SEPARATION' or l_noa_family_code = 'RETURN_TO_DUTY' or
4317 --Bug # 11060755 Added this to get User assignment status
4318 -- even when old system status is Suspended Assignment for Non Pay Duty Status
4319 -- Family
4320 (l_old_system_status = 'SUSP_ASSIGN' and l_noa_family_code = 'NON_PAY_DUTY_STATUS') ) then
4321
4322 -- Bug 2839332
4323 IF (l_noa_family_code = 'RETURN_TO_DUTY') THEN
4324 FOR rtd_rec in RTD_asg_status(p_pa_request_rec.employee_assignment_id,p_pa_request_rec.effective_date)
4325 LOOP
4326 l_old_effective_start_date := rtd_rec.effective_date-1;
4327 exit;
4328 END LOOP;
4329
4330 for asg_stat_old_rec in c_user_old_status loop
4331 --- Bug 5923426 start
4332 IF asg_stat_old_rec.per_system_status <>'SUSP_ASSIGN' THEN
4333 l_asg_status_type_id := asg_stat_old_rec.assignment_status_type_id;
4334 exit;
4335 END IF;
4336 --- Bug 5923426 end
4337 end loop;
4338 hr_utility.set_location('Assignment status type id '|| l_asg_status_type_id,997);
4339 l_activate_flag := 'Y';
4340 -- Bug 2839332
4341 --Bug# 6010971
4342 IF nvl(P_pa_request_rec.to_grade_id,hr_api.g_number) <> nvl(l_grade_id,hr_api.g_number) then
4343 l_employee_api_update_criteria := 'Y';
4344 end if;
4345 --Bug# 6010971
4346 ELSE --(l_noa_family_code = 'RETURN_TO_DUTY')
4347 -- Added p_assigment_id for Bug#4672772
4348 get_asg_status_type(p_noa_code => p_pa_request_rec.first_noa_code,
4349 p_business_group_id => l_business_group_id,
4350 p_assignment_id => p_pa_request_rec.employee_assignment_id,
4351 p_pa_request_id => p_pa_request_rec.pa_request_id, --Bug# 8724192
4352 p_status_type_id => l_asg_status_type_id,
4353 p_activate_flag => l_activate_flag,
4354 p_suspend_flag => l_suspend_flag,
4355 p_terminate_flag => l_terminate_flag
4356 );
4357 END IF; --(l_noa_family_code = 'RETURN_TO_DUTY')
4358 End if; -- l_old_system_status <> 'SUSP_ASSIGN'
4359
4360 --
4361 -- fetch payroll_id
4362 -- Note : Fetch has to be done only in cases where the user has not input a value in the
4363 -- specific DDF.
4364
4365 l_payroll_id := null;
4366
4367 For payroll in c_payroll_name loop
4368 l_payroll_id := payroll.payroll_id;
4369 End loop;
4370
4371 If l_payroll_id is null then
4372
4373 -- If payroll_id in the assignment record is null then
4374 If l_asg_payroll_id is null then
4375 For bw_payroll in c_bw_payroll loop
4376 l_payroll_id := bw_payroll.payroll_id;
4377 exit;
4378 End loop;
4379 Else
4380 l_payroll_id := l_asg_payroll_id;
4381 End if;
4382 End if;
4383
4384 If l_payroll_id is null then
4385 hr_utility.set_message(8301,'GHR_38183_PAY_NOT_EXISTS');
4386 hr_utility.raise_error;
4387 End if;
4388
4389 --Pradeep start of bug #4148743
4390 If l_payroll_id <> l_asg_payroll_id THEN
4391 l_employee_api_update_criteria := 'Y';
4392 end if;
4393 --Pradeep end of bug #4148743
4394
4395
4396 If nvl(p_pa_request_rec.duty_station_location_id,hr_api.g_number) <> nvl(l_asg_location_id,hr_api.g_number) then
4397 l_employee_api_update_criteria := 'Y';
4398 End if;
4399
4400 --BUG # 8258924
4401 If p_pa_request_rec.to_position_id is NOT NULL and p_pa_request_rec.to_job_id is NOT NULL THEN
4402 If l_asg_position is NOT NULL and l_asg_job_id is NOT NULL THEN
4403 If p_pa_request_rec.to_position_id = l_asg_position and p_pa_request_rec.to_job_id <> l_asg_job_id then
4404 l_employee_api_update_criteria := 'Y';
4405 End if;
4406 End if;
4407 End if;
4408
4409 --
4410 -- calling hr_assignment_api.update_emp_asg_criteria
4411 --
4412 If l_employee_api_update_criteria = 'Y' or l_update_gre = 'Y' then
4413 -- Function to determine update_mode
4414 l_update_mode := return_update_mode
4415 (p_id => p_pa_request_rec.employee_assignment_id,
4416 p_effective_date => p_pa_request_rec.effective_date,
4417 p_table_name => 'PER_ASSIGNMENTS_F'
4418 );
4419 hr_utility.set_location(l_proc,90);
4420 hr_utility.set_location('Asg id ' || to_char(l_assignment_id),3);
4421 hr_utility.set_location('pay id ' || to_char(l_payroll_id),4);
4422 hr_utility.set_location('l_update_gre is '||l_update_gre,91);
4423
4424 If l_update_gre = 'Y' then
4425 -- get the GRE . Passed into the foll. api as the p_tax_unit
4426 for tax_unit in c_tax_unit_org loop
4427 l_tax_unit_id := tax_unit.tax_unit_id;
4428 end loop;
4429 If l_tax_unit_id is null then
4430 for tax_unit in c_tax_unit_bg loop
4431 l_tax_unit_id := tax_unit.tax_unit_id;
4432 end loop;
4433 End if;
4434
4435 hr_utility.set_location(l_proc,92);
4436 begin
4437 savepoint update_emp_asg;
4438 hr_assignment_api.update_us_emp_asg
4439 (p_assignment_id => p_pa_request_rec.employee_assignment_id,
4440 p_object_version_number => l_asg_object_version_number,
4441 p_effective_date => g_effective_date,
4442 p_datetrack_update_mode => l_update_mode,
4443 p_comment_id => l_comment_id,
4444 p_tax_unit => l_tax_unit_id, -- gre
4445 p_soft_coding_keyflex_id => l_soft_coding_keyflex_id,
4446 p_effective_start_date => l_asg_upd_effective_start_date,
4447 p_effective_end_date => l_asg_upd_effective_end_date,
4448 p_concatenated_segments => l_concatenated_segments,
4449 p_no_managers_warning => l_asg_upd_org_now_man_warn,
4450 p_other_manager_warning => l_asg_upd_other_manager_warn
4451 );
4452 l_update_mode := 'CORRECTION';
4453 Exception
4454 When others then
4455 rollback to update_emp_asg;
4456 raise;
4457 End;
4458 End if;
4459 hr_utility.set_location('After update_us_emp_asg '||l_proc,93);
4460 If l_employee_api_update_criteria = 'Y' then
4461 hr_utility.set_location('Before update_emp_asg_criteria ',94);
4462 hr_utility.set_location('checking how correction updates the record',500);
4463 hr_utility.set_location('the to position id passed',500);
4464 hr_assignment_api.update_emp_asg_criteria
4465 (p_effective_date => g_effective_date
4466 ,p_datetrack_update_mode => l_update_mode
4467 ,p_assignment_id => l_assignment_id
4468 ,p_object_version_number => l_asg_object_version_number
4469 ,P_PAYROLL_ID => l_payroll_id
4470 ,p_position_id => nvl(P_pa_request_rec.to_position_id,l_position_id) --nvl added for bug 4542437
4471 ,p_job_id => nvl(P_pa_request_rec.to_job_id,l_job_id) --nvl added for bug 4542437
4472 ,p_location_id => P_pa_request_rec.duty_station_location_id
4473 ,p_organization_id => nvl(P_pa_request_rec.to_organization_id,l_org_id)--nvl added for bug 4542437
4474 ,p_grade_id => nvl(P_pa_request_rec.to_grade_id,l_grade_id) --nvl added for bug 4542437
4475 ,p_effective_start_date => l_asg_upd_effective_start_date
4476 ,p_effective_end_date => l_asg_upd_effective_end_date
4477 ,p_special_ceiling_step_id => l_asg_upd_special_ceil_step_id
4478 ,p_people_group_id => l_asg_upd_people_group_id
4479 ,p_group_name => l_asg_upd_group_name
4480 ,p_org_now_no_manager_warning => l_asg_upd_org_now_man_warn
4481 ,p_other_manager_warning => l_asg_upd_other_manager_warn
4482 ,p_spp_delete_warning => l_asg_upd_spp_delete_warning
4483 ,p_entries_changed_warning => l_asg_upd_entries_chan_warn
4484 ,p_tax_district_changed_warning => l_asg_upd_tax_dist_chan_warn
4485 );
4486 End if;
4487 End if;
4488 --
4489 hr_utility.set_location('After update_emp_asg_criteria '||l_proc,95);
4490 If l_activate_flag = 'Y' and l_session.noa_id_correct is null then
4491 hr_utility.set_location(l_proc,120);
4492 l_update_mode := return_update_mode
4493 (p_id => p_pa_request_rec.employee_assignment_id,
4494 p_effective_date => p_pa_request_rec.effective_date,
4495 p_table_name => 'PER_ASSIGNMENTS_F'
4496 );
4497 Begin
4498 savepoint activate;
4499 -- Begin Bug# 9849900
4500 -- To occur termination of Detail assignment as of NOA effective date, sending the eff date as +1
4501 IF p_pa_request_rec.first_noa_code IN ('732','932') THEN
4502 hr_assignment_api.activate_emp_asg
4503 (p_effective_date => g_effective_date+1
4504 ,p_datetrack_update_mode => l_update_mode
4505 ,p_assignment_id => l_assignment_id
4506 ,p_assignment_status_type_id => l_asg_status_type_id
4507 ,p_object_version_number => l_asg_object_version_number
4508 ,p_effective_start_date => l_asg_act_eff_start_date
4509 ,p_effective_end_date => l_asg_act_eff_end_date
4510 );
4511 ELSE
4512 -- End Bug# 9849900
4513 hr_assignment_api.activate_emp_asg
4514 (p_effective_date => g_effective_date
4515 ,p_datetrack_update_mode => l_update_mode
4516 ,p_assignment_id => l_assignment_id
4517 ,p_assignment_status_type_id => l_asg_status_type_id
4518 ,p_object_version_number => l_asg_object_version_number
4519 ,p_effective_start_date => l_asg_act_eff_start_date
4520 ,p_effective_end_date => l_asg_act_eff_end_date
4521 );
4522 END IF;-- Bug# 9849900
4523 Exception
4524 when others then
4525 rollback to activate;
4526 raise;
4527 end;
4528 Elsif l_suspend_flag = 'Y' and l_session.noa_id_correct is null then -- is a suspension and not a correction
4529 hr_utility.set_location(l_proc,125);
4530 l_update_mode := return_update_mode
4531 (p_id => p_pa_request_rec.employee_assignment_id,
4532 p_effective_date => p_pa_request_rec.effective_date,
4533 p_table_name => 'PER_ASSIGNMENTS_F'
4534 );
4535 Begin
4536 savepoint suspend;
4537 hr_assignment_api.suspend_emp_asg
4538 (p_effective_date => g_effective_date
4539 ,p_datetrack_update_mode => l_update_mode
4540 ,p_assignment_id => l_assignment_id
4541 ,p_object_version_number => l_asg_object_version_number
4542 ,p_assignment_status_type_id => l_asg_status_type_id
4543 ,p_effective_start_date => l_asg_sus_eff_start_date
4544 ,p_effective_end_date => l_asg_sus_eff_end_date
4545 );
4546 Exception
4547 when others then
4548 rollback to suspend;
4549 raise;
4550 End;
4551 -- elsif l_terminate_asg_flag = 'Y' then
4552 Elsif l_terminate_flag = 'Y' then
4553
4554 hr_utility.set_location(l_proc,130);
4555 hr_utility.set_location('NOA ID CORRECT : ' || l_session.noa_id_correct,1);
4556 If l_session.noa_id_correct is null then
4557 hr_utility.set_location(l_proc,132);
4558 l_emp_trm_eff_end_date := null;
4559
4560 for pds in c_pds loop
4561 l_period_of_service_id := pds.period_of_service_id;
4562 l_pds_object_version_number := pds.object_version_number;
4563 exit;
4564 end loop;
4565
4566 for ex_emp_type in c_ex_emp_per_type loop
4567 l_person_type_id := ex_emp_type.person_type_id;
4568 exit;
4569 end loop;
4570 begin
4571 savepoint terminate;
4572 l_date1 := g_effective_date;
4573 hr_ex_employee_api.actual_termination_emp
4574 (p_effective_date => g_effective_date
4575 ,p_period_of_service_id => l_period_of_service_id
4576 ,p_object_version_number => l_pds_object_version_number
4577 ,p_actual_termination_date => g_effective_date
4578 ,p_last_standard_process_date => l_date1
4579 ,p_person_type_id => l_person_type_id
4580 ,p_assignment_status_type_id => l_asg_status_type_id -- the one derived using the fn. get_asg_status_type
4581 ,p_supervisor_warning => l_supervisor_warning
4582 ,p_event_warning => l_event_warning
4583 ,p_interview_warning => l_interview_warning
4584 ,p_review_warning => l_review_warning
4585 ,p_recruiter_warning => l_recruiter_warning
4586 ,p_asg_future_changes_Warning => l_asg_future_changes_warning
4587 ,p_entries_changed_warning => l_entries_changed_warning
4588 ,p_pay_proposal_warning => l_pay_proposal_warning
4589 ,p_dod_warning => l_dod_warning
4590 );
4591 -- Start Changes for 3150551
4592 /*
4593 insert into per_person_list_changes
4594 (person_id
4595 ,security_profile_id
4596 ,include_flag
4597 ,termination_flag)
4598 select l.person_id
4599 ,l.security_profile_id
4600 ,'Y'
4601 ,'Y'
4602 from per_person_list l
4603 where l.person_id = p_pa_request_rec.person_id
4604 and not exists
4605 (Select 1
4606 From per_person_list_changes pplc
4607 Where pplc.person_id = p_pa_request_rec.person_id
4608 And pplc.security_profile_id = l.security_profile_id
4609 );
4610 */
4611 hr_security_internal.copy_to_person_list_changes
4612 (p_person_id => p_pa_request_rec.person_id );
4613 -- End Changes for 3150551
4614 Exception
4615 when others then
4616 rollback to terminate;
4617 raise;
4618 End;
4619
4620 l_emp_trm_eff_end_date := null;
4621 -- g_effective_date + 1;
4622 -- Checking whether Payroll installed or not. Skipping Final Process if the the Payrol
4623 -- Installed. If there is no payroll installed then doing Finall process.
4624 -- Assuming HR_USER_TYPE will be 'PER' if the payroll is not installed, so doing Final
4625 -- Process for HR user
4626 l_hr_user_type := fnd_profile.value('HR_USER_TYPE');
4627 IF l_hr_user_type = 'PER' THEN
4628 begin
4629
4630 savepoint final_process;
4631 hr_ex_employee_api.final_process_emp
4632 (p_period_of_service_id => l_period_of_service_id
4633 ,p_object_version_number => l_pds_object_version_number
4634 ,p_final_process_date => g_effective_date
4635 ,p_org_now_no_manager_warning => l_org_now_no_manager_warning
4636 ,p_asg_future_changes_warning => l_asg_future_changes_warning
4637 ,p_entries_changed_warning => l_entries_changed_warning
4638 );
4639 EXCEPTION
4640 WHEN OTHERS THEN
4641 rollback to final_process;
4642 raise;
4643 END;
4644 END IF;
4645 END IF;
4646 --if 352 then need to end date position as well -- Rohini
4647 -- Bug 2835138 Sundar End date position only for MTO.
4648 IF (p_pa_request_rec.first_noa_code = '352') AND (UPPER(SUBSTR(p_pa_request_rec.request_number,1,3)) = 'MTO') THEN
4649 l_position_data_rec_type.position_id := p_pa_request_rec.from_position_id;
4650 --since in case of a SEPARATION, the to fields are all closed
4651 -- Bug 3431540 Need to end date only on the next date of separation.
4652 l_position_data_rec_type.effective_date := g_effective_date + 1;
4653 l_position_data_rec_type.effective_end_date := g_effective_date + 1;
4654 -- End Bug 3431540
4655 l_position_data_rec_type.datetrack_mode := return_update_mode
4656 (p_id => p_pa_request_rec.to_position_id,
4657 p_effective_date => p_pa_request_rec.effective_date,
4658 p_table_name => 'HR_ALL_POSITIONS_F'
4659 );
4660 ghr_sf52_pos_update.update_position_info
4661 (p_pos_data_rec => l_position_data_rec_type);
4662 END IF; -- If NOA is 352
4663
4664 END IF;
4665
4666
4667 -- Name change -- The same should cope up with both normal and correction actions
4668 If l_update_person = 'Y' then
4669
4670 hr_utility.set_location(l_proc,138);
4671 l_update_mode := return_update_mode
4672 (p_id => p_pa_request_rec.person_id,
4673 p_effective_date => p_pa_request_rec.effective_date,
4674 p_table_name => 'PER_PEOPLE_F'
4675 );
4676
4677 hr_person_api.update_person
4678 (p_effective_date => g_effective_date
4679 ,p_datetrack_update_mode => l_update_mode
4680 ,p_person_id => p_pa_request_rec.person_id
4681 ,p_object_version_number => l_per_object_version_number
4682 ,p_employee_number => l_per_upd_employee_number
4683 ,p_last_name => p_pa_request_rec.employee_last_name
4684 ,p_first_name => p_pa_request_rec.employee_first_name
4685 ,p_middle_names => p_pa_request_rec.employee_middle_names
4686 ,p_national_identifier => p_pa_request_rec.employee_national_identifier
4687 ,p_date_of_birth => p_pa_request_rec.employee_date_of_birth
4688 ,p_effective_start_date => l_per_upd_effective_start_date
4689 ,p_effective_end_date => l_per_upd_effective_end_date
4690 ,p_full_name => l_per_upd_full_name
4691 ,p_comment_id => l_per_upd_comment_id
4692 ,p_name_combination_warning => l_per_upd_name_comb_warn
4693 ,p_assign_payroll_warning => l_per_upd_assgn_payroll_warn
4694 ,p_orig_hire_warning => l_orig_hire_warning
4695 );
4696
4697 End if;
4698 --
4699
4700 -- Address creation
4701 l_hr_user_type := fnd_profile.value('HR_USER_TYPE');
4702 hr_utility.set_location('in address'||l_hr_user_type,1000);
4703 IF l_hr_user_type = 'INT' THEN
4704 hr_utility.set_location('in per addresses',1000);
4705 If l_create_address = 'Y' or l_update_address = 'Y' then
4706 hr_utility.set_location('in upd addresses',1000);
4707 for county in county_name loop
4708 l_county_name := county.county_name;
4709 end loop;
4710 If l_create_address = 'Y' then
4711 -- 6919898 End dating the primary and secondary address
4712 -- only if exists If primary address does not exists just creating the new primary address
4713 -- to a person
4714 If l_address_id is not null then
4715 hr_utility.set_location(l_proc,145);
4716 --- End dating all the secondary addresses for existing primary address
4717 for sec_address in c_sec_address loop
4718
4719 hr_person_address_api.update_us_person_address
4720 (p_effective_date => g_effective_date
4721 ,p_date_to => g_effective_date
4722 ,p_address_id => sec_address.address_id
4723 ,p_object_version_number => sec_address.object_version_number
4724 );
4725 end loop;
4726 hr_utility.set_location('l_address_id'||l_address_id,1000);
4727 -- End dating the existing primary address
4728 hr_person_address_api.update_us_person_address
4729 (p_effective_date => g_effective_date
4730 ,p_date_to => g_effective_date
4731 ,p_address_id => l_address_id
4732 ,p_object_version_number => l_add_object_version_number
4733 );
4734 End If; -- l_address_id is not null
4735 -- Creating new primary address for forwarding address
4736 hr_person_address_api.create_us_person_address
4737 (p_effective_date => g_effective_date
4738 ,p_person_id => p_pa_request_rec.person_id
4739 ,p_primary_flag => 'Y'
4740 ,p_date_from => g_effective_date + 1
4741 ,p_address_line1 => p_pa_request_rec.forwarding_address_line1
4742 ,p_address_line2 => p_pa_request_rec.forwarding_address_line2
4743 ,p_address_line3 => p_pa_request_rec.forwarding_address_line3
4744 ,p_city => p_pa_request_rec.forwarding_town_or_city
4745 ,p_state => p_pa_request_rec.forwarding_region_2
4746 ,p_county => l_county_name
4747 ,p_zip_code => p_pa_request_rec.forwarding_postal_code
4748 ,p_country => p_pa_request_rec.forwarding_country
4749 ,p_address_id => l_per_add_address_id
4750 ,p_object_version_number => l_per_add_ovr_number
4751 );
4752 --Creating new secondary addresses
4753 for sec_address in c_sec_address loop
4754 hr_person_address_api.create_us_person_address
4755 (p_effective_date => g_effective_date
4756 ,p_person_id => p_pa_request_rec.person_id
4757 ,p_primary_flag => 'N'
4758 ,p_date_from => g_effective_date + 1
4759 ,p_address_line1 => sec_address.address_line1
4760 ,p_address_line2 => sec_address.address_line2
4761 ,p_address_line3 => sec_address.address_line3
4762 ,p_city => sec_address.town_or_city
4763 ,p_state => sec_address.region_2
4764 ,p_county => sec_address.region_1
4765 ,p_zip_code => sec_address.postal_code
4766 ,p_country => sec_address.country
4767 ,p_address_type => sec_address.address_type
4768 ,p_address_id => l_per_add_address_id
4769 ,p_object_version_number => l_per_add_ovr_number
4770 );
4771 end loop;
4772 End if;
4773
4774 --Update address -- In case of a correction, may be updating some entry in the address
4775
4776 If l_update_address = 'Y' then
4777 hr_utility.set_location(l_proc,150);
4778 hr_person_address_api.update_us_person_address
4779 (p_address_id => l_address_id
4780 ,p_object_version_number => l_add_object_version_number
4781 ,p_effective_date => g_effective_date
4782 ,p_address_line1 => p_pa_request_rec.forwarding_address_line1
4783 ,p_address_line2 => p_pa_request_rec.forwarding_address_line2
4784 ,p_address_line3 => p_pa_request_rec.forwarding_address_line3
4785 ,p_city => p_pa_request_rec.forwarding_town_or_city
4786 ,p_state => p_pa_request_rec.forwarding_region_2
4787 ,p_county => l_county_name
4788 ,p_zip_code => p_pa_request_rec.forwarding_postal_code
4789 ,p_country => p_pa_request_rec.forwarding_country
4790 );
4791 End if;
4792 End if;
4793 ELSIF l_hr_user_type = 'PER' THEN
4794 If l_create_address = 'Y' or l_update_address = 'Y' then
4795 for county in county_name loop
4796 l_county_name := county.county_name;
4797 end loop;
4798 If l_create_address = 'Y' then
4799 -- 6919898 End dating the primary and secondary address
4800 -- only if exists If primary address does not exists just creating the new primary address
4801 -- to a person
4802 If l_address_id is not null then
4803 hr_utility.set_location(l_proc,145);
4804 --- End dating all the secondary addresses for existing primary address
4805 for sec_address in c_sec_address loop
4806 hr_person_address_api.update_person_address
4807 (p_effective_date => g_effective_date
4808 ,p_date_to => g_effective_date
4809 ,p_address_id => sec_address.address_id
4810 ,p_object_version_number => sec_address.object_version_number
4811 );
4812 end loop;
4813 -- End dating the existing primary address
4814 hr_person_address_api.update_person_address
4815 (p_effective_date => g_effective_date
4816 ,p_date_to => g_effective_date
4817 ,p_address_id => l_address_id
4818 ,p_object_version_number => l_add_object_version_number
4819 );
4820 End If;
4821 -- Creating new primary address for forwarding address
4822 hr_person_address_api.create_person_address
4823 (p_effective_date => g_effective_date
4824 ,p_person_id => p_pa_request_rec.person_id
4825 ,p_primary_flag => 'Y'
4826 ,p_style => 'US_GLB_FED' -- Bug# 4725292
4827 ,p_date_from => g_effective_date + 1
4828 ,p_address_line1 => p_pa_request_rec.forwarding_address_line1
4829 ,p_address_line2 => p_pa_request_rec.forwarding_address_line2
4830 ,p_address_line3 => p_pa_request_rec.forwarding_address_line3
4831 ,p_town_or_city => p_pa_request_rec.forwarding_town_or_city
4832 ,p_region_1 => l_county_name
4833 ,p_region_2 => p_pa_request_rec.forwarding_region_2
4834 ,p_postal_code => p_pa_request_rec.forwarding_postal_code
4835 ,p_country => p_pa_request_rec.forwarding_country
4836 ,p_address_id => l_per_add_address_id
4837 ,p_object_version_number => l_per_add_ovr_number
4838 );
4839 --Creating new secondary addresses
4840 for sec_address in c_sec_address loop
4841 hr_person_address_api.create_person_address
4842 (p_effective_date => g_effective_date
4843 ,p_person_id => p_pa_request_rec.person_id
4844 ,p_primary_flag => 'N'
4845 ,p_style => 'US_GLB_FED' -- Bug# 4725292
4846 ,p_date_from => g_effective_date + 1
4847 ,p_address_line1 => sec_address.address_line1
4848 ,p_address_line2 => sec_address.address_line2
4849 ,p_address_line3 => sec_address.address_line3
4850 ,p_town_or_city => sec_address.town_or_city
4851 ,p_region_2 => sec_address.region_2
4852 ,p_region_1 => sec_address.region_1
4853 ,p_postal_code => sec_address.postal_code
4854 ,p_country => sec_address.country
4855 ,p_address_type => sec_address.address_type
4856 ,p_address_id => l_per_add_address_id
4857 ,p_object_version_number => l_per_add_ovr_number
4858 );
4859 end loop;
4860 End if;
4861
4862 --Update address -- In case of a correction, may be updating some entry in the address
4863
4864 If l_update_address = 'Y' then
4865 hr_utility.set_location(l_proc,150);
4866 hr_person_address_api.update_person_address
4867 (p_address_id => l_address_id
4868 ,p_object_version_number => l_add_object_version_number
4869 ,p_effective_date => g_effective_date
4870 ,p_address_line1 => p_pa_request_rec.forwarding_address_line1
4871 ,p_address_line2 => p_pa_request_rec.forwarding_address_line2
4872 ,p_address_line3 => p_pa_request_rec.forwarding_address_line3
4873 ,p_town_or_city => p_pa_request_rec.forwarding_town_or_city
4874 ,p_region_2 => p_pa_request_rec.forwarding_region_2
4875 ,p_region_1 => l_county_name
4876 ,p_postal_code => p_pa_request_rec.forwarding_postal_code
4877 ,p_country => p_pa_request_rec.forwarding_country
4878 );
4879 End if;
4880 End if;
4881 END IF;
4882
4883
4884 -- The foll. is to determine whether or not there are changes in either -- SSN / DOB /NAMES of
4885 -- the employee , while doing a CORRECTION action only.
4886
4887 If l_session.noa_id_correct is not null then
4888 for per in per_ovn loop
4889 l_business_group_id := per.business_group_id;
4890 l_per_object_version_number := per.object_version_number;
4891 l_per_upd_employee_number := per.employee_number;
4892 l_per_national_identifier := per.national_identifier;
4893 l_per_first_name := per.first_name;
4894 l_per_last_name := per.last_name;
4895 l_per_middle_names := per.middle_names;
4896 l_per_date_of_birth := per.date_of_birth;
4897 end loop;
4898 hr_utility.set_location(l_proc,138);
4899
4900 if nvl(p_pa_request_rec.employee_national_identifier,hr_api.g_varchar2) <> nvl(l_per_national_identifier,hr_api.g_varchar2) or
4901 nvl(p_pa_request_rec.employee_date_of_birth,hr_api.g_date) <> nvl(l_per_date_of_birth,hr_api.g_date) or
4902 nvl(p_pa_request_rec.employee_last_name,hr_api.g_varchar2) <> nvl(l_per_last_name,hr_api.g_varchar2) or
4903 nvl(p_pa_request_rec.employee_first_name,hr_api.g_varchar2) <> nvl(l_per_first_name,hr_api.g_varchar2)or
4904 nvl(p_pa_request_rec.employee_middle_names,hr_api.g_varchar2) <> nvl(l_per_middle_names,hr_api.g_varchar2) then
4905
4906 l_update_mode := return_update_mode
4907 (p_id => p_pa_request_rec.person_id,
4908 p_effective_date => p_pa_request_rec.effective_date,
4909 p_table_name => 'PER_PEOPLE_F'
4910 );
4911
4912 hr_person_api.update_person
4913 (p_effective_date => g_effective_date
4914 ,p_datetrack_update_mode => l_update_mode
4915 ,p_person_id => p_pa_request_rec.person_id
4916 ,p_object_version_number => l_per_object_version_number
4917 ,p_employee_number => l_per_upd_employee_number
4918 ,p_last_name => p_pa_request_rec.employee_last_name
4919 ,p_first_name => p_pa_request_rec.employee_first_name
4920 ,p_middle_names => p_pa_request_rec.employee_middle_names
4921 ,p_national_identifier => p_pa_request_rec.employee_national_identifier
4922 ,p_date_of_birth => p_pa_request_rec.employee_date_of_birth
4923 ,p_effective_start_date => l_per_upd_effective_start_date
4924 ,p_effective_end_date => l_per_upd_effective_end_date
4925 ,p_full_name => l_per_upd_full_name
4926 ,p_comment_id => l_per_upd_comment_id
4927 ,p_name_combination_warning => l_per_upd_name_comb_warn
4928 ,p_assign_payroll_warning => l_per_upd_assgn_payroll_warn
4929 ,p_orig_hire_warning => l_orig_hire_warning
4930 );
4931
4932 End if;
4933 End if;
4934
4935 --
4936 /* -- Not supported for the September Release
4937 If l_noa_family_code = 'POS_ABOLISH' then
4938 for pos_ovn in c_pos_ovn loop
4939 l_pos_object_version_number := pos_ovn.object_version_number;
4940 end loop;
4941 hr_position_api.update_position
4942 (p_position_id => p_pa_request_rec.from_position_id,
4943 p_date_end => p_pa_request_rec.effective_date,
4944 p_object_version_number => l_pos_object_version_number,
4945 p_position_definition_id => l_pos_definition_id,
4946 p_name => l_name,
4947 p_valid_grades_changed_warning => l_val_grd_chg_wng
4948 );
4949 End if;
4950 */
4951
4952 ----
4953 -- JH Adding update to Position's Location bug 773795
4954 -- This update is irrespective of family and is based on to_position being not null
4955 -- and the To Position process method
4956 -- Bug 2462929 For change in DS we must consider DS process method, if APUE/UE update Position.
4957 ----
4958 hr_utility.set_location('Update Positions Location ' || l_proc,151);
4959 IF p_pa_request_rec.to_position_id IS NOT NULL THEN
4960
4961 l_form_field_name := 'TO_POSITION_TITLE';
4962 FOR pm_rec in get_to_posn_title_pm LOOP
4963 l_posn_title_pm := pm_rec.process_method_code;
4964 END Loop;
4965
4966 l_form_field_name := 'DUTY_STATION_CODE';
4967 FOR pm_rec in get_to_posn_title_pm LOOP
4968 l_DS_pm := pm_rec.process_method_code;
4969 END Loop;
4970
4971 hr_utility.set_location('To Posn PM ' || l_posn_title_pm ,151);
4972 IF l_posn_title_pm = 'UE' OR
4973 (l_posn_title_pm = 'APUE' AND
4974 nvl(p_pa_request_rec.to_position_id,hr_api.g_number) <> nvl(p_pa_request_rec.from_position_id,hr_api.g_number)) OR
4975 l_DS_pm in ('APUE','UE') OR
4976 (p_pa_request_rec.effective_date >= to_date('2007/01/07','YYYY/MM/DD') AND p_pa_request_rec.first_noa_code = '894') THEN
4977 ghr_sf52_pos_update.update_positions_location(
4978 p_position_id => p_pa_request_rec.to_position_id,
4979 p_location_id => p_pa_request_rec.duty_station_location_id,
4980 p_effective_date => p_pa_request_rec.effective_date);
4981 END IF;
4982 END IF;
4983 ----
4984
4985 hr_utility.set_location('Leaving ' || l_proc,155);
4986 Exception when others then
4987 --
4988 -- Reset IN OUT parameters and set OUT parameters
4989 --
4990 p_pa_request_rec := l_pa_request_rec;
4991 raise;
4992
4993 End Process_Family;
4994 --
4995
4996 -- ********************************
4997 -- procedure Process_Salary_Info
4998 -- ********************************
4999 --
5000 Procedure Process_salary_Info
5001 (p_pa_request_rec in ghr_pa_requests%rowtype
5002 ,p_wgi in out nocopy ghr_api.within_grade_increase_type
5003 ,p_retention_allow_review in out nocopy ghr_api.retention_allow_review_type
5004 ,p_capped_other_pay in number default null
5005 ) is
5006
5007 l_proc varchar2(70) := 'Process_salary_info';
5008 l_noa_family_code ghr_families.noa_family_code%type;
5009 l_adj_basic_pay_warn boolean;
5010 l_element_entry_id number;
5011 l_basic_pay_warn boolean;
5012 l_locality_adj_warn boolean;
5013 l_total_salary_warn Boolean;
5014 l_within_grade_increase_warn boolean;
5015 l_wgi_due_date date;
5016 l_wgi_pay_date date;
5017 l_lei_date varchar2(60); -- Bug 3111719
5018 v_payroll_id number;
5019 v_asg_effective_start_date date;
5020 v_asg_effective_end_date date;
5021 l_retained_grade_rec ghr_pay_calc.retained_grade_rec_type;
5022 l_ret_grade_rec ghr_pay_calc.retained_grade_rec_type;
5023 l_new_date_to per_people_extra_info.pei_information1%type;
5024 l_new_grade_or_level per_people_extra_info.pei_information3%type;
5025 l_new_pay_plan per_people_extra_info.pei_information3%type;
5026 l_new_pay_table per_people_extra_info.pei_information3%type;
5027 l_new_loc_percent per_people_extra_info.pei_information3%type;
5028 l_new_pay_basis per_people_extra_info.pei_information3%type;
5029 l_new_step_or_rate per_people_extra_info.pei_information4%type;
5030 l_cur_step_or_rate per_people_extra_info.pei_information4%type;
5031 l_new_temp_step per_people_extra_info.pei_information9%type;
5032 l_ret_object_version_number ghr_pa_requests.object_version_number%type;
5033 l_effective_date date;
5034 l_session ghr_history_api.g_session_var_type;
5035 l_value varchar2(30);
5036 l_multiple_error_flag boolean;
5037 l_entitled_other_pay number;
5038
5039
5040
5041 -- Cursor declarations
5042
5043 Cursor c_ele_entry(ele_name varchar2,
5044 ipv_name varchar2,
5045 eff_date date,
5046 bg_id number
5047 ) is
5048 select eev.screen_entry_value screen_entry_value,
5049 ele.element_entry_id
5050 from pay_element_types_f elt,
5051 pay_input_values_f ipv,
5052 pay_element_entries_f ele,
5053 pay_element_entry_values_f eev
5054 where trunc(eff_date)
5055 between elt.effective_start_date and elt.effective_end_date
5056 and trunc(eff_date)
5057 between ipv.effective_start_date and ipv.effective_end_date
5058 and trunc(eff_date)
5059 between ele.effective_start_date and ele.effective_end_date
5060 and trunc(eff_date)
5061 between eev.effective_start_date and eev.effective_end_date
5062 and elt.element_type_id = ipv.element_type_id
5063 and upper(elt.element_name) = upper(ele_name)
5064 and ipv.input_value_id = eev.input_value_id
5065 and ele.assignment_id = p_pa_request_rec.employee_assignment_id
5066 and ele.element_entry_id + 0 = eev.element_entry_id
5067 and upper(ipv.name) = upper( ipv_name)
5068 -- and NVL(elt.business_group_id,0) = NVL(ipv.business_group_id,0) -- modified by Ashley
5069 and (elt.business_group_id is null or elt.business_group_id = bg_id);
5070
5071
5072 Cursor c_retained_grade_ovn is
5073 select object_version_number,
5074 pei_information2,
5075 pei_information3,
5076 pei_information4,
5077 pei_information5,
5078 pei_information6,
5079 pei_information7,
5080 pei_information8,
5081 pei_information9
5082 from per_people_extra_info
5083 where person_extra_info_id = l_retained_grade_rec.person_extra_info_id;
5084
5085 l_wgi ghr_api.within_grade_increase_type;
5086 l_retention_allow_review ghr_api.retention_allow_review_type;
5087
5088
5089 CURSOR cur_temp_step
5090 IS
5091 SELECT rei_information3 temp_step
5092 FROM ghr_pa_request_extra_info
5093 WHERE pa_request_id = p_pa_request_rec.pa_request_id
5094 AND information_type = 'GHR_US_PAR_RG_TEMP_PROMO';
5095
5096 -- Start of code for Payroll Integration
5097 -- Payroll Integration
5098 Cursor Cur_bg(p_assignment_id NUMBER,p_eff_date DATE) is
5099 Select distinct business_group_id bg
5100 from per_assignments_f
5101 where assignment_id = p_assignment_id
5102 and p_eff_date between effective_start_date
5103 and effective_end_date;
5104
5105 Cursor Cur_Sal_Basis_name(p_bg_id NUMBER,p_ele_name VARCHAR2)
5106 IS
5107 Select pb.pay_basis_id
5108 From pay_element_types_f ele,
5109 pay_input_values_f inp,
5110 per_pay_bases pb
5111 where ele.business_group_id=p_bg_id
5112 and upper(element_name)=upper(p_ele_name)
5113 and ele.business_group_id=inp.business_group_id
5114 and ele.element_type_id=inp.element_type_id
5115 and inp.input_value_id=pb.input_value_id;
5116
5117 Cursor Cur_asg_det_for_SB_upd(p_asg_id NUMBER,
5118 p_eff_date DATE)
5119 is
5120 select object_version_number ovn,
5121 people_group_id ppl_grp_id,
5122 special_ceiling_step_id spcl_clng_stp_id,
5123 soft_coding_keyflex_id scl_kff_id,
5124 effective_start_date start_date,
5125 effective_end_date end_date,
5126 payroll_id
5127 from per_assignments_f
5128 where assignment_id=p_asg_id
5129 -- and position_id = p_pa_request_rec.to_position_id
5130 and p_eff_date
5131 between effective_start_date and effective_end_date;
5132
5133 l_SB_ovn per_assignments_f.object_version_number%type;
5134 l_ppl_grp_id per_assignments_f.people_group_id%type;
5135 l_spcl_clng_stp_id per_assignments_f.special_ceiling_step_id%type;
5136 l_scl_kff_id per_assignments_f.soft_coding_keyflex_id%type;
5137 l_eff_start_date per_assignments_f.effective_start_date%type;
5138 l_eff_end_date per_assignments_f.effective_end_date%type;
5139 l_payroll_id per_assignments_f.payroll_id%type;
5140 l_group_name pay_people_groups.group_name%type;
5141 l_org_now_man_warn boolean;
5142 l_other_manager_warn boolean;
5143 l_spp_delete_warning boolean;
5144 l_entries_chan_warn varchar2(10);
5145 l_tax_dist_chan_warn boolean;
5146
5147 -- sal admin fields
5148 l_pay_proposal_id number;
5149 l_sal_admin_ovn number;
5150 l_ele_entry_id number;
5151 l_payroll_warn boolean;
5152 l_approve_warn boolean;
5153 l_sal_warn boolean;
5154 l_date_warn boolean;
5155
5156 l_bg_id NUMBER;
5157 l_sal_basis VARCHAR2(80);
5158 l_sal_basis_type VARCHAR2(80);
5159 l_sal_basis_id NUMBER;
5160 l_basic_sal_rate VARCHAR2(80);
5161 l_inp_val_id VARCHAR2(80);
5162 l_pay_basis VARCHAR2(80);
5163 -- to map pay basis to sal basis
5164
5165 l_new_element_name VARCHAR2(80);
5166 l_eff_Date DATE;
5167
5168 Cursor Cur_proposal_exists (p_assignment_id IN NUMBER,
5169 p_eff_date IN DATE) is
5170 Select ppp.pay_proposal_id proposal_id,
5171 ppp.object_version_number ovn
5172 from per_pay_proposals ppp
5173 where ppp.assignment_id = p_assignment_id
5174 and change_date = p_eff_date;
5175
5176 l_proposal_id NUMBER;
5177 l_pay_intg BOOLEAN:=FALSE;
5178
5179 ll_element_link_id pay_element_links_f.element_link_id%type;
5180 ll_input_value_id pay_input_values_f.input_value_id%type;
5181 ll_element_entry_id pay_element_entries_f.element_entry_id%type;
5182 ll_value pay_element_entry_values_f.screen_entry_value%type;
5183 ll_object_version_number pay_element_entries_f.object_version_number%type;
5184 ll_multiple_error_flag varchar2(50);
5185 l_error_text varchar2(4000);
5186 l_dt_mode varchar2(200);
5187
5188 cursor cur_ex_emp (p_person_id IN Number, p_effective_date IN Date) is
5189 select 1
5190 from per_person_types pet,
5191 per_people_f per
5192 where pet.person_type_id = per.person_type_id
5193 and per.person_id = p_person_id
5194 and p_effective_date
5195 between per.effective_start_date and per.effective_end_date
5196 and pet.system_person_type = 'EX_EMP';
5197
5198 l_asg_del_ovn NUMBER;
5199 l_org_now_no_manager_warning BOOLEAN;
5200 l_validation_start_date DATE;
5201 l_validation_end_date DATE;
5202 l_effective_start_date DATE;
5203 l_effective_end_date DATE;
5204 l_payroll_value NUMBER;
5205 l_fam_code VARCHAR2(80);
5206 ll_payroll_value NUMBER;
5207 l_del_pay_prop BOOLEAN:=FALSE;
5208 l_ex_emp BOOLEAN := FALSE;
5209 l_ovn NUMBER;
5210 --
5211 -- Payroll Integration
5212 -- End of variable declaration for Payroll Integration
5213 --
5214
5215 -- No need for this cursor
5216 -- The values are properly passed
5217 -- Bug 3263140
5218 CURSOR cur_wgi_due
5219 IS
5220 SELECT rei_information4 wgi_due
5221 FROM ghr_pa_request_extra_info
5222 WHERE pa_request_id = p_pa_request_rec.pa_request_id
5223 AND information_type = 'GHR_US_PAR_SALARY_CHG';
5224 --
5225 -- Bug 3953455 Cursor to fetch the To step for both normal and correction actions.
5226 CURSOR cur_get_step(c_pa_request_id ghr_pa_requests.pa_request_id%type)
5227 IS
5228 SELECT par_orig.from_step_or_rate step1, par_corr.from_step_or_rate step2
5229 FROM ghr_pa_requests par_orig , ghr_pa_requests par_corr
5230 where par_orig.pa_request_id = par_corr.altered_pa_request_id
5231 and par_corr.pa_request_id = c_pa_request_id;
5232
5233 l_orig_pa_from_step ghr_pa_requests.to_step_or_rate%type;
5234 l_corr_pa_from_step ghr_pa_requests.to_step_or_rate%type;
5235 l_call_wgi_dates BOOLEAN;
5236
5237 -- End Bug 3953455
5238
5239 -- -- Bug 4031919 Cursor to check if pay plan is eligible for WGI or not.
5240 l_is_wgi_eligible BOOLEAN;
5241 l_wgi_cleared BOOLEAN;
5242 l_to_pay_plan ghr_pa_requests.to_pay_plan%type;
5243 l_wgi_exists BOOLEAN;
5244 l_wgi_new_name VARCHAR2(250);
5245
5246 CURSOR c_wgi_pay_plan(c_pay_plan ghr_pa_requests.to_pay_plan%TYPE) IS
5247 SELECT 1
5248 FROM ghr_pay_plans gpp
5249 WHERE gpp.pay_plan = c_pay_plan
5250 AND gpp.wgi_enabled_flag = 'Y';
5251
5252 CURSOR c_get_pay_plan(c_pa_request_id ghr_pa_requests.pa_request_id%type) IS
5253 SELECT to_pay_plan
5254 FROM ghr_pa_requests par
5255 WHERE par.pa_request_id = c_pa_request_id;
5256
5257 -----GPPA Update46 Start.
5258 cursor cur_eq_ppl (c_pay_plan ghr_pay_plans.pay_plan%type)
5259 IS
5260 select EQUIVALENT_PAY_PLAN
5261 from ghr_pay_plans
5262 where pay_plan = c_pay_plan;
5263
5264 l_equ_pay_plan ghr_pay_plans.equivalent_pay_plaN%type;
5265 -----GPPA Update46 End.
5266
5267 CURSOR c_check_ele(c_element_name pay_element_types_f.element_name%type,
5268 c_effective_date pay_element_entries_f.effective_start_date%type,
5269 c_assignment_id pay_element_entries_f.assignment_id%type) IS
5270 SELECT 1
5271 FROM pay_element_entries_f pee, pay_element_types_f pet
5272 WHERE pee.element_type_id = pet.element_type_id
5273 AND c_effective_date BETWEEN pee.effective_start_date AND pee.effective_end_date
5274 AND c_effective_date BETWEEN pet.effective_start_date AND pet.effective_end_date
5275 AND pet.element_name = c_element_name
5276 AND pee.assignment_id = c_assignment_id;
5277
5278 --Pradeep start of Bug 3306515
5279 l_retention_allow_percentage ghr_pa_requests.to_retention_allow_percentage%type;
5280 l_retention_allowance ghr_pa_requests.to_retention_allowance%type;
5281 l_multi_error_flag boolean;
5282 --Pradeep end of Bug 3306515
5283
5284 Begin
5285
5286
5287 --
5288 hr_utility.set_location('Entering ' ||l_proc,5);
5289 -- Remember IN OUT parameter IN values
5290 --
5291 l_wgi := p_wgi;
5292 l_retention_allow_review := p_retention_allow_review;
5293 l_call_wgi_dates := FALSE;
5294 l_is_wgi_eligible := FALSE; -- Bug 4031919
5295 l_wgi_cleared := FALSE;-- Bug 4031919
5296 l_wgi_exists := FALSE;-- Bug 4031919
5297
5298 --Pradeep start of Bug 3306515
5299 -- Get the session variables.
5300 ghr_history_api.get_g_session_var(l_session);
5301 --Pradeep end of Bug 3306515
5302
5303 --
5304 -- Processing Basic pay
5305 --
5306 -- Code added/ Modified for Payroll Integration
5307 --
5308 ----**********************************************************************
5309 -- CHECK # :- Existence of PAYROLL Product
5310 ----**********************************************************************
5311 IF (hr_utility.chk_product_install('GHR','US') = TRUE
5312 and hr_utility.chk_product_install('PAY', 'US') = TRUE
5313 and fnd_profile.value('HR_USER_TYPE')='INT')
5314 THEN
5315 l_pay_intg:=TRUE;
5316 ELSE
5317 l_pay_intg:=FALSE;
5318 END IF;
5319 ----**********************************************************************
5320 --
5321 If p_pa_request_rec.first_noa_code = '866' then
5322 l_effective_date := trunc(p_pa_request_rec.effective_date + 1 );
5323 Else
5324 l_effective_date := trunc(p_pa_request_rec.effective_date);
5325 End if;
5326 -------Bug 5913362 -- Adding 890
5327 /**** Here for 890 date is not like 866.
5328 if p_pa_request_rec.first_noa_code = '890' AND
5329 p_pa_request_rec.input_pay_rate_determinant in ('A','B','E','F','U','V') then
5330 l_effective_date := trunc(p_pa_request_rec.effective_date + 1 );
5331 Else
5332 l_effective_date := trunc(p_pa_request_rec.effective_date);
5333 End if;
5334 *****/
5335 --
5336 -----Find out the Person system person type
5337 --
5338
5339 FOR cur_ex_emp_rec IN cur_ex_emp (p_pa_request_rec.person_id, l_effective_date)
5340 LOOP
5341 l_ex_emp := TRUE;
5342 hr_utility.set_location('Person is an Ex employee for the given date ' ||l_proc,5);
5343 END LOOP;
5344
5345 hr_utility.set_location(to_char(l_effective_date),1);
5346 -- Processing Basic pay
5347 --
5348 hr_utility.set_location('Entering ' ||l_proc,5);
5349
5350 -- pick business group id
5351 For BG_rec in Cur_BG(p_pa_request_rec.employee_assignment_id,
5352 l_effective_date)
5353 Loop
5354 l_bg_id:=BG_rec.bg;
5355 End Loop;
5356 --
5357 -- When to_basic_pay is not null
5358 If p_pa_request_rec.to_basic_pay is not null then
5359 hr_utility.set_location(l_proc || to_char(p_pa_request_rec.effective_date),10);
5360 --
5361 -- Code added for Payroll Integration
5362 --
5363 IF l_pay_intg
5364 -- Only when GHR and Payroll are installed can the following be performed
5365 THEN
5366 -- Salary Basis Type can be Monthly,Annual,Hourly
5367 If (p_pa_request_rec.from_pay_basis is NULL and
5368 p_pa_request_rec.to_pay_basis is not NULL) then
5369 l_pay_basis:=p_pa_request_rec.to_pay_basis;
5370 elsif (p_pa_request_rec.from_pay_basis is NOT NULL and
5371 p_pa_request_rec.to_pay_basis is NULL) then
5372 l_pay_basis:=p_pa_request_rec.from_pay_basis;
5373 elsif (p_pa_request_rec.from_pay_basis is NOT NULL and
5374 p_pa_request_rec.to_pay_basis is NOT NULL) then
5375 l_pay_basis:=p_pa_request_rec.to_pay_basis;
5376 End If;
5377
5378 -- Picking the new Basic Salary Rate Element
5379 l_new_element_name:=pqp_fedhr_uspay_int_utils.return_new_element_name(
5380 p_fedhr_element_name => 'Basic Salary Rate',
5381 p_business_group_id => l_bg_id,
5382 p_effective_date => l_effective_date,
5383 p_pay_basis => NVL(l_pay_basis,'PA'));
5384
5385 hr_utility.trace('The New Element Name is :'||l_new_element_name);
5386
5387 --
5388 -- Update the Assignment id with the Salary Basis Obtained in above step
5389 -- If not for this step Salary Admin form wont pick the Basic Sal Value
5390 --
5391 hr_utility.trace('NOA FAMILY CODE :'||p_pa_request_rec.noa_family_code);
5392 -- Check# 1
5393 IF (p_pa_request_rec.first_noa_cancel_or_correct ='CORRECT') THEN
5394
5395 -- Check# 2
5396 -- the following if condition is to avoid error of deleting salary proposal
5397 -- for correction actions not involving pay changes. Ex - realignment, Other pay etc
5398 IF ( nvl(p_pa_request_rec.to_basic_pay,0) <> nvl(p_pa_request_rec.from_basic_pay,0)
5399 OR nvl(p_pa_request_rec.from_pay_basis,'NPB') <> nvl(p_pa_request_rec.to_pay_basis,'NPB'))
5400 THEN
5401
5402 For Proposal_rec IN Cur_proposal_exists
5403 (p_pa_request_rec.employee_assignment_id,l_effective_date)
5404 Loop
5405 l_pay_proposal_id := proposal_rec.proposal_id;
5406 l_sal_admin_ovn := proposal_rec.ovn;
5407 End Loop;
5408
5409 hr_utility.trace('Before call to Delete Salary Proposal :'||l_dt_mode);
5410 -- if p_pa_request_rec.noa_family_code in ('APP','CONV_APP') then
5411 -- Check# 3
5412 IF (l_pay_proposal_id is not null ) THEN
5413
5414 hr_maintain_proposal_api.delete_salary_proposal
5415 (
5416 p_pay_proposal_id => l_pay_proposal_id ,
5417 p_business_group_id => l_bg_id ,
5418 p_object_version_number => l_sal_admin_ovn ,
5419 p_validate => FALSE ,
5420 p_salary_warning => l_sal_warn
5421 );
5422 l_del_pay_prop :=TRUE;
5423 END IF;
5424 -- End of Check# 3
5425 END IF;
5426 -- End of Check# 2
5427 END IF;
5428 -- End of Check# 1
5429
5430 -- Picking the Salary Basis based on the to_pay_basis during RPA
5431 For Sal_Basis_Name in Cur_Sal_Basis_name(l_bg_id,l_new_element_name)
5432 Loop
5433 l_sal_basis_id := Sal_Basis_Name.pay_basis_id;
5434 hr_utility.trace('The sal basis id is :'||to_char(l_sal_basis_id));
5435 End Loop;
5436 --
5437 --
5438 l_dt_mode := return_update_mode
5439 (p_id => p_pa_request_rec.employee_assignment_id,
5440 p_effective_date => l_effective_date,
5441 p_table_name => 'PER_ASSIGNMENTS_F'
5442 );
5443
5444 hr_utility.trace('l_dt_mode is :'||l_dt_mode);
5445
5446 -- collecting details for salary basis updation
5447 For SB_upd in Cur_asg_det_for_SB_upd(p_pa_request_rec.employee_assignment_id,
5448 l_effective_Date)
5449 Loop
5450 l_SB_ovn := SB_upd.ovn;
5451 l_ppl_grp_id := SB_upd.ppl_grp_id;
5452 l_spcl_clng_stp_id := SB_upd.spcl_clng_stp_id;
5453 l_scl_kff_id := SB_upd.scl_kff_id;
5454 l_eff_start_date := SB_upd.start_date;
5455 l_eff_end_date := SB_upd.end_date;
5456 l_payroll_id := SB_upd.payroll_id;
5457 End Loop;
5458
5459 --
5460 -- Update the Assignment id with the Salary Basis Obtained in above step
5461 -- If not for this step Salary Admin form wont pick the Basic Sal Value
5462 hr_utility.trace('assignment id is :'||p_pa_request_rec.employee_assignment_id);
5463 hr_utility.trace('EFF DATE :'||l_effective_date);
5464 hr_utility.trace('l_sb_ovn:'||l_SB_ovn);
5465 hr_utility.trace('l_payroll_id:'||l_payroll_id);
5466 hr_utility.trace('l_sal_basis_id:'||l_sal_basis_id);
5467
5468 hr_assignment_api.update_emp_asg_criteria
5469 (p_effective_date => l_effective_date
5470 ,p_datetrack_update_mode => l_dt_mode
5471 ,p_assignment_id => p_pa_request_rec.employee_assignment_id
5472 ,p_object_version_number => l_SB_ovn
5473 ,P_PAYROLL_ID => l_payroll_id
5474 ,p_pay_basis_id => l_sal_basis_id
5475 ,p_position_id => P_pa_request_rec.to_position_id
5476 ,p_job_id => P_pa_request_rec.to_job_id
5477 ,p_location_id => P_pa_request_rec.duty_station_location_id
5478 ,p_organization_id => P_pa_request_rec.to_organization_id
5479 ,p_grade_id => P_pa_request_rec.to_grade_id
5480 ,p_effective_start_date => l_eff_start_date
5481 ,p_effective_end_date => l_eff_end_date
5482 ,p_special_ceiling_step_id => l_spcl_clng_stp_id
5483 ,p_people_group_id => l_ppl_grp_id
5484 ,p_group_name => l_group_name
5485 ,p_org_now_no_manager_warning => l_org_now_man_warn
5486 ,p_other_manager_warning => l_other_manager_warn
5487 ,p_spp_delete_warning => l_spp_delete_warning
5488 ,p_entries_changed_warning => l_entries_chan_warn
5489 ,p_tax_district_changed_warning => l_tax_dist_chan_warn
5490 );
5491 --
5492 hr_utility.trace('After Update Person record under gh52doup.pkb');
5493 --
5494
5495 -- Blocking the call to use Core call for salary admin creation
5496 For Proposal_rec IN Cur_proposal_exists
5497 (p_pa_request_rec.employee_assignment_id,l_effective_date)
5498 Loop
5499 l_pay_proposal_id := proposal_rec.proposal_id;
5500 l_sal_admin_ovn := proposal_rec.ovn;
5501 End Loop;
5502
5503
5504 if ((p_pa_request_rec.noa_family_code <> 'APP')
5505 OR
5506 (p_pa_request_rec.noa_family_code = 'CONV_APP' and NOT l_ex_emp)) then
5507 ghr_element_api.retrieve_element_info
5508 (p_element_name => 'Basic Salary Rate'
5509 ,p_input_value_name => 'Rate'
5510 ,p_assignment_id => p_pa_request_rec.employee_assignment_id
5511 ,p_effective_date => l_effective_date
5512 ,p_processing_type => 'R'
5513 ,p_element_link_id => ll_element_link_id
5514 ,p_input_value_id => ll_input_value_id
5515 ,p_element_entry_id => ll_element_entry_id
5516 ,p_value => ll_value
5517 ,p_object_version_number => ll_object_version_number
5518 ,p_multiple_error_flag => ll_multiple_error_flag
5519 );
5520 end if;
5521
5522 hr_utility.trace('employee Asg id before proposal ..:'||
5523 to_char(p_pa_request_rec.employee_assignment_id));
5524 hr_utility.trace('Element entry id before proposal ..:'||to_char(ll_element_entry_id));
5525 hr_utility.trace('Business grp id before proposal ..:'||to_char(l_bg_id));
5526
5527 IF l_pay_proposal_id is null then
5528 if (nvl(p_pa_request_rec.from_basic_pay, 0) <> nvl(p_pa_request_rec.to_basic_pay,0)) then
5529 hr_maintain_proposal_api.insert_salary_proposal
5530 (
5531 p_pay_proposal_id => l_pay_proposal_id
5532 ,p_assignment_id => p_pa_request_rec.employee_assignment_id
5533 ,p_business_group_id => l_bg_id
5534 ,p_change_date => l_effective_date
5535 ,p_proposed_salary_n => p_pa_request_rec.to_basic_pay
5536 ,p_object_version_number => l_sal_admin_ovn
5537 ,p_element_entry_id => ll_element_entry_id
5538 ,p_inv_next_sal_date_warning => l_date_warn
5539 ,p_proposed_salary_warning => l_sal_warn
5540 ,p_approved_warning => l_approve_warn
5541 ,p_payroll_warning => l_payroll_warn
5542 ,p_multiple_components => 'N'
5543 ,p_approved => 'Y'
5544 );
5545 end if;
5546 ELSE
5547 if (nvl(p_pa_request_rec.from_basic_pay, 0) <> nvl(p_pa_request_rec.to_basic_pay,0)) then
5548 -- if the pay proposal is not deleted in the above step then delete, no otherwise
5549 if (not l_del_pay_prop) then
5550 hr_maintain_proposal_api.delete_salary_proposal(
5551 p_pay_proposal_id => l_pay_proposal_id
5552 ,p_business_group_id => l_bg_id
5553 ,p_object_version_number => l_sal_admin_ovn
5554 ,p_validate => FALSE
5555 ,p_salary_warning => l_sal_warn);
5556 end if;
5557 hr_maintain_proposal_api.insert_salary_proposal
5558 (
5559 p_pay_proposal_id => l_pay_proposal_id
5560 ,p_assignment_id => p_pa_request_rec.employee_assignment_id
5561 ,p_business_group_id => l_bg_id
5562 ,p_change_date => l_effective_date
5563 ,p_proposed_salary_n => p_pa_request_rec.to_basic_pay
5564 ,p_object_version_number => l_sal_admin_ovn
5565 ,p_element_entry_id => ll_element_entry_id
5566 ,p_inv_next_sal_date_warning => l_date_warn
5567 ,p_proposed_salary_warning => l_sal_warn
5568 ,p_approved_warning => l_approve_warn
5569 ,p_payroll_warning => l_payroll_warn
5570 ,p_multiple_components => 'N'
5571 ,p_approved => 'Y'
5572 );
5573
5574 end if;
5575
5576 END IF;
5577 -- if Payroll is not installed
5578 ELSIF NOT l_pay_intg
5579 THEN
5580 ghr_element_api.process_sf52_element
5581 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5582 ,p_element_name => 'Basic Salary Rate'
5583 ,p_input_value_name1 => 'Rate'
5584 ,p_value1 => to_char(p_pa_request_rec.to_basic_pay)
5585 ,p_effective_date => l_effective_date
5586 ,p_process_warning => l_adj_basic_pay_warn
5587 );
5588 END IF;
5589 -- if Payroll integration not being used.
5590 --
5591 -- Code added/ Modified for Payroll Integration
5592 --
5593
5594 /* To be included after Martin Reid's element api handles the create and update warning
5595 if l_adj_basic_pay_warn = FALSE then
5596 hr_utility.set_message(8301,'GHR_38136_FAIL_TO_UPD_SALARY');
5597 hr_utility.raise_error;
5598 end if;
5599 */
5600 end if;
5601 --
5602 --
5603 -- Processing Adjusted basic pay
5604 --
5605 If p_pa_request_rec.to_adj_basic_pay is not null then
5606 hr_utility.set_location(l_proc,20);
5607
5608 ghr_element_api.process_sf52_element
5609 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5610 ,p_element_name => 'Adjusted Basic Pay'
5611 ,p_input_value_name1 => 'Amount'
5612 ,p_value1 => to_char(p_pa_request_rec.to_adj_basic_pay)
5613 ,p_effective_date => l_effective_date
5614 ,p_process_warning => l_basic_pay_warn
5615 );
5616 --
5617 --
5618
5619 /*if l_adj_basic_pay_warn = FALSE then
5620 hr_utility.set_message(8301,'GHR_38137_FL_TO_UPD_ADJ_BS_PY');
5621 hr_utility.raise_error;
5622 end if;
5623 */
5624 end if;
5625 --
5626 -- Bug 2333719 GM IT pay calculations. Pay calc will set a global variable for
5627 -- Unadjusted Basic Pay.
5628 --
5629 -- Processing Unadjusted Basic Pay
5630 --
5631 If p_pa_request_rec.to_adj_basic_pay is not null then
5632 if ghr_pay_calc.g_gm_unadjd_basic_pay is not null and ghr_pay_calc.g_gm_unadjd_basic_pay <> 0 then
5633 hr_utility.set_location(l_proc,21);
5634
5635 ghr_element_api.process_sf52_element
5636 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5637 ,p_element_name => 'Unadjusted Basic Pay'
5638 ,p_input_value_name1 => 'Amount'
5639 ,p_value1 => to_char(ghr_pay_calc.g_gm_unadjd_basic_pay)
5640 ,p_effective_date => l_effective_date
5641 ,p_process_warning => l_basic_pay_warn
5642 );
5643 end if;
5644 --
5645 --
5646 end if;
5647 --
5648 -- Bug 2333719 GM IT Code End.
5649 --
5650 -- Processing Locality adjustment
5651 --
5652 If p_pa_request_rec.to_locality_adj is not null then
5653 hr_utility.set_location(l_proc,30);
5654 -- FWFA Changes Bug#4444609: Modify 'Locality Pay' to 'Locality Pay or SR Supplement'
5655 ghr_element_api.process_sf52_element
5656 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5657 ,p_element_name => 'Locality Pay or SR Supplement'
5658 ,p_input_value_name1 => 'Rate'
5659 -- 'Rate' was put by Ashu Gupta in place of 'Amount'
5660 ,p_value1 => to_char(p_pa_request_rec.to_locality_adj)
5661 ,p_effective_date => l_effective_date
5662 ,p_process_warning => l_locality_adj_warn
5663 );
5664 -- FWFA Changes
5665 End if;
5666
5667 --
5668
5669 /*if l_locality_adj_warn = FALSE then
5670 hr_utility.set_message(8301,'GHR_38138_FAIL_TO_UPD_LOC_ADJ');
5671 hr_utility.raise_error;
5672 end if;
5673 */
5674 --end if;
5675 --
5676
5677 --
5678 -- Processing Total Salary
5679 --
5680 If p_pa_request_rec.to_total_salary is not null then
5681 -- Bug#4486823 RRR Changes. Added the IF Condition to Restrict the element updation
5682 -- for GHR_INCENTIVE Family.
5683 IF p_pa_request_rec.first_noa_code IN ('815','816','825','827') OR
5684 p_pa_request_rec.second_noa_code IN ('815','816','825','827') THEN
5685 NULL;
5686 ELSE
5687 hr_utility.set_location(l_proc,45);
5688 ghr_element_api.process_sf52_element
5689 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5690 ,p_element_name => 'Total Pay'
5691 ,p_input_value_name1 => 'Amount'
5692 ,p_value1 => to_char(p_pa_request_rec.to_total_salary)
5693 ,p_effective_date => l_effective_date
5694 ,p_process_warning => l_total_salary_warn
5695 );
5696 END IF;
5697 --
5698 /* if l_total_salary_warn = FALSE then
5699 hr_utility.set_message(8301,'GHR_38139_FAIL_TO_UPD_TOT_SAL');
5700 hr_utility.raise_error;
5701 end if;
5702 */
5703 end if;
5704 --
5705 -- Processing Other Pay
5706
5707 --If p_pa_request_rec.noa_family_code = 'OTHER_PAY' then
5708
5709 If p_pa_request_rec.to_other_pay_amount is not null then
5710 -- Code to calculate Entitled Other Pay for Pay capped actions
5711 l_entitled_other_pay := p_pa_request_rec.to_other_pay_amount;
5712 IF p_capped_other_pay is not null THEN
5713 l_entitled_other_pay := nvl(p_pa_request_rec.to_au_overtime, 0) +
5714 nvl(p_pa_request_rec.to_availability_pay , 0) +
5715 nvl(p_pa_request_rec.to_retention_allowance , 0) +
5716 nvl(p_pa_request_rec.to_supervisory_differential, 0) +
5717 nvl(p_pa_request_rec.to_staffing_differential , 0);
5718 END IF;
5719 hr_utility.set_location(l_proc,55);
5720 ghr_element_api.process_sf52_element
5721 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5722 ,p_element_name => 'Other Pay'
5723 ,p_input_value_name1 => 'Amount'
5724 ,p_value1 => to_char(l_entitled_other_pay)
5725 ,p_input_value_name2 => 'Capped Other Pay'
5726 ,p_value2 => to_char(p_capped_other_pay)
5727 ,p_effective_date => l_effective_date
5728 ,p_process_warning => l_adj_basic_pay_warn
5729 );
5730 Else --if p_pa_request_rec.other_pay_amount is null
5731 -- According to John, any other pay and its sub elements can be nullified only by processing an 'OTHER_PAY' action
5732 If p_pa_request_rec.noa_family_code = 'OTHER_PAY' then
5733 hr_utility.set_location(l_proc,32);
5734
5735 l_new_element_name := pqp_fedhr_uspay_int_utils.return_new_element_name(
5736 p_fedhr_element_name => 'Other Pay',
5737 p_business_group_id => l_bg_id,
5738 p_effective_date => p_pa_request_rec.effective_date,
5739 p_pay_basis => NULL);
5740
5741 l_element_entry_id := NULL;
5742 for ele_entry in c_ele_entry(ele_name => l_new_element_name,
5743 ipv_name => 'Amount',
5744 eff_date => l_effective_date,
5745 bg_id => l_bg_id
5746 ) loop
5747
5748 l_element_entry_id := ele_entry.element_entry_id;
5749 End loop;
5750 If l_element_entry_id is not null then
5751 ghr_element_api.process_sf52_element
5752 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5753 ,p_element_name => 'Other Pay'
5754 ,p_input_value_name1 => 'Amount'
5755 ,p_value1 => to_char(p_pa_request_rec.to_other_pay_amount)
5756 ,p_effective_date => l_effective_date
5757 ,p_process_warning => l_adj_basic_pay_warn
5758 );
5759 End if;
5760 End if;
5761 End if;
5762
5763
5764 -- Processing AUO
5765
5766 If p_pa_request_rec.to_auo_premium_pay_indicator is not null or
5767 p_pa_request_rec.to_au_overtime is not null then
5768 hr_utility.set_location(l_proc,60);
5769 ghr_element_api.process_sf52_element
5770 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5771 ,p_element_name => 'AUO'
5772 ,p_input_value_name1 => 'Premium Pay Ind'
5773 ,p_value1 => p_pa_request_rec.to_auo_premium_pay_indicator
5774 ,p_input_value_name2 => 'Amount'
5775 ,p_value2 => to_char(p_pa_request_rec.to_au_overtime)
5776 ,p_effective_date => l_effective_date
5777 ,p_process_warning => l_adj_basic_pay_warn
5778 );
5779
5780 ghr_element_api.process_sf52_element
5781 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5782 ,p_element_name => 'Premium Pay'
5783 ,p_input_value_name1 => 'Premium Pay Ind'
5784 ,p_value1 => p_pa_request_rec.to_auo_premium_pay_indicator
5785 ,p_input_value_name2 => 'Amount'
5786 ,p_value2 => to_char(p_pa_request_rec.to_au_overtime)
5787 ,p_effective_date => l_effective_date
5788 ,p_process_warning => l_adj_basic_pay_warn
5789 );
5790 Else --if p_pa_request_rec.auo is null
5791
5792 If p_pa_request_rec.first_noa_code = '818' then
5793 hr_utility.set_location(l_proc,32);
5794 l_element_entry_id := NULL;
5795
5796 l_new_element_name :=
5797 pqp_fedhr_uspay_int_utils.return_new_element_name(
5798 p_fedhr_element_name => 'AUO',
5799 p_business_group_id => l_bg_id,
5800 p_effective_date => p_pa_request_rec.effective_date,
5801 p_pay_basis => NULL);
5802
5803 for ele_entry in c_ele_entry(ele_name => l_new_element_name,
5804 ipv_name => 'Amount',
5805 eff_date => l_effective_date,
5806 bg_id => l_bg_id
5807 ) loop
5808
5809 l_element_entry_id := ele_entry.element_entry_id;
5810 End loop;
5811 if l_element_entry_id is not null then
5812 ghr_element_api.process_sf52_element
5813 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5814 ,p_element_name => 'AUO'
5815 ,p_input_value_name1 => 'Premium Pay Ind'
5816 ,p_value1 => p_pa_request_rec.to_auo_premium_pay_indicator
5817 ,p_input_value_name2 => 'Amount'
5818 ,p_value2 => to_char(p_pa_request_rec.to_au_overtime)
5819 ,p_effective_date => l_effective_date
5820 ,p_process_warning => l_adj_basic_pay_warn
5821 );
5822
5823 ghr_element_api.process_sf52_element
5824 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5825 ,p_element_name => 'Premium Pay'
5826 ,p_input_value_name1 => 'Premium Pay Ind'
5827 ,p_value1 => p_pa_request_rec.to_auo_premium_pay_indicator
5828 ,p_input_value_name2 => 'Amount'
5829 ,p_value2 => to_char(p_pa_request_rec.to_au_overtime)
5830 ,p_effective_date => l_effective_date
5831 ,p_process_warning => l_adj_basic_pay_warn
5832 );
5833 End if;
5834 End if;
5835 End if;
5836
5837 -- Processing Availability pay
5838
5839 -- Note : The sequences of the Inp. Values 1 and 2 for the element, 'Availability Pay' has
5840 -- been swapped. According to Jon's list in new changes after September:
5841 -- Can change only when the seed data changes.
5842
5843 If p_pa_request_rec.to_ap_premium_pay_indicator is not null or
5844 p_pa_request_rec.to_availability_pay is not null then
5845 hr_utility.set_location(l_proc,65);
5846 ghr_element_api.process_sf52_element
5847 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5848 ,p_element_name => 'Availability Pay'
5849 ,p_input_value_name1 => 'Premium Pay Ind'
5850 ,p_value1 => p_pa_request_rec.to_ap_premium_pay_indicator
5851 ,p_input_value_name2 => 'Amount'
5852 ,p_value2 => to_char(p_pa_request_rec.to_availability_pay)
5853 ,p_effective_date => l_effective_date
5854 ,p_process_warning => l_adj_basic_pay_warn
5855 );
5856
5857 ghr_element_api.process_sf52_element
5858 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5859 ,p_element_name => 'Premium Pay'
5860 ,p_input_value_name1 => 'Premium Pay Ind'
5861 ,p_value1 => p_pa_request_rec.to_ap_premium_pay_indicator
5862 ,p_input_value_name2 => 'Amount'
5863 ,p_value2 => to_char(p_pa_request_rec.to_availability_pay)
5864 ,p_effective_date => l_effective_date
5865 ,p_process_warning => l_adj_basic_pay_warn
5866 );
5867 Else --if p_pa_request_rec.avaiability_pay is null
5868 If p_pa_request_rec.first_noa_code = '819' then
5869 hr_utility.set_location(l_proc,32);
5870 l_element_entry_id := NULL;
5871
5872 l_new_element_name :=
5873 pqp_fedhr_uspay_int_utils.return_new_element_name(
5874 p_fedhr_element_name => 'Availability Pay',
5875 p_business_group_id => l_bg_id,
5876 p_effective_date => p_pa_request_rec.effective_date,
5877 p_pay_basis => NULL);
5878
5879
5880 for ele_entry in c_ele_entry(ele_name => l_new_element_name,
5881 ipv_name => 'Amount',
5882 eff_date => l_effective_date,
5883 bg_id => l_bg_id
5884 ) loop
5885
5886 l_element_entry_id := ele_entry.element_entry_id;
5887 End loop;
5888 if l_element_entry_id is not null then
5889 hr_utility.set_location(l_proc,33);
5890 ghr_element_api.process_sf52_element
5891 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5892 ,p_element_name => 'Availability Pay'
5893 ,p_input_value_name1 => 'Premium Pay Ind'
5894 ,p_value1 => p_pa_request_rec.to_ap_premium_pay_indicator
5895 ,p_input_value_name2 => 'Amount'
5896 ,p_value2 => to_char(p_pa_request_rec.to_availability_pay)
5897 ,p_effective_date => l_effective_date
5898 ,p_process_warning => l_adj_basic_pay_warn
5899 );
5900
5901 ghr_element_api.process_sf52_element
5902 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5903 ,p_element_name => 'Premium Pay'
5904 ,p_input_value_name1 => 'Premium Pay Ind'
5905 ,p_value1 => p_pa_request_rec.to_ap_premium_pay_indicator
5906 ,p_input_value_name2 => 'Amount'
5907 ,p_value2 => to_char(p_pa_request_rec.to_availability_pay)
5908 ,p_effective_date => l_effective_date
5909 ,p_process_warning => l_adj_basic_pay_warn
5910 );
5911 End if;
5912 End if;
5913 End if;
5914
5915 -- Processing Supervisory Differential
5916 --
5917 -- Code added/ Modified for Payroll Integration
5918 -- Modifying the input value name from Percent to Percentage
5919 -- this change is done only for Supervisory diff and Retention Allowance
5920 --
5921
5922 hr_utility.trace('Element Name (new) is :'||l_new_element_name);
5923 hr_utility.trace('Supv Diff Amt process_sf52 :'||p_pa_request_rec.to_supervisory_differential);
5924 hr_utility.trace('Supv Diff % Process_sf52 :'||p_pa_request_rec.to_supervisory_diff_percentage);
5925
5926 If p_pa_request_rec.to_supervisory_differential is not null or
5927 p_pa_request_rec.to_supervisory_diff_percentage is not null then
5928 hr_utility.set_location(l_proc,70);
5929 ghr_element_api.process_sf52_element
5930 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5931 ,p_element_name => 'Supervisory Differential'
5932 ,p_input_value_name1 => 'Amount'
5933 ,p_value1 => to_char(p_pa_request_rec.to_supervisory_differential)
5934 ,p_input_value_name2 => 'Percentage'
5935 ,p_value2 => to_char(p_pa_request_rec.to_supervisory_diff_percentage)
5936 ,p_effective_date => l_effective_date
5937 ,p_process_warning => l_adj_basic_pay_warn
5938 );
5939
5940 Else --if p_pa_request_rec.superv. diff is null
5941 If p_pa_request_rec.noa_family_code = 'OTHER_PAY' then
5942 hr_utility.set_location(l_proc,32);
5943 l_element_entry_id := NULL;
5944 l_new_element_name :=
5945 pqp_fedhr_uspay_int_utils.return_new_element_name(
5946 p_fedhr_element_name => 'Supervisory Differential',
5947 p_business_group_id => l_bg_id,
5948 p_effective_date => p_pa_request_rec.effective_date,
5949 p_pay_basis => NULL);
5950
5951 for ele_entry in c_ele_entry(
5952 ele_name => l_new_element_name,
5953 ipv_name => 'Amount',
5954 eff_date => l_effective_date,
5955 bg_id => l_bg_id
5956 ) loop
5957
5958 l_element_entry_id := ele_entry.element_entry_id;
5959 End loop;
5960 If l_element_entry_id is not null then
5961 ghr_element_api.process_sf52_element
5962 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5963 ,p_element_name => 'Supervisory Differential'
5964 ,p_input_value_name1 => 'Amount'
5965 ,p_value1 => to_char(p_pa_request_rec.to_supervisory_differential)
5966 ,p_input_value_name2 => 'Percentage'
5967 ,p_value2 => to_char(p_pa_request_rec.to_supervisory_diff_percentage)
5968 ,p_effective_date => l_effective_date
5969 ,p_process_warning => l_adj_basic_pay_warn
5970 );
5971 End if;
5972 End if;
5973 End if;
5974 --
5975 -- Code added/ Modified for Payroll Integration
5976 -- Modifying the input value name from Percent to Percentage
5977 -- this change is done only for Supervisory diff and Retention Allowance
5978 --
5979 ------------------------------------------------------------------------------
5980 /************* Commenting the Staffing Differetial code... 05-AUG-2003 by AVR.
5981 --Processing Staffing Differential
5982
5983 If p_pa_request_rec.to_staffing_differential is not null or
5984 p_pa_request_rec.to_staffing_diff_percentage is not null then
5985
5986 hr_utility.set_location(l_proc,75);
5987 ghr_element_api.process_sf52_element
5988 (p_assignment_id => p_pa_request_rec.employee_assignment_id
5989 ,p_element_name => 'Staffing Differential'
5990 ,p_input_value_name1 => 'Amount'
5991 ,p_value1 => to_char(p_pa_request_rec.to_staffing_differential)
5992 ,p_input_value_name2 => 'Percent'
5993 ,p_value2 => to_char(p_pa_request_rec.to_staffing_diff_percentage)
5994 ,p_effective_date => l_effective_date
5995 ,p_process_warning => l_adj_basic_pay_warn
5996 );
5997 Else --if p_pa_request_rec.staff. diff is null
5998 If p_pa_request_rec.noa_family_code = 'OTHER_PAY' then
5999 hr_utility.set_location(l_proc,32);
6000 l_element_entry_id := NULL;
6001 l_new_element_name :=
6002 pqp_fedhr_uspay_int_utils.return_new_element_name(
6003 p_fedhr_element_name => 'Staffing Differential',
6004 p_business_group_id => l_bg_id,
6005 p_effective_date => p_pa_request_rec.effective_date,
6006 p_pay_basis => NULL);
6007
6008 for ele_entry in c_ele_entry(ele_name => l_new_element_name,
6009 ipv_name => 'Amount',
6010 eff_date => l_effective_date,
6011 bg_id => l_bg_id
6012 ) loop
6013
6014 l_element_entry_id := ele_entry.element_entry_id;
6015 End loop;
6016 If l_element_entry_id is not null then
6017 ghr_element_api.process_sf52_element
6018 (p_assignment_id => p_pa_request_rec.employee_assignment_id
6019 ,p_element_name => 'Staffing Differential'
6020 ,p_input_value_name1 => 'Amount'
6021 ,p_value1 => to_char(p_pa_request_rec.to_staffing_differential)
6022 ,p_input_value_name2 => 'Percent'
6023 ,p_value2 => to_char(p_pa_request_rec.to_staffing_diff_percentage)
6024 ,p_effective_date => l_effective_date
6025 ,p_process_warning => l_adj_basic_pay_warn
6026 );
6027 End if;
6028 End if;
6029 End if;
6030 ***********************/
6031
6032
6033 -- Processing retention Allowance
6034 --
6035 -- Code added/ Modified for Payroll Integration
6036 -- Modifying the input value name from Percent to Percentage
6037 -- this change is done only for Supervisory diff and Retention Allowance
6038 --
6039 hr_utility.trace('Element Name (new) is :'||l_new_element_name);
6040 hr_utility.trace('Ret Allw Amt process_sf52 :'||p_pa_request_rec.to_retention_allowance);
6041 hr_utility.trace('Ret Allw % Process_sf52 :'||p_pa_request_rec.to_retention_allow_percentage);
6042
6043
6044 --Pradeep start of Bug 3306515 - Ret All % Pay Cap.
6045 --Get the Retention Allowance and calculate % based on the Percentage.
6046 hr_utility.trace('Pradeep p_pa_request_rec.noa_family_code:'||p_pa_request_rec.noa_family_code);
6047
6048 IF p_pa_request_rec.to_retention_allow_percentage is null
6049 AND p_pa_request_rec.to_retention_allowance is not null THEN
6050
6051 -- Bug 4689374
6052 IF p_pa_request_rec.pay_rate_determinant IN ('3','4','J','K','U','V') AND
6053 p_pa_request_rec.effective_date >= to_date('01/05/2005','dd/mm/yyyy') THEN
6054 l_retention_allow_percentage := NULL;
6055 hr_utility.trace('Inside fwfa');
6056 ELSE
6057 IF ( p_pa_request_rec.noa_family_code like 'GHR_SAL%'
6058 OR p_pa_request_rec.noa_family_code ='OTHER_PAY' )
6059 THEN
6060
6061 hr_utility.trace('Pradeep l_session.noa_id_correct:'||l_session.noa_id_correct);
6062 IF l_session.noa_id_correct is null THEN
6063
6064 ghr_api.retrieve_element_entry_value (p_element_name => 'Retention Allowance'
6065 ,p_input_value_name => 'Amount'
6066 ,p_assignment_id => p_pa_request_rec.employee_assignment_id
6067 ,p_effective_date => l_effective_date
6068 ,p_value => l_retention_allowance
6069 ,p_multiple_error_flag => l_multi_error_flag);
6070
6071 l_retention_allow_percentage :=
6072 trunc((l_retention_allowance/p_pa_request_rec.from_basic_pay)*100,2);
6073 ELSE
6074
6075 --Get the To side Retention Allowance for corrections.
6076 hr_utility.trace('Pradeep Correction RA Amount:'||p_pa_request_rec.to_retention_allowance);
6077 l_retention_allow_percentage :=
6078 trunc((p_pa_request_rec.to_retention_allowance/p_pa_request_rec.to_basic_pay)*100,2);
6079 END IF; -- IF l_session.noa_id_corr
6080 END IF;-- IF ( p_pa_request_rec.noa_f
6081 END IF; -- IF p_pa_request_rec.pay_rate_determinant IN ('3','4',
6082
6083 END IF;
6084 --Pradeep End of Bug 3306515 - Ret All % Pay Cap.
6085
6086 If p_pa_request_rec.to_retention_allowance is not null or
6087 p_pa_request_rec.to_retention_allow_percentage is not null then
6088
6089 -- Bug 2627003
6090 IF p_pa_request_rec.to_retention_allowance=0 THEN
6091 p_retention_allow_review.review_date:=NULL;
6092 END IF;
6093 -- Bug 2627003
6094
6095 hr_utility.set_location(l_proc,80);
6096 ghr_element_api.process_sf52_element
6097 (p_assignment_id => p_pa_request_rec.employee_assignment_id
6098 ,p_element_name => 'Retention Allowance'
6099 ,p_input_value_name1 => 'Amount'
6100 ,p_value1 => to_char(p_pa_request_rec.to_retention_allowance)
6101 ,p_input_value_name2 => 'Percentage'
6102 --3306515 added l_retention_allow_percentage
6103 ,p_value2 => to_char(nvl(p_pa_request_rec.to_retention_allow_percentage,l_retention_allow_percentage))
6104
6105 ,p_input_value_name3 => 'Date'
6106 ,p_value3 => fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_retention_allow_review.review_date))
6107 ,p_effective_date => l_effective_date
6108 ,p_process_warning => l_adj_basic_pay_warn
6109 );
6110 Else --if p_pa_request_rec.ret. allowance is null
6111 If p_pa_request_rec.noa_family_code = 'OTHER_PAY' then
6112 hr_utility.set_location(l_proc,32);
6113 l_element_entry_id := NULL;
6114
6115 l_new_element_name :=
6116 pqp_fedhr_uspay_int_utils.return_new_element_name(
6117 p_fedhr_element_name => 'Retention Allowance',
6118 p_business_group_id => l_bg_id,
6119 p_effective_date => p_pa_request_rec.effective_date,
6120 p_pay_basis => NULL);
6121
6122 for ele_entry in c_ele_entry(ele_name => l_new_element_name,
6123 ipv_name => 'Amount',
6124 eff_date => l_effective_date,
6125 bg_id => l_bg_id
6126 ) loop
6127
6128 l_element_entry_id := ele_entry.element_entry_id;
6129 End loop;
6130
6131 If l_element_entry_id is not null then
6132
6133 -- Bug 2627003
6134 IF p_pa_request_rec.to_retention_allowance IS NULL THEN
6135 p_retention_allow_review.review_date:=NULL;
6136 END IF;
6137 -- Bug 2627003 Adding inp val date for processing
6138
6139 ghr_element_api.process_sf52_element
6140 (p_assignment_id => p_pa_request_rec.employee_assignment_id
6141 ,p_element_name => 'Retention Allowance'
6142 ,p_input_value_name1 => 'Amount'
6143 ,p_value1 => to_char(p_pa_request_rec.to_retention_allowance)
6144 ,p_input_value_name2 => 'Percentage'
6145 ,p_value2 => to_char(p_pa_request_rec.to_retention_allow_percentage)
6146 ,p_input_value_name3 => 'Date'
6147 ,p_value3 => fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_retention_allow_review.review_date))
6148 ,p_effective_date => l_effective_date
6149 ,p_process_warning => l_adj_basic_pay_warn
6150 );
6151 End if;
6152 End if;
6153 End if;
6154 --
6155 -- Code added/ Modified for Payroll Integration
6156 -- Modifying the input value name from Percent to Percentage
6157 -- this change is done only for Supervisory diff and Retention Allowance
6158 --
6159 ---------------------------------------------------------------------------------------------
6160 -- Processing Within Grade Increase
6161 --
6162 l_wgi_due_date := null;
6163 ---- Bug 3263140
6164 -- No need for this cursor as the values are properly passed.
6165 -- Instead of the cursor the below written statement is enough
6166 /*FOR ctr_wgi_due IN cur_wgi_due LOOP
6167 l_wgi_due_date := fnd_date.canonical_to_date(ctr_wgi_due.wgi_due);
6168 END LOOP; */
6169
6170 l_wgi_due_date := fnd_date.canonical_to_date(p_wgi.p_date_wgi_due);
6171
6172 hr_utility.set_location('WGI Due date ' || l_wgi_due_date,150);
6173 hr_utility.set_location('p_pa_request_rec.noa_family_code ' || p_pa_request_rec.noa_family_code,150);
6174 -- GPPA 46 Update. l_to_pay_plan is not getting initialized. So, added the
6175 -- following code to initialize the l_to_pay_plan value.
6176
6177 g_retained_grade_info := null;
6178 --BUG # 6628794 Added to update to pay plan with pa request pay plan before updating with
6179 -- retained grade pay plan if temp step is null
6180 l_to_pay_plan := p_pa_request_rec.to_pay_plan;
6181 IF p_pa_request_rec.pay_rate_determinant in ('A','B','E','F','U','V') THEN
6182 l_retained_grade_rec := ghr_pc_basic_pay.get_retained_grade_details
6183 (p_person_id => p_pa_request_rec.person_id,
6184 p_effective_date => p_pa_request_rec.effective_date,
6185 p_pa_request_id => p_pa_request_rec.pa_request_id
6186 );
6187 hr_utility.set_location('l_retained_pay_plan:'||l_retained_grade_rec.pay_plan,155);
6188 --BUG # 6628749
6189 IF l_retained_grade_rec.temp_step is NULL THEN
6190 l_to_pay_plan := l_retained_grade_rec.pay_plan;
6191 END IF;
6192
6193 g_retained_grade_info := l_retained_grade_rec;
6194 END IF;
6195 --BUG # 6628749 as already defaulted with pa request rec to_pay_plan above
6196 -- commented the below code
6197 /* IF l_retained_grade_rec.temp_step is NULL THEN
6198 l_to_pay_plan := l_retained_grade_rec.pay_plan;
6199 ELSE
6200 l_to_pay_plan := p_pa_request_rec.to_pay_plan;
6201 END IF;*/
6202 hr_utility.set_location('l_to_pay_plan:'||l_to_pay_plan,156);
6203 FOR cur_eq_ppl_rec IN cur_eq_ppl(l_to_pay_plan)
6204 LOOP
6205 l_equ_pay_plan := cur_eq_ppl_rec.EQUIVALENT_PAY_PLAN;
6206 exit;
6207 END LOOP;
6208 hr_utility.set_location('l_equ_pay_plan:'||l_equ_pay_plan,157);
6209 ------GPPA Update 46 changes - For SES employees WGI element should not be created for 891, 892 , 890 and 897 NOACs.
6210 -- OR condition for Pay Plan FE is added as FE is nomore ES equ pay plan
6211 IF NOT ((l_equ_pay_plan = 'ES' OR l_to_pay_plan='FE')
6212 AND p_pa_request_rec.first_noa_code IN ('891', '892', '890', '897')) THEN
6213
6214 IF nvl(p_pa_request_rec.noa_family_code,hr_api.g_varchar2) IN
6215 ('APP',
6216 'APP_TRANSFER',
6217 'RETURN_TO_DUTY',
6218 'CHG_WORK_SCHED',
6219 'CHG_HOURS',
6220 'CHG_SCD',
6221 'DENIAL_WGI',
6222 'CONV_APP')
6223 OR
6224 (
6225 nvl(p_pa_request_rec.noa_family_code,hr_api.g_varchar2) LIKE 'GHR_SAL%' AND
6226 nvl(p_pa_request_rec.first_noa_code,hr_api.g_varchar2) NOT IN ('894','895','850')
6227 ) THEN
6228
6229 IF nvl(p_pa_request_rec.noa_family_code,hr_api.g_varchar2) IN
6230 ('APP',
6231 'APP_TRANSFER',
6232 'RETURN_TO_DUTY',
6233 'CHG_WORK_SCHED',
6234 'CHG_HOURS',
6235 'CHG_SCD',
6236 'DENIAL_WGI',
6237 'CONV_APP') THEN
6238 -- Bug 4031919 If Conversion to appointment and we're moving from WGI to Non-WGI position
6239 -- End date the WGI element
6240 IF nvl(p_pa_request_rec.noa_family_code,hr_api.g_varchar2) = 'CONV_APP' THEN
6241 -- If Correction action, then take pay plan from Original action
6242 IF l_session.noa_id_correct IS NOT NULL AND p_pa_request_rec.to_pay_plan IS NULL THEN
6243 FOR l_get_pay_plan IN c_get_pay_plan(p_pa_request_rec.altered_pa_request_id) LOOP
6244 l_to_pay_plan := l_get_pay_plan.to_pay_plan;
6245 END LOOP;
6246 ELSE
6247 l_to_pay_plan := p_pa_request_rec.to_pay_plan;
6248 END IF;
6249
6250
6251 IF l_to_pay_plan IS NOT NULL THEN
6252 --
6253 FOR l_wgi_pay_plan IN c_wgi_pay_plan(l_to_pay_plan) LOOP
6254 l_is_wgi_eligible := TRUE;
6255 END LOOP;
6256
6257
6258 -- If Pay plan is not eligible, update with NULL
6259 IF l_is_wgi_eligible = FALSE THEN
6260 -- Check if WGI element is present or not. If present only we need to update
6261 -- Get Element Name
6262 l_wgi_new_name := pqp_fedhr_uspay_int_utils.return_new_element_name(
6263 p_fedhr_element_name =>'Within Grade Increase',
6264 p_business_group_id => l_bg_id,
6265 p_effective_date => p_pa_request_rec.effective_date);
6266 FOR l_check_wgi IN c_check_ele(l_wgi_new_name,p_pa_request_rec.effective_date, p_pa_request_rec.employee_assignment_id) LOOP
6267 l_wgi_exists := TRUE;
6268 END LOOP;
6269
6270 IF l_wgi_exists = TRUE THEN
6271 ghr_element_api.process_sf52_element
6272 (p_assignment_id => p_pa_request_rec.employee_assignment_id
6273 ,p_element_name => 'Within Grade Increase'
6274 ,p_input_value_name2 => 'Date Due'
6275 ,p_value2 => NULL
6276 ,p_input_value_name3 => 'Pay Date'
6277 ,p_value3 => NULL
6278 ,p_input_value_name4 => 'Last Equivalent Increase'
6279 ,p_value4 => NULL
6280 ,p_input_value_name5 => 'Postponmt Effective'
6281 ,p_value5 => NULL
6282 ,p_effective_date => l_effective_date
6283 ,p_process_warning => l_within_grade_increase_warn
6284 );
6285 l_wgi_cleared := TRUE;
6286 END IF;
6287 END IF; -- IF l_is_wgi_eligible = FALSE
6288 END IF;
6289 END IF; -- IF nvl(p_pa_request_rec.noa_family_code,hr_api.g_varchar2) = 'CONV_APP'
6290
6291 -- proceed only if date_wgi_due is not null
6292 l_wgi_due_date := fnd_date.canonical_to_date(p_wgi.p_date_wgi_due);
6293 IF l_wgi_due_date IS NOT NULL AND l_wgi_cleared = FALSE THEN
6294 ghr_sf52_do_update.get_wgi_dates
6295 (p_pa_request_rec => p_pa_request_rec,
6296 p_wgi_due_date => l_wgi_due_date,
6297 p_wgi_pay_date => l_wgi_pay_date,
6298 p_retained_grade_rec => l_retained_grade_rec,
6299 p_dlei => NULL
6300 );
6301 --Begin Bug 10104811
6302 IF nvl(p_pa_request_rec.noa_family_code,hr_api.g_varchar2) IN ('RETURN_TO_DUTY') AND p_wgi.p_last_equi_incr IS NULL THEN
6303 ghr_history_fetch.fetch_element_entry_value
6304 (p_element_name => 'Within Grade Increase',
6305 p_input_value_name => 'Last Equivalent Increase',
6306 p_assignment_id => p_pa_request_rec.employee_assignment_id,
6307 p_date_effective => p_pa_request_rec.effective_date,
6308 p_screen_entry_value => l_lei_date
6309 );
6310 p_wgi.p_last_equi_incr := l_lei_date;
6311 END IF;
6312 --End Bug 10104811
6313 hr_utility.set_location('Inside If loop',511);
6314 ghr_element_api.process_sf52_element
6315 (p_assignment_id => p_pa_request_rec.employee_assignment_id
6316 ,p_element_name => 'Within Grade Increase'
6317 ,p_input_value_name2 => 'Date Due'
6318 ,p_value2 => fnd_date.date_to_displaydate(l_wgi_due_date) --AVR
6319 ,p_input_value_name3 => 'Pay Date'
6320 ,p_value3 => fnd_date.date_to_displaydate(l_wgi_pay_date) --AVR
6321 ,p_input_value_name4 => 'Last Equivalent Increase'
6322 ,p_value4 => fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_wgi.p_last_equi_incr))
6323 ,p_input_value_name5 => 'Postponmt Effective'
6324 ,p_value5 =>
6325 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_wgi.p_date_wgi_postpone_effective)) --AVR
6326 ,p_effective_date => l_effective_date
6327 ,p_process_warning => l_within_grade_increase_warn
6328 );
6329 -- If WGI Due date is not entered for Appointment and Conversion to Appointment, atleast create
6330 -- WGI element with Last equivalent increase.
6331 -- Bug 3998686 In correction action, if DLEI is present and WGI Due date is cleared,
6332 -- it comes here. Need to update NULL in that case. .
6333 ELSIF nvl(p_pa_request_rec.noa_family_code,hr_api.g_varchar2) IN ('APP','CONV_APP')
6334 AND p_wgi.p_last_equi_incr IS NOT NULL AND l_wgi_cleared = FALSE THEN
6335 hr_utility.set_location('Inside elsif loop',511);
6336 ghr_element_api.process_sf52_element
6337 (p_assignment_id => p_pa_request_rec.employee_assignment_id
6338 ,p_element_name => 'Within Grade Increase'
6339 ,p_input_value_name2 => 'Date Due'
6340 ,p_value2 => NULL -- Bug 3998686
6341 ,p_input_value_name3 => 'Pay Date'
6342 ,p_value3 => NULL -- Bug 3998686
6343 ,p_input_value_name4 => 'Last Equivalent Increase'
6344 ,p_value4 => fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_wgi.p_last_equi_incr))
6345 ,p_input_value_name5 => 'Postponmt Effective'
6346 ,p_value5 =>
6347 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_wgi.p_date_wgi_postpone_effective)) --AVR
6348 ,p_effective_date => l_effective_date
6349 ,p_process_warning => l_within_grade_increase_warn
6350 );
6351 END IF; -- IF l_wgi_due_date IS NOT NULL THEN
6352 ELSE
6353 -- Bug 3953455
6354 -- If it's a correction action, and not in 702,703,713 then
6355 -- check for the To step. if it's different then need to call get_wgi_dates.
6356 IF (l_session.noa_id_correct is not null and
6357 p_pa_request_rec.first_noa_code NOT in ('702','703','713')) THEN
6358 -- Get the To step values
6359 FOR l_get_step IN cur_get_step(p_pa_request_rec.pa_request_id) LOOP
6360 l_orig_pa_from_step := l_get_step.step1;
6361 l_corr_pa_from_step := l_get_step.step2;
6362 END LOOP;
6363
6364 IF l_corr_pa_from_step IS NOT NULL THEN
6365 IF l_orig_pa_from_step <> l_corr_pa_from_step THEN
6366 l_call_wgi_dates := TRUE;
6367 END IF;
6368 END IF;
6369 -- Bug 4025190
6370 IF p_wgi.p_date_wgi_due IS NOT NULL OR p_wgi.p_last_equi_incr IS NOT NULL THEN
6371 l_call_wgi_dates := TRUE;
6372 END IF;
6373 -- Bug 4025190
6374 END IF;
6375 -- End Bug 3953455
6376
6377 -- CALL only if not a CORRECTION Action
6378 -- Bug#2099054 added OR Condition to handle
6379 -- a CORRECTION Action for noa codes 702,703,713 (Bug 3263140)
6380 If (l_session.noa_id_correct is null) OR
6381 (l_session.noa_id_correct is not null and
6382 p_pa_request_rec.first_noa_code in ('702','703','713')) OR
6383 l_call_wgi_dates = TRUE
6384 THEN
6385
6386 IF p_pa_request_rec.first_noa_code in ( '702','703','713') THEN
6387 l_wgi_due_date := fnd_date.canonical_to_date(p_wgi.p_date_wgi_due);
6388 hr_utility.set_location('702 -- l_wgi_due_date is ' || l_wgi_due_date,1);
6389 END IF;
6390
6391 IF not (p_pa_request_rec.first_noa_code = '702' AND
6392 g_old_user_status = 'Temp. Promotion NTE' )THEN
6393 -- Call get_wgi_dates irrespective of whether Due date is entered or not.
6394 -- Removed the condition which checked for Due date not null condition
6395 -- Bug 3940682, 3941877, 3617295, TAR 4141454.995
6396 ghr_sf52_do_update.get_wgi_dates
6397 (p_pa_request_rec => p_pa_request_rec,
6398 p_wgi_due_date => l_wgi_due_date,
6399 p_wgi_pay_date => l_wgi_pay_date,
6400 p_retained_grade_rec => l_retained_grade_rec,
6401 p_dlei => fnd_date.canonical_to_date(p_wgi.p_last_equi_incr)
6402 );
6403 -- Start of 3111719
6404 -- For QSI action get the current LEI date.
6405 -- Bug 3993664 - Included NOA 867...
6406 -- Bug#5666880 - Included NOA 896, 897
6407 IF (p_pa_request_rec.first_noa_code IN ('892','867','896','897') OR
6408 p_pa_request_rec.second_noa_code IN ('892','867','896','897')) THEN
6409 hr_utility.set_location('inside NOA Code 897',9999999);
6410 ghr_history_fetch.fetch_element_entry_value
6411 (p_element_name => 'Within Grade Increase',
6412 p_input_value_name => 'Last Equivalent Increase',
6413 p_assignment_id => p_pa_request_rec.employee_assignment_id,
6414 p_date_effective => p_pa_request_rec.effective_date,
6415 p_screen_entry_value => l_lei_date
6416 );
6417 p_wgi.p_last_equi_incr := l_lei_date;
6418 END IF;
6419 -- End of 3111719
6420 -- Bug 3709414 Retrieving Last equivalent increase date if it's not entered in RPA EIT.
6421 hr_utility.set_location('p_wgi.p_last_equi_incr is ' || p_wgi.p_last_equi_incr,1);
6422 IF (p_pa_request_rec.first_noa_code = '713' OR p_pa_request_rec.second_noa_code = '713')
6423 AND p_wgi.p_last_equi_incr IS NULL THEN
6424 ghr_history_fetch.fetch_element_entry_value
6425 (p_element_name => 'Within Grade Increase',
6426 p_input_value_name => 'Last Equivalent Increase',
6427 p_assignment_id => p_pa_request_rec.employee_assignment_id,
6428 p_date_effective => p_pa_request_rec.effective_date,
6429 p_screen_entry_value => l_lei_date
6430 );
6431 p_wgi.p_last_equi_incr := l_lei_date;
6432 END IF;
6433
6434 -- Bug 3617295 DLEI should be updated with RPA effective date
6435 IF p_pa_request_rec.first_noa_code = '855' OR p_pa_request_rec.second_noa_code = '855' THEN
6436 p_wgi.p_last_equi_incr := fnd_date.date_to_canonical(p_pa_request_rec.effective_date); -- Bug 3991240
6437 END IF;
6438 -- End Bug 3617295
6439
6440 hr_utility.set_location('l_wgi_due_date calculated is ' || l_wgi_due_date,1);
6441 hr_utility.set_location('lei date calculated is ' || p_wgi.p_last_equi_incr,2);
6442 hr_utility.set_location('l_wgi_pay_date calculated is ' || l_wgi_pay_date,3);
6443
6444 ghr_element_api.process_sf52_element
6445 (p_assignment_id => p_pa_request_rec.employee_assignment_id
6446 ,p_element_name => 'Within Grade Increase'
6447 ,p_input_value_name2 => 'Date Due'
6448 ,p_value2 => fnd_date.date_to_displaydate(l_wgi_due_date) --AVR
6449 ,p_input_value_name3 => 'Pay Date'
6450 ,p_value3 => fnd_date.date_to_displaydate(l_wgi_pay_date) --AVR
6451 ,p_input_value_name4 => 'Last Equivalent Increase'
6452 ,p_value4 => fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_wgi.p_last_equi_incr))
6453 ,p_input_value_name5 => 'Postponmt Effective'
6454 ,p_value5 =>
6455 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_wgi.p_date_wgi_postpone_effective)) --AVR
6456 ,p_effective_date => l_effective_date
6457 ,p_process_warning => l_within_grade_increase_warn
6458 );
6459 END IF; -- IF not (p_pa_request_rec.first_noa_code = '702'
6460 End if; -- If (l_session.noa_id_correct is null) OR
6461 End if;
6462 Else
6463 If p_wgi.p_date_wgi_due is not null or
6464 p_wgi.p_wgi_pay_date is not null or
6465 p_wgi.p_date_wgi_postpone_effective is not null then
6466 hr_utility.set_location(l_proc,85);
6467 hr_utility.set_location('date due ' || p_wgi.p_date_wgi_due,1);
6468 hr_utility.set_location('determ due' || p_wgi.p_date_wgi_postpone_effective,2);
6469
6470 ghr_element_api.process_sf52_element
6471 (p_assignment_id => p_pa_request_rec.employee_assignment_id
6472 ,p_element_name => 'Within Grade Increase'
6473 ,p_input_value_name2 => 'Date Due'
6474 ,p_value2 =>
6475 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_wgi.p_date_wgi_due)) --AVR
6476 ,p_input_value_name3 => 'Pay Date'
6477 ,p_value3 =>
6478 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_wgi.p_wgi_pay_date)) --AVR
6479 ,p_input_value_name4 => 'Last Equivalent Increase'
6480 ,p_value4 => fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_wgi.p_last_equi_incr))
6481 ,p_input_value_name5 => 'Postponmt Effective'
6482 ,p_value5 =>
6483 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_wgi.p_date_wgi_postpone_effective)) ---AVR
6484 ,p_effective_date => l_effective_date
6485 ,p_process_warning => l_within_grade_increase_warn
6486 );
6487 end if;
6488 End if;
6489 END IF; ------l_equ_pay_plan = 'ES'
6490
6491 -- FWFA Changes. Restrict this update if the update happens already in call_extra_info_api.
6492
6493
6494
6495 IF NOT(ghr_pay_calc.g_fwfa_pay_calc_flag) AND
6496 NOT(ghr_pay_calc.g_gl_upd_flag) THEN
6497 ghr_history_api.get_g_session_var(l_session);
6498 IF p_pa_request_rec.first_noa_code = '894' and
6499 ghr_process_sf52.g_prd IS NOT NULL AND
6500 l_session.noa_id_correct IS NULL THEN
6501 IF ghr_process_sf52.g_prd in ('A','B','E','F','U','V') THEN
6502 l_new_step_or_rate := ghr_process_sf52.g_step_or_rate;
6503 l_retained_grade_rec := ghr_pc_basic_pay.get_retained_grade_details
6504 (p_person_id => p_pa_request_rec.person_id,
6505 p_effective_date => p_pa_request_rec.effective_date,
6506 p_pa_request_id => p_pa_request_rec.pa_request_id
6507 );
6508 END IF;
6509 END IF;
6510 hr_utility.set_location('ret person extra info id : ' || l_retained_grade_rec.person_extra_info_id,1);
6511
6512 -------Bug 5913362 -- Adding 890
6513 If l_retained_grade_rec.person_extra_info_id is not null
6514 and p_pa_request_rec.first_noa_code NOT IN ('866', '890') then
6515 hr_utility.set_location('update retained grade info',1);
6516 for retained_grade_ovn in c_retained_grade_ovn loop
6517 l_ret_object_version_number := retained_grade_ovn.object_version_number;
6518 if p_pa_request_rec.first_noa_code in ('867','892','893','894')
6519 then
6520 l_new_date_to := retained_grade_ovn.pei_information2;
6521 l_new_grade_or_level := retained_grade_ovn.pei_information3;
6522 l_new_pay_plan := retained_grade_ovn.pei_information5;
6523 l_new_pay_table := retained_grade_ovn.pei_information6;
6524 l_new_loc_percent := retained_grade_ovn.pei_information7;
6525 l_new_pay_basis := retained_grade_ovn.pei_information8;
6526 l_cur_step_or_rate := retained_grade_ovn.pei_information4;
6527 l_new_temp_step := retained_grade_ovn.pei_information9;
6528 end if;
6529 end loop;
6530 If p_pa_request_rec.first_noa_code in ('867','892','893','894') then
6531 hr_utility.set_location('procesing 867,892,893,894',1);
6532 ghr_history_api.get_g_session_var(l_session);
6533 If l_session.noa_id_correct is null then
6534 hr_utility.set_location('procesing 867,892,893,894 not a corr',1);
6535 ----Bug 6193571 start
6536 if p_pa_request_rec.first_noa_code = '894'
6537 AND l_new_step_or_rate is not null
6538 AND ghr_process_sf52.g_prd IS NOT NULL then
6539 hr_person_extra_info_api.update_person_extra_info
6540 (p_person_extra_info_id => l_retained_grade_rec.person_extra_info_id,
6541 p_object_version_number => l_ret_object_version_number,
6542 p_pei_information2 => fnd_date.date_to_canonical(p_pa_request_rec.effective_date - 1)
6543 );
6544 end if;
6545 If p_pa_request_rec.first_noa_code in ('867','892','893') then
6546 --- Bug 6193571 end
6547 hr_person_extra_info_api.update_person_extra_info
6548 (p_person_extra_info_id => l_retained_grade_rec.person_extra_info_id,
6549 p_object_version_number => l_ret_object_version_number,
6550 p_pei_information2 => fnd_date.date_to_canonical(p_pa_request_rec.effective_date - 1)
6551 );
6552 end if;
6553 IF p_pa_request_rec.first_noa_code in ('867','892','893') THEN
6554 l_new_step_or_rate := l_retained_grade_rec.step_or_rate;
6555 l_new_temp_step := l_retained_grade_rec.temp_step;
6556 hr_utility.set_location('TPS 1 ',1);
6557 END IF;
6558 hr_utility.set_location('TPS 1a '||l_new_temp_step,1);
6559 IF l_new_temp_step is NOT NULL THEN
6560 hr_utility.set_location('TPS 1b '||l_new_temp_step,1);
6561 hr_person_extra_info_api.create_person_extra_info
6562 (p_person_id => p_pa_request_rec.person_id,
6563 p_information_type => 'GHR_US_RETAINED_GRADE',
6564 p_pei_information_category => 'GHR_US_RETAINED_GRADE',
6565 p_person_extra_info_id => l_ret_grade_rec.person_extra_info_id,
6566 p_object_version_number => l_ret_object_version_number,
6567 p_pei_information1 => fnd_date.date_to_canonical(p_pa_request_rec.effective_date),
6568 p_pei_information2 => l_new_date_to,
6569 p_pei_information3 => l_new_grade_or_level,
6570 p_pei_information4 => l_cur_step_or_rate,
6571 p_pei_information5 => l_new_pay_plan,
6572 p_pei_information6 => l_new_pay_table,
6573 p_pei_information7 => l_new_loc_percent,
6574 p_pei_information8 => l_new_pay_basis,
6575 p_pei_information9 => l_new_temp_step
6576 );
6577 ELSE
6578 hr_utility.set_location('TPS 2 '||l_new_step_or_rate,2);
6579 ---Bug 6024225 Added nvl value for 894 action. Need to check this at a later time.
6580
6581 --- Bug 6193571 start
6582 if p_pa_request_rec.first_noa_code = '894'
6583 AND l_new_step_or_rate is not null
6584 AND ghr_process_sf52.g_prd IS NOT NULL then
6585 hr_person_extra_info_api.create_person_extra_info
6586 (p_person_id => p_pa_request_rec.person_id,
6587 p_information_type => 'GHR_US_RETAINED_GRADE',
6588 p_pei_information_category => 'GHR_US_RETAINED_GRADE',
6589 p_person_extra_info_id => l_ret_grade_rec.person_extra_info_id,
6590 p_object_version_number => l_ret_object_version_number,
6591 p_pei_information1 => fnd_date.date_to_canonical(p_pa_request_rec.effective_date),
6592 p_pei_information2 => l_new_date_to,
6593 p_pei_information3 => l_new_grade_or_level,
6594 p_pei_information4 => nvl(l_new_step_or_rate,l_cur_step_or_rate),
6595 p_pei_information5 => l_new_pay_plan,
6596 p_pei_information6 => l_new_pay_table,
6597 p_pei_information7 => l_new_loc_percent,
6598 p_pei_information8 => l_new_pay_basis
6599 );
6600 end if;
6601 IF p_pa_request_rec.first_noa_code in ('867','892','893') THEN
6602 ----Bug 6193571 end
6603 hr_person_extra_info_api.create_person_extra_info
6604 (p_person_id => p_pa_request_rec.person_id,
6605 p_information_type => 'GHR_US_RETAINED_GRADE',
6606 p_pei_information_category => 'GHR_US_RETAINED_GRADE',
6607 p_person_extra_info_id => l_ret_grade_rec.person_extra_info_id,
6608 p_object_version_number => l_ret_object_version_number,
6609 p_pei_information1 => fnd_date.date_to_canonical(p_pa_request_rec.effective_date),
6610 p_pei_information2 => l_new_date_to,
6611 p_pei_information3 => l_new_grade_or_level,
6612 p_pei_information4 => nvl(l_new_step_or_rate,l_cur_step_or_rate),
6613 p_pei_information5 => l_new_pay_plan,
6614 p_pei_information6 => l_new_pay_table,
6615 p_pei_information7 => l_new_loc_percent,
6616 p_pei_information8 => l_new_pay_basis
6617 );
6618 end if;
6619 END IF;
6620 End if;
6621 Else
6622 hr_utility.set_location('TPS 3 '||l_new_step_or_rate,3);
6623 hr_person_extra_info_api.update_person_extra_info
6624 (p_person_extra_info_id => l_retained_grade_rec.person_extra_info_id,
6625 p_object_version_number => l_ret_object_version_number,
6626 p_pei_information4 => l_retained_grade_rec.step_or_rate
6627 );
6628 End if;
6629 End if;
6630 END IF;
6631 --
6632 -- Temp. Promo RG processing for 703 Actions
6633 -- Create a new RG row with the Temporary promotion step value
6634 -- and End date the current RG row with effective date minus one
6635 -- Get the Temporary Promotion Step Value
6636 l_new_temp_step := NULL;
6637 IF p_pa_request_rec.first_noa_code in ('703') THEN
6638 FOR cur_temp_step_rec IN cur_temp_step LOOP
6639 l_new_temp_step := cur_temp_step_rec.temp_step;
6640 END LOOP;
6641 hr_utility.set_location('TPS 4 '||l_new_temp_step,4);
6642 IF l_new_temp_step is not null THEN
6643 l_retained_grade_rec :=
6644 ghr_pc_basic_pay.get_retained_grade_details
6645 (p_person_id => p_pa_request_rec.person_id,
6646 p_effective_date => p_pa_request_rec.effective_date,
6647 p_pa_request_id => p_pa_request_rec.pa_request_id
6648 );
6649 IF l_retained_grade_rec.person_extra_info_id is not null then
6650 hr_utility.set_location('Inside 703 processing '||l_retained_grade_rec.person_extra_info_id,1);
6651 FOR retained_grade_ovn IN c_retained_grade_ovn LOOP
6652 l_ret_object_version_number := retained_grade_ovn.object_version_number;
6653 l_new_date_to := retained_grade_ovn.pei_information2;
6654 l_new_grade_or_level := retained_grade_ovn.pei_information3;
6655 l_new_step_or_rate := retained_grade_ovn.pei_information4;
6656 l_new_pay_plan := retained_grade_ovn.pei_information5;
6657 l_new_pay_table := retained_grade_ovn.pei_information6;
6658 l_new_loc_percent := retained_grade_ovn.pei_information7;
6659 l_new_pay_basis := retained_grade_ovn.pei_information8;
6660 exit;
6661 END LOOP;
6662 ghr_history_api.get_g_session_var(l_session);
6663 hr_utility.set_location('Inside 703 processing ',2);
6664 IF l_session.noa_id_correct is null then
6665 -- End date the existing RG record
6666 hr_person_extra_info_api.update_person_extra_info
6667 (p_person_extra_info_id => l_retained_grade_rec.person_extra_info_id,
6668 p_object_version_number => l_ret_object_version_number,
6669 p_pei_information2 => fnd_date.date_to_canonical(p_pa_request_rec.effective_date - 1)
6670 );
6671 hr_utility.set_location('Inside 703 processing ',3);
6672 -- Create the new RG Record with Temporary Promotion Step Value
6673 hr_person_extra_info_api.create_person_extra_info
6674 (p_person_id => p_pa_request_rec.person_id,
6675 p_information_type => 'GHR_US_RETAINED_GRADE',
6676 p_pei_information_category => 'GHR_US_RETAINED_GRADE',
6677 p_person_extra_info_id => l_ret_grade_rec.person_extra_info_id,
6678 p_object_version_number => l_ret_object_version_number,
6679 p_pei_information1 => fnd_date.date_to_canonical(p_pa_request_rec.effective_date),
6680 p_pei_information2 => l_new_date_to,
6681 p_pei_information3 => l_new_grade_or_level,
6682 p_pei_information4 => l_new_step_or_rate,
6683 p_pei_information5 => l_new_pay_plan,
6684 p_pei_information6 => l_new_pay_table,
6685 p_pei_information7 => l_new_loc_percent,
6686 p_pei_information8 => l_new_pay_basis,
6687 p_pei_information9 => l_new_temp_step
6688 );
6689 hr_utility.set_location('Inside 703 processing ',3);
6690 ELSE
6691 -- Update the current RG
6692 hr_utility.set_location('Inside 703 correction processing '||l_new_temp_step,4);
6693 hr_person_extra_info_api.update_person_extra_info
6694 (p_person_extra_info_id => l_retained_grade_rec.person_extra_info_id,
6695 p_object_version_number => l_ret_object_version_number,
6696 p_pei_information9 => l_new_temp_step
6697 );
6698 END IF;
6699 END IF;
6700 END IF;
6701 END IF;
6702 --
6703 -- Temp. Promo RG processing for 740 action
6704 -- Create a new RG record with the null Temporary promotion step value
6705 -- and End date the current RG row withe effective date minus one
6706 -- Get the Temporary Promotion Step Value
6707 IF p_pa_request_rec.first_noa_code in ('740') THEN
6708 BEGIN --Bug 3941836 added being and end for this.
6709 l_retained_grade_rec :=
6710 ghr_pc_basic_pay.get_retained_grade_details
6711 (p_person_id => p_pa_request_rec.person_id,
6712 p_effective_date => p_pa_request_rec.effective_date,
6713 p_pa_request_id => p_pa_request_rec.pa_request_id
6714 );
6715 EXCEPTION
6716 WHEN OTHERS THEN
6717 NULL;
6718 END;
6719 IF l_retained_grade_rec.person_extra_info_id is not null then
6720 hr_utility.set_location('Inside 740 processing '||l_retained_grade_rec.person_extra_info_id,1);
6721 FOR retained_grade_ovn IN c_retained_grade_ovn LOOP
6722 l_ret_object_version_number := retained_grade_ovn.object_version_number;
6723 l_new_date_to := retained_grade_ovn.pei_information2;
6724 l_new_grade_or_level := retained_grade_ovn.pei_information3;
6725 l_new_step_or_rate := retained_grade_ovn.pei_information4;
6726 l_new_pay_plan := retained_grade_ovn.pei_information5;
6727 l_new_pay_table := retained_grade_ovn.pei_information6;
6728 l_new_loc_percent := retained_grade_ovn.pei_information7;
6729 l_new_pay_basis := retained_grade_ovn.pei_information8;
6730 l_new_temp_step := retained_grade_ovn.pei_information9;
6731 exit;
6732 END LOOP;
6733 hr_utility.set_location('Inside 740 processing ',2);
6734 ghr_history_api.get_g_session_var(l_session);
6735 IF l_new_temp_step IS NOT NULL and l_session.noa_id_correct IS NULL THEN
6736 -- End date the existing RG record
6737 hr_person_extra_info_api.update_person_extra_info
6738 (p_person_extra_info_id => l_retained_grade_rec.person_extra_info_id,
6739 p_object_version_number => l_ret_object_version_number,
6740 p_pei_information2 => fnd_date.date_to_canonical(p_pa_request_rec.effective_date - 1)
6741 );
6742 hr_utility.set_location('Inside 740 processing ',3);
6743 -- Create the new RG Record with null Temporary Promotion Step Value
6744 hr_person_extra_info_api.create_person_extra_info
6745 (p_person_id => p_pa_request_rec.person_id,
6746 p_information_type => 'GHR_US_RETAINED_GRADE',
6747 p_pei_information_category => 'GHR_US_RETAINED_GRADE',
6748 p_person_extra_info_id => l_ret_grade_rec.person_extra_info_id,
6749 p_object_version_number => l_ret_object_version_number,
6750 p_pei_information1 => fnd_date.date_to_canonical(p_pa_request_rec.effective_date),
6751 p_pei_information2 => l_new_date_to,
6752 p_pei_information3 => l_new_grade_or_level,
6753 p_pei_information4 => l_new_step_or_rate,
6754 p_pei_information5 => l_new_pay_plan,
6755 p_pei_information6 => l_new_pay_table,
6756 p_pei_information7 => l_new_loc_percent,
6757 p_pei_information8 => l_new_pay_basis
6758 );
6759 hr_utility.set_location('Inside 740 processing ',3);
6760 END IF;
6761 END IF;
6762 END IF;
6763 hr_utility.set_location('Leaving ' ||l_proc,100);
6764 Exception when others then
6765 --
6766 -- Reset IN OUT parameters and set OUT parameters
6767 --
6768 p_wgi := l_wgi;
6769 p_retention_allow_review := l_retention_allow_review;
6770 raise;
6771
6772 end Process_salary_Info;
6773 --
6774 --
6775 --
6776 -- ********************************
6777 -- procedure Process_Non_Salary_Info
6778 -- ********************************
6779 --
6780 Procedure Process_non_salary_Info
6781 (p_pa_request_rec in ghr_pa_requests%rowtype
6782 ,p_recruitment_bonus in out nocopy ghr_api.recruitment_bonus_type
6783 ,p_relocation_bonus in out nocopy ghr_api.relocation_bonus_type
6784 ,p_student_loan_repay in out nocopy ghr_api.student_loan_repay_type
6785 --Pradeep
6786 ,p_mddds_special_pay in out nocopy ghr_api.mddds_special_pay_type
6787 ,p_premium_pay_ind in out nocopy ghr_api.premium_pay_ind_type
6788 ,p_gov_award in out nocopy ghr_api.government_awards_type
6789 ,p_entitlement in out nocopy ghr_api.entitlement_type
6790 -- Bug#2759379 Added FEGLI parameter
6791 ,p_fegli in out nocopy ghr_api.fegli_type
6792 ,p_foreign_lang_prof_pay in out nocopy ghr_api.foreign_lang_prof_pay_type
6793 -- Bug# 3385386 Added FTA parameter
6794 ,p_fta in out nocopy ghr_api.fta_type
6795 ,p_edp_pay in out nocopy ghr_api.edp_pay_type
6796 ,p_hazard_pay in out nocopy ghr_api.hazard_pay_type
6797 ,p_health_benefits in out nocopy ghr_api.health_benefits_type
6798 ,p_danger_pay in out nocopy ghr_api.danger_pay_type
6799 ,p_imminent_danger_pay in out nocopy ghr_api.imminent_danger_pay_type
6800 ,p_living_quarters_allow in out nocopy ghr_api.living_quarters_allow_type
6801 ,p_post_diff_amt in out nocopy ghr_api.post_diff_amt_type
6802 ,p_post_diff_percent in out nocopy ghr_api.post_diff_percent_type
6803 ,p_sep_maintenance_allow in out nocopy ghr_api.sep_maintenance_allow_type
6804 ,p_supplemental_post_allow in out nocopy ghr_api.supplemental_post_allow_type
6805 ,p_temp_lodge_allow in out nocopy ghr_api.temp_lodge_allow_type
6806 ,p_premium_pay in out nocopy ghr_api.premium_pay_type
6807 ,p_retirement_annuity in out nocopy ghr_api.retirement_annuity_type
6808 ,p_severance_pay in out nocopy ghr_api.severance_pay_type
6809 ,p_thrift_saving_plan in out nocopy ghr_api.thrift_saving_plan
6810 ,p_health_ben_pre_tax in out nocopy ghr_api.health_ben_pre_tax_type
6811 --Bug # 13571004
6812 ,p_tsp_roth in out nocopy ghr_api.tsp_roth_type
6813 ) is
6814
6815 l_proc varchar2(70) := 'Process_Non_salary_info';
6816 l_warning boolean;
6817 l_effective_date date;
6818 --
6819 -- No copy Changes.
6820 l_recruitment_bonus ghr_api.recruitment_bonus_type;
6821 l_relocation_bonus ghr_api.relocation_bonus_type;
6822 l_gov_award ghr_api.government_awards_type;
6823 l_entitlement ghr_api.entitlement_type;
6824 l_foreign_lang_prof_pay ghr_api.foreign_lang_prof_pay_type;
6825 -- Bug# 3385386 Added l_fta variable
6826 l_fta ghr_api.fta_type;
6827 l_edp_pay ghr_api.edp_pay_type;
6828 l_hazard_pay ghr_api.hazard_pay_type;
6829 l_health_benefits ghr_api.health_benefits_type;
6830 l_danger_pay ghr_api.danger_pay_type;
6831 l_imminent_danger_pay ghr_api.imminent_danger_pay_type;
6832 l_living_quarters_allow ghr_api.living_quarters_allow_type;
6833 l_post_diff_amt ghr_api.post_diff_amt_type;
6834 l_post_diff_percent ghr_api.post_diff_percent_type;
6835 l_sep_maintenance_allow ghr_api.sep_maintenance_allow_type;
6836 l_supplemental_post_allow ghr_api.supplemental_post_allow_type;
6837 l_temp_lodge_allow ghr_api.temp_lodge_allow_type;
6838 l_premium_pay ghr_api.premium_pay_type;
6839 l_retirement_annuity ghr_api.retirement_annuity_type;
6840 l_severance_pay ghr_api.severance_pay_type;
6841 l_thrift_saving_plan ghr_api.thrift_saving_plan;
6842 l_health_ben_pre_tax ghr_api.health_ben_pre_tax_type;
6843 l_student_loan_repay ghr_api.student_loan_repay_type;
6844 -- Bug#4486823 RRR Changes
6845 l_total_salary ghr_pa_requests.to_total_salary%TYPE;
6846 --
6847
6848 --Bug # 13571004
6849 l_tsp_roth ghr_api.tsp_roth_type;
6850 PROCEDURE Create_incentive_Remark(p_pa_request_id IN NUMBER,
6851 p_effective_date IN DATE,
6852 p_category IN VARCHAR2,
6853 p_noa_code IN VARCHAR2,
6854 p_percent IN NUMBER,
6855 p_amount IN NUMBER,
6856 p_payment_date IN DATE,
6857 p_end_date IN DATE) IS
6858
6859 l_remark_id ghr_remarks.remark_id%TYPE;
6860 l_pa_remark_id ghr_pa_remarks.pa_remark_id%TYPE;
6861 l_object_version_nbr ghr_pa_remarks.object_version_number%TYPE;
6862 l_remark_desc ghr_remarks.description%TYPE;
6863 l_remark_information1 ghr_pa_remarks.remark_code_information1%TYPE;
6864 l_remark_information2 ghr_pa_remarks.remark_code_information2%TYPE;
6865 l_remark_information3 ghr_pa_remarks.remark_code_information3%TYPE;
6866 l_remark_information4 ghr_pa_remarks.remark_code_information4%TYPE;
6867 l_remark_information5 ghr_pa_remarks.remark_code_information5%TYPE;
6868 l_remark_desc_out ghr_remarks.description%TYPE;
6869 l_end_date DATE;
6870
6871
6872 BEGIN
6873 l_end_date := p_end_date;
6874 ghr_mass_actions_pkg.get_remark_id_desc
6875 (p_remark_code => 'ZZZ',
6876 p_effective_date => p_effective_date,
6877 p_remark_id => l_remark_id,
6878 p_remark_desc => l_remark_desc);
6879
6880 l_remark_information1 := NULL;
6881 l_remark_information2 := NULL;
6882 l_remark_information3 := NULL;
6883 l_remark_information4 := NULL;
6884 l_remark_information5 := NULL;
6885
6886 IF p_percent IS NOT NULL THEN
6887 IF p_category = 'Biweekly' THEN
6888
6889 -- Bug#5039100
6890 IF p_percent = 0 THEN
6891 -- Change the remark from 'As on' to 'As of' : Bug:5170178
6892 l_remark_information1 := 'Retention Incentive Biweekly is terminated as of '||fnd_date.date_to_displaydate(p_payment_date);
6893 ELSE
6894 -- Added this IF condition to remove the end date if end date is '4712/12/31' : Bug#5170178
6895 IF l_end_date IS NULL THEN
6896 l_remark_information1 := p_category||' is '||p_percent||'% of Earned Basic Pay to be paid from '
6897 ||fnd_date.date_to_displaydate(p_payment_date);
6898 ELSE
6899 l_remark_information1 := p_category||' is '||p_percent||'% of Earned Basic Pay to be paid from '
6900 ||fnd_date.date_to_displaydate(p_payment_date) ||' to '
6901 ||fnd_date.date_to_displaydate(l_end_date);
6902 END IF;
6903 END IF;
6904 ELSE
6905 l_remark_information1 := p_category||' is '||p_percent||'% of Earned Basic Pay to be paid '
6906 ||fnd_date.date_to_displaydate(p_payment_date);
6907 END IF;
6908 ELSE
6909 IF p_category = 'Biweekly' THEN
6910 -- Added this IF condition to remove the end date if end date is '4712/12/31' : Bug#5170178
6911 IF l_end_date IS NULL THEN
6912 l_remark_information1 := p_category||' of $'||p_amount||' to be paid from '
6913 ||fnd_date.date_to_displaydate(p_payment_date);
6914 ELSE
6915 l_remark_information1 := p_category||' of $'||p_amount||' to be paid from '
6916 ||fnd_date.date_to_displaydate(p_payment_date) ||' to '
6917 ||fnd_date.date_to_displaydate(l_end_date);
6918
6919 END IF;
6920 ELSE
6921 l_remark_information1 := p_category||' of $'||p_amount||' to be paid '
6922 ||fnd_date.date_to_displaydate(p_payment_date);
6923 END IF;
6924 END IF;
6925
6926
6927 --Pradeep commented l_remark_desc and added l_remark_desc_out for the Bug#3974979.
6928 ghr_mass_actions_pkg.replace_insertion_values
6929 (p_desc => l_remark_desc,
6930 p_information1 => l_remark_information1,
6931 p_information2 => l_remark_information2,
6932 p_information3 => l_remark_information3,
6933 p_information4 => l_remark_information4,
6934 p_information5 => l_remark_information5,
6935 p_desc_out => l_remark_desc_out
6936 );
6937 l_remark_desc := l_remark_desc_out;
6938
6939 ghr_pa_remarks_api.create_pa_remarks
6940 (p_pa_request_id => p_pa_request_id,
6941 p_remark_id => l_remark_id,
6942 p_description => l_remark_desc,
6943 p_remark_code_information1 => l_remark_information1,
6944 p_remark_code_information2 => l_remark_information2,
6945 p_remark_code_information3 => l_remark_information3,
6946 p_remark_code_information4 => l_remark_information4,
6947 p_remark_code_information5 => l_remark_information5,
6948 p_pa_remark_id => l_pa_remark_id,
6949 p_object_version_number => l_object_version_nbr);
6950 END create_incentive_remark;
6951
6952 PROCEDURE Upd_sep_incn_elements(p_pa_request_id IN ghr_pa_requests.pa_request_id%TYPE
6953 ,p_assignment_id IN ghr_pa_requests.employee_assignment_id%TYPE
6954 ,p_effective_date IN ghr_pa_requests.effective_date%TYPE
6955 ,p_payment_option IN ghr_pa_requests.pa_incentive_payment_option%TYPE
6956 ,p_first_noa_code IN ghr_pa_requests.first_noa_code%TYPE
6957 ,p_second_noa_code IN ghr_pa_requests.second_noa_code%TYPE) IS
6958
6959 Cursor c_inc_catg_details(l_pa_request_id NUMBER) IS
6960 SELECT pa_incentive_category_amount amount,
6961 pa_incentive_category_pmnt_dt payment_date
6962 FROM ghr_pa_incentives
6963 where pa_request_id = l_pa_request_id
6964 order by pa_incentive_category_pmnt_dt;
6965
6966
6967 CURSOR c_nonrec_incntv_ele_info (ele_name in varchar2
6968 ,asg_id in number
6969 ,eff_date in date
6970 ,bg_id in number) is
6971 select ele.element_entry_id,
6972 ipv.name,
6973 ipv.input_value_id,
6974 ipv.uom,
6975 eev.screen_entry_value screen_entry_value,
6976 ele.object_version_number
6977 from pay_element_types_f elt,
6978 pay_input_values_f ipv,
6979 pay_element_entries_f ele,
6980 pay_element_entry_values_f eev
6981 where trunc(eff_date) between elt.effective_start_date
6982 and elt.effective_end_date
6983 and trunc(eff_date) between ipv.effective_start_date
6984 and ipv.effective_end_date
6985 and trunc(eff_date) between ele.effective_start_date
6986 and ele.effective_end_date
6987 and trunc(eff_date) between eev.effective_start_date
6988 and eev.effective_end_date
6989 and elt.element_type_id = ipv.element_type_id
6990 and upper(elt.element_name) = upper(ele_name)
6991 and ipv.input_value_id = eev.input_value_id
6992 and ele.assignment_id = asg_id
6993 and ele.element_entry_id + 0 = eev.element_entry_id
6994 and (elt.business_group_id is null or elt.business_group_id = bg_id)
6995 order by ele.element_entry_id,ipv.input_value_id;
6996
6997 cursor c_business_group (asg_id number, eff_date date) is
6998 select asg.business_group_id
6999 from per_all_assignments_f asg
7000 where asg.assignment_id = asg_id
7001 and eff_date between asg.effective_start_date
7002 and asg.effective_end_date;
7003
7004
7005 l_value1 pay_element_entry_values_f.screen_entry_value%type;
7006 l_value2 pay_element_entry_values_f.screen_entry_value%type;
7007 l_value3 pay_element_entry_values_f.screen_entry_value%type;
7008 l_amount1 pay_element_entry_values_f.screen_entry_value%type;
7009 l_amount2 pay_element_entry_values_f.screen_entry_value%type;
7010 l_date1 pay_element_entry_values_f.screen_entry_value%type;
7011 l_date2 pay_element_entry_values_f.screen_entry_value%type;
7012 l_business_group_id per_business_groups.business_group_id%type;
7013 l_input_value_id1 pay_input_values_f.input_value_id%type;
7014 l_input_value_id2 pay_input_values_f.input_value_id%type;
7015 l_input_value_id3 pay_input_values_f.input_value_id%type;
7016 l_element_entry_id pay_element_entries_f.element_entry_id%type;
7017 l_object_version_number pay_element_entries_f.object_version_number%type;
7018 l_update_mode VARCHAR2(25);
7019 l_ctr NUMBER;
7020 l_element_ctr NUMBER;
7021 l_update_warning boolean;
7022 l_effective_start_date date;
7023 l_effective_end_date date;
7024
7025 BEGIN
7026
7027 l_ctr := 0;
7028 for c_business_group_rec in c_business_group (p_assignment_id, p_effective_date)
7029 loop
7030 l_business_group_id := c_business_group_rec.business_group_id;
7031 exit;
7032 end loop;
7033
7034 FOR c_incdet_rec IN c_inc_catg_details(p_pa_request_id)
7035 LOOP
7036 l_ctr := l_ctr + 1;
7037 IF l_ctr = 1 THEN
7038 l_amount1 := c_incdet_rec.amount;
7039 l_date1 := fnd_date.date_to_displaydate(c_incdet_rec.payment_date);
7040 ELSE -- ie. l_ctr =2
7041 l_amount2 := c_incdet_rec.amount;
7042 l_date2 := fnd_date.date_to_displaydate(c_incdet_rec.payment_date);
7043 END IF;
7044 END LOOP;
7045
7046 l_ctr := 0;
7047 l_element_ctr := 0;
7048
7049 FOR c_ele_info_rec IN c_nonrec_incntv_ele_info('Separation Incentive Lump Sum'
7050 ,p_assignment_id
7051 ,p_effective_date
7052 ,l_business_group_id)
7053 LOOP
7054 l_ctr := l_ctr + 1;
7055 IF l_ctr <= 3 THEN
7056 l_element_entry_id := c_ele_info_rec.element_entry_id;
7057 l_object_version_number := c_ele_info_rec.object_version_number;
7058
7059 IF c_ele_info_rec.name = 'Amount' THEN
7060 l_input_value_id1 := c_ele_info_rec.input_value_id;
7061 l_value1 := c_ele_info_rec.screen_entry_value;
7062 ELSIF c_ele_info_rec.name = 'Payment Date' THEN
7063 l_input_value_id2 := c_ele_info_rec.input_value_id;
7064 l_value2 := c_ele_info_rec.screen_entry_value;
7065 ELSIF c_ele_info_rec.name = 'Payment Option' THEN
7066 l_input_value_id3 := c_ele_info_rec.input_value_id;
7067 l_value3 := c_ele_info_rec.screen_entry_value;
7068 END IF;
7069
7070 IF l_ctr = 3 THEN
7071
7072 BEGIN
7073 l_element_ctr := l_element_ctr + 1;
7074 IF l_element_ctr = 1 THEN
7075 l_value1 := NVL(l_amount1,l_value1);
7076 l_value2 := NVL(l_date1, l_value2);
7077 ELSIF l_element_ctr = 2 THEN
7078 l_value1 := NVL(l_amount2,l_value1);
7079 l_value2 := NVL(l_date2, l_value2);
7080 END IF;
7081 savepoint upd_ent;
7082 l_update_mode := 'CORRECTION';
7083 py_element_entry_api.update_element_entry
7084 (p_datetrack_update_mode => l_update_mode
7085 ,p_effective_date => p_effective_date
7086 ,p_business_group_id => l_business_group_id
7087 ,p_element_entry_id => l_element_entry_id
7088 ,p_object_version_number => l_object_version_number
7089 ,p_input_value_id1 => l_input_value_id1
7090 ,p_entry_value1 => l_value1
7091 ,p_input_value_id2 => l_input_value_id2
7092 ,p_entry_value2 => l_value2
7093 ,p_input_value_id3 => l_input_value_id3
7094 ,p_entry_value3 => l_value3
7095 ,p_effective_start_date => l_effective_start_date
7096 ,p_effective_end_date => l_effective_end_date
7097 ,p_update_warning => l_update_warning);
7098
7099 create_incentive_remark(p_pa_request_id => p_pa_request_id,
7100 p_effective_date => p_effective_date,
7101 p_category => 'Installment '||to_char(l_element_ctr),
7102 p_noa_code => '825',
7103 p_percent => NULL,
7104 p_amount => l_value1,
7105 p_payment_date => l_value2,
7106 p_end_date => NULL);
7107 Exception
7108 when others then
7109 rollback to upd_ent;
7110 raise;
7111 End;
7112 l_ctr := 0;
7113 END IF;
7114 END IF;
7115 END LOOP;
7116 END Upd_sep_incn_elements;
7117
7118
7119 -- Bug#4486823 RRR Changes
7120 -- This procedure processes the elements for Incentive Family.
7121 -- Depending on the user entry, the related elements will be processed.
7122 PROCEDURE process_incentive_elements(p_pa_request_id IN ghr_pa_requests.pa_request_id%TYPE
7123 ,p_assignment_id IN ghr_pa_requests.employee_assignment_id%TYPE
7124 ,p_effective_date IN ghr_pa_requests.effective_date%TYPE
7125 ,p_payment_option IN ghr_pa_requests.pa_incentive_payment_option%TYPE
7126 ,p_first_noa_code IN ghr_pa_requests.first_noa_code%TYPE
7127 ,p_second_noa_code IN ghr_pa_requests.second_noa_code%TYPE
7128 ,p_total_amount IN ghr_pa_requests.to_total_salary%TYPE
7129 ) IS
7130
7131 Cursor c_inc_catg_details(l_pa_request_id NUMBER) IS
7132 SELECT pa_incentive_category,
7133 pa_incentive_category_amount,
7134 pa_incentive_category_percent,
7135 pa_incentive_category_pmnt_dt,
7136 pa_incentive_category_end_date
7137 FROM ghr_pa_incentives
7138 where pa_request_id = l_pa_request_id
7139 order by pa_incentive_category_pmnt_dt;
7140
7141 l_installment_ctr NUMBER(10);
7142 l_payment_type VARCHAR2(150);
7143 l_noa_code VARCHAR2(150);
7144 l_session ghr_history_api.g_session_var_type;
7145
7146 BEGIN
7147 hr_utility.set_location('Entering process_incentive_elements'||p_pa_request_id,0);
7148 l_installment_ctr := 0;
7149 ghr_history_api.get_g_session_var(l_session);
7150 IF l_session.noa_id_correct IS NOT NULL and
7151 p_payment_option = 'H' and
7152 (p_first_noa_code = '825' OR p_second_noa_code ='825') THEN
7153 Upd_sep_incn_elements(p_pa_request_id
7154 ,p_assignment_id
7155 ,p_effective_date
7156 ,p_payment_option
7157 ,p_first_noa_code
7158 ,p_second_noa_code);
7159 ELSE
7160 FOR c_incdet_rec IN c_inc_catg_details(p_pa_request_id)
7161 LOOP
7162 hr_utility.set_location('Inside For Loop, Category: '||c_incdet_rec.pa_incentive_category,10);
7163 hr_utility.set_location('Inside For Loop, NOA Code: '||p_first_noa_code,20);
7164 hr_utility.set_location('Inside For Loop, ASG ID : '||p_assignment_id,30);
7165 -- This is a special case. Till now, we have never created the same element twice in a
7166 -- single RPA action. If process_sf52_element is called, only one of these two elements
7167 -- will be updated with both the values.And the latest values will retain. To avoid that,
7168 -- update the elements separately here itself.
7169
7170
7171 IF c_incdet_rec.pa_incentive_category = 'Biweekly' THEN
7172 l_payment_type := c_incdet_rec.pa_incentive_category;
7173 IF p_first_noa_code = '815' OR
7174 (p_first_noa_code = '002' AND p_second_noa_code = '815') THEN
7175 ghr_element_api.process_sf52_element
7176 (p_assignment_id => p_assignment_id
7177 ,p_element_name => 'Recruitment Incentive Biweekly'
7178 ,p_input_value_name1 => 'Biweekly Amount'
7179 ,p_value1 => c_incdet_rec.pa_incentive_category_amount
7180 ,p_input_value_name2 => 'Total Amount'
7181 ,p_value2 => p_total_amount
7182 ,p_input_value_name3 => 'Payment Option'
7183 ,p_value3 => p_payment_option
7184 ,p_input_value_name4 => 'Payment Type'
7185 ,p_value4 => l_payment_type
7186 ,p_value15 => c_incdet_rec.pa_incentive_category_end_date
7187 ,p_effective_date => c_incdet_rec.pa_incentive_category_pmnt_dt
7188 ,p_process_warning => l_warning
7189 );
7190 END IF;
7191 IF (p_first_noa_code = '816') OR
7192 (p_first_noa_code = '002' AND p_second_noa_code = '816') THEN
7193 ghr_element_api.process_sf52_element
7194 (p_assignment_id => p_assignment_id
7195 ,p_element_name => 'Relocation Incentive Biweekly'
7196 ,p_input_value_name1 => 'Biweekly Amount'
7197 ,p_value1 => c_incdet_rec.pa_incentive_category_amount
7198 ,p_input_value_name2 => 'Total Amount'
7199 ,p_value2 => p_total_amount
7200 ,p_input_value_name3 => 'Payment Option'
7201 ,p_value3 => p_payment_option
7202 ,p_input_value_name4 => 'Payment Type'
7203 ,p_value4 => l_payment_type
7204 ,p_value15 => c_incdet_rec.pa_incentive_category_end_date
7205 ,p_effective_date => c_incdet_rec.pa_incentive_category_pmnt_dt
7206 ,p_process_warning => l_warning
7207 );
7208 END IF;
7209
7210 -- Bug#3941541 Separation Incentive Elements.
7211 IF (p_first_noa_code = '825') OR
7212 (p_second_noa_code = '825') OR
7213 (p_first_noa_code = '002' AND p_second_noa_code = '825') THEN
7214 ghr_element_api.process_sf52_element
7215 (p_assignment_id => p_assignment_id
7216 ,p_element_name => 'Separation Incentive Biweekly'
7217 ,p_input_value_name1 => 'Biweekly Amount'
7218 ,p_value1 => c_incdet_rec.pa_incentive_category_amount
7219 ,p_input_value_name2 => 'Total Amount'
7220 ,p_value2 => p_total_amount
7221 ,p_input_value_name3 => 'Payment Start Date'
7222 ,p_value3 => c_incdet_rec.pa_incentive_category_pmnt_dt
7223 ,p_input_value_name4 => 'Payment End Date'
7224 ,p_value4 => c_incdet_rec.pa_incentive_category_end_date
7225 ,p_effective_date => p_effective_date
7226 ,p_process_warning => l_warning
7227 );
7228 END IF;
7229 -- End of Bug#3941541
7230
7231 IF (p_first_noa_code = '827') OR
7232 (p_first_noa_code = '002' AND p_second_noa_code = '827') THEN
7233 -- Bug#5039100
7234 --This code is commented for the bug#5307606
7235 /* IF p_payment_option = 'B' AND c_incdet_rec.pa_incentive_category_percent = 0 THEN
7236 ghr_element_api.process_sf52_element
7237 (p_assignment_id => p_assignment_id
7238 ,p_element_name => 'Retention Incentive Biweekly'
7239 ,p_input_value_name1 => 'Percent'
7240 ,p_value1 => c_incdet_rec.pa_incentive_category_percent
7241 ,p_input_value_name2 => 'Payment Option'
7242 ,p_value2 => p_payment_option
7243 ,p_input_value_name3 => 'Payment Type'
7244 ,p_value3 => l_payment_type
7245 ,p_effective_date => c_incdet_rec.pa_incentive_category_pmnt_dt
7246 ,p_process_warning => l_warning
7247 );
7248
7249 ELSE*/
7250 --This code is commented for the bug#5307606
7251
7252 ghr_element_api.process_sf52_element
7253 (p_assignment_id => p_assignment_id
7254 ,p_element_name => 'Retention Incentive Biweekly'
7255 ,p_input_value_name1 => 'Percent'
7256 ,p_value1 => c_incdet_rec.pa_incentive_category_percent
7257 ,p_input_value_name2 => 'Payment Option'
7258 ,p_value2 => p_payment_option
7259 ,p_input_value_name3 => 'Payment Type'
7260 ,p_value3 => l_payment_type
7261 ,p_value15 => c_incdet_rec.pa_incentive_category_end_date
7262 ,p_effective_date => c_incdet_rec.pa_incentive_category_pmnt_dt
7263 ,p_process_warning => l_warning
7264 );
7265 -- END IF; --This code is commented for the bug#5307606
7266 END IF;
7267 ELSE
7268 IF c_incdet_rec.pa_incentive_category = 'Installment' THEN
7269 l_installment_ctr := l_installment_ctr + 1;
7270 l_payment_type := c_incdet_rec.pa_incentive_category ||' '|| to_char(l_installment_ctr);
7271 ELSE
7272 l_payment_type := c_incdet_rec.pa_incentive_category ;
7273 END IF;
7274 IF p_first_noa_code = '815' OR
7275 (p_first_noa_code = '002' AND p_second_noa_code = '815') THEN
7276 ghr_element_api.process_sf52_element
7277 (p_assignment_id => p_assignment_id
7278 ,p_element_name => 'Recruitment Incentive Lump Sum'
7279 ,p_input_value_name1 => 'Percent'
7280 ,p_value1 => c_incdet_rec.pa_incentive_category_percent
7281 ,p_input_value_name2 => 'Amount'
7282 ,p_value2 => c_incdet_rec.pa_incentive_category_amount
7283 ,p_input_value_name3 => 'Payment Option'
7284 ,p_value3 => p_payment_option
7285 ,p_input_value_name4 => 'Payment Type'
7286 ,p_value4 => l_payment_type
7287 ,p_effective_date => c_incdet_rec.pa_incentive_category_pmnt_dt
7288 ,p_process_warning => l_warning
7289 );
7290 END IF;
7291 IF (p_first_noa_code = '816') OR
7292 (p_first_noa_code = '002' AND p_second_noa_code = '816') THEN
7293 ghr_element_api.process_sf52_element
7294 (p_assignment_id => p_assignment_id
7295 ,p_element_name => 'Relocation Incentive Lump Sum'
7296 ,p_input_value_name1 => 'Percent'
7297 ,p_value1 => c_incdet_rec.pa_incentive_category_percent
7298 ,p_input_value_name2 => 'Amount'
7299 ,p_value2 => c_incdet_rec.pa_incentive_category_amount
7300 ,p_input_value_name3 => 'Payment Option'
7301 ,p_value3 => p_payment_option
7302 ,p_input_value_name4 => 'Payment Type'
7303 ,p_value4 => l_payment_type
7304 ,p_effective_date => c_incdet_rec.pa_incentive_category_pmnt_dt
7305 ,p_process_warning => l_warning
7306 );
7307 END IF;
7308
7309 -- Bug#3941541 Separation Incentive Elements.
7310 IF (p_first_noa_code = '825') OR
7311 (p_second_noa_code = '825') OR
7312 (p_first_noa_code = '002' AND p_second_noa_code = '825') THEN
7313 ghr_element_api.process_sf52_element
7314 (p_assignment_id => p_assignment_id
7315 ,p_element_name => 'Separation Incentive Lump Sum'
7316 ,p_input_value_name1 => 'Amount'
7317 ,p_value1 => c_incdet_rec.pa_incentive_category_amount
7318 ,p_input_value_name2 => 'Payment Date'
7319 ,p_value2 => c_incdet_rec.pa_incentive_category_pmnt_dt
7320 ,p_input_value_name3 => 'Payment Option'
7321 ,p_value3 => p_payment_option
7322 ,p_effective_date => p_effective_date
7323 ,p_process_warning => l_warning
7324 );
7325 END IF;
7326 -- End of Bug#3941541
7327
7328 IF (p_first_noa_code = '827') OR
7329 (p_first_noa_code = '002' AND p_second_noa_code = '827') THEN
7330 ghr_element_api.process_sf52_element
7331 (p_assignment_id => p_assignment_id
7332 ,p_element_name => 'Retention Incentive Lump Sum'
7333 ,p_input_value_name1 => 'Percent'
7334 ,p_value1 => c_incdet_rec.pa_incentive_category_percent
7335 ,p_input_value_name2 => 'Payment Option'
7336 ,p_value2 => p_payment_option
7337 ,p_input_value_name3 => 'Payment Type'
7338 ,p_value3 => l_payment_type
7339 ,p_effective_date => c_incdet_rec.pa_incentive_category_pmnt_dt
7340 ,p_process_warning => l_warning
7341 );
7342 END IF;
7343 END IF;
7344 IF p_first_noa_code IN ('001','002') THEN
7345 l_noa_code := p_second_noa_code;
7346 ELSE
7347 l_noa_code := p_first_noa_code;
7348 END IF;
7349 create_incentive_remark(p_pa_request_id => p_pa_request_id,
7350 p_effective_date => p_effective_date,
7351 p_category => l_payment_type,
7352 p_noa_code => l_noa_code,
7353 p_percent => c_incdet_rec.pa_incentive_category_percent,
7354 p_amount => c_incdet_rec.pa_incentive_category_amount,
7355 p_payment_date => c_incdet_rec.pa_incentive_category_pmnt_dt,
7356 p_end_date => c_incdet_rec.pa_incentive_category_end_date);
7357
7358 END LOOP;
7359 END IF;
7360 END process_incentive_elements;
7361
7362 Begin
7363
7364 --
7365 -- Remember IN OUT parameter IN values
7366 --
7367 l_recruitment_bonus := p_recruitment_bonus;
7368 l_relocation_bonus := p_relocation_bonus;
7369 l_student_loan_repay := p_student_loan_repay;
7370
7371 l_gov_award := p_gov_award;
7372 l_entitlement := p_entitlement;
7373 l_foreign_lang_prof_pay := p_foreign_lang_prof_pay;
7374 -- Bug# 3385386
7375 l_fta := p_fta;
7376 l_edp_pay := p_edp_pay;
7377 l_hazard_pay := p_hazard_pay;
7378 l_health_benefits := p_health_benefits;
7379 l_danger_pay := p_danger_pay;
7380 l_imminent_danger_pay := p_imminent_danger_pay;
7381 l_living_quarters_allow := p_living_quarters_allow;
7382 l_post_diff_amt := p_post_diff_amt;
7383 l_post_diff_percent := p_post_diff_percent;
7384 l_sep_maintenance_allow := p_sep_maintenance_allow;
7385 l_supplemental_post_allow := p_supplemental_post_allow;
7386 l_temp_lodge_allow := p_temp_lodge_allow;
7387 l_premium_pay := p_premium_pay;
7388 l_retirement_annuity := p_retirement_annuity;
7389 l_severance_pay := p_severance_pay;
7390 l_thrift_saving_plan := p_thrift_saving_plan;
7391 l_health_ben_pre_tax := p_health_ben_pre_tax;
7392 --Bug # 13571004
7393 l_tsp_roth := p_tsp_roth;
7394
7395 --
7396 --
7397 If p_pa_request_rec.first_noa_code = '866' then
7398 l_effective_date := trunc(p_pa_request_rec.effective_date + 1 );
7399 Else
7400 l_effective_date := trunc(p_pa_request_rec.effective_date);
7401 End if;
7402 -------Bug 5913362 -- Adding 890
7403 /**** Here for 890 date is not like 866.
7404 if p_pa_request_rec.first_noa_code = '890' AND
7405 p_pa_request_rec.input_pay_rate_determinant in ('A','B','E','F','U','V') then
7406 l_effective_date := trunc(p_pa_request_rec.effective_date + 1 );
7407 Else
7408 l_effective_date := trunc(p_pa_request_rec.effective_date);
7409 End if;
7410 ****/
7411
7412 hr_utility.set_location('Entering ' || l_proc,5);
7413 -- Processing FEGLI
7414
7415 --
7416 If p_pa_request_rec.fegli is not null then
7417 hr_utility.set_location(l_proc,10);
7418 -- BEN_EIT Changes Commented the following code
7419 -- as input value2 is moved to Benefits EIT
7420 /* -- Bug 3238026 Added condition for CHG_FEGLI
7421 IF (p_pa_request_rec.noa_family_code = 'CHG_FEGLI') THEN
7422 hr_utility.set_location('Entering IF fegli',123456);
7423 ghr_element_api.process_sf52_element
7424 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7425 ,p_element_name => 'FEGLI'
7426 ,p_input_value_name1 => 'FEGLI'
7427 -- Bug#2759379 Added Input Value2 here.
7428 ,p_input_value_name2 => 'Eligibility Expiration'
7429 ,p_value2 =>
7430 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_fegli.eligibility_expiration))
7431 ,p_value1 => p_pa_request_rec.fegli
7432 ,p_effective_date => l_effective_date
7433 ,p_process_warning => l_warning
7434 );
7435 ELSE
7436 */
7437 hr_utility.set_location('Entering ELSE fegli',123456);
7438 ghr_element_api.process_sf52_element
7439 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7440 ,p_element_name => 'FEGLI'
7441 ,p_input_value_name1 => 'FEGLI'
7442 ,p_value1 => p_pa_request_rec.fegli
7443 ,p_effective_date => l_effective_date
7444 ,p_process_warning => l_warning
7445 );
7446 -- END IF;
7447 -- End Bug 3238026
7448
7449 /* To be included after Martin Reid's element api handles the create and update warning
7450 if l_fegli_warn = FALSE then
7451 hr_utility.set_message(8301,'GHR_38141_FAIL_TO_UPD_FEGLI');
7452 hr_utility.raise_error;
7453 end if;
7454 */
7455 END IF;
7456 --
7457 -- Processing retirement plan
7458 --
7459 If p_pa_request_rec.retirement_plan is not null then
7460 hr_utility.set_location(l_proc,20);
7461 ghr_element_api.process_sf52_element
7462 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7463 ,p_element_name => 'Retirement Plan'
7464 ,p_input_value_name1 => 'Plan'
7465 ,p_value1 => p_pa_request_rec.retirement_plan
7466 ,p_effective_date => l_effective_date
7467 ,p_process_warning => l_warning
7468 );
7469 --
7470 /*
7471 if l_retirement_plan_warn = FALSE then
7472 hr_utility.set_message(8301,'GHR_38142_FAIL_TO_UPD_RET_PLN');
7473 hr_utility.raise_error;
7474 end if;
7475 */
7476 end if;
7477 --
7478 --
7479 -- Processing recruitment bonus
7480 --
7481 If p_recruitment_bonus.p_recruitment_bonus is not null or
7482 p_recruitment_bonus.p_date_recruit_exp is not null then
7483 hr_utility.set_location(l_proc,30);
7484 hr_utility.set_location(l_proc || p_recruitment_bonus.p_date_recruit_exp,31);
7485 hr_utility.set_location(l_proc ||to_char(p_pa_request_rec.employee_assignment_id),35);
7486 ghr_element_api.process_sf52_element
7487 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7488 ,p_element_name => 'Recruitment Bonus'
7489 ,p_input_value_name1 => 'Amount'
7490 ,p_value1 => p_recruitment_bonus.p_recruitment_bonus
7491 ,p_input_value_name2 => 'Expiration Date'
7492 ,p_value2 =>
7493 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_recruitment_bonus.p_date_recruit_exp)) --AVR
7494 ,p_input_value_name3 => 'Percentage'
7495 ,p_value3 => p_recruitment_bonus.p_percentage
7496
7497 ,p_effective_date => l_effective_date
7498 ,p_process_warning => l_warning
7499 );
7500
7501 /*
7502 if l_recruitment_bonus_warn = FALSE then
7503 hr_utility.set_message(8301,'GHR_38143_FAIL_TO_UPD_RCRT_BON');
7504 hr_utility.raise_error;
7505 end if;
7506 */
7507 end if;
7508 --
7509 -- Processing relocation bonus
7510 --
7511 hr_utility.set_location('Rel. Bonus' || p_relocation_bonus.p_relocation_bonus,1);
7512 If p_relocation_bonus.p_relocation_bonus is not null or
7513 p_relocation_bonus.p_date_reloc_exp is not null then
7514 hr_utility.set_location(l_proc,40);
7515 ghr_element_api.process_sf52_element
7516 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7517 ,p_element_name => 'Relocation Bonus'
7518 ,p_input_value_name1 => 'Amount'
7519 ,p_value1 => p_relocation_bonus.p_relocation_bonus
7520 ,p_input_value_name2 => 'Expiration Date'
7521 ,p_value2 =>
7522 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_relocation_bonus.p_date_reloc_exp)) --AVR
7523 ,p_input_value_name3 => 'Percentage'
7524 ,p_value3 => p_relocation_bonus.p_percentage
7525 ,p_effective_date => l_effective_date
7526 ,p_process_warning => l_warning
7527 );
7528 --
7529 /*
7530 if l_relocation_bonus_warn = FALSE then
7531 hr_utility.set_message(8301,'GHR_38144_FAIL_TO_UPD_REL_BON');
7532 hr_utility.raise_error;
7533 end if;
7534 */
7535 end if;
7536 --
7537 -- Student Loan Repayment Changes
7538 If p_pa_request_rec.first_noa_code = '817' or p_pa_request_rec.second_noa_code = '817' then
7539 If p_student_loan_repay.p_amount is not null or
7540 p_student_loan_repay.p_review_date is not null then
7541 IF (p_student_loan_repay.p_repay_schedule = 'L') THEN
7542 hr_utility.set_location(l_proc,40);
7543 ghr_element_api.process_sf52_element
7544 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7545 ,p_element_name => 'Student Loan Repayment LumpSum'
7546 ,p_input_value_name1 => 'Amount'
7547 ,p_value1 => p_student_loan_repay.p_amount
7548 ,p_input_value_name2 => 'Review Date'
7549 ,p_value2 =>
7550 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_student_loan_repay.p_review_date))
7551 ,p_effective_date => l_effective_date
7552 ,p_process_warning => l_warning
7553 );
7554 ELSIF (p_student_loan_repay.p_repay_schedule = 'R') THEN
7555 hr_utility.set_location(l_proc,40);
7556 ghr_element_api.process_sf52_element
7557 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7558 ,p_element_name => 'Student Loan Repayment'
7559 ,p_input_value_name1 => 'Amount'
7560 ,p_value1 => (p_student_loan_repay.p_amount)
7561 ,p_input_value_name2 => 'Review Date'
7562 ,p_value2 =>
7563 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_student_loan_repay.p_review_date))
7564 ,p_effective_date => l_effective_date
7565 ,p_process_warning => l_warning
7566 );
7567 END IF;
7568 --
7569 end if;
7570 END IF;
7571 --
7572 -- processing awards_bonus
7573 --
7574 If p_gov_award.award_flag = 'Y' then
7575 hr_utility.set_location(l_proc,50);
7576 hr_utility.set_location('Date awRd' || p_gov_award.date_award_earned,1);
7577 hr_utility.set_location('Award Agency ' || p_gov_award.award_Agency,1);
7578 hr_utility.set_location('Award Percentage ' || p_pa_request_rec.award_percentage,1);
7579 hr_utility.set_location('Date Exemp' || p_gov_award.date_exemp_award,1);
7580 -- Bug # 1061084
7581 hr_utility.set_location('Appropriation Code' || p_gov_award.award_appropriation_code,1);
7582 ghr_element_api.process_sf52_element
7583 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7584 ,p_element_name => 'Federal Awards'
7585 ,p_input_value_name1 => 'Award Agency'
7586 ,p_value1 => p_gov_award.award_agency
7587 ,p_input_value_name2 => 'Award Type'
7588 ,p_value2 => p_gov_award.award_type
7589 ,p_input_value_name3 => 'Amount or Hours'
7590 ,p_value3 => p_pa_request_rec.award_amount
7591 ,p_input_value_name4 => 'Percentage'
7592 ,p_value4 => p_pa_request_rec.award_percentage
7593 ,p_input_value_name5 => 'Group Award'
7594 ,p_value5 => p_gov_award.group_award
7595 ,p_input_value_name6 => 'Tangible Benefit Dollars'
7596 ,p_value6 => p_gov_award.tangible_benefit_dollars
7597 ,p_input_value_name8 => 'Date Award Earned'
7598 ,p_value8 =>
7599 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_gov_award.date_award_earned)) --AVR
7600 ,p_input_value_name9 => 'Appropriation Code'
7601 ,p_value9 => p_gov_award.award_appropriation_code
7602 ,p_input_value_name10 => 'Date Ex Emp Award Paid'
7603 ,p_value10 =>
7604 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_gov_award.date_exemp_award))
7605 ,p_effective_date => l_effective_date
7606 ,p_process_warning => l_warning
7607 );
7608 End if;
7609 --
7610 -- process entitlement
7611 --
7612 if p_entitlement.entitlement_flag = 'Y' then
7613 hr_utility.set_location(l_proc,60);
7614 ghr_element_api.process_sf52_element
7615 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7616 ,p_element_name => 'Entitlement'
7617 ,p_input_value_name1 => 'Code'
7618 ,p_value1 => p_entitlement.entitlement_code
7619 ,p_input_value_name2 => 'Amount or Percent'
7620 ,p_value2 => p_entitlement.entitlement_amt_percent
7621 ,p_effective_date => l_effective_date
7622 ,p_process_warning => l_warning
7623 );
7624 end if;
7625 --
7626 -- process foreign lang profiency pay
7627 --
7628 if p_foreign_lang_prof_pay.for_lang_flag = 'Y' then
7629 hr_utility.set_location(l_proc,70);
7630 ghr_element_api.process_sf52_element
7631 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7632 ,p_element_name => 'Foreign Lang Proficiency Pay'
7633 ,p_input_value_name1 => 'Certification Date'
7634 ,p_value1 =>
7635 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_foreign_lang_prof_pay.certification_date)) --AVR
7636 ,p_input_value_name2 => 'Pay Level or Rate'
7637 ,p_value2 => p_foreign_lang_prof_pay.pay_level_or_rate
7638 ,p_effective_date => l_effective_date
7639 ,p_process_warning => l_warning
7640 );
7641 end if;
7642 --
7643 -- Bug#3385386 process foreign Transfer Allowance(FTA) element
7644 --
7645 if p_fta.fta_flag = 'Y' then
7646 hr_utility.set_location(l_proc,75);
7647 ghr_element_api.process_sf52_element
7648 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7649 ,p_element_name => 'Foreign Transfer Allowance'
7650 ,p_input_value_name1 => 'Last Action Code'
7651 ,p_value1 => p_fta.last_action_code
7652 ,p_input_value_name2 => 'Number Family Members'
7653 ,p_value2 => p_fta.number_family_members
7654 ,p_input_value_name3 => 'Miscellaneous Expense'
7655 ,p_value3 => p_fta.Miscellaneous_Expense
7656 ,p_input_value_name4 => 'Wardrobe Expense'
7657 ,p_value4 => p_fta.Wardrobe_Expense
7658 ,p_input_value_name5 => 'Pre Departure Sub Expense'
7659 ,p_value5 => p_fta.Pre_Departure_Subs_Expense
7660 ,p_input_value_name6 => 'Lease Penalty Expense'
7661 ,p_value6 => p_fta.Lease_Penalty_Expense
7662 ,p_input_value_name7 => 'Amount'
7663 ,p_value7 => p_fta.amount
7664 ,p_effective_date => l_effective_date
7665 ,p_process_warning => l_warning
7666 );
7667 end if;
7668 --
7669 -- process edp pay
7670 --
7671 if p_edp_pay.edp_flag = 'Y' then
7672 hr_utility.set_location(l_proc,80);
7673 ghr_element_api.process_sf52_element
7674 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7675 ,p_element_name => 'EDP Pay'
7676 ,p_input_value_name1 => 'Premium Pay Ind'
7677 ,p_value1 => p_edp_pay.premium_pay_indicator
7678 ,p_input_value_name2 => 'EDP Type'
7679 ,p_value2 => p_edp_pay.edp_type
7680 ,p_effective_date => l_effective_date
7681 ,p_process_warning => l_warning
7682 );
7683 end if;
7684 --
7685 --
7686 -- process hazard pay
7687 --
7688 if p_hazard_pay.hazard_flag = 'Y' then
7689 hr_utility.set_location(l_proc,85);
7690 ghr_element_api.process_sf52_element
7691 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7692 ,p_element_name => 'Hazard Pay'
7693 ,p_input_value_name1 => 'Premium Pay Ind'
7694 ,p_value1 => p_hazard_pay.premium_pay_indicator
7695 ,p_input_value_name2 => 'Hazard Type'
7696 ,p_value2 => p_hazard_pay.hazard_type
7697 ,p_effective_date => l_effective_date
7698 ,p_process_warning => l_warning
7699 );
7700 end if;
7701 --
7702 -- process health benefits
7703 -- Sundar Benefits EIT Enhancement
7704 if p_health_benefits.health_benefits_flag = 'Y' then
7705 hr_utility.set_location(l_proc,90);
7706 IF ghr_utility.is_ghr_ben_fehb = 'TRUE' THEN
7707 NULL;
7708 ELSE
7709 ghr_element_api.process_sf52_element
7710 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7711 ,p_element_name => 'Health Benefits'
7712 ,p_input_value_name1 => 'Enrollment'
7713 ,p_value1 => p_health_benefits.enrollment
7714 ,p_input_value_name2 => 'Health Plan'
7715 ,p_value2 => p_health_benefits.health_plan
7716 ,p_input_value_name3 => 'Temps Total Cost'
7717 ,p_value3 => p_health_benefits.temps_total_cost
7718 ,p_input_value_name4 => 'Pre tax Waiver'
7719 ,p_value4 => p_health_benefits.pre_tax_waiver
7720 ,p_effective_date => l_effective_date
7721 ,p_process_warning => l_warning
7722 );
7723 END IF; -- IF ghr_utility.is_ghr_ben_fehb THEN
7724 end if;
7725 --
7726 --
7727 -- process health benefits pre tax
7728 --
7729 if p_health_ben_pre_tax.health_ben_pre_tax_flag = 'Y' then
7730 hr_utility.set_location(l_proc,90);
7731 IF ghr_utility.is_ghr_ben_fehb = 'TRUE' THEN
7732 NULL;
7733 ELSE
7734 ghr_element_api.process_sf52_element
7735 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7736 ,p_element_name => 'Health Benefits Pre tax'
7737 ,p_input_value_name1 => 'Enrollment'
7738 ,p_value1 => p_health_ben_pre_tax.enrollment
7739 ,p_input_value_name2 => 'Health Plan'
7740 ,p_value2 => p_health_ben_pre_tax.health_plan
7741 ,p_input_value_name3 => 'Temps Total Cost'
7742 ,p_value3 => p_health_ben_pre_tax.temps_total_cost
7743 ,p_effective_date => l_effective_date
7744 ,p_process_warning => l_warning
7745 );
7746 END IF; -- IF ghr_utility.is_ghr_ben_fehb = TRUE THEN
7747 end if;
7748 --
7749 -- process danger pay
7750 --
7751 if p_danger_pay.danger_flag = 'Y' then
7752 hr_utility.set_location(l_proc,100);
7753 ghr_element_api.process_sf52_element
7754 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7755 ,p_element_name => 'Danger Pay'
7756 ,p_input_value_name1 => 'Last Action Code'
7757 ,p_value1 => p_danger_pay.last_action_code
7758 ,p_input_value_name2 => 'Location'
7759 ,p_value2 => p_danger_pay.location
7760 ,p_effective_date => l_effective_date
7761 ,p_process_warning => l_warning
7762 );
7763 end if;
7764 --
7765 -- process imminent danger pay
7766 --
7767 if p_imminent_danger_pay.imminent_danger_flag = 'Y' then
7768 hr_utility.set_location(l_proc,110);
7769 ghr_element_api.process_sf52_element
7770 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7771 ,p_element_name => 'Imminent Danger Pay'
7772 ,p_input_value_name1 => 'Amount'
7773 ,p_value1 => p_imminent_danger_pay.amount
7774 ,p_input_value_name2 => 'Last Action Code'
7775 ,p_value2 => p_imminent_danger_pay.last_action_code
7776 ,p_input_value_name3 => 'Location'
7777 ,p_value3 => p_imminent_danger_pay.location
7778 ,p_effective_date => l_effective_date
7779 ,p_process_warning => l_warning
7780 );
7781 end if;
7782 --
7783 -- process living_quarters_allow
7784 --
7785 if p_living_quarters_allow.living_quarters_allow_flag = 'Y' then
7786 hr_utility.set_location(l_proc,120);
7787 ghr_element_api.process_sf52_element
7788 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7789 ,p_element_name => 'Living Quarters Allowance'
7790 ,p_input_value_name1 => 'Purchase Amount'
7791 ,p_value1 => p_living_quarters_allow.purchase_amount
7792 ,p_input_value_name2 => 'Purchase Date'
7793 ,p_value2 =>
7794 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_living_quarters_allow.purchase_date)) --AVR
7795 ,p_input_value_name3 => 'Rent Amount'
7796 ,p_value3 => p_living_quarters_allow.rent_amount
7797 ,p_input_value_name4 => 'Utility Amount'
7798 ,p_value4 => p_living_quarters_allow.utility_amount
7799 ,p_input_value_name5 => 'Last Action Code'
7800 ,p_value5 => p_living_quarters_allow.last_action_code
7801 ,p_input_value_name6 => 'Location'
7802 ,p_value6 => p_living_quarters_allow.location
7803 ,p_input_value_name7 => 'Quarters Type'
7804 ,p_value7 => p_living_quarters_allow.quarters_type
7805 ,p_input_value_name8 => 'Shared Percent'
7806 ,p_value8 => p_living_quarters_allow.shared_percent
7807 ,p_input_value_name9 => 'Num Family Members'
7808 ,p_value9 => p_living_quarters_allow.no_of_family_members
7809 ,p_input_value_name10 => 'Summer Record Ind'
7810 ,p_value10 => p_living_quarters_allow.summer_record_ind
7811 ,p_input_value_name11 => 'Quarters Group'
7812 ,p_value11 => p_living_quarters_allow.quarters_group
7813 ,p_input_value_name12 => 'Currency'
7814 ,p_value12 => p_living_quarters_allow.currency
7815 ,p_effective_date => l_effective_date
7816 ,p_process_warning => l_warning
7817 );
7818 end if;
7819 --
7820 -- process post differential amount
7821 --
7822 if p_post_diff_amt.post_diff_amt_flag = 'Y' then
7823 hr_utility.set_location(l_proc,130);
7824 ghr_element_api.process_sf52_element
7825 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7826 -- ,p_element_name => 'Post Differential Amount' -- Bug 2645878 Elements renamed
7827 ,p_element_name => 'Post Allowance'
7828 ,p_input_value_name1 => 'Amount'
7829 ,p_value1 => p_post_diff_amt.amount
7830 ,p_input_value_name2 => 'Last Action Code'
7831 ,p_value2 => p_post_diff_amt.last_action_code
7832 ,p_input_value_name3 => 'Location'
7833 ,p_value3 => p_post_diff_amt.location
7834 ,p_input_value_name4 => 'Num Family Members'
7835 ,p_value4 => p_post_diff_amt.no_of_family_members
7836 ,p_effective_date => l_effective_date
7837 ,p_process_warning => l_warning
7838 );
7839 end if;
7840 --
7841 -- process post differential percent
7842 --
7843 if p_post_diff_percent.post_diff_percent_flag = 'Y' then
7844 hr_utility.set_location(l_proc,140);
7845 hr_utility.set_location('subbu'||p_post_diff_percent.percent,141);
7846 hr_utility.set_location('subbu'||p_post_diff_percent.last_action_code,142);
7847 hr_utility.set_location('subbu'||p_post_diff_percent.location,143);
7848
7849 ghr_element_api.process_sf52_element
7850 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7851 -- ,p_element_name => 'Post Differential Percent' -- Bug 2645878 Element renamed
7852 ,p_element_name => 'Post Differential'
7853 ,p_input_value_name1 => 'Percentage'
7854 ,p_value1 => p_post_diff_percent.percent
7855 ,p_input_value_name2 => 'Last Action Code'
7856 ,p_value2 => p_post_diff_percent.last_action_code
7857 ,p_input_value_name3 => 'Location'
7858 ,p_value3 => p_post_diff_percent.location
7859 ,p_effective_date => l_effective_date
7860 ,p_process_warning => l_warning
7861 );
7862 end if;
7863 --
7864 -- process sep_maintenance_allow
7865 --
7866 if p_sep_maintenance_allow.sep_maint_allow_flag = 'Y' then
7867 hr_utility.set_location(l_proc,150);
7868 ghr_element_api.process_sf52_element
7869 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7870 ,p_element_name => 'Separate Maintenance Allowance'
7871 ,p_input_value_name1 => 'Amount'
7872 ,p_value1 => p_sep_maintenance_allow.amount
7873 ,p_input_value_name2 => 'Last Action Code'
7874 ,p_value2 => p_sep_maintenance_allow.last_action_code
7875 ,p_input_value_name3 => 'Category'
7876 ,p_value3 => p_sep_maintenance_allow.category
7877 ,p_effective_date => l_effective_date
7878 ,p_process_warning => l_warning
7879 );
7880 end if;
7881 --
7882 -- process supplemental_post_allow
7883 --
7884 if p_supplemental_post_allow.sup_post_allow_flag = 'Y' then
7885 hr_utility.set_location(l_proc,160);
7886 ghr_element_api.process_sf52_element
7887 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7888 ,p_element_name => 'Supplemental Post Allowance'
7889 ,p_input_value_name1 => 'Amount'
7890 ,p_value1 => p_supplemental_post_allow.amount
7891 ,p_effective_date => l_effective_date
7892 ,p_process_warning => l_warning
7893 );
7894 end if;
7895 --
7896 -- process temp_lodge_allow
7897 --
7898 if p_temp_lodge_allow.temp_lodge_allow_flag = 'Y' then
7899 hr_utility.set_location(l_proc,170);
7900 ghr_element_api.process_sf52_element
7901 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7902 ,p_element_name => 'Temporary Lodging Allowance'
7903 ,p_input_value_name1 => 'Allowance Type'
7904 ,p_value1 => p_temp_lodge_allow.allowance_type
7905 ,p_input_value_name2 => 'Daily Rate'
7906 ,p_value2 => p_temp_lodge_allow.daily_rate
7907 ,p_effective_date => l_effective_date
7908 ,p_process_warning => l_warning
7909 );
7910 end if;
7911 --
7912 -- process premium_pay
7913 --
7914 if p_premium_pay.premium_pay_flag = 'Y' then
7915 hr_utility.set_location(l_proc,180);
7916 ghr_element_api.process_sf52_element
7917 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7918 ,p_element_name => 'Premium Pay'
7919 ,p_input_value_name1 => 'Premium Pay Ind'
7920 ,p_value1 => p_premium_pay.premium_pay_ind
7921 ,p_input_value_name2 => 'Amount'
7922 ,p_value2 => p_premium_pay.amount
7923 ,p_effective_date => l_effective_date
7924 ,p_process_warning => l_warning
7925 );
7926 end if;
7927 --
7928 -- process retirement_annuity
7929 --
7930 if p_retirement_annuity.retirement_annuity_flag = 'Y' then
7931 hr_utility.set_location(l_proc,190);
7932 ghr_element_api.process_sf52_element
7933 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7934 ,p_element_name => 'Retirement Annuity'
7935 ,p_input_value_name1 => 'Sum'
7936 ,p_value1 => p_retirement_annuity.annuity_sum
7937 ,p_input_value_name2 => 'Eligibility Expires'
7938 ,p_value2 =>
7939 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_retirement_annuity.eligibility_expires)) --AVR
7940 ,p_effective_date => l_effective_date
7941 ,p_process_warning => l_warning
7942 );
7943 end if;
7944 --
7945 -- process severance_pay
7946 --
7947 if p_severance_pay.severance_pay_flag = 'Y' then
7948 hr_utility.set_location(l_proc,200);
7949 ghr_element_api.process_sf52_element
7950 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7951 ,p_element_name => 'Severance Pay'
7952 ,p_input_value_name1 => 'Amount'
7953 ,p_value1 => p_severance_pay.amount
7954 ,p_input_value_name2 => 'Total Entitlement Weeks'
7955 ,p_value2 => p_severance_pay.total_entitlement_weeks
7956 ,p_input_value_name3 => 'Number Weeks Paid'
7957 ,p_value3 => p_severance_pay.number_weeks_paid
7958 ,p_input_value_name4 => 'Weekly Amount'
7959 ,p_value4 => p_severance_pay.weekly_amount
7960 ,p_effective_date => l_effective_date
7961 ,p_process_warning => l_warning
7962 );
7963 end if;
7964 --
7965 -- process thrift_saving_plan
7966 --
7967 if p_thrift_saving_plan.tsp_flag = 'Y' then
7968 hr_utility.set_location(l_proc,210);
7969 IF ghr_utility.is_ghr_ben_tsp = 'TRUE' THEN
7970 NULL;
7971 ELSE
7972 -- Bug#4582970 Removed Agncy Elig Date, Emp Elig Date values.
7973 ghr_element_api.process_sf52_element
7974 (p_assignment_id => p_pa_request_rec.employee_assignment_id
7975 ,p_element_name => 'TSP'
7976 ,p_input_value_name1 => 'Amount'
7977 ,p_value1 => p_thrift_saving_plan.amount
7978 ,p_input_value_name2 => 'Rate'
7979 ,p_value2 => p_thrift_saving_plan.rate
7980 ,p_input_value_name6 => 'Status'
7981 ,p_value6 => p_thrift_saving_plan.status
7982 ,p_input_value_name7 => 'Status Date'
7983 ,p_value7 =>
7984 fnd_date.date_to_displaydate(fnd_date.canonical_to_date(p_thrift_saving_plan.status_date)) --AVR
7985 ,p_effective_date => l_effective_date
7986 ,p_process_warning => l_warning
7987 );
7988 END IF; -- IF ghr_utility.is_ghr_ben_tsp
7989 end if;
7990
7991
7992 --
7993 -- BUG # 13571004 process TSP Roth
7994 --
7995 if p_tsp_roth.tsp_roth_flag = 'Y' then
7996 hr_utility.set_location(l_proc,212);
7997 IF ghr_utility.is_ghr_ben_tsp = 'TRUE' THEN
7998 NULL;
7999 ELSE
8000 ghr_element_api.process_sf52_element
8001 (p_assignment_id => p_pa_request_rec.employee_assignment_id
8002 ,p_element_name => 'TSP ROTH 401K'
8003 ,p_input_value_name1 => 'TSP Roth 401K Amount'
8004 ,p_value1 => p_tsp_roth.tsp_roth_401k_amount
8005 ,p_input_value_name2 => 'TSP Roth 401K Rate'
8006 ,p_value2 => p_tsp_roth.tsp_roth_401k_rate
8007 ,p_effective_date => l_effective_date
8008 ,p_process_warning => l_warning
8009 );
8010 END IF; -- IF ghr_utility.is_ghr_ben_tsp
8011 end if;
8012
8013
8014 --
8015 --Pradeep.
8016 --Process MDDDS Special Pay
8017 if p_mddds_special_pay.mddds_special_pay_flag = 'Y' then
8018 hr_utility.set_location(l_proc,215);
8019
8020 --Bug 3531369
8021 p_mddds_special_pay.amount := NVL(p_mddds_special_pay.Full_Time_Status,0) + NVL(p_mddds_special_pay.Length_of_Service,0) +
8022 NVL(p_mddds_special_pay.Scarce_Specialty,0) + NVL(p_mddds_special_pay.Specialty_or_Board_Cert,0) +
8023 NVL(p_mddds_special_pay.Geographic_Location,0) + NVL(p_mddds_special_pay.Exceptional_Qualifications,0) +
8024 NVL(p_mddds_special_pay.Executive_Position,0) + NVL(p_mddds_special_pay.Dentist_post_graduate_training,0);
8025 --Bug 3531369
8026 ghr_element_api.process_sf52_element
8027 (p_assignment_id => p_pa_request_rec.employee_assignment_id
8028 ,p_element_name => 'MDDDS Special Pay'
8029 ,p_input_value_name1 => 'Full Time Status'
8030 ,p_value1 => p_mddds_special_pay.Full_Time_Status
8031 ,p_input_value_name2 => 'Length of Service'
8032 ,p_value2 => p_mddds_special_pay.Length_of_Service
8033 ,p_input_value_name3 => 'Scarce Specialty'
8034 ,p_value3 => p_mddds_special_pay.Scarce_Specialty
8035 ,p_input_value_name4 => 'Specialty or Board Certification'
8036 ,p_value4 => p_mddds_special_pay.Specialty_or_Board_Cert
8037 ,p_input_value_name5 => 'Geographic Location'
8038 ,p_value5 => p_mddds_special_pay.Geographic_Location
8039 ,p_input_value_name6 => 'Exceptional Qualifications'
8040 ,p_value6 => p_mddds_special_pay.Exceptional_Qualifications
8041 ,p_input_value_name7 => 'Executive Position'
8042 ,p_value7 => p_mddds_special_pay.Executive_Position
8043 ,p_input_value_name8 => 'Dentist Post Graduate Training'
8044 ,p_value8 => p_mddds_special_pay.Dentist_post_graduate_training
8045 ,p_input_value_name9 => 'Amount'
8046 ,p_value9 => p_mddds_special_pay.amount
8047 ,p_input_value_name10 => 'MDDDS Special Pay NTE Date'
8048 ,p_value10 => fnd_date.date_to_displaydate(p_mddds_special_pay.mddds_special_pay_date)
8049 ,p_effective_date => l_effective_date
8050 ,p_process_warning => l_warning
8051 );
8052 end if;
8053
8054 --
8055 --Pradeep
8056 If p_mddds_special_pay.premium_pay_ind is not null then
8057 hr_utility.set_location(l_proc,220);
8058 ghr_element_api.process_sf52_element
8059 (p_assignment_id => p_pa_request_rec.employee_assignment_id
8060 ,p_element_name => 'Premium Pay'
8061 ,p_input_value_name1 => 'Premium Pay Ind'
8062 --,p_value1 => p_premium_pay.premium_pay_ind
8063 --Pradeep changed this as one EIT for both Premium pay and MD/DDS Special Pay
8064 ,p_value1 => p_mddds_special_pay.premium_pay_ind
8065 ,p_effective_date => l_effective_date
8066 ,p_process_warning => l_warning
8067 );
8068 end if;
8069 --
8070
8071 --
8072 --Pradeep
8073 If p_premium_pay_ind.premium_pay_ind is not null then
8074 hr_utility.set_location(l_proc,225);
8075 ghr_element_api.process_sf52_element
8076 (p_assignment_id => p_pa_request_rec.employee_assignment_id
8077 ,p_element_name => 'Premium Pay'
8078 ,p_input_value_name1 => 'Premium Pay Ind'
8079 ,p_value1 => p_premium_pay_ind.premium_pay_ind
8080 ,p_effective_date => l_effective_date
8081 ,p_process_warning => l_warning
8082 );
8083 end if;
8084
8085
8086 -- Bug#4486823 RRR Changes
8087 -- Process Incentive elements
8088 hr_utility.set_location('first noa '||p_pa_request_rec.first_noa_code ||';second noa :'||p_pa_request_rec.second_noa_code,50);
8089 hr_utility.set_location('noa family :'||p_pa_request_rec.noa_family_code,55);
8090 IF (p_pa_request_rec.noa_family_code = 'GHR_INCENTIVE') OR
8091 (p_pa_request_rec.first_noa_code = '002' AND p_pa_request_rec.second_noa_desc like '%Incentive%') OR
8092 (p_pa_request_rec.first_noa_code = '825' OR p_pa_request_rec.second_noa_code = '825' ) THEN
8093 hr_utility.set_location('before calling process_incentive_elements'||p_pa_request_rec.pa_request_id,10);
8094 IF p_pa_request_rec.pa_incentive_payment_option = 'B' THEN
8095 l_total_salary := p_pa_request_rec.to_total_salary;
8096 ELSE
8097 l_total_salary := NULL;
8098 END IF;
8099 process_incentive_elements(p_pa_request_id => p_pa_request_rec.pa_request_id,
8100 p_assignment_id => p_pa_request_rec.employee_assignment_id,
8101 p_effective_date => p_pa_request_rec.effective_date,
8102 p_payment_option => p_pa_request_rec.pa_incentive_payment_option,
8103 p_first_noa_code => p_pa_request_rec.first_noa_code,
8104 p_second_noa_code => p_pa_request_rec.second_noa_code,
8105 p_total_amount => l_total_salary
8106 );
8107 END IF;
8108 --
8109
8110 hr_utility.set_location('Leaving ' ||l_proc,60);
8111 --
8112 Exception when others then
8113 --
8114 -- Reset IN OUT parameters and set OUT parameters
8115 --
8116 p_recruitment_bonus := l_recruitment_bonus;
8117 p_relocation_bonus := l_relocation_bonus;
8118 p_student_loan_repay := l_student_loan_repay;
8119 p_gov_award := l_gov_award;
8120 p_entitlement := l_entitlement;
8121 p_foreign_lang_prof_pay := l_foreign_lang_prof_pay;
8122 p_fta := l_fta;
8123 p_edp_pay := l_edp_pay;
8124 p_hazard_pay := l_hazard_pay;
8125 p_health_benefits := l_health_benefits;
8126 p_danger_pay := l_danger_pay;
8127 p_imminent_danger_pay := l_imminent_danger_pay;
8128 p_living_quarters_allow := l_living_quarters_allow;
8129 p_post_diff_amt := l_post_diff_amt;
8130 p_post_diff_percent := l_post_diff_percent;
8131 p_sep_maintenance_allow := l_sep_maintenance_allow;
8132 p_supplemental_post_allow := l_supplemental_post_allow;
8133 p_temp_lodge_allow := l_temp_lodge_allow;
8134 p_premium_pay := l_premium_pay;
8135 p_retirement_annuity := l_retirement_annuity;
8136 p_severance_pay := l_severance_pay;
8137 p_thrift_saving_plan := l_thrift_saving_plan;
8138 p_health_ben_pre_tax := l_health_ben_pre_tax;
8139 p_tsp_roth := l_tsp_roth;
8140 raise;
8141
8142 END Process_non_salary_Info;
8143 --
8144 --
8145 --
8146 Procedure get_wgi_dates
8147 (p_pa_request_rec in ghr_pa_requests%rowtype,
8148 p_wgi_due_date in out nocopy date,
8149 p_wgi_pay_date out nocopy date,
8150 p_retained_grade_rec out nocopy ghr_pay_calc.retained_grade_rec_type,
8151 p_dlei in date
8152 )
8153 is
8154
8155 l_proc varchar2(72) := 'get_wgi_dates';
8156 l_initial_wgi_due_date date;
8157 l_payroll_id pay_payrolls_f.payroll_id%type;
8158 l_eq_pay_plan ghr_pay_plans.pay_plan%type;
8159 l_from_step ghr_pa_requests.to_step_or_rate%type;
8160 l_wgi_due_Date varchar2(60);
8161 l_wgi_pay_date date;
8162 l_wait_period ghr_pay_plan_waiting_periods.waiting_period%type;
8163 l_pay_plan ghr_pay_plans.pay_plan%type;
8164 l_step_or_rate ghr_pa_requests.to_step_or_rate%type;
8165 l_retained_grade_rec ghr_pay_calc.retained_grade_rec_type;
8166 l_maximum_step ghr_pa_requests.to_step_or_rate%type;
8167 l_grade_or_level ghr_pa_requests.to_grade_or_level%type;
8168 l_user_table_id pay_user_tables.user_table_id%TYPE;
8169
8170 l_lei_date varchar2(60); -- Bug 3709414
8171
8172 Cursor c_payroll is
8173 select rei_information3 payroll_type
8174 from ghr_pa_request_extra_info
8175 where pa_request_id = p_pa_request_rec.pa_request_id
8176 and information_type = 'GHR_US_PAR_PAYROLL_TYPE';
8177
8178 Cursor c_payroll_id is
8179 select asg.payroll_id
8180 from per_all_assignments_f asg
8181 where asg.assignment_id = p_pa_request_rec.employee_assignment_id;
8182
8183 Cursor c_equiv_pay_plan is
8184 select gpp.equivalent_pay_plan,gpp.maximum_Step
8185 from ghr_pay_plans gpp
8186 where gpp.pay_plan = l_pay_plan
8187 and gpp.wgi_enabled_flag = 'Y'; -- **also check for WGI enabled flag
8188 -- **calculate WGI only for eligible pay_plans and PRD
8189 Cursor c_next_step is -- ** WGI due date is null if the person has reached the max. step
8190 select gpw.to_step -- l_from_step
8191 from ghr_pay_plan_waiting_periods gpw
8192 where gpw.from_Step = l_step_or_rate
8193 and gpw.pay_plan = l_eq_pay_plan; -- pay plan -????
8194
8195 Cursor c_waiting_period is
8196 select gpw.waiting_period -- l_wait_period
8197 from ghr_pay_plan_waiting_periods gpw
8198 where gpw.pay_plan = l_eq_pay_plan
8199 and gpw.from_step = l_from_step; -- p_pa_request_rec.to_step_or_rate
8200
8201
8202 Cursor c_next_pay_date is
8203 select ptp.start_Date
8204 from per_time_periods ptp
8205 where ptp.payroll_id = l_payroll_id -- in case of p_wgi_due_date not null also get the payroll id
8206 and ptp.start_date >= p_wgi_due_date
8207 order by ptp.start_date asc ;
8208
8209 --
8210
8211 equiv_pay_plan c_equiv_pay_plan%rowtype;
8212
8213 Procedure get_gm_wgi_dates
8214 is
8215
8216 l_proc varchar2(72) := 'get_gm_wgi_dates';
8217 l_step4value varchar2(80);
8218 l_step7value varchar2(80);
8219 l_step10value varchar2(80);
8220 l_dummy_date date;
8221 l_pos_ei_data per_position_extra_info%ROWTYPE;
8222
8223 Begin
8224 hr_utility.set_location('entering ' || l_proc,5);
8225 If nvl(p_pa_request_rec.pay_Rate_determinant,hr_api.g_varchar2) in ('A','B','E','F') then
8226 for next_from_step in c_next_Step loop
8227 hr_utility.set_location(l_proc,34);
8228 l_step_or_rate := next_from_step.to_step;
8229 end loop;
8230 Else
8231 -- get the user table id for the position in all other cases .
8232 ghr_history_fetch.fetch_positionei
8233 (
8234 p_position_id => p_pa_request_rec.to_position_id
8235 ,p_information_type => 'GHR_US_POS_VALID_GRADE'
8236 ,p_date_effective => p_pa_request_rec.effective_date
8237 ,p_pos_ei_data => l_pos_ei_data
8238 );
8239 --
8240 l_user_table_id := l_pos_ei_data.poei_information5;
8241 End if;
8242 -- get table values for the given payplan.,grade or level, step or rate, pay table combination.
8243 ghr_pay_calc.get_pay_table_value
8244 (p_user_table_id => l_user_table_id,
8245 p_pay_plan => 'GS',
8246 p_grade_or_level => l_grade_or_level,
8247 p_step_or_rate => '04',
8248 p_effective_date => p_pa_request_rec.effective_date,
8249 p_pt_value => l_step4value,
8250 p_pt_eff_start_date => l_dummy_date,
8251 p_pt_eff_end_date => l_dummy_date
8252 );
8253 If p_pa_request_rec.to_basic_pay < l_step4value then
8254 p_wgi_due_date := p_pa_request_rec.effective_date + 364;
8255 Else
8256 ghr_pay_calc.get_pay_table_value
8257 (p_user_table_id => l_user_table_id,
8258 p_pay_plan => 'GS',
8259 p_grade_or_level => l_grade_or_level,
8260 p_step_or_rate => '07',
8261 p_effective_date => p_pa_request_rec.effective_date,
8262 p_pt_value => l_step7value,
8263 p_pt_eff_start_date => l_dummy_date,
8264 p_pt_eff_end_date => l_dummy_date
8265 );
8266 If p_pa_request_rec.to_basic_pay between l_step4value and l_step7value then
8267 p_wgi_due_date := p_pa_request_rec.effective_date + 728;
8268 Else
8269 ghr_pay_calc.get_pay_table_value
8270 (p_user_table_id => l_user_table_id,
8271 p_pay_plan => 'GS',
8272 p_grade_or_level => l_grade_or_level,
8273 p_step_or_rate => '10',
8274 p_effective_date => p_pa_request_rec.effective_date,
8275 p_pt_value => l_step10value,
8276 p_pt_eff_start_date => l_dummy_date,
8277 p_pt_eff_end_date => l_dummy_date
8278 );
8279 If p_pa_request_rec.to_basic_pay < l_step10value then
8280 p_wgi_due_date := p_pa_request_rec.effective_date + 1092;
8281 Else
8282 p_wgi_due_date := Null;
8283 End if;
8284 End if;
8285 End if;
8286 End get_gm_wgi_dates;
8287
8288 begin
8289
8290 hr_utility.set_location('Entering ' || l_proc,5);
8291 l_initial_wgi_due_date := p_wgi_due_date;
8292
8293 p_wgi_pay_date := null;
8294
8295 for payroll in c_payroll loop
8296 l_payroll_id := payroll.payroll_type;
8297 end loop;
8298
8299 If l_payroll_id is null then
8300 for payroll in c_payroll_id loop
8301 l_payroll_id := payroll.payroll_id;
8302 End loop;
8303 End if;
8304
8305 If l_payroll_id is null then
8306 hr_utility.set_location(l_proc,20);
8307 hr_utility.set_message(8301,'GHR_38268_ASG_NO_PAYROLL');
8308 hr_utility.raise_error;
8309 End if;
8310
8311 hr_utility.set_location('PAYROLLID ' || to_char(l_payroll_id),1);
8312
8313 -- Calculate WGI only when PRD is one of the foll.
8314
8315 If p_pa_request_rec.pay_rate_determinant in ('0','5','6','7','M') then
8316 l_pay_plan := p_pa_request_rec.to_pay_plan;
8317 l_step_or_rate := p_pa_request_rec.to_step_or_rate;
8318 l_grade_or_level := p_pa_request_rec.to_grade_or_level;
8319 Elsif p_pa_request_rec.pay_rate_determinant in ('A','B','E','F') then
8320 Begin
8321 l_retained_grade_rec := ghr_pc_basic_pay.get_retained_grade_details
8322 (p_person_id => p_pa_request_rec.person_id,
8323 p_effective_date => p_pa_request_rec.effective_date,
8324 p_pa_request_id => p_pa_request_rec.pa_request_id
8325 );
8326 l_pay_plan := l_retained_grade_rec.pay_plan;
8327 hr_utility.set_location('temp_step is ' || l_retained_grade_rec.temp_step,1);
8328 If l_retained_grade_rec.temp_step is not null
8329 then
8330 l_step_or_rate := l_retained_grade_rec.temp_step;
8331 l_pay_plan := p_pa_request_rec.to_pay_plan; -- Fix for bug 3023252
8332 hr_utility.set_location('New Step or Rate for Ret Grd Rec. is ' || l_step_or_rate,1);
8333 hr_utility.set_location('New pay plan is ' || l_pay_plan,1);
8334 else
8335 l_step_or_rate := l_retained_grade_rec.step_or_rate;
8336 hr_utility.set_location('New Step or Rate for Ret Grd Rec. is ' || l_step_or_rate,2);
8337 end if; -- If l_retained_grade_rec.temp_step is not null
8338 l_grade_or_level := l_retained_grade_rec.grade_or_level;
8339 l_user_table_id := l_retained_grade_rec.user_table_id;
8340 If p_pa_request_rec.first_noa_code in ('867','892','893')
8341 OR p_pa_request_rec.second_noa_code in ('867','892','893') then -- Bug 3953455 added second noa code to condition
8342 -- Bug#3304788 Modified the following if condition.
8343 -- Handled the retained step and temp.step cases separately
8344 If l_retained_grade_rec.temp_step is not null then
8345 if to_number(l_retained_grade_rec.temp_step) < 9 then
8346 p_retained_grade_rec.temp_step := '0' ||(l_retained_grade_rec.temp_step + 1 );
8347 l_step_or_rate := p_retained_grade_rec.temp_step;
8348 ELSE
8349 p_retained_grade_rec.temp_step := l_retained_grade_rec.temp_step + 1 ;
8350 l_step_or_rate := p_retained_grade_rec.temp_step;
8351 END IF;
8352 ELSE -- For Retained Grade
8353 if to_number(l_retained_grade_rec.step_or_rate) < 9 then
8354 l_step_or_rate := '0' ||(l_retained_grade_Rec.step_or_rate + 1 );
8355 ELSE
8356 l_step_or_rate := l_retained_grade_rec.step_or_rate + 1;
8357 END IF;
8358 END IF; -- If l_retained_grade_rec.temp_step is not null
8359 hr_utility.set_location('New Step or Rate for Ret Grd Rec. is ' || l_step_or_rate,3);
8360 hr_utility.set_location('temp_step is ' || p_retained_grade_rec.temp_step,2);
8361 p_retained_grade_rec.step_or_rate := l_step_or_rate;
8362 p_retained_Grade_rec.person_extra_info_id := l_retained_grade_rec.person_extra_info_id;
8363 End if; -- If p_pa_request_rec.first_noa_code in ('867',
8364
8365 Exception
8366 when ghr_pay_calc.pay_calc_message then
8367 Null;
8368 End;
8369
8370 Else -- else for -- If p_pa_request_rec.pay_rate_de
8371 l_pay_plan := null;
8372 p_wgi_due_date := null;
8373 p_wgi_pay_date := null;
8374 End if; -- If p_pa_request_rec.pay_rate_determinant in ('0','
8375
8376
8377 If l_pay_plan is not null then
8378 If p_wgi_due_date is null then
8379 hr_utility.set_location(l_proc,10);
8380 If l_pay_plan = 'GM' then
8381 get_gm_wgi_dates;
8382 -- Null;
8383 Else
8384 hr_utility.set_location(l_proc,15);
8385 -- Changed FOR LOOP, and showing error message conditionally. Dinesh Jan 12, 98
8386 open c_equiv_pay_plan;
8387 fetch c_equiv_pay_plan into equiv_pay_plan;
8388 l_eq_pay_plan := equiv_pay_plan.equivalent_pay_plan;
8389 l_maximum_step := equiv_pay_plan.maximum_step;
8390 if c_equiv_pay_plan%FOUND then
8391 If l_eq_pay_plan is null then
8392 hr_utility.set_location(l_proc,26);
8393 hr_utility.set_message(8301,'GHR_38269_NO_EQ_PAY_PLAN');
8394 hr_utility.raise_error;
8395 End if;
8396 else
8397 hr_utility.set_location(l_proc,25);
8398 close c_equiv_pay_plan;
8399 return;
8400 end if;
8401 close c_equiv_pay_plan;
8402
8403
8404 hr_utility.set_location(l_proc,30);
8405
8406 -- proceed only if the to_step_or_rate is less than the maximum step
8407
8408 hr_utility.set_location('Step or rate ' || l_step_or_rate,1);
8409 hr_utility.set_location('Max. Step or rate ' || l_maximum_step,1);
8410 l_from_step := l_step_or_rate;
8411
8412 If to_number(l_step_or_rate) < to_number(l_maximum_step) then
8413 hr_utility.set_location('step or rate less than max. ' || l_step_or_rate,1);
8414
8415 IF (p_pa_request_rec.first_noa_code = '892' or p_pa_request_rec.second_noa_code = '892') AND
8416 (p_retained_grade_rec.step_or_rate not in (4,7,10) or l_from_step not in (4,7,10))
8417 THEN
8418 hr_utility.set_location('Do not calc. WGI Dates for all steps in QSI ',1);
8419 -- Start of Bug 3111719
8420 -- Return the current WGI due date for steps other than 4,7,10 in QSI.
8421 ghr_history_fetch.fetch_element_entry_value
8422 (p_element_name => 'Within Grade Increase',
8423 p_input_value_name => 'Date Due',
8424 p_assignment_id => p_pa_request_rec.employee_assignment_id,
8425 p_date_effective => p_pa_request_rec.effective_date,
8426 p_screen_entry_value => l_wgi_due_date
8427 );
8428
8429 p_wgi_due_date := fnd_date.canonical_to_date(l_wgi_due_date);
8430 -- End of Bug 3111719.
8431 -- Bug 3709414 New Approach-- For 713 actions take from element entry
8432 -- If DLEI is entered, use that to calculate Due Date, else retain the old date
8433 ELSIF (p_pa_request_rec.first_noa_code = '713' OR p_pa_request_rec.second_noa_code = '713') AND p_dlei IS NULL THEN
8434 ghr_history_fetch.fetch_element_entry_value
8435 (p_element_name => 'Within Grade Increase',
8436 p_input_value_name => 'Date Due',
8437 p_assignment_id => p_pa_request_rec.employee_assignment_id,
8438 p_date_effective => p_pa_request_rec.effective_date,
8439 p_screen_entry_value => l_lei_date
8440 );
8441 p_wgi_due_date := fnd_date.canonical_to_date(l_lei_date);
8442 ELSE
8443 hr_utility.set_location(l_proc,40);
8444 If l_from_Step is not null then
8445 for waiting_period in c_waiting_period loop
8446 hr_utility.set_location(l_proc,45);
8447 l_wait_period := waiting_period.waiting_period;
8448 end loop;
8449 If (p_pa_request_rec.first_noa_code = '892' or p_pa_request_rec.second_noa_code = '892') and
8450 (p_retained_grade_rec.step_or_rate in (4,7) or l_from_step in (4,7)) then
8451 -- get current WGI Due Date
8452 ghr_history_fetch.fetch_element_entry_value
8453 (p_element_name => 'Within Grade Increase',
8454 p_input_value_name => 'Date Due',
8455 p_assignment_id => p_pa_request_rec.employee_assignment_id,
8456 p_date_effective => p_pa_request_rec.effective_date,
8457 p_screen_entry_value => l_wgi_due_date
8458 );
8459
8460 hr_utility.set_location(l_proc,25);
8461 p_wgi_due_date := fnd_date.canonical_to_date(l_wgi_due_date) + 364;
8462 -- If it's NOA 713 and DLEI is entered, it enters here
8463 -- Need to use DLEI to calculate WGI due date instead of effective date
8464 -- Code added as part of WGI Enhancments/Bug fixes
8465 ELSIF (p_pa_request_rec.first_noa_code = '713' or p_pa_request_rec.second_noa_code = '713') THEN
8466 hr_utility.set_location('Entering 713 - dlei is not null',333);
8467 p_wgi_due_date := p_dlei + l_wait_period;
8468 -- End WGI Changes for NOA 713
8469 ELSE
8470 If l_wait_period is not null then
8471 hr_utility.set_location(l_proc,26);
8472 p_wgi_due_date := p_pa_request_rec.effective_date + l_wait_period;
8473 END IF;
8474 END IF;
8475 END IF;
8476 END IF; -- Case 892 --01/Feb
8477 Else -- else for l_step_or_rate < l_maximum_step
8478 -- if the employee has reached the max. step
8479 hr_utility.set_location('emp. has reached the max. step',2);
8480 p_wgi_due_date := null; -- Venkat -- Uncommented bug #954104
8481 p_wgi_pay_date := null;
8482 End if;
8483 End if; -- GM pay plan check
8484 End if; -- WGI due date is Null
8485
8486 hr_utility.set_location('DUE DATE ' || to_char(p_wgi_due_date),1);
8487 If p_wgi_due_date is not null then
8488 hr_utility.set_location(l_proc,55);
8489 for next_pay_date in c_next_pay_date loop
8490 hr_utility.set_location(l_proc,60);
8491 p_wgi_pay_date := next_pay_date.start_date;
8492 exit;
8493 end loop;
8494 End if;
8495 hr_utility.set_location('Leaving ' ||l_proc,65);
8496 End if;
8497 Exception when others then
8498 --
8499 -- Reset IN OUT parameters and set OUT parameters
8500 --
8501 p_wgi_due_date := l_initial_wgi_due_date;
8502 p_wgi_pay_date := null;
8503 p_retained_grade_rec := null;
8504 raise;
8505
8506
8507 End get_wgi_dates;
8508 --
8509 Procedure generic_update_sit
8510 (p_pa_request_rec in ghr_pa_requests%rowtype,
8511 p_special_information_type in fnd_id_flex_structures_tl.id_flex_structure_name%type,
8512 p_segment_rec in ghr_api.special_information_type
8513 )
8514 is
8515
8516 l_proc varchar2(72) := 'Generic Update SIT';
8517 l_object_version_number per_people_f.object_version_number%type;
8518 l_session ghr_history_api.g_session_var_type;
8519 l_multiple varchar2(1);
8520 l_analysis_criteria_id per_analysis_criteria.analysis_criteria_id%type;
8521 l_person_analysis_id per_person_analyses.person_analysis_id%type;
8522 l_business_group_id per_people_f.business_group_id%type;
8523 l_id_flex_num fnd_id_flex_structures.id_flex_num%type;
8524 -- Bug#4054110,4069798 Added l_date_from variable
8525 l_date_from DATE;
8526
8527 Cursor c_bgpid is
8528 select business_group_id
8529 from per_all_people_f
8530 where person_id = p_pa_request_rec.person_id;
8531
8532 Cursor c_flex_num is
8533 select id_flex_num
8534 from fnd_id_flex_structures_tl
8535 where id_flex_structure_name = p_special_information_type
8536 and id_flex_code = 'PEA' --??
8537 and application_id = 800
8538 and language = 'US'; --??
8539
8540 Cursor c_multiple_occur is
8541 select multiple_occurrences_flag
8542 from per_special_info_types sit
8543 where business_group_id = l_business_group_id
8544 and id_flex_num = l_id_flex_num;
8545
8546 -- Bug#4054110,4069798 Added cursor c_date_from to fetch the
8547 -- start date of SIT record.
8548 Cursor c_date_from is
8549 Select date_from
8550 from per_person_analyses
8551 where person_analysis_id = p_segment_rec.person_analysis_id;
8552
8553 BEGIN
8554
8555 hr_utility.set_location('Entering ' || l_proc,5);
8556
8557 for bgpid in c_bgpid loop
8558 l_business_group_id := bgpid.business_group_id;
8559 end loop;
8560
8561 -- Get the id_flex_num
8562 for flex_num in c_flex_num loop
8563 hr_utility.set_location(l_proc,12);
8564 l_id_flex_num := flex_num.id_flex_num;
8565 end loop;
8566 hr_utility.set_location(l_proc,15);
8567
8568 for multiple_occur in c_multiple_occur loop
8569 hr_utility.set_location(l_proc,36);
8570 l_multiple := multiple_occur.multiple_occurrences_flag;
8571 end loop;
8572
8573 l_object_version_number := p_segment_rec.object_version_number;
8574 l_person_analysis_id := p_segment_rec.person_analysis_id;
8575
8576
8577 if p_segment_rec.person_analysis_id is null then
8578 hr_utility.set_location(l_proc,25);
8579 begin
8580 savepoint cr_sit;
8581 hr_sit_api.create_sit
8582 (p_person_id => p_pa_request_rec.person_id,
8583 p_business_group_id => l_business_group_id,
8584 p_id_flex_num => l_id_flex_num,
8585 p_effective_date => p_pa_request_rec.effective_date,
8586 p_date_from => p_pa_request_rec.effective_date,
8587 p_segment1 => p_segment_rec.segment1,
8588 p_segment2 => p_segment_rec.segment2,
8589 p_segment3 => p_segment_rec.segment3,
8590 p_segment4 => p_segment_rec.segment4,
8591 p_segment5 => p_segment_rec.segment5,
8592 p_segment6 => p_segment_rec.segment6,
8593 p_segment7 => p_segment_rec.segment7,
8594 p_segment8 => p_segment_rec.segment8,
8595 p_segment9 => p_segment_rec.segment9,
8596 p_segment10 => p_segment_rec.segment10,
8597 p_segment11 => p_segment_rec.segment11,
8598 p_segment12 => p_segment_rec.segment12,
8599 p_segment13 => p_segment_rec.segment13,
8600 p_segment14 => p_segment_rec.segment14,
8601 p_segment15 => p_segment_rec.segment15,
8602 p_segment16 => p_segment_rec.segment16,
8603 p_segment17 => p_segment_rec.segment17,
8604 p_segment18 => p_segment_rec.segment18,
8605 p_segment19 => p_segment_rec.segment19,
8606 p_segment20 => p_segment_rec.segment20,
8607 p_segment21 => p_segment_rec.segment21,
8608 p_segment22 => p_segment_rec.segment22,
8609 p_segment23 => p_segment_rec.segment23,
8610 p_segment24 => p_segment_rec.segment24,
8611 p_segment25 => p_segment_rec.segment25,
8612 p_segment26 => p_segment_rec.segment26,
8613 p_segment27 => p_segment_rec.segment27,
8614 p_segment28 => p_segment_rec.segment28,
8615 p_segment29 => p_segment_rec.segment29,
8616 p_segment30 => p_segment_rec.segment30,
8617 p_person_analysis_id => l_person_analysis_id,
8618 p_pea_object_version_number => l_object_version_number,
8619 p_analysis_criteria_id => l_analysis_criteria_id
8620 );
8621 Exception when others then
8622 rollback to cr_sit;
8623 raise;
8624 End;
8625 hr_utility.set_location(l_proc,30);
8626 Else
8627 Begin
8628 -- Bug#4054110,4069798 Fetching the SIT start date for SIT US Fed Perf Apprisal.
8629 IF p_special_information_type = 'US Fed Perf Appraisal' THEN
8630 Open c_date_from;
8631 Fetch c_date_from into l_date_from;
8632 Close c_date_from;
8633 ELSE
8634 l_date_from := p_pa_request_rec.effective_date;
8635 End IF;
8636
8637 savepoint upd_sit;
8638 hr_sit_api.update_sit
8639 (p_person_analysis_id => p_segment_rec.person_analysis_id,
8640 p_date_from => l_date_from,
8641 p_segment1 => p_segment_rec.segment1,
8642 p_segment2 => p_segment_rec.segment2,
8643 p_segment3 => p_segment_rec.segment3,
8644 p_segment4 => p_segment_rec.segment4,
8645 p_segment5 => p_segment_rec.segment5,
8646 p_segment6 => p_segment_rec.segment6,
8647 p_segment7 => p_segment_rec.segment7,
8648 p_segment8 => p_segment_rec.segment8,
8649 p_segment9 => p_segment_rec.segment9,
8650 p_segment10 => p_segment_rec.segment10,
8651 p_segment11 => p_segment_rec.segment11,
8652 p_segment12 => p_segment_rec.segment12,
8653 p_segment13 => p_segment_rec.segment13,
8654 p_segment14 => p_segment_rec.segment14,
8655 p_segment15 => p_segment_rec.segment15,
8656 p_segment16 => p_segment_rec.segment16,
8657 p_segment17 => p_segment_rec.segment17,
8658 p_segment18 => p_segment_rec.segment18,
8659 p_segment19 => p_segment_rec.segment19,
8660 p_segment20 => p_segment_rec.segment20,
8661 p_segment21 => p_segment_rec.segment21,
8662 p_segment22 => p_segment_rec.segment22,
8663 p_segment23 => p_segment_rec.segment23,
8664 p_segment24 => p_segment_rec.segment24,
8665 p_segment25 => p_segment_rec.segment25,
8666 p_segment26 => p_segment_rec.segment26,
8667 p_segment27 => p_segment_rec.segment27,
8668 p_segment28 => p_segment_rec.segment28,
8669 p_segment29 => p_segment_rec.segment29,
8670 p_segment30 => p_segment_rec.segment30,
8671 p_analysis_criteria_id => l_analysis_criteria_id,
8672 p_pea_object_version_number => l_object_version_number
8673 );
8674 Exception
8675 when others then
8676 rollback to upd_sit;
8677 raise;
8678 End;
8679 End if;
8680
8681 end; -- END OF generic_update_sit
8682 end GHR_SF52_DO_UPDATE;