[Home] [Help]
PACKAGE BODY: APPS.BEN_MANAGE_LIFE_EVENTS
Source
1 package body ben_manage_life_events as
2 /* $Header: benmngle.pkb 120.41.12020000.3 2012/12/11 05:20:51 pvelvano ship $ */
3 --
4 /*
5 +========================================================================+
6 | Copyright (c) 1997 Oracle Corporation |
7 | Redwood Shores, California, USA |
8 | All rights reserved. |
9 +========================================================================+
10 */
11 /*
12 Name
13 Manage Life Events
14 Purpose
15 This package is used to check validity of parameters passed in via SRS
16 or via a PL/SQL function or procedure. This package will then run the
17 BENMNGLE process.
18 History
19 Date Who Version What?
20 ---- --- ------- -----
21 14 Dec 97 G Perry 110.0 Created.
22 15 Dec 97 G Perry 110.1 Changed call to
23 derive_rates_and_facts.
24 04 Jan 98 G Perry 110.2 Added in exception handling
25 and log file reporting.
26 05 Jan 98 G Perry 110.3 Altered parameters so that
27 they are in a more logical
28 order.
29 07 Jan 98 lmcdonal 110.4 Added call to
30 create_related_person_ler
31 13 Jan 98 G Perry 110.5 Fixed parameter names in main
32 process_life_events procedure.
33 Added extra parameters for
34 person_selection_rule_id and
35 comp_selection_rule_id in to
36 called PL/SQL process.
37 14 Jan 98 G Perry 110.6 Added caching of comp object
38 types and messages.
39 14 Jan 98 T Mathers 110.7 Added calls to Pate04r5.
40 15 Jan 98 G Perry 110.8 Changed cache objects
41 variables to match real
42 lookup codes.
43 15 Jan 98 G Perry 110.9 Changed p_validate from a
44 boolean to a character due
45 to SRS not supporting boolean.
46 15 Jan 98 lmcdonal 110.10 Added call to
47 determine_eligibility.
48 16 Jan 98 G Perry 110.11 Added retcode and errbuf
49 which are needed by SRS.
50 18 Jan 98 G Perry 110.12 Added in real messages now
51 seeded in seed11.
52 19 Jan 98 lmcdonal 110.13 Created globals for person,
53 assignment and life event name.
54 Add get_ler_name.
55 21 Jan 98 G Perry 110.14 Created globals
56 g_last_person_failed
57 g_last_plan_failed
58 g_last_prog_failed
59 to handle propergation of comp
60 object failures.
61 22 Jan 98 lmcdonal 110.15 Uncomment determine elig.
62 24 Jan 98 G Perry 110.16 Fixed call to determine elig
63 so runs in every mode bar
64 derivable factor mode.
65 Added id function which
66 returns a bracketed number.
67 25 Jan 98 G Perry 110.17 Added banner for lers.
68 25 Jan 98 G Perry 110.18 Added app_exception exception
69 handler for row handler errors.
70 25 Jan 98 lmcdonal 110.19 Add setting of g_last...failed
71 to exception routine.
72 Change 6 locals from number(38)
73 to number.
74 26 Jan 98 lmcdonal 110.20 Call determine elig and evaluate
75 lers only if person has changed.
76 27 Jan 98 G Perry 110.21 Set g_person_changed so that it
77 takes into account when we get
78 several identical person_ids
79 and ler_ids.
80 27 Jan 98 G Perry 110.22 Changed commit_all_data proc.
81 02 Feb 98 G Perry 110.23 Moved Commit into C code and
82 passed p_validate to C code.
83 02 Feb 98 G Perry 110.24 Changed exception app_exception
84 call so it just raises an error.
85 03 Feb 98 G Perry 110.25 Completely removed
86 app_exception call and capture
87 via when others call.
88 06 Mar 98 G Perry 110.26 Removed commit_all_data procedure
89 Added log_benmngle_statistics
90 Restart, removed lots of logging
91 messages. Chng looping mechanism
92 for comp objects so they are done
93 in one call rather than lots of
94 seperate calls. Added lots of
95 caching routines.
96 16 Mar 98 G Perry 110.27 Added prtn_eff_strt_dt_rl and
97 prtn_eff_end_dt_rl into object
98 cache structure for pl,pgm,oipl.
99 08 Apr 98 G Perry 110.28 Added all multithread logic into
100 package. Added Conc defintion
101 to allow restart and multithread.
102 Cached objects only once now.
103 09 Apr 98 G Perry 110.29 Backport for BD2.
104 09 Apr 98 G Perry 110.30 remove commit in logging part.
105 13 Apr 98 G Perry 110.31 Added logging to PLSQL.
106 20 Apr 98 G Perry 110.32 Fixed cache errors.
107 Added error handling to trap
108 where error occured.
109 Added exception g_life_event
110 _after Clears cache each time.
111 21 Apr 98 G Perry 110.33 Fixed problem with restart.
112 18 May 98 G Perry 110.34 dbsynch up.
113 21 May 98 jcarpent 110.35 Added determine enrolment rqmts
114 27 May 98 G Perry 110.36 Added in fast formula cover calls.
115 27 May 98 jcarpent 110.38 Added elig_per_elctbl_chc_id arg.
116 04 Jun 98 G Perry 110.39 Added in reference to fte_value
117 and total_fte_value. This way we
118 can cache full time equivalents
119 this can be used by BENDRPAR.
120 04 Jun 98 jcarpent 110.40 Restricted call to bendenrr.
121 04 Jun 98 G Perry 110.41 Fixed compilation error and
122 moved output string to correct
123 position following change 110.40
124 05 Jun 98 G Perry 110.42 Add last place variable to
125 call before deenrollment.
126 07 Jun 98 G Perry 110.43 Changed name of package/proc for
127 dependent eligibility Added
128 global for last_pgm_id.
129 Fixed elig_to_prte_rsn_f bug,
130 this is only derived in life
131 event mode.
132 07 Jun 98 Ty Hayden 110.44 Added call to ben_determine_coverage
133 07 Jun 98 G Perry 110.46 Added in scheduled enrollment
134 logic.
135 08 Jun 98 G Perry 110.47 Removed exit statement.
136 08 Jun 98 G Perry 110.48 Fixed skipping of comp objects
137 when eligibility fails for a plan
138 or program.
139 11 Jun 98 G Perry 110.49 Including logic for temporal
140 life event processing.
141 12 Jun 98 Ty Hayden 110.50 Added call to ben_determine_rates
142 12 Jun 98 G Perry 110.51 Fixed error when defaulting
143 person types for contacts.
144 13 Jun 98 G Perry 110.52 Added Message names
145 Added parameter output.
146 14 Jun 98 G Perry 110.53 Added procedure
147 ben_determine_elct_chc_flx_imp.
148 14 Jun 98 G Perry 110.54 Improved life event cursor.
149 18 Jun 98 G Perry 110.55 Fixed when ineligible for
150 program ineligible for plan.
151 Fixed so that scheduled life
152 event is not commited.
153 08 Jul 98 jcarpent 110.56 Added p_popl_enrt_typ_cycl_id arg
154 21 Jul 98 G Perry 110.57 Fixed c_person_life cursor so
155 subselect only picks up detected
156 or unprocessed life events.
157 30 Jul 98 G Perry 110.58 Fixed cursor for percent full
158 time stuff from budget values.
159 Removed hr_lookups from
160 assignment cursor, this is not
161 needed.
162 03 Aug 98 F Martin 110.59 Reordered queries for greater
163 efficiency. These now utilise
164 more efficient indexes.
165 06 Aug 98 G Perry 110.60 Added check_business_rules
166 procedure to easily collate all
167 business rules.
168 Fixed bugs 490,491,492,493,494
169 10 Aug 98 G Perry 110.61 Added in concurrent request
170 columns to create_benefit
171 _actions_api call.
172 11 Aug 98 G Perry 110.62 Validate mode now multi-threads.
173 Moved person_actions code to
174 new module benbatpe.pkb.
175 24 Aug 98 G Perry 110.63 Added new globals to structure
176 for use in bendenrr.
177 26 Aug 98 G Perry 115.33 Moved person_selection_rule
178 into benbatpe.pkb.
179 Fixed wwbug 1129.
180 27 Aug 98 G Perry 115.34 Fixed bug 608.
181 problem was outer-join to
182 per_assignment_budget_values.
183 28 Aug 98 G Perry 115.35 Added check to test for whether
184 electable choices were written
185 for a life event that was being
186 processed.
187 28 Aug 98 G Perry 115.36 Removed logic where we store all
188 old potential life event info.
189 23 Sep 98 G Perry 115.37 Split up code so Prasad can do
190 his whatif functionality in
191 stages.
192 24 Sep 98 G Perry 115.38 Added in code to copy action id
193 to global structure for Prasad.
194 07 Oct 98 G Perry 115.39 Corrections following schema
195 issues. Added slave logic.
196 15 Oct 98 G Perry 115.40 Added new cache info for oipl.
197 20 Oct 98 J Carpenter 115.41 Added new cache info for pl+pgm.
198 20 Oct 98 J Carpenter 115.42 Added new columns to pgm cache
199 24 Oct 98 T Guy 115.43 Moved call to ben_determine_rate
200 inside people loop. Added column
201 person_id to call.
202 25 Oct 98 G Perry 115.45 Added ben_generate_communications
203 26 Oct 98 G Perry 115.46 Added hourly_salaried_code to
204 assignment select to go in cache
205 30 Oct 98 G Perry 115.47 Added in logic for unrestricted
206 enrollment and multiple scheduled
207 enrollment.
208 31 Oct 98 G Perry 115.49 Fixed error messages.
209 02 Nov 98 G Perry 115.50 Used new call to get parameters.
210 10 Nov 98 G Perry 115.51 Validate mode now regularly
211 commits to the logfile. All
212 modes now use true
213 multithreading. Made master
214 process drive from a cursor
215 rather than a global. Used
216 new mathod of writing to cache
217 structure rather than
218 ben_reporting table.
219 23 Nov 98 G Perry 115.52 Added support for rates and
220 factors which means that call
221 to determine_elig_prfls and
222 derive_rates_and_factors have
223 new parameters.
224 07 Dec 98 G Perry 115.53 Added support for object
225 selection rule.
226 17 Dec 98 G Perry 115.54 Added caching logic for logging
227 info.
228 21 Dec 98 G Perry 115.55 Fixed cussor to just bring back
229 unrestricted for unrestricted
230 mode.
231 22 Dec 98 T Guy 115.56 Added ben_determine_rate_chg
232
233 28 Dec 98 J Lamoureux 115.57 Commented out nocopy parameters dflt_
234 enrt_dt and elcn_made_dt in call
235 to person_life_event.
236 31 Dec 98 G Perry 115.58 Added people group to cache
237 and commented out nocopy rate change
238 call. tanie to fix.
239 01 Jan 99 G Perry 115.59 Global g_number_proc_objects was
240 not being reset to 0 in multi-
241 thread process.
242 02 Jan 99 G Perry 115.60 Added call to ben_cel_cache proc.
243 02 Jan 99 G Perry 115.61 Fixed cache_person_ler_information.
244 18 Jan 99 G Perry 115.62 LED V ED
245 18 Jan 99 T Guy 115.63 added lf_evt_ocrd_dt to rate change
246 call.
247 25 Jan 99 G Perry 115.64 Added p_mode variable so that
248 we only call certain stuff under
249 certain conditions. Makes the
250 run faster.
251 08 Feb 99 G Perry 115.65 Added in parameter
252 ptnl_ler_trtmt_cd in call to
253 derive rates and factors.
254 11 Feb 99 G Perry 115.66 Fixed error trace message prior
255 to evaluate life events call.
256 17 Feb 99 G Perry 115.67 Added once_r_cntug_cd and elig
257 flag param to determine_elig_
258 prfls and derive_part_and_rate_
259 facts.
260 18 Feb 99 G Perry 115.68 Support for canonical dates.
261 24 Feb 99 G Perry 115.69 Support for restart process.
262 26 Feb 99 T Guy 115.70 Added ben_determine_chc_ctfn
263 27 Feb 99 G Perry 115.71 Added Concurrent request id to
264 log. Added business_group_id
265 parameter to check_all_slaves
266 _finished procedure.
267 03 Mar 99 G Perry 115.72 Fixed unrestricted mode so it
268 creates batch_ler_info record.
269 09 Mar 99 G Perry 115.73 Changed c_pln cursor so it
270 picks up all plans if none are
271 specified for an enrollment
272 period. Bug 1924.
273 15 Mar 99 G Perry 115.75 Changed parameter order of
274 process procedure per bug 1529.
275 22 Mar 99 Tmathers 115.76 Changed -MON- to /MM/
276 05 Apr 99 mhoyes 115.78 - Un-datetrack of per_in_ler_f changes
277 - Removed DT restriction from
278 process_rows/c_ler_exists.
279 - Modified calls to per_in_ler and
280 ptnl_ler_for_per APIs
281 16-mar-99 pbodla 115.79 - If the supplied mode and mode of
282 winning life event differ, raise
283 error. p_enrt_perd_id parameter
284 added to create_ptnl_ler_for_per
285 in C mode.
286 21-APR-99 mhoyes 115.80 - Added p_popl_enrt_typ_cycl_id to
287 all calls to create_ptnl_ler_for_per
288 22-APR-99 GPerry 115.81 Added call set_potential_ler_id.
289 for temporal mode.
290 22-APR-99 mhoyes 115.82 - Modified call to
291 create_ptnl_ler_for_per and
292 update_ptnl_ler_for_per
293 23-APR-99 GPerry 115.83 Added p_mode to evaluate life
294 event call.
295 22-APR-99 mhoyes 115.84 Modified per in ler calls.
296 29-APR-99 shdas 115.85 Added to parameter list of
297 benutils.formula.
298 06-May-99 TGuy 115.86 uncommented rate change call
299 06-MAY-99 shdas 115.87 Added jurisdiction_code.
300 06-May-99 bbulusu 115.89 Added original_hire_date to the
301 person cache.
302 06-May-99 GPerry 115.90 Backport for Fidelity.
303 06-May-99 GPerry 115.91 Leapfrog from 115.89
304 10-May-99 GPerry 115.92 Backport Fix.
305 10-May-99 GPerry 115.93 Leapfrog from 115.91
306 14-May-99 GPerry 115.94 Support for PLIP and PTIP.
307 15-May-99 GPerry 115.95 Fix for Bug 2107. Ensure only
308 active comp objects are included.
309 18-May-99 GPerry 115.96 Added calls to environment routine.
310 Now we capture the message correctly
311 through the app_exception and
312 g_record_error exceptions.
313 lmcdonal 115.97 Added rudimentary p_comp_object_name
314 for ptip and plip. Also increase
315 length of comp object name in log.
316 20-May-99 jcarpent 115.98 Change enrt_perd_for_pl query to
317 handle no record condition and
318 allow no rows for flex and impt inc
319 27-May-99 G Perry 115.99 Changed c_pgm cursor so we pick
320 up cobra programs last.
321 02-May-99 bbulusu 115.100 Added 3 columns to c_person cursor
322 to fetch into the g_cache_person.
323 06-Jun-99 stee 115.101 Added 3 new cursors,c_pgm2,c_pln2,
324 c_oipl2 to build_comp_object
325 to process the COBRA program last.
326 09-Jun-99 stee 115.102 Only process COBRA last if in
327 life event or unrestricted mode.
328 16-Jun-99 bbulusu 115.103 Added call to ben_person_object to
329 cache info for person being procssed
330 18-Jun-99 G Perry 115.104 Removed FTE code and derived factor
331 life event stuff. This is all
332 cache on demand in the
333 ben_person_object and
334 ben_seeddata_object packages.
335 21-Jun-99 mhoyes 115.105 Added new trace messages.
336 23-Jun-99 G Perry 115.106 Added resetting calls to setenv
337 so that flags are reset correctly.
338 25-Jun-99 G Perry 115.107 Added call to ben_life_object.
339 Removed ben_person_object routine
340 as cache is cache on demand.
341 25-Jun-99 G Perry 115.108 Added p_rec to ben_comp_object.
342 set_object call.
343 28-Jun-99 mhoyes 115.109 Added new trace messages.
344 28-Jun-99 tguy 115.110 Added new call to
345 ben_determine_actual_premium.main
346 01-JUL-99 pbodla 115.111 Changes related with << Life Event Collision >>
347 added call to get_ori_bckdt_pil()
348 added call to p_lf_evt_clps_restore()
349 05-JUL-99 mhoyes 115.112 - Externalised c_pln_nip to
350 ben_pln_cache.nipplnpln_getdets.
351 - Added new trace messages.
352 07-JUL-99 mhoyes 115.113 - Backed out nocopy c_pln_nip cache.
353 07-JUL-99 shdas 115.114 Added setenv for business_group in evaluate_life_events.
354 08-JUL-99 mhoyes 115.115 - Added new trace messages.
355 09-JUL-99 mhoyes 115.116 - Added new trace messages.
356 - Removed + 0s from all cursors.
357 19-JUL-99 stee 115.117 - Fixed c_pln cursor to limit
358 check for enrd_perd_for_pl by
359 business_group_id. Also, do
360 not call actual premium if
361 no choices are created.
362 20-JUL-99 GPerry 115.118 genutils -> benutils package rename
363 26-JUL-99 GPerry 115.119 Removed ben_timing stuff.
364 26-JUL-99 GPerry 115.120 Added calls to dt_fndate.
365 Added call to new
366 create_perf_benefit_actions to
367 reduce bottleneck.
368 Added call to clear_down_cache in
369 benutils package.
370 26-JUL-99 GPerry 115.121 Removed setenv for business_group
371 in evaluate_life_events.
372 27-JUL-99 mhoyes 115.122 - Fixed genutil problems.
373 29-JUL-99 mhoyes 115.123 - Assigned globals to locals in
374 process_comp_objects.
375 - Added new trace messages.
376 - Modified references to benutils.
377 to bentype.
378 10-AUG-99 Gperry 115.124 Removed global references to
379 g_cache_person and the like.
380 Rewrote person_header.
381 24-AUG-99 Gperry 115.125 Fixed p_no_plans flag so it
382 only applies to plans not in
383 programs.
384 26-AUG-99 Gperry 115.126 Added call to benefits assignment
385 if employee assignment is null.
386 31-AUG-99 Gperry 115.127 Changed call to ptnl_ler_for_per.
387 31-AUG-99 mhoyes 115.128 - Added new trace message.
388 01-SEP-99 Gperry 115.129 Changed call to determine
389 eligibility.
390 14-SEP-99 Gperry 115.130 Fixed bug 2907. Life event occurred
391 date is now passed to automatic
392 enrollment routine.
393 15-SEP-99 Gperry 115.131 Added audit log flag to main
394 process procedure.
395 28-SEP-99 Stee 115.132 Changed where clause to select
396 COBRA pgms with a pgm_typ like
397 'COBRA%' instead of COBRA.
398 28-SEP-99 tguy 115.133 Moved closing of per_in_ler to
399 after rate change check. This
400 allows us to avoid duplication
401 and throughing off counts for
402 reporting purposes
403 04-OCT-99 mhoyes 115.134 - Tuned build_comp_object_list.
404 Replaced c_pln and c_oipl with
405 bgpcpp_getdets and bgpcop_getdets.
406 04-OCT-99 stee 115.135 - Added ptip_id to
407 g_cache_person_prtn.
408 04-OCT-99 mhoyes 115.136 - Added calls to flush_global_structures
409 to clear build_comp_object_list
410 plip and oipl caches.
411 08-OCT-99 jcarpent 115.137 - Moved auto_enrt to after rates
412 are created. Fixed some calling_
413 proc tokens
414 13-OCT-99 gperry 115.138 Fix bug 2703.
415 13-OCT-99 gperry 115.139 Fix bug 2960.
416 25-OCT-99 gperry 115.140 Fix bug 3103.
417 03-NOV-99 mhoyes 115.141 - Added comp object filtering
418 to improve performance. After
419 BENDETEL when the comp object
420 for the person is still in-eligible
421 or first time in-eligible then all
422 other processing in the loop is
423 skipped.
424 13-NOV-99 mhoyes 115.142 - Added trace messages.
425 14-NOV-99 gperry 115.143 Added mode to ben_batch_reporting
426 package call.
427 19-NOV-99 GPERRY 115.144 Added new flags.
428 22-NOV-99 PBODLA 115.145 Bug : 3511 : When a potential already
429 sitting and benmngle is ran in scheduled
430 mode with a effective date other than
431 life event occured date a duplicate
432 potential is being created and benmngle
433 is stopping. Use lf_evt_ocrd_dt instead
434 of effective_date in the where clause
435 of c_ler_exists.
436 24-NOV-99 mhoyes 115.146 - Bug : 3511 : Modified c_ler_exists
437 to restict by not in VOIDD and PROCD
438 rather than only DTCTD or UNPROCD
439 - Removed obsolete c_ler_exists cursor
440 from c_ler_exists.
441 24-NOV-99 jcarpent 115.147 - Added more bendenrr globals so pil can
442 be closed when no auto/electable epes
443 are created.
444 12-DEC-99 pbodla 115.148 - Modified c_ler_exists to look for
445 DTCTD or UNPROCD ( chaged not in to in
446 part of where clause)
447 22-DEC-99 gperry 115.149 Modified create_life_person_actions
448 call which occurred due to fix in
449 1096742.
450 30-DEC-99 maagrawa 115.150 Added parameter business_group_id.
451 to ben_determine_rate_chg.main
452 03-FEB-00 mhoyes 115.156 - Added HPAPRTTDE and HPADPNTLC to
453 call to generate communications.
454 - Modified process_comp_object to
455 process local l_comp_obj_tree.
456 - Fixed problem with app_exception. The
457 error from process_life_events is
458 now suppressed rather than raised. The
459 error is raised when max errors is
460 reached.
461 - Rolled back to pre-filtering.
462 07-FEB-00 mhoyes 115.157 - Modified/Added trace messages for
463 profiling.
464 - Fixed bug 1178659. Error was being
465 raised from the g_record_error
466 exception because life event occured
467 date had not been derived. Set the
468 life event occured date to the
469 effective date.
470 10-FEB-00 mhoyes 115.158 - Fixed bug 1169238. The eligibility
471 profile cache was not being cleared
472 down from build_comp_object_list.
473 Called ben_elp_cache.clear_down_cache
474 when comp object list is re-built.
475 - Added clear_init_benmngle_caches to
476 clear caches and globals at the
477 benmngle level. This should also be
478 called from on-line benmngle.
479 - Added call to
480 ben_person_object.clear_down_cache
481 from flush_global_structures. This
482 means that person cache information
483 is cleared between multiple benmngle
484 runs.
485 21-Feb-00 lmcdonal 115.159 load ptip id thru calls to setenv.
486 Bug 1179550.
487 25-Feb-00 mhoyes 115.160 - Added trace messages.
488 - Bug 1179550. Nullified ptip id and
489 plip_id values to avoid multiple
490 program issues.
491 - Revamped elig flags to uses a local
492 record structure rather than globals.
493 - Passed p_comp_obj_tree_row into
494 determine_eligibility. Currently
495 dual supporting ben_env_object
496 comp object globals in parallel
497 with p_comp_obj_tree_row. Bendrpar
498 totally uses p_comp_obj_tree_row but
499 bendetel, bendete2 and benwtprc still
500 need to be moved over.
501 27-Feb-00 stee 115.161 - Added new parameter,
502 p_cbr_tmprl_evt_flag.
503 28-Feb-00 stee 115.162 - Pass p_cbr_tmprl_evt_flag to
504 update benefits action.
505 28-Feb-00 stee 115.163 - Pass p_cbr_tmprl_evt_flag to
506 all relevant procedures.
507 01-MAR-00 pbodla 115.164 - Bug 4186 : Added csd_by_ptnl_ler_for_per
508 to create_related_person_ler call.
509 01-MAR-00 pbodla 115.165 - Do not run restore if electable choices
510 are not created
511 01-MAR-00 pbodla 115.166 - Bug : 4293/1172230 : Message to indicate
512 in what mode benmngle to run in case the
513 supplied mode is different.
514 02-MAR-00 stee 115.167 - Update COBRA qualified beneficiary
515 information if COBRA electable
516 choices exist.
517 03-MAR-00 mhoyes 115.168 - Phased out nocopy ben_env_object for comp
518 objects.
519 04-MAR-00 mhoyes 115.169 - Added comp object cache parameters to
520 load_cache.
521 - Stored parent comp object ID values
522 on the comp object cache.
523 - Added support for elig_tran_state.
524 Phased out nocopy first_inelig and
525 still_inelig flags.
526 04-MAR-00 mhoyes 115.170 - Modified build_comp_object_list to
527 process one comp object per cache
528 row.
529 - Revamped comp object list to reflect
530 the new cache struture.
531 04-MAR-00 mhoyes 115.171 - Fixed problem with parent elig flag
532 at ptip and plip levels.
533 05-MAR-00 mhoyes 115.172 - Fixed problem with cobra oipls
534 in build comp object list. The
535 parent comp object information
536 was not being populated.
537 05-MAR-00 stee 115.173 - Update cobra eligibility
538 only in life event or
539 unrestricted mode.
540 06-MAR-00 gperry 115.174 Changed process_life_events to use
541 nocopy so that we can use locals
542 to trap the number of errors.
543 Also made sure that when max errors
544 is hit the process stops.
545 07-MAR-00 mhoyes 115.175 - Moved build comp object list out
546 to ben_comp_object_list package
547 file bebmbcol.pkh.
548 08-MAR-00 mhoyes 115.176 - Added trace messages for profiling.
549 13-MAR-00 mhoyes 115.177 - Phase 5 performance. Implemented
550 PTIP level comp object filtering
551 in process_comp_objects.
552 14-MAR-00 mhoyes 115.178 - Phase 7 performance. Implemented
553 PLIP level comp object filtering
554 in process_comp_objects.
555 - Initialised comp object cache
556 global from
557 clear_init_benmngle_caches.
558 - Phase 8 performance. Implemented
559 plan and oipl level comp object
560 filtering in process_comp_objects.
561 - created set_up_cobj_part_elig and
562 moved set_up_part_elig from
563 build comp object list to
564 process comp objects.
565 15-MAR-00 mhoyes 115.179 - Modified get_comp_object_name so
566 that comp object ids are not
567 truncated from the audit log.
568 17-MAR-00 mhoyes 115.190 - Fixed eligible parent flag problems.
569 18-MAR-00 mhoyes 115.181 - Fixed filtering problems at PTIP
570 and PLIP levels.
571 21-MAR-00 pbodla 115.182 - Bug : 4919 : c_ler_exists modified
572 ; do not create potential even if a
573 processed potetial exists.
574 23-MAR-00 mhoyes 115.183 - Bug : 4965 : Fixed PLIP and Plan
575 level newly in-eligible problems.
576 - Fixes COBRA related coverage problem.
577 24-MAR-00 mmogel 115.184 - Added p_ntfn_dt to the call to
578 ben_ptnl_ler_for_per_api.create_
579 ptnl_ler_for_per in Procedure
580 evaluate_life_events (bug 4806/
581 1247107)
582 28-MAR-00 mhoyes 115.185 - Fixed benmngle caching issue. Added
583 pgm_id restriction to plan and oipl
584 level restrictions when checking
585 previous eligibility in
586 check_prevelig_compobj.
587 29-MAR-00 mhoyes 115.186 - Fixed 5009. Modified cursors in
588 check_prevelig_compobj to use
589 par_pgm_id rather than pgm_id.
590 30-MAR-00 mhoyes 115.187 - Fixed 1190876. Added logic and
591 routines to eliminate duplicate
592 PTIP processing.
593 - Turned off filtering in temporal
594 mode.
595 30-Mar-00 maagrawa 115.188 - For reporting purposes, to get
596 total person persons processed, add
597 persons processed successfully
598 and persons errored. (1133281).
599 31-Mar-00 gperry 115.189 Added oiplip support.
600 31-Mar-00 gperry 115.190 Fixed WWBUG 1178676.
601 01-Apr-00 stee 115.191 Create benefit assignment
602 for dependent if he/she
603 is found ineligible.
604 04-Apr-00 mhoyes 115.192 - Fixed duplicate PTIP problem at
605 PTIP filtering level for multiple
606 PTIPs wnen track in-eligibility is
607 Y.
608 06-Apr-00 lmcdonal 115.193 debugging messages.
609 06-Apr-00 stee 115.194 Check cobra requirements even
610 if choices are not electable.
611 10-Apr-00 stee 115.195 Only update cobra eligibility
612 dates if event is a cobra qualifying
613 event.
614 12-Apr-00 mhoyes 115.196 - Fixed 5075. Initialised eligible flag
615 on the duplicate PTIP global in
616 check_dupproc_ptip so that
617 it defaults to false. This prevents
618 parent eligibility flags being set
619 incorrectly when the PTIP is filtered.
620 Previously un-initialised the value
621 defaulted to true causing the PTIP
622 to be filtered and the plip below to be
623 processed.
624 14-Apr-00 pbodla 115.197 - Fixed 5093 : When unrestircted ptnl's
625 created notification date is populated.
626 14-Apr-00 stee 115.198 Update cobra info if mode is
627 Unrestricted( for core customers).
628 21-Apr-00 gperry 115.199 Fixed bug 5062 by testing for
629 whether a PTIP has been found when
630 filtering happened at the PTIP
631 level.
632 01 May 00 pbodla 115.200 - Task 131 : Elig dependent rows are
633 created before creating the electable
634 choice rows. Called procedures
635 ben_determine_dpnt_eligibility.main()after
636 calling ben_determine_eligibility.determine_elig_prfls.
637 p_upd_egd_with_epe_id called after
638 electable choice is created to set
639 electable choice id on dependent rows.
640 12 May 00 mhoyes 115.201 - Pulled filtering out nocopy of benmngle into
641 ben_comp_obj_filter.
642 12 May 00 stee 115.202 - Fix c_get_inelig_dpnt_info cursor.
643 15 May 00 mhoyes 115.203 - Called get_comp_object_name
644 procedure only when audit log flag
645 is Y.
646 22 May 00 mhoyes 115.204 - Revamped set_up_cobj_part_elig so that
647 cached current and parent rows are
648 passed down through bendetel and
649 bendete2.
650 23 May 00 mhoyes 115.205 - Passed p_comp_obj_tree_row into
651 enrolment_requirements.
652 24 May 00 mhoyes 115.206 - Called ben_pil_object.clear_down_cache
653 from flush_global_structures.
654 26 May 00 pbodla 115.207 - Bug 5123 : Added p_run_mode, p_enrt_perd_id
655 parameters to determine_elig_prfl proc.
656 31-May-00 gperry 115.208 BP of 115.198 with thread fix.
657 31 May 00 mhoyes 115.209 - Passed through cuurent comp object rows
658 into bendenrr.
659 05 Jun 00 stee 115.210 - Move electable chc certification
660 process into the comp object loop.
661 wwbug #1308629.
662 22 Jun 00 kmahendr 115.211 - Added a cursor in process_comp_objects procedure
663 to check whether pil_elctbl_popl_stat is to be
664 updated to PROCD - wwbug #1277369
665 26 Jun 00 stee 115.212 - Change p_derivable_factors to a
666 code.
667 27 Jun 00 mhoyes 115.213 - Fixed temporal mode audit log problem.
668 - Moved person cache calls out nocopy of bendetel
669 and into process_comp_objects.
670 28 Jun 00 jcarpent 115.214 - Bug 5176, 1329041. Pass more args
671 to bebmfilt.pkb filter_comp_objects.
672 29 Jun 00 mhoyes 115.215 - Passed mode_cd to create_normal_person_actions.
673 05 Jul 00 mhoyes 115.216 - Passed context parameters through to bendrpar.
674 10 Jul 00 mhoyes 115.217 - Bypassed filtering in temporal mode.
675 13 Jul 00 mhoyes 115.218 - Removed context parameters.
676 19 Jul 00 jcarpent 115.218 - 5241,1343362. Added update_defaults
677 26 Jul 00 gperry 115.219 Fixed BUG 5422/1365397.
678 SCheduled enrollment now voided
679 when no changes made to elig,
680 elect, rates, etc.
681 02 Aug 00 mhoyes 115.220 - Moved call to set_temporal_ler_id
682 outside of process_comp_object loop.
683
684 24 Aug 00 mhoyes 115.221 - Memory leaking fixes for bug 1387371.
685 05 Sep 00 pbodla 115.222 - Bug 5422 : Allow different enrollment periods
686 for programs for a scheduled enrollment.
687 p_popl_enrt_typ_cycl_id is removed.
688 06 Sep 00 jcarpent 115.223 - Leapfrog version based on 115.221
689 Fixes bug 1398444. Participation
690 cache was not cleared between people
691 06 Sep 00 jcarpent 115.224 - Merged version of 115.222 with 115.223.
692 18-Sep-00 pbodla 115.225 - Healthnet changes : PB : Added parameter
693 p_lmt_prpnip_by_org_typ_id to
694 Comp objects are now selected based on person's
695 organization id if p_lmt_prpnip_by_org_typ_id is
696 Y.
697 22-Sep-00 gperry 115.226 Added back param
698 p_popl_enrt_typ_cycl_id as otherwise
699 do_multithread bombs.
700 WWBUG 1412825.
701 25-Sep-00 gperry 115.227 Added call to reset life event
702 occurred date when BENMNGLE errors
703 in eveluate_life_events procedure.
704 WWBUG 1412614.
705 26-Sep-00 gperry 115.228 Fixed WWBUG 1412808.
706 Clear pil_cache for cases where a
707 backout may have occurred that
708 called communications.
709
710 27 Sep 00 pbodla 115.229 - Code added due to BUG 5422/1365397,
711 in version 115.219 is removed.
712 - Pil no longer required to be voided
713 if there is no impact of it on
714 eligibility, rates etc.,. It should
715 become processed.
716 05 Oct 00 gperry 115.230 Fixed call to ben_determine_eligibility
717 so that it passes the life event
718 occurred date as p_effective_date
719 when run in selection mode. This
720 is due to how least work in bendete2
721 for Prasads fixes.
722 06 Oct 00 pbodla 115.231 -- Above fix is removed as, the
723 fix should be in bendete2.pkb
724 13 Oct 00 rchase 115.232 ensure caches are cleared properly
725 when processing comp objects.
726 19 OCT 00 rchase 115.233 wwBug1427383 - return correct date for
727 creating dependent benefit assignment
728 07 Nov 00 mhoyes 115.234 - Added comp object loop electable choice
729 context global.
730 - Added clear down cache call for the
731 electable choice list.
732 08 Nov 00 vputtiga 115.235 - Fixed Bug 1485814.
733 g_enrollment_change global set to FALSE.
734 added a call at end of process_comp_objects to
735 ben_prtt_enrt_result.update_person_type_usages
736 Leapfrog based on 115.233.
737 15 Nov 00 jcarpent 115.236 Merged version of 115.235 and 115.234
738 22 Nov 00 tmathers 115.238 Merged version of 115.236 and 115.237
739 05 Jan 01 kmahendr 115.239 Unrestricted life event process changes
740 16 Jan 01 mhoyes 115.240 - Raised the oracle error code for the
741 generic 91665 error.
742 18 Jan 01 mhoyes 115.242 - Leapfrog of 115.240.
743 23 Jan 01 mhoyes 115.242 - Modified the call to coverage for EFC.
744 22 Mar 01 mhoyes 115.244 - Fixed multi-threading problem with
745 g_ler_id which was only being set in
746 the master and not the slaves.
747 28 Mar 01 gvenkata 115.245 - Bug 1696526. Was using lf_evt_ocrd_dt
748 from previous person for caching assignment.
749 - Bug 1636071. In call to benmgle from
750 benauthe g_modified_mode was not being
751 used so open events were not working.
752 09 Apr 01 kmahendr 115.246 - Bug 1543462 - If life event is opened and closed
753 in the same run, benmngle is to use least of sysdate or
754 effective_date to update processed date for active
755 life event
756 23 May 01 mhoyes 115.247 - Added refresh cache call for benelmen cache.
757 01 Jul 01 kmahendr 115.248 - Unrestricted process changes
758 18 Jul 01 ikasire 115.249 Commented the call to default enrollment
759 see details in bug 1874263 or in this
760 package at the place of call to
761 ben_manage_default_enrt.Process_default_enrt
762 19 Jul 01 kmahendr 115.250 - Bug#1871579- Effective date is greater
763 than unrestricted life event started date
764 benmngle errors out. made changes to
765 call ben_person_object.get_object and
766 ben_determine_derive_factors
767 30 Jul 01 pbodla 115.251 - Bug : 1894718 Also treat the electable
768 choices associated with suspended
769 enrollments as in pending work flow.
770 In other words do not delete the electable
771 choices data and other data if the
772 enrollment is in suspended state.
773 02-Aug-01 ikasire 115.251 Bug 1895846 added two new procedures
774 delete_in_pndg_elig_dpnt and
775 reset_elctbl_chc_inpng_flag
776 see bug for more details
777 28-Aug-01 kmahendr 115.252 updating of ben_enrt_rt in U mode
778 removed - Bug#1936976
779 11-Aug-01 kmahendr 115.253 Bug#1900657-Added codes in procedure
780 process_comp_objects
781 25-Sep-01 kmahendr 115.254 Made changes for R mode - private
782 procedure update_elig_row added
783 26-Sep-01 kmahendr 115.255 In R mode report for error not called
784 26-Sep-01 kmahendr 115.256 Only Activity Summary not called
785 05-Oct-01 kmahendr 115.257 Bug#2032672-added l_mode = C before
786 checking of electbl choice created
787 call
788 08-Oct-01 kmahendr 115.259 115.257 brought forward as version
789 115.258 was a leap frog version of
790 115.251 and fix of 115.257
791 26-Oct-01 maagrawa 115.260 Backported to 115.252
792 Do not create choices for "Save for
793 Later" ICD entries.
794 26-Oct-01 maagrawa 115.261 115.259 + 115.260.
795 09-Nov-01 mhoyes 115.262 - Fixed 2105125. Added hint to always
796 use index in cursor c_range_thread.
797 This avoids a full table lock on
798 ben_batch_ranges when running
799 multi-threaded.
800 30-Nov-01 mhoyes 115.263 - Made p_benefit_action_id in/out on
801 process.
802 03-Dec-01 mhoyes 115.264 - Re-enabled mode validation.
803 03-Dec-01 mhoyes 115.265 - dbdrv line.
804 04-Dec-01 kmahendr 115.266 - Bug#2097833 - parameter -p_per_in_ler_id
805 is added to ben_determine_dpnt_eligibility.
806 main call
807 06-Dec-01 mhoyes 115.267 - Fixed concurrent manager problem
808 with new CAGR OUT NOCOPY parameter on process.
809 Added new routine inner_process.
810 07-Dec-01 mhoyes 115.268 - Passed p_per_in_ler_id to
811 enrolment_requirements.
812 11-Dec-01 mhoyes 115.269 - Passed p_per_in_ler_id to
813 update_defaults.
814 19-Dec-01 pbodla 115.270 - CWB Changes : New mode W added for
815 processing comp work bench events.
816 27-Dec-01 pbodla 115.271 - CWB Changes : Added
817 popu_cross_gb_epe_data - to create
818 pil, epe, pel, ecr data for managers
819 who are in different business group
820 ikasire 115.271 - CWB Changes : Added popu_epe_heir
821 to populate performace table.
822 04-Jan-02 pbodla 115.272 - CWB Changes : Call procedure
823 popu_cross_gb_epe_data only in W
824 mode
825 07-Jan-02 rpillay 115.273 - Added Set Verify Off.
826 07-Jan-02 pbodla 115.274 - CWB Changes : Also delete the rows
827 for employees who do not have
828 subordinates and with level -1
829 08-Jan-02 ikasire 115.275 Bug 2172031 changes the order of
830 parameters in cwb_process
831 11-Jan-02 ikasire 115.276 Added a new public procedure
832 rebuild_heirarchy for rebuilding
833 the CWB hierarchy.
834 11-Jan-02 ikasire 115.277 More changes to popu_epe_heir and
835 rebuild_heirarchy
836 11-Jan-02 ikasire 115.278 Bug 2172036 changed a call to
837 after making it from function to
838 procedure with extra assignment_id
839 column.
840 18-Jan-02 mhoyes 115.279 - Fixed restart null benefit action
841 problem. Introduced by CAGR.
842 01-Feb-02 stee 115.280 - Update cobra information for
843 a life event type of 'ENDDSBLTY'.
844 Bug#2068332.
845 12-Feb-02 mhoyes 115.281 - Added write_bft_statistics and
846 init_bft_statistics.
847 - Moved delete_elctbl_choice and
848 update_in_pend_flag to
849 ben_manage_unres_life_events.
850 12-Feb-02 mhoyes 115.282 - Removed dbms_output.
851 15-Feb-02 rpillay 115.283 - Bug# 2214961 removed check for
852 Ineligibility (l_continue_loop)
853 for CWB (l_mode = 'W')
854 19-Feb-02 ikasire 115.284 Bug 2172036 and 2231371 fixes
855 popu_cross_gb_epe_data was not
856 passing assignment_id in the
857 creation of epe
858 27-Feb-02 pabodla 115.285 Bug 2237993 CWB - moved
859 popu_cross_gb_epe_data call form
860 process_rows to internal_process
861 to avoid creating duplicate records
862 for the cross business group.
863 11-Mar-02 mhoyes 115.286 Dependent eligibility tuning.
864 20 Mar 02 tjesumic 115.287 PTIP caching data is refreshed when the
865 current row ptip_id is not matching with
866 cached ptip_id bug 2228464
867 25-Mar-02 rpillay 115.289 Fixed CWB Bugs 2270672 and 2275257
868 13-Jun-02 mhoyes 115.290 - Test harness changes for family Pack C.
869 Called populate_benmngle_rbvs.
870 15-Jul-02 mhoyes 115.291 - Moved out nocopy start_slaves, grab_next_batch_range
871 and check_all_slaves_finished to
872 ben_maintain_benefit_actions.
873 26-Jul-02 pbodla 115.292 - ABSENCES - Added procedure abse_process
874 to process absences. All the changes for
875 absence processing are identified with
876 ABSENCES tag.
877 17-Jul-02 kmahendr 115.293 - ABSENCES - Added looping in process_rows.
878 24-Jul-02 mmudigon 115.294 - ABSENCES - Added logic for exiting out nocopy of loop
879 in case of error
880 14-Aug-02 stee 115.295 COBRA: If person is no longer
881 enrolled in a COBRA program and
882 has no enrollment opportunity,
883 terminate COBRA eligibility.
884 Bug: 1794808.
885 30-Aug-02 ikasire 115.296 CWB Hierarcy changes Bugs 2541072 and 2541065
886 05-Sep-02 lakrish 115.297 Exception g_record_error handled in do_multithread
887 - raised by build_comp_object_list
888 13-Sep-02 pbodla 115.298 2288042 Create 0 level heirarchy data if
889 manager is processed first and
890 employee is processed later benmngle run.
891 18-Sep-02 pbodla 115.299 2288042 Create 0 level heirarchy :
892 tested in hrcwbdvl.
893 25-Sep-02 pbodla 115.300 Bug 2574791 : modified popu_hrchy and
894 rebuild_hrchy to make reassign employee
895 work.
896 28-Oct-02 kmahendr 115.301 Bug#2638681 - effective date is passed instead
897 of lf_evt_ocrd_dt for creating person actions
898 29-Oct-02 mmudigon 115.302 CWB: Bug 2526595 Added proc
899 del_cwb_pil()
900 18-Nov-02 pbodla 115.303 ABSE: 2673323 For every absence life event
901 recache the person data.
902 In absence mode several life events
903 may be processed in single run, so
904 lf_evt_ocrd_dt may change, so recache
905 the person data as of current life
906 event otherwise leads to inconsistent
907 eligibility.
908 01-Dec-02 pabodla 115.304 Arcsing the file with CWB itemization
909 code as commented.
910 09-Dec-02 mmudigon 115.305 CWB itemization code uncommented.
911 18-Dec-02 kmahendr 115.306 Bug#2718215 - logic for updating elcns_made_dt
912 in update_enrt_rt procedure changed
913 31-Dec-02 pbodla 115.307 Bug#2712602 - CWB : When a comp
914 per in ler is backed out nocopy and rerun
915 again rebuild the heirarchy.
916 23-Jan-03 mmudigon 115.308 CWB itemization: Added rt edits.
917 25-Jan-03 pbodla 115.309 GRADE/STEP : added code to support
918 grade/step processing.
919 25-Jan-03 pbodla 115.310 Modified cursor c3 to remove errors.
920 29-Jan-03 kmahendr 115.311 Added a wrapper for Personnel Action Mode
921 30-Jan-03 pbodla 115.312 Added a wrapper for Grade/step
922 progression participation process.
923 06-feb-2003 nhunur 115.313 Commented cursor c2 and an validation in
924 check_business_rules for bug - 2784150
925 10-feb-2003 pbodla 115.314 GRADE/STEP : Added code to support
926 grade/step processing.
927 14-Feb-2003 mmudigon 115.315 CWB itemization: bug fix 2793785
928 modified cursor c5 in check_business
929 14-Feb-2003 rpillay 115.316 HRMS Debug Performance changes to
930 hr_utility.set_location calls
931 24-Feb-2003 mmudigon 115.317 CWB itemization: Bug fix 2801671
932 Make ineligible for plan if not elig
933 for any options
934 07-Mar-2003 nhunur 115.318 Modified code to handle error messages
935 properly. Bug - 2836770.
936 14-Mar-2003 lakrish 115.319 Bug 2840078 check that cwb plans/options
937 do not have coverages attached
938 10-Apr-2003 mhoyes 115.320 - Bug 2900255 - enabled baseline mode
939 for the test harness.
940 11-Apr-2003 tjesumic 115.321 - # 2899702 if the setup is auto enrollment Person Type usages
941 are not create.created in close enrollement
942 because the multi edit is not called , Person Type usages
943 created in multiedit
944 autoenrollment calls update_person_type_usages
945 with g_enrollment_change true
946 27-Apr-03 mmudigon 115.322 - Absences July FP enhancements.
947 Additional param p_abs_historical_mode
948 01-Aug-03 rpgupta 115.323 - 2940151 Grade/ step
949 1. added some parameters to grade_step_process
950 2. Added some checks to procedure
951 check_business_rules
952 19-Aug-03 ikasire 115.324 2940151 GSP Added New Procedure gsp_proc_dflt_auten
953 and call after determine_rates.
954 Need to include pqgspdef.pkh and pqhgsppp.pkh files
955 along with this version.
956 20-Aug-03 rpgupta 115.325 - 2940151 Grade/ step
957 Fixed issues in check_business_rule
958 21-Aug-03 mmudigon 115.326 - 2940151 Grade/ step. Loop through
959 all GSP potential LEs
960 01-Sep-03 hmani 115.327 - 3087889 Passed lf_evt_ocrd_dt to
961 set_up_cobj_part_elig proc instead of effective_date
962 16-Sep-03 pbodla 115.328 - GSP : mode specific get_active_life_
963 event procedure is called.
964 22-Sep-03 rpgupta 115.329 - GSP: Passed GSP parameters from procedure
965 grade_step_process to procedure
966 process
967 26-Sep-03 stee 115.330 - 2894200: If derivable factors
968 parameter is 'NONE' and there are
969 derived factors attached to a
970 compensation object, set it to the
971 default parameter.
972 11-Nov-03 ikasire 115.331 setting g_no_ptnl_ler_id to evaluate in drpar
973 not to trigger potential life events for
974 U,M,W,I,P,A Modes - BUG 3243960
975 26-Nov-03 pbodla 115.332 3216667 : iss_val, mx_elcn_val,
976 mn_elcn_val are passed to cloned rows.
977 22-Dec-03 Indrasen 115.333 CWBGLOBAL New Procedure
978 10-Jan-04 tjesumic 115.334 new cursor c9 added in check_business_rule to validate
979 the cwb task for the budget flag
980 20-Jan-04 ikasire 115.335/338 ben_pep_cache.clear_down_cache called after call to
981 ben_enrolment_requirements.update_defaults as it uses
982 a different effective date
983 21-Jan-04 ikasire 115.339 Added p_trace_plans_flag to CWBGLOBAL procedure
984
985 02-Feb-04 pbodla 115.340 GLOBALCWB : Error
986 BEN_91769_NOONE_TO_PROCESS is not
987 relevant for CWB.
988 Cursor C5 modified such that
989 worksheet rates are not relevant for
990 group plan.
991 16-Feb-04 kmahendr 115.341 Bug#3420298 - dpnt_eligibility calls made in R
992 mode
993 17-Feb-04 kmahendr 115.343 Leapfrog version of 115.341
994 18-Feb-04 tjesumic 115.344 cwb edit , cursor c10,c11 created , c5 edited
995 18-Feb-04 tjesumic 115.345 cwb edit
996 23-Feb-04 mmudigon 115.346 GSP: Selective Eligibility evaluation
997 Changes in process_comp_objects proc
998 27-Feb-04 pbodla 115.347 GLOBALCWB: procedure update_cwb_epe
999 modified not to delete the epe,
1000 calls to del_cwb_pil etc are commented.
1001 02-Mar-04 tjesumic 115.348 cwb cursor c6 validation removed
1002 08-Mar-04 abparekh 115.349 Modified Cursor c2 in check_business_rules to check
1003 that more than one similar type of CWB Rates (except
1004 CWBAHE, CWBGP, CWBRA) are not attached to the same
1005 Plan : Bug 3482033
1006 07-Apr-04 pbodla 115.350 FONM : Added fonm functionality.
1007 Tilak
1008 12-Apr-2004 nhunur 115.351 Bypass generate_communication for GSP mode.
1009 22-Apr-2004 pbodla 115.352 FONM : clear the caches if previous
1010 coverage date is different from current.
1011 New GLOBALCWB messages added.
1012 Some Commented code is deleted.
1013 28-May-04 mmudigon 115.353 OSP fixes to process multiple LEs
1014 31-May-04 abparekh 115.354 Bug : 3658807 Set the message name in evaluate_life_events
1015 before raising exception g_record_error.
1016 16-Jun-04 mmudigon 115.355 GSP fixes to process multiple LEs
1017 18 Aug 04 tjesumic 115.356 ptip_id parameter added for csd_rsd determination
1018 fonm validated for every comp object
1019 23 Aug 04 mmudigon 115.357 CFW. Call to ben_carry_forward
1020 2534391 :NEED TO LEAVE ACTION ITEMS
1021 03-Sep-04 abparekh 115.358 3870204 : Don't error out when criteria does not select
1022 any person. Give message in audit log and complete with Normal status.
1023 28-Sep-04 hmani 115.359 IREC - Front Port of 115.343.15102.4
1024 30-Sep-04 abparekh 115.360 IREC - Set G_LER_ID in do_multithread for subsequent use.
1025 15-Oct-04 abparekh 115.361 GSP Rate Sync changes
1026 18-Oct-04 abparekh 115.362 GSP Rate Sync changes
1027 18-Oct-04 abparekh 115.363 Bug 3964719 : GSP : Get employee step only when progression style
1028 is not Grade Progression.
1029 03-Nov-04 abparekh 115.364 Bug 3975857 Changed definition and usage of cursor C2 in
1030 check_business_rules procedure so that validation works correctly
1031 03-Nov-04 kmahendr 115.365 Bug#3903126 - global variable g_derivable_factor
1032 assigned value inside do_multithread procedure
1033 03-Nov-04 pbodla 115.366 GLOBALCWB :Bug#3968065-Added call to
1034 sum_oipl_rates_and_upd_pl_rate
1035 15-Nov-04 kmahendr 115.367 Unrest. enh changes
1036 03-Dec-04 ikasire 115.368 BUG 4046914
1037 14-Dec-04 pbodla 115.369 bug 4040013 - when sum_oipl_rates_an...
1038 procedure is called, plan id is going as null
1039 so l_cwb_pl_id is passed.
1040 06-Jan-05 ikasire 115.370 Bug 4064635 a call to new Procedure got added
1041 Look for dependent package changes
1042 31-Jan-05 abparekh 115.371 Bug 4149182 Commented the check to prevent rates at plan level
1043 when options attached to the plan.
1044 14-Jan-05 bmanyam 115.372/373 Bug: 4128034. CWB Mode fnd_session needs to be set.
1045 22-feb-05 nhunur 115.374 Bug : 4199099 - Task for group plan need not be 'A'
1046 24-feb-05 tjesumic 115.375 Bug : 4204020 - cache_person_information called after determing LE date
1047 25-Feb-05 abparekh 115.376 Added procedure person_header_new and called it
1048 from process_life_events to separate caching from peson header
1049 29-Feb-05 pbodla 115.377 4214845 : To not skip the comp object
1050 processing if parent object is ineligible.
1051 08-mar-05 nhunur 115.378 GSI Netherlands issue. Added condition to get GRE info
1052 only for US leg code.
1053 10-Mar-05 mmudigon 115.380 Bug 4194337. Added calls to
1054 set_parent_elig_flags in proc
1055 update_elig_per_rows
1056 24-Mar-05 pbodla 115.381 Bug 4258498 - Moved the carry forward results call
1057 after the reinstate call, so that reinstate first
1058 attempt to get back the enrollments first.
1059 25-Mar-05 abparekh 115.382 Bug 4245975 : Rollback in exception g_life_event_after
1060 only for G, M modes
1061 07-Apr-05 mmudigon 115.383 Bug 4234501. Removed Rollback in
1062 exception g_life_event_after
1063 14-Apr-05 kmahendr 115.384 Bug#4291122 - added newly_ineligible condition
1064 to call enrolment_requirement
1065 22-apr-05 nhunur 115.385 All threads should have fnd_sessions populated for FF.
1066 05-May-05 tjesumic 115.386 Fonm Clearing cache for fonm date date is fixed
1067 23-May-05 mmudigon 115.387 Rank and Score Call added
1068 01-jun-05 pbodla 115.388 Bug 4258200 : Budget and reserve rates
1069 can be attached to local plans so that the
1070 data is copied over in the event of
1071 cloning of cwb data.
1072 28-jun-05 nhunur 115.389 for GSP chk elig at PGM level for all prog styles.
1073 26-jul-05 ssarkar 115.390 Bug 4496944 : Handled exception thrown by person_header_new .
1074 03-Aug-05 rbingi 115.391 Bug 4394545: Erroring if cwb_process(BENCOMOD) is submitted through SRS
1075 (Not by other Conc Request)
1076 12-Sep-05 ikasire 115.392 Bug 4463267 added new procedure call update_susp_if_ctfn_flag
1077 22-sep-05 ssarkar 115.393 Bug 4621751 irec2 -- offer assignment
1078 06-Oct-05 rbingi 115.394 Bug 4640014 Added call to ben_manage_unres_life_events.clear_epe_cache
1079 10-nov-05 ssarkar 115.395 IREC2: Called post_irec_process_update.
1080 17-nov-05 nhunur 115.396 bug - 4743143 - gsp changes in check_business_rules, grade_step_process.
1081 03-Jan-06 nhunur 115.397 cwb - changes for person type param.
1082 02-Feb-06 swjain 115.398 CWB Thread Num Enhancement
1083 08-Feb-06 abparekh 115.399 Bug 4875181 - Added p_run_rollup_only to cwb_global_process
1084 28-Feb-06 kmahendr 115.400 Added ben_reopen_ended_result call for
1085 GM issue - Fidelity
1086 14-mar-06 nhunur 115.401 bug 5090149 for cwb
1087 16-Mar-06 kmahendr 115.402 Bug#5089721-added codes to update_elig_per
1088 proc
1089 23-Mar-06 kmahendr 115.403 Bug#5100083 - added parameters to call
1090 ben_reopen_ended_result
1091 04-APR-06 ssarkar 115.404 Bug 5055119 - added end_date_elig_per_rows
1092 22-May-06 pbodla 115.405 Bug 5232223 - Added code to handle the trk inelig flag
1093 If trk inelig flag is set to N at group plan level
1094 then do not create cwb per in ler and all associated data.
1095 29-jul-06 nhunur 115.406 CAGR fix for person selection
1096 20-Sep-06 abparekh 115.407 Bug 5550359 : Passed p_validate correctly to benptnle
1097 Added p_validate to PROCESS_LIFE_EVENTS
1098 and EVALUATE_LIFE_EVENTS
1099 21-sep-06 nhunur 115.408 bug 5534550 - call reopen only for L or C modes
1100 17-oct-06 stee 115.409 bug 5364920 - pass per_in_ler_id to
1101 ben_generate_communication.
1102 30-oct-06 gsehgal 115.410 bug 5618436 - changed in print parameters
1103 16-Nov-06 maagrawa 115.411 5666180. Remove the cwb check (c7)
1104 which prevented plan with only one
1105 salary component.
1106 22-Jan-07 rtagarra 115.412 ICM Changes.
1107 06-Aug-07 rtagarra 115.415 Bug 6321565 : For 'R' mode corrected the if condition to call benutils.get_ler.
1108 04-Dec-07 krupani 115.419 Incorporated changes of defer deenrollment, Bug 6519622, Bug 6373951,
1109 Bug 6373951 and Bug 6390880 from branchline to mainline
1110 10-Mar-08 krupani 115.421 Bug 6404338. Min Max enhancement incorporated in R12 mainline
1111 12-Aug-08 pvelugul 120.28.12010000.2 Bug 6872010: Cleared global variables
1112 g_fonm_cvg_strt_dt and g_fonm_rt_strt_dt
1113 in clear_init_benmngle_caches
1114 12-Aug-08 pvelugul 120.28.12010000.3 Bug 6806014: While processing open, if the winner life event is
1115 a normal life event(mode 'L'), then change the mode on the fly
1116 to 'L' from 'C', instead of raising an exception
1117 17-Apr-09 ksridhar 120.28.12010000.4 Bug 7374364: Added calls to ben_use_cvg_rt_date.clear_fonm_globals
1118 17-Apr-09 ksridhar 120.28.12010000.5 Bug 6491682: For mode S (MPE), passed per_in_ler_id while calling
1119 ben_person_object.get_object to fetch pil row.
1120 30-Apr-09 krupani 120.28.12010000.6 Forward ported fix of bug 8290746
1121 06-Jan-10 krupani 120.28.12010000.8 Bug 8431552: Setting the benmngle mode in the environment variable
1122 24-Oct-10 krupani 120.28.12010000.9 Bug 10206398: Changed datatype of l_output_string to nvarchar2
1123 15-Feb-10 krupani 120.28.12010000.10 Bug 10350428: While processing IREC life event, date tracked assignment
1124 record columns were getting updated with current assignment record.
1125 Fixed the same.
1126 27-Apr-11 krupani 120.28.12010000.11 Bug 12360677 : Forward port of 11i bug 12354919
1127 07-Jul-11 velvanop 120.28.12010000.12 Bug 12711900 : Commented ben_enrolment_requirements.g_auto_choice_created check. Profile 'Ben:Check Enrollment limits' should be validated
1128 even though automatic enrollments are assigned for Life Event. Only when there is no electability
1129 profile validation should happen
1130 13-Sep-11 usaraswa 120.28.12010000.13 Bug 12715758 : In Process_comp_objects while calling ben_comp_obj_filter.filter_comp_objects sending
1131 p_effective_date instead of nvl(l_rec.lf_evt_ocrd_dt,p_effective_date).
1132 14-Dec-11 usaraswa 120.28.12010000.14 Bug 12732878 : Added procedure check_for_first_eligible to check whether the comp objects present in the global variables
1133 ben_determine_eligibility2.g_cache_first_inelig_object,ben_determine_eligibility2.g_cache_first_elig_object
1134 are having any future records are there in ben_elig_per_f and ben_elig_per_opt_f tables.If the future records are present
1135 then inserting the future records in to back up table and deleting the future records.
1136 called the procedure check_for_first_eligible in process_comp_objects.
1137 10-Oct-12 velvanop 120.28.12010000.15 Bug 14484394: Set g_max_errors_allowed for the Participation Process: Compensation Workbench Conc Program
1138 11-Dec-12 velvanop 120.28.12010000.16 Bug 14484281
1139 */
1140 --------------------------------------------------------------------------------
1141 --
1142 g_package varchar2(80) := 'ben_manage_life_events';
1143 g_max_errors_allowed number;
1144 --
1145 -- Process information
1146 --
1147 g_proc_rec ben_type.g_batch_proc_rec;
1148 g_action_rec ben_type.g_batch_action_rec;
1149 g_strt_tm_numeric number;
1150 g_end_tm_numeric number;
1151 g_prev_sysdate date := sysdate;
1152 g_opt_exists boolean;
1153 --
1154 -- Bug 2574791
1155 --
1156 g_rebuild_pl_id number := null;
1157 g_rebuild_lf_evt_ocrd_dt date := null;
1158 g_rebuild_business_group_id number := null;
1159 --
1160 g_debug boolean := hr_utility.debug_enabled;
1161 --
1162 -------------------------------------------------------------------------------
1163 --Bug 12732878 ud changes start
1164 --Added procedure check_for_first_eligible to check whether the comp objects present in the global variables
1165 --ben_determine_eligibility2.g_cache_first_inelig_object,ben_determine_eligibility2.g_cache_first_elig_object
1166 --are having any future records in ben_elig_per_f and ben_elig_per_opt_f tables.If the future records are
1167 --present then inserting the future records in to back up table and deleting the future records.
1168
1169 procedure check_for_first_eligible(
1170 p_per_in_ler_id in number
1171 ,p_person_id in number
1172 ,p_effective_date in date)
1173 is
1174 cursor c_prev_pil(c_per_in_ler_id number ) is
1175 select pil.per_in_ler_id
1176 from ben_per_in_ler pil,
1177 ben_ler_f ler
1178 where pil.per_in_ler_id not in (c_per_in_ler_id)
1179 and pil.person_id = p_person_id
1180 and pil.ler_id = ler.ler_id
1181 and p_effective_date between
1182 ler.effective_start_date and ler.effective_end_date
1183 and ler.typ_cd not in ('IREC', 'SCHEDDU', 'COMP', 'GSP', 'ABS')
1184 and pil.per_in_ler_stat_cd not in('BCKDT', 'VOIDD')
1185 order by pil.lf_evt_ocrd_dt desc;
1186
1187 --
1188
1189 cursor c_elig_rec(c_elig_per_id number,c_per_in_ler_id number) is
1190 select * from ben_elig_per_f
1191 where elig_per_id = c_elig_per_id
1192 and per_in_ler_id = c_per_in_ler_id;
1193
1194 --
1195
1196 cursor c_prev_elig_rec(c_per_in_ler_id number,
1197 c_pgm_id number,
1198 c_pl_id number,
1199 c_ptip_id number,
1200 c_plip_id number,
1201 c_effective_date date) is
1202 select * from ben_elig_per_f pep
1203 where nvl(pep.pgm_id,-1) = nvl(c_pgm_id,-1)
1204 and nvl(pep.pl_id,-1) = nvl(c_pl_id,-1)
1205 and nvl(pep.plip_id,-1) = nvl(c_plip_id ,-1)
1206 and nvl(pep.ptip_id,-1) = nvl(c_ptip_id,-1)
1207 and pep.per_in_ler_id = c_per_in_ler_id
1208 and c_effective_date < pep.effective_start_date;
1209 --
1210
1211 cursor c_prev_elig_opt_rec(c_elig_per_id number,c_per_in_ler_id number) is
1212 select * from ben_elig_per_opt_f epo
1213 where epo.elig_per_id = c_elig_per_id
1214 and epo.per_in_ler_id = c_per_in_ler_id;
1215
1216 --
1217 cursor c_get_end_date_version(c_elig_per_id number,c_effective_date date) is
1218 select epf.effective_end_date,epf.object_version_number
1219 from ben_elig_per_f epf
1220 where epf.elig_per_id = c_elig_per_id
1221 and c_effective_date between epf.effective_start_date
1222 and epf.effective_end_date;
1223 -- and c_effective_date > epf.effective_start_date
1224 -- order by epf.effective_end_date desc;
1225
1226 --
1227
1228 cursor c_get_end_date_version_opt(c_elig_per_opt_id number,c_effective_date date) is
1229 select epo.effective_end_date,epo.object_version_number
1230 from ben_elig_per_opt_f epo
1231 where epo.elig_per_opt_id = c_elig_per_opt_id
1232 and c_effective_date between epo.effective_start_date
1233 and epo.effective_end_date;
1234 -- and c_effective_date > epo.effective_start_date
1235 -- order by epo.effective_end_date;
1236
1237 --
1238
1239 cursor c_get_option( c_elig_per_id number,c_effective_date date) is
1240 select epo.elig_per_opt_id
1241 from ben_elig_per_opt_f epo
1242 where epo.elig_per_id = c_elig_per_id
1243 and c_effective_date between epo.effective_start_date
1244 and epo.effective_end_date;
1245
1246 --
1247 cursor c_get_elig_per_opt_rec(c_elig_per_opt_id number
1248 ,c_pil_id number
1249 ,c_effective_date date) is
1250 select * from ben_elig_per_opt_f epo
1251 where epo.elig_per_opt_id = c_elig_per_opt_id
1252 and epo.per_in_ler_id = c_pil_id;
1253 -- and epo.effective_start_date > c_effective_date;
1254
1255 l_elig_per_rec c_elig_rec%rowtype;
1256 l_fut_elig_per_rec c_prev_elig_rec%rowtype;
1257 l_fut_elig_per_opt_rec c_prev_elig_opt_rec%rowtype;
1258 l_get_end_date_version c_get_end_date_version%rowtype;
1259 l_get_end_date_version_opt c_get_end_date_version_opt%rowtype;
1260 l_get_option c_get_option%rowtype;
1261 l_opt_rec c_get_elig_per_opt_rec%rowtype;
1262
1263 l_proc varchar2(80);
1264 l_per_in_ler_id number;
1265 l_first_num number;
1266 l_max_num number;
1267 l_first_num1 number;
1268 l_max_num1 number;
1269 l_prev_pil_id number;
1270 l_elig_per_id number;
1271 l_effective_start_date date;
1272 l_effective_end_date date;
1273
1274 begin
1275 l_proc := g_package||'.check_for_first_eligible';
1276 hr_utility.set_location('uxx entering '||l_proc,10);
1277 hr_utility.set_location('uxx p_per_in_ler_id '||p_per_in_ler_id,10);
1278 hr_utility.set_location('uxx p_person_id '||p_person_id,10);
1279 hr_utility.set_location('uxx p_effective_date '||p_effective_date,10);
1280
1281 l_first_num := nvl(ben_determine_eligibility2.g_cache_first_elig_object.first,0);
1282 l_max_num := nvl(ben_determine_eligibility2.g_cache_first_elig_object.last,0);
1283 l_first_num1 := nvl(ben_determine_eligibility2.g_cache_first_inelig_object.first,0);
1284 l_max_num1 := nvl(ben_determine_eligibility2.g_cache_first_inelig_object.last,0);
1285
1286 /* this if handles
1287 case 1: track inelig flag:'N'
1288 1.fonm eligible
1289 2.event eligible in same month as fonm
1290 case 2: track inelig flag:'N'
1291 1.event ineligible
1292 2.fonm eligible
1293 3.event eligible in same month as fonm
1294 */
1295 if l_first_num <> 0 then
1296
1297 l_per_in_ler_id := ben_determine_eligibility2.g_cache_first_elig_object(l_first_num).per_in_ler_id;
1298
1299 hr_utility.set_location('uxx l_per_in_ler_id '||l_per_in_ler_id,10);
1300 hr_utility.set_location('uxx l_first_num '||l_first_num,10);
1301 hr_utility.set_location('uxx l_max_num '||l_max_num,10);
1302
1303 if p_per_in_ler_id = l_per_in_ler_id --a
1304 then
1305 open c_prev_pil(l_per_in_ler_id);
1306 fetch c_prev_pil into l_prev_pil_id;
1307 close c_prev_pil;
1308
1309 hr_utility.set_location('l_prev_pil_id '||l_prev_pil_id,10);
1310
1311 for i in l_first_num..l_max_num loop --b
1312
1313 hr_utility.set_location('uxx Start loop',10);
1314 l_elig_per_id :=ben_determine_eligibility2.g_cache_first_elig_object(i).elig_per_id;
1315 hr_utility.set_location('uxx l_elig_per_id '||l_elig_per_id,10);
1316
1317 open c_elig_rec(l_elig_per_id,l_per_in_ler_id);
1318 fetch c_elig_rec into l_elig_per_rec;
1319 close c_elig_rec;
1320
1321 open c_prev_elig_rec(l_prev_pil_id
1322 ,l_elig_per_rec.pgm_id
1323 ,l_elig_per_rec.pl_id
1324 ,l_elig_per_rec.ptip_id
1325 ,l_elig_per_rec.plip_id
1326 ,p_effective_date);
1327 fetch c_prev_elig_rec into l_fut_elig_per_rec;
1328 close c_prev_elig_rec;
1329
1330 hr_utility.set_location('uxx l_fut_elig_per_rec.elig_per_id '||l_fut_elig_per_rec.elig_per_id,10);
1331
1332 if(l_fut_elig_per_rec.elig_per_id is not null) then --c
1333
1334 open c_prev_elig_opt_rec(l_fut_elig_per_rec.elig_per_id,l_prev_pil_id);
1335 loop
1336 fetch c_prev_elig_opt_rec into l_fut_elig_per_opt_rec;
1337 exit when c_prev_elig_opt_rec%notfound;
1338 hr_utility.set_location('uxx l_fut_elig_per_opt_rec.elig_per_opt_id '||l_fut_elig_per_opt_rec.elig_per_opt_id,10);
1339
1340 if (l_fut_elig_per_opt_rec.elig_per_opt_id is not null) then
1341
1342 ben_determine_eligibility3.save_to_restore
1343 (p_current_per_in_ler_id => l_per_in_ler_id
1344 ,p_per_in_ler_id => l_prev_pil_id
1345 ,p_elig_per_id => NUll
1346 ,p_elig_per_opt_id => l_fut_elig_per_opt_rec.elig_per_opt_id
1347 ,p_effective_date => l_fut_elig_per_opt_rec.effective_start_date
1348 );
1349 delete from ben_elig_per_opt_f
1350 where elig_per_opt_id = l_fut_elig_per_opt_rec.elig_per_opt_id;
1351 hr_utility.set_location('option was deleted',10);
1352
1353 end if;
1354 end loop;
1355 close c_prev_elig_opt_rec;
1356
1357 ben_determine_eligibility3.save_to_restore
1358 (p_current_per_in_ler_id => l_per_in_ler_id
1359 ,p_per_in_ler_id => l_prev_pil_id
1360 ,p_elig_per_id => l_fut_elig_per_rec.elig_per_id
1361 ,p_elig_per_opt_id => NULL
1362 ,p_effective_date => l_fut_elig_per_rec.effective_start_date
1363 );
1364
1365 delete from ben_elig_per_f
1366 where elig_per_id = l_fut_elig_per_rec.elig_per_id;
1367 hr_utility.set_location('elig_per_id record deleted',10);
1368
1369 end if; --c
1370 hr_utility.set_location('end loop',10);
1371 end loop; --b
1372 hr_utility.set_location('out loop',10);
1373 end if; --a
1374 end if;
1375 /* This if handles
1376 case 1: track inelig flag 'N'
1377 1.event ineligible
1378 2.fonm eligible
1379 3.event ineligible in the same month as fonm
1380 case 2: track inelig flag 'N'
1381 1.fonm eligible
1382 2.event ineligible in the same month as fonm
1383 case 3: track inelig flag 'N'
1384 1.event eligible
1385 2.event ineligible
1386 3.fonm eligible
1387 4.event ineligible in the same month as fonm.
1388 */
1389
1390 if l_first_num1 <> 0 then
1391
1392 hr_utility.set_location('uxx l_first_num1 '||l_first_num1,10);
1393 hr_utility.set_location('uxx l_max_num1 '||l_max_num1,10);
1394
1395 open c_prev_pil(p_per_in_ler_id);
1396 fetch c_prev_pil into l_prev_pil_id;
1397 close c_prev_pil;
1398
1399 hr_utility.set_location('l_prev_pil_id '||l_prev_pil_id,10);
1400
1401 for i in l_first_num1..l_max_num1 loop
1402 open c_prev_elig_rec(l_prev_pil_id
1403 ,ben_determine_eligibility2.g_cache_first_inelig_object(i).pgm_id
1404 ,ben_determine_eligibility2.g_cache_first_inelig_object(i).pl_id
1405 ,ben_determine_eligibility2.g_cache_first_inelig_object(i).ptip_id
1406 ,ben_determine_eligibility2.g_cache_first_inelig_object(i).plip_id
1407 ,p_effective_date);
1408 fetch c_prev_elig_rec into l_fut_elig_per_rec;
1409 close c_prev_elig_rec;
1410
1411 hr_utility.set_location('uxx l_fut_elig_per_rec.elig_per_id '||l_fut_elig_per_rec.elig_per_id,10);
1412
1413 if(l_fut_elig_per_rec.elig_per_id is not null) then --c
1414
1415 open c_get_end_date_version(l_fut_elig_per_rec.elig_per_id,p_effective_date);
1416 fetch c_get_end_date_version into l_get_end_date_version;
1417 close c_get_end_date_version;
1418
1419 hr_utility.set_location('uxx effective_end_date'||l_get_end_date_version.effective_end_date,10);
1420 hr_utility.set_location('uxx object_version'||l_get_end_date_version.object_version_number,10);
1421
1422 if (l_get_end_date_version.effective_end_date is not null) and
1423 (l_get_end_date_version.effective_end_date <> hr_api.g_eot) then
1424
1425 open c_get_option(l_fut_elig_per_rec.elig_per_id,p_effective_date);
1426 loop
1427 fetch c_get_option into l_get_option;
1428 exit when c_get_option%notfound;
1429 hr_utility.set_location('uxx l_get_option.elig_per_opt_id'||l_get_option.elig_per_opt_id,10);
1430 if l_get_option.elig_per_opt_id is not null then
1431
1432 open c_get_end_date_version_opt(l_get_option.elig_per_opt_id,p_effective_date);
1433 fetch c_get_end_date_version_opt into l_get_end_date_version_opt;
1434 close c_get_end_date_version_opt;
1435
1436 hr_utility.set_location('uxx2 opt effective_end_date'||l_get_end_date_version_opt.effective_end_date,20);
1437 hr_utility.set_location('uxx2 opt object version'||l_get_end_date_version_opt.object_version_number,20);
1438 if (l_get_end_date_version_opt.effective_end_date is not null) and
1439 (l_get_end_date_version_opt.effective_end_date <> hr_api.g_eot) then
1440
1441 open c_get_elig_per_opt_rec(l_get_option.elig_per_opt_id
1442 ,l_prev_pil_id
1443 ,p_effective_date);
1444 fetch c_get_elig_per_opt_rec into l_opt_rec;
1445 close c_get_elig_per_opt_rec;
1446 hr_utility.set_location('l_opt_rec.elig_per_opt_id '||l_opt_rec.elig_per_opt_id,10);
1447 hr_utility.set_location('l_opt_rec.effective_start_date '||l_opt_rec.effective_start_date,10);
1448 ben_determine_eligibility3.save_to_restore
1449 (p_current_per_in_ler_id => p_per_in_ler_id
1450 ,p_per_in_ler_id => l_prev_pil_id
1451 ,p_elig_per_id => NUll
1452 ,p_elig_per_opt_id => l_opt_rec.elig_per_opt_id
1453 ,p_effective_date => l_opt_rec.effective_start_date
1454 );
1455
1456 ben_elig_person_option_api.delete_elig_person_option
1457 (p_validate => false,
1458 p_elig_per_opt_id => l_get_option.elig_per_opt_id,
1459 p_effective_start_date => l_effective_start_date,
1460 p_effective_end_date => l_effective_end_date,
1461 p_object_version_number => l_get_end_date_version_opt.object_version_number,
1462 p_effective_date => l_get_end_date_version_opt.effective_end_date,
1463 p_datetrack_mode => 'DELETE_NEXT_CHANGE'
1464 );
1465 end if;
1466 end if;
1467 end loop;
1468 close c_get_option;
1469 hr_utility.set_location('uxx before save to resote',10);
1470 ben_determine_eligibility3.save_to_restore
1471 (p_current_per_in_ler_id => p_per_in_ler_id
1472 ,p_per_in_ler_id => l_prev_pil_id
1473 ,p_elig_per_id => l_fut_elig_per_rec.elig_per_id
1474 ,p_elig_per_opt_id => NULL
1475 ,p_effective_date => l_fut_elig_per_rec.effective_start_date
1476 );
1477
1478 ben_eligible_person_api.delete_eligible_person
1479 (p_validate => false,
1480 p_elig_per_id => l_fut_elig_per_rec.elig_per_id,
1481 p_effective_start_date => l_effective_start_date,
1482 p_effective_end_date => l_effective_end_date,
1483 p_object_version_number => l_get_end_date_version.object_version_number,
1484 p_effective_date => l_get_end_date_version.effective_end_date,
1485 p_datetrack_mode => 'DELETE_NEXT_CHANGE'
1486 );
1487 -- end if;
1488 else
1489 open c_prev_elig_opt_rec(l_fut_elig_per_rec.elig_per_id,l_prev_pil_id);
1490 loop
1491 fetch c_prev_elig_opt_rec into l_fut_elig_per_opt_rec;
1492 exit when c_prev_elig_opt_rec%notfound;
1493 hr_utility.set_location('uxx l_fut_elig_per_opt_rec.elig_per_opt_id '||l_fut_elig_per_opt_rec.elig_per_opt_id,10);
1494
1495 if (l_fut_elig_per_opt_rec.elig_per_opt_id is not null) then
1496
1497 ben_determine_eligibility3.save_to_restore
1498 (p_current_per_in_ler_id => p_per_in_ler_id
1499 ,p_per_in_ler_id => l_prev_pil_id
1500 ,p_elig_per_id => NUll
1501 ,p_elig_per_opt_id => l_fut_elig_per_opt_rec.elig_per_opt_id
1502 ,p_effective_date => l_fut_elig_per_opt_rec.effective_start_date
1503 );
1504
1505 delete from ben_elig_per_opt_f
1506 where elig_per_opt_id = l_fut_elig_per_opt_rec.elig_per_opt_id;
1507 hr_utility.set_location('option was deleted',10);
1508
1509 end if;
1510 end loop;
1511 close c_prev_elig_opt_rec;
1512
1513 ben_determine_eligibility3.save_to_restore
1514 (p_current_per_in_ler_id => p_per_in_ler_id
1515 ,p_per_in_ler_id => l_prev_pil_id
1516 ,p_elig_per_id => l_fut_elig_per_rec.elig_per_id
1517 ,p_elig_per_opt_id => NULL
1518 ,p_effective_date => l_fut_elig_per_rec.effective_start_date
1519 );
1520
1521 delete from ben_elig_per_f
1522 where elig_per_id = l_fut_elig_per_rec.elig_per_id;
1523 hr_utility.set_location('elig_per_id record deleted',10);
1524 end if;
1525 end if; --c
1526 end loop;
1527 end if;
1528 end check_for_first_eligible;
1529
1530 --Bug 12732878 ud changes end
1531 -------------------------------------------------------------------------------
1532
1533 procedure clear_init_benmngle_caches
1534 (p_business_group_id in number
1535 ,p_effective_date in date
1536 ,p_threads in number default null
1537 ,p_chunk_size in number default null
1538 ,p_max_errors in number default null
1539 ,p_benefit_action_id in number default null
1540 ,p_thread_id in number default null
1541 )
1542
1543 is
1544 --
1545 begin
1546 g_debug := hr_utility.debug_enabled;
1547 --
1548 -- Set up benefits environment
1549 --
1550 ben_env_object.init
1551 (p_business_group_id => p_business_group_id
1552 ,p_effective_date => p_effective_date
1553 ,p_thread_id => p_thread_id
1554 ,p_chunk_size => p_chunk_size
1555 ,p_threads => p_threads
1556 ,p_max_errors => p_max_errors
1557 ,p_benefit_action_id => p_benefit_action_id
1558 );
1559 --
1560 -- Reset value of globals
1561 --
1562 g_elig_for_pgm_flag := null;
1563 g_elig_for_pl_flag := null;
1564 g_trk_inelig_flag := null;
1565 g_last_pgm_id := null;
1566 g_output_string := null;
1567 --
1568 -- Flush all global structures
1569 --
1570 -- bug 6872010
1571 g_fonm_cvg_strt_dt := null;
1572 g_fonm_rt_strt_dt := null;
1573 -- bug 6872010
1574
1575 flush_global_structures;
1576 benutils.g_benefit_action_id := p_benefit_action_id;
1577 benutils.g_thread_id := p_thread_id;
1578 --
1579 -- Initialise comp object list globals
1580 --
1581 ben_comp_object_list.init_comp_object_list_globals;
1582 --
1583 end clear_init_benmngle_caches;
1584 --
1585 /* GSP Rate Sync */
1586 procedure get_grade_step_placement
1587 (p_person_id in number,
1588 p_assignment_id in number,
1589 p_business_group_id in number,
1590 p_effective_date in date,
1591 p_gsp_pgm_id out nocopy number,
1592 p_gsp_plip_id out nocopy number,
1593 p_gsp_oipl_id out nocopy number,
1594 p_prgr_style out nocopy varchar2,
1595 p_gsp_emp_step_id out nocopy number,
1596 p_gsp_num_incr out nocopy number) is
1597 --
1598 l_proc varchar2(80);
1599 l_exc_grade EXCEPTION;
1600 l_exc_step EXCEPTION;
1601 --
1602 begin
1603 --
1604 l_proc := g_package || '.get_grade_step_placement';
1605 --
1606 hr_utility.set_location('Entering : ' || l_proc, 10);
1607 --
1608 -- Get Grade Ladder (PGM_ID) and Grade (PLIP_ID) placement
1609 pqh_gsp_post_process.get_persons_gl_and_grade
1610 (p_person_id => p_person_id,
1611 p_business_group_id => p_business_group_id,
1612 p_effective_date => p_effective_date,
1613 p_persons_pgm_id => p_gsp_pgm_id,
1614 p_persons_plip_id => p_gsp_plip_id,
1615 p_prog_style => p_prgr_style);
1616
1617 if p_prgr_style not in ('PQH_GSP_GP')
1618 then
1619 --
1620 -- Get Step placement
1621 pqh_gsp_default.get_emp_step_placement
1622 (p_assignment_id => p_assignment_id,
1623 p_effective_date => p_effective_date,
1624 p_emp_step_id => p_gsp_emp_step_id,
1625 p_num_incr => p_gsp_num_incr);
1626
1627 -- Get the OIPL_ID (Step)
1628 p_gsp_oipl_id := pqh_gsp_hr_to_stage.get_oipl_for_step
1629 (p_step_id => p_gsp_emp_step_id,
1630 p_effective_date => p_effective_date);
1631 --
1632 end if;
1633 --
1634 hr_utility.set_location('Leaving : ' || l_proc, 20);
1635 --
1636 exception
1637 --
1638 when others
1639 then
1640 --
1641 if p_gsp_plip_id is null or p_gsp_pgm_id is null
1642 then
1643 --
1644 fnd_message.set_name('BEN','BEN_94094_PERSON_GRADE_NOT_FND');
1645 --
1646 elsif p_gsp_emp_step_id is null or p_gsp_oipl_id is null
1647 then
1648 --
1649 fnd_message.set_name('BEN','BEN_94095_PERSON_STEP_NOT_FND');
1650 --
1651 end if;
1652 --
1653 raise g_record_error;
1654 --
1655 end get_grade_step_placement;
1656 --
1657 procedure check_business_rules
1658 (p_business_group_id in number,
1659 p_derivable_factors in varchar2,
1660 p_validate in varchar2,
1661 p_no_programs in varchar2,
1662 p_no_plans in varchar2,
1663 p_mode in varchar2,
1664 p_effective_date in date,
1665 p_person_id in number,
1666 p_person_selection_rule_id in number,
1667 p_person_type_id in number,
1668 p_pgm_id in number,
1669 p_pl_id in number,
1670 p_ler_id in number,
1671 p_pl_typ_id in number,
1672 p_opt_id in number,
1673 p_lf_evt_ocrd_dt in date,
1674 p_org_heirarchy_id in number default null,
1675 p_org_starting_node_id in number default null,
1676 p_asg_events_to_all_sel_dt in date default null,
1677 p_per_sel_dt_cd in varchar2 default null,
1678 p_per_sel_dt_from in date default null,
1679 p_per_sel_dt_to in date default null,
1680 p_year_from in number default null,
1681 p_year_to in number default null,
1682 p_qual_type in number default null,
1683 p_qual_status in varchar2 default null,
1684 p_lf_evt_oper_cd in varchar2 default null
1685 ) is
1686 -- PB : 5422 :
1687 -- p_popl_enrt_typ_cycl_id in number) is
1688 --
1689 l_package varchar2(80) := g_package||'.check_business_rules';
1690 l_dummy varchar2(1);
1691 l_rec benutils.g_active_life_event;
1692 l_ler_rec benutils.g_ler;
1693 l_effective_start_date date;
1694 l_effective_end_date date;
1695 l_ptnl_ler_for_per_id number;
1696 l_object_version_number number;
1697 l_per_in_ler_id number;
1698 l_opt_count number;
1699 l_cwbdb_count number;
1700 l_cwbwb_count number;
1701 l_cwbr_count number;
1702
1703 --
1704 cursor c1 is
1705 select null
1706 from per_person_type_usages_f ppu
1707 where ppu.person_id = p_person_id
1708 and ppu.person_type_id = p_person_type_id
1709 and p_effective_date
1710 between ppu.effective_start_date
1711 and ppu.effective_end_date;
1712 --
1713 -- CWB Change Bug 2275257
1714 --
1715 --Bug : 3482033
1716 cursor c2 is
1717 select null
1718 from ben_acty_base_rt_f abr
1719 where abr.pl_id = p_pl_id
1720 and abr.acty_typ_cd like 'CWB%'
1721 and abr.acty_typ_cd not in ('CWBAHE') -- Bug 3975857 - Removed codes CWBRA,CWBGP
1722 and abr.acty_base_rt_stat_cd = 'A'
1723 and abr.business_group_id = p_business_group_id
1724 and nvl(p_lf_evt_ocrd_dt,p_effective_date)
1725 between abr.effective_start_date
1726 and abr.effective_end_date
1727 group by abr.acty_typ_cd
1728 having count(*) > 1;
1729 --Bug : 3482033
1730 --
1731 cursor c3 is
1732 select enp.uses_bdgt_flag,
1733 enp.prsvr_bdgt_cd,
1734 DECODE(pln.pl_id,pln.group_pl_id,'Y','N') Group_plan
1735 from ben_enrt_perd enp,
1736 ben_popl_enrt_typ_cycl_f pet,
1737 ben_pl_f pln
1738 where pet.pl_id = p_pl_id
1739 and pet.business_group_id = p_business_group_id
1740 and enp.popl_enrt_typ_cycl_id = pet.popl_enrt_typ_cycl_id
1741 and enp.asnd_lf_evt_dt = p_lf_evt_ocrd_dt
1742 and pln.pl_id = p_pl_id
1743 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1744 pet.effective_start_date and pet.effective_end_date
1745 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1746 pln.effective_start_date and pln.effective_end_date
1747 ;
1748 c3_rec c3%rowtype;
1749
1750 cursor c4 is
1751 select count(decode(abr.acty_typ_cd,'CWBDB',1,0)),
1752 count(decode(abr.acty_typ_cd,'CWBWB',1,0)),
1753 count(decode(abr.acty_typ_cd,'CWBR',1,0))
1754 from ben_acty_base_rt_f abr
1755 where abr.acty_typ_cd in ('CWBDB','CWBWB','CWBR')
1756 and abr.acty_base_rt_stat_cd = 'A'
1757 and abr.business_group_id = p_business_group_id
1758 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1759 abr.effective_start_date and abr.effective_end_date
1760 and (abr.pl_id = p_pl_id or
1761 abr.oipl_id in
1762 (select oipl.oipl_id
1763 from ben_oipl_f oipl
1764 where oipl.pl_id = p_pl_id
1765 and oipl.business_group_id = p_business_group_id
1766 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1767 oipl.effective_start_date and oipl.effective_end_date
1768 )
1769 );
1770
1771 --if plan or option has CWBDB and it should have CWBWB
1772 cursor c5 is
1773 select 'x'
1774 from ben_acty_base_rt_f abr1
1775 where
1776 ( abr1.acty_typ_cd in ('CWBDB')
1777 and abr1.acty_base_rt_stat_cd = 'A'
1778 and abr1.business_group_id = p_business_group_id
1779 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1780 abr1.effective_start_date and abr1.effective_end_date
1781 and (abr1.pl_id = p_pl_id or
1782 abr1.oipl_id in
1783 (select oipl.oipl_id
1784 from ben_oipl_f oipl
1785 where oipl.pl_id = p_pl_id
1786 and oipl.business_group_id = p_business_group_id
1787 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1788 oipl.effective_start_date and oipl.effective_end_date
1789 )
1790 )
1791 and not exists
1792 (select 'x'
1793 from ben_acty_base_rt_f abr2
1794 where abr2.acty_typ_cd = 'CWBWB'
1795 and abr2.acty_base_rt_stat_cd = 'A'
1796 and abr2.business_group_id = p_business_group_id
1797 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1798 abr2.effective_start_date and abr2.effective_end_date
1799 and nvl(abr2.pl_id,-1) = nvl(abr1.pl_id,-1)
1800 and nvl(abr2.oipl_id,-1) = nvl(abr1.oipl_id,-1)
1801 )
1802 ) OR
1803 --if plan or option has CWBWB and it should have CWBDB
1804 ( abr1.acty_typ_cd in ('CWBWB')
1805 and abr1.acty_base_rt_stat_cd = 'A'
1806 and abr1.business_group_id = p_business_group_id
1807 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1808 abr1.effective_start_date and abr1.effective_end_date
1809 and (abr1.pl_id = p_pl_id or
1810 abr1.oipl_id in
1811 (select oipl.oipl_id
1812 from ben_oipl_f oipl
1813 where oipl.pl_id = p_pl_id
1814 and oipl.business_group_id = p_business_group_id
1815 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1816 oipl.effective_start_date and oipl.effective_end_date
1817 )
1818 )
1819 and not exists
1820 (select 'x'
1821 from ben_acty_base_rt_f abr2
1822 where abr2.acty_typ_cd = 'CWBDB'
1823 and abr2.acty_base_rt_stat_cd = 'A'
1824 and abr2.business_group_id = p_business_group_id
1825 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1826 abr2.effective_start_date and abr2.effective_end_date
1827 and nvl(abr2.pl_id,-1) = nvl(abr1.pl_id,-1)
1828 and nvl(abr2.oipl_id,-1) = nvl(abr1.oipl_id,-1)
1829 )
1830 ) ;
1831
1832
1833 cursor c6 is
1834 select 'x'
1835 from ben_acty_base_rt_f abr1
1836 where abr1.acty_typ_cd in ('CWBDB')
1837 and abr1.acty_base_rt_stat_cd = 'A'
1838 and abr1.business_group_id = p_business_group_id
1839 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1840 abr1.effective_start_date and abr1.effective_end_date
1841 and (abr1.pl_id = p_pl_id or
1842 abr1.oipl_id in
1843 (select oipl.oipl_id
1844 from ben_oipl_f oipl
1845 where oipl.pl_id = p_pl_id
1846 and oipl.business_group_id = p_business_group_id
1847 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1848 oipl.effective_start_date and oipl.effective_end_date
1849 )
1850 )
1851 and not exists
1852 (select 'x'
1853 from ben_acty_base_rt_f abr2
1854 where abr2.acty_typ_cd in ('CWBES')
1855 and abr2.acty_base_rt_stat_cd = 'A'
1856 and abr2.business_group_id = p_business_group_id
1857 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1858 abr2.effective_start_date and abr2.effective_end_date
1859 and nvl(abr2.pl_id,-1) = nvl(abr1.pl_id,-1)
1860 and nvl(abr2.oipl_id,-1) = nvl(abr1.oipl_id,-1)
1861 );
1862
1863 cursor c7 is
1864 select count(opt.opt_id)
1865 from ben_opt_f opt
1866 where opt.component_reason is not null
1867 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1868 opt.effective_start_date and opt.effective_end_date
1869 and opt.opt_id in
1870 (select oipl.opt_id
1871 from ben_oipl_f oipl
1872 where oipl.pl_id = p_pl_id
1873 and oipl.business_group_id = p_business_group_id
1874 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1875 oipl.effective_start_date and oipl.effective_end_date);
1876
1877 --
1878 -- Cursor c8 added for Bug 2840078
1879 --
1880 cursor c8 is
1881 select 'x' found
1882 from ben_cvg_amt_calc_mthd_f ccm,
1883 ben_pl_typ_f pt,
1884 ben_pl_f pl
1885 where pl.pl_id = p_pl_id
1886 and pt.pl_typ_id = pl.pl_typ_id
1887 and pt.opt_typ_cd = 'CWB'
1888 and (ccm.pl_id = pl.pl_id or
1889 ccm.oipl_id in
1890 (select oipl.oipl_id
1891 from ben_oipl_f oipl
1892 where oipl.pl_id = pl.pl_id
1893 and oipl.business_group_id = p_business_group_id
1894 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1895 oipl.effective_start_date and oipl.effective_end_date
1896 )
1897 )
1898 and ccm.business_group_id = p_business_group_id
1899 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between ccm.effective_start_date and ccm.effective_end_date
1900 and pl.business_group_id = p_business_group_id
1901 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between pl.effective_start_date and pl.effective_end_date
1902 and pt.business_group_id = p_business_group_id
1903 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between pt.effective_start_date and pt.effective_end_date;
1904
1905
1906 cursor c9 is
1907 select 'x'
1908 from ben_cwb_wksht_grp cwg
1909 where cwg.pl_id = p_pl_id ;
1910 -- and cwg.status_cd = 'A' ; bug 4199099
1911
1912 -- to find wheether there is any option
1913 cursor c10 is
1914 select 'x' found
1915 from ben_oipl_f oipl
1916 where oipl.pl_id = p_pl_id
1917 and oipl.business_group_id = p_business_group_id
1918 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1919 oipl.effective_start_date and oipl.effective_end_date ;
1920
1921
1922 -- rate is attached to plan
1923 cursor c11 is
1924 select 'x' found
1925 from ben_acty_base_rt_f abr
1926 where abr.acty_typ_cd in ('CWBDB','CWBWB','CWBR')
1927 and abr.acty_base_rt_stat_cd = 'A'
1928 and abr.business_group_id = p_business_group_id
1929 and nvl(p_lf_evt_ocrd_dt,p_effective_date) between
1930 abr.effective_start_date and abr.effective_end_date
1931 and abr.pl_id = p_pl_id
1932 ;
1933 -- iRec
1934 cursor c_irec_rptg_grp is
1935 select null
1936 from ben_rptg_grp bnr
1937 where bnr.business_group_id = p_business_group_id
1938 and bnr.rptg_prps_cd = 'IREC';
1939 --
1940
1941 -- GSP Rate Sync
1942 cursor c_gsp_rate_sync_ler is
1943 select null
1944 from ben_ler_f ler
1945 where ler.typ_cd = 'GSP'
1946 and ler.lf_evt_oper_cd = 'SYNC'
1947 and ler.business_group_id = p_business_group_id
1948 and p_effective_date between ler.effective_start_date
1949 and ler.effective_end_date;
1950 --
1951 begin
1952 --
1953 if g_debug then
1954 hr_utility.set_location ('Entering '||l_package,10);
1955 end if;
1956 --
1957 -- This procedure checks validity of parameters that have been passed to the
1958 -- BENMNGLE process.
1959 --
1960 -- Check if mandatory arguments have been stipulated
1961 --
1962 hr_api.mandatory_arg_error(p_api_name => l_package,
1963 p_argument => 'p_business_group_id',
1964 p_argument_value => p_business_group_id);
1965 --
1966 hr_api.mandatory_arg_error(p_api_name => l_package,
1967 p_argument => 'p_mode',
1968 p_argument_value => p_mode);
1969 --
1970 hr_api.mandatory_arg_error(p_api_name => l_package,
1971 p_argument => 'p_effective_date',
1972 p_argument_value => p_effective_date);
1973 --
1974 --
1975 hr_api.mandatory_arg_error(p_api_name => l_package,
1976 p_argument => 'p_no_programs',
1977 p_argument_value => p_no_programs);
1978 --
1979 hr_api.mandatory_arg_error(p_api_name => l_package,
1980 p_argument => 'p_no_plans',
1981 p_argument_value => p_no_plans);
1982 --
1983 hr_api.mandatory_arg_error(p_api_name => l_package,
1984 p_argument => 'p_validate',
1985 p_argument_value => p_validate);
1986 --
1987 -- Business Rule Checks
1988 --
1989 -- p_no_plans and p_no_programs can not be both 'Y'
1990 --
1991 if p_no_plans = 'Y' and
1992 p_no_programs = 'Y' then
1993 --
1994 fnd_message.set_name('BEN','BEN_91391_NO_PLAN_PROG');
1995 fnd_message.raise_error;
1996 --
1997 end if;
1998 --
1999 -- p_person_selection_rule_id and p_person_id are mutually exclusive
2000 --
2001 if p_person_id is not null and
2002 p_person_selection_rule_id is not null then
2003 --
2004 fnd_message.set_name('BEN','BEN_91745_RULE_AND_PERSON');
2005 fnd_message.raise_error;
2006 --
2007 end if;
2008 --
2009 -- p_no_plans = 'Y' then p_pl_id and p_opt_id must be null
2010 --
2011 if p_no_plans = 'Y' and
2012 (p_pl_id is not null or
2013 p_opt_id is not null) then
2014 --
2015 fnd_message.set_name('BEN','BEN_91746_PROGRAMS_ONLY');
2016 fnd_message.raise_error;
2017 --
2018 end if;
2019 --
2020 -- p_no_programs = 'Y' then p_pgm_id must be null
2021 --
2022 if p_no_programs = 'Y' and
2023 p_pgm_id is not null then
2024 --
2025 fnd_message.set_name('BEN','BEN_91747_PLANS_ONLY');
2026 fnd_message.raise_error;
2027 --
2028 end if;
2029 --
2030 -- p_person_id must be of p_person_type_id
2031 --
2032 if p_person_id is not null and
2033 p_person_type_id is not null then
2034 --
2035 -- Make sure person is of type person type
2036 --
2037 open c1;
2038 --
2039 fetch c1 into l_dummy;
2040 if c1%notfound then
2041 --
2042 close c1;
2043 fnd_message.set_name('BEN','BEN_91748_PERSON_TYPE');
2044 fnd_message.raise_error;
2045 --
2046 end if;
2047 --
2048 close c1;
2049 if g_debug then
2050 hr_utility.set_location ('close c1: '||l_package,50);
2051 end if;
2052 --
2053 end if;
2054 --
2055 -- p_pl_typ_id not null then no_plans, plan and option name must be blank
2056 --
2057 if p_pl_typ_id is not null and
2058 (p_no_plans = 'Y' or
2059 p_opt_id is not null or
2060 p_pl_id is not null) then
2061 --
2062 fnd_message.set_name('BEN','BEN_91749_PLAN_TYPE');
2063 fnd_message.raise_error;
2064 --
2065 end if;
2066 --
2067 -- p_mode = 'C' and p_popl_enrt_typ_cycl_id is null
2068 --
2069 -- CWB Changes
2070 --
2071 if p_mode in ('C', 'W') and
2072 -- PB : 5422 :
2073 -- Now check for p_lf_evt_ocrd_dt
2074 --
2075 -- p_popl_enrt_typ_cycl_id is null then
2076 p_lf_evt_ocrd_dt is null then
2077 --
2078 fnd_message.set_name('BEN','BEN_91667_SCHED_NO_POPL_ENRT');
2079 fnd_message.raise_error;
2080 --
2081 end if;
2082 --
2083 -- CWB Changes
2084 --
2085 if p_mode = 'W' and p_pl_id is null then
2086 --
2087 fnd_message.set_name('BEN','BEN_91667_SCHED_NO_POPL_ENRT');
2088 fnd_message.raise_error;
2089 --
2090 end if;
2091
2092 --
2093 -- CWB Changes Bug 2270672
2094 -- Effective date must be greater than or equal to Life Event Occurred Date
2095 --
2096 if p_mode = 'W' and p_effective_date < p_lf_evt_ocrd_dt then
2097 --
2098 fnd_message.set_name('BEN','BEN_93017_INVALID_EFF_DATE');
2099 fnd_message.raise_error;
2100 --
2101 end if;
2102
2103 --
2104 -- CWB Changes Bug 2275257
2105 -- There must be exactly one rate defined for a Plan with the Activity Type
2106 -- of 'CWBWS'
2107 --
2108 if p_mode = 'W' then
2109
2110 --Bug : 3482033
2111 --For a plan or option, you cannot have more than one of each of the following rates: CWB
2112 --Worksheet Budget, CWB Distribution Budget, CWB Reserve, CWB Worksheet Amount, CWB Eligible
2113 --Salary, CWB Stated Salary, CWB Other Salary, CWB Total Compensation, CWB Misc Rate 1, CWB
2114 --Misc Rate 2, CWB Misc Rate 3.
2115 open c2;
2116 --
2117 fetch c2 into l_dummy;
2118 if c2%found then -- Bug 3975857 Changed "notfound" to "found"
2119 --
2120 close c2;
2121 fnd_message.set_name('BEN','BEN_93015_CWB_NO_WS_RATE');
2122 fnd_message.raise_error;
2123 --
2124 end if;
2125 --
2126 close c2;
2127 --Bug : 3482033
2128
2129 -- if plan or option rate has CWBDB and it should have CWBWB
2130 -- if plan or option rqte has CWBWB and it should have CWBDB
2131 open c5;
2132 fetch c5 into l_dummy;
2133 if c5%found then
2134 --
2135 close c5;
2136 fnd_message.set_name('BEN','BEN_93968_CWB_BDGT_RT_AMT_CB');
2137 fnd_message.raise_error;
2138 --
2139 end if;
2140 close c5;
2141 --
2142
2143
2144 open c3;
2145 fetch c3 into c3_rec;
2146 close c3;
2147
2148 open c4;
2149 fetch c4 into l_cwbdb_count,l_cwbwb_count,l_cwbr_count;
2150 close c4;
2151
2152 -- the assumption is if the plan is group then option is group so plan alone is checked
2153 -- whether it is group or not. verified with manish
2154
2155 if c3_rec.group_plan = 'Y' then
2156
2157 /* Bug 4149182 : Commented the following Check
2158 *
2159 * -- if the groip plan has option then the rate should be attached to option
2160 * open c10 ;
2161 * fetch c10 into l_dummy ;
2162 * if c10%found then
2163 * open c11 ;
2164 * fetch c11 into l_dummy ;
2165 * if c11%found then
2166 * close c11 ;
2167 * close c10 ;
2168 * fnd_message.set_name('BEN','BEN_93742_CWB_RATE_TO_CHILD');
2169 * fnd_message.raise_error;
2170 * end if ;
2171 * close c11 ;
2172 * end if ;
2173 * close c10 ;
2174 */
2175
2176
2177 -- if the budget flag is 'y' there should be a rate
2178 if c3_rec.uses_bdgt_flag = 'Y' then
2179 if l_cwbdb_count < 1 or
2180 l_cwbwb_count < 1 then
2181 --
2182 fnd_message.set_name('BEN','BEN_93967_CWB_BDGT_RT_PLAN_CB');
2183 fnd_message.raise_error;
2184 --
2185 end if;
2186 end if ;
2187 /* -- bug 5090149
2188 -- if the budget flag is 'y' there should be budget task
2189 open c9 ;
2190 fetch c9 into l_dummy ;
2191 if c9%notfound then
2192 close c9 ;
2193 fnd_message.set_name('BEN','BEN_93740_CWB_BDGT_TASK_NOT');
2194 fnd_message.raise_error;
2195 end if ;
2196 close c9 ;
2197 */
2198
2199 /*
2200 Bug 4258200 : Budget and reserve rates can be attached to local plans
2201 so that the data is copied over in the event of cloning of cwb data.
2202
2203 else
2204 -- if the plan is not group and date DB/WB/reserve attached then error
2205 if l_cwbdb_count > 0 or
2206 l_cwbwb_count > 0 or
2207 l_cwbr_count > 0 then
2208 fnd_message.set_name('BEN','BEN_93743_CWB_RATE_TO_GROUP');
2209 fnd_message.raise_error;
2210 end if ;
2211 */
2212 end if ;
2213 --
2214
2215 /* elibile salary are attached to actual plan and DB are attached to group pls
2216 this condition is no more valid
2217 if c3_rec.prsvr_bdgt_cd = 'P' then
2218 open c6;
2219 fetch c6 into l_dummy;
2220 if c6%found then
2221 --
2222 close c6;
2223 fnd_message.set_name('BEN','BEN_93319_CWB_BDGT_RT_SAL');
2224 fnd_message.raise_error;
2225 --
2226 end if;
2227 --
2228 close c6;
2229 end if;
2230 */
2231
2232 /* Bug 5666180
2233 Allow customers to setup salary plan with only one salary component.
2234 In this case, customers uses salary components but the other
2235 components come from some other place or is entered by admin
2236
2237 Removing the below check.
2238
2239 open c7;
2240 fetch c7 into l_opt_count;
2241 close c7;
2242
2243 if l_opt_count = 1 then
2244 fnd_message.set_name('BEN','BEN_93320_CWB_OPT_COMP_RSN');
2245 fnd_message.raise_error;
2246 end if;
2247 */
2248
2249 --
2250 -- Bug 2840078 check that cwb plans/options do not have coverages,
2251 -- raise error if coverages are attached.
2252 --
2253 open c8;
2254 fetch c8 into l_dummy;
2255 if c8%found then
2256 --
2257 close c8;
2258 fnd_message.set_name('BEN','BEN_93356_CWB_NO_CVG');
2259 fnd_message.raise_error;
2260 --
2261 end if;
2262 --
2263 close c8;
2264
2265 -- End of fix Bug 2840078
2266
2267 end if;
2268
2269 --
2270 -- iRec : For p_mode = I : iRecruitment, check that atleast one Reporting Group
2271 -- with purpose "iRecruitment" exists in the Business Group.
2272 --
2273 if p_mode = 'I' then
2274 --
2275 open c_irec_rptg_grp;
2276 --
2277 fetch c_irec_rptg_grp into l_dummy;
2278 if c_irec_rptg_grp%notfound then
2279 --
2280 close c_irec_rptg_grp;
2281 fnd_message.set_name('BEN','BEN_94026_NO_RPTG_GRP_DFND');
2282 fnd_message.raise_error;
2283 --
2284 end if;
2285 --
2286 close c_irec_rptg_grp;
2287 --
2288 end if;
2289 -- iRec
2290
2291 -- GSP Rate Sync
2292 -- If for GSP, the operation code = Rate Synchronization, then check that one Life event
2293 -- of type GSP with operation code = SYNC exists in the Business Group
2294 if p_mode = 'G' and p_lf_evt_oper_cd = 'SYNC'
2295 then
2296 --
2297 open c_gsp_rate_sync_ler;
2298 --
2299 fetch c_gsp_rate_sync_ler into l_dummy;
2300 if c_gsp_rate_sync_ler%notfound
2301 then
2302 --
2303 close c_gsp_rate_sync_ler;
2304 fnd_message.set_name('BEN','BEN_94090_NO_GSP_RS_LER_DFND');
2305 fnd_message.raise_error;
2306 --
2307 end if;
2308 --
2309 close c_gsp_rate_sync_ler;
2310 --
2311 end if;
2312 -- GSP Rate Sync
2313 --
2314
2315 -- p_mode = 'U' make sure any open life event is an unrestricted one -modified
2316 -- any open unrestricted life event on the same day will be checked at the client side
2317 --
2318 --
2319 -- p_mode not in L,S,C,U
2320 --
2321 if g_debug then
2322 hr_utility.set_location ('BEN_BENMNGLE_MD '||l_package,50);
2323 end if;
2324 --
2325 if hr_api.not_exists_in_hr_lookups
2326 (p_lookup_type => 'BEN_BENMNGLE_MD',
2327 p_lookup_code => p_mode,
2328 p_effective_date => p_effective_date) then
2329 --
2330 fnd_message.set_name('BEN','BEN_91326_MODE_INVALID');
2331 fnd_message.raise_error;
2332 --
2333 end if;
2334 --
2335 -- 2940151 grade/step
2336 -- 1. If business rule param is null and business rule strt or end dts
2337 -- are not null, raise error
2338 if p_per_sel_dt_cd is null and
2339 ( p_per_sel_dt_from is not null or
2340 p_per_sel_dt_to is not null) then
2341
2342 fnd_message.set_name('PER','HR_289506_SPP_BR_NULL');
2343 fnd_message.raise_error;
2344 end if;
2345
2346 -- 2. If business rule param is not null and business rule strt or end dts
2347 -- are null, raise error
2348 if p_per_sel_dt_cd is not null and
2349 ( p_per_sel_dt_from is null or
2350 p_per_sel_dt_to is null) then
2351
2352 fnd_message.set_name('PER','HR_289510_SPP_BR_DATE_NULL');
2353 fnd_message.raise_error;
2354 end if;
2355 --
2356 -- 3. If business rule param is neither of the four values, raise error
2357
2358 if p_per_sel_dt_cd not in ('AOJ', 'DOB', 'ASD', 'LHD') then
2359 fnd_message.set_name('PER','HR_289507_SPP_BR_INVALID');
2360 fnd_message.raise_error;
2361 end if;
2362 --
2363 -- 4. If date from is greater than date to, raise error
2364
2365 if p_per_sel_dt_from > p_per_sel_dt_to then
2366 fnd_message.set_name('PER','HR_289500_SPP_BR_DATE');
2367 fnd_message.raise_error;
2368 end if;
2369 --
2370 -- 5. If the dates are more than 12 months apart, raise error
2371
2372 if ( months_between( p_per_sel_dt_to, p_per_sel_dt_from) > 12 ) then
2373 fnd_message.set_name('PER','HR_289501_SPP_BR_YEAR_GREATER');
2374 fnd_message.raise_error;
2375 end if;
2376 --
2377 -- 6. If effective date does not fall between the from and to dates, raise error
2378
2379 if not ( p_effective_date between p_per_sel_dt_from and p_per_sel_dt_to ) then
2380 fnd_message.set_name('PER','HR_289503_SPP_EFF_BR_DATE');
2381 fnd_message.raise_error;
2382 end if;
2383 --
2384 -- 7. If year from is greater than year to, raise error
2385
2386 if p_year_from > p_year_to then
2387 fnd_message.set_name('PER','HR_289504_SPP_BR_YEAR_FROM_TO');
2388 fnd_message.raise_error;
2389 end if;
2390 --
2391 -- end 2940151
2392
2393 --
2394 if g_debug then
2395 hr_utility.set_location ('Leaving '||l_package,10);
2396 end if;
2397 --
2398 end check_business_rules;
2399 --
2400 procedure update_elig_per_rows
2401 (p_comp_obj_tree_row in ben_manage_life_events.g_cache_proc_objects_rec
2402 ,p_comp_rec in ben_derive_part_and_rate_facts.g_cache_structure
2403 ,p_person_id in number
2404 ,p_par_elig_state in out nocopy ben_comp_obj_filter.g_par_elig_state_rec
2405 ,p_treeele_num in number
2406 ,p_business_group_id in number
2407 ,p_effective_date in date
2408 ,p_lf_evt_ocrd_dt in date
2409 ,p_per_in_ler_id in number
2410 ,p_continue_loop out nocopy boolean) is
2411 --
2412 l_envpgm_id number := p_comp_obj_tree_row.par_pgm_id;
2413 l_envptip_id number := p_comp_obj_tree_row.par_ptip_id;
2414 l_envplip_id number := p_comp_obj_tree_row.par_plip_id;
2415 l_envpl_id number := p_comp_obj_tree_row.par_pl_id;
2416 l_oipl_id number := p_comp_obj_tree_row.oipl_id;
2417 l_pl_id number := p_comp_obj_tree_row.pl_id;
2418 l_oiplip_id number := p_comp_obj_tree_row.oiplip_id;
2419 l_plip_id number := p_comp_obj_tree_row.plip_id;
2420 l_ptip_id number := p_comp_obj_tree_row.ptip_id;
2421
2422 l_elig_per_id ben_elig_per_f.elig_per_id%TYPE;
2423 l_object_version_number ben_elig_per_f.object_version_number%TYPE;
2424 l_object_version_number_opt ben_elig_per_opt_f.object_version_number%type;
2425 l_effective_start_date date;
2426 l_effective_end_date date;
2427 l_datetrack_mode varchar2(100);
2428 l_elig_per_opt_id ben_elig_per_opt_f.elig_per_opt_id%type;
2429 l_elig_per_oiplip_id ben_elig_per_opt_f.elig_per_opt_id%type;
2430 l_effective_start_date_opt date;
2431 l_effective_end_date_opt date;
2432 l_correction boolean;
2433 l_update boolean;
2434 l_update_override boolean;
2435 l_update_change_insert boolean;
2436
2437 --
2438 CURSOR c_prev_elig_check
2439 (c_person_id in number
2440 ,c_pgm_id in number
2441 ,c_pl_id in number
2442 ,c_ptip_id in number
2443 ,c_effective_date in date
2444 )
2445 IS
2446 select pep.elig_per_id,
2447 pep.elig_flag,
2448 pep.prtn_strt_dt,
2449 pep.prtn_end_dt,
2450 pep.per_in_ler_id,
2451 pep.object_version_number
2452 from ben_elig_per_f pep,
2453 ben_per_in_ler pil
2454 where pep.person_id = c_person_id
2455 and nvl(pep.pgm_id,-1) = c_pgm_id
2456 and nvl(pep.pl_id,-1) = c_pl_id
2457 and pep.plip_id is null
2458 and nvl(pep.ptip_id,-1) = c_ptip_id
2459 and c_effective_date
2460 between pep.effective_start_date
2461 and pep.effective_end_date
2462 and pil.per_in_ler_id(+)=pep.per_in_ler_id
2463 and pil.business_group_id(+)=pep.business_group_id
2464 and ( pil.per_in_ler_stat_cd not in ('VOIDD','BCKDT') -- found row condition
2465 or pil.per_in_ler_stat_cd is null -- outer join condition
2466 )
2467 ;
2468 --
2469 cursor c_prev_opt_elig_check
2470 (c_person_id in number
2471 ,c_effective_date in date
2472 ,c_pl_id in number
2473 ,c_opt_id in number
2474 )
2475 is
2476 select epo.elig_per_opt_id,
2477 epo.elig_flag,
2478 epo.prtn_strt_dt,
2479 epo.prtn_end_dt,
2480 epo.object_version_number,
2481 pep.elig_per_id,
2482 epo.per_in_ler_id,
2483 pep.prtn_strt_dt strt_dt,
2484 pep.prtn_end_dt end_dt
2485 from ben_elig_per_opt_f epo,
2486 ben_per_in_ler pil,
2487 ben_elig_per_f pep
2488 where pep.person_id = c_person_id
2489 and pep.pl_id = c_pl_id
2490 and epo.opt_id = c_opt_id
2491 and pep.elig_per_id = epo.elig_per_id
2492 and pep.pgm_id is null
2493 and c_effective_date
2494 between pep.effective_start_date
2495 and pep.effective_end_date
2496 and c_effective_date
2497 between epo.effective_start_date
2498 and epo.effective_end_date
2499 and pil.per_in_ler_id(+)=epo.per_in_ler_id
2500 and pil.business_group_id(+)=epo.business_group_id
2501 and ( pil.per_in_ler_stat_cd not in ('VOIDD','BCKDT')
2502 or pil.per_in_ler_stat_cd is null);
2503 --
2504 cursor c_epe (p_pgm_id number) is
2505 select null
2506 from ben_elig_per_f
2507 where person_id = p_person_id
2508 and p_effective_date between effective_start_date and
2509 effective_end_date
2510 and per_in_ler_id is null
2511 and pgm_id = p_pgm_id;
2512 --
2513 cursor c_epe2 (p_pl_id number) is
2514 select null
2515 from ben_elig_per_f
2516 where person_id = p_person_id
2517 and p_effective_date between effective_start_date and
2518 effective_end_date
2519 and per_in_ler_id is null
2520 and pgm_id is null
2521 and pl_id = p_pl_id;
2522 --
2523 cursor c_epo (p_pgm_id number) is
2524 select null
2525 from ben_elig_per_opt_f epo
2526 where epo.per_in_ler_id is null
2527 and p_effective_date between epo.effective_start_date
2528 and epo.effective_end_date
2529 and epo.elig_per_id in
2530 (select elig_per_id
2531 from ben_elig_per_f
2532 where person_id = p_person_id
2533 and p_effective_date between effective_start_date and
2534 effective_end_date
2535 and per_in_ler_id = p_per_in_ler_id
2536 and pgm_id = p_pgm_id);
2537 --
2538 cursor c_epo2 (p_pl_id number) is
2539 select null
2540 from ben_elig_per_opt_f epo
2541 where epo.per_in_ler_id is null
2542 and p_effective_date between epo.effective_start_date
2543 and epo.effective_end_date
2544 and epo.elig_per_id in
2545 (select elig_per_id
2546 from ben_elig_per_f
2547 where person_id = p_person_id
2548 and p_effective_date between effective_start_date and
2549 effective_end_date
2550 and per_in_ler_id = p_per_in_ler_id
2551 and pgm_id is null
2552 and pl_id = p_pl_id);
2553
2554 l_prev_opt_elig_check c_prev_opt_elig_check%rowtype;
2555 l_prev_elig_check c_prev_elig_check%rowtype;
2556 l_oipl_rec ben_cobj_cache.g_oipl_inst_row;
2557 l_epo_row ben_derive_part_and_rate_facts.g_cache_structure;
2558 l_pep_row ben_derive_part_and_rate_facts.g_cache_structure;
2559 l_proc VARCHAR2(72);
2560 l_par_elig_state ben_comp_obj_filter.g_par_elig_state_rec := p_par_elig_state;
2561 l_dummy varchar2(100);
2562 --
2563
2564 begin
2565 --
2566 p_continue_loop := false;
2567 if g_debug then
2568 l_proc := g_package ||'.update_elig_per_rows';
2569 hr_utility.set_location('Entering:' || l_proc, 10);
2570 end if;
2571 --
2572 if l_envpgm_id is not null then
2573 --
2574 open c_epe (l_envpgm_id);
2575 fetch c_epe into l_dummy;
2576 if c_epe%found then
2577 --
2578 update ben_elig_per_f pep set per_in_ler_id = p_per_in_ler_id
2579 where pep.person_id = p_person_id
2580 and pep.per_in_ler_id is null
2581 and pep.pgm_id = l_envpgm_id
2582 and p_effective_date between pep.effective_start_date
2583 and pep.effective_end_date;
2584 ben_pep_cache.clear_down_pepcache;
2585 end if;
2586 close c_epe;
2587 --
2588 if l_oipl_id is not null then
2589 --
2590 open c_epo(l_envpgm_id);
2591 fetch c_epo into l_dummy;
2592 if c_epo%found then
2593 l_oipl_rec := ben_cobj_cache.g_oipl_currow;
2594 --
2595 update ben_elig_per_opt_f epo
2596 set per_in_ler_id = p_per_in_ler_id
2597 where epo.per_in_ler_id is null
2598 and epo.elig_per_id in
2599 (select elig_per_id from ben_elig_per_f pep
2600 where pep.pgm_id = l_envpgm_id
2601 and pep.per_in_ler_id = p_per_in_ler_id
2602 and p_effective_date between pep.effective_start_date
2603 and pep.effective_end_date)
2604 and p_effective_date between epo.effective_start_date and
2605 epo.effective_end_date
2606 and epo.opt_id = l_oipl_rec.opt_id;
2607 ben_pep_cache.clear_down_epocache;
2608 end if;
2609 close c_epo;
2610 end if;
2611 --
2612 else
2613 --
2614 open c_epe2(l_envpl_id);
2615 fetch c_epe2 into l_dummy;
2616 if c_epe2%found then
2617 --
2618 update ben_elig_per_f pep set per_in_ler_id = p_per_in_ler_id
2619 where pep.person_id = p_person_id
2620 and pep.per_in_ler_id is null
2621 and pep.pgm_id is null
2622 and pep.pl_id = l_envpl_id
2623 and p_effective_date between pep.effective_start_date
2624 and pep.effective_end_date;
2625 ben_pep_cache.clear_down_pepcache;
2626 end if;
2627 close c_epe2;
2628 --
2629 if l_oipl_id is not null then
2630 --
2631 open c_epo2(l_envpl_id);
2632 fetch c_epo2 into l_dummy;
2633 if c_epo2%found then
2634
2635 l_oipl_rec := ben_cobj_cache.g_oipl_currow;
2636 --
2637 update ben_elig_per_opt_f epo
2638 set per_in_ler_id = p_per_in_ler_id
2639 where epo.per_in_ler_id is null
2640 and epo.elig_per_id in
2641 (select elig_per_id from ben_elig_per_f pep
2642 where pep.pgm_id is null
2643 and pep.pl_id = l_envpl_id
2644 and pep.per_in_ler_id = p_per_in_ler_id
2645 and p_effective_date between pep.effective_start_date
2646 and pep.effective_end_date)
2647 and p_effective_date between epo.effective_start_date and
2648 epo.effective_end_date
2649 and epo.opt_id = l_oipl_rec.opt_id;
2650 ben_pep_cache.clear_down_epocache;
2651 end if;
2652 close c_epo2;
2653 --
2654 end if;
2655 --
2656 end if;
2657 --
2658 if l_oipl_id is not null then
2659 --
2660 hr_utility.set_location('OIPL ID-update'||l_oipl_id,111);
2661 l_oipl_rec := ben_cobj_cache.g_oipl_currow;
2662 if l_envpgm_id is not null then
2663 --
2664 ben_pep_cache.get_pilepo_dets
2665 (p_person_id => p_person_id
2666 ,p_business_group_id => p_business_group_id
2667 ,p_effective_date => p_effective_date
2668 ,p_pgm_id => l_envpgm_id
2669 ,p_pl_id => l_envpl_id
2670 ,p_opt_id => l_oipl_rec.opt_id
2671 ,p_inst_row => l_epo_row
2672 );
2673 --
2674 --
2675 if l_epo_row.elig_per_opt_id is null then
2676 p_continue_loop := false;
2677 hr_utility.set_location('elig per id is null' ||l_oipl_id,111);
2678 return;
2679 else
2680 l_elig_per_opt_id := l_epo_row.elig_per_opt_id;
2681 l_object_version_number_opt := l_epo_row.object_version_number;
2682 l_elig_per_id := l_epo_row.elig_per_id;
2683
2684 end if;
2685 else -- pgm_id is null
2686 open c_prev_opt_elig_check
2687 (c_person_id => p_person_id
2688 ,c_effective_date => p_effective_date
2689 ,c_pl_id => l_envpl_id
2690 ,c_opt_id => l_oipl_rec.opt_id
2691 );
2692 if g_debug then
2693 hr_utility.set_location('fetch c_prvoptelch ' || l_proc, 10);
2694 end if;
2695 fetch c_prev_opt_elig_check into l_prev_opt_elig_check;
2696 if c_prev_opt_elig_check%notfound then
2697 --
2698 close c_prev_opt_elig_check;
2699 p_continue_loop := false;
2700 return;
2701 --
2702 else
2703 --
2704 l_elig_per_opt_id := l_prev_opt_elig_check.elig_per_opt_id;
2705 l_object_version_number_opt := l_prev_opt_elig_check.object_version_number;
2706 l_elig_per_id := l_prev_opt_elig_check.elig_per_id;
2707 --
2708 end if;
2709 close c_prev_opt_elig_check;
2710
2711
2712 end if;
2713 p_continue_loop := true;
2714
2715 else -- oipl_id is null
2716 --
2717 -- Check for a plan in program
2718 --
2719 if l_envpgm_id is not null and
2720 l_pl_id is not null
2721 then
2722 --
2723 if g_debug then
2724 hr_utility.set_location(' before pilpep ',111);
2725 end if;
2726 ben_pep_cache.get_pilpep_dets
2727 (p_person_id => p_person_id
2728 ,p_business_group_id => p_business_group_id
2729 ,p_effective_date => p_effective_date
2730 ,p_pgm_id => l_envpgm_id
2731 ,p_pl_id => l_pl_id
2732 ,p_plip_id => l_plip_id
2733 ,p_inst_row => l_pep_row
2734 );
2735 --
2736 if l_pep_row.elig_per_id is not null then
2737 --
2738 l_elig_per_id := l_pep_row.elig_per_id;
2739 l_object_version_number := l_pep_row.object_version_number;
2740 --
2741 if l_pep_row.elig_flag = 'Y' then
2742 ben_comp_obj_filter.set_parent_elig_flags
2743 (p_comp_obj_tree_row => p_comp_obj_tree_row
2744 ,p_eligible => TRUE
2745 ,p_treeele_num => p_treeele_num
2746 ,p_par_elig_state => l_par_elig_state
2747 );
2748 else
2749 ben_comp_obj_filter.set_parent_elig_flags
2750 (p_comp_obj_tree_row => p_comp_obj_tree_row
2751 ,p_eligible => FALSE
2752 ,p_treeele_num => p_treeele_num
2753 ,p_par_elig_state => l_par_elig_state
2754 );
2755 end if;
2756 else
2757 --
2758 p_continue_loop := false;
2759 return;
2760 --
2761 end if;
2762 --
2763 else -- pgm_id is null
2764 --
2765 open c_prev_elig_check
2766 (c_person_id => p_person_id
2767 ,c_pgm_id => nvl(l_envpgm_id,-1)
2768 ,c_pl_id => nvl(l_pl_id,-1)
2769 ,c_ptip_id => nvl(l_ptip_id,-1)
2770 ,c_effective_date => p_effective_date
2771 );
2772 fetch c_prev_elig_check into l_prev_elig_check;
2773 --
2774 if c_prev_elig_check%found then
2775 l_elig_per_id := l_prev_elig_check.elig_per_id;
2776 l_object_version_number := l_prev_elig_check.object_version_number;
2777
2778 if l_prev_elig_check.elig_flag = 'Y' then
2779 ben_comp_obj_filter.set_parent_elig_flags
2780 (p_comp_obj_tree_row => p_comp_obj_tree_row
2781 ,p_eligible => TRUE
2782 ,p_treeele_num => p_treeele_num
2783 ,p_par_elig_state => l_par_elig_state
2784 );
2785 else
2786 ben_comp_obj_filter.set_parent_elig_flags
2787 (p_comp_obj_tree_row => p_comp_obj_tree_row
2788 ,p_eligible => FALSE
2789 ,p_treeele_num => p_treeele_num
2790 ,p_par_elig_state => l_par_elig_state
2791 );
2792 end if;
2793 else
2794 close c_prev_elig_check;
2795 p_continue_loop := false;
2796 return;
2797 --
2798 end if;
2799 --
2800 end if;
2801 --
2802 p_continue_loop := true;
2803
2804 end if;
2805 --
2806 p_par_elig_state := l_par_elig_state;
2807 if g_debug then
2808 hr_utility.set_location('Leaving:' || l_proc, 10);
2809 end if;
2810 end;
2811 --
2812 procedure update_enrt_rt (p_per_in_ler_id number) is
2813 --
2814 cursor c_enrt_rt is
2815 select *
2816 from ben_enrt_rt
2817 where elig_per_elctbl_chc_id in
2818 (select elig_per_elctbl_chc_id from ben_elig_per_elctbl_chc
2819 where per_in_ler_id = p_per_in_ler_id)
2820 union
2821 select *
2822 from ben_enrt_rt
2823 where enrt_bnft_id in
2824 (select enrt_bnft_id from ben_enrt_bnft
2825 where elig_per_elctbl_chc_id in
2826 (select elig_per_elctbl_chc_id from ben_elig_per_elctbl_chc
2827 where per_in_ler_id = p_per_in_ler_id));
2828
2829 --
2830 cursor c_pil_popl is
2831 select *
2832 from ben_pil_elctbl_chc_popl
2833 where per_in_ler_id = p_per_in_ler_id;
2834 --
2835 --bug#2718215
2836 cursor c_result_pgm (p_pgm_id number) is
2837 select effective_start_date
2838 from ben_prtt_enrt_rslt_f pen,
2839 ben_per_in_ler pil
2840 where pen.pgm_id = p_pgm_id
2841 and pen.person_id = pil.person_id
2842 and pil.per_in_ler_id = p_per_in_ler_id
2843 and pen.prtt_enrt_rslt_stat_cd is null
2844 and pen.effective_end_date = hr_api.g_eot;
2845 --
2846 cursor c_result_pln (p_pl_id number) is
2847 select effective_start_date
2848 from ben_prtt_enrt_rslt_f pen,
2849 ben_per_in_ler pil
2850 where pen.pl_id = p_pl_id
2851 and pen.person_id = pil.person_id
2852 and pil.per_in_ler_id = p_per_in_ler_id
2853 and pen.prtt_enrt_rslt_stat_cd is null
2854 and pen.effective_end_date = hr_api.g_eot;
2855 --
2856 l_effective_start_date date;
2857
2858 begin
2859 --
2860 if g_debug then
2861 hr_utility.set_location('Entering ',10);
2862 end if;
2863 /*
2864 bug#1936976 prtt_rt_val_id is already populated in benactbr - this process is redundant
2865 and if coverage is %rng multiple rate for same acty_base_rt is possible
2866 for i in c_enrt_rt loop
2867 --
2868 if g_debug then
2869 hr_utility.set_location('Entering ',10);
2870 end if;
2871 if ben_manage_life_events.g_enrt_rt_tbl.count = 0 then
2872 return;
2873 end if;
2874 --
2875 for j in ben_manage_life_events.g_enrt_rt_tbl.first .. ben_manage_life_events.g_enrt_rt_tbl.last loop
2876 --
2877 if g_debug then
2878 hr_utility.set_location('Entering ',10);
2879 end if;
2880 if i.acty_base_rt_id = ben_manage_life_events.g_enrt_rt_tbl(j).acty_base_rt_id then
2881 --
2882 if ben_manage_life_events.g_enrt_rt_tbl(j).prtt_rt_val_id is not null then
2883 update ben_enrt_rt
2884 set prtt_rt_val_id = ben_manage_life_events.g_enrt_rt_tbl(j).prtt_rt_val_id
2885 where enrt_rt_id = i.enrt_rt_id;
2886 end if;
2887 --
2888 exit;
2889 --
2890 end if;
2891 --
2892 end loop;
2893 --
2894 end loop;
2895 */
2896 --
2897 for i in c_pil_popl loop
2898 --
2899 /* The logic of updating the elections made date is changed to take care of situations
2900 after running recalculate process and after conversion because after conversion
2901 there is no pil elctble choice record. Now, the cursors fetch the election made
2902 date from enrollment result table.
2903
2904 if g_debug then
2905 hr_utility.set_location('Entering popl update',10);
2906 end if;
2907 if ben_manage_life_events.g_pil_popl_tbl.count = 0 then
2908 return;
2909 end if;
2910 --
2911 for j in ben_manage_life_events.g_pil_popl_tbl.first .. ben_manage_life_events.g_pil_popl_tbl.last loop
2912 --
2913 if i.pgm_id = ben_manage_life_events.g_pil_popl_tbl(j).pgm_id or
2914 i.pl_id = ben_manage_life_events.g_pil_popl_tbl(j).pl_id then
2915 --
2916 update ben_pil_elctbl_chc_popl
2917 set elcns_made_dt = ben_manage_life_events.g_pil_popl_tbl(j).elcns_made_dt
2918 where pil_elctbl_chc_popl_id = i.pil_elctbl_chc_popl_id;
2919 --
2920 --
2921 --
2922 end if;
2923 --
2924 end loop;
2925 --
2926 */
2927 if i.pgm_id is not null then
2928 open c_result_pgm (i.pgm_id);
2929 fetch c_result_pgm into l_effective_start_date;
2930 if c_result_pgm%found then
2931 update ben_pil_elctbl_chc_popl
2932 set elcns_made_dt = l_effective_start_date
2933 where pil_elctbl_chc_popl_id = i.pil_elctbl_chc_popl_id;
2934 end if;
2935 close c_result_pgm;
2936 elsif i.pl_id is not null then
2937 open c_result_pln (i.pl_id);
2938 fetch c_result_pln into l_effective_start_date;
2939 if c_result_pln%found then
2940 update ben_pil_elctbl_chc_popl
2941 set elcns_made_dt = l_effective_start_date
2942 where pil_elctbl_chc_popl_id = i.pil_elctbl_chc_popl_id;
2943 end if;
2944 close c_result_pln;
2945 end if;
2946
2947 end loop;
2948
2949 if g_debug then
2950 hr_utility.set_location('Leaving update enrt',10);
2951 end if;
2952 end;
2953 -- GSP New Procedure for updating the epe for default/auto
2954 -- enrollments.
2955 procedure gsp_proc_dflt_auten(p_per_in_ler_id number,
2956 p_effective_date date ) is
2957 --local variables
2958 l_package varchar2(80) := g_package||'.gsp_proc_dflt_auten';
2959 l_return_cd varchar2(30);
2960 l_elig_per_elctbl_chc_id number(15);
2961 l_dflt_flag varchar2(30) := 'N';
2962 l_auto_enrt_flag varchar2(30) := 'N';
2963 --cursors
2964 cursor c_epe is
2965 select elig_per_elctbl_chc_id,
2966 object_version_number
2967 from ben_elig_per_elctbl_chc epe
2968 where elig_per_elctbl_chc_id = l_elig_per_elctbl_chc_id
2969 and per_in_ler_id = p_per_in_ler_id ;
2970 --
2971 l_epe c_epe%ROWTYPE;
2972 --
2973 begin
2974 --
2975 hr_utility.set_location('Entering '||l_package,10);
2976 --
2977 --Call the GSP Default procedure to get the epe and return code
2978 pqh_gsp_default.get_def_auto_code(
2979 p_per_in_ler_id => p_per_in_ler_id,
2980 p_effective_date => p_effective_date,
2981 p_return_code => l_return_cd,
2982 p_electbl_chc_id => l_elig_per_elctbl_chc_id
2983 );
2984 --
2985 if l_elig_per_elctbl_chc_id is not null then
2986 --
2987 open c_epe ;
2988 fetch c_epe into l_epe ;
2989 close c_epe ;
2990 --
2991 if l_return_cd = 'D' then
2992 --
2993 l_dflt_flag := 'Y' ;
2994 --
2995 elsif l_return_cd = 'A' then
2996 --
2997 l_auto_enrt_flag := 'Y' ;
2998 l_dflt_flag := 'Y' ;
2999 --
3000 end if;
3001 --
3002 if l_epe.elig_per_elctbl_chc_id is not null then
3003 ben_elig_per_elc_chc_api.update_perf_ELIG_PER_ELC_CHC
3004 (p_elig_per_elctbl_chc_id => l_epe.elig_per_elctbl_chc_id
3005 ,p_object_version_number => l_epe.object_version_number
3006 ,p_dflt_flag => l_dflt_flag
3007 ,p_auto_enrt_flag => l_auto_enrt_flag
3008 ,p_effective_date => p_effective_date
3009 );
3010 --
3011 --Call the GSP Post process for Automatic enrollment
3012 if l_auto_enrt_flag = 'Y' then
3013 --
3014 pqh_gsp_post_process.Call_PP_From_Benmngle(
3015 P_Effective_Date =>p_effective_date,
3016 P_Elig_per_Elctbl_Chc_Id =>l_epe.elig_per_elctbl_chc_id
3017 ) ;
3018 --
3019 end if;
3020 --
3021 end if;
3022 --
3023 end if;
3024 --
3025 hr_utility.set_location('Leaving '||l_package,20);
3026 --
3027 end gsp_proc_dflt_auten ;
3028 --
3029 -- Bug 1895846
3030 procedure reset_elctbl_chc_inpng_flag(p_per_in_ler_id number,
3031 p_effective_date date ) is
3032 --
3033 l_object_version_number number ;
3034 l_package varchar2(100);
3035 cursor c_epe is
3036 select
3037 elig_per_elctbl_chc_id
3038 from
3039 ben_elig_per_elctbl_chc epe
3040 where
3041 per_in_ler_id = p_per_in_ler_id and
3042 in_pndg_wkflow_flag = 'S';
3043 --
3044 begin
3045 --
3046 /*
3047 update ben_elig_per_elctbl_chc
3048 set in_pndg_wkflow_flag = 'N'
3049 where in_pndg_wkflow_flag = 'S'
3050 and per_in_ler_id = p_per_in_ler_id;
3051 */
3052 if g_debug then
3053 l_package := 'reset_elctbl_chc_inpng_flag' ;
3054 hr_utility.set_location('Entering '||l_package , 10);
3055 end if;
3056 --
3057 for l_epe in c_epe loop
3058 --
3059 ben_elig_per_elc_chc_api.update_perf_ELIG_PER_ELC_CHC
3060 (p_elig_per_elctbl_chc_id => l_epe.elig_per_elctbl_chc_id
3061 ,p_object_version_number => l_object_version_number
3062 ,p_in_pndg_wkflow_flag => 'N'
3063 ,p_effective_date => p_effective_date
3064 );
3065 --
3066 end loop ;
3067 --
3068 if g_debug then
3069 hr_utility.set_location('Leaving '||l_package , 10);
3070 end if;
3071 --
3072 end;
3073 --
3074 -- Bug 1895846
3075 procedure delete_in_pndg_elig_dpnt( p_per_in_ler_id in number,
3076 p_effective_date in date) is
3077 l_object_version_number number ;
3078 l_package varchar2(100);
3079 --
3080 cursor c_in_pndg_edg is
3081 select
3082 elig_dpnt_id
3083 from
3084 ben_elig_dpnt egd
3085 where
3086 egd.per_in_ler_id = p_per_in_ler_id and
3087 egd.elig_per_elctbl_chc_id is null ;
3088
3089 begin
3090 --
3091 if g_debug then
3092 l_package := 'delete_in_pndg_elig_dpnt' ;
3093 hr_utility.set_location('Entering '||l_package , 10);
3094 end if;
3095 for l_in_pndg_edg in c_in_pndg_edg loop
3096 --
3097 ben_elig_dpnt_api.delete_elig_dpnt
3098 (p_elig_dpnt_id => l_in_pndg_edg.elig_dpnt_id
3099 ,p_object_version_number => l_object_version_number
3100 ,p_effective_date => p_effective_date
3101 ) ;
3102 --
3103 end loop;
3104 --
3105 if g_debug then
3106 hr_utility.set_location('Leaving '||l_package , 10);
3107 end if;
3108 end ;
3109 --
3110 procedure write_logfile(p_benefit_action_id in number,
3111 p_thread_id in number,
3112 p_validate in varchar2,
3113 p_person_count in number,
3114 p_error_person_count in number) is
3115 --
3116 l_package varchar2(80);
3117 --
3118 table_full EXCEPTION;
3119 index_full EXCEPTION;
3120 pragma exception_init(table_full,-1653);
3121 pragma exception_init(index_full,-1654);
3122 begin
3123 --
3124 if g_debug then
3125 l_package := g_package||'.write_logfile';
3126 hr_utility.set_location ('Entering '||l_package,10);
3127 end if;
3128 --
3129 benutils.write(p_text => benutils.g_banner_minus);
3130 benutils.write(p_text => 'Benefits Statistical Information');
3131 benutils.write(p_text => benutils.g_banner_minus);
3132 benutils.write(p_text => 'Processed persons '||p_person_count);
3133 benutils.write(p_text => 'Errored persons '||p_error_person_count);
3134 benutils.write(p_text => benutils.g_banner_minus);
3135 --
3136 benutils.write_table_and_file(p_table => true,
3137 p_file => true);
3138 commit;
3139 --
3140 if g_debug then
3141 hr_utility.set_location ('Leaving '||l_package,10);
3142 end if;
3143 --
3144 exception
3145 --
3146 --
3147 when table_full then
3148 benutils.write(fnd_message.get);
3149 fnd_message.raise_error;
3150 when index_full then
3151 benutils.write(fnd_message.get);
3152 fnd_message.raise_error;
3153 --
3154 when others then
3155 --
3156 fnd_message.set_name('BEN','BEN_91663_BENMNGLE_LOGGING');
3157 benutils.write(fnd_message.get);
3158 fnd_message.raise_error;
3159 --
3160 end write_logfile;
3161 --
3162 procedure flush_global_structures is
3163 --
3164 l_package varchar2(80);
3165 --
3166 begin
3167 --
3168 g_debug := hr_utility.debug_enabled;
3169 if g_debug then
3170 l_package := g_package||'.flush_global_structures';
3171 hr_utility.set_location ('Entering '||l_package,10);
3172 end if;
3173 --
3174 g_cache_person_process.delete;
3175 benutils.clear_down_cache;
3176 benutils.g_batch_param_table_object.delete;
3177 ben_elig_rl_cache.clear_down_cache;
3178 ben_location_object.clear_down_cache;
3179 ben_org_object.clear_down_cache;
3180 ben_life_object.clear_down_cache;
3181 --
3182 -- Clear down comp object cache
3183 --
3184 ben_pln_cache.clear_down_cache;
3185 ben_cop_cache.clear_down_cache;
3186 ben_cobj_cache.clear_down_cache;
3187 ben_element_entry.clear_down_cache;
3188 --
3189 -- Clear down person object caches
3190 --
3191 ben_person_object.clear_down_cache;
3192 ben_batch_dt_api.clear_down_cache;
3193 --
3194 ben_pil_object.clear_down_cache;
3195 --
3196 if g_debug then
3197 hr_utility.set_location ('Leaving '||l_package,10);
3198 end if;
3199 --
3200 end flush_global_structures;
3201 --
3202 procedure print_parameters
3203 (p_benefit_action_id in number) is
3204 --
3205 l_package varchar2(80);
3206 l_rec benutils.g_batch_param_rec;
3207 -- added bug: 5618436
3208 CURSOR c_conc_pgm_name is
3209 SELECT fcp.concurrent_program_name
3210 FROM ben_benefit_actions bft, fnd_concurrent_programs fcp
3211 WHERE bft.program_id = fcp.concurrent_program_id
3212 AND bft.benefit_action_id = p_benefit_action_id;
3213
3214 l_source_program fnd_concurrent_programs.concurrent_program_name%TYPE;
3215 --
3216 begin
3217 --
3218 if g_debug then
3219 l_package := g_package||'.print_parameters';
3220 hr_utility.set_location ('Entering '||l_package,10);
3221 end if;
3222 open c_conc_pgm_name;
3223 fetch c_conc_pgm_name into l_source_program;
3224 close c_conc_pgm_name;
3225 --
3226 if fnd_global.conc_request_id = -1 then
3227 return;
3228 end if;
3229 --
3230 benutils.get_batch_parameters
3231 (p_benefit_action_id => p_benefit_action_id,
3232 p_rec => l_rec);
3233 --
3234 fnd_file.put_line(which => fnd_file.log,
3235 buff => 'Runtime Parameters');
3236 fnd_file.put_line(which => fnd_file.log,
3237 buff => '------------------');
3238 fnd_file.put_line(which => fnd_file.log,
3239 buff => 'Concurrent Request ID :'||
3240 fnd_global.conc_request_id);
3241 fnd_file.put_line(which => fnd_file.log,
3242 buff => 'Run Mode :'||
3243 hr_general.decode_lookup('BEN_BENMNGLE_MD',l_rec.mode_cd));
3244 fnd_file.put_line(which => fnd_file.log,
3245 buff => 'Validation Mode :'||
3246 hr_general.decode_lookup('YES_NO',l_rec.validate_flag));
3247 -- bug: 5618436
3248 if l_source_program
3249 not in ('BENLIMOD','BENSCMOD','BENSEMOD','BENPAMOD','BENGSMOD','BENTEMOD')
3250 then
3251 fnd_file.put_line(which => fnd_file.log,
3252 buff => 'Limit By Person''s Organization :'||
3253 hr_general.decode_lookup('YES_NO',l_rec.lmt_prpnip_by_org_flag));
3254 end if;
3255
3256 fnd_file.put_line(which => fnd_file.log,
3257 buff => 'Benefit Action ID :'||
3258 p_benefit_action_id);
3259 fnd_file.put_line(which => fnd_file.log,
3260 buff => 'Effective Date :'||
3261 to_char(l_rec.process_date,'DD/MM/YYYY'));
3262 fnd_file.put_line(which => fnd_file.log,
3263 buff => 'Derivable Factors :'||
3264 hr_general.decode_lookup('BEN_DTCT_TMPRL_LER_TYP',l_rec.derivable_factors_flag));
3265 fnd_file.put_line(which => fnd_file.log,
3266 buff => 'Business Group ID :'||
3267 l_rec.business_group_id);
3268 fnd_file.put_line(which => fnd_file.log,
3269 buff => 'Program ID :'||
3270 benutils.iftrue
3271 (p_expression => l_rec.pgm_id is null,
3272 p_true => 'All',
3273 p_false => l_rec.pgm_id));
3274 fnd_file.put_line(which => fnd_file.log,
3275 buff => 'Plan ID :'||
3276 benutils.iftrue
3277 (p_expression => l_rec.pl_id is null,
3278 p_true => 'All',
3279 p_false => l_rec.pl_id));
3280 fnd_file.put_line(which => fnd_file.log,
3281 buff => 'Plan Type ID :'||
3282 benutils.iftrue
3283 (p_expression => l_rec.pl_typ_id is null,
3284 p_true => 'All',
3285 p_false => l_rec.pl_typ_id));
3286 fnd_file.put_line(which => fnd_file.log,
3287 buff => 'Option ID :'||
3288 benutils.iftrue
3289 (p_expression => l_rec.opt_id is null,
3290 p_true => 'All',
3291 p_false => l_rec.opt_id));
3292 --
3293 -- PB : 5422 : Need to dump the lf_evt_dt
3294 -- popl_enrt_typ_cycl_id is no longer available.
3295 --
3296 /*
3297 fnd_file.put_line(which => fnd_file.log,
3298 buff => 'Enrollment Type Cycle :'||
3299 benutils.iftrue
3300 (p_expression => l_rec.popl_enrt_typ_cycl_id is null,
3301 p_true => 'All',
3302 p_false => l_rec.popl_enrt_typ_cycl_id));
3303 */
3304 fnd_file.put_line(which => fnd_file.log,
3305 buff => 'Just Plans not in Programs :'||
3306 hr_general.decode_lookup('YES_NO',l_rec.no_programs_flag));
3307 fnd_file.put_line(which => fnd_file.log,
3308 buff => 'Just Programs :'||
3309 hr_general.decode_lookup('YES_NO',l_rec.no_plans_flag));
3310 fnd_file.put_line(which => fnd_file.log,
3311 buff => 'Reporting Group :'||
3312 benutils.iftrue
3313 (p_expression => l_rec.rptg_grp_id is null,
3314 p_true => 'All',
3315 p_false => l_rec.rptg_grp_id));
3316 fnd_file.put_line(which => fnd_file.log,
3317 buff => 'Eligiblity Profile :'||
3318 benutils.iftrue
3319 (p_expression => l_rec.eligy_prfl_id is null,
3320 p_true => 'All',
3321 p_false => l_rec.eligy_prfl_id));
3322 fnd_file.put_line(which => fnd_file.log,
3323 buff => 'Variable Rate Profile :'||
3324 benutils.iftrue
3325 (p_expression => l_rec.vrbl_rt_prfl_id is null,
3326 p_true => 'All',
3327 p_false => l_rec.vrbl_rt_prfl_id));
3328 fnd_file.put_line(which => fnd_file.log,
3329 buff => 'Person Selection Rule :'||
3330 benutils.iftrue
3331 (p_expression => l_rec.person_selection_rl is null,
3332 p_true => 'None',
3333 p_false => l_rec.person_selection_rl));
3334 fnd_file.put_line(which => fnd_file.log,
3335 buff => 'Comp Object Selection Rule :'||
3336 benutils.iftrue
3337 (p_expression => l_rec.comp_selection_rl is null,
3338 p_true => 'None',
3339 p_false => l_rec.comp_selection_rl));
3340 --
3341 if g_debug then
3342 hr_utility.set_location ('Leaving '||l_package,10);
3343 end if;
3344 --
3345 end print_parameters;
3346 --
3347 -- CWBITEM
3348 --
3349 --
3350 -- CWB Procedure for population of the CWB Hierarchy table
3351 --
3352 procedure popu_pel_heir is
3353 --
3354 l_proc VARCHAR2(80);
3355 l_level number := 1 ;
3356 l_emp_pel number ;
3357 l_mgr_pel number ;
3358 l_mgr_person_id number ;
3359 l_mgr_person_id_out number ;
3360 l_business_group_id number ;
3361 l_pl_id number;
3362 l_lf_evt_ocrd_dt date;
3363 l_ler_id number;
3364 l_rec benutils.g_batch_param_rec;
3365 lv_pl_id number;
3366 lv_business_group_id number;
3367 lv_ler_id number;
3368 lv_lf_evt_ocrd_dt date;
3369 --
3370 -- Bug 2288042 : Create 0 level heirarchy data if manager is
3371 -- is processed first and employee is processed later.
3372 --
3373 cursor c_no_0_hrchy(p_pl_id number,
3374 p_lf_evt_ocrd_dt date,
3375 p_business_group_id number) is
3376 select unique pel_0.mgr_pil_elctbl_chc_popl_id
3377 from ben_cwb_hrchy pel_0,
3378 ben_pil_elctbl_chc_popl mgr_pel_0,
3379 ben_per_in_ler pil_0
3380 where
3381 mgr_pel_0.pil_elctbl_chc_popl_id = pel_0.mgr_pil_elctbl_chc_popl_id
3382 and mgr_pel_0.per_in_ler_id = pil_0.per_in_ler_id
3383 and mgr_pel_0.pl_id = p_pl_id
3384 and pil_0.lf_evt_ocrd_dt = p_lf_evt_ocrd_dt
3385 -- and pil_0.ler_id = p_ler_id
3386 and pil_0.business_group_id = p_business_group_id
3387 and pil_0.per_in_ler_stat_cd = 'STRTD'
3388 and pel_0.lvl_num > 0
3389 and pel_0.mgr_pil_elctbl_chc_popl_id not in
3390 ( select mgr_pel.pil_elctbl_chc_popl_id
3391 from ben_cwb_hrchy hrh,
3392 ben_pil_elctbl_chc_popl mgr_pel,
3393 ben_per_in_ler pil
3394 where hrh.mgr_pil_elctbl_chc_popl_id =
3395 hrh.emp_pil_elctbl_chc_popl_id
3396 and mgr_pel.pil_elctbl_chc_popl_id = hrh.mgr_pil_elctbl_chc_popl_id
3397 and hrh.lvl_num = 0
3398 and mgr_pel.per_in_ler_id = pil.per_in_ler_id
3399 and mgr_pel.pl_id = p_pl_id
3400 and pil.lf_evt_ocrd_dt = p_lf_evt_ocrd_dt
3401 -- and pil.ler_id = p_ler_id
3402 and pil.business_group_id = p_business_group_id
3403 and pil.per_in_ler_stat_cd = 'STRTD'
3404 );
3405 --
3406 -- Cursor to select the pel records for emp
3407 -- These are the records created initially with mgr_pil_elctbl_chc_popl_id and
3408 -- lvl_num as '-1'
3409 --
3410 cursor c_pel(cv_pl_id number, cv_lf_evt_ocrd_dt date) is
3411 select
3412 cwb.emp_pil_elctbl_chc_popl_id,
3413 pel.ws_mgr_id
3414 from
3415 ben_cwb_hrchy cwb,
3416 ben_pil_elctbl_chc_popl pel ,
3417 ben_per_in_ler pil
3418 where
3419 cwb.mgr_pil_elctbl_chc_popl_id = -1
3420 and pel.pil_elctbl_chc_popl_id = cwb.emp_pil_elctbl_chc_popl_id
3421 --
3422 -- Bug 2541072 : Do not consider all per in ler's.
3423 --
3424 and pel.per_in_ler_id = pil.per_in_ler_id
3425 and pil.per_in_ler_stat_cd = 'STRTD'
3426 and ((cv_pl_id = -1 and cv_lf_evt_ocrd_dt = hr_api.g_eot)
3427 or
3428 (pil.lf_evt_ocrd_dt = cv_lf_evt_ocrd_dt and pel.pl_id = cv_pl_id)
3429 )
3430 and cwb.lvl_num = -1;
3431 --
3432 -- To get the pl_id, lf_evt_ocrd_dt, ler_id and business_group_id of the first records.
3433 -- This is the criteria used for finding the pel records in the hierarchy.
3434 --
3435 cursor c_pl_ler(p_pil_elctbl_chc_popl_id number) is
3436 select
3437 pel.pl_id,
3438 pil.lf_evt_ocrd_dt,
3439 pil.ler_id,
3440 pil.business_group_id
3441 from
3442 ben_pil_elctbl_chc_popl pel,
3443 ben_per_in_ler pil
3444 where
3445 pel.per_in_ler_id = pil.per_in_ler_id
3446 and pel.pil_elctbl_chc_popl_id = p_pil_elctbl_chc_popl_id
3447 and pil.per_in_ler_stat_cd = 'STRTD';
3448 --
3449 -- This private procedure determines the Manager pel
3450 -- This will get the manager pel record for a given emp - cascading
3451 procedure mgr( p_person_id number,
3452 p_business_group_id number,
3453 p_pl_id number,
3454 p_lf_evt_ocrd_dt date,
3455 p_ler_id number,
3456 p_ws_mgr_id out nocopy number,
3457 p_pil_elctbl_chc_popl_id out nocopy number ) is
3458 --
3459 cursor c_mgr(p_person_id number,
3460 p_pl_id number,
3461 p_lf_evt_ocrd_dt date,
3462 p_ler_id number,
3463 p_business_group_id number) is
3464 select pel.ws_mgr_id,
3465 pel.pil_elctbl_chc_popl_id
3466 from ben_pil_elctbl_chc_popl pel,
3467 ben_per_in_ler pil
3468 where pel.per_in_ler_id = pil.per_in_ler_id
3469 and pel.pl_id = p_pl_id
3470 and pil.lf_evt_ocrd_dt = p_lf_evt_ocrd_dt
3471 and pil.ler_id = p_ler_id
3472 and pil.person_id = p_person_id
3473 and pil.business_group_id = p_business_group_id
3474 and pil.per_in_ler_stat_cd = 'STRTD';
3475 --
3476 l_ws_mgr_id number := null ;
3477 l_pil_elctbl_chc_popl_id number := null ;
3478 begin
3479 --
3480 g_debug := hr_utility.debug_enabled;
3481 if g_debug then
3482 hr_utility.set_location('MGR p_person_id '||p_person_id,22);
3483 hr_utility.set_location('MGR p_business_group_id '||p_business_group_id,23);
3484 end if;
3485 --
3486 open c_mgr (p_person_id,p_pl_id,p_lf_evt_ocrd_dt,p_ler_id,p_business_group_id);
3487 fetch c_mgr into l_ws_mgr_id,l_pil_elctbl_chc_popl_id ;
3488 close c_mgr ;
3489 --
3490 if g_debug then
3491 hr_utility.set_location('MGR OUT l_pil_elctbl_chc_popl_id '||l_pil_elctbl_chc_popl_id,30);
3492 hr_utility.set_location('MGR OUT l_ws_mgr_id '||l_ws_mgr_id,40);
3493 end if;
3494 --
3495 p_pil_elctbl_chc_popl_id := l_pil_elctbl_chc_popl_id ;
3496 p_ws_mgr_id := l_ws_mgr_id ;
3497 end;
3498 --
3499 -- This procedure inserts records into hierarchy table
3500 --
3501 procedure insert_mgr_hrchy ( p_emp_pil_elctbl_chc_popl_id number,
3502 p_mgr_pil_elctbl_chc_popl_id number,
3503 p_lvl_num number ) is
3504 begin
3505 --
3506 if g_debug then
3507 hr_utility.set_location('insert_mgr_hrchy p_emp_pil_elctbl_chc_popl_id '
3508 ||p_emp_pil_elctbl_chc_popl_id,10);
3509 hr_utility.set_location('insert_mgr_hrchy p_mgr_pil_elctbl_chc_popl_id '
3510 ||p_mgr_pil_elctbl_chc_popl_id || ' lvl = ' || p_lvl_num, 20);
3511 end if;
3512 insert into ben_cwb_hrchy (
3513 emp_pil_elctbl_chc_popl_id,
3514 mgr_pil_elctbl_chc_popl_id,
3515 lvl_num )
3516 values (
3517 p_emp_pil_elctbl_chc_popl_id,
3518 p_mgr_pil_elctbl_chc_popl_id,
3519 p_lvl_num );
3520 --
3521 exception when others then
3522 --
3523 -- raise;
3524 null; -- For Bug 2712602
3525 --
3526 end insert_mgr_hrchy;
3527 --
3528 procedure update_init_pel(cv_pl_id number, cv_lf_evt_ocrd_dt date) is
3529 --
3530 -- CWB bug : 2712602
3531 --
3532 cursor c_cwh is
3533 select rowid
3534 from ben_cwb_hrchy cwh
3535 where cwh.lvl_num = -1 and
3536 cwh.mgr_pil_elctbl_chc_popl_id = -1
3537 --
3538 -- Bug 2541072 : Do not consider all per in ler's.
3539 --
3540 and exists
3541 (select null
3542 from ben_pil_elctbl_chc_popl pel ,
3543 ben_per_in_ler pil
3544 where pel.pil_elctbl_chc_popl_id = cwh.emp_pil_elctbl_chc_popl_id
3545 and pel.per_in_ler_id = pil.per_in_ler_id
3546 and pil.per_in_ler_stat_cd = 'STRTD'
3547 and ((cv_pl_id = -1 and cv_lf_evt_ocrd_dt = hr_api.g_eot)
3548 or
3549 (pil.lf_evt_ocrd_dt = cv_lf_evt_ocrd_dt and pel.pl_id = cv_pl_id)
3550 )
3551 ) ;
3552 --
3553 begin
3554 --
3555 -- Also delete the rows for employees who do not have
3556 -- subordinates and with level -1 .
3557 -- And also the last subordinate is now reporting to another manager
3558 -- we need to delete the pel,0,0 row of the employee.
3559 --
3560 delete
3561 from ben_cwb_hrchy cwh
3562 where (( cwh.lvl_num = -1
3563 and cwh.mgr_pil_elctbl_chc_popl_id = -1) OR
3564 ( cwh.lvl_num = 0 and
3565 cwh.mgr_pil_elctbl_chc_popl_id = cwh.emp_pil_elctbl_chc_popl_id ) )
3566 and not exists
3567 (select null
3568 from ben_cwb_hrchy cwh1
3569 where cwh1.mgr_pil_elctbl_chc_popl_id = cwh.emp_pil_elctbl_chc_popl_id
3570 and cwh1.lvl_num <> 0
3571 )
3572 --
3573 -- Bug 2541072 : Do not consider all per in ler's.
3574 --
3575 and exists
3576 (select null
3577 from ben_pil_elctbl_chc_popl pel ,
3578 ben_per_in_ler pil
3579 where pel.pil_elctbl_chc_popl_id = cwh.emp_pil_elctbl_chc_popl_id
3580 and pel.per_in_ler_id = pil.per_in_ler_id
3581 and pil.per_in_ler_stat_cd = 'STRTD'
3582 and ((cv_pl_id = -1 and cv_lf_evt_ocrd_dt = hr_api.g_eot)
3583 or
3584 (pil.lf_evt_ocrd_dt = cv_lf_evt_ocrd_dt and pel.pl_id = cv_pl_id)
3585 )
3586 ) ;
3587 --
3588 -- Bug 2712602
3589 --
3590 for l_cwh in c_cwh loop
3591 --
3592 begin
3593 --
3594 update ben_cwb_hrchy cwh
3595 set cwh.mgr_pil_elctbl_chc_popl_id = cwh.emp_pil_elctbl_chc_popl_id,
3596 cwh.lvl_num = 0
3597 where cwh.lvl_num = -1
3598 and cwh.mgr_pil_elctbl_chc_popl_id = -1
3599 and cwh.rowid = l_cwh.rowid;
3600 exception
3601 when others then
3602 delete from ben_cwb_hrchy where rowid = l_cwh.rowid;null;
3603 end;
3604 --
3605 end loop;
3606 --
3607 exception when others then
3608 raise ;
3609 end ;
3610 --
3611 begin
3612 --
3613 if g_debug then
3614 l_proc := g_package|| '.popu_pel_heir';
3615 hr_utility.set_location('Entering: '||l_proc,10);
3616 end if;
3617 --
3618 lv_pl_id := -1;
3619 lv_lf_evt_ocrd_dt := hr_api.g_eot;
3620 --
3621 if benutils.g_benefit_action_id is not null then
3622 --
3623 benutils.get_batch_parameters
3624 (p_benefit_action_id => benutils.g_benefit_action_id,
3625 p_rec => l_rec);
3626 --
3627 lv_pl_id := l_rec.pl_id;
3628 lv_lf_evt_ocrd_dt := l_rec.lf_evt_ocrd_dt;
3629 lv_business_group_id := l_rec.business_group_id;
3630 lv_ler_id := l_rec.ler_id;
3631 --
3632 -- Bug 2574791
3633 else
3634 --
3635 lv_pl_id := g_rebuild_pl_id;
3636 lv_lf_evt_ocrd_dt := g_rebuild_lf_evt_ocrd_dt;
3637 lv_business_group_id := g_rebuild_business_group_id;
3638 --
3639 end if;
3640 --
3641 if g_debug then
3642 hr_utility.set_location(l_proc || ' lv_pl_id = ' || lv_pl_id, 9876);
3643 hr_utility.set_location(l_proc || ' lv_lf_evt_ocrd_dt = ' || lv_lf_evt_ocrd_dt, 9876);
3644 hr_utility.set_location(l_proc || ' lv_business_group_id = ' || lv_business_group_id, 9876);
3645 hr_utility.set_location(l_proc || ' lv_ler_id = ' || lv_ler_id, 9876);
3646 end if;
3647 open c_pel(lv_pl_id, lv_lf_evt_ocrd_dt);
3648 fetch c_pel into l_emp_pel,l_mgr_person_id ;
3649 --
3650 if g_debug then
3651 hr_utility.set_location(' l_emp_pel '||l_emp_pel,99);
3652 hr_utility.set_location(' l_mgr_person_id '||l_mgr_person_id,99);
3653 end if;
3654 if c_pel%found then
3655 --
3656 open c_pl_ler(l_emp_pel);
3657 fetch c_pl_ler into l_pl_id, l_lf_evt_ocrd_dt, l_ler_id, l_business_group_id ;
3658 close c_pl_ler ;
3659 --
3660 end if;
3661 --
3662 if g_debug then
3663 hr_utility.set_location(' l_pl_id '||l_pl_id,99);
3664 hr_utility.set_location(' l_lf_evt_ocrd_dt '||l_lf_evt_ocrd_dt,99);
3665 hr_utility.set_location(' l_ler_id '||l_ler_id,99);
3666 hr_utility.set_location(' l_business_group_id '||l_business_group_id,99);
3667 end if;
3668 <<pel>>
3669 loop
3670 --
3671 exit pel when c_pel%notfound ;
3672 l_level := 1 ;
3673 --
3674 <<mgr_loop>>
3675 loop
3676 --
3677 if g_debug then
3678 hr_utility.set_location('Before mgr l_mgr_person_id '||l_mgr_person_id,10);
3679 end if;
3680 mgr(l_mgr_person_id,
3681 l_business_group_id,
3682 l_pl_id,
3683 l_lf_evt_ocrd_dt,
3684 l_ler_id,
3685 l_mgr_person_id_out,
3686 l_mgr_pel);
3687 if g_debug then
3688 hr_utility.set_location('After Mgr l_mgr_person_id '||l_mgr_person_id,20);
3689 hr_utility.set_location('After Mgr l_mgr_person_id_out '||l_mgr_person_id_out,20);
3690 hr_utility.set_location('After Mgr l_mgr_pel '||l_mgr_pel,30);
3691 end if;
3692 --
3693 if l_mgr_pel is not null then
3694 --
3695 insert_mgr_hrchy(l_emp_pel,l_mgr_pel,l_level);
3696 --
3697 end if;
3698 --
3699 exit mgr_loop when (l_mgr_person_id = l_mgr_person_id_out
3700 OR l_mgr_person_id_out is null ) ;
3701 --call to insert routne
3702 if g_debug then
3703 hr_utility.set_location('Emp EPE '||l_emp_pel , 20);
3704 hr_utility.set_location('Mgr EPE '||l_mgr_pel , 30);
3705 hr_utility.set_location('Level '||l_level , 40);
3706 end if;
3707 --
3708 -- insert_mgr_hrchy(l_emp_pel,l_mgr_pel,l_level);
3709 --
3710 --after call to insert routine
3711 --
3712 l_mgr_person_id := l_mgr_person_id_out ;
3713 l_level := l_level + 1 ;
3714 l_mgr_pel := null ;
3715 --
3716 end loop mgr_loop;
3717 --
3718 fetch c_pel into l_emp_pel,l_mgr_person_id ;
3719 --
3720 if c_pel%found then
3721 --
3722 open c_pl_ler(l_emp_pel);
3723 fetch c_pl_ler into l_pl_id, l_lf_evt_ocrd_dt, l_ler_id, l_business_group_id ;
3724 close c_pl_ler ;
3725 --
3726 end if;
3727 --
3728 if g_debug then
3729 hr_utility.set_location(' End of mgr_loop ',99);
3730 end if;
3731 end loop pel ;
3732 --
3733 close c_pel ;
3734 --
3735 --call to delete the intial pel records
3736 if g_debug then
3737 hr_utility.set_location('Before call to delete_init_pel',10);
3738 end if;
3739 update_init_pel(lv_pl_id, lv_lf_evt_ocrd_dt) ;
3740 if g_debug then
3741 hr_utility.set_location('After call to delete_init_pel',10);
3742 end if;
3743 --
3744 -- CWB 2712602 : Delete all the hrchy data linked to backed out per in ler.
3745 --
3746 delete from ben_cwb_hrchy
3747 where emp_pil_elctbl_chc_popl_id in (
3748 select pel.pil_elctbl_chc_popl_id
3749 from ben_pil_elctbl_chc_popl pel,
3750 ben_per_in_ler pil
3751 where pel.pl_id = lv_pl_id
3752 and pil.lf_evt_ocrd_dt = lv_lf_evt_ocrd_dt
3753 and pil.per_in_ler_id = pel.per_in_ler_id
3754 and pil.per_in_ler_stat_cd = 'BCKDT');
3755 --
3756 delete from ben_cwb_hrchy
3757 where mgr_pil_elctbl_chc_popl_id in (
3758 select pel.pil_elctbl_chc_popl_id
3759 from ben_pil_elctbl_chc_popl pel,
3760 ben_per_in_ler pil
3761 where pel.pl_id = lv_pl_id
3762 and pil.lf_evt_ocrd_dt = lv_lf_evt_ocrd_dt
3763 and pil.per_in_ler_id = pel.per_in_ler_id
3764 and pil.per_in_ler_stat_cd = 'BCKDT');
3765 --
3766 -- After testing on hrcwbdvl uncomment the code.
3767 --
3768 -- Bug 2288042
3769 -- Create 0 level heirarchy data for managers for whom this data
3770 -- is missing.
3771 --
3772 for l_no_0_hrchy in c_no_0_hrchy(lv_pl_id, lv_lf_evt_ocrd_dt, lv_business_group_id) loop
3773 --
3774 begin
3775 --
3776 insert into ben_cwb_hrchy (
3777 emp_pil_elctbl_chc_popl_id,
3778 mgr_pil_elctbl_chc_popl_id,
3779 lvl_num )
3780 values (
3781 l_no_0_hrchy.mgr_pil_elctbl_chc_popl_id,
3782 l_no_0_hrchy.mgr_pil_elctbl_chc_popl_id,
3783 0 );
3784 --
3785 exception when others then
3786 null;
3787 end;
3788 --
3789 end loop;
3790 if g_debug then
3791 hr_utility.set_location('Leaving: '||l_proc,10);
3792 end if;
3793 --
3794 end popu_pel_heir;
3795 --
3796 --
3797 -- CWB Procedure for population of the CWB Hierarchy table
3798 --
3799 /*
3800 procedure popu_epe_heir is
3801 --
3802 l_proc VARCHAR2(80);
3803 l_level number := 1 ;
3804 l_emp_epe number ;
3805 l_mgr_epe number ;
3806 l_mgr_person_id number ;
3807 l_mgr_person_id_out number ;
3808 l_business_group_id number ;
3809 l_pl_id number;
3810 l_lf_evt_ocrd_dt date;
3811 l_ler_id number;
3812 l_rec benutils.g_batch_param_rec;
3813 lv_pl_id number;
3814 lv_business_group_id number;
3815 lv_ler_id number;
3816 lv_lf_evt_ocrd_dt date;
3817 --
3818 -- Bug 2288042 : Create 0 level heirarchy data if manager is
3819 -- is processed first and employee is processed later.
3820 --
3821 cursor c_no_0_hrchy(p_pl_id number,
3822 p_lf_evt_ocrd_dt date,
3823 p_business_group_id number) is
3824 select unique epe_0.mgr_elig_per_elctbl_chc_id
3825 from ben_cwb_mgr_hrchy epe_0,
3826 ben_elig_per_elctbl_chc mgr_epe_0,
3827 ben_per_in_ler pil_0
3828 where
3829 mgr_epe_0.elig_per_elctbl_chc_id = epe_0.mgr_elig_per_elctbl_chc_id
3830 and mgr_epe_0.per_in_ler_id = pil_0.per_in_ler_id
3831 and mgr_epe_0.pl_id = p_pl_id
3832 and pil_0.lf_evt_ocrd_dt = p_lf_evt_ocrd_dt
3833 -- and pil_0.ler_id = p_ler_id
3834 and pil_0.business_group_id = p_business_group_id
3835 and pil_0.per_in_ler_stat_cd = 'STRTD'
3836 and epe_0.lvl_num > 0
3837 and epe_0.mgr_elig_per_elctbl_chc_id not in
3838 ( select mgr_epe.elig_per_elctbl_chc_id
3839 from ben_cwb_mgr_hrchy hrh,
3840 ben_elig_per_elctbl_chc mgr_epe,
3841 ben_per_in_ler pil
3842 where hrh.mgr_elig_per_elctbl_chc_id =
3843 hrh.emp_elig_per_elctbl_chc_id
3844 and mgr_epe.elig_per_elctbl_chc_id = hrh.mgr_elig_per_elctbl_chc_id
3845 and hrh.lvl_num = 0
3846 and mgr_epe.per_in_ler_id = pil.per_in_ler_id
3847 and mgr_epe.pl_id = p_pl_id
3848 and pil.lf_evt_ocrd_dt = p_lf_evt_ocrd_dt
3849 -- and pil.ler_id = p_ler_id
3850 and pil.business_group_id = p_business_group_id
3851 and pil.per_in_ler_stat_cd = 'STRTD'
3852 );
3853 --
3854 -- Cursor to select the epe records for emp
3855 -- These are the records created initially with mgr_elig_per_elctbl_chc_id and
3856 -- lvl_num as '-1'
3857 --
3858 cursor c_epe(cv_pl_id number, cv_lf_evt_ocrd_dt date) is
3859 select
3860 cwb.emp_elig_per_elctbl_chc_id,
3861 epe.ws_mgr_id
3862 from
3863 ben_cwb_mgr_hrchy cwb,
3864 ben_elig_per_elctbl_chc epe ,
3865 ben_per_in_ler pil
3866 where
3867 cwb.mgr_elig_per_elctbl_chc_id = -1
3868 and epe.elig_per_elctbl_chc_id = cwb.emp_elig_per_elctbl_chc_id
3869 --
3870 -- Bug 2541072 : Do not consider all per in ler's.
3871 --
3872 and epe.per_in_ler_id = pil.per_in_ler_id
3873 and pil.per_in_ler_stat_cd = 'STRTD'
3874 and ((cv_pl_id = -1 and cv_lf_evt_ocrd_dt = hr_api.g_eot)
3875 or
3876 (pil.lf_evt_ocrd_dt = cv_lf_evt_ocrd_dt and epe.pl_id = cv_pl_id)
3877 )
3878 and cwb.lvl_num = -1;
3879 --
3880 -- To get the pl_id, lf_evt_ocrd_dt, ler_id and business_group_id of the first records.
3881 -- This is the criteria used for finding the epe records in the hierarchy.
3882 --
3883 cursor c_pl_ler(p_elig_per_elctbl_chc_id number) is
3884 select
3885 epe.pl_id,
3886 pil.lf_evt_ocrd_dt,
3887 pil.ler_id,
3888 pil.business_group_id
3889 from
3890 ben_elig_per_elctbl_chc epe,
3891 ben_per_in_ler pil
3892 where
3893 epe.per_in_ler_id = pil.per_in_ler_id
3894 and epe.elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id
3895 and pil.per_in_ler_stat_cd = 'STRTD';
3896 --
3897 -- This private procedure determines the Manager epe
3898 -- This will get the manager epe record for a given emp - cascading
3899 procedure mgr( p_person_id number,
3900 p_business_group_id number,
3901 p_pl_id number,
3902 p_lf_evt_ocrd_dt date,
3903 p_ler_id number,
3904 p_ws_mgr_id out nocopy number,
3905 p_elig_per_elctbl_chc_id out nocopy number ) is
3906 --
3907 cursor c_mgr(p_person_id number,
3908 p_pl_id number,
3909 p_lf_evt_ocrd_dt date,
3910 p_ler_id number,
3911 p_business_group_id number) is
3912 select epe.ws_mgr_id,
3913 epe.elig_per_elctbl_chc_id
3914 from ben_elig_per_elctbl_chc epe,
3915 ben_per_in_ler pil
3916 where epe.per_in_ler_id = pil.per_in_ler_id
3917 and epe.pl_id = p_pl_id
3918 and pil.lf_evt_ocrd_dt = p_lf_evt_ocrd_dt
3919 and pil.ler_id = p_ler_id
3920 and pil.person_id = p_person_id
3921 and pil.business_group_id = p_business_group_id
3922 and pil.per_in_ler_stat_cd = 'STRTD';
3923 --
3924 l_ws_mgr_id number := null ;
3925 l_elig_per_elctbl_chc_id number := null ;
3926 begin
3927 --
3928 if g_debug then
3929 hr_utility.set_location('MGR p_person_id '||p_person_id,22);
3930 hr_utility.set_location('MGR p_business_group_id '||p_business_group_id,23);
3931 end if;
3932 --
3933 open c_mgr (p_person_id,p_pl_id,p_lf_evt_ocrd_dt,p_ler_id,p_business_group_id);
3934 fetch c_mgr into l_ws_mgr_id,l_elig_per_elctbl_chc_id ;
3935 close c_mgr ;
3936 --
3937 if g_debug then
3938 hr_utility.set_location('MGR OUT l_elig_per_elctbl_chc_id '||l_elig_per_elctbl_chc_id,30);
3939 hr_utility.set_location('MGR OUT l_ws_mgr_id '||l_ws_mgr_id,40);
3940 end if;
3941 --
3942 p_elig_per_elctbl_chc_id := l_elig_per_elctbl_chc_id ;
3943 p_ws_mgr_id := l_ws_mgr_id ;
3944 end;
3945 --
3946 -- This procedure inserts records into hierarchy table
3947 --
3948 procedure insert_mgr_hrchy ( p_emp_elig_per_elctbl_chc_id number,
3949 p_mgr_elig_per_elctbl_chc_id number,
3950 p_lvl_num number ) is
3951 begin
3952 --
3953 if g_debug then
3954 hr_utility.set_location('insert_mgr_hrchy p_emp_elig_per_elctbl_chc_id '
3955 ||p_emp_elig_per_elctbl_chc_id,10);
3956 hr_utility.set_location('insert_mgr_hrchy p_mgr_elig_per_elctbl_chc_id '
3957 ||p_mgr_elig_per_elctbl_chc_id || ' lvl = ' || p_lvl_num, 20);
3958 end if;
3959 insert into ben_cwb_mgr_hrchy (
3960 emp_elig_per_elctbl_chc_id,
3961 mgr_elig_per_elctbl_chc_id,
3962 lvl_num )
3963 values (
3964 p_emp_elig_per_elctbl_chc_id,
3965 p_mgr_elig_per_elctbl_chc_id,
3966 p_lvl_num );
3967 --
3968 exception when others then
3969 --
3970 raise;
3971 --
3972 end insert_mgr_hrchy;
3973 --
3974 procedure update_init_epe(cv_pl_id number, cv_lf_evt_ocrd_dt date) is
3975 begin
3976 --
3977 -- Also delete the rows for employees who do not have
3978 -- subordinates and with level -1 .
3979 -- And also the last subordinate is now reporting to another manager
3980 -- we need to delete the epe,0,0 row of the employee.
3981 --
3982 delete
3983 from ben_cwb_mgr_hrchy cwh
3984 where (( cwh.lvl_num = -1
3985 and cwh.mgr_elig_per_elctbl_chc_id = -1) OR
3986 ( cwh.lvl_num = 0 and
3987 cwh.mgr_elig_per_elctbl_chc_id = cwh.emp_elig_per_elctbl_chc_id ) )
3988 and not exists
3989 (select null
3990 from ben_cwb_mgr_hrchy cwh1
3991 where cwh1.mgr_elig_per_elctbl_chc_id = cwh.emp_elig_per_elctbl_chc_id
3992 and cwh1.lvl_num <> 0
3993 )
3994 --
3995 -- Bug 2541072 : Do not consider all per in ler's.
3996 --
3997 and exists
3998 (select null
3999 from ben_elig_per_elctbl_chc epe ,
4000 ben_per_in_ler pil
4001 where epe.elig_per_elctbl_chc_id = cwh.emp_elig_per_elctbl_chc_id
4002 and epe.per_in_ler_id = pil.per_in_ler_id
4003 and pil.per_in_ler_stat_cd = 'STRTD'
4004 and ((cv_pl_id = -1 and cv_lf_evt_ocrd_dt = hr_api.g_eot)
4005 or
4006 (pil.lf_evt_ocrd_dt = cv_lf_evt_ocrd_dt and epe.pl_id = cv_pl_id)
4007 )
4008 ) ;
4009 --
4010 update ben_cwb_mgr_hrchy cwh
4011 set cwh.mgr_elig_per_elctbl_chc_id = cwh.emp_elig_per_elctbl_chc_id,
4012 cwh.lvl_num = 0
4013 where cwh.lvl_num = -1 and
4014 cwh.mgr_elig_per_elctbl_chc_id = -1
4015 --
4016 -- Bug 2541072 : Do not consider all per in ler's.
4017 --
4018 and exists
4019 (select null
4020 from ben_elig_per_elctbl_chc epe ,
4021 ben_per_in_ler pil
4022 where epe.elig_per_elctbl_chc_id = cwh.emp_elig_per_elctbl_chc_id
4023 and epe.per_in_ler_id = pil.per_in_ler_id
4024 and pil.per_in_ler_stat_cd = 'STRTD'
4025 and ((cv_pl_id = -1 and cv_lf_evt_ocrd_dt = hr_api.g_eot)
4026 or
4027 (pil.lf_evt_ocrd_dt = cv_lf_evt_ocrd_dt and epe.pl_id = cv_pl_id)
4028 )
4029 ) ;
4030 --
4031 exception when others then
4032 raise ;
4033 end ;
4034 --
4035 begin
4036 --
4037 if g_debug then
4038 l_proc := g_package|| '.popu_epe_heir';
4039 hr_utility.set_location('Entering: '||l_proc,10);
4040 end if;
4041 --
4042 lv_pl_id := -1;
4043 lv_lf_evt_ocrd_dt := hr_api.g_eot;
4044 --
4045 if benutils.g_benefit_action_id is not null then
4046 --
4047 benutils.get_batch_parameters
4048 (p_benefit_action_id => benutils.g_benefit_action_id,
4049 p_rec => l_rec);
4050 --
4051 lv_pl_id := l_rec.pl_id;
4052 lv_lf_evt_ocrd_dt := l_rec.lf_evt_ocrd_dt;
4053 lv_business_group_id := l_rec.business_group_id;
4054 lv_ler_id := l_rec.ler_id;
4055 --
4056 -- Bug 2574791
4057 else
4058 --
4059 lv_pl_id := g_rebuild_pl_id;
4060 lv_lf_evt_ocrd_dt := g_rebuild_lf_evt_ocrd_dt;
4061 lv_business_group_id := g_rebuild_business_group_id;
4062 --
4063 end if;
4064 --
4065 if g_debug then
4066 hr_utility.set_location(l_proc || ' lv_pl_id = ' || lv_pl_id, 9876);
4067 hr_utility.set_location(l_proc || ' lv_lf_evt_ocrd_dt = ' || lv_lf_evt_ocrd_dt, 9876);
4068 hr_utility.set_location(l_proc || ' lv_business_group_id = ' || lv_business_group_id, 9876);
4069 hr_utility.set_location(l_proc || ' lv_ler_id = ' || lv_ler_id, 9876);
4070 end if;
4071 open c_epe(lv_pl_id, lv_lf_evt_ocrd_dt);
4072 fetch c_epe into l_emp_epe,l_mgr_person_id ;
4073 --
4074 if g_debug then
4075 hr_utility.set_location(' l_emp_epe '||l_emp_epe,99);
4076 hr_utility.set_location(' l_mgr_person_id '||l_mgr_person_id,99);
4077 end if;
4078 if c_epe%found then
4079 --
4080 open c_pl_ler(l_emp_epe);
4081 fetch c_pl_ler into l_pl_id, l_lf_evt_ocrd_dt, l_ler_id, l_business_group_id ;
4082 close c_pl_ler ;
4083 --
4084 end if;
4085 --
4086 if g_debug then
4087 hr_utility.set_location(' l_pl_id '||l_pl_id,99);
4088 hr_utility.set_location(' l_lf_evt_ocrd_dt '||l_lf_evt_ocrd_dt,99);
4089 hr_utility.set_location(' l_ler_id '||l_ler_id,99);
4090 hr_utility.set_location(' l_business_group_id '||l_business_group_id,99);
4091 end if;
4092 <<epe>>
4093 loop
4094 --
4095 exit epe when c_epe%notfound ;
4096 l_level := 1 ;
4097 --
4098 <<mgr_loop>>
4099 loop
4100 --
4101 if g_debug then
4102 hr_utility.set_location('Before mgr l_mgr_person_id '||l_mgr_person_id,10);
4103 end if;
4104 mgr(l_mgr_person_id,
4105 l_business_group_id,
4106 l_pl_id,
4107 l_lf_evt_ocrd_dt,
4108 l_ler_id,
4109 l_mgr_person_id_out,
4110 l_mgr_epe);
4111 if g_debug then
4112 hr_utility.set_location('After Mgr l_mgr_person_id '||l_mgr_person_id,20);
4113 hr_utility.set_location('After Mgr l_mgr_person_id_out '||l_mgr_person_id_out,20);
4114 hr_utility.set_location('After Mgr l_mgr_epe '||l_mgr_epe,30);
4115 end if;
4116 --
4117 if l_mgr_epe is not null then
4118 --
4119 insert_mgr_hrchy(l_emp_epe,l_mgr_epe,l_level);
4120 --
4121 end if;
4122 --
4123 exit mgr_loop when (l_mgr_person_id = l_mgr_person_id_out
4124 OR l_mgr_person_id_out is null ) ;
4125 --call to insert routne
4126 if g_debug then
4127 hr_utility.set_location('Emp EPE '||l_emp_epe , 20);
4128 hr_utility.set_location('Mgr EPE '||l_mgr_epe , 30);
4129 hr_utility.set_location('Level '||l_level , 40);
4130 end if;
4131 --
4132 -- insert_mgr_hrchy(l_emp_epe,l_mgr_epe,l_level);
4133 --
4134 --after call to insert routine
4135 --
4136 l_mgr_person_id := l_mgr_person_id_out ;
4137 l_level := l_level + 1 ;
4138 l_mgr_epe := null ;
4139 --
4140 end loop mgr_loop;
4141 --
4142 fetch c_epe into l_emp_epe,l_mgr_person_id ;
4143 --
4144 if c_epe%found then
4145 --
4146 open c_pl_ler(l_emp_epe);
4147 fetch c_pl_ler into l_pl_id, l_lf_evt_ocrd_dt, l_ler_id, l_business_group_id ;
4148 close c_pl_ler ;
4149 --
4150 end if;
4151 --
4152 if g_debug then
4153 hr_utility.set_location(' End of mgr_loop ',99);
4154 end if;
4155 end loop epe ;
4156 --
4157 close c_epe ;
4158 --
4159 --call to delete the intial epe records
4160 if g_debug then
4161 hr_utility.set_location('Before call to delete_init_epe',10);
4162 end if;
4163 update_init_epe(lv_pl_id, lv_lf_evt_ocrd_dt) ;
4164 if g_debug then
4165 hr_utility.set_location('After call to delete_init_epe',10);
4166 end if;
4167 -- After testing on hrcwbdvl uncomment the code.
4168 --
4169 -- Bug 2288042
4170 -- Create 0 level heirarchy data for managers for whom this data
4171 -- is missing.
4172 --
4173 for l_no_0_hrchy in c_no_0_hrchy(lv_pl_id, lv_lf_evt_ocrd_dt, lv_business_group_id) loop
4174 --
4175 begin
4176 --
4177 insert into ben_cwb_mgr_hrchy (
4178 emp_elig_per_elctbl_chc_id,
4179 mgr_elig_per_elctbl_chc_id,
4180 lvl_num )
4181 values (
4182 l_no_0_hrchy.mgr_elig_per_elctbl_chc_id,
4183 l_no_0_hrchy.mgr_elig_per_elctbl_chc_id,
4184 0 );
4185 --
4186 exception when others then
4187 null;
4188 end;
4189 --
4190 end loop;
4191 if g_debug then
4192 hr_utility.set_location('Leaving: '||l_proc,10);
4193 end if;
4194 --
4195 end popu_epe_heir;
4196 --
4197 */
4198 procedure popu_cross_gb_epe_pel_data(
4199 p_mode in varchar2,
4200 p_person_id in number,
4201 p_business_group_id in number,
4202 p_ler_id in number,
4203 p_pl_id in number,
4204 p_effective_date in date,
4205 p_lf_evt_ocrd_dt in date
4206 ) is
4207 --
4208 l_package varchar2(80);
4209 --
4210 l_rec benutils.g_active_life_event;
4211 l_mgr_rec benutils.g_active_life_event;
4212 l_mgr_rec_temp benutils.g_active_life_event;
4213 l_effective_date date := nvl(p_lf_evt_ocrd_dt, p_effective_date);
4214 l_procd_dt date;
4215 l_strtd_dt date;
4216 l_voidd_dt date;
4217 l_ptnl_ler_for_per_id number;
4218 l_object_version_number number;
4219 l_dummy_per_in_ler_id number;
4220 l_mgr_per_in_ler_not_found boolean;
4221 l_mgr_person_id number;
4222 l_mgr_person_id_temp number;
4223 l_assignment_id number;
4224 l_elig_per_elctbl_chc_id number;
4225 --
4226 l_created_by ben_elig_per_elctbl_chc.created_by%TYPE;
4227 l_creation_date ben_elig_per_elctbl_chc.creation_date%TYPE;
4228 l_last_update_date ben_elig_per_elctbl_chc.last_update_date%TYPE;
4229 l_last_updated_by ben_elig_per_elctbl_chc.last_updated_by%TYPE;
4230 l_last_update_login ben_elig_per_elctbl_chc.last_update_login%TYPE;
4231 -- CWBITEM
4232 l_emp_pel_id number;
4233 l_pel_id number;
4234 --
4235 -- 9999 Why not use the pl_id, so that the data from the
4236 -- other conc program will not be picked up.
4237 --
4238 cursor c_pel(cv_per_in_ler_id in number) is
4239 select pel.dflt_enrt_dt,
4240 pel.cls_enrt_dt_to_use_cd,
4241 pel.enrt_typ_cycl_cd,
4242 pel.enrt_perd_strt_dt,
4243 pel.enrt_perd_end_dt,
4244 pel.lee_rsn_id,
4245 pel.enrt_perd_id,
4246 pel.uom,
4247 pel.acty_ref_perd_cd,
4248 pel.business_group_id per_business_group_id,
4249 per.business_group_id mgr_business_group_id,
4250 pel.ws_mgr_id
4251 from ben_pil_elctbl_chc_popl pel,
4252 per_all_people_f per
4253 where pel.per_in_ler_id = cv_per_in_ler_id
4254 and pel.ws_mgr_id = per.person_id (+)
4255 and l_effective_date between effective_start_date
4256 and effective_end_date;
4257 --
4258 cursor c_epe(cv_per_in_ler_id in number) is
4259 select epe.* ,
4260 pel.dflt_enrt_dt,
4261 pel.cls_enrt_dt_to_use_cd,
4262 pel.enrt_typ_cycl_cd,
4263 pel.enrt_perd_strt_dt,
4264 pel.enrt_perd_end_dt,
4265 pel.lee_rsn_id,
4266 pel.enrt_perd_id,
4267 pel.uom,
4268 pel.acty_ref_perd_cd,
4269 epe.business_group_id per_business_group_id,
4270 per.business_group_id mgr_business_group_id
4271 from ben_elig_per_elctbl_chc epe,
4272 ben_pil_elctbl_chc_popl pel,
4273 per_all_people_f per
4274 where epe.per_in_ler_id = cv_per_in_ler_id
4275 and epe.per_in_ler_id = pel.per_in_ler_id
4276 and epe.pl_id = pel.pl_id
4277 and epe.ws_mgr_id = per.person_id (+)
4278 and l_effective_date between effective_start_date
4279 and effective_end_date;
4280 --
4281 cursor c_ecr(cv_elig_per_elctbl_chc_id in number) is
4282 select ecr.*
4283 from ben_enrt_rt ecr
4284 where ecr.elig_per_elctbl_chc_id = cv_elig_per_elctbl_chc_id;
4285 --
4286 l_curr_pel c_pel%rowtype;
4287 l_curr_epe c_epe%rowtype;
4288 --
4289 -- Gets the enrolment information for this plan
4290 --
4291 CURSOR c_plan_enrolment_info(cv_person_id in number,
4292 cv_business_group_id in number,
4293 cv_lf_evt_ocrd_dt in date,
4294 cv_pl_id in number,
4295 cv_pgm_id in number)
4296 IS
4297 SELECT pen.prtt_enrt_rslt_id
4298 FROM ben_prtt_enrt_rslt_f pen
4299 WHERE pen.person_id = cv_person_id
4300 AND pen.business_group_id = cv_business_group_id
4301 AND pen.sspndd_flag = 'N'
4302 AND pen.prtt_enrt_rslt_stat_cd IS NULL
4303 AND pen.effective_end_date = hr_api.g_eot
4304 AND cv_lf_evt_ocrd_dt <= pen.enrt_cvg_thru_dt
4305 AND pen.enrt_cvg_strt_dt < pen.effective_end_date
4306 AND cv_pl_id = pen.pl_id
4307 AND (
4308 ( pen.pgm_id = cv_pgm_id
4309 AND cv_pgm_id IS NOT NULL)
4310 OR ( pen.pgm_id IS NULL
4311 AND cv_pgm_id IS NULL));
4312 --
4313 l_prtt_enrt_rslt_id number := null;
4314 --
4315 l_emp_epe_id number;
4316 --
4317 cursor c_cwb_hrchy(cv_emp_epe_id in number) is
4318 select emp_elig_per_elctbl_chc_id
4319 from ben_cwb_mgr_hrchy
4320 where emp_elig_per_elctbl_chc_id = cv_emp_epe_id;
4321 --
4322 cursor c_hrchy(cv_emp_epe_id in number) is
4323 select hrc.emp_pil_elctbl_chc_popl_id,
4324 epe.pil_elctbl_chc_popl_id
4325 from ben_elig_per_elctbl_chc epe,
4326 ben_cwb_hrchy hrc
4327 where epe.elig_per_elctbl_chc_id = cv_emp_epe_id
4328 and hrc.emp_pil_elctbl_chc_popl_id(+) = epe.pil_elctbl_chc_popl_id;
4329 --
4330 begin
4331 --
4332 if g_debug then
4333 l_package := g_package||'.popu_cross_gb_epe_data';
4334 hr_utility.set_location ('Entering '||l_package,10);
4335 end if;
4336 --
4337 benutils.get_active_life_event
4338 (p_person_id => p_person_id,
4339 p_business_group_id => p_business_group_id,
4340 p_effective_date => p_effective_date,
4341 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
4342 p_ler_id => p_ler_id,
4343 p_rec => l_rec);
4344 --
4345 -- Get the manager information.
4346 --
4347 open c_pel(l_rec.per_in_ler_id);
4348 fetch c_pel into l_curr_pel;
4349 close c_pel;
4350 --
4351 -- Now loop through the manager heirarchy and duplicate the data.
4352 --
4353 l_mgr_per_in_ler_not_found := true;
4354 l_mgr_person_id := l_curr_pel.ws_mgr_id;
4355 --
4356 while l_mgr_per_in_ler_not_found loop
4357 --
4358 -- Get per in ler for manager in per_business_group_id.
4359 --
4360 l_mgr_rec := l_mgr_rec_temp;
4361 --
4362 benutils.get_active_life_event
4363 (p_person_id => l_mgr_person_id,
4364 p_business_group_id => l_curr_pel.per_business_group_id,
4365 p_effective_date => p_effective_date,
4366 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
4367 p_ler_id => p_ler_id,
4368 p_rec => l_mgr_rec);
4369 --
4370 if l_mgr_rec.per_in_ler_id is not null or l_mgr_person_id is null then
4371 l_mgr_per_in_ler_not_found := false;
4372 else
4373 --
4374 -- Now duplicate the pil, pel, epe, ecr data.
4375 --
4376 l_mgr_per_in_ler_not_found := true;
4377 --
4378 -- Need to copy potential ler for per.
4379 --
4380 ben_ptnl_ler_for_per_api.create_ptnl_ler_for_per_perf
4381 (p_validate => false,
4382 p_ptnl_ler_for_per_id => l_ptnl_ler_for_per_id,
4383 p_lf_evt_ocrd_dt => l_effective_date,
4384 p_ptnl_ler_for_per_stat_cd => 'PROCD' ,
4385 --l_ptnl_ler_for_per_stat_cd_use,
4386 p_ler_id => p_ler_id,
4387 p_person_id => l_mgr_person_id,
4388 p_ntfn_dt => p_effective_date, -- l_ntfn_dt,
4389 p_procd_dt => p_effective_date,
4390 p_dtctd_dt => p_effective_date,
4391 p_business_group_id => l_curr_pel.per_business_group_id,
4392 p_object_version_number => l_object_version_number,
4393 p_effective_date => l_effective_date,
4394 p_program_application_id => fnd_global.prog_appl_id,
4395 p_program_id => fnd_global.conc_program_id,
4396 p_request_id => fnd_global.conc_request_id,
4397 p_program_update_date => l_effective_date);
4398 --
4399 ben_Person_Life_Event_api.create_Person_Life_Event_perf
4400 (p_validate => false
4401 ,p_per_in_ler_id => l_dummy_per_in_ler_id
4402 ,p_ler_id => p_ler_id
4403 ,p_person_id => l_mgr_person_id
4404 ,p_per_in_ler_stat_cd => 'STRTD'
4405 ,p_ptnl_ler_for_per_id => l_ptnl_ler_for_per_id
4406 ,p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt
4407 ,p_business_group_id => l_curr_pel.per_business_group_id
4408 ,p_ntfn_dt => trunc(sysdate)
4409 ,p_object_version_number => l_object_version_number
4410 ,p_effective_date => l_effective_date
4411 ,p_program_application_id => fnd_global.prog_appl_id
4412 ,p_program_id => fnd_global.conc_program_id
4413 ,p_request_id => fnd_global.conc_request_id
4414 ,p_program_update_date => trunc(sysdate)
4415 ,p_procd_dt => l_procd_dt
4416 ,p_strtd_dt => l_strtd_dt
4417 ,p_voidd_dt => l_voidd_dt);
4418 --
4419 --
4420 -- Now get the manager for l_mgr_person_id.
4421 --
4422 -- But 2172036 addition of assignment_id to epe
4423 --
4424 ben_enrolment_requirements.get_cwb_manager_and_assignment(
4425 p_person_id => l_mgr_person_id,
4426 p_hrchy_to_use_cd =>
4427 ben_enrolment_requirements.g_ple_hrchy_to_use_cd,
4428 p_pos_structure_version_id =>
4429 ben_enrolment_requirements.g_ple_pos_structure_version_id,
4430 p_effective_date => l_effective_date,
4431 p_manager_id => l_mgr_person_id_temp,
4432 p_assignment_id => l_assignment_id );
4433 --
4434 l_prtt_enrt_rslt_id := null;
4435 --
4436 -- Now loop through all the epe's associated with current pel and
4437 -- duplicate the data.
4438 --
4439 for l_curr_epe in c_epe(l_rec.per_in_ler_id) loop
4440 --
4441 if g_debug then
4442 hr_utility.set_location('EPEC_CRE: Cross BG ' || l_package, 10);
4443 end if;
4444 ben_elig_per_elc_chc_api.create_perf_elig_per_elc_chc(
4445 p_elig_per_elctbl_chc_id => l_elig_per_elctbl_chc_id,
4446 p_business_group_id => l_curr_epe.per_business_group_id,
4447 p_auto_enrt_flag => l_curr_epe.auto_enrt_flag,
4448 p_per_in_ler_id => l_dummy_per_in_ler_id,
4449 p_yr_perd_id => l_curr_epe.yr_perd_id,
4450 p_pl_id => l_curr_epe.pl_id,
4451 p_pl_typ_id => l_curr_epe.pl_typ_id,
4452 p_oipl_id => l_curr_epe.oipl_id,
4453 p_pgm_id => l_curr_epe.pgm_id,
4454 -- p_pgm_typ_cd => l_curr_epe.pgm_typ_cd,
4455 p_must_enrl_anthr_pl_id => l_curr_epe.must_enrl_anthr_pl_id,
4456 p_plip_id => l_curr_epe.plip_id,
4457 p_ptip_id => l_curr_epe.ptip_id,
4458 -- As per CWB team l_prtt_enrt_rslt_id can go as null.
4459 p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id,
4460 --
4461 p_enrt_typ_cycl_cd => l_curr_epe.enrt_typ_cycl_cd,
4462 p_comp_lvl_cd => l_curr_epe.comp_lvl_cd,
4463 p_enrt_cvg_strt_dt_cd => l_curr_epe.enrt_cvg_strt_dt_cd,
4464 p_enrt_perd_end_dt => l_curr_epe.enrt_perd_end_dt,
4465 p_enrt_perd_strt_dt => l_curr_epe.enrt_perd_strt_dt,
4466 p_enrt_cvg_strt_dt_rl => l_curr_epe.enrt_cvg_strt_dt_rl,
4467 p_roll_crs_flag => 'N',
4468 p_ctfn_rqd_flag => l_curr_epe.ctfn_rqd_flag,
4469 p_crntly_enrd_flag => 'N',-- l_curr_epe.crntly_enrd_flag,
4470 p_dflt_flag => l_curr_epe.dflt_flag,
4471 p_elctbl_flag => 'N',-- l_curr_epe.elctbl_flag,
4472 p_mndtry_flag => l_curr_epe.mndtry_flag,
4473 p_dflt_enrt_dt => l_curr_epe.dflt_enrt_dt,
4474 p_dpnt_cvg_strt_dt_cd => NULL,
4475 p_dpnt_cvg_strt_dt_rl => NULL,
4476 p_enrt_cvg_strt_dt => l_curr_epe.enrt_cvg_strt_dt,
4477 p_alws_dpnt_dsgn_flag => 'N',
4478 p_erlst_deenrt_dt => l_curr_epe.erlst_deenrt_dt,
4479 p_procg_end_dt => l_curr_epe.procg_end_dt,
4480 p_pl_ordr_num => l_curr_epe.pl_ordr_num,
4481 p_plip_ordr_num => l_curr_epe.plip_ordr_num,
4482 p_ptip_ordr_num => l_curr_epe.ptip_ordr_num,
4483 p_oipl_ordr_num => l_curr_epe.oipl_ordr_num,
4484 p_object_version_number => l_object_version_number,
4485 p_effective_date => l_effective_date,
4486 p_program_application_id => fnd_global.prog_appl_id,
4487 p_program_id => fnd_global.conc_program_id,
4488 p_request_id => fnd_global.conc_request_id,
4489 p_program_update_date => trunc(SYSDATE),
4490 p_enrt_perd_id => l_curr_epe.enrt_perd_id,
4491 p_lee_rsn_id => l_curr_epe.lee_rsn_id,
4492 p_cls_enrt_dt_to_use_cd => l_curr_epe.cls_enrt_dt_to_use_cd,
4493 p_uom => l_curr_epe.uom,
4494 p_acty_ref_perd_cd => l_curr_epe.acty_ref_perd_cd,
4495 p_cryfwd_elig_dpnt_cd => l_curr_epe.cryfwd_elig_dpnt_cd,
4496 -- added for cwb
4497 p_mode => p_mode,
4498 p_ws_mgr_id => l_mgr_person_id_temp,
4499 p_elig_flag => 'N',
4500 p_assignment_id => l_assignment_id ); -- l_curr_epe.elig_flag);
4501 -- Bug 2172036 and 2231371 added assignment_id in the above call
4502 --
4503 -- Populate the heirarchy table.
4504 --
4505 open c_hrchy(l_elig_per_elctbl_chc_id);
4506 fetch c_hrchy into l_emp_pel_id, l_pel_id;
4507 --
4508 if l_pel_id is not null and l_emp_pel_id is null then
4509 --
4510 begin
4511 insert into ben_cwb_hrchy (
4512 emp_pil_elctbl_chc_popl_id,
4513 mgr_pil_elctbl_chc_popl_id,
4514 lvl_num )
4515 values(
4516 l_pel_id,
4517 -1,
4518 -1);
4519 exception
4520 when others then
4521 null; -- For 2712602
4522 end;
4523 --
4524 end if;
4525 --
4526 close c_hrchy;
4527 --
4528 if g_debug then
4529 hr_utility.set_location('Done EPEC_CRE Cross BG : ' || l_package, 10);
4530 end if;
4531 --
4532 for l_ecr_rec in c_ecr(l_curr_epe.elig_per_elctbl_chc_id)
4533 loop
4534 --
4535 INSERT INTO ben_enrt_rt
4536 (
4537 enrt_rt_id,
4538 acty_typ_cd,
4539 tx_typ_cd,
4540 ctfn_rqd_flag,
4541 dflt_flag,
4542 dflt_pndg_ctfn_flag,
4543 dsply_on_enrt_flag,
4544 use_to_calc_net_flx_cr_flag,
4545 entr_val_at_enrt_flag,
4546 asn_on_enrt_flag,
4547 rl_crs_only_flag,
4548 dflt_val,
4549 ann_val,
4550 ann_mn_elcn_val,
4551 ann_mx_elcn_val,
4552 val,
4553 ISS_VAL,
4554 nnmntry_uom,
4555 mx_elcn_val,
4556 mn_elcn_val,
4557 incrmt_elcn_val,
4558 cmcd_acty_ref_perd_cd,
4559 cmcd_mn_elcn_val,
4560 cmcd_mx_elcn_val,
4561 cmcd_val,
4562 cmcd_dflt_val,
4563 rt_usg_cd,
4564 ann_dflt_val,
4565 bnft_rt_typ_cd,
4566 rt_mlt_cd,
4567 dsply_mn_elcn_val,
4568 dsply_mx_elcn_val,
4569 entr_ann_val_flag,
4570 rt_strt_dt,
4571 rt_strt_dt_cd,
4572 rt_strt_dt_rl,
4573 rt_typ_cd,
4574 elig_per_elctbl_chc_id,
4575 acty_base_rt_id,
4576 spcl_rt_enrt_rt_id,
4577 enrt_bnft_id,
4578 prtt_rt_val_id,
4579 decr_bnft_prvdr_pool_id,
4580 cvg_amt_calc_mthd_id,
4581 actl_prem_id,
4582 comp_lvl_fctr_id,
4583 ptd_comp_lvl_fctr_id,
4584 clm_comp_lvl_fctr_id,
4585 business_group_id,
4586 ecr_attribute_category,
4587 ecr_attribute1,
4588 ecr_attribute2,
4589 ecr_attribute3,
4590 ecr_attribute4,
4591 ecr_attribute5,
4592 ecr_attribute6,
4593 ecr_attribute7,
4594 ecr_attribute8,
4595 ecr_attribute9,
4596 ecr_attribute10,
4597 ecr_attribute11,
4598 ecr_attribute12,
4599 ecr_attribute13,
4600 ecr_attribute14,
4601 ecr_attribute15,
4602 ecr_attribute16,
4603 ecr_attribute17,
4604 ecr_attribute18,
4605 ecr_attribute19,
4606 ecr_attribute20,
4607 ecr_attribute21,
4608 ecr_attribute22,
4609 ecr_attribute23,
4610 ecr_attribute24,
4611 ecr_attribute25,
4612 ecr_attribute26,
4613 ecr_attribute27,
4614 ecr_attribute28,
4615 ecr_attribute29,
4616 ecr_attribute30,
4617 last_update_login,
4618 created_by,
4619 creation_date,
4620 last_updated_by,
4621 last_update_date,
4622 request_id,
4623 program_application_id,
4624 program_id,
4625 program_update_date,
4626 object_version_number)
4627 VALUES(
4628 ben_enrt_rt_s.nextval,
4629 l_ecr_rec.acty_typ_cd,
4630 l_ecr_rec.tx_typ_cd,
4631 l_ecr_rec.ctfn_rqd_flag,
4632 l_ecr_rec.dflt_flag,
4633 l_ecr_rec.dflt_pndg_ctfn_flag,
4634 l_ecr_rec.dsply_on_enrt_flag,
4635 l_ecr_rec.use_to_calc_net_flx_cr_flag,
4636 l_ecr_rec.entr_val_at_enrt_flag,
4637 l_ecr_rec.asn_on_enrt_flag,
4638 l_ecr_rec.rl_crs_only_flag,
4639 l_ecr_rec.dflt_val,
4640 l_ecr_rec.ann_val,
4641 l_ecr_rec.ann_mn_elcn_val,
4642 l_ecr_rec.ann_mx_elcn_val,
4643 l_ecr_rec.val,
4644 -- 3216667 : iss_val, mx_elcn_val, mn_elcn_val are passed to
4645 -- cloned rows.
4646 l_ecr_rec.ISS_VAL,
4647 l_ecr_rec.nnmntry_uom,
4648 -- Initially they have to go null.
4649 l_ecr_rec.mx_elcn_val,
4650 l_ecr_rec.mn_elcn_val,
4651 l_ecr_rec.incrmt_elcn_val,
4652 l_ecr_rec.cmcd_acty_ref_perd_cd,
4653 -- Initially they have to go null.
4654 null, --l_ecr_rec.cmcd_mn_elcn_val,
4655 null, --l_ecr_rec.cmcd_mx_elcn_val,
4656 l_ecr_rec.cmcd_val,
4657 null,
4658 l_ecr_rec.rt_usg_cd,
4659 l_ecr_rec.ann_dflt_val,
4660 l_ecr_rec.bnft_rt_typ_cd,
4661 l_ecr_rec.rt_mlt_cd,
4662 -- Initially they have to go null.
4663 null, -- l_ecr_rec.dsply_mn_elcn_val,
4664 null, -- l_ecr_rec.dsply_mx_elcn_val,
4665 l_ecr_rec.entr_ann_val_flag,
4666 l_ecr_rec.rt_strt_dt,
4667 l_ecr_rec.rt_strt_dt_cd,
4668 l_ecr_rec.rt_strt_dt_rl,
4669 l_ecr_rec.rt_typ_cd,
4670 l_elig_per_elctbl_chc_id,
4671 l_ecr_rec.acty_base_rt_id,
4672 null,
4673 null, -- enrt_bnft_id : Should be null
4674 null, -- prtt_rt_val_id : should be null
4675 l_ecr_rec.decr_bnft_prvdr_pool_id,
4676 l_ecr_rec.cvg_amt_calc_mthd_id,
4677 l_ecr_rec.actl_prem_id,
4678 l_ecr_rec.comp_lvl_fctr_id,
4679 l_ecr_rec.ptd_comp_lvl_fctr_id,
4680 l_ecr_rec.clm_comp_lvl_fctr_id,
4681 l_curr_epe.per_business_group_id,
4682 l_ecr_rec.ecr_attribute_category,
4683 l_ecr_rec.ecr_attribute1,
4684 l_ecr_rec.ecr_attribute2,
4685 l_ecr_rec.ecr_attribute3,
4686 l_ecr_rec.ecr_attribute4,
4687 l_ecr_rec.ecr_attribute5,
4688 l_ecr_rec.ecr_attribute6,
4689 l_ecr_rec.ecr_attribute7,
4690 l_ecr_rec.ecr_attribute8,
4691 l_ecr_rec.ecr_attribute9,
4692 l_ecr_rec.ecr_attribute10,
4693 l_ecr_rec.ecr_attribute11,
4694 l_ecr_rec.ecr_attribute12,
4695 l_ecr_rec.ecr_attribute13,
4696 l_ecr_rec.ecr_attribute14,
4697 l_ecr_rec.ecr_attribute15,
4698 l_ecr_rec.ecr_attribute16,
4699 l_ecr_rec.ecr_attribute17,
4700 l_ecr_rec.ecr_attribute18,
4701 l_ecr_rec.ecr_attribute19,
4702 l_ecr_rec.ecr_attribute20,
4703 l_ecr_rec.ecr_attribute21,
4704 l_ecr_rec.ecr_attribute22,
4705 l_ecr_rec.ecr_attribute23,
4706 l_ecr_rec.ecr_attribute24,
4707 l_ecr_rec.ecr_attribute25,
4708 l_ecr_rec.ecr_attribute26,
4709 l_ecr_rec.ecr_attribute27,
4710 l_ecr_rec.ecr_attribute28,
4711 l_ecr_rec.ecr_attribute29,
4712 l_ecr_rec.ecr_attribute30,
4713 l_last_update_login,
4714 l_created_by,
4715 l_creation_date,
4716 l_last_updated_by,
4717 trunc(SYSDATE),
4718 fnd_global.conc_request_id,
4719 fnd_global.prog_appl_id,
4720 fnd_global.conc_program_id,
4721 trunc(SYSDATE),
4722 l_object_version_number);
4723 --
4724 end loop; -- Rates for loop
4725 --
4726 end loop; -- epe for loop
4727 l_mgr_person_id := l_mgr_person_id_temp;
4728 --
4729 end if;
4730 --
4731 end loop; -- while loop
4732 --
4733 if g_debug then
4734 hr_utility.set_location ('Leaving '||l_package,10);
4735 end if;
4736 --
4737 end popu_cross_gb_epe_pel_data;
4738 --
4739 /*
4740 procedure popu_cross_gb_epe_data(
4741 p_mode in varchar2,
4742 p_person_id in number,
4743 p_business_group_id in number,
4744 p_ler_id in number,
4745 p_pl_id in number,
4746 p_effective_date in date,
4747 p_lf_evt_ocrd_dt in date
4748 ) is
4749 --
4750 l_package varchar2(80);
4751 --
4752 l_rec benutils.g_active_life_event;
4753 l_mgr_rec benutils.g_active_life_event;
4754 l_mgr_rec_temp benutils.g_active_life_event;
4755 l_effective_date date := nvl(p_lf_evt_ocrd_dt, p_effective_date);
4756 l_procd_dt date;
4757 l_strtd_dt date;
4758 l_voidd_dt date;
4759 l_ptnl_ler_for_per_id number;
4760 l_object_version_number number;
4761 l_dummy_per_in_ler_id number;
4762 l_mgr_per_in_ler_not_found boolean;
4763 l_mgr_person_id number;
4764 l_mgr_person_id_temp number;
4765 l_assignment_id number;
4766 l_elig_per_elctbl_chc_id number;
4767 --
4768 l_created_by ben_elig_per_elctbl_chc.created_by%TYPE;
4769 l_creation_date ben_elig_per_elctbl_chc.creation_date%TYPE;
4770 l_last_update_date ben_elig_per_elctbl_chc.last_update_date%TYPE;
4771 l_last_updated_by ben_elig_per_elctbl_chc.last_updated_by%TYPE;
4772 l_last_update_login ben_elig_per_elctbl_chc.last_update_login%TYPE;
4773 --
4774 cursor c_epe(cv_per_in_ler_id in number) is
4775 select epe.* ,
4776 pel.dflt_enrt_dt,
4777 pel.cls_enrt_dt_to_use_cd,
4778 pel.enrt_typ_cycl_cd,
4779 pel.enrt_perd_strt_dt,
4780 pel.enrt_perd_end_dt,
4781 pel.lee_rsn_id,
4782 pel.enrt_perd_id,
4783 pel.uom,
4784 pel.acty_ref_perd_cd,
4785 epe.business_group_id per_business_group_id,
4786 per.business_group_id mgr_business_group_id
4787 from ben_elig_per_elctbl_chc epe,
4788 ben_pil_elctbl_chc_popl pel,
4789 per_all_people_f per
4790 where epe.per_in_ler_id = cv_per_in_ler_id
4791 and epe.per_in_ler_id = pel.per_in_ler_id
4792 and epe.pl_id = pel.pl_id
4793 and epe.ws_mgr_id = per.person_id (+)
4794 and l_effective_date between effective_start_date
4795 and effective_end_date;
4796 --
4797 cursor c_ecr(cv_elig_per_elctbl_chc_id in number) is
4798 select ecr.*
4799 from ben_enrt_rt ecr
4800 where ecr.elig_per_elctbl_chc_id = cv_elig_per_elctbl_chc_id;
4801 --
4802 l_curr_epe c_epe%rowtype;
4803 --
4804 -- Gets the enrolment information for this plan
4805 --
4806 CURSOR c_plan_enrolment_info(cv_person_id in number,
4807 cv_business_group_id in number,
4808 cv_lf_evt_ocrd_dt in date,
4809 cv_pl_id in number,
4810 cv_pgm_id in number)
4811 IS
4812 SELECT pen.prtt_enrt_rslt_id
4813 FROM ben_prtt_enrt_rslt_f pen
4814 WHERE pen.person_id = cv_person_id
4815 AND pen.business_group_id = cv_business_group_id
4816 AND pen.sspndd_flag = 'N'
4817 AND pen.prtt_enrt_rslt_stat_cd IS NULL
4818 AND pen.effective_end_date = hr_api.g_eot
4819 AND cv_lf_evt_ocrd_dt <= pen.enrt_cvg_thru_dt
4820 AND pen.enrt_cvg_strt_dt < pen.effective_end_date
4821 AND cv_pl_id = pen.pl_id
4822 AND (
4823 ( pen.pgm_id = cv_pgm_id
4824 AND cv_pgm_id IS NOT NULL)
4825 OR ( pen.pgm_id IS NULL
4826 AND cv_pgm_id IS NULL));
4827 --
4828 l_prtt_enrt_rslt_id number := null;
4829 --
4830 l_emp_epe_id number;
4831 --
4832 cursor c_cwb_hrchy(cv_emp_epe_id in number) is
4833 select emp_elig_per_elctbl_chc_id
4834 from ben_cwb_mgr_hrchy
4835 where emp_elig_per_elctbl_chc_id = cv_emp_epe_id;
4836 --
4837 begin
4838 --
4839 if g_debug then
4840 l_package := g_package||'.popu_cross_gb_epe_data';
4841 hr_utility.set_location ('Entering '||l_package,10);
4842 end if;
4843 --
4844 benutils.get_active_life_event
4845 (p_person_id => p_person_id,
4846 p_business_group_id => p_business_group_id,
4847 p_effective_date => p_effective_date,
4848 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
4849 p_ler_id => p_ler_id,
4850 p_rec => l_rec);
4851 --
4852 -- Get the manager information.
4853 --
4854 open c_epe(l_rec.per_in_ler_id);
4855 fetch c_epe into l_curr_epe;
4856 close c_epe;
4857 --
4858 -- Bug 2541072 for person selection rule dummy le is not created. We need to
4859 -- do this for same business group also.
4860 --
4861 -- if l_curr_epe.per_business_group_id <> l_curr_epe.mgr_business_group_id
4862 -- then
4863 --
4864 -- Now loop through the manager heirarchy and duplicate the data.
4865 --
4866 l_mgr_per_in_ler_not_found := true;
4867 l_mgr_person_id := l_curr_epe.ws_mgr_id;
4868 --
4869 while l_mgr_per_in_ler_not_found loop
4870 --
4871 -- Get per in ler for manager in per_business_group_id.
4872 --
4873 l_mgr_rec := l_mgr_rec_temp;
4874 --
4875 benutils.get_active_life_event
4876 (p_person_id => l_mgr_person_id,
4877 p_business_group_id => l_curr_epe.per_business_group_id,
4878 p_effective_date => p_effective_date,
4879 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
4880 p_ler_id => p_ler_id,
4881 p_rec => l_mgr_rec);
4882 --
4883 if l_mgr_rec.per_in_ler_id is not null or l_mgr_person_id is null then
4884 l_mgr_per_in_ler_not_found := false;
4885 else
4886 --
4887 -- Now duplicate the pil, pel, epe, ecr data.
4888 --
4889 l_mgr_per_in_ler_not_found := true;
4890 --
4891 -- Need to copy potential ler for per.
4892 --
4893 ben_ptnl_ler_for_per_api.create_ptnl_ler_for_per_perf
4894 (p_validate => false,
4895 p_ptnl_ler_for_per_id => l_ptnl_ler_for_per_id,
4896 p_lf_evt_ocrd_dt => l_effective_date,
4897 p_ptnl_ler_for_per_stat_cd => 'PROCD' ,
4898 --l_ptnl_ler_for_per_stat_cd_use,
4899 p_ler_id => p_ler_id,
4900 p_person_id => l_mgr_person_id,
4901 p_ntfn_dt => p_effective_date, -- l_ntfn_dt,
4902 p_procd_dt => p_effective_date,
4903 p_dtctd_dt => p_effective_date,
4904 p_business_group_id => l_curr_epe.per_business_group_id,
4905 p_object_version_number => l_object_version_number,
4906 p_effective_date => l_effective_date,
4907 p_program_application_id => fnd_global.prog_appl_id,
4908 p_program_id => fnd_global.conc_program_id,
4909 p_request_id => fnd_global.conc_request_id,
4910 p_program_update_date => l_effective_date);
4911 --
4912 ben_Person_Life_Event_api.create_Person_Life_Event_perf
4913 (p_validate => false
4914 ,p_per_in_ler_id => l_dummy_per_in_ler_id
4915 ,p_ler_id => p_ler_id
4916 ,p_person_id => l_mgr_person_id
4917 ,p_per_in_ler_stat_cd => 'STRTD'
4918 ,p_ptnl_ler_for_per_id => l_ptnl_ler_for_per_id
4919 ,p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt
4920 ,p_business_group_id => l_curr_epe.per_business_group_id
4921 ,p_ntfn_dt => trunc(sysdate)
4922 ,p_object_version_number => l_object_version_number
4923 ,p_effective_date => l_effective_date
4924 ,p_program_application_id => fnd_global.prog_appl_id
4925 ,p_program_id => fnd_global.conc_program_id
4926 ,p_request_id => fnd_global.conc_request_id
4927 ,p_program_update_date => trunc(sysdate)
4928 ,p_procd_dt => l_procd_dt
4929 ,p_strtd_dt => l_strtd_dt
4930 ,p_voidd_dt => l_voidd_dt);
4931 --
4932 --
4933 -- Now get the manager for l_mgr_person_id.
4934 --
4935
4936 --l_mgr_person_id_temp := ben_enrolment_requirements.get_manager_id(
4937 -- p_person_id => l_mgr_person_id,
4938 -- p_hrchy_to_use_cd =>
4939 -- ben_enrolment_requirements.g_ple_hrchy_to_use_cd,
4940 -- p_pos_structure_version_id =>
4941 -- ben_enrolment_requirements.g_ple_pos_structure_version_id,
4942 -- p_effective_date => l_effective_date);
4943
4944 -- But 2172036 addition of assignment_id to epe
4945 --
4946 ben_enrolment_requirements.get_cwb_manager_and_assignment(
4947 p_person_id => l_mgr_person_id,
4948 p_hrchy_to_use_cd =>
4949 ben_enrolment_requirements.g_ple_hrchy_to_use_cd,
4950 p_pos_structure_version_id =>
4951 ben_enrolment_requirements.g_ple_pos_structure_version_id,
4952 p_effective_date => l_effective_date,
4953 p_manager_id => l_mgr_person_id_temp,
4954 p_assignment_id => l_assignment_id );
4955 --
4956 l_prtt_enrt_rslt_id := null;
4957 --
4958 -- For Dummy rows no need to determine previous result
4959 -- open c_plan_enrolment_info(
4960 -- cv_person_id => l_mgr_person_id,
4961 -- cv_business_group_id => l_curr_epe.mgr_business_group_id,
4962 -- cv_lf_evt_ocrd_dt => l_effective_date,
4963 -- cv_pl_id => l_curr_epe.pl_id,
4964 -- cv_pgm_id => l_curr_epe.pgm_id);
4965 -- fetch c_plan_enrolment_info into l_prtt_enrt_rslt_id;
4966 -- close c_plan_enrolment_info;
4967 --
4968 if g_debug then
4969 hr_utility.set_location('EPEC_CRE: Cross BG ' || l_package, 10);
4970 end if;
4971 ben_elig_per_elc_chc_api.create_perf_elig_per_elc_chc(
4972 p_elig_per_elctbl_chc_id => l_elig_per_elctbl_chc_id,
4973 p_business_group_id => l_curr_epe.per_business_group_id,
4974 p_auto_enrt_flag => l_curr_epe.auto_enrt_flag,
4975 p_per_in_ler_id => l_dummy_per_in_ler_id,
4976 p_yr_perd_id => l_curr_epe.yr_perd_id,
4977 p_pl_id => l_curr_epe.pl_id,
4978 p_pl_typ_id => l_curr_epe.pl_typ_id,
4979 p_oipl_id => l_curr_epe.oipl_id,
4980 p_pgm_id => l_curr_epe.pgm_id,
4981 -- p_pgm_typ_cd => l_curr_epe.pgm_typ_cd,
4982 p_must_enrl_anthr_pl_id => l_curr_epe.must_enrl_anthr_pl_id,
4983 p_plip_id => l_curr_epe.plip_id,
4984 p_ptip_id => l_curr_epe.ptip_id,
4985 -- As per CWB team l_prtt_enrt_rslt_id can go as null.
4986 p_prtt_enrt_rslt_id => l_prtt_enrt_rslt_id,
4987 --
4988 p_enrt_typ_cycl_cd => l_curr_epe.enrt_typ_cycl_cd,
4989 p_comp_lvl_cd => l_curr_epe.comp_lvl_cd,
4990 p_enrt_cvg_strt_dt_cd => l_curr_epe.enrt_cvg_strt_dt_cd,
4991 p_enrt_perd_end_dt => l_curr_epe.enrt_perd_end_dt,
4992 p_enrt_perd_strt_dt => l_curr_epe.enrt_perd_strt_dt,
4993 p_enrt_cvg_strt_dt_rl => l_curr_epe.enrt_cvg_strt_dt_rl,
4994 p_roll_crs_flag => 'N',
4995 p_ctfn_rqd_flag => l_curr_epe.ctfn_rqd_flag,
4996 p_crntly_enrd_flag => 'N',-- l_curr_epe.crntly_enrd_flag,
4997 p_dflt_flag => l_curr_epe.dflt_flag,
4998 p_elctbl_flag => 'N',-- l_curr_epe.elctbl_flag,
4999 p_mndtry_flag => l_curr_epe.mndtry_flag,
5000 p_dflt_enrt_dt => l_curr_epe.dflt_enrt_dt,
5001 p_dpnt_cvg_strt_dt_cd => NULL,
5002 p_dpnt_cvg_strt_dt_rl => NULL,
5003 p_enrt_cvg_strt_dt => l_curr_epe.enrt_cvg_strt_dt,
5004 p_alws_dpnt_dsgn_flag => 'N',
5005 p_erlst_deenrt_dt => l_curr_epe.erlst_deenrt_dt,
5006 p_procg_end_dt => l_curr_epe.procg_end_dt,
5007 p_pl_ordr_num => l_curr_epe.pl_ordr_num,
5008 p_plip_ordr_num => l_curr_epe.plip_ordr_num,
5009 p_ptip_ordr_num => l_curr_epe.ptip_ordr_num,
5010 p_oipl_ordr_num => l_curr_epe.oipl_ordr_num,
5011 p_object_version_number => l_object_version_number,
5012 p_effective_date => l_effective_date,
5013 p_program_application_id => fnd_global.prog_appl_id,
5014 p_program_id => fnd_global.conc_program_id,
5015 p_request_id => fnd_global.conc_request_id,
5016 p_program_update_date => trunc(SYSDATE),
5017 p_enrt_perd_id => l_curr_epe.enrt_perd_id,
5018 p_lee_rsn_id => l_curr_epe.lee_rsn_id,
5019 p_cls_enrt_dt_to_use_cd => l_curr_epe.cls_enrt_dt_to_use_cd,
5020 p_uom => l_curr_epe.uom,
5021 p_acty_ref_perd_cd => l_curr_epe.acty_ref_perd_cd,
5022 p_cryfwd_elig_dpnt_cd => l_curr_epe.cryfwd_elig_dpnt_cd,
5023 -- added for cwb
5024 p_mode => p_mode,
5025 p_ws_mgr_id => l_mgr_person_id_temp,
5026 p_elig_flag => 'N',
5027 p_assignment_id => l_assignment_id ); -- l_curr_epe.elig_flag);
5028 -- Bug 2172036 and 2231371 added assignment_id in the above call
5029 --
5030 -- Populate the heirarchy table.
5031 --
5032 open c_cwb_hrchy(l_elig_per_elctbl_chc_id);
5033 fetch c_cwb_hrchy into l_emp_epe_id;
5034 --
5035 if c_cwb_hrchy%notfound then
5036 --
5037 insert into ben_cwb_mgr_hrchy (
5038 emp_elig_per_elctbl_chc_id,
5039 mgr_elig_per_elctbl_chc_id,
5040 lvl_num )
5041 values(
5042 l_elig_per_elctbl_chc_id,
5043 -1,
5044 -1);
5045 --
5046 end if;
5047 --
5048 close c_cwb_hrchy;
5049 --
5050 if g_debug then
5051 hr_utility.set_location('Done EPEC_CRE Cross BG : ' || l_package, 10);
5052 end if;
5053 --
5054 for l_ecr_rec in c_ecr(l_curr_epe.elig_per_elctbl_chc_id)
5055 loop
5056 --
5057 INSERT INTO ben_enrt_rt
5058 (
5059 enrt_rt_id,
5060 acty_typ_cd,
5061 tx_typ_cd,
5062 ctfn_rqd_flag,
5063 dflt_flag,
5064 dflt_pndg_ctfn_flag,
5065 dsply_on_enrt_flag,
5066 use_to_calc_net_flx_cr_flag,
5067 entr_val_at_enrt_flag,
5068 asn_on_enrt_flag,
5069 rl_crs_only_flag,
5070 dflt_val,
5071 ann_val,
5072 ann_mn_elcn_val,
5073 ann_mx_elcn_val,
5074 val,
5075 nnmntry_uom,
5076 mx_elcn_val,
5077 mn_elcn_val,
5078 incrmt_elcn_val,
5079 cmcd_acty_ref_perd_cd,
5080 cmcd_mn_elcn_val,
5081 cmcd_mx_elcn_val,
5082 cmcd_val,
5083 cmcd_dflt_val,
5084 rt_usg_cd,
5085 ann_dflt_val,
5086 bnft_rt_typ_cd,
5087 rt_mlt_cd,
5088 dsply_mn_elcn_val,
5089 dsply_mx_elcn_val,
5090 entr_ann_val_flag,
5091 rt_strt_dt,
5092 rt_strt_dt_cd,
5093 rt_strt_dt_rl,
5094 rt_typ_cd,
5095 elig_per_elctbl_chc_id,
5096 acty_base_rt_id,
5097 spcl_rt_enrt_rt_id,
5098 enrt_bnft_id,
5099 prtt_rt_val_id,
5100 decr_bnft_prvdr_pool_id,
5101 cvg_amt_calc_mthd_id,
5102 actl_prem_id,
5103 comp_lvl_fctr_id,
5104 ptd_comp_lvl_fctr_id,
5105 clm_comp_lvl_fctr_id,
5106 business_group_id,
5107 ecr_attribute_category,
5108 ecr_attribute1,
5109 ecr_attribute2,
5110 ecr_attribute3,
5111 ecr_attribute4,
5112 ecr_attribute5,
5113 ecr_attribute6,
5114 ecr_attribute7,
5115 ecr_attribute8,
5116 ecr_attribute9,
5117 ecr_attribute10,
5118 ecr_attribute11,
5119 ecr_attribute12,
5120 ecr_attribute13,
5121 ecr_attribute14,
5122 ecr_attribute15,
5123 ecr_attribute16,
5124 ecr_attribute17,
5125 ecr_attribute18,
5126 ecr_attribute19,
5127 ecr_attribute20,
5128 ecr_attribute21,
5129 ecr_attribute22,
5130 ecr_attribute23,
5131 ecr_attribute24,
5132 ecr_attribute25,
5133 ecr_attribute26,
5134 ecr_attribute27,
5135 ecr_attribute28,
5136 ecr_attribute29,
5137 ecr_attribute30,
5138 last_update_login,
5139 created_by,
5140 creation_date,
5141 last_updated_by,
5142 last_update_date,
5143 request_id,
5144 program_application_id,
5145 program_id,
5146 program_update_date,
5147 object_version_number)
5148 VALUES(
5149 ben_enrt_rt_s.nextval,
5150 l_ecr_rec.acty_typ_cd,
5151 l_ecr_rec.tx_typ_cd,
5152 l_ecr_rec.ctfn_rqd_flag,
5153 l_ecr_rec.dflt_flag,
5154 l_ecr_rec.dflt_pndg_ctfn_flag,
5155 l_ecr_rec.dsply_on_enrt_flag,
5156 l_ecr_rec.use_to_calc_net_flx_cr_flag,
5157 l_ecr_rec.entr_val_at_enrt_flag,
5158 l_ecr_rec.asn_on_enrt_flag,
5159 l_ecr_rec.rl_crs_only_flag,
5160 l_ecr_rec.dflt_val,
5161 l_ecr_rec.ann_val,
5162 l_ecr_rec.ann_mn_elcn_val,
5163 l_ecr_rec.ann_mx_elcn_val,
5164 l_ecr_rec.val,
5165 l_ecr_rec.nnmntry_uom,
5166 -- Initially they have to go null.
5167 null, -- l_ecr_rec.mx_elcn_val,
5168 null, -- l_ecr_rec.mn_elcn_val,
5169 l_ecr_rec.incrmt_elcn_val,
5170 l_ecr_rec.cmcd_acty_ref_perd_cd,
5171 -- Initially they have to go null.
5172 null, --l_ecr_rec.cmcd_mn_elcn_val,
5173 null, --l_ecr_rec.cmcd_mx_elcn_val,
5174 l_ecr_rec.cmcd_val,
5175 null,
5176 l_ecr_rec.rt_usg_cd,
5177 l_ecr_rec.ann_dflt_val,
5178 l_ecr_rec.bnft_rt_typ_cd,
5179 l_ecr_rec.rt_mlt_cd,
5180 -- Initially they have to go null.
5181 null, -- l_ecr_rec.dsply_mn_elcn_val,
5182 null, -- l_ecr_rec.dsply_mx_elcn_val,
5183 l_ecr_rec.entr_ann_val_flag,
5184 l_ecr_rec.rt_strt_dt,
5185 l_ecr_rec.rt_strt_dt_cd,
5186 l_ecr_rec.rt_strt_dt_rl,
5187 l_ecr_rec.rt_typ_cd,
5188 l_elig_per_elctbl_chc_id,
5189 l_ecr_rec.acty_base_rt_id,
5190 null,
5191 null, -- enrt_bnft_id : Should be null
5192 null, -- prtt_rt_val_id : should be null
5193 l_ecr_rec.decr_bnft_prvdr_pool_id,
5194 l_ecr_rec.cvg_amt_calc_mthd_id,
5195 l_ecr_rec.actl_prem_id,
5196 l_ecr_rec.comp_lvl_fctr_id,
5197 l_ecr_rec.ptd_comp_lvl_fctr_id,
5198 l_ecr_rec.clm_comp_lvl_fctr_id,
5199 l_curr_epe.per_business_group_id,
5200 l_ecr_rec.ecr_attribute_category,
5201 l_ecr_rec.ecr_attribute1,
5202 l_ecr_rec.ecr_attribute2,
5203 l_ecr_rec.ecr_attribute3,
5204 l_ecr_rec.ecr_attribute4,
5205 l_ecr_rec.ecr_attribute5,
5206 l_ecr_rec.ecr_attribute6,
5207 l_ecr_rec.ecr_attribute7,
5208 l_ecr_rec.ecr_attribute8,
5209 l_ecr_rec.ecr_attribute9,
5210 l_ecr_rec.ecr_attribute10,
5211 l_ecr_rec.ecr_attribute11,
5212 l_ecr_rec.ecr_attribute12,
5213 l_ecr_rec.ecr_attribute13,
5214 l_ecr_rec.ecr_attribute14,
5215 l_ecr_rec.ecr_attribute15,
5216 l_ecr_rec.ecr_attribute16,
5217 l_ecr_rec.ecr_attribute17,
5218 l_ecr_rec.ecr_attribute18,
5219 l_ecr_rec.ecr_attribute19,
5220 l_ecr_rec.ecr_attribute20,
5221 l_ecr_rec.ecr_attribute21,
5222 l_ecr_rec.ecr_attribute22,
5223 l_ecr_rec.ecr_attribute23,
5224 l_ecr_rec.ecr_attribute24,
5225 l_ecr_rec.ecr_attribute25,
5226 l_ecr_rec.ecr_attribute26,
5227 l_ecr_rec.ecr_attribute27,
5228 l_ecr_rec.ecr_attribute28,
5229 l_ecr_rec.ecr_attribute29,
5230 l_ecr_rec.ecr_attribute30,
5231 l_last_update_login,
5232 l_created_by,
5233 l_creation_date,
5234 l_last_updated_by,
5235 trunc(SYSDATE),
5236 fnd_global.conc_request_id,
5237 fnd_global.prog_appl_id,
5238 fnd_global.conc_program_id,
5239 trunc(SYSDATE),
5240 l_object_version_number);
5241 --
5242 end loop;
5243 --
5244 l_mgr_person_id := l_mgr_person_id_temp;
5245 --
5246 end if;
5247 end loop;
5248 -- end if;
5249 --
5250 if g_debug then
5251 hr_utility.set_location ('Leaving '||l_package,10);
5252 end if;
5253 --
5254 end popu_cross_gb_epe_data;
5255 */
5256 --
5257 -- checks if there are any eligible options for the plan
5258 -- if No then
5259 -- if trk_inelig_flag is set to 'N' at plan level then
5260 -- delete the elctbl chc for the plan
5261 -- else if trk_inelig_flag is set to 'Y' at plan level then
5262 -- update the elctbl chc for the plan to ineligible
5263 -- end
5264 -- end
5265 --
5266 procedure update_cwb_epe
5267 (p_per_in_ler_id number,
5268 p_effective_date date) is
5269
5270 l_elig_per_elctbl_chc_id number;
5271 l_ovn number;
5272 l_pl_id number;
5273 l_dummy varchar2(1);
5274 l_package varchar2(80) := g_package||'.update_cwb_epe';
5275
5276 cursor c_pln is
5277 select pl.trk_inelig_per_flag
5278 from ben_pl_f pl
5279 where pl.pl_id = l_pl_id
5280 and p_effective_date between pl.effective_start_date and
5281 pl.effective_end_date;
5282
5283 cursor c_pln_opt is
5284 select 'x'
5285 from ben_oipl_f oipl
5286 where oipl.pl_id = l_pl_id
5287 and p_effective_date between oipl.effective_start_date and
5288 oipl.effective_end_date;
5289
5290 cursor c_epe1 is
5291 select epe1.elig_per_elctbl_chc_id,
5292 epe1.object_version_number,
5293 epe1.pl_id
5294 from ben_elig_per_elctbl_chc epe1
5295 where epe1.per_in_ler_id = p_per_in_ler_id
5296 and epe1.pl_id is not null
5297 and epe1.oipl_id is null;
5298
5299 cursor c_epe2 is
5300 select 'x'
5301 from ben_elig_per_elctbl_chc epe2
5302 where epe2.per_in_ler_id = p_per_in_ler_id
5303 and epe2.oipl_id is not null
5304 and epe2.pl_id = l_pl_id
5305 and epe2.elig_flag ='Y';
5306
5307
5308 begin
5309
5310 if g_debug then
5311 hr_utility.set_location ('Entering '||l_package,10);
5312 end if;
5313
5314 open c_epe1;
5315 fetch c_epe1 into
5316 l_elig_per_elctbl_chc_id,
5317 l_ovn,
5318 l_pl_id;
5319 if c_epe1%notfound then
5320 return;
5321 end if;
5322 close c_epe1;
5323
5324 if g_trk_inelig_flag is null then
5325 open c_pln;
5326 fetch c_pln into g_trk_inelig_flag;
5327 close c_pln;
5328 end if;
5329
5330 if g_opt_exists is null then
5331 open c_pln_opt;
5332 fetch c_pln_opt into l_dummy;
5333 g_opt_exists := c_pln_opt%found;
5334 close c_pln_opt;
5335 end if;
5336
5337 if g_opt_exists then
5338 open c_epe2;
5339 fetch c_epe2 into l_dummy;
5340 if c_epe2%notfound then
5341 if g_trk_inelig_flag ='N' then
5342 /* GLOBALCWB : If this data is deleted then no cwb rates are written
5343 co do not delete
5344 ben_elig_per_elc_chc_api.delete_ELIG_PER_ELC_CHC
5345 (p_elig_per_elctbl_chc_id => l_elig_per_elctbl_chc_id
5346 ,p_object_version_number => l_ovn
5347 ,p_effective_date => p_effective_date);
5348 */
5349 null;
5350 else
5351 ben_elig_per_elc_chc_api.update_perf_ELIG_PER_ELC_CHC
5352 (p_elig_per_elctbl_chc_id => l_elig_per_elctbl_chc_id
5353 ,p_elig_flag => 'N'
5354 ,p_inelig_rsn_cd => 'OTH'
5355 ,p_object_version_number => l_ovn
5356 ,p_effective_date => p_effective_date);
5357 end if;
5358 end if;
5359 close c_epe2;
5360 end if;
5361
5362 if g_debug then
5363 hr_utility.set_location ('Leaving '||l_package,10);
5364 end if;
5365
5366 exception
5367 when others then
5368 if c_epe2%isopen then
5369 close c_epe2;
5370 end if;
5371 raise;
5372 end;
5373
5374 --
5375 -- deletes per in ler for people with no elctble chc when
5376 -- trk_inelig_per_flag is set to N
5377 --
5378 procedure del_cwb_pil
5379 (p_person_id in number,
5380 p_pl_id in number,
5381 p_effective_date in date,
5382 p_ler_id in number,
5383 p_lf_evt_ocrd_dt in date) is
5384
5385 cursor c_pil is
5386 select pil.per_in_ler_id,
5387 ptnl.ptnl_ler_for_per_id,
5388 ptnl.object_version_number ptnl_ovn,
5389 pil.object_version_number pil_ovn
5390 from ben_per_in_ler pil,
5391 ben_ptnl_ler_for_per ptnl
5392 where pil.ler_id = p_ler_id
5393 and pil.lf_evt_ocrd_dt = p_lf_evt_ocrd_dt
5394 and pil.person_id = p_person_id
5395 and ptnl.ptnl_ler_for_per_id = pil.ptnl_ler_for_per_id
5396 and not exists
5397 (select 'x'
5398 from ben_elig_per_elctbl_chc epe
5399 where epe.per_in_ler_id = pil.per_in_ler_id);
5400 l_pil_rec c_pil%rowtype;
5401
5402 cursor c_popl is
5403 select pil_elctbl_chc_popl_id,
5404 object_version_number
5405 from ben_pil_elctbl_chc_popl
5406 where per_in_ler_id = l_pil_rec.per_in_ler_id;
5407 l_popl_rec c_popl%rowtype;
5408
5409 l_package varchar2(80);
5410
5411 begin
5412
5413 if g_debug then
5414 l_package := g_package||'.del_cwb_pil';
5415 hr_utility.set_location ('Entering '||l_package,10);
5416 end if;
5417
5418 open c_pil;
5419 fetch c_pil into l_pil_rec;
5420 if c_pil%found then
5421
5422 open c_popl;
5423 loop
5424 fetch c_popl into l_popl_rec;
5425 if c_popl%notfound then
5426 exit;
5427 end if;
5428
5429 ben_Pil_Elctbl_chc_Popl_api.delete_Pil_Elctbl_chc_Popl
5430 (p_pil_elctbl_chc_popl_id => l_popl_rec.pil_elctbl_chc_popl_id,
5431 p_object_version_number => l_popl_rec.object_version_number,
5432 p_effective_date => p_effective_date);
5433
5434 end loop;
5435 close c_popl;
5436
5437 ben_Person_Life_Event_api.delete_Person_Life_Event
5438 (p_per_in_ler_id => l_pil_rec.per_in_ler_id,
5439 p_object_version_number => l_pil_rec.pil_ovn,
5440 p_effective_date => p_effective_date);
5441
5442 ben_ptnl_ler_for_per_api.delete_ptnl_ler_for_per
5443 (p_ptnl_ler_for_per_id => l_pil_rec.ptnl_ler_for_per_id,
5444 p_object_version_number => l_pil_rec.ptnl_ovn,
5445 p_effective_date => p_effective_date);
5446
5447 end if;
5448 close c_pil;
5449
5450 if g_debug then
5451 hr_utility.set_location ('Leaving '||l_package,10);
5452 end if;
5453
5454 end;
5455 --
5456 procedure process_rows(p_benefit_action_id in number,
5457 p_start_person_action_id in number,
5458 p_end_person_action_id in number,
5459 p_business_group_id in number,
5460 p_mode in varchar2,
5461 p_person_selection_rule_id in number,
5462 p_comp_selection_rule_id in number,
5463 -- PB : 5422 :
5464 -- p_popl_enrt_typ_cycl_id in number,
5465 p_derivable_factors in varchar2,
5466 p_cbr_tmprl_evt_flag in varchar2,
5467 p_person_count in out nocopy number,
5468 p_error_person_count in out nocopy number,
5469 p_thread_id in number,
5470 p_validate in varchar2,
5471 p_effective_date in date,
5472 p_lf_evt_ocrd_dt in date,
5473 p_gsp_eval_elig_flag in varchar2 default null, /* GSP Rate Sync */
5474 p_lf_evt_oper_cd in varchar2 default null /* GSP Rate Sync */
5475 ) is
5476 --
5477 l_ler_id ben_person_actions.ler_id%type;
5478 l_person_id ben_person_actions.person_id%type;
5479 l_person_action_id ben_person_actions.person_action_id%type;
5480 l_object_version_number ben_person_actions.object_version_number%type;
5481 l_ptnl_ler_for_per_id ben_ptnl_ler_for_per.ptnl_ler_for_per_id%type;
5482 l_effective_start_date date;
5483 l_effective_end_date date;
5484 l_dummy varchar2(1);
5485 l_count number := 0;
5486 l_threads number;
5487 l_chunk_size number;
5488 l_max_errors number;
5489 l_package varchar2(80);
5490 l_mnl_dt date;
5491 l_dtctd_dt date;
5492 l_procd_dt date;
5493 l_unprocd_dt date;
5494 l_voidd_dt date;
5495 l_rec ben_env_object.g_global_env_rec_type;
5496 --
5497 cursor c_person_thread is
5498 select ben.person_id,
5499 ben.person_action_id,
5500 ben.object_version_number,
5501 ben.ler_id
5502 from ben_person_actions ben
5503 where ben.benefit_action_id = p_benefit_action_id
5504 and ben.action_status_cd <> 'P'
5505 and ben.person_action_id
5506 between p_start_person_action_id
5507 and p_end_person_action_id
5508 order by ben.person_action_id;
5509 --
5510 -- absences,gsp
5511 --
5512 cursor c_potential (p_person_id number) is
5513 select ptnl_ler_for_per_id
5514 from ben_ptnl_ler_for_per pfl,
5515 ben_ler_f ler
5516 where pfl.ptnl_ler_for_per_stat_cd not in ('VOIDD','PROCD')
5517 and pfl.person_id = p_person_id
5518 and pfl.ler_id = ler.ler_id
5519 and p_effective_date
5520 between ler.effective_start_date
5521 and ler.effective_end_date
5522 and pfl.lf_evt_ocrd_dt <= p_effective_date
5523 and ler.typ_cd = decode(p_mode,'M','ABS','G','GSP',null)
5524 order by pfl.lf_evt_ocrd_dt asc, ler.lf_evt_oper_cd desc;
5525
5526 cursor c_pil (p_person_id number) is
5527 select 'x'
5528 from ben_per_in_ler pil,
5529 ben_ler_f ler
5530 where pil.per_in_ler_stat_cd = 'STRTD'
5531 and pil.person_id = p_person_id
5532 and pil.ler_id = ler.ler_id
5533 and p_effective_date between ler.effective_start_date
5534 and ler.effective_end_date
5535 and ler.typ_cd = decode(p_mode,'M','ABS','G','GSP',null);
5536
5537 l_potential_o number ;
5538 l_potential number ;
5539
5540 begin
5541 --
5542 if g_debug then
5543 l_package := g_package||'.process_rows';
5544 hr_utility.set_location ('Entering '||l_package,10);
5545 end if;
5546 --
5547 open c_person_thread;
5548 --
5549 loop
5550 --
5551 if g_debug then
5552 hr_utility.set_location (l_package||' Start c_person_thread ',20);
5553 end if;
5554 fetch c_person_thread into l_person_id,
5555 l_person_action_id,
5556 l_object_version_number,
5557 l_ler_id;
5558 if g_debug then
5559 hr_utility.set_location (l_package||' fetch c_person_thread ',20);
5560 end if;
5561 exit when c_person_thread%notfound;
5562 --
5563 l_count := l_count + 1;
5564 --
5565 -- absence changes
5566 l_potential_o := null;
5567 l_potential := null;
5568
5569 Loop
5570 --
5571 process_life_events
5572 (p_person_id => l_person_id,
5573 p_person_action_id => l_person_action_id,
5574 p_object_version_number => l_object_version_number,
5575 p_business_group_id => p_business_group_id,
5576 p_mode => p_mode,
5577 p_ler_id => l_ler_id,
5578 p_person_selection_rule_id => p_person_selection_rule_id,
5579 p_comp_selection_rule_id => p_comp_selection_rule_id,
5580 p_derivable_factors => p_derivable_factors,
5581 p_cbr_tmprl_evt_flag => p_cbr_tmprl_evt_flag,
5582 p_person_count => p_person_count,
5583 p_error_person_count => p_error_person_count,
5584 p_effective_date => p_effective_date,
5585 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
5586 p_validate => p_validate, /* Bug 5550359 */
5587 p_gsp_eval_elig_flag => p_gsp_eval_elig_flag, /* GSP Rate Sync */
5588 p_lf_evt_oper_cd => p_lf_evt_oper_cd /* GSP Rate Sync */
5589 );
5590 --
5591 if p_mode in ('G','M') then
5592 -- absence mode loop
5593 -- if there are no ABS life events unprocessed
5594 -- (or)
5595 -- if the processing of previous life event errored,
5596 -- then exit out of the loop
5597 open c_potential ( l_person_id );
5598 fetch c_potential into l_potential;
5599 if c_potential%notfound or
5600 l_potential = l_potential_o then
5601 close c_potential;
5602 exit;
5603 else
5604 open c_pil(l_person_id);
5605 fetch c_pil into l_dummy;
5606 if c_pil%found then
5607 close c_potential;
5608 close c_pil;
5609 exit;
5610 end if;
5611 close c_pil;
5612 end if;
5613 close c_potential;
5614 l_potential_o := l_potential;
5615 else
5616 -- exit out of the loop after one iteration
5617 exit;
5618 end if;
5619 --
5620 End loop;
5621 --
5622 --
5623 if g_debug then
5624 hr_utility.set_location('End c_person_thread loop '||l_package,10);
5625 end if;
5626 --
5627 -- We need to commit the validate mode stuff to the log and
5628 -- table at regular intervals, that way users can view the log
5629 -- before the process has finished
5630 --
5631 -- Populate rollback value tables
5632 --
5633 ben_populate_rbv.populate_benmngle_rbvs
5634 (p_benefit_action_id => p_benefit_action_id
5635 ,p_person_action_id => l_person_action_id
5636 ,p_validate_flag => p_validate
5637 );
5638 --
5639 end loop;
5640 --
5641 close c_person_thread;
5642 if g_debug then
5643 hr_utility.set_location (l_package||' close c_person_thread ',20);
5644 end if;
5645 --
5646 if ben_populate_rbv.validate_mode
5647 (p_validate => p_validate
5648 )
5649 then
5650 --
5651 rollback;
5652 --
5653 end if;
5654 --
5655 /*
5656 if p_validate in ('Y','C')
5657 then
5658 --
5659 rollback;
5660 --
5661 end if;
5662 --
5663 */
5664 if g_debug then
5665 hr_utility.set_location (l_package||' Write TAF ',20);
5666 end if;
5667 benutils.write_table_and_file(p_table => true,
5668 p_file => true);
5669 commit;
5670 --
5671 if g_debug then
5672 hr_utility.set_location ('Leaving '||l_package,10);
5673 end if;
5674 --
5675 end process_rows;
5676 --
5677
5678 procedure set_up_cobj_part_elig
5679 (p_comp_obj_tree_row in out NOCOPY ben_manage_life_events.g_cache_proc_objects_rec
5680 ,p_ler_id in number
5681 ,p_business_group_id in number
5682 ,p_effective_date in date
5683 )
5684 is
5685 --
5686 l_proc varchar2(80);
5687 --
5688 begin
5689 --
5690 if g_debug then
5691 l_proc := g_package || '.set_up_cobj_part_elig';
5692 hr_utility.set_location('Entering '||l_proc,10);
5693 end if;
5694 if p_comp_obj_tree_row.pgm_id is not null then
5695 --
5696 if g_debug then
5697 hr_utility.set_location('Setting up eligibility at the PGM level',10);
5698 end if;
5699 --
5700 ben_cobj_cache.get_pgm_dets
5701 (p_business_group_id => p_business_group_id
5702 ,p_effective_date => p_effective_date
5703 ,p_pgm_id => p_comp_obj_tree_row.pgm_id
5704 ,p_inst_row => ben_cobj_cache.g_pgm_currow
5705 );
5706 --
5707 ben_cobj_cache.get_etpr_dets
5708 (p_business_group_id => p_business_group_id
5709 ,p_effective_date => p_effective_date
5710 ,p_ler_id => p_ler_id
5711 ,p_pgm_id => p_comp_obj_tree_row.pgm_id
5712 ,p_inst_row => ben_cobj_cache.g_pgmetpr_currow
5713 );
5714 --
5715 ben_cobj_cache.get_prel_dets
5716 (p_business_group_id => p_business_group_id
5717 ,p_effective_date => p_effective_date
5718 ,p_pgm_id => p_comp_obj_tree_row.pgm_id
5719 ,p_inst_row => ben_cobj_cache.g_pgmprel_currow
5720 );
5721 --
5722 if g_debug then
5723 hr_utility.set_location('Done pgm setobjs '||l_proc,20);
5724 end if;
5725 --
5726 elsif p_comp_obj_tree_row.ptip_id is not null then
5727 --
5728 if g_debug then
5729 hr_utility.set_location('Setting up eligibility at the PTIP level',10);
5730 end if;
5731 --
5732 ben_cobj_cache.get_ptip_dets
5733 (p_business_group_id => p_business_group_id
5734 ,p_effective_date => p_effective_date
5735 ,p_ptip_id => p_comp_obj_tree_row.ptip_id
5736 ,p_inst_row => ben_cobj_cache.g_ptip_currow
5737 );
5738 --
5739 ben_cobj_cache.get_etpr_dets
5740 (p_business_group_id => p_business_group_id
5741 ,p_effective_date => p_effective_date
5742 ,p_ler_id => p_ler_id
5743 ,p_ptip_id => p_comp_obj_tree_row.ptip_id
5744 ,p_inst_row => ben_cobj_cache.g_ptipetpr_currow
5745 );
5746 --
5747 ben_cobj_cache.get_prel_dets
5748 (p_business_group_id => p_business_group_id
5749 ,p_effective_date => p_effective_date
5750 ,p_ptip_id => p_comp_obj_tree_row.ptip_id
5751 ,p_inst_row => ben_cobj_cache.g_ptipprel_currow
5752 );
5753 --
5754 elsif p_comp_obj_tree_row.plip_id is not null then
5755 --
5756 if g_debug then
5757 hr_utility.set_location('Setting up eligibility at the PLIP level',10);
5758 end if;
5759 --
5760 ben_cobj_cache.get_plip_dets
5761 (p_business_group_id => p_business_group_id
5762 ,p_effective_date => p_effective_date
5763 ,p_plip_id => p_comp_obj_tree_row.plip_id
5764 ,p_inst_row => ben_cobj_cache.g_plip_currow
5765 );
5766 --
5767 ben_cobj_cache.get_etpr_dets
5768 (p_business_group_id => p_business_group_id
5769 ,p_effective_date => p_effective_date
5770 ,p_ler_id => p_ler_id
5771 ,p_plip_id => p_comp_obj_tree_row.plip_id
5772 ,p_inst_row => ben_cobj_cache.g_plipetpr_currow
5773 );
5774 --
5775 ben_cobj_cache.get_prel_dets
5776 (p_business_group_id => p_business_group_id
5777 ,p_effective_date => p_effective_date
5778 ,p_plip_id => p_comp_obj_tree_row.plip_id
5779 ,p_inst_row => ben_cobj_cache.g_plipprel_currow
5780 );
5781 --
5782 if g_debug then
5783 hr_utility.set_location(' current ptip ' || p_comp_obj_tree_row.par_ptip_id, 99 );
5784 hr_utility.set_location(' current hash ' || ben_cobj_cache.g_ptip_currow.ptip_id, 99 ) ;
5785 end if;
5786 ---- bug : 2228464 tilak
5787 ---- Compensation object tree was populated in PGM,PL name order
5788 ---- there cane a possibility of ptip falls in different levl
5789 ---- PRG1 MEDICAL ptip mediacl plan1
5790 ---- PRG1 DEntal ptip DEntal Plan 1
5791 --- PRG1 MEDICAL Ptip Medical Plan2
5792 ---- in the above case of Medical Plan2 cached ptip is DENTAL but the current ptip is
5793 --- Medical so the eligibility of PTIP validated for DENTAL not for MEDIACL
5794 --- so if the ptip_id of current row is not matching with cached then PTIP level
5795 --- is refreshed , discussed with martin and he agreed that
5796
5797
5798 if p_comp_obj_tree_row.par_ptip_id <> ben_cobj_cache.g_ptip_currow.ptip_id then
5799 ben_cobj_cache.get_ptip_dets
5800 (p_business_group_id => p_business_group_id
5801 ,p_effective_date => p_effective_date
5802 ,p_ptip_id => p_comp_obj_tree_row.par_ptip_id
5803 ,p_inst_row => ben_cobj_cache.g_ptip_currow
5804 );
5805 --
5806 ben_cobj_cache.get_etpr_dets
5807 (p_business_group_id => p_business_group_id
5808 ,p_effective_date => p_effective_date
5809 ,p_ler_id => p_ler_id
5810 ,p_ptip_id => p_comp_obj_tree_row.par_ptip_id
5811 ,p_inst_row => ben_cobj_cache.g_ptipetpr_currow
5812 );
5813 --
5814 ben_cobj_cache.get_prel_dets
5815 (p_business_group_id => p_business_group_id
5816 ,p_effective_date => p_effective_date
5817 ,p_ptip_id => p_comp_obj_tree_row.par_ptip_id
5818 ,p_inst_row => ben_cobj_cache.g_ptipprel_currow
5819 );
5820 end if ;
5821
5822 if g_debug then
5823 hr_utility.set_location('Done PLIP '||l_proc,30);
5824 end if;
5825 --
5826 elsif p_comp_obj_tree_row.pl_id is not null then
5827 --
5828 if g_debug then
5829 hr_utility.set_location('Setting up eligibility at the PLN level',10);
5830 end if;
5831 --
5832 ben_cobj_cache.get_pl_dets
5833 (p_business_group_id => p_business_group_id
5834 ,p_effective_date => p_effective_date
5835 ,p_pl_id => p_comp_obj_tree_row.pl_id
5836 ,p_inst_row => ben_cobj_cache.g_pl_currow
5837 );
5838 --
5839 ben_cobj_cache.get_etpr_dets
5840 (p_business_group_id => p_business_group_id
5841 ,p_effective_date => p_effective_date
5842 ,p_ler_id => p_ler_id
5843 ,p_pl_id => p_comp_obj_tree_row.pl_id
5844 ,p_inst_row => ben_cobj_cache.g_pletpr_currow
5845 );
5846 --
5847 ben_cobj_cache.get_prel_dets
5848 (p_business_group_id => p_business_group_id
5849 ,p_effective_date => p_effective_date
5850 ,p_pl_id => p_comp_obj_tree_row.pl_id
5851 ,p_inst_row => ben_cobj_cache.g_plprel_currow
5852 );
5853 --
5854 if g_debug then
5855 hr_utility.set_location('Done pln setobjs '||l_proc,20);
5856 end if;
5857 --
5858 elsif p_comp_obj_tree_row.oipl_id is not null then
5859 --
5860 if g_debug then
5861 hr_utility.set_location(l_proc||' OIPL NN ',20);
5862 end if;
5863 --
5864 ben_cobj_cache.get_oipl_dets
5865 (p_business_group_id => p_business_group_id
5866 ,p_effective_date => p_effective_date
5867 ,p_oipl_id => p_comp_obj_tree_row.oipl_id
5868 ,p_inst_row => ben_cobj_cache.g_oipl_currow
5869 );
5870 --
5871 ben_cobj_cache.get_opt_dets
5872 (p_business_group_id => p_business_group_id
5873 ,p_effective_date => p_effective_date
5874 ,p_opt_id => ben_cobj_cache.g_oipl_currow.opt_id
5875 ,p_inst_row => ben_cobj_cache.g_opt_currow
5876 );
5877 --
5878 ben_cobj_cache.get_etpr_dets
5879 (p_business_group_id => p_business_group_id
5880 ,p_effective_date => p_effective_date
5881 ,p_ler_id => p_ler_id
5882 ,p_oipl_id => p_comp_obj_tree_row.oipl_id
5883 ,p_inst_row => ben_cobj_cache.g_oipletpr_currow
5884 );
5885 --
5886 ben_cobj_cache.get_prel_dets
5887 (p_business_group_id => p_business_group_id
5888 ,p_effective_date => p_effective_date
5889 ,p_oipl_id => p_comp_obj_tree_row.oipl_id
5890 ,p_inst_row => ben_cobj_cache.g_oiplprel_currow
5891 );
5892 --
5893 -- Check oiplip stuff
5894 --
5895 if p_comp_obj_tree_row.oiplip_id is not null then
5896 --
5897 ben_cobj_cache.get_oiplip_dets
5898 (p_business_group_id => p_business_group_id
5899 ,p_effective_date => p_effective_date
5900 ,p_oiplip_id => p_comp_obj_tree_row.oiplip_id
5901 ,p_inst_row => ben_cobj_cache.g_oiplip_currow
5902 );
5903 --
5904 end if;
5905 --
5906 if g_debug then
5907 hr_utility.set_location('Done oipl setobjs '||l_proc,20);
5908 end if;
5909 --
5910 end if;
5911 --
5912 if g_debug then
5913 hr_utility.set_location('Leaving '||l_proc,10);
5914 end if;
5915 --
5916 end set_up_cobj_part_elig;
5917 --
5918 procedure set_up_list_part_elig
5919 (p_ler_id in number
5920 ,p_business_group_id in number
5921 ,p_effective_date in date
5922 )
5923 is
5924 --
5925 l_proc varchar2(80);
5926 --
5927 l_rec ben_elig_to_prte_rsn_f%rowtype;
5928 --
5929 begin
5930 --
5931 if g_debug then
5932 l_proc := g_package || '.set_up_list_part_elig';
5933 hr_utility.set_location('Entering '||l_proc,10);
5934 end if;
5935 --
5936 -- Loop through all comp objects and making a call to set up the eligibility
5937 -- cache.
5938 --
5939 for l_count in g_cache_proc_object.first..g_cache_proc_object.last loop
5940 --
5941 if g_debug then
5942 hr_utility.set_location('Start loop '||l_proc,20);
5943 end if;
5944 if g_cache_proc_object(l_count).pgm_id is not null then
5945 --
5946 if g_debug then
5947 hr_utility.set_location('Setting up eligibility at the PGM level',10);
5948 end if;
5949 --
5950 ben_elig_object.set_object
5951 (p_pgm_id => g_cache_proc_object(l_count).pgm_id,
5952 p_ler_id => p_ler_id,
5953 p_business_group_id => p_business_group_id,
5954 p_effective_date => p_effective_date
5955 ,p_rec => l_rec
5956 );
5957 --
5958 ben_elig_object.set_object
5959 (p_pgm_id => g_cache_proc_object(l_count).pgm_id,
5960 p_business_group_id => p_business_group_id,
5961 p_effective_date => p_effective_date);
5962
5963 if g_debug then
5964 hr_utility.set_location('Done pgm setobjs '||l_proc,20);
5965 end if;
5966 --
5967 elsif g_cache_proc_object(l_count).pl_id is not null then
5968 --
5969 if g_debug then
5970 hr_utility.set_location('Setting up eligibility at the PLN level',10);
5971 end if;
5972 --
5973 ben_elig_object.set_object
5974 (p_pl_id => g_cache_proc_object(l_count).pl_id,
5975 p_ler_id => p_ler_id,
5976 p_business_group_id => p_business_group_id,
5977 p_effective_date => p_effective_date
5978 ,p_rec => l_rec
5979 );
5980 --
5981 ben_elig_object.set_object
5982 (p_pl_id => g_cache_proc_object(l_count).pl_id,
5983 p_business_group_id => p_business_group_id,
5984 p_effective_date => p_effective_date);
5985 if g_debug then
5986 hr_utility.set_location('Done pln setobjs '||l_proc,20);
5987 end if;
5988 --
5989 --
5990 elsif g_cache_proc_object(l_count).plip_id is not null then
5991 --
5992 if g_debug then
5993 hr_utility.set_location('Setting up eligibility at the PLIP level',10);
5994 end if;
5995 --
5996 ben_elig_object.set_object
5997 (p_plip_id => g_cache_proc_object(l_count).plip_id,
5998 p_ler_id => p_ler_id,
5999 p_business_group_id => p_business_group_id,
6000 p_effective_date => p_effective_date
6001 ,p_rec => l_rec
6002 );
6003 --
6004 if g_debug then
6005 hr_utility.set_location('Done plip ler sobjs '||l_proc,20);
6006 end if;
6007 ben_elig_object.set_object
6008 (p_plip_id => g_cache_proc_object(l_count).plip_id,
6009 p_business_group_id => p_business_group_id,
6010 p_effective_date => p_effective_date);
6011 --
6012 if g_debug then
6013 hr_utility.set_location('Done PLIP '||l_proc,30);
6014 end if;
6015 --
6016 elsif g_cache_proc_object(l_count).ptip_id is not null then
6017 --
6018 if g_debug then
6019 hr_utility.set_location('Setting up eligibility at the PTIP level',10);
6020 hr_utility.set_location('Current PTIP = '||
6021 g_cache_proc_object(l_count).ptip_id,10);
6022 --
6023 hr_utility.set_location('ELOBJ_SOBJ '||l_proc,30);
6024 end if;
6025 ben_elig_object.set_object
6026 (p_ptip_id => g_cache_proc_object(l_count).ptip_id,
6027 p_ler_id => p_ler_id,
6028 p_business_group_id => p_business_group_id,
6029 p_effective_date => p_effective_date
6030 ,p_rec => l_rec
6031 );
6032 --
6033 ben_elig_object.set_object
6034 (p_ptip_id => g_cache_proc_object(l_count).ptip_id,
6035 p_business_group_id => p_business_group_id,
6036 p_effective_date => p_effective_date);
6037 --
6038 elsif g_cache_proc_object(l_count).oipl_id is not null then
6039 --
6040 if g_debug then
6041 hr_utility.set_location('Setting up eligibility at the OIPL level',10);
6042 end if;
6043 --
6044 if g_debug then
6045 hr_utility.set_location(l_proc||' OIPL NN ',20);
6046 end if;
6047 ben_elig_object.set_object
6048 (p_oipl_id => g_cache_proc_object(l_count).oipl_id,
6049 p_ler_id => p_ler_id,
6050 p_business_group_id => p_business_group_id,
6051 p_effective_date => p_effective_date
6052 ,p_rec => l_rec
6053 );
6054 --
6055 ben_elig_object.set_object
6056 (p_oipl_id => g_cache_proc_object(l_count).oipl_id,
6057 p_business_group_id => p_business_group_id,
6058 p_effective_date => p_effective_date);
6059 if g_debug then
6060 hr_utility.set_location('Done oipl setobjs '||l_proc,20);
6061 end if;
6062 --
6063 end if;
6064 --
6065 end loop;
6066 --
6067 if g_debug then
6068 hr_utility.set_location('Leaving '||l_proc,10);
6069 end if;
6070 --
6071 end set_up_list_part_elig;
6072 --
6073 procedure do_multithread
6074 (errbuf out nocopy varchar2,
6075 retcode out nocopy number,
6076 p_validate in varchar2,
6077 p_benefit_action_id in number,
6078 p_effective_date in varchar2,
6079 p_pgm_id in number,
6080 p_business_group_id in number,
6081 p_pl_id in number,
6082 -- PB : 5422 :
6083 p_popl_enrt_typ_cycl_id in number,
6084 p_no_programs in varchar2,
6085 p_no_plans in varchar2,
6086 p_rptg_grp_id in number,
6087 p_pl_typ_id in number,
6088 p_opt_id in number,
6089 p_eligy_prfl_id in number,
6090 p_vrbl_rt_prfl_id in number,
6091 p_mode in varchar2,
6092 p_person_selection_rule_id in number,
6093 p_comp_selection_rule_id in number,
6094 p_derivable_factors in varchar2,
6095 p_thread_id in number,
6096 p_lf_evt_ocrd_dt in varchar2,
6097 p_cbr_tmprl_evt_flag in varchar2,
6098 p_lmt_prpnip_by_org_flag in varchar2,
6099 p_gsp_eval_elig_flag in varchar2 default null, /* GSP Rate Sync */
6100 p_lf_evt_oper_cd in varchar2 default null /* GSP Rate Sync */
6101 ) is
6102 --
6103 l_package varchar2(80);
6104 l_row_id rowid;
6105 l_rows_found boolean := false;
6106 l_record_number number := 0;
6107 l_start_person_action_id number := 0;
6108 l_end_person_action_id number := 0;
6109 l_person_count number := 0;
6110 l_error_person_count number := 0;
6111 l_chunk_size number := 0;
6112 l_threads number := 0;
6113 --
6114 l_effective_date date;
6115 l_lf_evt_ocrd_dt date;
6116 l_max_errors number;
6117 l_commit number;
6118 l_slave_errored boolean := false;
6119 --
6120 l_ler_rec benutils.g_ler;
6121 --
6122 begin
6123 --
6124 g_debug := hr_utility.debug_enabled;
6125 if g_debug then
6126 l_package := g_package||'.do_multithread';
6127 hr_utility.set_location ('Entering '||l_package,10);
6128 hr_utility.set_location ('p_mode : '||p_mode,20);
6129 end if;
6130 --
6131 -- Convert varchar2 dates to real dates
6132 -- 1) First remove time component
6133 -- 2) Next convert format
6134 --
6135 /*
6136 l_effective_date := to_date(p_effective_date,'YYYY/MM/DD HH24:MI:SS');
6137 l_effective_date := to_date(to_char(trunc(l_effective_date),'DD/MM/RRRR'),'DD/MM/RRRR');
6138 l_lf_evt_ocrd_dt := to_date(p_lf_evt_ocrd_dt,'YYYY/MM/DD HH24:MI:SS');
6139 l_lf_evt_ocrd_dt := to_date(to_char(trunc(l_lf_evt_ocrd_dt),'DD/MM/RRRR'),'DD/MM/RRRR');
6140 */
6141 l_effective_date := trunc(fnd_date.canonical_to_date(p_effective_date));
6142 l_lf_evt_ocrd_dt := trunc(fnd_date.canonical_to_date(p_lf_evt_ocrd_dt));
6143 --
6144 benutils.get_ler
6145 (p_business_group_id => p_business_group_id
6146 ,p_typ_cd => 'SCHEDDU'
6147 ,p_effective_date => l_effective_date
6148 ,p_rec => l_ler_rec
6149 );
6150 --
6151 g_ler_id := l_ler_rec.ler_id;
6152 g_derivable_factors := p_derivable_factors;
6153 --
6154 -- iRec
6155 if p_mode = 'I' then
6156 --
6157 -- Set G_LER_ID to iRecruitment LER_ID for subsequent use in ben_evaluate_ptnl_lf_evt
6158 --
6159 benutils.get_ler (p_business_group_id => p_business_group_id,
6160 p_typ_cd => 'IREC',
6161 p_effective_date => l_effective_date,
6162 p_rec => l_ler_rec
6163 );
6164 --
6165 g_ler_id := l_ler_rec.ler_id;
6166 --
6167 end if;
6168 -- iRec
6169
6170 /* Bug 14484394: Set g_max_errors_allowed for the Participation Process: Compensation Workbench Conc Program */
6171 if(p_mode = 'W') then
6172 benutils.get_parameter(p_business_group_id => p_business_group_id,
6173 p_batch_exe_cd => 'BENGCMOD',
6174 p_threads => l_threads,
6175 p_chunk_size => l_chunk_size,
6176 p_max_errors => g_max_errors_allowed);
6177 else
6178 benutils.get_parameter
6179 (p_business_group_id => p_business_group_id,
6180 p_batch_exe_cd => 'BENMNGLE',
6181 p_threads => l_threads,
6182 p_chunk_size => l_chunk_size,
6183 p_max_errors => g_max_errors_allowed);
6184 end if;
6185
6186
6187 if g_debug then
6188 hr_utility.set_location ('Dn get_parameter '||l_package,10);
6189 end if;
6190 --
6191 -- Clear benmngle level caches
6192 --
6193 ben_manage_life_events.clear_init_benmngle_caches
6194 (p_business_group_id => p_business_group_id
6195 ,p_effective_date => l_effective_date
6196 ,p_threads => l_threads
6197 ,p_chunk_size => l_chunk_size
6198 ,p_max_errors => g_max_errors_allowed
6199 ,p_benefit_action_id => p_benefit_action_id
6200 ,p_thread_id => p_thread_id
6201 );
6202 --
6203 print_parameters
6204 (p_benefit_action_id => p_benefit_action_id);
6205 --
6206 -- Bug: 4128034. CWB Mode fnd_session needs to be set.
6207 if p_mode in ('L' , 'W' ) then
6208 dt_fndate.change_ses_date
6209 (p_ses_date => l_effective_date
6210 ,p_commit => l_commit
6211 );
6212 end if;
6213 --
6214 if p_mode in ('A','P','S','T') then
6215 --
6216 dt_fndate.change_ses_date
6217 (p_ses_date => l_effective_date
6218 ,p_commit => l_commit
6219 );
6220 --
6221 -- PB : Healthnet changes
6222 -- Build the comp object list in evaluate_life_events
6223 -- if comp objects selection is based on person's org id.
6224 --
6225 if p_lmt_prpnip_by_org_flag = 'N' then
6226 --
6227 if g_debug then
6228 hr_utility.set_location (' Temp BCOL '||l_package,10);
6229 end if;
6230 ben_comp_object_list.build_comp_object_list
6231 (p_benefit_action_id => p_benefit_action_id
6232 ,p_comp_selection_rule_id => p_comp_selection_rule_id
6233 ,p_effective_date => l_effective_date
6234 ,p_pgm_id => p_pgm_id
6235 ,p_business_group_id => p_business_group_id
6236 ,p_pl_id => p_pl_id
6237
6238 -- PB : 5422 :
6239 -- Pass on the asnd_lf_evt_dt
6240 --
6241 ,p_asnd_lf_evt_dt => null
6242 -- ,p_popl_enrt_typ_cycl_id => p_popl_enrt_typ_cycl_id
6243 ,p_no_programs => p_no_programs
6244 ,p_no_plans => p_no_plans
6245 ,p_rptg_grp_id => p_rptg_grp_id
6246 ,p_pl_typ_id => p_pl_typ_id
6247 ,p_opt_id => p_opt_id
6248 ,p_eligy_prfl_id => p_eligy_prfl_id
6249 ,p_vrbl_rt_prfl_id => p_vrbl_rt_prfl_id
6250 ,p_thread_id => p_thread_id
6251 ,p_mode => p_mode
6252 );
6253 --
6254 -- Set up participation eligibility for all comp objects in the list
6255 --
6256 set_up_list_part_elig
6257 (p_ler_id => null
6258 ,p_business_group_id => p_business_group_id
6259 ,p_effective_date => l_effective_date
6260 );
6261 if g_debug then
6262 hr_utility.set_location (' Dn Temp BCOL '||l_package,10);
6263 end if;
6264 --
6265 end if;
6266 --
6267 end if;
6268 --
6269 -- Non Validate Mode process
6270 -- -------------------------
6271 -- The process is as follows :
6272 -- 1) Lock the rows that are not processed
6273 -- 2) Grab the start and end person action id.
6274 -- 3) Process the person range
6275 -- 4) Go to number 1 again.
6276 --
6277 loop
6278 if g_debug then
6279 hr_utility.set_location (l_package||' START process_rows loop ',20);
6280 end if;
6281 --
6282 -- Chunk scheduling changes
6283 --
6284 if g_debug then
6285 hr_utility.set_location (l_package||' open c_range_thread ',22);
6286 end if;
6287 ben_maintain_benefit_actions.grab_next_batch_range
6288 (p_benefit_action_id => p_benefit_action_id
6289 --
6290 ,p_start_person_action_id => l_start_person_action_id
6291 ,p_end_person_action_id => l_end_person_action_id
6292 ,p_rows_found => l_rows_found
6293 );
6294 --
6295 if g_debug then
6296 hr_utility.set_location (l_package||' Done c_range_thread ',25);
6297 end if;
6298 --
6299 if not l_rows_found then
6300 --
6301 exit;
6302 --
6303 end if;
6304 --
6305 commit;
6306 --
6307 -- Bug 1387371: Added to cure memory leaking problems.
6308 -- The date dependent comp object list caches are flushed
6309 -- every 15 minutes.
6310 --
6311 if (sysdate-g_prev_sysdate) > (1/96) then
6312 --
6313 ben_pln_cache.clear_down_cache;
6314 ben_cop_cache.clear_down_cache;
6315 --
6316 g_prev_sysdate := sysdate;
6317 --
6318 end if;
6319 --
6320 if g_debug then
6321 hr_utility.set_location ('p_mode : '||p_mode,25);
6322 end if;
6323 process_rows
6324 (p_benefit_action_id => p_benefit_action_id,
6325 p_start_person_action_id => l_start_person_action_id,
6326 p_end_person_action_id => l_end_person_action_id,
6327 p_business_group_id => p_business_group_id,
6328 p_mode => p_mode,
6329 p_person_selection_rule_id => p_person_selection_rule_id,
6330 p_comp_selection_rule_id => p_comp_selection_rule_id,
6331 --
6332 -- PB : 5422 :
6333 -- Following parameter is no longer needed,
6334 --
6335 -- p_popl_enrt_typ_cycl_id => p_popl_enrt_typ_cycl_id,
6336 p_derivable_factors => p_derivable_factors,
6337 p_cbr_tmprl_evt_flag => p_cbr_tmprl_evt_flag,
6338 p_person_count => l_person_count,
6339 p_error_person_count => l_error_person_count,
6340 p_thread_id => p_thread_id,
6341 p_validate => p_validate,
6342 p_effective_date => l_effective_date,
6343 p_lf_evt_ocrd_dt => l_lf_evt_ocrd_dt,
6344 p_gsp_eval_elig_flag => p_gsp_eval_elig_flag, /* GSP Rate Sync */
6345 p_lf_evt_oper_cd => p_lf_evt_oper_cd /* GSP Rate Sync */
6346 );
6347 --
6348 if g_debug then
6349 hr_utility.set_location (l_package||' END process_rows loop ',50);
6350 end if;
6351 end loop;
6352 if g_debug then
6353 hr_utility.set_location (l_package||' Dn process_rows loop ',50);
6354 end if;
6355 --
6356 -- Output log information to log file
6357 --
6358 write_logfile(p_benefit_action_id => p_benefit_action_id,
6359 p_thread_id => p_thread_id,
6360 p_validate => p_validate,
6361 p_person_count => l_person_count,
6362 p_error_person_count => l_error_person_count);
6363 --
6364 ben_maintain_benefit_actions.check_all_slaves_finished
6365 (p_benefit_action_id => p_benefit_action_id
6366 ,p_business_group_id => p_business_group_id
6367 ,p_slave_errored => l_slave_errored
6368 );
6369 --
6370 if l_slave_errored then
6371 --
6372 fnd_message.raise_error;
6373 --
6374 end if;
6375 --
6376 if g_debug then
6377 hr_utility.set_location ('Leaving '||l_package,10);
6378 end if;
6379 --
6380 exception
6381 --
6382 when g_record_error then
6383 if g_debug then
6384 hr_utility.set_location (l_package||' Exception g_record_error ',50);
6385 end if;
6386 benutils.write(p_text => fnd_message.get);
6387 --
6388 -- Write the last bit of information for the thread
6389 --
6390 benutils.write_table_and_file(p_table => true,
6391 p_file => true);
6392 commit;
6393 --
6394 -- Output log information to log file
6395 --
6396 write_logfile(p_benefit_action_id => p_benefit_action_id,
6397 p_thread_id => p_thread_id,
6398 p_validate => 'Y',
6399 p_person_count => l_person_count,
6400 p_error_person_count => l_error_person_count);
6401
6402 ben_maintain_benefit_actions.check_all_slaves_finished
6403 (p_benefit_action_id => p_benefit_action_id
6404 ,p_business_group_id => p_business_group_id
6405 ,p_slave_errored => l_slave_errored
6406 );
6407 --
6408 when others then
6409 --
6410 if not l_slave_errored then
6411 --
6412 if g_debug then
6413 hr_utility.set_location (l_package||' OTHERS Exc ',60);
6414 end if;
6415 rollback;
6416 if g_debug then
6417 hr_utility.set_location ('BENMNGLE Super Error '||l_package,10);
6418 end if;
6419 g_rec.rep_typ_cd := 'FATAL';
6420 g_rec.text := nvl(fnd_message.get,sqlerrm);
6421 if g_debug then
6422 hr_utility.set_location(substr(g_rec.text,1,100),10);
6423 end if;
6424 benutils.write(p_rec => g_rec);
6425 --
6426 -- Output log information to log file
6427 --
6428 write_logfile(p_benefit_action_id => p_benefit_action_id,
6429 p_thread_id => p_thread_id,
6430 p_validate => 'Y',
6431 p_person_count => l_person_count,
6432 p_error_person_count => l_error_person_count);
6433 --
6434 ben_maintain_benefit_actions.check_all_slaves_finished
6435 (p_benefit_action_id => p_benefit_action_id
6436 ,p_business_group_id => p_business_group_id
6437 ,p_slave_errored => l_slave_errored
6438 );
6439 --
6440 end if;
6441 --
6442 -- Set generic system error with oracle SQLCODE as the token
6443 --
6444 fnd_message.set_name('BEN','BEN_91665_BENMNGLE_ERRORED');
6445 fnd_message.set_token('ORA_ERRCODE',SQLCODE);
6446 --
6447 benutils.write(p_text => fnd_message.get);
6448 benutils.write_table_and_file(p_table => true,
6449 p_file => true);
6450 commit;
6451 if g_debug then
6452 hr_utility.set_location ('Others error '||l_package,100);
6453 end if;
6454 fnd_message.raise_error;
6455 --
6456 end do_multithread;
6457 --
6458 procedure restart
6459 (errbuf out nocopy varchar2,
6460 retcode out nocopy number,
6461 p_benefit_action_id in number) is
6462 --
6463 l_package varchar2(80);
6464 --
6465 cursor c_parameters is
6466 select process_date,
6467 mode_cd,
6468 derivable_factors_flag,
6469 validate_flag,
6470 person_id,
6471 person_type_id,
6472 pgm_id,
6473 business_group_id,
6474 pl_id,
6475 --
6476 -- PB : 5422 : No longer needed.
6477 -- popl_enrt_typ_cycl_id,
6478 --
6479 no_programs_flag,
6480 no_plans_flag,
6481 comp_selection_rl,
6482 person_selection_rl,
6483 ler_id,
6484 organization_id,
6485 benfts_grp_id,
6486 location_id,
6487 pstl_zip_rng_id,
6488 rptg_grp_id,
6489 pl_typ_id,
6490 opt_id,
6491 eligy_prfl_id,
6492 vrbl_rt_prfl_id,
6493 legal_entity_id,
6494 payroll_id,
6495 audit_log_flag,
6496 debug_messages_flag,
6497 -- PB : 5422 :
6498 -- Add lf_evt_ocrd_dt
6499 lf_evt_ocrd_dt,
6500 lmt_prpnip_by_org_flag,
6501 inelg_action_cd
6502 from ben_benefit_actions ben
6503 where ben.benefit_action_id = p_benefit_action_id;
6504 --
6505 l_parameters c_parameters%rowtype;
6506 l_errbuf varchar2(80);
6507 l_retcode number;
6508 --
6509 begin
6510 --
6511 g_debug := hr_utility.debug_enabled;
6512 if g_debug then
6513 l_package := g_package||'.restart';
6514 hr_utility.set_location ('Entering '||l_package,10);
6515 end if;
6516 --
6517 -- get the parameters for a previous run and do a restart
6518 --
6519 open c_parameters;
6520 --
6521 fetch c_parameters into l_parameters;
6522 if c_parameters%notfound then
6523 --
6524 fnd_message.set_name('BEN','BEN_91666_BENMNGLE_NO_RESTART');
6525 fnd_message.raise_error;
6526 --
6527 end if;
6528 --
6529 close c_parameters;
6530 --
6531 -- Call process procedure with parameters for restart
6532 --
6533 process
6534 (errbuf => l_errbuf,
6535 retcode => l_retcode,
6536 p_benefit_action_id => p_benefit_action_id,
6537 p_effective_date => fnd_date.date_to_canonical(l_parameters.process_date),
6538 p_mode => l_parameters.mode_cd,
6539 p_derivable_factors => l_parameters.derivable_factors_flag,
6540 p_validate => l_parameters.validate_flag,
6541 p_person_id => l_parameters.person_id,
6542 p_person_type_id => l_parameters.person_type_id,
6543 p_pgm_id => l_parameters.pgm_id,
6544 p_business_group_id => l_parameters.business_group_id,
6545 p_pl_id => l_parameters.pl_id,
6546 -- PB : 5422 :
6547 -- p_popl_enrt_typ_cycl_id => l_parameters.popl_enrt_typ_cycl_id,
6548 p_no_programs => l_parameters.no_programs_flag,
6549 p_no_plans => l_parameters.no_plans_flag,
6550 p_comp_selection_rule_id => l_parameters.comp_selection_rl,
6551 p_person_selection_rule_id => l_parameters.person_selection_rl,
6552 p_ler_id => l_parameters.ler_id,
6553 p_organization_id => l_parameters.organization_id,
6554 p_benfts_grp_id => l_parameters.benfts_grp_id,
6555 p_location_id => l_parameters.location_id,
6556 p_pstl_zip_rng_id => l_parameters.pstl_zip_rng_id,
6557 p_rptg_grp_id => l_parameters.rptg_grp_id,
6558 p_pl_typ_id => l_parameters.pl_typ_id,
6559 p_opt_id => l_parameters.opt_id,
6560 p_eligy_prfl_id => l_parameters.eligy_prfl_id,
6561 p_vrbl_rt_prfl_id => l_parameters.vrbl_rt_prfl_id,
6562 p_legal_entity_id => l_parameters.legal_entity_id,
6563 p_payroll_id => l_parameters.payroll_id,
6564 p_commit_data => 'Y',
6565 p_audit_log_flag => l_parameters.audit_log_flag,
6566 p_cbr_tmprl_evt_flag => l_parameters.debug_messages_flag,--cobra
6567 p_abs_historical_mode => l_parameters.inelg_action_cd,
6568 p_lmt_prpnip_by_org_flag => l_parameters.lmt_prpnip_by_org_flag,
6569 -- PB : 5422 :
6570 -- Now pass on the lf_evt_ocrd_dt
6571 p_lf_evt_ocrd_dt => fnd_date.date_to_canonical(l_parameters.lf_evt_ocrd_dt));
6572 --
6573 -- The p_lf_evt_ocrd_dt needs to use lf_evt_ocrd_dt but that needs a schema
6574 -- change.
6575 --
6576 if g_debug then
6577 hr_utility.set_location ('Leaving '||l_package,10);
6578 end if;
6579 --
6580 end restart;
6581 --
6582 -- wrapper for procedure process
6583 --
6584 procedure cwb_process
6585 (errbuf out nocopy varchar2,
6586 retcode out nocopy number,
6587 p_benefit_action_id in number default null,
6588 p_effective_date in varchar2,
6589 p_mode in varchar2 default 'W',
6590 p_derivable_factors in varchar2 default 'ASC',
6591 p_validate in varchar2 default 'N',
6592 p_person_id in number default null,
6593 p_pgm_id in number default null,
6594 p_business_group_id in number,
6595 p_pl_id in number default null,
6596 p_popl_enrt_typ_cycl_id in number default null,
6597 p_lf_evt_ocrd_dt in varchar2 default null,
6598 p_person_type_id in number default null,
6599 p_no_programs in varchar2 default 'N',
6600 p_no_plans in varchar2 default 'N',
6601 p_comp_selection_rule_id in number default null,
6602 p_person_selection_rule_id in number default null,
6603 p_ler_id in number default null,
6604 p_organization_id in number default null,
6605 p_benfts_grp_id in number default null,
6606 p_location_id in number default null,
6607 p_pstl_zip_rng_id in number default null,
6608 p_rptg_grp_id in number default null,
6609 p_pl_typ_id in number default null,
6610 p_opt_id in number default null,
6611 p_eligy_prfl_id in number default null,
6612 p_vrbl_rt_prfl_id in number default null,
6613 p_legal_entity_id in number default null,
6614 p_payroll_id in number default null,
6615 p_commit_data in varchar2 default 'Y',
6616 p_audit_log_flag in varchar2 default 'N',
6617 p_lmt_prpnip_by_org_flag in varchar2 default 'N',
6618 p_cbr_tmprl_evt_flag in varchar2 default 'N',
6619 p_cwb_person_type in varchar2 default null) is
6620 --
6621 l_retcode number;
6622 l_errbuf varchar2(1000);
6623 -- Bug 4394545 . This program is now cannot be submitted directly through SRS.
6624 l_exc_no_parent_req exception ;
6625 l_parent_req_id number ;
6626 l_temp BOOLEAN ;
6627 l_text varchar2(1000) ;
6628 --
6629 cursor c_get_parent_req_id is
6630 select parent_request_id
6631 from fnd_concurrent_requests
6632 where request_id = fnd_global.conc_request_id;
6633 --
6634 begin
6635 --
6636 g_debug := hr_utility.debug_enabled;
6637 --
6638 open c_get_parent_req_id ;
6639 fetch c_get_parent_req_id into l_parent_req_id ;
6640 close c_get_parent_req_id ;
6641 -- Check for Parent request 4394545
6642 if l_parent_req_id is not null and
6643 l_parent_req_id = '-1' then
6644 -- Submitted by user
6645 raise l_exc_no_parent_req;
6646 --
6647 else
6648 -- Submitted by another Conc program, Continue processing
6649 process
6650 (errbuf =>l_errbuf,
6651 retcode =>l_retcode,
6652 p_benefit_action_id =>p_benefit_action_id ,
6653 p_effective_date =>p_effective_date,
6654 p_mode =>p_mode,
6655 p_derivable_factors =>p_derivable_factors,
6656 p_validate =>p_validate,
6657 p_person_id =>p_person_id,
6658 p_person_type_id =>p_person_type_id,
6659 p_pgm_id =>p_pgm_id,
6660 p_business_group_id =>p_business_group_id,
6661 p_pl_id =>p_pl_id,
6662 p_popl_enrt_typ_cycl_id =>p_popl_enrt_typ_cycl_id,
6663 p_lf_evt_ocrd_dt =>p_lf_evt_ocrd_dt,
6664 p_no_programs =>p_no_programs,
6665 p_no_plans =>p_no_plans,
6666 p_comp_selection_rule_id =>p_comp_selection_rule_id,
6667 p_person_selection_rule_id =>p_person_selection_rule_id,
6668 p_ler_id =>p_ler_id,
6669 p_organization_id =>p_organization_id,
6670 p_benfts_grp_id =>p_benfts_grp_id,
6671 p_location_id =>p_location_id,
6672 p_pstl_zip_rng_id =>p_pstl_zip_rng_id,
6673 p_rptg_grp_id =>p_rptg_grp_id,
6674 p_pl_typ_id =>p_pl_typ_id,
6675 p_opt_id =>p_opt_id,
6676 p_eligy_prfl_id =>p_eligy_prfl_id,
6677 p_vrbl_rt_prfl_id =>p_vrbl_rt_prfl_id,
6678 p_legal_entity_id =>p_legal_entity_id,
6679 p_payroll_id =>p_payroll_id,
6680 p_commit_data =>p_commit_data,
6681 p_audit_log_flag =>p_audit_log_flag,
6682 p_lmt_prpnip_by_org_flag =>p_lmt_prpnip_by_org_flag,
6683 p_cbr_tmprl_evt_flag =>p_cbr_tmprl_evt_flag ,
6684 p_cwb_person_type => p_cwb_person_type);
6685 --
6686 end if;
6687 --
6688 Exception
6689 when l_exc_no_parent_req then
6690 -- 4394545
6691 fnd_message.set_name('BEN','BEN_94272_COMOD_NO_SRS_SUBMIT');
6692 l_text := fnd_message.get ;
6693 FND_FILE.PUT_LINE(FND_FILE.LOG, l_text);
6694 l_temp := FND_CONCURRENT.SET_COMPLETION_STATUS('ERROR', l_text) ;
6695 --
6696 end cwb_process;
6697 --
6698 -- wrapper for CWB GLOBAL procedure process
6699 --
6700 procedure cwb_global_process
6701 (errbuf out nocopy varchar2,
6702 retcode out nocopy number,
6703 p_benefit_action_id in number default null,
6704 p_effective_date in varchar2,
6705 p_mode in varchar2 default 'W',
6706 p_derivable_factors in varchar2 default 'ASC',
6707 p_validate in varchar2 default 'N',
6708 p_person_id in number default null,
6709 p_pgm_id in number default null,
6710 p_business_group_id in number,
6711 p_pl_id in number default null,
6712 p_popl_enrt_typ_cycl_id in number default null,
6713 p_lf_evt_ocrd_dt in varchar2 default null,
6714 p_person_type_id in number default null,
6715 p_no_programs in varchar2 default 'N',
6716 p_no_plans in varchar2 default 'N',
6717 p_comp_selection_rule_id in number default null,
6718 p_person_selection_rule_id in number default null,
6719 p_ler_id in number default null,
6720 p_organization_id in number default null,
6721 p_benfts_grp_id in number default null,
6722 p_location_id in number default null,
6723 p_pstl_zip_rng_id in number default null,
6724 p_rptg_grp_id in number default null,
6725 p_pl_typ_id in number default null,
6726 p_opt_id in number default null,
6727 p_eligy_prfl_id in number default null,
6728 p_vrbl_rt_prfl_id in number default null,
6729 p_legal_entity_id in number default null,
6730 p_payroll_id in number default null,
6731 p_commit_data in varchar2 default 'Y',
6732 p_audit_log_flag in varchar2 default 'N',
6733 p_lmt_prpnip_by_org_flag in varchar2 default 'N',
6734 p_cbr_tmprl_evt_flag in varchar2 default 'N',
6735 p_trace_plans_flag in varchar2 default 'N',
6736 p_cwb_person_type in varchar2 default null,
6737 p_run_rollup_only in varchar2 default 'N' /* Bug 4875181 */
6738 ) is
6739 --
6740 l_retcode number;
6741 l_errbuf varchar2(1000);
6742 l_commit number;
6743 begin
6744 --
6745 g_debug := hr_utility.debug_enabled;
6746 --
6747 -- Bug: 4128034. CWB Mode fnd_session needs to be set.
6748 if p_mode = 'W' then
6749 dt_fndate.change_ses_date
6750 (p_ses_date => fnd_date.canonical_to_date(p_effective_date)
6751 ,p_commit => l_commit
6752 );
6753 end if;
6754 --
6755 ben_manage_cwb_life_events.global_process
6756 (errbuf =>l_errbuf,
6757 retcode =>l_retcode,
6758 p_benefit_action_id =>p_benefit_action_id ,
6759 p_effective_date =>p_effective_date,
6760 p_mode =>p_mode,
6761 p_derivable_factors =>p_derivable_factors,
6762 p_validate =>p_validate,
6763 p_person_id =>p_person_id,
6764 p_person_type_id =>p_person_type_id,
6765 p_pgm_id =>p_pgm_id,
6766 p_business_group_id =>p_business_group_id,
6767 p_pl_id =>p_pl_id,
6768 p_popl_enrt_typ_cycl_id =>p_popl_enrt_typ_cycl_id,
6769 p_lf_evt_ocrd_dt =>p_lf_evt_ocrd_dt,
6770 p_no_programs =>p_no_programs,
6771 p_no_plans =>p_no_plans,
6772 p_comp_selection_rule_id =>p_comp_selection_rule_id,
6773 p_person_selection_rule_id =>p_person_selection_rule_id,
6774 p_ler_id =>p_ler_id,
6775 p_organization_id =>p_organization_id,
6776 p_benfts_grp_id =>p_benfts_grp_id,
6777 p_location_id =>p_location_id,
6778 p_pstl_zip_rng_id =>p_pstl_zip_rng_id,
6779 p_rptg_grp_id =>p_rptg_grp_id,
6780 p_pl_typ_id =>p_pl_typ_id,
6781 p_opt_id =>p_opt_id,
6782 p_eligy_prfl_id =>p_eligy_prfl_id,
6783 p_vrbl_rt_prfl_id =>p_vrbl_rt_prfl_id,
6784 p_legal_entity_id =>p_legal_entity_id,
6785 p_payroll_id =>p_payroll_id,
6786 p_commit_data =>p_commit_data,
6787 p_audit_log_flag =>p_audit_log_flag,
6788 p_lmt_prpnip_by_org_flag =>p_lmt_prpnip_by_org_flag,
6789 p_cbr_tmprl_evt_flag =>p_cbr_tmprl_evt_flag,
6790 p_trace_plans_flag =>p_trace_plans_flag,
6791 p_cwb_person_type => p_cwb_person_type,
6792 p_run_rollup_only =>p_run_rollup_only /* Bug 4875181 */
6793 );
6794 --
6795 end cwb_global_process;
6796 --
6797 -- GRADE/STEP : wrapper header for G mode Operation Code = Progression
6798 --
6799 procedure grade_step_process
6800 (errbuf out nocopy varchar2
6801 ,retcode out nocopy number
6802 ,p_benefit_action_id in number default null
6803 ,p_effective_date in varchar2
6804 ,p_mode in varchar2 default 'G'
6805 ,p_derivable_factors in varchar2 default 'ASC'
6806 ,p_validate in varchar2 default 'N'
6807 ,p_person_id in number default null
6808 ,p_pgm_id in number default null
6809 ,p_business_group_id in number
6810 ,p_pl_id in number default null
6811 ,p_popl_enrt_typ_cycl_id in number default null
6812 ,p_lf_evt_ocrd_dt in varchar2 default null
6813 ,p_person_type_id in number default null
6814 ,p_no_programs in varchar2 default 'N'
6815 ,p_no_plans in varchar2 default 'N'
6816 ,p_comp_selection_rule_id in number default null
6817 ,p_person_selection_rule_id in number default null
6818 ,p_ler_id in number default null
6819 ,p_organization_id in number default null
6820 ,p_benfts_grp_id in number default null
6821 ,p_location_id in number default null
6822 ,p_pstl_zip_rng_id in number default null
6823 ,p_rptg_grp_id in number default null
6824 ,p_pl_typ_id in number default null
6825 ,p_opt_id in number default null
6826 ,p_eligy_prfl_id in number default null
6827 ,p_vrbl_rt_prfl_id in number default null
6828 ,p_legal_entity_id in number default null
6829 ,p_payroll_id in number default null
6830 -- GRADE/STEP : Added for grade/step benmngle
6831 ,p_org_heirarchy_id in number default null
6832 ,p_org_starting_node_id in number default null
6833 ,p_grade_ladder_id in number default null
6834 ,p_asg_events_to_all_sel_dt in varchar2 default null
6835 ,p_rate_id in number default null -- pay scale
6836 ,p_per_sel_dt_cd in varchar2 default null -- business rule
6837 ,p_per_sel_dt_from in varchar2 default null -- business rule date from
6838 ,p_per_sel_dt_to in varchar2 default null -- business rule date to
6839 ,p_per_sel_freq_cd in varchar2 default null -- 2940151
6840 ,p_year_from in number default null -- business rule year from
6841 ,p_year_to in number default null -- business rule year to
6842 ,p_cagr_id in number default null -- Coll agreement id
6843 ,p_qual_type in number default null
6844 ,p_qual_status in varchar2 default null
6845 -- 2940151
6846 ,p_id_flex_num in number default null
6847 ,p_concat_segs in varchar2 default null
6848 -- end 2940151
6849 -- GRADE/STEP : End
6850 ,p_commit_data in varchar2 default 'Y'
6851 ,p_audit_log_flag in varchar2 default 'N'
6852 ,p_lmt_prpnip_by_org_flag in varchar2 default 'N'
6853 ,p_cbr_tmprl_evt_flag in varchar2 default 'N'
6854 )is
6855 --
6856 l_bin binary_integer ;
6857 l_retcode number;
6858 l_errbuf varchar2(1000);
6859
6860 begin
6861 --
6862 -- hr_utility.trace_on(null, 'GSPRS');
6863 g_debug := hr_utility.debug_enabled;
6864 /*
6865 fnd_file.put_line(fnd_file.log,'p_benefit_action_id '||nvl(p_benefit_action_id, -1));
6866 fnd_file.put_line(fnd_file.log,'p_effective_date '||p_effective_date);
6867 fnd_file.put_line(fnd_file.log,'p_mode '||nvl(p_mode,'null'));
6868 fnd_file.put_line(fnd_file.log,'p_business_group_id '||p_business_group_id);
6869 fnd_file.put_line(fnd_file.log,'p_business_group_id '||p_business_group_id);
6870 fnd_file.put_line(fnd_file.log,'p_business_group_id '||p_business_group_id);
6871 fnd_file.put_line(fnd_file.log,'p_business_group_id '||p_business_group_id);
6872 fnd_file.put_line(fnd_file.log,'p_business_group_id '||p_business_group_id);
6873 fnd_file.put_line(fnd_file.log,'p_business_group_id '||p_business_group_id);
6874 fnd_file.put_line(fnd_file.log,'p_business_group_id '||p_business_group_id);
6875 fnd_file.put_line(fnd_file.log,'p_business_group_id '||p_business_group_id);
6876 fnd_file.put_line(fnd_file.log,'p_business_group_id '||p_business_group_id);
6877 fnd_file.put_line(fnd_file.log,'p_business_group_id '||p_business_group_id);
6878 fnd_file.put_line(fnd_file.log,'p_business_group_id '||p_business_group_id);
6879 fnd_file.put_line(fnd_file.log,'p_business_group_id '||p_business_group_id);
6880 fnd_file.put_line(fnd_file.log,'p_business_group_id '||p_business_group_id);
6881
6882
6883 hr_utility.set_location ('Before Step 1',20);
6884 hr_utility.set_location ('p_effective_date '||p_effective_date,20);
6885 hr_utility.set_location ('p_business_group_id '||p_business_group_id,20);
6886 hr_utility.set_location ('p_commit_data '||p_commit_data,20);
6887 hr_utility.set_location ('p_audit_log_flag '||p_audit_log_flag,20);
6888 hr_utility.set_location ('p_lmt_prpnip_by_org_flag '||p_lmt_prpnip_by_org_flag,20);
6889 */
6890 --
6891 process
6892 (errbuf =>l_errbuf,
6893 retcode =>l_retcode,
6894 p_benefit_action_id =>p_benefit_action_id ,
6895 p_effective_date =>p_effective_date,
6896 p_mode =>p_mode,
6897 p_derivable_factors =>p_derivable_factors,
6898 p_validate =>p_validate,
6899 p_person_id =>p_person_id,
6900 p_person_type_id =>p_person_type_id,
6901 p_pgm_id =>p_pgm_id,
6902 p_business_group_id =>p_business_group_id,
6903 p_pl_id =>p_pl_id,
6904 p_popl_enrt_typ_cycl_id =>p_popl_enrt_typ_cycl_id,
6905 p_lf_evt_ocrd_dt =>p_lf_evt_ocrd_dt,
6906 p_no_programs =>p_no_programs,
6907 p_no_plans =>p_no_plans,
6908 p_comp_selection_rule_id =>p_comp_selection_rule_id,
6909 p_person_selection_rule_id =>p_person_selection_rule_id,
6910 p_ler_id =>p_ler_id,
6911 p_organization_id =>p_organization_id,
6912 p_benfts_grp_id =>p_benfts_grp_id,
6913 p_location_id =>p_location_id,
6914 p_pstl_zip_rng_id =>p_pstl_zip_rng_id,
6915 p_rptg_grp_id =>p_rptg_grp_id,
6916 p_pl_typ_id =>p_pl_typ_id,
6917 p_opt_id =>p_opt_id,
6918 p_eligy_prfl_id =>p_eligy_prfl_id,
6919 p_vrbl_rt_prfl_id =>p_vrbl_rt_prfl_id,
6920 p_legal_entity_id =>p_legal_entity_id,
6921 p_payroll_id =>p_payroll_id,
6922 p_commit_data =>p_commit_data,
6923 p_audit_log_flag =>p_audit_log_flag,
6924 p_lmt_prpnip_by_org_flag =>p_lmt_prpnip_by_org_flag,
6925 p_cbr_tmprl_evt_flag =>p_cbr_tmprl_evt_flag ,
6926 -- passed these gsp parameters
6927 -- version 115.329
6928 p_org_heirarchy_id =>p_org_heirarchy_id,
6929 p_org_starting_node_id =>p_org_starting_node_id,
6930 p_grade_ladder_id =>p_grade_ladder_id,
6931 p_asg_events_to_all_sel_dt =>p_asg_events_to_all_sel_dt,
6932 p_rate_id =>p_rate_id,
6933 p_per_sel_dt_cd =>p_per_sel_dt_cd,
6934 p_per_sel_dt_from => fnd_date.canonical_to_date(p_per_sel_dt_from),
6935 p_per_sel_dt_to => fnd_date.canonical_to_date(p_per_sel_dt_to),
6936 p_year_from =>p_year_from,
6937 p_year_to =>p_year_to,
6938 p_cagr_id =>p_cagr_id,
6939 p_qual_type =>p_qual_type,
6940 p_qual_status =>p_qual_status,
6941 -- 2940151
6942 p_per_sel_freq_cd =>p_per_sel_freq_cd,
6943 p_concat_segs =>p_concat_segs,
6944 p_gsp_eval_elig_flag => 'Y', /* GSP Rate Sync */
6945 p_lf_evt_oper_cd => 'PROG' /* GSP Rate Sync */
6946 -- end 2940151
6947 );
6948 --
6949 end grade_step_process;
6950 --
6951 -- GRADE/STEP : wrapper header for G mode Operation Code = Rate Synchronization
6952 -- GSP Rate Sync
6953 procedure grade_step_rate_sync_process
6954 (errbuf out nocopy varchar2
6955 ,retcode out nocopy number
6956 ,p_benefit_action_id in number default null
6957 ,p_effective_date in varchar2
6958 ,p_mode in varchar2 default 'G'
6959 ,p_derivable_factors in varchar2 default 'ASC'
6960 ,p_validate in varchar2 default 'N'
6961 ,p_person_id in number default null
6962 ,p_pgm_id in number default null
6963 ,p_business_group_id in varchar2
6964 ,p_person_type_id in number default null
6965 ,p_comp_selection_rule_id in number default null
6966 ,p_person_selection_rule_id in number default null
6967 ,p_organization_id in number default null
6968 ,p_benfts_grp_id in number default null
6969 ,p_location_id in number default null
6970 ,p_pstl_zip_rng_id in number default null
6971 ,p_rptg_grp_id in number default null
6972 ,p_legal_entity_id in number default null
6973 ,p_payroll_id in number default null
6974 ,p_org_heirarchy_id in number default null
6975 ,p_org_starting_node_id in number default null
6976 ,p_grade_ladder_id in number default null
6977 ,p_rate_id in number default null -- pay scale
6978 ,p_per_sel_dt_cd in varchar2 default null -- business rule
6979 ,p_per_sel_dt_from in varchar2 default null -- business rule date from
6980 ,p_per_sel_dt_to in varchar2 default null -- business rule date to
6981 ,p_per_sel_freq_cd in varchar2 default null -- 2940151
6982 ,p_year_from in number default null -- business rule year from
6983 ,p_year_to in number default null -- business rule year to
6984 ,p_cagr_id in number default null -- Coll agreement id
6985 ,p_qual_type in number default null
6986 ,p_qual_status in varchar2 default null
6987 ,p_id_flex_num in number default null
6988 ,p_concat_segs in varchar2 default null
6989 ,p_commit_data in varchar2 default 'Y'
6990 ,p_gsp_eval_elig_flag in varchar2 default 'N' -- Evaluate Eligibility
6991 ,p_audit_log_flag in varchar2 default 'N'
6992 ,p_lmt_prpnip_by_org_flag in varchar2 default 'N'
6993 )is
6994 --
6995 l_bin binary_integer ;
6996 l_retcode number;
6997 l_errbuf varchar2(1000);
6998
6999 begin
7000 --
7001 -- hr_utility.trace_on(null, 'GSPRS');
7002 g_debug := hr_utility.debug_enabled;
7003 --
7004 process
7005 (errbuf => l_errbuf,
7006 retcode => l_retcode,
7007 p_benefit_action_id => p_benefit_action_id,
7008 p_effective_date => p_effective_date,
7009 p_mode => p_mode,
7010 p_derivable_factors => p_derivable_factors,
7011 p_validate => p_validate,
7012 p_person_id => p_person_id,
7013 p_pgm_id => p_pgm_id,
7014 p_business_group_id => p_business_group_id,
7015 p_person_type_id => p_person_type_id,
7016 p_comp_selection_rule_id => p_comp_selection_rule_id,
7017 p_person_selection_rule_id => p_person_selection_rule_id,
7018 p_organization_id => p_organization_id,
7019 p_benfts_grp_id => p_benfts_grp_id,
7020 p_location_id => p_location_id,
7021 p_pstl_zip_rng_id => p_pstl_zip_rng_id,
7022 p_rptg_grp_id => p_rptg_grp_id,
7023 p_legal_entity_id => p_legal_entity_id,
7024 p_payroll_id => p_payroll_id,
7025 p_org_heirarchy_id => p_org_heirarchy_id,
7026 p_org_starting_node_id => p_org_starting_node_id,
7027 p_grade_ladder_id => p_grade_ladder_id,
7028 p_rate_id => p_rate_id,
7029 p_per_sel_dt_cd => p_per_sel_dt_cd,
7030 p_per_sel_dt_from => p_per_sel_dt_from,
7031 p_per_sel_dt_to => p_per_sel_dt_to,
7032 p_per_sel_freq_cd => p_per_sel_freq_cd,
7033 p_year_from => p_year_from,
7034 p_year_to => p_year_to,
7035 p_cagr_id => p_cagr_id,
7036 p_qual_type => p_qual_type,
7037 p_qual_status => p_qual_status,
7038 p_concat_segs => p_concat_segs,
7039 p_commit_data => p_commit_data,
7040 p_audit_log_flag => p_audit_log_flag,
7041 p_lmt_prpnip_by_org_flag => p_lmt_prpnip_by_org_flag,
7042 p_asg_events_to_all_sel_dt => p_effective_date, -- Pass Effective Date as PTNL Life Event Occurred Date
7043 p_gsp_eval_elig_flag => p_gsp_eval_elig_flag,
7044 p_lf_evt_oper_cd => 'SYNC' -- Life Event Operation code for Rate Synchronization
7045 );
7046 hr_utility.trace_off;
7047 --
7048 end grade_step_rate_sync_process;
7049 --
7050 -- wrapper for procedure process - ABSENCES
7051 --
7052 procedure abse_process
7053 (errbuf out nocopy varchar2,
7054 retcode out nocopy number,
7055 p_benefit_action_id in number default null,
7056 p_effective_date in varchar2,
7057 p_mode in varchar2 default 'M',
7058 p_derivable_factors in varchar2 default 'ASC',
7059 p_validate in varchar2 default 'N',
7060 p_person_id in number default null,
7061 p_pgm_id in number default null,
7062 p_business_group_id in number,
7063 p_pl_id in number default null,
7064 p_popl_enrt_typ_cycl_id in number default null,
7065 p_lf_evt_ocrd_dt in varchar2 default null,
7066 p_person_type_id in number default null,
7067 p_no_programs in varchar2 default 'N',
7068 p_no_plans in varchar2 default 'N',
7069 p_comp_selection_rule_id in number default null,
7070 p_person_selection_rule_id in number default null,
7071 p_ler_id in number default null,
7072 p_organization_id in number default null,
7073 p_benfts_grp_id in number default null,
7074 p_location_id in number default null,
7075 p_pstl_zip_rng_id in number default null,
7076 p_rptg_grp_id in number default null,
7077 p_pl_typ_id in number default null,
7078 p_opt_id in number default null,
7079 p_eligy_prfl_id in number default null,
7080 p_vrbl_rt_prfl_id in number default null,
7081 p_legal_entity_id in number default null,
7082 p_payroll_id in number default null,
7083 p_commit_data in varchar2 default 'Y',
7084 p_audit_log_flag in varchar2 default 'N',
7085 p_lmt_prpnip_by_org_flag in varchar2 default 'N',
7086 p_abs_historical_mode in varchar2 default 'N',
7087 p_cbr_tmprl_evt_flag in varchar2 default 'N') is
7088 --
7089 l_retcode number;
7090 l_errbuf varchar2(1000);
7091 begin
7092 --
7093 g_debug := hr_utility.debug_enabled;
7094 --
7095 process
7096 (errbuf =>l_errbuf,
7097 retcode =>l_retcode,
7098 p_benefit_action_id =>p_benefit_action_id ,
7099 p_effective_date =>p_effective_date,
7100 p_mode =>p_mode,
7101 p_derivable_factors =>p_derivable_factors,
7102 p_validate =>p_validate,
7103 p_person_id =>p_person_id,
7104 p_person_type_id =>p_person_type_id,
7105 p_pgm_id =>p_pgm_id,
7106 p_business_group_id =>p_business_group_id,
7107 p_pl_id =>p_pl_id,
7108 p_popl_enrt_typ_cycl_id =>p_popl_enrt_typ_cycl_id,
7109 p_lf_evt_ocrd_dt =>p_lf_evt_ocrd_dt,
7110 p_no_programs =>p_no_programs,
7111 p_no_plans =>p_no_plans,
7112 p_comp_selection_rule_id =>p_comp_selection_rule_id,
7113 p_person_selection_rule_id =>p_person_selection_rule_id,
7114 p_ler_id =>p_ler_id,
7115 p_organization_id =>p_organization_id,
7116 p_benfts_grp_id =>p_benfts_grp_id,
7117 p_location_id =>p_location_id,
7118 p_pstl_zip_rng_id =>p_pstl_zip_rng_id,
7119 p_rptg_grp_id =>p_rptg_grp_id,
7120 p_pl_typ_id =>p_pl_typ_id,
7121 p_opt_id =>p_opt_id,
7122 p_eligy_prfl_id =>p_eligy_prfl_id,
7123 p_vrbl_rt_prfl_id =>p_vrbl_rt_prfl_id,
7124 p_legal_entity_id =>p_legal_entity_id,
7125 p_payroll_id =>p_payroll_id,
7126 p_commit_data =>p_commit_data,
7127 p_audit_log_flag =>p_audit_log_flag,
7128 p_lmt_prpnip_by_org_flag =>p_lmt_prpnip_by_org_flag,
7129 p_cbr_tmprl_evt_flag =>p_cbr_tmprl_evt_flag,
7130 p_abs_historical_mode =>p_abs_historical_mode);
7131 --
7132 end abse_process;
7133 --
7134 -- iRec
7135 -- wrapper for procedure internal_process - iRecruitment
7136 --
7137 procedure irec_process
7138 (errbuf out nocopy varchar2,
7139 retcode out nocopy number,
7140 p_effective_date in varchar2,
7141 p_mode in varchar2 default 'I',
7142 p_derivable_factors in varchar2 default 'ASC',
7143 p_validate in varchar2 default 'N',
7144 p_person_id in number default null,
7145 p_pgm_id in number default null,
7146 p_business_group_id in number,
7147 p_pl_id in number default null,
7148 p_popl_enrt_typ_cycl_id in number default null,
7149 p_lf_evt_ocrd_dt in varchar2 default null,
7150 p_person_type_id in number default null,
7151 p_no_programs in varchar2 default 'N',
7152 p_no_plans in varchar2 default 'N',
7153 p_comp_selection_rule_id in number default null,
7154 p_person_selection_rule_id in number default null,
7155 p_ler_id in number default null,
7156 p_organization_id in number default null,
7157 p_benfts_grp_id in number default null,
7158 p_location_id in number default null,
7159 p_pstl_zip_rng_id in number default null,
7160 p_rptg_grp_id in number default null,
7161 p_pl_typ_id in number default null,
7162 p_opt_id in number default null,
7163 p_eligy_prfl_id in number default null,
7164 p_vrbl_rt_prfl_id in number default null,
7165 p_legal_entity_id in number default null,
7166 p_payroll_id in number default null,
7167 p_commit_data in varchar2 default 'Y',
7168 p_audit_log_flag in varchar2 default 'N',
7169 p_lmt_prpnip_by_org_flag in varchar2 default 'N',
7170 p_abs_historical_mode in varchar2 default 'N',
7171 p_cbr_tmprl_evt_flag in varchar2 default 'N',
7172 p_assignment_id in number default null,
7173 p_offer_assignment_rec in per_all_assignments_f%rowtype) ----bug 4621751 irec2
7174 is
7175 --
7176 l_retcode number;
7177 l_errbuf varchar2(1000);
7178 l_benefit_action_id number;
7179 l_old_data_migrator_mode varchar2(1) ;-- irec2
7180
7181 --
7182 cursor c_irec_ass_rec is
7183 select ass.*
7184 from per_all_assignments_F ass
7185 where assignment_id = p_assignment_id
7186 and to_date(p_effective_date,'YYYY/MM/DD HH24:MI:SS') between ass.effective_start_date
7187 and ass.effective_end_date;
7188
7189 cursor c_irec_ass_rec_upd is
7190 select ass.*
7191 from per_all_assignments_F ass
7192 where assignment_id = p_assignment_id
7193 and to_date(p_effective_date,'YYYY/MM/DD HH24:MI:SS') between ass.effective_start_date
7194 and ass.effective_end_date;
7195
7196 --
7197 begin
7198 --
7199 g_debug := hr_utility.debug_enabled;
7200 --
7201 -- Bug 5857493
7202 if p_audit_log_flag ='Y' then
7203 ben_benbatch_persons.g_audit_flag := true;
7204 else
7205 ben_benbatch_persons.g_audit_flag := false;
7206 end if;
7207 --
7208 -- Populate global assignment record of the applicant being processed
7209 -- by BENMNGLE in mode I into g_irec_ass_rec
7210 -- irec2 : 1. copy c_irec_ass_rec to g_irec_old_ass_rec
7211 -- 2. update per_all_assignments_F with p_offer_assignment_rec
7212 open c_irec_ass_rec;
7213 --
7214 fetch c_irec_ass_rec into ben_manage_life_events.g_irec_old_ass_rec; -- irec2
7215 if c_irec_ass_rec%notfound then
7216 --
7217 close c_irec_ass_rec;
7218 fnd_message.set_name('BEN','BEN_94027_NO_ACT_APL_ASS_FOUND');
7219 fnd_message.raise_error;
7220 --
7221 else -- begin irec2
7222 begin
7223 l_old_data_migrator_mode := hr_general.g_data_migrator_mode ;
7224 hr_general.g_data_migrator_mode := 'Y' ;
7225 -- update starts
7226 update per_all_assignments_F
7227 set
7228 BUSINESS_GROUP_ID = p_offer_assignment_rec.BUSINESS_GROUP_ID
7229 ,RECRUITER_ID = p_offer_assignment_rec.RECRUITER_ID
7230 ,GRADE_ID = p_offer_assignment_rec.GRADE_ID
7231 ,POSITION_ID = p_offer_assignment_rec.POSITION_ID
7232 ,JOB_ID = p_offer_assignment_rec.JOB_ID
7233 ,ASSIGNMENT_STATUS_TYPE_ID = p_offer_assignment_rec.ASSIGNMENT_STATUS_TYPE_ID
7234 ,PAYROLL_ID = p_offer_assignment_rec.PAYROLL_ID
7235 ,LOCATION_ID = p_offer_assignment_rec.LOCATION_ID
7236 ,PERSON_REFERRED_BY_ID = p_offer_assignment_rec.PERSON_REFERRED_BY_ID
7237 ,SUPERVISOR_ID = p_offer_assignment_rec.SUPERVISOR_ID
7238 ,SPECIAL_CEILING_STEP_ID = p_offer_assignment_rec.SPECIAL_CEILING_STEP_ID
7239 ,PERSON_ID = p_offer_assignment_rec.PERSON_ID
7240 ,RECRUITMENT_ACTIVITY_ID = p_offer_assignment_rec.RECRUITMENT_ACTIVITY_ID
7241 ,SOURCE_ORGANIZATION_ID = p_offer_assignment_rec.SOURCE_ORGANIZATION_ID
7242 ,ORGANIZATION_ID = p_offer_assignment_rec.ORGANIZATION_ID
7243 ,PEOPLE_GROUP_ID = p_offer_assignment_rec.PEOPLE_GROUP_ID
7244 ,SOFT_CODING_KEYFLEX_ID = p_offer_assignment_rec.SOFT_CODING_KEYFLEX_ID
7245 ,VACANCY_ID = p_offer_assignment_rec.VACANCY_ID
7246 ,PAY_BASIS_ID = p_offer_assignment_rec.PAY_BASIS_ID
7247 ,ASSIGNMENT_SEQUENCE = p_offer_assignment_rec.ASSIGNMENT_SEQUENCE
7248 ,APPLICATION_ID = p_offer_assignment_rec.APPLICATION_ID
7249 ,ASSIGNMENT_NUMBER = p_offer_assignment_rec.ASSIGNMENT_NUMBER
7250 ,CHANGE_REASON = p_offer_assignment_rec.CHANGE_REASON
7251 ,COMMENT_ID = p_offer_assignment_rec.COMMENT_ID
7252 ,DATE_PROBATION_END = p_offer_assignment_rec.DATE_PROBATION_END
7253 ,DEFAULT_CODE_COMB_ID = p_offer_assignment_rec.DEFAULT_CODE_COMB_ID
7254 ,EMPLOYMENT_CATEGORY = p_offer_assignment_rec.EMPLOYMENT_CATEGORY
7255 ,FREQUENCY = p_offer_assignment_rec.FREQUENCY
7256 ,INTERNAL_ADDRESS_LINE = p_offer_assignment_rec.INTERNAL_ADDRESS_LINE
7257 ,MANAGER_FLAG = p_offer_assignment_rec.MANAGER_FLAG
7258 ,NORMAL_HOURS = p_offer_assignment_rec.NORMAL_HOURS
7259 ,PERF_REVIEW_PERIOD = p_offer_assignment_rec.PERF_REVIEW_PERIOD
7260 ,PERF_REVIEW_PERIOD_FREQUENCY = p_offer_assignment_rec.PERF_REVIEW_PERIOD_FREQUENCY
7261 ,PERIOD_OF_SERVICE_ID = p_offer_assignment_rec.PERIOD_OF_SERVICE_ID
7262 ,PROBATION_PERIOD = p_offer_assignment_rec.PROBATION_PERIOD
7263 ,PROBATION_UNIT = p_offer_assignment_rec.PROBATION_UNIT
7264 ,SAL_REVIEW_PERIOD = p_offer_assignment_rec.SAL_REVIEW_PERIOD
7265 ,SAL_REVIEW_PERIOD_FREQUENCY = p_offer_assignment_rec.SAL_REVIEW_PERIOD_FREQUENCY
7266 ,SET_OF_BOOKS_ID = p_offer_assignment_rec.SET_OF_BOOKS_ID
7267 ,SOURCE_TYPE = p_offer_assignment_rec.SOURCE_TYPE
7268 ,TIME_NORMAL_FINISH = p_offer_assignment_rec.TIME_NORMAL_FINISH
7269 ,TIME_NORMAL_START = p_offer_assignment_rec.TIME_NORMAL_START
7270 ,REQUEST_ID = p_offer_assignment_rec.REQUEST_ID
7271 ,PROGRAM_APPLICATION_ID = p_offer_assignment_rec.PROGRAM_APPLICATION_ID
7272 ,PROGRAM_ID = p_offer_assignment_rec.PROGRAM_ID
7273 ,PROGRAM_UPDATE_DATE = p_offer_assignment_rec.PROGRAM_UPDATE_DATE
7274 ,ASS_ATTRIBUTE_CATEGORY = p_offer_assignment_rec.ASS_ATTRIBUTE_CATEGORY
7275 ,ASS_ATTRIBUTE1 = p_offer_assignment_rec.ASS_ATTRIBUTE1
7276 ,ASS_ATTRIBUTE2 = p_offer_assignment_rec.ASS_ATTRIBUTE2
7277 ,ASS_ATTRIBUTE3 = p_offer_assignment_rec.ASS_ATTRIBUTE3
7278 ,ASS_ATTRIBUTE4 = p_offer_assignment_rec.ASS_ATTRIBUTE4
7279 ,ASS_ATTRIBUTE5 = p_offer_assignment_rec.ASS_ATTRIBUTE5
7280 ,ASS_ATTRIBUTE6 = p_offer_assignment_rec.ASS_ATTRIBUTE6
7281 ,ASS_ATTRIBUTE7 = p_offer_assignment_rec.ASS_ATTRIBUTE7
7282 ,ASS_ATTRIBUTE8 = p_offer_assignment_rec.ASS_ATTRIBUTE8
7283 ,ASS_ATTRIBUTE9 = p_offer_assignment_rec.ASS_ATTRIBUTE9
7284 ,ASS_ATTRIBUTE10 = p_offer_assignment_rec.ASS_ATTRIBUTE10
7285 ,ASS_ATTRIBUTE11 = p_offer_assignment_rec.ASS_ATTRIBUTE11
7286 ,ASS_ATTRIBUTE12 = p_offer_assignment_rec.ASS_ATTRIBUTE12
7287 ,ASS_ATTRIBUTE13 = p_offer_assignment_rec.ASS_ATTRIBUTE13
7288 ,ASS_ATTRIBUTE14 = p_offer_assignment_rec.ASS_ATTRIBUTE14
7289 ,ASS_ATTRIBUTE15 = p_offer_assignment_rec.ASS_ATTRIBUTE15
7290 ,ASS_ATTRIBUTE16 = p_offer_assignment_rec.ASS_ATTRIBUTE16
7291 ,ASS_ATTRIBUTE17 = p_offer_assignment_rec.ASS_ATTRIBUTE17
7292 ,ASS_ATTRIBUTE18 = p_offer_assignment_rec.ASS_ATTRIBUTE18
7293 ,ASS_ATTRIBUTE19 = p_offer_assignment_rec.ASS_ATTRIBUTE19
7294 ,ASS_ATTRIBUTE20 = p_offer_assignment_rec.ASS_ATTRIBUTE20
7295 ,ASS_ATTRIBUTE21 = p_offer_assignment_rec.ASS_ATTRIBUTE21
7296 ,ASS_ATTRIBUTE22 = p_offer_assignment_rec.ASS_ATTRIBUTE22
7297 ,ASS_ATTRIBUTE23 = p_offer_assignment_rec.ASS_ATTRIBUTE23
7298 ,ASS_ATTRIBUTE24 = p_offer_assignment_rec.ASS_ATTRIBUTE24
7299 ,ASS_ATTRIBUTE25 = p_offer_assignment_rec.ASS_ATTRIBUTE25
7300 ,ASS_ATTRIBUTE26 = p_offer_assignment_rec.ASS_ATTRIBUTE26
7301 ,ASS_ATTRIBUTE27 = p_offer_assignment_rec.ASS_ATTRIBUTE27
7302 ,ASS_ATTRIBUTE28 = p_offer_assignment_rec.ASS_ATTRIBUTE28
7303 ,ASS_ATTRIBUTE29 = p_offer_assignment_rec.ASS_ATTRIBUTE29
7304 ,ASS_ATTRIBUTE30 = p_offer_assignment_rec.ASS_ATTRIBUTE30
7305 ,TITLE = p_offer_assignment_rec.TITLE
7306 ,OBJECT_VERSION_NUMBER = p_offer_assignment_rec.OBJECT_VERSION_NUMBER
7307 ,BARGAINING_UNIT_CODE = p_offer_assignment_rec.BARGAINING_UNIT_CODE
7308 ,LABOUR_UNION_MEMBER_FLAG = p_offer_assignment_rec.LABOUR_UNION_MEMBER_FLAG
7309 ,HOURLY_SALARIED_CODE = p_offer_assignment_rec.HOURLY_SALARIED_CODE
7310 ,CONTRACT_ID = p_offer_assignment_rec.CONTRACT_ID
7311 ,COLLECTIVE_AGREEMENT_ID = p_offer_assignment_rec.COLLECTIVE_AGREEMENT_ID
7312 ,CAGR_ID_FLEX_NUM = p_offer_assignment_rec.CAGR_ID_FLEX_NUM
7313 ,CAGR_GRADE_DEF_ID = p_offer_assignment_rec.CAGR_GRADE_DEF_ID
7314 ,ESTABLISHMENT_ID = p_offer_assignment_rec.ESTABLISHMENT_ID
7315 ,NOTICE_PERIOD = p_offer_assignment_rec.NOTICE_PERIOD
7316 ,NOTICE_PERIOD_UOM = p_offer_assignment_rec.NOTICE_PERIOD_UOM
7317 ,EMPLOYEE_CATEGORY = p_offer_assignment_rec.EMPLOYEE_CATEGORY
7318 ,WORK_AT_HOME = p_offer_assignment_rec.WORK_AT_HOME
7319 ,JOB_POST_SOURCE_NAME = p_offer_assignment_rec.JOB_POST_SOURCE_NAME
7320 ,POSTING_CONTENT_ID = p_offer_assignment_rec.POSTING_CONTENT_ID
7321 ,PERIOD_OF_PLACEMENT_DATE_START = p_offer_assignment_rec.PERIOD_OF_PLACEMENT_DATE_START
7322 ,VENDOR_ID = p_offer_assignment_rec.VENDOR_ID
7323 ,VENDOR_EMPLOYEE_NUMBER = p_offer_assignment_rec.VENDOR_EMPLOYEE_NUMBER
7324 ,VENDOR_ASSIGNMENT_NUMBER = p_offer_assignment_rec.VENDOR_ASSIGNMENT_NUMBER
7325 ,ASSIGNMENT_CATEGORY = p_offer_assignment_rec.ASSIGNMENT_CATEGORY
7326 ,PROJECT_TITLE = p_offer_assignment_rec.PROJECT_TITLE
7327 ,APPLICANT_RANK = p_offer_assignment_rec.APPLICANT_RANK
7328 ,GRADE_LADDER_PGM_ID = p_offer_assignment_rec.GRADE_LADDER_PGM_ID
7329 ,SUPERVISOR_ASSIGNMENT_ID = p_offer_assignment_rec.SUPERVISOR_ASSIGNMENT_ID
7330 ,VENDOR_SITE_ID = p_offer_assignment_rec.VENDOR_SITE_ID
7331 ,PO_HEADER_ID = p_offer_assignment_rec.PO_HEADER_ID
7332 ,PO_LINE_ID = p_offer_assignment_rec.PO_LINE_ID
7333 ,PROJECTED_ASSIGNMENT_END = p_offer_assignment_rec.PROJECTED_ASSIGNMENT_END
7334
7335 where assignment_id = p_assignment_id
7336 and to_date(p_effective_date,'YYYY/MM/DD HH24:MI:SS') between effective_start_date and effective_end_date
7337 ;
7338 -- Bug 10350428: Added the date condition in above update statement
7339 -- update ends
7340 hr_general.g_data_migrator_mode := l_old_data_migrator_mode ;
7341
7342 -- move updated per_all_assignments_f record to g_irec_ass_rec.
7343 open c_irec_ass_rec_upd;
7344 fetch c_irec_ass_rec_upd into g_irec_ass_rec;
7345 close c_irec_ass_rec_upd;
7346
7347 -- end irec2
7348 exception
7349 when others then
7350 raise;
7351 end;
7352
7353 end if;
7354 --
7355 close c_irec_ass_rec;
7356 --
7357 --
7358 internal_process
7359 (errbuf =>l_errbuf,
7360 retcode =>l_retcode,
7361 p_benefit_action_id =>l_benefit_action_id ,
7362 p_effective_date =>p_effective_date,
7363 p_mode =>p_mode,
7364 p_derivable_factors =>p_derivable_factors,
7365 p_validate =>p_validate,
7366 p_person_id =>p_person_id,
7367 p_person_type_id =>p_person_type_id,
7368 p_pgm_id =>p_pgm_id,
7369 p_business_group_id =>p_business_group_id,
7370 p_pl_id =>p_pl_id,
7371 p_popl_enrt_typ_cycl_id =>p_popl_enrt_typ_cycl_id,
7372 p_lf_evt_ocrd_dt =>p_lf_evt_ocrd_dt,
7373 p_no_programs =>p_no_programs,
7374 p_no_plans =>p_no_plans,
7375 p_comp_selection_rule_id =>p_comp_selection_rule_id,
7376 p_person_selection_rule_id =>p_person_selection_rule_id,
7377 p_ler_id =>p_ler_id,
7378 p_organization_id =>p_organization_id,
7379 p_benfts_grp_id =>p_benfts_grp_id,
7380 p_location_id =>p_location_id,
7381 p_pstl_zip_rng_id =>p_pstl_zip_rng_id,
7382 p_rptg_grp_id =>p_rptg_grp_id,
7383 p_pl_typ_id =>p_pl_typ_id,
7384 p_opt_id =>p_opt_id,
7385 p_eligy_prfl_id =>p_eligy_prfl_id,
7386 p_vrbl_rt_prfl_id =>p_vrbl_rt_prfl_id,
7387 p_legal_entity_id =>p_legal_entity_id,
7388 p_payroll_id =>p_payroll_id,
7389 p_commit_data =>p_commit_data,
7390 p_audit_log_flag =>p_audit_log_flag,
7391 p_lmt_prpnip_by_org_flag =>p_lmt_prpnip_by_org_flag,
7392 p_cbr_tmprl_evt_flag =>p_cbr_tmprl_evt_flag,
7393 p_abs_historical_mode =>p_abs_historical_mode
7394 );
7395 --
7396 end irec_process;
7397 --
7398 --
7399 procedure rebuild_heirarchy
7400 (p_pil_elctbl_chc_popl_id in number ) is
7401 --
7402 l_package varchar2(80) := g_package||'.rebuild_heirarchy' ;
7403 -- Bug 2574791
7404 cursor c_pel is
7405 select pel.pl_id, pil.lf_evt_ocrd_dt, pel.business_group_id
7406 from ben_pil_elctbl_chc_popl pel
7407 ,ben_per_in_ler pil
7408 where pel.per_in_ler_id = pil.per_in_ler_id
7409 and pel.pil_elctbl_chc_popl_id = p_pil_elctbl_chc_popl_id;
7410 --
7411 begin
7412 --
7413 g_debug := hr_utility.debug_enabled;
7414 --
7415 -- Steps
7416 --
7417 -- 1. create pel,-1,-1 record for the p_pil_elctbl_chc_popl_id.
7418 -- 2. create pel,-1,-1 records for
7419 -- empoyees whose mgr_pel is = to p_pil_elctbl_chc_popl_id.
7420 -- 3. Delete all records from hierarchy table of the managers of the
7421 -- p_pil_elctbl_chc_popl_id and the employees reporting to this
7422 -- p_pil_elctbl_chc_popl_id.
7423 -- 4. call the popu_pel_heir to rebuild the table.
7424 --
7425 -- 5. When the first direct reportee is added to a new Manager
7426 -- we need two insert a mgr_pel,0,0 with level 1
7427 --
7428 if p_pil_elctbl_chc_popl_id is not null then
7429 --
7430 -- Bug 2574791
7431 open c_pel;
7432 fetch c_pel into g_rebuild_pl_id, g_rebuild_lf_evt_ocrd_dt, g_rebuild_business_group_id;
7433 close c_pel;
7434
7435 if g_debug then
7436 hr_utility.set_location ('Before Step 1',20);
7437 end if;
7438 --
7439 -- Step 1
7440 begin
7441 --
7442 insert into ben_cwb_hrchy (
7443 emp_pil_elctbl_chc_popl_id,
7444 mgr_pil_elctbl_chc_popl_id,
7445 lvl_num )
7446 values (
7447 p_pil_elctbl_chc_popl_id,
7448 -1,
7449 -1 );
7450 --
7451 exception when no_data_found then
7452 --
7453 null;
7454 --
7455 when others then
7456 --
7457 null; -- raise ;
7458 --
7459 end;
7460 --
7461 if g_debug then
7462 hr_utility.set_location ('After Step 1',20);
7463 --
7464 hr_utility.set_location ('Before Step 2 ',20);
7465 end if;
7466 --
7467 --Step 2
7468 -- Don't insert for the pel,0,0 record since it is
7469 -- Already handled in Step 1 above.
7470 --
7471 declare
7472 cursor c_emp_repo is
7473 select
7474 emp_pil_elctbl_chc_popl_id
7475 from ben_cwb_hrchy
7476 where mgr_pil_elctbl_chc_popl_id = p_pil_elctbl_chc_popl_id
7477 and lvl_num > 0;
7478 begin
7479 --
7480 for r_emp_repo in c_emp_repo loop
7481 --
7482 begin
7483 -- Bug 2574791
7484 insert into ben_cwb_hrchy (
7485 emp_pil_elctbl_chc_popl_id,
7486 mgr_pil_elctbl_chc_popl_id,
7487 lvl_num ) values (r_emp_repo.emp_pil_elctbl_chc_popl_id, -1, -1);
7488 exception when others then
7489 null;
7490 end;
7491 end loop;
7492 --
7493 exception when no_data_found then
7494 --
7495 null;
7496 --
7497 when others then
7498 --
7499 raise ;
7500 --
7501 end;
7502 --
7503 if g_debug then
7504 hr_utility.set_location ('After Step 2 ',20);
7505 --
7506 hr_utility.set_location ('Before Step 3 ',20);
7507 end if;
7508 --
7509 begin
7510 --
7511 --First Delete the Managers in the Hierarchy
7512 --
7513 delete from ben_cwb_hrchy
7514 where emp_pil_elctbl_chc_popl_id = p_pil_elctbl_chc_popl_id
7515 and lvl_num >= 0;
7516 --
7517 -- Now delete the Employees reporting to this manager(if he is a manager).
7518 --
7519 delete from ben_cwb_hrchy
7520 where emp_pil_elctbl_chc_popl_id in (
7521 select emp_pil_elctbl_chc_popl_id
7522 from ben_cwb_hrchy
7523 where mgr_pil_elctbl_chc_popl_id = p_pil_elctbl_chc_popl_id )
7524 and lvl_num >= 0;
7525 --
7526 exception when others then
7527 --
7528 raise ;
7529 --
7530 end;
7531 --
7532 if g_debug then
7533 hr_utility.set_location ('After Step 3 ',20);
7534 --
7535 hr_utility.set_location ('Before Calling popu_pel_heir',20);
7536 end if;
7537 begin
7538 --
7539 ben_manage_life_events.popu_pel_heir ;
7540 --
7541 exception when others then
7542 --
7543 raise ;
7544 --
7545 end;
7546 --
7547 if g_debug then
7548 hr_utility.set_location ('Before Step 5',20);
7549 end if;
7550 --
7551 begin
7552 --
7553 insert into ben_cwb_hrchy(
7554 emp_pil_elctbl_chc_popl_id,
7555 mgr_pil_elctbl_chc_popl_id,
7556 lvl_num )
7557 select
7558 distinct emp_pil_elctbl_chc_popl_id,
7559 emp_pil_elctbl_chc_popl_id,
7560 0
7561 from ben_cwb_hrchy cwb1
7562 where emp_pil_elctbl_chc_popl_id =
7563 ( select mgr_pil_elctbl_chc_popl_id from ben_cwb_hrchy
7564 where emp_pil_elctbl_chc_popl_id = p_pil_elctbl_chc_popl_id
7565 and lvl_num = 1 )
7566 and not exists ( select null from ben_cwb_hrchy cwb2
7567 where cwb1.emp_pil_elctbl_chc_popl_id = cwb2.emp_pil_elctbl_chc_popl_id
7568 and lvl_num = 0 ) ;
7569 --
7570 exception when no_data_found then
7571 --
7572 null;
7573 --
7574 when others then
7575 --
7576 raise ;
7577 --
7578 end;
7579 --
7580 -- Bug 2574791
7581 g_rebuild_pl_id := null;
7582 g_rebuild_lf_evt_ocrd_dt := null;
7583 g_rebuild_business_group_id := null;
7584 --
7585 end if;
7586 --
7587 if g_debug then
7588 hr_utility.set_location ('Afert Step 5',20);
7589 hr_utility.set_location ('After Calling popu_pel_heir',20);
7590 end if;
7591 --
7592 --
7593 end rebuild_heirarchy ;
7594
7595 --
7596 -- Wrapper for Personnel Action mode
7597
7598 procedure Personnel_action_process
7599 (errbuf out nocopy varchar2,
7600 retcode out nocopy number,
7601 p_benefit_action_id in number default null,
7602 p_effective_date in varchar2,
7603 p_mode in varchar2,
7604 p_derivable_factors in varchar2 default 'ASC',
7605 p_validate in varchar2 default 'N',
7606 p_person_id in number default null,
7607 p_person_type_id in number default null,
7608 p_pgm_id in number default null,
7609 p_business_group_id in number,
7610 p_pl_id in number default null,
7611 p_popl_enrt_typ_cycl_id in number default null,
7612 p_lf_evt_ocrd_dt in varchar2 default null,
7613 p_no_programs in varchar2 default 'N',
7614 p_no_plans in varchar2 default 'N',
7615 p_comp_selection_rule_id in number default null,
7616 p_person_selection_rule_id in number default null,
7617 p_ler_id in number default null,
7618 p_organization_id in number default null,
7619 p_benfts_grp_id in number default null,
7620 p_location_id in number default null,
7621 p_pstl_zip_rng_id in number default null,
7622 p_rptg_grp_id in number default null,
7623 p_pl_typ_id in number default null,
7624 p_opt_id in number default null,
7625 p_eligy_prfl_id in number default null,
7626 p_vrbl_rt_prfl_id in number default null,
7627 p_legal_entity_id in number default null,
7628 p_payroll_id in number default null,
7629 p_commit_data in varchar2 default 'Y',
7630 p_audit_log_flag in varchar2 default 'N',
7631 p_lmt_prpnip_by_org_flag in varchar2 default 'N',
7632 p_cbr_tmprl_evt_flag in varchar2 default 'N') is
7633 --
7634 l_retcode number;
7635 l_errbuf varchar2(1000);
7636 --
7637 begin
7638 --
7639 g_debug := hr_utility.debug_enabled;
7640 --
7641 process
7642 (errbuf =>l_errbuf,
7643 retcode =>l_retcode,
7644 p_benefit_action_id => null,
7645 p_effective_date =>p_effective_date,
7646 p_mode =>p_mode,
7647 p_derivable_factors =>'ASC',
7648 p_validate =>p_validate,
7649 p_person_id =>p_person_id,
7650 p_person_type_id =>p_person_type_id,
7651 p_pgm_id =>p_pgm_id,
7652 p_business_group_id =>p_business_group_id,
7653 p_pl_id =>p_pl_id,
7654 p_popl_enrt_typ_cycl_id =>p_popl_enrt_typ_cycl_id,
7655 p_lf_evt_ocrd_dt =>p_lf_evt_ocrd_dt,
7656 p_no_programs =>p_no_programs,
7657 p_no_plans =>p_no_plans,
7658 p_comp_selection_rule_id =>p_comp_selection_rule_id,
7659 p_person_selection_rule_id =>p_person_selection_rule_id,
7660 p_ler_id =>p_ler_id,
7661 p_organization_id =>p_organization_id,
7662 p_benfts_grp_id =>p_benfts_grp_id,
7663 p_location_id =>p_location_id,
7664 p_pstl_zip_rng_id =>p_pstl_zip_rng_id,
7665 p_rptg_grp_id =>p_rptg_grp_id,
7666 p_pl_typ_id =>p_pl_typ_id,
7667 p_opt_id =>p_opt_id,
7668 p_eligy_prfl_id =>p_eligy_prfl_id,
7669 p_vrbl_rt_prfl_id =>p_vrbl_rt_prfl_id,
7670 p_legal_entity_id =>p_legal_entity_id,
7671 p_payroll_id =>p_payroll_id,
7672 p_commit_data =>p_commit_data,
7673 p_audit_log_flag =>p_audit_log_flag,
7674 p_lmt_prpnip_by_org_flag =>p_lmt_prpnip_by_org_flag,
7675 p_cbr_tmprl_evt_flag =>p_cbr_tmprl_evt_flag );
7676 end;
7677 ----
7678 procedure process_recalculate
7679 (errbuf out nocopy varchar2,
7680 retcode out nocopy number,
7681 p_benefit_action_id in number default null,
7682 p_effective_date in varchar2,
7683 p_mode in varchar2,
7684 p_derivable_factors in varchar2 default 'ASC',
7685 p_validate in varchar2 default 'N',
7686 p_person_id in number default null,
7687 p_person_type_id in number default null,
7688 p_pgm_id in number default null,
7689 p_business_group_id in number,
7690 p_pl_id in number default null,
7691 p_popl_enrt_typ_cycl_id in number default null,
7692 p_lf_evt_ocrd_dt in varchar2 default null,
7693 p_no_programs in varchar2 default 'N',
7694 p_no_plans in varchar2 default 'N',
7695 p_comp_selection_rule_id in number default null,
7696 p_person_selection_rule_id in number default null,
7697 p_ler_id in number default null,
7698 p_organization_id in number default null,
7699 p_benfts_grp_id in number default null,
7700 p_location_id in number default null,
7701 p_pstl_zip_rng_id in number default null,
7702 p_rptg_grp_id in number default null,
7703 p_pl_typ_id in number default null,
7704 p_opt_id in number default null,
7705 p_eligy_prfl_id in number default null,
7706 p_vrbl_rt_prfl_id in number default null,
7707 p_legal_entity_id in number default null,
7708 p_payroll_id in number default null,
7709 p_commit_data in varchar2 default 'Y',
7710 p_audit_log_flag in varchar2 default 'N',
7711 p_lmt_prpnip_by_org_flag in varchar2 default 'N',
7712 p_cbr_tmprl_evt_flag in varchar2 default 'N') is
7713 --
7714 l_retcode number;
7715 l_errbuf varchar2(1000);
7716 --
7717 begin
7718 --
7719 g_debug := hr_utility.debug_enabled;
7720 --
7721 process
7722 (errbuf =>l_errbuf,
7723 retcode =>l_retcode,
7724 p_benefit_action_id => null,
7725 p_effective_date =>p_effective_date,
7726 p_mode =>p_mode,
7727 p_derivable_factors =>'NONE',
7728 p_validate =>p_validate,
7729 p_person_id =>p_person_id,
7730 p_person_type_id =>p_person_type_id,
7731 p_pgm_id =>p_pgm_id,
7732 p_business_group_id =>p_business_group_id,
7733 p_pl_id =>p_pl_id,
7734 p_popl_enrt_typ_cycl_id =>p_popl_enrt_typ_cycl_id,
7735 p_lf_evt_ocrd_dt =>p_lf_evt_ocrd_dt,
7736 p_no_programs =>p_no_programs,
7737 p_no_plans =>p_no_plans,
7738 p_comp_selection_rule_id =>p_comp_selection_rule_id,
7739 p_person_selection_rule_id =>p_person_selection_rule_id,
7740 p_ler_id =>p_ler_id,
7741 p_organization_id =>p_organization_id,
7742 p_benfts_grp_id =>p_benfts_grp_id,
7743 p_location_id =>p_location_id,
7744 p_pstl_zip_rng_id =>p_pstl_zip_rng_id,
7745 p_rptg_grp_id =>p_rptg_grp_id,
7746 p_pl_typ_id =>p_pl_typ_id,
7747 p_opt_id =>p_opt_id,
7748 p_eligy_prfl_id =>p_eligy_prfl_id,
7749 p_vrbl_rt_prfl_id =>p_vrbl_rt_prfl_id,
7750 p_legal_entity_id =>p_legal_entity_id,
7751 p_payroll_id =>p_payroll_id,
7752 p_commit_data =>p_commit_data,
7753 p_audit_log_flag =>p_audit_log_flag,
7754 p_lmt_prpnip_by_org_flag =>p_lmt_prpnip_by_org_flag,
7755 p_cbr_tmprl_evt_flag =>p_cbr_tmprl_evt_flag );
7756 --
7757 end;
7758
7759 ----
7760 procedure internal_process
7761 (errbuf out nocopy varchar2
7762 ,retcode out nocopy number
7763 ,p_benefit_action_id in out nocopy number
7764 ,p_effective_date in varchar2
7765 ,p_mode in varchar2
7766 ,p_derivable_factors in varchar2 default 'ASC'
7767 ,p_validate in varchar2 default 'N'
7768 ,p_person_id in number default null
7769 ,p_person_type_id in number default null
7770 ,p_pgm_id in number default null
7771 ,p_business_group_id in number
7772 ,p_pl_id in number default null
7773 ,p_popl_enrt_typ_cycl_id in number default null
7774 ,p_lf_evt_ocrd_dt in varchar2 default null
7775 ,p_no_programs in varchar2 default 'N'
7776 ,p_no_plans in varchar2 default 'N'
7777 ,p_comp_selection_rule_id in number default null
7778 ,p_person_selection_rule_id in number default null
7779 ,p_ler_id in number default null
7780 ,p_organization_id in number default null
7781 ,p_benfts_grp_id in number default null
7782 ,p_location_id in number default null
7783 ,p_pstl_zip_rng_id in number default null
7784 ,p_rptg_grp_id in number default null
7785 ,p_pl_typ_id in number default null
7786 ,p_opt_id in number default null
7787 ,p_eligy_prfl_id in number default null
7788 ,p_vrbl_rt_prfl_id in number default null
7789 ,p_legal_entity_id in number default null
7790 ,p_payroll_id in number default null
7791 ,p_commit_data in varchar2 default 'Y'
7792 ,p_audit_log_flag in varchar2 default 'N'
7793 ,p_lmt_prpnip_by_org_flag in varchar2 default 'N'
7794 ,p_cbr_tmprl_evt_flag in varchar2 default 'N'
7795 -- GRADE/STEP : Added for grade/step benmngle
7796 ,p_org_heirarchy_id in number default null
7797 ,p_org_starting_node_id in number default null
7798 ,p_grade_ladder_id in number default null
7799 ,p_asg_events_to_all_sel_dt in varchar2 default null
7800 ,p_rate_id in number default null -- pay scale
7801 ,p_per_sel_dt_cd in varchar2 default null -- business rule
7802 ,p_per_sel_dt_from in date default null -- business rule date from
7803 ,p_per_sel_dt_to in date default null -- business rule date to
7804 ,p_year_from in number default null -- business rule year from
7805 ,p_year_to in number default null -- business rule year to
7806 ,p_cagr_id in number default null -- Coll agreement id
7807 ,p_qual_type in number default null
7808 ,p_qual_status in varchar2 default null
7809 -- 2940151
7810 ,p_per_sel_freq_cd in varchar2 default null
7811 ,p_concat_segs in varchar2 default null
7812 -- end 2940151
7813 ,p_abs_historical_mode in varchar2 default 'N'
7814 ,p_gsp_eval_elig_flag in varchar2 default null -- GSP Rate Sync : Evaluate Eligibility
7815 ,p_lf_evt_oper_cd in varchar2 default null -- GSP Rate Sync : Life Event Operation code
7816 ,p_cwb_person_type in varchar2 default null
7817 )
7818 is
7819 --
7820 l_package varchar2(80);
7821 --
7822 l_effective_date date;
7823 l_lf_evt_ocrd_dt date;
7824 l_asg_events_to_all_sel_dt date;
7825 l_per_sel_dt_from date;
7826 l_per_sel_dt_to date;
7827 l_commit number;
7828 l_gsp_eval_elig_flag varchar2(30);
7829 --
7830 -- Bug:2237993 CWB
7831 --
7832 l_person_id per_all_people_f.person_id%type;
7833 cursor c_person_info is
7834 select person_id
7835 from ben_person_actions
7836 where benefit_action_id = p_benefit_action_id
7837 and action_status_cd = 'P';
7838
7839 cursor c_pln is
7840 select pl.trk_inelig_per_flag
7841 from ben_pl_f pl
7842 where pl.pl_id = p_pl_id
7843 and l_effective_date between pl.effective_start_date and
7844 pl.effective_end_date;
7845 --
7846 cursor c_popl_enrt_typ_cycl is
7847 select ler.ler_id, pet.popl_enrt_typ_cycl_id
7848 from ben_popl_enrt_typ_cycl_f pet,
7849 ben_enrt_perd enp,
7850 ben_ler_f ler
7851 where enp.business_group_id = p_business_group_id
7852 -- PB : 5422 :
7853 and enp.asnd_lf_evt_dt = l_lf_evt_ocrd_dt
7854 -- and enp.enrt_perd_id = p_popl_enrt_typ_cycl_id
7855 and enp.popl_enrt_typ_cycl_id = pet.popl_enrt_typ_cycl_id
7856 and pet.business_group_id = enp.business_group_id
7857 and l_effective_date
7858 between pet.effective_start_date
7859 and pet.effective_end_date
7860 -- CWB Changes
7861 and ((ler.typ_cd = 'SCHEDD'||pet.enrt_typ_cycl_cd and p_mode = 'C') or
7862 (ler.typ_cd = 'COMP' and p_mode = 'W')
7863 )
7864 -- CWB Changes end
7865 and ler.business_group_id = pet.business_group_id
7866 and l_effective_date
7867 between ler.effective_start_date
7868 and ler.effective_end_date
7869 -- CWB Change
7870 and ((p_mode = 'W' and ler.ler_id = enp.ler_id
7871 and pet.pl_id = p_pl_id) or p_mode <> 'W');
7872 -- 2940151
7873 -- Grade Step- cursor for fetching people group kff structure
7874 --
7875 l_popl_enrt_typ_cycl_id number ;
7876 --
7877 cursor c_people_group_structure is
7878 select people_group_structure
7879 from per_business_groups
7880 where business_group_id = p_business_group_id;
7881 --
7882 l_id_flex_num per_business_groups.people_group_structure%TYPE;
7883 --
7884 --
7885 l_ler_override_id number;
7886 l_trk_inelig_per_flag ben_pl_f.trk_inelig_per_flag%type;
7887 l_request_id number;
7888 l_object_version_number ben_benefit_actions.object_version_number%type;
7889 l_benefit_action_id ben_benefit_actions.benefit_action_id%type;
7890 l_chunk_size number;
7891 l_threads number;
7892 l_max_errors number;
7893 l_num_ranges number := 0;
7894 l_num_persons number := 0;
7895 l_person_action_id number;
7896 l_range_id number;
7897 l_ler_rec benutils.g_ler;
7898 l_retcode number;
7899 l_errbuf varchar2(1000);
7900 l_no_one_to_process exception; -- Bug 3870204
7901 -- iRec
7902 l_ler_id number;
7903 --
7904 --
7905 begin
7906 --
7907 g_debug := hr_utility.debug_enabled;
7908 l_package := g_package||'.internal_process';
7909 if g_debug then
7910 hr_utility.set_location ('Entering '||l_package,10);
7911 hr_utility.set_location ('p_mode : '||p_mode,5);
7912 end if;
7913 --
7914 g_derivable_factors := p_derivable_factors;
7915 --
7916 -- Convert varchar2 dates to real dates
7917 -- 1) First remove time component
7918 -- 2) Next convert format
7919 /*
7920 l_effective_date := to_date(p_effective_date,'YYYY/MM/DD HH24:MI:SS');
7921 l_effective_date := to_date(to_char(trunc(l_effective_date),'DD/MM/RRRR'),'DD/MM/RRRR');
7922 l_lf_evt_ocrd_dt := to_date(p_lf_evt_ocrd_dt,'YYYY/MM/DD HH24:MI:SS');
7923 l_lf_evt_ocrd_dt := to_date(to_char(trunc(l_lf_evt_ocrd_dt),'DD/MM/RRRR'),'DD/MM/RRRR');
7924 */
7925 l_effective_date := trunc(fnd_date.canonical_to_date(p_effective_date));
7926 l_lf_evt_ocrd_dt := trunc(fnd_date.canonical_to_date(p_lf_evt_ocrd_dt));
7927 --
7928 if p_asg_events_to_all_sel_dt is not null then
7929 /*
7930 l_asg_events_to_all_sel_dt := to_date(p_asg_events_to_all_sel_dt,'YYYY/MM/DD HH24:MI:SS');
7931 l_asg_events_to_all_sel_dt := to_date(to_char(trunc(l_asg_events_to_all_sel_dt),'DD/MM/RRRR'),'DD/MM/RRRR');
7932 */
7933 l_asg_events_to_all_sel_dt := trunc(fnd_date.canonical_to_date(p_asg_events_to_all_sel_dt));
7934 --
7935 end if;
7936 --
7937 if p_per_sel_dt_from is not null then
7938 --
7939 /*
7940 l_per_sel_dt_from := to_date(p_per_sel_dt_from,'YYYY/MM/DD HH24:MI:SS');
7941 l_per_sel_dt_from := to_date(to_char(trunc(l_per_sel_dt_from),'DD/MM/RRRR'),'DD/MM/RRRR');
7942 */
7943 l_per_sel_dt_from :=trunc(p_per_sel_dt_from);
7944 --
7945 end if;
7946 --
7947 if p_per_sel_dt_to is not null then
7948 --
7949 /*
7950 l_per_sel_dt_to := to_date(p_per_sel_dt_to,'YYYY/MM/DD HH24:MI:SS');
7951 l_per_sel_dt_to := to_date(to_char(trunc(l_per_sel_dt_to),'DD/MM/RRRR'),'DD/MM/RRRR');
7952 */
7953 l_per_sel_dt_to := trunc(p_per_sel_dt_to);
7954 --
7955 end if;
7956 --
7957 -- Put row in fnd_sessions
7958 --
7959 dt_fndate.change_ses_date
7960 (p_ses_date => nvl(l_lf_evt_ocrd_dt,l_effective_date),
7961 p_commit => l_commit);
7962 --
7963 -- Log start time of process
7964 --
7965 ben_manage_life_events.init_bft_statistics
7966 (p_business_group_id => p_business_group_id
7967 );
7968 -- GSP Rate Sync
7969 if p_mode = 'G' and p_gsp_eval_elig_flag is null
7970 then
7971 --
7972 if p_lf_evt_oper_cd = 'SYNC'
7973 then
7974 l_gsp_eval_elig_flag := 'N';
7975 else
7976 l_gsp_eval_elig_flag := 'Y';
7977 end if;
7978 --
7979 else
7980 --
7981 l_gsp_eval_elig_flag := p_gsp_eval_elig_flag;
7982 --
7983 end if;
7984 --
7985 --
7986 -- Check that business rules that apply to BENMNGLE are being adhered to.
7987 --
7988 check_business_rules
7989 (p_business_group_id => p_business_group_id,
7990 p_derivable_factors => p_derivable_factors,
7991 p_validate => p_validate,
7992 p_no_programs => p_no_programs,
7993 p_no_plans => p_no_plans,
7994 p_mode => p_mode,
7995 p_effective_date => l_effective_date,
7996 p_person_id => p_person_id,
7997 p_person_selection_rule_id => p_person_selection_rule_id,
7998 p_person_type_id => p_person_type_id,
7999 p_pgm_id => p_pgm_id,
8000 p_pl_id => p_pl_id,
8001 p_ler_id => p_ler_id,
8002 p_pl_typ_id => p_pl_typ_id,
8003 p_opt_id => p_opt_id,
8004 p_lf_evt_ocrd_dt => l_lf_evt_ocrd_dt,
8005 -- Grade/Step progression
8006 p_org_heirarchy_id => p_org_heirarchy_id,
8007 p_org_starting_node_id => p_org_starting_node_id,
8008 p_asg_events_to_all_sel_dt => l_asg_events_to_all_sel_dt,
8009 p_per_sel_dt_cd => p_per_sel_dt_cd,
8010 p_per_sel_dt_from => l_per_sel_dt_from,
8011 p_per_sel_dt_to => l_per_sel_dt_to,
8012 p_year_from => p_year_from,
8013 p_year_to => p_year_to,
8014 p_qual_type => p_qual_type,
8015 p_qual_status => p_qual_status,
8016 p_lf_evt_oper_cd => p_lf_evt_oper_cd /* GSP Rate Sync */
8017 );
8018
8019 -- p_popl_enrt_typ_cycl_id => p_popl_enrt_typ_cycl_id);
8020 if g_debug then
8021 hr_utility.set_location (l_package||' Check business rules',20);
8022 end if;
8023 --
8024 -- Get ler_id for Unrestricted Mode and store it in globle variable so that procedures down the road can
8025 -- access it
8026 --
8027 benutils.get_ler
8028 (p_business_group_id => p_business_group_id,
8029 p_typ_cd => 'SCHEDDU',
8030 p_effective_date => l_effective_date,
8031 p_rec => l_ler_rec);
8032 --
8033 g_ler_id := l_ler_rec.ler_id;
8034 --
8035 -- iRec
8036 if p_mode = 'I' then
8037 --
8038 -- Set G_LER_ID to iRecruitment LER_ID for subsequent use in ben_evaluate_ptnl_lf_evt
8039 --
8040 benutils.get_ler (p_business_group_id => p_business_group_id,
8041 p_typ_cd => 'IREC',
8042 p_effective_date => l_effective_date,
8043 p_rec => l_ler_rec
8044 );
8045 --
8046 g_ler_id := l_ler_rec.ler_id;
8047 --
8048 end if;
8049 -- iRec
8050 --
8051 -- Get override ler_id for Scheduled mode.
8052 --
8053 -- CWB Changes
8054 --
8055 if p_mode in ('C', 'W') and
8056 p_lf_evt_ocrd_dt is not null then
8057 -- PB : 5422 :
8058 -- p_popl_enrt_typ_cycl_id is not null then
8059 --
8060 open c_popl_enrt_typ_cycl;
8061 --
8062 fetch c_popl_enrt_typ_cycl into l_ler_override_id, l_popl_enrt_typ_cycl_id;
8063 if c_popl_enrt_typ_cycl%notfound then
8064 --
8065 close c_popl_enrt_typ_cycl;
8066 fnd_message.set_name('BEN','BEN_91668_NO_FIND_POPL_ENRT');
8067 fnd_message.raise_error;
8068 --
8069 end if;
8070 --
8071 close c_popl_enrt_typ_cycl;
8072
8073 if g_debug then
8074 hr_utility.set_location (l_popl_enrt_typ_cycl_id || ' Done c_popl_enrt_typ_cycl ',30);
8075 hr_utility.set_location (p_popl_enrt_typ_cycl_id || ' Done c_popl_enrt_typ_cycl ',30);
8076 end if;
8077 --
8078 end if;
8079 --
8080 -- Get ler id for unrestricted
8081 --
8082 if p_mode in ('U','D') then
8083 --
8084 benutils.get_ler
8085 (p_business_group_id => p_business_group_id,
8086 p_typ_cd => 'SCHEDDU',
8087 p_effective_date => l_effective_date,
8088 p_rec => l_ler_rec);
8089 --
8090 l_ler_override_id := l_ler_rec.ler_id;
8091 --
8092 if g_debug then
8093 hr_utility.set_location (l_package||' benutils.get_ler ',30);
8094 end if;
8095 --
8096 end if;
8097 /*
8098 --
8099 -- Get ler id for Grade/Step
8100 --
8101 if p_mode = 'G' then
8102 --
8103 benutils.get_ler
8104 (p_business_group_id => p_business_group_id,
8105 p_typ_cd => 'GSP',
8106 p_effective_date => l_effective_date,
8107 p_rec => l_ler_rec);
8108 --
8109 l_ler_override_id := l_ler_rec.ler_id;
8110 --
8111 if g_debug then
8112 hr_utility.set_location (l_package||' benutils.get_ler ',31);
8113 end if;
8114 end if;
8115 */
8116 --
8117 -- Get parameters so we know how many slaves to start and what size the
8118 -- chunk size we will be processing is.
8119 --
8120 if g_debug then
8121 hr_utility.set_location (l_package||' get_parameter',20);
8122 end if;
8123 /* Start: CWB Thread Num Enhancement */
8124 if(p_mode = 'W') then
8125 benutils.get_parameter(p_business_group_id => p_business_group_id,
8126 p_batch_exe_cd => 'BENGCMOD',
8127 p_threads => l_threads,
8128 p_chunk_size => l_chunk_size,
8129 p_max_errors => l_max_errors);
8130 else
8131 benutils.get_parameter(p_business_group_id => p_business_group_id,
8132 p_batch_exe_cd => 'BENMNGLE',
8133 p_threads => l_threads,
8134 p_chunk_size => l_chunk_size,
8135 p_max_errors => l_max_errors);
8136 end if;
8137 /* End: CWB Thread Num Enhancement */
8138 if g_debug then
8139 hr_utility.set_location (l_package||' Done get pm ',30);
8140 --
8141 hr_utility.set_location('Num Threads = '||l_threads,10);
8142 hr_utility.set_location('Chunk Size = '||l_chunk_size,10);
8143 hr_utility.set_location('Max Errors = '||l_max_errors,10);
8144 --
8145 end if;
8146 --
8147 benutils.g_benefit_action_id := l_benefit_action_id; -- Bug 3870204
8148 --
8149 -- Create benefit actions parameters in the benefit action table.
8150 -- Do not create if a benefit action already exists, in other words
8151 -- we are doing a restart.
8152 --
8153 if p_benefit_action_id is null then
8154 --
8155 if g_debug then
8156 hr_utility.set_location (l_package||' Create BFT ',30);
8157 end if;
8158 --
8159 --
8160 ben_benefit_actions_api.create_perf_benefit_actions
8161 (p_validate => false,
8162 p_benefit_action_id => l_benefit_action_id,
8163 p_process_date => l_effective_date,
8164 p_mode_cd => p_mode,
8165 p_derivable_factors_flag => p_derivable_factors,
8166 p_validate_flag => p_validate,
8167 p_person_id => p_person_id,
8168 p_person_type_id => p_person_type_id,
8169 p_pgm_id => p_pgm_id,
8170 p_business_group_id => p_business_group_id,
8171 p_pl_id => p_pl_id,
8172 -- PB : 5422 :
8173 -- No longer needed.
8174 -- p_popl_enrt_typ_cycl_id => p_popl_enrt_typ_cycl_id,
8175 p_no_programs_flag => p_no_programs,
8176 p_no_plans_flag => p_no_plans,
8177 p_comp_selection_rl => p_comp_selection_rule_id,
8178 p_person_selection_rl => p_person_selection_rule_id,
8179 p_ler_id => p_ler_id,
8180 p_organization_id => p_organization_id,
8181 p_benfts_grp_id => p_benfts_grp_id,
8182 p_location_id => p_location_id,
8183 p_pstl_zip_rng_id => p_pstl_zip_rng_id,
8184 p_rptg_grp_id => p_rptg_grp_id,
8185 p_pl_typ_id => p_pl_typ_id,
8186 p_opt_id => p_opt_id,
8187 p_eligy_prfl_id => p_eligy_prfl_id,
8188 p_vrbl_rt_prfl_id => p_vrbl_rt_prfl_id,
8189 p_legal_entity_id => p_legal_entity_id,
8190 p_payroll_id => p_payroll_id,
8191 p_debug_messages_flag => p_cbr_tmprl_evt_flag,
8192 p_audit_log_flag => p_audit_log_flag,
8193 --
8194 -- PB : Healthnet change : Limit comp object selection
8195 -- based on the org id.
8196 --
8197 p_lmt_prpnip_by_org_flag => p_lmt_prpnip_by_org_flag,
8198 --
8199 -- GRADE/STEP : Reuse date_from to store l_asg_events_to_all_sel_dt
8200 -- Later add this column to bft table use proper column
8201 -- We may need to add other grade/step paramters to this table
8202 -- for now just reuse.
8203 --
8204 p_date_from => l_asg_events_to_all_sel_dt,
8205 p_request_id => fnd_global.conc_request_id,
8206 p_program_application_id => fnd_global.prog_appl_id,
8207 p_program_id => fnd_global.conc_program_id,
8208 p_program_update_date => sysdate,
8209 p_object_version_number => l_object_version_number,
8210 p_lf_evt_ocrd_dt => l_lf_evt_ocrd_dt,
8211 p_inelg_action_cd => p_abs_historical_mode,
8212 p_effective_date => l_effective_date,
8213 -- 2940151
8214 p_org_hierarchy_id => p_org_heirarchy_id, -- note the spelling for hierarchy
8215 p_org_starting_node_id => p_org_starting_node_id,
8216 p_grade_ladder_id => p_grade_ladder_id,
8217 p_asg_events_to_all_sel_dt => p_asg_events_to_all_sel_dt,
8218 p_rate_id => p_rate_id,
8219 p_per_sel_dt_cd => p_per_sel_dt_cd,
8220 p_per_sel_dt_from => p_per_sel_dt_from,
8221 p_per_sel_dt_to => p_per_sel_dt_to,
8222 p_year_from => p_year_from,
8223 p_year_to => p_year_to,
8224 p_cagr_id => p_cagr_id,
8225 p_qual_type => p_qual_type,
8226 p_qual_status => p_qual_status,
8227 p_per_sel_freq_cd => p_per_sel_freq_cd ,
8228 p_concat_segs => p_concat_segs
8229 -- end 2940151
8230 );
8231 --
8232 benutils.g_benefit_action_id := l_benefit_action_id; -- Bug 3870204
8233 --
8234 if g_debug then
8235 hr_utility.set_location (l_package||' Dn Create BFT ',20);
8236 end if;
8237 -- Bug 8431552: initialize the benmngle mode
8238 ben_env_object.setenv(p_mode);
8239 --
8240 -- This must be committed to the database
8241 --
8242 if p_commit_data = 'Y' then
8243 --
8244 commit;
8245 --
8246 end if;
8247 --
8248 -- Now lets create person actions for all the people we are going to
8249 -- process in the BENMNGLE run.
8250 --
8251 -- ABSENCES mode M added. Added GRADE/STEP mode
8252 --
8253 if p_mode in ('L','M', 'G', 'I', 'A') then
8254 --
8255 -- iRec
8256 if p_mode = 'I' then
8257 --
8258 l_ler_id := g_ler_id;
8259 --
8260 else
8261 --
8262 l_ler_id := p_ler_id;
8263 --
8264 end if;
8265 --
8266
8267 -- 2940151
8268 -- get the people group kff structure and pass it
8269
8270 open c_people_group_structure;
8271 fetch c_people_group_structure into l_id_flex_num;
8272 close c_people_group_structure;
8273
8274 if g_debug then
8275 hr_utility.set_location (l_package||' Create L PER ACTs ',20);
8276 hr_utility.set_location ('p_mode : '||p_mode,6);
8277 end if;
8278 ben_benbatch_persons.create_life_person_actions
8279 (p_benefit_action_id => l_benefit_action_id,
8280 p_business_group_id => p_business_group_id,
8281 p_person_id => p_person_id,
8282 p_ler_id => nvl(l_ler_id,l_ler_override_id), -- irec
8283 p_person_type_id => p_person_type_id,
8284 p_benfts_grp_id => p_benfts_grp_id,
8285 p_location_id => p_location_id,
8286 p_legal_entity_id => p_legal_entity_id,
8287 p_payroll_id => p_payroll_id,
8288 p_pstl_zip_rng_id => p_pstl_zip_rng_id,
8289 p_organization_id => p_organization_id,
8290 p_person_selection_rule_id => p_person_selection_rule_id,
8291 -- GRADE/STEP
8292 p_org_heirarchy_id => p_org_heirarchy_id,
8293 p_org_starting_node_id => p_org_starting_node_id,
8294 p_grade_ladder_id => p_grade_ladder_id,
8295 p_asg_events_to_all_sel_dt => l_asg_events_to_all_sel_dt,
8296 p_rate_id => p_rate_id,
8297 p_per_sel_dt_cd => p_per_sel_dt_cd,
8298 p_per_sel_dt_from => l_per_sel_dt_from,
8299 p_per_sel_dt_to => l_per_sel_dt_to,
8300 p_year_from => p_year_from,
8301 p_year_to => p_year_to,
8302 p_cagr_id => p_cagr_id,
8303 p_qual_type => p_qual_type,
8304 p_qual_status => p_qual_status,
8305 -- 2940151
8306 p_per_sel_freq_cd =>p_per_sel_freq_cd,
8307 p_id_flex_num =>l_id_flex_num,
8308 p_concat_segs =>p_concat_segs,
8309 -- end 2940151
8310 -- End GRADE/STEP
8311 p_effective_date => l_effective_date,
8312 p_chunk_size => l_chunk_size,
8313 p_threads => l_threads,
8314 p_num_ranges => l_num_ranges,
8315 p_num_persons => l_num_persons,
8316 --
8317 -- PB : Healthnet change : Limit comp object selection
8318 -- based on the org id.
8319 --
8320 p_lmt_prpnip_by_org_flag => p_lmt_prpnip_by_org_flag,
8321 p_commit_data => p_commit_data,
8322 -- ABSENCES : p_mode added
8323 p_mode => p_mode,
8324 p_lf_evt_oper_cd => p_lf_evt_oper_cd /* GSP Rate Sync */
8325 );
8326
8327 if g_debug then
8328 hr_utility.set_location (l_package||' Dn Create L PER ACTs ',20);
8329 end if;
8330 --
8331 elsif p_mode in ('U','D') then
8332 --
8333 benutils.get_ler
8334 (p_business_group_id => p_business_group_id,
8335 p_typ_cd => 'SCHEDDU',
8336 p_effective_date => l_effective_date,
8337 p_rec => l_ler_rec);
8338 --
8339 -- A bit of a hack to force the creation of a person action as we
8340 -- don't have a potential life event at this point and we want to be
8341 -- able to safely roll the person back should an error occur.
8342 --
8343 ben_person_actions_api.create_person_actions
8344 (p_validate => false,
8345 p_person_action_id => l_person_action_id,
8346 p_person_id => p_person_id,
8347 p_ler_id => l_ler_rec.ler_id,
8348 p_benefit_action_id => l_benefit_action_id,
8349 p_action_status_cd => 'U',
8350 p_chunk_number => 1,
8351 p_object_version_number => l_object_version_number,
8352 p_effective_date => l_effective_date);
8353 --
8354 ben_batch_ranges_api.create_batch_ranges
8355 (p_validate => false,
8356 p_benefit_action_id => l_benefit_action_id,
8357 p_range_id => l_range_id,
8358 p_range_status_cd => 'U',
8359 p_starting_person_action_id => l_person_action_id,
8360 p_ending_person_action_id => l_person_action_id,
8361 p_object_version_number => l_object_version_number,
8362 p_effective_date => l_effective_date);
8363 --
8364 l_num_ranges := 1;
8365 l_num_persons := 1;
8366 --
8367 else
8368 --
8369 ben_benbatch_persons.create_normal_person_actions
8370 (p_benefit_action_id => l_benefit_action_id
8371 --
8372 ,p_mode_cd => p_mode
8373 --
8374 ,p_business_group_id => p_business_group_id
8375 ,p_person_id => p_person_id
8376 ,p_ler_id => p_ler_id
8377 ,p_person_type_id => p_person_type_id
8378 ,p_benfts_grp_id => p_benfts_grp_id
8379 ,p_location_id => p_location_id
8380 ,p_legal_entity_id => p_legal_entity_id
8381 ,p_payroll_id => p_payroll_id
8382 ,p_pstl_zip_rng_id => p_pstl_zip_rng_id
8383 ,p_organization_id => p_organization_id
8384 ,p_ler_override_id => l_ler_override_id
8385 ,p_person_selection_rule_id => p_person_selection_rule_id
8386 --
8387 -- PB : Healthnet Change
8388 -- Pass the l_lf_evt_ocrd_dt for scheduled mode
8389 -- Bug#2638681 - Healthnet change reversed
8390 --,p_effective_date => nvl(l_lf_evt_ocrd_dt, l_effective_date)
8391 ,p_effective_date => l_effective_date
8392 ,p_lmt_prpnip_by_org_flag => p_lmt_prpnip_by_org_flag
8393 ,p_mode => p_mode
8394 ,p_chunk_size => l_chunk_size
8395 ,p_threads => l_threads
8396 ,p_num_ranges => l_num_ranges
8397 ,p_num_persons => l_num_persons
8398 ,p_commit_data => p_commit_data
8399 ,p_popl_enrt_typ_cycl_id => l_popl_enrt_typ_cycl_id
8400 ,p_cwb_person_type => p_cwb_person_type
8401 ,p_lf_evt_ocrd_dt => l_lf_evt_ocrd_dt
8402 );
8403 --
8404 end if;
8405 --
8406 else
8407 --
8408 ben_benbatch_persons.create_restart_person_actions
8409 (p_benefit_action_id => p_benefit_action_id,
8410 p_effective_date => l_effective_date,
8411 p_chunk_size => l_chunk_size,
8412 p_threads => l_threads,
8413 p_num_ranges => l_num_ranges,
8414 p_num_persons => l_num_persons,
8415 p_commit_data => p_commit_data);
8416 --
8417 l_benefit_action_id := p_benefit_action_id;
8418 --
8419 end if;
8420 if g_debug then
8421 hr_utility.set_location (l_package,30);
8422 end if;
8423 --
8424 if l_num_ranges = 0 then
8425 --
8426 if nvl(p_mode, 'X') <> 'W' then
8427 fnd_message.set_name('BEN','BEN_91769_NOONE_TO_PROCESS');
8428 -- Bug 3870204 : If no persons are selected then, dont error out, but just write the message
8429 -- in Audit Log and finish the process with Status = Normal
8430 -- fnd_message.raise_error;
8431 fnd_message.set_token('PROC' , l_package);
8432 raise l_no_one_to_process;
8433 end if;
8434 --
8435 end if;
8436 --
8437
8438 -- No point in starting of ten threads if there is only one range of data.
8439 --
8440 -- Only run this if we are using concurrent manager and not doing WHAT IF
8441 -- Functionality
8442 --
8443
8444 if p_commit_data = 'Y' then
8445 --
8446 if g_debug then
8447 hr_utility.set_location ('Threads = '||l_threads,10);
8448 hr_utility.set_location ('Ranges = '||l_num_ranges,10);
8449 end if;
8450 --
8451 -- Set l_threads = l_threads - 1 as the master becomes a thread
8452 --
8453 commit;
8454 --
8455 l_threads := least(l_threads,l_num_ranges)-1;
8456 --
8457 ben_maintain_benefit_actions.start_slaves
8458 (p_threads => l_threads
8459 ,p_num_ranges => l_num_ranges
8460 ,p_validate => p_validate
8461 ,p_benefit_action_id => l_benefit_action_id
8462 ,p_effective_date => p_effective_date
8463 ,p_pgm_id => p_pgm_id
8464 ,p_business_group_id => p_business_group_id
8465 ,p_pl_id => p_pl_id
8466 ,p_no_programs => p_no_programs
8467 ,p_no_plans => p_no_plans
8468 ,p_rptg_grp_id => p_rptg_grp_id
8469 ,p_pl_typ_id => p_pl_typ_id
8470 ,p_opt_id => p_opt_id
8471 ,p_eligy_prfl_id => p_eligy_prfl_id
8472 ,p_vrbl_rt_prfl_id => p_vrbl_rt_prfl_id
8473 ,p_mode => p_mode
8474 ,p_person_selection_rule_id => p_person_selection_rule_id
8475 ,p_comp_selection_rule_id => p_comp_selection_rule_id
8476 ,p_derivable_factors => p_derivable_factors
8477 ,p_cbr_tmprl_evt_flag => p_cbr_tmprl_evt_flag
8478 ,p_lmt_prpnip_by_org_flag => p_lmt_prpnip_by_org_flag
8479 ,p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt
8480 ,p_gsp_eval_elig_flag => l_gsp_eval_elig_flag /* GSP Rate Sync */
8481 ,p_lf_evt_oper_cd => p_lf_evt_oper_cd /* GSP Rate Sync */
8482 );
8483 --
8484 -- Always carry on with the master but make the master act as a slave
8485 -- as well. Only this thread can see the cache structure that we use to
8486 -- store the concurrent request id's. This ensures that the master thread
8487 -- always finishes last. GOOD THREADS ALWAYS FINISH LAST.
8488 --
8489 do_multithread
8490 (errbuf => l_errbuf,
8491 retcode => l_retcode,
8492 p_validate => p_validate,
8493 p_benefit_action_id => l_benefit_action_id,
8494 p_effective_date => p_effective_date,
8495 p_pgm_id => p_pgm_id,
8496 p_business_group_id => p_business_group_id,
8497 p_pl_id => p_pl_id,
8498 -- PB : 5422 :
8499 p_popl_enrt_typ_cycl_id => p_popl_enrt_typ_cycl_id,
8500 p_no_programs => p_no_programs,
8501 p_no_plans => p_no_plans,
8502 p_rptg_grp_id => p_rptg_grp_id,
8503 p_pl_typ_id => p_pl_typ_id,
8504 p_opt_id => p_opt_id,
8505 p_eligy_prfl_id => p_eligy_prfl_id,
8506 p_vrbl_rt_prfl_id => p_vrbl_rt_prfl_id,
8507 p_mode => p_mode,
8508 p_person_selection_rule_id => p_person_selection_rule_id,
8509 p_comp_selection_rule_id => p_comp_selection_rule_id,
8510 p_derivable_factors => p_derivable_factors,
8511 p_thread_id => l_threads+1,
8512 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
8513 p_lmt_prpnip_by_org_flag => p_lmt_prpnip_by_org_flag,
8514 p_cbr_tmprl_evt_flag => p_cbr_tmprl_evt_flag,
8515 p_gsp_eval_elig_flag => l_gsp_eval_elig_flag, /* GSP Rate Sync */
8516 p_lf_evt_oper_cd => p_lf_evt_oper_cd /* GSP Rate Sync */
8517 );
8518 --
8519 end if;
8520 --
8521 -- Prasad special case
8522 --
8523 benutils.g_benefit_action_id := l_benefit_action_id;
8524 p_benefit_action_id := l_benefit_action_id;
8525 --
8526 /* GLOBALCWB : The issue of track ineligible flag have to be addressed
8527 later after drop 3, currently it has no meaning
8528 -- CWB Changes.
8529 -- Populate the heirarchy table.
8530 --
8531 if p_mode = 'W' then
8532 --
8533 open c_pln;
8534 fetch c_pln into l_trk_inelig_per_flag;
8535 close c_pln;
8536
8537 if nvl(l_trk_inelig_per_flag,'N') = 'N' then
8538 for l_person_rec in c_person_info
8539 loop
8540 --
8541 del_cwb_pil
8542 (l_person_rec.person_id,
8543 p_pl_id,
8544 l_effective_date,
8545 l_ler_override_id,
8546 l_lf_evt_ocrd_dt);
8547 --
8548 end loop;
8549 end if;
8550
8551 -- Bug 2237993 CWB fix: moved popu_cross_gb_epe_data call form
8552 -- process_rows to internal_process to avoid creating duplicate records
8553 -- for the cross business group.
8554 --
8555 for l_per_rec in c_person_info loop
8556 --
8557 --popu_cross_gb_epe_data(
8558 -- p_mode => p_mode,
8559 -- p_person_id => l_per_rec.person_id,
8560 -- p_business_group_id => p_business_group_id,
8561 -- p_ler_id => l_ler_override_id,
8562 -- p_pl_id => null, -- Currently not used by proc
8563 -- p_effective_date => l_effective_date,
8564 -- p_lf_evt_ocrd_dt => l_lf_evt_ocrd_dt
8565 -- );
8566 --
8567 popu_cross_gb_epe_pel_data(
8568 p_mode => p_mode,
8569 p_person_id => l_per_rec.person_id,
8570 p_business_group_id => p_business_group_id,
8571 p_ler_id => l_ler_override_id,
8572 p_pl_id => null, -- Currently not used by proc
8573 p_effective_date => l_effective_date,
8574 p_lf_evt_ocrd_dt => l_lf_evt_ocrd_dt
8575 );
8576 --
8577 end loop;
8578 --
8579 --CWBITEM
8580 --popu_epe_heir();
8581 --CWBITEM
8582 popu_pel_heir();
8583 --
8584 end if;
8585 */
8586 --
8587 if p_commit_data = 'Y' then
8588 --
8589 commit;
8590 --
8591 end if;
8592 --
8593 if g_debug then
8594 hr_utility.set_location ('Leaving '||l_package,10);
8595 end if;
8596 --
8597 exception
8598 -- Bug 3870204
8599 when l_no_one_to_process then
8600 benutils.write(p_text => fnd_message.get);
8601 benutils.write_table_and_file(p_table => TRUE, p_file => TRUE);
8602 rollback;
8603 end internal_process;
8604 --
8605 procedure process
8606 (errbuf out nocopy varchar2
8607 ,retcode out nocopy number
8608 ,p_benefit_action_id in number
8609 ,p_effective_date in varchar2
8610 ,p_mode in varchar2
8611 ,p_derivable_factors in varchar2 default 'ASC'
8612 ,p_validate in varchar2 default 'N'
8613 ,p_person_id in number default null
8614 ,p_person_type_id in number default null
8615 ,p_pgm_id in number default null
8616 ,p_business_group_id in number
8617 ,p_pl_id in number default null
8618 ,p_popl_enrt_typ_cycl_id in number default null
8619 ,p_lf_evt_ocrd_dt in varchar2 default null
8620 ,p_no_programs in varchar2 default 'N'
8621 ,p_no_plans in varchar2 default 'N'
8622 ,p_comp_selection_rule_id in number default null
8623 ,p_person_selection_rule_id in number default null
8624 ,p_ler_id in number default null
8625 ,p_organization_id in number default null
8626 ,p_benfts_grp_id in number default null
8627 ,p_location_id in number default null
8628 ,p_pstl_zip_rng_id in number default null
8629 ,p_rptg_grp_id in number default null
8630 ,p_pl_typ_id in number default null
8631 ,p_opt_id in number default null
8632 ,p_eligy_prfl_id in number default null
8633 ,p_vrbl_rt_prfl_id in number default null
8634 ,p_legal_entity_id in number default null
8635 ,p_payroll_id in number default null
8636 ,p_commit_data in varchar2 default 'Y'
8637 ,p_audit_log_flag in varchar2 default 'N'
8638 ,p_lmt_prpnip_by_org_flag in varchar2 default 'N'
8639 ,p_cbr_tmprl_evt_flag in varchar2 default 'N'
8640 -- GRADE/STEP : Added for grade/step benmngle
8641 ,p_org_heirarchy_id in number default null
8642 ,p_org_starting_node_id in number default null
8643 ,p_grade_ladder_id in number default null
8644 ,p_asg_events_to_all_sel_dt in varchar2 default null
8645 ,p_rate_id in number default null -- pay scale
8646 ,p_per_sel_dt_cd in varchar2 default null -- business rule
8647 ,p_per_sel_dt_from in date default null -- business rule date from
8648 ,p_per_sel_dt_to in date default null -- business rule date to
8649 ,p_year_from in number default null -- business rule year from
8650 ,p_year_to in number default null -- business rule year to
8651 ,p_cagr_id in number default null -- Coll agreement id
8652 ,p_qual_type in number default null
8653 ,p_qual_status in varchar2 default null
8654 -- 2940151
8655 ,p_per_sel_freq_cd in varchar2 default null
8656 ,p_concat_segs in varchar2 default null
8657 -- end 2940151
8658 ,p_abs_historical_mode in varchar2 default 'N'
8659 ,p_gsp_eval_elig_flag in varchar2 default null -- GSP Rate Sync : Evaluate Eligibility
8660 ,p_lf_evt_oper_cd in varchar2 default null -- GSP Rate Sync : Life Event Operation code
8661 ,p_cwb_person_type in varchar2 default null)
8662 is
8663 --
8664 l_package varchar2(80);
8665 --
8666 l_bft_id number;
8667 --
8668 begin
8669 --
8670 g_debug := hr_utility.debug_enabled;
8671 if g_debug then
8672 l_package := g_package||'.process';
8673 hr_utility.set_location ('Entering '||l_package,10);
8674 end if;
8675 --
8676 l_bft_id := p_benefit_action_id;
8677 --
8678 if g_debug then
8679 hr_utility.set_location ('p_mode : '||p_mode,4);
8680 end if;
8681 -- Bug 5857493
8682 if p_audit_log_flag ='Y' then
8683 ben_benbatch_persons.g_audit_flag := true;
8684 else
8685 ben_benbatch_persons.g_audit_flag := false;
8686 end if;
8687 internal_process
8688 (errbuf => errbuf
8689 ,retcode => retcode
8690 ,p_benefit_action_id => l_bft_id
8691 ,p_effective_date => p_effective_date
8692 ,p_mode => p_mode
8693 ,p_derivable_factors => p_derivable_factors
8694 ,p_validate => p_validate
8695 ,p_person_id => p_person_id
8696 ,p_person_type_id => p_person_type_id
8697 ,p_pgm_id => p_pgm_id
8698 ,p_business_group_id => p_business_group_id
8699 ,p_pl_id => p_pl_id
8700 ,p_popl_enrt_typ_cycl_id => p_popl_enrt_typ_cycl_id
8701 ,p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt
8702 ,p_no_programs => p_no_programs
8703 ,p_no_plans => p_no_plans
8704 ,p_comp_selection_rule_id => p_comp_selection_rule_id
8705 ,p_person_selection_rule_id => p_person_selection_rule_id
8706 ,p_ler_id => p_ler_id
8707 ,p_organization_id => p_organization_id
8708 ,p_benfts_grp_id => p_benfts_grp_id
8709 ,p_location_id => p_location_id
8710 ,p_pstl_zip_rng_id => p_pstl_zip_rng_id
8711 ,p_rptg_grp_id => p_rptg_grp_id
8712 ,p_pl_typ_id => p_pl_typ_id
8713 ,p_opt_id => p_opt_id
8714 ,p_eligy_prfl_id => p_eligy_prfl_id
8715 ,p_vrbl_rt_prfl_id => p_vrbl_rt_prfl_id
8716 ,p_legal_entity_id => p_legal_entity_id
8717 ,p_payroll_id => p_payroll_id
8718 ,p_commit_data => p_commit_data
8719 ,p_audit_log_flag => p_audit_log_flag
8720 ,p_lmt_prpnip_by_org_flag => p_lmt_prpnip_by_org_flag
8721 ,p_cbr_tmprl_evt_flag => p_cbr_tmprl_evt_flag
8722 -- GRADE/STEP : Added for grade/step benmngle
8723 ,p_org_heirarchy_id => p_org_heirarchy_id
8724 ,p_org_starting_node_id => p_org_starting_node_id
8725 ,p_grade_ladder_id => p_grade_ladder_id
8726 ,p_asg_events_to_all_sel_dt => p_asg_events_to_all_sel_dt
8727 ,p_rate_id => p_rate_id
8728 ,p_per_sel_dt_cd => p_per_sel_dt_cd
8729 ,p_per_sel_dt_from => p_per_sel_dt_from
8730 ,p_per_sel_dt_to => p_per_sel_dt_to
8731 ,p_year_from => p_year_from
8732 ,p_year_to => p_year_to
8733 ,p_cagr_id => p_cagr_id
8734 ,p_qual_type => p_qual_type
8735 ,p_qual_status => p_qual_status
8736 ,p_abs_historical_mode => p_abs_historical_mode
8737 -- 2940151
8738 ,p_per_sel_freq_cd => p_per_sel_freq_cd
8739 ,p_concat_segs => p_concat_segs
8740 -- end 2940151
8741 ,p_gsp_eval_elig_flag => p_gsp_eval_elig_flag -- GSP Rate Sync : Evaluate Eligibility
8742 ,p_lf_evt_oper_cd => p_lf_evt_oper_cd -- GSP Rate Sync : Life Event Operation code
8743 ,p_cwb_person_type => p_cwb_person_type);
8744 --
8745 if g_debug then
8746 hr_utility.set_location ('Leaving '||l_package,10);
8747 end if;
8748 --
8749 end process;
8750 --
8751 -- This procedure caches comp object names which can be referenced by
8752 -- all other batch processes
8753 --
8754 procedure get_comp_object_name
8755 (p_oipl_id in number
8756 ,p_pgm_id in number
8757 ,p_pl_id in number
8758 ,p_plip_id in number
8759 ,p_ptip_id in number
8760 ,p_pl_nip in varchar2
8761 ,p_comp_object_name out nocopy varchar2
8762 ,p_comp_object_value out nocopy varchar2
8763 )
8764 is
8765 --
8766 l_package varchar2(80);
8767 l_comp_object_name varchar2(80);
8768 l_pgm_rec ben_pgm_f%rowtype;
8769 l_pl_rec ben_pl_f%rowtype;
8770 l_oipl_rec ben_oipl_f%rowtype;
8771 l_opt_rec ben_opt_f%rowtype;
8772 l_plip_rec ben_plip_f%rowtype;
8773 l_ptip_rec ben_ptip_f%rowtype;
8774 --
8775 begin
8776 --
8777 if g_debug then
8778 l_package := g_package||'.get_comp_object_name';
8779 hr_utility.set_location ('Entering '||l_package,10);
8780 end if;
8781 --
8782 if p_oipl_id is not null then
8783 --
8784 p_comp_object_value := g_cache_comp_objects.oipl;
8785 --
8786 ben_comp_object.get_object(p_rec => l_oipl_rec,
8787 p_oipl_id => p_oipl_id);
8788 ben_comp_object.get_object(p_rec => l_opt_rec,
8789 p_opt_id => l_oipl_rec.opt_id);
8790 p_comp_object_name := rpad(substr(l_opt_rec.name,1,18),18,' ')||
8791 benutils.id(p_oipl_id);
8792 --
8793 elsif p_pl_id is not null then
8794 --
8795 -- Test if plan is in program or not
8796 --
8797 if p_pl_nip = 'Y' then
8798 --
8799 p_comp_object_value := g_cache_comp_objects.pl;
8800 --
8801 else
8802 --
8803 p_comp_object_value := g_cache_comp_objects.plip;
8804 --
8805 end if;
8806 --
8807 ben_comp_object.get_object(p_rec => l_pl_rec,
8808 p_pl_id => p_pl_id);
8809 p_comp_object_name := rpad(substr(l_pl_rec.name,1,18),18,' ')||
8810 benutils.id(p_pl_id);
8811 --
8812 elsif p_pgm_id is not null then
8813 --
8814 p_comp_object_value := g_cache_comp_objects.pgm;
8815 --
8816 ben_comp_object.get_object(p_rec => l_pgm_rec,
8817 p_pgm_id => p_pgm_id);
8818 p_comp_object_name := rpad(substr(l_pgm_rec.name,1,18),18,' ')||
8819 benutils.id(p_pgm_id);
8820 --
8821 elsif p_plip_id is not null then
8822 --
8823 p_comp_object_value := g_cache_comp_objects.plip;
8824 --
8825 p_comp_object_name := rpad('Plip',15,' ')||
8826 benutils.id(p_plip_id);
8827 --
8828 elsif p_ptip_id is not null then
8829 --
8830 p_comp_object_value := g_cache_comp_objects.ptip;
8831 --
8832 p_comp_object_name := rpad('Ptip',15,' ')||
8833 benutils.id(p_ptip_id);
8834 --
8835 end if;
8836 --
8837 if g_debug then
8838 hr_utility.set_location ('Leaving '||l_package,10);
8839 end if;
8840 --
8841 end get_comp_object_name;
8842 --
8843 procedure cache_person_information
8844 (p_person_id in number,
8845 p_business_group_id in number,
8846 p_effective_date in date) is
8847 --
8848 cursor c_person_prtn is
8849 select pen.pl_id,
8850 pen.oipl_id,
8851 pen.pgm_id,
8852 pen.ptip_id,
8853 pen.enrt_cvg_strt_dt,
8854 pen.enrt_cvg_thru_dt
8855 from ben_prtt_enrt_rslt_f pen
8856 where pen.person_id = p_person_id
8857 and pen.business_group_id = p_business_group_id
8858 and p_effective_date
8859 between pen.enrt_cvg_strt_dt
8860 and pen.enrt_cvg_thru_dt
8861 and pen.enrt_cvg_thru_dt <= pen.effective_end_date
8862 and pen.prtt_enrt_rslt_stat_cd is null
8863 and pen.sspndd_flag = 'N';
8864 --
8865 l_package varchar2(80);
8866 l_count number(9) := 0;
8867 l_person_prtn c_person_prtn%rowtype;
8868 --
8869 begin
8870 --
8871 g_debug := hr_utility.debug_enabled;
8872 if g_debug then
8873 l_package := g_package||'.cache_person_information';
8874 hr_utility.set_location ('Entering '||l_package,10);
8875 hr_utility.set_location ('Entering '||p_effective_date,10);
8876 end if;
8877 --
8878 -- Open cursor to see if the person holds emp person type status
8879 --
8880 g_cache_person_prtn.delete;
8881 --
8882 l_count := 0;
8883 --
8884 open c_person_prtn;
8885 --
8886 loop
8887 --
8888 fetch c_person_prtn into l_person_prtn;
8889 exit when c_person_prtn%notfound;
8890 l_count := l_count + 1;
8891 --
8892 g_cache_person_prtn(l_count).pl_id
8893 := l_person_prtn.pl_id;
8894 g_cache_person_prtn(l_count).oipl_id
8895 := l_person_prtn.oipl_id;
8896 g_cache_person_prtn(l_count).pgm_id
8897 := l_person_prtn.pgm_id;
8898 g_cache_person_prtn(l_count).ptip_id
8899 := l_person_prtn.ptip_id;
8900 g_cache_person_prtn(l_count).enrt_cvg_strt_dt
8901 := l_person_prtn.enrt_cvg_strt_dt;
8902 g_cache_person_prtn(l_count).enrt_cvg_thru_dt
8903 := l_person_prtn.enrt_cvg_thru_dt;
8904 --
8905 end loop;
8906 --
8907 close c_person_prtn;
8908
8909 if g_debug then
8910 hr_utility.set_location ('Done c_person_prtn '||l_package,40);
8911 end if;
8912 --
8913 -- We need to do the assignment stuff seperately as we can't outer join
8914 -- as we need assignments with primary flags and applicants have non
8915 -- primary flag assignments so the hack is to do the select in two
8916 -- statements, although a fix could be to do a union to get the value
8917 -- for the assignment id.
8918 --
8919 if g_debug then
8920 hr_utility.set_location ('Leaving '||l_package,100);
8921 end if;
8922 --
8923 end cache_person_information;
8924 -- ---------------------------------------------------------------------
8925 procedure person_header
8926 (p_person_id in number default null,
8927 p_business_group_id in number,
8928 p_effective_date in date) is
8929 --
8930 l_package varchar2(80);
8931 l_output_string nvarchar2(100);
8932 l_per_rec per_all_people_f%rowtype;
8933 l_ass_rec per_all_assignments_f%rowtype;
8934 l_bus_rec per_business_groups%rowtype;
8935 l_org_rec hr_all_organization_units%rowtype;
8936 l_org2_rec hr_all_organization_units%rowtype;
8937 l_pad_rec per_addresses%rowtype;
8938 l_loc_rec hr_locations_all%rowtype;
8939 l_pay_rec pay_all_payrolls_f%rowtype;
8940 l_ben_rec ben_benfts_grp%rowtype;
8941 l_hsc_rec hr_soft_coding_keyflex%rowtype;
8942 l_typ_rec ben_person_object.g_cache_typ_table;
8943 --
8944 begin
8945 --
8946 g_debug := hr_utility.debug_enabled;
8947 if g_debug then
8948 l_package := g_package||'.person_header';
8949 hr_utility.set_location ('Entering '||l_package,10);
8950 end if;
8951 --
8952 -- Cache person data
8953 --
8954 cache_person_information
8955 (p_person_id => p_person_id,
8956 p_business_group_id => p_business_group_id,
8957 p_effective_date => p_effective_date);
8958 if g_debug then
8959 hr_utility.set_location ('Dn Cac Per Inf '||l_package,10);
8960 end if;
8961 --
8962 -- This should display something like this
8963 --
8964 -- *********************************************************************
8965 -- Name : John Smith (100) Type : Employee (1) Grp : Benefits Group (1)
8966 -- BG : Freds BG (100) Org : Freds Org(1) GRE : Retiree
8967 -- Loc : HQ (100) Pst : 86727 Pyr : Payroll 3B (1)
8968 --
8969 ben_person_object.get_object(p_person_id => p_person_id,
8970 p_rec => l_per_rec);
8971 --
8972 if l_per_rec.benefit_group_id is not null then
8973 --
8974 ben_org_object.get_object(p_benfts_grp_id => l_per_rec.benefit_group_id,
8975 p_rec => l_ben_rec);
8976 --
8977 end if;
8978 --
8979 ben_person_object.get_object(p_person_id => p_person_id,
8980 p_rec => l_ass_rec);
8981 --
8982 if l_ass_rec.assignment_id is null then
8983 --
8984 ben_person_object.get_benass_object(p_person_id => p_person_id,
8985 p_rec => l_ass_rec);
8986 --
8987 end if;
8988 --
8989 if l_ass_rec.location_id is not null then
8990 --
8991 ben_location_object.get_object(p_location_id => l_ass_rec.location_id,
8992 p_rec => l_loc_rec);
8993 --
8994 end if;
8995 --
8996 if l_ass_rec.organization_id is not null then
8997 --
8998 ben_org_object.get_object(p_organization_id => l_ass_rec.organization_id,
8999 p_rec => l_org_rec);
9000 --
9001 end if;
9002 --
9003 if l_ass_rec.payroll_id is not null then
9004 --
9005 ben_org_object.get_object(p_payroll_id => l_ass_rec.payroll_id,
9006 p_rec => l_pay_rec);
9007 --
9008 end if;
9009 --
9010 if l_ass_rec.soft_coding_keyflex_id is not null then
9011 --
9012 ben_person_object.get_object
9013 (p_soft_coding_keyflex_id => l_ass_rec.soft_coding_keyflex_id,
9014 p_rec => l_hsc_rec);
9015 --
9016 if l_hsc_rec.segment1 is not null and hr_api.return_legislation_code(p_business_group_id) = 'US'
9017 then
9018 --
9019 ben_org_object.get_object(p_organization_id => l_hsc_rec.segment1,
9020 p_rec => l_org2_rec);
9021 --
9022 end if;
9023 --
9024 end if;
9025 --
9026 if g_debug then
9027 hr_utility.set_location ('BPO_GO PAD '||l_package,10);
9028 end if;
9029 ben_person_object.get_object(p_person_id => p_person_id,
9030 p_rec => l_pad_rec);
9031 --
9032 ben_person_object.get_object(p_person_id => p_person_id,
9033 p_rec => l_typ_rec);
9034 --
9035 ben_org_object.get_object(p_business_group_id => p_business_group_id,
9036 p_rec => l_bus_rec);
9037 --
9038 benutils.write(p_text => benutils.g_banner_asterix);
9039 l_output_string := 'Name: '||
9040 substr(l_per_rec.full_name,1,45)||
9041 benutils.id(p_person_id);
9042 benutils.write(p_text => l_output_string);
9043 l_output_string := ' Typ: '||
9044 substr(l_typ_rec(1).user_person_type,1,45);
9045 --
9046 -- loop through the rest of the person_types
9047 --
9048 for l_count in 2..l_typ_rec.last loop
9049 --
9050 l_output_string := rpad(' ',6,' ');
9051 l_output_string := l_output_string||
9052 substr(l_typ_rec(l_count).user_person_type,1,45);
9053 benutils.write(l_output_string);
9054 --
9055 end loop;
9056 l_output_string := 'Grp: '||
9057 substr(l_ben_rec.name,1,45)||
9058 benutils.id(l_per_rec.benefit_group_id);
9059 benutils.write(p_text => l_output_string);
9060 --
9061 l_output_string := 'BG: '||
9062 substr(l_bus_rec.name,1,45)||
9063 benutils.id(p_business_group_id);
9064 benutils.write(p_text => l_output_string);
9065 --
9066 l_output_string := 'Org: '||
9067 substr(l_org_rec.name,1,45)||
9068 benutils.id(l_ass_rec.organization_id);
9069 benutils.write(p_text => l_output_string);
9070 --
9071 if hr_api.return_legislation_code(p_business_group_id) = 'US'
9072 then
9073 l_output_string := 'Gre: '||
9074 substr(l_org2_rec.name,1,45);
9075 benutils.write(p_text => l_output_string);
9076 else
9077 l_output_string := 'Gre: '|| 'Not applicable' ;
9078 benutils.write(p_text => l_output_string);
9079 end if;
9080 --
9081 l_output_string := 'Loc: '||
9082 substr(l_loc_rec.address_line_1,1,45)||
9083 benutils.id(l_loc_rec.location_id);
9084 benutils.write(p_text => l_output_string);
9085 --
9086 l_output_string := 'Pst: '||
9087 substr(l_pad_rec.postal_code,1,45);
9088 benutils.write(p_text => l_output_string);
9089 --
9090 l_output_string := 'Pyr: '||
9091 substr(l_pay_rec.payroll_name,1,45)||
9092 benutils.id(l_pay_rec.payroll_id);
9093 benutils.write(p_text => l_output_string);
9094 --
9095 if g_debug then
9096 hr_utility.set_location ('Leaving '||l_package,10);
9097 end if;
9098 --
9099 end person_header;
9100 --
9101 --
9102 ----------------------------------------------------------
9103 -----------------< person_header_new >--------------------
9104 ----------------------------------------------------------
9105 --
9106 -- This is same procedure as PERSON_HEADER except that the call to
9107 -- CACHE_PERSON_INFORMATION was removed to separate CACHE Logic
9108 -- from displaying of person header
9109 --
9110 PROCEDURE person_header_new (
9111 p_person_id IN NUMBER DEFAULT NULL,
9112 p_business_group_id IN NUMBER
9113 )
9114 IS
9115 --
9116 l_package VARCHAR2 (80);
9117 l_output_string NVARCHAR2 (100);
9118 l_per_rec per_all_people_f%ROWTYPE;
9119 l_ass_rec per_all_assignments_f%ROWTYPE;
9120 l_bus_rec per_business_groups%ROWTYPE;
9121 l_org_rec hr_all_organization_units%ROWTYPE;
9122 l_org2_rec hr_all_organization_units%ROWTYPE;
9123 l_pad_rec per_addresses%ROWTYPE;
9124 l_loc_rec hr_locations_all%ROWTYPE;
9125 l_pay_rec pay_all_payrolls_f%ROWTYPE;
9126 l_ben_rec ben_benfts_grp%ROWTYPE;
9127 l_hsc_rec hr_soft_coding_keyflex%ROWTYPE;
9128 l_typ_rec ben_person_object.g_cache_typ_table;
9129 --
9130 BEGIN
9131 --
9132 g_debug := hr_utility.debug_enabled;
9133
9134 IF g_debug
9135 THEN
9136 l_package := g_package || '.person_header';
9137 hr_utility.set_location ('Entering ' || l_package, 10);
9138 END IF;
9139
9140 --
9141 -- This should display something like this
9142 --
9143 -- *********************************************************************
9144 -- Name : John Smith (100) Type : Employee (1) Grp : Benefits Group (1)
9145 -- BG : Freds BG (100) Org : Freds Org(1) GRE : Retiree
9146 -- Loc : HQ (100) Pst : 86727 Pyr : Payroll 3B (1)
9147 --
9148 ben_person_object.get_object (p_person_id => p_person_id,
9149 p_rec => l_per_rec
9150 );
9151
9152 --
9153 IF l_per_rec.benefit_group_id IS NOT NULL
9154 THEN
9155 --
9156 ben_org_object.get_object (p_benfts_grp_id => l_per_rec.benefit_group_id,
9157 p_rec => l_ben_rec
9158 );
9159 --
9160 END IF;
9161
9162 --
9163 ben_person_object.get_object (p_person_id => p_person_id,
9164 p_rec => l_ass_rec
9165 );
9166
9167 --
9168 IF l_ass_rec.assignment_id IS NULL
9169 THEN
9170 --
9171 ben_person_object.get_benass_object (p_person_id => p_person_id,
9172 p_rec => l_ass_rec
9173 );
9174 --
9175 END IF;
9176
9177 --
9178 IF l_ass_rec.location_id IS NOT NULL
9179 THEN
9180 --
9181 ben_location_object.get_object (p_location_id => l_ass_rec.location_id,
9182 p_rec => l_loc_rec
9183 );
9184 --
9185 END IF;
9186
9187 --
9188 IF l_ass_rec.organization_id IS NOT NULL
9189 THEN
9190 --
9191 ben_org_object.get_object (p_organization_id => l_ass_rec.organization_id,
9192 p_rec => l_org_rec
9193 );
9194 --
9195 END IF;
9196
9197 --
9198 IF l_ass_rec.payroll_id IS NOT NULL
9199 THEN
9200 --
9201 ben_org_object.get_object (p_payroll_id => l_ass_rec.payroll_id,
9202 p_rec => l_pay_rec
9203 );
9204 --
9205 END IF;
9206
9207 --
9208 IF l_ass_rec.soft_coding_keyflex_id IS NOT NULL
9209 THEN
9210 --
9211 ben_person_object.get_object (p_soft_coding_keyflex_id => l_ass_rec.soft_coding_keyflex_id,
9212 p_rec => l_hsc_rec
9213 );
9214
9215 --
9216 IF l_hsc_rec.segment1 IS NOT NULL and hr_api.return_legislation_code(p_business_group_id) = 'US'
9217 THEN
9218 --
9219 ben_org_object.get_object (p_organization_id => l_hsc_rec.segment1,
9220 p_rec => l_org2_rec
9221 );
9222 --
9223 END IF;
9224 --
9225 END IF;
9226
9227 --
9228 IF g_debug
9229 THEN
9230 hr_utility.set_location ('BPO_GO PAD ' || l_package, 10);
9231 END IF;
9232
9233 ben_person_object.get_object (p_person_id => p_person_id,
9234 p_rec => l_pad_rec
9235 );
9236 --
9237 ben_person_object.get_object (p_person_id => p_person_id,
9238 p_rec => l_typ_rec
9239 );
9240 --
9241 ben_org_object.get_object (p_business_group_id => p_business_group_id,
9242 p_rec => l_bus_rec
9243 );
9244 --
9245 benutils.WRITE (p_text => benutils.g_banner_asterix);
9246 --
9247 l_output_string :=
9248 'Name: '
9249 || SUBSTR (l_per_rec.full_name, 1, 45)
9250 || benutils.ID (p_person_id);
9251 --
9252 benutils.WRITE (p_text => l_output_string);
9253 --
9254 l_output_string :=
9255 ' Typ: '
9256 || SUBSTR (l_typ_rec (1).user_person_type, 1, 45);
9257
9258 --
9259 -- loop through the rest of the person_types
9260 --
9261 FOR l_count IN 2 .. l_typ_rec.LAST
9262 LOOP
9263 --
9264 l_output_string := RPAD (' ', 6, ' ');
9265 l_output_string :=
9266 l_output_string
9267 || SUBSTR (l_typ_rec (l_count).user_person_type, 1, 45);
9268 benutils.WRITE (l_output_string);
9269 --
9270 END LOOP;
9271
9272 l_output_string :=
9273 'Grp: '
9274 || SUBSTR (l_ben_rec.NAME, 1, 45)
9275 || benutils.ID (l_per_rec.benefit_group_id);
9276 benutils.WRITE (p_text => l_output_string);
9277 --
9278 l_output_string :=
9279 'BG: '
9280 || SUBSTR (l_bus_rec.NAME, 1, 45)
9281 || benutils.ID (p_business_group_id);
9282 benutils.WRITE (p_text => l_output_string);
9283 --
9284 l_output_string :=
9285 'Org: '
9286 || SUBSTR (l_org_rec.NAME, 1, 45)
9287 || benutils.ID (l_ass_rec.organization_id);
9288 benutils.WRITE (p_text => l_output_string);
9289 --
9290 if hr_api.return_legislation_code(p_business_group_id) = 'US'
9291 then
9292 l_output_string := 'Gre: ' || SUBSTR (l_org2_rec.NAME, 1, 45);
9293 benutils.WRITE (p_text => l_output_string);
9294 else
9295 l_output_string := 'Gre: ' || 'Not applicable' ;
9296 benutils.WRITE (p_text => l_output_string);
9297 end if;
9298 --
9299 l_output_string :=
9300 'Loc: '
9301 || SUBSTR (l_loc_rec.address_line_1, 1, 45)
9302 || benutils.ID (l_loc_rec.location_id);
9303 benutils.WRITE (p_text => l_output_string);
9304 --
9305 l_output_string := 'Pst: ' || SUBSTR (l_pad_rec.postal_code, 1, 45);
9306 benutils.WRITE (p_text => l_output_string);
9307 --
9308 l_output_string :=
9309 'Pyr: '
9310 || SUBSTR (l_pay_rec.payroll_name, 1, 45)
9311 || benutils.ID (l_pay_rec.payroll_id);
9312 benutils.WRITE (p_text => l_output_string);
9313
9314 --
9315 IF g_debug
9316 THEN
9317 hr_utility.set_location ('Leaving ' || l_package, 10);
9318 END IF;
9319 --
9320 END person_header_new;
9321 --
9322 --
9323 procedure evaluate_life_events
9324 (p_person_id in number default null,
9325 p_business_group_id in number,
9326 p_mode in varchar2,
9327 p_ler_id in out nocopy number,
9328 -- PB : 5422 :
9329 -- p_popl_enrt_typ_cycl_id in number,
9330 p_lf_evt_ocrd_dt in date,
9331 p_effective_date in date,
9332 p_validate in varchar2 default 'N', /* Bug 5550359 */
9333 p_gsp_eval_elig_flag in varchar2 default null, /* GSP Rate Sync */
9334 p_lf_evt_oper_cd in varchar2 default null) is /* GSP Rate Sync */
9335 --
9336 l_package varchar2(80);
9337 l_created_ler_id ben_ler_f.ler_id%type := null;
9338 l_per_in_ler_id ben_per_in_ler.per_in_ler_id%type;
9339 l_ptnl_ler benutils.g_ptnl_ler;
9340 l_effective_start_date date;
9341 l_effective_end_date date;
9342 l_rec benutils.g_active_life_event;
9343 l_param_rec benutils.g_batch_param_rec;
9344 l_ler_rec benutils.g_ler;
9345 l_ler_batch_rec benutils.g_batch_ler_rec;
9346 l_ptnl_ler_for_per_id number;
9347 l_object_version_number number;
9348 l_ovn number;
9349 l_commit number;
9350 l_mnl_dt date;
9351 l_dtctd_dt date;
9352 l_procd_dt date;
9353 l_unprocd_dt date;
9354 l_voidd_dt date;
9355 l_strtd_dt date;
9356 l_dummy varchar2(1);
9357 --
9358 -- Bug : 3511 : When a potential already sitting and
9359 -- benmngle is ran in scheduled mode with a effective
9360 -- date other than life event occured date a duplicate
9361 -- potential is being created and benmngle is stopping.
9362 -- Use lf_evt_ocrd_dt instead of effective_date in the
9363 -- where clause of c_ler_exists.
9364 -- Bug : 4919 : When a open potential is processed, do not create
9365 -- a new potential, the processed one will be backed out and it will
9366 -- be used for the current run.
9367 --
9368 -- Unrestricted enrollment enhancement-there can be more than one life event on the same day
9369 --
9370 cursor c_ler_exists(cv_ler_id in number,
9371 cv_person_id in number,
9372 cv_business_group_id in number,
9373 cv_lf_evt_ocrd_dt in date) is
9374 select ptn.ptnl_ler_for_per_id
9375 from ben_ptnl_ler_for_per ptn
9376 where ptn.ler_id = cv_ler_id
9377 and ptn.person_id = cv_person_id
9378 and ptn.business_group_id = cv_business_group_id
9379 and ptn.lf_evt_ocrd_dt = cv_lf_evt_ocrd_dt
9380 and ptn.ptnl_ler_for_per_stat_cd in ('DTCTD','UNPROCD', 'PROCD');
9381 --
9382 l_use_mode varchar2(80);
9383 l_asnd_lf_evt_dt date;
9384 l_cv_ler_id number;
9385 l_cv_lf_evt_ocrd_dt date;
9386 l_gsp_ler_rec benutils.g_ler;
9387 l_validate boolean;
9388 --
9389 begin
9390 --
9391 g_debug := hr_utility.debug_enabled;
9392 if g_debug then
9393 l_package := g_package||'.evaluate_life_events';
9394 hr_utility.set_location ('Entering ' || l_package,10);
9395 hr_utility.set_location ('p_mode : ' || p_mode,10);
9396 end if;
9397 --
9398 -- Method of Operation
9399 -- ===================
9400 --
9401 -- In life event mode it is imperative that we recreate the set of comp
9402 -- objects for each person based on the life event occured date of the
9403 -- persons life event. To do this we simply rebuild the set of comp objects
9404 -- using the life event occured on date to derive which objects to use.
9405 -- Certain operations must be done using the life event occured date and
9406 -- certain operations must be done using the effective date. In general when
9407 -- creating records we use the effective date but when looking at reference
9408 -- information we use the life event occured date.
9409 --
9410 -- (1) Log the life event we are attempting to process
9411 -- (2) Evaluate the potential life events
9412 -- (3) If a new winning life event is found then log it
9413 --
9414 ben_env_object.setenv(p_person_id => p_person_id);
9415
9416 -- Bug 1696526. Added by Gopal Venkataraman 3/20/01 - This is was done
9417 -- to set the p_lf_evt_ocrd_dt until the real one is determined.
9418 -- Better than using the one from the previous person as is what happens
9419 -- without this.
9420 ben_env_object.setenv(p_lf_evt_ocrd_dt => p_effective_date);
9421 -- Add ended
9422 --
9423 benutils.get_batch_parameters
9424 (p_benefit_action_id => benutils.g_benefit_action_id
9425 ,p_rec => l_param_rec
9426 );
9427 --
9428 benutils.get_batch_parameters
9429 (p_benefit_action_id => benutils.g_benefit_action_id
9430 ,p_rec => l_param_rec
9431 );
9432 --
9433 -- CWB Changes : Added mode ABSENCES mode(M) added. Added GRADE/STEP mode
9434 -- added irec mode also
9435 if p_mode in ('G', 'L','C','U','R', 'W', 'M','I','D') then
9436 --
9437 -- CWB Changes : Added mode
9438 -- added irec mode
9439 if p_mode in ('G', 'L','C','W', 'M','I') then
9440 --
9441 --
9442 -- Create life event if person does not currently have an open
9443 -- enrollment.
9444 --
9445 -- CWB Changes : Added mode
9446 -- For Grade/Step : If the date is not null then create potential
9447 -- life events to every one.
9448 --
9449 if (p_mode in ('C', 'W')) or
9450 (p_mode = 'G' and l_param_rec.date_from is not null) then
9451 --
9452 if g_debug then
9453 hr_utility.set_location('Create potential',10);
9454 end if;
9455 if p_mode in ('C', 'W') then
9456 --
9457 l_cv_ler_id := p_ler_id;
9458 l_cv_lf_evt_ocrd_dt := nvl(p_lf_evt_ocrd_dt,
9459 p_effective_date);
9460 --
9461 elsif p_mode = 'G' then
9462 --
9463 benutils.get_ler
9464 (p_business_group_id => p_business_group_id,
9465 p_typ_cd => 'GSP',
9466 p_effective_date => p_effective_date,
9467 p_lf_evt_oper_cd => p_lf_evt_oper_cd, /* GSP Rate Sync */
9468 p_rec => l_gsp_ler_rec);
9469 --
9470 l_cv_ler_id := l_gsp_ler_rec.ler_id;
9471 --
9472 -- Here date_from is mapped to asg_events_to_all_sel_dt
9473 -- When all GRADE/STEP parameters are added to bft table use
9474 -- the actual column.
9475 --
9476 l_cv_lf_evt_ocrd_dt := l_param_rec.date_from;
9477 --
9478 end if;
9479 --
9480 open c_ler_exists(l_cv_ler_id,
9481 p_person_id,
9482 p_business_group_id,
9483 l_cv_lf_evt_ocrd_dt);
9484 --
9485 fetch c_ler_exists into l_ptnl_ler_for_per_id;
9486 if c_ler_exists%notfound then
9487 --
9488 -- Create potential life event
9489 --
9490 if g_debug then
9491 hr_utility.set_location('Really created GSP potential',10);
9492 end if;
9493 ben_ptnl_ler_for_per_api.create_ptnl_ler_for_per
9494 (p_validate => false
9495 ,p_ptnl_ler_for_per_id => l_ptnl_ler_for_per_id
9496 ,p_lf_evt_ocrd_dt => l_cv_lf_evt_ocrd_dt
9497 --
9498 -- PB : 5422 : need to modify the form.
9499 -- 99999 Will this affect any where
9500 --
9501 ,p_enrt_perd_id => null -- p_popl_enrt_typ_cycl_id
9502 ,p_ptnl_ler_for_per_stat_cd => 'DTCTD'
9503 ,p_ntfn_dt => trunc(sysdate)
9504 ,p_ler_id => l_cv_ler_id
9505 ,p_person_id => p_person_id
9506 ,p_business_group_id => p_business_group_id
9507 ,p_object_version_number => l_ovn
9508 ,p_effective_date => p_effective_date
9509 ,p_dtctd_dt => p_effective_date);
9510 --
9511 if g_debug then
9512 hr_utility.set_location('Finished created potential',10);
9513 end if;
9514 --
9515 end if;
9516 --
9517 close c_ler_exists;
9518 --
9519 end if;
9520 --
9521 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
9522 --
9523 -- CWB Changes : Added mode
9524 --
9525 if p_mode in ('C', 'L') then
9526 --
9527 if g_debug then
9528 hr_utility.set_location('Evaluate potential',10);
9529 end if;
9530 fnd_message.set_token('PROC','ben_evaluate_ptnl_lf_evt');
9531 --
9532 if p_validate = 'Y'
9533 then
9534 l_validate := TRUE;
9535 else
9536 l_validate := FALSE;
9537 end if;
9538 --
9539 ben_evaluate_ptnl_lf_evt.eval_ptnl_per_for_ler
9540 (p_validate => l_validate, /* Bug 5550359 */
9541 p_person_id => p_person_id,
9542 p_business_group_id => p_business_group_id,
9543 p_ler_id => p_ler_id,
9544 p_mode => p_mode,
9545 p_effective_date => p_effective_date,
9546 p_created_ler_id => l_created_ler_id);
9547 --
9548 --
9549 elsif p_mode = 'I' then
9550 --
9551 -- iRec
9552 if g_debug then
9553 hr_utility.set_location('Evaluate iRec Potential LER',10);
9554 end if;
9555 --
9556 fnd_message.set_token('PROC','ben_evaluate_ptnl_lf_evt');
9557 --
9558 ben_evaluate_ptnl_lf_evt.irec_eval_ptnl_per_for_ler
9559 (p_validate => false,
9560 p_person_id => p_person_id,
9561 p_business_group_id => p_business_group_id,
9562 p_ler_id => g_ler_id,
9563 p_mode => p_mode,
9564 p_effective_date => p_effective_date,
9565 p_lf_evt_ocrd_dt => p_effective_date,
9566 p_assignment_id => g_irec_ass_rec.assignment_id,
9567 p_ptnl_ler_for_per_id => null,
9568 p_created_ler_id => l_created_ler_id);
9569 --
9570 -- iRec
9571 --
9572 --
9573 elsif p_mode = 'W' then
9574 --
9575 if g_debug then
9576 hr_utility.set_location('CWB Evaluate potential',10);
9577 end if;
9578 fnd_message.set_token('PROC','cwb_eval_ptnl_per_for_ler');
9579 --
9580 ben_evaluate_ptnl_lf_evt.cwb_eval_ptnl_per_for_ler
9581 (p_validate => false,
9582 p_person_id => p_person_id,
9583 p_business_group_id => p_business_group_id,
9584 p_ler_id => p_ler_id,
9585 p_mode => p_mode,
9586 p_effective_date => p_effective_date,
9587 p_lf_evt_ocrd_dt => nvl(p_lf_evt_ocrd_dt,
9588 p_effective_date),
9589 p_ptnl_ler_for_per_id => l_ptnl_ler_for_per_id,
9590 p_created_ler_id => l_created_ler_id);
9591 --
9592 --
9593 -- ABSENCES mode
9594 --
9595 elsif p_mode = 'M' then
9596 --
9597 ben_evaluate_ptnl_lf_evt.absences_eval_ptnl_per_for_ler
9598 (p_validate => false,
9599 p_person_id => p_person_id,
9600 p_business_group_id => p_business_group_id,
9601 p_ler_id => p_ler_id,
9602 p_mode => p_mode,
9603 p_effective_date => p_effective_date,
9604 p_created_ler_id => l_created_ler_id);
9605 --
9606 -- GRADE/STEP mode
9607 --
9608 elsif p_mode = 'G' then
9609 --
9610 ben_evaluate_ptnl_lf_evt.grd_stp_eval_ptnl_per_for_ler
9611 (p_validate => false,
9612 p_person_id => p_person_id,
9613 p_business_group_id => p_business_group_id,
9614 p_ler_id => p_ler_id,
9615 p_mode => p_mode,
9616 p_effective_date => p_effective_date,
9617 p_created_ler_id => l_created_ler_id,
9618 p_lf_evt_oper_cd => p_lf_evt_oper_cd); /* GSP Rate Sync */
9619 --
9620 end if;
9621 --
9622 -- Unrestricted Mode should ignore active or potential non-unrestricted mode
9623 -- the following common codes for L,C or U mode is now made only for L or C mode
9624 --
9625 -- CWB Changes 9999 GRADE???? Need a seperate proc?
9626 --
9627 if p_mode <> 'W' then
9628 --
9629 if p_mode = 'G' then
9630 --
9631 benutils.get_active_life_event
9632 (p_person_id => p_person_id,
9633 p_business_group_id => p_business_group_id,
9634 p_effective_date => p_effective_date,
9635 p_lf_event_mode => 'G',
9636 p_rec => l_rec);
9637 --
9638 elsif p_mode = 'M' then
9639 --
9640 benutils.get_active_life_event
9641 (p_person_id => p_person_id,
9642 p_business_group_id => p_business_group_id,
9643 p_effective_date => p_effective_date,
9644 p_lf_event_mode => 'M',
9645 p_rec => l_rec);
9646 --
9647 elsif p_mode = 'I' then
9648 --
9649 -- iRec
9650 benutils.get_active_life_event
9651 (p_person_id => p_person_id,
9652 p_business_group_id => p_business_group_id,
9653 p_effective_date => p_effective_date,
9654 p_lf_event_mode => 'I',
9655 p_rec => l_rec);
9656 --
9657 else
9658 --
9659 benutils.get_active_life_event
9660 (p_person_id => p_person_id,
9661 p_business_group_id => p_business_group_id,
9662 p_effective_date => p_effective_date,
9663 p_rec => l_rec);
9664 --
9665 end if;
9666 --
9667 else
9668 --
9669 -- Is it necessary in this procedure as this proc may not be called in W mode.
9670 benutils.get_active_life_event
9671 (p_person_id => p_person_id,
9672 p_business_group_id => p_business_group_id,
9673 p_effective_date => p_effective_date,
9674 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
9675 p_ler_id => p_ler_id,
9676 p_rec => l_rec);
9677 --
9678 end if;
9679 --
9680 if g_debug then
9681 hr_utility.set_location ('Done get ale ' || l_package,30);
9682 end if;
9683 --
9684 -- For life event collision detect any life event
9685 -- which was backed out and occured on same day.
9686 --
9687 g_bckdt_per_in_ler_id := null;
9688 --
9689 -- CWB Changes ABSENCES changes , GRADE/STEP no restore for Grade life events
9690 -- added irec
9691 if p_mode not in ('W', 'M', 'G','I') then
9692 --
9693 ben_lf_evt_clps_restore.get_ori_bckdt_pil(
9694 p_person_id => p_person_id
9695 ,p_business_group_id => p_business_group_id
9696 ,p_ler_id => l_rec.ler_id
9697 ,p_effective_date => l_rec.lf_evt_ocrd_dt
9698 ,p_bckdt_per_in_ler_id => g_bckdt_per_in_ler_id
9699 );
9700 end if;
9701 --
9702 if g_debug then
9703 hr_utility.set_location ('Dn BLECR_GOBP ' || l_package,30);
9704 end if;
9705 --
9706 -- PB : 5422 :
9707 -- Now if benmngle is run in Life event mode and the winner
9708 -- is open then change the mode of benmngle run for this
9709 -- person and proceed. Means the mode to be changed on the fly.
9710 --
9711 if (p_mode = 'L' and l_rec.typ_cd in ('SCHEDDO', 'SCHEDDA'))
9712 then
9713 --
9714 ben_manage_life_events.g_modified_mode := 'C';
9715 --
9716 -- 6806014
9717
9718 -- Now if benmngle is run in Open mode (C) and the winner
9719 -- is a normal life event (which would be processed in mode 'L')
9720 -- then change the mode of benmngle run from 'C' to 'L' for this
9721 -- person and proceed. Means the mode to be changed on the fly.
9722
9723 elsif (p_mode = 'C' and l_rec.typ_cd not like 'SCHEDD%') then
9724
9725 ben_manage_life_events.g_modified_mode := 'L';
9726 -- 6806014
9727 end if;
9728 --
9729 -- PB : If the supplied mode and mode of winning life event
9730 -- differ, raise error.
9731 --
9732 -- if (p_mode = 'U' and l_rec.typ_cd <> 'SCHEDDU') or
9733 --
9734 if /*(p_mode = 'C' and l_rec.typ_cd not like 'SCHEDD%') or --commented for bug 6806014 */
9735 (p_mode = 'L' and l_rec.typ_cd in ('SCHEDDU','UNRSTR'))
9736 -- PB : 5422 :
9737 -- If benmngle is run in Life event mode and the winner
9738 -- is open then still proceed further.
9739 --
9740 -- PB : 5422 : (p_mode = 'L' and l_rec.typ_cd in ('SCHEDDO', 'SCHEDDA','SCHEDDU','UNRSTR'))
9741 then
9742 --
9743 benutils.write(p_text => 'Winner Life Event : '|| l_rec.name||
9744 benutils.id(l_rec.ler_id) ||
9745 ' , Supplied Mode : ' || p_mode);
9746 --
9747 -- Raise error for this person.
9748 --
9749 if (l_rec.typ_cd like 'SCHEDD%' or l_rec.typ_cd = 'UNRSTR') then
9750 l_use_mode := 'Scheduled mode';
9751 else
9752 l_use_mode := 'Life event mode';
9753 end if;
9754 fnd_message.set_name('BEN','BEN_92145_MODE_LE_DIFFER');
9755 fnd_message.set_token('MODE',l_use_mode);
9756 --
9757 -- Bug 2836770
9758 -- Set proper values to global variables before raising error
9759 -- Once value is retrieved from fnd_message.get, the next call
9760 -- return null value. Hence set the values.
9761 --
9762 g_rec.text := fnd_message.get;
9763 g_rec.error_message_code := 'BEN_92145_MODE_LE_DIFFER';
9764 benutils.write(p_text => g_rec.text );
9765 --
9766 -- Bug 2836770
9767 --
9768 -- Bug : 3658807
9769 -- Set the message name so that correct message is displayed in
9770 -- BENAUTHE.pld (Life Events Evaluation Processing Summary) - Messages
9771 --
9772 fnd_message.set_name('BEN','BEN_92145_MODE_LE_DIFFER');
9773 fnd_message.set_token('MODE',l_use_mode);
9774 raise g_record_error;
9775 --
9776 end if;
9777 --
9778 benutils.write(p_text => 'Life Event Occured Date: '||
9779 l_rec.lf_evt_ocrd_dt);
9780 if l_created_ler_id <> nvl(p_ler_id,-1) then
9781 --
9782 -- Get life event name we are dealing with, put in global structure
9783 --
9784 p_ler_id := l_created_ler_id;
9785 benutils.write(p_text => 'Winner Life Event : '||
9786 l_rec.name||
9787 benutils.id(l_rec.ler_id));
9788 --
9789 end if;
9790 --
9791 ben_env_object.setenv(p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt);
9792 dt_fndate.change_ses_date
9793 (p_ses_date => l_rec.lf_evt_ocrd_dt,
9794 p_commit => l_commit);
9795 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
9796 fnd_message.set_token('PROC','ben_related_person_ler_api');
9797 if g_debug then
9798 hr_utility.set_location (l_package||' create_rel_per_ler ' ,20);
9799 end if;
9800 --
9801 -- CWB Changes ABSENCES , GRADE/STEP : no need to create related ler's
9802 --
9803 if p_mode not in ('W', 'M', 'G','I') then
9804 --
9805 ben_related_person_ler_api.create_related_person_ler
9806 (p_validate => false,
9807 p_person_id => p_person_id,
9808 p_ler_id => p_ler_id,
9809 p_effective_date => p_effective_date,
9810 p_business_group_id => p_business_group_id,
9811 p_csd_by_ptnl_ler_for_per_id => l_rec.ptnl_ler_for_per_id,
9812 p_from_form => 'N' );
9813 --
9814 end if;
9815 --
9816 -- CWB Changes
9817 --
9818 if nvl(ben_manage_life_events.g_modified_mode, p_mode) in ('C','W') then
9819 l_asnd_lf_evt_dt := l_rec.lf_evt_ocrd_dt;
9820 end if;
9821 --
9822 if p_mode = 'G' and p_lf_evt_oper_cd = 'SYNC'
9823 then
9824 --
9825 -- GSP Rate Sync : For this case we would not build compensation object list, but get current grade ladder / grade step
9826 -- and populate g_cache_proc_object in procedure process_comp_objects later
9827 hr_utility.set_location('GSP Rate Sync : Do not build comp obj list here', 23);
9828 --
9829 else
9830 if g_debug then
9831 hr_utility.set_location (l_package||' Bef BCOL ' ,25);
9832 end if;
9833
9834 ben_comp_object_list.build_comp_object_list
9835 (p_benefit_action_id => benutils.g_benefit_action_id
9836 ,p_comp_selection_rule_id => l_param_rec.comp_selection_rl
9837 ,p_effective_date => l_rec.lf_evt_ocrd_dt
9838 ,p_pgm_id => l_param_rec.pgm_id
9839 ,p_business_group_id => l_param_rec.business_group_id
9840 ,p_pl_id => l_param_rec.pl_id
9841 -- PB : 5422 :
9842 -- ,p_popl_enrt_typ_cycl_id => l_param_rec.popl_enrt_typ_cycl_id
9843 ,p_asnd_lf_evt_dt => l_asnd_lf_evt_dt
9844 ,p_no_programs => l_param_rec.no_programs_flag
9845 ,p_no_plans => l_param_rec.no_plans_flag
9846 ,p_rptg_grp_id => l_param_rec.rptg_grp_id
9847 ,p_pl_typ_id => l_param_rec.pl_typ_id
9848 ,p_opt_id => l_param_rec.opt_id
9849 ,p_eligy_prfl_id => l_param_rec.eligy_prfl_id
9850 ,p_vrbl_rt_prfl_id => l_param_rec.vrbl_rt_prfl_id
9851 ,p_thread_id => benutils.g_thread_id
9852 -- PB : 5422 :
9853 ,p_mode => nvl(ben_manage_life_events.g_modified_mode,l_param_rec.mode_cd)
9854 -- ,p_mode => l_param_rec.mode_cd
9855 ,p_lmt_prpnip_by_org_flag => l_param_rec.lmt_prpnip_by_org_flag
9856 ,p_person_id => p_person_id
9857 );
9858 if g_debug then
9859 hr_utility.set_location (l_package||' Dn BCOL ' ,27);
9860 end if;
9861 --
9862 end if;
9863 --
9864 -- if mode is 'U' unrestricted
9865 -- Get life event reason information for the passed in typ_cd.
9866 --
9867 elsif (p_mode = 'U' or p_mode = 'R' or p_mode = 'D') then /* IF p_mode IN ('G', 'L', 'C', 'U', 'R', 'W', 'M', 'I') */
9868 --
9869 if p_mode = 'D' then
9870 --
9871 benutils.get_active_life_event
9872 (p_person_id => p_person_id,
9873 p_business_group_id => p_business_group_id,
9874 p_effective_date => p_effective_date,
9875 p_lf_event_mode => 'U',
9876 p_rec => l_rec);
9877 --
9878 else
9879 --
9880 ben_manage_unres_life_events.delete_elctbl_choice
9881 (p_person_id => p_person_id
9882 ,p_effective_date => p_effective_date
9883 ,p_business_group_id => p_business_group_id
9884 ,p_rec => l_rec
9885 );
9886 --
9887 end if;
9888 --
9889 -- if p_mode in ('U','D') then -- Bug 6321565
9890 --
9891 benutils.get_ler
9892 (p_business_group_id => p_business_group_id,
9893 p_typ_cd => 'SCHEDDU',
9894 p_effective_date => p_effective_date,
9895 p_rec => l_ler_rec);
9896 --
9897 -- end if;
9898 --
9899 if l_rec.per_in_ler_id is null then
9900 --
9901 ben_ptnl_ler_for_per_api.create_ptnl_ler_for_per
9902 (p_validate => false
9903 ,p_ptnl_ler_for_per_id => l_ptnl_ler_for_per_id
9904 --
9905 -- PB : 5422 : need to modify the form.
9906 --
9907 ,p_enrt_perd_id => null -- p_popl_enrt_typ_cycl_id
9908 ,p_lf_evt_ocrd_dt => p_effective_date
9909 ,p_ptnl_ler_for_per_stat_cd => 'DTCTD'
9910 ,p_ler_id => l_ler_rec.ler_id
9911 ,p_person_id => p_person_id
9912 ,p_business_group_id => p_business_group_id
9913 ,p_object_version_number => l_object_version_number
9914 ,p_effective_date => p_effective_date
9915 ,p_ntfn_dt => trunc(sysdate)
9916 ,p_dtctd_dt => p_effective_date);
9917 --
9918 l_rec.ptnl_ler_for_per_id := l_ptnl_ler_for_per_id;
9919 --
9920 end if;
9921 --
9922 -- Update the ptnl per for ler for the person
9923 --
9924 if p_ler_id is null then
9925 p_ler_id := l_ler_rec.ler_id;
9926 end if;
9927 --
9928 ben_ptnl_ler_for_per_api.update_ptnl_ler_for_per
9929 (p_validate => false
9930 ,p_object_version_number => l_object_version_number
9931 ,p_ptnl_ler_for_per_id => l_rec.ptnl_ler_for_per_id
9932 ,p_lf_evt_ocrd_dt => p_effective_date
9933 ,p_ptnl_ler_for_per_stat_cd => 'PROCD'
9934 ,p_ler_id => p_ler_id
9935 ,p_person_id => p_person_id
9936 ,p_business_group_id => p_business_group_id
9937 ,p_effective_date => p_effective_date
9938 ,p_program_application_id => fnd_global.prog_appl_id
9939 ,p_program_id => fnd_global.conc_program_id
9940 ,p_request_id => fnd_global.conc_request_id
9941 ,p_program_update_date => sysdate
9942 ,p_ntfn_dt => trunc(sysdate)
9943 ,p_procd_dt => p_effective_date);
9944 --
9945 -- Since this process does not go through the evaluate life event
9946 -- process we need to make this the active life event
9947 --
9948 l_ler_batch_rec.person_id := p_person_id;
9949 l_ler_batch_rec.ler_id := p_ler_id;
9950 l_ler_batch_rec.lf_evt_ocrd_dt := p_effective_date;
9951 l_ler_batch_rec.replcd_flag := 'N';
9952 l_ler_batch_rec.crtd_flag := 'Y';
9953 l_ler_batch_rec.tmprl_flag := 'N';
9954 l_ler_batch_rec.dltd_flag := 'N';
9955 l_ler_batch_rec.open_and_clsd_flag := 'N';
9956 l_ler_batch_rec.not_crtd_flag := 'N';
9957 l_ler_batch_rec.clsd_flag := 'N';
9958 l_ler_batch_rec.stl_actv_flag := 'N';
9959 l_ler_batch_rec.clpsd_flag := 'N';
9960 l_ler_batch_rec.clsn_flag := 'N';
9961 l_ler_batch_rec.no_effect_flag := 'N';
9962 l_ler_batch_rec.cvrge_rt_prem_flag := 'N';
9963 l_ler_batch_rec.business_group_id := p_business_group_id;
9964 l_ler_batch_rec.effective_date := p_effective_date;
9965 --
9966 benutils.write(p_rec => l_ler_batch_rec);
9967 if g_debug then
9968 hr_utility.set_location (l_package,60);
9969 end if;
9970 if l_rec.per_in_ler_id is null then
9971 ben_person_life_event_api.create_person_life_Event
9972 (p_validate => false,
9973 p_per_in_ler_id => l_per_in_ler_id,
9974 p_ler_id => p_ler_id,
9975 p_person_id => p_person_id,
9976 p_ptnl_ler_for_per_id => l_ptnl_ler_for_per_id,
9977 p_per_in_ler_stat_cd => 'STRTD',
9978 p_lf_evt_ocrd_dt => p_effective_date,
9979 p_business_group_id => p_business_group_id,
9980 p_object_version_number => l_object_version_number,
9981 p_effective_date => p_effective_date,
9982 p_program_application_id => fnd_global.prog_appl_id,
9983 p_program_id => fnd_global.conc_program_id,
9984 p_request_id => fnd_global.conc_request_id,
9985 p_program_update_date => sysdate
9986 ,p_procd_dt => l_procd_dt
9987 ,p_strtd_dt => l_strtd_dt
9988 ,p_voidd_dt => l_voidd_dt
9989 );
9990 -- only one started unrestricted for a person
9991 if p_mode = 'U' then
9992 commit;
9993 end if;
9994 else
9995 ben_person_life_event_api.update_person_life_event
9996 (p_per_in_ler_id => l_rec.per_in_ler_id,
9997 p_per_in_ler_stat_cd => 'STRTD',
9998 p_object_version_number => l_rec.object_version_number,
9999 p_lf_evt_ocrd_dt => p_effective_date,
10000 p_effective_date => p_effective_date,
10001 p_procd_dt => l_procd_dt,
10002 p_strtd_dt => l_strtd_dt,
10003 p_voidd_dt => l_voidd_dt);
10004 end if;
10005 --
10006 if p_mode = 'R' then
10007 --
10008 ben_comp_object_list.build_comp_object_list
10009 (p_benefit_action_id => benutils.g_benefit_action_id
10010 ,p_comp_selection_rule_id => l_param_rec.comp_selection_rl
10011 ,p_effective_date => p_effective_date
10012 ,p_pgm_id => l_param_rec.pgm_id
10013 ,p_business_group_id => l_param_rec.business_group_id
10014 ,p_pl_id => l_param_rec.pl_id
10015 ,p_asnd_lf_evt_dt => l_asnd_lf_evt_dt
10016 ,p_no_programs => l_param_rec.no_programs_flag
10017 ,p_no_plans => l_param_rec.no_plans_flag
10018 ,p_rptg_grp_id => l_param_rec.rptg_grp_id
10019 ,p_pl_typ_id => l_param_rec.pl_typ_id
10020 ,p_opt_id => l_param_rec.opt_id
10021 ,p_eligy_prfl_id => l_param_rec.eligy_prfl_id
10022 ,p_vrbl_rt_prfl_id => l_param_rec.vrbl_rt_prfl_id
10023 ,p_thread_id => benutils.g_thread_id
10024 ,p_mode => 'U'
10025 ,p_lmt_prpnip_by_org_flag => l_param_rec.lmt_prpnip_by_org_flag
10026 ,p_person_id => p_person_id
10027 );
10028 --
10029 end if;
10030 --
10031 end if;
10032 --
10033 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
10034 fnd_message.set_token('PROC','benutils.get_batch_parameters');
10035 ben_enrolment_requirements.g_electable_choice_created := false;
10036 ben_enrolment_requirements.g_any_choice_created := false;
10037 ben_enrolment_requirements.g_auto_choice_created := false;
10038 ben_determine_dpnt_eligibility.g_dpnt_ineligible := false;
10039 --
10040 elsif l_param_rec.lmt_prpnip_by_org_flag = 'Y'
10041 and p_mode in ('A','P','S','T') then
10042 --
10043 -- PB : Healthnet changes
10044 -- Build the comp object list in evaluate_life_events
10045 -- if comp objects selection is based on person's org id.
10046 --
10047 if g_debug then
10048 hr_utility.set_location (' Temp BCOL '||l_package,10);
10049 end if;
10050 ben_comp_object_list.build_comp_object_list
10051 (p_benefit_action_id => benutils.g_benefit_action_id
10052 ,p_comp_selection_rule_id => l_param_rec.comp_selection_rl
10053 ,p_effective_date => p_effective_date
10054 ,p_pgm_id => l_param_rec.pgm_id
10055 ,p_business_group_id => l_param_rec.business_group_id
10056 ,p_pl_id => l_param_rec.pl_id
10057 -- PB : 5422 :
10058 -- ,p_popl_enrt_typ_cycl_id => l_param_rec.popl_enrt_typ_cycl_id
10059 ,p_asnd_lf_evt_dt => null
10060 ,p_no_programs => l_param_rec.no_programs_flag
10061 ,p_no_plans => l_param_rec.no_plans_flag
10062 ,p_rptg_grp_id => l_param_rec.rptg_grp_id
10063 ,p_pl_typ_id => l_param_rec.pl_typ_id
10064 ,p_opt_id => l_param_rec.opt_id
10065 ,p_eligy_prfl_id => l_param_rec.eligy_prfl_id
10066 ,p_vrbl_rt_prfl_id => l_param_rec.vrbl_rt_prfl_id
10067 ,p_thread_id => benutils.g_thread_id
10068 -- PB : 5422 :
10069 ,p_mode => p_mode
10070 -- ,p_mode => l_param_rec.mode_cd
10071 ,p_lmt_prpnip_by_org_flag => l_param_rec.lmt_prpnip_by_org_flag
10072 ,p_person_id => p_person_id
10073 );
10074 --
10075 -- Set up participation eligibility for all comp objects in the list
10076 --
10077 set_up_list_part_elig
10078 (p_ler_id => null
10079 ,p_business_group_id => p_business_group_id
10080 ,p_effective_date => p_effective_date
10081 );
10082 if g_debug then
10083 hr_utility.set_location (' Dn Temp BCOL '||l_package,10);
10084 end if;
10085 --
10086 end if;
10087 --
10088 if g_debug then
10089 hr_utility.set_location ('Leaving '||l_package,10);
10090 end if;
10091 --
10092 exception
10093 --
10094 when others then
10095 raise;
10096 --
10097 end evaluate_life_events;
10098 --
10099 procedure process_comp_objects
10100 (p_person_id in number default null
10101 ,p_person_action_id in number
10102 ,p_object_version_number in out nocopy number
10103 ,p_business_group_id in number
10104 ,p_mode in varchar2
10105 ,p_ler_id in number default null
10106 ,p_derivable_factors in varchar2 default 'ASC'
10107 ,p_cbr_tmprl_evt_flag in varchar2 default 'N'
10108 ,p_person_count in out nocopy number
10109 -- PB : 5422 :
10110 ,p_lf_evt_ocrd_dt in date default null
10111 -- ,p_popl_enrt_typ_cycl_id in number
10112 ,p_effective_date in date
10113 ,p_gsp_eval_elig_flag in varchar2 default null /* GSP Rate Sync */
10114 ,p_lf_evt_oper_cd in varchar2 default null /* GSP Rate Sync */
10115 )
10116 is
10117 --
10118 -- PB : 5422 :
10119 -- This is not being used
10120 --
10121 /*
10122 cursor c_strt_dt is
10123 select strt_dt
10124 from ben_enrt_perd
10125 where enrt_perd_id = p_popl_enrt_typ_cycl_id;
10126 */
10127 --
10128 cursor c_get_inelig_dpnt_info(p_per_in_ler_id in number) is
10129 -- RCHASE - wwBug1427383 - return correct date for creating dependent benefit assignment
10130 select pdp.dpnt_person_id, min(egd.elig_thru_dt) cvg_thru_dt--min(pdp.cvg_thru_dt) cvg_thru_dt
10131 from ben_elig_cvrd_dpnt_f pdp
10132 ,ben_elig_dpnt egd
10133 ,ben_prtt_enrt_rslt_f pen
10134 where pdp.prtt_enrt_rslt_id = pen.prtt_enrt_rslt_id
10135 and pen.person_id = p_person_id
10136 and pen.effective_end_date = hr_api.g_eot
10137 and pen.business_group_id = p_business_group_id
10138 and nvl(pdp.cvg_thru_dt,hr_api.g_eot) <> hr_api.g_eot
10139 and pdp.business_group_id = pen.business_group_id
10140 and pdp.elig_cvrd_dpnt_id = egd.elig_cvrd_dpnt_id
10141 and egd.dpnt_inelig_flag = 'Y'
10142 and egd.per_in_ler_id = p_per_in_ler_id
10143 and egd.business_group_id = pdp.business_group_id
10144 group by pdp.dpnt_person_id;
10145 --
10146 cursor c_pil_elctbl_chc_popl (p_per_in_ler_id in number) is
10147 select popl.pil_elctbl_chc_popl_id,
10148 popl.object_version_number
10149 from ben_pil_elctbl_chc_popl popl
10150 where per_in_ler_id = p_per_in_ler_id
10151 and not exists
10152 (select null
10153 from ben_elig_per_elctbl_chc epe
10154 where epe.pil_elctbl_chc_popl_id = popl.pil_elctbl_chc_popl_id
10155 and elctbl_flag = 'Y');
10156 --
10157 cursor c_pil (p_per_in_ler_id number, p_pgm_id number, p_pl_id number) is
10158 select 'Y'
10159 from ben_pil_elctbl_chc_popl popl
10160 where per_in_ler_id = p_per_in_ler_id
10161 and (popl.pgm_id = p_pgm_id or
10162 popl.pl_id = p_pl_id);
10163 --
10164 l_rec benutils.g_active_life_event;
10165 l_lf_rec benutils.g_active_life_event;
10166 --
10167 cursor c_ptnl is
10168 select a.ptnl_ler_for_per_id ptnl_ler_for_per_id,
10169 a.object_version_number object_version_number
10170 from ben_ptnl_ler_for_per a,
10171 ben_per_in_ler b
10172 where b.per_in_ler_id = l_rec.per_in_ler_id
10173 and b.ptnl_ler_for_per_id = a.ptnl_ler_for_per_id;
10174 --
10175 cursor c_ptip_pl_id(p_gsp_pgm_id number,
10176 p_gsp_plip_id number) is
10177 select ptip.ptip_id,
10178 pln.pl_id
10179 from ben_ptip_f ptip,
10180 ben_pl_f pln,
10181 ben_plip_f plip
10182 where plip.plip_id = p_gsp_plip_id
10183 and plip.pgm_id = p_gsp_pgm_id
10184 and p_effective_date between plip.effective_start_date
10185 and plip.effective_end_date
10186 and pln.pl_id = plip.pl_id
10187 and plip.effective_start_date between pln.effective_start_date
10188 and pln.effective_end_date
10189 and ptip.pl_typ_id = pln.pl_typ_id
10190 and ptip.pgm_id = p_gsp_pgm_id
10191 and p_effective_date between ptip.effective_start_date
10192 and ptip.effective_end_date;
10193 --
10194 -- Min Max enhancement.
10195 --
10196 cursor c_get_ended_enrt_rslts(p_per_in_ler_id number) is
10197 select pen.*
10198 from ben_prtt_enrt_rslt_f pen
10199 where pen.person_id = p_person_id
10200 and pen.prtt_enrt_rslt_stat_cd is null
10201 and pen.sspndd_flag = 'N'
10202 and pen.enrt_cvg_thru_dt <> hr_api.g_eot
10203 and pen.effective_end_date = hr_api.g_eot
10204 and p_effective_date between pen.effective_start_date
10205 and pen.effective_end_date
10206 and pen.business_group_id = p_business_group_id
10207 and pen.comp_lvl_cd not in ('PLANFC', 'PLANIMP')
10208 and pen.per_in_ler_id = p_per_in_ler_id
10209 ;
10210 cursor c_get_ptip_tot_enrd(p_ptip_id number) is
10211 select count(*)
10212 from ben_prtt_enrt_rslt_f pen
10213 where pen.person_id = p_person_id
10214 and pen.prtt_enrt_rslt_stat_cd is null
10215 and pen.sspndd_flag = 'N'
10216 and pen.ptip_id = p_ptip_id
10217 and pen.comp_lvl_cd not in ('PLANFC', 'PLANIMP')
10218 and ( pen.enrt_cvg_thru_dt = hr_api.g_eot
10219 or ( pen.enrt_cvg_thru_dt >= p_effective_date
10220 and nvl(pen.enrt_ovridn_flag,'N') = 'Y'
10221 )
10222 )
10223 and pen.effective_end_date = hr_api.g_eot
10224 and p_effective_date between pen.effective_start_date
10225 and pen.effective_end_date
10226 and pen.business_group_id = p_business_group_id
10227 ;
10228
10229 cursor c_get_ptip(p_ptip_id number) is
10230 select ptip.ptip_id,
10231 ptip.pgm_id,
10232 ptip.pl_typ_id,
10233 ptip.Mx_ENRD_ALWD_OVRID_NUM,
10234 ptip.no_mx_pl_typ_ovrid_flag,
10235 ptip.MN_ENRD_RQD_OVRID_NUM,
10236 ptip.no_mn_pl_typ_overid_flag,
10237 plt.name,
10238 Plt.MN_ENRL_RQD_NUM,
10239 plt.MX_ENRL_ALWD_NUM
10240 from ben_ptip_f ptip
10241 , ben_pl_typ_f plt
10242 where ptip.ptip_id = p_ptip_id
10243 and ptip.pl_typ_id = plt.pl_typ_id
10244 and ptip.business_group_id = p_business_group_id
10245 and p_effective_date between
10246 ptip.effective_start_date and ptip.effective_end_date
10247 and p_effective_date between
10248 plt.effective_start_date and plt.effective_end_date
10249 ;
10250 --
10251 cursor c_get_ptip_elig(p_ptip_id number
10252 ,p_per_in_ler_id number
10253 ) is
10254 select pep.elig_flag
10255 from ben_elig_per_f pep
10256 where pep.per_in_ler_id = p_per_in_ler_id
10257 and pep.ptip_id = p_ptip_id
10258 and pep.business_group_id = p_business_group_id
10259 and p_effective_date between pep.effective_start_date
10260 and pep.effective_end_date
10261 ;
10262
10263
10264 -- bug 12354919
10265
10266 type epetab is table of ben_elig_per_elctbl_chc.elig_per_elctbl_chc_id%type;
10267 t_epe_tbl epetab;
10268
10269 l_cnt number;
10270
10271 cursor c_epe(p_per_in_ler_id number) is
10272 select epe.elig_per_elctbl_chc_id
10273 from ben_elig_per_elctbl_chc epe
10274 where epe.per_in_ler_id = p_per_in_ler_id
10275 and epe.pil_elctbl_chc_popl_id in
10276 (select pel.pil_elctbl_chc_popl_id
10277 from ben_pil_elctbl_chc_popl pel
10278 where pel.per_in_ler_id = p_per_in_ler_id
10279 and not exists
10280 (select null
10281 from ben_elig_per_elctbl_chc epe2
10282 where pel.pil_elctbl_chc_popl_id=epe2.pil_elctbl_chc_popl_id
10283 and nvl(epe2.in_pndg_wkflow_flag,'N') in ('Y', 'S')));
10284
10285
10286 cursor c_ecr_ch (p_elig_per_elctbl_chc_id number) is
10287 select enrt_rt_id,
10288 elig_per_elctbl_chc_id,
10289 enrt_bnft_id,
10290 object_version_number,
10291 acty_base_rt_id,
10292 null mark_delete
10293 from ben_enrt_rt
10294 where elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id
10295 union
10296 select enrt_rt_id,
10297 elig_per_elctbl_chc_id,
10298 enrt_bnft_id,
10299 object_version_number,
10300 acty_base_rt_id,
10301 null mark_delete
10302 from ben_enrt_rt
10303 where enrt_bnft_id in (select enrt_bnft_id
10304 from ben_enrt_bnft
10305 where elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id
10306 );
10307
10308 -- bug 12354919
10309
10310
10311 l_ptip_rec c_get_ptip%rowtype;
10312 l_count number(15);
10313 l_pep_row ben_derive_part_and_rate_facts.g_cache_structure;
10314 l_chk_min_max varchar2(30);
10315 l_ptip_elig_flag varchar2(30);
10316 l_MN_ENRD_RQD_OVRID_NUM ben_ptip_f.MN_ENRD_RQD_OVRID_NUM%type;
10317 --
10318 -- End Min Max enhancement.
10319 --
10320 l_rec_ptnl_ler_for_per_id number;
10321 l_rec_object_version_number number;
10322 --
10323 l_package varchar2(80);
10324 --
10325 l_enb_valrow ben_determine_coverage.ENBValType;
10326 --
10327 l_env ben_env_object.g_global_env_rec_type;
10328 l_comp_obj_tree ben_manage_life_events.g_cache_proc_object_table;
10329 l_par_elig_state ben_comp_obj_filter.g_par_elig_state_rec;
10330 l_comp_obj_tree_row ben_manage_life_events.g_cache_proc_objects_rec;
10331 l_parpepgm_row ben_prtn_elig_f%rowtype;
10332 l_parpeptip_row ben_prtn_elig_f%rowtype;
10333 l_parpeplip_row ben_prtn_elig_f%rowtype;
10334 l_parpepl_row ben_prtn_elig_f%rowtype;
10335 l_paretprpgm_row ben_elig_to_prte_rsn_f%rowtype;
10336 l_paretprptip_row ben_elig_to_prte_rsn_f%rowtype;
10337 l_paretprplip_row ben_elig_to_prte_rsn_f%rowtype;
10338 l_paretprpl_row ben_elig_to_prte_rsn_f%rowtype;
10339 l_currpe_row ben_prtn_elig_f%rowtype;
10340 l_curretpr_row ben_elig_to_prte_rsn_f%rowtype;
10341 l_currpgm_row ben_pgm_f%rowtype;
10342 l_currptip_row ben_ptip_f%rowtype;
10343 l_currplip_row ben_plip_f%rowtype;
10344 l_currpl_row ben_pl_f%rowtype;
10345 l_curroipl_row ben_cobj_cache.g_oipl_inst_row;
10346 l_curroiplip_row ben_cobj_cache.g_oiplip_inst_row;
10347 l_parpgm_row ben_pgm_f%rowtype;
10348 l_parptip_row ben_ptip_f%rowtype;
10349 l_parplip_row ben_plip_f%rowtype;
10350 l_parpl_row ben_pl_f%rowtype;
10351 l_paropt_row ben_cobj_cache.g_opt_inst_row;
10352 l_paroipl_row ben_cobj_cache.g_oipl_inst_row;
10353 l_per_row per_all_people_F%rowtype;
10354 l_pil_row ben_per_in_ler%rowtype;
10355 l_empasg_row per_all_assignments_f%rowtype;
10356 l_benasg_row per_all_assignments_f%rowtype;
10357 l_appasg_row ben_person_object.g_cache_ass_table;
10358 l_empasgast_row per_assignment_status_types%rowtype;
10359 l_benasgast_row per_assignment_status_types%rowtype;
10360 --
10361 l_comp_object_value varchar2(80);
10362 l_comp_object_name varchar2(80);
10363 l_output_string nvarchar2(100);
10364 l_per_grade number := null;
10365 l_per_job number := null;
10366 l_per_per_typ varchar2(30) := null;
10367 l_per_pay_basis_id number := null;
10368 l_per_benfts_grp_id number := null;
10369 l_per_pyrl_id number := null;
10370 l_per_location_id number := null;
10371 l_per_org_id number := null;
10372 l_per_peo_group_id number := null;
10373 l_postal_code varchar2(30) := null;
10374 l_py_freq varchar2(30) := null;
10375 l_normal_hours number := null;
10376 l_frequency varchar2(30) := null;
10377 l_bargaining_unit_code varchar2(30) := null;
10378 l_assignment_status_type_id number := null;
10379 l_change_rsn varchar2(30) := null;
10380 l_gre_cd varchar2(150) := null;
10381 l_enrlt_pl_id number := null;
10382 l_employment_category varchar2(30) := null;
10383 l_prtt_is_cvrd_flag varchar2(30) := null;
10384 l_sspndd_flag varchar2(30) := null;
10385 l_electable_flag varchar2(30) := null;
10386 l_once_r_cntug_cd varchar2(30) := null;
10387 l_elig_flag varchar2(30) := null;
10388 l_elig_per_elctbl_chc_id number :=null;
10389 l_strt_dt date :=null;
10390 l_effective_start_date date;
10391 l_effective_end_date date;
10392 l_loop_count number;
10393 l_commit number;
10394 l_procd_dt date;
10395 l_voidd_dt date;
10396 l_strtd_dt date;
10397 l_pl_id number;
10398 l_cwb_pl_id number;
10399 l_plip_id number;
10400 l_ptip_id number;
10401 l_pgm_id number;
10402 l_oipl_id number;
10403 --
10404 l_newly_elig boolean;
10405 l_newly_inelig boolean;
10406 l_first_elig boolean;
10407 l_first_inelig boolean;
10408 l_still_elig boolean;
10409 l_still_inelig boolean;
10410 l_continue_loop boolean;
10411 l_eligible boolean;
10412 l_not_eligible boolean;
10413 l_elig_state_change boolean := false;
10414 --
10415 l_pl_nip varchar2(30);
10416 --
10417 l_treeele_num pls_integer;
10418 l_maxtreeele_num pls_integer;
10419 l_treeloop boolean;
10420 l_boundary boolean;
10421 l_comp_rec ben_derive_part_and_rate_facts.g_cache_structure;
10422 l_d_comp_rec ben_derive_part_and_rate_facts.g_cache_structure;
10423 l_oiplip_rec ben_derive_part_and_rate_facts.g_cache_structure;
10424 l_d_oiplip_rec ben_derive_part_and_rate_facts.g_cache_structure;
10425 --
10426 l_object_version_number number;
10427 l_perhasmultptus boolean;
10428 l_assignment_id number;
10429 l_pil_elctbl_chc_popl c_pil_elctbl_chc_popl%rowtype;
10430 l_asnd_lf_evt_dt date;
10431 --
10432 l_mode varchar2(1); -- Added by Gopal Venkataraman 3/27/01 bug 1636071.
10433 l_pil varchar2(1);
10434 l_gsp_pgm_id number;
10435 l_gsp_ptip_id number;
10436 l_gsp_plip_id number;
10437 l_gsp_pl_id number;
10438 l_prgr_style varchar2(30);
10439 l_evaluate_eligibility boolean := true;
10440
10441 --
10442 -- FONM : Begin
10443 --
10444 l_rec_enrt_cvg_strt_dt DATE;
10445 l_fonm_cvg_strt_dt DATE;
10446 l_dummy_rt_strt_dt DATE;
10447 l_dummy_rt_strt_dt_cd VARCHAR2(30);
10448 l_dummy_rt_strt_dt_rl NUMBER;
10449 l_dummy_enrt_cvg_end_dt DATE;
10450 l_dummy_enrt_cvg_end_dt_cd VARCHAR2(30);
10451 l_dummy_enrt_cvg_end_dt_rl NUMBER;
10452 l_dummy_rt_end_dt DATE;
10453 l_dummy_rt_end_dt_cd VARCHAR2(30);
10454 l_dummy_rt_end_dt_rl NUMBER;
10455 l_dummy_enrt_cvg_strt_dt_cd VARCHAR2(30);
10456 l_dummy_enrt_cvg_strt_dt_rl NUMBER;
10457 l_rec_lee_rsn_id NUMBER;
10458 l_rec_enrt_perd_id NUMBER;
10459 l_dummy VARCHAR2(30);
10460
10461 l_old_data_migrator_mode varchar2(1) ;-- irec2
10462
10463 -- to get the le_resn id
10464 cursor c_lee_rsn(c_pl_id number ,
10465 c_pgm_id number,
10466 c_effective_date date) is
10467 select 1 ordr_num ,
10468 leer.lee_rsn_id,
10469 NVL(leer.defer_deenrol_flag,'N')
10470 FROM ben_lee_rsn_f leer, ben_popl_enrt_typ_cycl_f petc
10471 WHERE leer.ler_id = p_ler_id
10472 AND leer.business_group_id = p_business_group_id
10473 AND c_effective_date BETWEEN leer.effective_start_date
10474 AND leer.effective_end_date
10475 AND leer.popl_enrt_typ_cycl_id = petc.popl_enrt_typ_cycl_id
10476 AND petc.pl_id = c_pl_id
10477 AND petc.enrt_typ_cycl_cd = 'L' -- life event
10478 AND petc.business_group_id = p_business_group_id
10479 AND c_effective_date BETWEEN petc.effective_start_date
10480 AND petc.effective_end_date
10481 UNION
10482 select 2 ordr_num ,
10483 leer.lee_rsn_id,
10484 NVL(leer.defer_deenrol_flag,'N')
10485 FROM ben_lee_rsn_f leer, ben_popl_enrt_typ_cycl_f petc
10486 WHERE leer.ler_id = p_ler_id
10487 AND leer.business_group_id = p_business_group_id
10488 AND c_effective_date BETWEEN leer.effective_start_date
10489 AND leer.effective_end_date
10490 AND leer.popl_enrt_typ_cycl_id = petc.popl_enrt_typ_cycl_id
10491 AND petc.pgm_id = c_pgm_id
10492 AND petc.enrt_typ_cycl_cd = 'L' -- life event
10493 AND petc.business_group_id = p_business_group_id
10494 AND c_effective_date BETWEEN petc.effective_start_date
10495 AND petc.effective_end_date
10496 order by 1 ;
10497
10498 -- to get the enrol_period id
10499 cursor c_enrt_perd_id (c_pl_id number ,
10500 c_pgm_id number,
10501 c_effective_date date) is
10502 select 1 ordr_num ,
10503 enrtp.enrt_perd_id,
10504 NVL(enrtp.defer_deenrol_flag,'N')
10505 FROM ben_popl_enrt_typ_cycl_f petc,
10506 ben_enrt_perd enrtp,
10507 ben_ler_f ler
10508 WHERE petc.pl_id = c_pl_id
10509 AND petc.business_group_id = p_business_group_id
10510 AND c_effective_date BETWEEN petc.effective_start_date
10511 AND petc.effective_end_date
10512 AND petc.enrt_typ_cycl_cd <> 'L'
10513 AND enrtp.business_group_id = p_business_group_id
10514 AND enrtp.asnd_lf_evt_dt = c_effective_date
10515 AND enrtp.popl_enrt_typ_cycl_id = petc.popl_enrt_typ_cycl_id
10516 -- comp work bench changes
10517 and ler.ler_id (+) = enrtp.ler_id
10518 and ler.ler_id (+) = p_ler_id
10519 and c_effective_date between ler.effective_start_date (+)
10520 and ler.effective_end_date (+)
10521 UNION
10522 select 2 ordr_num ,
10523 enrtp.enrt_perd_id,
10524 NVL(enrtp.defer_deenrol_flag,'N')
10525 FROM ben_popl_enrt_typ_cycl_f petc,
10526 ben_enrt_perd enrtp,
10527 ben_ler_f ler
10528 WHERE petc.pgm_id = c_pgm_id
10529 AND petc.business_group_id = p_business_group_id
10530 AND c_effective_date BETWEEN petc.effective_start_date
10531 AND petc.effective_end_date
10532 AND petc.enrt_typ_cycl_cd <> 'L'
10533 AND enrtp.business_group_id = p_business_group_id
10534 AND enrtp.asnd_lf_evt_dt = c_effective_date
10535 AND enrtp.popl_enrt_typ_cycl_id = petc.popl_enrt_typ_cycl_id
10536 -- comp work bench changes
10537 and ler.ler_id (+) = enrtp.ler_id
10538 and ler.ler_id (+) = p_ler_id
10539 and c_effective_date between ler.effective_start_date (+)
10540 and ler.effective_end_date (+)
10541 order by 1 ;
10542 -- bug 6491682
10543 -- cursor to fetch per_in_ler_id in mode S (MPE conc program)
10544
10545 cursor c_get_unres_per_in_ler is
10546 select pil.per_in_ler_id
10547 from ben_per_in_ler pil,
10548 ben_ler_f ler
10549 where pil.person_id = p_person_id
10550 and pil.business_group_id = p_business_group_id
10551 and ler.ler_id = pil.ler_id
10552 and ler.business_group_id = pil.business_group_id
10553 and p_effective_date
10554 between ler.effective_start_date
10555 and ler.effective_end_date
10556 and pil.per_in_ler_stat_cd = 'STRTD'
10557 and ler.typ_cd = 'SCHEDDU';
10558
10559 l_get_unres_per_in_ler c_get_unres_per_in_ler%ROWTYPE;
10560
10561 -- bug 6491682
10562
10563 --
10564 l_last_ptip_id number ;
10565 l_pgm_fonm varchar2(1) ;
10566 l_ptip_fonm varchar2(1) ;
10567 -- FONM : End
10568
10569 --
10570 -- GSP Rate Sync
10571 l_gsp_emp_step_id number(30);
10572 l_gsp_num_incr number(30);
10573 l_gsp_oipl_id number(30);
10574 l_gsp_oiplip_id number(30);
10575 l_gsp_opt_id number(30);
10576 --
10577 cursor c_get_oiplip_opt_id (cv_oipl_id number,
10578 cv_plip_id number) is
10579 select opp.oiplip_id, opt_id
10580 from ben_oiplip_f opp, ben_oipl_f cop
10581 where opp.oipl_id = cv_oipl_id
10582 and opp.plip_id = cv_plip_id
10583 and p_effective_date between opp.effective_start_date and opp.effective_end_date
10584 and cop.oipl_id = opp.oipl_id
10585 and p_effective_date between cop.effective_start_date and cop.effective_end_date;
10586 -- GSP Rate Sync
10587 --
10588 -- Defer ENH.
10589 cursor c_pel_defer(p_pgm_id number,p_per_in_ler_id in number) is
10590 select pel.*
10591 from ben_pil_elctbl_chc_popl pel
10592 where pel.pgm_id = p_pgm_id
10593 and pel.pl_id is null
10594 and pel.pil_elctbl_popl_stat_cd not in ('VOIDD','BCKDT')
10595 and pel.per_in_ler_id = p_per_in_ler_id;
10596 --
10597 l_pel_defer c_pel_defer%ROWTYPE;
10598 --
10599 cursor c_pel_pnip_defer (p_pl_id number,p_per_in_ler_id in number) is
10600 --
10601 select pel.*
10602 from ben_pil_elctbl_chc_popl pel
10603 where pel.pl_id = p_pl_id
10604 and pel.pgm_id is null
10605 and pel.pil_elctbl_popl_stat_cd not in ('VOIDD','BCKDT')
10606 and pel.per_in_ler_id = p_per_in_ler_id;
10607 --
10608 l_pel_pnip_defer c_pel_pnip_defer%ROWTYPE;
10609 l_defer_popl_id NUMBER;
10610 l_defer_popl_ovn NUMBER;
10611
10612 type l_defer_deenrl_rec is record
10613 (pl_id ben_pl_f.pl_id%type
10614 ,pgm_id ben_pgm_f.pgm_id%type
10615 ,chc_exists boolean
10616 ,newly_inelig_exists boolean
10617 );
10618
10619 type l_defer_deenrl_table is table of l_defer_deenrl_rec
10620 index by binary_integer;
10621
10622 l_defer_deenrl_tbl l_defer_deenrl_table;
10623 l_defer_count number := 0;
10624
10625 --
10626 -- Defer ENH.
10627 begin
10628 --
10629 g_debug := hr_utility.debug_enabled;
10630 if g_debug then
10631 l_package :=g_package||'.process_comp_objects';
10632 hr_utility.set_location ('Entering '||l_package,10);
10633 end if;
10634 --
10635 -- Start - Added by Gopal Venkataraman 3/27/01 bug 1636071
10636 -- also changed all following p_mode to l_mode.
10637 l_mode := nvl(ben_manage_life_events.g_modified_mode,p_mode);
10638 l_defer_deenrl_tbl.delete;
10639 -- End
10640 --Bug 12732878 ud changes start
10641 --Clearing the cache for every benmngle run
10642 ben_determine_eligibility2.g_cache_first_elig_object.delete;
10643 ben_determine_eligibility2.g_cache_first_inelig_object.delete;
10644 -- Bug 12732878 ud changs end
10645
10646 dbms_session.free_unused_user_memory;
10647 --
10648 -- ben_prtt_enrt_result_api.g_enrollment_change := FALSE; -- VP 11/08/00
10649 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
10650 if l_mode not in ('A','P','S','T') then
10651 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
10652 if g_debug then
10653 hr_utility.set_location('mode'||l_mode,11);
10654 end if;
10655 --
10656 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
10657 if (l_mode = 'U'or l_mode = 'R' or l_mode = 'D') then
10658 --
10659 if l_mode <> 'D' then
10660 benutils.get_active_life_event
10661 (p_person_id => p_person_id,
10662 p_business_group_id => p_business_group_id,
10663 p_effective_date => p_effective_date,
10664 p_lf_event_mode => 'U',
10665 p_rec => l_rec);
10666 --
10667 else
10668 --
10669 benutils.get_active_life_event
10670 (p_person_id => p_person_id,
10671 p_business_group_id => p_business_group_id,
10672 p_effective_date => p_effective_date,
10673 p_lf_event_mode => 'D',
10674 p_rec => l_rec);
10675 --
10676 end if;
10677 --
10678 benutils.get_active_life_event
10679 (p_person_id => p_person_id,
10680 p_business_group_id => p_business_group_id,
10681 p_effective_date => p_effective_date,
10682 p_rec => l_lf_rec);
10683
10684 --
10685 else
10686 --
10687 -- CWB Changes .
10688 --
10689 if l_mode = 'W' then
10690 --
10691 benutils.get_active_life_event
10692 (p_person_id => p_person_id,
10693 p_business_group_id => p_business_group_id,
10694 p_effective_date => p_effective_date,
10695 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
10696 p_ler_id => p_ler_id,
10697 p_rec => l_rec);
10698 --
10699 elsif l_mode = 'G' then
10700 --
10701 benutils.get_active_life_event
10702 (p_person_id => p_person_id,
10703 p_business_group_id => p_business_group_id,
10704 p_effective_date => p_effective_date,
10705 p_lf_event_mode => 'G',
10706 p_rec => l_rec);
10707 --
10708 elsif l_mode = 'M' then
10709 --
10710 benutils.get_active_life_event
10711 (p_person_id => p_person_id,
10712 p_business_group_id => p_business_group_id,
10713 p_effective_date => p_effective_date,
10714 p_lf_event_mode => 'M',
10715 p_rec => l_rec);
10716 --
10717 elsif l_mode = 'I' then
10718 --
10719 -- iRec
10720 benutils.get_active_life_event
10721 (p_person_id => p_person_id,
10722 p_business_group_id => p_business_group_id,
10723 p_effective_date => p_effective_date,
10724 p_lf_event_mode => 'I',
10725 p_rec => l_rec);
10726 --
10727 else
10728 --
10729 benutils.get_active_life_event
10730 (p_person_id => p_person_id,
10731 p_business_group_id => p_business_group_id,
10732 p_effective_date => p_effective_date,
10733 p_rec => l_rec);
10734 --
10735 end if;
10736 --
10737 end if;
10738 if g_debug then
10739 hr_utility.set_location('Current OVN '||l_rec.object_version_number,10);
10740 hr_utility.set_location('lf evt date '||l_rec.lf_evt_ocrd_dt,11);
10741 end if;
10742 end if;
10743 --
10744 -- Setup environment for person being processed.
10745 --
10746 if g_debug then
10747 hr_utility.set_location (l_package||' Set env ',20);
10748 end if;
10749 ben_env_object.setenv(p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt);
10750 --
10751 -- Clear eligibility caches
10752 --
10753 ben_pep_cache.clear_down_cache;
10754 ben_epe_cache.clear_down_cache;
10755 --
10756 dt_fndate.change_ses_date
10757 (p_ses_date => nvl(l_rec.lf_evt_ocrd_dt,p_effective_date)
10758 ,p_commit => l_commit
10759 );
10760 --
10761 -- Get environment values
10762 --
10763 ben_env_object.get
10764 (p_rec => l_env
10765 );
10766 --
10767 -- Get person info
10768 --
10769 ben_person_object.get_object
10770 (p_person_id => p_person_id
10771 ,p_rec => l_per_row
10772 );
10773 --
10774 ben_person_object.get_object
10775 (p_person_id => p_person_id
10776 ,p_rec => l_empasg_row
10777 );
10778 --
10779 if l_empasg_row.assignment_id is not null then
10780 --
10781 ben_person_object.get_object
10782 (p_assignment_status_type_id => l_empasg_row.assignment_status_type_id
10783 ,p_rec => l_empasgast_row
10784 );
10785 --
10786 end if;
10787 --
10788 ben_person_object.get_benass_object
10789 (p_person_id => p_person_id
10790 ,p_rec => l_benasg_row
10791 );
10792 --
10793 if l_benasg_row.assignment_id is not null then
10794 --
10795 ben_person_object.get_object
10796 (p_assignment_status_type_id => l_benasg_row.assignment_status_type_id
10797 ,p_rec => l_benasgast_row
10798 );
10799 --
10800 end if;
10801 --
10802 -- If benefit assignment not found, get applicant assignment.
10803 --
10804 if l_benasg_row.assignment_id is null then
10805 --
10806 ben_person_object.get_object
10807 (p_person_id => p_person_id
10808 ,p_rec => l_appasg_row
10809 );
10810 --
10811 end if;
10812 -- bug 6491682
10813
10814 if l_mode = 'S' then
10815
10816 open c_get_unres_per_in_ler;
10817 fetch c_get_unres_per_in_ler into l_get_unres_per_in_ler;
10818 close c_get_unres_per_in_ler;
10819
10820 end if;
10821
10822 -- bug 6491682
10823 --
10824 -- Fixes WWBUG 1412808.
10825 -- In case a backout has occurred that uses communications we need to
10826 -- reset the cache for ther person life event object
10827 --
10828 ben_person_object.g_cache_last_pil_rec := l_pil_row;
10829 ben_person_object.g_cache_pil_rec.delete;
10830 --
10831 -- bug 6491682 - For mode S, passed the per_in_ler_id derived by cursor c_get_unres_per_in_ler
10832
10833 if l_mode = 'S' then
10834
10835 ben_person_object.get_object
10836 (p_person_id => p_person_id
10837 -- unrestricted change
10838 ,p_per_in_ler_id => l_get_unres_per_in_ler.per_in_ler_id
10839 ,p_rec => l_pil_row
10840 );
10841
10842 else
10843 ben_person_object.get_object
10844 (p_person_id => p_person_id
10845 -- unrestricted change
10846 ,p_per_in_ler_id =>l_rec.per_in_ler_id
10847 ,p_rec => l_pil_row
10848 );
10849 end if;
10850 --
10851 if g_debug then
10852 hr_utility.set_location ('Life event occured datee'||l_pil_row.lf_evt_ocrd_dt,11);
10853 end if;
10854 -- Assign comp object cache to a local variable
10855 --
10856 l_comp_obj_tree := g_cache_proc_object;
10857 --
10858 -- Flush duplicate ptip list
10859 --
10860 ben_comp_obj_filter.flush_dupproc_ptip_list;
10861 --
10862 l_treeele_num := l_comp_obj_tree.first;
10863 l_treeloop := TRUE;
10864 l_maxtreeele_num := l_comp_obj_tree.last;
10865 --
10866 -- If we are running in temporal mode then we may only want to
10867 -- create certain temporal events so set the temporal ler id we
10868 -- want to test
10869 --
10870 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
10871 --
10872 ben_derive_part_and_rate_facts.g_no_ptnl_ler_id := null ;
10873 --
10874 if l_mode = 'T' then
10875 --
10876 ben_derive_part_and_rate_facts.g_temp_ler_id := p_ler_id;
10877 --
10878 else
10879 --
10880 --For unrestricted enrollment we dont want to trigger the pdpar potentials
10881 --Also don't trigger potentials for the following modes
10882 --
10883 if l_mode in ('U','W','M','I','P','A','D') then
10884 ben_derive_part_and_rate_facts.g_no_ptnl_ler_id := p_ler_id ;
10885 end if;
10886 --
10887 -- Globals are kept for a session so reset the global in the package
10888 --
10889 ben_derive_part_and_rate_facts.g_temp_ler_id := null;
10890 --
10891 end if;
10892 --
10893 --GSP: do not need to evaluate eligibility for entire comp object list
10894 --
10895 if l_mode ='G' then
10896 /* GSP Rate Sync
10897 * The following function fetches current Grade Ladder and Grade for a person being processed
10898 * If the person does not have any assigned grade ladder or grade, then default grade ladder and grade
10899 * for the business group are returned. In case of GSP Rate Sync, always current (assigned) Grade Ladder and Grade
10900 * will be returned because GSP Rate Sync process will reach here only if person has GSP Prog processed once
10901 * in the past.
10902 */
10903 get_grade_step_placement
10904 (p_person_id => p_person_id,
10905 p_assignment_id => l_empasg_row.assignment_id,
10906 p_business_group_id => p_business_group_id,
10907 p_effective_date => p_effective_date,
10908 p_gsp_pgm_id => l_gsp_pgm_id,
10909 p_gsp_plip_id => l_gsp_plip_id,
10910 p_gsp_oipl_id => l_gsp_oipl_id,
10911 p_prgr_style => l_prgr_style,
10912 p_gsp_emp_step_id => l_gsp_emp_step_id,
10913 p_gsp_num_incr => l_gsp_num_incr);
10914 /*
10915 pqh_gsp_post_process.get_persons_gl_and_grade
10916 (p_person_id => p_person_id,
10917 p_business_group_id => p_business_group_id,
10918 p_effective_date => p_effective_date,
10919 p_persons_pgm_id => l_gsp_pgm_id,
10920 p_persons_plip_id => l_gsp_plip_id,
10921 p_prog_style => l_prgr_style);
10922 */
10923 if g_debug then
10924 hr_utility.set_location('p_persons_pgm_id :'||l_gsp_pgm_id,20);
10925 hr_utility.set_location('p_persons_plip_id :'||l_gsp_plip_id,20);
10926 hr_utility.set_location('p_prog_style :'||l_prgr_style,20);
10927 hr_utility.set_location('l_gsp_oipl_id :' || l_gsp_oipl_id,20);
10928 end if;
10929 --
10930 -- no grade ladder defined (or) no grade, then skip the person
10931 --
10932 if l_gsp_pgm_id is null or
10933 l_gsp_plip_id is null
10934 then
10935 hr_utility.set_location('Current GSP Grade Ladder / Grade / PLIP for person not found', 15);
10936 fnd_message.set_name('BEN','BEN_94094_PERSON_GRADE_NOT_FND');
10937 raise g_record_error;
10938 elsif l_prgr_style not in ('PQH_GSP_GP') and l_gsp_oipl_id is null /* Bug 3964719 */
10939 then
10940 hr_utility.set_location('Current GSP OIPL for person not found', 15);
10941 fnd_message.set_name('BEN','BEN_94095_PERSON_STEP_NOT_FND');
10942 raise g_record_error;
10943 end if;
10944 --
10945 open c_ptip_pl_id(l_gsp_pgm_id,l_gsp_plip_id);
10946 fetch c_ptip_pl_id into l_gsp_ptip_id,l_gsp_pl_id;
10947 close c_ptip_pl_id;
10948 --
10949 if l_prgr_style not in ('PQH_GSP_GP')
10950 then
10951 --
10952 open c_get_oiplip_opt_id(l_gsp_plip_id,l_gsp_oipl_id );
10953 fetch c_get_oiplip_opt_id into l_gsp_oiplip_id, l_gsp_opt_id;
10954 close c_get_oiplip_opt_id;
10955 --
10956 end if;
10957 --
10958 /*
10959 * The following call will populate G_CACHE_PROC_OBJECT with the PGM_ID, PL_ID, PLIP_ID and OIPL_ID records
10960 * corresponding to the current Grade / Step Placement of the person.
10961 */
10962 if p_lf_evt_oper_cd = 'SYNC'
10963 then
10964 --
10965 ben_comp_object_list.build_gsp_rate_sync_coobj_list
10966 (p_effective_date => p_effective_date
10967 ,p_business_group_id => p_business_group_id
10968 ,p_pgm_id => l_gsp_pgm_id
10969 ,p_pl_id => l_gsp_pl_id
10970 ,p_opt_id => l_gsp_opt_id
10971 ,p_plip_id => l_gsp_plip_id
10972 ,p_ptip_id => l_gsp_ptip_id
10973 ,p_oipl_id => l_gsp_oipl_id
10974 ,p_oiplip_id => l_gsp_oiplip_id
10975 ,p_person_id => p_person_id
10976 ) ;
10977 --
10978 l_comp_obj_tree := g_cache_proc_object;
10979 l_treeele_num := l_comp_obj_tree.first;
10980 l_treeloop := TRUE;
10981 l_maxtreeele_num := l_comp_obj_tree.last;
10982 --
10983 end if;
10984 --
10985 end if;
10986 --
10987 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
10988 fnd_message.set_token('PROC','BEN_CARRY_FORWARD_ITEMS');
10989 --
10990 -- If the event is staying open, then delete the suspended enrollments
10991 -- and action items
10992 --
10993 if l_mode = 'L' or l_mode = 'C' then
10994 if p_ler_id is not null then
10995 --
10996 ben_carry_forward_items.main
10997 (p_effective_date => p_effective_date
10998 ,p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
10999 ,p_per_in_ler_id => l_rec.per_in_ler_id
11000 ,p_ler_id => p_ler_id
11001 ,p_business_group_id => p_business_group_id
11002 ,p_person_id => p_person_id);
11003 --
11004 end if;
11005 end if;
11006 --
11007 loop
11008 if g_debug then
11009 hr_utility.set_location (l_package||' Start Proc loop ',20);
11010 end if;
11011 --
11012 -- Comp object filtering. Navigate to the next comp object to be processed
11013 -- We do not need to filter in temporal mode because we do not check
11014 -- eligibility.
11015 --
11016 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
11017 if l_mode <> 'T' then
11018 --
11019 if g_debug then
11020 hr_utility.set_location (l_package||' Filtering ',20);
11021 end if;
11022 -- Bug#1900657
11023 if l_mode in ('U','D') then
11024 if l_lf_rec.per_in_ler_id is not null then
11025 loop
11026 --
11027 open c_pil(l_lf_rec.per_in_ler_id,
11028 l_comp_obj_tree(l_treeele_num).par_pgm_id,
11029 l_comp_obj_tree(l_treeele_num).par_pl_id);
11030 fetch c_pil into l_pil;
11031 if c_pil%found then
11032 close c_pil;
11033 if l_treeele_num = l_maxtreeele_num then
11034 --
11035 l_treeloop := FALSE;
11036 exit;
11037 --
11038 else
11039 --
11040 l_treeele_num := l_treeele_num+1;
11041 --
11042 end if;
11043 --
11044 else
11045 close c_pil;
11046 exit;
11047 end if;
11048 --
11049 end loop;
11050 --
11051 end if;
11052 --
11053 end if;
11054 --
11055 if not l_treeloop then
11056 exit;
11057 end if;
11058 --
11059 -- GLOBALCWB : Bug 4214845 : All comp objects must be processed, in
11060 -- cwb mode as data have to be created with elig flag = N in case of in-eligibility.
11061 --
11062 --Bug 12715758 sending p_effective_date instead of nvl(l_rec.lf_evt_ocrd_dt,p_effective_date)
11063 -- as we are determining the l_rec.lf_evt_ocrd_dt in
11064 -- filter_comp_objects and we need p_effective_date to determine
11065 -- fonm dates in filter_comp_objects for every comp object.
11066 if l_mode <> 'W' then
11067 --
11068 ben_comp_obj_filter.filter_comp_objects
11069 (p_comp_obj_tree => l_comp_obj_tree
11070 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
11071 ,p_mode => l_mode
11072 ,p_person_id => p_person_id
11073 -- ,p_effective_date => nvl(l_rec.lf_evt_ocrd_dt,p_effective_date) -- Bug 12715758 commmented
11074 ,p_effective_date => p_effective_date --Bug 12715758
11075 ,p_maxtreeele_num => l_maxtreeele_num
11076 --
11077 ,p_par_elig_state => l_par_elig_state
11078 ,p_treeele_num => l_treeele_num
11079 --
11080 ,p_treeloop => l_treeloop
11081 ,p_ler_id => p_ler_id
11082 -- PB : 5422 :
11083 ,p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt
11084 -- ,p_popl_enrt_typ_cycl_id => p_popl_enrt_typ_cycl_id
11085 ,p_business_group_id => p_business_group_id
11086 );
11087 --
11088 end if;
11089 if g_debug then
11090 hr_utility.set_location (l_package||' Dn Filtering ',20);
11091 end if;
11092 --
11093 end if;
11094 --
11095 -- Check if the end of the comp object list was reached
11096 -- otherwise refresh environment globals. These globals
11097 -- are referenced in BENDETE2.
11098 --
11099 if not l_treeloop then
11100 --
11101 exit;
11102 --
11103 else
11104 --
11105 -- Reset locals to new tree location values
11106 --
11107 l_pgm_id := l_comp_obj_tree(l_treeele_num).pgm_id;
11108 l_ptip_id := l_comp_obj_tree(l_treeele_num).ptip_id;
11109 l_plip_id := l_comp_obj_tree(l_treeele_num).plip_id;
11110 l_pl_id := l_comp_obj_tree(l_treeele_num).pl_id;
11111 l_oipl_id := l_comp_obj_tree(l_treeele_num).oipl_id;
11112 l_pl_nip := l_comp_obj_tree(l_treeele_num).pl_nip;
11113 l_comp_obj_tree_row := l_comp_obj_tree(l_treeele_num);
11114 --
11115 end if;
11116 --
11117
11118 -- bof FONM Determine whther the pgm/pl set for FONM
11119
11120 if g_debug then
11121 hr_utility.set_location ('OIpl Id '||l_oipl_id,31);
11122 hr_utility.set_location (' l_pl_nip ' || l_pl_nip,30);
11123 hr_utility.set_location (' g_last_pgm_id ' || g_last_pgm_id,30);
11124 hr_utility.set_location (' l_last_ptip_id ' || l_last_ptip_id,30);
11125 hr_utility.set_location (' pgm ' ||l_comp_obj_tree(l_treeele_num).par_pgm_id ,30);
11126 hr_utility.set_location (' ptip ' ||l_comp_obj_tree(l_treeele_num).par_ptip_id ,30);
11127 hr_utility.set_location (' pl ' ||l_comp_obj_tree(l_treeele_num).par_pl_id ,30);
11128 hr_utility.set_location (' plip ' ||l_comp_obj_tree(l_treeele_num).par_plip_id ,30);
11129 hr_utility.set_location ('Old fonm ' ||ben_manage_life_events.fonm ,30);
11130 hr_utility.set_location ('Old pgm fonm ' || l_pgm_fonm ,30);
11131 hr_utility.set_location ('Old ptip fonm ' || l_ptip_fonm ,30);
11132 end if;
11133 -- FONM II
11134 if l_pl_nip = 'Y'
11135 -- whne the new program
11136 or ( nvl(g_last_pgm_id,-1) <> l_comp_obj_tree(l_treeele_num).par_pgm_id )
11137 -- if the pgm level fonm determined as no then dont look below
11138 -- and if there is ptip then look @ ptip , there can be one ptip fonm other non fonm
11139 -- that case pgm is allways FONM
11140 or ( nvl(g_last_pgm_id,-1) = l_comp_obj_tree(l_treeele_num).par_pgm_id and
11141 l_pgm_fonm = 'Y' and l_ptip_fonm is null
11142 )
11143 -- new ptip
11144 -- when the pgm is fonm then validate for ptip fonm
11145 or ( l_pgm_fonm = 'Y' and
11146 ( l_ptip_fonm = 'Y' or nvl(l_last_ptip_id,-1) <> l_comp_obj_tree(l_treeele_num).par_ptip_id
11147 )
11148 )
11149 or ben_manage_life_events.fonm is null then
11150
11151 hr_utility.set_location (' calling fonm status ' ,30);
11152 ben_use_cvg_rt_date.get_csd_rsd_Status
11153 (p_pgm_id => l_comp_obj_tree(l_treeele_num).par_pgm_id
11154 ,p_ptip_id => l_comp_obj_tree(l_treeele_num).par_ptip_id
11155 ,p_plip_id => l_comp_obj_tree(l_treeele_num).par_plip_id
11156 ,p_pl_id => l_comp_obj_tree(l_treeele_num).par_pl_id
11157 ,p_effective_date => p_effective_date
11158 ,p_status => ben_manage_life_events.fonm
11159 ) ;
11160 hr_utility.set_location (' fonm ' ||ben_manage_life_events.fonm ,30);
11161 end if ;
11162 -- eof FONM
11163
11164 -- Set up environment for retrieval of comp object information
11165 --
11166 if l_pl_nip = 'Y' then
11167 --
11168 g_last_pgm_id := null;
11169 --
11170 elsif l_comp_obj_tree(l_treeele_num).par_pgm_id is not null then
11171 --
11172 g_last_pgm_id := l_comp_obj_tree(l_treeele_num).par_pgm_id;
11173
11174 hr_utility.set_location (' fonm ptip ' || l_comp_obj_tree(l_treeele_num).par_ptip_id ,30);
11175
11176 if l_comp_obj_tree(l_treeele_num).par_ptip_id is not null then
11177 l_last_ptip_id := l_comp_obj_tree(l_treeele_num).par_ptip_id ;
11178 hr_utility.set_location (' fonm plip ' ||l_comp_obj_tree(l_treeele_num).par_plip_id ,30);
11179 -- if the plip is null then the fonm for ptio
11180 if l_comp_obj_tree(l_treeele_num).par_plip_id is null then
11181
11182 l_ptip_fonm := ben_manage_life_events.fonm ;
11183 end if ;
11184 else
11185 l_pgm_fonm := ben_manage_life_events.fonm ;
11186 l_ptip_fonm := null ;
11187 end if ;
11188 --
11189 end if;
11190 --
11191 -- Check if the audit log flag is on
11192 --
11193 if g_debug then
11194 hr_utility.set_location (l_package||' get_comp_object_name ',30);
11195 end if;
11196 if l_env.audit_log_flag = 'Y' then
11197 --
11198 get_comp_object_name
11199 (p_oipl_id => l_oipl_id
11200 ,p_pgm_id => l_pgm_id
11201 ,p_pl_id => l_pl_id
11202 ,p_plip_id => l_plip_id
11203 ,p_ptip_id => l_ptip_id
11204 ,p_pl_nip => l_pl_nip
11205 ,p_comp_object_name => l_comp_object_name
11206 ,p_comp_object_value => l_comp_object_value
11207 );
11208 --
11209 g_output_string := rpad(l_comp_object_value,21,' ')||rpad(l_comp_object_name,30,' ');
11210 end if;
11211
11212 l_evaluate_eligibility := true;
11213
11214 if l_mode ='G' then
11215
11216 /* l_evaluate_eligibility := (l_comp_obj_tree_row.par_pgm_id = l_gsp_pgm_id)
11217 and
11218 ( (nvl(l_prgr_style,'PQH_GSP_SP') <> 'PQH_GSP_SP')
11219 or ( l_comp_obj_tree_row.par_ptip_id = l_gsp_ptip_id
11220 and nvl(l_comp_obj_tree_row.par_plip_id,l_gsp_plip_id) = l_gsp_plip_id
11221 and nvl(l_comp_obj_tree_row.par_pl_id,l_gsp_pl_id) = l_gsp_pl_id
11222 )
11223 );
11224 */
11225 l_evaluate_eligibility := ( (nvl(l_prgr_style,'PQH_GSP_SP') = 'PQH_GSP_SP' )
11226 and
11227 ( l_comp_obj_tree_row.par_pgm_id = l_gsp_pgm_id
11228 and nvl(l_comp_obj_tree_row.par_ptip_id,l_gsp_ptip_id) = l_gsp_ptip_id
11229 and nvl(l_comp_obj_tree_row.par_plip_id,l_gsp_plip_id) = l_gsp_plip_id
11230 and nvl(l_comp_obj_tree_row.par_pl_id,l_gsp_pl_id) = l_gsp_pl_id )
11231 or
11232 ( nvl(l_prgr_style,'PQH_GSP_SP') <> 'PQH_GSP_SP' )
11233 and ( l_comp_obj_tree_row.par_pgm_id = l_gsp_pgm_id )
11234 );
11235
11236 if g_debug then
11237 if l_evaluate_eligibility then
11238 hr_utility.set_location('Processing '||l_comp_obj_tree_row.par_pgm_id||','||l_comp_obj_tree_row.par_ptip_id||','||l_comp_obj_tree_row.par_plip_id||','||l_comp_obj_tree_row.par_pl_id||','||l_oipl_id,80);
11239 else
11240 hr_utility.set_location('Skipping '||l_comp_obj_tree_row.par_pgm_id||','||l_comp_obj_tree_row.par_ptip_id||','||l_comp_obj_tree_row.par_plip_id||','||l_comp_obj_tree_row.par_pl_id||','||l_oipl_id,80);
11241 end if;
11242 end if;
11243
11244 end if;
11245
11246 /* GSP Rate Sync */
11247 if p_mode = 'G' and p_lf_evt_oper_cd = 'SYNC' and p_gsp_eval_elig_flag = 'N'
11248 then
11249 --
11250 /* GSP Rate Sync :
11251 * If Evaluate Eligibility is No, then do not go through evaluate eligibility process
11252 * If Evaluate Eligibility is Yes, then through evaluate eligibility process for current
11253 * grade ladder, grade and step
11254 * Make a call to PQHGSP package, that will create electable choices and rates.
11255 */
11256 hr_utility.set_location('GSP Rate Sync Do Not Evaluate Eligibility', 45);
11257 hr_utility.set_location('GSPRS p_effective_date = ' || p_effective_date, 45);
11258 hr_utility.set_location('GSPRS l_pil_row.per_in_ler_id = ' || l_pil_row.per_in_ler_id, 45);
11259 hr_utility.set_location('GSPRS p_person_id = ' || p_person_id, 45);
11260 hr_utility.set_location('GSPRS l_empasg_row.assignment_id = ' || l_empasg_row.assignment_id, 45);
11261 --
11262
11263 -- This procedure will create Electable Choices and Rates
11264 pqh_gsp_post_process.gsp_rate_sync
11265 (p_effective_date => p_effective_date
11266 ,p_per_in_ler_id => l_pil_row.per_in_ler_id
11267 ,p_person_id => p_person_id
11268 ,p_assignment_id => l_empasg_row.assignment_id
11269 );
11270
11271 -- This procedure will update salary if at all new salary has changed from current salary
11272 pqh_gsp_post_process.update_rate_sync_salary
11273 (p_per_in_ler_id => l_pil_row.per_in_ler_id
11274 ,p_effective_date => p_effective_date
11275 );
11276
11277 --
11278 p_person_count := p_person_count +1;
11279 --
11280 g_action_rec.person_action_id := p_person_action_id;
11281 g_action_rec.action_status_cd := 'P';
11282 g_action_rec.ler_id := p_ler_id;
11283 g_action_rec.object_version_number := p_object_version_number;
11284 g_action_rec.effective_date := p_effective_date;
11285 --
11286 benutils.write(p_rec => g_action_rec);
11287 --
11288 return;
11289 --
11290 elsif l_evaluate_eligibility
11291 then
11292
11293 --
11294 -- Set up participation eligibility
11295 --
11296 if g_debug then
11297 hr_utility.set_location (l_package||' Set Part Elig ',80);
11298 end if;
11299 --
11300 -- Set up comp object context rows
11301 --
11302 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
11303 if l_mode <> 'T' then
11304 --
11305 set_up_cobj_part_elig
11306 (p_comp_obj_tree_row => l_comp_obj_tree_row
11307 ,p_ler_id => p_ler_id
11308 ,p_business_group_id => p_business_group_id
11309 -- Bug 3087889 Passing lf_evt_ocrd_dt
11310 ,p_effective_date => nvl(l_rec.lf_evt_ocrd_dt,p_effective_date)
11311 -- End of Bug 3087889
11312 );
11313 --
11314 end if;
11315 --
11316 if l_mode in ('L', 'C', 'A') then
11317 --
11318 g_defer_deenrol_flag := 'N';
11319 --
11320 if l_mode in ('L') then
11321
11322 open c_lee_rsn(c_pl_id => l_comp_obj_tree(l_treeele_num).par_pl_id,
11323 c_pgm_id=> l_comp_obj_tree(l_treeele_num).par_pgm_id,
11324 c_effective_date => nvl(l_rec.lf_evt_ocrd_dt, p_effective_date)
11325 ) ;
11326 fetch c_lee_rsn into l_dummy , l_rec_lee_rsn_id ,g_defer_deenrol_flag ;
11327 close c_lee_rsn ;
11328
11329 elsif l_mode in ( 'C' , 'A') then
11330 open c_enrt_perd_id(c_pl_id => l_comp_obj_tree(l_treeele_num).par_pl_id,
11331 c_pgm_id=> l_comp_obj_tree(l_treeele_num).par_pgm_id,
11332 c_effective_date => nvl(l_rec.lf_evt_ocrd_dt, p_effective_date)
11333 ) ;
11334 fetch c_enrt_perd_id into l_dummy ,l_rec_enrt_perd_id ,g_defer_deenrol_flag ;
11335 close c_enrt_perd_id ;
11336 --
11337 end if ;
11338 --
11339 end if;
11340 --
11341 if g_debug then
11342 hr_utility.set_location(' g_defer_deenrol_flag' || g_defer_deenrol_flag, 9653);
11343 end if;
11344 hr_utility.set_location (' FONM : ' || ben_manage_life_events.fonm ,80);
11345 -- BOF FONM
11346 if l_mode in ('L','C') and -- Bug 6390880
11347 ben_manage_life_events.fonm = 'Y' then
11348
11349 hr_utility.set_location (' FONM : Begin ',80);
11350 hr_utility.set_location(' l_pgm_id = ' || l_pgm_id, 4444);
11351 hr_utility.set_location(' l_pl_id = ' || l_pl_id, 4444);
11352 hr_utility.set_location(' l_oipl_id = ' || l_oipl_id, 4444);
11353 hr_utility.set_location(' l_ptip_id = ' || l_ptip_id, 4444);
11354 hr_utility.set_location(' l_plip_id = ' || l_plip_id, 4444);
11355 if g_debug then
11356 hr_utility.set_location('p_pgm_id'||l_comp_obj_tree(l_treeele_num).par_pgm_id,1234);
11357 hr_utility.set_location('p_pl_id'||l_comp_obj_tree(l_treeele_num).par_pl_id,1234);
11358 hr_utility.set_location('p_plip_id'||l_comp_obj_tree(l_treeele_num).par_plip_id,1234);
11359 hr_utility.set_location('p_ptip_id'||l_comp_obj_tree(l_treeele_num).par_ptip_id,1234);
11360 hr_utility.set_location('p_oipl_id'||l_oipl_id,1234);
11361 end if;
11362
11363 /* if l_mode in ('L') then
11364
11365 open c_lee_rsn(c_pl_id => l_comp_obj_tree(l_treeele_num).par_pl_id,
11366 c_pgm_id=> l_comp_obj_tree(l_treeele_num).par_pgm_id,
11367 c_effective_date => nvl(l_rec.lf_evt_ocrd_dt, p_effective_date)
11368 ) ;
11369 fetch c_lee_rsn into l_dummy , l_rec_lee_rsn_id ;
11370 close c_lee_rsn ;
11371
11372 elsif l_mode in ( 'C' , 'A') then
11373 open c_enrt_perd_id(c_pl_id => l_comp_obj_tree(l_treeele_num).par_pl_id,
11374 c_pgm_id=> l_comp_obj_tree(l_treeele_num).par_pgm_id,
11375 c_effective_date => nvl(l_rec.lf_evt_ocrd_dt, p_effective_date)
11376 ) ;
11377 fetch c_enrt_perd_id into l_dummy ,l_rec_enrt_perd_id ;
11378 close c_enrt_perd_id ;
11379
11380
11381 end if ;*/
11382 hr_utility.set_location(' l_rec_lee_rsn_id ' || l_rec_lee_rsn_id, 99 );
11383 hr_utility.set_location(' c_enrt_perd_id ' || l_rec_enrt_perd_id , 99 );
11384 hr_utility.set_location(' p_ler_id ' || p_ler_id , 99 );
11385 hr_utility.set_location(' p_pgm_id ' || l_comp_obj_tree(l_treeele_num).par_pgm_id , 99 );
11386 hr_utility.set_location(' p_pl_id ' || l_comp_obj_tree(l_treeele_num).par_pl_id , 99 );
11387 hr_utility.set_location(' p_ptip ' || l_comp_obj_tree(l_treeele_num).par_ptip_id , 99 );
11388 hr_utility.set_location(' p_plip ' || l_comp_obj_tree(l_treeele_num).par_plip_id , 99 );
11389 hr_utility.set_location(' p_oipl ' || l_oipl_id , 99 );
11390
11391 ben_determine_date.rate_and_coverage_dates
11392 (p_cache_mode => TRUE
11393 ,p_per_in_ler_id => l_rec.per_in_ler_id
11394 ,p_person_id => p_person_id
11395 ,p_pgm_id => l_comp_obj_tree(l_treeele_num).par_pgm_id
11396 ,p_pl_id => l_comp_obj_tree(l_treeele_num).par_pl_id
11397 ,p_oipl_id => l_oipl_id
11398 ,p_par_ptip_id => l_comp_obj_tree(l_treeele_num).par_ptip_id
11399 ,p_par_plip_id => l_comp_obj_tree(l_treeele_num).par_plip_id
11400 ,p_lee_rsn_id => l_rec_lee_rsn_id
11401 ,p_enrt_perd_id => l_rec_enrt_perd_id
11402 ,p_business_group_id => p_business_group_id
11403 ,p_which_dates_cd => 'C'
11404 ,p_date_mandatory_flag => 'N'
11405 ,p_compute_dates_flag => 'Y'
11406 ,p_enrt_cvg_strt_dt => l_rec_enrt_cvg_strt_dt
11407 ,p_enrt_cvg_strt_dt_cd => l_dummy_enrt_cvg_strt_dt_cd
11408 ,p_enrt_cvg_strt_dt_rl => l_dummy_enrt_cvg_strt_dt_rl
11409 ,p_rt_strt_dt => l_dummy_rt_strt_dt
11410 ,p_rt_strt_dt_cd => l_dummy_rt_strt_dt_cd
11411 ,p_rt_strt_dt_rl => l_dummy_rt_strt_dt_rl
11412 ,p_enrt_cvg_end_dt => l_dummy_enrt_cvg_end_dt
11413 ,p_enrt_cvg_end_dt_cd => l_dummy_enrt_cvg_end_dt_cd
11414 ,p_enrt_cvg_end_dt_rl => l_dummy_enrt_cvg_end_dt_rl
11415 ,p_rt_end_dt => l_dummy_rt_end_dt
11416 ,p_rt_end_dt_cd => l_dummy_rt_end_dt_cd
11417 ,p_rt_end_dt_rl => l_dummy_rt_end_dt_rl
11418 ,p_effective_date => p_effective_date
11419 ,p_lf_evt_ocrd_dt => nvl(l_rec.lf_evt_ocrd_dt, p_effective_date)
11420 );
11421 hr_utility.set_location('l_rec_enrt_cvg_strt_dt = ' || l_rec_enrt_cvg_strt_dt, 4444);
11422 hr_utility.set_location('l_dummy_rt_strt_dt = ' || l_dummy_rt_strt_dt, 4444);
11423 hr_utility.set_location('l_dummy_rt_strt_dt_cd = ' || l_dummy_rt_strt_dt_cd, 4444);
11424 hr_utility.set_location('l_dummy_rt_strt_dt_rl = ' || l_dummy_rt_strt_dt_rl, 4444);
11425 hr_utility.set_location('l_dummy_enrt_cvg_end_dt = ' || l_dummy_enrt_cvg_end_dt, 4444);
11426 hr_utility.set_location('l_dummy_enrt_cvg_end_dt_cd = ' || l_dummy_enrt_cvg_end_dt_cd, 4444);
11427 hr_utility.set_location('l_dummy_enrt_cvg_end_dt_rl = ' || l_dummy_enrt_cvg_end_dt_rl, 4444);
11428 hr_utility.set_location('l_dummy_rt_end_dt = ' || l_dummy_rt_end_dt, 4444);
11429 hr_utility.set_location('l_dummy_rt_end_dt_cd = ' || l_dummy_rt_end_dt_cd, 4444);
11430 hr_utility.set_location('l_dummy_rt_end_dt_rl = ' || l_dummy_rt_end_dt_rl, 4444);
11431 --
11432 -- If previous cvg start date and current date is different then
11433 -- clear the caches.
11434 --
11435 if nvl(l_fonm_cvg_strt_dt, hr_api.g_sot) <>
11436 l_rec_enrt_cvg_strt_dt
11437 then
11438 --
11439 hr_utility.set_location('clearing cache bnmngle '||l_fonm_cvg_strt_dt || ' / ' || l_rec_enrt_cvg_strt_dt ,10);
11440 ben_use_cvg_rt_date.fonm_clear_down_cache;
11441 --
11442 end if;
11443 --
11444 ben_manage_life_events.g_fonm_cvg_strt_dt := l_rec_enrt_cvg_strt_dt ;
11445 l_fonm_cvg_strt_dt := l_rec_enrt_cvg_strt_dt ;
11446 --
11447 hr_utility.set_location(' g_fonm_cvg_strt_dt '||g_fonm_cvg_strt_dt,110);
11448 --
11449 end if;
11450 --
11451 -- EOF FONM
11452 if g_debug then
11453 hr_utility.set_location (l_package||' FND Mess ',80);
11454 hr_utility.set_location ('p_derivable_factors '||p_derivable_factors,80);
11455 end if;
11456 l_comp_rec:=l_d_comp_rec;
11457 l_oiplip_rec:=l_d_oiplip_rec;
11458 --
11459 if p_derivable_factors <> 'NONE' then
11460 --
11461 if g_debug then
11462 hr_utility.set_location (l_package||' fnd_message_call ',30);
11463 end if;
11464 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
11465 fnd_message.set_token('PROC','ben_derive_part_and_rate_facts');
11466 if g_debug then
11467 hr_utility.set_location (l_package||' done fnd_message_call ',30);
11468 hr_utility.set_location (l_package||' DRAF ',15);
11469 end if;
11470 ben_derive_part_and_rate_facts.derive_rates_and_factors
11471 (p_comp_obj_tree_row => l_comp_obj_tree_row
11472 --
11473 ,p_per_row => l_per_row
11474 ,p_empasg_row => l_empasg_row
11475 ,p_benasg_row => l_benasg_row
11476 ,p_pil_row => l_pil_row
11477 --
11478 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
11479 ,p_mode => l_mode
11480 --
11481 ,p_person_id => p_person_id
11482 ,p_business_group_id => p_business_group_id
11483 ,p_pgm_id => l_pgm_id
11484 ,p_pl_id => l_pl_id
11485 ,p_oipl_id => l_oipl_id
11486 ,p_plip_id => l_plip_id
11487 ,p_ptip_id => l_ptip_id
11488 ,p_ptnl_ler_trtmt_cd => l_rec.ptnl_ler_trtmt_cd
11489 ,p_derivable_factors => p_derivable_factors
11490 ,p_comp_rec => l_comp_rec
11491 ,p_oiplip_rec => l_oiplip_rec
11492 -- ,p_effective_date => p_effective_date
11493 ,p_effective_date => least(p_effective_date, nvl(l_rec.lf_evt_ocrd_dt,p_effective_date))
11494 ,p_lf_evt_ocrd_dt => nvl(l_rec.lf_evt_ocrd_dt,p_effective_date)
11495 );
11496 if g_debug then
11497 hr_utility.set_location (l_package||' Done DRAF ',15);
11498 end if;
11499 --
11500 else
11501 --
11502 -- Derive factor direct from the previous eligibility records.
11503 --
11504 if g_debug then
11505 hr_utility.set_location (l_package||' Ass Der facts ',50);
11506 end if;
11507 --
11508 ben_derive_part_and_rate_facts.cache_data_structures
11509 (p_comp_obj_tree_row => l_comp_obj_tree_row
11510 --
11511 ,p_empasg_row => l_empasg_row
11512 ,p_benasg_row => l_benasg_row
11513 ,p_pil_row => l_pil_row
11514 --
11515 ,p_business_group_id => p_business_group_id
11516 ,p_person_id => p_person_id
11517 ,p_pgm_id => l_pgm_id
11518 ,p_pl_id => l_pl_id
11519 ,p_oipl_id => l_oipl_id
11520 ,p_plip_id => l_plip_id
11521 ,p_ptip_id => l_ptip_id
11522 ,p_comp_rec => l_comp_rec
11523 ,p_oiplip_rec => l_oiplip_rec
11524 ,p_effective_date => p_effective_date);
11525 --
11526 end if;
11527 --
11528 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
11529 if l_mode not in ('R','T') then
11530 --
11531 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
11532 fnd_message.set_token('PROC','ben_determine_eligibility');
11533 if g_debug then
11534 hr_utility.set_location (l_package||' Dn FND Mess ',80);
11535 end if;
11536 --
11537 -- Initialise the dependent eligibility related globals.
11538 -- They should be initialised for every comp object.
11539 -- All these globals are used in bendepen.pkb.
11540 --
11541 ben_determine_dpnt_eligibility.g_egd_table.delete;
11542 ben_determine_dpnt_eligibility.g_egd_table :=
11543 ben_determine_dpnt_eligibility.g_egd_table_temp;
11544 --
11545 if g_debug then
11546 hr_utility.set_location (l_package||' BENDETEL ',80);
11547 end if;
11548 --
11549 ben_determine_eligibility.determine_elig_prfls
11550 (p_comp_obj_tree_row => l_comp_obj_tree_row
11551 ,p_par_elig_state => l_par_elig_state
11552 --
11553 ,p_per_row => l_per_row
11554 ,p_empasg_row => l_empasg_row
11555 ,p_benasg_row => l_benasg_row
11556 ,p_appasg_row => l_appasg_row
11557 ,p_empasgast_row => l_empasgast_row
11558 ,p_benasgast_row => l_benasgast_row
11559 ,p_pil_row => l_pil_row
11560 --
11561 ,p_person_id => p_person_id
11562 ,p_business_group_id => p_business_group_id
11563 ,p_effective_date => p_effective_date
11564 ,p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
11565 ,p_pl_id => l_pl_id
11566 ,p_pgm_id => l_pgm_id
11567 ,p_oipl_id => l_oipl_id
11568 ,p_plip_id => l_plip_id
11569 ,p_ptip_id => l_ptip_id
11570 ,p_ler_id => p_ler_id
11571 ,p_comp_rec => l_comp_rec
11572 ,p_oiplip_rec => l_oiplip_rec
11573 --
11574 ,p_eligible => l_eligible
11575 ,p_not_eligible => l_not_eligible
11576 --
11577 ,p_newly_elig => l_newly_elig
11578 ,p_newly_inelig => l_newly_inelig
11579 ,p_first_elig => l_first_elig
11580 ,p_first_inelig => l_first_inelig
11581 ,p_still_elig => l_still_elig
11582 ,p_still_inelig => l_still_inelig
11583 );
11584 if g_debug then
11585 hr_utility.set_location (l_package||' Done BENDETEL ',85);
11586 end if;
11587 --
11588 -- Bug 5232223
11589 --
11590 if l_not_eligible and l_mode = 'W'
11591 and ben_manage_cwb_life_events.g_cache_group_plan_rec.trk_inelig_per_flag = 'N'
11592 and l_oipl_id is null and l_pl_id is not null
11593 -- and fnd_global.conc_request_id > 0 /* Bug 8290746 */
11594 then
11595 --
11596 -- No need to write the data.
11597 --
11598 raise g_cwb_trk_ineligible;
11599 --
11600 end if;
11601 --
11602 -- Set comp object parent eligibility flags
11603 --
11604 if l_eligible then
11605 --
11606 ben_comp_obj_filter.set_parent_elig_flags
11607 (p_comp_obj_tree_row => l_comp_obj_tree_row
11608 ,p_eligible => TRUE
11609 ,p_treeele_num => l_treeele_num
11610 --
11611 ,p_par_elig_state => l_par_elig_state
11612 );
11613 --
11614 if g_debug then
11615 hr_utility.set_location('p_pgm_id'||l_comp_obj_tree(l_treeele_num).par_pgm_id,1234);
11616 hr_utility.set_location('p_pl_id'||l_comp_obj_tree(l_treeele_num).par_pl_id,1234);
11617 hr_utility.set_location('p_plip_id'||l_comp_obj_tree(l_treeele_num).par_plip_id,1234);
11618 hr_utility.set_location('p_ptip_id'||l_comp_obj_tree(l_treeele_num).par_ptip_id,1234);
11619 hr_utility.set_location('p_oipl_id'||l_oipl_id,1234);
11620 end if;
11621 --
11622 -- Don't run enrolment_requirements for levels other than plan and oipl.
11623 -- Don't run it if the ler_id is null.
11624 --
11625 if (l_pl_id is not null
11626 or l_oipl_id is not null)
11627 and p_ler_id is not null
11628 and not nvl(l_first_inelig, FALSE)
11629 and not nvl(l_still_inelig, FALSE)
11630 --
11631 -- CWB Changes.ABSENCES, GRADE/STEP avoid dependent eligibility
11632 -- added irec
11633 and l_mode not in ( 'W', 'M', 'G','I','D')
11634 then
11635 --
11636 --
11637 -- Task 131 : Eligible dependent rows are already created.
11638 -- Now update them with electable choice id.
11639 --
11640 if g_debug then
11641 hr_utility.set_location (l_package||' St BENDEPEN ',85);
11642 end if;
11643 ben_determine_dpnt_eligibility.main
11644 (p_pgm_id => l_comp_obj_tree(l_treeele_num).par_pgm_id
11645 ,p_pl_id => l_comp_obj_tree(l_treeele_num).par_pl_id
11646 ,p_plip_id => l_comp_obj_tree(l_treeele_num).par_plip_id
11647 ,p_ptip_id => l_comp_obj_tree(l_treeele_num).par_ptip_id
11648 ,p_oipl_id => l_oipl_id
11649 ,p_pl_typ_id => null
11650 ,p_business_group_id => p_business_group_id
11651 ,p_person_id => p_person_id
11652 ,p_effective_date => p_effective_date
11653 ,p_per_in_ler_id => l_rec.per_in_ler_id
11654 ,p_elig_per_id => l_comp_obj_tree_row.elig_per_id
11655 ,p_elig_per_opt_id => l_comp_obj_tree_row.elig_per_opt_id
11656 ,p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
11657 );
11658 if g_debug then
11659 hr_utility.set_location (l_package||' Dn BENDEPEN ',85);
11660 end if;
11661 --
11662 end if;
11663 --
11664 elsif l_not_eligible then
11665 --
11666 ben_comp_obj_filter.set_parent_elig_flags
11667 (p_comp_obj_tree_row => l_comp_obj_tree_row
11668 ,p_eligible => FALSE
11669 ,p_treeele_num => l_treeele_num
11670 --
11671 ,p_par_elig_state => l_par_elig_state
11672 );
11673 --
11674 -------------------------------------------------------------------------------
11675 --Bug 12732878 ud changes start
11676 --if program level comp object is ineligible then inserting the comp object to ben_determine_eligibility2.g_cache_first_inelig_object
11677 --for checking any future records are there in ben_elig_per_f and ben_elig_per_opt_f tables.
11678 hr_utility.set_location('In the l_not_eligible if',20);
11679 if l_comp_obj_tree(l_treeele_num).pgm_id is not null then
11680 hr_utility.set_location('l_comp_obj_tree(l_treeele_num).pgm_id'||l_comp_obj_tree(l_treeele_num).pgm_id,10);
11681 ben_determine_eligibility2.g_cache_first_inelig_object.extend;
11682 ben_determine_eligibility2.g_cache_first_inelig_object
11683 (ben_determine_eligibility2.g_cache_first_inelig_object.last).rowno :=
11684 ben_determine_eligibility2.g_cache_first_inelig_object.last;
11685 ben_determine_eligibility2.g_cache_first_inelig_object
11686 (ben_determine_eligibility2.g_cache_first_inelig_object.last).pgm_id :=
11687 l_comp_obj_tree(l_treeele_num).pgm_id;
11688 end if;
11689 --Bug 12732878 ud changes end
11690 --------------------------------------------------------------------------------
11691 end if;
11692 --
11693
11694 if l_first_inelig then
11695 --
11696 --l_elig_state_change := true;
11697 l_comp_obj_tree(l_treeele_num).elig_tran_state := 'FT_INELIG';
11698 --
11699 elsif l_still_inelig then
11700 --
11701 l_comp_obj_tree(l_treeele_num).elig_tran_state := 'ST_INELIG';
11702 --
11703 elsif l_newly_inelig then
11704 --
11705 l_elig_state_change := true;
11706 l_comp_obj_tree(l_treeele_num).elig_tran_state := 'NW_INELIG';
11707 --
11708 elsif l_first_elig then
11709 --
11710 l_comp_obj_tree(l_treeele_num).elig_tran_state := 'FT_ELIG';
11711 --
11712 elsif l_still_elig then
11713 --
11714 l_comp_obj_tree(l_treeele_num).elig_tran_state := 'ST_ELIG';
11715 --
11716 elsif l_newly_elig then
11717 --
11718 l_elig_state_change := true;
11719 l_comp_obj_tree(l_treeele_num).elig_tran_state := 'NW_ELIG';
11720 --
11721 end if;
11722 --
11723 end if;
11724 end if;
11725 --
11726 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
11727 if l_mode not in ('R','T') then
11728 --
11729 -- Check for first in-eligible or still in-eligible
11730 --
11731 l_continue_loop := false;
11732 --
11733 if l_comp_obj_tree(l_treeele_num).elig_tran_state = 'FT_INELIG'
11734 or l_comp_obj_tree(l_treeele_num).elig_tran_state = 'ST_INELIG'
11735 or l_comp_obj_tree(l_treeele_num).elig_tran_state = 'NW_INELIG'
11736 or not l_evaluate_eligibility
11737 then
11738 --
11739 if g_debug then
11740 hr_utility.set_location (' First In-Eligible BENMNGLE ',85);
11741 end if;
11742 --
11743 l_continue_loop := false;
11744 --
11745 else
11746 --
11747 if g_debug then
11748 hr_utility.set_location (' Non-filter eligibility BENMNGLE ',85);
11749 end if;
11750 --
11751 l_continue_loop := true;
11752 --
11753 end if;
11754 --
11755 -- Defer Deenrollment cases
11756 -- If defer_deenrol_flag is set at len/enp, then
11757 -- populate pl/sql table l_defer_deenrl_tbl with pgm_id/pl_id
11758 -- if any comp.obj has newly_inligible status, update newly_inelig_exists to true.
11759 -- if any epe was created in pgm/pnip, update chc_exists to true
11760 --
11761 if (g_defer_deenrol_flag = 'Y') then
11762 -- Add pgm/pln to cache
11763 if (g_debug) then
11764 hr_utility.set_location('DEFER Starts', 1039);
11765 hr_utility.set_location('DEFER l_defer_count ' || l_defer_count , 1039);
11766 hr_utility.set_location('DEFER par_pl_id ' || l_comp_obj_tree(l_treeele_num).par_pl_id , 1039);
11767 hr_utility.set_location('DEFER pl_id ' || l_comp_obj_tree(l_treeele_num).pl_id , 1039);
11768 hr_utility.set_location('DEFER par_pgm_id ' || l_comp_obj_tree(l_treeele_num).par_pgm_id , 1039);
11769 hr_utility.set_location('DEFER pgm_id ' || l_comp_obj_tree(l_treeele_num).pgm_id , 1039);
11770 end if;
11771 --
11772 if (l_defer_deenrl_tbl.COUNT > 0) then
11773 if (l_comp_obj_tree(l_treeele_num).pl_nip <> 'Y') then
11774 --
11775 if (g_debug) then
11776 hr_utility.set_location('DEFER tab_pgm_id '
11777 || l_defer_deenrl_tbl(l_defer_count).pgm_id , 1039);
11778 end if;
11779 --
11780 if (NVL(l_defer_deenrl_tbl(l_defer_count).pgm_id,-1) <>
11781 NVL(l_comp_obj_tree(l_treeele_num).par_pgm_id,
11782 l_comp_obj_tree(l_treeele_num).pgm_id) ) then
11783 --
11784 l_defer_count := l_defer_count +1;
11785 l_defer_deenrl_tbl(l_defer_count).pgm_id :=
11786 l_comp_obj_tree(l_treeele_num).par_pgm_id;
11787 l_defer_deenrl_tbl(l_defer_count).pl_id := null;
11788 l_defer_deenrl_tbl(l_defer_count).chc_exists := false;
11789 l_defer_deenrl_tbl(l_defer_count).newly_inelig_exists := false;
11790 --
11791 end if;
11792 else
11793 --
11794 if (g_debug) then
11795 hr_utility.set_location('DEFER tab_pl_id '
11796 || l_defer_deenrl_tbl(l_defer_count).pl_id , 1039);
11797 end if;
11798 --
11799 if (NVL(l_defer_deenrl_tbl(l_defer_count).pl_id,-1) <>
11800 NVL(l_comp_obj_tree(l_treeele_num).par_pl_id,
11801 l_comp_obj_tree(l_treeele_num).pl_id)) then
11802 --
11803 l_defer_count := l_defer_count +1;
11804 l_defer_deenrl_tbl(l_defer_count).pl_id :=
11805 l_comp_obj_tree(l_treeele_num).par_pl_id;
11806 l_defer_deenrl_tbl(l_defer_count).pgm_id := null;
11807 l_defer_deenrl_tbl(l_defer_count).chc_exists := false;
11808 l_defer_deenrl_tbl(l_defer_count).newly_inelig_exists := false;
11809 --
11810 end if;
11811 end if;
11812 else
11813 hr_utility.set_location('DEFER First PGM/PLN ' , 1039);
11814 --
11815 l_defer_count := l_defer_count +1;
11816 if (l_comp_obj_tree(l_treeele_num).pl_nip <> 'Y') then
11817 l_defer_deenrl_tbl(l_defer_count).pgm_id :=
11818 NVL(l_comp_obj_tree(l_treeele_num).par_pgm_id,
11819 l_comp_obj_tree(l_treeele_num).pgm_id);
11820 l_defer_deenrl_tbl(l_defer_count).pl_id := null;
11821 else
11822 l_defer_deenrl_tbl(l_defer_count).pgm_id := null;
11823 l_defer_deenrl_tbl(l_defer_count).pl_id :=
11824 NVL(l_comp_obj_tree(l_treeele_num).par_pl_id,
11825 l_comp_obj_tree(l_treeele_num).pl_id);
11826 end if;
11827 l_defer_deenrl_tbl(l_defer_count).chc_exists := false;
11828 l_defer_deenrl_tbl(l_defer_count).newly_inelig_exists := false;
11829 end if;
11830 --
11831 -- If Newly Inelig set Flag
11832 if (l_comp_obj_tree(l_treeele_num).elig_tran_state = 'NW_INELIG' ) then
11833 l_defer_deenrl_tbl(l_defer_count).newly_inelig_exists := true;
11834 hr_utility.set_location('DEFER NEWLY INELIG ' , 1039);
11835 end if;
11836 --
11837 end if;
11838 -- Defer enrollments ends;
11839
11840 --
11841 -- Don't run enrolment_requirements for levels other than plan and oipl.
11842 -- Don't run it if the ler_id is null.
11843 --
11844 if g_debug then
11845 hr_utility.set_location ('Before enrollment call. pl id :'||l_pl_id,10);
11846 hr_utility.set_location ('Before enrollment call. oipl id :'||l_oipl_id,10);
11847 hr_utility.set_location ('Before enrollment call. ler id :'||p_ler_id,10);
11848 hr_utility.set_location ('Before enrollment call. l_mode :'||l_mode,10);
11849 end if;
11850 if (l_pl_id is not null
11851 or l_oipl_id is not null)
11852 and p_ler_id is not null
11853 and ((l_continue_loop and l_mode <> 'W') or (l_mode = 'W')) --Changed for Bug #2214961
11854 then
11855 --
11856 -- Initialise the current EPE row for the comp object loop
11857 --
11858 ben_epe_cache.init_context_cobj_pileperow;
11859 --
11860 if g_debug then
11861 hr_utility.set_location (l_package||' FND Bf BENDENRR ',85);
11862 end if;
11863 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
11864 fnd_message.set_token('PROC','ben_enrolment_requirements');
11865 --
11866 -- p_mode changed to l_mode in following line by Gopal Venkataraman
11867 -- 3/27/01 bug 1636071
11868 --
11869 -- CWB Change
11870 --
11871 if l_mode in ('C', 'W') then
11872 l_asnd_lf_evt_dt := l_rec.lf_evt_ocrd_dt;
11873 if l_mode = 'W' and l_cwb_pl_id is null then
11874 l_cwb_pl_id := l_pl_id;
11875 end if;
11876 end if;
11877 --
11878 if g_debug then
11879 hr_utility.set_location (l_package||' FND Af BENDENRR ',100);
11880 end if;
11881 ben_enrolment_requirements.enrolment_requirements
11882 (p_comp_obj_tree_row => l_comp_obj_tree_row
11883 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
11884 ,p_run_mode => l_mode
11885 ,p_business_group_id => p_business_group_id
11886 ,p_effective_date => p_effective_date
11887 ,p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
11888 ,p_ler_id => p_ler_id
11889 ,p_per_in_ler_id => l_pil_row.per_in_ler_id
11890 ,p_person_id => p_person_id
11891 ,p_pl_id => l_pl_id
11892 ,p_pgm_id => l_comp_obj_tree(l_treeele_num).par_pgm_id
11893 ,p_oipl_id => l_oipl_id
11894 ,p_elig_per_elctbl_chc_id => l_elig_per_elctbl_chc_id
11895 ,p_electable_flag => l_electable_flag
11896 -- PB : 5422 :
11897 -- ,p_popl_enrt_typ_cycl_id => p_popl_enrt_typ_cycl_id
11898 ,p_asnd_lf_evt_dt => l_asnd_lf_evt_dt
11899 );
11900 if g_debug then
11901 hr_utility.set_location (l_package||' Dn BENDENRR ',100);
11902 end if;
11903 --
11904 -- If choice has not been created don't do dependent stuff
11905 --
11906 if l_elig_per_elctbl_chc_id is not null then
11907 --
11908 -- Defer Deenrollment
11909 if (g_defer_deenrol_flag = 'Y') then
11910 hr_utility.set_location('DEFER CHOICE EXISTS ' , 1039);
11911 l_defer_deenrl_tbl(l_defer_count).chc_exists := true;
11912 end if;
11913 --
11914 -- Set electable choice context row details
11915 --
11916 ben_epe_cache.g_currcobjepe_row.ler_id := p_ler_id;
11917 ben_epe_cache.g_currcobjepe_row.opt_id := l_comp_obj_tree(l_treeele_num).par_opt_id;
11918 --
11919 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
11920 fnd_message.set_token('PROC','ben_determine_dpnt_eligibility');
11921 --
11922 if g_debug then
11923 hr_utility.set_location (l_package||' BDDE_PUEWEID ',110);
11924 end if;
11925 --
11926 -- Task 131 : Eligible dependent rows are already created.
11927 -- Now update them with electable choice id.
11928 --
11929 --
11930 -- CWB Changes. ABSENCES : Dependents are not processed
11931 --
11932 if l_mode not in ('W', 'M','I','D') then
11933 --
11934 ben_determine_dpnt_eligibility.p_upd_egd_with_epe_id
11935 (p_elig_per_elctbl_chc_id => l_elig_per_elctbl_chc_id
11936 ,p_person_id => p_person_id
11937 ,p_effective_date => p_effective_date
11938 ,p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
11939 );
11940 --
11941 end if;
11942 --
11943 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
11944 fnd_message.set_token('PROC','BEN_DETERMINE_CHC_CTFN');
11945 --
11946 if g_debug then
11947 hr_utility.set_location ('BDCC_MN '||l_package,10);
11948 end if;
11949 if l_mode <> 'D' then
11950 ben_determine_chc_ctfn.main
11951 (p_effective_date => p_effective_date,
11952 p_person_id => p_person_id,
11953 p_elig_per_elctbl_chc_id => l_elig_per_elctbl_chc_id,
11954 p_mode => l_mode);
11955 end if;
11956 if g_debug then
11957 hr_utility.set_location ('Dn BDCC_MN '||l_package,10);
11958 end if;
11959 --
11960 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
11961 fnd_message.set_token('PROC','ben_determine_coverage');
11962 --
11963 if g_debug then
11964 hr_utility.set_location (l_package||' ben_determine_coverage.main ',110);
11965 end if;
11966 --
11967 if l_mode <> 'D' then
11968 ben_determine_coverage.main
11969 (p_elig_per_elctbl_chc_id => l_elig_per_elctbl_chc_id
11970 ,p_effective_date => p_effective_date
11971 ,p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
11972 ,p_perform_rounding_flg => true
11973 --
11974 ,p_enb_valrow => l_enb_valrow
11975 );
11976 end if;
11977 if g_debug then
11978 hr_utility.set_location (l_package||' Dn DetCov_MN ',110);
11979 end if;
11980 --
11981 -- Initialise the current EPE row for the comp object loop
11982 --
11983 ben_epe_cache.init_context_cobj_pileperow;
11984 --
11985 end if;
11986 --
11987 end if; -- pl_id is not null
11988 --
11989 end if;
11990 --
11991 if l_mode = 'R' then
11992 --
11993 update_elig_per_rows
11994 (p_comp_obj_tree_row => l_comp_obj_tree_row
11995 ,p_comp_rec => l_comp_rec
11996 ,p_person_id => p_person_id
11997 ,p_treeele_num => l_treeele_num
11998 ,p_par_elig_state => l_par_elig_state
11999 ,p_business_group_id => p_business_group_id
12000 ,p_effective_date => p_effective_date
12001 ,p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
12002 ,p_per_in_ler_id => l_pil_row.per_in_ler_id
12003 ,p_continue_loop => l_continue_loop);
12004 --
12005 if (l_pl_id is not null
12006 or l_oipl_id is not null)
12007 and p_ler_id is not null
12008 and l_continue_loop
12009 then
12010 --
12011 -- Initialise the current EPE row for the comp object loop
12012 --
12013 ben_epe_cache.init_context_cobj_pileperow;
12014 --
12015 if g_debug then
12016 hr_utility.set_location (l_package||' FND Bf BENDENRR ',86);
12017 hr_utility.set_location ('l_oipl_id' ||l_oipl_id,87);
12018 end if;
12019 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
12020 fnd_message.set_token('PROC','ben_enrolment_requirements');
12021 --
12022 ben_enrolment_requirements.enrolment_requirements
12023 (p_comp_obj_tree_row => l_comp_obj_tree_row
12024 ,p_run_mode => 'U' --l_mode
12025 ,p_business_group_id => p_business_group_id
12026 ,p_effective_date => p_effective_date
12027 ,p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
12028 ,p_ler_id => p_ler_id
12029 ,p_per_in_ler_id => l_pil_row.per_in_ler_id
12030 ,p_person_id => p_person_id
12031 ,p_pl_id => l_pl_id
12032 ,p_pgm_id => l_comp_obj_tree(l_treeele_num).par_pgm_id
12033 ,p_oipl_id => l_oipl_id
12034 ,p_elig_per_elctbl_chc_id => l_elig_per_elctbl_chc_id
12035 ,p_electable_flag => l_electable_flag
12036 ,p_asnd_lf_evt_dt => l_asnd_lf_evt_dt
12037 );
12038 if g_debug then
12039 hr_utility.set_location (l_package||' Dn BENDENRR ',200);
12040 end if;
12041 --
12042 -- If choice has not been created don't do dependent stuff
12043 --
12044 if l_elig_per_elctbl_chc_id is not null then
12045 --
12046 -- Set electable choice context row details
12047 --
12048 ben_epe_cache.g_currcobjepe_row.ler_id := p_ler_id;
12049 ben_epe_cache.g_currcobjepe_row.opt_id := l_comp_obj_tree(l_treeele_num).par_opt_id;
12050 --bug#3420298
12051 ben_determine_dpnt_eligibility.g_egd_table.delete;
12052 ben_determine_dpnt_eligibility.g_egd_table :=
12053 ben_determine_dpnt_eligibility.g_egd_table_temp;
12054 --
12055 ben_determine_dpnt_eligibility.main
12056 (p_pgm_id => l_comp_obj_tree(l_treeele_num).par_pgm_id
12057 ,p_pl_id => l_comp_obj_tree(l_treeele_num).par_pl_id
12058 ,p_plip_id => l_comp_obj_tree(l_treeele_num).par_plip_id
12059 ,p_ptip_id => l_comp_obj_tree(l_treeele_num).par_ptip_id
12060 ,p_oipl_id => l_oipl_id
12061 ,p_pl_typ_id => null
12062 ,p_business_group_id => p_business_group_id
12063 ,p_person_id => p_person_id
12064 ,p_effective_date => p_effective_date
12065 ,p_per_in_ler_id => l_pil_row.per_in_ler_id
12066 ,p_elig_per_id => l_comp_obj_tree_row.elig_per_id
12067 ,p_elig_per_opt_id => l_comp_obj_tree_row.elig_per_opt_id
12068 ,p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
12069 );
12070 --
12071
12072 ben_determine_dpnt_eligibility.p_upd_egd_with_epe_id
12073 (p_elig_per_elctbl_chc_id => l_elig_per_elctbl_chc_id
12074 ,p_person_id => p_person_id
12075 ,p_effective_date => p_effective_date
12076 ,p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
12077 );
12078 -- end of bug#3420298
12079 ben_determine_coverage.main
12080 (p_elig_per_elctbl_chc_id => l_elig_per_elctbl_chc_id
12081 ,p_effective_date => p_effective_date
12082 ,p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
12083 ,p_perform_rounding_flg => true
12084 ,p_enb_valrow => l_enb_valrow
12085 );
12086 --
12087 -- Initialise the current EPE row for the comp object loop
12088 --
12089 ben_epe_cache.init_context_cobj_pileperow;
12090 --
12091 end if;
12092 --
12093 end if;
12094 --
12095 end if;
12096 -- end of mode 'R'
12097 benutils.write(p_text => g_output_string);
12098 --
12099 -- Check if the last row of the comp object list has been reached
12100 -- otherwise navigate to the next row
12101 --
12102 if l_treeele_num = l_maxtreeele_num then
12103 --
12104 l_treeloop := FALSE;
12105 exit;
12106 --
12107 else
12108 --
12109 l_treeele_num := l_treeele_num+1;
12110 --
12111 end if;
12112 --
12113 if g_debug then
12114 hr_utility.set_location (l_package||' End Proc loop ',20);
12115 end if;
12116 --
12117 end loop;
12118 --
12119 if g_debug then
12120 hr_utility.set_location (l_package||' OUT Proc loop ',25);
12121 end if;
12122 --
12123 --------------------------------------------------------------------------
12124 --Bug 12732878 ud changes procedure start
12125 --Calling procedure check_for_first_eligible to check whether the comp objects present in the global variables
12126 --ben_determine_eligibility2.g_cache_first_inelig_object,ben_determine_eligibility2.g_cache_first_elig_object
12127 --are having any future records in ben_elig_per_f and ben_elig_opt_f tables.If the future records are present
12128 -- then inserting the future records in to back up table and deleting the future records.
12129
12130 check_for_first_eligible(p_per_in_ler_id => l_pil_row.per_in_ler_id
12131 ,p_person_id => p_person_id
12132 ,p_effective_date => p_effective_date);
12133 --Bug 12732878 ud changes procedure end
12134 --------------------------------------------------------------------------
12135 -- Defer Deenrollment
12136 -- 1. Loop thru the l_defer_deenrl_tbl
12137 -- 2. If any choice was created in pgm/pnip and
12138 -- if any pl/oipl was newly_ineligible and we deferred the de-enrollment
12139 -- then update corresponding PEL record with defer_deenrol_flag = Y
12140 -- 3. If no choice was created in pgm/pnip, then run newly_ineligible.main
12141 -- and de-enroll immediately.
12142 --
12143 if (l_defer_deenrl_tbl.COUNT > 0) then
12144 --
12145 for defer_indx in l_defer_deenrl_tbl.FIRST..l_defer_deenrl_tbl.LAST loop
12146 --
12147 hr_utility.set_location ('DEFER loop '|| defer_indx, 1039);
12148 --
12149 if l_defer_deenrl_tbl(defer_indx).chc_exists then
12150 --
12151 hr_utility.set_location ('DEFER chc_exists' ,9653);
12152 --
12153 if l_defer_deenrl_tbl(defer_indx).newly_inelig_exists then
12154 --
12155 l_defer_popl_id := null;
12156 l_defer_popl_ovn := null;
12157 hr_utility.set_location ('DEFER newly_inelig_exists' ,9653);
12158
12159 --
12160 if (l_defer_deenrl_tbl(defer_indx).pgm_id is not null) then
12161 --
12162 hr_utility.set_location ('DEFER INSIDE PGM ' ,9653);
12163 open c_pel_defer (l_defer_deenrl_tbl(defer_indx).pgm_id, l_rec.per_in_ler_id);
12164 fetch c_pel_defer into l_pel_defer;
12165 if c_pel_defer%FOUND then
12166 --
12167 l_defer_popl_id := l_pel_defer.pil_elctbl_chc_popl_id;
12168 l_defer_popl_ovn := l_pel_defer.object_version_number;
12169 --
12170 end if;
12171 close c_pel_defer;
12172 hr_utility.set_location ('DEFER PGM' || l_pel_defer.pgm_id,9653);
12173 --
12174 elsif (l_defer_deenrl_tbl(defer_indx).pl_id is not null) then
12175 --
12176 hr_utility.set_location ('DEFER INSIDE PLN ' ,9653);
12177
12178 open c_pel_pnip_defer (l_defer_deenrl_tbl(defer_indx).pl_id, l_rec.per_in_ler_id);
12179 fetch c_pel_pnip_defer into l_pel_pnip_defer;
12180 if c_pel_pnip_defer%FOUND then
12181 --
12182 l_defer_popl_id := l_pel_pnip_defer.pil_elctbl_chc_popl_id;
12183 l_defer_popl_ovn := l_pel_pnip_defer.object_version_number;
12184 --
12185 end if;
12186 close c_pel_pnip_defer;
12187 hr_utility.set_location ('DEFER PL' || l_pel_pnip_defer.pl_id,9653);
12188 --
12189 end if;
12190 --
12191 if l_defer_popl_id IS NOT NULL then
12192 --
12193 hr_utility.set_location ('DEFER UPDATED ' || l_defer_popl_id,9653);
12194 hr_utility.set_location ('DEFER OVN ' || l_defer_popl_ovn,9653);
12195 --
12196 ben_pil_elctbl_chc_popl_api.update_pil_elctbl_chc_popl
12197 (p_validate => FALSE,
12198 p_pil_elctbl_chc_popl_id => l_defer_popl_id,
12199 p_object_version_number => l_defer_popl_ovn,
12200 p_effective_date => p_effective_date,
12201 p_defer_deenrol_flag => 'Y'
12202 );
12203 end if;
12204 --
12205 end if;
12206 else
12207 --
12208 hr_utility.set_location ('DEFER NEWLYINELIG ' ,9653);
12209 --
12210 if l_defer_deenrl_tbl(defer_indx).newly_inelig_exists then
12211 ben_newly_ineligible.main
12212 (p_person_id => p_person_id,
12213 p_pgm_id => l_defer_deenrl_tbl(defer_indx).pgm_id,
12214 p_pl_id => l_defer_deenrl_tbl(defer_indx).pl_id,
12215 p_oipl_id => NULL,
12216 p_business_group_id => p_business_group_id,
12217 p_ler_id => p_ler_id,
12218 p_effective_date => p_effective_date
12219 );
12220 end if;
12221 --
12222 end if;
12223 --
12224 hr_utility.set_location ('DEFER End loop ' ,9653);
12225 --
12226 end loop;
12227 --
12228 end if;
12229 -- Defer Deenrollment ends
12230
12231 if l_mode = 'W' then
12232
12233 update_cwb_epe
12234 (p_per_in_ler_id => l_rec.per_in_ler_id
12235 ,p_effective_date => p_effective_date);
12236
12237 end if;
12238
12239 --
12240 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
12241 if l_mode <> 'T' then
12242 --
12243 -- Clear eligibility caches
12244 --
12245 ben_pep_cache.clear_down_cache;
12246 ben_epe_cache.clear_down_cache;
12247 --
12248 -- PB : 5422 :
12249 -- l_strt_dt is not being used by the process to which it is passed.
12250 -- May be necessary to remove this code.
12251 --
12252 /*
12253 open c_strt_dt;
12254 --
12255 fetch c_strt_dt into l_strt_dt;
12256 --
12257 close c_strt_dt;
12258 */
12259 --
12260 -- Start 5055119
12261 IF l_mode IN ('U', 'R', 'S', 'P','D')
12262
12263 THEN
12264 hr_utility.set_location('SSARKAR p_person_id '|| p_person_id,9909);
12265 hr_utility.set_location('SSARKAR l_pil_row.per_in_ler_id '|| l_pil_row.per_in_ler_id,9909);
12266 hr_utility.set_location('SSARKAR p_effective_date '|| p_effective_date,9909);
12267
12268 ben_manage_unres_life_events.end_date_elig_per_rows (p_person_id => p_person_id,
12269 p_per_in_ler_id => l_pil_row.per_in_ler_id,
12270 p_effective_date => p_effective_date
12271 );
12272 END IF;
12273 -- End 5055119
12274 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
12275 if l_mode not in ('A','P','S','T') then
12276 -- Bug 4640014, deleting EPEs before update_defaults
12277 if l_mode in ('U','R') then
12278 --
12279 ben_manage_unres_life_events.clear_epe_cache ;
12280 --
12281 end if;
12282 --
12283 -- If defaults have changed due to deenrollments then
12284 -- check to see if choice defaults have changed.
12285 --
12286 if ben_enrolment_requirements.g_any_choice_created then
12287 if l_mode <> 'D' then
12288 ben_enrolment_requirements.update_defaults
12289 (p_run_mode => l_mode
12290 ,p_business_group_id => p_business_group_id
12291 ,p_effective_date => p_effective_date
12292 ,p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
12293 ,p_ler_id => p_ler_id
12294 ,p_person_id => p_person_id
12295 ,p_per_in_ler_id => l_pil_row.per_in_ler_id
12296 );
12297 end if;
12298 end if;
12299 --BUG 4463267 Need to update the flag
12300 if l_mode <> 'D' then
12301 --
12302 BEN_DETERMINE_CHC_CTFN.update_susp_if_ctfn_flag
12303 (p_effective_date => p_effective_date,
12304 p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt,
12305 p_person_id => p_person_id,
12306 p_per_in_ler_id => l_pil_row.per_in_ler_id
12307 );
12308 -- 1895846 call
12309 -- to delete the egd records create for the suspended pen or in pending wkflow epe records
12310 --
12311 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
12312 fnd_message.set_token('PROC','delete_in_pndg_elig_dpnt');
12313 --
12314 delete_in_pndg_elig_dpnt( l_rec.per_in_ler_id,p_effective_date ) ;
12315 --
12316 end if;
12317 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
12318 fnd_message.set_token('PROC','ben_determine_elct_chc_flx_imp');
12319 if g_debug then
12320 hr_utility.set_location('lf evt ocrd dt'||l_rec.lf_evt_ocrd_dt,11);
12321 end if;
12322 --
12323 -- CWB Changes. ABSENCES, GRADE/STEP : no need to run flex logic
12324 -- added irec
12325 if l_mode not in ( 'W', 'M', 'G','I','D') then
12326 --
12327 ben_determine_elct_chc_flx_imp.main
12328 (p_person_id => p_person_id,
12329 p_business_group_id => p_business_group_id,
12330 p_per_in_ler_id => l_rec.per_in_ler_id,
12331 p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt,
12332 p_enrt_perd_strt_dt => l_strt_dt,
12333 p_effective_date => p_effective_date,
12334 p_mode => l_mode);
12335 --
12336 end if;
12337 --
12338 -- Assumption is that ben_determine_actual_premium.main and
12339 -- ben_determine_rates.main do not perform any updates to
12340 -- electable choices. Be aware of this assumption when modifying
12341 -- ben_determine_actual_premium and ben_determine_rates.
12342 --
12343 -- Clear electability caches
12344 --
12345 ben_epe_cache.clear_down_cache;
12346 --
12347 -- Clear Elig per Cache as ben_enrolment_requirements.update_defaults
12348 -- build the cache for previous eligibility.
12349 -- And in the benrates we need the current elig records.
12350 --
12351 ben_pep_cache.clear_down_cache;
12352 --
12353 -- Clear distribute rates function caches
12354 --
12355 ben_distribute_rates.clear_down_cache;
12356 --
12357 -- Do premium stuff if choices are created.
12358 --
12359 -- CWB Changes. ABSENCES ,GRADE/STEP : No need to run premium logic
12360 --
12361 if ben_enrolment_requirements.g_any_choice_created
12362 and l_mode not in( 'W', 'M', 'G','I','D') -- added irec
12363 then
12364 if g_debug then
12365 hr_utility.set_location (l_package||'.ben_determine_actual_premium ',10);
12366 end if;
12367 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
12368 fnd_message.set_token('PROC','ben_determine_actual_premium');
12369 --
12370 ben_determine_actual_premium.main
12371 (p_person_id => p_person_id,
12372 p_effective_date => p_effective_date,
12373 -- added per_in_ler_id for unrestricted enhancement
12374 p_per_in_ler_id => l_rec.per_in_ler_id,
12375 p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt,
12376 p_mode => l_mode
12377 );
12378 --
12379 end if;
12380 --
12381 -- Do rates stuff
12382 --
12383 if g_debug then
12384 hr_utility.set_location ('FND mess '||l_package,10);
12385 end if;
12386 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
12387 fnd_message.set_token('PROC','ben_determine_rates');
12388 --
12389
12390 -- bug 12354919
12391 -- refresh the cache g_unrest_ecr_instance since ovn has changed after imputed shell rate got updated
12392 -- in ben_newly_ineligible
12393
12394 if (p_mode = 'U' or p_mode = 'R') then
12395
12396 if l_rec.per_in_ler_id is not null then
12397 open c_epe(l_rec.per_in_ler_id);
12398 fetch c_epe bulk collect into t_epe_tbl;
12399 close c_epe;
12400
12401 hr_utility.set_location('epe count'|| t_epe_tbl.count,10);
12402
12403 if t_epe_tbl.count > 0 then
12404 l_cnt := 1;
12405 for i in 1..t_epe_tbl.last loop
12406 hr_utility.set_location (' within ecr t_epe_tbl(i) '||t_epe_tbl(i),11);
12407 open c_ecr_ch (t_epe_tbl(i));
12408 loop
12409 fetch c_ecr_ch into ben_manage_unres_life_events.g_unrest_ecr_instance_row;
12410 if c_ecr_ch%found then
12411 hr_utility.set_location ('enrt id'||ben_manage_unres_life_events.g_unrest_ecr_instance_row.enrt_rt_id,11);
12412 hr_utility.set_location ('ecr ovn '||ben_manage_unres_life_events.g_unrest_ecr_instance_row.object_version_number,11);
12413 ben_manage_unres_life_events.g_unrest_ecr_instance(l_cnt) := ben_manage_unres_life_events.g_unrest_ecr_instance_row;
12414 l_cnt := l_cnt + 1;
12415 else
12416 exit;
12417 end if;
12418 end loop;
12419 close c_ecr_ch;
12420 end loop;
12421 end if;
12422 end if;
12423 end if;
12424
12425 -- bug 12354919
12426
12427
12428 if g_debug then
12429 hr_utility.set_location ('ben_determine_rates '||l_package,10);
12430 end if;
12431 ben_determine_rates.main
12432 (p_effective_date => p_effective_date,
12433 p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt,
12434 p_person_id => p_person_id,
12435 p_mode => l_mode,
12436 -- added per_in_ler_id for unrestricted enhancement
12437 p_per_in_ler_id => l_rec.per_in_ler_id);
12438 --
12439 -- Bug 3968065 : in CWB mode summ the rates defined at oipls and
12440 -- write into ben_cwb_person_rates.
12441 --
12442 if l_mode = 'W' then
12443 --
12444 BEN_MANAGE_CWB_LIFE_EVENTS.sum_oipl_rates_and_upd_pl_rate (
12445 p_pl_id => l_cwb_pl_id,
12446 p_group_pl_id => ben_manage_cwb_life_events.g_cache_group_plan_rec.group_pl_id,
12447 p_lf_evt_ocrd_dt => ben_manage_cwb_life_events.g_cache_group_plan_rec.group_lf_evt_ocrd_dt,
12448 p_person_id => p_person_id,
12449 p_assignment_id => null
12450 );
12451 --
12452 end if;
12453 --
12454 /* GSP Rate Sync */
12455 if l_mode = 'G'
12456 then
12457 --
12458 if p_lf_evt_oper_cd = 'SYNC'
12459 then
12460 --
12461 hr_utility.set_location('Calling GSP Rate Sync Post Process in PQH', 45);
12462 pqh_gsp_post_process.update_rate_sync_salary
12463 (p_per_in_ler_id => l_pil_row.per_in_ler_id
12464 ,p_effective_date => p_effective_date
12465 );
12466 --
12467 else /* p_lf_evt_oper_cd = 'PROG' */
12468 --
12469 gsp_proc_dflt_auten(l_rec.per_in_ler_id, p_effective_date) ;
12470 --
12471 end if;
12472 end if ;
12473 --
12474 if l_mode in ('U', 'R') then
12475 --
12476 update_enrt_rt (p_per_in_ler_id => l_rec.per_in_ler_id);
12477 ben_manage_unres_life_events.clear_cache;
12478 --
12479 end if;
12480 if g_debug then
12481 hr_utility.set_location ('ben_determine_rate_chg '||l_package,10);
12482 end if;
12483 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
12484 fnd_message.set_token('PROC','ben_determine_rate_chg');
12485 --
12486 -- Turn off distribute rates function caching because cached information
12487 -- is updated in later RCOs. Any further RCOs will hit the DB rather the
12488 -- function cache.
12489 --
12490 ben_distribute_rates.set_no_cache_context;
12491 --
12492 --
12493 -- CWB Changes. ABSENCES, GRADE/STEP
12494 -- added irec
12495 if l_mode not in ('W', 'M', 'G','I','D') then
12496 --
12497 ben_determine_rate_chg.main
12498 (p_effective_date => p_effective_date,
12499 p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt,
12500 p_business_group_id => p_business_group_id,
12501 p_person_id => p_person_id,
12502 -- added per_in_ler_id for unrestricted enhancement
12503 p_per_in_ler_id => l_rec.per_in_ler_id,
12504 p_mode => l_mode);
12505 --
12506 end if;
12507 --
12508 end if;
12509 --
12510 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
12511 fnd_message.set_token('PROC','reset_elctbl_chc_inpng_flag');
12512 --
12513 -- Reset the in_pndg_wkflow_flag to 'N' for the suspended enrollment cases
12514 --
12515 reset_elctbl_chc_inpng_flag(l_rec.per_in_ler_id,p_effective_date );
12516 -- reopen already ended results if elecatble choice with flag Y
12517 -- Fidelity GM issue
12518 --
12519 -- bug 5534550 - call reopen only for L or C modes
12520 if l_mode in ('L', 'C') then
12521 --
12522 ben_reopen_ended_results.reopen_routine(
12523 p_per_in_ler_id => l_rec.per_in_ler_id,
12524 p_business_group_id => p_business_group_id,
12525 p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt,
12526 p_person_id => p_person_id,
12527 p_effective_date => l_rec.lf_evt_ocrd_dt);
12528 --
12529 end if;
12530 --
12531 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
12532 fnd_message.set_token('PROC','ben_automatic_enrollments');
12533 --
12534 -- Do the automatic enrollments
12535 --
12536 -- CWB Changes.
12537 --
12538 if g_debug then
12539 hr_utility.set_location ('BENAUTEN '||l_package,10);
12540 end if;
12541 if ben_enrolment_requirements.g_auto_choice_created
12542 and l_mode not in ('W','D')
12543 then
12544 ben_automatic_enrollments.main(
12545 p_person_id => p_person_id,
12546 p_ler_id => p_ler_id,
12547 p_business_group_id => p_business_group_id,
12548 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
12549 p_mode => l_mode,
12550 p_effective_date => l_rec.lf_evt_ocrd_dt
12551 );
12552 end if;
12553 if g_debug then
12554 hr_utility.set_location ('Dn BENAUTEN '||l_package,10);
12555 end if;
12556 --
12557 --
12558 -- Check for reqired communications
12559 --
12560 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
12561 fnd_message.set_token('PROC','ben_generate_communications');
12562 --
12563 if g_debug then
12564 hr_utility.set_location ('Comms '||l_package,10);
12565 end if;
12566 --
12567 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
12568 -- CWB Changes.
12569 --
12570 if l_mode in ('C', 'W') then
12571 l_asnd_lf_evt_dt := l_rec.lf_evt_ocrd_dt;
12572 end if;
12573 --
12574 -- call communications for all modes other than GSP
12575 -- bypass communications call for irec
12576 if l_mode not in ( 'G','I','D') then
12577 --
12578 ben_generate_communications.main
12579 (p_person_id => p_person_id,
12580 p_ler_id => p_ler_id,
12581 p_per_in_ler_id => l_rec.per_in_ler_id,
12582 p_prtt_enrt_actn_id => null,
12583 p_bnf_person_id => null,
12584 p_dpnt_person_id => null,
12585 -- PB : 5422 :
12586 -- As enrt_perd_id is not passed, so pass the null value.
12587 --
12588 -- p_enrt_perd_id => p_popl_enrt_typ_cycl_id,
12589 p_asnd_lf_evt_dt => l_asnd_lf_evt_dt,
12590 p_actn_typ_id => null,
12591 p_enrt_mthd_cd => null,
12592 p_business_group_id => p_business_group_id,
12593 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
12594 p_proc_cd1 => benutils.iftrue(l_mode = 'U'
12595 ,null
12596 ,'MLEPECP'),
12597 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
12598 p_proc_cd2 => benutils.iftrue(l_mode = 'U'
12599 ,null
12600 ,'MLEAUTOENRT'),
12601 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
12602 p_proc_cd3 => benutils.iftrue(l_mode = 'U'
12603 ,null
12604 ,'MLERTCHG'),
12605 p_proc_cd4 => 'MLEENDENRT',
12606 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
12607 p_proc_cd5 => benutils.iftrue(l_mode = 'U'
12608 ,null
12609 ,'MLENOIMP'),
12610 p_proc_cd6 => 'MLEELIG',
12611 p_proc_cd7 => 'MLEINELIG',
12612 p_proc_cd8 => 'HPAPRTTDE',
12613 p_proc_cd9 => 'HPADPNTLC',
12614 p_proc_cd10 => null,
12615 p_effective_date => p_effective_date,
12616 p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
12617 );
12618 --
12619 end if;
12620 --
12621 if g_debug then
12622 hr_utility.set_location ('Dn Comms '||l_package,10);
12623 end if;
12624 --
12625 -- Create benefit assignment for dependents if they were
12626 -- found ineligible.
12627 --
12628 -- CWB Changes. ABSENCES, GRADE/STEP
12629 -- added irec
12630 if ben_determine_dpnt_eligibility.g_dpnt_ineligible
12631 and (l_mode not in ( 'W', 'M', 'G','I','D'))
12632 then
12633 if g_debug then
12634 hr_utility.set_location ('Dpnt ineligible '||l_package,10);
12635 end if;
12636 for l_dpnt_rec in c_get_inelig_dpnt_info(l_rec.per_in_ler_id) loop
12637 if g_debug then
12638 hr_utility.set_location ('Dpnt person_id '||l_dpnt_rec.dpnt_person_id,10);
12639 hr_utility.set_location ('cvg_thru_dt '||l_dpnt_rec.cvg_thru_dt,10);
12640 end if;
12641 ben_assignment_internal.copy_empasg_to_benasg
12642 (p_person_id => p_person_id
12643 ,p_dpnt_person_id => l_dpnt_rec.dpnt_person_id
12644 ,p_effective_date => l_dpnt_rec.cvg_thru_dt + 1
12645 ,p_assignment_id => l_assignment_id
12646 ,p_object_version_number => l_object_version_number
12647 ,p_perhasmultptus => l_perhasmultptus
12648 );
12649 end loop;
12650 end if;
12651 --
12652 -- COBRA: If person is no longer enrolled in the COBRA program and has no
12653 -- opportunity to elect then, end COBRA eligibility.
12654 --
12655 if ben_cobra_requirements.g_cobra_enrollment_change then
12656 ben_cobra_requirements.end_prtt_cobra_eligibility
12657 (p_per_in_ler_id => l_rec.per_in_ler_id
12658 ,p_person_id => p_person_id
12659 ,p_business_group_id => p_business_group_id
12660 ,p_effective_date => p_effective_date
12661 );
12662 end if;
12663 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
12664 if l_mode in ('L','U') then
12665 --
12666 -- If electable choices are created, check if we need to create
12667 -- cobra qualified beneficiaries.
12668 --
12669 if (p_ler_id is not null and
12670 (l_rec.qualg_evt_flag = 'Y' or
12671 l_rec.typ_cd = 'ENDDSBLTY' or
12672 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
12673 l_mode = 'U')) then
12674 ben_cobra_requirements.update_cobra_elig_info
12675 (p_person_id => p_person_id
12676 ,p_per_in_ler_id => l_rec.per_in_ler_id
12677 ,p_lf_evt_ocrd_dt => l_rec.lf_evt_ocrd_dt
12678 ,p_effective_date => p_effective_date
12679 ,p_business_group_id => p_business_group_id
12680 );
12681 end if;
12682 end if;
12683 --
12684 -- if condition added for unrestricted enhancement
12685 -- p_mode changed to l_mode in following line by Gopal Venkataraman 3/27/01 bug 1636071
12686 --
12687 -- iRec (OI) : Even if the person is not eligible to any plan, still the Life Event status in PIL
12688 -- should be Started (and should not be changed to Processed). Hence mode iRecruitment (I) not
12689 -- added in the following "if statement".
12690
12691 -- ABSENCES : Close the life event.
12692 --
12693 if l_mode = 'L' or l_mode = 'C' or l_mode = 'M' then
12694 if (p_ler_id is not null and
12695 not ben_enrolment_requirements.g_electable_choice_created
12696 /*Bug 12711900 : Commented below condition. Profile 'Ben:Check Enrollment limits' should be validated
12697 even though automatic enrollments are assigned for Life Event. Only when there is no electability
12698 profile validation should happen*/
12699 -- and not ben_enrolment_requirements.g_auto_choice_created
12700 ) or (l_mode = 'M')
12701 then
12702 --
12703 -- Set life event to processed, only update the per_in_ler_stat_cd
12704 --
12705 if l_mode = 'M' then
12706 --
12707 benutils.get_active_life_event
12708 (p_person_id => p_person_id,
12709 p_business_group_id => p_business_group_id,
12710 p_effective_date => p_effective_date,
12711 p_lf_event_mode => 'M',
12712 p_rec => l_rec);
12713 --
12714 else
12715 --
12716 benutils.get_active_life_event
12717 (p_person_id => p_person_id,
12718 p_business_group_id => p_business_group_id,
12719 p_effective_date => p_effective_date,
12720 p_rec => l_rec);
12721 --
12722 end if;
12723
12724 /* Bug 12711900 : If there is no electability life event will directly move to Processed state. So calling
12725 benutils.get_active_life_event will not return life event. Added below code to get the Life event details*/
12726 if(not ben_enrolment_requirements.g_electable_choice_created) then
12727 hr_utility.set_location('Getting pil_id ',10);
12728 declare
12729 cursor c_get_pil_id is
12730 select pil.per_in_ler_id,
12731 pil.lf_evt_ocrd_dt,
12732 pil.ntfn_dt,
12733 pil.ler_id,
12734 ler.name,
12735 ler.typ_cd,
12736 ler.ovridg_le_flag,
12737 ler.ptnl_ler_trtmt_cd,
12738 pil.object_version_number,
12739 pil.ptnl_ler_for_per_id,
12740 ler.qualg_evt_flag
12741 from ben_per_in_ler pil,
12742 ben_ler_f ler
12743 where pil.person_id = p_person_id
12744 and ler.ler_id = pil.ler_id
12745 and p_effective_date
12746 between ler.effective_start_date
12747 and ler.effective_end_date
12748 and pil.lf_evt_ocrd_dt = nvl(p_lf_evt_ocrd_dt,p_effective_date)
12749 and ler.typ_cd not in ('SCHEDDU', 'COMP', 'GSP', 'ABS', 'IREC')
12750 and pil.per_in_ler_stat_cd not in ('VOIDD','BCKDT');
12751 begin
12752 open c_get_pil_id;
12753 fetch c_get_pil_id into l_rec;
12754 close c_get_pil_id;
12755 end;
12756 end if;
12757
12758 --
12759 if l_rec.lf_evt_ocrd_dt is not null then
12760 --
12761 if g_debug then
12762 hr_utility.set_location('processing event',10);
12763 end if;
12764 ben_person_life_event_api.update_person_life_event
12765 (p_per_in_ler_id => l_rec.per_in_ler_id,
12766 p_per_in_ler_stat_cd => 'PROCD',
12767 p_object_version_number => l_rec.object_version_number,
12768 -- p_effective_date => p_effective_date,
12769 -- Bug#1543462
12770 p_effective_date => least(p_effective_date,trunc(sysdate)),
12771 p_procd_dt => l_procd_dt,
12772 p_strtd_dt => l_strtd_dt,
12773 p_voidd_dt => l_voidd_dt);
12774 --
12775 -- Bug 6404338. Min Max enhancement.
12776 l_chk_min_max := fnd_profile.value('BEN_CHK_MIN_MAX');
12777 --
12778 if g_debug then
12779 hr_utility.set_location ('l_chk_min_max '||l_chk_min_max,10);
12780 end if;
12781 --
12782 if l_chk_min_max = 'Y' then
12783 --
12784 -- Check if coverage was terminated in this event.
12785 --
12786 if ben_prtt_enrt_result_api.g_enrollment_change = true then
12787 if g_debug then
12788 hr_utility.set_location ('Enrollment ended ',10);
12789 end if;
12790 for l_rslt_rec in c_get_ended_enrt_rslts(l_rec.per_in_ler_id) loop
12791 --
12792 -- Check if person is still eligible for the plan type in
12793 -- program.
12794 --
12795 l_ptip_elig_flag := 'N';
12796 open c_get_ptip_elig(l_rslt_rec.ptip_id, l_rec.per_in_ler_id);
12797 fetch c_get_ptip_elig into l_ptip_elig_flag;
12798 close c_get_ptip_elig;
12799 --
12800 if g_debug then
12801 hr_utility.set_location (' Elig flag '||l_ptip_elig_flag,10);
12802 end if;
12803 --
12804 if l_ptip_elig_flag = 'Y' then
12805 --
12806 -- Get the ptip min and max.
12807 --
12808 open c_get_ptip(l_rslt_rec.ptip_id);
12809 fetch c_get_ptip into l_ptip_rec;
12810 if c_get_ptip%notfound then
12811 close c_get_ptip;
12812 fnd_message.set_name('BEN','BEN_91462_PTIP_MISSING');
12813 fnd_message.set_token('ID', to_char(l_rslt_rec.ptip_id) );
12814 fnd_message.raise_error;
12815 end if;
12816 --
12817 close c_get_ptip;
12818 --
12819 if (l_ptip_rec.no_mn_pl_typ_overid_flag = 'Y' or
12820 (l_ptip_rec.no_mn_pl_typ_overid_flag = 'N' and
12821 l_ptip_rec.MN_ENRD_RQD_OVRID_NUM is null)) then
12822 l_mn_enrd_rqd_ovrid_num := l_ptip_rec.MN_ENRL_RQD_NUM;
12823 else
12824 l_mn_enrd_rqd_ovrid_num := l_ptip_rec.MN_ENRD_RQD_OVRID_NUM;
12825 end if;
12826 --
12827 -- Get the total enrolled in the ptip
12828 --
12829 open c_get_ptip_tot_enrd(l_rslt_rec.ptip_id);
12830 fetch c_get_ptip_tot_enrd into l_count;
12831 close c_get_ptip_tot_enrd;
12832 hr_utility.set_location (' MN_ENRD_RQD_OVRID_NUM '||l_ptip_rec.MN_ENRD_RQD_OVRID_NUM,10);
12833 if (l_count < l_MN_ENRD_RQD_OVRID_NUM ) then
12834 hr_utility.set_location (' error '||l_count,10);
12835 fnd_message.set_name('BEN','BEN_91588_PL_ENRD_LT_MN_RQD');
12836 fnd_message.set_token('MN_ENRL', to_char(l_MN_ENRD_RQD_OVRID_NUM));
12837 fnd_message.set_token('PL_TYP_NAME', l_ptip_rec.name);
12838 fnd_message.raise_error;
12839 end if;
12840 end if;
12841 end loop;
12842 end if;
12843 end if; -- l_chk_min_max = 'Y'
12844 --
12845 -- End min max enhancement.
12846 --
12847 end if;
12848 --
12849 -- Update status of life event to opened and closed as this is what has
12850 -- happened unless the life event was replaced.
12851 --
12852 benutils.update_life_event_cache(p_open_and_closed => 'Y');
12853 --
12854 end if;
12855 --
12856 if (p_ler_id is not null and
12857 ben_enrolment_requirements.g_electable_choice_created ) or
12858 l_mode = 'M' -- ABSENCES : close life event in absences mode.
12859 then
12860 open c_pil_elctbl_chc_popl(l_rec.per_in_ler_id);
12861 loop
12862 fetch c_pil_elctbl_chc_popl into l_pil_elctbl_chc_popl;
12863 if c_pil_elctbl_chc_popl%notfound then
12864 close c_pil_elctbl_chc_popl;
12865 exit;
12866 else
12867 ben_pil_elctbl_chc_popl_api.update_pil_elctbl_chc_popl
12868 (p_pil_elctbl_chc_popl_id => l_pil_elctbl_chc_popl.pil_elctbl_chc_popl_id
12869 ,p_pil_elctbl_popl_stat_cd => 'PROCD'
12870 ,p_business_group_id => p_business_group_id
12871 ,p_object_version_number => l_pil_elctbl_chc_popl.object_version_number
12872 ,p_effective_date => p_effective_date);
12873 end if;
12874 end loop;
12875 end if;
12876
12877 end if;
12878 --
12879 -- Do not run restore if electable choices are not created.
12880 --
12881 -- CWB Changes. -- ABSENCES : no restore logic.
12882 -- added irec
12883 if g_bckdt_per_in_ler_id is not null and
12884 ben_enrolment_requirements.g_electable_choice_created and
12885 l_mode not in ('W', 'M','I','D')
12886 then
12887 --
12888 ben_lf_evt_clps_restore.p_lf_evt_clps_restore
12889 (p_person_id => p_person_id
12890 ,p_business_group_id => p_business_group_id
12891 ,p_effective_date => p_effective_date
12892 ,p_per_in_ler_id => l_rec.per_in_ler_id
12893 ,p_bckdt_per_in_ler_id => g_bckdt_per_in_ler_id);
12894 --
12895 end if;
12896 --
12897 -- Bug 4258498 : moved carry forward after reinstate, so that reinstate
12898 -- try to restore back what was previous state first.
12899 --Bug 4064635. New Procedure call to carry forward suspended enrollments
12900 --
12901 if l_mode not in ('W', 'M', 'G','I','D') then
12902 --
12903 if g_debug then
12904 hr_utility.set_location ('carry_farward_results '||l_package,10);
12905 end if;
12906 --
12907 ben_carry_forward_items.carry_farward_results(
12908 p_person_id => p_person_id
12909 ,p_per_in_ler_id => l_rec.per_in_ler_id
12910 ,p_ler_id => p_ler_id
12911 ,p_business_group_id => p_business_group_id
12912 ,p_mode => l_mode
12913 ,p_effective_date => p_effective_date
12914 );
12915 --
12916 if g_debug then
12917 hr_utility.set_location ('Dn carry_farward_results '||l_package,10);
12918 end if;
12919 --
12920 end if;
12921 --
12922 end if;
12923 --
12924 -- GRADE/STEP - Bypass this for absences and grade modes V.Puttigampala 11/08/00
12925 -- added irec
12926 if l_mode not in ('W', 'M', 'G','I','D') then
12927 --
12928 --- # 2899702 if the setup is autoenrollment Person Type usages are not create
12929 --- because the multi edit is not called , Person Type usages created in multiedit
12930 --- this is called for autoenrollment to created person type usaged
12931 if ben_enrolment_requirements.g_auto_choice_created
12932 and l_mode <> 'W' then
12933
12934 ben_prtt_enrt_result_api.g_enrollment_change := true ;
12935 end if ;
12936
12937 ben_prtt_enrt_result_api.update_person_type_usages
12938 (p_person_id => p_person_id
12939 ,p_business_group_id => p_business_group_id
12940 ,p_effective_date => p_effective_date
12941 );
12942 --
12943 end if;
12944 -- bug 4621751 irec2 updating per_all_assignments_f with g_irec_old_ass_rec
12945 if l_mode = 'I' then
12946 begin
12947 -- dbms_output.put_line('*** G_IREC_OLD_ASS_REC.assignment_id '||G_IREC_OLD_ASS_REC.assignment_id);
12948 ben_irc_util.post_irec_process_update
12949 (p_person_id => p_person_id,
12950 p_business_group_id => p_business_group_id,
12951 p_assignment_id => G_IREC_OLD_ASS_REC.assignment_id,
12952 p_effective_date => p_effective_date);
12953
12954 l_old_data_migrator_mode := hr_general.g_data_migrator_mode ;
12955 hr_general.g_data_migrator_mode := 'Y' ;
12956
12957 -- update starts
12958 update per_all_assignments_F
12959 set
12960 BUSINESS_GROUP_ID = G_IREC_OLD_ASS_REC.BUSINESS_GROUP_ID
12961 ,RECRUITER_ID = G_IREC_OLD_ASS_REC.RECRUITER_ID
12962 ,GRADE_ID = G_IREC_OLD_ASS_REC.GRADE_ID
12963 ,POSITION_ID = G_IREC_OLD_ASS_REC.POSITION_ID
12964 ,JOB_ID = G_IREC_OLD_ASS_REC.JOB_ID
12965 ,ASSIGNMENT_STATUS_TYPE_ID = G_IREC_OLD_ASS_REC.ASSIGNMENT_STATUS_TYPE_ID
12966 ,PAYROLL_ID = G_IREC_OLD_ASS_REC.PAYROLL_ID
12967 ,LOCATION_ID = G_IREC_OLD_ASS_REC.LOCATION_ID
12968 ,PERSON_REFERRED_BY_ID = G_IREC_OLD_ASS_REC.PERSON_REFERRED_BY_ID
12969 ,SUPERVISOR_ID = G_IREC_OLD_ASS_REC.SUPERVISOR_ID
12970 ,SPECIAL_CEILING_STEP_ID = G_IREC_OLD_ASS_REC.SPECIAL_CEILING_STEP_ID
12971 ,PERSON_ID = G_IREC_OLD_ASS_REC.PERSON_ID
12972 ,RECRUITMENT_ACTIVITY_ID = G_IREC_OLD_ASS_REC.RECRUITMENT_ACTIVITY_ID
12973 ,SOURCE_ORGANIZATION_ID = G_IREC_OLD_ASS_REC.SOURCE_ORGANIZATION_ID
12974 ,ORGANIZATION_ID = G_IREC_OLD_ASS_REC.ORGANIZATION_ID
12975 ,PEOPLE_GROUP_ID = G_IREC_OLD_ASS_REC.PEOPLE_GROUP_ID
12976 ,SOFT_CODING_KEYFLEX_ID = G_IREC_OLD_ASS_REC.SOFT_CODING_KEYFLEX_ID
12977 ,VACANCY_ID = G_IREC_OLD_ASS_REC.VACANCY_ID
12978 ,PAY_BASIS_ID = G_IREC_OLD_ASS_REC.PAY_BASIS_ID
12979 ,ASSIGNMENT_SEQUENCE = G_IREC_OLD_ASS_REC.ASSIGNMENT_SEQUENCE
12980 ,APPLICATION_ID = G_IREC_OLD_ASS_REC.APPLICATION_ID
12981 ,ASSIGNMENT_NUMBER = G_IREC_OLD_ASS_REC.ASSIGNMENT_NUMBER
12982 ,CHANGE_REASON = G_IREC_OLD_ASS_REC.CHANGE_REASON
12983 ,COMMENT_ID = G_IREC_OLD_ASS_REC.COMMENT_ID
12984 ,DATE_PROBATION_END = G_IREC_OLD_ASS_REC.DATE_PROBATION_END
12985 ,DEFAULT_CODE_COMB_ID = G_IREC_OLD_ASS_REC.DEFAULT_CODE_COMB_ID
12986 ,EMPLOYMENT_CATEGORY = G_IREC_OLD_ASS_REC.EMPLOYMENT_CATEGORY
12987 ,FREQUENCY = G_IREC_OLD_ASS_REC.FREQUENCY
12988 ,INTERNAL_ADDRESS_LINE = G_IREC_OLD_ASS_REC.INTERNAL_ADDRESS_LINE
12989 ,MANAGER_FLAG = G_IREC_OLD_ASS_REC.MANAGER_FLAG
12990 ,NORMAL_HOURS = G_IREC_OLD_ASS_REC.NORMAL_HOURS
12991 ,PERF_REVIEW_PERIOD = G_IREC_OLD_ASS_REC.PERF_REVIEW_PERIOD
12992 ,PERF_REVIEW_PERIOD_FREQUENCY = G_IREC_OLD_ASS_REC.PERF_REVIEW_PERIOD_FREQUENCY
12993 ,PERIOD_OF_SERVICE_ID = G_IREC_OLD_ASS_REC.PERIOD_OF_SERVICE_ID
12994 ,PROBATION_PERIOD = G_IREC_OLD_ASS_REC.PROBATION_PERIOD
12995 ,PROBATION_UNIT = G_IREC_OLD_ASS_REC.PROBATION_UNIT
12996 ,SAL_REVIEW_PERIOD = G_IREC_OLD_ASS_REC.SAL_REVIEW_PERIOD
12997 ,SAL_REVIEW_PERIOD_FREQUENCY = G_IREC_OLD_ASS_REC.SAL_REVIEW_PERIOD_FREQUENCY
12998 ,SET_OF_BOOKS_ID = G_IREC_OLD_ASS_REC.SET_OF_BOOKS_ID
12999 ,SOURCE_TYPE = G_IREC_OLD_ASS_REC.SOURCE_TYPE
13000 ,TIME_NORMAL_FINISH = G_IREC_OLD_ASS_REC.TIME_NORMAL_FINISH
13001 ,TIME_NORMAL_START = G_IREC_OLD_ASS_REC.TIME_NORMAL_START
13002 ,REQUEST_ID = G_IREC_OLD_ASS_REC.REQUEST_ID
13003 ,PROGRAM_APPLICATION_ID = G_IREC_OLD_ASS_REC.PROGRAM_APPLICATION_ID
13004 ,PROGRAM_ID = G_IREC_OLD_ASS_REC.PROGRAM_ID
13005 ,PROGRAM_UPDATE_DATE = G_IREC_OLD_ASS_REC.PROGRAM_UPDATE_DATE
13006 ,ASS_ATTRIBUTE_CATEGORY = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE_CATEGORY
13007 ,ASS_ATTRIBUTE1 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE1
13008 ,ASS_ATTRIBUTE2 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE2
13009 ,ASS_ATTRIBUTE3 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE3
13010 ,ASS_ATTRIBUTE4 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE4
13011 ,ASS_ATTRIBUTE5 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE5
13012 ,ASS_ATTRIBUTE6 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE6
13013 ,ASS_ATTRIBUTE7 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE7
13014 ,ASS_ATTRIBUTE8 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE8
13015 ,ASS_ATTRIBUTE9 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE9
13016 ,ASS_ATTRIBUTE10 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE10
13017 ,ASS_ATTRIBUTE11 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE11
13018 ,ASS_ATTRIBUTE12 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE12
13019 ,ASS_ATTRIBUTE13 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE13
13020 ,ASS_ATTRIBUTE14 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE14
13021 ,ASS_ATTRIBUTE15 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE15
13022 ,ASS_ATTRIBUTE16 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE16
13023 ,ASS_ATTRIBUTE17 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE17
13024 ,ASS_ATTRIBUTE18 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE18
13025 ,ASS_ATTRIBUTE19 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE19
13026 ,ASS_ATTRIBUTE20 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE20
13027 ,ASS_ATTRIBUTE21 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE21
13028 ,ASS_ATTRIBUTE22 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE22
13029 ,ASS_ATTRIBUTE23 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE23
13030 ,ASS_ATTRIBUTE24 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE24
13031 ,ASS_ATTRIBUTE25 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE25
13032 ,ASS_ATTRIBUTE26 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE26
13033 ,ASS_ATTRIBUTE27 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE27
13034 ,ASS_ATTRIBUTE28 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE28
13035 ,ASS_ATTRIBUTE29 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE29
13036 ,ASS_ATTRIBUTE30 = G_IREC_OLD_ASS_REC.ASS_ATTRIBUTE30
13037 ,TITLE = G_IREC_OLD_ASS_REC.TITLE
13038 ,OBJECT_VERSION_NUMBER = G_IREC_OLD_ASS_REC.OBJECT_VERSION_NUMBER
13039 ,BARGAINING_UNIT_CODE = G_IREC_OLD_ASS_REC.BARGAINING_UNIT_CODE
13040 ,LABOUR_UNION_MEMBER_FLAG = G_IREC_OLD_ASS_REC.LABOUR_UNION_MEMBER_FLAG
13041 ,HOURLY_SALARIED_CODE = G_IREC_OLD_ASS_REC.HOURLY_SALARIED_CODE
13042 ,CONTRACT_ID = G_IREC_OLD_ASS_REC.CONTRACT_ID
13043 ,COLLECTIVE_AGREEMENT_ID = G_IREC_OLD_ASS_REC.COLLECTIVE_AGREEMENT_ID
13044 ,CAGR_ID_FLEX_NUM = G_IREC_OLD_ASS_REC.CAGR_ID_FLEX_NUM
13045 ,CAGR_GRADE_DEF_ID = G_IREC_OLD_ASS_REC.CAGR_GRADE_DEF_ID
13046 ,ESTABLISHMENT_ID = G_IREC_OLD_ASS_REC.ESTABLISHMENT_ID
13047 ,NOTICE_PERIOD = G_IREC_OLD_ASS_REC.NOTICE_PERIOD
13048 ,NOTICE_PERIOD_UOM = G_IREC_OLD_ASS_REC.NOTICE_PERIOD_UOM
13049 ,EMPLOYEE_CATEGORY = G_IREC_OLD_ASS_REC.EMPLOYEE_CATEGORY
13050 ,WORK_AT_HOME = G_IREC_OLD_ASS_REC.WORK_AT_HOME
13051 ,JOB_POST_SOURCE_NAME = G_IREC_OLD_ASS_REC.JOB_POST_SOURCE_NAME
13052 ,POSTING_CONTENT_ID = G_IREC_OLD_ASS_REC.POSTING_CONTENT_ID
13053 ,PERIOD_OF_PLACEMENT_DATE_START = G_IREC_OLD_ASS_REC.PERIOD_OF_PLACEMENT_DATE_START
13054 ,VENDOR_ID = G_IREC_OLD_ASS_REC.VENDOR_ID
13055 ,VENDOR_EMPLOYEE_NUMBER = G_IREC_OLD_ASS_REC.VENDOR_EMPLOYEE_NUMBER
13056 ,VENDOR_ASSIGNMENT_NUMBER = G_IREC_OLD_ASS_REC.VENDOR_ASSIGNMENT_NUMBER
13057 ,ASSIGNMENT_CATEGORY = G_IREC_OLD_ASS_REC.ASSIGNMENT_CATEGORY
13058 ,PROJECT_TITLE = G_IREC_OLD_ASS_REC.PROJECT_TITLE
13059 ,APPLICANT_RANK = G_IREC_OLD_ASS_REC.APPLICANT_RANK
13060 ,GRADE_LADDER_PGM_ID = G_IREC_OLD_ASS_REC.GRADE_LADDER_PGM_ID
13061 ,SUPERVISOR_ASSIGNMENT_ID = G_IREC_OLD_ASS_REC.SUPERVISOR_ASSIGNMENT_ID
13062 ,VENDOR_SITE_ID = G_IREC_OLD_ASS_REC.VENDOR_SITE_ID
13063 ,PO_HEADER_ID = G_IREC_OLD_ASS_REC.PO_HEADER_ID
13064 ,PO_LINE_ID = G_IREC_OLD_ASS_REC.PO_LINE_ID
13065 ,PROJECTED_ASSIGNMENT_END = G_IREC_OLD_ASS_REC.PROJECTED_ASSIGNMENT_END
13066
13067 where assignment_id = G_IREC_OLD_ASS_REC.assignment_id
13068 and p_effective_date between effective_start_date and effective_end_date
13069 ;
13070 -- Bug 10350428: Added the date condition in above update statement
13071 -- update ends
13072 hr_general.g_data_migrator_mode := l_old_data_migrator_mode ;
13073
13074 exception
13075 when others then
13076 raise;
13077 end;
13078 end if; --end irec2
13079 --
13080 benutils.write(p_text => benutils.g_banner_asterix);
13081 --
13082 p_person_count := p_person_count +1;
13083 --
13084 g_action_rec.person_action_id := p_person_action_id;
13085 g_action_rec.action_status_cd := 'P';
13086 g_action_rec.ler_id := p_ler_id;
13087 g_action_rec.object_version_number := p_object_version_number;
13088 g_action_rec.effective_date := p_effective_date;
13089 --
13090 benutils.write(p_rec => g_action_rec);
13091 --
13092 if g_debug then
13093 hr_utility.set_location ('Leaving '||l_package,10);
13094 end if;
13095 --
13096 end process_comp_objects;
13097 --
13098 procedure process_life_events
13099 (p_person_id in number default null,
13100 p_person_action_id in number default null,
13101 p_object_version_number in out nocopy number,
13102 p_business_group_id in number,
13103 p_mode in varchar2,
13104 p_ler_id in number default null,
13105 p_person_selection_rule_id in number default null,
13106 p_comp_selection_rule_id in number default null,
13107 -- PB : 5422 :
13108 -- p_popl_enrt_typ_cycl_id in number default null,
13109 p_derivable_factors in varchar2 default 'ASC',
13110 p_cbr_tmprl_evt_flag in varchar2 default 'N',
13111 p_person_count in out nocopy number,
13112 p_error_person_count in out nocopy number,
13113 p_lf_evt_ocrd_dt in date,
13114 p_effective_date in date,
13115 p_validate in varchar2 default 'N', /* Bug 5550359 */
13116 p_gsp_eval_elig_flag in varchar2 default null, /* GSP Rate Sync */
13117 p_lf_evt_oper_cd in varchar2 default null /* GSP Rate Sync */
13118 ) is
13119 --
13120 l_package varchar2(80);
13121 l_ler_id number := p_ler_id;
13122 l_rec benutils.g_active_life_event;
13123 l_env ben_env_object.g_global_env_rec_type;
13124 l_encoded_message varchar2(2000);
13125 l_app_short_name varchar2(2000);
13126 l_message_name varchar2(2000);
13127 l_per_rec per_all_people_f%rowtype;
13128 p_prtt_cache varchar2(1) ;
13129 l_module varchar2(30);
13130 --
13131 begin
13132 --
13133 g_debug := hr_utility.debug_enabled;
13134 if g_debug then
13135 l_package := g_package||'.process_life_events';
13136 hr_utility.set_location ('Entering '||l_package,10);
13137 end if;
13138 --
13139 -- Create savepoint for error handling purposes
13140 --
13141 savepoint process_life_event_savepoint;
13142 benutils.set_cache_record_position;
13143
13144 -- iRec
13145 -- In iRecruitment mode, as multiple life events for a person could be processed for
13146 -- single person on a given day, clear down person cache. This change is necessary as
13147 -- same session could be used to process the person using different applicant assignments.
13148 if p_mode = 'I' then
13149 --
13150 ben_person_object.clear_down_cache;
13151 --
13152 end if;
13153 --
13154 -- iRec
13155
13156 -- bug 7374364
13157 ben_use_cvg_rt_date.clear_fonm_globals;
13158 --
13159 --
13160 if g_debug then
13161 hr_utility.set_location (l_package||' Bef evaluate_life_events ',13);
13162 end if;
13163 --
13164 -- PB : 5422 :
13165 -- Now if benmngle is run in Life event mode and the winner
13166 -- is open then change the mode of benmngle run for this
13167 -- person and proceed. Means the mode to be changed on the fly.
13168 -- To make above logic work store the mode in global. Which
13169 -- may change later.
13170 --
13171 ben_manage_life_events.g_modified_mode := p_mode;
13172 --
13173 /* GSP Rate Sync */
13174 p_prtt_cache := 'N' ;
13175 -- begin 4496944
13176 begin
13177 person_header_new
13178 (p_person_id => p_person_id,
13179 p_business_group_id => p_business_group_id);
13180 exception
13181 when others then
13182 --
13183 if g_debug then
13184 hr_utility.set_location ('Not Logging Person Header information for person_id : '||p_person_id ||' p_business_group_id : '||p_business_group_id,12);
13185 end if;
13186
13187 end;
13188 -- end 4496944
13189 if g_cache_person_prtn.last is not null then
13190 p_prtt_cache := 'Y' ;
13191 end if ;
13192
13193 evaluate_life_events
13194 (p_person_id => p_person_id,
13195 p_business_group_id => p_business_group_id,
13196 p_mode => p_mode,
13197 p_ler_id => l_ler_id,
13198 -- PB : 5422 :
13199 -- p_popl_enrt_typ_cycl_id => p_popl_enrt_typ_cycl_id,
13200 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
13201 p_effective_date => p_effective_date,
13202 p_validate => p_validate, /* Bug 5550359 */
13203 p_gsp_eval_elig_flag => p_gsp_eval_elig_flag, /* GSP Rate Sync */
13204 p_lf_evt_oper_cd => p_lf_evt_oper_cd /* GSP Rate Sync */
13205 );
13206
13207 if g_debug then
13208 hr_utility.set_location (l_package||' Dn evaluate_life_events ',15);
13209 end if;
13210 --
13211 if p_mode not in ('A','P','S','T') then
13212 --
13213 if p_mode in ( 'R', 'U') then
13214 --
13215 benutils.get_active_life_event
13216 (p_person_id => p_person_id,
13217 p_business_group_id => p_business_group_id,
13218 p_effective_date => p_effective_date,
13219 p_lf_event_mode => 'U',
13220 p_rec => l_rec);
13221 else
13222 --
13223 --
13224 -- CWB Changes .
13225 --
13226 if p_mode = 'W' then
13227 --
13228 benutils.get_active_life_event
13229 (p_person_id => p_person_id,
13230 p_business_group_id => p_business_group_id,
13231 p_effective_date => p_effective_date,
13232 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
13233 p_ler_id => p_ler_id,
13234 p_rec => l_rec);
13235 --
13236 elsif p_mode = 'G' then
13237 --
13238 benutils.get_active_life_event
13239 (p_person_id => p_person_id,
13240 p_business_group_id => p_business_group_id,
13241 p_effective_date => p_effective_date,
13242 p_lf_event_mode => 'G',
13243 p_rec => l_rec);
13244 --
13245 elsif p_mode = 'M' then
13246 --
13247 benutils.get_active_life_event
13248 (p_person_id => p_person_id,
13249 p_business_group_id => p_business_group_id,
13250 p_effective_date => p_effective_date,
13251 p_lf_event_mode => 'M',
13252 p_rec => l_rec);
13253 --
13254 else
13255 --
13256 benutils.get_active_life_event
13257 (p_person_id => p_person_id,
13258 p_business_group_id => p_business_group_id,
13259 p_effective_date => p_effective_date,
13260 p_rec => l_rec);
13261 --
13262 end if;
13263 --
13264 if g_debug then
13265 hr_utility.set_location (l_package||' Dn get_active_life_event ',17);
13266 end if;
13267 --
13268 end if;
13269 --
13270 end if;
13271 --
13272 -- ABSE : 2652690 : For every absence life event recache the person data.
13273 --
13274 if nvl(ben_manage_life_events.g_modified_mode, p_mode) in ('G', 'M') then
13275 --
13276 ben_person_object.clear_down_cache;
13277 --
13278 end if;
13279 --
13280
13281
13282 --- build comp object clear the person level cacahe
13283 -- then build it again 4204020
13284 --if p_prtt_cache = 'Y' and g_cache_person_prtn.last is null then
13285 cache_person_information
13286 (p_person_id => p_person_id,
13287 p_business_group_id => p_business_group_id,
13288 p_effective_date => nvl(l_rec.lf_evt_ocrd_dt,p_effective_date));
13289
13290 if g_debug then
13291 hr_utility.set_location ('Dn Cac Per Inf '||l_package,10);
13292 end if;
13293 --
13294 --end if ;
13295
13296
13297 /* Moved call to person_header before evaluate_life_events
13298 person_header
13299 (p_person_id => p_person_id,
13300 p_business_group_id => p_business_group_id,
13301 p_effective_date => nvl(l_rec.lf_evt_ocrd_dt,p_effective_date));
13302 */
13303 --
13304 if g_debug then
13305 hr_utility.set_location (l_package||' Bef process_comp_objects ',17);
13306 end if;
13307 process_comp_objects
13308 (p_person_id => p_person_id,
13309 p_person_action_id => p_person_action_id,
13310 p_object_version_number => p_object_version_number,
13311 p_business_group_id => p_business_group_id,
13312 p_mode => nvl(ben_manage_life_events.g_modified_mode, p_mode),
13313 p_ler_id => l_ler_id,
13314 p_derivable_factors => g_derivable_factors,
13315 p_cbr_tmprl_evt_flag => p_cbr_tmprl_evt_flag,
13316 p_person_count => p_person_count,
13317 -- PB : 5422 :
13318 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
13319 -- p_popl_enrt_typ_cycl_id => p_popl_enrt_typ_cycl_id,
13320 p_effective_date => p_effective_date,
13321 p_gsp_eval_elig_flag => p_gsp_eval_elig_flag, /* GSP Rate Sync */
13322 p_lf_evt_oper_cd => p_lf_evt_oper_cd /* GSP Rate Sync */
13323 );
13324 --
13325 if p_mode in ('W','G') then
13326 if p_mode = 'W' then
13327 l_module := 'CWB';
13328 elsif p_mode = 'G' then
13329 l_module := 'GSP';
13330 end if;
13331 --
13332 if g_debug then
13333 hr_utility.set_location ('Calling pqh ranking proc ',10);
13334 hr_utility.set_location ('p_benefit_action_id=>'||benutils.g_benefit_action_id,10);
13335 hr_utility.set_location ('p_module=>'||l_module,10);
13336 hr_utility.set_location ('p_per_in_ler_id=>'||l_rec.per_in_ler_id,10);
13337 hr_utility.set_location ('p_person_id=>'||p_person_id,10);
13338 hr_utility.set_location ('p_effective_date=>'||l_rec.lf_evt_ocrd_dt,10);
13339 end if;
13340 --
13341 pqh_ranking.compute_total_score (
13342 p_benefit_action_id => benutils.g_benefit_action_id
13343 ,p_module => l_module
13344 ,p_per_in_ler_id => l_rec.per_in_ler_id
13345 ,p_person_id => p_person_id
13346 ,p_effective_date => l_rec.lf_evt_ocrd_dt );
13347 --
13348 end if;
13349 if g_debug then
13350 hr_utility.set_location ('Leaving '||l_package,10);
13351 end if;
13352 --
13353 exception
13354 --
13355 when g_record_error then
13356 --
13357 if g_debug then
13358 hr_utility.set_location ('PLE g_record_error '||l_package,10);
13359 end if;
13360 --
13361 -- An error has occured so rollback anything that could have been
13362 -- inserted into tables at this point.
13363 --
13364 if g_debug then
13365 hr_utility.set_location ('PERSON ERROR '||l_package,10);
13366 end if;
13367
13368 /*Bug 14484281*/
13369 begin
13370 rollback to process_life_event_savepoint;
13371 exception
13372 when others then
13373 hr_utility.set_location ('SQL CODE '||SQLCODE,101.99);
13374 hr_utility.set_location ('SQLMSG '||SQLERRM,101.99);
13375 end;
13376 --
13377 -- Roll cache to savepoint
13378 --
13379 benutils.rollback_cache;
13380 --
13381 -- WW1178659 - Set the life event occured date to the effective
13382 -- date because the life event occured date may not have been
13383 -- derived. We can do this because national identifier is
13384 -- non-updateable so the effective date is irrelevant when
13385 -- getting person information.
13386 --
13387 ben_env_object.setenv(p_lf_evt_ocrd_dt => p_effective_date);
13388 ben_env_object.get(p_rec => l_env);
13389 ben_person_object.get_object(p_person_id => p_person_id,
13390 p_rec => l_per_rec);
13391
13392 g_rec.person_id := p_person_id;
13393 g_rec.pgm_id := l_env.pgm_id;
13394 g_rec.pl_id := l_env.pl_id;
13395 g_rec.oipl_id := l_env.oipl_id;
13396 l_encoded_message := fnd_message.get_encoded;
13397 fnd_message.parse_encoded(encoded_message => l_encoded_message,
13398 app_short_name => l_app_short_name,
13399 message_name => l_message_name);
13400 fnd_message.set_encoded(encoded_message => l_encoded_message);
13401
13402 g_rec.rep_typ_cd := 'ERROR';
13403 g_rec.national_identifier := l_per_rec.national_identifier;
13404
13405 -- Bug 2836770
13406 -- Added nvl's for l_message_name and fnd_message.get
13407 -- made call to write_table_and_file
13408 --
13409 g_rec.error_message_code := nvl(l_message_name , g_rec.error_message_code);
13410 g_rec.text := nvl(fnd_message.get , g_rec.text );
13411 --
13412 --benutils.write(p_text => g_rec.text); /* GSP Rate Sync */
13413 benutils.write(p_rec => g_rec);
13414 --
13415 -- benutils.write_table_and_file(p_table => true,
13416 -- p_file => true);
13417
13418 -- Bug 2836770
13419 g_action_rec.person_action_id := p_person_action_id;
13420 g_action_rec.action_status_cd := 'E';
13421 g_action_rec.ler_id := p_ler_id;
13422 g_action_rec.object_version_number := p_object_version_number;
13423 g_action_rec.effective_date := p_effective_date;
13424 --
13425 benutils.write(p_rec => g_action_rec);
13426 --
13427 p_error_person_count := p_error_person_count +1;
13428 --
13429 -- bug 7374364
13430 ben_use_cvg_rt_date.clear_fonm_globals;
13431 --
13432 if p_error_person_count = g_max_errors_allowed then
13433 --
13434 fnd_message.set_name('BEN','BEN_91662_BENMNGLE_ERROR_LIMIT');
13435 benutils.write(p_text => fnd_message.get);
13436 if g_debug then
13437 hr_utility.set_location ('PLE g_record_error Err Lim '||l_package,10);
13438 end if;
13439 --
13440 -- Write the last bit of information for the thread before
13441 -- the rollback fires when we raise the error.
13442 --
13443 benutils.write_table_and_file(p_table => true,
13444 p_file => true);
13445 commit;
13446 --
13447 raise;
13448 --
13449 end if;
13450 --
13451 -- Bug 5232223
13452 --
13453 when g_cwb_trk_ineligible then
13454 --
13455 if g_debug then
13456 hr_utility.set_location ('PLE g_life_event_after '||l_package,10);
13457 end if;
13458 --
13459 rollback to process_life_event_savepoint;
13460 --
13461 -- process.
13462 --
13463 g_action_rec.person_action_id := p_person_action_id;
13464 g_action_rec.action_status_cd := 'P';
13465 g_action_rec.ler_id := p_ler_id;
13466 g_action_rec.object_version_number := p_object_version_number;
13467 g_action_rec.effective_date := p_effective_date;
13468 --
13469 -- bug 7374364
13470 ben_use_cvg_rt_date.clear_fonm_globals;
13471 --
13472 benutils.write(p_rec => g_action_rec);
13473 --
13474 p_person_count := p_person_count +1;
13475 --
13476 when g_life_event_after then
13477 --
13478 if g_debug then
13479 hr_utility.set_location ('PLE g_life_event_after '||l_package,10);
13480 end if;
13481 --
13482 -- We don't want to roll back the transaction, just carry on with the
13483 -- process.
13484 --
13485 g_action_rec.person_action_id := p_person_action_id;
13486 g_action_rec.action_status_cd := 'P';
13487 g_action_rec.ler_id := p_ler_id;
13488 g_action_rec.object_version_number := p_object_version_number;
13489 g_action_rec.effective_date := p_effective_date;
13490 --
13491 -- bug 7374364
13492 ben_use_cvg_rt_date.clear_fonm_globals;
13493 --
13494 benutils.write(p_rec => g_action_rec);
13495 --
13496 p_person_count := p_person_count +1;
13497 --
13498 when app_exception.application_exception then
13499 --
13500 if g_debug then
13501 hr_utility.set_location ('PLE application_exception '||l_package,12);
13502 end if;
13503 --
13504 -- Update person action to errored as record has an error
13505 --
13506 rollback to process_life_event_savepoint;
13507 benutils.rollback_cache;
13508 --
13509 -- Roll cache to savepoint
13510 --
13511 ben_env_object.setenv(p_lf_evt_ocrd_dt => p_effective_date);
13512 ben_env_object.get(p_rec => l_env);
13513 ben_person_object.get_object(p_person_id => p_person_id,
13514 p_rec => l_per_rec);
13515 g_rec.person_id := p_person_id;
13516 g_rec.pgm_id := l_env.pgm_id;
13517 g_rec.pl_id := l_env.pl_id;
13518 g_rec.oipl_id := l_env.oipl_id;
13519 l_encoded_message := fnd_message.get_encoded;
13520 fnd_message.parse_encoded(encoded_message => l_encoded_message,
13521 app_short_name => l_app_short_name,
13522 message_name => l_message_name);
13523 fnd_message.set_encoded(encoded_message => l_encoded_message);
13524 g_rec.rep_typ_cd := 'ERROR';
13525 g_rec.error_message_code := l_message_name;
13526 g_rec.national_identifier := l_per_rec.national_identifier;
13527 g_rec.text := fnd_message.get;
13528 benutils.write(p_text => g_rec.text);
13529 benutils.write(p_rec => g_rec);
13530 --
13531 g_action_rec.person_action_id := p_person_action_id;
13532 g_action_rec.action_status_cd := 'E';
13533 g_action_rec.ler_id := p_ler_id;
13534 g_action_rec.object_version_number := p_object_version_number;
13535 g_action_rec.effective_date := p_effective_date;
13536 -- bug 7374364
13537 ben_use_cvg_rt_date.clear_fonm_globals;
13538 --
13539 --
13540 benutils.write(p_rec => g_action_rec);
13541 --
13542 p_error_person_count := p_error_person_count +1;
13543 --
13544 if p_error_person_count = g_max_errors_allowed then
13545 --
13546 fnd_message.set_name('BEN','BEN_91662_BENMNGLE_ERROR_LIMIT');
13547 benutils.write(p_text => fnd_message.get);
13548 --
13549 -- Write the last bit of information for the thread before
13550 -- the rollback fires when we raise the error.
13551 --
13552 benutils.write_table_and_file(p_table => true,
13553 p_file => true);
13554 commit;
13555 --
13556 raise;
13557 --
13558 end if;
13559 --
13560 when others then
13561 --
13562 if g_debug then
13563 hr_utility.set_location ('SERIOUS Error '||l_package,10);
13564 end if;
13565 --
13566 -- Update person action to errored as record has an error
13567 --
13568 rollback to process_life_event_savepoint;
13569 benutils.rollback_cache;
13570 --
13571 g_rec.rep_typ_cd := 'FATAL';
13572 g_rec.text := sqlerrm;
13573 benutils.write(p_rec => g_rec);
13574 --
13575 g_action_rec.person_action_id := p_person_action_id;
13576 g_action_rec.action_status_cd := 'E';
13577 g_action_rec.ler_id := p_ler_id;
13578 g_action_rec.object_version_number := p_object_version_number;
13579 g_action_rec.effective_date := p_effective_date;
13580
13581 -- bug 7374364
13582 ben_use_cvg_rt_date.clear_fonm_globals;
13583 --
13584 --
13585 benutils.write(p_rec => g_action_rec);
13586 --
13587
13588 p_error_person_count := p_error_person_count +1;
13589 --
13590 raise;
13591 --
13592 end process_life_events;
13593 --
13594 procedure init_bft_statistics
13595 (p_business_group_id in number
13596 )
13597 is
13598 --
13599 l_proc varchar2(80) := g_package||'.init_bft_statistics';
13600 --
13601 begin
13602 --
13603 g_debug := hr_utility.debug_enabled;
13604 --
13605 g_proc_rec.business_group_id := p_business_group_id;
13606 g_proc_rec.strt_dt := sysdate;
13607 g_proc_rec.strt_tm := to_char(sysdate,'HH24:MI:SS');
13608 g_strt_tm_numeric := dbms_utility.get_time;
13609 --
13610 end init_bft_statistics;
13611 --
13612 procedure write_bft_statistics
13613 (p_business_group_id in number
13614 ,p_benefit_action_id in number
13615 )
13616 is
13617 --
13618 l_proc varchar2(80);
13619 --
13620 cursor c_person_actions(p_status_cd varchar2) is
13621 select count(*)
13622 from ben_person_actions pac
13623 where pac.benefit_action_id = p_benefit_action_id
13624 and pac.action_status_cd = nvl(p_status_cd,pac.action_status_cd);
13625 --
13626 begin
13627 --
13628 g_debug := hr_utility.debug_enabled;
13629 --
13630 g_proc_rec.end_dt := sysdate;
13631 g_proc_rec.end_tm := to_char(sysdate,'HH24:MI:SS');
13632 g_end_tm_numeric := dbms_utility.get_time;
13633 g_proc_rec.elpsd_tm := (g_end_tm_numeric-g_strt_tm_numeric)/100;
13634 --
13635 if g_debug then
13636 l_proc := g_package||'.write_bft_statistics';
13637 hr_utility.set_location (l_proc||' Master process ',30);
13638 end if;
13639 open c_person_actions(null);
13640 fetch c_person_actions into g_proc_rec.per_slctd;
13641 close c_person_actions;
13642 if g_debug then
13643 hr_utility.set_location (l_proc||' c_person_actions(null)',31);
13644 end if;
13645 --
13646 open c_person_actions('E');
13647 fetch c_person_actions into g_proc_rec.per_err;
13648 close c_person_actions;
13649 if g_debug then
13650 hr_utility.set_location (l_proc||' c_person_actions(E) ',32);
13651 end if;
13652 --
13653 open c_person_actions('P');
13654 fetch c_person_actions into g_proc_rec.per_proc_succ;
13655 close c_person_actions;
13656 if g_debug then
13657 hr_utility.set_location (l_proc||' c_person_actions(P) ',33);
13658 end if;
13659 --
13660 open c_person_actions('U');
13661 fetch c_person_actions into g_proc_rec.per_unproc;
13662 close c_person_actions;
13663 --
13664 if g_debug then
13665 hr_utility.set_location (l_proc||' Done c_person_actions ',35);
13666 end if;
13667 g_proc_rec.business_group_id := p_business_group_id;
13668 g_proc_rec.per_proc := nvl(g_proc_rec.per_proc_succ,0)+
13669 nvl(g_proc_rec.per_err,0);
13670 --
13671 if g_debug then
13672 hr_utility.set_location (l_proc||' Write ',35);
13673 end if;
13674 benutils.write(p_rec => g_proc_rec);
13675 --
13676 end write_bft_statistics;
13677 --
13678 end ben_manage_life_events;