[Home] [Help]
PACKAGE BODY: APPS.PQH_GSP_HR_TO_STAGE
Source
1 package body pqh_gsp_hr_to_stage as
2 /* $Header: pqgsphrs.pkb 120.13 2011/11/24 07:46:41 lbodired ship $ */
3 function get_display_vpf_cer(p_vpf_id in number,
4 p_copy_entity_txn_id in number) return number is
5 l_vpf_cer_id number;
6 begin
7 select copy_entity_result_id
8 into l_vpf_cer_id
9 from ben_copy_entity_results
10 where copy_entity_txn_id = p_copy_entity_txn_id
11 and result_type_cd ='DISPLAY'
12 and table_alias = 'VPF'
13 and information1 = p_vpf_id;
14 return l_vpf_cer_id;
15 exception
16 when others then
17 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
18 (P_MASTER_TXN_ID => g_master_txn_id,
19 P_TXN_ID => g_txn_id,
20 p_context => 'get_display_vpf_cer',
21 P_MODULE_CD => 'PQH_GSP_BENSTG',
22 P_MESSAGE_TYPE_CD => 'E',
23 P_MESSAGE_TEXT => sqlerrm,
24 p_effective_date => trunc(sysdate));
25 raise;
26 end;
27 procedure update_crset_type(p_copy_entity_txn_id in number,
28 p_crset_id in number,
29 p_crset_type in varchar2) is
30 begin
31 update ben_copy_entity_results
32 set information100 = p_crset_type
33 where copy_entity_txn_id = p_copy_entity_txn_id
34 and table_alias ='CRSET'
35 and information161 = p_crset_id;
36 exception
37 when others then
38 hr_utility.set_location('crset type upd issue ',11);
39 raise;
40 end;
41 function is_crrate_there(p_oipl_cer_id in number default null,
42 p_plip_cer_id in number default null,
43 p_pl_cer_id in number default null,
44 p_point_cer_id in number default null,
45 p_copy_entity_txn_id in number,
46 p_effective_date in date) return varchar2 is
47 l_count number;
48 l_grade_cer_id number;
49 l_point_cer_id number;
50 begin
51 if p_oipl_cer_id is null and p_plip_cer_id is null
52 and p_pl_cer_id is null and p_point_cer_id is null then
53 return 'N';
54 elsif p_oipl_cer_id is not null and p_point_cer_id is null then
55 select information262
56 into l_point_cer_id
57 from ben_copy_entity_results
58 where copy_entity_result_id = p_oipl_cer_id;
59 elsif p_plip_cer_id is not null and p_pl_cer_id is null then
60 select information252
61 into l_grade_cer_id
62 from ben_copy_entity_results
63 where copy_entity_result_id = p_plip_cer_id;
64 elsif p_point_cer_id is not null then
65 l_point_cer_id := p_point_cer_id;
66 elsif p_pl_cer_id is not null then
67 l_grade_cer_id := p_pl_cer_id;
68 end if;
69 if l_point_cer_id is not null then
70 select count(*)
71 into l_count
72 from ben_copy_entity_results
73 where copy_entity_txn_id = p_copy_entity_txn_id
74 and table_alias ='CRRATE'
75 and p_effective_date between information2 and information3
76 and information169 = l_point_cer_id
77 and information160 is not null;
78 end if;
79 if l_grade_cer_id is not null then
80 select count(*)
81 into l_count
82 from ben_copy_entity_results
83 where copy_entity_txn_id = p_copy_entity_txn_id
84 and table_alias ='CRRATE'
85 and p_effective_date between information2 and information3
86 and information230 = l_grade_cer_id
87 and information160 is not null;
88 end if;
89 if nvl(l_count,0) >0 then
90 return 'Y';
91 else
92 return 'N';
93 end if;
94 end is_crrate_there;
95 function get_elp_for_vpf(p_vpf_cer_id in number,
96 p_copy_entity_txn_id in number,
97 p_effective_date in date) return number is
98 l_elp_id number;
99 l_message_text varchar2(240);
100 begin
101 hr_utility.set_location('vpf_cer_id is '||p_vpf_cer_id,1);
102 select information1
103 into l_elp_id
104 from ben_copy_entity_results
105 where copy_entity_txn_id = p_copy_entity_txn_id
106 and table_alias ='ELP'
107 and parent_entity_result_id = p_vpf_cer_id
108 and p_effective_date between information2 and information3;
109 hr_utility.set_location('elp id is '||l_elp_id,1);
110 return l_elp_id;
111 exception
112 when no_data_found then
113 l_message_text := 'no_data_found for vpf_cer is :'||p_vpf_cer_id
114 ||' cet id is '||p_copy_entity_txn_id
115 ||' effdt is '||to_char(p_effective_date,'DD-MM-RRRR');
116 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
117 (P_MASTER_TXN_ID => g_master_txn_id,
118 P_TXN_ID => g_txn_id,
119 p_context => 'get_elp_for_vpf_no_data',
120 P_MODULE_CD => 'PQH_GSP_BENSTG',
121 P_MESSAGE_TYPE_CD => 'E',
122 P_MESSAGE_TEXT => l_message_text,
123 p_effective_date => p_effective_date);
124 raise;
125 when others then
126 hr_utility.set_location('elp pull had issues',10);
127 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
128 (P_MASTER_TXN_ID => g_master_txn_id,
129 P_TXN_ID => g_txn_id,
130 p_context => 'get_elp_for_vpf_other',
131 P_MODULE_CD => 'PQH_GSP_BENSTG',
132 P_MESSAGE_TYPE_CD => 'E',
133 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm)||l_message_text,
134 p_effective_date => p_effective_date);
135 raise;
136 end get_elp_for_vpf;
137 procedure validate_crset(p_name in varchar2,
138 p_bu_cd in varchar2 default null,
139 p_bu_name in varchar2 default null,
140 p_fp_cd in varchar2 default null,
141 p_fp_name in varchar2 default null,
142 p_job_id in number default null,
143 p_job_name in varchar2 default null,
144 p_org_id in number default null,
145 p_org_name in varchar2 default null,
146 p_pt_id in number default null,
147 p_pt_name in varchar2 default null,
148 p_loc_id in number default null,
149 p_loc_name in varchar2 default null,
150 p_perf_rtng_cd in varchar2 default null,
151 p_event_type in varchar2 default null,
152 p_perf_rtng_name in varchar2 default null,
153 p_event_name in varchar2 default null,
154 p_sa_id in number default null,
155 p_sa_name in varchar2 default null,
156 p_ff_id in number default null,
157 p_ff_name in varchar2 default null,
158 p_valid out nocopy boolean) is
159 l_continue boolean := true;
160 begin
161 if p_name is null then
162 l_continue := false;
163 end if;
164 if p_event_name is not null and p_event_type is null then
165 l_continue := false;
166 end if;
167 if p_event_name is null and p_event_type is not null then
168 l_continue := false;
169 end if;
170 if p_perf_rtng_cd is not null and p_perf_rtng_name is null then
171 l_continue := false;
172 end if;
173 if p_perf_rtng_cd is null and p_perf_rtng_name is not null then
174 l_continue := false;
175 end if;
176 if p_perf_rtng_cd is null and p_event_type is not null then
177 l_continue := false;
178 end if;
179 if p_perf_rtng_cd is not null and p_event_type is null then
180 l_continue := false;
181 end if;
182 if p_bu_cd is null and p_bu_name is not null then
183 l_continue := false;
184 end if;
185 if p_bu_cd is not null and p_bu_name is null then
186 l_continue := false;
187 end if;
188 if p_fp_cd is null and p_fp_name is not null then
189 l_continue := false;
190 end if;
191 if p_fp_cd is not null and p_fp_name is null then
192 l_continue := false;
193 end if;
194 if p_sa_id is null and p_sa_name is not null then
195 l_continue := false;
196 end if;
197 if p_sa_id is not null and p_sa_name is null then
198 l_continue := false;
199 end if;
200 if p_pt_id is null and p_pt_name is not null then
201 l_continue := false;
202 end if;
203 if p_pt_id is not null and p_pt_name is null then
204 l_continue := false;
205 end if;
206 if p_ff_id is null and p_ff_name is not null then
207 l_continue := false;
208 end if;
209 if p_ff_id is not null and p_ff_name is null then
210 l_continue := false;
211 end if;
212 if p_loc_id is null and p_loc_name is not null then
213 l_continue := false;
214 end if;
215 if p_loc_id is not null and p_loc_name is null then
216 l_continue := false;
217 end if;
218 if p_job_id is null and p_job_name is not null then
219 l_continue := false;
220 end if;
221 if p_job_id is not null and p_job_name is null then
222 l_continue := false;
223 end if;
224 if p_org_id is null and p_org_name is not null then
225 l_continue := false;
226 end if;
227 if p_org_id is not null and p_org_name is null then
228 l_continue := false;
229 end if;
230 p_valid := l_continue;
231 end validate_crset;
232 procedure get_abr_detl(p_abr_cer_id in number,
233 p_abr_type out nocopy varchar2,
234 p_pl_id out nocopy number,
235 p_opt_id out nocopy number,
236 p_grade_cer_id out nocopy number,
237 p_point_cer_id out nocopy number) is
238 begin
239 hr_utility.set_location('abr cer is'||p_abr_cer_id,10);
240 select information261,information247,information277,information278
241 into p_pl_id,p_opt_id,p_grade_cer_id,p_point_cer_id
242 from ben_copy_entity_results
243 where copy_entity_result_id = p_abr_cer_id;
244 hr_utility.set_location('pl is'||p_pl_id,10);
245 hr_utility.set_location('opt is'||p_opt_id,10);
246 if p_pl_id is not null then
247 p_abr_type := 'GRADE';
248 elsif p_opt_id is not null then
249 p_abr_type := 'POINT';
250 else
251 p_abr_type := '';
252 end if;
253 exception
254 when others then
255 hr_utility.set_location('abr fetch issues '||p_abr_cer_id,11);
256 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
257 (P_MASTER_TXN_ID => g_master_txn_id,
258 P_TXN_ID => g_txn_id,
259 p_context => 'get_abr_detl',
260 P_MODULE_CD => 'PQH_GSP_BENSTG',
261 P_MESSAGE_TYPE_CD => 'E',
262 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
263 p_effective_date => trunc(sysdate));
264 raise;
265 end get_abr_detl;
266 function get_abr_cer(p_copy_entity_txn_id in number,
267 p_pl_cer_id in number default null,
268 p_opt_cer_id in number default null,
269 p_effective_date in date) return number is
270 l_abr_cer_id number;
271 begin
272 if p_pl_cer_id is not null then
273 begin
274 hr_utility.set_location('getting abr cer for pl cer'||p_pl_cer_id,10);
275 select copy_entity_result_id
276 into l_abr_cer_id
277 from ben_copy_entity_results
278 where INFORMATION277 = p_pl_cer_id
279 and table_alias = 'ABR'
280 and copy_entity_txn_id = p_copy_entity_txn_id
281 and p_effective_date between information2 and information3;
282 hr_utility.set_location('abr cer '||l_abr_cer_id,20);
283 return l_abr_cer_id;
284 exception
285 when no_data_found then
286 hr_utility.set_location('abr cer doesnot exist',30);
287 return l_abr_cer_id;
288 when others then
289 hr_utility.set_location('issues in getting abr cer ',40);
290 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
291 (P_MASTER_TXN_ID => g_master_txn_id,
292 P_TXN_ID => g_txn_id,
293 p_context => 'get_abr_cer',
294 P_MODULE_CD => 'PQH_GSP_BENSTG',
295 P_MESSAGE_TYPE_CD => 'E',
296 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
297 p_effective_date => p_effective_date);
298 raise;
299 end;
300 elsif p_opt_cer_id is not null then
301 begin
302 hr_utility.set_location('getting abr cer for opt cer'||p_opt_cer_id,10);
303 select copy_entity_result_id
304 into l_abr_cer_id
305 from ben_copy_entity_results
306 where INFORMATION278 = p_opt_cer_id
307 and table_alias = 'ABR'
308 and copy_entity_txn_id = p_copy_entity_txn_id
309 and p_effective_date between information2 and information3;
310 hr_utility.set_location('abr cer '||l_abr_cer_id,20);
311 return l_abr_cer_id;
312 exception
313 when no_data_found then
314 hr_utility.set_location('abr cer doesnot exist',30);
315 return l_abr_cer_id;
316 when others then
317 hr_utility.set_location('issues in getting abr cer ',40);
318 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
319 (P_MASTER_TXN_ID => g_master_txn_id,
320 P_TXN_ID => g_txn_id,
321 p_context => 'get_abr_cer',
322 P_MODULE_CD => 'PQH_GSP_BENSTG',
323 P_MESSAGE_TYPE_CD => 'E',
324 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
325 p_effective_date => p_effective_date);
326 raise;
327 end;
328 else
329 hr_utility.set_location('pl or opt cer is to be passed',50);
330 end if;
331 end get_abr_cer;
332 function is_hrr_exists(p_copy_entity_txn_id in number,
333 p_grade_cer_id in number default null,
334 p_point_cer_id in number default null,
335 p_hrr_esd in date) return number is
336 l_hrr_cer_id number;
337 begin
338 hr_utility.set_location('inside is_hrr_exists',10);
339 select copy_entity_result_id
340 into l_hrr_cer_id
341 from ben_copy_entity_results
342 where copy_entity_txn_id = p_copy_entity_txn_id
343 and table_alias = 'HRRATE'
344 and (information277 is null or information277 = p_grade_cer_id)
345 and (information278 is null or information278 = p_point_cer_id)
346 and p_hrr_esd between information2 and information3;
347 return l_hrr_cer_id;
348 exception
349 when no_data_found then
350 hr_utility.set_location('hrr cer doesnot exist',30);
351 return l_hrr_cer_id;
352 when others then
353 hr_utility.set_location('issues in getting hrr cer ',40);
354 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
355 (P_MASTER_TXN_ID => g_master_txn_id,
356 P_TXN_ID => g_txn_id,
357 p_context => 'is_hrr_exists',
358 P_MODULE_CD => 'PQH_GSP_BENSTG',
359 P_MESSAGE_TYPE_CD => 'E',
360 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
361 p_effective_date => trunc(sysdate));
362 raise;
363 end is_hrr_exists;
364 function is_crr_exists(p_copy_entity_txn_id in number,
365 p_crset_id in number,
366 p_grade_cer_id in number,
367 p_point_cer_id in number,
368 p_crr_esd in date) return boolean is
369 l_count number;
370 begin
371 hr_utility.set_location('inside is_crr_exists',10);
372 select count(*) into l_count
373 from ben_copy_entity_results
374 where copy_entity_txn_id = p_copy_entity_txn_id
375 and table_alias = 'CRRATE'
376 and (information230 is null or information230 = p_grade_cer_id)
377 and (information169 is null or information169 = p_point_cer_id)
378 and p_crr_esd between information2 and information3
379 and information160 = p_crset_id;
380 hr_utility.set_location('count is '||l_count,20);
381 if nvl(l_count,0) > 0 then
382 return TRUE;
383 else
384 return FALSE;
385 end if;
386 end is_crr_exists;
387 procedure create_crrate_row(p_vpf_cer_id in number default null,
388 p_abr_cer_id in number ,
389 p_vpf_id in number default null,
390 p_vpf_name in varchar2 default null,
391 p_vpf_ovn in number default null,
392 p_grade_cer_id in number default null,
393 p_point_cer_id in number default null,
394 p_copy_entity_txn_id in number,
395 p_business_group_id in number,
396 p_effective_date in date,
397 p_vpf_esd in date,
398 p_vpf_eed in date,
399 p_vpf_value in number,
400 p_crset_id in number,
401 p_dml_operation in varchar2 default 'INSERT',
402 p_datetrack_mode in varchar2 default 'INSERT',
403 p_elp_id in number default null,
404 p_crr_cer_id out nocopy number) is
405 l_crr_tr_id number;
406 l_crr_tr_name varchar2(30);
407 l_crr_cer_ovn number;
408 l_crr_cer_id number;
409 l_continue boolean := TRUE;
410 l_crr_exists boolean ;
411 begin
412 hr_utility.set_location('inside crr create',10);
413 get_table_route_details(p_table_alias => 'CRRATE',
414 p_table_route_id => l_crr_tr_id,
415 p_table_name => l_crr_tr_name);
416 hr_utility.set_location('crr tr name'||l_crr_tr_name,20);
417 if l_crr_tr_name is null then
418 hr_utility.set_location('crr tr name'||l_crr_tr_name,45);
419 l_continue := FALSE;
420 end if;
421 if p_copy_entity_txn_id is null then
422 hr_utility.set_location('CET is '||p_copy_entity_txn_id,50);
423 l_continue := FALSE;
424 end if;
425 if p_crset_id is null then
426 hr_utility.set_location('crset id passed is null',55);
427 -- in case of create grrate, we will like to create crrate with no crset id.
428 end if;
429 if p_abr_cer_id is null then
430 hr_utility.set_location('crr has to have abr cer',55);
431 l_continue := FALSE;
432 end if;
433 if p_grade_cer_id is null and p_point_cer_id is null then
434 hr_utility.set_location('crr has to have grd/pt cer',55);
435 l_continue := FALSE;
436 end if;
437 if p_vpf_esd is null or p_vpf_eed is null then
438 hr_utility.set_location('crr has to have dt range',55);
439 l_continue := FALSE;
440 end if;
441 if p_dml_operation not in ('INSERT','REUSE','UPDATE') then
442 hr_utility.set_location('wrong dml_oper passed ',55);
443 l_continue := FALSE;
444 end if;
445 if p_datetrack_mode not in ('INSERT','UPDATE_REPLACE') then
446 hr_utility.set_location('wrong dt_mode passed ',55);
447 l_continue := FALSE;
448 end if;
449 l_crr_exists := is_crr_exists(p_copy_entity_txn_id => p_copy_entity_txn_id,
450 p_crset_id => p_crset_id,
451 p_grade_cer_id => p_grade_cer_id,
452 p_point_cer_id => p_point_cer_id,
453 p_crr_esd => p_vpf_esd);
454 if l_crr_exists then
455 hr_utility.set_location('crr exists, no insert',55);
456 l_continue := FALSE;
457 end if;
458 if l_continue then
459 begin
460 hr_utility.set_location('cer insert api called',55);
461 ben_copy_entity_results_api.create_copy_entity_results
462 (p_effective_date => p_effective_date
463 ,p_copy_entity_txn_id => p_copy_entity_txn_id
464 ,p_result_type_cd => 'DISPLAY'
465 ,p_table_name => l_crr_tr_name
466 ,p_table_alias => 'CRRATE'
467 ,p_table_route_id => l_crr_tr_id
468 ,p_dml_operation => p_dml_operation
469 ,p_datetrack_mode => p_datetrack_mode
470 ,p_information2 => p_vpf_esd
471 ,p_information3 => p_vpf_eed
472 ,p_information4 => p_business_group_id
473 ,p_information160 => p_crset_id
474 ,p_information161 => p_abr_cer_id
475 ,p_information162 => p_vpf_cer_id
476 ,p_information169 => p_point_cer_id
477 ,p_information170 => p_vpf_name
478 ,p_information278 => p_vpf_id
479 ,p_information279 => p_elp_id
480 ,p_information298 => p_vpf_ovn
481 ,p_information230 => p_grade_cer_id
482 ,p_information293 => p_vpf_value
483 ,p_information287 => p_vpf_value
484 ,p_copy_entity_result_id => l_crr_cer_id
485 ,p_object_version_number => l_crr_cer_ovn);
486 exception
487 when others then
488 hr_utility.set_location('some issue in creating crr row ',120);
489 raise;
490 end;
491 p_crr_cer_id := l_crr_cer_id;
492 end if;
493 hr_utility.set_location('leaving create crrate',55);
494 end create_crrate_row;
495 procedure create_crrate_row(p_grade_cer_id in number default null,
496 p_point_cer_id in number default null,
497 p_copy_entity_txn_id in number,
498 p_business_group_id in number,
499 p_effective_date in date,
500 p_vpf_value in number,
501 p_crset_id in number,
502 p_crr_cer_id out nocopy number) is
503 l_eot date := to_date('31-12-4712','DD-MM-RRRR');
504 l_sot date := pqh_gsp_utility.get_gsp_plntyp_str_date(p_business_group_id,p_copy_entity_txn_id);
505 l_abr_cer_id number;
506 l_grd_st_dt date;
507 l_continue boolean := true;
508 begin
509 hr_utility.set_location('inside create crrate',55);
510 -- this routine will be called by setup UI.
511 if p_grade_cer_id is null and p_point_cer_id is null then
512 hr_utility.set_location('grd/pt cer id should be there',10);
513 l_continue := false;
514 else
515 l_abr_cer_id := get_abr_cer(p_copy_entity_txn_id => p_copy_entity_txn_id,
516 p_pl_cer_id => p_grade_cer_id,
517 p_opt_cer_id => p_point_cer_id,
518 p_effective_date => p_effective_date);
519 if l_abr_cer_id is null then
520 hr_utility.set_location('going for abr row create ',40);
521 if p_grade_cer_id is not null then
522 l_grd_st_dt := get_grd_start_date(p_grade_cer_id => p_grade_cer_id);
523 end if;
524 create_abr_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
525 p_pl_cer_id => p_grade_cer_id,
526 p_opt_cer_id => p_point_cer_id,
527 p_business_group_id => p_business_group_id,
528 p_effective_date => p_effective_date,
529 p_start_date => nvl(l_grd_st_dt,l_sot),
530 p_abr_cer_id => l_abr_cer_id,
531 p_create_hrr => 'Y',
532 p_dml_oper => 'INSERT');
533 hr_utility.set_location('abr cer is '||l_abr_cer_id,50);
534 if l_abr_cer_id is null then
535 l_continue := false;
536 end if;
537 end if;
538 end if;
539 if l_continue then
540 create_crrate_row(p_grade_cer_id => p_grade_cer_id,
541 p_point_cer_id => p_point_cer_id,
542 p_copy_entity_txn_id => p_copy_entity_txn_id,
543 p_business_group_id => p_business_group_id,
544 p_abr_cer_id => l_abr_cer_id,
545 p_effective_date => p_effective_date,
546 p_vpf_esd => p_effective_date,
547 p_vpf_eed => l_eot,
548 p_vpf_value => p_vpf_value,
549 p_crset_id => p_crset_id,
550 p_elp_id => '',
551 p_crr_cer_id => p_crr_cer_id);
552 end if;
553 hr_utility.set_location('leaving create crrate',56);
554 end create_crrate_row;
555 procedure create_crset_row(p_crset_id in number,
556 p_effective_date in date,
557 p_copy_entity_txn_id in number,
558 p_bu_cd in varchar2 default null,
559 p_bu_name in varchar2 default null,
560 p_bu_cer_id in number default null,
561 p_fp_cd in varchar2 default null,
562 p_fp_name in varchar2 default null,
563 p_fp_cer_id in number default null,
564 p_job_id in number default null,
565 p_job_name in varchar2 default null,
566 p_job_cer_id in number default null,
567 p_org_id in number default null,
568 p_org_name in varchar2 default null,
569 p_org_cer_id in number default null,
570 p_pt_id in number default null,
571 p_pt_name in varchar2 default null,
572 p_pt_cer_id in number default null,
573 p_loc_id in number default null,
574 p_loc_name in varchar2 default null,
575 p_loc_cer_id in number default null,
576 p_perf_rtng_cd in varchar2 default null,
577 p_event_type in varchar2 default null,
578 p_perf_rtng_name in varchar2 default null,
579 p_event_name in varchar2 default null,
580 p_pr_cer_id in number default null,
581 p_sa_id in number default null,
582 p_sa_name in varchar2 default null,
583 p_sa_cer_id in number default null,
584 p_ff_id in number default null,
585 p_ff_name in varchar2 default null,
586 p_ff_cer_id in number default null,
587 p_elp_id in number default null,
588 p_crset_type in varchar2,
589 p_elp_esd in date,
590 p_elp_eed in date default null,
591 p_elp_cer_id in number default null,
592 p_name in varchar2) is
593 l_crs_tr_id number;
594 l_crs_tr_name varchar2(30);
595 l_crs_cer_ovn number;
596 l_crs_cer_id number;
597 l_continue boolean := TRUE;
598 l_hyphen number;
599 l_event_name varchar2(240);
600 l_perf_rating varchar2(240);
601 l_dml_oper varchar2(30);
602 l_eot date := to_date('31-12-4712','DD-MM-RRRR');
603 l_crs_eed date;
604 l_Elg_Ovn Ben_Eligy_Prfl_F.Object_Version_Number%TYPE;
605 begin
606 get_table_route_details(p_table_alias => 'CRSET',
607 p_table_route_id => l_crs_tr_id,
608 p_table_name => l_crs_tr_name);
609 hr_utility.set_location('crs tr name'||l_crs_tr_name,20);
610 if l_crs_tr_name is null then
611 hr_utility.set_location('crs tr name'||l_crs_tr_name,45);
612 l_continue := FALSE;
613 end if;
614 if p_copy_entity_txn_id is null then
615 hr_utility.set_location('CET is '||p_copy_entity_txn_id,50);
616 l_continue := FALSE;
617 end if;
618 if p_crset_id is null then
619 hr_utility.set_location('crset id has to be passed ',55);
620 l_continue := FALSE;
621 end if;
622 if p_elp_id is null then
623 l_dml_oper := 'INSERT';
624 end if;
625 if p_elp_eed is null then
626 l_crs_eed := l_eot;
627 else
628 l_crs_eed := p_elp_eed;
629 end if;
630 Begin
631 If P_Elp_Id is NOT NULL Then
632 l_Elg_Ovn := Pqh_Gsp_Stage_To_Ben.Get_ovn(p_table_name => 'BEN_ELIGY_PRFL_F',
633 p_key_column_name => 'ELIGY_PRFL_ID',
634 p_key_column_value => p_elp_id,
635 P_effective_date => P_effective_date);
636 Else
637 l_Elg_Ovn := NULL;
638 End If;
639 Exception
640 When No_Data_Found Then
641 l_Elg_Ovn := NULL;
642 End;
643 if l_continue then
644 begin
645 -- These mappings have been taken from hrben_to_stage document
646 -- call to create ben_cer is made here using api.
647 ben_copy_entity_results_api.create_copy_entity_results
648 (p_effective_date => p_effective_date
649 ,p_copy_entity_txn_id => p_copy_entity_txn_id
650 ,p_result_type_cd => 'DISPLAY'
651 ,p_table_name => l_crs_tr_name
652 ,p_table_alias => 'CRSET'
653 ,p_table_route_id => l_crs_tr_id
654 ,p_dml_operation => l_dml_oper
655 ,p_information2 => p_elp_esd
656 ,p_information3 => l_crs_eed
657 ,p_information5 => p_name
658 ,p_information151 => p_name
659 ,p_information1 => p_crset_id
660 ,p_information277 => p_elp_id
661 ,p_information160 => p_elp_cer_id
662 ,p_information161 => p_crset_id
663 ,p_information100 => p_crset_type
664 -- copy the cers
665 ,p_INFORMATION222 => p_loc_cer_id
666 ,p_INFORMATION223 => p_job_cer_id
667 ,p_INFORMATION224 => p_org_cer_id
668 ,p_INFORMATION225 => p_ff_cer_id
669 ,p_INFORMATION226 => p_pt_cer_id
670 ,p_INFORMATION227 => p_sa_cer_id
671 ,p_INFORMATION228 => p_bu_cer_id
672 ,p_INFORMATION229 => p_fp_cer_id
673 ,p_INFORMATION230 => p_pr_cer_id
674 -- copy the id/codes
675 ,p_INFORMATION232 => p_loc_id
676 ,p_INFORMATION233 => p_job_id
677 ,p_INFORMATION234 => p_org_id
678 ,p_INFORMATION235 => p_ff_id
679 ,p_INFORMATION236 => p_pt_id
680 ,p_INFORMATION237 => p_sa_id
681 ,p_INFORMATION101 => p_bu_cd
682 ,p_INFORMATION102 => p_fp_cd
683 ,p_INFORMATION103 => p_perf_rtng_cd
684 ,p_INFORMATION104 => p_event_type
685 -- copy the values
686 ,p_INFORMATION179 => p_loc_name
687 ,p_INFORMATION181 => p_job_name
688 ,p_INFORMATION182 => p_org_name
689 ,p_INFORMATION170 => p_ff_name
690 ,p_INFORMATION173 => p_pt_name
691 ,p_INFORMATION185 => p_sa_name
692 ,p_INFORMATION186 => p_bu_name
693 ,p_INFORMATION187 => p_fp_name
694 ,p_INFORMATION188 => p_perf_rtng_name
695 ,p_INFORMATION175 => p_event_name
696 ,p_INFORMATION265 => l_Elg_Ovn
697 ,p_copy_entity_result_id => l_crs_cer_id
698 ,p_object_version_number => l_crs_cer_ovn);
699 exception
700 when others then
701 hr_utility.set_location('some issue in creating crs row ',120);
702 raise;
703 end;
704 end if;
705 end create_crset_row;
706 procedure update_crset(p_crset_id in number,
707 p_effective_date in date,
708 p_crset_name in varchar2,
709 p_copy_entity_txn_id in number,
710 p_datetrack_mode in varchar2,
711 p_bu_cd in varchar2 default null,
712 p_bu_name in varchar2 default null,
713 p_fp_cd in varchar2 default null,
714 p_fp_name in varchar2 default null,
715 p_job_id in number default null,
716 p_job_name in varchar2 default null,
717 p_org_id in number default null,
718 p_org_name in varchar2 default null,
719 p_pt_id in number default null,
720 p_pt_name in varchar2 default null,
721 p_loc_id in number default null,
722 p_loc_name in varchar2 default null,
723 p_perf_rtng_cd in varchar2 default null,
724 p_perf_rtng_name in varchar2 default null,
725 p_event_type in varchar2 default null,
726 p_event_name in varchar2 default null,
727 p_sa_id in number default null,
728 p_sa_name in varchar2 default null,
729 p_ff_id in number default null,
730 p_ff_name in varchar2 default null) is
731 cursor csr_crset is
732 select *
733 from ben_copy_entity_results
734 where copy_entity_txn_id = p_copy_entity_txn_id
735 and table_alias = 'CRSET'
736 and information161 = p_crset_id
737 and p_effective_date between information2 and information3;
738 l_continue boolean := TRUE;
739 l_dml_operation varchar2(30);
740 l_upd_curr varchar2(30);
741 l_del_future varchar2(30);
742 l_crset_eed date;
743 l_upd_effdt varchar2(30);
744 l_ins_row varchar2(30);
745 l_eot date := to_date('31-12-4712','DD-MM-RRRR');
746 begin
747 hr_utility.set_location('inside update_crset ',10);
748 validate_crset(p_name => p_crset_name,
749 p_bu_cd => p_bu_cd,
750 p_bu_name => p_bu_name,
751 p_fp_cd => p_fp_cd,
752 p_fp_name => p_fp_name,
753 p_job_id => p_job_id,
754 p_job_name => p_job_name,
755 p_org_id => p_org_id,
756 p_org_name => p_org_name,
757 p_pt_id => p_pt_id,
758 p_pt_name => p_pt_name,
759 p_loc_id => p_loc_id,
760 p_loc_name => p_loc_name,
761 p_perf_rtng_cd => p_perf_rtng_cd,
762 p_event_type => p_event_type,
763 p_perf_rtng_name => p_perf_rtng_name,
764 p_event_name => p_event_name,
765 p_sa_id => p_sa_id,
766 p_sa_name => p_sa_name,
767 p_ff_id => p_ff_id,
768 p_ff_name => p_ff_name,
769 p_valid => l_continue);
770 hr_utility.set_location('data validated ',10);
771 if p_datetrack_mode not in ('CORRECTION','UPDATE_REPLACE') then
772 hr_utility.set_location('invalid dt mode '||p_datetrack_mode,1);
773 l_continue := false;
774 else
775 hr_utility.set_location('dt mode '||p_datetrack_mode,1);
776 end if;
777 if l_continue then
778 for crset_rec in csr_crset loop
779 hr_utility.set_location('criteria set row found'||substr(p_crset_name,1,40),10);
780 if nvl(crset_rec.dml_operation,'REUSE') = 'REUSE' then
781 l_dml_operation := 'UPDATE';
782 else
783 l_dml_operation := crset_rec.dml_operation;
784 end if;
785 hr_utility.set_location('new dml oper is '||l_dml_operation,4);
786 if p_datetrack_mode = 'CORRECTION' then
787 hr_utility.set_location('same row is to be updated',10);
788 l_upd_curr := 'Y';
789 l_del_future := 'N';
790 l_crset_eed := crset_rec.information3;
791 l_upd_effdt := 'N';
792 l_ins_row := 'N';
793 else
794 if crset_rec.information2 = p_effective_date then
795 -- row is getting updated on same date, so no insert only update
796 hr_utility.set_location('rec started as of today',5);
797 l_ins_row := 'N';
798 l_upd_curr := 'Y';
799 l_upd_effdt := 'N';
800 l_crset_eed := l_eot;
801 if crset_rec.information3 <> l_eot then
802 -- current row goes till end of time so no delete too
803 hr_utility.set_location('rec is not till eot ',5);
804 l_del_future := 'Y';
805 else
806 hr_utility.set_location('rec is till eot ',5);
807 l_del_future := 'N';
808 end if;
809 else
810 hr_utility.set_location('rec started earlier than today',5);
811 l_del_future := 'Y';
812 l_upd_curr := 'N';
813 l_ins_row := 'Y';
814 l_upd_effdt := 'Y';
815 l_crset_eed := p_effective_date - 1;
816 end if;
817 end if;
818 if l_del_future = 'Y' then
819 hr_utility.set_location('deleting future recs',6);
820 delete from ben_copy_entity_results
821 where copy_entity_txn_id = p_copy_entity_txn_id
822 and table_alias = 'CRSET'
823 and information161 = p_crset_id
824 and information2 > p_effective_date;
825 end if;
826 if l_upd_effdt ='Y' then
827 hr_utility.set_location('updating effdt of curr row',6);
828 update ben_copy_entity_results
829 set INFORMATION3 = l_crset_eed
830 where copy_entity_result_id = crset_rec.copy_entity_result_id;
831 end if;
832 if l_upd_curr ='Y' then
833 hr_utility.set_location('updating curr row with new values',6);
834 update ben_copy_entity_results
835 set dml_operation = l_dml_operation,
836 INFORMATION232 = p_loc_id,
837 INFORMATION233 = p_job_id,
838 INFORMATION234 = p_org_id,
839 INFORMATION235 = p_ff_id,
840 INFORMATION236 = p_pt_id,
841 INFORMATION237 = p_sa_id,
842 INFORMATION101 = p_bu_cd,
843 INFORMATION102 = p_fp_cd,
844 INFORMATION103 = p_perf_rtng_cd,
845 INFORMATION104 = p_event_type,
846 INFORMATION179 = p_loc_name,
847 INFORMATION181 = p_job_name,
848 INFORMATION182 = p_org_name,
849 INFORMATION170 = p_ff_name,
850 INFORMATION173 = p_pt_name,
851 INFORMATION185 = p_sa_name,
852 INFORMATION186 = p_bu_name,
853 INFORMATION187 = p_fp_name,
854 INFORMATION188 = p_perf_rtng_name,
855 INFORMATION175 = p_event_name,
856 information151 = p_crset_name,
857 information3 = l_crset_eed
858 where copy_entity_result_id = crset_rec.copy_entity_result_id;
859 end if;
860 if l_ins_row ='Y' then
861 hr_utility.set_location('creating new row with new values',6);
862 create_crset_row(p_crset_id => p_crset_id,
863 p_effective_date => p_effective_date,
864 p_copy_entity_txn_id => p_copy_entity_txn_id,
865 p_bu_cd => p_bu_cd,
866 p_bu_name => p_bu_name,
867 p_bu_cer_id => crset_rec.information228,
868 p_fp_cd => p_fp_cd,
869 p_fp_name => p_fp_name,
870 p_fp_cer_id => crset_rec.information229,
871 p_job_id => p_job_id,
872 p_job_name => p_job_name,
873 p_job_cer_id => crset_rec.information223,
874 p_org_id => p_org_id,
875 p_org_name => p_org_name,
876 p_org_cer_id => crset_rec.information224,
877 p_pt_id => p_pt_id,
878 p_pt_name => p_pt_name,
879 p_pt_cer_id => crset_rec.information226,
880 p_loc_id => p_loc_id,
881 p_loc_name => p_loc_name,
882 p_loc_cer_id => crset_rec.information222,
883 p_perf_rtng_cd => p_perf_rtng_cd,
884 p_event_type => p_event_type,
885 p_perf_rtng_name => p_perf_rtng_name,
886 p_event_name => p_event_name,
887 p_pr_cer_id => crset_rec.information230,
888 p_sa_id => p_sa_id,
889 p_sa_name => p_sa_name,
890 p_sa_cer_id => crset_rec.information227,
891 p_ff_id => p_ff_id,
892 p_ff_name => p_ff_name,
893 p_ff_cer_id => crset_rec.information225,
894 p_crset_type => crset_rec.information100,
895 p_elp_id => crset_rec.information277,
896 p_elp_esd => p_effective_date,
897 p_elp_eed => l_eot,
898 p_name => p_crset_name,
899 p_elp_cer_id => crset_rec.information160);
900 end if;
901 hr_utility.set_location('end of update_crset ',6);
902 end loop;
903 else
904 hr_utility.set_location('invalid data passed',7);
905 end if;
906 hr_utility.set_location('out of update_crset',8);
907 end update_crset;
908 procedure create_crset_row(p_crset_id out nocopy number,
909 p_effective_date in date,
910 p_copy_entity_txn_id in number,
911 p_bu_cd in varchar2 default null,
912 p_bu_name in varchar2 default null,
913 p_fp_cd in varchar2 default null,
914 p_fp_name in varchar2 default null,
915 p_job_id in number default null,
916 p_job_name in varchar2 default null,
917 p_org_id in number default null,
918 p_org_name in varchar2 default null,
919 p_pt_id in number default null,
920 p_pt_name in varchar2 default null,
921 p_loc_id in number default null,
922 p_loc_name in varchar2 default null,
923 p_perf_rtng_cd in varchar2 default null,
924 p_event_type in varchar2 default null,
925 p_perf_rtng_name in varchar2 default null,
926 p_event_name in varchar2 default null,
927 p_sa_id in number default null,
928 p_sa_name in varchar2 default null,
929 p_ff_id in number default null,
930 p_ff_name in varchar2 default null,
931 p_validate in varchar2 default 'TRUE',
932 p_crset_type in varchar2,
933 p_name in varchar2) is
934 l_eot date := to_date('31-12-4712','DD-MM-RRRR');
935 l_crset_id number;
936 l_continue boolean := true;
937 begin
938 if p_validate = 'TRUE' then
939 validate_crset(p_name => p_name,
940 p_bu_cd => p_bu_cd,
941 p_bu_name => p_bu_name,
942 p_fp_cd => p_fp_cd,
943 p_fp_name => p_fp_name,
944 p_job_id => p_job_id,
945 p_job_name => p_job_name,
946 p_org_id => p_org_id,
947 p_org_name => p_org_name,
948 p_pt_id => p_pt_id,
949 p_pt_name => p_pt_name,
950 p_loc_id => p_loc_id,
951 p_loc_name => p_loc_name,
952 p_perf_rtng_cd => p_perf_rtng_cd,
953 p_event_type => p_event_type,
954 p_perf_rtng_name => p_perf_rtng_name,
955 p_event_name => p_event_name,
956 p_sa_id => p_sa_id,
957 p_sa_name => p_sa_name,
958 p_ff_id => p_ff_id,
959 p_ff_name => p_ff_name,
960 p_valid => l_continue);
961 else
962 hr_utility.set_location('data is not to be validated coming from SFL',11);
963 end if;
964 if l_continue then
965 select pqh_gsp_criteria_set_id_s.nextval into l_crset_id from dual;
966 hr_utility.set_location('crset id value is '||l_crset_id,30);
967 create_crset_row
968 (p_crset_id => l_crset_id,
969 p_effective_date => p_effective_date,
970 p_copy_entity_txn_id => p_copy_entity_txn_id,
971 p_bu_cd => p_bu_cd,
972 p_bu_name => p_bu_name,
973 p_fp_cd => p_fp_cd,
974 p_fp_name => p_fp_name,
975 p_job_id => p_job_id,
976 p_job_name => p_job_name,
977 p_org_id => p_org_id,
978 p_org_name => p_org_name,
979 p_pt_id => p_pt_id,
980 p_pt_name => p_pt_name,
981 p_loc_id => p_loc_id,
982 p_loc_name => p_loc_name,
983 p_perf_rtng_cd => p_perf_rtng_cd,
984 p_event_type => p_event_type,
985 p_perf_rtng_name => p_perf_rtng_name,
986 p_event_name => p_event_name,
987 p_sa_id => p_sa_id,
988 p_sa_name => p_sa_name,
989 p_ff_id => p_ff_id,
990 p_ff_name => p_ff_name,
991 p_crset_type => p_crset_type,
992 p_elp_esd => p_effective_date,
993 p_elp_eed => l_eot,
994 p_name => p_name);
995 else
996 hr_utility.set_location('data incomplete',20);
997 end if;
998 p_crset_id := l_crset_id;
999 end create_crset_row;
1000 procedure is_elp_exists_in_crset(p_copy_entity_txn_id in number,
1001 p_elp_id in number,
1002 p_start_date in date,
1003 p_end_date in date,
1004 p_crset_id out nocopy number,
1005 p_crset_type out nocopy varchar2,
1006 p_ins_flag out nocopy boolean) is
1007 cursor csr_crset is
1008 select information151,copy_entity_result_id,information161,information2,information3,information100
1009 from ben_copy_entity_results
1010 where table_alias ='CRSET'
1011 and copy_entity_txn_id = p_copy_entity_txn_id
1012 and information277 = p_elp_id;
1013 begin
1014 -- crset may exist but not for the date range, with this routine we are
1015 -- telling whether it exists or not and also , for this range can the row is to be inserted
1016 -- or not
1017 hr_utility.set_location('inside is_elp_exists_in_crset ',10);
1018 hr_utility.set_location('elp_id is '||p_elp_id,10);
1019 hr_utility.set_location('elp esd '||to_char(p_start_date,'DD-MM-RRRR'),11);
1020 hr_utility.set_location('elp eed '||to_char(p_end_date,'DD-MM-RRRR'),11);
1021 p_ins_flag := true;
1022 for i in csr_crset loop
1023 p_crset_id := i.information161;
1024 p_crset_type := i.information100;
1025 hr_utility.set_location('crset name is '||substr(i.information151,1,45),12);
1026 hr_utility.set_location('crset cer id is '||i.copy_entity_result_id,12);
1027 hr_utility.set_location('crset esd '||to_char(i.information2,'DD-MM-RRRR'),13);
1028 hr_utility.set_location('crset eed '||to_char(i.information3,'DD-MM-RRRR'),14);
1029 if p_start_date between i.information2 and i.information3 and
1030 p_end_date between i.information2 and i.information3 then
1031 p_ins_flag := false;
1032 end if;
1033 end loop;
1034 end is_elp_exists_in_crset;
1035 procedure build_crset_for_elp(p_elp_id in number,
1036 p_copy_entity_txn_id in number,
1037 p_abr_type in varchar2,
1038 p_effective_date in date,
1039 p_business_group_id in number,
1040 p_crset_id out nocopy number) is
1041 l_elp_cer_id number;
1042 l_crset_name varchar2(240);
1043 l_elp_id number;
1044 l_bu_cd varchar2(30);
1045 l_bu_name varchar2(240);
1046 l_fp_name varchar2(240);
1047 l_fp_cd varchar2(30);
1048 l_job_id varchar2(30);
1049 l_org_id varchar2(30);
1050 l_org_name varchar2(240);
1051 l_job_name varchar2(240);
1052 l_loc_name varchar2(240);
1053 l_pt_id varchar2(30);
1054 l_pt_name varchar2(240);
1055 l_pr_name varchar2(240);
1056 l_loc_id varchar2(30);
1057 l_perf_rtng_cd varchar2(30);
1058 l_event_type varchar2(30);
1059 l_perf_rtng_name varchar2(240);
1060 l_event_name varchar2(240);
1061 l_sa_id varchar2(30);
1062 l_sa_name varchar2(30);
1063 l_ff_id varchar2(30);
1064 l_ff_name varchar2(30);
1065 l_continue varchar2(30);
1066 l_elp_esd date;
1067 l_abr_type varchar2(30);
1068 l_crset_type varchar2(30);
1069 l_ins_flag boolean;
1070 l_crset_id number;
1071 l_bu_cer_id number;
1072 l_sa_cer_id number;
1073 l_pt_cer_id number;
1074 l_pr_cer_id number;
1075 l_ff_cer_id number;
1076 l_fp_cer_id number;
1077 l_job_cer_id number;
1078 l_org_cer_id number;
1079 l_loc_cer_id number;
1080 l_hyphen varchar2(30);
1081 cursor csr_elig_prof is
1082 select *
1083 from ben_copy_entity_results
1084 where information1 = p_elp_id
1085 and copy_entity_txn_id = p_copy_entity_txn_id
1086 and table_alias ='ELP'
1087 order by result_type_cd;
1088 cursor csr_elig_crit (l_elp_cer_id number) is
1089 select *
1090 from ben_copy_entity_results
1091 where parent_entity_result_id = l_elp_cer_id
1092 and copy_entity_txn_id = p_copy_entity_txn_id
1093 and l_elp_esd between information2 and information3;
1094 begin
1095 hr_utility.set_location('inside build_crset_for_elp ',10);
1096 for elp_rec in csr_elig_prof loop
1097 hr_utility.set_location('elp avail,pull detl ',30);
1098 l_ins_flag := TRUE;
1099 l_elp_esd := elp_rec.information2;
1100 hr_utility.set_location('elp esd is '||to_char(l_elp_esd,'DD-MM-RRRR'),13);
1101 if l_elp_cer_id is null then
1102 -- as all criteria rows are linked to display elp row, we are getting that
1103 l_elp_cer_id := elp_rec.copy_entity_result_id;
1104 end if;
1105 hr_utility.set_location('elp cer id is '||l_elp_cer_id,13);
1106 -- if crset exists in this txn then we don't have to create it
1107 is_elp_exists_in_crset(p_copy_entity_txn_id => p_copy_entity_txn_id,
1108 p_elp_id => elp_rec.information1,
1109 p_start_date => elp_rec.information2,
1110 p_end_date => elp_rec.information3,
1111 p_crset_id => l_crset_id,
1112 p_ins_flag => l_ins_flag,
1113 p_crset_type => l_crset_type);
1114 hr_utility.set_location('exist crset type is '||l_crset_type,30);
1115 if l_crset_type is null then
1116 l_crset_type := p_abr_type;
1117 elsif ((l_crset_type ='GRADE' and p_abr_type ='POINT') or
1118 (l_crset_type ='POINT' and p_abr_type ='GRADE')) then
1119 l_crset_type := 'GRADE_POINT';
1120 hr_utility.set_location('upd crset type is '||l_crset_type,30);
1121 update_crset_type(p_copy_entity_txn_id => p_copy_entity_txn_id,
1122 p_crset_id => l_crset_id,
1123 p_crset_type => l_crset_type);
1124 end if;
1125 hr_utility.set_location('crset type updated to be '||l_crset_type,30);
1126 if l_ins_flag then
1127 -- the elp current row is to be inserted in crset table
1128 -- if crset id is null then new crset is to be pulled from seq.
1129 if l_crset_id is null then
1130 select pqh_gsp_criteria_set_id_s.nextval into l_crset_id from dual;
1131 hr_utility.set_location('crset id value is '||l_crset_id,30);
1132 end if;
1133
1134 l_bu_cd := null;
1135 l_bu_name := null;
1136 l_bu_cer_id := null;
1137
1138 l_fp_name := null;
1139 l_fp_cd := null;
1140 l_fp_cer_id := null;
1141
1142 l_job_id := null;
1143 l_job_name := null;
1144 l_job_cer_id := null;
1145
1146 l_org_id := null;
1147 l_org_name := null;
1148 l_org_cer_id := null;
1149
1150 l_pt_id := null;
1151 l_pt_name := null;
1152 l_pt_cer_id := null;
1153
1154 l_loc_id := null;
1155 l_loc_name := null;
1156 l_loc_cer_id := null;
1157
1158 l_pr_cer_id := null;
1159 l_pr_name := null;
1160 l_perf_rtng_cd := null;
1161 l_event_type := null;
1162 l_perf_rtng_name := null;
1163 l_event_name := null;
1164
1165 l_sa_id := null;
1166 l_sa_name := null;
1167 l_sa_cer_id := null;
1168
1169 l_ff_id := null;
1170 l_ff_name := null;
1171 l_ff_cer_id := null;
1172
1173 hr_utility.set_location('local_var initialized',11);
1174 for crit_rec in csr_elig_crit(l_elp_cer_id ) loop
1175 hr_utility.set_location('table alias is '||crit_rec.table_alias,30);
1176 if crit_rec.table_alias = 'EBU' then
1177 l_bu_cd := crit_rec.information11;
1178 l_bu_name := crit_rec.information5;
1179 l_bu_cer_id := crit_rec.copy_entity_result_id;
1180 hr_utility.set_location('bargain_unit is '||substr(l_bu_name,1,40),11);
1181 elsif crit_rec.table_alias = 'EFP' then
1182 l_fp_cd := crit_rec.information12;
1183 l_fp_name := crit_rec.information5;
1184 l_fp_cer_id := crit_rec.copy_entity_result_id;
1185 hr_utility.set_location('fp is '||substr(l_fp_name,1,40),11);
1186 elsif crit_rec.table_alias = 'EJP' then
1187 l_job_id := crit_rec.information174;
1188 l_job_name := crit_rec.information5;
1189 l_job_cer_id := crit_rec.copy_entity_result_id;
1190 hr_utility.set_location('job is '||substr(l_job_name,1,40),11);
1191 elsif crit_rec.table_alias = 'EOU' then
1192 l_org_id := crit_rec.information174;
1193 l_org_name := crit_rec.information5;
1194 l_org_cer_id := crit_rec.copy_entity_result_id;
1195 hr_utility.set_location('org is '||substr(l_org_name,1,40),11);
1196 elsif crit_rec.table_alias = 'EPT' then
1197 l_pt_id := crit_rec.information174;
1198 l_pt_name := crit_rec.information5;
1199 l_pt_cer_id := crit_rec.copy_entity_result_id;
1200 hr_utility.set_location('per_typ is '||substr(l_pt_name,1,40),11);
1201 elsif crit_rec.table_alias = 'EWL' then
1202 l_loc_id := crit_rec.information174;
1203 l_loc_name := crit_rec.information5;
1204 l_loc_cer_id := crit_rec.copy_entity_result_id;
1205 hr_utility.set_location('loc is '||substr(l_loc_name,1,40),11);
1206 elsif crit_rec.table_alias = 'ERG' then
1207 l_event_type := crit_rec.information12;
1208 l_perf_rtng_cd := crit_rec.information13;
1209 l_pr_name := crit_rec.information5;
1210 l_pr_cer_id := crit_rec.copy_entity_result_id;
1211 if l_pr_name is not null then
1212 l_hyphen := instr(l_pr_name,'-');
1213 l_perf_rtng_name := substr(l_pr_name,1,l_hyphen-1);
1214 l_event_name := substr(l_pr_name,l_hyphen+2);
1215 end if;
1216 hr_utility.set_location('perf_rtng is '||substr(l_pr_name,1,40),11);
1217 elsif crit_rec.table_alias = 'ESA' then
1218 l_sa_id := crit_rec.information241;
1219 l_sa_name := crit_rec.information5;
1220 l_sa_cer_id := crit_rec.copy_entity_result_id;
1221 hr_utility.set_location('svc_area is '||substr(l_sa_name,1,40),11);
1222 elsif crit_rec.table_alias = 'ERL' then
1223 l_ff_id := crit_rec.information251;
1224 l_ff_name := crit_rec.information5;
1225 l_ff_cer_id := crit_rec.copy_entity_result_id;
1226 hr_utility.set_location('rule is '||substr(l_ff_name,1,40),11);
1227 end if;
1228 end loop;
1229 hr_utility.set_location('all variables pulled',11);
1230 create_crset_row(p_crset_id => l_crset_id,
1231 p_effective_date => p_effective_date,
1232 p_copy_entity_txn_id => p_copy_entity_txn_id,
1233 p_bu_cd => l_bu_cd,
1234 p_bu_name => l_bu_name,
1235 p_bu_cer_id => l_bu_cer_id,
1236 p_fp_cd => l_fp_cd,
1237 p_fp_name => l_fp_name,
1238 p_fp_cer_id => l_fp_cer_id,
1239 p_job_id => l_job_id,
1240 p_job_name => l_job_name,
1241 p_job_cer_id => l_job_cer_id,
1242 p_org_id => l_org_id,
1243 p_org_name => l_org_name,
1244 p_org_cer_id => l_org_cer_id,
1245 p_pt_id => l_pt_id,
1246 p_pt_name => l_pt_name,
1247 p_pt_cer_id => l_pt_cer_id,
1248 p_loc_id => l_loc_id,
1249 p_loc_name => l_loc_name,
1250 p_loc_cer_id => l_loc_cer_id,
1251 p_perf_rtng_cd => l_perf_rtng_cd,
1252 p_event_type => l_event_type,
1253 p_perf_rtng_name => l_perf_rtng_name,
1254 p_event_name => l_event_name,
1255 p_pr_cer_id => l_pr_cer_id,
1256 p_sa_id => l_sa_id,
1257 p_sa_name => l_sa_name,
1258 p_sa_cer_id => l_sa_cer_id,
1259 p_ff_id => l_ff_id,
1260 p_ff_name => l_ff_name,
1261 p_ff_cer_id => l_ff_cer_id,
1262 p_crset_type => l_crset_type,
1263 p_elp_id => elp_rec.information1,
1264 p_elp_esd => elp_rec.information2,
1265 p_elp_eed => elp_rec.information3,
1266 p_name => substr(elp_rec.information5,1,150),
1267 p_elp_cer_id => elp_rec.copy_entity_result_id);
1268 else
1269 hr_utility.set_location('elp row in crset,skipping',50);
1270 end if;
1271 end loop;
1272 p_crset_id := l_crset_id;
1273 hr_utility.set_location('build_crset_for_elp done',50);
1274 end build_crset_for_elp;
1275 procedure pull_elp_for_crset(p_elp_id in number,
1276 p_copy_entity_txn_id in number,
1277 p_crset_type in varchar2,
1278 p_effective_date in date,
1279 p_business_group_id in number,
1280 p_crset_id out nocopy number,
1281 p_dup_crset out nocopy varchar2) is
1282 l_elp_cer_id number;
1283 l_job_id number;
1284 l_loc_id number;
1285 l_org_id number;
1286 l_rule_id number;
1287 l_pt_id number;
1288 l_sa_id number;
1289 l_bu_cd varchar2(30);
1290 l_pr_cd varchar2(30);
1291 l_event_type varchar2(30);
1292 l_crset_name varchar2(240);
1293 l_fp_cd varchar2(30);
1294 l_dup_exists varchar2(30) := 'N';
1295 l_dup_crset varchar2(150);
1296 cursor crset_rec is select information151 crset_name,
1297 INFORMATION232 loc_id,
1298 INFORMATION233 job_id,
1299 INFORMATION234 org_id,
1300 INFORMATION235 rule_id,
1301 INFORMATION236 pt_id,
1302 INFORMATION237 sa_id,
1303 INFORMATION101 bu_cd,
1304 INFORMATION102 fp_cd,
1305 INFORMATION103 pr_cd,
1306 INFORMATION104 event_type
1307 from ben_copy_entity_results
1308 where copy_entity_txn_id = p_copy_entity_txn_id
1309 and table_alias ='CRSET'
1310 and information161 = p_crset_id
1311 and p_effective_date between information2 and information3;
1312 begin
1313 hr_utility.set_location('elig-prof to be copied',1);
1314 savepoint pull_elp;
1315 populate_ep_hierarchy(p_copy_entity_txn_id => p_copy_entity_txn_id,
1316 p_effective_date => p_effective_date,
1317 p_business_group_id => p_business_group_id,
1318 p_business_area => 'PQH_GSP_TASK_LIST',
1319 p_ep_id => p_elp_id,
1320 p_ep_cer_id => l_elp_cer_id);
1321 hr_utility.set_location('elig-prof copied',10);
1322 build_crset_for_elp(p_elp_id => p_elp_id,
1323 p_copy_entity_txn_id => p_copy_entity_txn_id,
1324 p_abr_type => p_crset_type,
1325 p_effective_date => p_effective_date,
1326 p_business_group_id => p_business_group_id,
1327 p_crset_id => p_crset_id);
1328 hr_utility.set_location('crset is '||p_crset_id,20);
1329 if p_crset_id is not null then
1330 open crset_rec;
1331 fetch crset_rec into l_crset_name,l_loc_id,l_job_id,l_org_id,l_rule_id,l_pt_id,l_sa_id,l_bu_cd,l_fp_cd,l_pr_cd,l_event_type;
1332 if crset_rec%found then
1333 pqh_gsp_utility.chk_duplicate_crset_exists(
1334 p_copy_entity_txn_id => p_copy_entity_txn_id,
1335 p_effective_date => p_effective_date,
1336 p_cset_id => p_crset_id,
1337 p_location_id => l_loc_id,
1338 p_job_id => l_job_id,
1339 p_org_id => l_org_id,
1340 p_rule_id => l_rule_id,
1341 p_person_type_id => l_pt_id,
1342 p_service_area_id => l_sa_id,
1343 p_barg_unit_cd => l_bu_cd,
1344 p_full_part_time_cd => l_fp_cd,
1345 p_perf_type_cd => l_pr_cd,
1346 p_rating_type_cd => l_event_type,
1347 p_duplicate_exists => l_dup_exists,
1348 p_duplicate_cset_name => l_dup_crset);
1349 if l_dup_exists = 'Y' then
1350 rollback to pull_elp;
1351 p_dup_crset := l_dup_crset;
1352 end if;
1353 end if;
1354 close crset_rec;
1355 end if;
1356 exception
1357 when others then
1358 raise;
1359 end pull_elp_for_crset;
1360 procedure vpf_to_stage(p_vpf_cer_id in number,
1361 p_copy_entity_txn_id in number,
1362 p_effective_date in date,
1363 p_result_type_cd in varchar2) is
1364 l_abr_cer_id number;
1365 l_crr_cer_id number;
1366 l_vpf_name varchar2(240);
1367 l_vpf_value number;
1368 l_vpf_id number;
1369 l_vpf_ovn number;
1370 l_pl_id number;
1371 l_opt_id number;
1372 l_continue varchar2(30) := 'Y';
1373 l_abr_type varchar2(30);
1374 l_dis_vpf_cer_id number;
1375 l_crset_id number;
1376 l_grade_cer_id number;
1377 l_point_cer_id number;
1378 l_vpf_esd date;
1379 l_vpf_eed date;
1380 l_bg number;
1381 l_elp_id number;
1382 begin
1383 hr_utility.set_location('inside vpf_to_stage ',10);
1384 -- variable rate row is pulled to staging area, based on this we have to build
1385 -- crrate row and crset row
1386 -- the hierarchy on the ben side is like this
1387 -- abr -> avr -> vpf -> vep -> elp -> criteria rows
1388 begin
1389 select PARENT_ENTITY_RESULT_ID , -- abr_cer_id
1390 INFORMATION170 NAME , -- name of Variable Rate
1391 INFORMATION303 VAL , -- value
1392 INFORMATION2 esd , -- st dt
1393 INFORMATION3 eed , -- end dt
1394 INFORMATION4 bg , -- end dt
1395 INFORMATION1 VRBL_RT_PRFL_ID , -- pk of database row
1396 INFORMATION265 ovn
1397 into l_abr_cer_id,l_vpf_name, l_vpf_value, l_vpf_esd, l_vpf_eed, l_bg, l_vpf_id, l_vpf_ovn
1398 from ben_copy_entity_results
1399 where copy_entity_result_id = p_vpf_cer_id
1400 and information72 ='GSPSA'
1401 and INFORMATION77 = 'A';
1402 exception
1403 when no_data_found then
1404 hr_utility.set_location('vpf is not for GSP ',10);
1405 l_continue := 'N';
1406 when others then
1407 hr_utility.set_location('issues in getting vpf ',20);
1408 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1409 (P_MASTER_TXN_ID => g_master_txn_id,
1410 P_TXN_ID => g_txn_id,
1411 p_context => 'vpf_to_stage_vpf_pull',
1412 P_MODULE_CD => 'PQH_GSP_BENSTG',
1413 P_MESSAGE_TYPE_CD => 'E',
1414 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1415 p_effective_date => p_effective_date);
1416 raise;
1417 end;
1418 hr_utility.set_location('abr cer id is '||l_abr_cer_id,10);
1419 get_abr_detl(p_abr_cer_id => l_abr_cer_id,
1420 p_abr_type => l_abr_type,
1421 p_pl_id => l_pl_id,
1422 p_opt_id => l_opt_id,
1423 p_grade_cer_id => l_grade_cer_id,
1424 p_point_cer_id => l_point_cer_id);
1425 hr_utility.set_location('abr_type is '||l_abr_type,10);
1426 if l_abr_type is null then
1427 l_continue := 'N';
1428 end if;
1429 if p_result_type_cd <> 'DISPLAY' then
1430 l_dis_vpf_cer_id := get_display_vpf_cer(p_vpf_id => l_vpf_id,
1431 p_copy_entity_txn_id => p_copy_entity_txn_id);
1432 else
1433 l_dis_vpf_cer_id := p_vpf_cer_id;
1434 end if;
1435 if l_dis_vpf_cer_id is not null then
1436 l_elp_id := get_elp_for_vpf(p_vpf_cer_id => l_dis_vpf_cer_id,
1437 p_copy_entity_txn_id => p_copy_entity_txn_id,
1438 p_effective_date => p_effective_date);
1439 if l_elp_id is null then
1440 l_continue := 'N';
1441 end if;
1442 else
1443 l_continue := 'N';
1444 end if;
1445 if l_continue = 'Y' then
1446 build_crset_for_elp(p_elp_id => l_elp_id,
1447 p_copy_entity_txn_id => p_copy_entity_txn_id,
1448 p_abr_type => l_abr_type,
1449 p_business_group_id => l_bg,
1450 p_effective_date => p_effective_date,
1451 p_crset_id => l_crset_id);
1452 end if;
1453 if l_crset_id is not null then
1454 create_crrate_row(p_vpf_cer_id => p_vpf_cer_id,
1455 p_abr_cer_id => l_abr_cer_id,
1456 p_vpf_id => l_vpf_id,
1457 p_vpf_ovn => l_vpf_ovn,
1458 p_vpf_name => l_vpf_name,
1459 p_grade_cer_id => l_grade_cer_id,
1460 p_point_cer_id => l_point_cer_id,
1461 p_copy_entity_txn_id => p_copy_entity_txn_id,
1462 p_business_group_id => l_bg,
1463 p_effective_date => p_effective_date,
1464 p_vpf_esd => l_vpf_esd,
1465 p_vpf_eed => l_vpf_eed,
1466 p_vpf_value => l_vpf_value,
1467 p_crset_id => l_crset_id,
1468 p_dml_operation => 'REUSE',
1469 p_elp_id => l_elp_id,
1470 p_crr_cer_id => l_crr_cer_id);
1471 end if;
1472 hr_utility.set_location('vpf_to_stage done',50);
1473 exception
1474 when others then
1475 hr_utility.set_location('issues in vpf_to_stage ',20);
1476 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1477 (P_MASTER_TXN_ID => g_master_txn_id,
1478 P_TXN_ID => g_txn_id,
1479 p_context => 'vpf_to_stage',
1480 P_MODULE_CD => 'PQH_GSP_BENSTG',
1481 P_MESSAGE_TYPE_CD => 'E',
1482 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1483 p_effective_date => p_effective_date);
1484 raise;
1485 end vpf_to_stage;
1486 procedure scl_writeback(p_copy_entity_txn_id in number,
1487 p_scale_id in number,
1488 p_scale_cer_id in number) is
1489 begin
1490 -- this routine will update scale_cer_id for all plips
1491 update ben_copy_entity_results
1492 set information255 = p_scale_id,
1493 information258 = p_scale_cer_id
1494 where table_alias = 'CPP'
1495 and copy_entity_txn_id = p_copy_entity_txn_id
1496 and (information258 = p_scale_cer_id or information255 = p_scale_id);
1497 exception
1498 when others then
1499 hr_utility.set_location('issue in updating parent ',420);
1500 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1501 (P_MASTER_TXN_ID => g_master_txn_id,
1502 P_TXN_ID => g_txn_id,
1503 p_context => 'scl_writeback',
1504 P_MODULE_CD => 'PQH_GSP_BENSTG',
1505 P_MESSAGE_TYPE_CD => 'E',
1506 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1507 p_effective_date => trunc(sysdate));
1508 raise;
1509 end scl_writeback;
1510 -- this routine is not needed as of now, because elig-prof can be attached to
1511 -- oipls only
1512 procedure change_parent_oipl(p_copy_entity_txn_id in number,
1513 p_oipl_cer_id in number,
1514 p_opt_cer_id in number) is
1515 begin
1516 hr_utility.set_location('inside chg_parent for oipl'||p_oipl_cer_id,10);
1517 begin
1518 update ben_copy_entity_results
1519 set parent_entity_result_id = p_oipl_cer_id,
1520 gs_parent_entity_result_id = p_oipl_cer_id
1521 where table_alias = 'ELP'
1522 and copy_entity_txn_id = p_copy_entity_txn_id
1523 and parent_entity_result_id = p_opt_cer_id;
1524 hr_utility.set_location('ELP rows changed '||p_oipl_cer_id,20);
1525 exception
1526 when others then
1527 hr_utility.set_location('issue in updating parent ',420);
1528 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1529 (P_MASTER_TXN_ID => g_master_txn_id,
1530 P_TXN_ID => g_txn_id,
1531 p_context => 'change_parent_oipl',
1532 P_MODULE_CD => 'PQH_GSP_BENSTG',
1533 P_MESSAGE_TYPE_CD => 'E',
1534 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1535 p_effective_date => trunc(sysdate));
1536 raise;
1537 end;
1538 end change_parent_oipl;
1539 procedure change_parent_plip(p_copy_entity_txn_id in number,
1540 p_plip_cer_id in number,
1541 p_pl_cer_id in number) is
1542 begin
1543 hr_utility.set_location('inside chg_parent for plp: plip_cer'||p_plip_cer_id,10);
1544 hr_utility.set_location('inside chg_parent for plp: pl_cer'||p_pl_cer_id,20);
1545 -- The following Update Call is commented as the same is taken care by plan Copy APIs
1546 -- update_txn_table_route(p_copy_entity_txn_id);
1547 hr_utility.set_location('table routes updated ',25);
1548 begin
1549 update ben_copy_entity_results
1550 set parent_entity_result_id = p_plip_cer_id,
1551 gs_parent_entity_result_id = p_plip_cer_id
1552 where table_alias = 'COP'
1553 and copy_entity_txn_id = p_copy_entity_txn_id
1554 and parent_entity_result_id = p_pl_cer_id;
1555 hr_utility.set_location('oipl rows changed '||p_plip_cer_id,420);
1556 exception
1557 when others then
1558 hr_utility.set_location('issue in updating parent ',420);
1559 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1560 (P_MASTER_TXN_ID => g_master_txn_id,
1561 P_TXN_ID => g_txn_id,
1562 p_context => 'change_parent_plip',
1563 P_MODULE_CD => 'PQH_GSP_BENSTG',
1564 P_MESSAGE_TYPE_CD => 'E',
1565 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1566 p_effective_date => trunc(sysdate));
1567 raise;
1568 end;
1569 begin
1570 update ben_copy_entity_results
1571 set parent_entity_result_id = p_plip_cer_id,
1572 gs_parent_entity_result_id = p_plip_cer_id
1573 where table_alias = 'ELP'
1574 and copy_entity_txn_id = p_copy_entity_txn_id
1575 and parent_entity_result_id = p_pl_cer_id;
1576 hr_utility.set_location('ELP rows changed '||p_plip_cer_id,420);
1577 exception
1578 when others then
1579 hr_utility.set_location('issue in updating parent ',420);
1580 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1581 (P_MASTER_TXN_ID => g_master_txn_id,
1582 P_TXN_ID => g_txn_id,
1583 p_context => 'change_parent_plip-2',
1584 P_MODULE_CD => 'PQH_GSP_BENSTG',
1585 P_MESSAGE_TYPE_CD => 'E',
1586 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1587 p_effective_date => trunc(sysdate));
1588 raise;
1589 end;
1590 end change_parent_plip;
1591 procedure create_plip_row(p_copy_entity_txn_id in number,
1592 p_effective_date in date,
1593 p_business_group_id in number,
1594 p_grade_id in number,
1595 p_pgm_cer_id in number,
1596 p_pl_cer_id in number default null,
1597 p_grade_name in varchar2,
1598 p_plip_cer_id out nocopy number,
1599 p_plip_cer_ovn out nocopy number) is
1600 l_cpp_tr_id number;
1601 l_cpp_tr_name varchar2(80);
1602 l_grd_short_name varchar2(30);
1603 l_grd_date_from date;
1604 l_grd_date_to date;
1605 l_ordr_num number;
1606 begin
1607 get_table_route_details(p_table_alias => 'CPP',
1608 p_table_route_id => l_cpp_tr_id,
1609 p_table_name => l_cpp_tr_name);
1610 if p_pl_cer_id is not null then
1611 select information102,information307,information308
1612 into l_grd_short_name,l_grd_date_from,l_grd_date_to
1613 from ben_copy_entity_results
1614 where copy_entity_result_id = p_pl_cer_id;
1615 end if;
1616 begin
1617 select max(information263) into l_ordr_num
1618 from ben_copy_entity_results
1619 where copy_entity_txn_id = p_copy_entity_txn_id
1620 and table_alias = 'CPP';
1621 l_ordr_num := nvl(l_ordr_num,0) + 1;
1622 hr_utility.set_location('ord_num is '||l_ordr_num,20);
1623 end;
1624 begin
1625 ben_copy_entity_results_api.create_copy_entity_results(
1626 p_effective_date => p_effective_date
1627 ,p_copy_entity_txn_id => p_copy_entity_txn_id
1628 ,p_gs_mr_src_entity_result_id => p_pgm_cer_id
1629 ,p_gs_parent_entity_result_id => p_pgm_cer_id
1630 ,p_mirror_src_entity_result_id => p_pgm_cer_id
1631 ,p_parent_entity_result_id => p_pgm_cer_id
1632 ,p_result_type_cd => 'DISPLAY'
1633 ,p_table_name => l_cpp_tr_name
1634 ,p_table_route_id => l_cpp_tr_id
1635 ,p_table_alias => 'CPP'
1636 ,p_dml_operation => 'INSERT'
1637 -- ,p_information1 => p_plip_id -- new ben object
1638 ,p_information2 => p_effective_date
1639 ,p_information4 => p_business_group_id
1640 ,p_information5 => p_grade_name
1641 ,p_information12 => l_grd_short_name
1642 ,p_information104 => 'LINK'
1643 ,p_information252 => p_pl_cer_id
1644 ,p_information263 => l_ordr_num
1645 ,p_information306 => l_grd_date_from
1646 ,p_information307 => l_grd_date_to
1647 ,p_copy_entity_result_id => p_plip_cer_id
1648 ,p_object_version_number => p_plip_cer_ovn);
1649 exception
1650 when others then
1651 hr_utility.set_location('issue in creation cpp cer '||p_grade_id,400);
1652 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1653 (P_MASTER_TXN_ID => g_master_txn_id,
1654 P_TXN_ID => g_txn_id,
1655 p_context => 'create_plip_row',
1656 P_MODULE_CD => 'PQH_GSP_BENSTG',
1657 P_MESSAGE_TYPE_CD => 'E',
1658 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1659 p_effective_date => p_effective_date);
1660 raise;
1661 end;
1662 exception
1663 when others then
1664 hr_utility.set_location('issue in cpp cer '||p_grade_id,420);
1665 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1666 (P_MASTER_TXN_ID => g_master_txn_id,
1667 P_TXN_ID => g_txn_id,
1668 p_context => 'create_plip_row2',
1669 P_MODULE_CD => 'PQH_GSP_BENSTG',
1670 P_MESSAGE_TYPE_CD => 'E',
1671 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1672 p_effective_date => p_effective_date);
1673 raise;
1674 end create_plip_row;
1675 function get_grd_start_date(p_grade_cer_id in number) return date is
1676 l_start_date date;
1677 begin
1678 select information307
1679 into l_start_date
1680 from ben_copy_entity_results
1681 where copy_entity_result_id = p_grade_cer_id;
1682 return l_start_date;
1683 exception
1684 when others then
1685 hr_utility.set_location('issue in getting grd start date '||p_grade_cer_id,10);
1686 raise;
1687 end get_grd_start_date;
1688 procedure post_pull_process(p_copy_entity_txn_id in number,
1689 p_start_cer in number default null,
1690 p_effective_date in date,
1691 p_business_group_id in number,
1692 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST') is
1693 cursor csr_scl is
1694 select copy_entity_result_id,information1
1695 from ben_copy_entity_results
1696 where copy_entity_txn_id = p_copy_entity_txn_id
1697 and table_alias ='SCALE';
1698 begin
1699 -- update_txn_table_route(p_copy_entity_txn_id);
1700 begin
1701 hr_to_stage(p_copy_entity_txn_id => p_copy_entity_txn_id,
1702 p_start_cer_id => p_start_cer,
1703 p_effective_date => p_effective_date,
1704 p_business_group_id => p_business_group_id,
1705 p_business_area => p_business_area);
1706 exception
1707 when others then
1708 hr_utility.set_location('issues in copying hr data on hier',30);
1709 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1710 (P_MASTER_TXN_ID => g_master_txn_id,
1711 P_TXN_ID => g_txn_id,
1712 p_context => 'post_pull_process',
1713 P_MODULE_CD => 'PQH_GSP_BENSTG',
1714 P_MESSAGE_TYPE_CD => 'E',
1715 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1716 p_effective_date => p_effective_date);
1717 raise;
1718 end;
1719 for scl_rec in csr_scl loop
1720 hr_utility.set_location('scale cer id is '||scl_rec.copy_entity_result_id,20);
1721 scl_writeback(p_copy_entity_txn_id => p_copy_entity_txn_id,
1722 p_scale_id => scl_rec.information1,
1723 p_scale_cer_id => scl_rec.copy_entity_result_id);
1724 end loop;
1725 PQH_PROCESS_BATCH_LOG.END_LOG;
1726 end post_pull_process;
1727 procedure cep_to_stage(p_cep_cer_id in number,
1728 p_copy_entity_txn_id in number) is
1729 begin
1730 hr_utility.set_location('inside cep_to_stage ',10);
1731 update ben_copy_entity_results
1732 set gs_parent_entity_result_id = parent_entity_result_id,
1733 gs_mirror_src_entity_result_id = mirror_src_entity_result_id
1734 where copy_entity_txn_id = p_copy_entity_txn_id
1735 and copy_entity_result_id = p_cep_cer_id
1736 and gs_parent_entity_result_id is null;
1737 hr_utility.set_location('cep_to_stage done',50);
1738 exception
1739 when others then
1740 hr_utility.set_location('issues in updating cep row',20);
1741 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1742 (P_MASTER_TXN_ID => g_master_txn_id,
1743 P_TXN_ID => g_txn_id,
1744 p_context => 'cep_to_stage',
1745 P_MODULE_CD => 'PQH_GSP_BENSTG',
1746 P_MESSAGE_TYPE_CD => 'E',
1747 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1748 p_effective_date => trunc(sysdate));
1749 raise;
1750 end cep_to_stage;
1751 procedure epa_to_stage(p_epa_cer_id in number,
1752 p_copy_entity_txn_id in number) is
1753 begin
1754 hr_utility.set_location('inside epa_to_stage ',10);
1755 update ben_copy_entity_results
1756 set gs_parent_entity_result_id = parent_entity_result_id,
1757 gs_mirror_src_entity_result_id = mirror_src_entity_result_id
1758 where copy_entity_txn_id = p_copy_entity_txn_id
1759 and copy_entity_result_id = p_epa_cer_id
1760 and gs_parent_entity_result_id is null;
1761 hr_utility.set_location('epa_to_stage done',50);
1762 exception
1763 when others then
1764 hr_utility.set_location('issues in updating epa row',20);
1765 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1766 (P_MASTER_TXN_ID => g_master_txn_id,
1767 P_TXN_ID => g_txn_id,
1768 p_context => 'epa_to_stage',
1769 P_MODULE_CD => 'PQH_GSP_BENSTG',
1770 P_MESSAGE_TYPE_CD => 'E',
1771 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1772 p_effective_date => trunc(sysdate));
1773 raise;
1774 end epa_to_stage;
1775 procedure elp_to_stage(p_elp_cer_id in number,
1776 p_copy_entity_txn_id in number,
1777 p_effective_date in date,
1778 p_elpro_id in number,
1779 p_business_group_id in number) is
1780 Cursor Cs_Cep is
1781 Select Cep.Result_Type_cd
1782 From Ben_Copy_Entity_results ELP,
1783 Ben_Copy_Entity_Results CEP
1784 Where Elp.Copy_Entity_Txn_Id = p_Copy_Entity_Txn_Id
1785 and Elp.Copy_Entity_Result_id = p_Elp_Cer_Id
1786 and Cep.Copy_Entity_Txn_Id = Elp.Copy_Entity_Txn_id
1787 and Cep.Copy_Entity_Result_id = Elp.Mirror_Src_Entity_result_id
1788 and Elp.information1 is not null;
1789
1790 L_Result_type_Cd Ben_Copy_Entity_Results.Result_type_Cd%TYPE;
1791 begin
1792
1793 Open Cs_Cep;
1794 Fetch Cs_Cep into l_Result_type_Cd;
1795 Close cs_Cep;
1796
1797 hr_utility.set_location('inside elp_to_stage ',10);
1798 begin
1799 hr_utility.set_location('updating crit rows ',15);
1800 update ben_copy_entity_results
1801 set gs_parent_entity_result_id = parent_entity_result_id,
1802 gs_mirror_src_entity_result_id = mirror_src_entity_result_id,
1803 information101 = information1,
1804 information1 = null
1805 where copy_entity_txn_id = p_copy_entity_txn_id
1806 and parent_entity_result_id = p_elp_cer_id;
1807 exception
1808 when others then
1809 hr_utility.set_location('issues in updating criteria rows ',20);
1810 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1811 (P_MASTER_TXN_ID => g_master_txn_id,
1812 P_TXN_ID => g_txn_id,
1813 p_context => 'elp_to_stage',
1814 P_MODULE_CD => 'PQH_GSP_BENSTG',
1815 P_MESSAGE_TYPE_CD => 'E',
1816 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1817 p_effective_date => trunc(sysdate));
1818 raise;
1819 end;
1820 begin
1821 hr_utility.set_location('updating elp row ',15);
1822 update ben_copy_entity_results
1823 set gs_parent_entity_result_id = parent_entity_result_id,
1824 gs_mirror_src_entity_result_id = mirror_src_entity_result_id,
1825 Result_type_cd = Nvl(l_Result_type_Cd, result_type_Cd)
1826 where copy_entity_txn_id = p_copy_entity_txn_id
1827 and copy_entity_result_id = p_elp_cer_id;
1828
1829 update ben_copy_entity_results
1830 set result_type_cd = 'NO DISPLAY'
1831 where copy_entity_txn_id = p_copy_entity_txn_id
1832 and copy_entity_result_id = p_elp_cer_id
1833 and table_alias = 'ELP'
1834 and p_Effective_Date not between information2 and information3;
1835
1836 pqh_gsp_prgrules.nullify_elp_rec (
1837 p_copy_entity_result_id => p_elp_cer_id
1838 ,p_copy_entity_txn_id => p_copy_entity_txn_id
1839 );
1840 exception
1841 when others then
1842 hr_utility.set_location('issues in updating criteria rows ',20);
1843 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1844 (P_MASTER_TXN_ID => g_master_txn_id,
1845 P_TXN_ID => g_txn_id,
1846 p_context => 'elp_to_stage2',
1847 P_MODULE_CD => 'PQH_GSP_BENSTG',
1848 P_MESSAGE_TYPE_CD => 'E',
1849 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1850 p_effective_date => trunc(sysdate));
1851 raise;
1852 end;
1853
1854 hr_utility.set_location('elp_to_stage done',50);
1855
1856 end elp_to_stage;
1857 function get_ep_id(p_prtn_elig_prfl_id in number,
1858 p_effective_date in date) return number is
1859 cursor csr_elp is
1860 select eligy_prfl_id
1861 from ben_prtn_elig_prfl_f
1862 where p_effective_date between effective_start_date and effective_end_date
1863 and prtn_elig_prfl_id = p_prtn_elig_prfl_id;
1864 l_ep_id number;
1865 begin
1866 hr_utility.set_location('getting EP for PEP'||p_prtn_elig_prfl_id,10);
1867 for i in csr_elp loop
1868 l_ep_id := i.eligy_prfl_id;
1869 end loop;
1870 return l_ep_id;
1871 exception
1872 when others then
1873 hr_utility.set_location('issues in pulling EP for PEP',20);
1874 raise;
1875 end;
1876 function get_co_std_rate(p_plan_id in number default null,
1877 p_opt_id in number default null,
1878 p_effective_date in date,
1879 p_pay_rule_id out nocopy number) return number is
1880 l_abr_id number;
1881 begin
1882 if p_plan_id is null and p_opt_id is null then
1883 hr_utility.set_location('both plan and option passed is null',10);
1884 return 0;
1885 elsif p_plan_id is not null and p_opt_id is not null then
1886 hr_utility.set_location('both plan and option are passed ',20);
1887 return 0;
1888 elsif p_plan_id is not null and p_opt_id is null then
1889 begin
1890 select acty_base_rt_id,pay_rate_grade_rule_id
1891 into l_abr_id,p_pay_rule_id
1892 from ben_acty_base_rt_f
1893 where p_effective_date between effective_start_date and effective_end_date
1894 and pl_id = p_plan_id
1895 and acty_typ_cd ='GSPSA'; -- we are interested only in this type
1896 exception
1897 when no_data_found then
1898 hr_utility.set_location('no pl rate defined '||p_plan_id,30);
1899 when others then
1900 hr_utility.set_location('issues in getting rate ',40);
1901 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1902 (P_MASTER_TXN_ID => g_master_txn_id,
1903 P_TXN_ID => g_txn_id,
1904 p_context => 'get_co_for_abr_other',
1905 P_MODULE_CD => 'PQH_GSP_BENSTG',
1906 P_MESSAGE_TYPE_CD => 'E',
1907 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1908 p_effective_date => trunc(sysdate));
1909 raise;
1910 end;
1911 hr_utility.set_location('rate id is '||l_abr_id,50);
1912 return l_abr_id;
1913 elsif p_plan_id is null and p_opt_id is not null then
1914 begin
1915 select acty_base_rt_id,pay_rate_grade_rule_id
1916 into l_abr_id,p_pay_rule_id
1917 from ben_acty_base_rt_f
1918 where p_effective_date between effective_start_date and effective_end_date
1919 and opt_id = p_opt_id
1920 and acty_typ_cd ='GSPSA'; -- we are interested only in this type
1921 exception
1922 when no_data_found then
1923 hr_utility.set_location('no opt rate defined '||p_opt_id,30);
1924 when others then
1925 hr_utility.set_location('issues in getting rate ',40);
1926 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1927 (P_MASTER_TXN_ID => g_master_txn_id,
1928 P_TXN_ID => g_txn_id,
1929 p_context => 'get_co_for_abr_other2',
1930 P_MODULE_CD => 'PQH_GSP_BENSTG',
1931 P_MESSAGE_TYPE_CD => 'E',
1932 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1933 p_effective_date => trunc(sysdate));
1934 raise;
1935 end;
1936 hr_utility.set_location('rate id is '||l_abr_id,50);
1937 return l_abr_id;
1938 end if;
1939 end get_co_std_rate;
1940 function get_scl_pay_rate(p_scale_id in number) return number is
1941 l_pay_rate_id number;
1942 begin
1943 hr_utility.set_location('scale id is '||p_scale_id,10);
1944 -- if the pay rate doesn't exist with this name, no value will be set.
1945 select rate.rate_id
1946 into l_pay_rate_id
1947 from pay_rates rate, per_parent_spines scale
1948 where rate.name = scale.name
1949 and rate.rate_type ='SP'
1950 and rate.parent_spine_id = p_scale_id
1951 and scale.parent_spine_id = p_scale_id;
1952 hr_utility.set_location('rate is '||l_pay_rate_id,20);
1953 return l_pay_rate_id;
1954 exception
1955 when no_data_found then
1956 hr_utility.set_location('no rate is defined '||p_scale_id,30);
1957 null;
1958 when others then
1959 hr_utility.set_location('issues in pulling scl pay rate'||p_scale_id,40);
1960 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1961 (P_MASTER_TXN_ID => g_master_txn_id,
1962 P_TXN_ID => g_txn_id,
1963 p_context => 'get_scl_pay_rate_other',
1964 P_MODULE_CD => 'PQH_GSP_BENSTG',
1965 P_MESSAGE_TYPE_CD => 'E',
1966 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1967 p_effective_date => trunc(sysdate));
1968 raise;
1969 end get_scl_pay_rate;
1970 procedure get_step_details(p_grade_spine_id in number,
1971 p_point_id in number,
1972 p_effective_date in date,
1973 p_step_id out nocopy number,
1974 p_step_ovn out nocopy number,
1975 p_step_name out nocopy number) is
1976 begin
1977 hr_utility.set_location('grade scale id is '||p_grade_spine_id,1);
1978 hr_utility.set_location('point id is '||p_point_id,2);
1979 select step_id,sequence,object_version_number
1980 into p_step_id, p_step_name,p_step_ovn
1981 from per_spinal_point_steps_f
1982 where grade_spine_id = p_grade_spine_id
1983 and spinal_point_id = p_point_id
1984 and p_effective_date between effective_start_date and effective_end_date;
1985 exception
1986 when no_data_found then
1987 hr_utility.set_location('grade scale does not have point '||p_grade_spine_id,20);
1988 hr_utility.set_location('point '||p_point_id,30);
1989 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
1990 (P_MASTER_TXN_ID => g_master_txn_id,
1991 P_TXN_ID => g_txn_id,
1992 p_context => 'get_step_details_no_data',
1993 P_MODULE_CD => 'PQH_GSP_BENSTG',
1994 P_MESSAGE_TYPE_CD => 'E',
1995 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
1996 p_effective_date => trunc(sysdate));
1997 raise;
1998 when others then
1999 hr_utility.set_location('issues in selected step',40);
2000 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2001 (P_MASTER_TXN_ID => g_master_txn_id,
2002 P_TXN_ID => g_txn_id,
2003 p_context => 'get_step_details_other',
2004 P_MODULE_CD => 'PQH_GSP_BENSTG',
2005 P_MESSAGE_TYPE_CD => 'E',
2006 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2007 p_effective_date => trunc(sysdate));
2008 raise;
2009 end get_step_details;
2010 procedure get_grade_scale_details(p_grade_id in number,
2011 p_scale_id in number,
2012 p_effective_date in date,
2013 p_ceiling_step_id out nocopy number,
2014 p_grade_spine_id out nocopy number,
2015 p_starting_step out nocopy number) is
2016 begin
2017 hr_utility.set_location('grade id is '||p_grade_id,1);
2018 hr_utility.set_location('scale id is '||p_scale_id,2);
2019 select ceiling_step_id,grade_spine_id,starting_step
2020 into p_ceiling_step_id,p_grade_spine_id,p_starting_step
2021 from per_grade_spines_f
2022 where grade_id = p_grade_id
2023 and parent_spine_id = p_scale_id
2024 and p_effective_date between effective_start_date and effective_end_date;
2025 hr_utility.set_location('grade scale id is '||p_grade_spine_id,10);
2026 exception
2027 when no_data_found then
2028 hr_utility.set_location('grade scale combination does not exist '||p_grade_id,20);
2029 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2030 (P_MASTER_TXN_ID => g_master_txn_id,
2031 P_TXN_ID => g_txn_id,
2032 p_context => 'get_scale_details_no_data',
2033 P_MODULE_CD => 'PQH_GSP_BENSTG',
2034 P_MESSAGE_TYPE_CD => 'E',
2035 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2036 p_effective_date => trunc(sysdate));
2037 raise;
2038 when others then
2039 hr_utility.set_location('issues in selected grade_spine',30);
2040 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2041 (P_MASTER_TXN_ID => g_master_txn_id,
2042 P_TXN_ID => g_txn_id,
2043 p_context => 'get_scale_details_other',
2044 P_MODULE_CD => 'PQH_GSP_BENSTG',
2045 P_MESSAGE_TYPE_CD => 'E',
2046 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2047 p_effective_date => trunc(sysdate));
2048 raise;
2049 end;
2050 procedure get_point_details(p_point_id in number,
2051 p_scale_id out nocopy number,
2052 p_point_seq out nocopy number,
2053 p_point_ovn out nocopy number,
2054 p_spinal_point out nocopy varchar2) is
2055 begin
2056 hr_utility.set_location('point is '||p_point_id,1);
2057 select parent_spine_id,sequence,spinal_point,object_version_number
2058 into p_scale_id, p_point_seq, p_spinal_point,p_point_ovn
2059 from per_spinal_points
2060 where spinal_point_id = p_point_id;
2061 hr_utility.set_location('scale id is '||p_scale_id,2);
2062 exception
2063 when no_data_found then
2064 hr_utility.set_location('point does not exist',20);
2065 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2066 (P_MASTER_TXN_ID => g_master_txn_id,
2067 P_TXN_ID => g_txn_id,
2068 p_context => 'get_point_details_no_data',
2069 P_MODULE_CD => 'PQH_GSP_BENSTG',
2070 P_MESSAGE_TYPE_CD => 'E',
2071 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2072 p_effective_date => trunc(sysdate));
2073 raise;
2074 when others then
2075 hr_utility.set_location('issue in pulling point ',30);
2076 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2077 (P_MASTER_TXN_ID => g_master_txn_id,
2078 P_TXN_ID => g_txn_id,
2079 p_context => 'get_point_details_other',
2080 P_MODULE_CD => 'PQH_GSP_BENSTG',
2081 P_MESSAGE_TYPE_CD => 'E',
2082 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2083 p_effective_date => trunc(sysdate));
2084 raise;
2085 end get_point_details;
2086 function get_point_for_step(p_step_id in number,
2087 p_effective_date in date) return number is
2088 l_spinal_point_id number;
2089 begin
2090 select spinal_point_id
2091 into l_spinal_point_id
2092 from per_spinal_point_steps_f
2093 where step_id = p_step_id
2094 and p_effective_date between effective_start_date and effective_end_date;
2095 hr_utility.set_location('spinal point id is'||l_spinal_point_id,10);
2096 return l_spinal_point_id;
2097 exception
2098 when no_data_found then
2099 hr_utility.set_location('invalid step '||p_step_id,15);
2100 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2101 (P_MASTER_TXN_ID => g_master_txn_id,
2102 P_TXN_ID => g_txn_id,
2103 p_context => 'get_point_for_step_no_data',
2104 P_MODULE_CD => 'PQH_GSP_BENSTG',
2105 P_MESSAGE_TYPE_CD => 'E',
2106 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2107 p_effective_date => trunc(sysdate));
2108 raise;
2109 when others then
2110 hr_utility.set_location('issues in selecting step',20);
2111 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2112 (P_MASTER_TXN_ID => g_master_txn_id,
2113 P_TXN_ID => g_txn_id,
2114 p_context => 'get_point_for_step_other',
2115 P_MODULE_CD => 'PQH_GSP_BENSTG',
2116 P_MESSAGE_TYPE_CD => 'E',
2117 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2118 p_effective_date => trunc(sysdate));
2119 raise;
2120 end get_point_for_step;
2121 function get_point_for_opt(p_option_id in number,
2122 p_effective_date in date) return number is
2123 l_spinal_point_id number;
2124 begin
2125 hr_utility.set_location('opt id is'||p_option_id,10);
2126 hr_utility.set_location('effdate is'||to_char(p_effective_date,'DD-MM-RRRRy'),10);
2127 select mapping_table_pk_id
2128 into l_spinal_point_id
2129 from ben_opt_f
2130 where opt_id = p_option_id
2131 and p_effective_date between effective_start_date and effective_end_date
2132 and mapping_table_name ='PER_SPINAL_POINTS';
2133 hr_utility.set_location('spinal point id is'||l_spinal_point_id,10);
2134 return l_spinal_point_id;
2135 exception
2136 when no_data_found then
2137 hr_utility.set_location('selected option is not linked to SP'||p_option_id,15);
2138 return l_spinal_point_id;
2139 when others then
2140 hr_utility.set_location('issues in selecting point',20);
2141 raise;
2142 end get_point_for_opt;
2143 function get_opt_for_point(p_point_id in number,
2144 p_effective_date in date) return number is
2145 l_opt_id number;
2146 begin
2147 hr_utility.set_location('pt id is'||p_point_id,10);
2148 hr_utility.set_location('effdt is'||to_char(p_effective_date,'DD-MM-RRRR'),20);
2149 select opt_id
2150 into l_opt_id
2151 from ben_opt_f
2152 where mapping_table_pk_id = p_point_id
2153 and p_effective_date between effective_start_date and effective_end_date
2154 and mapping_table_name ='PER_SPINAL_POINTS';
2155 hr_utility.set_location('opt id is'||l_opt_id,30);
2156 return l_opt_id;
2157 exception
2158 when no_data_found then
2159 hr_utility.set_location('option is not linked to point'||p_point_id,15);
2160 return l_opt_id;
2161 when others then
2162 hr_utility.set_location('issues in selecting option',20);
2163 raise;
2164 end get_opt_for_point;
2165 function get_grade_for_plan(p_plan_id in number,
2166 p_effective_date in date) return number is
2167 l_grade_id number;
2168 begin
2169 select mapping_table_pk_id
2170 into l_grade_id
2171 from ben_pl_f
2172 where pl_id = p_plan_id
2173 and p_effective_date between effective_start_date and effective_end_date
2174 and mapping_table_name ='PER_GRADES';
2175 hr_utility.set_location('grade id is'||l_grade_id,10);
2176 return l_grade_id;
2177 exception
2178 when no_data_found then
2179 hr_utility.set_location('selected plan is not linked to grade'||p_plan_id,15);
2180 return l_grade_id;
2181 when others then
2182 hr_utility.set_location('issues in selecting grade',20);
2183 raise;
2184 end get_grade_for_plan;
2185 function get_plan_for_grade(p_grade_id in number,
2186 p_effective_date in date) return number is
2187 l_pl_id number;
2188 begin
2189 select pl_id
2190 into l_pl_id
2191 from ben_pl_f
2192 where mapping_table_pk_id = p_grade_id
2193 and p_effective_date between effective_start_date and effective_end_date
2194 and mapping_table_name ='PER_GRADES';
2195 hr_utility.set_location('plan id is'||l_pl_id,10);
2196 return l_pl_id;
2197 exception
2198 when no_data_found then
2199 hr_utility.set_location('grade is not linked to plan'||p_grade_id,15);
2200 return l_pl_id;
2201 when others then
2202 hr_utility.set_location('issues in selecting plan',20);
2203 raise;
2204 end get_plan_for_grade;
2205 function get_oipl_for_step(p_step_id in number,
2206 p_effective_date in date) return number is
2207 l_oipl_id number;
2208 l_pl_id number;
2209 l_opt_id number;
2210 l_point_id number;
2211 l_grade_id number;
2212 l_grade_spine_id number;
2213 begin
2214 begin
2215 -- for a grade there can be only one spine
2216 select gs.grade_id,sps.spinal_point_id
2217 into l_grade_id, l_point_id
2218 from per_spinal_point_steps_f sps, per_grade_spines_f gs
2219 where sps.grade_spine_id = gs.grade_spine_id
2220 and p_effective_date between sps.effective_start_date and sps.effective_end_date
2221 and p_effective_date between gs.effective_start_date and gs.effective_end_date
2222 and sps.step_id = p_step_id;
2223 exception
2224 when no_data_found then
2225 hr_utility.set_location('invalid step '||p_step_id,20);
2226 raise;
2227 when others then
2228 hr_utility.set_location('issues in selecting step detail'||p_step_id,30);
2229 raise;
2230 end;
2231 hr_utility.set_location('grade is '||l_grade_id,10);
2232 hr_utility.set_location('point is '||l_point_id,15);
2233 l_pl_id := get_plan_for_grade(p_grade_id => l_grade_id,
2234 p_effective_date => p_effective_date);
2235 hr_utility.set_location('plan is '||l_pl_id,10);
2236 l_opt_id := get_opt_for_point(p_point_id => l_point_id,
2237 p_effective_date => p_effective_date);
2238 hr_utility.set_location('option is '||l_opt_id,20);
2239 if l_pl_id is not null and l_opt_id is not null then
2240 begin
2241 select oipl_id
2242 into l_oipl_id
2243 from ben_oipl_f
2244 where pl_id = l_pl_id
2245 and opt_id = l_opt_id
2246 and p_effective_date between effective_start_date and effective_end_date;
2247 hr_utility.set_location('oipl is '||l_oipl_id,30);
2248 return l_oipl_id;
2249 exception
2250 when no_data_found then
2251 hr_utility.set_location('invalid oipl for pl'||l_pl_id,100);
2252 raise;
2253 when others then
2254 hr_utility.set_location('issues in selecting oipl detail',120);
2255 raise;
2256 end;
2257 else
2258 hr_utility.set_location('either plan or opt is null',150);
2259 return null;
2260 end if;
2261 end get_oipl_for_step;
2262 function get_step_for_oipl(p_oipl_id in number,
2263 p_effective_date in date) return number is
2264 l_step_id number;
2265 l_pl_id number;
2266 l_opt_id number;
2267 l_point_id number;
2268 l_grade_id number;
2269 l_grade_spine_id number;
2270 begin
2271 begin
2272 select pl_id,opt_id
2273 into l_pl_id,l_opt_id
2274 from ben_oipl_f
2275 where oipl_id = p_oipl_id
2276 and p_effective_date between effective_start_date and effective_end_date;
2277 exception
2278 when no_data_found then
2279 hr_utility.set_location('invalid oipl '||p_oipl_id,100);
2280 raise;
2281 when others then
2282 hr_utility.set_location('issues in selecting oipl detail'||p_oipl_id,120);
2283 raise;
2284 end;
2285 hr_utility.set_location('plan is '||l_pl_id,10);
2286 hr_utility.set_location('option is '||l_opt_id,20);
2287 l_grade_id := get_grade_for_plan(p_plan_id => l_pl_id,
2288 p_effective_date => p_effective_date);
2289 hr_utility.set_location('grade is '||l_grade_id,30);
2290 l_point_id := get_point_for_opt(p_option_id => l_opt_id,
2291 p_effective_date => p_effective_date);
2292 hr_utility.set_location('point is '||l_point_id,40);
2293 if l_grade_id is not null and l_point_id is not null then
2294 begin
2295 -- for a grade there can be only one spine
2296 select step_id
2297 into l_step_id
2298 from per_spinal_point_steps_f sps, per_grade_spines_f gs
2299 where sps.grade_spine_id = gs.grade_spine_id
2300 and p_effective_date between sps.effective_start_date and sps.effective_end_date
2301 and p_effective_date between gs.effective_start_date and gs.effective_end_date
2302 and gs.grade_id = l_grade_id
2303 and sps.spinal_point_id = l_point_id;
2304 hr_utility.set_location('step is '||l_step_id,60);
2305 return l_step_id;
2306 exception
2307 when no_data_found then
2308 hr_utility.set_location('invalid grade step comb ',60);
2309 raise;
2310 when others then
2311 hr_utility.set_location('issues in selecting step ',80);
2312 raise;
2313 end;
2314 else
2315 hr_utility.set_location('grade or point is null ',100);
2316 return null;
2317 end if;
2318 end get_step_for_oipl;
2319 procedure get_grade_for_plip(p_plip_id in number,
2320 p_effective_date in date,
2321 p_plan_id out nocopy number,
2322 p_grade_id out nocopy number) is
2323 begin
2324 begin
2325 select pl_id
2326 into p_plan_id
2327 from ben_plip_f
2328 where plip_id = p_plip_id
2329 and p_effective_date between effective_start_date and effective_end_date;
2330 hr_utility.set_location('plan is '||p_plan_id,10);
2331 exception
2332 when no_data_found then
2333 hr_utility.set_location('plip does not exist '||p_plip_id,10);
2334 when others then
2335 hr_utility.set_location('issues in selected plip',20);
2336 raise;
2337 end;
2338 if p_plan_id is not null then
2339 p_grade_id := get_grade_for_plan(p_plan_id => p_plan_id,
2340 p_effective_date => p_effective_date);
2341 hr_utility.set_location('grade id is'||p_grade_id,40);
2342 end if;
2343 end get_grade_for_plip;
2344 procedure get_table_route_details(p_table_alias in varchar2,
2345 p_table_route_id out nocopy number ,
2346 p_table_name out nocopy varchar2 ) is
2347 begin
2348 select table_route_id, substrb(display_name,1,30) -- fix for the bug#12797263
2349 into p_table_route_id, p_table_name
2350 from pqh_table_route_vl
2351 where table_alias = p_table_alias;
2352 hr_utility.set_location('table_route name is '||p_table_name,10);
2353 exception
2354 when no_data_found then
2355 hr_utility.set_location('no table_route is defined for this alias'||p_table_alias,10);
2356 null;
2357 when others then
2358 hr_utility.set_location('issues in pulling table_route details ',20);
2359 raise;
2360 end get_table_route_details;
2361 procedure update_gsp_control_rec(p_copy_entity_txn_id in number,
2362 p_effective_date in date,
2363 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST') is
2364 l_grd_exists varchar2(30) := 'N';
2365 l_step_exists varchar2(30) := 'N';
2366 l_rate_exists varchar2(30) := 'N';
2367 l_rule_exists varchar2(30) := 'N';
2368 l_cpd_exists varchar2(30) := 'N';
2369 l_cdd_exists varchar2(30) := 'N';
2370 l_plip_row number;
2371 l_oipl_row number;
2372 l_rate_row number;
2373 l_rule_row number;
2374 l_ctrl_rec_cer_id number;
2375 l_ctrl_rec_ovn number;
2376 begin
2377 hr_utility.set_location('bus area is'||p_business_area,10);
2378 hr_utility.set_location('cet is'||p_copy_entity_txn_id,10);
2379 select count(*) into l_plip_row
2380 from ben_copy_entity_results
2381 where copy_entity_txn_id = p_copy_entity_txn_id
2382 and table_alias ='CPP'
2383 and Result_type_Cd = 'DISPLAY'
2384 and information104 ='LINK'; -- plip record is linked as well
2385
2386 hr_utility.set_location('grade in GL'||l_plip_row,10);
2387
2388 select count(*) into l_oipl_row
2389 from ben_copy_entity_results
2390 where copy_entity_txn_id = p_copy_entity_txn_id
2391 and table_alias ='COP'
2392 and Result_Type_Cd = 'DISPLAY';
2393 hr_utility.set_location('steps'||l_oipl_row,20);
2394
2395 select count(*) into l_rate_row
2396 from ben_copy_entity_results
2397 where copy_entity_txn_id = p_copy_entity_txn_id
2398 and table_alias = 'ABR'
2399 and Result_Type_Cd = 'DISPLAY';
2400 hr_utility.set_location('rates'||l_rate_row,30);
2401
2402 select count(*) into l_rule_row
2403 from ben_copy_entity_results
2404 where copy_entity_txn_id = p_copy_entity_txn_id
2405 and table_alias ='CEP'
2406 and Result_Type_Cd = 'DISPLAY';
2407 hr_utility.set_location('rules'||l_rule_row,40);
2408
2409 if l_plip_row > 0 then
2410 l_grd_exists := 'Y';
2411 end if;
2412 if l_grd_exists = 'Y' then
2413 if l_oipl_row > 0 then
2414 l_step_exists := 'Y';
2415 end if;
2416 if l_rate_row > 0 then
2417 l_rate_exists := 'Y';
2418 end if;
2419 if l_rule_row > 0 then
2420 l_rule_exists := 'Y';
2421 end if;
2422 end if;
2423 if p_business_area = 'PQH_CORPS_TASK_LIST' then
2424 l_cpd_exists := pqh_cpd_hr_to_stage.check_cpd_row(p_copy_entity_txn_id);
2425 l_cdd_exists := pqh_cpd_hr_to_stage.check_cdd_row(p_copy_entity_txn_id);
2426 else
2427 l_cpd_exists := '';
2428 l_cdd_exists := '';
2429 end if;
2430 hr_utility.set_location('bus area is'||p_business_area,101);
2431 hr_utility.set_location('cet is'||p_copy_entity_txn_id,101);
2432 begin
2433 select copy_entity_result_id
2434 into l_ctrl_rec_cer_id
2435 from ben_copy_entity_results
2436 where copy_entity_txn_id = p_copy_entity_txn_id
2437 and table_alias = p_business_area;
2438 hr_utility.set_location('ctrl_rec_cer is'||l_ctrl_rec_cer_id,50);
2439 exception
2440 when no_data_found then
2441 hr_utility.set_location('no control rec exists',60);
2442 raise;
2443 when others then
2444 hr_utility.set_location('issues in updating control rec ',70);
2445 raise;
2446 end;
2447
2448 begin
2449 update ben_copy_entity_results
2450 set information100 = 'Y'
2451 ,information101 = 'Y'
2452 ,information102 = l_grd_exists
2453 ,information103 = l_step_exists
2454 ,information104 = l_rate_exists
2455 ,information105 = l_rule_exists
2456 ,information106 = l_grd_exists -- review is enabled only when grade is enabled
2457 ,information107 = l_cpd_exists
2458 ,information108 = l_cdd_exists
2459 where copy_entity_result_id = l_ctrl_rec_cer_id;
2460 exception
2461 when others then
2462 hr_utility.set_location('issues in updating control rec ',80);
2463 raise;
2464 end;
2465 end update_gsp_control_rec;
2466 procedure create_gsp_control_rec(p_copy_entity_txn_id in number,
2467 p_effective_date in date,
2468 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST') is
2469 l_table_route_id number;
2470 l_table_route_name varchar2(30);
2471 l_ctrl_rec_cer_id number;
2472 l_ctrl_rec_ovn number;
2473 l_table_alias varchar2(30);
2474 begin
2475 if p_business_area in ('PQH_GSP_TASK_LIST','PQH_CORPS_TASK_LIST') then
2476 l_table_alias := p_business_area;
2477 end if;
2478 get_table_route_details(p_table_alias => l_table_alias,
2479 p_table_route_id => l_table_route_id,
2480 p_table_name => l_table_route_name);
2481 -- create a row for the control record with the values of flags for this txn.
2482 ben_copy_entity_results_api.create_copy_entity_results
2483 (p_effective_date => p_effective_date
2484 ,p_copy_entity_txn_id => p_copy_entity_txn_id
2485 ,p_result_type_cd => 'DISPLAY'
2486 ,p_table_name => l_table_route_name
2487 ,p_table_alias => l_table_alias
2488 ,p_table_route_id => l_table_route_id
2489 ,p_copy_entity_result_id => l_ctrl_rec_cer_id
2490 ,p_object_version_number => l_ctrl_rec_ovn);
2491 update_gsp_control_rec(p_copy_entity_txn_id => p_copy_entity_txn_id,
2492 p_effective_date => p_effective_date,
2493 p_business_area => p_business_area);
2494 exception
2495 when others then
2496 hr_utility.set_location('issues in creating control rec ',10);
2497 raise;
2498 end create_gsp_control_rec;
2499
2500 procedure create_gsp_control_rec(p_copy_entity_txn_id in number,
2501 p_effective_date in date,
2502 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST',
2503 p_gl_exists in varchar2,
2504 p_sal_exists in varchar2,
2505 p_grd_exists in varchar2,
2506 p_step_exists in varchar2,
2507 p_rate_exists in varchar2,
2508 p_rule_exists in varchar2) is
2509 l_table_route_id number;
2510 l_table_route_name varchar2(30);
2511 l_ctrl_rec_cer_id number;
2512 l_ctrl_rec_ovn number;
2513 l_table_alias varchar2(30);
2514 begin
2515 -- this is override way of creating control rec for use with GL and salary page
2516 if p_business_area in ('PQH_GSP_TASK_LIST','PQH_CORPS_TASK_LIST') then
2517 l_table_alias := p_business_area;
2518 end if;
2519 get_table_route_details(p_table_alias => l_table_alias,
2520 p_table_route_id => l_table_route_id,
2521 p_table_name => l_table_route_name);
2522 -- create a row for the control record with the values of flags for this txn.
2523 ben_copy_entity_results_api.create_copy_entity_results
2524 (p_effective_date => p_effective_date
2525 ,p_copy_entity_txn_id => p_copy_entity_txn_id
2526 ,p_result_type_cd => 'DISPLAY'
2527 ,p_table_name => l_table_route_name
2528 ,p_table_alias => l_table_alias
2529 ,p_table_route_id => l_table_route_id
2530 ,p_information100 => p_gl_exists
2531 ,p_information101 => p_sal_exists
2532 ,p_information102 => p_grd_exists
2533 ,p_information103 => p_step_exists
2534 ,p_information104 => p_rate_exists
2535 ,p_information105 => p_rule_exists
2536 ,p_information106 => p_grd_exists -- review is enabled only when grade is enabled
2537 ,p_copy_entity_result_id => l_ctrl_rec_cer_id
2538 ,p_object_version_number => l_ctrl_rec_ovn);
2539 exception
2540 when others then
2541 hr_utility.set_location('issues in creating control rec ',10);
2542 raise;
2543 end create_gsp_control_rec;
2544 function get_bg_grd_pay_rate(p_business_group_id in number) return number is
2545 l_pay_rate_name pay_rates.name%type;
2546 l_pay_rate_id number;
2547 begin
2548 -- for a grade there can be many pay rates, we have to find that pay rate which is
2549 -- having name based on lookup code
2550 l_pay_rate_name := hr_general.decode_lookup(p_lookup_type => 'PQH_GSP_GEN_NAME',
2551 p_lookup_code => 'GRADE_RATEGSP');
2552 if l_pay_rate_name is not null then
2553 hr_utility.set_location('pay rate name'||l_pay_rate_name,10);
2554 hr_utility.set_location('bg id is '||p_business_group_id,15);
2555 -- if the pay rate doesn't exist with this name, no value will be set.
2556 begin
2557 select rate_id
2558 into l_pay_rate_id
2559 from pay_rates
2560 where name = l_pay_rate_name
2561 and rate_type ='G'
2562 and business_group_id = p_business_group_id;
2563 hr_utility.set_location('rate is '||l_pay_rate_id,20);
2564 return l_pay_rate_id;
2565 exception
2566 when no_data_found then
2567 hr_utility.set_location('no rate is defined for this BG'||p_business_group_id,30);
2568 null;
2569 when others then
2570 hr_utility.set_location('issues in pulling grd pay rate'||p_business_group_id,40);
2571 raise;
2572 end;
2573 else
2574 hr_utility.set_location('pay rate is not defined ',100);
2575 end if;
2576 end get_bg_grd_pay_rate;
2577 procedure get_grade_details(p_grade_id in number,
2578 p_date_from out nocopy date,
2579 p_date_to out nocopy date,
2580 p_short_name out nocopy varchar2,
2581 p_grade_name out nocopy varchar2,
2582 p_grd_ovn out nocopy number,
2583 p_grade_definition_id out nocopy number) is
2584 begin
2585 hr_utility.set_location('grade id is'||p_grade_id,20);
2586 -- get the grade info in local variables
2587 select date_from, date_to, short_name, name,
2588 grade_definition_id, object_version_number
2589 into p_date_from,p_date_to,p_short_name,p_grade_name,
2590 p_grade_definition_id,p_grd_ovn
2591 from per_grades
2592 where grade_id = p_grade_id;
2593 hr_utility.set_location('grade name'||p_grade_name,20);
2594 exception
2595 when no_data_found then
2596 hr_utility.set_location('grade doesnot exist '||p_grade_id,35);
2597 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2598 (P_MASTER_TXN_ID => g_master_txn_id,
2599 P_TXN_ID => g_txn_id,
2600 p_context => 'get_grade_details_no_data',
2601 P_MODULE_CD => 'PQH_GSP_BENSTG',
2602 P_MESSAGE_TYPE_CD => 'E',
2603 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2604 p_effective_date => trunc(sysdate));
2605 raise;
2606 when others then
2607 hr_utility.set_location('issue in pulling grade details ',120);
2608 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2609 (P_MASTER_TXN_ID => g_master_txn_id,
2610 P_TXN_ID => g_txn_id,
2611 p_context => 'get_grade_details_others',
2612 P_MODULE_CD => 'PQH_GSP_BENSTG',
2613 P_MESSAGE_TYPE_CD => 'E',
2614 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2615 p_effective_date => trunc(sysdate));
2616 raise;
2617 end get_grade_details;
2618 procedure get_grd_rate_values(p_grade_id in number,
2619 p_effective_date in date,
2620 p_grd_value out nocopy number,
2621 p_grd_min out nocopy number,
2622 p_grd_mid out nocopy number,
2623 p_grd_max out nocopy number) is
2624 -- this procedure takes the benefit route of finding the rate value for an grade
2625 l_plan_id number;
2626 l_pay_rule_id number;
2627 l_abr_id number;
2628 l_message_text varchar2(2000);
2629 begin
2630 hr_utility.set_location('grade passed is '||p_grade_id,10);
2631 hr_utility.set_location('effective date passed is '||to_char(p_effective_date,'DD-MM-RRRR'),20);
2632 l_message_text := 'grade passed is '||p_grade_id
2633 ||' effective date passed is '||to_char(p_effective_date,'DD-MM-RRRR');
2634 l_plan_id := get_plan_for_grade(p_grade_id => p_grade_id,
2635 p_effective_date => p_effective_date);
2636 hr_utility.set_location('plan is '||l_plan_id,30);
2637 if l_plan_id is not null then
2638 l_abr_id := get_co_std_rate(p_plan_id => l_Plan_id,
2639 p_effective_date => p_effective_date,
2640 p_pay_rule_id => l_pay_rule_id);
2641 end if;
2642 if l_pay_rule_id is not null then
2643 hr_utility.set_location('Rate passed is '||l_pay_rule_id,40);
2644 begin
2645 select value,minimum,mid_value,maximum
2646 into p_grd_value,p_grd_min,p_grd_mid,p_grd_max
2647 from pay_grade_rules_f
2648 where grade_rule_id = l_pay_rule_id
2649 and grade_or_spinal_point_id = p_grade_id
2650 and p_effective_date between effective_start_date and effective_end_date
2651 and rate_type ='G';
2652 exception
2653 when no_data_found then
2654 hr_utility.set_location('Grade doesnot have a standard rate'||p_grade_id,100);
2655 null;
2656 when others then
2657 hr_utility.set_location('some issues in rate pull',120);
2658 raise;
2659 end;
2660 else
2661 hr_utility.set_location('no rate defined or issues in getting pay rule ',140);
2662 end if;
2663 exception
2664 when others then
2665 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2666 (P_MASTER_TXN_ID => g_master_txn_id,
2667 P_TXN_ID => g_txn_id,
2668 p_context => 'get_grd_rate_values',
2669 P_MODULE_CD => 'PQH_GSP_BENSTG',
2670 P_MESSAGE_TYPE_CD => 'E',
2671 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2672 p_effective_date => trunc(sysdate));
2673 raise;
2674 end get_grd_rate_values;
2675 procedure get_grd_rate_values(p_grade_id in number,
2676 p_business_group_id in number,
2677 p_effective_date in date,
2678 p_grd_value out nocopy number,
2679 p_grd_min out nocopy number,
2680 p_grd_mid out nocopy number,
2681 p_grd_max out nocopy number) is
2682 -- this procedure takes the hr route of finding the rate value for an grade
2683 -- only issue in this is pay rate name is assumed to be fixed based on lookup value
2684 l_grd_pay_rate_id number;
2685 begin
2686 hr_utility.set_location('grade passed is '||p_grade_id,10);
2687 hr_utility.set_location('effective date passed is '||to_char(p_effective_date,'DD-MM-RRRR'),20);
2688 l_grd_pay_rate_id := get_bg_grd_pay_rate(p_business_group_id => p_business_group_id);
2689 if l_grd_pay_rate_id is not null then
2690 hr_utility.set_location('Rate passed is '||l_grd_pay_rate_id,40);
2691 begin
2692 select value,minimum,mid_value,maximum
2693 into p_grd_value,p_grd_min,p_grd_mid,p_grd_max
2694 from pay_grade_rules_f
2695 where rate_id = l_grd_pay_rate_id
2696 and grade_or_spinal_point_id = p_grade_id
2697 and p_effective_date between effective_start_date and effective_end_date
2698 and rate_type ='G';
2699 exception
2700 when no_data_found then
2701 hr_utility.set_location('Grade doesnot have a standard rate'||p_grade_id,100);
2702 null;
2703 when others then
2704 hr_utility.set_location('some issues in rate pull',120);
2705 raise;
2706 end;
2707 else
2708 hr_utility.set_location('issue in getting bg grd pay rate ',120);
2709 end if;
2710 exception
2711 when others then
2712 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2713 (P_MASTER_TXN_ID => g_master_txn_id,
2714 P_TXN_ID => g_txn_id,
2715 p_context => 'get_grd_rate_values',
2716 P_MODULE_CD => 'PQH_GSP_BENSTG',
2717 P_MESSAGE_TYPE_CD => 'E',
2718 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2719 p_effective_date => trunc(sysdate));
2720 raise;
2721 end get_grd_rate_values;
2722 procedure get_point_rate_values(p_effective_date in date,
2723 p_opt_id in number,
2724 p_point_id in number,
2725 p_point_value out nocopy number) is
2726 -- this procedure takes the benefit route of finding the rate value for an option
2727 l_pay_rule_id number;
2728 l_option_id number;
2729 l_abr_id number;
2730 begin
2731 hr_utility.set_location('option is '||p_opt_id,10);
2732 if p_opt_id is not null then
2733 hr_utility.set_location('going for rates',35);
2734 l_abr_id := get_co_std_rate(p_opt_id => p_opt_id,
2735 p_effective_date => p_effective_date,
2736 p_pay_rule_id => l_pay_rule_id);
2737 end if;
2738 if l_pay_rule_id is not null then
2739 hr_utility.set_location('Rate passed is '||l_pay_rule_id,40);
2740 begin
2741 select value
2742 into p_point_value
2743 from pay_grade_rules_f
2744 where grade_rule_id = l_pay_rule_id
2745 and grade_or_spinal_point_id = p_point_id
2746 and p_effective_date between effective_start_date and effective_end_date
2747 and rate_type ='SP';
2748 exception
2749 when no_data_found then
2750 hr_utility.set_location('Point doesnot have a standard rate'||p_point_id,100);
2751 null;
2752 when others then
2753 hr_utility.set_location('some issues in rate pull',120);
2754 raise;
2755 end;
2756 else
2757 hr_utility.set_location('issue in getting pay rate ',130);
2758 end if;
2759 exception
2760 when others then
2761 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2762 (P_MASTER_TXN_ID => g_master_txn_id,
2763 P_TXN_ID => g_txn_id,
2764 p_context => 'get_point_rate_values',
2765 P_MODULE_CD => 'PQH_GSP_BENSTG',
2766 P_MESSAGE_TYPE_CD => 'E',
2767 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2768 p_effective_date => trunc(sysdate));
2769 raise;
2770 end get_point_rate_values;
2771 procedure get_point_rate_values(p_effective_date in date,
2772 p_point_id in number,
2773 p_point_value out nocopy number) is
2774 -- this procedure takes the benefit route of finding the rate value for an option
2775 l_pay_rule_id number;
2776 l_option_id number;
2777 l_abr_id number;
2778 begin
2779 hr_utility.set_location('point passed is '||p_point_id,10);
2780 hr_utility.set_location('effective date passed is '||to_char(p_effective_date,'DD-MM-RRRR'),20);
2781 l_option_id := get_opt_for_point(p_point_id => p_point_id,
2782 p_effective_date => p_effective_date);
2783 hr_utility.set_location('option is '||l_option_id,30);
2784 get_point_rate_values(p_effective_date => p_effective_date,
2785 p_opt_id => l_option_id,
2786 p_point_id => p_point_id,
2787 p_point_value => p_point_value);
2788 end get_point_rate_values;
2789 procedure get_point_rate_values(p_scale_id in number,
2790 p_point_id in number,
2791 p_effective_date in date,
2792 p_point_value out nocopy number) is
2793 -- this procedure takes the hr route of finding the rate value for an grade
2794 -- only issue in this is pay rate name is assumed to be fixed based on scale name
2795 l_scl_pay_rate_id number;
2796 begin
2797 hr_utility.set_location('scale passed is '||p_scale_id,10);
2798 hr_utility.set_location('effective date passed is '||to_char(p_effective_date,'DD-MM-RRRR'),20);
2799 l_scl_pay_rate_id := get_scl_pay_rate(p_scale_id => p_scale_id);
2800 if l_scl_pay_rate_id is not null then
2801 hr_utility.set_location('Rate passed is '||l_scl_pay_rate_id,40);
2802 begin
2803 select value
2804 into p_point_value
2805 from pay_grade_rules_f
2806 where rate_id = l_scl_pay_rate_id
2807 and grade_or_spinal_point_id = p_point_id
2808 and p_effective_date between effective_start_date and effective_end_date
2809 and rate_type ='SP';
2810 exception
2811 when no_data_found then
2812 hr_utility.set_location('Point doesnot have a standard rate'||p_point_id,100);
2813 null;
2814 when others then
2815 hr_utility.set_location('some issues in rate pull',120);
2816 raise;
2817 end;
2818 else
2819 hr_utility.set_location('issue in getting scl pay rate ',130);
2820 end if;
2821 exception
2822 when others then
2823 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2824 (P_MASTER_TXN_ID => g_master_txn_id,
2825 P_TXN_ID => g_txn_id,
2826 p_context => 'get_point_rate_values',
2827 P_MODULE_CD => 'PQH_GSP_BENSTG',
2828 P_MESSAGE_TYPE_CD => 'E',
2829 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2830 p_effective_date => trunc(sysdate));
2831 raise;
2832 end get_point_rate_values;
2833 procedure get_step_all_details(p_point_id in number,
2834 p_grade_id in number,
2835 p_option_id in number,
2836 p_effective_date in date,
2837 p_point_name out nocopy varchar2,
2838 p_step_name out nocopy varchar2,
2839 p_step_id out nocopy number,
2840 p_step_ovn out nocopy number,
2841 p_grade_spine_id out nocopy number,
2842 p_ceiling_flag out nocopy varchar2,
2843 p_point_value out nocopy number,
2844 p_scale_id out nocopy number) is
2845 l_point_seq number;
2846 l_point_ovn number;
2847 l_ceiling_step_id number;
2848 l_starting_step number;
2849 begin
2850 hr_utility.set_location('point id is'||p_point_id,10);
2851 if p_point_id is not null then
2852 get_point_details(p_point_id => p_point_id,
2853 p_scale_id => p_scale_id,
2854 p_point_seq => l_point_seq,
2855 p_point_ovn => l_point_ovn,
2856 p_spinal_point => p_point_name);
2857 hr_utility.set_location('scale id is'||p_scale_id,20);
2858 get_point_rate_values(p_effective_date => p_effective_date,
2859 p_opt_id => p_option_id,
2860 p_point_id => p_point_id,
2861 p_point_value => p_point_value);
2862 hr_utility.set_location('point value is'||p_point_value,30);
2863 end if;
2864 if p_grade_id is not null and p_scale_id is not null then
2865 get_grade_scale_details(p_grade_id => p_grade_id,
2866 p_scale_id => p_scale_id,
2867 p_effective_date => p_effective_date,
2868 p_ceiling_step_id => l_ceiling_step_id,
2869 p_grade_spine_id => p_grade_spine_id,
2870 p_starting_step => l_starting_step);
2871
2872 hr_utility.set_location('grade spine id is'||p_grade_spine_id,40);
2873 end if;
2874 if p_grade_spine_id is not null then
2875 get_step_details(p_grade_spine_id => p_grade_spine_id,
2876 p_point_id => p_point_id,
2877 p_effective_date => p_effective_date,
2878 p_step_id => p_step_id,
2879 p_step_ovn => p_step_ovn,
2880 p_step_name => p_step_name) ;
2881 hr_utility.set_location('step id is'||p_step_id,50);
2882 if l_ceiling_step_id = p_step_id then
2883 p_ceiling_flag := 'Y';
2884 else
2885 p_ceiling_flag := 'N';
2886 end if;
2887 end if;
2888 exception
2889 when others then
2890 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
2891 (P_MASTER_TXN_ID => g_master_txn_id,
2892 P_TXN_ID => g_txn_id,
2893 p_context => 'get_step_all_details',
2894 P_MODULE_CD => 'PQH_GSP_BENSTG',
2895 P_MESSAGE_TYPE_CD => 'E',
2896 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
2897 p_effective_date => trunc(sysdate));
2898 raise;
2899 end get_step_all_details;
2900 procedure get_step_details_for_oipl(p_oipl_id in number,
2901 p_effective_date in date,
2902 p_point_id out nocopy number,
2903 p_point_name out nocopy varchar2,
2904 p_step_name out nocopy varchar2,
2905 p_step_id in out nocopy number,
2906 p_step_ovn out nocopy number,
2907 p_grade_id out nocopy number,
2908 p_grade_spine_id out nocopy number,
2909 p_ceiling_flag out nocopy varchar2,
2910 p_point_value out nocopy number,
2911 p_scale_id out nocopy number) is
2912 l_option_id number;
2913 l_plan_id number;
2914 begin
2915 -- because oipl is only in ben, we will pick plan and option and use that to get the details
2916 if p_step_id is null and p_oipl_id is not null then
2917 hr_utility.set_location('oipl_id is '||p_oipl_id,10);
2918 begin
2919 select opt_id,pl_id
2920 into l_option_id,l_plan_id
2921 from ben_oipl_f
2922 where oipl_id = p_oipl_id
2923 and p_effective_date between effective_start_date and effective_end_date;
2924 hr_utility.set_location('option is '||l_option_id,10);
2925 hr_utility.set_location('plan is '||l_plan_id,15);
2926 exception
2927 when no_data_found then
2928 hr_utility.set_location('oipl does not exist '||p_oipl_id,18);
2929 raise;
2930 when others then
2931 hr_utility.set_location('issues in selected oipl',20);
2932 raise;
2933 end;
2934 -- get point for option
2935 p_point_id := get_point_for_opt(p_option_id => l_option_id,
2936 p_effective_date => p_effective_date);
2937 hr_utility.set_location('spinal_point_id is'||p_point_id,40);
2938 -- get grade for plan
2939 p_grade_id := get_grade_for_plan(p_plan_id => l_plan_id,
2940 p_effective_date => p_effective_date);
2941 hr_utility.set_location('grade id is'||p_grade_id,50);
2942 elsif p_step_id is not null then
2943 hr_utility.set_location('step_id is '||p_step_id,10);
2944 begin
2945 select sps.spinal_point_id,gs.grade_id, gs.grade_spine_id
2946 into p_point_id,p_grade_id,p_grade_spine_id
2947 from per_spinal_point_steps_f sps, per_grade_spines_f gs
2948 where sps.step_id = p_step_id
2949 and sps.grade_spine_id = gs.grade_spine_id
2950 and p_effective_date between sps.effective_start_date and sps.effective_end_date
2951 and p_effective_date between gs.effective_start_date and gs.effective_end_date;
2952 hr_utility.set_location('point is '||p_point_id,10);
2953 hr_utility.set_location('grade is '||p_grade_id,15);
2954 exception
2955 when no_data_found then
2956 hr_utility.set_location('step does not exist '||p_step_id,18);
2957 raise;
2958 when others then
2959 hr_utility.set_location('issues in selected step',20);
2960 raise;
2961 end;
2962 else
2963 hr_utility.set_location('oipl id is null and step id is null ',10);
2964 end if;
2965 if p_point_id is not null and p_grade_id is not null then
2966 get_step_all_details(p_point_id => p_point_id,
2967 p_effective_date => p_effective_date,
2968 p_grade_id => p_grade_id,
2969 p_option_id => l_option_id,
2970 p_point_name => p_point_name,
2971 p_step_name => p_step_name,
2972 p_step_id => p_step_id,
2973 p_step_ovn => p_step_ovn,
2974 p_grade_spine_id => p_grade_spine_id,
2975 p_ceiling_flag => p_ceiling_flag,
2976 p_point_value => p_point_value,
2977 p_scale_id => p_scale_id);
2978 hr_utility.set_location('details pulled',60);
2979 end if;
2980 end get_step_details_for_oipl;
2981 procedure get_co_for_abr(p_abr_id in number,
2982 p_effective_date in date,
2983 p_plan_id out nocopy number,
2984 p_option_id out nocopy number,
2985 p_pay_rule_id out nocopy number) is
2986 begin
2987 select pl_id, opt_id, pay_rate_grade_rule_id
2988 into p_plan_id, p_option_id,p_pay_rule_id
2989 from ben_acty_base_rt_f
2990 where acty_base_rt_id = p_abr_id
2991 and p_effective_date between effective_start_date and effective_end_date;
2992 hr_utility.set_location('rate is for plan'||p_plan_id,1);
2993 hr_utility.set_location('rate is for opt'||p_option_id,2);
2994 exception
2995 when no_data_found then
2996 hr_utility.set_location('no data exists '||p_abr_id,10);
2997 raise;
2998 when others then
2999 hr_utility.set_location('issues in pulling txn data ',20);
3000 raise;
3001 end get_co_for_abr;
3002 procedure get_grd_pay_rate_values(p_grade_id in number,
3003 p_pay_rule_id in number,
3004 p_effective_date in date,
3005 p_grd_value out nocopy number,
3006 p_grd_min out nocopy number,
3007 p_grd_mid out nocopy number,
3008 p_grd_max out nocopy number) is
3009 begin
3010 select maximum, mid_value,minimum,value
3011 into p_grd_max,p_grd_mid, p_grd_min,p_grd_value
3012 from pay_grade_rules_f
3013 where grade_rule_id = p_pay_rule_id
3014 and rate_type ='G'
3015 and grade_or_spinal_point_id = p_grade_id
3016 and p_effective_date between effective_start_date and effective_end_date;
3017 hr_utility.set_location('grade value is '||p_grd_value,10);
3018 exception
3019 when no_data_found then
3020 hr_utility.set_location('no rule exists '||p_pay_rule_id,20);
3021 hr_utility.set_location('as of this date'||to_char(p_effective_date,'DD-MM-RRRR'),30);
3022 raise;
3023 when others then
3024 hr_utility.set_location('issues in pulling grade rate data ',40);
3025 raise;
3026 end get_grd_pay_rate_values;
3027 procedure get_point_pay_rate_values(p_point_id in number,
3028 p_pay_rule_id in number,
3029 p_effective_date in date,
3030 p_point_value out nocopy number) is
3031 begin
3032 select value
3033 into p_point_value
3034 from pay_grade_rules_f
3035 where grade_rule_id = p_pay_rule_id
3036 and rate_type ='SP'
3037 and grade_or_spinal_point_id = p_point_id
3038 and p_effective_date between effective_start_date and effective_end_date;
3039 hr_utility.set_location('point value is '||p_point_value,10);
3040 exception
3041 when no_data_found then
3042 hr_utility.set_location('no rule exists '||p_pay_rule_id,20);
3043 hr_utility.set_location('as of this date'||to_char(p_effective_date,'DD-MM-RRRR'),30);
3044 raise;
3045 when others then
3046 hr_utility.set_location('issues in pulling point rate data ',40);
3047 raise;
3048 end get_point_pay_rate_values;
3049 procedure pgm_on_stage(p_pgm_id in number,
3050 p_pgm_cer_id in number,
3051 p_copy_entity_txn_id in number) is
3052 l_sal_upd_flag varchar2(30);
3053 l_sal_update_cd varchar2(30);
3054 l_dflt_step_cd varchar2(30);
3055 l_enrt_cd varchar2(30);
3056 l_business_group_id number;
3057 l_ler_id number;
3058 l_rate_st_dt varchar2(30) := null;
3059 Cursor csr_ler_id(p_business_group_id in number)
3060 is
3061 select ler_id
3062 from ben_ler_f
3063 where business_Group_id = p_business_group_id
3064 and typ_cd = 'GSP'
3065 and lf_evt_oper_cd ='SYNC';
3066 Cursor csr_rate_st_dt (p_ler_id in number)
3067 is
3068 select information17
3069 from ben_copy_entity_results
3070 where table_alias = 'LEN'
3071 and information257 = p_ler_id
3072 and copy_entity_txn_id = p_copy_entity_txn_id;
3073 begin
3074 hr_utility.set_location('inside pgm update ',10);
3075 begin
3076 select information16,information14,information4
3077 into l_sal_update_cd,l_dflt_step_cd,l_business_group_id
3078 from ben_copy_entity_results
3079 where copy_entity_result_id = p_pgm_cer_id;
3080 open csr_ler_id(l_business_group_id);
3081 fetch csr_ler_id into l_ler_id;
3082 if csr_ler_id%FOUND then
3083 open csr_rate_st_dt(l_ler_id);
3084 fetch csr_rate_st_dt into l_rate_st_dt;
3085 close csr_rate_st_dt;
3086 end if;
3087 close csr_ler_id;
3088 exception
3089 when others then
3090 hr_utility.set_location('issues in updating pgm ',20);
3091 raise;
3092 end;
3093 if nvl(l_sal_update_cd,'NO_UPDATE') = 'NO_UPDATE' then
3094 l_sal_upd_flag := 'N';
3095 l_sal_update_cd := '';
3096 elsif l_sal_update_cd in ('SALARY_ELEMENT','SALARY_BASIS') then
3097 l_sal_upd_flag := 'Y';
3098 else
3099 hr_utility.set_location('invalid sal upd ',30);
3100 end if;
3101 if l_dflt_step_cd in ('PQH_GSP_GP','PQH_GSP_SP','PQH_GSP_NP') then
3102 l_enrt_cd := l_dflt_step_cd;
3103 l_dflt_step_cd := '';
3104 else
3105 l_enrt_cd := 'PQH_GSP_GSP';
3106 end if;
3107 hr_utility.set_location('prog_style is '||l_enrt_cd,35);
3108 begin
3109 update ben_copy_entity_results
3110 set information_category = 'GRADE_LADDER',
3111 information16 = l_sal_upd_flag,
3112 information51 = l_enrt_cd,
3113 information14 = l_dflt_step_cd,
3114 information71 = l_sal_update_cd,
3115 information53 = l_rate_st_dt,
3116 dml_operation = 'UPDATE'
3117 where copy_entity_result_id = p_pgm_cer_id;
3118 exception
3119 when others then
3120 hr_utility.set_location('issues in updating pgm ',40);
3121 raise;
3122 end;
3123 hr_utility.set_location('done pgm update ',50);
3124 end pgm_on_stage;
3125 procedure hrate_to_stage(p_abr_cer_id in number,
3126 p_copy_entity_txn_id in number,
3127 p_effective_date in date,
3128 p_abr_id in number,
3129 p_parent_cer_id in number) is
3130 l_plan_id number;
3131 l_option_id number;
3132 l_pay_rule_id number;
3133 l_grade_id number;
3134 l_point_id number;
3135 l_pl_cer_id number;
3136 l_opt_cer_id number;
3137 begin
3138 hr_utility.set_location('inside standard rate ',10);
3139 get_co_for_abr(p_abr_id => p_abr_id,
3140 p_effective_date => p_effective_date,
3141 p_plan_id => l_plan_id,
3142 p_option_id => l_option_id,
3143 p_pay_rule_id => l_pay_rule_id);
3144 hr_utility.set_location('comp object selected ',20);
3145 if l_plan_id is not null then
3146 hr_utility.set_location('its plan '||l_plan_id,30);
3147 l_pl_cer_id := is_pl_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
3148 p_pl_id => l_plan_id);
3149 hr_utility.set_location('pl cer is '||l_pl_cer_id,35);
3150 l_grade_id := get_grade_for_plan(p_plan_id => l_plan_id,
3151 p_effective_date => p_effective_date);
3152 hr_utility.set_location('grade is '||l_grade_id,40);
3153 if l_grade_id is not null and p_abr_id is not null then
3154 pqh_gsp_rates.create_grade_hrrate
3155 (p_copy_entity_txn_id => p_copy_entity_txn_id,
3156 p_effective_date => p_effective_date,
3157 p_abr_id => p_abr_id,
3158 p_abr_cer_id => p_abr_cer_id,
3159 p_pay_rule_id => l_pay_rule_id,
3160 p_grade_id => l_grade_id);
3161 hr_utility.set_location('grade hrrate created ',45);
3162 end if;
3163 elsif l_option_id is not null then
3164 hr_utility.set_location('its point '||l_option_id,50);
3165 l_opt_cer_id := is_option_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
3166 p_opt_id => l_option_id);
3167 hr_utility.set_location('opt cer is '||l_opt_cer_id,55);
3168 l_point_id := get_point_for_opt(p_option_id => l_option_id,
3169 p_effective_date => p_effective_date);
3170 hr_utility.set_location('point is '||l_point_id,60);
3171 if l_point_id is not null and p_abr_id is not null then
3172 pqh_gsp_rates.create_point_hrrate
3173 (p_copy_entity_txn_id => p_copy_entity_txn_id,
3174 p_effective_date => p_effective_date,
3175 p_abr_id => p_abr_id,
3176 p_abr_cer_id => p_abr_cer_id,
3177 p_pay_rule_id => l_pay_rule_id,
3178 p_point_id => l_point_id);
3179 hr_utility.set_location('point hrrate created ',70);
3180 end if;
3181 end if;
3182 if l_pl_cer_id is null and l_opt_cer_id is null then
3183 hr_utility.set_location('rate is for something else',100);
3184 else
3185 begin
3186 update ben_copy_entity_results
3187 set information277 = l_pl_cer_id,
3188 information278 = l_opt_cer_id,
3189 gs_mirror_src_entity_result_id = mirror_src_entity_result_id
3190 where copy_entity_result_id = p_abr_cer_id;
3191 exception
3192 when others then
3193 hr_utility.set_location('issue in update abr with co cer',120);
3194 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
3195 (P_MASTER_TXN_ID => g_master_txn_id,
3196 P_TXN_ID => g_txn_id,
3197 p_context => 'hrate_to_stage',
3198 P_MODULE_CD => 'PQH_GSP_BENSTG',
3199 P_MESSAGE_TYPE_CD => 'E',
3200 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
3201 p_effective_date => p_effective_date);
3202 raise;
3203 end;
3204 end if;
3205 end hrate_to_stage;
3206 procedure pre_pull_process(p_copy_entity_txn_id in number,
3207 p_start_cer_id in number default null,
3208 p_effective_date in date,
3209 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST',
3210 p_business_group_id in number) is
3211 cursor csr_grd_scales is
3212 select gs.parent_spine_id scale_id,gs.grade_id grade_id
3213 from ben_copy_entity_results cer, per_grade_spines_f gs
3214 where copy_entity_txn_id = p_copy_entity_txn_id
3215 and cer.information294 = gs.grade_id
3216 and table_alias = 'PLN'
3217 and p_effective_date between gs.effective_start_date and gs.effective_end_date
3218 and copy_entity_result_id > nvl(p_start_cer_id,0);
3219 l_scale_cer_id number;
3220 begin
3221 hr_utility.set_location('inside pre-process ',10);
3222 hr_utility.set_location('bus_area is '||p_business_area,10);
3223 for i in csr_grd_scales loop
3224 hr_utility.set_location('copying scale for grade'||i.grade_id,20);
3225 populate_scale_hierarchy(p_copy_entity_txn_id => p_copy_entity_txn_id,
3226 p_effective_date => p_effective_date,
3227 p_business_group_id => p_business_group_id,
3228 p_business_area => p_business_area,
3229 p_scale_id => i.scale_id,
3230 p_mode => 'BAREBONE',
3231 p_scale_cer_id => l_scale_cer_id);
3232 end loop;
3233 hr_utility.set_location('done pre-process ',40);
3234 end pre_pull_process;
3235
3236 procedure pgi_to_stage(p_pgm_id in number,
3237 p_copy_entity_txn_id in number) is
3238
3239 l_copy_entity_result_id number;
3240 l_ovn number;
3241 l_old_flag varchar2(1) := 'Y';
3242 cursor c1 is
3243 SELECT pgm_extra_info_id,pgi_information1,pgi_information2,pgi_information3,pgi_information4
3244 FROM ben_pgm_extra_info
3245 where information_type ='PQH_GSP_EXTRA_INFO'
3246 and pgm_id = p_pgm_id;
3247 begin
3248 hr_utility.set_location('pgm id is'||p_pgm_id,10);
3249 if p_pgm_id is not null then
3250 for i in c1 loop
3251 l_old_flag := 'N';
3252 BEN_COPY_ENTITY_RESULTS_API.CREATE_COPY_ENTITY_RESULTS(
3253 p_copy_entity_result_id => l_copy_entity_result_id
3254 ,p_copy_entity_txn_id => p_copy_entity_txn_id
3255 ,p_result_type_cd => 'DISPLAY'
3256 ,p_information_category => 'PQH_GSP_EXTRA_INFO'
3257 ,p_information11 => i.pgi_information1
3258 ,p_information12 => i.pgi_information2
3259 ,p_information13 => i.pgi_information3
3260 ,p_information14 => i.pgi_information4
3261 ,p_information174 => i.pgm_extra_info_id
3262 ,p_table_name => 'BEN_PGM_EXTRA_INFO'
3263 ,p_table_alias => 'PGI'
3264 ,p_object_version_number => l_ovn
3265 ,p_effective_date => to_date('1900/01/01', 'RRRR/MM/DD')
3266 ,p_dml_operation => 'UPDATE'
3267 );
3268 end loop;
3269 if l_old_flag = 'Y' then
3270 BEN_COPY_ENTITY_RESULTS_API.CREATE_COPY_ENTITY_RESULTS(
3271 p_copy_entity_result_id => l_copy_entity_result_id
3272 ,p_copy_entity_txn_id => p_copy_entity_txn_id
3273 ,p_result_type_cd => 'DISPLAY'
3274 ,p_information_category => 'PQH_GSP_EXTRA_INFO'
3275 ,p_information11 => 'N'
3276 ,p_information12 => 'N'
3277 ,p_information13 => 'GL'
3278 ,p_information14 => 'AVG'
3279 ,p_information174 => null
3280 ,p_table_name => 'BEN_PGM_EXTRA_INFO'
3281 ,p_table_alias => 'PGI'
3282 ,p_object_version_number => l_ovn
3283 ,p_effective_date => to_date('1900/01/01', 'RRRR/MM/DD')
3284 ,p_dml_operation => 'UPDATE'
3285 );
3286 end if;
3287 end if;
3288 exception
3289 when no_data_found then
3290 hr_utility.set_location('no extra info ',10);
3291 when others then
3292 hr_utility.set_location('issues is selecting pgm extra info',10);
3293 raise;
3294 end pgi_to_stage;
3295
3296 procedure hr_to_stage(p_copy_entity_txn_id in number,
3297 p_start_cer_id in number default null,
3298 p_effective_date in date,
3299 p_business_group_id in number,
3300 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST') is
3301 -- this procedure will be the callable routine and will be starting after
3302 -- ben_to_stage has copied the data to staging table.
3303 -- in this procedure we will traverse the hierarchy and find out what all is pulled
3304 -- in and add HR data corresponding to it for GSP pages to work.
3305 -- for transaction control record is to be created after all the records have been processed
3306 -- for plan call grade_to_stage
3307 -- for a option point_to_stage
3308 -- for a oipl step_to_stage
3309 -- for a plip scale_to_stage
3310 -- for a standard rate hrate_to_stage
3311 -- for a variable rate vrate_to_stage
3312 -- we also have to update gs_parent_entity_result_id so that hierarchy can be used
3313 -- except eligibility, rest of the hierarchy is same
3314 l_proc varchar2(61) := 'hr_to_stage' ;
3315 cursor csr_txn_cer is
3316 select copy_entity_result_id,table_alias,information1,information5,information253,
3317 result_type_cd,parent_entity_result_id,information261,mirror_src_entity_result_id
3318 from ben_copy_entity_results
3319 where copy_entity_txn_id = p_copy_entity_txn_id
3320 and ((table_alias in ('PGM','PLN','OPT','CPP','COP','EPA','CEP') and result_type_cd ='DISPLAY')
3321 or table_alias in ('ABR','AVR','ELP','VPF','VEP'))
3322 and copy_entity_result_id > nvl(p_start_cer_id,0)
3323 order by copy_entity_result_id;
3324 l_effective_date date;
3325 l_status varchar2(30);
3326 l_context varchar2(30);
3327 l_grd_exists varchar2(10) := 'N';
3328 l_step_exists varchar2(10) := 'N';
3329 l_rule_exists varchar2(10) := 'N';
3330 l_rate_exists varchar2(10) := 'N';
3331 l_grade_id number;
3332 l_plan_id number;
3333 l_pl_cer_id number;
3334 l_pgm_id number;
3335 l_pgm_cer_id number;
3336 begin
3337 -- for all the pln rows get the scale attached and populate it to staging area
3338 hr_utility.set_location('start cer is'||p_start_cer_id,5);
3339 pre_pull_process(p_copy_entity_txn_id => p_copy_entity_txn_id,
3340 p_start_cer_id => p_start_cer_id,
3341 p_effective_date => p_effective_date,
3342 p_business_area => p_business_area,
3343 p_business_group_id => p_business_group_id);
3344 for txn_cer_rec in csr_txn_cer loop
3345 hr_utility.set_location('inside cer loop'||txn_cer_rec.copy_entity_result_id,10);
3346 begin
3347 if txn_cer_rec.table_alias ='PLN' then
3348 -- it's a plan row, grade is mapped to plan
3349 hr_utility.set_location('its plan row ',20);
3350 l_grade_id := get_grade_for_plan(p_plan_id => txn_cer_rec.information1,
3351 p_effective_date => p_effective_date);
3352 grade_to_pl_stage(p_grade_id => l_grade_id,
3353 p_pl_cer_id => txn_cer_rec.copy_entity_result_id,
3354 p_effective_date => p_effective_date);
3355 hr_utility.set_location('plan row updated',22);
3356 elsif txn_cer_rec.table_alias ='PGM' then
3357 hr_utility.set_location('its PGM row ',25);
3358 pgm_on_stage(p_pgm_id => txn_cer_rec.information1,
3359 p_pgm_cer_id => txn_cer_rec.copy_entity_result_id,
3360 p_copy_entity_txn_id =>p_copy_entity_txn_id);
3361 hr_utility.set_location('PGM row updated',28);
3362 l_pgm_id := txn_cer_rec.information1;
3363 l_pgm_cer_id := txn_cer_rec.copy_entity_result_id;
3364 pgi_to_stage(p_pgm_id => l_pgm_id,
3365 p_copy_entity_txn_id => p_copy_entity_txn_id);
3366 hr_utility.set_location('PGI row updated',28);
3367 elsif txn_cer_rec.table_alias ='CPP' and txn_cer_rec.information1 is not null then
3368 -- it's a plip row
3369 hr_utility.set_location('its plip row ',30);
3370 get_grade_for_plip(p_plip_id => txn_cer_rec.information1,
3371 p_effective_date => p_effective_date,
3372 p_plan_id => l_plan_id,
3373 p_grade_id => l_grade_id);
3374 hr_utility.set_location('grade is '||l_grade_id,32);
3375 hr_utility.set_location('plan is '||l_plan_id,34);
3376 if l_plan_id is not null then
3377 l_pl_cer_id := is_pl_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
3378 p_pl_id => l_plan_id);
3379 hr_utility.set_location('pl cer is'||l_pl_cer_id,10);
3380 end if;
3381 grade_to_plip_stage(p_grade_id => l_grade_id,
3382 p_plip_cer_id => txn_cer_rec.copy_entity_result_id,
3383 p_pl_cer_id => l_pl_cer_id,
3384 p_parent_cer_id => txn_cer_rec.parent_entity_result_id,
3385 p_mirror_ser_id => txn_cer_rec.mirror_src_entity_result_id,
3386 p_effective_date => p_effective_date,
3387 p_business_area => p_business_area);
3388 hr_utility.set_location('plip rec updated ',38);
3389 elsif txn_cer_rec.table_alias ='OPT' then
3390 -- it's a option row
3391 hr_utility.set_location('its option row ',40);
3392 point_to_opt_stage(p_copy_entity_txn_id => p_copy_entity_txn_id,
3393 p_option_id => txn_cer_rec.information1,
3394 p_opt_cer_id => txn_cer_rec.copy_entity_result_id,
3395 p_effective_date => p_effective_date,
3396 p_business_area => p_business_area,
3397 p_business_group_id => p_business_group_id);
3398 hr_utility.set_location('option row updated',42);
3399 elsif txn_cer_rec.table_alias ='COP' then
3400 -- it's a OIPL row
3401 hr_utility.set_location('its oipl row ',50);
3402 step_to_oipl_stage(p_copy_entity_txn_id => p_copy_entity_txn_id,
3403 p_oipl_cer_id => txn_cer_rec.copy_entity_result_id,
3404 p_oipl_id => txn_cer_rec.information1,
3405 p_step_id => txn_cer_rec.information253,
3406 p_parent_cer_id => txn_cer_rec.parent_entity_result_id,
3407 p_effective_date => p_effective_date,
3408 p_business_area => p_business_area);
3409 hr_utility.set_location('oipl row updated',52);
3410 elsif txn_cer_rec.table_alias ='ABR' then
3411 -- it's a Rate row
3412 hr_utility.set_location('its ABR row ',60);
3413 hrate_to_stage(p_abr_cer_id => txn_cer_rec.copy_entity_result_id,
3414 p_effective_date => p_effective_date,
3415 p_copy_entity_txn_id => p_copy_entity_txn_id,
3416 p_abr_id => txn_cer_rec.information1,
3417 p_parent_cer_id => txn_cer_rec.parent_entity_result_id);
3418 hr_utility.set_location('ABR row updated',62);
3419 elsif txn_cer_rec.table_alias ='VPF' then
3420 -- it's a variable rate row
3421 hr_utility.set_location('its VPF row ',70);
3422 vpf_to_stage(p_vpf_cer_id => txn_cer_rec.copy_entity_result_id,
3423 p_copy_entity_txn_id => p_copy_entity_txn_id,
3424 p_effective_date => p_effective_date,
3425 p_result_type_cd => txn_cer_rec.result_type_cd);
3426 elsif txn_cer_rec.table_alias ='ELP' then
3427 -- it's a eligibility profile row
3428 hr_utility.set_location('its ELP row ',80);
3429 elp_to_stage(p_elp_cer_id => txn_cer_rec.copy_entity_result_id,
3430 p_copy_entity_txn_id => p_copy_entity_txn_id,
3431 p_effective_date => p_effective_date,
3432 p_elpro_id => txn_cer_rec.information1,
3433 p_business_group_id => p_business_group_id);
3434 hr_utility.set_location('ELP row updated',85);
3435 elsif txn_cer_rec.table_alias ='EPA' then
3436 hr_utility.set_location('its EPA row ',90);
3437 epa_to_stage(p_epa_cer_id => txn_cer_rec.copy_entity_result_id,
3438 p_copy_entity_txn_id => p_copy_entity_txn_id);
3439 hr_utility.set_location('Epa row updated',100);
3440 elsif txn_cer_rec.table_alias ='CEP' then
3441 hr_utility.set_location('its cep row ',110);
3442 cep_to_stage(p_cep_cer_id => txn_cer_rec.copy_entity_result_id,
3443 p_copy_entity_txn_id => p_copy_entity_txn_id);
3444 hr_utility.set_location('cep row updated',115);
3445 end if;
3446 exception
3447 when others then
3448 hr_utility.set_location('error encountered, row being skipped',420);
3449 end;
3450 end loop;
3451 hr_utility.set_location('done reading all rows ',120);
3452 if p_business_area = 'PQH_CORPS_TASK_LIST' and l_pgm_id is not null then
3453 pqh_cpd_hr_to_stage.corps_to_stage(p_copy_entity_txn_id => p_copy_entity_txn_id,
3454 p_pgm_id => l_pgm_id,
3455 p_effective_date => p_effective_date,
3456 p_pgm_cer_id => l_pgm_cer_id);
3457 end if;
3458 if p_start_cer_id is null then
3459 hr_utility.set_location('going for ctrlrec create',125);
3460 create_gsp_control_rec(p_copy_entity_txn_id => p_copy_entity_txn_id,
3461 p_effective_date => p_effective_date,
3462 p_business_area => p_business_area);
3463 hr_utility.set_location('done creating control row ',130);
3464 end if;
3465 end hr_to_stage;
3466 procedure point_to_opt_stage(p_copy_entity_txn_id in number,
3467 p_option_id in number,
3468 p_opt_cer_id in number,
3469 p_effective_date in date,
3470 p_business_group_id in number,
3471 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST') is
3472 l_proc varchar2(61) :='point_to_opt_stage';
3473 l_scale_id number;
3474 l_scale_cer_id number;
3475 l_point_id number;
3476 l_point_seq number;
3477 l_point_ovn number;
3478 l_spinal_point per_spinal_points.spinal_point%type;
3479 l_information_category varchar2(30);
3480 l_information1 varchar2(150);
3481 l_information2 varchar2(150);
3482 l_information3 varchar2(150);
3483 l_information4 varchar2(150);
3484 l_information5 varchar2(150);
3485 begin
3486 hr_utility.set_location('option is '||p_option_id,1);
3487 l_point_id := get_point_for_opt(p_option_id => p_option_id,
3488 p_effective_date => p_effective_date);
3489 hr_utility.set_location('point for option is '||l_point_id,10);
3490 if l_point_id is not null then
3491 get_point_details(p_point_id => l_point_id,
3492 p_scale_id => l_scale_id,
3493 p_point_seq => l_point_seq,
3494 p_point_ovn => l_point_ovn,
3495 p_spinal_point => l_spinal_point);
3496 hr_utility.set_location('point is '||l_spinal_point,20);
3497 hr_utility.set_location('bus_area is '||p_business_area,20);
3498 if p_business_area ='PQH_CORPS_TASK_LIST' then
3499 pqh_cpd_hr_to_stage.get_point_details(p_point_id => l_point_id,
3500 p_information_category => l_information_category,
3501 p_information1 => l_information1,
3502 p_information2 => l_information2,
3503 p_information3 => l_information3,
3504 p_information4 => l_information4,
3505 p_information5 => l_information5);
3506 end if;
3507 if l_scale_id is not null then
3508 -- create scale if it doesnot exist in staging area.
3509 l_scale_cer_id := is_scale_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
3510 p_scale_id => l_scale_id);
3511 if l_scale_cer_id is null then
3512 hr_utility.set_location('scale not in stage,copy it',10);
3513 scale_to_stage(p_scale_id => l_scale_id,
3514 p_business_group_id => p_business_group_id,
3515 p_copy_entity_txn_id => p_copy_entity_txn_id,
3516 p_effective_date => p_effective_date,
3517 p_business_area => p_business_area,
3518 p_scale_cer_id => l_scale_cer_id);
3519 else
3520 hr_utility.set_location('scale is already in staging area ',15);
3521 end if;
3522 hr_utility.set_location('scale cer id is '||l_scale_cer_id,20);
3523 end if;
3524 end if;
3525 if p_opt_cer_id is not null then
3526 begin
3527 update ben_copy_entity_results set
3528 information98 = nvl(l_spinal_point,information98),
3529 information253 = nvl(l_point_seq,information253),
3530 information254 = nvl(l_point_ovn,information254),
3531 information255 = nvl(l_scale_id,information255),
3532 information256 = nvl(l_scale_cer_id,information256),
3533 information173 = nvl(l_information1,information173),
3534 information175 = nvl(l_information2,information175),
3535 information179 = nvl(l_information3,information179),
3536 information181 = nvl(l_information4,information181),
3537 information182 = nvl(l_information5,information182),
3538 information101 = nvl(l_information_category,information101)
3539 where copy_entity_result_id = p_opt_cer_id;
3540 exception
3541 when others then
3542 hr_utility.set_location('some issue in updating option row '||l_proc,120);
3543 end;
3544 else
3545 hr_utility.set_location('opt_cer_id is '||p_opt_cer_id,130);
3546 end if;
3547 end point_to_opt_stage;
3548 Procedure grade_to_pl_stage(p_grade_id in number,
3549 p_pl_cer_id in number,
3550 p_effective_date in date) is
3551 --
3552 -- this routine will be getting called when the data is to be loaded into staging area
3553 -- ben routine will be calling this routine.
3554 -- Data will be written into ben_copy_entity_results row provided for this purpose
3555 --
3556 l_proc varchar2(61) :='Grade_to_stage';
3557 l_date_from date;
3558 l_date_to date;
3559 l_short_name per_grades.short_name%type;
3560 l_grade_name per_grades.name%type;
3561 l_grade_definition_id number;
3562 l_grd_ovn number;
3563 begin
3564 hr_utility.set_location('inside'||l_proc,10);
3565 if p_grade_id is not null then
3566 get_grade_details(p_grade_id => p_grade_id,
3567 p_date_from => l_date_from,
3568 p_date_to => l_date_to,
3569 p_short_name => l_short_name,
3570 p_grade_name => l_grade_name,
3571 p_grd_ovn => l_grd_ovn,
3572 p_grade_definition_id => l_grade_definition_id);
3573 hr_utility.set_location('grd name is'||substr(l_grade_name,1,40),20);
3574 end if;
3575 if p_pl_cer_id is not null then
3576 -- update plan row with Grade data
3577 begin
3578 -- These mappings have been taken from hrben_to_stage document ben_pl_f addition columns section.
3579 update ben_copy_entity_results set
3580 information5 = nvl(l_grade_name,information5), -- plan name is overridden by Grade Name
3581 information102 = nvl(l_short_name,information102),
3582 information221 = nvl(l_grade_definition_id,information221),
3583 information222 = nvl(l_grd_ovn,information222),
3584 information307 = nvl(l_date_from,information307),
3585 information308 = nvl(l_date_to,information308),
3586 information223 = nvl(p_grade_id,information223),
3587 gs_mirror_src_entity_result_id = nvl(gs_mirror_src_entity_result_id,
3588 mirror_src_entity_result_id)
3589 where copy_entity_result_id = p_pl_cer_id;
3590 exception
3591 when others then
3592 hr_utility.set_location('some issue in updating Plan row '||l_proc,120);
3593 end;
3594 else
3595 hr_utility.set_location('pl_cer_id is '||p_pl_cer_id,130);
3596 end if;
3597 hr_utility.set_location('leaving '||l_proc,420);
3598 end grade_to_pl_stage;
3599 procedure get_grd_scale_details(p_grade_id in number,
3600 p_effective_date in date,
3601 p_scale_id out nocopy number,
3602 p_ceiling_step_id out nocopy number,
3603 p_grade_spine_ovn out nocopy number,
3604 p_grade_spine_id out nocopy number,
3605 p_scale_ovn out nocopy number,
3606 p_scale_name out nocopy varchar2,
3607 p_starting_step out nocopy number) is
3608 begin
3609 -- get the scale which this grade is linked to
3610 hr_utility.set_location('grade id is '||p_grade_id,10);
3611 hr_utility.set_location('effdt is '||to_char(p_effective_date,'DD-MM-RRRR'),12);
3612 select psp.parent_spine_id,psp.name,gsp.ceiling_step_id,gsp.grade_spine_id,
3613 gsp.object_version_number,psp.object_version_number,gsp.starting_step
3614 into p_scale_id,p_scale_name, p_ceiling_step_id,p_grade_spine_id,p_grade_spine_ovn,p_scale_ovn,p_starting_step
3615 from per_grade_spines_f gsp, per_parent_spines psp
3616 where gsp.grade_id = p_grade_id
3617 and psp.parent_spine_id = gsp.parent_spine_id
3618 and p_effective_date between gsp.effective_start_date and gsp.effective_end_date;
3619 hr_utility.set_location('scale name is '||p_scale_name,40);
3620 exception
3621 when no_data_found then
3622 hr_utility.set_location('no scale is linked to grade'||p_grade_id,40);
3623 null;
3624 when others then
3625 hr_utility.set_location('issues in getting scale '||p_grade_id,40);
3626 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
3627 (P_MASTER_TXN_ID => g_master_txn_id,
3628 P_TXN_ID => g_txn_id,
3629 p_context => 'get_grade_scl_details_others',
3630 P_MODULE_CD => 'PQH_GSP_BENSTG',
3631 P_MESSAGE_TYPE_CD => 'E',
3632 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
3633 p_effective_date => trunc(sysdate));
3634 raise;
3635 end get_grd_scale_details;
3636 Procedure grade_to_plip_stage(p_grade_id in number,
3637 p_plip_cer_id in number,
3638 p_pl_cer_id in number,
3639 p_parent_cer_id in number,
3640 p_mirror_ser_id in number,
3641 p_effective_date in date,
3642 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST') is
3643 --
3644 -- this routine will be getting called when the data is to be loaded into staging area
3645 -- ben routine will be calling this routine.
3646 -- Data will be written into ben_copy_entity_results row provided for this purpose
3647 --
3648 l_proc varchar2(61) :='grade_to_plip_stage';
3649 l_date_from date;
3650 l_date_to date;
3651 l_short_name per_grades.short_name%type;
3652 l_grade_name per_grades.name%type;
3653 l_grade_definition_id number;
3654 l_grd_ovn number;
3655
3656 l_scale_id number;
3657 l_scale_ovn number;
3658 l_scale_name per_parent_spines.name%type;
3659 l_ceiling_step_id number;
3660 l_grd_value number;
3661 l_grd_min number;
3662 l_grd_mid number;
3663 l_grd_max number;
3664 l_grade_spine_ovn number;
3665 l_grade_spine_id number;
3666 l_message_text varchar2(2000);
3667 l_perc_quota number;
3668 l_population_cd varchar2(150);
3669 l_comb_grades varchar2(2000);
3670 l_max_speed_quota number;
3671 l_avg_speed_quota number;
3672 l_corps_definition_id number;
3673 l_cet_id number;
3674 l_starting_step number;
3675 l_corps_extra_info_id number;
3676 begin
3677 hr_utility.set_location('inside'||l_proc,10);
3678 l_message_text := 'inside grade_to_plip'
3679 ||' grade id is '||p_grade_id
3680 ||' plip_cer_id is '||p_plip_cer_id;
3681 if p_grade_id is not null then
3682 get_grade_details(p_grade_id => p_grade_id,
3683 p_date_from => l_date_from,
3684 p_date_to => l_date_to,
3685 p_short_name => l_short_name,
3686 p_grade_name => l_grade_name,
3687 p_grd_ovn => l_grd_ovn,
3688 p_grade_definition_id => l_grade_definition_id);
3689 hr_utility.set_location('grade name is'||l_grade_name,20);
3690 -- get the scale data corresponding to the grade
3691 get_grd_scale_details(p_grade_id => p_grade_id,
3692 p_effective_date => p_effective_date,
3693 p_scale_id => l_scale_id,
3694 p_grade_spine_ovn => l_grade_spine_ovn,
3695 p_grade_spine_id => l_grade_spine_id ,
3696 p_scale_ovn => l_scale_ovn,
3697 p_ceiling_step_id => l_ceiling_step_id,
3698 p_scale_name => l_scale_name,
3699 p_starting_step => l_starting_step);
3700 hr_utility.set_location('scale name is'||l_scale_name,30);
3701 hr_utility.set_location('starting step is'||l_starting_step,370);
3702 get_grd_rate_values(p_grade_id => p_grade_id,
3703 p_effective_date => p_effective_date,
3704 p_grd_value => l_grd_value,
3705 p_grd_min => l_grd_min,
3706 p_grd_mid => l_grd_mid,
3707 p_grd_max => l_grd_max);
3708 hr_utility.set_location('grade value is'||l_grd_value,40);
3709 if p_business_area ='PQH_CORPS_TASK_LIST' then
3710 hr_utility.set_location('getting quota for plip',40);
3711 pqh_cpd_hr_to_stage.get_corp(p_pgm_cer_id => p_parent_cer_id,
3712 p_corps_id => l_corps_definition_id,
3713 p_cet_id => l_cet_id);
3714 hr_utility.set_location('corps is '||l_corps_definition_id,40);
3715 hr_utility.set_location('cet is '||l_cet_id,40);
3716 if l_corps_definition_id >0 AND l_cet_id >0 THEN
3717 pqh_cpd_hr_to_stage.get_grd_quota(p_pgm_cer_id => p_parent_cer_id,
3718 p_grade_id => p_grade_id,
3719 p_corps_definition_id => l_corps_definition_id,
3720 p_cet_id => l_cet_id,
3721 p_perc_quota => l_perc_quota,
3722 p_population_cd => l_population_cd,
3723 p_comb_grade => l_comb_grades,
3724 p_max_speed_quota => l_max_speed_quota,
3725 p_avg_speed_quota => l_avg_speed_quota,
3726 p_corps_extra_info_id => l_corps_extra_info_id);
3727 end if;
3728 end if;
3729 end if;
3730 if p_plip_cer_id is not null then
3731 begin
3732 hr_utility.set_location('going for update ',40);
3733 hr_utility.set_location('starting step is'||l_starting_step,370);
3734 update ben_copy_entity_results set
3735 information5 = nvl(l_grade_name,information5), -- plip name is same as plan name and overridden
3736 information306 = nvl(l_date_from,information306),
3737 information307 = nvl(l_date_to,information307),
3738 information253 = nvl(p_grade_id,information253),
3739 information252 = nvl(p_pl_cer_id,information252),
3740 information255 = nvl(l_scale_id,information255),
3741 information280 = nvl(l_grade_spine_id,information280),
3742 information98 = nvl(l_scale_name,information98),
3743 information12 = nvl(l_short_name,information12),
3744 information259 = nvl(l_ceiling_step_id,information259),
3745 information298 = nvl(l_grd_value,information298),
3746 information287 = l_perc_quota,
3747 information99 = l_population_cd,
3748 information219 = l_comb_grades,
3749 information288 = l_max_speed_quota,
3750 information289 = l_avg_speed_quota,
3751 information290 = l_corps_extra_info_id,
3752 information291 = l_corps_definition_id,
3753 information228 = l_starting_step,
3754 information104 = 'LINK',
3755 gs_parent_entity_result_id = nvl(gs_parent_entity_result_id,p_parent_cer_id),
3756 gs_mirror_src_entity_result_id = nvl(gs_mirror_src_entity_result_id,p_mirror_ser_id),
3757 information281 = l_grade_spine_ovn
3758 where copy_entity_result_id = p_plip_cer_id;
3759 exception
3760 when others then
3761 hr_utility.set_location('some issue in updating Plip row '||l_proc,120);
3762 end;
3763 else
3764 hr_utility.set_location('plip_cer_id is '||p_plip_cer_id,130);
3765 hr_utility.set_location('grade_name is '||l_grade_name,140);
3766 hr_utility.set_location('starting step is'||l_starting_step,370);
3767 end if;
3768
3769 hr_utility.set_location('leaving '||l_proc,420);
3770 exception
3771 when others then
3772 hr_utility.set_location('some issues in geting grd dtl '||l_proc,120);
3773 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
3774 (P_MASTER_TXN_ID => g_master_txn_id,
3775 P_TXN_ID => g_txn_id,
3776 p_context => 'grade_to_plip_stage',
3777 P_MODULE_CD => 'PQH_GSP_BENSTG',
3778 P_MESSAGE_TYPE_CD => 'E',
3779 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
3780 p_effective_date => trunc(sysdate));
3781 raise;
3782 end grade_to_plip_stage;
3783 procedure step_to_oipl_stage(p_copy_entity_txn_id in number,
3784 p_oipl_id in number,
3785 p_step_id in number,
3786 p_oipl_cer_id in number,
3787 p_parent_cer_id in number,
3788 p_effective_date in date,
3789 p_business_area in varchar2) is
3790 l_proc varchar2(61) :='step_to_stage';
3791 l_point_id number;
3792 l_point_cer_id number;
3793 l_point_name per_spinal_points.spinal_point%type;
3794 l_step_id number;
3795 l_step_ovn number;
3796 l_step_name number;
3797 l_grade_id number;
3798 l_grade_spine_id number;
3799 l_scale_id number;
3800 l_scale_cer_id number;
3801 l_point_value number;
3802 l_ceiling_flag varchar2(10);
3803 begin
3804 hr_utility.set_location('inside '||l_proc,10);
3805 l_step_id := p_step_id;
3806 if p_oipl_id is not null or l_step_id is not null then
3807 get_step_details_for_oipl(p_oipl_id => p_oipl_id,
3808 p_effective_date => p_effective_date,
3809 p_point_id => l_point_id,
3810 p_point_name => l_point_name,
3811 p_step_name => l_step_name,
3812 p_step_id => l_step_id,
3813 p_step_ovn => l_step_ovn,
3814 p_grade_id => l_grade_id,
3815 p_grade_spine_id => l_grade_spine_id,
3816 p_ceiling_flag => l_ceiling_flag,
3817 p_point_value => l_point_value,
3818 p_scale_id => l_scale_id) ;
3819 end if;
3820 if l_scale_id is not null then
3821 l_scale_cer_id := is_scale_exists_in_txn
3822 (p_copy_entity_txn_id => p_copy_entity_txn_id,
3823 p_scale_id => l_scale_id);
3824 end if;
3825 if l_point_id is not null then
3826 l_point_cer_id := is_point_exists_in_txn
3827 (p_copy_entity_txn_id => p_copy_entity_txn_id,
3828 p_point_id => l_point_id);
3829 end if;
3830 if p_oipl_cer_id is not null then
3831 hr_utility.set_location('going for update '||l_proc,20);
3832 begin
3833 update ben_copy_entity_results set
3834 information253 = nvl(l_step_id, information253),
3835 information255 = nvl(l_grade_spine_id,information255),
3836 information256 = nvl(l_point_id,information256),
3837 information262 = nvl(l_point_cer_id,information262),
3838 information98 = nvl(l_ceiling_flag, information98),
3839 information99 = nvl(l_point_name, information99),
3840 information5 = nvl(l_point_name, information5),
3841 information263 = nvl(l_step_name, information263),
3842 information298 = nvl(l_point_value, information298),
3843 information260 = nvl(l_scale_id,information260),
3844 information259 = nvl(l_scale_cer_id,information259),
3845 information104 = 'LINK',
3846 gs_parent_entity_result_id = nvl(gs_parent_entity_result_id,p_parent_cer_id)
3847 where copy_entity_result_id = p_oipl_cer_id;
3848 exception
3849 when others then
3850 hr_utility.set_location('some issue in updating oipl row '||l_proc,120);
3851 end;
3852 else
3853 hr_utility.set_location('oipl_cer_id is '||p_oipl_cer_id,130);
3854 end if;
3855 if p_business_area = 'PQH_CORPS_TASK_LIST' and l_step_id is not null then
3856 pqh_cpd_hr_to_stage.pull_career_path(p_copy_entity_txn_id => p_copy_entity_txn_id,
3857 p_step_id => l_step_id,
3858 p_effective_date => p_effective_date,
3859 p_grade_id => l_grade_id);
3860 end if;
3861 exception
3862 when others then
3863 hr_utility.set_location('some issues in geting grd dtl '||l_proc,120);
3864 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
3865 (P_MASTER_TXN_ID => g_master_txn_id,
3866 P_TXN_ID => g_txn_id,
3867 p_context => 'step_to_oipl_stage',
3868 P_MODULE_CD => 'PQH_GSP_BENSTG',
3869 P_MESSAGE_TYPE_CD => 'E',
3870 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
3871 p_effective_date => trunc(sysdate));
3872 raise;
3873 end step_to_oipl_stage;
3874 function is_hrrate_for_abr_exists(p_copy_entity_txn_id in number,
3875 p_abr_id in number) return boolean is
3876 l_exists boolean := false;
3877 l_check varchar2(30);
3878 begin
3879 select 'x'
3880 into l_check
3881 from ben_copy_entity_results
3882 where copy_entity_txn_id = p_copy_entity_txn_id
3883 and table_alias ='HRRATE'
3884 and information299 = p_abr_id;
3885 if sql%found then
3886 l_exists := true;
3887 else
3888 l_exists := false;
3889 end if;
3890 return l_exists;
3891 exception
3892 when no_data_found then
3893 hr_utility.set_location('no row for hrrate for abr in stage',10);
3894 return false;
3895 when too_many_rows then
3896 hr_utility.set_location('rows for hrrate for abr',20);
3897 return true;
3898 when others then
3899 hr_utility.set_location('issues is checking hrrate for abr',30);
3900 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
3901 (P_MASTER_TXN_ID => g_master_txn_id,
3902 P_TXN_ID => g_txn_id,
3903 p_context => 'is_hrrate_for_abr_exists',
3904 P_MODULE_CD => 'PQH_GSP_BENSTG',
3905 P_MESSAGE_TYPE_CD => 'E',
3906 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
3907 p_effective_date => trunc(sysdate));
3908 raise;
3909 end is_hrrate_for_abr_exists;
3910 procedure create_hrrate_row(p_copy_entity_txn_id in number,
3911 p_effective_date in date,
3912 p_start_date in date,
3913 p_business_group_id in number,
3914 p_abr_cer_id in number,
3915 p_grade_cer_id in number,
3916 p_grd_value in number,
3917 p_grd_min_value in number,
3918 p_grd_mid_value in number,
3919 p_grd_max_value in number,
3920 p_dml_oper in varchar2,
3921 p_hrrate_cer_id out nocopy number) is
3922 l_eot date := to_date('31/12/4712','DD/MM/RRRR');
3923 l_hrr_tr_id number;
3924 l_hrr_tr_name varchar2(30);
3925 l_pay_rate_id number;
3926 l_hrr_cer_ovn number;
3927 l_hrr_cer_id number;
3928 l_continue boolean := TRUE;
3929 begin
3930 get_table_route_details(p_table_alias => 'HRRATE',
3931 p_table_route_id => l_hrr_tr_id,
3932 p_table_name => l_hrr_tr_name);
3933 hr_utility.set_location('hrrate tr name'||l_hrr_tr_name,20);
3934 if l_hrr_tr_name is null then
3935 hr_utility.set_location('hrrate tr name'||l_hrr_tr_name,45);
3936 l_continue := FALSE;
3937 end if;
3938 if p_copy_entity_txn_id is null then
3939 hr_utility.set_location('CET is '||p_copy_entity_txn_id,50);
3940 l_continue := FALSE;
3941 end if;
3942 if p_abr_cer_id is null then
3943 hr_utility.set_location('abr cer is '||p_abr_cer_id,50);
3944 l_continue := FALSE;
3945 end if;
3946 if l_continue then
3947 l_hrr_cer_id := is_hrr_exists(p_copy_entity_txn_id => p_copy_entity_txn_id,
3948 p_grade_cer_id => p_grade_cer_id,
3949 p_hrr_esd => p_start_date);
3950 if l_hrr_cer_id is not null then
3951 p_hrrate_cer_id := l_hrr_cer_id;
3952 l_continue := FALSE;
3953 end if;
3954 end if;
3955 if l_continue then
3956 begin
3957 -- These mappings have been taken from hrben_to_stage document
3958 -- call to create ben_cer is made here using api.
3959 ben_copy_entity_results_api.create_copy_entity_results
3960 (p_effective_date => p_effective_date
3961 ,p_copy_entity_txn_id => p_copy_entity_txn_id
3962 ,p_result_type_cd => 'DISPLAY'
3963 ,p_table_name => l_hrr_tr_name
3964 ,p_table_alias => 'HRRATE'
3965 ,p_table_route_id => l_hrr_tr_id
3966 ,p_dml_operation => 'INSERT'
3967 ,p_datetrack_mode => 'CORRECTION'
3968 ,p_information2 => p_start_date
3969 ,p_information3 => l_eot
3970 ,p_information4 => p_business_group_id
3971 ,p_information277 => p_grade_cer_id
3972 ,p_information293 => l_pay_rate_id
3973 ,p_information294 => p_grd_min_value
3974 ,p_information288 => p_grd_min_value
3975 ,p_information295 => p_grd_max_value
3976 ,p_information289 => p_grd_max_value
3977 ,p_information296 => p_grd_mid_value
3978 ,p_information290 => p_grd_mid_value
3979 ,p_information297 => p_grd_value
3980 ,p_information287 => p_grd_value
3981 ,p_information300 => p_abr_cer_id
3982 ,p_copy_entity_result_id => p_hrrate_cer_id
3983 ,p_object_version_number => l_hrr_cer_ovn);
3984 exception
3985 when others then
3986 hr_utility.set_location('some issue in creating hrrate row ',120);
3987 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
3988 (P_MASTER_TXN_ID => g_master_txn_id,
3989 P_TXN_ID => g_txn_id,
3990 p_context => 'create_hrrate_row_grd',
3991 P_MODULE_CD => 'PQH_GSP_BENSTG',
3992 P_MESSAGE_TYPE_CD => 'E',
3993 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
3994 p_effective_date => p_effective_date);
3995 raise;
3996 end;
3997 end if;
3998 end create_hrrate_row;
3999
4000 procedure create_hrrate_row(p_copy_entity_txn_id in number,
4001 p_effective_date in date,
4002 p_start_date in date,
4003 p_business_group_id in number,
4004 p_abr_cer_id in number,
4005 p_point_cer_id in number,
4006 p_point_value in number,
4007 p_dml_oper in varchar2,
4008 p_hrrate_cer_id out nocopy number) is
4009 l_eot date := to_date('31/12/4712','DD/MM/RRRR');
4010 l_hrr_tr_id number;
4011 l_hrr_tr_name varchar2(30);
4012 l_pay_rate_id number;
4013 l_hrr_cer_ovn number;
4014 l_hrr_cer_id number;
4015 l_continue boolean := TRUE;
4016 begin
4017 get_table_route_details(p_table_alias => 'HRRATE',
4018 p_table_route_id => l_hrr_tr_id,
4019 p_table_name => l_hrr_tr_name);
4020 hr_utility.set_location('hrrate tr name'||l_hrr_tr_name,20);
4021 if l_hrr_tr_name is null then
4022 hr_utility.set_location('hrrate tr name'||l_hrr_tr_name,45);
4023 l_continue := FALSE;
4024 end if;
4025 if p_copy_entity_txn_id is null then
4026 hr_utility.set_location('CET is '||p_copy_entity_txn_id,50);
4027 l_continue := FALSE;
4028 end if;
4029 if p_abr_cer_id is null then
4030 hr_utility.set_location('abr cer is '||p_abr_cer_id,50);
4031 l_continue := FALSE;
4032 end if;
4033 if l_continue then
4034 l_hrr_cer_id := is_hrr_exists(p_copy_entity_txn_id => p_copy_entity_txn_id,
4035 p_point_cer_id => p_point_cer_id,
4036 p_hrr_esd => p_start_date);
4037 if l_hrr_cer_id is not null then
4038 p_hrrate_cer_id := l_hrr_cer_id;
4039 l_continue := FALSE;
4040 end if;
4041 end if;
4042 if l_continue then
4043 begin
4044 -- These mappings have been taken from hrben_to_stage document
4045 -- call to create ben_cer is made here using api.
4046 ben_copy_entity_results_api.create_copy_entity_results
4047 (p_effective_date => p_effective_date
4048 ,p_copy_entity_txn_id => p_copy_entity_txn_id
4049 ,p_result_type_cd => 'DISPLAY'
4050 ,p_table_name => l_hrr_tr_name
4051 ,p_table_alias => 'HRRATE'
4052 ,p_table_route_id => l_hrr_tr_id
4053 ,p_dml_operation => 'INSERT'
4054 ,p_datetrack_mode => 'CORRECTION'
4055 ,p_information2 => p_start_date
4056 ,p_information3 => l_eot
4057 ,p_information4 => p_business_group_id
4058 ,p_information278 => p_point_cer_id
4059 ,p_information293 => l_pay_rate_id
4060 ,p_information297 => p_point_value
4061 ,p_information287 => p_point_value
4062 ,p_information300 => p_abr_cer_id
4063 ,p_copy_entity_result_id => p_hrrate_cer_id
4064 ,p_object_version_number => l_hrr_cer_ovn);
4065 exception
4066 when others then
4067 hr_utility.set_location('some issue in creating hrrate row ',120);
4068 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4069 (P_MASTER_TXN_ID => g_master_txn_id,
4070 P_TXN_ID => g_txn_id,
4071 p_context => 'create_hrrate_row_pnt',
4072 P_MODULE_CD => 'PQH_GSP_BENSTG',
4073 P_MESSAGE_TYPE_CD => 'E',
4074 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
4075 p_effective_date => p_effective_date);
4076 raise;
4077 end;
4078 end if;
4079 end create_hrrate_row;
4080 procedure create_abr_row(p_copy_entity_txn_id in number,
4081 p_start_date in date,
4082 p_pl_cer_id in number default null,
4083 p_opt_cer_id in number default null,
4084 p_business_group_id in number,
4085 p_effective_date in date,
4086 p_abr_cer_id out nocopy number,
4087 p_create_hrr in varchar2 default 'N',
4088 p_dml_oper in varchar2) is
4089 l_eot date := to_date('31/12/4712','DD/MM/RRRR');
4090 l_abr_tr_id number;
4091 l_abr_tr_name varchar2(30);
4092 l_abr_cer_ovn number;
4093 l_hrr_cer_id number;
4094 l_continue boolean := TRUE;
4095 begin
4096 if p_pl_cer_id is null and p_opt_cer_id is null then
4097 hr_utility.set_location('pl or opt cer is reqd',55);
4098 l_continue := FALSE;
4099 else
4100 p_abr_cer_id := get_abr_cer(p_copy_entity_txn_id => p_copy_entity_txn_id,
4101 p_pl_cer_id => p_pl_cer_id,
4102 p_opt_cer_id => p_opt_cer_id,
4103 p_effective_date => p_effective_date);
4104 end if;
4105 if p_abr_cer_id is null then
4106 get_table_route_details(p_table_alias => 'ABR',
4107 p_table_route_id => l_abr_tr_id,
4108 p_table_name => l_abr_tr_name);
4109 hr_utility.set_location('abr tr name'||l_abr_tr_name,20);
4110 if l_abr_tr_name is null then
4111 hr_utility.set_location('abr tr name'||l_abr_tr_name,45);
4112 l_continue := FALSE;
4113 end if;
4114 if p_copy_entity_txn_id is null then
4115 hr_utility.set_location('CET is '||p_copy_entity_txn_id,50);
4116 l_continue := FALSE;
4117 end if;
4118 else
4119 l_continue := FALSE;
4120 end if;
4121 if l_continue then
4122 begin
4123 -- These mappings have been taken from hrben_to_stage document
4124 -- call to create ben_cer is made here using api.
4125 ben_copy_entity_results_api.create_copy_entity_results
4126 (p_effective_date => p_effective_date
4127 ,p_copy_entity_txn_id => p_copy_entity_txn_id
4128 ,p_result_type_cd => 'DISPLAY'
4129 ,p_table_name => l_abr_tr_name
4130 ,p_table_alias => 'ABR'
4131 ,p_table_route_id => l_abr_tr_id
4132 ,p_dml_operation => 'INSERT'
4133 ,p_information2 => p_start_date
4134 ,p_information3 => l_eot
4135 ,p_information4 => p_business_group_id
4136 ,p_information277 => p_pl_cer_id
4137 ,p_information278 => p_opt_cer_id
4138 ,p_copy_entity_result_id => p_abr_cer_id
4139 ,p_object_version_number => l_abr_cer_ovn);
4140 exception
4141 when others then
4142 hr_utility.set_location('some issue in creating abr row ',120);
4143 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4144 (P_MASTER_TXN_ID => g_master_txn_id,
4145 P_TXN_ID => g_txn_id,
4146 p_context => 'create_abr_row',
4147 P_MODULE_CD => 'PQH_GSP_BENSTG',
4148 P_MESSAGE_TYPE_CD => 'E',
4149 P_MESSAGE_TEXT => sqlerrm,
4150 p_effective_date => p_effective_date);
4151 raise;
4152 end;
4153 end if;
4154 if p_abr_cer_id is not null and p_create_hrr = 'Y' then
4155 if p_pl_cer_id is not null then
4156 create_hrrate_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
4157 p_effective_date => p_effective_date,
4158 p_start_date => p_start_date,
4159 p_business_group_id => p_business_group_id,
4160 p_abr_cer_id => p_abr_cer_id,
4161 p_grade_cer_id => p_pl_cer_id,
4162 p_grd_value => 0,
4163 p_grd_min_value => '',
4164 p_grd_mid_value => '',
4165 p_grd_max_value => '',
4166 p_dml_oper => 'INSERT',
4167 p_hrrate_cer_id => l_hrr_cer_id);
4168 elsif p_opt_cer_id is not null then
4169 create_hrrate_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
4170 p_effective_date => p_effective_date,
4171 p_start_date => p_start_date,
4172 p_business_group_id => p_business_group_id,
4173 p_abr_cer_id => p_abr_cer_id,
4174 p_point_cer_id => p_opt_cer_id,
4175 p_point_value => 0,
4176 p_dml_oper => 'INSERT',
4177 p_hrrate_cer_id => l_hrr_cer_id);
4178 end if;
4179 end if;
4180 end create_abr_row;
4181 Procedure scale_to_stage(p_scale_id in number,
4182 p_business_group_id in number,
4183 p_copy_entity_txn_id in number,
4184 p_effective_date in date,
4185 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST',
4186 p_scale_cer_id out nocopy number) is
4187 --
4188 -- this routine will be getting called when the scale is selected for update or for attaching.
4189 -- Data will be written into ben_copy_entity_results row provided for this purpose
4190 --
4191 l_proc varchar2(61) :='Scale_to_stage';
4192 l_scale_name per_parent_spines.name%type;
4193 l_scale_ovn number;
4194 l_increment_frequency per_parent_spines.increment_frequency%type;
4195 l_bg number;
4196 l_increment_period per_parent_spines.increment_period%type;
4197 l_scl_tr_id number;
4198 l_scl_tr_name ben_copy_entity_results.table_name%type;
4199 l_scl_cer_ovn number;
4200 l_information_category varchar2(30);
4201 l_information1 varchar2(150);
4202 l_information2 varchar2(150);
4203 begin
4204 hr_utility.set_location('inside'||l_proc,10);
4205 hr_utility.set_location('bus_area is'||p_business_area,10);
4206 begin
4207 -- get the scale info in local variables
4208 select name, increment_frequency,business_group_id, increment_period,object_version_number
4209 into l_scale_name,l_increment_frequency,l_bg,l_increment_period,l_scale_ovn
4210 from per_parent_spines
4211 where parent_spine_id = p_scale_id
4212 and business_group_id = p_business_group_id;
4213 hr_utility.set_location('scale name'||l_scale_name,20);
4214 exception
4215 when others then
4216 hr_utility.set_location('scale doesnot exist '||p_scale_id,35);
4217 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4218 (P_MASTER_TXN_ID => g_master_txn_id,
4219 P_TXN_ID => g_txn_id,
4220 p_context => 'scale_to_stage',
4221 P_MODULE_CD => 'PQH_GSP_BENSTG',
4222 P_MESSAGE_TYPE_CD => 'E',
4223 P_MESSAGE_TEXT => sqlerrm,
4224 p_effective_date => p_effective_date);
4225 raise;
4226 end;
4227 if l_scale_name is not null then
4228 -- get the table route id and table alias
4229 get_table_route_details(p_table_alias => 'SCALE',
4230 p_table_route_id => l_scl_tr_id,
4231 p_table_name => l_scl_tr_name);
4232 hr_utility.set_location('scale tr name'||l_scl_tr_name,50);
4233 else
4234 hr_utility.set_location('no scale table route exists',55);
4235 end if;
4236 if p_business_area ='PQH_CORPS_TASK_LIST' then
4237 pqh_cpd_hr_to_stage.get_scale_ddf_det(p_scale_id => p_scale_id,
4238 p_information_category => l_information_category,
4239 p_information1 => l_information1,
4240 p_information2 => l_information2);
4241 end if;
4242 if p_copy_entity_txn_id is not null and
4243 l_scale_name is not null and
4244 l_scl_tr_name is not null then
4245 -- create scale row in staging area
4246 begin
4247 -- These mappings have been taken from hrben_to_stage document
4248 -- call to create ben_cer is made here using api.
4249 ben_copy_entity_results_api.create_copy_entity_results
4250 (p_effective_date => p_effective_date
4251 ,p_copy_entity_txn_id => p_copy_entity_txn_id
4252 ,p_result_type_cd => 'DISPLAY'
4253 ,p_table_name => l_scl_tr_name
4254 ,p_table_alias => 'SCALE'
4255 ,p_table_route_id => l_scl_tr_id
4256 ,p_information1 => p_scale_id
4257 ,p_information4 => l_bg
4258 ,p_information5 => l_scale_name
4259 ,p_information254 => l_scale_ovn
4260 ,p_information253 => l_increment_frequency
4261 ,p_information98 => l_scale_name
4262 ,p_information99 => l_increment_period
4263 ,p_information101 => l_information_category
4264 ,p_information112 => l_information1
4265 ,p_information113 => l_information2
4266 ,p_copy_entity_result_id => p_scale_cer_id
4267 ,p_object_version_number => l_scl_cer_ovn);
4268 exception
4269 when others then
4270 hr_utility.set_location('some issue in creating scale row '||l_proc,120);
4271 raise;
4272 end;
4273 else
4274 hr_utility.set_location('p_copy_entity_txn_id is '||p_copy_entity_txn_id,130);
4275 hr_utility.set_location('l_scale_name is '||l_scale_name,140);
4276 hr_utility.set_location('l_scl_tr_name is '||l_scl_tr_name,140);
4277 end if;
4278 end Scale_to_stage;
4279 function get_current_max_cer(p_copy_entity_txn_id in number) return number is
4280 l_max_cer_id number;
4281 begin
4282 select max(copy_entity_result_id)
4283 into l_max_cer_id
4284 from ben_copy_entity_results
4285 where copy_entity_txn_id = p_copy_entity_txn_id;
4286 hr_utility.set_location('max cer is'||l_max_cer_id,10);
4287 return l_max_cer_id;
4288 exception
4289 when others then
4290 hr_utility.set_location('issue in getting max cer',40);
4291 raise;
4292 end get_current_max_cer;
4293 procedure update_txn_table_route(p_copy_entity_txn_id in number) is
4294 cursor tr is select table_route_id,display_name,table_alias
4295 from pqh_table_route
4296 where from_clause ='OAB';
4297 begin
4298 for i in tr loop
4299 update ben_copy_entity_results
4300 set table_alias = nvl(table_alias,i.table_alias)
4301 , table_name = nvl(table_name,substr(i.display_name,1,30))
4302 where copy_entity_txn_id = p_copy_entity_txn_id
4303 and table_route_id = i.table_route_id;
4304 end loop;
4305 end update_txn_table_route;
4306 procedure create_txn_user(p_copy_entity_txn_id in number,
4307 p_user_id in number,
4308 p_replacement_type_cd in varchar2,
4309 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST') is
4310 l_cea_ovn number;
4311 l_cea_id number;
4312 begin
4313 hr_utility.set_location('creating txn user',10);
4314 pqh_copy_entity_attribs_api.create_copy_entity_attrib
4315 (p_copy_entity_attrib_id => l_cea_id,
4316 p_copy_entity_txn_id => p_copy_entity_txn_id,
4317 p_information_category => 'PQH_GSP_TXN',
4318 p_information1 => 'UGL',
4319 p_row_type_cd => 'GSP',
4320 p_information7 => p_user_id,
4321 p_information8 => p_replacement_type_cd,
4322 p_information9 => p_business_area,
4323 p_object_version_number => l_cea_ovn,
4324 p_effective_date => trunc(sysdate));
4325 hr_utility.set_location('cea '||l_cea_id,20);
4326 exception
4327 when others then
4328 hr_utility.set_location('issues in creating txn user',30);
4329 raise;
4330 end create_txn_user;
4331 procedure update_or_view_GL(p_calling_mode in varchar2,
4332 p_action_type in varchar2 default 'REFRESH',
4333 p_pgm_id in number,
4334 p_pgm_name in varchar2,
4335 p_effective_date in date,
4336 p_business_group_id in number,
4337 p_user_id in number,
4338 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST',
4339 p_copy_entity_txn_id out nocopy number ) is
4340 cursor csr_txns is select txn.copy_entity_txn_id
4341 from pqh_copy_entity_txns txn, ben_copy_entity_results cer
4342 where txn.context_business_group_id = p_business_group_id
4343 and txn.status ='VIEW'
4344 and txn.context ='GSP'
4345 and cer.copy_entity_txn_id = txn.copy_entity_txn_id
4346 and cer.information1 = p_pgm_id
4347 and cer.table_alias = 'PGM';
4348 l_cet_id number;
4349 l_cet_ovn number;
4350 l_txn_name varchar2(100);
4351 begin
4352 if p_calling_mode ='U' then
4353 hr_utility.set_location('calling for update with'||p_pgm_name,10);
4354 update_GL(p_pgm_id => p_pgm_id,
4355 p_pgm_name => p_pgm_name,
4356 p_effective_date => p_effective_date,
4357 p_business_group_id => p_business_group_id,
4358 p_action_type => p_action_type,
4359 p_user_id => p_user_id,
4360 p_business_area => p_business_area,
4361 p_copy_entity_txn_id => p_copy_entity_txn_id);
4362 elsif p_calling_mode ='V' then
4363 hr_utility.set_location('calling for view',15);
4364 open csr_txns;
4365 fetch csr_txns into l_cet_id;
4366 if csr_txns%found then
4367 --close csr_txns;
4368 hr_utility.set_location('deleting details',20);
4369 --pqh_gsp_utility.del_gl_details_from_stage(p_pqh_copy_entity_txn_id => l_cet_id);
4370 pqh_gsp_utility.delete_transaction(p_pqh_copy_entity_txn_id =>l_cet_id);
4371
4372 end if;
4373 close csr_txns;
4374 l_txn_name := pqh_gsp_utility.gen_txn_display_name
4375 (p_program_name => p_pgm_name,
4376 p_mode => 'V');
4377 hr_utility.set_location('starting cet row ',30);
4378 start_gsp_txn(p_copy_entity_txn_id => l_cet_id
4379 ,p_business_group_id => p_business_group_id
4380 ,p_name => p_pgm_name
4381 ,p_effective_date => p_effective_date
4382 ,p_status => 'VIEW'
4383 ,p_object_version_number => l_cet_ovn);
4384 -- end if;
4385 hr_utility.set_location('populating pgm hier for cet '||l_cet_id,40);
4386 PQH_GSP_PROCESS_LOG.START_LOG
4387 (P_TXN_ID => p_pgm_id,
4388 P_TXN_NAME => p_pgm_name,
4389 P_MODULE_CD => 'PQH_GSP_BENSTG');
4390 g_master_txn_id := p_pgm_id;
4391 g_txn_id := p_pgm_id;
4392 populate_pgm_hierarchy(p_copy_entity_txn_id => l_cet_id,
4393 p_effective_date => p_effective_date,
4394 p_business_group_id => p_business_group_id,
4395 p_business_area => p_business_area,
4396 p_pgm_id => p_pgm_id);
4397 hr_utility.set_location('done populating pgm hier ',50);
4398 p_copy_entity_txn_id := l_cet_id;
4399 else
4400 hr_utility.set_location('invalid mode passed '||p_calling_mode,100);
4401 end if;
4402 end update_or_view_gl;
4403 procedure update_GL(p_pgm_id in number,
4404 p_action_type in varchar2 default 'REFRESH',
4405 p_pgm_name in varchar2,
4406 p_effective_date in date,
4407 p_business_group_id in number,
4408 p_user_id in number,
4409 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST',
4410 p_copy_entity_txn_id out nocopy number ) is
4411 cursor csr_txns is select txn.copy_entity_txn_id
4412 from pqh_copy_entity_txns txn, ben_copy_entity_results cer,
4413 pqh_copy_entity_attribs attr
4414 where txn.context_business_group_id = p_business_group_id
4415 and attr.copy_entity_txn_id = txn.copy_entity_txn_id
4416 --changes for bug no 6030246 starts here
4417 -- and attr.information7 = p_user_id
4418 and attr.information7 = to_char(p_user_id)
4419 --changes for bug no 6030246 ends here
4420 and txn.status ='SFL'
4421 and txn.context ='GSP'
4422 and cer.copy_entity_txn_id = txn.copy_entity_txn_id
4423 and cer.information1 = p_pgm_id
4424 and cer.table_alias = 'PGM';
4425
4426 l_rec_found boolean := FALSE;
4427 l_user_name fnd_user.user_name%type;
4428 l_txn_name pqh_copy_entity_txns.display_name%type;
4429 l_cet_ovn number;
4430 l_copy_entity_txn_id number;
4431 begin
4432 -- when Grade ladder is selected for Update following things are to be done
4433 -- 1) check all the rows in staging area having this pgm in staging area
4434 -- 2) if this pgm is in staging area open for update then
4435 -- 3) get the user who has it
4436 -- 4) if not then create a cet row.
4437 -- 5) call populate_pgm_hierarchy
4438 hr_utility.set_location('inside update '||p_pgm_id,10);
4439 for txn_rec in csr_txns loop
4440 l_rec_found := TRUE;
4441 hr_utility.set_location('inside loop',15);
4442 l_copy_entity_txn_id := txn_rec.copy_entity_txn_id;
4443 end loop;
4444 if l_copy_entity_txn_id is not null then
4445 hr_utility.set_location('stage has data',16);
4446 if p_action_type ='REFRESH' then
4447 hr_utility.set_location('staging data to be refreshed',18);
4448 pqh_gsp_utility.delete_transaction(p_pqh_copy_entity_txn_id => l_copy_entity_txn_id);
4449 l_rec_found := FALSE;
4450 elsif p_action_type ='CONTINUE' then
4451 hr_utility.set_location('staging data to be used',18);
4452 p_copy_entity_txn_id := l_copy_entity_txn_id;
4453 else
4454 hr_utility.set_location('cet_id will be going null ',19);
4455 end if;
4456 else
4457 hr_utility.set_location('nothing in staging',18);
4458 end if;
4459 if not l_rec_found then
4460 -- create txn_name
4461 l_txn_name := pqh_gsp_utility.gen_txn_display_name
4462 (p_program_name => p_pgm_name,
4463 p_mode => 'U');
4464 -- create txn
4465 start_gsp_txn(p_copy_entity_txn_id => l_copy_entity_txn_id
4466 ,p_business_group_id => p_business_group_id
4467 ,p_name => l_txn_name
4468 ,p_effective_date => p_effective_date
4469 ,p_status => 'SFL'
4470 ,p_business_area => p_business_area
4471 ,p_object_version_number => l_cet_ovn);
4472 p_copy_entity_txn_id := l_copy_entity_txn_id;
4473 PQH_GSP_PROCESS_LOG.START_LOG
4474 (P_TXN_ID => p_copy_entity_txn_id,
4475 P_TXN_NAME => p_pgm_name,
4476 P_MODULE_CD => 'PQH_GSP_BENSTG');
4477 g_master_txn_id := p_copy_entity_txn_id;
4478 g_txn_id := p_copy_entity_txn_id;
4479 -- populate hierarchy
4480 populate_pgm_hierarchy(p_copy_entity_txn_id => l_copy_entity_txn_id,
4481 p_effective_date => p_effective_date,
4482 p_business_group_id => p_business_group_id,
4483 p_business_area => p_business_area,
4484 p_pgm_id => p_pgm_id);
4485 -- create txn user row
4486 create_txn_user(p_copy_entity_txn_id => l_copy_entity_txn_id,
4487 p_user_id => p_user_id,
4488 p_replacement_type_cd => 'UPD',
4489 p_business_area => p_business_area);
4490 end if;
4491 end update_GL;
4492 procedure start_gsp_txn(p_copy_entity_txn_id out nocopy number
4493 ,p_business_group_id in number
4494 ,p_name in varchar2
4495 ,p_effective_date in date
4496 ,p_status in varchar2
4497 ,p_business_area in varchar2 default 'PQH_GSP_TASK_LIST'
4498 ,p_object_version_number out nocopy number) is
4499 l_gsp_txn_cat number;
4500 l_error boolean := TRUE;
4501 begin
4502 if p_status in ('VIEW','SFL') then
4503 l_error := FALSE;
4504 else
4505 hr_utility.set_location('invalid status passed',10);
4506 l_error := TRUE;
4507 end if;
4508 if not l_error then
4509 select transaction_category_id
4510 into l_gsp_txn_cat
4511 from pqh_transaction_categories
4512 where short_name ='PQHGSP'
4513 and business_group_id is null;
4514 end if;
4515 if l_gsp_txn_cat is not null then
4516 begin
4517 pqh_copy_entity_txns_api.create_COPY_ENTITY_TXN
4518 (p_copy_entity_txn_id => p_copy_entity_txn_id
4519 ,p_transaction_category_id => l_gsp_txn_cat
4520 ,p_context_business_group_id => p_business_group_id
4521 ,p_context => 'GSP'
4522 ,p_action_date => p_effective_date
4523 ,p_src_effective_date => p_effective_date
4524 ,p_number_of_copies => 1
4525 ,p_display_name => p_name
4526 ,p_replacement_type_cd => 'NONE'
4527 ,p_start_with => p_business_area
4528 ,p_status => p_status
4529 ,p_object_version_number => p_object_version_number
4530 ,p_effective_date => p_effective_date
4531 ) ;
4532 exception
4533 when others then
4534 hr_utility.set_location('issues in creating CET row',100);
4535 raise;
4536 end;
4537 end if;
4538 end start_gsp_txn;
4539 procedure populate_pgm_hierarchy(p_copy_entity_txn_id in number,
4540 p_effective_date in date,
4541 p_business_group_id in number,
4542 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST',
4543 p_pgm_id in number) is
4544 l_copy_entity_result_id number;
4545 l_cer_ovn number;
4546 begin
4547 begin
4548 BEN_PLAN_DESIGN_TXNS_API.create_plan_design_result
4549 (p_copy_entity_result_id => l_copy_entity_result_id
4550 ,p_copy_entity_txn_id => p_copy_entity_txn_id
4551 ,p_pgm_id => p_pgm_id
4552 ,p_business_group_id => p_business_group_id
4553 ,p_number_of_copies => 1
4554 ,p_object_version_number => l_cer_ovn
4555 ,p_effective_date => p_effective_date
4556 ,p_no_dup_rslt => 'Y'
4557 ) ;
4558 exception
4559 when others then
4560 hr_utility.set_location('issues in copying pgm hier',20);
4561 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4562 (P_MASTER_TXN_ID => g_master_txn_id,
4563 P_TXN_ID => g_txn_id,
4564 p_context => 'populate_pgm_hierarchy',
4565 P_MODULE_CD => 'PQH_GSP_BENSTG',
4566 P_MESSAGE_TYPE_CD => 'E',
4567 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
4568 p_effective_date => p_effective_date);
4569 raise;
4570 end;
4571 post_pull_process(p_copy_entity_txn_id => p_copy_entity_txn_id,
4572 p_effective_date => p_effective_date,
4573 p_business_group_id => p_business_group_id,
4574 p_business_area => p_business_area);
4575 end populate_pgm_hierarchy;
4576 function is_scale_exists_in_txn(p_copy_entity_txn_id in number,
4577 p_scale_id in number) return number is
4578 l_scl_cer_id number;
4579 cursor csr_scale is
4580 select copy_entity_result_id
4581 from ben_copy_entity_results
4582 where copy_entity_txn_id = p_copy_entity_txn_id
4583 and table_alias ='SCALE'
4584 and information1 = p_scale_id;
4585 begin
4586 hr_utility.set_location('checking scale'||p_scale_id,10);
4587 for i in csr_scale loop
4588 l_scl_cer_id := i.copy_entity_result_id;
4589 end loop;
4590 return l_scl_cer_id;
4591 exception
4592 when others then
4593 hr_utility.set_location('issues in checking scale ',20);
4594 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4595 (P_MASTER_TXN_ID => g_master_txn_id,
4596 P_TXN_ID => g_txn_id,
4597 p_context => 'is_scale_exists_in_txn',
4598 P_MODULE_CD => 'PQH_GSP_BENSTG',
4599 P_MESSAGE_TYPE_CD => 'E',
4600 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
4601 p_effective_date => trunc(sysdate));
4602 raise;
4603 end is_scale_exists_in_txn;
4604 function is_grd_exists_in_txn(p_copy_entity_txn_id in number,
4605 p_grd_id in number) return number is
4606 l_grd_cer_id number;
4607 cursor csr_grd is
4608 select copy_entity_result_id
4609 from ben_copy_entity_results
4610 where copy_entity_txn_id = p_copy_entity_txn_id
4611 and table_alias ='PLN'
4612 and information223 = p_grd_id;
4613 begin
4614 hr_utility.set_location('checking grd'||p_grd_id,10);
4615 for i in csr_grd loop
4616 l_grd_cer_id := i.copy_entity_result_id;
4617 end loop;
4618 return l_grd_cer_id;
4619 exception
4620 when others then
4621 hr_utility.set_location('issues in finding grade ',20);
4622 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4623 (P_MASTER_TXN_ID => g_master_txn_id,
4624 P_TXN_ID => g_txn_id,
4625 p_context => 'is_grd_exists_in_txn',
4626 P_MODULE_CD => 'PQH_GSP_BENSTG',
4627 P_MESSAGE_TYPE_CD => 'E',
4628 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
4629 p_effective_date => trunc(sysdate));
4630 raise;
4631 end is_grd_exists_in_txn;
4632 function is_plip_exists_in_txn(p_copy_entity_txn_id in number,
4633 p_pl_cer_id in number,
4634 p_grade_id in number) return number is
4635 l_plip_cer_id number;
4636 begin
4637 hr_utility.set_location('pl_cer'||p_pl_cer_id,10);
4638 hr_utility.set_location('grd'||p_grade_id,15);
4639 if p_grade_id is not null then
4640 select copy_entity_result_id
4641 into l_plip_cer_id
4642 from ben_copy_entity_results
4643 where copy_entity_txn_id = p_copy_entity_txn_id
4644 and table_alias ='CPP'
4645 and information253 = p_grade_id;
4646 else
4647 select copy_entity_result_id
4648 into l_plip_cer_id
4649 from ben_copy_entity_results
4650 where copy_entity_txn_id = p_copy_entity_txn_id
4651 and table_alias ='CPP'
4652 and information252 = p_pl_cer_id;
4653 end if;
4654 hr_utility.set_location('plip_cer'||l_plip_cer_id,20);
4655 return l_plip_cer_id;
4656 exception
4657 when no_data_found then
4658 hr_utility.set_location('issues in finding plip ',30);
4659 return l_plip_cer_id;
4660 when others then
4661 hr_utility.set_location('issues in finding plip ',30);
4662 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4663 (P_MASTER_TXN_ID => g_master_txn_id,
4664 P_TXN_ID => g_txn_id,
4665 p_context => 'is_plip_exists_in_txn',
4666 P_MODULE_CD => 'PQH_GSP_BENSTG',
4667 P_MESSAGE_TYPE_CD => 'E',
4668 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
4669 p_effective_date => trunc(sysdate));
4670 raise;
4671 end is_plip_exists_in_txn;
4672 function is_pl_exists_in_txn(p_copy_entity_txn_id in number,
4673 p_pl_id in number) return number is
4674 l_pl_cer_id number;
4675 cursor csr_pln is
4676 select copy_entity_result_id
4677 from ben_copy_entity_results
4678 where copy_entity_txn_id = p_copy_entity_txn_id
4679 and table_alias ='PLN'
4680 and information1 = p_pl_id;
4681 begin
4682 hr_utility.set_location('checking pl'||p_pl_id,10);
4683 for i in csr_pln loop
4684 l_pl_cer_id := i.copy_entity_result_id;
4685 end loop;
4686 return l_pl_cer_id;
4687 exception
4688 when others then
4689 hr_utility.set_location('issues in finding plan ',20);
4690 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4691 (P_MASTER_TXN_ID => g_master_txn_id,
4692 P_TXN_ID => g_txn_id,
4693 p_context => 'is_pl_exists_in_txn',
4694 P_MODULE_CD => 'PQH_GSP_BENSTG',
4695 P_MESSAGE_TYPE_CD => 'E',
4696 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
4697 p_effective_date => trunc(sysdate));
4698 raise;
4699 end is_pl_exists_in_txn;
4700 function is_ep_exists_in_txn(p_copy_entity_txn_id in number,
4701 p_start_cer in number,
4702 p_ep_id in number) return number is
4703 l_ep_cer_id number;
4704 cursor csr_epn is
4705 select copy_entity_result_id
4706 from ben_copy_entity_results
4707 where copy_entity_txn_id = p_copy_entity_txn_id
4708 and table_alias ='ELP'
4709 and copy_entity_result_id > p_start_cer
4710 and (information1 = p_ep_id OR information101 = p_ep_id) ;
4711 begin
4712 hr_utility.set_location('checking EP'||p_ep_id,10);
4713 for i in csr_epn loop
4714 l_ep_cer_id := i.copy_entity_result_id;
4715 end loop;
4716 return l_ep_cer_id;
4717 exception
4718 when others then
4719 hr_utility.set_location('issues in finding EP ',20);
4720 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4721 (P_MASTER_TXN_ID => g_master_txn_id,
4722 P_TXN_ID => g_txn_id,
4723 p_context => 'is_ep_exists_in_txn',
4724 P_MODULE_CD => 'PQH_GSP_BENSTG',
4725 P_MESSAGE_TYPE_CD => 'E',
4726 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
4727 p_effective_date => trunc(sysdate));
4728 raise;
4729 end is_ep_exists_in_txn;
4730 function is_option_exists_in_txn(p_copy_entity_txn_id in number,
4731 p_opt_id in number) return number is
4732 l_opt_cer_id number;
4733 cursor csr_opt is
4734 select copy_entity_result_id
4735 from ben_copy_entity_results
4736 where copy_entity_txn_id = p_copy_entity_txn_id
4737 and table_alias ='OPT'
4738 and information1 = p_opt_id;
4739 begin
4740 for i in csr_opt loop
4741 l_opt_cer_id := i.copy_entity_result_id;
4742 end loop;
4743 return l_opt_cer_id;
4744 exception
4745 when others then
4746 hr_utility.set_location('issues in copying opt hier',20);
4747 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4748 (P_MASTER_TXN_ID => g_master_txn_id,
4749 P_TXN_ID => g_txn_id,
4750 p_context => 'is_opt_exists_in_txn',
4751 P_MODULE_CD => 'PQH_GSP_BENSTG',
4752 P_MESSAGE_TYPE_CD => 'E',
4753 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
4754 p_effective_date => trunc(sysdate));
4755 raise;
4756 end is_option_exists_in_txn;
4757 function is_point_exists_in_txn(p_copy_entity_txn_id in number,
4758 p_point_id in number) return number is
4759 l_pt_cer_id number;
4760 cursor csr_opt is
4761 select copy_entity_result_id
4762 from ben_copy_entity_results
4763 where copy_entity_txn_id = p_copy_entity_txn_id
4764 and table_alias ='OPT'
4765 and information257 = p_point_id;
4766 begin
4767 for i in csr_opt loop
4768 l_pt_cer_id := i.copy_entity_result_id;
4769 end loop;
4770 return l_pt_cer_id;
4771 exception
4772 when others then
4773 hr_utility.set_location('issues in finding point ',20);
4774 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4775 (P_MASTER_TXN_ID => g_master_txn_id,
4776 P_TXN_ID => g_txn_id,
4777 p_context => 'is_pnt_exists_in_txn',
4778 P_MODULE_CD => 'PQH_GSP_BENSTG',
4779 P_MESSAGE_TYPE_CD => 'E',
4780 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
4781 p_effective_date => trunc(sysdate));
4782 raise;
4783 end is_point_exists_in_txn;
4784 function is_step_exists_in_txn(p_copy_entity_txn_id in number,
4785 p_step_id in number,
4786 p_option_id in number,
4787 p_pl_id in number) return number is
4788 l_oipl_cer_id number;
4789 cursor csr_oipl is
4790 select copy_entity_result_id
4791 from ben_copy_entity_results
4792 where copy_entity_txn_id = p_copy_entity_txn_id
4793 and table_alias ='COP'
4794 and information253 = p_step_id;
4795 begin
4796 if p_option_id is not null and p_pl_id is not null then
4797 begin
4798 hr_utility.set_location('checking oipl ofr opt '||p_option_id,10);
4799 hr_utility.set_location('checking oipl for pl '||p_pl_id,12);
4800 select copy_entity_result_id
4801 into l_oipl_cer_id
4802 from ben_copy_entity_results
4803 where copy_entity_txn_id = p_copy_entity_txn_id
4804 and table_alias ='COP'
4805 and information247 = p_option_id
4806 and information261 = p_pl_id;
4807 exception
4808 when no_data_found then
4809 hr_utility.set_location('oipl doesnot exist',20);
4810 return l_oipl_cer_id;
4811 when others then
4812 hr_utility.set_location('issues in finding point ',20);
4813 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4814 (P_MASTER_TXN_ID => g_master_txn_id,
4815 P_TXN_ID => g_txn_id,
4816 p_context => 'is_step_exists_in_txn',
4817 P_MODULE_CD => 'PQH_GSP_BENSTG',
4818 P_MESSAGE_TYPE_CD => 'E',
4819 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
4820 p_effective_date => trunc(sysdate));
4821 raise;
4822 end;
4823 else
4824 hr_utility.set_location('checking oipl ofr step '||p_step_id,30);
4825 for i in csr_oipl loop
4826 l_oipl_cer_id := i.copy_entity_result_id;
4827 end loop;
4828 end if;
4829 return l_oipl_cer_id;
4830 exception
4831 when others then
4832 hr_utility.set_location('issues in finding oipl ',40);
4833 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4834 (P_MASTER_TXN_ID => g_master_txn_id,
4835 P_TXN_ID => g_txn_id,
4836 p_context => 'is_step_exists_in_txn2',
4837 P_MODULE_CD => 'PQH_GSP_BENSTG',
4838 P_MESSAGE_TYPE_CD => 'E',
4839 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
4840 p_effective_date => trunc(sysdate));
4841 raise;
4842 end is_step_exists_in_txn;
4843 procedure populate_opt_hierarchy(p_copy_entity_txn_id in number,
4844 p_effective_date in date,
4845 p_business_group_id in number,
4846 p_opt_id in number,
4847 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST',
4848 p_opt_cer_id out nocopy number) is
4849 l_copy_entity_result_id number;
4850 l_cer_ovn number;
4851 l_start_cer number;
4852 begin
4853 p_opt_cer_id := is_option_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
4854 p_opt_id => p_opt_id);
4855 hr_utility.set_location('opt cer is'||p_opt_cer_id,10);
4856 if p_opt_cer_id is null then
4857 hr_utility.set_location('opt not in staging area, going for copy ',15);
4858 l_start_cer:= get_current_max_cer(p_copy_entity_txn_id );
4859 begin
4860 ben_plan_design_plan_module.create_opt_result
4861 (p_copy_entity_result_id => l_copy_entity_result_id
4862 ,p_copy_entity_txn_id => p_copy_entity_txn_id
4863 ,p_opt_id => p_opt_id
4864 ,p_business_group_id => p_business_group_id
4865 ,p_number_of_copies => 1
4866 ,p_object_version_number => l_cer_ovn
4867 ,p_effective_date => p_effective_date
4868 ,p_parent_entity_result_id => l_copy_entity_result_id
4869 ,p_no_dup_rslt => 'Y'
4870 );
4871 hr_utility.set_location('copied opt hier',20);
4872 exception
4873 when others then
4874 hr_utility.set_location('issues in copying opt hier',25);
4875 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
4876 (P_MASTER_TXN_ID => g_master_txn_id,
4877 P_TXN_ID => g_txn_id,
4878 p_context => 'populate_opt_hierarchy',
4879 P_MODULE_CD => 'PQH_GSP_BENSTG',
4880 P_MESSAGE_TYPE_CD => 'E',
4881 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
4882 p_effective_date => p_effective_date);
4883 raise;
4884 end;
4885 post_pull_process(p_copy_entity_txn_id => p_copy_entity_txn_id,
4886 p_start_cer => l_start_cer,
4887 p_effective_date => p_effective_date,
4888 p_business_group_id => p_business_group_id,
4889 p_business_area => p_business_area);
4890 p_opt_cer_id := is_option_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
4891 p_opt_id => p_opt_id);
4892 if p_opt_cer_id is null then
4893 hr_utility.set_location('issues in copying option',50);
4894 else
4895 hr_utility.set_location('opt cer is'||p_opt_cer_id,55);
4896 end if;
4897 else
4898 hr_utility.set_location('opt exists and cer is'||p_opt_cer_id,65);
4899 end if;
4900 end populate_opt_hierarchy;
4901 procedure populate_grd_hierarchy(p_copy_entity_txn_id in number,
4902 p_effective_date in date,
4903 p_business_group_id in number,
4904 p_grade_id in number,
4905 p_grade_name in varchar2,
4906 p_pgm_cer_id in number,
4907 p_in_pl_cer_id in number,
4908 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST',
4909 p_out_pl_cer_id out nocopy number,
4910 p_plip_cer_id out nocopy number,
4911 p_scale_cer_id out nocopy number) is
4912 cursor csr_grd_scale is
4913 select parent_spine_id
4914 from per_grade_spines_f
4915 where p_effective_date between effective_start_date and effective_end_date
4916 and grade_id = p_grade_id;
4917 cursor csr_grd_steps is
4918 select sps.step_id,sps.spinal_point_id,sps.object_version_number,gs.grade_spine_id
4919 from per_spinal_point_steps_f sps, per_grade_spines_f gs
4920 where p_effective_date between sps.effective_start_date and sps.effective_end_date
4921 and gs.grade_spine_id = sps.grade_spine_id
4922 and p_effective_date between gs.effective_start_date and gs.effective_end_date
4923 and gs.grade_id = p_grade_id;
4924 l_pl_cer_ovn number;
4925 l_grade_scale_id number;
4926 l_pl_id number;
4927 l_oipl_cer_id number;
4928 l_opt_cer_id number;
4929 l_start_cer number;
4930 l_option_id number;
4931 l_plip_cer_ovn number;
4932 begin
4933 hr_utility.set_location('populating grade'||p_grade_id,10);
4934 -- initialize message pub before trying to add grade into the ladder
4935 fnd_msg_pub.initialize; --- Bug 8365941
4936 PQH_GSP_PROCESS_LOG.START_LOG
4937 (P_TXN_ID => Nvl(p_grade_id,p_in_pl_cer_id) ,
4938 P_TXN_NAME => p_grade_name,
4939 P_MODULE_CD => 'PQH_GSP_BENSTG');
4940 g_master_txn_id := Nvl(p_grade_id, P_in_Pl_Cer_id);
4941 g_txn_id := Nvl(p_grade_id, P_In_Pl_Cer_Id);
4942 l_start_cer:= get_current_max_cer(p_copy_entity_txn_id );
4943 if p_grade_id is not null then
4944 l_pl_id := get_plan_for_grade(p_grade_id => p_grade_id,
4945 p_effective_date => p_effective_date);
4946 end if;
4947 -- check for plip existence
4948 p_plip_cer_id := is_plip_exists_in_txn
4949 (p_copy_entity_txn_id => p_copy_entity_txn_id,
4950 p_pl_cer_id => p_in_pl_cer_id,
4951 p_grade_id => p_grade_id);
4952 if p_plip_cer_id is null then
4953 create_plip_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
4954 p_effective_date => p_effective_date,
4955 p_business_group_id => p_business_group_id,
4956 p_grade_id => p_grade_id,
4957 p_pgm_cer_id => p_pgm_cer_id,
4958 p_grade_name => p_grade_name,
4959 p_pl_cer_id => p_in_pl_cer_id,
4960 p_plip_cer_id => p_plip_cer_id,
4961 p_plip_cer_ovn => l_plip_cer_ovn);
4962 end if;
4963 if l_pl_id is not null then
4964 hr_utility.set_location('grade is linked to plan'||l_pl_id,20);
4965 populate_pl_hierarchy(p_copy_entity_txn_id => p_copy_entity_txn_id,
4966 p_effective_date => p_effective_date,
4967 p_business_group_id => p_business_group_id,
4968 p_plip_cer_id => p_plip_cer_id,
4969 p_pl_id => l_pl_id,
4970 p_mode => 'BAREBONE',
4971 p_business_area => p_business_area,
4972 p_pl_cer_id => p_out_pl_cer_id);
4973 hr_utility.set_location('pl hier populated '||p_out_pl_cer_id,30);
4974 else
4975 hr_utility.set_location('grade not linked ',40);
4976 if p_grade_id is not null then
4977 p_out_pl_cer_id := is_grd_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
4978 p_grd_id => p_grade_id);
4979 if p_out_pl_cer_id is null then
4980 hr_utility.set_location('grade not in stage'||p_grade_id,42);
4981 create_plan_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
4982 p_effective_date => p_effective_date,
4983 p_business_group_id => p_business_group_id,
4984 p_grade_id => p_grade_id,
4985 p_plip_cer_id => p_plip_cer_id,
4986 p_dml_operation => 'COPIED',
4987 p_pl_cer_id => p_out_pl_cer_id,
4988 p_pl_cer_ovn => l_pl_cer_ovn);
4989 hr_utility.set_location('plan row created for grade'||p_out_pl_cer_id,45);
4990 else
4991 hr_utility.set_location('pl cer is'||p_out_pl_cer_id,48);
4992 end if;
4993 else
4994 hr_utility.set_location('pl cer is updating with plip'||p_in_pl_cer_id,48);
4995 begin
4996 update ben_copy_entity_results
4997 set gs_mirror_src_entity_result_id = p_plip_cer_id,
4998 mirror_src_entity_result_id = p_plip_cer_id,
4999 information104 = ''
5000 where copy_entity_result_id = p_in_pl_cer_id;
5001 exception
5002 when others then
5003 hr_utility.set_location('pl cer is'||p_in_pl_cer_id,48);
5004 raise;
5005 end;
5006 end if;
5007 end if;
5008 if p_grade_id is not null then
5009 hr_utility.set_location('going for grade details update on plip ',49);
5010 grade_to_plip_stage(p_grade_id => p_grade_id,
5011 p_plip_cer_id => p_plip_cer_id,
5012 p_pl_cer_id => p_out_pl_cer_id,
5013 p_parent_cer_id => p_pgm_cer_id,
5014 p_mirror_ser_id => p_pgm_cer_id,
5015 p_effective_date => p_effective_date,
5016 p_business_area => p_business_area);
5017 hr_utility.set_location('plip updated with Grade ',50);
5018 hr_utility.set_location('going for grade components ',50);
5019 for i in csr_grd_scale loop
5020 -- copy the attached scale to stage
5021 l_grade_scale_id := i.parent_spine_id;
5022 populate_scale_hierarchy(p_copy_entity_txn_id => p_copy_entity_txn_id,
5023 p_effective_date => p_effective_date,
5024 p_business_group_id => p_business_group_id,
5025 p_scale_id => i.parent_spine_id,
5026 p_mode => 'BAREBONE',
5027 p_business_area => p_business_area,
5028 p_scale_cer_id => p_scale_cer_id);
5029 end loop;
5030 hr_utility.set_location('scale populated if any'||p_scale_cer_id,55);
5031 -- now plan and options are in staging area, we have to check whether oipl exists in stage
5032 -- or not corresponding to the step in HR
5033 if l_grade_scale_id is not null then
5034 for grd_step in csr_grd_steps loop
5035 hr_utility.set_location('point passed is '||grd_step.spinal_point_id,22);
5036 l_option_id := get_opt_for_point(p_point_id => grd_step.spinal_point_id,
5037 p_effective_date => p_effective_date);
5038 hr_utility.set_location('option is '||l_option_id,30);
5039 hr_utility.set_location('creating step of Grade '||grd_step.step_id,60);
5040 l_oipl_cer_id := is_step_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
5041 p_step_id => grd_step.step_id,
5042 p_option_id => l_option_id,
5043 p_pl_id => l_pl_id);
5044 if l_oipl_cer_id is null then
5045 hr_utility.set_location('step doesnot exist, create it',70);
5046 l_opt_cer_id := is_point_exists_in_txn
5047 (p_copy_entity_txn_id => p_copy_entity_txn_id,
5048 p_point_id => grd_step.spinal_point_id);
5049 hr_utility.set_location('opt cer is '||l_opt_cer_id,35);
5050 create_oipl_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
5051 p_effective_date => p_effective_date,
5052 p_business_group_id => p_business_group_id,
5053 p_grade_id => p_grade_id,
5054 p_plip_cer_id => p_plip_cer_id,
5055 p_point_id => grd_step.spinal_point_id,
5056 p_point_cer_id => l_opt_cer_id,
5057 p_scale_cer_id => p_scale_cer_id,
5058 p_option_id => l_option_id,
5059 p_dml_operation => 'COPIED',
5060 p_oipl_cer_id => l_oipl_cer_id);
5061 hr_utility.set_location('oipl row created'||l_oipl_cer_id,80);
5062 else
5063 hr_utility.set_location('oipl row exists'||l_oipl_cer_id,80);
5064 end if;
5065 end loop;
5066 else
5067 hr_utility.set_location('scale not there ',90);
5068 end if;
5069 else
5070 -- grade and components are all in staging
5071 hr_utility.set_location('grade in stage ',90);
5072 end if;
5073 post_pull_process(p_copy_entity_txn_id => p_copy_entity_txn_id,
5074 p_start_cer => l_start_cer,
5075 p_effective_date => p_effective_date,
5076 p_business_group_id => p_business_group_id,
5077 p_business_area => p_business_area);
5078 end populate_grd_hierarchy;
5079 procedure create_oipl_row(p_copy_entity_txn_id in number,
5080 p_effective_date in date,
5081 p_business_group_id in number,
5082 p_grade_id in number,
5083 p_plip_cer_id in number,
5084 p_point_id in number,
5085 p_point_cer_id in number,
5086 p_option_id in number,
5087 p_scale_cer_id in number,
5088 p_dml_operation in varchar2 default 'INSERT',
5089 p_oipl_cer_id out nocopy number) is
5090 l_cop_tr_id number;
5091 l_cop_tr_name varchar2(80);
5092 l_oipl_cer_ovn number;
5093 l_plip_cer_id number;
5094 l_point_name per_spinal_points.spinal_point%type;
5095 l_step_id number;
5096 l_step_ovn number;
5097 l_step_name number;
5098 l_grade_spine_id number;
5099 l_ceiling_flag varchar2(30);
5100 l_point_value number;
5101 l_scale_id number;
5102 begin
5103 get_table_route_details(p_table_alias => 'COP',
5104 p_table_route_id => l_cop_tr_id,
5105 p_table_name => l_cop_tr_name);
5106 get_step_all_details(p_point_id => p_point_id,
5107 p_grade_id => p_grade_id,
5108 p_effective_date => p_effective_date,
5109 p_option_id => p_option_id,
5110 p_point_name => l_point_name,
5111 p_step_name => l_step_name,
5112 p_step_id => l_step_id,
5113 p_step_ovn => l_step_ovn,
5114 p_grade_spine_id => l_grade_spine_id,
5115 p_ceiling_flag => l_ceiling_flag,
5116 p_point_value => l_point_value,
5117 p_scale_id => l_scale_id);
5118 begin
5119 ben_copy_entity_results_api.create_copy_entity_results(
5120 p_effective_date => p_effective_date
5121 ,p_copy_entity_txn_id => p_copy_entity_txn_id
5122 ,p_gs_parent_entity_result_id => p_plip_cer_id
5123 ,p_parent_entity_result_id => p_plip_cer_id
5124 ,p_result_type_cd => 'DISPLAY'
5125 ,p_table_name => l_cop_tr_name
5126 ,p_table_route_id => l_cop_tr_id
5127 ,p_table_alias => 'COP'
5128 ,p_dml_operation => p_dml_operation
5129 -- ,p_information1 => p_oipl_id -- new ben object
5130 ,p_information2 => p_effective_date
5131 ,p_information4 => p_business_group_id
5132 ,p_information253 => l_step_id
5133 ,p_information104 => 'LINK'
5134 ,p_information254 => l_step_ovn
5135 ,p_information255 => l_grade_spine_id
5136 ,p_information256 => p_point_id
5137 ,p_information98 => l_ceiling_flag
5138 ,p_information99 => l_point_name
5139 ,p_information262 => p_point_cer_id
5140 ,p_information263 => l_step_name
5141 ,p_information298 => l_point_value
5142 ,p_information259 => p_scale_cer_id
5143 ,p_information260 => l_scale_id
5144 ,p_copy_entity_result_id => p_oipl_cer_id
5145 ,p_object_version_number => l_oipl_cer_ovn);
5146 if l_ceiling_flag = 'Y' then
5147 update ben_copy_entity_results
5148 set information262 = p_oipl_cer_id,
5149 information259 = l_step_id
5150 where copy_entity_result_id = p_plip_cer_id;
5151 end if;
5152 exception
5153 when others then
5154 hr_utility.set_location('issue in creation oipl cer '||p_point_id,400);
5155 raise;
5156 end;
5157 exception
5158 when others then
5159 hr_utility.set_location('issue in oipl cer '||p_point_id,420);
5160 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
5161 (P_MASTER_TXN_ID => g_master_txn_id,
5162 P_TXN_ID => g_txn_id,
5163 p_context => 'create_oipl_row',
5164 P_MODULE_CD => 'PQH_GSP_BENSTG',
5165 P_MESSAGE_TYPE_CD => 'E',
5166 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
5167 p_effective_date => p_effective_date);
5168 raise;
5169 end create_oipl_row;
5170 procedure copy_pl_hierarchy(p_copy_entity_txn_id in number,
5171 p_pl_id in number,
5172 p_bg_id in number,
5173 p_effective_date in date,
5174 p_pl_cer_id out nocopy number,
5175 p_pl_cer_ovn out nocopy number) is
5176 l_pl_cer_id number;
5177 begin
5178 hr_utility.set_location('copying pl hier'||p_pl_id,10);
5179 ben_plan_design_plan_module.create_plan_result
5180 (p_copy_entity_result_id => l_pl_cer_id
5181 ,p_copy_entity_txn_id => p_copy_entity_txn_id
5182 ,p_pl_id => p_pl_id
5183 ,p_business_group_id => p_bg_id
5184 ,p_number_of_copies => 1
5185 ,p_object_version_number => p_pl_cer_ovn
5186 ,p_effective_date => p_effective_date
5187 ,p_no_dup_rslt => 'Y'
5188 );
5189 hr_utility.set_location('copied pl hier'||l_pl_cer_id,20);
5190 p_pl_cer_id := l_pl_cer_id;
5191 exception
5192 when others then
5193 hr_utility.set_location('issues in copying pl hier',25);
5194 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
5195 (P_MASTER_TXN_ID => g_master_txn_id,
5196 P_TXN_ID => g_txn_id,
5197 p_context => 'copy_pl_hierarchy',
5198 P_MODULE_CD => 'PQH_GSP_BENSTG',
5199 P_MESSAGE_TYPE_CD => 'E',
5200 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
5201 p_effective_date => p_effective_date);
5202 raise;
5203 end copy_pl_hierarchy;
5204 procedure populate_pl_hierarchy(p_copy_entity_txn_id in number,
5205 p_effective_date in date,
5206 p_business_group_id in number,
5207 p_plip_cer_id in number,
5208 p_pl_id in number,
5209 p_mode in varchar2 default 'COMPLETE',
5210 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST',
5211 p_pl_cer_id out nocopy number) is
5212 l_cer_ovn number;
5213 l_start_cer number;
5214 begin
5215 p_pl_cer_id := is_pl_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
5216 p_pl_id => p_pl_id);
5217 hr_utility.set_location('pl cer is'||p_pl_cer_id,10);
5218 if p_pl_cer_id is null then
5219 hr_utility.set_location('pl not in staging area, going for copy ',15);
5220 l_start_cer:= get_current_max_cer(p_copy_entity_txn_id );
5221 copy_pl_hierarchy(p_copy_entity_txn_id => p_copy_entity_txn_id,
5222 p_pl_id => p_pl_id,
5223 p_bg_id => p_business_group_id,
5224 p_effective_date => p_effective_date,
5225 p_pl_cer_id => p_pl_cer_id,
5226 p_pl_cer_ovn => l_cer_ovn);
5227 hr_utility.set_location('pl cer id is'||p_pl_cer_id,16);
5228 hr_utility.set_location('plip cer id is'||p_plip_cer_id,17);
5229 if p_pl_cer_id is not null then
5230 begin
5231 update ben_copy_entity_results
5232 set gs_mirror_src_entity_result_id = p_plip_cer_id,
5233 mirror_src_entity_result_id = p_plip_cer_id
5234 where copy_entity_result_id = p_pl_cer_id;
5235 exception
5236 when others then
5237 hr_utility.set_location('pl update had issues ',18);
5238 raise;
5239 end;
5240 hr_utility.set_location('changing parent to plip',19);
5241 change_parent_plip(p_copy_entity_txn_id => p_copy_entity_txn_id,
5242 p_plip_cer_id => p_plip_cer_id,
5243 p_pl_cer_id => p_pl_cer_id);
5244 hr_utility.set_location('parent plip done',20);
5245 else
5246 hr_utility.set_location('Issue in copy ',30);
5247 end if;
5248 if p_mode = 'COMPLETE' then
5249 post_pull_process(p_copy_entity_txn_id => p_copy_entity_txn_id,
5250 p_start_cer => l_start_cer,
5251 p_effective_date => p_effective_date,
5252 p_business_group_id => p_business_group_id,
5253 p_business_area => p_business_area);
5254 p_pl_cer_id := is_pl_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
5255 p_pl_id => p_pl_id);
5256 end if;
5257 if p_pl_cer_id is null then
5258 hr_utility.set_location('issues in copying plan',50);
5259 else
5260 hr_utility.set_location('pl cer is'||p_pl_cer_id,55);
5261 end if;
5262 else
5263 hr_utility.set_location('plan exists ',100);
5264 end if;
5265 end populate_pl_hierarchy;
5266 procedure populate_ep_hierarchy(p_copy_entity_txn_id in number,
5267 p_effective_date in date,
5268 p_business_group_id in number,
5269 p_ep_id in number,
5270 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST',
5271 p_ep_cer_id out nocopy number) is
5272 l_copy_entity_result_id number;
5273 l_cer_ovn number;
5274 l_start_cer number;
5275 l_parent_cer_id number;
5276 begin
5277 -- a elig-prof can be in system more than once, hence not having the check of existence
5278 PQH_GSP_PROCESS_LOG.START_LOG
5279 (P_TXN_ID => p_ep_id,
5280 P_TXN_NAME => 'ELP_id : '||p_ep_id,
5281 P_MODULE_CD => 'PQH_GSP_BENSTG');
5282 g_master_txn_id := p_ep_id;
5283 g_txn_id := p_ep_id;
5284 hr_utility.set_location('ep id is'||p_ep_id,10);
5285 l_start_cer:= get_current_max_cer(p_copy_entity_txn_id );
5286 begin
5287 ben_plan_design_elpro_module.create_elig_prfl_results
5288 (p_copy_entity_txn_id => p_copy_entity_txn_id
5289 ,p_mirror_src_entity_result_id => l_parent_cer_id
5290 ,p_parent_entity_result_id => l_parent_cer_id
5291 ,p_mndtry_flag => ''
5292 ,p_eligy_prfl_id => p_ep_id
5293 ,p_business_group_id => p_business_group_id
5294 ,p_number_of_copies => 1
5295 ,p_object_version_number => l_cer_ovn
5296 ,p_effective_date => p_effective_date
5297 );
5298 hr_utility.set_location('copied ep hier',20);
5299
5300 BEN_PDW_COPY_BEN_TO_STG.populate_extra_mapping_ELP(
5301 p_copy_entity_txn_id => p_copy_entity_txn_id,
5302 p_effective_date => p_effective_date,
5303 p_elig_prfl_id =>p_ep_id
5304 );
5305 hr_utility.set_location('Done with the mapping',25);
5306 /*
5307 exception
5308 when others then
5309 hr_utility.set_location('issues in copying ep hier',25);
5310 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
5311 (P_MASTER_TXN_ID => g_master_txn_id,
5312 P_TXN_ID => g_txn_id,
5313 p_context => 'copy_ep_hierarchy',
5314 P_MODULE_CD => 'PQH_GSP_BENSTG',
5315 P_MESSAGE_TYPE_CD => 'E',
5316 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
5317 p_effective_date => p_effective_date);
5318 raise;
5319 */
5320 end;
5321
5322 p_ep_cer_id := is_ep_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
5323 p_start_cer => l_start_cer,
5324 p_ep_id => p_ep_id);
5325
5326 post_pull_process(p_copy_entity_txn_id => p_copy_entity_txn_id,
5327 p_start_cer => l_start_cer,
5328 p_effective_date => p_effective_date,
5329 p_business_group_id => p_business_group_id,
5330 p_business_area => p_business_area);
5331
5332 if p_ep_cer_id is null then
5333 hr_utility.set_location('issues in copying ep',50);
5334 else
5335 hr_utility.set_location('ep cer is'||p_ep_cer_id,55);
5336 end if;
5337
5338 -- For elp/child_records which have future records , pdw needs the
5339 -- attribute FUTURE_DATA_EXISTS properly set so that they can properly
5340 -- set the datetrack_mode and dml_operation
5341 -- The following code is copied from BEN_PDW_COPY_BEN_TO_STG.mark_future_data_exists
5342
5343 update ben_copy_entity_results a
5344 set future_data_exists ='Y'
5345 where a.copy_entity_txn_id = p_copy_entity_txn_id
5346 and a.future_data_exists is null
5347 and a.information3 < to_date('4712/12/31','YYYY/MM/DD')
5348 and exists
5349 ( select 'Y' from ben_copy_entity_results b
5350 where b.copy_entity_txn_id = a.copy_entity_txn_id
5351 and b.table_alias = a.table_alias
5352 and b.information1 = a.information1
5353 and b.information2 = a.information3+1);
5354 hr_utility.set_location('Updated bcer records for future_data_exists flag',25);
5355
5356 end populate_ep_hierarchy;
5357
5358 procedure create_plan_row(p_copy_entity_txn_id in number,
5359 p_effective_date in date,
5360 p_business_group_id in number,
5361 p_grade_id in number,
5362 p_plip_cer_id in number,
5363 p_dml_operation in varchar2 default 'INSERT',
5364 p_pl_cer_id out nocopy number,
5365 p_pl_cer_ovn out nocopy number) is
5366 l_pln_tr_id number;
5367 l_pln_tr_name varchar2(80);
5368 l_date_from date;
5369 l_date_to date;
5370 l_short_name per_grades.short_name%type;
5371 l_grade_name per_grades.name%type;
5372 l_grade_definition_id number;
5373 l_grd_ovn number;
5374 begin
5375 get_table_route_details(p_table_alias => 'PLN',
5376 p_table_route_id => l_pln_tr_id,
5377 p_table_name => l_pln_tr_name);
5378 if p_grade_id is not null then
5379 get_grade_details(p_grade_id => p_grade_id,
5380 p_date_from => l_date_from,
5381 p_date_to => l_date_to,
5382 p_short_name => l_short_name,
5383 p_grade_name => l_grade_name,
5384 p_grd_ovn => l_grd_ovn,
5385 p_grade_definition_id => l_grade_definition_id);
5386 end if;
5387 begin
5388 ben_copy_entity_results_api.create_copy_entity_results(
5389 p_effective_date => p_effective_date
5390 ,p_copy_entity_txn_id => p_copy_entity_txn_id
5391 ,p_gs_mr_src_entity_result_id => p_plip_cer_id
5392 ,p_mirror_src_entity_result_id => p_plip_cer_id
5393 ,p_result_type_cd => 'DISPLAY'
5394 ,p_table_name => l_pln_tr_name
5395 ,p_table_route_id => l_pln_tr_id
5396 ,p_table_alias => 'PLN'
5397 ,p_dml_operation => p_dml_operation
5398 ,p_information2 => p_effective_date
5399 ,p_information4 => p_business_group_id
5400 ,p_information5 => l_grade_name
5401 ,p_information170 => l_grade_name
5402 ,p_information221 => l_grade_definition_id
5403 ,p_information307 => l_date_from
5404 ,p_information308 => l_date_to
5405 ,p_information222 => l_grd_ovn
5406 ,p_information223 => p_grade_id
5407 ,p_information141 => 'PER_GRADES'
5408 ,p_information294 => p_grade_id
5409 ,p_information102 => l_short_name
5410 ,p_copy_entity_result_id => p_pl_cer_id
5411 ,p_object_version_number => p_pl_cer_ovn);
5412 exception
5413 when others then
5414 hr_utility.set_location('issue in creation pln cer '||p_grade_id,400);
5415 raise;
5416 end;
5417 exception
5418 when others then
5419 hr_utility.set_location('issue in pln cer '||p_grade_id,420);
5420 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
5421 (P_MASTER_TXN_ID => g_master_txn_id,
5422 P_TXN_ID => g_txn_id,
5423 p_context => 'create_plan_row',
5424 P_MODULE_CD => 'PQH_GSP_BENSTG',
5425 P_MESSAGE_TYPE_CD => 'E',
5426 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
5427 p_effective_date => p_effective_date);
5428 raise;
5429 end create_plan_row;
5430 procedure create_option_row(p_copy_entity_txn_id in number,
5431 p_effective_date in date,
5432 p_business_group_id in number,
5433 p_scale_id in number,
5434 p_scale_cer_id in number,
5435 p_point_id in number,
5436 p_dml_operation in varchar2 default 'INSERT',
5437 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST',
5438 p_opt_cer_id out nocopy number,
5439 p_opt_cer_ovn out nocopy number) is
5440 l_opt_tr_id number;
5441 l_opt_tr_name varchar2(80);
5442 l_scale_id number;
5443 l_point_seq number;
5444 l_point_ovn number;
5445 l_spinal_point per_spinal_points.spinal_point%type;
5446 l_information_category varchar2(30);
5447 l_information1 varchar2(150);
5448 l_information2 varchar2(150);
5449 l_information3 varchar2(150);
5450 l_information4 varchar2(150);
5451 l_information5 varchar2(150);
5452 begin
5453 get_table_route_details(p_table_alias => 'OPT',
5454 p_table_route_id => l_opt_tr_id,
5455 p_table_name => l_opt_tr_name);
5456 if p_point_id is not null then
5457 get_point_details(p_point_id => p_point_id,
5458 p_scale_id => l_scale_id,
5459 p_point_seq => l_point_seq,
5460 p_point_ovn => l_point_ovn,
5461 p_spinal_point => l_spinal_point);
5462 if p_business_area = 'PQH_CORPS_TASK_LIST' then
5463 pqh_cpd_hr_to_stage.get_point_details(p_point_id => p_point_id,
5464 p_information_category => l_information_category,
5465 p_information1 => l_information1,
5466 p_information2 => l_information2,
5467 p_information3 => l_information3,
5468 p_information4 => l_information4,
5469 p_information5 => l_information5);
5470 end if;
5471 end if;
5472 begin
5473 ben_copy_entity_results_api.create_copy_entity_results(
5474 p_effective_date => p_effective_date
5475 ,p_copy_entity_txn_id => p_copy_entity_txn_id
5476 ,p_result_type_cd => 'DISPLAY'
5477 ,p_table_name => l_opt_tr_name
5478 ,p_table_route_id => l_opt_tr_id
5479 ,p_table_alias => 'OPT'
5480 ,p_dml_operation => p_dml_operation
5481 -- ,p_information1 => p_option_id -- new ben object
5482 ,p_information2 => p_effective_date
5483 ,p_information4 => p_business_group_id
5484 ,p_information5 => l_spinal_point
5485 ,p_information98 => l_spinal_point
5486 ,p_information253 => l_point_seq
5487 ,p_information254 => l_point_ovn
5488 ,p_information255 => l_scale_id
5489 ,p_information256 => p_scale_cer_id
5490 ,p_information257 => p_point_id
5491 ,p_information141 => 'PER_SPINAL_POINTS'
5492 ,p_information173 => l_information1
5493 ,p_information175 => l_information2
5494 ,p_information179 => l_information3
5495 ,p_information181 => l_information4
5496 ,p_information182 => l_information5
5497 ,p_information101 => l_information_category
5498 ,p_copy_entity_result_id => p_opt_cer_id
5499 ,p_object_version_number => p_opt_cer_ovn);
5500 exception
5501 when others then
5502 hr_utility.set_location('issue in creation opt cer '||p_point_id,400);
5503 raise;
5504 end;
5505 if p_business_area = 'PQH_CORPS_TASK_LIST' then
5506 pqh_gsp_utility.update_frps_point_rate(p_point_cer_id => p_opt_cer_id,
5507 p_copy_entity_txn_id => p_copy_entity_txn_id,
5508 p_business_group_id => p_business_group_id,
5509 p_salary_rate => l_information2,
5510 p_gross_index => l_information1,
5511 p_effective_date => p_effective_date);
5512 end if;
5513 exception
5514 when others then
5515 hr_utility.set_location('issue in opt cer '||p_point_id,420);
5516 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
5517 (P_MASTER_TXN_ID => g_master_txn_id,
5518 P_TXN_ID => g_txn_id,
5519 p_context => 'create_opt_row',
5520 P_MODULE_CD => 'PQH_GSP_BENSTG',
5521 P_MESSAGE_TYPE_CD => 'E',
5522 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
5523 p_effective_date => p_effective_date);
5524 raise;
5525 end create_option_row;
5526 procedure populate_scale_hierarchy(p_copy_entity_txn_id in number,
5527 p_effective_date in date,
5528 p_business_group_id in number,
5529 p_scale_id in number,
5530 p_mode in varchar2 default 'COMPLETE',
5531 p_business_area in varchar2 default 'PQH_GSP_TASK_LIST',
5532 p_scale_cer_id out nocopy number) is
5533 l_cer_ovn number;
5534 l_option_id number;
5535 l_opt_cer_id number;
5536 l_parent_opt_cer_id number;
5537 l_start_cer number;
5538 --bug 6277443 changing the cursor to improve performance
5539
5540 cursor csr_scale_points is
5541 select spinal_point_id
5542 from per_spinal_points
5543 where parent_spine_id = p_scale_id
5544 and not exists (select 1 from
5545 ben_copy_entity_results
5546 where copy_entity_txn_id = p_copy_entity_txn_id
5547 and table_alias ='OPT'
5548 and information257 = spinal_point_id) ;
5549 --bug 6277443
5550 begin
5551 if p_scale_id is not null then
5552 l_start_cer:= get_current_max_cer(p_copy_entity_txn_id );
5553 -- create scale if it doesnot exist in staging area.
5554 p_scale_cer_id := is_scale_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
5555 p_scale_id => p_scale_id);
5556 If g_txn_id is NULL Then
5557 PQH_GSP_PROCESS_LOG.START_LOG
5558 (P_TXN_ID => P_Scale_id,
5559 P_TXN_NAME => 'SCALE',
5560 P_MODULE_CD => 'PQH_GSP_BENSTG');
5561 g_master_txn_id := P_Scale_id;
5562 g_txn_id := P_Scale_id;
5563 End If;
5564 if p_scale_cer_id is null then
5565 hr_utility.set_location('scale not in stage,copy it',10);
5566 scale_to_stage(p_scale_id => p_scale_id,
5567 p_business_group_id => p_business_group_id,
5568 p_business_area => p_business_area,
5569 p_copy_entity_txn_id => p_copy_entity_txn_id,
5570 p_effective_date => p_effective_date,
5571 p_scale_cer_id => p_scale_cer_id);
5572 else
5573 hr_utility.set_location('scale is already in staging area ',15);
5574 end if;
5575 for i in csr_scale_points loop
5576 begin
5577 hr_utility.set_location('point passed is '||i.spinal_point_id,22);
5578 l_option_id := get_opt_for_point(p_point_id => i.spinal_point_id,
5579 p_effective_date => p_effective_date);
5580 hr_utility.set_location('option is '||l_option_id,30);
5581 l_opt_cer_id := is_point_exists_in_txn
5582 (p_copy_entity_txn_id => p_copy_entity_txn_id,
5583 p_point_id => i.spinal_point_id);
5584 if l_opt_cer_id is null and l_option_id is not null then
5585 hr_utility.set_location('opt is linked to point but doesnot exist in txn',37);
5586 begin
5587 hr_utility.set_location('calling opt hier copy ',38);
5588 ben_plan_design_plan_module.create_opt_result
5589 (p_copy_entity_result_id => l_opt_cer_id
5590 ,p_copy_entity_txn_id => p_copy_entity_txn_id
5591 ,p_opt_id => l_option_id
5592 ,p_business_group_id => p_business_group_id
5593 ,p_number_of_copies => 1
5594 ,p_object_version_number => l_cer_ovn
5595 ,p_effective_date => p_effective_date
5596 ,p_parent_entity_result_id => l_parent_opt_cer_id
5597 );
5598 hr_utility.set_location('opt hier copy done',39);
5599 exception
5600 when others then
5601 hr_utility.set_location('issues in copying opt hier',40);
5602 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
5603 (P_MASTER_TXN_ID => g_master_txn_id,
5604 P_TXN_ID => g_txn_id,
5605 p_context => 'populate_scale_hierarchy',
5606 P_MODULE_CD => 'PQH_GSP_BENSTG',
5607 P_MESSAGE_TYPE_CD => 'E',
5608 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
5609 p_effective_date => p_effective_date);
5610 raise;
5611 end;
5612 elsif l_option_id is null and l_opt_cer_id is null then
5613 hr_utility.set_location('point is not mapped,create option row ',25);
5614 create_option_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
5615 p_effective_date => p_effective_date,
5616 p_business_group_id => p_business_group_id,
5617 p_scale_id => p_scale_id,
5618 p_scale_cer_id => p_scale_cer_id,
5619 p_point_id => i.spinal_point_id,
5620 p_opt_cer_id => l_opt_cer_id,
5621 p_dml_operation => 'COPIED',
5622 p_business_area => p_business_area,
5623 p_opt_cer_ovn => l_cer_ovn);
5624 hr_utility.set_location('option created '||l_opt_cer_id,35);
5625 else
5626 hr_utility.set_location('option exists in staging '||l_opt_cer_id,35);
5627 end if;
5628 exception
5629 when others then
5630 hr_utility.set_location('issues in getting opt ',25);
5631 PQH_GSP_PROCESS_LOG.LOG_PROCESS_DTLS
5632 (P_MASTER_TXN_ID => g_master_txn_id,
5633 P_TXN_ID => g_txn_id,
5634 p_context => 'populate_scale_hierarchy',
5635 P_MODULE_CD => 'PQH_GSP_BENSTG',
5636 P_MESSAGE_TYPE_CD => 'E',
5637 P_MESSAGE_TEXT => Nvl(fnd_Message.Get,sqlerrm),
5638 p_effective_date => p_effective_date);
5639 raise;
5640 end;
5641 end loop;
5642 if p_mode = 'COMPLETE' then
5643 post_pull_process(p_copy_entity_txn_id => p_copy_entity_txn_id,
5644 p_start_cer => l_start_cer,
5645 p_effective_date => p_effective_date,
5646 p_business_group_id => p_business_group_id,
5647 p_business_area => p_business_area);
5648 end if;
5649 else
5650 hr_utility.set_location('scale id passed is null',25);
5651 end if;
5652 end populate_scale_hierarchy;
5653 procedure pull_payrate(p_copy_entity_txn_id in number,
5654 p_payrate_id in number,
5655 p_effective_date in date) is
5656 cursor csr_grd_rt is
5657 select * from pay_grade_rules_f
5658 where rate_id = p_payrate_id
5659 and p_effective_date between effective_start_date and effective_end_date;
5660 l_hrr_cer_id number;
5661 l_abr_cer_id number;
5662 l_opt_cer_id number;
5663 l_pl_cer_id number;
5664 l_grade_id number;
5665 l_point_id number;
5666 l_sot date ;
5667 l_grd_st_dt date;
5668 begin
5669 -- start the process_log for rate pull
5670 If g_txn_id is NULL Then
5671 PQH_GSP_PROCESS_LOG.START_LOG
5672 (P_TXN_ID => p_payrate_id,
5673 P_TXN_NAME => 'pull_pay_rate',
5674 P_MODULE_CD => 'PQH_GSP_BENSTG');
5675 g_master_txn_id := P_payrate_id;
5676 g_txn_id := P_payrate_id;
5677 End If;
5678 -- get the child rows corresponding to the pay rate.
5679 -- if the pay rate is Grade then we may have to create rows for ABR/ HRRATE for plan
5680 -- in case of scale, it will be for the point associated.
5681 -- if new rates are created then plip and oipl rows should be updated to show standard rate
5682 for grd_rt in csr_grd_rt loop
5683 l_sot := pqh_gsp_utility.get_gsp_plntyp_str_date(grd_rt.business_group_id,p_copy_entity_txn_id);
5684 if grd_rt.rate_type = 'G' then
5685 l_grade_id := grd_rt.grade_or_spinal_point_id;
5686 hr_utility.set_location('grade id is '||l_grade_id,13);
5687 -- check grade is part of grade ladder or not
5688 -- if rate is not defined then we create abr and hrrate rows.
5689 l_pl_cer_id := is_grd_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
5690 p_grd_id => l_grade_id);
5691 if l_pl_cer_id is not null then
5692 hr_utility.set_location('pl_cer_id id is '||l_pl_cer_id,14);
5693 l_hrr_cer_id := is_hrr_exists(p_copy_entity_txn_id => p_copy_entity_txn_id,
5694 p_grade_cer_id => l_pl_cer_id,
5695 p_hrr_esd => p_effective_date);
5696 if l_hrr_cer_id is not null then
5697 hr_utility.set_location('rate for grade exists',12);
5698 else
5699 hr_utility.set_location('rate for grade doesnot exist, have to create',12);
5700 l_grd_st_dt := get_grd_start_date(p_grade_cer_id => l_pl_cer_id);
5701 hr_utility.set_location('grd_st_dt is '||to_char(l_grd_st_dt,'DD/MM/RRRR'),12);
5702 create_abr_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
5703 p_start_date => l_grd_st_dt,
5704 p_pl_cer_id => l_pl_cer_id,
5705 p_business_group_id => grd_rt.business_group_id,
5706 p_effective_date => p_effective_date,
5707 p_abr_cer_id => l_abr_cer_id,
5708 p_create_hrr => 'N',
5709 p_dml_oper => 'INSERT');
5710 hr_utility.set_location('abr_cer_id is '||l_abr_cer_id,16);
5711 create_hrrate_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
5712 p_effective_date => p_effective_date,
5713 p_start_date => l_grd_st_dt,
5714 p_business_group_id => grd_rt.business_group_id,
5715 p_abr_cer_id => l_abr_cer_id,
5716 p_grade_cer_id => l_pl_cer_id,
5717 p_grd_value => grd_rt.value,
5718 p_grd_min_value => grd_rt.minimum,
5719 p_grd_mid_value => grd_rt.mid_value,
5720 p_grd_max_value => grd_rt.maximum,
5721 p_dml_oper => 'INSERT',
5722 p_hrrate_cer_id => l_hrr_cer_id);
5723 hr_utility.set_location('hrr_cer_id is '||l_hrr_cer_id,17);
5724 end if;
5725 else
5726 hr_utility.set_location('grade is not in GL',11);
5727 end if;
5728 elsif grd_rt.rate_type = 'SP' then
5729 l_point_id := grd_rt.grade_or_spinal_point_id;
5730 hr_utility.set_location('point id is '||l_point_id,13);
5731 -- check point is part of grade ladder or not
5732 -- if rate is not defined then we create abr and hrrate rows.
5733 l_opt_cer_id := is_point_exists_in_txn(p_copy_entity_txn_id => p_copy_entity_txn_id,
5734 p_point_id => l_point_id);
5735 if l_opt_cer_id is not null then
5736 hr_utility.set_location('pl_cer_id id is '||l_pl_cer_id,14);
5737 l_hrr_cer_id := is_hrr_exists(p_copy_entity_txn_id => p_copy_entity_txn_id,
5738 p_point_cer_id => l_opt_cer_id,
5739 p_hrr_esd => p_effective_date);
5740 if l_hrr_cer_id is not null then
5741 hr_utility.set_location('rate for point exists',12);
5742 else
5743 hr_utility.set_location('rate for point doesnot exist, have to create',12);
5744 create_abr_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
5745 p_start_date => l_sot,
5746 p_opt_cer_id => l_opt_cer_id,
5747 p_business_group_id => grd_rt.business_group_id,
5748 p_effective_date => p_effective_date,
5749 p_abr_cer_id => l_abr_cer_id,
5750 p_create_hrr => 'N',
5751 p_dml_oper => 'INSERT');
5752 hr_utility.set_location('abr_cer_id is '||l_abr_cer_id,16);
5753 create_hrrate_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
5754 p_effective_date => p_effective_date,
5755 p_start_date => l_sot,
5756 p_business_group_id => grd_rt.business_group_id,
5757 p_abr_cer_id => l_abr_cer_id,
5758 p_point_cer_id => l_opt_cer_id,
5759 p_point_value => grd_rt.value,
5760 p_dml_oper => 'INSERT',
5761 p_hrrate_cer_id => l_hrr_cer_id);
5762 hr_utility.set_location('hrr_cer_id is '||l_hrr_cer_id,17);
5763 end if;
5764 else
5765 hr_utility.set_location('grade is not in GL',11);
5766 end if;
5767 else
5768 hr_utility.set_location('invalid rate type'||grd_rt.rate_type,10);
5769 end if;
5770 end loop;
5771 PQH_PROCESS_BATCH_LOG.END_LOG;
5772 end pull_payrate;
5773 procedure create_frps_point_rate(p_point_cer_id in number,
5774 p_copy_entity_txn_id in number,
5775 p_business_group_id in number,
5776 p_point_value in number,
5777 p_effective_date in date) is
5778 l_sot date := pqh_gsp_utility.get_gsp_plntyp_str_date(p_business_group_id,p_copy_entity_txn_id);
5779 l_abr_cer_id number;
5780 l_hrr_cer_id number;
5781 begin
5782 if p_point_cer_id is not null then
5783 create_abr_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
5784 p_start_date => l_sot,
5785 p_opt_cer_id => p_point_cer_id,
5786 p_business_group_id => p_business_group_id,
5787 p_effective_date => p_effective_date,
5788 p_abr_cer_id => l_abr_cer_id,
5789 p_create_hrr => 'N',
5790 p_dml_oper => 'INSERT');
5791 hr_utility.set_location('abr_cer_id is '||l_abr_cer_id,16);
5792 create_hrrate_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
5793 p_effective_date => p_effective_date,
5794 p_start_date => l_sot,
5795 p_business_group_id => p_business_group_id,
5796 p_abr_cer_id => l_abr_cer_id,
5797 p_point_cer_id => p_point_cer_id,
5798 p_point_value => p_point_value,
5799 p_dml_oper => 'INSERT',
5800 p_hrrate_cer_id => l_hrr_cer_id);
5801 hr_utility.set_location('hrr_cer_id is '||l_hrr_cer_id,17);
5802 end if;
5803 end create_frps_point_rate;
5804 procedure update_frps_point_rate(p_point_cer_id in number,
5805 p_copy_entity_txn_id in number,
5806 p_business_group_id in number,
5807 p_point_value in number,
5808 p_effective_date in date) is
5809 l_hrr_cer_id number;
5810 begin
5811 l_hrr_cer_id := is_hrr_exists(p_copy_entity_txn_id => p_copy_entity_txn_id,
5812 p_point_cer_id => p_point_cer_id,
5813 p_hrr_esd => p_effective_date);
5814 if l_hrr_cer_id is null then
5815 create_frps_point_rate(p_point_cer_id => p_point_cer_id,
5816 p_copy_entity_txn_id => p_copy_entity_txn_id,
5817 p_business_group_id => p_business_group_id,
5818 p_point_value => p_point_value,
5819 p_effective_date => p_effective_date);
5820 else
5821 pqh_gsp_rates.update_point_hrrate(p_copy_entity_txn_id => p_copy_entity_txn_id,
5822 p_rt_effective_date => p_effective_date,
5823 p_gl_effective_date => p_effective_date,
5824 p_business_group_id => p_business_group_id,
5825 p_hrrate_cer_id => l_hrr_cer_id,
5826 p_point_cer_id => p_point_cer_id,
5827 p_point_value => p_point_value,
5828 p_datetrack_mode => 'UPDATE_REPLACE');
5829 end if;
5830 end update_frps_point_rate;
5831 procedure create_payrate(p_copy_entity_txn_id in number,
5832 p_effective_date in date,
5833 p_business_group_id in number) is
5834
5835 Cursor csr_pgm_details
5836 is
5837 select information70 calc_method,information51 prog_style
5838 from ben_copy_entity_results
5839 where copy_entity_txn_id = p_copy_entity_txn_id
5840 and table_alias = 'PGM'
5841 and result_type_cd = 'DISPLAY';
5842
5843 Cursor csr_grd_details
5844 is
5845 select copy_entity_result_id
5846 from ben_copy_entity_results
5847 where copy_entity_txn_id = p_copy_entity_txn_id
5848 AND table_alias = 'PLN'
5849 AND result_type_cd ='DISPLAY';
5850
5851 Cursor csr_opt_details
5852 is
5853 select copy_entity_result_id
5854 from ben_copy_entity_results
5855 where copy_entity_txn_id = p_copy_entity_txn_id
5856 AND table_alias = 'OPT';
5857
5858 l_calc_method varchar2(240);
5859 l_prog_style varchar2(240);
5860
5861
5862 l_grade_cer_id number;
5863 l_point_cer_id number;
5864
5865
5866
5867
5868 l_hrr_cer_id number;
5869 l_abr_cer_id number;
5870 l_opt_cer_id number;
5871 l_grade_id number;
5872 l_point_id number;
5873 l_sot date := pqh_gsp_utility.get_gsp_plntyp_str_date(p_business_group_id,p_copy_entity_txn_id);
5874 l_grd_st_dt date;
5875 begin
5876
5877 OPEN csr_pgm_details;
5878 FETCH csr_pgm_details into l_calc_method,l_prog_style;
5879 CLOSE csr_pgm_details;
5880
5881 IF l_calc_method = 'RULE' THEN
5882 IF l_prog_style = 'PQH_GSP_GP' THEN
5883 for i in csr_grd_details loop
5884 l_grade_cer_id := i.copy_entity_result_id;
5885 if l_grade_cer_id is not null then
5886 hr_utility.set_location('grd_cer_id id is '||l_grade_cer_id,14);
5887 l_hrr_cer_id := is_hrr_exists(p_copy_entity_txn_id => p_copy_entity_txn_id,
5888 p_grade_cer_id => l_grade_cer_id,
5889 p_hrr_esd => p_effective_date);
5890 if l_hrr_cer_id is not null then
5891 hr_utility.set_location('rate for grade exists',12);
5892 else
5893 hr_utility.set_location('rate for grade doesnot exist, have to create',12);
5894 l_grd_st_dt := get_grd_start_date(p_grade_cer_id => l_grade_cer_id);
5895 hr_utility.set_location('grd_st_dt is '||to_char(l_grd_st_dt,'DD/MM/RRRR'),12);
5896 create_abr_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
5897 p_start_date => l_grd_st_dt,
5898 p_pl_cer_id => l_grade_cer_id,
5899 p_business_group_id => p_business_group_id ,
5900 p_effective_date => p_effective_date,
5901 p_abr_cer_id => l_abr_cer_id,
5902 p_create_hrr => 'N',
5903 p_dml_oper => 'INSERT');
5904 hr_utility.set_location('abr_cer_id is '||l_abr_cer_id,16);
5905 create_hrrate_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
5906 p_effective_date => p_effective_date,
5907 p_start_date => l_grd_st_dt,
5908 p_business_group_id => p_business_group_id,
5909 p_abr_cer_id => l_abr_cer_id,
5910 p_grade_cer_id => l_grade_cer_id,
5911 p_grd_value => 0,
5912 p_grd_min_value => 0,
5913 p_grd_mid_value => 0,
5914 p_grd_max_value => 0,
5915 p_dml_oper => 'INSERT',
5916 p_hrrate_cer_id => l_hrr_cer_id);
5917 hr_utility.set_location('hrr_cer_id is '||l_hrr_cer_id,17);
5918 end if;
5919 else
5920 hr_utility.set_location('grade is not in GL',11);
5921 end if;
5922 end loop;
5923 ELSE
5924 for i in csr_opt_details loop
5925 l_opt_cer_id := i.copy_entity_result_id;
5926 hr_utility.set_location('opt_cer_id id is '||l_opt_cer_id,14);
5927 l_hrr_cer_id := is_hrr_exists(p_copy_entity_txn_id => p_copy_entity_txn_id,
5928 p_point_cer_id => l_opt_cer_id,
5929 p_hrr_esd => p_effective_date);
5930 if l_hrr_cer_id is not null then
5931 hr_utility.set_location('rate for point exists',12);
5932 else
5933 hr_utility.set_location('rate for point doesnot exist, have to create',12);
5934 create_abr_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
5935 p_start_date => l_sot,
5936 p_opt_cer_id => l_opt_cer_id,
5937 p_business_group_id => p_business_group_id,
5938 p_effective_date => p_effective_date,
5939 p_abr_cer_id => l_abr_cer_id,
5940 p_create_hrr => 'N',
5941 p_dml_oper => 'INSERT');
5942 hr_utility.set_location('abr_cer_id is '||l_abr_cer_id,16);
5943 create_hrrate_row(p_copy_entity_txn_id => p_copy_entity_txn_id,
5944 p_effective_date => p_effective_date,
5945 p_start_date => l_sot,
5946 p_business_group_id => p_business_group_id,
5947 p_abr_cer_id => l_abr_cer_id,
5948 p_point_cer_id => l_opt_cer_id,
5949 p_point_value => 0,
5950 p_dml_oper => 'INSERT',
5951 p_hrrate_cer_id => l_hrr_cer_id);
5952 hr_utility.set_location('hrr_cer_id is '||l_hrr_cer_id,17);
5953 end if;
5954 end loop;
5955 END IF;
5956 END IF;
5957 end create_payrate;
5958 function get_plip_for_pgm_plan(p_pgm_id in number,
5959 p_plan_id in number,
5960 p_effective_date in date
5961 ) return number is
5962 l_plip_id number;
5963 begin
5964 begin
5965 select plip_id
5966 into l_plip_id
5967 from ben_plip_f
5968 where pgm_id = p_pgm_id
5969 and pl_id = p_plan_id
5970 and p_effective_date between effective_start_date and effective_end_date;
5971 hr_utility.set_location('plip is '||l_plip_id,10);
5972 exception
5973 when no_data_found then
5974 hr_utility.set_location('plip does not exist '||l_plip_id,10);
5975 when others then
5976 hr_utility.set_location('issues in selected plip',20);
5977 raise;
5978 end;
5979 return l_plip_id;
5980 end get_plip_for_pgm_plan;
5981 end pqh_gsp_hr_to_stage;