[Home] [Help]
PACKAGE BODY: APPS.BEN_ENROLLMENT_PROCESS
Source
1 package body ben_enrollment_process as
2 /* $Header: benenrol.pkb 120.18 2006/12/29 08:29:06 nkkrishn noship $ */
3 --------------------------------------------------------------------------------
4 /*
5 +==============================================================================+
6 | Copyright (c) 1998 Oracle Corporation |
7 | Redwood Shores, California, USA |
8 | All rights reserved. |
9 +==============================================================================+
10 --
11 Name
12 Enrollment Process
13 Purpose
14 This is a wrapper procedure for Benefits enrollments,
15 dependents and beneficiaries designation for Enrollments conversion,
16 ongoing mass updates and IVR Process.
17 History
18 Date Who Version What?
19 ---- --- ------- -----
20 01 Nov 05 ikasire 115.0 Created
21 31 Jan 06 ikasired 115.1 Added more validations
22 07 Feb 06 ikasired 115.2 More validations
23 21 Feb 06 ikasired 115.3 GSCC Errors
24 01 Mar 06 ikasired 115.4 Fix for c_epe cursors to
25 for plans in multiple programs
26 16 Mar 06 ikasired 115.6 Bug 5099945 fixes
27 17 Mar 06 ikasired 115.7 Bug 5100373 fix
28 21 Mar 06 ikasired 115.8 Bug 5108304 Added validation for
29 benefit amounts
30 Bug 5099864 Dependents validation fix
31 22 Mar 06 ikasired 115.9 Bug 5111326 fixes - more validations
32 23 Mar 06 ikasired 115.10 Bug 5097635 fix for beneficiary action
33 items
34 13 Apr 06 nkkrishn 115.11 Summary row elimination changes
35 02 May 06 nkkrishn 115.12 Fixed Beneficiary upload
36 10 May 06 nkkrishn 115.13 Beneficiary upload, suspend
37 enrollment problem fixed
38 10 May 06 nkkrishn 115.14 passing benefit amount param
39 to create_plan_beneficiary
40 12 Jun 06 ikasired 115.15 If condition got removed for the
41 call to ben_env_object.init
42 Bug 5259118
43 12 Jun 06 ikasired 115.16 Bug 5305426 to populate the proper
44 designation coverage start date
45 22 Nov 06 nkkrishn 115.18 Bug 5675220 - end dependant
46 designation not showing up
47 in PUI
48 07 Dec 06 nkkrishn 115.19 Bug 5675220 - end dependant
49 designation not showing up
50 in PUI.Using ben_prtt_enrt_result_api.
51 calc_dpnt_cvg_dt to calculate both
52 coverage start and end date for
53 dependants
54 29 Dec 06 nkkrishn 115.20 ENH - End Enrollment. (5738940)
55 */
56 --
57 --Globals
58 --
59 g_debug boolean := hr_utility.debug_enabled;
60 --
61 cursor c_pil(p_ler_id number,
62 p_life_event_date date,
63 p_person_id number) is
64 select pil.per_in_ler_id
65 from ben_per_in_ler pil
66 where pil.ler_id = p_ler_id
67 and pil.lf_evt_ocrd_dt = p_life_event_date
68 and pil.person_id = p_person_id
69 and pil.per_in_ler_stat_cd = 'STRTD' ;
70 --
71 cursor c_epe_oipl(p_per_in_ler_id number,
72 p_pl_id number,
73 p_opt_id number,
74 p_life_event_date date,
75 p_pgm_id number ) is
76 select epe.elig_per_elctbl_chc_id,
77 epe.enrt_cvg_strt_dt,
78 epe.enrt_cvg_strt_dt_cd,
79 epe.prtt_enrt_rslt_id,
80 epe.oipl_id,
81 epe.dpnt_cvg_strt_dt_cd,
82 epe.dpnt_cvg_strt_dt_rl,
83 epe.pgm_id,
84 epe.pl_id,
85 epe.ptip_id
86 from ben_elig_per_elctbl_chc epe,
87 ben_oipl_f oipl
88 where epe.per_in_ler_id = p_per_in_ler_id
89 and epe.pl_id = p_pl_id
90 and epe.oipl_id = oipl.oipl_id
91 and epe.elctbl_flag = 'Y'
92 and oipl.opt_id = p_opt_id
93 and (epe.pgm_id = p_pgm_id OR p_pgm_id IS NULL)
94 and p_life_event_date between oipl.effective_start_date
95 and oipl.effective_end_date ;
96 --
97 --Get EPE from Plan
98 cursor c_epe_pl(p_per_in_ler_id number,
99 p_pl_id number,
100 p_pgm_id number ) is
101 select epe.elig_per_elctbl_chc_id,
102 epe.enrt_cvg_strt_dt,
103 epe.enrt_cvg_strt_dt_cd,
104 epe.prtt_enrt_rslt_id,
105 epe.oipl_id,
106 epe.dpnt_cvg_strt_dt_cd,
107 epe.dpnt_cvg_strt_dt_rl,
108 epe.pgm_id,
109 epe.pl_id,
110 epe.ptip_id
111 from ben_elig_per_elctbl_chc epe
112 where epe.per_in_ler_id = p_per_in_ler_id
113 and epe.oipl_id IS NULL --- SAVINGS PLAN FIX
114 and epe.pl_id = p_pl_id
115 and epe.elctbl_flag = 'Y'
116 and (epe.pgm_id = p_pgm_id OR p_pgm_id IS NULL) ;
117 --
118 cursor c_egd(p_per_in_ler_id number,
119 p_elig_per_elctbl_chc_id number,
120 p_dpnt_person_id number) is
121 select egd.elig_dpnt_id,
122 egd.elig_strt_dt,
123 egd.elig_thru_dt
124 from ben_elig_dpnt egd
125 where egd.per_in_ler_id = p_per_in_ler_id
126 and egd.elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id
127 and egd.dpnt_person_id = p_dpnt_person_id ;
128 --
129 cursor c_bnf(p_prtt_enrt_rslt_id number,
130 p_bnf_person_id number,
131 p_effective_date date ) is
132 select pbn.pl_bnf_id,
133 pbn.dsgn_strt_dt,
134 pbn.dsgn_thru_dt,
135 pbn.object_version_number,
136 pbn.effective_start_date
137 from ben_pl_bnf_f pbn
138 where pbn.prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
139 and pbn.bnf_person_id = p_bnf_person_id
140 and p_effective_date between pbn.effective_start_date
141 and pbn.effective_end_date ;
142 --
143 cursor c_bnf_org(p_prtt_enrt_rslt_id number,
144 p_organization_id number,
145 p_effective_date date ) is
146 select pbn.pl_bnf_id,
147 pbn.dsgn_strt_dt,
148 pbn.dsgn_thru_dt,
149 pbn.object_version_number,
150 pbn.effective_start_date
151 from ben_pl_bnf_f pbn
152 where pbn.prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
153 and pbn.organization_id = p_organization_id
154 and p_effective_date between pbn.effective_start_date
155 and pbn.effective_end_date ;
156 --
157 procedure get_pil
158 (p_person_id in number,
159 p_ler_id in number,
160 p_life_event_date in date,
161 p_pil out nocopy c_pil%ROWTYPE ) is
162 --
163 l_proc varchar2(60) := 'ben_enrollment_process.get_pil';
164 --
165 l_pil c_pil%ROWTYPE;
166 --
167 begin
168 --Get PIL
169 OPEN c_pil(p_ler_id,p_life_event_date,p_person_id);
170 FETCH c_pil into l_pil ;
171 --
172 IF c_pil%NOTFOUND THEN
173 --
174 CLOSE c_pil;
175 if g_debug then
176 hr_utility.set_location('BEN_94534_PIL_NOT_FOUND'|| to_char(p_person_id),54);
177 end if;
178 fnd_message.set_name('BEN','BEN_94534_PIL_NOT_FOUND');
179 fnd_message.set_token('PROC',l_proc);
180 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
181 fnd_message.set_token('LER_ID',to_char(p_ler_id));
182 fnd_message.set_token('LE_DATE', p_life_event_date);
183 fnd_message.raise_error;
184 --
185 END IF;
186 CLOSE c_pil;
187 --
188 p_pil := l_pil ;
189 --
190 end get_pil ;
191 --
192 procedure get_epe
193 (p_person_id in number,
194 p_per_in_ler_id in number,
195 p_life_event_date in date,
196 p_opt_id in number,
197 p_pl_id in number,
198 p_pgm_id in number,
199 p_epe out nocopy c_epe_pl%ROWTYPE ) is
200 --
201 l_proc varchar2(60) := 'ben_enrollment_process.get_epe';
202 l_epe c_epe_pl%ROWTYPE;
203 --
204 begin
205 --Get EPE
206 --Get EPE
207 IF p_opt_id IS NOT NULL THEN
208 --
209 OPEN c_epe_oipl(p_per_in_ler_id,
210 p_pl_id,
211 p_opt_id,
212 p_life_event_date,
213 p_pgm_id ) ;
214 FETCH c_epe_oipl INTO l_epe;
215 IF c_epe_oipl%NOTFOUND THEN
216 CLOSE c_epe_oipl ;
217 if g_debug then
218 hr_utility.set_location('BEN_94612_NO_EPE_EU'|| to_char(p_person_id),54);
219 end if;
220 fnd_message.set_name('BEN','BEN_94612_NO_EPE_EU');
221 fnd_message.set_token('PROC',l_proc);
222 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
223 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
224 fnd_message.set_token('PL_ID',to_char(p_pl_id));
225 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
226 fnd_message.set_token('PER_IN_LER_ID',to_char(p_per_in_ler_id));
227 fnd_message.set_token('LE_DATE',p_life_event_date);
228 fnd_message.raise_error;
229 --
230 END IF;
231 --
232 CLOSE c_epe_oipl ;
233 --
234 ELSE
235 --
236 OPEN c_epe_pl(p_per_in_ler_id,
237 p_pl_id,
238 p_pgm_id ) ;
239 FETCH c_epe_pl INTO l_epe;
240 IF c_epe_pl%NOTFOUND THEN
241 CLOSE c_epe_pl ;
242 if g_debug then
243 hr_utility.set_location('BEN_94612_NO_EPE_EU'|| to_char(p_person_id),54);
244 end if;
245 fnd_message.set_name('BEN','BEN_94612_NO_EPE_EU');
246 fnd_message.set_token('PROC',l_proc);
247 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
248 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
249 fnd_message.set_token('PL_ID',to_char(p_pl_id));
250 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
251 fnd_message.set_token('PER_IN_LER_ID',to_char(p_per_in_ler_id));
252 fnd_message.set_token('LE_DATE',p_life_event_date);
253 fnd_message.raise_error;
254 --
255 END IF;
256 --
257 CLOSE c_epe_pl ;
258 --
259 END IF;
260 --
261 p_epe := l_epe ;
262 --
263 end get_epe ;
264 --
265 procedure get_egd
266 (p_per_in_ler_id in number,
267 p_dpnt_person_id in number,
268 p_elig_per_elctbl_chc_id in number,
269 p_egd out nocopy c_egd%ROWTYPE ) is
270 --
271 l_proc varchar2(60) := 'ben_enrollment_process.get_egd';
272 --
273 l_pil c_pil%ROWTYPE;
274 l_epe c_epe_oipl%ROWTYPE;
275 l_egd c_egd%ROWTYPE;
276 --
277 begin
278 --Get PIL
279 open c_egd(p_per_in_ler_id => p_per_in_ler_id,
280 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
281 p_dpnt_person_id => p_dpnt_person_id
282 );
283 fetch c_egd into l_egd ;
284 --
285 IF c_egd%NOTFOUND THEN
286 CLOSE c_egd ;
287 if g_debug then
288 hr_utility.set_location('BEN_94616_DPNT_WRONG',54);
289 end if;
290 fnd_message.set_name('BEN','BEN_94616_DPNT_WRONG');
291 fnd_message.set_token('PROC',l_proc);
292 fnd_message.raise_error;
293 --
294 END IF;
295 --
296 close c_egd ;
297 --
298 p_egd := l_egd ;
299 --
300 end get_egd ;
301 --
302 procedure check_pen
303 (p_per_in_ler_id in number,
304 p_prtt_enrt_rslt_id in number ) is
305 --
306 l_proc varchar2(60) := 'ben_enrollment_process.check_pen';
307 --
308 cursor c_pen is
309 select 'x'
310 from ben_prtt_enrt_rslt_f pen
311 where pen.prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
312 and pen.prtt_enrt_rslt_stat_cd is null
313 and pen.effective_end_date = hr_api.g_eot
314 and pen.enrt_cvg_thru_dt = hr_api.g_eot ;
315 --
316 l_dummy varchar2(30);
317 --
318 begin
319 --Get PIL
320 IF p_prtt_enrt_rslt_id IS NOT NULL THEN
321 open c_pen;
322 fetch c_pen into l_dummy;
323 IF c_pen%NOTFOUND THEN
324 CLOSE c_pen ;
325 if g_debug then
326 hr_utility.set_location('BEN_94617_DPNT_NO_PEN',54);
327 end if;
328 fnd_message.set_name('BEN','BEN_94617_DPNT_NO_PEN');
329 fnd_message.set_token('PROC',l_proc);
330 fnd_message.raise_error;
331 --
332 END IF;
333 --
334 close c_pen ;
335 ELSE
336 --
337 if g_debug then
338 hr_utility.set_location('BEN_94617_DPNT_NO_PEN',54);
339 end if;
340 fnd_message.set_name('BEN','BEN_94617_DPNT_NO_PEN');
341 fnd_message.set_token('PROC',l_proc);
342 fnd_message.raise_error;
343 --
344 END IF;
345 --
346 end check_pen ;
347 --
348 procedure get_pbn
349 (p_effective_date in date,
350 p_bnf_person_id in number,
351 p_organization_id in number,
352 p_prtt_enrt_rslt_id in number,
353 p_bnf out nocopy c_bnf%ROWTYPE ) is
354 --
355 l_proc varchar2(60) := 'ben_enrollment_process.get_pbn';
356 --
357 l_bnf c_bnf%ROWTYPE;
358 --
359 begin
360 --
361 IF p_organization_id IS NULL AND p_bnf_person_id IS NULL THEN
362 --
363 if g_debug then
364 hr_utility.set_location('BEN_94617_NO_BNF_PERSON',54);
365 end if;
366 fnd_message.set_name('BEN','BEN_94617_NO_BNF_PERSON');
367 fnd_message.set_token('PROC',l_proc);
368 fnd_message.raise_error;
369 --
370 END IF;
371 --Get PIL
372 IF p_organization_id IS NOT NULL THEN
373 --
374 open c_bnf_org(p_prtt_enrt_rslt_id => p_prtt_enrt_rslt_id,
375 p_organization_id => p_organization_id,
376 p_effective_date => p_effective_date
377 );
378 fetch c_bnf_org into l_bnf ;
379 close c_bnf_org ;
380 --
381 ELSIF p_bnf_person_id IS NOT NULL THEN
382 --
383 open c_bnf(p_prtt_enrt_rslt_id => p_prtt_enrt_rslt_id,
384 p_bnf_person_id => p_bnf_person_id,
385 p_effective_date => p_effective_date
386 );
387 fetch c_bnf into l_bnf ;
388 close c_bnf ;
389 --
390 ELSE
391 --Raise error;
392 null;
393 END IF;
394 --
395 p_bnf := l_bnf ;
396 --
397 end get_pbn ;
398 --
399 procedure get_current_pen
400 (p_effective_date in date,
401 p_life_event_date in date,
402 p_person_id in number,
403 p_pgm_id in number,
404 p_pl_id in number,
405 p_opt_id in number,
406 p_bnft_val in number,
407 p_prtt_enrt_rslt_id out nocopy number,
408 p_object_version_number out nocopy number) is
409 --
413 --
410 l_proc varchar2(60) := 'ben_enrollment_information_detail.get_pen';
411 l_prtt_enrt_rslt_id number ;
412 l_oipl_id number ;
414 cursor c_oipl is
415 select oipl_id
416 from ben_oipl_f
417 where opt_id = p_opt_id
418 and pl_id = p_pl_id
419 and p_effective_date between effective_start_date
420 and effective_end_date;
421 --
422 cursor c_pen_plnip is
423 select pen.prtt_enrt_rslt_id,
424 pen.object_version_number
425 from ben_prtt_enrt_rslt_f pen
426 where pen.pl_id = p_pl_id
427 and pen.person_id = p_person_id
428 and pen.effective_end_date = hr_api.g_eot
429 and pen.enrt_cvg_thru_dt = hr_api.g_eot
430 and ( p_bnft_val is NULL or
431 pen.bnft_amt = p_bnft_val)
432 and prtt_enrt_rslt_stat_cd is null;
433 --
434 cursor c_pen_oiplnip is
435 select pen.prtt_enrt_rslt_id,
436 pen.object_version_number
437 from ben_prtt_enrt_rslt_f pen
438 where pen.oipl_id = l_oipl_id
439 and pen.person_id = p_person_id
440 and pen.effective_end_date = hr_api.g_eot
441 and pen.enrt_cvg_thru_dt = hr_api.g_eot
442 and ( p_bnft_val is NULL or
443 pen.bnft_amt = p_bnft_val)
444 and prtt_enrt_rslt_stat_cd is null;
445 --
446 cursor c_pen_pl is
447 select pen.prtt_enrt_rslt_id,
448 pen.object_version_number
449 from ben_prtt_enrt_rslt_f pen
450 where pen.pgm_id = p_pgm_id
451 and pen.pl_id = p_pl_id
452 and pen.person_id = p_person_id
453 and pen.effective_end_date = hr_api.g_eot
454 and pen.enrt_cvg_thru_dt = hr_api.g_eot
455 and ( p_bnft_val is NULL or
456 pen.bnft_amt = p_bnft_val)
457 and prtt_enrt_rslt_stat_cd is null;
458 --
459 cursor c_pen_oipl is
460 select pen.prtt_enrt_rslt_id,
461 pen.object_version_number
462 from ben_prtt_enrt_rslt_f pen
463 where pen.pgm_id = p_pgm_id
464 and pen.oipl_id = l_oipl_id
465 and pen.person_id = p_person_id
466 and pen.effective_end_date = hr_api.g_eot
467 and pen.enrt_cvg_thru_dt = hr_api.g_eot
468 and ( p_bnft_val is NULL or
469 pen.bnft_amt = p_bnft_val)
470 and prtt_enrt_rslt_stat_cd is null;
471 --
472 l_pen c_pen_plnip%ROWTYPE;
473 --
474 begin
475 --
476 open c_oipl ;
477 fetch c_oipl into l_oipl_id;
478 close c_oipl ;
479 --
480 IF p_pgm_id IS NULL THEN
481 --
482 IF l_oipl_id IS NULL THEN
483 --
484 open c_pen_plnip ;
485 fetch c_pen_plnip into l_pen ;
486 close c_pen_plnip ;
487 --
488 ELSE -- Plan level
489 open c_pen_oiplnip ;
490 fetch c_pen_oiplnip into l_pen ;
491 close c_pen_oiplnip ;
492 END IF;
493 --
494 ELSE
495 --
496 IF l_oipl_id IS NULL THEN
497 --
498 open c_pen_pl;
499 fetch c_pen_pl into l_pen ;
500 close c_pen_pl ;
501 --
502 ELSE -- Plan level
503 open c_pen_oipl ;
504 fetch c_pen_oipl into l_pen ;
505 close c_pen_oipl ;
506 END IF;
507 --
508 END IF;
509 --
510 p_prtt_enrt_rslt_id := l_pen.prtt_enrt_rslt_id;
511 p_object_version_number := l_pen.object_version_number;
512 --
513 end get_current_pen ;
514 --
515 procedure get_ended_pen
516 (p_effective_date in date,
517 p_life_event_date in date,
518 p_person_id in number,
519 p_pgm_id in number,
520 p_pl_id in number,
521 p_opt_id in number,
522 p_prtt_enrt_rslt_id out nocopy number) is
523 --
524 l_proc varchar2(60) := 'ben_enrollment_information_detail.get_ended_pen';
525 l_prtt_enrt_rslt_id number ;
526 l_oipl_id number ;
527 --
528 cursor c_oipl is
529 select oipl_id
530 from ben_oipl_f
531 where opt_id = p_opt_id
532 and pl_id = p_pl_id
533 and p_effective_date between effective_start_date
534 and effective_end_date;
535 --
536 cursor c_pen_plnip is
537 select pen.prtt_enrt_rslt_id,
538 pen.object_version_number
539 from ben_prtt_enrt_rslt_f pen
540 where pen.pl_id = p_pl_id
541 and pen.person_id = p_person_id
542 and (pen.effective_end_date <> hr_api.g_eot
543 or pen.enrt_cvg_thru_dt <> hr_api.g_eot);
544 --
545 cursor c_pen_oiplnip is
546 select pen.prtt_enrt_rslt_id,
547 pen.object_version_number
548 from ben_prtt_enrt_rslt_f pen
549 where pen.oipl_id = l_oipl_id
550 and pen.person_id = p_person_id
551 and (pen.effective_end_date <> hr_api.g_eot
552 or pen.enrt_cvg_thru_dt <> hr_api.g_eot);
553 --
554 cursor c_pen_pl is
555 select pen.prtt_enrt_rslt_id,
556 pen.object_version_number
557 from ben_prtt_enrt_rslt_f pen
558 where pen.pgm_id = p_pgm_id
559 and pen.pl_id = p_pl_id
563 --
560 and pen.person_id = p_person_id
561 and (pen.effective_end_date <> hr_api.g_eot
562 or pen.enrt_cvg_thru_dt <> hr_api.g_eot);
564 cursor c_pen_oipl is
565 select pen.prtt_enrt_rslt_id,
566 pen.object_version_number
567 from ben_prtt_enrt_rslt_f pen
568 where pen.pgm_id = p_pgm_id
569 and pen.oipl_id = l_oipl_id
570 and pen.person_id = p_person_id
571 and (pen.effective_end_date <> hr_api.g_eot
572 or pen.enrt_cvg_thru_dt <> hr_api.g_eot);
573 --
574 l_pen c_pen_plnip%ROWTYPE;
575 --
576 begin
577 --
578 open c_oipl ;
579 fetch c_oipl into l_oipl_id;
580 close c_oipl ;
581 --
582 IF p_pgm_id IS NULL THEN
583 --
584 IF l_oipl_id IS NULL THEN
585 --
586 open c_pen_plnip ;
587 fetch c_pen_plnip into l_pen ;
588 close c_pen_plnip ;
589 --
590 ELSE -- Plan level
591 open c_pen_oiplnip ;
592 fetch c_pen_oiplnip into l_pen ;
593 close c_pen_oiplnip ;
594 END IF;
595 --
596 ELSE
597 --
598 IF l_oipl_id IS NULL THEN
599 --
600 open c_pen_pl;
601 fetch c_pen_pl into l_pen ;
602 close c_pen_pl ;
603 --
604 ELSE -- Plan level
605 open c_pen_oipl ;
606 fetch c_pen_oipl into l_pen ;
607 close c_pen_oipl ;
608 END IF;
609 --
610 END IF;
611 --
612 p_prtt_enrt_rslt_id := l_pen.prtt_enrt_rslt_id;
613 --
614 end get_ended_pen;
615 --
616 -- --------------------------------------------------------------------------------
617 -- |-----------------------------< ELECTION_INFORMATION >-------------------------|
618 -- -------------------------------------------------------------------------------+
619 --
620 procedure enrollment_information_detail
621 (p_validate in boolean default false
622 ,p_pgm_id in number default null
623 ,p_pl_id in number default null
624 ,p_opt_id in number default null
625 ,p_ler_id in number
626 ,p_life_event_date in date
627 ,p_ended_pl_id in number default null
628 ,p_ended_opt_id in number default null
629 ,p_ended_bnft_val in number default null
630 ,p_effective_date in date
631 ,p_person_id in number
632 ,p_bnft_val in number default null
633 ,p_acty_base_rt_id1 in number default null
634 ,p_rt_val1 in number default null
635 ,p_ann_rt_val1 in number default null
636 ,p_rt_strt_dt1 in date default null
637 ,p_rt_end_dt1 in date default null
638 ,p_acty_base_rt_id2 in number default null
639 ,p_rt_val2 in number default null
640 ,p_ann_rt_val2 in number default null
641 ,p_rt_strt_dt2 in date default null
642 ,p_rt_end_dt2 in date default null
643 ,p_acty_base_rt_id3 in number default null
644 ,p_rt_val3 in number default null
645 ,p_ann_rt_val3 in number default null
646 ,p_rt_strt_dt3 in date default null
647 ,p_rt_end_dt3 in date default null
648 ,p_acty_base_rt_id4 in number default null
649 ,p_rt_val4 in number default null
650 ,p_ann_rt_val4 in number default null
651 ,p_rt_strt_dt4 in date default null
652 ,p_rt_end_dt4 in date default null
653 ,p_business_group_id in number
654 ,p_enrt_cvg_strt_dt in date default null
655 ,p_enrt_cvg_thru_dt in date default null
656 ,p_orgnl_enrt_dt in date default null ) is
657 --
658 --
659 l_proc varchar2(60) := 'ben_enrollment_process.enrollment_information_detail';
660 l_suspend_flag varchar2(30);
661 l_dpnt_actn_warning boolean;
662 l_bnf_actn_warning boolean;
663 l_ctfn_actn_warning boolean;
664 l_object_version_number number;
665 l_prtt_enrt_rslt_id number;
666 l_prtt_rt_val_id1 number;
667 l_prtt_rt_val_id2 number;
668 l_prtt_rt_val_id3 number;
669 l_prtt_rt_val_id4 number;
670 l_prtt_rt_val_id5 number;
671 l_prtt_rt_val_id6 number;
672 l_prtt_rt_val_id7 number;
673 l_prtt_rt_val_id8 number;
674 l_prtt_rt_val_id9 number;
675 l_prtt_rt_val_id10 number;
676 l_enrt_rt_id1 number;
677 l_enrt_rt_id2 number;
678 l_enrt_rt_id3 number;
679 l_enrt_rt_id4 number;
680 l_enrt_bnft_id number;
681 l_elig_per_elctbl_chc_id number;
682 l_prtt_enrt_interim_id number;
683 l_effective_start_date date;
684 l_effective_end_date date;
685 l_datetrack_mode varchar2(30) ;
686 l_pl_id number := p_pl_id;
687 l_enroll_flag boolean := true;
688 --
689 l_pil c_pil%ROWTYPE;
690 --
691 l_epe c_epe_oipl%ROWTYPE;
692 --
693 --GET ENB when bnft amount entered by the user
694 --
698 enb.entr_val_at_enrt_flag,
695 cursor c_enb_with_amt is
696 select enb.enrt_bnft_id,
697 enb.cvg_mlt_cd,
699 enb.val,
700 enb.mn_val,
701 enb.mx_val,
702 enb.incrmt_val
703 from ben_enrt_bnft enb
704 where enb.elig_per_elctbl_chc_id = l_epe.elig_per_elctbl_chc_id
705 and enb.mx_wo_ctfn_flag = 'N'
706 and (enb.entr_val_at_enrt_flag = 'Y' OR enb.vaL = p_bnft_val) ;
707 --
708 l_enb c_enb_with_amt%ROWTYPE;
709 --
710 --GET ENB when bnft amount is not entered by the user
711 --
712 cursor c_enb is
713 select enb.enrt_bnft_id,enb.cvg_mlt_cd,enb.entr_val_at_enrt_flag,enb.val,
714 enb.mn_val,
715 enb.mx_val,
716 enb.incrmt_val
717 from ben_enrt_bnft enb
718 where enb.elig_per_elctbl_chc_id = l_epe.elig_per_elctbl_chc_id
719 and enb.mx_wo_ctfn_flag = 'N' ;
720 --
721 --ECR from EPE
722 --
723 cursor c_ecr(p_acty_base_rt_id number) is
724 select enrt_rt_id,
725 rt_strt_dt,
726 rt_strt_dt_cd,
727 entr_val_at_enrt_flag,
728 val,
729 ann_val
730 from ben_enrt_rt ecr
731 where ecr.elig_per_elctbl_chc_id = l_epe.elig_per_elctbl_chc_id
732 --and ecr.entr_val_at_enrt_flag = 'Y'
733 and ecr.acty_base_rt_id = p_acty_base_rt_id ;
734 --
735 l_ecr1 c_ecr%ROWTYPE;
736 l_ecr2 c_ecr%ROWTYPE;
737 l_ecr3 c_ecr%ROWTYPE;
738 l_ecr4 c_ecr%ROWTYPE;
739 --
740 --ECR from ENB
741 --
742 cursor c_ecr_enb(p_acty_base_rt_id number) is
743 select enrt_rt_id,
744 rt_strt_dt,
745 rt_strt_dt_cd,
746 entr_val_at_enrt_flag,
747 val,
748 ann_val
749 from ben_enrt_rt ecr
750 where ecr.enrt_bnft_id = l_enb.enrt_bnft_id
751 --and ecr.entr_val_at_enrt_flag = 'Y'
752 and ecr.acty_base_rt_id = p_acty_base_rt_id ;
753 --
754 cursor c_ecr_eve(p_epe_id number) is
755 select 'Y'
756 from ben_enrt_rt ecr
757 where ecr.elig_per_elctbl_chc_id = p_epe_id
758 and ecr.entr_val_at_enrt_flag = 'Y' ;
759 --
760 cursor c_ecr_enb_eve(p_enb_id number) is
761 select 'Y'
762 from ben_enrt_rt ecr
763 where ecr.enrt_bnft_id = p_enb_id
764 and ecr.entr_val_at_enrt_flag = 'Y' ;
765 --
766 l_dummy varchar2(30);
767 --
768 cursor c_pl_opt_name(p_epe_id number) is
769 select pln.name || ' '|| opt.name
770 from ben_elig_per_elctbl_chc epe,
771 ben_pl_f pln,
772 ben_oipl_f oipl,
773 ben_opt_f opt
774 where epe.elig_per_elctbl_chc_id = p_epe_id
775 and epe.pl_id = pln.pl_id
776 and epe.oipl_id = oipl.oipl_id(+)
777 and oipl.opt_id = opt.opt_id(+)
778 and p_life_event_date between
779 pln.effective_start_date and pln.effective_end_date
780 and p_life_event_date between
781 oipl.effective_start_date(+) and oipl.effective_end_date(+)
782 and p_life_event_date between
783 opt.effective_start_date(+) and opt.effective_end_date(+);
784 --
785 l_pl_opt_name varchar2(600) := null;
786 --
787 begin
788 --
789 hr_utility.set_location('Entering:'||l_proc, 20);
790 --
791 fnd_file.put_line
792 (which => fnd_file.log,
793 buff => 'Entering - BEN_ENROLLMENT_PROCESS.ENROLLMENT_INFORMATION_DETAIL' );
794 fnd_file.put_line
795 (which => fnd_file.log,
796 buff => 'l_person_id '||p_person_id||' l_pgm_id '||p_pgm_id||' l_pl_id '||p_pl_id);
797 --
798 fnd_file.put_line
799 (which => fnd_file.log,
800 buff => 'l_opt_id '||p_opt_id||' l_ler_id '||p_ler_id);
801 fnd_file.put_line
802 (which => fnd_file.log,
803 buff => 'p_bnft_val '||p_bnft_val);
804 fnd_file.put_line
805 (which => fnd_file.log,
806 buff => 'l_life_event_date '||p_life_event_date);
807 --
808 fnd_file.put_line
809 (which => fnd_file.log,
810 buff => 'p_ended_pl_id '||p_ended_pl_id||' p_ended_opt_id '||p_ended_opt_id);
811 --
812 get_pil
813 (p_person_id => p_person_id,
814 p_ler_id => p_ler_id,
815 p_life_event_date => p_life_event_date,
816 p_pil => l_pil
817 );
818 --
819 --Set De-Enroll flag if ended plan details have been entered by the user
820 --
821 if p_ended_pl_id is not null and p_pl_id is null then --De Enroll person from the spedified plan
822 l_enroll_flag := false;
823 end if;
824 --
825 if (l_enroll_flag) then
826 --
827 --Get EPE
828 --
829 get_epe
830 (p_person_id => p_person_id,
831 p_per_in_ler_id => l_pil.per_in_ler_id,
832 p_life_event_date => p_life_event_date,
833 p_opt_id => p_opt_id,
834 p_pl_id => p_pl_id,
835 p_pgm_id => p_pgm_id,
836 p_epe => l_epe
840 --
837 ) ;
838 --
839 --Get Ended Enrollment Result
841 get_current_pen
842 (p_effective_date => p_effective_date,
843 p_life_event_date => p_life_event_date,
844 p_person_id => p_person_id,
845 p_pgm_id => p_pgm_id,
846 p_pl_id => p_ended_pl_id,
847 p_opt_id => p_ended_opt_id,
848 p_bnft_val => p_ended_bnft_val,
849 p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id,
850 p_object_version_number => l_object_version_number
851 );
852 --
853 --Coverage start date check. User should only enter for the code ENTRBL
854 IF l_epe.enrt_cvg_strt_dt_cd = 'ENTRBL' THEN
855 --
856 IF p_enrt_cvg_strt_dt IS NOT NULL THEN
857 l_epe.enrt_cvg_strt_dt := p_enrt_cvg_strt_dt ;
858 ELSE
859 --Throw Error.. Coverage start date needs to be entered
860 if g_debug then
861 hr_utility.set_location('BEN_94552_NO_CVG_STRT_DT'|| to_char(p_person_id),54);
862 end if;
863 fnd_message.set_name('BEN','BEN_94552_NO_CVG_STRT_DT');
864 fnd_message.set_token('PACKAGE',l_proc);
865 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
866 fnd_message.set_token('LER_ID', to_char(p_ler_id));
867 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
868 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
869 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
870 fnd_message.raise_error;
871 --
872 END IF;
873 --
874 ELSE
875 --
876 if g_debug then
877 hr_utility.set_location('No Coverage Start date is required '||p_enrt_cvg_strt_dt ,54);
878 end if;
879 --
880 END IF;
881 --
882 --Get ENB
883 --User needs to enter benefit amout for flat range and enter value at enrollment cases.
884 --Enter Benefit amount.
885 --Flat Range
886 --Other types.
887 --
888 --If amount is entered by user, get the matching record or MX_WO_CTFN_FLAG
889 --If no amount
890 IF p_bnft_val IS NOT NULL THEN
891 --
892 OPEN c_enb_with_amt ;
893 --
894 FETCH c_enb_with_amt INTO l_enb;
895 IF c_enb_with_amt%NOTFOUND THEN
896 CLOSE c_enb_with_amt ;
897 if g_debug then
898 hr_utility.set_location('BEN_91561_BENVRBRT_ENB_NF'|| to_char(p_person_id),54);
899 end if;
900 fnd_message.set_name('BEN','BEN_91561_BENVRBRT_ENB_NF');
901 fnd_message.set_token('PACKAGE',l_proc);
902 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
903 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
904 fnd_message.set_token('PL_ID', to_char(p_pl_id));
905 fnd_message.set_token('OIPL_ID',to_char(l_epe.oipl_id));
906 fnd_message.set_token('LF_EVT_OCRD_DT',p_life_event_date);
907 fnd_message.set_token('EFFECTIVE_DATE',p_effective_date);
908 fnd_message.set_token('PER_IN_LER_ID',to_char(l_pil.per_in_ler_id));
909 fnd_message.set_token('ELIG_PER_ELCTBL_CHC_ID', to_char(l_epe.elig_per_elctbl_chc_id));
910 fnd_message.raise_error;
911 --
912 ELSE
913 --
914 --Check check to see if the coverage calculation method requires the benefit amount.
915 IF (l_enb.entr_val_at_enrt_flag = 'Y' or l_enb.cvg_mlt_cd like '%RNG') THEN
916 --
917 l_enb.val := p_bnft_val ;
918 --
919 ELSE
920 --
921 CLOSE c_enb_with_amt ;
922 if g_debug then
923 hr_utility.set_location('BEN_94558_INVALID_BNFT_VAL'|| to_char(p_person_id),54);
924 end if;
925 fnd_message.set_name('BEN','BEN_91561_BENVRBRT_ENB_NF');
926 fnd_message.set_token('PROC',l_proc);
927 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
928 fnd_message.set_token('LER_ID',to_char(p_ler_id));
929 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
930 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
931 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
932 fnd_message.raise_error;
933 --
934 END IF;
935 --
936 END IF;
937 --
938 CLOSE c_enb_with_amt ;
939 --Validation for Benefit Amount ranges
940 if p_bnft_val is not null then
941 --
942 -- Bug 3181158, added nvl in 'if' to handle
943 -- 'EnrtValAtEnrt + no default value' condition
944 --
945 if ((l_enb.mn_val is not null and p_bnft_val < l_enb.mn_val) or
946 (l_enb.mx_val is not null and p_bnft_val > l_enb.mx_val)) then
947 --
948 -- Open the c_pl_opt_name cursor only if error needs to be displayed.
949 --
950 open c_pl_opt_name(l_epe.elig_per_elctbl_chc_id);
951 fetch c_pl_opt_name into l_pl_opt_name;
952 close c_pl_opt_name;
953 --
954 fnd_message.set_name('BEN','BEN_92394_OUT_OF_RANGE');
955 fnd_message.set_token('MINIMUM', l_enb.mn_val);
956 fnd_message.set_token('MAXIMUM', l_enb.mx_val);
957 fnd_message.set_token('PLAN', l_pl_opt_name);
958 fnd_message.raise_error;
959 --
963 l_enb.incrmt_val is not null and
960 end if;
961 --
962 if l_enb.mn_val is not null and
964 mod(p_bnft_val-l_enb.mn_val, l_enb.incrmt_val) <> 0 then
965 --
966 -- Open the c_pl_opt_name cursor only if error needs to be displayed.
967 --
968 open c_pl_opt_name(l_epe.elig_per_elctbl_chc_id);
969 fetch c_pl_opt_name into l_pl_opt_name;
970 close c_pl_opt_name;
971 --
972 fnd_message.set_name('BEN','BEN_92395_NOT_IN_INCR');
973 fnd_message.set_token('INCREMENT', l_enb.incrmt_val);
974 fnd_message.set_token('PLAN', l_pl_opt_name);
975 fnd_message.raise_error;
976 --
977 end if;
978 --
979 end if;
980 --
981 --
982 ELSE
983 --
984 OPEN c_enb ;
985 FETCH c_enb INTO l_enb;
986 IF ((l_enb.entr_val_at_enrt_flag = 'Y' or l_enb.cvg_mlt_cd like '%RNG') and
987 p_bnft_val IS NULL) THEN
988 --
989 if g_debug then
990 hr_utility.set_location('BEN_94559_NO_BNFT_VAL'|| to_char(p_person_id),54);
991 end if;
992 CLOSE c_enb ;
993 fnd_message.set_name('BEN','BEN_94559_NO_BNFT_VAL');
994 fnd_message.set_token('PROC',l_proc);
995 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
996 fnd_message.set_token('LER_ID',to_char(p_ler_id));
997 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
998 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
999 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1000 fnd_message.raise_error;
1001 --
1002 END IF;
1003 CLOSE c_enb ;
1004 --
1005 END IF;
1006 --
1007 IF l_enb.enrt_bnft_id IS NOT NULL THEN
1008 open c_ecr_enb_eve(l_enb.enrt_bnft_id );
1009 fetch c_ecr_enb_eve into l_dummy;
1010 close c_ecr_enb_eve;
1011 --
1012 ELSE
1013 --
1014 open c_ecr_eve(l_epe.elig_per_elctbl_chc_id);
1015 fetch c_ecr_eve into l_dummy;
1016 close c_ecr_eve;
1017 --
1018 END IF;
1019 --
1020 IF l_dummy = 'Y' THEN
1021 --
1022 IF p_acty_base_rt_id1 IS NOT NULL AND
1023 (p_rt_val1 IS NOT NULL OR p_ann_rt_val1 IS NOT NULL OR p_rt_strt_dt1 IS NOT NULL ) THEN
1024 --
1025 null;
1026 ELSIF p_acty_base_rt_id2 IS NOT NULL AND
1027 (p_rt_val2 IS NOT NULL OR p_ann_rt_val2 IS NOT NULL OR p_rt_strt_dt2 IS NOT NULL ) THEN
1028 --
1029 null;
1030 --
1031 ELSIF p_acty_base_rt_id3 IS NOT NULL AND
1032 (p_rt_val3 IS NOT NULL OR p_ann_rt_val3 IS NOT NULL OR p_rt_strt_dt3 IS NOT NULL ) THEN
1033 --
1034 null;
1035 --
1036 ELSIF p_acty_base_rt_id4 IS NOT NULL AND
1037 (p_rt_val4 IS NOT NULL OR p_ann_rt_val4 IS NOT NULL OR p_rt_strt_dt4 IS NOT NULL ) THEN
1038 --
1039 null;
1040 --
1041 ELSE
1042 --
1043 if g_debug then
1044 hr_utility.set_location('APP_94555_NO_RATE_VAL'|| to_char(p_person_id),54);
1045 end if;
1046 fnd_message.set_name('BEN','APP_94555_NO_RATE_VAL');
1047 fnd_message.set_token('PROC',l_proc);
1048 fnd_message.set_token('PERSON_ID', to_char(p_person_id));
1049 fnd_message.set_token('LER_ID',to_char(p_ler_id));
1050 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1051 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1052 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1053 fnd_message.raise_error;
1054 --
1055 END IF;
1056
1057 END IF ;
1058 --
1059
1060 --Get ECR
1061 --
1062 IF p_acty_base_rt_id1 IS NOT NULL AND
1063 (p_rt_val1 IS NOT NULL OR p_ann_rt_val1 IS NOT NULL OR p_rt_strt_dt1 IS NOT NULL ) THEN
1064 --
1065 IF l_enb.enrt_bnft_id IS NOT NULL THEN
1066 --
1067 OPEN c_ecr_enb(p_acty_base_rt_id1);
1068 FETCH c_ecr_enb INTO l_ecr1; -- l_enrt_rt_id1;
1069 IF c_ecr_enb%NOTFOUND THEN
1070 CLOSE c_ecr_enb ;
1071 if g_debug then
1072 hr_utility.set_location('BEN_94535_ECR_NOT_FOUND'|| to_char(p_person_id),54);
1073 end if;
1074 fnd_message.set_name('BEN','BEN_94535_ECR_NOT_FOUND');
1075 fnd_message.set_token('PROC',l_proc);
1076 fnd_message.set_token('PERSON_ID', to_char(p_person_id));
1077 fnd_message.set_token('ABR_ID', to_char(p_acty_base_rt_id1));
1078 fnd_message.set_token('RT_VAL', to_char(p_rt_val1));
1079 fnd_message.set_token('ANN_RT_VAL', to_char(p_ann_rt_val1));
1080 fnd_message.raise_error;
1081 --
1082 ELSE
1083 --
1084 IF l_ecr1.rt_strt_dt_cd = 'ENTRBL' THEN
1085 IF p_rt_strt_dt1 IS NOT NULL THEN
1086 --
1087 l_ecr1.rt_strt_dt := p_rt_strt_dt1 ;
1088 --
1089 ELSE
1090 --Throw Error
1091 if g_debug then
1092 hr_utility.set_location('BEN_94552_NO_RT_STRT_DT'|| to_char(p_person_id),54);
1093 end if;
1094 CLOSE c_ecr_enb;
1098 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1095 fnd_message.set_name('BEN','BEN_94552_NO_RT_STRT_DT');
1096 fnd_message.set_token('PACKAGE',l_proc);
1097 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1099 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1100 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1101 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1102 fnd_message.raise_error;
1103 --
1104 END IF;
1105 END IF;
1106 --
1107 IF l_ecr1.entr_val_at_enrt_flag = 'Y' THEN
1108 --
1109 IF p_rt_val1 IS NOT NULL OR p_ann_rt_val1 IS NOT NULL THEN
1110 l_ecr1.val := p_rt_val1 ;
1111 l_ecr1.ann_val := p_ann_rt_val1;
1112 ELSE
1113 --Throw error- rates need to be entered
1114 if g_debug then
1115 hr_utility.set_location('BEN_94555_NO_RATE_VAL'|| to_char(p_person_id),54);
1116 end if;
1117 CLOSE c_ecr_enb;
1118 fnd_message.set_name('BEN','BEN_94555_NO_RATE_VAL');
1119 fnd_message.set_token('PACKAGE',l_proc);
1120 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1121 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1122 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1123 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1124 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1125 fnd_message.raise_error;
1126 --
1127 END IF;
1128 --
1129 ELSE
1130 null ; --ignore supplied rates.
1131 END IF;
1132 END IF;
1133 --
1134 CLOSE c_ecr_enb;
1135 --
1136 ELSE
1137 --
1138 OPEN c_ecr(p_acty_base_rt_id1);
1139 FETCH c_ecr INTO l_ecr1; -- l_enrt_rt_id1;
1140 IF c_ecr%NOTFOUND THEN
1141 CLOSE c_ecr ;
1142 if g_debug then
1143 hr_utility.set_location('BEN_94535_ECR_NOT_FOUND'|| to_char(p_person_id),54);
1144 end if;
1145 fnd_message.set_name('BEN','BEN_94535_ECR_NOT_FOUND');
1146 fnd_message.set_token('PROC',l_proc);
1147 fnd_message.set_token('PERSON_ID', to_char(p_person_id));
1148 fnd_message.set_token('ABR_ID', to_char(p_acty_base_rt_id1));
1149 fnd_message.set_token('RT_VAL', to_char(p_rt_val1));
1150 fnd_message.set_token('ANN_RT_VAL', to_char(p_ann_rt_val1));
1151 fnd_message.raise_error;
1152 --
1153 ELSE
1154 --
1155 IF l_ecr1.rt_strt_dt_cd = 'ENTRBL' THEN
1156 IF p_rt_strt_dt1 IS NOT NULL THEN
1157 --
1158 l_ecr1.rt_strt_dt := p_rt_strt_dt1 ;
1159 --
1160 ELSE
1161 --Throw Error
1162 if g_debug then
1163 hr_utility.set_location('BEN_94552_NO_RT_STRT_DT'|| to_char(p_person_id),54);
1164 end if;
1165 CLOSE c_ecr;
1166 fnd_message.set_name('BEN','BEN_94552_NO_RT_STRT_DT');
1167 fnd_message.set_token('PACKAGE',l_proc);
1168 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1169 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1170 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1171 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1172 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1173 fnd_message.raise_error;
1174 --
1175 END IF;
1176 END IF;
1177 --
1178 IF l_ecr1.entr_val_at_enrt_flag = 'Y' THEN
1179 --
1180 IF p_rt_val1 IS NOT NULL OR p_ann_rt_val1 IS NOT NULL THEN
1181 l_ecr1.val := p_rt_val1 ;
1182 l_ecr1.ann_val := p_ann_rt_val1;
1183 ELSE
1184 --Throw error- rates need to be entered
1185 if g_debug then
1186 hr_utility.set_location('BEN_94555_NO_RATE_VAL'|| to_char(p_person_id),54);
1187 end if;
1188 CLOSE c_ecr;
1189 fnd_message.set_name('BEN','BEN_94555_NO_RATE_VAL');
1190 fnd_message.set_token('PACKAGE',l_proc);
1191 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1192 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1193 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1194 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1195 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1196 fnd_message.raise_error;
1197 --
1198 END IF;
1199 --
1200 ELSE
1201 null ; --ignore supplied rates.
1202 END IF;
1203 --
1204 END IF;
1205 --
1206 CLOSE c_ecr;
1207 --
1208 END IF;
1209 --
1210 END IF;
1211 --
1212 IF p_acty_base_rt_id2 IS NOT NULL AND
1213 (p_rt_val2 IS NOT NULL OR p_ann_rt_val2 IS NOT NULL OR p_rt_strt_dt2 IS NOT NULL ) THEN
1214 --
1215 IF l_enb.enrt_bnft_id IS NOT NULL THEN
1216 --
1220 CLOSE c_ecr_enb ;
1217 OPEN c_ecr_enb(p_acty_base_rt_id2);
1218 FETCH c_ecr_enb INTO l_ecr2; -- l_enrt_rt_id2;
1219 IF c_ecr_enb%NOTFOUND THEN
1221 if g_debug then
1222 hr_utility.set_location('BEN_94535_ECR_NOT_FOUND'|| to_char(p_person_id),54);
1223 end if;
1224 fnd_message.set_name('BEN','BEN_94535_ECR_NOT_FOUND');
1225 fnd_message.set_token('PROC',l_proc);
1226 fnd_message.set_token('PERSON_ID', to_char(p_person_id));
1227 fnd_message.set_token('ABR_ID', to_char(p_acty_base_rt_id2));
1228 fnd_message.set_token('RT_VAL', to_char(p_rt_val2));
1229 fnd_message.set_token('ANN_RT_VAL', to_char(p_ann_rt_val2));
1230 fnd_message.raise_error;
1231 --
1232 ELSE
1233 --
1234 IF l_ecr2.rt_strt_dt_cd = 'ENTRBL' THEN
1235 IF p_rt_strt_dt2 IS NOT NULL THEN
1236 --
1237 l_ecr2.rt_strt_dt := p_rt_strt_dt2 ;
1238 --
1239 ELSE
1240 --Throw Error
1241 if g_debug then
1242 hr_utility.set_location('BEN_94552_NO_RT_STRT_DT'|| to_char(p_person_id),54);
1243 end if;
1244 CLOSE c_ecr_enb;
1245 fnd_message.set_name('BEN','BEN_94552_NO_RT_STRT_DT');
1246 fnd_message.set_token('PACKAGE',l_proc);
1247 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1248 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1249 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1250 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1251 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1252 fnd_message.raise_error;
1253 --
1254 END IF;
1255 END IF;
1256 --
1257 IF l_ecr2.entr_val_at_enrt_flag = 'Y' THEN
1258 --
1259 IF p_rt_val2 IS NOT NULL OR p_ann_rt_val2 IS NOT NULL THEN
1260 l_ecr2.val := p_rt_val2 ;
1261 l_ecr2.ann_val := p_ann_rt_val2;
1262 ELSE
1263 --Throw error- rates need to be entered
1264 if g_debug then
1265 hr_utility.set_location('BEN_94555_NO_RATE_VAL'|| to_char(p_person_id),54);
1266 end if;
1267 CLOSE c_ecr_enb;
1268 fnd_message.set_name('BEN','BEN_94555_NO_RATE_VAL');
1269 fnd_message.set_token('PACKAGE',l_proc);
1270 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1271 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1272 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1273 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1274 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1275 fnd_message.raise_error;
1276 --
1277 END IF;
1278 --
1279 ELSE
1280 null ; --ignore supplied rates.
1281 END IF;
1282 END IF;
1283 --
1284 CLOSE c_ecr_enb;
1285 --
1286 ELSE
1287 --
1288 OPEN c_ecr(p_acty_base_rt_id2);
1289 FETCH c_ecr INTO l_ecr2; -- l_enrt_rt_id2;
1290 IF c_ecr%NOTFOUND THEN
1291 CLOSE c_ecr ;
1292 if g_debug then
1293 hr_utility.set_location('BEN_94535_ECR_NOT_FOUND'|| to_char(p_person_id),54);
1294 end if;
1295 fnd_message.set_name('BEN','BEN_94535_ECR_NOT_FOUND');
1296 fnd_message.set_token('PROC',l_proc);
1297 fnd_message.set_token('PERSON_ID', to_char(p_person_id));
1298 fnd_message.set_token('ABR_ID', to_char(p_acty_base_rt_id2));
1299 fnd_message.set_token('RT_VAL', to_char(p_rt_val2));
1300 fnd_message.set_token('ANN_RT_VAL', to_char(p_ann_rt_val2));
1301 fnd_message.raise_error;
1302 --
1303 ELSE
1304 --
1305 IF l_ecr2.rt_strt_dt_cd = 'ENTRBL' THEN
1306 IF p_rt_strt_dt2 IS NOT NULL THEN
1307 --
1308 l_ecr2.rt_strt_dt := p_rt_strt_dt2 ;
1309 --
1310 ELSE
1311 --Throw Error
1312 if g_debug then
1313 hr_utility.set_location('BEN_94552_NO_RT_STRT_DT'|| to_char(p_person_id),54);
1314 end if;
1315 CLOSE c_ecr;
1316 fnd_message.set_name('BEN','BEN_94552_NO_RT_STRT_DT');
1317 fnd_message.set_token('PACKAGE',l_proc);
1318 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1319 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1320 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1321 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1322 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1323 fnd_message.raise_error;
1324 --
1325 END IF;
1326 END IF;
1327 --
1328 IF l_ecr2.entr_val_at_enrt_flag = 'Y' THEN
1329 --
1330 IF p_rt_val2 IS NOT NULL OR p_ann_rt_val2 IS NOT NULL THEN
1331 l_ecr2.val := p_rt_val2 ;
1332 l_ecr2.ann_val := p_ann_rt_val2;
1333 ELSE
1337 end if;
1334 --Throw error- rates need to be entered
1335 if g_debug then
1336 hr_utility.set_location('BEN_94555_NO_RATE_VAL'|| to_char(p_person_id),54);
1338 CLOSE c_ecr;
1339 fnd_message.set_name('BEN','BEN_94555_NO_RATE_VAL');
1340 fnd_message.set_token('PACKAGE',l_proc);
1341 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1342 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1343 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1344 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1345 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1346 fnd_message.raise_error;
1347 --
1348 END IF;
1349 --
1350 ELSE
1351 null ; --ignore supplied rates.
1352 END IF;
1353 --
1354 END IF;
1355 --
1356 CLOSE c_ecr;
1357 --
1358 END IF;
1359 --
1360 END IF;
1361 --
1362 IF p_acty_base_rt_id3 IS NOT NULL AND
1363 (p_rt_val3 IS NOT NULL OR p_ann_rt_val3 IS NOT NULL OR p_rt_strt_dt3 IS NOT NULL ) THEN
1364 --
1365 IF l_enb.enrt_bnft_id IS NOT NULL THEN
1366 --
1367 OPEN c_ecr_enb(p_acty_base_rt_id3);
1368 FETCH c_ecr_enb INTO l_ecr3; -- l_enrt_rt_id3;
1369 IF c_ecr_enb%NOTFOUND THEN
1370 CLOSE c_ecr_enb ;
1371 if g_debug then
1372 hr_utility.set_location('BEN_94535_ECR_NOT_FOUND'|| to_char(p_person_id),54);
1373 end if;
1374 fnd_message.set_name('BEN','BEN_94535_ECR_NOT_FOUND');
1375 fnd_message.set_token('PROC',l_proc);
1376 fnd_message.set_token('PERSON_ID', to_char(p_person_id));
1377 fnd_message.set_token('ABR_ID', to_char(p_acty_base_rt_id3));
1378 fnd_message.set_token('RT_VAL', to_char(p_rt_val3));
1379 fnd_message.set_token('ANN_RT_VAL', to_char(p_ann_rt_val3));
1380 fnd_message.raise_error;
1381 --
1382 ELSE
1383 --
1384 IF l_ecr3.rt_strt_dt_cd = 'ENTRBL' THEN
1385 IF p_rt_strt_dt3 IS NOT NULL THEN
1386 --
1387 l_ecr3.rt_strt_dt := p_rt_strt_dt3 ;
1388 --
1389 ELSE
1390 --Throw Error
1391 if g_debug then
1392 hr_utility.set_location('BEN_94552_NO_RT_STRT_DT'|| to_char(p_person_id),54);
1393 end if;
1394 CLOSE c_ecr_enb;
1395 fnd_message.set_name('BEN','BEN_94552_NO_RT_STRT_DT');
1396 fnd_message.set_token('PACKAGE',l_proc);
1397 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1398 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1399 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1400 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1401 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1402 fnd_message.raise_error;
1403 --
1404 END IF;
1405 END IF;
1406 --
1407 IF l_ecr3.entr_val_at_enrt_flag = 'Y' THEN
1408 --
1409 IF p_rt_val3 IS NOT NULL OR p_ann_rt_val3 IS NOT NULL THEN
1410 l_ecr3.val := p_rt_val3 ;
1411 l_ecr3.ann_val := p_ann_rt_val3;
1412 ELSE
1413 --Throw error- rates need to be entered
1414 if g_debug then
1415 hr_utility.set_location('BEN_94555_NO_RATE_VAL'|| to_char(p_person_id),54);
1416 end if;
1417 CLOSE c_ecr_enb;
1418 fnd_message.set_name('BEN','BEN_94555_NO_RATE_VAL');
1419 fnd_message.set_token('PACKAGE',l_proc);
1420 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1421 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1422 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1423 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1424 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1425 fnd_message.raise_error;
1426 --
1427 END IF;
1428 --
1429 ELSE
1430 null ; --ignore supplied rates.
1431 END IF;
1432 END IF;
1433 --
1434 CLOSE c_ecr_enb;
1435 --
1436 ELSE
1437 --
1438 OPEN c_ecr(p_acty_base_rt_id3);
1439 FETCH c_ecr INTO l_ecr3; -- l_enrt_rt_id3;
1440 IF c_ecr%NOTFOUND THEN
1441 CLOSE c_ecr ;
1442 if g_debug then
1443 hr_utility.set_location('BEN_94535_ECR_NOT_FOUND'|| to_char(p_person_id),54);
1444 end if;
1445 fnd_message.set_name('BEN','BEN_94535_ECR_NOT_FOUND');
1446 fnd_message.set_token('PROC',l_proc);
1447 fnd_message.set_token('PERSON_ID', to_char(p_person_id));
1448 fnd_message.set_token('ABR_ID', to_char(p_acty_base_rt_id3));
1449 fnd_message.set_token('RT_VAL', to_char(p_rt_val3));
1450 fnd_message.set_token('ANN_RT_VAL', to_char(p_ann_rt_val3));
1451 fnd_message.raise_error;
1452 --
1453 ELSE
1454 --
1458 l_ecr3.rt_strt_dt := p_rt_strt_dt3 ;
1455 IF l_ecr3.rt_strt_dt_cd = 'ENTRBL' THEN
1456 IF p_rt_strt_dt3 IS NOT NULL THEN
1457 --
1459 --
1460 ELSE
1461 --Throw Error
1462 if g_debug then
1463 hr_utility.set_location('BEN_94552_NO_RT_STRT_DT'|| to_char(p_person_id),54);
1464 end if;
1465 CLOSE c_ecr;
1466 fnd_message.set_name('BEN','BEN_94552_NO_RT_STRT_DT');
1467 fnd_message.set_token('PACKAGE',l_proc);
1468 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1469 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1470 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1471 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1472 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1473 fnd_message.raise_error;
1474 --
1475 END IF;
1476 END IF;
1477 --
1478 IF l_ecr3.entr_val_at_enrt_flag = 'Y' THEN
1479 --
1480 IF p_rt_val3 IS NOT NULL OR p_ann_rt_val3 IS NOT NULL THEN
1481 l_ecr3.val := p_rt_val3 ;
1482 l_ecr3.ann_val := p_ann_rt_val3;
1483 ELSE
1484 --Throw error- rates need to be entered
1485 if g_debug then
1486 hr_utility.set_location('BEN_94555_NO_RATE_VAL'|| to_char(p_person_id),54);
1487 end if;
1488 CLOSE c_ecr;
1489 fnd_message.set_name('BEN','BEN_94555_NO_RATE_VAL');
1490 fnd_message.set_token('PACKAGE',l_proc);
1491 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1492 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1493 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1494 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1495 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1496 fnd_message.raise_error;
1497 --
1498 END IF;
1499 --
1500 ELSE
1501 null ; --ignore supplied rates.
1502 END IF;
1503 --
1504 END IF;
1505 --
1506 CLOSE c_ecr;
1507 --
1508 END IF;
1509 --
1510 END IF;
1511 --
1512 IF p_acty_base_rt_id4 IS NOT NULL AND
1513 (p_rt_val4 IS NOT NULL OR p_ann_rt_val4 IS NOT NULL OR p_rt_strt_dt4 IS NOT NULL ) THEN
1514 --
1515 IF l_enb.enrt_bnft_id IS NOT NULL THEN
1516 --
1517 OPEN c_ecr_enb(p_acty_base_rt_id4);
1518 FETCH c_ecr_enb INTO l_ecr4; -- l_enrt_rt_id4;
1519 IF c_ecr_enb%NOTFOUND THEN
1520 CLOSE c_ecr_enb ;
1521 if g_debug then
1522 hr_utility.set_location('BEN_94535_ECR_NOT_FOUND'|| to_char(p_person_id),54);
1523 end if;
1524 fnd_message.set_name('BEN','BEN_94535_ECR_NOT_FOUND');
1525 fnd_message.set_token('PROC',l_proc);
1526 fnd_message.set_token('PERSON_ID', to_char(p_person_id));
1527 fnd_message.set_token('ABR_ID', to_char(p_acty_base_rt_id4));
1528 fnd_message.set_token('RT_VAL', to_char(p_rt_val4));
1529 fnd_message.set_token('ANN_RT_VAL', to_char(p_ann_rt_val4));
1530 fnd_message.raise_error;
1531 --
1532 ELSE
1533 --
1534 IF l_ecr4.rt_strt_dt_cd = 'ENTRBL' THEN
1535 IF p_rt_strt_dt4 IS NOT NULL THEN
1536 --
1537 l_ecr4.rt_strt_dt := p_rt_strt_dt4 ;
1538 --
1539 ELSE
1540 --Throw Error
1541 if g_debug then
1542 hr_utility.set_location('BEN_94552_NO_RT_STRT_DT'|| to_char(p_person_id),54);
1543 end if;
1544 CLOSE c_ecr_enb;
1545 fnd_message.set_name('BEN','BEN_94552_NO_RT_STRT_DT');
1546 fnd_message.set_token('PACKAGE',l_proc);
1547 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1548 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1549 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1550 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1551 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1552 fnd_message.raise_error;
1553 --
1554 END IF;
1555 END IF;
1556 --
1557 IF l_ecr4.entr_val_at_enrt_flag = 'Y' THEN
1558 --
1559 IF p_rt_val4 IS NOT NULL OR p_ann_rt_val4 IS NOT NULL THEN
1560 l_ecr4.val := p_rt_val4 ;
1561 l_ecr4.ann_val := p_ann_rt_val4;
1562 ELSE
1563 --Throw error- rates need to be entered
1564 if g_debug then
1565 hr_utility.set_location('BEN_94555_NO_RATE_VAL'|| to_char(p_person_id),54);
1566 end if;
1567 CLOSE c_ecr_enb;
1568 fnd_message.set_name('BEN','BEN_94555_NO_RATE_VAL');
1569 fnd_message.set_token('PACKAGE',l_proc);
1570 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1571 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1572 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1576 --
1573 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1574 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1575 fnd_message.raise_error;
1577 END IF;
1578 --
1579 ELSE
1580 null ; --ignore supplied rates.
1581 END IF;
1582 END IF;
1583 --
1584 CLOSE c_ecr_enb;
1585 --
1586 ELSE
1587 --
1588 OPEN c_ecr(p_acty_base_rt_id4);
1589 FETCH c_ecr INTO l_ecr4; -- l_enrt_rt_id4;
1590 IF c_ecr%NOTFOUND THEN
1591 CLOSE c_ecr ;
1592 if g_debug then
1593 hr_utility.set_location('BEN_94535_ECR_NOT_FOUND'|| to_char(p_person_id),54);
1594 end if;
1595 fnd_message.set_name('BEN','BEN_94535_ECR_NOT_FOUND');
1596 fnd_message.set_token('PROC',l_proc);
1597 fnd_message.set_token('PERSON_ID', to_char(p_person_id));
1598 fnd_message.set_token('ABR_ID', to_char(p_acty_base_rt_id4));
1599 fnd_message.set_token('RT_VAL', to_char(p_rt_val4));
1600 fnd_message.set_token('ANN_RT_VAL', to_char(p_ann_rt_val4));
1601 fnd_message.raise_error;
1602 --
1603 ELSE
1604 --
1605 IF l_ecr4.rt_strt_dt_cd = 'ENTRBL' THEN
1606 IF p_rt_strt_dt4 IS NOT NULL THEN
1607 --
1608 l_ecr4.rt_strt_dt := p_rt_strt_dt4 ;
1609 --
1610 ELSE
1611 --Throw Error
1612 if g_debug then
1613 hr_utility.set_location('BEN_94552_NO_RT_STRT_DT'|| to_char(p_person_id),54);
1614 end if;
1615 CLOSE c_ecr;
1616 fnd_message.set_name('BEN','BEN_94552_NO_RT_STRT_DT');
1617 fnd_message.set_token('PACKAGE',l_proc);
1618 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1619 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1620 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1621 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1622 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1623 fnd_message.raise_error;
1624 --
1625 END IF;
1626 END IF;
1627 --
1628 IF l_ecr4.entr_val_at_enrt_flag = 'Y' THEN
1629 --
1630 IF p_rt_val4 IS NOT NULL OR p_ann_rt_val4 IS NOT NULL THEN
1631 l_ecr4.val := p_rt_val4 ;
1632 l_ecr4.ann_val := p_ann_rt_val4;
1633 ELSE
1634 --Throw error- rates need to be entered
1635 if g_debug then
1636 hr_utility.set_location('BEN_94555_NO_RATE_VAL'|| to_char(p_person_id),54);
1637 end if;
1638 CLOSE c_ecr;
1639 fnd_message.set_name('BEN','BEN_94555_NO_RATE_VAL');
1640 fnd_message.set_token('PACKAGE',l_proc);
1641 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1642 fnd_message.set_token('LER_ID', to_char(p_ler_id));
1643 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1644 fnd_message.set_token('PLAN_ID', to_char(p_pl_id));
1645 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
1646 fnd_message.raise_error;
1647 --
1648 END IF;
1649 --
1650 ELSE
1651 null ; --ignore supplied rates.
1652 END IF;
1653 --
1654 END IF;
1655 --
1656 CLOSE c_ecr;
1657 --
1658 END IF;
1659 --
1660 END IF;
1661 --
1662 -- WAENT --1 Prior or Enterable
1663 -- ENTRBL - Enterable -- Start date
1664 --
1665 ben_election_information.election_information
1666 (p_validate => p_validate
1667 ,p_elig_per_elctbl_chc_id => l_epe.elig_per_elctbl_chc_id
1668 ,p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id
1669 ,p_effective_date => p_effective_date
1670 ,p_enrt_mthd_cd => 'E'
1671 ,p_enrt_bnft_id => l_enb.enrt_bnft_id
1672 ,p_bnft_val => l_enb.val
1673 ,p_enrt_cvg_strt_dt => l_epe.enrt_cvg_strt_dt
1674 ,p_enrt_cvg_thru_dt => p_enrt_cvg_thru_dt
1675 ,p_enrt_rt_id1 => l_ecr1.enrt_rt_id
1676 ,p_prtt_rt_val_id1 => l_prtt_rt_val_id1
1677 ,p_rt_val1 => l_ecr1.val
1678 ,p_ann_rt_val1 => l_ecr1.ann_val
1679 ,p_rt_strt_dt1 => p_rt_strt_dt1
1680 ,p_rt_end_dt1 => p_rt_end_dt1
1681 ,p_enrt_rt_id2 => l_ecr2.enrt_rt_id
1682 ,p_prtt_rt_val_id2 => l_prtt_rt_val_id2
1683 ,p_rt_val2 => l_ecr2.val
1684 ,p_ann_rt_val2 => l_ecr2.ann_val
1685 ,p_rt_strt_dt2 => p_rt_strt_dt2
1686 ,p_rt_end_dt2 => p_rt_end_dt2
1687 ,p_enrt_rt_id3 => l_ecr3.enrt_rt_id
1688 ,p_prtt_rt_val_id3 => l_prtt_rt_val_id3
1689 ,p_rt_val3 => l_ecr3.val
1690 ,p_ann_rt_val3 => l_ecr3.ann_val
1691 ,p_rt_strt_dt3 => p_rt_strt_dt3
1692 ,p_rt_end_dt3 => p_rt_end_dt3
1693 ,p_enrt_rt_id4 => l_ecr4.enrt_rt_id
1697 ,p_rt_strt_dt4 => p_rt_strt_dt4
1694 ,p_prtt_rt_val_id4 => l_prtt_rt_val_id4
1695 ,p_rt_val4 => l_ecr4.val
1696 ,p_ann_rt_val4 => l_ecr4.ann_val
1698 ,p_rt_end_dt4 => p_rt_end_dt4
1699 ,p_prtt_rt_val_id5 => l_prtt_rt_val_id5
1700 ,p_prtt_rt_val_id6 => l_prtt_rt_val_id6
1701 ,p_prtt_rt_val_id7 => l_prtt_rt_val_id7
1702 ,p_prtt_rt_val_id8 => l_prtt_rt_val_id8
1703 ,p_prtt_rt_val_id9 => l_prtt_rt_val_id9
1704 ,p_prtt_rt_val_id10 => l_prtt_rt_val_id10
1705 ,p_datetrack_mode => l_datetrack_mode
1706 ,p_suspend_flag => l_suspend_flag
1707 ,p_called_from_sspnd => 'N'
1708 ,p_effective_start_date => l_effective_start_date
1709 ,p_effective_end_date => l_effective_end_date
1710 ,p_object_version_number => l_object_version_number
1711 ,p_prtt_enrt_interim_id => l_prtt_enrt_interim_id
1712 ,p_business_group_id => p_business_group_id
1713 ,p_dpnt_actn_warning => l_dpnt_actn_warning
1714 ,p_bnf_actn_warning => l_bnf_actn_warning
1715 ,p_ctfn_actn_warning => l_ctfn_actn_warning);
1716 --
1717 --Set the Original Coverage Start Date
1718 IF p_orgnl_enrt_dt IS NOT NULL and l_prtt_enrt_rslt_id IS NOT NULL THEN
1719 --
1720 update ben_prtt_enrt_rslt_f
1721 set ORGNL_ENRT_DT = p_orgnl_enrt_dt
1722 where prtt_enrt_rslt_id = l_prtt_enrt_rslt_id ;
1723 --
1724 END IF;
1725 --
1726 else --De Enroll from plan (dax)
1727 --
1728 --Get Ended Enrollment Result
1729 --
1730 get_current_pen
1731 (p_effective_date => p_effective_date,
1732 p_life_event_date => p_life_event_date,
1733 p_person_id => p_person_id,
1734 p_pgm_id => p_pgm_id,
1735 p_pl_id => p_ended_pl_id,
1736 p_opt_id => p_ended_opt_id,
1737 p_bnft_val => p_ended_bnft_val,
1738 p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id,
1739 p_object_version_number => l_object_version_number
1740 );
1741 --
1742 if l_prtt_enrt_rslt_id is null then
1743 --
1744 --Check for already ended enrollments
1745 --
1746 get_ended_pen
1747 (p_effective_date => p_effective_date,
1748 p_life_event_date => p_life_event_date,
1749 p_person_id => p_person_id,
1750 p_pgm_id => p_pgm_id,
1751 p_pl_id => p_ended_pl_id,
1752 p_opt_id => p_ended_opt_id,
1753 p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id
1754 );
1755 --
1756 if l_prtt_enrt_rslt_id is not null then
1757 --
1758 --Raise error saying that enrollment has already been ended.
1759 --
1760 fnd_message.set_name('BEN','BEN_94658_PLN_ALRDY_DE_ENRLD');
1761 fnd_message.set_token('PACKAGE',l_proc);
1762 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1763 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1764 fnd_message.set_token('PL_ID', to_char(p_ended_pl_id));
1765 fnd_message.set_token('OPT_ID',to_char(p_ended_opt_id));
1766 fnd_message.set_token('PER_ENR_RSLT_ID',to_char(l_prtt_enrt_rslt_id));
1767 fnd_message.set_token('LE_DATE', p_life_event_date);
1768 fnd_message.raise_error;
1769 --
1770 else
1771 --
1772 --No Enrollment open/ended were found. Invalid data entered. Raise error
1773 --
1774 fnd_message.set_name('BEN','BEN_94659_NO_PLN_FOR_DE_ENRL');
1775 fnd_message.set_token('PACKAGE',l_proc);
1776 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1777 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
1778 fnd_message.set_token('PL_ID', to_char(p_ended_pl_id));
1779 fnd_message.set_token('OPT_ID',to_char(p_ended_opt_id));
1780 fnd_message.set_token('LE_DATE', p_life_event_date);
1781 fnd_message.raise_error;
1782 --
1783 end if;
1784 --
1785 end if;
1786 --
1787 --Proceed with de-enrolling from the specified plan
1788 --
1789 fnd_file.put_line
1790 (which => fnd_file.log,
1791 buff => 'l_prtt_enrt_rslt_id '||l_prtt_enrt_rslt_id);
1792 --
1793 ben_prtt_enrt_result_api.delete_enrollment
1794 (p_validate => p_validate
1795 ,p_per_in_ler_id => l_pil.per_in_ler_id
1796 ,p_lee_rsn_id => null --?
1797 ,p_enrt_perd_id => null --?
1798 ,p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id
1799 ,p_business_group_id => p_business_group_id
1800 ,p_effective_start_date => l_effective_start_date
1801 ,p_effective_end_date => l_effective_end_date
1802 ,p_object_version_number => l_object_version_number
1803 ,p_effective_date => p_effective_date
1804 ,p_datetrack_mode => l_datetrack_mode
1805 ,p_multi_row_validate => false --??
1806 ,p_source => null --?
1807 ,p_enrt_cvg_thru_dt => p_enrt_cvg_thru_dt --?
1808 ,p_mode => null); --?
1809 --
1813 --
1810 end if; --End of if(l_enroll_flag)
1811 --
1812 hr_utility.set_location('Leaving:'||l_proc, 20);
1814 exception when others then
1815 raise ;
1816 end enrollment_information_detail;
1817 --
1818 -- --------------------------------------------------------------------------------
1819 -- |-----------------------------< ELECTION_INFORMATION >-------------------------|
1820 -- -------------------------------------------------------------------------------+
1821 --
1822 procedure post_enrollment
1823 (p_validate in boolean default false
1824 ,p_person_id in number
1825 ,p_ler_id in number
1826 ,p_life_event_date in date
1827 ,p_pgm_id in number default null
1828 ,p_pl_id in number default null
1829 -- ,p_flx_cr_flag in varchar2 default 'N'
1830 ,p_proc_cd in varchar2 default null
1831 ,p_business_group_id in number
1832 ,p_effective_date in date ) is
1833 --
1834 l_proc varchar2(60) := 'ben_process_enrollment.post_enrollment';
1835 --
1836 cursor c_pgm is
1837 select pgm_typ_cd
1838 from ben_pgm_f pgm
1839 where pgm.pgm_id = p_pgm_id
1840 and p_life_event_date between pgm.effective_start_date
1841 and pgm.effective_end_date ;
1842 --
1843 cursor c_pil is
1844 select pil.per_in_ler_id
1845 from ben_per_in_ler pil
1846 where pil.ler_id =p_ler_id
1847 and pil.person_id = p_person_id
1848 and pil.lf_evt_ocrd_dt = p_life_event_date
1849 and pil.per_in_ler_stat_cd = 'STRTD' ;
1850 --
1851 l_per_in_ler_id NUMBER(15);
1852 l_pgm_typ_cd hr_lookups.lookup_code%TYPE;
1853 l_flx_cr_flag VARCHAR2(30) := 'N';
1854 --
1855 begin
1856 --
1857 hr_utility.set_location('Entering:'||l_proc, 20);
1858 --
1859 IF p_pgm_id IS NOT NULL THEN
1860 OPEN c_pgm ;
1861 FETCH c_pgm INTO l_pgm_typ_cd ;
1862 CLOSE c_pgm;
1863 --
1864 IF l_pgm_typ_cd in ('FLEX','FPC') THEN
1865 --
1866 l_flx_cr_flag := 'Y';
1867 --
1868 END IF;
1869 --
1870 END IF;
1871 --
1872 OPEN c_pil;
1873 FETCH c_pil INTO l_per_in_ler_id;
1874 --
1875 IF c_pil%NOTFOUND THEN
1876 CLOSE c_pil ;
1877 --
1878 if g_debug then
1879 hr_utility.set_location('BEN_94534_PIL_NOT_FOUND'|| to_char(p_person_id),54);
1880 end if;
1881 fnd_message.set_name('BEN','BEN_94534_PIL_NOT_FOUND');
1882 fnd_message.set_token('PROC',l_proc);
1883 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
1884 fnd_message.set_token('LER_ID',to_char(p_ler_id));
1885 fnd_message.set_token('LE_DATE', p_life_event_date);
1886 fnd_message.raise_error;
1887 --
1888 END IF;
1889 --
1890 CLOSE c_pil;
1891 --
1892 ben_proc_common_enrt_rslt.set_elcn_made_or_asnd_dt
1893 (p_validate => p_validate
1894 ,p_per_in_ler_id => l_per_in_ler_id
1895 ,p_pgm_id => p_pgm_id
1896 ,p_pl_id => p_pl_id
1897 ,p_enrt_mthd_cd => 'E'
1898 ,p_business_group_id => p_business_group_id
1899 ,p_effective_date => p_effective_date);
1900 --
1901 ben_prtt_enrt_result_api.multi_rows_edit
1902 (p_person_id => p_person_id
1903 ,p_per_in_ler_id => l_per_in_ler_id
1904 ,p_pgm_id => p_pgm_id
1905 ,p_business_group_id => p_business_group_id
1906 ,p_effective_date => p_effective_date);
1907 --
1908 ben_proc_common_enrt_rslt.process_post_results
1909 (p_validate => p_validate
1910 ,p_person_id => p_person_id
1911 ,p_per_in_ler_id => l_per_in_ler_id
1912 ,p_flx_cr_flag => l_flx_cr_flag
1913 ,p_enrt_mthd_cd => 'E'
1914 ,p_business_group_id => p_business_group_id
1915 ,p_effective_date => p_effective_date
1916 ,p_self_service_flag => false
1917 ,p_pgm_id => p_pgm_id
1918 ,p_pl_id => p_pl_id);
1919 --
1920 ben_proc_common_enrt_rslt.process_post_enrollment
1921 (p_validate => p_validate
1922 ,p_person_id => p_person_id
1923 ,p_per_in_ler_id => l_per_in_ler_id
1924 ,p_pgm_id => p_pgm_id
1925 ,p_pl_id => p_pl_id
1926 ,p_enrt_mthd_cd => 'E'
1927 ,p_cls_enrt_flag => false
1928 ,p_proc_cd => p_proc_cd
1929 ,p_business_group_id => p_business_group_id
1930 ,p_effective_date => p_effective_date);
1931 --
1932 hr_utility.set_location('Leaving:'||l_proc, 20);
1933 --
1934 exception when others then
1935 raise ;
1936 end post_enrollment ;
1937 --
1938 procedure create_enrollment
1939 (p_validate in boolean default false
1940 ,p_pgm_id in number default null
1941 ,p_pl_id in number default null
1942 ,p_opt_id in number default null
1946 ,p_ended_opt_id in number default null
1943 ,p_ler_id in number
1944 ,p_life_event_date in date
1945 ,p_ended_pl_id in number default null
1947 ,p_ended_bnft_val in number default null
1948 ,p_effective_date in date
1949 ,p_person_id in number
1950 ,p_bnft_val in number default null
1951 ,p_acty_base_rt_id1 in number default null
1952 ,p_rt_val1 in number default null
1953 ,p_ann_rt_val1 in number default null
1954 ,p_rt_strt_dt1 in date default null
1955 ,p_rt_end_dt1 in date default null
1956 ,p_acty_base_rt_id2 in number default null
1957 ,p_rt_val2 in number default null
1958 ,p_ann_rt_val2 in number default null
1959 ,p_rt_strt_dt2 in date default null
1960 ,p_rt_end_dt2 in date default null
1961 ,p_acty_base_rt_id3 in number default null
1962 ,p_rt_val3 in number default null
1963 ,p_ann_rt_val3 in number default null
1964 ,p_rt_strt_dt3 in date default null
1965 ,p_rt_end_dt3 in date default null
1966 ,p_acty_base_rt_id4 in number default null
1967 ,p_rt_val4 in number default null
1968 ,p_ann_rt_val4 in number default null
1969 ,p_rt_strt_dt4 in date default null
1970 ,p_rt_end_dt4 in date default null
1971 ,p_business_group_id in number
1972 ,p_enrt_cvg_strt_dt in date default null
1973 ,p_enrt_cvg_thru_dt in date default null
1974 ,p_orgnl_enrt_dt in date default null
1975 ,p_proc_cd in varchar2 default null
1976 ,p_record_typ_cd in varchar2 ) IS
1977 --
1978 l_proc varchar2(60) := 'ben_enrollment_process.create_enrollment' ;
1979 --
1980 begin
1981 --
1982 hr_utility.set_location('Entering:'||l_proc||':'||p_record_typ_cd, 20);
1983 --Bug 5259118
1984 -- IF fnd_global.conc_request_id = -1 THEN
1985 --
1986 ben_env_object.init(p_business_group_id => p_business_group_id,
1987 p_effective_date => p_effective_date,
1988 p_thread_id => 1,
1989 p_chunk_size => 1,
1990 p_threads => 1,
1991 p_max_errors => 1,
1992 p_benefit_action_id => null);
1993 --
1994 -- END IF;
1995 --
1996 IF upper(p_record_typ_cd) = 'ENROLL' THEN
1997 --
1998 enrollment_information_detail
1999 (p_validate => p_validate
2000 ,p_pgm_id => p_pgm_id
2001 ,p_pl_id => p_pl_id
2002 ,p_opt_id => p_opt_id
2003 ,p_ler_id => p_ler_id
2004 ,p_life_event_date => p_life_event_date
2005 ,p_ended_pl_id => p_ended_pl_id
2006 ,p_ended_opt_id => p_ended_opt_id
2007 ,p_effective_date => p_effective_date
2008 ,p_person_id => p_person_id
2009 ,p_bnft_val => p_bnft_val
2010 ,p_acty_base_rt_id1 => p_acty_base_rt_id1
2011 ,p_rt_val1 => p_rt_val1
2012 ,p_ann_rt_val1 => p_ann_rt_val1
2013 ,p_rt_strt_dt1 => p_rt_strt_dt1
2014 ,p_rt_end_dt1 => p_rt_end_dt1
2015 ,p_acty_base_rt_id2 => p_acty_base_rt_id2
2016 ,p_rt_val2 => p_rt_val2
2017 ,p_ann_rt_val2 => p_ann_rt_val2
2018 ,p_rt_strt_dt2 => p_rt_strt_dt2
2019 ,p_rt_end_dt2 => p_rt_end_dt2
2020 ,p_acty_base_rt_id3 => p_acty_base_rt_id3
2021 ,p_rt_val3 => p_rt_val3
2022 ,p_ann_rt_val3 => p_ann_rt_val3
2023 ,p_rt_strt_dt3 => p_rt_strt_dt3
2024 ,p_rt_end_dt3 => p_rt_end_dt3
2025 ,p_acty_base_rt_id4 => p_acty_base_rt_id4
2026 ,p_rt_val4 => p_rt_val4
2027 ,p_ann_rt_val4 => p_ann_rt_val4
2028 ,p_rt_strt_dt4 => p_rt_strt_dt4
2029 ,p_rt_end_dt4 => p_rt_end_dt4
2030 ,p_business_group_id => p_business_group_id
2031 ,p_enrt_cvg_strt_dt => p_enrt_cvg_strt_dt
2032 ,p_enrt_cvg_thru_dt => p_enrt_cvg_thru_dt
2033 ,p_orgnl_enrt_dt => p_orgnl_enrt_dt
2034 );
2035 --
2036 ELSIF upper(p_record_typ_cd) = 'POST' THEN
2037 --
2038 --NK
2039 --Changes to eliminate summary row in Enrollment Upload Spreadsheet.
2040 --If the record type is POST, this is the last record of the group
2041 --So, first do the enrollment and then run the post enrollment process
2042 enrollment_information_detail
2043 (p_validate => p_validate
2044 ,p_pgm_id => p_pgm_id
2045 ,p_pl_id => p_pl_id
2046 ,p_opt_id => p_opt_id
2047 ,p_ler_id => p_ler_id
2048 ,p_life_event_date => p_life_event_date
2049 ,p_ended_pl_id => p_ended_pl_id
2050 ,p_ended_opt_id => p_ended_opt_id
2054 ,p_acty_base_rt_id1 => p_acty_base_rt_id1
2051 ,p_effective_date => p_effective_date
2052 ,p_person_id => p_person_id
2053 ,p_bnft_val => p_bnft_val
2055 ,p_rt_val1 => p_rt_val1
2056 ,p_ann_rt_val1 => p_ann_rt_val1
2057 ,p_rt_strt_dt1 => p_rt_strt_dt1
2058 ,p_rt_end_dt1 => p_rt_end_dt1
2059 ,p_acty_base_rt_id2 => p_acty_base_rt_id2
2060 ,p_rt_val2 => p_rt_val2
2061 ,p_ann_rt_val2 => p_ann_rt_val2
2062 ,p_rt_strt_dt2 => p_rt_strt_dt2
2063 ,p_rt_end_dt2 => p_rt_end_dt2
2064 ,p_acty_base_rt_id3 => p_acty_base_rt_id3
2065 ,p_rt_val3 => p_rt_val3
2066 ,p_ann_rt_val3 => p_ann_rt_val3
2067 ,p_rt_strt_dt3 => p_rt_strt_dt3
2068 ,p_rt_end_dt3 => p_rt_end_dt3
2069 ,p_acty_base_rt_id4 => p_acty_base_rt_id4
2070 ,p_rt_val4 => p_rt_val4
2071 ,p_ann_rt_val4 => p_ann_rt_val4
2072 ,p_rt_strt_dt4 => p_rt_strt_dt4
2073 ,p_rt_end_dt4 => p_rt_end_dt4
2074 ,p_business_group_id => p_business_group_id
2075 ,p_enrt_cvg_strt_dt => p_enrt_cvg_strt_dt
2076 ,p_enrt_cvg_thru_dt => p_enrt_cvg_thru_dt
2077 ,p_orgnl_enrt_dt => p_orgnl_enrt_dt
2078 );
2079 --
2080 post_enrollment
2081 (p_validate => p_validate
2082 ,p_person_id => p_person_id
2083 ,p_ler_id => p_ler_id
2084 ,p_life_event_date => p_life_event_date
2085 ,p_pgm_id => p_pgm_id
2086 ,p_pl_id => p_pl_id
2087 ,p_proc_cd => p_proc_cd
2088 ,p_business_group_id => p_business_group_id
2089 ,p_effective_date => p_effective_date );
2090 --
2091 ELSE
2092 --
2093 if g_debug then
2094 hr_utility.set_location('BEN_94536_RECORD_TYPE_ERROR'|| to_char(p_person_id),54);
2095 end if;
2096 fnd_message.set_name('BEN','BEN_94536_RECORD_TYPE_ERROR');
2097 fnd_message.set_token('PROC',l_proc);
2098 fnd_message.set_token('PERSON_ID',p_record_typ_cd);
2099 fnd_message.raise_error;
2100 --
2101 END IF;
2102 --
2103 exception when others then
2104 raise ;
2105 end create_enrollment ;
2106 --
2107 procedure process_dependent
2108 (p_validate in boolean default false
2109 ,p_person_id in number
2110 ,p_pgm_id in number default null
2111 ,p_pl_id in number default null
2112 ,p_opt_id in number default null
2113 ,p_ler_id in number
2114 ,p_life_event_date in date
2115 ,p_effective_date in date
2116 ,p_contact_person_id in number
2117 ,p_business_group_id in number
2118 ,p_cvg_strt_dt in date default null
2119 ,p_cvg_thru_dt in date default null
2120 ,p_multi_row_actn in boolean default false
2121 ,p_record_typ_cd in varchar2 ) is
2122 --
2123 l_proc varchar2(60) := 'ben_enrollment_process.process_dependent';
2124 --
2125 l_pil c_pil%ROWTYPE;
2126 --
2127 l_epe c_epe_oipl%ROWTYPE;
2128 l_egd c_egd%ROWTYPE;
2129 l_dt_mode varchar2(30) := hr_api.g_update; --5675220
2130 l_elig_cvrd_dpnt_id number;
2131 l_dummy_date date;
2132 l_ovn number;
2133 l_person_id number := p_person_id;
2134 l_pgm_id number := p_pgm_id;
2135 l_pl_id number := p_pl_id;
2136 l_opt_id number := p_opt_id;
2137 l_ler_id number := p_ler_id;
2138 l_life_event_date date := p_life_event_date;
2139 l_contact_person_id number := p_contact_person_id;
2140 l_cvg_strt_dt date := p_cvg_strt_dt;
2141 l_pd_cvg_strt_dt date ;
2142 l_cvg_thru_dt date := p_cvg_thru_dt;
2143 l_record_typ_cd varchar2(30) := p_record_typ_cd;
2144 l_returned_strt_dt date ;
2145 l_returned_end_dt date ;
2146 --
2147 begin
2148 --
2149 hr_utility.set_location('Entering:'||l_proc, 20);
2150 --
2151 --Bug 5259118
2152 -- IF fnd_global.conc_request_id = -1 THEN
2153 --
2154 ben_env_object.init(p_business_group_id => p_business_group_id,
2155 p_effective_date => p_effective_date,
2156 p_thread_id => 1,
2157 p_chunk_size => 1,
2158 p_threads => 1,
2159 p_max_errors => 1,
2160 p_benefit_action_id => null);
2161 --
2162 -- END IF;
2163 --
2164 IF l_person_id = hr_api.g_number THEN
2165 l_person_id := null;
2166 END IF;
2167 --
2168 IF l_pgm_id = hr_api.g_number THEN
2169 l_pgm_id := null;
2170 END IF;
2171 --
2172 IF l_pl_id = hr_api.g_number THEN
2173 l_pl_id := null;
2174 END IF;
2175 --
2176 IF l_opt_id = hr_api.g_number THEN
2177 l_opt_id := null;
2178 END IF;
2179 --
2183 --
2180 IF l_ler_id = hr_api.g_number THEN
2181 l_ler_id := null;
2182 END IF;
2184 IF l_life_event_date = hr_api.g_date THEN
2185 l_life_event_date := null;
2186 END IF;
2187 --
2188 IF l_contact_person_id = hr_api.g_number THEN
2189 l_contact_person_id := null;
2190 END IF;
2191 --
2192 IF l_cvg_strt_dt = hr_api.g_date THEN
2193 l_cvg_strt_dt := null;
2194 END IF;
2195 --
2196 IF l_cvg_thru_dt = hr_api.g_date THEN
2197 l_cvg_thru_dt := null;
2198 END IF;
2199 --
2200 IF l_record_typ_cd = hr_api.g_varchar2 THEN
2201 l_record_typ_cd := 'ENROLL' ;
2202 END IF;
2203 --
2204 fnd_file.put_line
2205 (which => fnd_file.log,
2206 buff => 'Entering - BEN_ENROLLMENT_PROCESS.PROCESS_DEPENDENT' );
2207 fnd_file.put_line
2208 (which => fnd_file.log,
2209 buff => 'l_person_id '||l_person_id||' l_pgm_id '||l_pgm_id||' l_pl_id '||l_pl_id);
2210 --
2211 fnd_file.put_line
2212 (which => fnd_file.log,
2213 buff => 'l_opt_id '||l_opt_id||' l_ler_id '||l_ler_id);
2214 fnd_file.put_line
2215 (which => fnd_file.log,
2216 buff => 'l_record_typ_cd '||l_record_typ_cd);
2217 fnd_file.put_line
2218 (which => fnd_file.log,
2219 buff => 'l_life_event_date '||l_life_event_date||' l_contact_person_id '||l_contact_person_id);
2220 fnd_file.put_line
2221 (which => fnd_file.log,
2222 buff => 'l_cvg_strt_dt '||l_cvg_strt_dt||' l_cvg_thru_dt '||l_cvg_thru_dt);
2223 --
2224 get_pil
2225 (p_person_id => l_person_id,
2226 p_ler_id => l_ler_id,
2227 p_life_event_date => l_life_event_date,
2228 p_pil => l_pil
2229 );
2230 --
2231 fnd_file.put_line
2232 (which => fnd_file.log,
2233 buff => 'l_pil.per_in_ler_id '||l_pil.per_in_ler_id);
2234 --Get EPE
2235 IF l_pil.per_in_ler_id IS NOT NULL THEN
2236 get_epe
2237 (p_person_id => l_person_id,
2238 p_per_in_ler_id => l_pil.per_in_ler_id,
2239 p_life_event_date => l_life_event_date,
2240 p_opt_id => l_opt_id,
2241 p_pl_id => l_pl_id,
2242 p_pgm_id => l_pgm_id,
2243 p_epe => l_epe
2244 ) ;
2245 fnd_file.put_line
2246 (which => fnd_file.log,
2247 buff => 'l_epe.elig_per_elctbl_chc_id '||l_epe.elig_per_elctbl_chc_id);
2248 --
2249 --Find if there is a valid enrollment result exists for this epe and pil
2250 --If not throw error.
2251 --
2252 check_pen
2253 (p_per_in_ler_id => l_pil.per_in_ler_id,
2254 p_prtt_enrt_rslt_id => l_epe.prtt_enrt_rslt_id );
2255 --
2256 --You can't designate a person if the person is not enrolled in this plan
2257 --or option in plan.
2258 --
2259 --
2260 IF l_epe.elig_per_elctbl_chc_id IS NOT NULL THEN
2261 --
2262 /*
2263 --Now Get the Depdenent Coverage Start Date derived.
2264 if l_EPE.DPNT_CVG_STRT_DT_CD is not null then
2265 --
2266 --
2267 ben_determine_date.main
2268 (p_cache_mode => false
2269 ,p_date_cd => l_epe.dpnt_cvg_strt_dt_cd
2270 ,p_per_in_ler_id => l_pil.per_in_ler_id
2271 ,p_person_id => p_person_id
2272 ,p_pgm_id => l_epe.pgm_id
2273 ,p_pl_id => l_epe.pl_id
2274 ,p_oipl_id => l_epe.oipl_id
2275 ,p_elig_per_elctbl_chc_id => l_epe.elig_per_elctbl_chc_id
2276 ,p_business_group_id => p_business_group_id
2277 ,p_formula_id => l_epe.dpnt_cvg_strt_dt_rl
2278 ,p_acty_base_rt_id => null
2279 ,p_bnfts_bal_id => null
2280 ,p_effective_date => p_effective_date
2281 ,p_lf_evt_ocrd_dt =>null
2282 ,p_returned_date => l_pd_cvg_strt_dt
2283 ,p_start_date => null
2284 ,p_param1 => 'CON_PERSON_ID'
2285 ,p_param1_value => p_contact_person_id
2286 ,p_parent_person_id=>null
2287 ,p_enrt_cvg_end_dt =>null
2288 ,p_comp_obj_mode =>true
2289 ,p_fonm_cvg_strt_dt =>null
2290 ,p_fonm_rt_strt_dt =>null
2291 -- ,p_cmpltd_dt =>null
2292 );
2293 --
2294 end if;
2295 */
2296 ben_prtt_enrt_result_api.calc_dpnt_cvg_dt(
2297 p_calc_end_dt => true,
2298 P_calc_strt_dt => true,
2299 P_per_in_ler_id => l_pil.per_in_ler_id,
2300 p_person_id => l_person_id,
2301 p_pgm_id => l_pgm_id,
2302 p_pl_id => l_pl_id,
2303 p_oipl_id => l_epe.oipl_id,
2304 p_ptip_id => l_epe.ptip_id,
2305 p_ler_id => l_ler_id,
2306 p_elig_per_elctbl_chc_id => l_epe.elig_per_elctbl_chc_id,
2307 p_business_group_id => p_business_group_id,
2308 p_effective_date => p_effective_date,
2309 p_enrt_cvg_end_dt => null,
2310 p_returned_strt_dt => l_returned_strt_dt,
2311 p_returned_end_dt => l_returned_end_dt);
2312 --
2313 IF l_cvg_thru_dt IS NULL THEN
2314 l_returned_end_dt := NULL;
2315 ELSIF l_cvg_thru_dt <> l_returned_end_dt THEN
2316 --Make entry in log file indicating mismatch between the supplied and plan design Coverge Through Date.
2317 fnd_file.put_line
2318 (which => fnd_file.log,
2319 buff => 'Mismatch found between supplied and plan design Dependant Coverage Through Date. Using the date in Plan Design: '||l_returned_end_dt);
2320 NULL;
2321 end if;
2322 --
2323 IF l_cvg_strt_dt is NULL THEN
2324 NULL;
2325 ELSIF l_cvg_strt_dt <> l_returned_strt_dt THEN
2326 IF l_cvg_thru_dt IS NULL THEN --Check for thru date null again,so that start date warning is printed only when enrolling dependants.
2327 --Make entry in log file indicating mismatch between the supplied and plan design Coverge Start Date.
2328 fnd_file.put_line
2329 (which => fnd_file.log,
2330 buff => 'Mismatch found between supplied and plan design Dependant Coverage Start Date. Using the date in Plan Design: '||l_returned_strt_dt);
2331 END IF;
2332 END IF;
2333 --
2334 /*
2335 if l_cvg_strt_dt is null then
2336 --
2337 l_cvg_strt_dt := l_pd_cvg_strt_dt;
2338 --
2339 end if;
2340 */
2341 --
2342 IF l_record_typ_cd = 'ENROLL' THEN
2343 --
2344 get_egd
2345 (p_per_in_ler_id => l_pil.per_in_ler_id,
2346 p_dpnt_person_id => l_contact_person_id,
2347 p_elig_per_elctbl_chc_id => l_epe.elig_per_elctbl_chc_id,
2348 p_egd => l_egd
2349 );
2350 --
2351 fnd_file.put_line
2352 (which => fnd_file.log,
2353 buff => ' l_egd.elig_dpnt_id '||l_egd.elig_dpnt_id);
2354 --
2355 IF l_egd.elig_dpnt_id IS NOT NULL THEN
2356 --
2357 ben_elig_dpnt_api.process_dependent(
2358 p_validate => p_validate
2359 ,p_elig_dpnt_id => l_egd.elig_dpnt_id
2360 ,p_business_group_id => p_business_group_id
2361 ,p_effective_date => p_effective_date
2362 ,p_cvg_strt_dt => l_returned_strt_dt -- l_cvg_strt_dt --If in EGD take it
2363 ,p_cvg_thru_dt => l_returned_end_dt -- NVL(l_returned_end_dt,l_egd.elig_thru_dt)
2364 ,p_datetrack_mode => l_dt_mode
2365 ,p_elig_cvrd_dpnt_id => l_elig_cvrd_dpnt_id
2366 ,p_effective_start_date => l_dummy_date
2367 ,p_effective_end_date => l_dummy_date
2368 ,p_object_version_number => l_ovn
2372 --
2369 ,p_multi_row_actn => p_multi_row_actn);
2370 --
2371 END IF;
2373 ELSIF l_record_typ_cd = 'POST' THEN
2374 --NK
2375 --Changes to eliminate summary row in Enrollment Upload Spreadsheet.
2376 --If the record type is POST, this is the last record of the group
2377 --So, first process the dependent information and then run the post process.
2378 --
2379 get_egd
2380 (p_per_in_ler_id => l_pil.per_in_ler_id,
2381 p_dpnt_person_id => l_contact_person_id,
2382 p_elig_per_elctbl_chc_id => l_epe.elig_per_elctbl_chc_id,
2383 p_egd => l_egd
2384 );
2385 --
2386 fnd_file.put_line
2387 (which => fnd_file.log,
2388 buff => ' l_egd.elig_dpnt_id '||l_egd.elig_dpnt_id);
2389 --
2390 IF l_egd.elig_dpnt_id IS NOT NULL THEN
2391 --
2392 ben_elig_dpnt_api.process_dependent(
2393 p_validate => p_validate
2394 ,p_elig_dpnt_id => l_egd.elig_dpnt_id
2395 ,p_business_group_id => p_business_group_id
2396 ,p_effective_date => p_effective_date
2397 ,p_cvg_strt_dt => l_returned_strt_dt -- l_cvg_strt_dt --If in EGD take it
2398 ,p_cvg_thru_dt => l_returned_end_dt -- NVL(l_returned_end_dt,l_egd.elig_thru_dt) --If Entered take it
2399 ,p_datetrack_mode => l_dt_mode
2400 ,p_elig_cvrd_dpnt_id => l_elig_cvrd_dpnt_id
2401 ,p_effective_start_date => l_dummy_date
2402 ,p_effective_end_date => l_dummy_date
2403 ,p_object_version_number => l_ovn
2404 ,p_multi_row_actn => p_multi_row_actn);
2405 --
2406 END IF;
2407 --
2408 -- POST PROCESS
2409 --
2410 IF l_epe.prtt_enrt_rslt_id IS NOT NULL THEN
2411 --
2412 ben_elig_cvrd_dpnt_api.dpnt_actn_items(
2413 p_prtt_enrt_rslt_id => l_epe.prtt_enrt_rslt_id,
2414 p_elig_cvrd_dpnt_id => null,
2415 p_effective_date => p_effective_date,
2416 p_business_group_id => p_business_group_id,
2417 p_datetrack_mode => l_dt_mode);
2418 --
2419 ben_elig_cvrd_dpnt_api.chk_max_num_dpnt_for_pen(
2420 p_prtt_enrt_rslt_id => l_epe.prtt_enrt_rslt_id,
2421 p_effective_date => p_effective_date,
2422 p_business_group_id => p_business_group_id);
2423 --
2424 END IF;
2425 --
2426 ELSE
2427 --Throw Error invalid record type
2428 if g_debug then
2429 hr_utility.set_location('BEN_94536_RECORD_TYPE_ERROR'|| to_char(p_person_id),54);
2430 end if;
2431 fnd_message.set_name('BEN','BEN_94536_RECORD_TYPE_ERROR');
2432 fnd_message.set_token('PROC',l_proc);
2433 fnd_message.set_token('PERSON_ID',l_record_typ_cd);
2434 fnd_message.raise_error;
2435 --
2436 END IF;
2437 --
2438 END IF;
2439 ELSE
2440 if g_debug then
2441 hr_utility.set_location('BEN_94534_PIL_NOT_FOUND'|| to_char(p_person_id),54);
2442 end if;
2443 fnd_message.set_name('BEN','BEN_94534_PIL_NOT_FOUND');
2444 fnd_message.set_token('PROC',l_proc);
2445 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
2446 fnd_message.set_token('LER_ID',to_char(p_ler_id));
2447 fnd_message.set_token('LE_DATE', p_life_event_date);
2448 fnd_message.raise_error;
2449 --
2450 END IF;
2451 --
2452 exception when others then
2453 --
2454 raise;
2455 --
2456 end process_dependent;
2457 --
2458 -- --------------------------------------------------------------------------------
2459 -- |-----------------------------< PROCESS_BENEFICIARY >-------------------------|
2460 -- -------------------------------------------------------------------------------+
2461 procedure process_beneficiary
2462 (p_validate in boolean default false
2463 ,p_person_id in number
2464 ,p_pgm_id in number default null
2465 ,p_pl_id in number default null
2466 ,p_opt_id in number default null
2467 ,p_bnft_val in number default null
2468 ,p_ler_id in number
2469 ,p_life_event_date in date
2470 ,p_effective_date in date
2471 ,p_bnf_person_id in number
2472 ,p_business_group_id in number
2473 ,p_dsgn_strt_dt in date default null
2474 ,p_dsgn_thru_dt in date default null
2475 ,p_prmry_cntngnt_cd in varchar2
2476 ,p_pct_dsgd_num in number
2477 ,p_amt_dsgd_val in number default null
2478 ,p_amt_dsgd_uom in varchar2 default null
2479 ,p_addl_instrn_txt in varchar2 default null
2480 ,p_multi_row_actn in boolean default true
2481 ,p_organization_id in number default null
2482 ,p_ttee_person_id in number default null
2483 ,p_record_typ_cd in varchar2 ) is
2484 --
2485 l_proc varchar2(60) := 'ben_enrollment_information_detail.process_beneficiary';
2486 l_prtt_enrt_rslt_id number;
2487 l_object_version_number number;
2488 l_pl_bnf_id number;
2489 l_dummy_date date;
2490 l_pil c_pil%ROWTYPE;
2491 l_epe c_epe_oipl%ROWTYPE;
2492 l_bnf c_bnf%ROWTYPE;
2493 l_dt_mode varchar2(30);
2494 l_person_id number := p_person_id;
2495 l_dsgn_strt_dt date := p_dsgn_strt_dt;
2496 l_dsgn_thru_dt date := p_dsgn_thru_dt;
2497 l_bnft_val number := p_bnft_val;
2498 l_pgm_id number := p_pgm_id;
2502 l_life_event_date date := p_effective_date;
2499 l_pl_id number := p_pl_id;
2500 l_opt_id number := p_opt_id;
2501 l_ler_id number := p_ler_id;
2503 l_prmry_cntngnt_cd varchar2(30) := p_prmry_cntngnt_cd;
2504 l_bnf_person_id number := p_bnf_person_id;
2505 l_pct_dsgd_num number := p_pct_dsgd_num;
2506 l_amt_dsgd_val ben_pl_bnf_f.amt_dsgd_val%TYPE := p_amt_dsgd_val;
2507 l_amt_dsgd_uom ben_pl_bnf_f.amt_dsgd_uom%TYPE := p_amt_dsgd_uom;
2508 l_addl_instrn_txt ben_pl_bnf_f.addl_instrn_txt%TYPE := p_addl_instrn_txt;
2509 l_organization_id number := p_organization_id;
2510 l_ttee_person_id number := p_ttee_person_id;
2511 l_bnf_actn_warning boolean;
2512 l_suspend_flag varchar2(30);
2513 l_rslt_object_version_number number(9);
2514 l_record_typ_cd varchar2(30) := p_record_typ_cd;
2515 --
2516 cursor get_rslt_ovn_c is
2517 select object_version_number,
2518 sspndd_flag
2519 from ben_prtt_enrt_rslt_f
2520 where prtt_enrt_rslt_id = l_prtt_enrt_rslt_id
2521 and business_group_id = p_business_group_id
2522 and p_effective_date
2523 between effective_start_date and effective_end_date;
2524 --
2525 begin
2526 hr_utility.set_location('Entering:'||l_proc, 20);
2527 --
2528 --Bug 5259118
2529 -- IF fnd_global.conc_request_id = -1 THEN
2530 --
2531 ben_env_object.init(p_business_group_id => p_business_group_id,
2532 p_effective_date => p_effective_date,
2533 p_thread_id => 1,
2534 p_chunk_size => 1,
2535 p_threads => 1,
2536 p_max_errors => 1,
2537 p_benefit_action_id => null);
2538 --
2539 -- END IF;
2540 --
2541 IF l_dsgn_strt_dt = hr_api.g_date THEN
2542 l_dsgn_strt_dt := NULL;
2543 END IF;
2544 --
2545 IF l_dsgn_thru_dt = hr_api.g_date THEN
2546 l_dsgn_thru_dt := NULL;
2547 END IF;
2548 --
2549 IF l_bnft_val = hr_api.g_number THEN
2550 l_bnft_val := null;
2551 END IF;
2552 --
2553 IF l_amt_dsgd_val = hr_api.g_number THEN
2554 l_amt_dsgd_val := null;
2555 END IF;
2556 --
2557 IF l_amt_dsgd_uom = hr_api.g_varchar2 THEN
2558 l_amt_dsgd_uom := null;
2559 END IF;
2560 --
2561 IF l_addl_instrn_txt = hr_api.g_varchar2 THEN
2562 l_addl_instrn_txt := null;
2563 END IF;
2564 --
2565 IF l_organization_id = hr_api.g_number THEN
2566 l_organization_id := NULL ;
2567 END IF;
2568 --
2569 IF l_ttee_person_id = hr_api.g_number THEN
2570 l_ttee_person_id := NULL;
2571 END IF;
2572 --
2573 IF l_record_typ_cd = hr_api.g_varchar2 THEN
2574 l_record_typ_cd := 'ENROLL';
2575 END IF;
2576 --
2577 fnd_file.put_line
2578 (which => fnd_file.log,
2579 buff => 'Entering - ben_enrollment_process.process_beneficiary' );
2580 --
2581 fnd_file.put_line
2582 (which => fnd_file.log,
2583 buff => 'l_person_id '||l_person_id||' l_pgm_id '||l_pgm_id||' l_pl_id '||l_pl_id);
2584 --
2585 fnd_file.put_line
2586 (which => fnd_file.log,
2587 buff => 'l_opt_id '||l_opt_id||' l_bnft_val '||l_bnft_val||' l_ler_id '||l_ler_id);
2588 fnd_file.put_line
2589 (which => fnd_file.log,
2590 buff => 'l_pct_dsgd_num '||l_pct_dsgd_num||' l_amt_dsgd_val '||l_amt_dsgd_val);
2591 fnd_file.put_line
2592 (which => fnd_file.log,
2593 buff => 'l_addl_instrn_txt '||l_addl_instrn_txt);
2594 fnd_file.put_line
2595 (which => fnd_file.log,
2596 buff => 'l_organization_id '||l_organization_id||' l_ttee_person_id '||l_ttee_person_id);
2597 fnd_file.put_line
2598 (which => fnd_file.log,
2599 buff => 'l_life_event_date '||l_life_event_date||' l_bnf_person_id '||l_bnf_person_id);
2600 fnd_file.put_line
2601 (which => fnd_file.log,
2602 buff => 'l_dsgn_strt_dt '||l_dsgn_strt_dt||' l_dsgn_thru_dt '||l_dsgn_thru_dt);
2603 fnd_file.put_line
2604 (which => fnd_file.log,
2605 buff => 'l_record_typ_cd '||l_record_typ_cd);
2606 --
2607 get_pil
2608 (p_person_id => l_person_id,
2609 p_ler_id => l_ler_id,
2610 p_life_event_date => l_life_event_date,
2611 p_pil => l_pil
2612 );
2613 --
2614 --Get Ended Enrollment Result
2615 get_current_pen
2616 (p_effective_date => p_effective_date,
2617 p_life_event_date => l_life_event_date,
2618 p_person_id => l_person_id,
2619 p_pgm_id => l_pgm_id,
2620 p_pl_id => l_pl_id,
2621 p_opt_id => l_opt_id,
2622 p_bnft_val => l_bnft_val,
2623 p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id,
2624 p_object_version_number => l_object_version_number
2625 );
2626 --
2627 IF l_prtt_enrt_rslt_id IS NULL THEN
2628 --
2629 fnd_message.set_name('BEN','BEN_94614_NO_PEN_FOR_BNF');
2630 fnd_message.set_token('PROC',l_proc);
2631 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
2632 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
2633 fnd_message.set_token('PL_ID',to_char(p_pl_id));
2634 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
2635 fnd_message.set_token('PER_IN_LER_ID',to_char(l_pil.per_in_ler_id));
2636 fnd_message.set_token('LE_DATE',p_life_event_date);
2637 fnd_message.raise_error;
2638 --
2639 END IF;
2640 --
2641 open get_rslt_ovn_c;
2642 fetch get_rslt_ovn_c into l_rslt_object_version_number,
2646 IF l_pil.per_in_ler_id IS NULL THEN
2643 l_suspend_flag;
2644 close get_rslt_ovn_c;
2645 --
2647 --
2648 if g_debug then
2649 hr_utility.set_location('BEN_94534_PIL_NOT_FOUND'|| to_char(p_person_id),54);
2650 end if;
2651 fnd_message.set_name('BEN','BEN_94534_PIL_NOT_FOUND');
2652 fnd_message.set_token('PROC',l_proc);
2653 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
2654 fnd_message.set_token('LER_ID',to_char(p_ler_id));
2655 fnd_message.set_token('LE_DATE', p_life_event_date);
2656 fnd_message.raise_error;
2657 --
2658 END IF ;
2659 --
2660 get_pbn
2661 (p_effective_date => p_effective_date,
2662 p_bnf_person_id => l_bnf_person_id,
2663 p_organization_id => l_organization_id,
2664 p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id,
2665 p_bnf => l_bnf
2666 );
2667 --
2668 IF l_bnf.pl_bnf_id IS NULL and l_prtt_enrt_rslt_id IS NOT NULL and
2669 l_dsgn_thru_dt IS NULL THEN
2670 --
2671 ben_plan_beneficiary_api.create_plan_beneficiary
2672 ( p_validate => p_validate
2673 ,p_pl_bnf_id => l_pl_bnf_id
2674 ,p_effective_start_date => l_dummy_date
2675 ,p_effective_end_date => l_dummy_date
2676 ,p_business_group_id => p_business_group_id
2677 ,p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id
2678 ,p_bnf_person_id => l_bnf_person_id
2679 ,p_organization_id => l_organization_id
2680 ,p_prmry_cntngnt_cd => l_prmry_cntngnt_cd
2681 ,p_pct_dsgd_num => l_pct_dsgd_num
2682 ,p_amt_dsgd_val => l_amt_dsgd_val
2683 ,p_amt_dsgd_uom => l_amt_dsgd_uom
2684 ,p_dsgn_strt_dt => l_dsgn_strt_dt
2685 ,p_dsgn_thru_dt => l_dsgn_thru_dt
2686 ,p_object_version_number => l_object_version_number
2687 ,p_per_in_ler_id => l_pil.per_in_ler_id
2688 ,p_effective_date => p_effective_date
2689 ,p_multi_row_actn => p_multi_row_actn
2690 );
2691 --
2692 ELSIF l_bnf.pl_bnf_id IS NOT NULL and l_dsgn_thru_dt IS NULL THEN
2693 --
2694 IF l_bnf.effective_start_date < p_effective_date THEN
2695 l_dt_mode := hr_api.g_update ;
2696 ELSE
2697 l_dt_mode := hr_api.g_correction ;
2698 END IF ;
2699 --
2700 ben_plan_beneficiary_api.update_plan_beneficiary
2701 ( p_validate => p_validate
2702 ,p_pl_bnf_id => l_bnf.pl_bnf_id
2703 ,p_effective_start_date => l_dummy_date
2704 ,p_effective_end_date => l_dummy_date
2705 ,p_business_group_id => p_business_group_id
2706 ,p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id
2707 ,p_bnf_person_id => l_bnf_person_id
2708 ,p_organization_id => l_organization_id
2709 ,p_prmry_cntngnt_cd => l_prmry_cntngnt_cd
2710 ,p_pct_dsgd_num => l_pct_dsgd_num
2711 ,p_amt_dsgd_val => l_amt_dsgd_val
2712 ,p_amt_dsgd_uom => l_amt_dsgd_uom
2713 ,p_dsgn_strt_dt => l_dsgn_strt_dt
2714 ,p_dsgn_thru_dt => l_dsgn_thru_dt
2715 ,p_object_version_number => l_bnf.object_version_number
2716 ,p_per_in_ler_id => l_pil.per_in_ler_id
2717 ,p_effective_date => p_effective_date
2718 ,p_datetrack_mode => l_dt_mode
2719 ,p_multi_row_actn => p_multi_row_actn
2720 );
2721 --
2722 ELSIF l_bnf.pl_bnf_id IS NOT NULL AND l_dsgn_thru_dt IS NOT NULL THEN
2723 --
2724 IF l_bnf.effective_start_date < p_effective_date THEN
2725 l_dt_mode := hr_api.g_update ;
2726 ben_plan_beneficiary_api.update_plan_beneficiary
2727 ( p_validate => p_validate
2728 ,p_pl_bnf_id => l_bnf.pl_bnf_id
2729 ,p_effective_start_date => l_dummy_date
2730 ,p_effective_end_date => l_dummy_date
2731 ,p_business_group_id => p_business_group_id
2732 ,p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id
2733 ,p_bnf_person_id => l_bnf_person_id
2734 ,p_organization_id => l_organization_id
2735 ,p_prmry_cntngnt_cd => l_prmry_cntngnt_cd
2736 ,p_pct_dsgd_num => l_pct_dsgd_num
2737 ,p_amt_dsgd_val => l_amt_dsgd_val
2738 ,p_amt_dsgd_uom => l_amt_dsgd_uom
2739 ,p_dsgn_strt_dt => l_dsgn_strt_dt
2740 ,p_dsgn_thru_dt => l_dsgn_thru_dt
2741 ,p_object_version_number => l_bnf.object_version_number
2742 ,p_per_in_ler_id => l_pil.per_in_ler_id
2743 ,p_effective_date => p_effective_date
2744 ,p_datetrack_mode => l_dt_mode
2745 ,p_multi_row_actn => p_multi_row_actn
2746 );
2747 --
2748 ELSE
2749 --
2750 l_dt_mode := hr_api.g_zap ;
2751 ben_plan_beneficiary_api.delete_plan_beneficiary
2752 (p_validate => p_validate
2753 ,p_pl_bnf_id => l_bnf.pl_bnf_id
2754 ,p_effective_start_date => l_dummy_date
2755 ,p_effective_end_date => l_dummy_date
2756 ,p_business_group_id => p_business_group_id
2757 ,p_object_version_number => l_bnf.object_version_number
2758 ,p_effective_date => p_effective_date
2759 ,p_datetrack_mode => l_dt_mode
2760 ,p_multi_row_actn => true
2761 );
2762 END IF;
2763 --
2764 ELSE
2765 --Bad case why are we here ???
2766 fnd_file.put_line
2767 (which => fnd_file.log,
2768 buff => 'Nothing happended... something wrong...');
2769 fnd_message.set_name('BEN','BEN_94615_BNF_WRONG_IF');
2770 fnd_message.set_token('PROC',l_proc);
2771 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
2772 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
2773 fnd_message.set_token('PL_ID',to_char(p_pl_id));
2774 fnd_message.set_token('OPT_ID',to_char(p_opt_id));
2775 fnd_message.set_token('PER_IN_LER_ID',to_char(l_pil.per_in_ler_id));
2776 fnd_message.set_token('LE_DATE',p_life_event_date);
2777 fnd_message.raise_error;
2778 --
2779 END IF;
2780 --
2781 -- IF l_prtt_enrt_rslt_id IS NOT NULL THEN
2782 IF l_record_typ_cd = 'POST' THEN
2783 --
2784 fnd_file.put_line
2785 (which => fnd_file.log,
2786 buff => 'Calling ben_plan_beneficiary_api.bnf_actn_items');
2787 --
2788 ben_plan_beneficiary_api.bnf_actn_items(
2789 p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id
2790 ,p_pl_bnf_id => l_bnf.pl_bnf_id
2791 ,p_effective_date => p_effective_date
2792 ,p_business_group_id => p_business_group_id
2793 ,p_validate => p_validate
2794 ,p_datetrack_mode => NULL);
2795
2796 /* ben_enrollment_action_items.process_bnf_actn_items(
2797 p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id
2798 ,p_rslt_object_version_number => l_rslt_object_version_number
2799 ,p_effective_date => trunc(p_effective_date)
2800 ,p_business_group_id => p_business_group_id
2801 ,p_validate => p_validate
2802 ,p_datetrack_mode => NULL
2803 ,p_suspend_flag => l_suspend_flag
2804 ,p_bnf_actn_warning => l_bnf_actn_warning
2805 );
2806 */
2807 --
2808 --
2809 END IF;
2810 --
2811 end process_beneficiary ;
2812 --
2813 end ben_enrollment_process;