[Home] [Help]
PACKAGE BODY: APPS.BEN_DETERMINE_ACTIVITY_BASE_RT
Source
4 /*
1 Package Body BEN_DETERMINE_ACTIVITY_BASE_RT as
2 /* $Header: benactbr.pkb 120.24.12020000.4 2013/02/18 10:28:03 amnaraya ship $ */
3 --------------------------------------------------------------------------------
5 +==============================================================================+
6 | Copyright (c) 1997 Oracle Corporation |
7 | Redwood Shores, California, USA |
8 | All rights reserved. |
9 +==============================================================================+
10 Name: Determine Activity Base Rates
11
12 Purpose:
13 This program Determines the Activity Base Rate. Whether it be a Standard
14 Rate, Flex Credit, or Imputed Income, the calculation and processing are
15 the same.
16
17 History:
18 Date Who Version What?
19 ---- --- ------- -----
20 7 May 98 Ty Hayden 110.0 Created.
21 16 Jun 98 T Guy 110.1 Removed exception.
22 18 Jun 98 Ty Hayden 110.2 Added p_rt_usg_cd
23 p_bnft_prvdr_pool_id
24 p_prtt_rt_val_id
25 25 Jun 98 T Guy 110.3 Replaced all occurrences of
26 'PER10' with 'PERTEN'
27 15 Jul 98 Ty Hayden 110.4 Assign rt_usg_cd to output.
28 21 Jul 98 T Guy 110.5 Removed return statements and
29 replaced with hard errors for
30 NULL l_compensation,
31 l_actl_prem_value,
32 l_prnt_rt_value.
33 11 Aug 98 Ty Hayden 110.6 Added mlt_cd, val, and mn_mx edits.
34 8 Oct 98 T Guy 115.1 Added error messages and set location
35 calls.
36 19 Oct 98 T Guy 115.2 Added ann_val, ann_mn-mx val, cmcd val
37 mn - mx acty ref period cd,
38 actl_prem_id, cvg_amt_cal_mthd_id
39 bnft_rt_typ_cd, rt_typ_cd, rt_mlt_cd,
40 comp_lvl_fctr_id, entr_ann_val_flag,
41 ptd_comp_lvl_fctr_id, ann_dflt_val
42 Put in rate calculated prior to enrollment
43 logic.
44 Added call to calculate rt_strt_dt and
45 get rt_strt_dt_cd and rl.
46 ben_determine_date.rate_and_coverage_dates
47 25 Oct 98 T Guy 115.3 removed show errors
48 27 Oct 98 T Guy 115.4 removed date track for ben_prtt_rt_val_f
49 29 Oct 98 T Guy 115.5 fixed dflt_ann val
50 12 Nov 98 T Guy 115.6 Implemented overall min/max val and
51 rules
52 24 Nov 98 T Guy 115.7 Fixed undefined upr/lwr rule checking
53 02 Dec 98 T Guy 115.8 removed mlt_cd FLENR, this was replaced
57 02 Dec 98 T Guy 115.10 Version syncing.
54 by entr_val_at_enrt_flag.
55 02 Dec 98 T Guy 115.9 Put mlt_cd FLENR back in until form is
56 fixed to handle enter val at enrt.
58 08 Dec 98 T Guy 115.11 added comp_lvl_fctr_id assignment when
59 entr_at_enrt_flag = Y
60 17-Dec-98 T Guy 115.12 Fixed bug 1582 - took out nocopy cursor c_btr
61 because comp_lvl_fctr_id is now
62 stored on acty_base_rt.
63 bug 1589 - changed logic process
64 to check that actl_prem_id is
65 not null before calling actl_prem
66 22-Dec-98 T Guy 115.13 Removed the FLENR mlt_cd and added
67 entr_val_at_enrt_flag
68 05-Jan-98 T Guy 115.14 Fixed cursor c_abr2
69 18-Jan-99 G Perry 115.15 LED V ED
70 24-Feb-99 T Guy 115.16 Added overide check
71 09-Mar-99 G Perry 115.17 IS to AS.
72 06-Apr-99 T Guy 115.18 Fixed the overide date check
73 24-Apr-99 lmcdonal 115.19 prtt-rt-val now has a status code
74 as does prtt_enrt_rslt.
75 07-may-99 shdas 115.20 added parameters to genutils.formula.
76 08-May-99 jcarpent 115.21 Pass greatest(elig_strt_dt,
77 lf_evt_ocrd_dt)into start dt routines.
78 27 May 99 maagrawa 115.22 Modified the procedure to be called
79 without passing in the chc_id and pass
80 in reqd. details instead.
81 02 Jun 99 tguy 115.23 Modified the main procedure check that
82 effective start date of acty_base_rt is
83 >= enrt_perd_strt_dt for this chc.
84 28 Jun 99 tguy 115.24 Made total premium changes
85 02 Jul 99 lmcdonal 115.25 Make use of genutils limit_checks and
86 rt_typ_calc.
87 09 Jul 99 bbulusu 115.25 Added checks for backed out nocopy life evt.
88 16 Jul 99 lmcdonal 115.26 limit_checks parms changed.
89 20 JUL 99 Gperry 115.27 genutils -> benutils package rename.
90 22 JUL 99 mhoyes 115.28 - Added trace messages.
91 - Replace +0s.
92 31 AUG 99 mhoyes 115.30 - Added trace messages.
93 07 SEP 99 tguy 115.31 fixed call to
94 pay_mag_utils.lookup_jurisdiction_code
95 10-SEP-99 maagrawa 115.32 Bug 3109. enrt_perd_strt_dt to be
96 effective date when no chc is passed.
97 13-sep-99 jcarpent 115.33 Bug 3252. use only epe.bg_id not
98 p_business_group_id, since may be null
99 bug is that no current enrt found due
100 to business group mismatch (null).
101 13-sep-1999 jcarpent 115.34 - Patch on 115.29 for bug 3252.
102 13-sep-1999 jcarpent 115.35 - Leapfrog. Same as version 115.33
103 except comments.
104 21-sep-1999 tguy 115.36 added check for dflt_enrt_cd for
105 dflt_val assignemnt
106 29-Sep-1999 lmcdonal 115.37 Call prorate_min_max and compare_balances.
107 04-Oct-1999 tguy 115.38 added call to dt_fndate
108 21-Oct-1999 pbodla 115.39 benutils.limit_checks: p_val is sent
109 instead of l_rounded_value
110 29-Oct-1999 lmcdonal 115.40 When the use calc acty bs rt flag is OFF
111 do not calc the rate out, just send along
112 the 'value' field.
113 See bugs3549_3552.doc.
114 14-Nov-1999 mhoyes 115.41 - Added trace messages.
115 16-Nov-1999 pbodla 115.42 - Added acty_base_rt_id as context to
116 val_calc_rl evaluation and to
117 limit_checks, rate_and_coverage_dates
118 calls.
119 18-Nov-1999 pbodla 115.43 - Added p_elig_per_elctbl_chc_id as context to
120 val_calc_rl evaluation , passed to limit_checks
121 29-Nov-1999 jcarpent 115.44 - Added call to det._dflt_enrt_cd
122 15-Dec-1999 lmcdonal 115.45 Do not force min and max values if the entr-
123 ann-val-flag is on.
124 17-Jan-00 tguy 115.46 Added check for rounding when vrbl
125 rt trtmt cd = rplc do not round at
126 value at this level
127 20-Jan-00 maagrawa 115.47 Pass payroll_id to ben_distribute_rates
128 20-Jan-00 lmcdonal 115.48 If enrt_bnft cvg val is null, use dflt
129 val. Bug 1118016.
130 09-FEB-2000 pbodla 115.49 - Bug : 1169626 p_acty_base_rt_id is passed
131 to formula instead of l_acty_base_rt_id
132 18-FEB-2000 pbodla 115.50 - c_prv modified : order by clause added.
133 When prv record is fetched it is fetching
134 the first row. It should fetch the latest
135 participant rate value record for a given
136 enrollment result id.
140 91383 to 92833 in the message name
137 29-Mar-00 mmogel 115.51 I changed the message numbers from
138 91382 to 91832 in the message name
139 BEN_91382_PACKAGE_PARAM_NULL and the
141 BEN_91833_CURSOR_RETURN_NO_ROW and also
142 added tokens to some other messages
143 31-Mar-2000 jcarpent 115.52 - bug 1252087/4983. Fix dflt_val for
144 dflt_enrt_cds of 'NSDCS','NNCS';
145 19-Apr-2000 lmcdonal 115.53 - bug 5088, per gp, calls to dt_fndate.
146 change_ses_date should be in the highest
147 level batch processes (for rule calls)
148 not in lower level procs like this one.
149
150 10-MAY-200 Tilak 115.54 bug 4816 l_val is not rounded to hundredth fixd by
151 correcting if condition. nvl added in l_vr_trtmt_cd
152 12-MAY-2000 mhoyes 115.55 - Added messages for profiling.
153 22-May-2000 lmcdonal 115.56 Leap frog of 52 with fix for 1295277:
154 when checking to see if
155 acty-base-rt is already a prtt-rt-val
156 record, do not compare acty-typ-cd; this
157 can come from the acty-base-rt row OR
158 from vrbl-rt row.
159 22-May-2000 lmcdonal 115.57 Bug 1295277: fix noted above. This is
160 leap from version 55. 'real' version.
161 22-May-2000 lmcdonal 115.58 leap of version 56 to allow fido to fix
162 aera data.
163 22-May-20000 lmcdonal 115.59 'real' version....allow mis-matched
164 acty-type and tax-type codes, causing
165 update to be determined only by
166 acty-base-rt-id.
167 26-May-2000 shdas 115.60 round rates before variable
168 rates applied--5152.
169 29-May-2000 mhoyes 115.61 Added record structures to main.
170 29-May-2000 mhoyes 115.62 Re-applied fix 5152.
171 31-May-2000 mhoyes 115.63 Added enrt_perd_strt_dt to p_currepe_row.
172 12-JUN-2000 tilak 115.64 acty_base_rt >= enrt_perd_strt_dt condition
173 is removed from c_abr cursor for bug 5173
174 This conition return no row .when the enrollment for future
175 period the date betwen chek the future period and this condion
176 check the current period
177 26-JUN-2000 shdas 115.65 added codes for new mlt_cd 'SAREC'.
178 28-JUN-2000 mhoyes 115.66 - Fixed duplicate rate problem.
179 - Tuned c_prv.
180 - Bypassed c_current_elig when prtn_strt_dt
181 is passed in.
182 25-AUG-2000 pbodla 115.67 - Bug : 1386285 : When RT_OVRIDN_THRU_DT
183 is null assume it as EOT.
184 28-SEP-2000 stee 115.68 - Added p_cal_val for UK Select to
185 calculate a child rate if the parent
186 rate is calculate at enrollment.
187 27-AUG-2000 RCHASE 115.69 - wwbug#1207803.999 - correct perfprv
188 cursor to fetch rows when
189 updates have been made to the enrollment
190 result past the life event occured date.
191 This is a leapfrog version based on
192 115.67.
193 29-AUG-2000 jcarpent 115.70 - Merge version based on 115.68 and
194 115.69.
195 06-Nov-2000 tilak 115.71 bug-1480407 calculation of rate for enter at entrolment is added
196 06-nov-2000 tilak 115.72
197 29-nov-2000 gperry 115.73 Added person_id to epe record so that
198 rules work correctly in rate and
199 coverage call. WWBUG 1510623.
200 15-jan-2001 tilak 115.74 encremental chek is added to the rate
201 22-jan-2001 tilak 115.75 p_parent_val added to calculate the parent value
202 when the child recod called for calucaltion from
203 enrollment and parent entr_val_at_entr is on
204 07-mar-2001 tilak 115.76 bug : 1628762, when the premium based on coverage
205 and coverage is range then benefit id reauired
206 to get the premiuum value -c_enrt_prem cursor changed
207 06-mar-2001 ikasire 115.77 bug 1650517 not passing p_complete_year_flag
208 for SAREC condition for communicated amount
209 calculation
210 15-mar-2001 tilak 115.78 bun : 1676551 calling premium calcualtion
211 21-mar-2001 tilak 115.79 ultmt_upr_lmt,ultmt_lwr_lmt is validated
212 01-apr-2001 tilak 115.80 ultmt_upr_lmt_calc_rl ,ltmt_lwr_lmtcalc_rl is validated
213 01-may-2001 kmahendr 115.81 Bug#1749068 - changed p_cal_val value depending on parent rate's
214 enter value at enrollment flag
215 03-may-2001 kmahendr 115.83 As version 115.82 was based on leapfrog of version 115.77,
216 version 115.81 brought forward.
217 13-Jul-2001 ikasire 115.84 bug 1834655 fixed the code for default enrollment
221 27-Aug-2001 mhoyes 115.87 - Replaced generic error messages,
218 13-Jul-2001 ikasire 115.85 removed the show errors
219 18-Jul-2001 ikasire 115.86 bug 1834655 added ann_rt_val to prv and perfprv
220 cursors
222 - 91832 with 92748.
223 - 91833 with 92743, 92738, 92739, 92740
224 92741, 92742
225 - 91835 with 92744, 92745, 92746, 92747
226 29-aug-2001 tilak 115.88 bug:1949361 jurisdiction code is
227 derived inside benutils.formula.
228 27-Sep-2001 kmahendr 115.89 Bug#1981673-Added parameter ann_mn_elcn_val and
229 ann_mx_elcn_val to ben_determine_variable_rates
230 call and returned values assigned
231
232 05-dec-2001 tjesumic 115.90 Add,mutltifly,substract added for vapro values
233 bug:2112513
234 05-Feb-2002 kmahendr 115.91 Bug#2207947-Added a cursor c_perfPrv_2 to get the
235 prtt_rt_val_id if the coverage and rate starts in
236 future
237 05-Feb-2002 kmahendr 115.92 Added dbdrv : checkfile line
238 06-Feb-2002 pabodla 115.93 Calculating cmcd_mn/mx values.
239 07-Feb-2002 ikasire 115.94 Bug 2192102 Flex Credit fails in case of the
240 Flex Credit or VAPRO associated with the FC is
241 based on coverage calculation- fixed
242 15-Nov-2001 dschwart/ 115.95 Bug#1791203: altered estimate only functions to
243 gopal calculate correctly when frequency rules are
244 altered to 24 pay periods. bug : 1794303
245 26-Mar-2002 kmahendr 115.96 Bug#1833008 - Added parameter p_cal_for to the call
246 determine_compensation to handle multi-assignment.
247 18-Apr-2002 lmcdonal 115.97 l_coverage_val was not always being loaded
248 from p_bnft_amt. Needed for SS call to
249 this package.
250 30-Apr-2002 kmahendr 115.98 Added token to error message-91832.
251 01 May 2002 lmcdonal 115.99 Bug 2048257 Added main_w.
252 20-May-2002 pabodla 115.100 If this procedure is called from enrt
253 process then validate value with
254 enrt_rt table's min/max instead of
255 standard rate min max values.
256
257 23 May 2002 kmahendr 115.101 Added a parameter to main.
258 115.102 No changes
259 03 Jun 2002 pabodla 115.103 Bug 2400850 : Checking prtt_enrt_rslt_id
260 before assigning any values to p_dflt_val
261 05 Jun 2002 pabodla 115.104 Bug 2403243 : If vapro and abr both has
262 null values for min/max then assigning
263 null to p_mn/max_elcn_val variables
264 instead of zero
265 08-Jun-2002 pabodla 115.105 Do not select the contingent worker
266 assignment when assignment data is
267 fetched.
268 27-Jun-2002 Tilak 115.106 Bug 2438506: if vapro treatment code is
269 multiply by and abr have null value
270 then trat abr value as 1 else causes
271 null rate value calculation.
272 08-Jul-2002 ikasire 115.107 Bug 2445318 handling the p_dflt_val and
273 p_ann_dflt_val cases
274 12-Jul-2002 vsethi 115.108 Bug 1699585 added tokens for message BEN_91932_NOT_INCREMENT
275 15-Jul-2002 vsethi 115.109 Wrong variable referenced in cursor c_pln
276 04-sep-2002 kmahendr 115.111 Added new acty_ref_perd_cd - phr.
277 17-Sep-2002 hnarayan 115.112 Bug 2569884 - communicated min and max values should
278 be calculated irrespective of whether calculate for
279 enrollment flag is checked or not
280 11-Oct-2002 vsethi 115.113 Rates Sequence no enhancements. Modified to cater
281 to new column ord_num on ben_acty_base_rt_f
282 24-Oct-2002 shdas 115.114 Added ben_env_object.init to main_w
283 13-Nov-2002 vsethi 115.115 Bug 1210355, if variable rate is detected the mlt code
284 attached to the variable profile should be displayed
285 for the rate
286 09-DEC-2002 hnarayan 115.116 Bug 2691169 - added order by clause to cursor c_asg
287 so that it retrieves assignmnets of type 'E' first
288 and then of type 'B'
289 16 Dec 02 hnarayan 115.117 Added NOCOPY hint
290 24 Dec 02 kmullapu 115.118 Added new cursor c_pl_opt_name to display pl-opt name
291 in error messages. Bug 2385186
292 27 Dec 02 ikasire 115.119 Bug 2677804 changes for override thru date
293 23 Jan 03 ikasire 115.120 Bug 2149438 using to overloaded annual_to_period procedure
294 and rounding to 4 digits to improve the precision.
295 05-Feb-03 gjesumig 115.121 GSP enhancement, calculation added for new mlt_cd 'PRV'
296 12-Feb-03 tjesumic 115.122 2797031 , if premium value is null it is recaulcualted
297 nvl added to premium value
298 13-Feb-03 kmahendr 115.123 Added a parameter - p_iss_val and codes for auto_distr
299 22-May-03 kmahendr 115.124 Included ERL to evaluate formula
303 11-nov-03 hmani 115.127 Reversing back the previous fix
300 06-Jun-03 kmahendr 115.125 Rt_mlt_cd is populated from variable rate only if the
301 treatment code is Replace.Bug#2996378
302 21-oct-03 hmani 115.126 Bug 3177401 - Changed p_date_mandatory_flag to 'Y'
304 12-Nov-03 ikasire 115.128 Bug 3253180 Defaults not working when enter value at
305 enrollment annual flag is checked for the current
306 enrollment
307 13-Nov-03 kmahendr 115.129 Bug#3254240 - added codes in main_w to get the
308 communicated value
309 23-Feb-04 stee 115.130 Bug 3457483 - Check the assignment to use code
310 in activity base rate when selecting the
311 assignment.
312 14-Apr-04 mmudigon 115.132 FONM changes
313 29-May-04 mmudigon 115.133 FONM changes continued
314 05-Aug-04 tjesumic 115.134 FONM for ben_derive_factors fonm date paseed as param
315 03-Sep-04 hmani 115.135 fixed cmcd_dflt_val issue Bug 3274902
316 06-sep-04 hmani 115.136 Modified for annual value flag Bug 3274902
317 Also fixed few missed out FONM issues.
318 03-Dec-04 vvprabhu 115.137 Bug 3980063 - SSBEN Trace Enhancement
319 03-Dec-04 ikasire 115.138 Added defaults to main_w as per main
320 14-dec-04 nhunur 115.139 cwb now allows null values for min/max/incrmt val
321 so no need to validate
322 30-dec-2004 nhunur 115.140 4031733 - No need to open cursor c_state.
323 24-Jan-2004 swjain 115.141 3981982 - Min Max Enhancement. Added code to evaluate
324 min max rule.
325 27-Jan-2004 swjain 115.142 Updated the message number of the the message
326 BEN_XXXX_MN_MX_RL_OUT_ERR to
327 BEN_94130_MN_MX_RL_OUT_ERR
328 31-Jan-2004 swjain 115.143 3981982 - Added more input paramters in call to
329 benutils.formula
330 17-Feb-2004 vvprabhu 115.144 Bug 4143012 : Changes in procedure main_w
331 to avoid value of cost1 being displayed for
332 cost2 when cost1 is 'SAREC'
333 12-May-2005 ikasire 115.145 Moved the fnd_message binding into IF clause to avoid
334 misleading error message from SSBEN
335 23-May-2005 lakrish 115.146 4235088, do fnd_number.canonical_to_number() to the
336 FF output before assigning to a number variable
337 09-Jun-2005 nhunur 115.147 4383988, do fnd_number.canonical_to_number() to all
338 FF that return a number variable
339 05-Sep-05 swjain 115.148 Bug No 4538786 Per Pay Period with frequency rules
340 changes in procedure main
341 13-Sep-2005 rbingi 115.151 Bug-4604560 in procedure main, Added close for
342 cursor get_rt_and_element
343 28-Sep-2005 nhunur 115.152 Bug 4637525 : CWB- MULTIPLE OF COMPENSATION CHANGES.
344 02-Feb-2006 stee 115.153 Bug 4873847. cwb: Round the rec_val,
345 rec_mn_val, rec_mx_val.
346 24-Apr-2006 rgajula 115.154 Bug 5031047 Modified the order by clause to prv.rt_start_dt asecending
347 and added the clause c_effective_date < prv.rt_end_dt for the cursors
348 c_prv,c_perfprv,c_perfprv_2
349 18-May-2006 rgajula 115.155 Bug 5225815 do not prorate if there are no prior elections
350 or the l_rt_strt_dt is null
351 07-Jul-2006 bmanyam 115.156 5371364 : Do not Operate (i.e multiply/divide..)
352 the Increment Value.
353 21-Sep-2006 vborkar 115.157 5534498 : Passed p_person_id and p_start_date(rt_strt_dt)
354 parameters to annual_to_period for correct rate calculation
355 on 'Recalculate'.
356 25-Sep-2006 bmanyam 115.158 5557305 : Premium has to be recalculated everytime
357 for rates of type 'Multiple of Premium'
358 3-nov-2006 nhunur 115.159 c_perfprv,c_perfprv_2 to handle non recurrring
359
360 1-Feb-2007 bmanyam 115.160 5748126: Update BEN_ENRT_RT with the
361 latest PRV_ID, which occurs before the LE_OCRD_DT
362 23-Feb-2006 bmanyam 115.161 5898039: same as above. [ON or before LE_OCRD_DT]
363
364 22-Jan-2007 rtagarra 115.160 ICM Changes.
365
366 19-Dec-2007 krupani 115.162 Changes against Bug 6015724 incorporated from 115.162.
367 Forward port Bug is 6158436
368
369 26-Dec-2007 krupani 115.164 Changes against Bug 6314463 and 6330056 incorporated from 115.164
370 in R12 mainline
371 17-Jun-2008 sagnanas 115.165 Bug 7154229
372 11-Feb-2009 velvanop 115.166 Bug 7414757: Added parameter p_entr_val_at_enrt_flag.
373 VAPRO rates which are 'Enter value at Enrollment', Form field
374 should allow the user to enter a value during enrollment.
375 25-Sep-2009 velvanop 115.167 Bug 8943410(11i): System applies rounding to rate value prior to the application of VAPRO
376 factor. The fix is to apply rounding after the VAPRO has been applied
377 20-Jan-2011 krupani 120.18.12010000.4 Bug 10428587: Cursor c_pgr was failing when NLS_NUMERIC_CHARACTERS
378 is set to ',.' from '.,'. Fixed the same using
379 fnd_number.canonical_to_number function
383 if it is new mid-year election.
380 31-Jan-2011 amnaraya 120.18.12010000.6 Bug 11065081: Calculate the communicated values for use in SS
381 20-Apr-2011 sagnanas 120.18.12010000.7 Bug 12378553: Passed p_annual_target
382 29-Oct-2012 stee 120.18.12010000.8 Bug 14751721: When calculating the rate value, check
384 03-Dec-2012 amnaraya 120.18.12010000.9 Bug 15853867: p_cmcd_val was overriden with l_cmcd_dflt_val when the
385 entr_val_at_enrt_flag is Y and entr_ann_val_flag is N
386 18-Feb-2012 amnaraya 120.18.12010000.10 Fwd. Port 13013980
387
388
389 */
390 --------------------------------------------------------------------------------
391 --
392 g_package varchar2(80) := 'ben_determine_activity_base_rt';
393 g_debug boolean := hr_utility.debug_enabled;
394 --
395 TYPE g_element_link_id_table IS TABLE OF pay_element_links_f.element_link_id%TYPE
396 INDEX BY BINARY_INTEGER;
397 --
398 -------------------------------------------------------------------------------
399 -- get_expr_val
400 -------------------------------------------------------------------------------
401 function get_expr_val(p_op in varchar2,
402 p_oper1 in number,
403 p_oper2 in number)
404 return number is
405 --
406 l_proc varchar2(80) := 'get_expr_val';
407 l_oper1 number;
408 l_oper2 number;
409 l_ret_val number := null;
410 --
411 begin
412 --
413 l_oper1 := p_oper1;
414 l_oper2 := p_oper2;
415 --
416 if p_oper1 is null and p_oper2 is null then
417 --
418 l_ret_val := null;
419 return l_ret_val;
420 --
421 elsif p_oper1 is null then
422 --
423 l_oper1 := 0;
424 --
425 elsif p_oper2 is null then
426 --
427 l_oper2 := 0;
428 --
429 end if;
430 --
431 if p_op = '+' then
432 --
433 l_ret_val := l_oper1+l_oper2;
434 --
435 elsif p_op = '-' then
436 --
437 l_ret_val := l_oper1-l_oper2;
438 --
439 elsif p_op = '*' then
440 --
441 if p_oper1 is null then
442 --
443 l_oper1 := 1;
444 --
445 elsif p_oper2 is null then
446 --
447 l_oper2 := 1;
448 --
449 end if;
450 --
451 l_ret_val := l_oper1*l_oper2;
452 end if;
453 return l_ret_val;
454 --
455 end get_expr_val;
456
457 PROCEDURE main
458 (p_currepe_row in ben_determine_rates.g_curr_epe_rec
459 := ben_determine_rates.g_def_curr_epe_rec
460 ,p_per_row in per_all_people_F%rowtype
461 := ben_determine_rates.g_def_curr_per_rec
462 ,p_asg_row in per_all_assignments_f%rowtype
463 := ben_determine_rates.g_def_curr_asg_rec
464 ,p_ast_row in per_assignment_status_types%rowtype
465 := ben_determine_rates.g_def_curr_ast_rec
466 ,p_adr_row in per_addresses%rowtype
467 := ben_determine_rates.g_def_curr_adr_rec
468 ,p_person_id IN number
469 ,p_elig_per_elctbl_chc_id IN number
470 ,p_enrt_bnft_id IN number default null
471 ,p_acty_base_rt_id IN number
472 ,p_effective_date IN date
473 ,p_lf_evt_ocrd_dt IN date default null
474 ,p_perform_rounding_flg IN boolean default true
475 ,p_calc_only_rt_val_flag in boolean default false
476 ,p_pl_id in number default null
477 ,p_oipl_id in number default null
478 ,p_pgm_id in number default null
479 ,p_pl_typ_id in number default null
480 ,p_per_in_ler_id in number default null
481 ,p_ler_id in number default null
482 ,p_bnft_amt in number default null
483 ,p_business_group_id in number default null
484 ,p_cal_val in number default null
485 ,p_parent_val in number default null
486 ,p_called_from_ss in boolean default false
487 ,p_val OUT NOCOPY number
488 ,p_mn_elcn_val OUT NOCOPY number
489 ,p_mx_elcn_val OUT NOCOPY number
490 ,p_ann_val OUT NOCOPY number
491 ,p_ann_mn_elcn_val OUT NOCOPY number
492 ,p_ann_mx_elcn_val OUT NOCOPY number
493 ,p_cmcd_val OUT NOCOPY number
494 ,p_cmcd_mn_elcn_val OUT NOCOPY number
495 ,p_cmcd_mx_elcn_val OUT NOCOPY number
496 ,p_cmcd_acty_ref_perd_cd OUT NOCOPY varchar2
497 ,p_incrmt_elcn_val OUT NOCOPY number
498 ,p_dflt_val OUT NOCOPY number
499 ,p_tx_typ_cd OUT NOCOPY varchar2
500 ,p_acty_typ_cd OUT NOCOPY varchar2
501 ,p_nnmntry_uom OUT NOCOPY varchar2
502 ,p_entr_val_at_enrt_flag OUT NOCOPY varchar2
503 ,p_dsply_on_enrt_flag OUT NOCOPY varchar2
504 ,p_use_to_calc_net_flx_cr_flag OUT NOCOPY varchar2
505 ,p_rt_usg_cd OUT NOCOPY varchar2
506 ,p_bnft_prvdr_pool_id OUT NOCOPY number
507 ,p_actl_prem_id OUT NOCOPY number
508 ,p_cvg_calc_amt_mthd_id OUT NOCOPY number
509 ,p_bnft_rt_typ_cd OUT NOCOPY varchar2
510 ,p_rt_typ_cd OUT NOCOPY varchar2
511 ,p_rt_mlt_cd OUT NOCOPY varchar2
512 ,p_comp_lvl_fctr_id OUT NOCOPY number
513 ,p_entr_ann_val_flag OUT NOCOPY varchar2
514 ,p_ptd_comp_lvl_fctr_id OUT NOCOPY number
518 ,p_rt_strt_dt_cd OUT NOCOPY varchar2
515 ,p_clm_comp_lvl_fctr_id OUT NOCOPY number
516 ,p_ann_dflt_val OUT NOCOPY number
517 ,p_rt_strt_dt OUT NOCOPY date
519 ,p_rt_strt_dt_rl OUT NOCOPY number
520 ,p_prtt_rt_val_id OUT NOCOPY number
521 ,p_dsply_mn_elcn_val OUT NOCOPY number
522 ,p_dsply_mx_elcn_val OUT NOCOPY number
523 ,p_pp_in_yr_used_num OUT NOCOPY number
524 ,p_ordr_num OUT NOCOPY number
525 ,p_iss_val OUT NOCOPY number
526 )
527 IS
528 --
529 l_value number;
530 l_rounded_value number;
531 l_pl_id number;
532 l_oipl_id number;
533 l_coverage_value number;
534 l_val number;
535 l_dflt_val number;
536 l_compensation_value number;
537 l_actl_prem_value number;
538 l_prnt_rt_value number;
539 l_comp_lvl_fctr_id number;
540 l_actl_prem_id number;
541 l_acty_base_rt_id number;
542 l_dummy_num number;
543 l_dummy_char varchar2(30);
544 l_dummy_date date;
545 l_outputs ff_exec.outputs_t;
546 l_vr_val number := null;
547 l_vr_mn_elcn_val number := null;
548 l_vr_mx_elcn_val number := null;
549 l_vr_incrmt_elcn_val number := null;
550 l_vr_dflt_elcn_val number := null;
551 l_vr_tx_typ_cd varchar2(30);
552 l_vr_acty_typ_cd varchar2(30);
553 l_vr_trtmt_cd varchar2(30);
554 l_prtt_rt_val_id number;
555 l_bnft_prvdr_pool_id number;
556 l_rt_strt_dt date;
557 l_rt_strt_dt_cd varchar2(30);
558 l_rt_strt_dt_rl number;
559 l_ann_dflt_val number;
560 l_ann_val number;
561 l_cmcd_val number;
562 l_pl_opt_name varchar2(600) := null;
563 --
564 -- For selfservice enhancement : Communicated values are required
565 -- on self service pages.
566 --
567 l_cmcd_mn_val number;
568 l_cmcd_ann_mn_val number;
569 l_cmcd_mx_val number;
570 l_cmcd_ann_mx_val number;
571 --
572
573 -- bug 3274092
574 l_cmcd_dflt_val number;
575 l_cmcd_ann_dflt_val number;
576 -- bug 3274092
577 --
578 l_cmcd_acty_ref_perd_cd varchar2(30);
579 l_acty_ref_perd_cd varchar2(30);
580 l_enrt_info_rt_freq_cd varchar2(30);
581 l_cvg_calc_amt_mthd_id varchar2(30);
582 l_lwr_outputs ff_exec.outputs_t;
583 l_upr_outputs ff_exec.outputs_t;
584 l_rt_ovridn_flag varchar2(15);
585 l_rt_ovridn_thru_dt date;
586 l_rt_val number;
587 l_prtn_strt_dt date;
588 l_jurisdiction_code varchar2(30);
589 l_dflt_enrt_cd varchar2(30);
590 l_dflt_enrt_rl number;
591 l_ptd_balance number;
592 l_clm_balance number;
593 l_commit number;
594 l_ultmt_upr_lmt number;
595 l_ultmt_lwr_lmt number;
596 l_ultmt_upr_lmt_calc_rl number;
597 l_ultmt_lwr_lmt_calc_rl number;
598 l_vr_ann_mn_elcn_val number;
599 l_vr_ann_mx_elcn_val number;
600 l_enrt_bnft_id number := p_enrt_bnft_id ;
601 l_assignment_id per_all_assignments_f.assignment_id%type;
602 l_payroll_id per_all_assignments_f.payroll_id%type;
603 l_organization_id per_all_assignments_f.organization_id%type;
604 --
605 -- Bug 4637525
606 l_cwb_dflt_val number;
607 l_cwb_incrmt_elcn_val number;
608 l_cwb_mx_elcn_val number;
609 l_cwb_mn_elcn_val number;
610 -- Bug 4637525
611 l_package varchar2(80) := g_package||'.main';
612
613 --
614 -- open c_pl_opt_name cursor only if error needs to be displayed.
615 --
616 cursor c_pl_opt_name is
617 select pln.name || ' '|| opt.name
618 from ben_elig_per_elctbl_chc epe,
619 ben_pl_f pln,
620 ben_oipl_f oipl,
621 ben_opt_f opt
622 where epe.elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id
623 and epe.pl_id = pln.pl_id
624 and epe.oipl_id = oipl.oipl_id(+)
625 and oipl.opt_id = opt.opt_id(+)
626 and p_effective_date between
627 pln.effective_start_date and pln.effective_end_date
628 and p_effective_date between
629 oipl.effective_start_date(+) and oipl.effective_end_date(+)
630 and p_effective_date between
631 opt.effective_start_date(+) and opt.effective_end_date(+);
632
633 cursor c_enrt_rt(p_elig_per_elctbl_chc_id in number,
634 p_enrt_bnft_id in number,
635 p_acty_base_rt_id in number)
636 is
637 select enrt.mn_elcn_val,
638 enrt.mx_elcn_val,
639 enrt.incrmt_elcn_val
640 from ben_enrt_rt enrt
641 where (enrt.elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id
642 or enrt.enrt_bnft_id = p_enrt_bnft_id) and
643 enrt.acty_base_rt_id = p_acty_base_rt_id;
644 l_enrt_rt c_enrt_rt%rowtype;
645 --
646 -- commented out to fix bug 3457483
647
648 /* cursor c_asg
649 (c_effective_date in date
650 )
651 is
652 select asg.assignment_id,
653 asg.organization_id,
654 asg.payroll_id,
655 loc.region_2
656 from per_all_assignments_f asg,hr_locations_all loc
657 where asg.person_id = p_person_id
661 and c_effective_date
658 and asg.assignment_type <> 'C'
659 and asg.primary_flag = 'Y'
660 and asg.location_id = loc.location_id(+)
662 between asg.effective_start_date
663 and asg.effective_end_date
664 order by -- bug fix 2691169
665 asg.assignment_type desc;
666 l_asg c_asg%rowtype; */
667 -- end bug fix 3457483
668 cursor c_epe
669 is
670 select epe.pl_id,
671 epe.oipl_id,
672 epe.pgm_id,
673 epe.pl_typ_id,
674 epe.business_group_id,
675 epe.per_in_ler_id,
676 epe.plip_id,
677 epe.ptip_id,
678 epe.prtt_enrt_rslt_id,
679 epe.roll_crs_flag,
680 epe.elctbl_flag,
681 epe.enrt_cvg_strt_dt,
682 epe.enrt_cvg_strt_dt_cd,
683 epe.enrt_cvg_strt_dt_rl,
684 epe.yr_perd_id,
685 epe.pl_ordr_num,
686 epe.oipl_ordr_num,
687 pel.enrt_perd_id,
688 pel.lee_rsn_id,
689 pel.enrt_perd_strt_dt,
690 pel.acty_ref_perd_cd,
691 pil.person_id,
692 pil.ler_id
693 from ben_elig_per_elctbl_chc epe,
694 ben_per_in_ler pil,
695 ben_pil_elctbl_chc_popl pel
696 where epe.elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id
697 and epe.per_in_ler_id = pil.per_in_ler_id
698 and epe.pil_elctbl_chc_popl_id = pel.pil_elctbl_chc_popl_id
699 and epe.per_in_ler_id = pel.per_in_ler_id;
700 l_epe c_epe%rowtype;
701 --
702 --
703 cursor c_opt
704 (c_effective_date in date
705 )
706 is
707 select opt_id
708 from ben_oipl_f oipl
709 where oipl.oipl_id = l_epe.oipl_id
710 and c_effective_date
711 between oipl.effective_start_date
712 and oipl.effective_end_date;
713
714
715 l_opt c_opt%rowtype;
716
717 cursor c_abr
721 select abr.rt_mlt_cd,
718 (c_effective_date in date
719 )
720 is
722 abr.val,
723 abr.mn_elcn_val,
724 abr.mx_elcn_val,
725 abr.incrmt_elcn_val,
726 abr.dflt_val,
727 abr.rndg_cd,
728 abr.rndg_rl,
729 abr.pl_id,
730 abr.oipl_id,
731 abr.pgm_id,
732 abr.acty_typ_cd,
733 abr.rt_typ_cd,
734 abr.bnft_rt_typ_cd,
735 abr.ptd_comp_lvl_fctr_id,
736 abr.entr_val_at_enrt_flag,
737 abr.clm_comp_lvl_fctr_id,
738 abr.tx_typ_cd,
739 abr.val_calc_rl,
740 abr.nnmntry_uom,
741 abr.entr_ann_val_flag,
742 abr.comp_lvl_fctr_id,
743 abr.dsply_on_enrt_flag,
744 abr.use_to_calc_net_flx_cr_flag,
745 abr.rt_usg_cd,
746 abr.ann_mn_elcn_val,
747 abr.ann_mx_elcn_val,
748 abr.lwr_lmt_val,
749 abr.lwr_lmt_calc_rl,
750 abr.upr_lmt_val,
751 abr.upr_lmt_calc_rl,
752 abr.actl_prem_id,
753 abr.use_calc_acty_bs_rt_flag ,
754 abr.det_pl_ytd_cntrs_cd, -- Bug#1791203: added
755 abr.element_type_id,
756 abr.pay_rate_grade_rule_id,
757 abr.ordr_num,
758 abr.rate_periodization_rl, --BUG 3463457
759 abr.mn_mx_elcn_rl, -- Min Max Enhancement : 3981982
760 abr.input_va_calc_rl
761 from ben_acty_base_rt_f abr
762 where abr.acty_base_rt_id = p_acty_base_rt_id
763 and c_effective_date
764 between abr.effective_start_date
765 and abr.effective_end_date ;
766
767 l_abr c_abr%rowtype;
768 --
769 cursor c_enb(p_enrt_bnft_id number)
770 is
771 select enb.val,
772 enb.dflt_val
773 from ben_enrt_bnft enb
774 where enb.enrt_bnft_id = p_enrt_bnft_id;
775 --
776 --Bug 2192102 added new cursor to find the cvg at the same level
777 cursor c_enb_fc is
778 select
779 enb.enrt_bnft_id
780 from
781 ben_enrt_bnft enb,
782 ben_elig_per_elctbl_chc epe,
783 ben_elig_per_elctbl_chc epe_fc
784 where
785 enb.elig_per_elctbl_chc_id = epe.elig_per_elctbl_chc_id
786 and epe.pgm_id = epe_fc.pgm_id
787 and nvl(epe.oipl_id,-99999) = nvl(epe_fc.oipl_id,-99999)
788 and nvl(epe.pl_id,-99999) = nvl(epe_fc.pl_id,-99999)
789 and nvl(epe.plip_id,-99999) = nvl(epe_fc.plip_id,-99999)
790 and nvl(epe.ptip_id,-99999) = nvl(epe_fc.ptip_id,-99999)
794 --
791 and nvl(epe.pl_typ_id,-99999) = nvl(epe_fc.pl_typ_id,-99999)
792 and epe.per_in_ler_id = epe_fc.per_in_ler_id
793 and epe_fc.elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id ;
795 l_enb_fc c_enb_fc%rowtype;
796 --
797 cursor c_cvg_pl
798 (c_effective_date in date
799 )
800 is
801 select ccm.cvg_amt_calc_mthd_id
802 from ben_cvg_amt_calc_mthd_f ccm,
803 ben_pl_f pln
804 where pln.pl_id = l_epe.pl_id
805 and pln.pl_id = ccm.pl_id
806 and c_effective_date
807 between pln.effective_start_date
808 and pln.effective_end_date
809 and c_effective_date
810 between ccm.effective_start_date
811 and ccm.effective_end_date;
812
813 cursor c_cvg_oipl
814 (c_effective_date in date
815 )
816 is
817 select ccm.cvg_amt_calc_mthd_id
818 from ben_cvg_amt_calc_mthd_f ccm,
819 ben_oipl_f cop
820 where cop.oipl_id = l_epe.oipl_id
821 and cop.oipl_id = ccm.oipl_id
822 and c_effective_date
823 between cop.effective_start_date
824 and cop.effective_end_date
825 and c_effective_date
826 between ccm.effective_start_date
827 and ccm.effective_end_date;
828
829 cursor c_abr2
830 (c_effective_date in date
831 )
832 is
833 select abr2.acty_base_rt_id,abr2.entr_val_at_enrt_flag
834 from ben_acty_base_rt_f abr,
835 ben_acty_base_rt_f abr2
836 where abr.acty_base_rt_id = p_acty_base_rt_id
837 and abr2.acty_base_rt_id = abr.parnt_acty_base_rt_id
838 and abr2.parnt_chld_cd = 'PARNT'
839 and c_effective_date
840 between abr.effective_start_date
841 and abr.effective_end_date
842 and c_effective_date
843 between abr2.effective_start_date
844 and abr2.effective_end_date;
845
846 cursor c_pln
847 (c_effective_date in date,
848 c_pl_id in number
849 )
850 is
851 select pln.nip_acty_ref_perd_cd
852 ,pln.nip_enrt_info_rt_freq_cd
853 ,name
854 from ben_pl_f pln
855 where pln.pl_id = c_pl_id
856 and c_effective_date
857 between pln.effective_start_date
858 and pln.effective_end_date;
859
860 l_pln c_pln%rowtype;
861 l_pln2 c_pln%rowtype;
862 cursor c_pgm
863 (c_effective_date in date
864 )
865 is
866 select pgm.acty_ref_perd_cd,
867 pgm.enrt_info_rt_freq_cd
868 from ben_pgm_f pgm
869 where pgm.pgm_id = l_epe.pgm_id
870 and c_effective_date
871 between pgm.effective_start_date
872 and pgm.effective_end_date;
873
874 l_pgm c_pgm%rowtype;
875
876 cursor c_abp
877 (c_effective_date in date
878 )
879 is
880 select abp.bnft_prvdr_pool_id
881 from ben_aplcn_to_bnft_pool_f abp
882 where abp.acty_base_rt_id = p_acty_base_rt_id
883 and c_effective_date
884 between abp.effective_start_date
885 and abp.effective_end_date
886 and abp.bnft_prvdr_pool_id in
887 (select epe.bnft_prvdr_pool_id
888 from ben_elig_per_elctbl_chc epe
889 where epe.pgm_id = l_epe.pgm_id
890 and epe.per_in_ler_id = l_epe.per_in_ler_id);
891
892
893 --Bug 5031047
894 --Modified the order by clause to prv.rt_Start_dt asecending
895 --and added the clause c_effective_date < prv.rt_end_dt
896 --for the below 3 prv cursors
897
898 cursor c_prv
899 (c_effective_date in date
900 ,c_acty_base_rt_id in number
901 ,c_elig_per_elctbl_chc_id in number
902 )
903 is
904 select prv.prtt_rt_val_id,
905 prv.rt_ovridn_flag,
906 prv.rt_ovridn_thru_dt,
907 prv.rt_val,
908 prv.ann_rt_val,
909 prv.cmcd_rt_val, -- Bug 6015724
910 prv.rt_strt_dt,
911 prv.rt_end_dt
912 from ben_prtt_rt_val prv,
913 ben_prtt_enrt_rslt_f pen,
914 ben_elig_per_elctbl_chc epe
915 where epe.elig_per_elctbl_chc_id = c_elig_per_elctbl_chc_id
916 and epe.prtt_enrt_rslt_id = pen.prtt_enrt_rslt_id
917 and pen.prtt_enrt_rslt_id = prv.prtt_enrt_rslt_id
918 and pen.prtt_enrt_rslt_stat_cd is null
919 and prv.prtt_rt_val_stat_cd is null
920 and prv.acty_base_rt_id = c_acty_base_rt_id
921 and c_effective_date
922 between pen.enrt_cvg_strt_dt
923 and pen.enrt_cvg_thru_dt
924 --and prv.acty_typ_cd = l_abr.acty_typ_cd bug 1295277 comment out.
925 --and prv.tx_typ_cd = l_abr.tx_typ_cd
926 and c_effective_date
927 between pen.effective_start_date
928 and pen.effective_end_date
929 /* get the latest prv for the enrollment result id */
930 and ((c_effective_date <= prv.rt_end_dt) or (prv.rt_strt_dt = prv.rt_end_dt))
931 order by prv.rt_strt_dt desc; -- 5748126 Changed ORDER-BY from ASC to DESC
932
933 cursor c_perfprv
934 (c_effective_date in date
935 ,c_acty_base_rt_id in number
936 ,c_prtt_enrt_rslt_id in number
937 )
938 is
939 select prv.prtt_rt_val_id,
940 prv.rt_ovridn_flag,
941 prv.rt_ovridn_thru_dt,
942 prv.rt_val,
943 prv.ann_rt_val,
944 prv.cmcd_rt_val, -- Bug 6015724
945 prv.rt_strt_dt,
946 prv.rt_end_dt
950 and pen.prtt_enrt_rslt_id = prv.prtt_enrt_rslt_id
947 from ben_prtt_rt_val prv,
948 ben_prtt_enrt_rslt_f pen
949 where pen.prtt_enrt_rslt_id = c_prtt_enrt_rslt_id
951 and pen.prtt_enrt_rslt_stat_cd is null
952 and prv.prtt_rt_val_stat_cd is null
953 and prv.acty_base_rt_id = c_acty_base_rt_id
954 and c_effective_date
955 between pen.enrt_cvg_strt_dt
956 and pen.enrt_cvg_thru_dt
957 --RCHASE wwbug#1207803.999 - correct perfprv cursor to fetch rows when
958 -- updates have been made to the enrollment
959 -- result past the life event occured date
960 --and c_effective_date
961 -- between pen.effective_start_date
962 -- and pen.effective_end_date
963 and pen.effective_end_date = hr_api.g_eot
964 and ((c_effective_date <= prv.rt_end_dt) or (prv.rt_strt_dt = prv.rt_end_dt))
965 --RCHASE end
966 order by prv.rt_strt_dt desc; -- 5748126 Changed ORDER-BY from ASC to DESC
967
968 -- if the coverage starts in future to the life event occurred date like coverage code 'First of
969 -- next month' - 2 life events occurs in the same month
970 cursor c_perfprv_2
971 (c_effective_date in date
972 ,c_acty_base_rt_id in number
973 ,c_prtt_enrt_rslt_id in number
974 )
975 is
976 select prv.prtt_rt_val_id,
977 prv.rt_ovridn_flag,
978 prv.rt_ovridn_thru_dt,
979 prv.rt_val,
980 prv.ann_rt_val,
981 prv.cmcd_rt_val, -- Bug 6015724
982 prv.rt_strt_dt,
983 prv.rt_end_dt
984 from ben_prtt_rt_val prv,
985 ben_prtt_enrt_rslt_f pen
986 where pen.prtt_enrt_rslt_id = c_prtt_enrt_rslt_id
987 and pen.prtt_enrt_rslt_id = prv.prtt_enrt_rslt_id
988 and pen.prtt_enrt_rslt_stat_cd is null
989 and prv.prtt_rt_val_stat_cd is null
990 and prv.acty_base_rt_id = c_acty_base_rt_id
991 and c_effective_date < pen.enrt_cvg_thru_dt
992 and pen.effective_end_date = hr_api.g_eot
993 and ((c_effective_date <= prv.rt_end_dt) or (prv.rt_strt_dt = prv.rt_end_dt))
994 order by prv.rt_strt_dt desc; -- 5748126 Changed ORDER-BY from ASC to DESC
995
996
997 --End Bug 5031047
998
999 -- Determines the current eligibility for an option
1000 --
1001 cursor c_current_elig
1002 (c_person_id in number
1003 ,c_pgm_id in number
1004 ,c_pl_id in number
1005 ,c_opt_id in number
1006 ,c_nvlopt_id in number
1007 ,c_effective_date in date
1008 )
1009 is
1010 select epo.prtn_strt_dt
1011 from ben_elig_per_f ep,
1012 ben_elig_per_opt_f epo,
1013 ben_per_in_ler pil
1014 where ep.person_id=c_person_id
1015 and nvl(ep.pgm_id,-1)=c_pgm_id
1016 and ep.pl_id=c_pl_id
1017 and epo.opt_id=c_opt_id
1018 and c_effective_date
1019 between ep.effective_start_date and ep.effective_end_date
1020 and ep.elig_per_id=epo.elig_per_id
1021 and c_effective_date
1022 between epo.effective_start_date and epo.effective_end_date
1023 and pil.per_in_ler_id(+) = ep.per_in_ler_id
1024 and ( pil.per_in_ler_stat_cd not in ('VOIDD', 'BCKDT')
1025 or
1026 pil.per_in_ler_stat_cd is null)
1027 union
1028 select prtn_strt_dt
1029 from ben_elig_per_f ep,
1030 ben_per_in_ler pil
1031 where ep.person_id=c_person_id
1032 and nvl(ep.pgm_id,-1)=c_pgm_id
1033 and ep.pl_id=c_pl_id
1034 and c_effective_date
1035 between ep.effective_start_date and ep.effective_end_date
1036 and pil.per_in_ler_id(+) = ep.per_in_ler_id
1037 and ( pil.per_in_ler_stat_cd not in ('VOIDD', 'BCKDT')
1038 or pil.per_in_ler_stat_cd is null)
1039 and c_nvlopt_id=hr_api.g_number;
1040
1041 cursor c_enrt_prem(p_actl_prem_id in number)
1042 is
1043 select ecr.val
1044 from ben_enrt_prem ecr,
1045 ben_per_in_ler pil,
1046 ben_elig_per_elctbl_chc epe
1047 where ecr.actl_prem_id = p_actl_prem_id
1048 and ecr.elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id
1049 and epe.elig_per_elctbl_chc_id = ecr.elig_per_elctbl_chc_id
1050 and pil.per_in_ler_id = epe.per_in_ler_id
1051 --- when the premium depend on coverage , coverage inturn multi rance
1052 --- benefit is is required to find the correct row : bug 1628762
1053 and (ecr.enrt_bnft_id is null or nvl(ecr.enrt_bnft_id ,0) = nvl(p_enrt_bnft_id ,0) )
1054 and pil.per_in_ler_stat_cd not in ('VOIDD','BCKDT');
1055
1056 Cursor c_state
1057 is
1058 select region_2
1059 from hr_locations_all loc,per_all_assignments_f asg
1060 where loc.location_id = asg.location_id
1061 and asg.assignment_type <> 'C'
1062 and asg.person_id = p_person_id
1066
1063 and asg.primary_flag = 'Y'
1064 and p_effective_date between
1065 asg.effective_start_date and asg.effective_end_date;
1067 l_state c_state%rowtype;
1068 --
1069 Cursor c_pgr (c_pay_rate_grade_rule_id in number
1070 ,c_effective_date in date ) is
1071 select fnd_number.canonical_to_number(value) /* Bug 10428587 */
1072 from pay_grade_rules_f pgr
1073 where grade_rule_id = c_pay_rate_grade_rule_id
1074 and c_effective_date between
1075 pgr.effective_start_date and pgr.effective_end_date;
1076 --
1077 cursor c_pln_auto_distr (p_elig_per_elctbl_chc_id number)
1078 is
1079 select auto_distr_flag
1080 from ben_enrt_perd enp,
1081 ben_pil_elctbl_chc_popl pel,
1082 ben_elig_per_elctbl_chc epe
1083 where enp.enrt_perd_id = pel.enrt_perd_id
1084 and pel.pil_elctbl_chc_popl_id = epe.pil_elctbl_chc_popl_id
1085 and epe.elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id;
1086 -- and enp.business_group_id = p_business_group_id;
1087 --
1088 -- Bug No 4538786 Added cursor to fetch the rate and element id
1089 -- of the Flex Shell plan instead of the flex credits
1090 --
1091 cursor get_rt_and_element(c_pgm_id in number,
1092 c_per_in_ler_id in number) is
1093 select abr.acty_base_rt_id, abr.element_type_id, epe.elig_per_elctbl_chc_id
1094 from ben_elig_per_elctbl_chc epe, ben_acty_base_rt_f abr
1095 where (epe.pl_id = abr.pl_id or epe.plip_id = abr.plip_id)
1096 and epe.pgm_id = c_pgm_id and epe.per_in_ler_id = c_per_in_ler_id
1097 and epe.comp_lvl_cd = 'PLANFC';
1098 l_rt_and_element get_rt_and_element%rowtype;
1099
1100 --
1101 --6314463
1102 cursor c_force_prem_calc(p_actl_prem_id number) is
1103 select 'Y'
1104 from ben_actl_prem_f
1105 where actl_prem_id = p_actl_prem_id
1106 and (mlt_cd in ('CVG', 'NSVU') or
1107 exists (select null from ben_actl_prem_vrbl_rt_f
1108 where actl_prem_id = p_actl_prem_id));
1109 l_force_prem_calc varchar2(30);
1110
1111 -- End Bug No 4538786
1112
1113 --ICM Changes
1114 --
1115 cursor c_abr_level is
1116 select pl_id,oipl_id
1117 from ben_acty_base_rt_f abr
1118 where abr.acty_base_rt_id = p_acty_base_rt_id
1119 and p_effective_date between abr.effective_start_date
1120 and abr.effective_end_date;
1121 --
1122 l_abr_level c_abr_level%ROWTYPE;
1123 --
1124 cursor c_elem_link(p_element_type_id number) is
1125 select p.element_link_id
1126 from pay_element_links_f p
1127 where element_type_id = p_element_type_id
1128 and p_effective_date between p.effective_start_date
1129 and p.effective_end_date;
1130 --
1131 l_elem_link pay_element_links_f.element_link_id%TYPE;
1132 --
1133 l_element_link_id_table g_element_link_id_table;
1134 --
1135 l_input_value_id pay_input_values_f.input_value_id%TYPE;
1136 --
1137 cursor c_pl_typ(p_pl_id number) is
1138 select opt_typ_cd
1139 from ben_pl_typ_f ptp,
1140 ben_pl_f pln
1141 where pln.pl_id = p_pl_id
1142 and ptp.pl_typ_id = pln.pl_typ_id;
1143 --
1144 l_opt_typ_cd ben_pl_typ_f.opt_typ_cd%TYPE;
1145 --
1146 cursor c_input_values(p_element_link_id number) is
1147 select p.input_value_id,p.default_value
1148 from pay_link_input_values_f p
1149 where element_link_id = p_element_link_id
1150 and p_effective_date between
1151 effective_start_date and effective_end_date
1152 order by input_value_id ;
1153 --
1154 l_ext_inpval c_input_values%ROWTYPE;
1155 --
1156 l_element_link_id number;
1157 --
1158 cursor c_ext_inpval(p_abr_id in number)
1159 is
1160 select eiv.extra_input_value_id,
1161 eiv.input_value_id,
1162 eiv.acty_base_rt_id,
1163 eiv.input_text,
1164 eiv.return_var_name,
1165 eiv.upd_when_ele_ended_cd
1166 from ben_extra_input_values eiv
1167 where eiv.acty_base_rt_id = p_abr_id;
1168 --
1169 l_ext_inpval_rec c_ext_inpval%rowtype;
1170 --
1171 -- 14751721
1172 --
1173 cursor c_pl_popl_yr_period_current(p_pl_id number
1174 ,p_pgm_id number
1175 ,p_business_group_id number
1176 ) is
1177 SELECT distinct yp.start_date
1178 FROM ben_popl_yr_perd pyp
1179 ,ben_yr_perd yp
1180 WHERE (pyp.pl_id = p_pl_id or pyp.pgm_id = p_pgm_id)
1181 AND pyp.yr_perd_id = yp.yr_perd_id
1182 AND pyp.business_group_id = p_business_group_id
1183 AND p_effective_date
1184 BETWEEN yp.start_date AND yp.end_date
1185 AND yp.business_group_id = p_business_group_id;
1186 --
1187 cursor c_min_rt_strt_dt(p_business_group_id number) is
1188 SELECT min(prv.rt_strt_dt)
1189 FROM ben_prtt_rt_val prv
1190 where prv.acty_base_rt_id = p_acty_base_rt_id
1191 and prv.prtt_rt_val_stat_cd is null
1192 and prv.business_group_id = p_business_group_id
1193 and prv.prtt_enrt_rslt_id in
1194 (select pen.prtt_enrt_rslt_id
1195 from ben_prtt_enrt_rslt_f pen
1199 );
1196 where pen.person_id = p_person_id
1197 and pen.prtt_enrt_rslt_stat_cd is null
1198 and pen.business_group_id = p_business_group_id
1200
1201 -- end 14751721
1202 --
1203 l_param_tab ff_exec.outputs_t;
1204 l_counter number;
1205 --
1206 l_cnt_inp_vals number;
1207 l_cnt_links number;
1208 -- End Of ICM Changes
1209
1210 l_effective_date date;
1211 l_calc_val number;
1212 l_prnt_entr_val_at_enrt_flag varchar2(30);
1213 l_cal_val number;
1214 l_ann_rt_val number;
1215 l_cmcd_rt_val number; -- Bug 6015724
1216 l_element_type_id number;
1217 l_pay_annualization_factor number;
1218 l_pln_auto_distr_flag varchar2(1):= 'N';
1219 --GEVITY
1220 l_dfnd_dummy number;
1221 l_ann_dummy number;
1222 l_cmcd_dummy number;
1223 --END GEVITY
1224 l_cvg_eff_dt date;
1225 l_fonm_rt_strt_dt date;
1226
1227 -- Getting mode for bug 3274902
1228 l_env ben_env_object.g_global_env_rec_type;
1229 l_mode l_env.mode_cd%TYPE;
1230 l_prv_rt_strt_dt date; -- 5748126
1231 l_prv_rt_end_dt date; -- 5748126
1232 l_vapro_entr_val_at_enrt_flag varchar2(10) := 'N'; --11065081
1233 l_annual_target boolean ; --12378553
1234 --
1235 -- 14751721
1236 --
1237 l_complete_year_flag varchar2(30) := 'Y';
1238 l_yr_strt_dt date;
1242 --
1239 l_min_rt_strt_dt date;
1240 --
1241 -- end 14751721
1243
1244 function get_input_value_id(p_extra_input_value_id number)
1245 return number is
1246 cursor c_input_value_id is
1247 select input_value_id
1248 from ben_extra_input_values
1249 where extra_input_value_id = p_extra_input_value_id;
1250 --
1251 l_input_value_id number;
1252 --
1253 begin
1254 --
1255 open c_input_value_id;
1256 fetch c_input_value_id into l_input_value_id;
1257 close c_input_value_id;
1258 --
1259 return l_input_value_id;
1260 end;
1261 --
1262 begin
1263 --
1264 g_debug := hr_utility.debug_enabled;
1265 hr_utility.set_location ('Entering '||l_package,10);
1266 --
1267 l_effective_date := nvl(ben_manage_life_events.g_fonm_rt_strt_dt,nvl(p_lf_evt_ocrd_dt,p_effective_date));
1268 l_cvg_eff_dt := nvl(ben_manage_life_events.g_fonm_cvg_strt_dt,nvl(p_lf_evt_ocrd_dt,p_effective_date));
1269 l_fonm_rt_strt_dt := ben_manage_life_events.g_fonm_rt_strt_dt;
1270 --
1271 hr_utility.set_location('l_effective_date'||l_effective_date,10);
1272 hr_utility.set_location('p_acty_base_rt_id'||p_acty_base_rt_id,20);
1273 hr_utility.set_location('p_person_id '||p_person_id,20);
1274 hr_utility.set_location('p_effective_date'||p_effective_date,20);
1275 hr_utility.set_location(' p_elig_per_elctbl_chc_id'||p_elig_per_elctbl_chc_id,20);
1276 if p_calc_only_rt_val_flag then
1277 hr_utility.set_location(' p_calc_only_rt_val_flag',10);
1278 end if ;
1279 --
1280 -- Ensure relevant parameters have been populated with values
1281 --
1282 if p_acty_base_rt_id is null then
1283 fnd_message.set_name('BEN','BEN_91832_PACKAGE_PARAM_NULL');
1284 fnd_message.set_token('PACKAGE',l_package);
1285 fnd_message.set_token('PROC','Standard Rates');
1286 fnd_message.set_token('PARAM','p_acty_base_rt_id');
1287 fnd_message.raise_error;
1288 elsif p_person_id is null then
1289 fnd_message.set_name('BEN','BEN_91832_PACKAGE_PARAM_NULL');
1290 fnd_message.set_token('PACKAGE',l_package);
1291 fnd_message.set_token('PROC','Standard Rates');
1292 fnd_message.set_token('PARAM','p_person_id');
1293 fnd_message.raise_error;
1294 elsif p_effective_date is null then
1295 fnd_message.set_name('BEN','BEN_91832_PACKAGE_PARAM_NULL');
1296 fnd_message.set_token('PACKAGE',l_package);
1297 fnd_message.set_token('PROC','Standard Rates');
1298 fnd_message.set_token('PARAM','p_effective_date');
1299 fnd_message.raise_error;
1300 elsif p_elig_per_elctbl_chc_id is null and not(p_calc_only_rt_val_flag) then
1301 fnd_message.set_name('BEN','BEN_91832_PACKAGE_PARAM_NULL');
1302 fnd_message.set_token('PACKAGE',l_package);
1303 fnd_message.set_token('PROC','Standard Rates');
1304 fnd_message.set_token('PARAM','p_elig_per_elctbl_chc_id');
1305 fnd_message.raise_error;
1306 end if;
1307 hr_utility.set_location (' Checking Electable Choice ',20);
1308 --
1309 -- Populate electable choice information
1310 --
1311 l_coverage_value := p_bnft_amt;
1312 if p_calc_only_rt_val_flag then
1313 --
1314 l_epe.pl_id := p_pl_id;
1315 l_epe.pgm_id := p_pgm_id;
1316 l_epe.oipl_id := p_oipl_id;
1317 l_epe.pl_typ_id := p_pl_typ_id;
1318 l_epe.per_in_ler_id := p_per_in_ler_id;
1319 l_epe.ler_id := p_ler_id;
1320 l_epe.business_group_id := p_business_group_id;
1321 l_epe.enrt_perd_strt_dt := p_effective_date;
1322 l_epe.person_id := p_person_id;
1323 --
1324 -- Check if the context row is populated
1325 --
1326 elsif p_currepe_row.elig_per_elctbl_chc_id is not null
1327 then
1328 --
1329 l_epe.pgm_id := p_currepe_row.pgm_id;
1330 l_epe.pl_typ_id := p_currepe_row.pl_typ_id;
1331 l_epe.ptip_id := p_currepe_row.ptip_id;
1335 l_epe.per_in_ler_id := p_currepe_row.per_in_ler_id;
1332 l_epe.pl_id := p_currepe_row.pl_id;
1333 l_epe.plip_id := p_currepe_row.plip_id;
1334 l_epe.oipl_id := p_currepe_row.oipl_id;
1336 l_epe.ler_id := p_currepe_row.ler_id;
1337 l_epe.business_group_id := p_currepe_row.business_group_id;
1338 l_epe.enrt_perd_id := p_currepe_row.enrt_perd_id;
1339 l_epe.lee_rsn_id := p_currepe_row.lee_rsn_id;
1340 l_epe.enrt_perd_strt_dt := p_currepe_row.enrt_perd_strt_dt;
1341 l_epe.prtt_enrt_rslt_id := p_currepe_row.prtt_enrt_rslt_id;
1342 --
1343 l_epe.enrt_cvg_strt_dt := p_currepe_row.enrt_cvg_strt_dt;
1344 l_epe.enrt_cvg_strt_dt_cd := p_currepe_row.enrt_cvg_strt_dt_cd;
1345 l_epe.enrt_cvg_strt_dt_rl := p_currepe_row.enrt_cvg_strt_dt_rl;
1346 l_epe.yr_perd_id := p_currepe_row.yr_perd_id;
1347 l_epe.person_id := p_person_id;
1348 --
1349 else
1350 open c_epe;
1351 fetch c_epe into l_epe;
1352 if c_epe%notfound then
1353 close c_epe;
1354 fnd_message.set_name('BEN','BEN_92743_NO_ABR_EPE_EXISTS');
1355 fnd_message.raise_error;
1356 end if;
1357 close c_epe;
1358 end if;
1359 hr_utility.set_location ('Dn Pop EPE'||l_package,10);
1360 --
1361 -- Get related information from either the context record or
1362 --
1363 if p_currepe_row.oipl_id is not null
1364 then
1365 --
1366 l_opt.opt_id := p_currepe_row.opt_id;
1367 --
1368 elsif l_epe.oipl_id is not null
1369 then
1370 --
1371 open c_opt
1372 (c_effective_date => l_effective_date
1373 );
1374 fetch c_opt into l_opt;
1375 close c_opt;
1376 --
1377 end if;
1378 --
1379 open c_abr
1380 (c_effective_date => l_effective_date
1381 );
1382 fetch c_abr into l_abr;
1383 if c_abr%notfound then
1384 close c_abr;
1385 fnd_message.set_name('BEN','BEN_92738_NO_ABR_EXISTS');
1386 fnd_message.raise_error;
1387 end if;
1388 close c_abr;
1389 --
1390 if l_abr.acty_typ_cd in ('CWBWB','CWBDB') then
1391 open c_pln_auto_distr (p_currepe_row.elig_per_elctbl_chc_id);
1392 fetch c_pln_auto_distr into l_pln_auto_distr_flag;
1393 close c_pln_auto_distr;
1394 end if;
1395 hr_utility.set_location('Roundng'||l_abr.rndg_cd,951);
1396 --
1397 -- get values for rules and limit checking
1398 --
1399 -- bug fix 3457483
1400 /* open c_asg
1401 (c_effective_date => l_effective_date
1402 );
1403 fetch c_asg into l_asg;
1404 close c_asg; */
1405 ben_element_entry.get_abr_assignment
1406 (p_person_id => p_person_id
1407 ,p_effective_date => l_effective_date
1408 ,p_acty_base_rt_id => p_acty_base_rt_id
1409 ,p_organization_id => l_organization_id
1410 ,p_payroll_id => l_payroll_id
1411 ,p_assignment_id => l_assignment_id
1412 );
1413 --
1414 -- ICM Changes
1415 -- l_element_link_id_table.DELETE;
1416
1417 --
1418 OPEN c_pl_typ (l_epe.pl_id);
1419
1420 --
1421 FETCH c_pl_typ
1422 INTO l_opt_typ_cd;
1423
1424 --
1425 CLOSE c_pl_typ;
1426
1427 --
1428 hr_utility.set_location ('l_input_value_id' || l_input_value_id, 33);
1429
1430 IF l_opt_typ_cd = 'ICM'
1431 THEN
1432 --
1433 OPEN c_abr_level;
1434
1435 FETCH c_abr_level
1436 INTO l_abr_level;
1437
1438 CLOSE c_abr_level;
1439
1440 --
1441 IF l_abr_level.pl_id IS NOT NULL
1442 THEN
1443 hr_utility.set_location ('PL LEVEL' || l_abr_level.pl_id, 32);
1444 ELSIF l_abr_level.oipl_id IS NOT NULL
1445 THEN
1446 hr_utility.set_location ('OIPL LEVEL' || l_abr_level.oipl_id, 32);
1447 END IF;
1448
1449 -- To find the eligible element link for the element attached to a Rate
1450 OPEN c_elem_link (l_abr.element_type_id);
1451
1452 --
1453 LOOP
1454 --
1455 FETCH c_elem_link
1456 INTO l_input_value_id;
1457
1458 EXIT WHEN c_elem_link%NOTFOUND;
1459 hr_utility.set_location ('l_input_value_id' || l_input_value_id, 32);
1460 --
1461 ben_element_entry.get_link
1462 (p_assignment_id => l_assignment_id,
1463 p_element_type_id => l_abr.element_type_id,
1464 p_business_group_id => p_business_group_id,
1465 p_input_value_id => l_input_value_id,
1466 p_effective_date => p_effective_date,
1467 p_element_link_id => l_element_link_id
1468 );
1469
1470 --
1471 IF l_element_link_id = l_input_value_id
1472 THEN
1473 --
1474 hr_utility.set_location ('l_element_link_id' || l_element_link_id,
1475 321
1476 );
1477 l_element_link_id_table (l_element_link_id_table.COUNT + 1) :=
1478 l_element_link_id;
1479 --
1480 END IF;
1481 --
1482 END LOOP;
1483
1484 --
1485 --MAA
1486 IF l_abr.input_va_calc_rl IS NOT NULL
1487 THEN
1488 --
1489 l_outputs.DELETE;
1490 hr_utility.set_location ( 'l_abr.input_va_calc_rl'
1491 || l_abr.input_va_calc_rl,
1492 13
1496 BEGIN
1493 );
1494 -- getting the values returned by rule
1495
1497 --
1498 l_outputs :=
1499 benutils.formula (p_formula_id => l_abr.input_va_calc_rl,
1500 p_effective_date => l_effective_date,
1501 p_business_group_id => p_business_group_id,
1502 p_assignment_id => l_assignment_id,
1503 p_organization_id => l_organization_id,
1504 p_pl_id => l_epe.pl_id,
1505 p_pl_typ_id => l_epe.pl_typ_id,
1506 p_acty_base_rt_id => p_acty_base_rt_id
1507 );
1508 --
1509 hr_utility.set_location ('l_count' || l_outputs.COUNT, 321);
1510 --
1511 EXCEPTION
1512 WHEN OTHERS
1513 THEN
1514 fnd_message.set_name ('BEN', 'BEN_92311_FORMULA_VAL_PARAM');
1515 fnd_message.set_token ('PROC', l_package);
1516 fnd_message.set_token ('FORMULA', l_abr.input_va_calc_rl);
1517 fnd_message.set_token ('PARAMETER',
1518 l_outputs (l_outputs.COUNT).NAME
1519 );
1520 fnd_message.raise_error;
1521 END;
1522 --
1523 END IF;
1524
1525 hr_utility.set_location ( 'l_element_link_id_table.LAST'
1526 || l_element_link_id_table.LAST,
1527 23
1528 );
1529 --
1530 l_counter := 0;
1531 --
1532 l_cnt_links := 0;
1533 l_cnt_inp_vals := 0;
1534 hr_utility.set_location (l_element_link_id_table.FIRST, 1121);
1535
1536 -- putting all the default values in an element link to a table that will be used to insert values in ben_icd_chc_rates
1537 IF l_element_link_id_table.COUNT > 0
1538 THEN
1539 --
1540 FOR i IN
1541 l_element_link_id_table.FIRST .. l_element_link_id_table.LAST
1542 --
1543 LOOP
1544 hr_utility.set_location ( 'l_element_link_id_table (i)'
1545 || l_element_link_id_table (i),
1546 11
1547 );
1548 IF NOT l_icd_chc_rates_tab.EXISTS(1) THEN
1549 --
1550 l_cnt_links := 1;
1551 --
1552 ELSE
1553 --
1554 l_cnt_links := l_icd_chc_rates_tab.LAST + 1;
1555 --
1556 END IF;
1557 --
1558 -- l_cnt_links := 1;
1559 hr_utility.set_location('l_cnt_links'||l_cnt_links,14);
1560 --
1561 -- creating row for icd pl sql table
1562 l_icd_chc_rates_tab (l_cnt_links).element_link_id :=
1563 l_element_link_id_table (i);
1564
1565 --
1566 IF l_abr_level.pl_id IS NULL
1567 THEN
1568 hr_utility.set_location ('PLAN', 23);
1569 l_icd_chc_rates_tab (l_cnt_links).l_level := 'O';
1570 -- l_icd_chc_rates_tab (l_cnt_links).pl_id := NULL;
1571 -- l_icd_chc_rates_tab (l_cnt_links).oipl_id := l_epe.oipl_id;
1572 ELSIF l_abr_level.oipl_id IS NULL
1573 THEN
1574 hr_utility.set_location ('OIPL', 23);
1575 l_icd_chc_rates_tab (l_cnt_links).l_level := 'P';
1576 -- l_icd_chc_rates_tab (l_cnt_links).pl_id := l_epe.pl_id;
1577 -- l_icd_chc_rates_tab (l_cnt_links).oipl_id := NULL;
1578 END IF;
1579 l_icd_chc_rates_tab (l_cnt_links).pl_id := l_epe.pl_id;
1580 l_icd_chc_rates_tab (l_cnt_links).oipl_id := l_epe.oipl_id;
1581 l_icd_chc_rates_tab (l_cnt_links).l_assignment_id :=
1582 l_assignment_id;
1583 l_icd_chc_rates_tab (l_cnt_links).pl_typ_id := l_epe.pl_typ_id;
1584 l_icd_chc_rates_tab (l_cnt_links).opt_id := l_opt.opt_id;
1585 l_icd_chc_rates_tab (l_cnt_links).pl_ordr_num := l_epe.pl_ordr_num;
1586 l_icd_chc_rates_tab (l_cnt_links).oipl_ordr_num :=
1587 l_epe.oipl_ordr_num;
1588 l_icd_chc_rates_tab (l_cnt_links).pl_ordr_num := l_epe.pl_ordr_num;
1589 l_icd_chc_rates_tab (l_cnt_links).element_type_id :=
1590 l_abr.element_type_id;
1591 l_icd_chc_rates_tab (l_cnt_links).acty_base_rt_id :=
1592 p_acty_base_rt_id;
1593 --
1594 BEGIN
1595 --
1596 OPEN c_input_values (l_element_link_id_table (i));
1597
1598 -- fetching default values defined in element link
1599 l_cnt_inp_vals := 1;
1600
1601 --
1602 LOOP
1603 FETCH c_input_values
1604 INTO l_ext_inpval;
1605
1606 --
1607 EXIT WHEN c_input_values%NOTFOUND;
1608 -- assigning default values
1609 --
1610 hr_utility.set_location ('l_cnt_inp_vals' || l_cnt_inp_vals,
1611 21
1612 );
1613
1614 IF l_cnt_inp_vals = 1
1615 THEN
1616 l_icd_chc_rates_tab (l_cnt_links).input_value_id1 :=
1617 l_ext_inpval.input_value_id;
1618 l_icd_chc_rates_tab (l_cnt_links).input_value1 :=
1622 l_icd_chc_rates_tab (l_cnt_links).input_value_id2 :=
1619 l_ext_inpval.DEFAULT_VALUE;
1620 ELSIF l_cnt_inp_vals = 2
1621 THEN
1623 l_ext_inpval.input_value_id;
1624 l_icd_chc_rates_tab (l_cnt_links).input_value2 :=
1625 l_ext_inpval.DEFAULT_VALUE;
1626 ELSIF l_cnt_inp_vals = 3
1627 THEN
1628 l_icd_chc_rates_tab (l_cnt_links).input_value_id3 :=
1629 l_ext_inpval.input_value_id;
1630 l_icd_chc_rates_tab (l_cnt_links).input_value3 :=
1631 l_ext_inpval.DEFAULT_VALUE;
1632 ELSIF l_cnt_inp_vals = 4
1633 THEN
1634 l_icd_chc_rates_tab (l_cnt_links).input_value_id4 :=
1635 l_ext_inpval.input_value_id;
1636 l_icd_chc_rates_tab (l_cnt_links).input_value4 :=
1637 l_ext_inpval.DEFAULT_VALUE;
1638 ELSIF l_cnt_inp_vals = 5
1639 THEN
1640 l_icd_chc_rates_tab (l_cnt_links).input_value_id5 :=
1641 l_ext_inpval.input_value_id;
1642 l_icd_chc_rates_tab (l_cnt_links).input_value5 :=
1643 l_ext_inpval.DEFAULT_VALUE;
1644 ELSIF l_cnt_inp_vals = 6
1645 THEN
1646 l_icd_chc_rates_tab (l_cnt_links).input_value_id6 :=
1647 l_ext_inpval.input_value_id;
1648 l_icd_chc_rates_tab (l_cnt_links).input_value6 :=
1649 l_ext_inpval.DEFAULT_VALUE;
1650 ELSIF l_cnt_inp_vals = 7
1651 THEN
1652 l_icd_chc_rates_tab (l_cnt_links).input_value_id7 :=
1653 l_ext_inpval.input_value_id;
1654 l_icd_chc_rates_tab (l_cnt_links).input_value7 :=
1655 l_ext_inpval.DEFAULT_VALUE;
1656 ELSIF l_cnt_inp_vals = 8
1657 THEN
1658 l_icd_chc_rates_tab (l_cnt_links).input_value_id8 :=
1659 l_ext_inpval.input_value_id;
1660 l_icd_chc_rates_tab (l_cnt_links).input_value8 :=
1661 l_ext_inpval.DEFAULT_VALUE;
1662 ELSIF l_cnt_inp_vals = 9
1663 THEN
1664 l_icd_chc_rates_tab (l_cnt_links).input_value_id9 :=
1665 l_ext_inpval.input_value_id;
1666 l_icd_chc_rates_tab (l_cnt_links).input_value9 :=
1667 l_ext_inpval.DEFAULT_VALUE;
1668 ELSIF l_cnt_inp_vals = 10
1669 THEN
1670 l_icd_chc_rates_tab (l_cnt_links).input_value_id10 :=
1671 l_ext_inpval.input_value_id;
1672 l_icd_chc_rates_tab (l_cnt_links).input_value10 :=
1673 l_ext_inpval.DEFAULT_VALUE;
1674 ELSIF l_cnt_inp_vals = 11
1675 THEN
1676 l_icd_chc_rates_tab (l_cnt_links).input_value_id11 :=
1677 l_ext_inpval.input_value_id;
1678 l_icd_chc_rates_tab (l_cnt_links).input_value11 :=
1679 l_ext_inpval.DEFAULT_VALUE;
1680 ELSIF l_cnt_inp_vals = 12
1681 THEN
1682 l_icd_chc_rates_tab (l_cnt_links).input_value_id12 :=
1683 l_ext_inpval.input_value_id;
1684 l_icd_chc_rates_tab (l_cnt_links).input_value12 :=
1685 l_ext_inpval.DEFAULT_VALUE;
1686 ELSIF l_cnt_inp_vals = 13
1687 THEN
1688 l_icd_chc_rates_tab (l_cnt_links).input_value_id13 :=
1689 l_ext_inpval.input_value_id;
1690 l_icd_chc_rates_tab (l_cnt_links).input_value13 :=
1691 l_ext_inpval.DEFAULT_VALUE;
1692 ELSIF l_cnt_inp_vals = 14
1693 THEN
1694 l_icd_chc_rates_tab (l_cnt_links).input_value_id14 :=
1695 l_ext_inpval.input_value_id;
1696 l_icd_chc_rates_tab (l_cnt_links).input_value14 :=
1697 l_ext_inpval.DEFAULT_VALUE;
1698 ELSIF l_cnt_inp_vals = 15
1699 THEN
1700 l_icd_chc_rates_tab (l_cnt_links).input_value_id15 :=
1701 l_ext_inpval.input_value_id;
1702 l_icd_chc_rates_tab (l_cnt_links).input_value15 :=
1703 l_ext_inpval.DEFAULT_VALUE;
1704 END IF;
1705
1706 --
1707 l_cnt_inp_vals := l_cnt_inp_vals + 1;
1708 --
1709 END LOOP;
1710
1711 --
1712 CLOSE c_input_values;
1713
1714 --
1715 -- l_cnt_links := l_cnt_links + 1;
1716 --
1717 EXCEPTION
1718 WHEN OTHERS
1719 THEN
1720 hr_utility.set_location (SQLERRM, 23);
1721 END;
1722 --
1726
1723 END LOOP;
1724 --
1725 END IF;
1727 hr_utility.set_location ('Default values assigned ', 5);
1728 hr_utility.set_location ( l_icd_chc_rates_tab.FIRST
1729 || 'f counts'
1730 || l_icd_chc_rates_tab.LAST,
1731 121
1732 );
1733
1734 --
1735 --
1736 IF l_abr.input_va_calc_rl IS NOT NULL
1737 AND l_icd_chc_rates_tab.COUNT > 0
1738 AND l_outputs.COUNT > 0
1739 THEN
1740 --
1741 l_counter := 0;
1742
1743 --
1744 /* IF NOT l_icd_chc_rates_tab.EXISTS(1) THEN
1745 --
1746 l_cnt_links := 1;
1747 --
1748 ELSE
1749 --
1750 l_cnt_links := l_icd_chc_rates_tab.LAST + 1;
1751 --
1752 END IF;*/
1753
1754 -- putting all the values returned by forumula in the table that will be used to insert values in ben_icd_chc_rates
1755 FOR l_cnt IN l_icd_chc_rates_tab.FIRST .. l_icd_chc_rates_tab.LAST
1756 -- change default values to formula returned value for every link
1757 LOOP
1758 hr_utility.set_location (' in loop ', 121);
1759
1760 -- FOR l_cnt IN l_icd_chc_rates_tab.FIRST .. l_icd_chc_rates_tab.LAST
1761 FOR l_count IN l_outputs.FIRST .. l_outputs.LAST
1762 LOOP
1763 --
1764 BEGIN
1765 --
1766 OPEN c_ext_inpval (p_acty_base_rt_id);
1767
1768 LOOP
1769 FETCH c_ext_inpval
1770 INTO l_ext_inpval_rec;
1771
1772 EXIT WHEN c_ext_inpval%NOTFOUND;
1773 --
1774 hr_utility.set_location
1775 ( ' l_outputs (l_count).NAME '
1776 || l_outputs (l_count).NAME,
1777 121
1778 );
1779 hr_utility.set_location
1780 ( ' l_ext_inpval_rec.return_var_name '
1781 || l_ext_inpval_rec.return_var_name,
1782 121
1783 );
1784
1785 IF l_outputs (l_count).NAME =
1786 l_ext_inpval_rec.return_var_name
1787 THEN
1788 --
1789 l_counter := l_counter + 1;
1790 hr_utility.set_location
1791 ('Before assign extra inputs cache',
1792 11
1793 );
1794 --
1795 hr_utility.set_location
1796 ( 'l_ext_inpval_rec.extra_input_value_id'
1797 || l_ext_inpval_rec.extra_input_value_id,
1798 132
1799 );
1800 --
1801 hr_utility.set_location('l_cnt_links'||l_cnt_links,1231);
1802 l_input_value_id :=
1803 get_input_value_id
1804 (l_ext_inpval_rec.extra_input_value_id);
1805
1806 --
1807 /* IF l_outputs (l_count).VALUE IS NOT NULL
1808 THEN
1809 --
1810 IF l_icd_chc_rates_tab (l_cnt).input_value_id1 =
1811 l_input_value_id
1812 THEN
1813 l_icd_chc_rates_tab (l_cnt).default_value1 :=
1814 l_outputs (l_count).VALUE;
1815 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id2 =
1816 l_input_value_id
1817 THEN
1818 l_icd_chc_rates_tab (l_cnt).default_value2 :=
1819 l_outputs (l_count).VALUE;
1820 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id3 =
1821 l_input_value_id
1822 THEN
1823 l_icd_chc_rates_tab (l_cnt).default_value3 :=
1824 l_outputs (l_count).VALUE;
1825 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id4 =
1826 l_input_value_id
1827 THEN
1828 l_icd_chc_rates_tab (l_cnt).default_value4 :=
1829 l_outputs (l_count).VALUE;
1830 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id5 =
1831 l_input_value_id
1832 THEN
1833 l_icd_chc_rates_tab (l_cnt).default_value5 :=
1834 l_outputs (l_count).VALUE;
1835 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id6 =
1836 l_input_value_id
1837 THEN
1838 l_icd_chc_rates_tab (l_cnt).default_value6 :=
1839 l_outputs (l_count).VALUE;
1840 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id7 =
1844 l_outputs (l_count).VALUE;
1841 l_input_value_id
1842 THEN
1843 l_icd_chc_rates_tab (l_cnt).default_value7 :=
1845 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id8 =
1846 l_input_value_id
1847 THEN
1848 l_icd_chc_rates_tab (l_cnt).default_value8 :=
1849 l_outputs (l_count).VALUE;
1850 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id9 =
1851 l_input_value_id
1852 THEN
1853 l_icd_chc_rates_tab (l_cnt).default_value9 :=
1854 l_outputs (l_count).VALUE;
1855 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id10 =
1856 l_input_value_id
1857 THEN
1858 l_icd_chc_rates_tab (l_cnt).default_value10 :=
1859 l_outputs (l_count).VALUE;
1860 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id11 =
1861 l_input_value_id
1862 THEN
1863 l_icd_chc_rates_tab (l_cnt).default_value11 :=
1864 l_outputs (l_count).VALUE;
1865 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id12 =
1866 l_input_value_id
1867 THEN
1868 l_icd_chc_rates_tab (l_cnt).default_value12 :=
1869 l_outputs (l_count).VALUE;
1870 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id13 =
1871 l_input_value_id
1872 THEN
1873 l_icd_chc_rates_tab (l_cnt).default_value13 :=
1874 l_outputs (l_count).VALUE;
1875 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id14 =
1876 l_input_value_id
1877 THEN
1878 l_icd_chc_rates_tab (l_cnt).default_value14 :=
1879 l_outputs (l_count).VALUE;
1880 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id15 =
1881 l_input_value_id
1882 THEN
1883 l_icd_chc_rates_tab (l_cnt).default_value15 :=
1884 l_outputs (l_count).VALUE;
1885 END IF;*/
1886 --
1887
1888 -- my change
1889 IF l_outputs (l_count).VALUE IS NOT NULL
1890 THEN
1891 --
1892 IF l_icd_chc_rates_tab (l_cnt_links).input_value_id1 =
1893 l_input_value_id
1894 THEN
1895 l_icd_chc_rates_tab (l_cnt_links).input_value1 :=
1896 l_outputs (l_count).VALUE;
1897 ELSIF l_icd_chc_rates_tab (l_cnt_links).input_value_id2 =
1898 l_input_value_id
1899 THEN
1900 l_icd_chc_rates_tab (l_cnt_links).input_value2 :=
1901 l_outputs (l_count).VALUE;
1902 ELSIF l_icd_chc_rates_tab (l_cnt_links).input_value_id3 =
1903 l_input_value_id
1904 THEN
1905 l_icd_chc_rates_tab (l_cnt_links).input_value3 :=
1906 l_outputs (l_count).VALUE;
1907 ELSIF l_icd_chc_rates_tab (l_cnt_links).input_value_id4 =
1908 l_input_value_id
1909 THEN
1910 l_icd_chc_rates_tab (l_cnt_links).input_value4 :=
1911 l_outputs (l_count).VALUE;
1912 ELSIF l_icd_chc_rates_tab (l_cnt_links).input_value_id5 =
1913 l_input_value_id
1914 THEN
1915 l_icd_chc_rates_tab (l_cnt_links).input_value5 :=
1916 l_outputs (l_count).VALUE;
1917 ELSIF l_icd_chc_rates_tab (l_cnt_links).input_value_id6 =
1918 l_input_value_id
1919 THEN
1920 l_icd_chc_rates_tab (l_cnt_links).input_value6 :=
1921 l_outputs (l_count).VALUE;
1922 ELSIF l_icd_chc_rates_tab (l_cnt_links).input_value_id7 =
1923 l_input_value_id
1924 THEN
1925 l_icd_chc_rates_tab (l_cnt_links).input_value7 :=
1926 l_outputs (l_count).VALUE;
1927 ELSIF l_icd_chc_rates_tab (l_cnt_links).input_value_id8 =
1928 l_input_value_id
1929 THEN
1933 l_input_value_id
1930 l_icd_chc_rates_tab (l_cnt_links).input_value8 :=
1931 l_outputs (l_count).VALUE;
1932 ELSIF l_icd_chc_rates_tab (l_cnt_links).input_value_id9 =
1934 THEN
1935 l_icd_chc_rates_tab (l_cnt_links).input_value9 :=
1936 l_outputs (l_count).VALUE;
1937 ELSIF l_icd_chc_rates_tab (l_cnt_links).input_value_id10 =
1938 l_input_value_id
1939 THEN
1940 l_icd_chc_rates_tab (l_cnt_links).input_value10 :=
1941 l_outputs (l_count).VALUE;
1942 ELSIF l_icd_chc_rates_tab (l_cnt_links).input_value_id11 =
1943 l_input_value_id
1944 THEN
1945 l_icd_chc_rates_tab (l_cnt).input_value11 :=
1946 l_outputs (l_count).VALUE;
1947 ELSIF l_icd_chc_rates_tab (l_cnt).input_value_id12 =
1948 l_input_value_id
1949 THEN
1950 l_icd_chc_rates_tab (l_cnt_links).input_value12 :=
1951 l_outputs (l_count).VALUE;
1952 ELSIF l_icd_chc_rates_tab (l_cnt_links).input_value_id13 =
1953 l_input_value_id
1954 THEN
1955 l_icd_chc_rates_tab (l_cnt_links).input_value13 :=
1956 l_outputs (l_count).VALUE;
1957 ELSIF l_icd_chc_rates_tab (l_cnt_links).input_value_id14 =
1958 l_input_value_id
1959 THEN
1960 l_icd_chc_rates_tab (l_cnt_links).input_value14 :=
1961 l_outputs (l_count).VALUE;
1962 ELSIF l_icd_chc_rates_tab (l_cnt_links).input_value_id15 =
1963 l_input_value_id
1964 THEN
1965 l_icd_chc_rates_tab (l_cnt_links).input_value15 :=
1966 l_outputs (l_count).VALUE;
1967 END IF;
1968 --my change
1969 END IF;
1970 --
1971 END IF;
1972
1973 --
1974 END LOOP;
1975
1976 --
1977 CLOSE c_ext_inpval;
1978 --
1979 END;
1980 END LOOP;
1981 END LOOP;
1982 END IF;
1983 --
1984 END IF; -- ICM;
1985
1986
1987 --
1988 -- Enhancement No 3981982 - Min Max Rule
1989 --
1990 if (l_abr.mn_mx_elcn_rl IS NOT NULL) then
1991 l_outputs := benutils.formula( p_formula_id => l_abr.mn_mx_elcn_rl,
1992 p_effective_date => NVL(p_lf_evt_ocrd_dt, l_effective_date),
1993 p_assignment_id => l_assignment_id,
1994 p_organization_id => l_organization_id,
1995 p_pgm_id => l_epe.pgm_id,
1996 p_pl_id => l_epe.pl_id,
1997 p_pl_typ_id => l_epe.pl_typ_id,
1998 p_opt_id => l_opt.opt_id,
1999 p_jurisdiction_code => l_jurisdiction_code,
2000 p_ler_id => l_epe.ler_id,
2001 p_business_group_id => l_epe.business_group_id,
2002 p_param1 => 'BEN_IV_PERSON_ID',
2003 p_param1_value => to_char(p_person_id)
2004 );
2005 hr_utility.set_location('l_outputs.count'||l_outputs.count,951);
2006 if (l_outputs.count >= 4) then
2007 for l_count in l_outputs.first..l_outputs.last loop
2008 begin
2009 if l_outputs(l_count).name = 'L_MN_ELCN_VAL' then
2010 l_abr.mn_elcn_val := fnd_number.canonical_to_number(l_outputs(l_count).value);
2011 elsif l_outputs(l_count).name = 'L_MX_ELCN_VAL' then
2012 l_abr.mx_elcn_val := fnd_number.canonical_to_number(l_outputs(l_count).value);
2013 elsif l_outputs(l_count).name = 'L_INCRMT_VAL' then
2014 l_abr.incrmt_elcn_val := fnd_number.canonical_to_number(l_outputs(l_count).value);
2015 elsif l_outputs(l_count).name = 'L_DFLT_VAL' then
2016 l_abr.dflt_val := fnd_number.canonical_to_number(l_outputs(l_count).value);
2017 end if;
2018 exception
2019 when others then
2020 fnd_message.set_name('BEN','BEN_92311_FORMULA_VAL_PARAM');
2021 fnd_message.set_token('PROC',l_package);
2022 fnd_message.set_token('FORMULA',l_abr.mn_mx_elcn_rl);
2023 fnd_message.set_token('PARAMETER',l_outputs(l_count).name);
2024 fnd_message.raise_error;
2025 end;
2026 end loop;
2027 else
2028 fnd_message.set_name('BEN','BEN_94130_MN_MX_RL_OUT_ERR');
2029 fnd_message.raise_error;
2030 end if;
2031 --hr_utility.set_location('mn_elcn_val is '||l_abr.mn_elcn_val,951);
2032 --hr_utility.set_location('mx_elcn_val is '||l_abr.mx_elcn_val,951);
2033 --hr_utility.set_location('incrmt_elcn_val is '||l_abr.incrmt_elcn_val,951);
2034 --hr_utility.set_location('dflt_val is '||l_abr.dflt_val,951);
2038 -- end bug fix 3457483
2035 end if;
2036 --
2037
2039 /* -- 4031733 - Cursor used to populate l_state.region_2 param for benutils.limit_checks
2040 -- which is not used down the line
2041 --
2042 open c_state;
2043 fetch c_state into l_state;
2044 close c_state;
2045 */
2046 hr_utility.set_location (' Checking rate multiplier code ',40);
2047 if l_abr.rt_mlt_cd is null then
2048 fnd_message.set_name('BEN','BEN_91834_BASE_RATE_COLUMN_ERR');
2049 fnd_message.set_token('COLUMN','rt_mlt_cd');
2050 fnd_message.set_token('PACKAGE',l_package);
2051 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
2052 fnd_message.set_token('ACTY_BASE_RT_ID',to_char(p_acty_base_rt_id));
2053 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
2054 fnd_message.set_token('PL_TYP_ID',to_char(p_pl_typ_id));
2055 fnd_message.set_token('PL_ID',to_char(p_pl_id));
2056 fnd_message.set_token('OIPL_ID',to_char(p_oipl_id));
2057 fnd_message.raise_error;
2058 end if;
2059 hr_utility.set_location (' Checking rate multiplier code others',50);
2060 if l_abr.rt_mlt_cd in ('FLFX','CL','AP','CVG','PRNT','CLANDCVG',
2061 'APANDCVG','PRNTANDCVG') then
2062 if l_abr.val is null and l_abr.entr_val_at_enrt_flag = 'N' then
2063 --
2064 fnd_message.set_name('BEN','BEN_91834_BASE_RATE_COLUMN_ERR');
2065 fnd_message.set_token('COLUMN','val');
2066 fnd_message.set_token('PACKAGE',l_package);
2067 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
2068 fnd_message.set_token('ACTY_BASE_RT_ID',to_char(p_acty_base_rt_id));
2069 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
2070 fnd_message.set_token('PL_TYP_ID',to_char(p_pl_typ_id));
2071 fnd_message.set_token('PL_ID',to_char(p_pl_id));
2072 fnd_message.set_token('OIPL_ID',to_char(p_oipl_id));
2073 fnd_message.raise_error;
2074 end if;
2075 end if;
2076 hr_utility.set_location (' Checking acty base rate values ',60);
2077 --
2078 -- cwb now allows null values for min/max/incrmt so no need to validate
2079 --
2080 ben_env_object.get(p_rec => l_env);
2081 if (l_abr.entr_val_at_enrt_flag = 'Y' and l_abr.entr_ann_val_flag = 'N')
2082 and nvl(l_env.mode_cd,'~') <> 'W' then
2083
2084 if l_abr.mn_elcn_val is null then
2085 hr_utility.set_location (' BEN_91834_BASE_RATE_COLUMN_ERR ',61);
2086 fnd_message.set_name('BEN','BEN_91834_BASE_RATE_COLUMN_ERR');
2087 fnd_message.set_token('COLUMN','mn_elcn_val');
2088 fnd_message.set_token('PACKAGE',l_package);
2089 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
2090 fnd_message.set_token('ACTY_BASE_RT_ID',to_char(p_acty_base_rt_id));
2091 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
2092 fnd_message.set_token('PL_TYP_ID',to_char(p_pl_typ_id));
2093 fnd_message.set_token('PL_ID',to_char(p_pl_id));
2094 fnd_message.set_token('OIPL_ID',to_char(p_oipl_id));
2095 fnd_message.raise_error;
2096
2097 elsif l_abr.mx_elcn_val is null then
2098 hr_utility.set_location (' BEN_91834_BASE_RATE_COLUMN_ERR ',62);
2099 fnd_message.set_name('BEN','BEN_91834_BASE_RATE_COLUMN_ERR');
2100 fnd_message.set_token('COLUMN','mx_elcn_val');
2101 fnd_message.set_token('PACKAGE',l_package);
2102 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
2103 fnd_message.set_token('ACTY_BASE_RT_ID',to_char(p_acty_base_rt_id));
2104 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
2105 fnd_message.set_token('PL_TYP_ID',to_char(p_pl_typ_id));
2106 fnd_message.set_token('PL_ID',to_char(p_pl_id));
2107 fnd_message.set_token('OIPL_ID',to_char(p_oipl_id));
2108 fnd_message.raise_error;
2109 elsif l_abr.incrmt_elcn_val is null then
2110 hr_utility.set_location (' BEN_91834_BASE_RATE_COLUMN_ERR ',63);
2111 fnd_message.set_name('BEN','BEN_91834_BASE_RATE_COLUMN_ERR');
2112 fnd_message.set_token('COLUMN','incrmt_elcn_val');
2113 fnd_message.set_token('PACKAGE',l_package);
2114 fnd_message.set_token('PERSON_ID',to_char(p_person_id));
2115 fnd_message.set_token('ACTY_BASE_RT_ID',to_char(p_acty_base_rt_id));
2116 fnd_message.set_token('PGM_ID',to_char(p_pgm_id));
2117 fnd_message.set_token('PL_TYP_ID',to_char(p_pl_typ_id));
2118 fnd_message.set_token('PL_ID',to_char(p_pl_id));
2119 fnd_message.set_token('OIPL_ID',to_char(p_oipl_id));
2120 fnd_message.raise_error;
2121 end if;
2122 end if;
2123
2124 hr_utility.set_location(' checking if program or plan ',70);
2125 hr_utility.set_location ('BRRRRRP '||l_package||to_char(l_coverage_value),333);
2126
2127 if l_epe.pgm_id is not null then
2128 open c_pgm
2129 (c_effective_date => l_effective_date
2130 );
2131 fetch c_pgm into l_pgm;
2132 if c_pgm%notfound then
2133 close c_pgm;
2134 fnd_message.set_name('BEN','BEN_92410_BENACTBR_PGM_NF');
2135 fnd_message.set_token('ID',to_char(l_epe.pgm_id));
2136 fnd_message.set_token('PACKAGE',l_package);
2137 fnd_message.raise_error;
2138 end if;
2139 close c_pgm;
2140 l_acty_ref_perd_cd := l_pgm.acty_ref_perd_cd;
2141 l_enrt_info_rt_freq_cd := l_pgm.enrt_info_rt_freq_cd;
2142 else
2143 hr_utility.set_location(' testing if plan ',80);
2144 hr_utility.set_location(' l_epe.pl_id'||l_epe.pl_id,80);
2145 open c_pln
2146 (c_effective_date => l_effective_date,
2147 c_pl_id => l_epe.pl_id
2148 );
2149 fetch c_pln into l_pln;
2150 if c_pln%notfound then
2151 close c_pln;
2152 fnd_message.set_name('BEN','BEN_92411_BENACTBR_PLN_NF');
2153 fnd_message.set_token('ID',to_char(l_epe.pl_id));
2154 fnd_message.set_token('PACKAGE',l_package);
2155 fnd_message.raise_error;
2156 end if;
2157 close c_pln;
2158 l_acty_ref_perd_cd := l_pln.nip_acty_ref_perd_cd;
2162 -- Bug No 4538786
2159 l_enrt_info_rt_freq_cd := l_pln.nip_enrt_info_rt_freq_cd;
2160 end if;
2161 --
2163 --
2164 /* hr_utility.set_location('PPF changes: input epe id'||p_elig_per_elctbl_chc_id,99);
2165 hr_utility.set_location('PPF changes: element type id before changes'||l_abr.element_type_id,99); */
2166 if l_abr.rt_usg_cd = 'FLXCR' and l_enrt_info_rt_freq_cd = 'PPF' then
2167 -- hr_utility.set_location('PPF changes: fetching the element type id...',99);
2168 open get_rt_and_element(l_epe.pgm_id, l_epe.per_in_ler_id);
2169 fetch get_rt_and_element into l_rt_and_element;
2170 if get_rt_and_element%FOUND then
2171 l_abr.element_type_id := l_rt_and_element.element_type_id;
2172 end if;
2173 Close get_rt_and_element; -- Close added during bug fix 4604560
2174 end if;
2175 -- hr_utility.set_location('PPF changes: afterwards element type id'||l_abr.element_type_id,99);
2176 --
2177 -- End Bug No 4538786
2178 --
2179 -- get the dflt_enrt_cd/rule
2180 --
2181 hr_utility.set_location ('BER_DDEC '||l_package,10);
2182 ben_env_object.get(p_rec => l_env);
2183 hr_utility.set_location('l_env.mode_cd' || l_env.mode_cd,13);
2184 if nvl(l_env.mode_cd,'~') <> 'D' then --cant set this code in 'D' Plans -- ICM
2185 --
2186 ben_enrolment_requirements.determine_dflt_enrt_cd
2187 (p_oipl_id =>l_epe.oipl_id
2188 ,p_plip_id =>l_epe.plip_id
2189 ,p_pl_id =>l_epe.pl_id
2190 ,p_ptip_id =>l_epe.ptip_id
2191 ,p_pgm_id =>l_epe.pgm_id
2192 ,p_ler_id =>l_epe.ler_id
2193 ,p_dflt_enrt_cd =>l_dflt_enrt_cd
2194 ,p_dflt_enrt_rl =>l_dflt_enrt_rl
2195 ,p_business_group_id =>l_epe.business_group_id
2196 ,p_effective_date =>l_cvg_eff_dt
2197 );
2198 hr_utility.set_location ('BRRRRRP '||l_package||to_char(l_coverage_value),299);
2199 --
2200 end if;
2201 if l_abr.rt_mlt_cd in ('CVG','CLANDCVG','APANDCVG','PRNTANDCVG','SAREC') then
2202 --
2203 --Bug 2192102 if the rate is of Flex credit letus get the associated enrt bnft id
2204 if l_abr.rt_usg_cd = 'FLXCR' then
2205 --
2206 hr_utility.set_location (' Before FLXCR l_enrt_bnft_id '||l_enrt_bnft_id, 19);
2207 --
2208 open c_enb_fc ;
2209 fetch c_enb_fc into l_enrt_bnft_id ;
2210 close c_enb_fc;
2211 --
2212 hr_utility.set_location (' After FLXCR l_enrt_bnft_id '||l_enrt_bnft_id, 19);
2213 end if;
2214 --
2215 if l_coverage_value is null then
2216 if l_enrt_bnft_id is null then
2217 fnd_message.set_name('BEN','BEN_92748_ABR_ENBID_NULL');
2218 fnd_message.set_token('PACKAGE',l_package);
2219 fnd_message.set_token('PARAM','p_enrt_bnft_id');
2220 fnd_message.raise_error;
2221 end if;
2222 open c_enb(l_enrt_bnft_id);
2223 fetch c_enb into l_val, l_dflt_val;
2224 if c_enb%notfound then
2225 close c_enb;
2226 fnd_message.set_name('BEN','BEN_92739_NO_ABR_ENB_EXISTS');
2227 fnd_message.raise_error;
2228 end if;
2229 close c_enb;
2230 --
2231 l_coverage_value := nvl(l_val, l_dflt_val);
2232 --
2233 end if;
2234 if l_epe.oipl_id is not NULL then
2235 open c_cvg_oipl
2236 (c_effective_date => l_effective_date
2237 );
2238 fetch c_cvg_oipl into l_cvg_calc_amt_mthd_id;
2239 if c_cvg_oipl%notfound then
2240 close c_cvg_oipl;
2241 fnd_message.set_name('BEN','BEN_92740_NO_OIPL_CCM_ATTACH');
2242 fnd_message.raise_error;
2243 end if;
2244 close c_cvg_oipl;
2245 elsif l_epe.pl_id is not NULL then
2246 open c_cvg_pl
2247 (c_effective_date => l_effective_date
2248 );
2249 fetch c_cvg_pl into l_cvg_calc_amt_mthd_id;
2250 if c_cvg_pl%notfound then
2251 close c_cvg_pl;
2252 fnd_message.set_name('BEN','BEN_92741_NO_PLN_CCM_ATTACH');
2253 fnd_message.raise_error;
2254 end if;
2255 close c_cvg_pl;
2256 else
2257 fnd_message.set_name('BEN','BEN_92744_ABR_ENB_NULL');
2258 fnd_message.raise_error;
2259 end if;
2260 p_cvg_calc_amt_mthd_id := l_cvg_calc_amt_mthd_id;
2261 end if;
2262 hr_utility.set_location ('ABR_RTMLTCD CL'||l_package,10);
2263 if l_abr.rt_mlt_cd in ('CL','CLANDCVG') then
2264 if l_abr.comp_lvl_fctr_id is null then
2265 fnd_message.set_name('BEN','BEN_92745_NO_ABR_CLF_EXISTS');
2266 fnd_message.raise_error;
2267 end if;
2268 p_comp_lvl_fctr_id := l_abr.comp_lvl_fctr_id;
2269 ben_derive_factors.determine_compensation
2270 (p_comp_lvl_fctr_id => l_abr.comp_lvl_fctr_id,
2271 p_person_id => p_person_id,
2272 p_pgm_id => l_epe.pgm_id,
2273 p_pl_id => l_epe.pl_id,
2274 p_oipl_id => l_epe.oipl_id,
2275 p_per_in_ler_id => l_epe.per_in_ler_id,
2276 p_business_group_id => l_epe.business_group_id,
2277 p_perform_rounding_flg => true,
2278 p_effective_date => p_effective_date,
2279 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
2280 p_cal_for => 'R',
2281 p_value => l_compensation_value,
2282 p_fonm_cvg_strt_dt => l_cvg_eff_dt,
2283 p_fonm_rt_strt_dt => l_fonm_rt_strt_dt );
2284
2285
2286 if l_compensation_value is null then
2287 fnd_message.set_name('BEN','BEN_92746_ABR_COMP_NULL');
2288 fnd_message.set_token('PACKAGE',l_package);
2289 fnd_message.set_token('VARIABLE','l_compensation_value');
2290 fnd_message.raise_error;
2291 end if;
2292 end if;
2293 hr_utility.set_location ('ABR_RTMLTCD AP '||l_package,10);
2294 if l_abr.rt_mlt_cd in ('AP','APANDCVG') then
2298 close c_enrt_prem;
2295 p_actl_prem_id := l_abr.actl_prem_id;
2296 open c_enrt_prem(l_abr.actl_prem_id);
2297 fetch c_enrt_prem into l_actl_prem_value;
2299 hr_utility.set_location (' Dn c_enrt_prem ',120);
2300 --6314463
2301 l_force_prem_calc := 'N';
2302 open c_force_prem_calc(p_actl_prem_id);
2303 fetch c_force_prem_calc into l_force_prem_calc;
2304 close c_force_prem_calc;
2305 --- if premium is null it will calcualte again 2797031
2306 -- 5557305 : Recalculate 'Actual Premium' irrespective of current value
2307 -- as value might have changed, Hence commented the below condition
2308 if nvl(l_env.mode_cd,'~') <> 'D' then
2309 --
2310 if /*nvl(l_actl_prem_value,0) = 0 and */ p_calc_only_rt_val_flag
2311 or (l_force_prem_calc = 'Y' and p_called_from_ss) then
2312 hr_utility.set_location('premium re calculation ',551);
2313 ben_determine_actual_premium.g_computed_prem_val := null ;
2314 ben_determine_actual_premium.main
2315 (p_person_id => p_person_id,
2316 p_effective_date => l_cvg_eff_dt,
2317 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
2318 p_calc_only_rt_val_flag => true , --6314463 As we have already decided to calculate premium for the rate
2319 --let's not allow this flag to impact the premium computation
2320 p_pgm_id => l_epe.pgm_id,
2321 p_pl_id => l_epe.pl_id,
2322 p_pl_typ_id => l_epe.pl_typ_id,
2323 p_oipl_id => l_epe.oipl_id,
2324 p_per_in_ler_id => l_epe.per_in_ler_id,
2325 p_ler_id => l_epe.ler_id,
2326 p_bnft_amt => l_coverage_value,
2327 p_business_group_id => l_epe.business_group_id );
2328
2329 hr_utility.set_location('premium re calculation over ',551);
2330 hr_utility.set_location('Required actl_prem_id ' || l_abr.actl_prem_id,551);
2331 --
2332 -- 6330056 : Match the actl_prem_id for the evaluated
2333 -- premiums to get the correct required value.
2334 --
2335 if (ben_determine_actual_premium.g_computed_prem_tbl.COUNT > 0) then
2336 --
2337 for idx IN ben_determine_actual_premium.g_computed_prem_tbl.FIRST..
2338 ben_determine_actual_premium.g_computed_prem_tbl.LAST loop
2339 --
2340 hr_utility.set_location('Calculated actl_prem_id ' ||
2341 ben_determine_actual_premium.g_computed_prem_tbl(idx).actl_prem_id,551);
2342 if (ben_determine_actual_premium.g_computed_prem_tbl(idx).actl_prem_id
2343 = l_abr.actl_prem_id) then
2344 --
2345 l_actl_prem_value :=
2346 ben_determine_actual_premium.g_computed_prem_tbl(idx).val;
2347 --
2348 end if;
2349 --
2350 end loop;
2351 --
2352 end if;
2353 --
2354 hr_utility.set_location('l_actl_prem_value ' || l_actl_prem_value,100);
2355 --l_actl_prem_value := ben_determine_actual_premium.g_computed_prem_val;
2356 hr_utility.set_location('re calculation premium'||l_actl_prem_value,551);
2357 ben_determine_actual_premium.g_computed_prem_val := null;
2358 --
2359 end if;
2360
2361 if l_actl_prem_value is null then
2362 fnd_message.set_name('BEN','BEN_92747_ABR_APR_NULL');
2363 hr_utility.set_location (' FNDMS_RE 1 ',130);
2364 fnd_message.raise_error;
2365 end if;
2366 hr_utility.set_location (' Convert prem rate (monthly) to acty_ref_perd',140);
2367 hr_utility.set_location (' l_acty_ref_perd_cd -> '||l_acty_ref_perd_cd,140);
2368 --
2369
2370 if l_acty_ref_perd_cd = 'PWK' then
2371 l_actl_prem_value := (l_actl_prem_value * 12) / 52;
2372 elsif l_acty_ref_perd_cd = 'BWK' then
2373 l_actl_prem_value := (l_actl_prem_value * 12) / 26;
2374 elsif l_acty_ref_perd_cd = 'MO' then
2375 null; -- premiums are always monthly, so nothing to do
2376 elsif l_acty_ref_perd_cd = 'SMO' then
2377 l_actl_prem_value := (l_actl_prem_value * 12) / 6;
2378 elsif l_acty_ref_perd_cd = 'PQU' then
2379 l_actl_prem_value := (l_actl_prem_value * 12) / 4;
2380 elsif l_acty_ref_perd_cd = 'SAN' then
2381 l_actl_prem_value := (l_actl_prem_value * 12) / 2;
2382 elsif l_acty_ref_perd_cd = 'PYR' then
2383 l_actl_prem_value := l_actl_prem_value * 12;
2384 elsif l_acty_ref_perd_cd = 'PHR' then
2385 --
2386 l_pay_annualization_factor := to_number(fnd_profile.value('BEN_HRLY_ANAL_FCTR'));
2387 if l_pay_annualization_factor is null then
2388 l_pay_annualization_factor := 2080;
2389 end if;
2390 --
2391 l_actl_prem_value := l_actl_prem_value * 12 / l_pay_annualization_factor;
2392 --
2393 else
2394 fnd_message.set_name('BEN','BEN_92412_UKN_ACTY_REF_PERD');
2395 fnd_message.set_token('PROC',l_package);
2396 fnd_message.set_token('VARIABLE',l_acty_ref_perd_cd);
2397 hr_utility.set_location (' FNDMS_RE 2 ',150);
2398 fnd_message.raise_error;
2399 end if;
2400 end if; --'D'
2401 end if;
2402 hr_utility.set_location ('ABR_RTMLTCD PRNT '||l_package,10);
2403 if l_abr.rt_mlt_cd in ('PRNT','PRNTANDCVG') then
2404 open c_abr2
2405 (c_effective_date => l_effective_date
2406 );
2407 fetch c_abr2 into l_acty_base_rt_id ,l_prnt_entr_val_at_enrt_flag;
2408 if c_abr2%notfound then
2409 close c_abr2;
2410 fnd_message.set_name('BEN','BEN_92742_NO_PRNT_ABR_EXISTS');
2411 fnd_message.raise_error;
2412 end if;
2413 close c_abr2;
2417 -- would be raised
2414 /*
2415 --
2416 -- MH - removed this could never occur because BEN_92742_NO_PRNT_ABR_EXISTS
2418 --
2419 if l_acty_base_rt_id is null then
2420 fnd_message.set_name('BEN','BEN_91835_VARIABLE_VALUE_NULL');
2421 fnd_message.set_token('PACKAGE',l_package);
2422 fnd_message.set_token('VARIABLE','l_acty_base_rt_id');
2423 fnd_message.raise_error;
2424 end if;
2425 */
2426 hr_utility.set_location ('St BDABR_MN Sub '||l_package,10);
2427 if l_prnt_entr_val_at_enrt_flag = 'Y' then
2428 l_cal_val := null;
2429 else
2430 l_cal_val := p_cal_val;
2431 end if;
2432 if p_parent_val is not null then
2433 l_prnt_rt_value := p_parent_val ;
2434 else
2435 ben_determine_activity_base_rt.main
2436 (p_person_id => p_person_id
2437 ,p_per_row => p_per_row
2438 ,p_asg_row => p_asg_row
2439 ,p_ast_row => p_ast_row
2440 ,p_adr_row => p_adr_row
2441 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
2442 ,p_enrt_bnft_id => l_enrt_bnft_id
2443 ,p_acty_base_rt_id => l_acty_base_rt_id
2444 ,p_effective_date => p_effective_date
2445 ,p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt
2446 ,p_perform_rounding_flg => true
2447 ,p_calc_only_rt_val_flag => p_calc_only_rt_val_flag
2448 ,p_pl_id => l_epe.pl_id
2449 ,p_pgm_id => l_epe.pgm_id
2450 ,p_oipl_id => l_epe.oipl_id
2451 ,p_pl_typ_id => l_epe.pl_typ_id
2452 ,p_per_in_ler_id => l_epe.per_in_ler_id
2453 ,p_ler_id => l_epe.ler_id
2454 ,p_bnft_amt => l_coverage_value
2455 ,p_business_group_id => l_epe.business_group_id
2456 ,p_cal_val => l_cal_val/* to handle net credit method for flex credit */
2457 ,p_val => l_prnt_rt_value
2458 ,p_mn_elcn_val => l_dummy_num
2459 ,p_mx_elcn_val => l_dummy_num
2460 ,p_ann_val => l_dummy_num
2461 ,p_ann_mn_elcn_val => l_dummy_num
2462 ,p_ann_mx_elcn_val => l_dummy_num
2463 ,p_dsply_mn_elcn_val => l_dummy_num
2464 ,p_dsply_mx_elcn_val => l_dummy_num
2465 ,p_cmcd_val => l_dummy_num
2466 ,p_cmcd_mn_elcn_val => l_dummy_num
2467 ,p_cmcd_mx_elcn_val => l_dummy_num
2468 ,p_cmcd_acty_ref_perd_cd => l_dummy_char
2469 ,p_incrmt_elcn_val => l_dummy_num
2470 ,p_dflt_val => l_dummy_num
2471 ,p_tx_typ_cd => l_dummy_char
2472 ,p_acty_typ_cd => l_dummy_char
2473 ,p_nnmntry_uom => l_dummy_char
2474 ,p_entr_val_at_enrt_flag => l_dummy_char
2475 ,p_dsply_on_enrt_flag => l_dummy_char
2476 ,p_use_to_calc_net_flx_cr_flag => l_dummy_char
2477 ,p_rt_usg_cd => l_dummy_char
2478 ,p_bnft_prvdr_pool_id => l_dummy_num
2479 ,p_actl_prem_id => l_dummy_num
2480 ,p_cvg_calc_amt_mthd_id => l_dummy_num
2481 ,p_bnft_rt_typ_cd => l_dummy_char
2482 ,p_rt_typ_cd => l_dummy_char
2483 ,p_rt_mlt_cd => l_dummy_char
2484 ,p_comp_lvl_fctr_id => l_dummy_num
2485 ,p_entr_ann_val_flag => l_dummy_char
2486 ,p_ptd_comp_lvl_fctr_id => l_dummy_num
2487 ,p_clm_comp_lvl_fctr_id => l_dummy_num
2488 ,p_ann_dflt_val => l_dummy_num
2489 ,p_rt_strt_dt => l_dummy_date
2490 ,p_rt_strt_dt_cd => l_dummy_char
2491 ,p_rt_strt_dt_rl => l_dummy_num
2492 ,p_prtt_rt_val_id => l_dummy_num
2493 ,p_pp_in_yr_used_num => l_dummy_num
2494 ,p_ordr_num => l_dummy_num
2495 ,p_iss_val => l_dummy_num
2496 );
2497 end if ;
2498 hr_utility.set_location ('Dn BDABR_MN Sub '||l_package,10);
2499 --bug :1555624 when the parent defiend as enter at enrollment then vlue
2500 -- may be returend as null or 0 this will be calcualtead in post enrollement
2501 -- process
2502 if l_prnt_rt_value is null
2503 and nvl(l_prnt_entr_val_at_enrt_flag,'N') <> 'Y'
2504 then
2505 fnd_message.set_name('BEN','BEN_91835_VARIABLE_VALUE_NULL');
2506 fnd_message.set_token('PACKAGE',l_package);
2507 fnd_message.set_token('VARIABLE','l_prnt_rt_value');
2508 fnd_message.raise_error;
2509 end if;
2510 --
2511 end if;
2512
2513 p_entr_val_at_enrt_flag := l_abr.entr_val_at_enrt_flag;
2514
2515 hr_utility.set_location(' l_abr.rt_mlt_cd:'||l_abr.rt_mlt_cd,170);
2516 hr_utility.set_location(' cal val :'|| p_cal_val,170);
2517 --- bug 1480407
2518 -- when entr_val_at_enrt_flag and use_calc_acty_bs_rt_flag is true this calculation will be called
2519 -- after enrolement with the entered rate so the calulatiuon is to be done for incomming value
2520 --- also validate the min max with the ammount entered , thi validation will be skipped in Rhi for
2521 --- calcualted amonut
2522 IF l_abr.entr_val_at_enrt_flag = 'Y' and l_abr.use_calc_acty_bs_rt_flag = 'Y' and
2523 p_cal_val is not null then
2524 --
2525 open c_enrt_rt(p_elig_per_elctbl_chc_id,p_enrt_bnft_id, p_acty_base_rt_id);
2526 fetch c_enrt_rt into l_enrt_rt;
2527 close c_enrt_rt;
2528 --
2529
2533 and p_cal_val > nvl(l_enrt_rt.mx_elcn_val,l_abr.mx_elcn_val))) then
2530 if ((nvl(l_enrt_rt.mn_elcn_val,l_abr.mn_elcn_val) is not NULL
2531 and p_cal_val < nvl(l_enrt_rt.mn_elcn_val,l_abr.mn_elcn_val))
2532 or (nvl(l_enrt_rt.mx_elcn_val,l_abr.mx_elcn_val) is not NULL
2534
2535 open c_pl_opt_name;
2536 fetch c_pl_opt_name into l_pl_opt_name;
2537 close c_pl_opt_name;
2538
2539 fnd_message.set_name('BEN','BEN_91939_NOT_IN_RANGE');
2540 fnd_message.set_token('MIN',nvl(l_enrt_rt.mn_elcn_val,l_abr.mn_elcn_val));
2541 fnd_message.set_token('MAX',nvl(l_enrt_rt.mx_elcn_val,l_abr.mx_elcn_val));
2542 fnd_message.set_token('PLOPT',l_pl_opt_name);
2543 fnd_message.raise_error;
2544
2545 elsif (mod(p_cal_val,nvl(l_enrt_rt.incrmt_elcn_val,l_abr.incrmt_elcn_val))
2546 <>0) then
2547 --
2548 -- raise error is not multiple of increment
2549 --
2550
2551 -- bug # 1699585 passing the plan name in the error message
2552 open c_pl_opt_name;
2553 fetch c_pl_opt_name into l_pl_opt_name;
2554 close c_pl_opt_name;
2555 -- end # 1699585
2556
2557 fnd_message.set_name('BEN','BEN_91932_NOT_INCREMENT');
2558 fnd_message.set_token('INCREMENT', nvl(l_enrt_rt.incrmt_elcn_val,l_abr.incrmt_elcn_val));
2559 fnd_message.set_token('PLAN', l_pl_opt_name);
2560 fnd_message.raise_error;
2561
2562 End if;
2563
2564
2565 l_abr.val := p_cal_val;
2566 hr_utility.set_location(' incomming value ' || l_abr.val , 407);
2567 end if ;
2568
2569 /* Bug 6015724 */
2570 l_prv_rt_strt_dt := null; -- 5748126
2571 l_prv_rt_end_dt := null;
2572 --
2573 -- Modified for performance.
2574 --
2575 -- When the passed in EPE prtt_enrt_rslt_id is set then do not perform
2576 -- SQL. Nullify PRV values
2577 --
2578 if p_currepe_row.elig_per_elctbl_chc_id is not null
2579 and p_currepe_row.prtt_enrt_rslt_id is null
2580 then
2581 --
2582 l_prtt_rt_val_id := null;
2583 l_rt_ovridn_flag := null;
2584 l_rt_ovridn_thru_dt := null;
2585 l_rt_val := null;
2586 --
2587 -- When the EPE prtt_enrt_rslt_id is set then perform performance PRV cursor
2588 --
2589 elsif l_epe.prtt_enrt_rslt_id is not null
2590 then
2591 --
2592 open c_perfprv
2593 (c_effective_date => l_effective_date
2594 ,c_acty_base_rt_id => p_acty_base_rt_id
2595 ,c_prtt_enrt_rslt_id => l_epe.prtt_enrt_rslt_id
2596 );
2597 loop -- 5748126: Added LOOP to fetch the Latest PRV which occurs before eff_dt
2598 fetch c_perfprv into l_prtt_rt_val_id,
2599 l_rt_ovridn_flag,
2600 l_rt_ovridn_thru_dt,
2601 l_rt_val,
2602 l_ann_rt_val,
2603 l_cmcd_rt_val,
2604 l_prv_rt_strt_dt,
2605 l_prv_rt_end_dt;
2606 --
2607 if (g_debug) then
2608 hr_utility.set_location(' l_prtt_rt_val_id: '|| l_prtt_rt_val_id
2609 ||':'|| l_prv_rt_strt_dt ||':'|| l_prv_rt_end_dt, 10);
2610 end if;
2611 --
2612 exit when (c_perfprv%notfound or l_prv_rt_strt_dt <= l_effective_date); -- 5898039: Changed from < to <=
2613 end loop;
2614 if l_prv_rt_strt_dt is null then
2615 --
2616 open c_perfprv_2
2617 (c_effective_date => l_effective_date
2618 ,c_acty_base_rt_id => p_acty_base_rt_id
2619 ,c_prtt_enrt_rslt_id => l_epe.prtt_enrt_rslt_id
2620 );
2621 loop -- 5748126: Added LOOP to fetch the Latest PRV which occurs before eff_dt
2622 fetch c_perfprv_2 into l_prtt_rt_val_id,
2623 l_rt_ovridn_flag,
2624 l_rt_ovridn_thru_dt,
2625 l_rt_val,
2626 l_ann_rt_val,
2627 l_cmcd_rt_val,
2628 l_prv_rt_strt_dt,
2629 l_prv_rt_end_dt;
2630 --
2631 if (g_debug) then
2632 hr_utility.set_location(' l_prtt_rt_val_id: '|| l_prtt_rt_val_id
2633 ||':'|| l_prv_rt_strt_dt ||':'|| l_prv_rt_end_dt, 10);
2634 end if;
2635 --
2636 exit when (c_perfprv_2%notfound or l_prv_rt_strt_dt <= l_effective_date); -- 5898039: Changed from < to <=
2637 end loop;
2638 close c_perfprv_2;
2639
2640 --
2641 end if;
2642
2643 close c_perfprv;
2644 --
2645 --
2646 -- This was left here to support for calls from outside of benmngle
2647 --
2648 else
2649 --
2650 open c_prv
2651 (c_effective_date => l_effective_date
2652 ,c_acty_base_rt_id => p_acty_base_rt_id
2653 ,c_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
2654 );
2655 loop -- 5748126: Added LOOP to fetch the Latest PRV which occurs before eff_dt
2656 fetch c_prv into l_prtt_rt_val_id,
2657 l_rt_ovridn_flag,
2658 l_rt_ovridn_thru_dt,
2659 l_rt_val,
2660 l_ann_rt_val,
2661 l_cmcd_rt_val,
2662 l_prv_rt_strt_dt,
2663 l_prv_rt_end_dt;
2664 --
2665 if (g_debug) then
2666 hr_utility.set_location(' l_prtt_rt_val_id: '|| l_prtt_rt_val_id
2667 ||':'|| l_prv_rt_strt_dt ||':'|| l_prv_rt_end_dt, 10);
2668 end if;
2672 close c_prv;
2669 --
2670 exit when c_prv%notfound or l_prv_rt_strt_dt <= l_effective_date; -- 5898039: Changed from < to <=
2671 end loop;
2673 --
2674 end if;
2675 hr_utility.set_location ('Cl c_prv '||l_package,10);
2676
2677 p_prtt_rt_val_id := l_prtt_rt_val_id;
2678 /* End Bug 6015724 */
2679 --
2680 -- Flat Amount
2681 --
2682 if l_abr.rt_mlt_cd = 'FLFX' or l_abr.use_calc_acty_bs_rt_flag = 'N' then
2683 if p_cal_val is not null then
2684 l_val := p_cal_val;
2685 else
2686 l_val := l_abr.val;
2687 end if;
2688 --
2689 elsif l_abr.rt_mlt_cd = 'CL' then
2690 benutils.rt_typ_calc
2691 (p_rt_typ_cd => l_abr.rt_typ_cd
2692 ,p_val => l_abr.val
2693 ,p_val_2 => l_compensation_value
2694 ,p_calculated_val => l_val);
2695
2696 elsif l_abr.rt_mlt_cd = 'CVG' then
2697 benutils.rt_typ_calc
2698 (p_rt_typ_cd => l_abr.bnft_rt_typ_cd
2699 ,p_val => l_abr.val
2700 ,p_val_2 => l_coverage_value
2701 ,p_calculated_val => l_val);
2702 /* : 1791203: added */
2703 /*
2704 if nvl(l_abr.det_pl_ytd_cntrs_cd,'X') = 'ESTONLY' then
2705 l_val := ben_distribute_rates.estonly_pp_to_period
2706 (p_business_group_id,
2707 p_person_id,
2708 p_effective_date ,
2709 p_acty_base_rt_id,
2710 p_elig_per_elctbl_chc_id,
2711 l_abr.element_type_id,
2712 l_payroll_id,
2713 l_val
2714 );
2715 end if;
2716 */
2717
2718
2719 elsif l_abr.rt_mlt_cd = 'AP' then
2720 benutils.rt_typ_calc
2721 (p_rt_typ_cd => l_abr.rt_typ_cd
2722 ,p_val => l_abr.val
2723 ,p_val_2 => l_actl_prem_value
2724 ,p_calculated_val => l_val);
2725
2726 elsif l_abr.rt_mlt_cd = 'PRNT' then
2727
2728 hr_utility.set_location(' abr value ' || l_abr.val , 407);
2729 hr_utility.set_location(' parent ' || l_prnt_rt_value , 407);
2730 benutils.rt_typ_calc
2731 (p_rt_typ_cd => l_abr.rt_typ_cd
2732 ,p_val => l_abr.val
2733 ,p_val_2 => l_prnt_rt_value
2734 ,p_calculated_val => l_val);
2735 if l_val is null then
2736 l_val := 0;
2737 end if;
2738 hr_utility.set_location(' result ' || l_val , 407);
2739 elsif l_abr.rt_mlt_cd = 'CLANDCVG' then
2740 benutils.rt_typ_calc
2741 (p_rt_typ_cd => l_abr.rt_typ_cd
2742 ,p_val => l_abr.val
2743 ,p_val_2 => l_compensation_value
2744 ,p_calculated_val => l_value);
2745
2746 --
2747 -- now take l_value and apply it against the coverage
2748 --
2749 benutils.rt_typ_calc
2750 (p_rt_typ_cd => l_abr.bnft_rt_typ_cd
2751 ,p_val => l_value
2752 ,p_val_2 => l_coverage_value
2753 ,p_calculated_val => l_val);
2754
2755 elsif l_abr.rt_mlt_cd = 'APANDCVG' then
2756 benutils.rt_typ_calc
2757 (p_rt_typ_cd => l_abr.rt_typ_cd
2758 ,p_val => l_abr.val
2759 ,p_val_2 => l_actl_prem_value
2760 ,p_calculated_val => l_value);
2761
2762 --
2763 -- now take l_value and apply it against the coverage
2764 --
2765 benutils.rt_typ_calc
2766 (p_rt_typ_cd => l_abr.bnft_rt_typ_cd
2767 ,p_val => l_value
2768 ,p_val_2 => l_coverage_value
2769 ,p_calculated_val => l_val);
2770
2771 elsif l_abr.rt_mlt_cd = 'PRNTANDCVG' then
2772 benutils.rt_typ_calc
2773 (p_rt_typ_cd => l_abr.rt_typ_cd
2774 ,p_val => l_abr.val
2775 ,p_val_2 => l_prnt_rt_value
2776 ,p_calculated_val => l_value);
2777
2778 --
2779 -- now take l_value and apply it against the coverage
2780 --
2781 benutils.rt_typ_calc
2782 (p_rt_typ_cd => l_abr.bnft_rt_typ_cd
2783 ,p_val => l_value
2784 ,p_val_2 => l_coverage_value
2785 ,p_calculated_val => l_val);
2786
2787 elsif l_abr.rt_mlt_cd in ('RL','ERL') then -- added ERL for canon fix
2788 --
2789 -- Call formula initialise routine
2790 --
2791 if l_assignment_id is not null then
2792
2793 --if l_asg.region_2 is not null then
2794 -- l_jurisdiction_code :=
2795 -- pay_mag_utils.lookup_jurisdiction_code
2796 -- (p_state => l_asg.region_2);
2797
2798 --end if;
2799
2800 l_outputs := benutils.formula
2801 (p_formula_id => l_abr.val_calc_rl,
2802 p_effective_date => nvl(p_lf_evt_ocrd_dt,l_effective_date),
2803 p_assignment_id => l_assignment_id,
2804 p_acty_base_rt_id => p_acty_base_rt_id,
2805 p_organization_id => l_organization_id,
2806 p_business_group_id => l_epe.business_group_id,
2807 p_pgm_id => l_epe.pgm_id,
2808 p_pl_id => l_epe.pl_id,
2812 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
2809 p_pl_typ_id => l_epe.pl_typ_id,
2810 p_opt_id => l_opt.opt_id,
2811 p_ler_id => l_epe.ler_id,
2813 p_jurisdiction_code => l_jurisdiction_code,
2814 p_param1 => 'RT_STRT_DT',
2815 p_param1_value => fnd_date.date_to_canonical(l_fonm_rt_strt_dt),
2816 p_param2 => 'CVG_STRT_DT',
2817 p_param2_value => fnd_date.date_to_canonical(l_cvg_eff_dt)
2818 );
2819 l_val := fnd_number.canonical_to_number(l_outputs(l_outputs.first).value); --bug4235088
2820 else
2821 l_val := 0;
2822 end if;
2823
2824 elsif l_abr.rt_mlt_cd = 'SAREC' then
2825 hr_utility.set_location ('BDR_ATP '||l_package||to_char(l_coverage_value),299);
2826 --ikasire -- not passing the p_complete_year_flag per bug 1650517
2827 /* Bug 6015724 */
2828 if l_rt_ovridn_flag = 'Y' and nvl(l_rt_ovridn_thru_dt, hr_api.g_eot) >= l_effective_date then
2829 --
2830 p_ann_val:= l_ann_rt_val; -- ikasire
2831 p_val := l_rt_val;
2832 p_cmcd_val := l_cmcd_rt_val;
2833 --
2834 else
2835 p_ann_val := l_coverage_value;
2836 --
2837 --
2838 --GEVITY
2839 --
2840 IF l_abr.rate_periodization_rl IS NOT NULL THEN
2841 --
2842 ben_distribute_rates.periodize_with_rule
2843 (p_formula_id => l_abr.rate_periodization_rl -- in number,
2844 ,p_effective_date => nvl(p_lf_evt_ocrd_dt,l_effective_date) --in date,
2845 ,p_assignment_id => l_assignment_id --in number,
2846 ,p_convert_from_val => l_coverage_value -- in number,
2847 ,p_convert_from => 'ANNUAL' -- in varchar2,
2848 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id -- in number,
2849 ,p_acty_base_rt_id => p_acty_base_rt_id -- in number,
2850 ,p_business_group_id => l_epe.business_group_id -- in number,
2851 ,p_enrt_rt_id => NULL -- in number default null,
2852 ,p_ann_val => p_ann_val -- out nocopy number,
2853 ,p_cmcd_val => p_cmcd_val -- out nocopy number,
2854 ,p_val => l_val -- out nocopy number
2855 );
2856 --
2857 ELSE
2858 if l_enrt_info_rt_freq_cd = 'PPF' then
2859 l_element_type_id := l_abr.element_type_id;
2860 else
2861 l_element_type_id := null;
2862 end if;
2863 --
2864 -- 14751721. If it is a new mid year election(new hire), then set the
2865 -- complete_year_flag to 'N'
2866 --
2867 l_complete_year_flag := 'Y';
2868 --
2869 if (l_prv_rt_strt_dt is not null and
2870 l_abr.rt_mlt_cd = 'SAREC') then
2871 --
2872 open c_pl_popl_yr_period_current(l_epe.pl_id
2873 ,l_epe.pgm_id
2874 ,l_epe.business_group_id
2875 );
2876 fetch c_pl_popl_yr_period_current into l_yr_strt_dt;
2877 close c_pl_popl_yr_period_current;
2878 --
2879 hr_utility.set_location ('l_yr_strt_dt '||l_yr_strt_dt,291);
2880 --
2881 open c_min_rt_strt_dt(l_epe.business_group_id);
2882 fetch c_min_rt_strt_dt into l_min_rt_strt_dt;
2883 close c_min_rt_strt_dt;
2884 --
2885 hr_utility.set_location ('l_min_rt_strt_dt '||l_min_rt_strt_dt,291);
2886 --
2887 -- Calculate the rate value from the current rate start date instead
2888 -- of the plan year period start date.
2889 --
2890 if (l_min_rt_strt_dt = l_prv_rt_strt_dt
2891 and l_prv_rt_strt_dt > l_yr_strt_dt) then
2892 l_complete_year_flag := 'N';
2893 end if;
2894 end if;
2895 hr_utility.set_location ('l_complete_year_flag '||l_complete_year_flag,291);
2896 -- end 14751721
2897 --
2898 l_val := ben_distribute_rates.annual_to_period
2899 (p_amount => p_ann_val,
2900 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
2901 p_acty_ref_perd_cd => l_acty_ref_perd_cd,
2902 p_business_group_id => l_epe.business_group_id,
2903 p_effective_date => l_effective_date,
2904 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
2905 p_complete_year_flag => l_complete_year_flag, -- 14751721
2906 p_start_date => l_prv_rt_strt_dt, -- 14751721
2907 --1791203
2908 p_payroll_id => l_payroll_id,
2909 p_element_type_id => l_element_type_id,
2910 p_rounding_flag => 'N' ); --Bug 2149438
2911 --
2912 --Bug 2149438
2913 l_val := round(l_val,4);
2914 --
2915 hr_utility.set_location ('BDR_ATP '||l_package,291);
2916 /**************************************/
2917 /* --Bug 2149438
2918 l_calc_val := ben_distribute_rates.period_to_annual
2919 (p_amount => l_val,
2920 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
2921 p_acty_ref_perd_cd => l_acty_ref_perd_cd,
2922 p_business_group_id => l_epe.business_group_id,
2923 p_effective_date => l_effective_date,
2924 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
2925 p_complete_year_flag => 'Y',
2926 p_payroll_id => l_payroll_id);
2927 */
2928 l_calc_val := p_ann_val ;
2932 l_element_type_id := l_abr.element_type_id;
2929 --
2930
2931 if l_enrt_info_rt_freq_cd = 'PPF' then
2933 else
2934 l_element_type_id := null;
2935 end if;
2936 --
2937 p_cmcd_val := ben_distribute_rates.annual_to_period_out
2938 (p_amount => l_calc_val,
2939 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
2940 p_acty_ref_perd_cd => l_enrt_info_rt_freq_cd,
2941 p_business_group_id => l_epe.business_group_id,
2942 p_effective_date => l_effective_date,
2943 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
2944 -- p_complete_year_flag => 'Y',
2945 /* Start of Changes for WWBUG: 1791203 */
2946 p_payroll_id => l_payroll_id,
2947 p_element_type_id => l_element_type_id,
2948 p_pp_in_yr_used_num => p_pp_in_yr_used_num);
2949 END IF; --GEVITY
2950 --
2951 end if; -- end if for if l_rt_ovridn_flag = 'Y'
2952 /* End Bug 6015724 */
2953 --
2954 p_cmcd_acty_ref_perd_cd := l_enrt_info_rt_freq_cd;
2955 hr_utility.set_location ('BDR_ATP '||to_char(p_ann_val),222);
2956 hr_utility.set_location ('BDR_ATP '||to_char(l_cmcd_val),223);
2957 hr_utility.set_location ('BDR_ATP '||to_char(l_val),224);
2958 elsif l_abr.rt_mlt_cd = 'NSVU' then
2959 null; -- do nothing if 'no standard value used'
2960 elsif l_abr.rt_mlt_cd = 'PRV' then
2961 --- for grade step progression
2962 hr_utility.set_location('GSP mulsti code PRV ',551) ;
2963 open c_pgr (l_abr.pay_rate_grade_rule_id , l_effective_date ) ;
2964 fetch c_pgr into l_val ;
2965 close c_pgr ;
2966 hr_utility.set_location('GSP value '|| l_val ,551) ;
2967
2968 else
2969 fnd_message.set_name('BEN','BEN_91342_UNKNOWN_CODE_1');
2970 fnd_message.set_token('PROC',l_package);
2971 fnd_message.set_token('CODE1',l_abr.rt_mlt_cd);
2972 fnd_message.raise_error;
2973 end if;
2974 hr_utility.set_location ('Dn ABR_RTMLTCDS '||l_package,10);
2975 --
2976 -- set some of the outputs
2977 --
2978 hr_utility.set_location(' set outputs ',180);
2979 p_tx_typ_cd := l_abr.tx_typ_cd;
2980 p_acty_typ_cd := l_abr.acty_typ_cd;
2981 p_nnmntry_uom := l_abr.nnmntry_uom;
2982 p_dsply_on_enrt_flag := l_abr.dsply_on_enrt_flag;
2983 p_use_to_calc_net_flx_cr_flag := l_abr.use_to_calc_net_flx_cr_flag;
2984 p_rt_usg_cd := l_abr.rt_usg_cd;
2985 p_mx_elcn_val := l_abr.mx_elcn_val;
2986 p_mn_elcn_val := l_abr.mn_elcn_val;
2987 p_incrmt_elcn_val := l_abr.incrmt_elcn_val;
2988 p_ordr_num := l_abr.ordr_num;
2989
2990 hr_utility.set_location('p_ordr_num ='||p_ordr_num,181);
2991
2992 -- get default value from the right place depending on dflt code
2993 /*
2994 if l_dflt_enrt_cd in ('NSDCS','NNCS') then
2995 p_dflt_val := l_rt_val;
2996 l_abr.dflt_val:=l_rt_val;
2997 else
2998 p_dflt_val := l_abr.dflt_val;
2999 end if;
3000 */
3001 -- Bug 1834655
3002 -- Bug 2400850 : Checking prtt_enrt_rslt_id before assigning
3003 -- values to p_dflt_val
3004 if l_dflt_enrt_cd in ('NSDCS','NNCS')
3005 and p_currepe_row.prtt_enrt_rslt_id is not null
3006 -- Bug 2677804 if there was a overriden rate and you are processing the
3007 -- enrollment after the overrident thru date dont default from the
3008 -- previous enorllment. Instead get it from the abr.
3009 and l_effective_date <= nvl( l_rt_ovridn_thru_dt,l_effective_date + 1 ) then
3010 --
3011 p_dflt_val := l_rt_val;
3012 l_abr.dflt_val:=l_rt_val;
3013 p_ann_dflt_val:= l_ann_rt_val; -- ikasire
3014 --
3015 end if;
3016 --
3017 open c_abp
3018 (c_effective_date => l_effective_date
3019 );
3020 fetch c_abp into l_bnft_prvdr_pool_id;
3021 close c_abp;
3022
3023 p_bnft_prvdr_pool_id := l_bnft_prvdr_pool_id;
3024
3025
3026 --bug : 1433393 Value us validated befoe calcualting the
3027 --variable rate riable rate with value us validated agains the ulitmate values of
3028 -- VAPRO
3029 hr_utility.set_location ('Lim Chk '||l_package,10);
3030 benutils.limit_checks
3031 (p_upr_lmt_val => l_abr.upr_lmt_val,
3032 p_lwr_lmt_val => l_abr.lwr_lmt_val,
3033 p_upr_lmt_calc_rl => l_abr.upr_lmt_calc_rl,
3034 p_lwr_lmt_calc_rl => l_abr.lwr_lmt_calc_rl,
3035 p_effective_date => nvl(p_lf_evt_ocrd_dt,l_effective_date),
3036 p_business_group_id => l_epe.business_group_id,
3037 p_assignment_id => l_assignment_id,
3038 p_acty_base_rt_id => p_acty_base_rt_id,
3039 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3040 p_organization_id => l_organization_id,
3041 p_pgm_id => l_epe.pgm_id,
3042 p_pl_id => l_epe.pl_id,
3043 p_pl_typ_id => l_epe.pl_typ_id,
3044 p_opt_id => l_opt.opt_id,
3045 p_ler_id => l_epe.ler_id,
3046 p_state => l_state.region_2,
3047 p_val => l_val); -- l_rounded_value);
3048
3049
3050
3051
3052 if l_abr.use_calc_acty_bs_rt_flag = 'N' then
3053 -- if we are not to calculate a rate, do not perform the variable rates
3054 -- code, rounding.
3055 p_val := l_val;
3056 --- this variable used for in out parameter so intialised here
3057 l_vr_ann_mn_elcn_val := l_abr.ann_mn_elcn_val;
3058 l_vr_ann_mx_elcn_val := l_abr.ann_mx_elcn_val;
3059
3060 -- bug 1210355 safe coding make the global variable g_vrbl_mlt_code null
3064
3061 -- if no variable rate is attached
3062 ben_determine_variable_rates.g_vrbl_mlt_code := null;
3063 --
3065 else
3066 --Bug 2192102 if the rate is of Flex credit letus get the associated enrt bnft id
3067 if l_enrt_bnft_id is null and l_abr.rt_usg_cd = 'FLXCR' then
3068 --
3069 hr_utility.set_location (' Before FLXCR l_enrt_bnft_id '||l_enrt_bnft_id, 19);
3070 --
3071 open c_enb_fc ;
3072 fetch c_enb_fc into l_enrt_bnft_id ;
3073 close c_enb_fc;
3074 --
3075 hr_utility.set_location (' After FLXCR l_enrt_bnft_id '||l_enrt_bnft_id, 19);
3076 end if;
3077 --
3078 hr_utility.set_location ('BDVR_MN '||l_package,10);
3079 ben_determine_variable_rates.main
3080 (p_currepe_row => p_currepe_row
3081 ,p_per_row => p_per_row
3082 ,p_asg_row => p_asg_row
3083 ,p_ast_row => p_ast_row
3084 ,p_adr_row => p_adr_row
3085 ,p_person_id => p_person_id
3086 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
3087 ,p_enrt_bnft_id => l_enrt_bnft_id
3088 ,p_acty_base_rt_id => p_acty_base_rt_id
3089 ,p_effective_date => p_effective_date
3090 ,p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt
3091 ,p_calc_only_rt_val_flag => p_calc_only_rt_val_flag
3092 ,p_pgm_id => l_epe.pgm_id
3093 ,p_pl_id => l_epe.pl_id
3094 ,p_oipl_id => l_epe.oipl_id
3095 ,p_pl_typ_id => l_epe.pl_typ_id
3096 ,p_per_in_ler_id => l_epe.per_in_ler_id
3097 ,p_ler_id => l_epe.ler_id
3098 ,p_business_group_id => l_epe.business_group_id
3099 ,p_bnft_amt => l_coverage_value
3100 ,p_entr_val_at_enrt_flag => p_entr_val_at_enrt_flag -- Bug 7414757
3101 ,p_val => l_vr_val
3102 ,p_mn_elcn_val => l_vr_mn_elcn_val
3103 ,p_mx_elcn_val => l_vr_mx_elcn_val
3104 ,p_incrmnt_elcn_val => l_vr_incrmt_elcn_val
3105 ,p_dflt_elcn_val => l_vr_dflt_elcn_val
3106 ,p_tx_typ_cd => l_vr_tx_typ_cd
3107 ,p_acty_typ_cd => l_vr_acty_typ_cd
3108 ,p_vrbl_rt_trtmt_cd => l_vr_trtmt_cd
3109 ,p_ultmt_upr_lmt => l_ultmt_upr_lmt
3110 ,p_ultmt_lwr_lmt => l_ultmt_lwr_lmt
3111 ,p_ultmt_upr_lmt_calc_rl => l_ultmt_upr_lmt_calc_rl
3112 ,p_ultmt_lwr_lmt_calc_rl => l_ultmt_lwr_lmt_calc_rl
3113 ,p_ann_mn_elcn_val => l_vr_ann_mn_elcn_val
3114 ,p_ann_mx_elcn_val => l_vr_ann_mx_elcn_val
3115 );
3116
3117 l_vapro_entr_val_at_enrt_flag := p_entr_val_at_enrt_flag; --11065081
3118 hr_utility.set_location(' after ben_determine_variable_rates ',200);
3119 --if l_val is null then
3120 -- l_vr_trtmt_cd := 'RPLC';
3121 --end if;
3122 -- Bug 8943410:Moved this code after the variable rate is treated on std rate
3123 -- and final rate value is derived
3124 /*if (l_abr.rndg_cd is not null or
3125 l_abr.rndg_rl is not null) and
3126 p_perform_rounding_flg
3127 and l_val is not null and
3128 nvl(l_vr_trtmt_cd,' ') <> 'RPLC' then
3129
3130 l_rounded_value := benutils.do_rounding
3131 (p_rounding_cd => l_abr.rndg_cd,
3132 p_rounding_rl => l_abr.rndg_rl,
3133 p_value => l_val,
3134 p_effective_date => l_effective_date);
3135 l_val := l_rounded_value;
3136 end if;*/
3137 -- End of change for Bug 8943410
3138
3139 hr_utility.set_location('rounded value rate : ' ||to_char(l_val) ,954);
3140 hr_utility.set_location('variable rate : ' ||l_vr_val ,954);
3141 hr_utility.set_location('treatement : ' ||l_vr_trtmt_cd ,954);
3142 --
3143 -- Tilak Bug 2438506 : if the abr have null values then treat as 1 for
3144 -- multiply
3145 -- as 0 for add or subtract.
3146 --
3147 if l_vr_val is not null then
3148 if l_vr_trtmt_cd = 'RPLC' then
3149 l_val := l_vr_val;
3150 elsif l_vr_trtmt_cd = 'MB' then
3151 l_val := nvl(l_val,1) * l_vr_val;
3152 elsif l_vr_trtmt_cd = 'SF' then
3153 l_val := nvl(l_val,0) - l_vr_val;
3154 elsif l_vr_trtmt_cd = 'ADDTO' then
3155 l_val := nvl(l_val,0) + l_vr_val;
3156 else
3157 l_val := l_vr_val;
3158 end if;
3159 end if;
3160
3161 -- Bug 8943410: Variable rate is treated on std rate
3162 -- and final rate value is derived
3163 if (l_abr.rndg_cd is not null or
3164 l_abr.rndg_rl is not null) and
3165 p_perform_rounding_flg
3166 and l_val is not null and
3167 nvl(l_vr_trtmt_cd,' ') <> 'RPLC' then
3168
3169 l_rounded_value := benutils.do_rounding
3170 (p_rounding_cd => l_abr.rndg_cd,
3171 p_rounding_rl => l_abr.rndg_rl,
3172 p_value => l_val,
3173 p_effective_date => l_effective_date);
3174 l_val := l_rounded_value;
3175 end if;
3176 -- End of change for Bug 8943410
3177
3178 hr_utility.set_location('l_val2 : ' ||l_val ,954);
3179
3180 if l_vr_trtmt_cd is not null then
3181 --- Tilak : this code is not validating whether the enter at enrollemt is defined
3182 --- in either side ,(rate,VAPRO), this just work on the treatment code
3183 --- the User has to make sure both the side has the same setup like enter at enrollemt
3184 --
3185 if l_vr_trtmt_cd = 'RPLC' then
3186 l_vr_mn_elcn_val := nvl(l_vr_mn_elcn_val,l_abr.mn_elcn_val) ;
3187 l_vr_mx_elcn_val := nvl(l_vr_mx_elcn_val,l_abr.mx_elcn_val) ;
3188 l_vr_incrmt_elcn_val := nvl(l_vr_incrmt_elcn_val,l_abr.incrmt_elcn_val );
3192 -- Bug 2403243 - Assigning zero to the variables if vapro is returnd null
3189 l_vr_dflt_elcn_val := nvl(l_vr_dflt_elcn_val , l_abr.dflt_val );
3190 l_vr_ann_mn_elcn_val := nvl(l_vr_ann_mn_elcn_val,l_abr.ann_mn_elcn_val);
3191 l_vr_ann_mx_elcn_val := nvl(l_vr_ann_mx_elcn_val,l_abr.ann_mx_elcn_val);
3193 -- and also l_abr values also null, which is worng.
3194 /*
3195 elsif l_vr_trtmt_cd = 'ADDTO' then
3196
3197 l_vr_mn_elcn_val := nvl(l_vr_mn_elcn_val,0)+ nvl(l_abr.mn_elcn_val,0) ;
3198 l_vr_mx_elcn_val := nvl(l_vr_mx_elcn_val,0)+ nvl(l_abr.mx_elcn_val,0) ;
3199 l_vr_incrmt_elcn_val := nvl(l_vr_incrmt_elcn_val,0)+ nvl(l_abr.incrmt_elcn_val,0);
3200 l_vr_dflt_elcn_val := nvl(l_vr_dflt_elcn_val,0)+ nvl(l_abr.dflt_val,0 );
3201 l_vr_ann_mn_elcn_val := nvl(l_vr_ann_mn_elcn_val,0)+nvl(l_abr.ann_mn_elcn_val,0);
3202 l_vr_ann_mx_elcn_val := nvl(l_vr_ann_mx_elcn_val,0)+nvl(l_abr.ann_mx_elcn_val,0);
3203
3204 elsif l_vr_trtmt_cd = 'SF' then
3205 l_vr_mn_elcn_val := nvl(l_abr.mn_elcn_val,0) - nvl(l_vr_mn_elcn_val,0) ;
3206 l_vr_mx_elcn_val := nvl(l_abr.mx_elcn_val,0) - nvl(l_vr_mx_elcn_val,0) ;
3207 l_vr_incrmt_elcn_val := nvl(l_abr.incrmt_elcn_val,0)- nvl(l_vr_incrmt_elcn_val,0);
3208 l_vr_dflt_elcn_val := nvl(l_abr.dflt_val,0 ) - nvl(l_vr_dflt_elcn_val,0);
3209 l_vr_ann_mn_elcn_val := nvl(l_abr.ann_mn_elcn_val,0)- nvl(l_vr_ann_mn_elcn_val,0);
3210 l_vr_ann_mx_elcn_val := nvl(l_abr.ann_mx_elcn_val,0)- nvl(l_vr_ann_mx_elcn_val,0);
3211
3212 elsif l_vr_trtmt_cd = 'MB' then
3213
3214 l_vr_mn_elcn_val := nvl(l_abr.mn_elcn_val,0)*nvl(l_vr_mn_elcn_val,0) ;
3215 l_vr_mx_elcn_val := nvl(l_abr.mx_elcn_val,0)*nvl(l_vr_mx_elcn_val,0) ;
3216 l_vr_incrmt_elcn_val := nvl(l_abr.incrmt_elcn_val,0)*nvl(l_vr_incrmt_elcn_val,0);
3217 l_vr_dflt_elcn_val := nvl(l_abr.dflt_val,0 )*nvl(l_vr_dflt_elcn_val,0);
3218 l_vr_ann_mn_elcn_val := nvl(l_vr_ann_mn_elcn_val,0)*nvl(l_abr.ann_mn_elcn_val,0);
3219 l_vr_ann_mx_elcn_val := nvl(l_vr_ann_mx_elcn_val,0)*nvl(l_abr.ann_mx_elcn_val,0);
3220 */
3221 elsif l_vr_trtmt_cd = 'ADDTO' then
3222
3223 l_vr_mn_elcn_val := get_expr_val('+', l_vr_mn_elcn_val,l_abr.mn_elcn_val);
3224 l_vr_mx_elcn_val := get_expr_val('+', l_vr_mx_elcn_val,l_abr.mx_elcn_val);
3225 l_vr_incrmt_elcn_val := get_expr_val('+', l_vr_incrmt_elcn_val,l_abr.incrmt_elcn_val);
3226 l_vr_dflt_elcn_val := get_expr_val('+', l_vr_dflt_elcn_val,l_abr.dflt_val);
3227 l_vr_ann_mn_elcn_val := get_expr_val('+', l_vr_ann_mn_elcn_val,l_abr.ann_mn_elcn_val);
3228 l_vr_ann_mx_elcn_val := get_expr_val('+', l_vr_ann_mx_elcn_val,l_abr.ann_mx_elcn_val);
3229
3230 elsif l_vr_trtmt_cd = 'SF' then
3231 l_vr_mn_elcn_val := get_expr_val('-', l_abr.mn_elcn_val,l_vr_mn_elcn_val);
3232 l_vr_mx_elcn_val := get_expr_val('-', l_abr.mx_elcn_val,l_vr_mx_elcn_val);
3233 l_vr_incrmt_elcn_val := get_expr_val('-', l_abr.incrmt_elcn_val,l_vr_incrmt_elcn_val);
3234 l_vr_dflt_elcn_val := get_expr_val('-', l_abr.dflt_val,l_vr_dflt_elcn_val);
3235 l_vr_ann_mn_elcn_val := get_expr_val('-', l_abr.ann_mn_elcn_val,l_vr_ann_mn_elcn_val);
3236 l_vr_ann_mx_elcn_val := get_expr_val('-', l_abr.ann_mx_elcn_val,l_vr_ann_mx_elcn_val);
3237
3238 elsif l_vr_trtmt_cd = 'MB' then
3239
3240 l_vr_mn_elcn_val := get_expr_val('*', l_abr.mn_elcn_val,l_vr_mn_elcn_val);
3241 l_vr_mx_elcn_val := get_expr_val('*', l_abr.mx_elcn_val,l_vr_mx_elcn_val) ;
3242 l_vr_incrmt_elcn_val := get_expr_val('*', l_abr.incrmt_elcn_val,l_vr_incrmt_elcn_val);
3243 l_vr_dflt_elcn_val := get_expr_val('*', l_abr.dflt_val,l_vr_dflt_elcn_val);
3244 l_vr_ann_mn_elcn_val := get_expr_val('*', l_abr.ann_mn_elcn_val,l_vr_ann_mn_elcn_val);
3245 l_vr_ann_mx_elcn_val := get_expr_val('*', l_abr.ann_mx_elcn_val,l_vr_ann_mx_elcn_val);
3246
3247 else
3248 l_vr_mn_elcn_val := l_abr.mn_elcn_val ;
3249 l_vr_mx_elcn_val := l_abr.mx_elcn_val ;
3250 l_vr_dflt_elcn_val := l_abr.dflt_val ;
3251 l_vr_incrmt_elcn_val := l_abr.incrmt_elcn_val ;
3252 --
3253 -- For selfservice enhancement :
3254 -- Should assign l_abr.ann_mn_elcn_val not l_abr.ann_mx_elcn_val
3255 --
3256 l_vr_ann_mn_elcn_val := l_abr.ann_mn_elcn_val;
3257 l_vr_ann_mx_elcn_val := l_abr.ann_mx_elcn_val;
3258
3259 end if;
3260 else
3261 l_vr_mn_elcn_val := l_abr.mn_elcn_val ;
3262 l_vr_mx_elcn_val := l_abr.mx_elcn_val ;
3263 l_vr_dflt_elcn_val := l_abr.dflt_val ;
3264 l_vr_incrmt_elcn_val := l_abr.incrmt_elcn_val ;
3265 --
3266 -- For selfservice enhancement :
3267 -- Should assign l_abr.ann_mn_elcn_val not l_abr.ann_mx_elcn_val
3268 --
3269 l_vr_ann_mn_elcn_val := l_abr.ann_mn_elcn_val;
3270 l_vr_ann_mx_elcn_val := l_abr.ann_mx_elcn_val;
3271
3272 ---
3273 end if ;
3274 --
3275 l_abr.dflt_val := nvl(l_vr_dflt_elcn_val,l_abr.dflt_val);
3276 --
3277 hr_utility.set_location(' l_vr_dflt_elcn_val ' ||l_abr.dflt_val , 199);
3278
3279 hr_utility.set_location(' mn_elcn_va ' || l_vr_mn_elcn_val , 199);
3280 p_val := l_val;
3281 hr_utility.set_location('valiable and rate : ' ||to_char(l_val) ,954);
3282 if l_ultmt_upr_lmt is not null or l_ultmt_lwr_lmt is not null
3283 OR l_ultmt_upr_lmt_calc_rl is not null or l_ultmt_lwr_lmt_calc_rl is not null then
3284 hr_utility.set_location(' calling ultmate check rate ' ,393);
3285 hr_utility.set_location('upper '|| l_ultmt_upr_lmt ||' Lower' || l_ultmt_lwr_lmt,393);
3286 hr_utility.set_location('ammount '|| p_val ,393);
3287
3288 benutils.limit_checks
3289 (p_upr_lmt_val => l_ultmt_upr_lmt,
3290 p_lwr_lmt_val => l_ultmt_lwr_lmt,
3291 p_upr_lmt_calc_rl => l_ultmt_upr_lmt_calc_rl,
3295 p_assignment_id => l_assignment_id,
3292 p_lwr_lmt_calc_rl => l_ultmt_lwr_lmt_calc_rl,
3293 p_effective_date => l_effective_date,
3294 p_business_group_id => l_epe.business_group_id,
3296 p_acty_base_rt_id => p_acty_base_rt_id,
3297 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3298 p_organization_id => l_organization_id,
3299 p_pgm_id => l_epe.pgm_id,
3300 p_pl_id => l_epe.pl_id,
3301 p_pl_typ_id => l_epe.pl_typ_id,
3302 p_opt_id => l_opt.opt_id,
3303 p_ler_id => l_epe.ler_id,
3304 p_state => l_state.region_2,
3305 p_val => p_val); -- l_rounded_value);
3306 hr_utility.set_location('ammount '|| p_val ,393);
3307
3308 end if ;
3309 --
3310 end if;
3311 --
3312 -- Start 6015724
3313 --
3314 if l_rt_ovridn_flag = 'Y' and
3315 nvl(l_rt_ovridn_thru_dt, hr_api.g_eot) >= l_effective_date and-- p_effective_date then
3316 l_rt_val = l_val then --bug 13013980
3317 p_val := l_rt_val;
3318 end if;
3319 --
3320 -- End 6015724
3321 --
3322 --
3323 -- The rate value has been calculated. All the value
3324 -- related processing is done.
3325 -- Hence, if the p_calc_only_rt_flag is ON, then
3326 -- we should just return.
3327 -- Bug 2677804 use l_effective_date to handle open enrollment also
3328 if p_calc_only_rt_val_flag then
3329 /* 6015724 - Commenting out this code as we are already doing this calculation before now
3330 if l_rt_ovridn_flag = 'Y' and
3331 nvl(l_rt_ovridn_thru_dt, hr_api.g_eot) >= l_effective_date then -- p_effective_date then
3332 p_val := l_rt_val;
3333 end if; */
3334 return;
3335 end if;
3336 --
3337 if l_pln_auto_distr_flag = 'Y' then
3338 p_iss_val := p_val;
3339 end if;
3340 --
3341 -- Get the participation start date to use in
3342 -- ben_determine_date.
3343 -- Note: don't check for notfound because
3344 --
3345 -- 1) will handle null anyway.
3346 -- 2) any eligibility requirements are already handled in bendenrr
3347 -- don't want to second guess it here
3348 --
3349 -- Check if the context information for the EPE is set. When it is
3350 -- there is no need to fire cursor because the information is pre
3351 -- derived.
3352 --
3353 if ben_manage_life_events.fonm = 'Y' then
3354 l_rt_strt_dt := l_fonm_rt_strt_dt;
3355 p_rt_strt_dt := l_rt_strt_dt;
3356 else
3357 if p_currepe_row.prtn_strt_dt is not null then
3358 --
3359 l_prtn_strt_dt := p_currepe_row.prtn_strt_dt;
3360 --
3361 else
3362 --
3363 open c_current_elig
3364 (c_person_id => p_person_id
3365 ,c_pl_id => l_epe.pl_id
3366 ,c_pgm_id => nvl(l_epe.pgm_id,-1)
3367 ,c_opt_id => l_opt.opt_id
3368 ,c_nvlopt_id => nvl(l_opt.opt_id,hr_api.g_number)
3369 ,c_effective_date => l_effective_date
3370 );
3371 fetch c_current_elig into l_prtn_strt_dt;
3372 close c_current_elig;
3373 --
3374 end if;
3375 hr_utility.set_location ('BDD_RACD '||l_package,10);
3376 ben_determine_date.rate_and_coverage_dates
3377 (p_cache_mode => TRUE
3378 ,p_par_ptip_id => l_epe.ptip_id
3379 ,p_par_plip_id => l_epe.plip_id
3380 ,p_person_id => l_epe.person_id
3381 ,p_per_in_ler_id => l_epe.per_in_ler_id
3382 ,p_pgm_id => l_epe.pgm_id
3383 ,p_pl_id => l_epe.pl_id
3384 ,p_oipl_id => l_epe.oipl_id
3385 ,p_enrt_perd_id => l_epe.enrt_perd_id
3386 ,p_lee_rsn_id => l_epe.lee_rsn_id
3387 --
3388 ,p_which_dates_cd => 'R'
3389 ,p_date_mandatory_flag => 'N'
3390 ,p_compute_dates_flag => 'Y'
3391 /*
3392 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
3393 */
3394 ,p_business_group_id => l_epe.business_group_id
3395 ,p_acty_base_rt_id => p_acty_base_rt_id
3396 ,p_effective_date => p_effective_date
3397 ,p_lf_evt_ocrd_dt => greatest
3398 (nvl(p_lf_evt_ocrd_dt,l_prtn_strt_dt)
3399 ,nvl(l_prtn_strt_dt,p_lf_evt_ocrd_dt))
3400 ,p_rt_strt_dt => l_rt_strt_dt
3401 ,p_rt_strt_dt_cd => l_rt_strt_dt_cd
3402 ,p_rt_strt_dt_rl => l_rt_strt_dt_rl
3403 ,p_enrt_cvg_strt_dt => l_dummy_date
3404 ,p_enrt_cvg_strt_dt_cd => l_dummy_char
3405 ,p_enrt_cvg_strt_dt_rl => l_dummy_num
3406 ,p_enrt_cvg_end_dt => l_dummy_date
3407 ,p_enrt_cvg_end_dt_cd => l_dummy_char
3408 ,p_enrt_cvg_end_dt_rl => l_dummy_num
3409 ,p_rt_end_dt => l_dummy_date
3410 ,p_rt_end_dt_cd => l_dummy_char
3411 ,p_rt_end_dt_rl => l_dummy_num
3412 );
3413 hr_utility.set_location ('Dn BDD_RACD '||l_package,10);
3414 p_rt_strt_dt := l_rt_strt_dt;
3415 p_rt_strt_dt_cd := l_rt_strt_dt_cd;
3416 p_rt_strt_dt_rl := l_rt_strt_dt_rl;
3417 end if;
3418
3419 p_entr_ann_val_flag := l_abr.entr_ann_val_flag;
3420 p_ptd_comp_lvl_fctr_id := l_abr.ptd_comp_lvl_fctr_id;
3421 p_clm_comp_lvl_fctr_id := l_abr.clm_comp_lvl_fctr_id;
3422 --
3423
3424 -- bug 1210355, if variable rate is detected use the mlt code attached to the variable profile
3425 if l_vr_trtmt_cd = 'RPLC' then
3426 p_rt_mlt_cd := nvl(ben_determine_variable_rates.g_vrbl_mlt_code,l_abr.rt_mlt_cd);
3430 --
3427 else
3428 p_rt_mlt_cd := l_abr.rt_mlt_cd;
3429 end if;
3431
3432 --
3433 -- compute annual val and communicated values
3434 --
3435 if l_abr.rt_mlt_cd <> 'SAREC' then
3436 if l_abr.bnft_rt_typ_cd = 'PCT' or l_abr.use_calc_acty_bs_rt_flag = 'N' then
3437 -- Percents and non-calculated rates should not have computed communicated
3438 -- nor annual values.
3439 -- bug 1834655
3440 if l_dflt_enrt_cd in ('NSDCS','NNCS') and
3441 p_currepe_row.prtt_enrt_rslt_id is not null then
3442 --
3443 null ;
3444 --
3445 else
3446 if l_abr.entr_ann_val_flag = 'Y' then
3447 p_ann_dflt_val := l_abr.dflt_val;
3448 else
3449 p_dflt_val := l_abr.dflt_val;
3450 end if;
3451 end if;
3452 -- p_ann_dflt_val := l_abr.dflt_val;
3453 p_ann_val := p_val;
3454 p_ann_mn_elcn_val := l_vr_ann_mn_elcn_val;
3455 p_ann_mx_elcn_val := l_vr_ann_mx_elcn_val;
3456 p_cmcd_val := p_val;
3457 p_cmcd_mn_elcn_val := nvl(l_vr_ann_mn_elcn_val,l_abr.ann_mn_elcn_val);
3458 p_cmcd_mx_elcn_val := nvl(l_vr_ann_mx_elcn_val,l_abr.ann_mx_elcn_val);
3459 p_cmcd_acty_ref_perd_cd := l_enrt_info_rt_freq_cd;
3460
3461 else
3462 hr_utility.set_location ('BDR_PTA '||l_package,10);
3463 hr_utility.set_location (' l_abr.dflt_val '||l_abr.dflt_val,22);
3464 hr_utility.set_location (' p_elig_per_elctbl_chc_id '||p_elig_per_elctbl_chc_id,22);
3465 --
3466 --Bug 2445318 We need to see whether to assign the l_abr.dflt_val to
3467 -- p_ann_dflt_val or p_dflt_val
3468 --
3469 --BUG 3253180 We dont need to do this for current enrollment
3470 --
3471 -- if nvl(l_env.mode_cd,'~') <> 'D' then
3472 --
3473 if l_dflt_enrt_cd in ('NSDCS','NNCS') and
3474 p_currepe_row.prtt_enrt_rslt_id is not null then
3475 --
3476 null ;
3477 else
3478 --
3479 if l_abr.dflt_val is not null then
3480 if p_entr_ann_val_flag = 'Y' then
3481 --
3482 p_ann_dflt_val := l_abr.dflt_val ;
3483 --
3484 else
3485 --GEVITY
3486 IF l_abr.rate_periodization_rl IS NOT NULL THEN
3487 --
3488 ben_distribute_rates.periodize_with_rule
3489 (p_formula_id => l_abr.rate_periodization_rl
3490 ,p_effective_date => nvl(p_lf_evt_ocrd_dt,l_effective_date)
3491 ,p_assignment_id => l_assignment_id
3492 ,p_convert_from_val => l_abr.dflt_val
3493 ,p_convert_from => 'DEFINED'
3494 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
3495 ,p_acty_base_rt_id => p_acty_base_rt_id
3496 ,p_business_group_id => l_epe.business_group_id
3497 ,p_enrt_rt_id => NULL
3498 ,p_ann_val => p_ann_dflt_val
3499 ,p_cmcd_val => l_cmcd_dummy
3500 ,p_val => l_dfnd_dummy
3501 );
3502 --
3503 ELSE
3504 --
3505 p_ann_dflt_val := ben_distribute_rates.period_to_annual
3506 (p_amount => l_abr.dflt_val,
3507 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3508 p_acty_ref_perd_cd => l_acty_ref_perd_cd,
3509 p_business_group_id => l_epe.business_group_id,
3510 p_effective_date => l_effective_date,
3511 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3512 p_complete_year_flag => 'Y',
3513 p_payroll_id => l_payroll_id);
3514 p_dflt_val := l_abr.dflt_val;
3515 --
3516 END IF; --GEVITY
3517 end if;
3518 end if;
3519 end if;
3520 --
3521 -- end if; -- 'D' Mode
3522 hr_utility.set_location (' p_dflt_val '||p_dflt_val,23);
3523 hr_utility.set_location (' p_ann_dflt_val '||p_ann_dflt_val,23);
3524 hr_utility.set_location (' l_ann_dflt_val '||l_ann_dflt_val,22);
3525 --GEVITY
3526 IF l_abr.rate_periodization_rl IS NOT NULL THEN
3527 --
3528 l_dfnd_dummy := p_val ;
3529 --
3530 ben_distribute_rates.periodize_with_rule
3531 (p_formula_id => l_abr.rate_periodization_rl
3532 ,p_effective_date => nvl(p_lf_evt_ocrd_dt,l_effective_date)
3533 ,p_assignment_id => l_assignment_id
3534 ,p_convert_from_val => l_dfnd_dummy
3535 ,p_convert_from => 'DEFINED'
3536 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
3537 ,p_acty_base_rt_id => p_acty_base_rt_id
3538 ,p_business_group_id => l_epe.business_group_id
3539 ,p_enrt_rt_id => NULL
3540 ,p_ann_val => l_ann_val
3541 ,p_cmcd_val => l_cmcd_val
3542 ,p_val => p_val
3543 );
3544 --
3545 l_dfnd_dummy := NULL ;
3546 --
3547 ELSE
3548 --
3549 l_ann_val := ben_distribute_rates.period_to_annual
3550 (p_amount => p_val,
3551 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3552 p_acty_ref_perd_cd => l_acty_ref_perd_cd,
3553 p_business_group_id => l_epe.business_group_id,
3554 p_effective_date => l_effective_date,
3555 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3556 p_complete_year_flag => 'Y',
3560 l_calc_val := ben_distribute_rates.period_to_annual
3557 p_payroll_id => l_payroll_id);
3558 hr_utility.set_location ('BDR_PTA '||l_package,290);
3559 --
3561 (p_amount => p_val,
3562 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3563 p_acty_ref_perd_cd => l_acty_ref_perd_cd,
3564 p_business_group_id => l_epe.business_group_id,
3565 p_effective_date => l_effective_date,
3566 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3567 p_complete_year_flag => 'Y',
3568 p_payroll_id => l_payroll_id);
3569 --
3570 if l_enrt_info_rt_freq_cd = 'PPF' then
3571 l_element_type_id := l_abr.element_type_id;
3572 else
3573 l_element_type_id := null;
3574 end if;
3575 --
3576 l_cmcd_val := ben_distribute_rates.annual_to_period_out
3577 (p_amount => l_calc_val,
3578 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3579 p_acty_ref_perd_cd => l_enrt_info_rt_freq_cd,
3580 p_business_group_id => l_epe.business_group_id,
3581 p_effective_date => l_effective_date,
3582 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3583 p_complete_year_flag => 'Y',
3584 /* Start of Changes for WWBUG: 1791203 */
3585 p_payroll_id => l_payroll_id,
3586 p_element_type_id => l_element_type_id,
3587 p_pp_in_yr_used_num => p_pp_in_yr_used_num);
3588 END IF; --GEVITY
3589 --
3590 p_ann_val := l_ann_val;
3591 p_cmcd_val := l_cmcd_val;
3592 p_cmcd_acty_ref_perd_cd := l_enrt_info_rt_freq_cd;
3593 --
3594 --Bug 5225815 do not prorate if there are no prior elections
3595 --or the l_rt_strt_dt is null
3596 if l_abr.entr_ann_val_flag = 'Y' and l_rt_strt_dt is not null then
3597 -- Before assigning the annual min and max, try to prorate the values.
3598 ben_distribute_rates.prorate_min_max
3599 (p_person_id => p_person_id
3600 ,p_effective_date => l_effective_date
3601 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
3602 ,p_acty_base_rt_id => p_acty_base_rt_id
3603 ,p_rt_strt_dt => l_rt_strt_dt
3604 ,p_ann_mn_val => l_vr_ann_mn_elcn_val
3605 ,p_ann_mx_val => l_vr_ann_mx_elcn_val ) ;
3606 -- Also, check that their period-to-date payments and claims do not
3607 -- force the minimum and maximum to be different.
3608 ben_distribute_rates.compare_balances
3609 (p_person_id => p_person_id
3610 ,p_effective_date => l_effective_date
3611 ,p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt
3612 ,p_pgm_id => l_epe.pgm_id
3613 ,p_pl_id => l_epe.pl_id
3614 ,p_oipl_id => l_epe.oipl_id
3615 ,p_per_in_ler_id => l_epe.per_in_ler_id
3616 ,p_business_group_id => l_epe.business_group_id
3617 ,p_acty_base_rt_id => p_acty_base_rt_id
3618 ,p_ann_mn_val => l_vr_ann_mn_elcn_val
3619 ,p_ann_mx_val => l_vr_ann_mx_elcn_val
3620 ,p_ptd_balance => l_ptd_balance -- outputs not used here.
3621 ,p_clm_balance => l_clm_balance ) ;
3622 end if;
3623 --
3624 p_ann_mn_elcn_val := nvl(l_vr_ann_mn_elcn_val,l_abr.ann_mn_elcn_val);
3625 p_ann_mx_elcn_val := nvl(l_vr_ann_mx_elcn_val,l_abr.ann_mx_elcn_val);
3626 hr_utility.set_location ('BDR_ATP '||l_package,290);
3627 hr_utility.set_location ('Dn BDR_ATP '||l_package,290);
3628 --
3629 end if;
3630 --
3631 -- bug fix 2569884 - Communicated Min and Max values are needed for self service
3632 -- irrespective of whether calculate for enrollment flag is checked or not.
3633 -- Hence, moving the logic of calculating l_cmcd_mn_val/l_cmcd_mx_val outside the
3634 -- if condition of use_calc_acty_bs_rt_flag (above).
3635 -- The communicated Min/Max are to be calculated only when rate is
3636 -- 'Enter Value at enrollment'
3637 --
3638 --Start of bug 11065081
3639 --If the standard rate setup up is enter value at enrollment, then we already have the code below
3640 --to calulate the communicated min, max for use in SS. But in case where standard rate is something
3641 --other than enter value at enrollment, the system did not calculate the communicate values. Hence
3642 --this was resulting in null pointer exception in SS. We have now included code to calculate the
3643 --commmunicated values.
3644
3645 if (l_abr.entr_val_at_enrt_flag = 'N' and l_vapro_entr_val_at_enrt_flag = 'Y') then
3646 if(l_vr_mn_elcn_val is not null and l_vr_mx_elcn_val is not null) then
3647 l_cmcd_ann_mn_val := ben_distribute_rates.period_to_annual
3648 (p_amount => l_vr_mn_elcn_val,
3649 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3650 p_acty_ref_perd_cd => l_acty_ref_perd_cd,
3651 p_business_group_id => l_epe.business_group_id,
3652 p_effective_date => l_effective_date,
3653 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3654 p_complete_year_flag => 'Y',
3655 p_payroll_id => l_payroll_id);
3656 --
3657 if l_enrt_info_rt_freq_cd = 'PPF' then
3658 l_element_type_id := l_abr.element_type_id;
3659 else
3660 l_element_type_id := null;
3661 end if;
3662 --
3666 p_acty_ref_perd_cd => l_enrt_info_rt_freq_cd,
3663 l_cmcd_mn_val := ben_distribute_rates.annual_to_period
3664 (p_amount =>l_cmcd_ann_mn_val ,
3665 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3667 p_business_group_id => l_epe.business_group_id,
3668 p_effective_date => l_effective_date,
3669 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3670 p_complete_year_flag => 'Y',
3671 p_payroll_id => l_payroll_id,
3672 p_element_type_id => l_element_type_id);
3673
3674 l_cmcd_ann_mx_val := ben_distribute_rates.period_to_annual
3675 (p_amount => l_vr_mx_elcn_val,
3676 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3677 p_acty_ref_perd_cd => l_acty_ref_perd_cd,
3678 p_business_group_id => l_epe.business_group_id,
3679 p_effective_date => l_effective_date,
3680 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3681 p_complete_year_flag => 'Y',
3682 p_payroll_id => l_payroll_id);
3683 --
3684 if l_enrt_info_rt_freq_cd = 'PPF' then
3685 l_element_type_id := l_abr.element_type_id;
3686 else
3687 l_element_type_id := null;
3688 end if;
3689 --
3690 l_cmcd_mx_val := ben_distribute_rates.annual_to_period
3691 (p_amount =>l_cmcd_ann_mx_val ,
3692 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3693 p_acty_ref_perd_cd => l_enrt_info_rt_freq_cd,
3694 p_business_group_id => l_epe.business_group_id,
3695 p_effective_date => l_effective_date,
3696 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3697 p_complete_year_flag => 'Y',
3698 p_payroll_id => l_payroll_id,
3699 p_element_type_id => l_element_type_id);
3700
3701 p_cmcd_mn_elcn_val := l_cmcd_mn_val;
3702 p_cmcd_mx_elcn_val := l_cmcd_mx_val;
3703 end if;
3704 end if;
3705 --End of bug 11065081
3706
3707 --12378553
3708 if l_abr.entr_val_at_enrt_flag='Y' or
3709 l_abr.rt_mlt_cd = 'SAREC' then
3710 l_annual_target := true;
3711 end if;
3712 --12378553
3713
3714 if l_abr.entr_val_at_enrt_flag = 'Y' then
3715 --
3716 -- For selfservice enhancement : Communicated values are required
3717 -- on self service pages.
3718 --
3719 if(l_abr.entr_ann_val_flag = 'Y') then
3720 --
3721 if nvl(l_vr_ann_mn_elcn_val,l_abr.ann_mn_elcn_val) is not null then
3722 --
3723 if l_enrt_info_rt_freq_cd = 'PPF' then
3724 l_element_type_id := l_abr.element_type_id;
3725 else
3726 l_element_type_id := null;
3727 end if;
3728 --
3729 IF l_abr.rate_periodization_rl IS NOT NULL THEN
3730 --
3731 ben_distribute_rates.periodize_with_rule
3732 (p_formula_id => l_abr.rate_periodization_rl
3733 ,p_effective_date => nvl(p_lf_evt_ocrd_dt,l_effective_date)
3734 ,p_assignment_id => l_assignment_id
3735 ,p_convert_from_val => nvl(l_vr_ann_mn_elcn_val,l_abr.ann_mn_elcn_val)
3736 ,p_convert_from => 'ANNUAL'
3737 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
3738 ,p_acty_base_rt_id => p_acty_base_rt_id
3739 ,p_business_group_id => l_epe.business_group_id
3740 ,p_enrt_rt_id => NULL
3741 ,p_ann_val => l_ann_dummy
3742 ,p_cmcd_val => l_cmcd_mn_val
3743 ,p_val => l_dfnd_dummy
3744 );
3745 --
3746 ELSE
3747 --
3748 l_cmcd_mn_val := ben_distribute_rates.annual_to_period
3749 (p_amount => nvl(l_vr_ann_mn_elcn_val,l_abr.ann_mn_elcn_val),
3750 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3751 p_acty_ref_perd_cd => l_enrt_info_rt_freq_cd,
3752 p_business_group_id => l_epe.business_group_id,
3753 p_effective_date => l_effective_date,
3754 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3755 p_complete_year_flag => 'Y',
3756 p_annual_target => l_annual_target, --12378553
3757 p_payroll_id => l_payroll_id,
3758 p_element_type_id => l_element_type_id);
3759 END IF; --GEVITY
3760 end if;
3761
3762 if nvl(l_vr_ann_mx_elcn_val,l_abr.ann_mx_elcn_val) is not null then
3763 --GEVITY
3764 IF l_abr.rate_periodization_rl IS NOT NULL THEN
3765 --
3766 ben_distribute_rates.periodize_with_rule
3767 (p_formula_id => l_abr.rate_periodization_rl
3768 ,p_effective_date => nvl(p_lf_evt_ocrd_dt,l_effective_date)
3769 ,p_assignment_id => l_assignment_id
3770 ,p_convert_from_val => nvl(l_vr_ann_mx_elcn_val,l_abr.ann_mx_elcn_val)
3771 ,p_convert_from => 'ANNUAL'
3772 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
3773 ,p_acty_base_rt_id => p_acty_base_rt_id
3774 ,p_business_group_id => l_epe.business_group_id
3775 ,p_enrt_rt_id => NULL
3779 );
3776 ,p_ann_val => l_ann_dummy
3777 ,p_cmcd_val => l_cmcd_mx_val
3778 ,p_val => l_dfnd_dummy
3780 --
3781 ELSE
3782 --
3783 if l_enrt_info_rt_freq_cd = 'PPF' then
3784 l_element_type_id := l_abr.element_type_id;
3785 else
3786 l_element_type_id := null;
3787 end if;
3788 --
3789 l_cmcd_mx_val := ben_distribute_rates.annual_to_period
3790 (p_amount =>nvl(l_vr_ann_mx_elcn_val,l_abr.ann_mx_elcn_val),
3791 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3792 p_acty_ref_perd_cd => l_enrt_info_rt_freq_cd,
3793 p_business_group_id => l_epe.business_group_id,
3794 p_effective_date => l_effective_date,
3795 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3796 p_complete_year_flag => 'Y',
3797 p_annual_target => l_annual_target, --12378553
3798 p_payroll_id => l_payroll_id,
3799 p_element_type_id => l_element_type_id);
3800 END IF; --GEVITY
3801 end if;
3802
3803 -- hmani
3804
3805 if l_abr.dflt_val is not null then
3806 hr_utility.set_location ('HMANI '||l_abr.dflt_val,290.3);
3807 --GEVITY
3808 IF l_abr.rate_periodization_rl IS NOT NULL THEN
3809 --
3810 --null;
3811
3812 ben_distribute_rates.periodize_with_rule
3813 (p_formula_id => l_abr.rate_periodization_rl
3814 ,p_effective_date => nvl(p_lf_evt_ocrd_dt,l_effective_date)
3815 ,p_assignment_id => l_assignment_id
3816 ,p_convert_from_val => p_ann_dflt_val
3817 ,p_convert_from => 'ANNUAL'
3818 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
3819 ,p_acty_base_rt_id => p_acty_base_rt_id
3820 ,p_business_group_id => l_epe.business_group_id
3821 ,p_enrt_rt_id => NULL
3822 ,p_ann_val => l_ann_dummy
3823 ,p_cmcd_val => l_cmcd_dflt_val
3824 ,p_val => l_dfnd_dummy
3825 );
3826 --
3827
3828 ELSE
3829 --
3830 if l_enrt_info_rt_freq_cd = 'PPF' then
3831 l_element_type_id := l_abr.element_type_id;
3832 else
3833 l_element_type_id := null;
3834 end if;
3835 --
3836 hr_utility.set_location ('HMANI Me here'||l_cmcd_dflt_val,290.3);
3837 l_cmcd_dflt_val := ben_distribute_rates.annual_to_period
3838 (p_amount => p_ann_dflt_val,
3839 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3840 p_acty_ref_perd_cd => l_enrt_info_rt_freq_cd,
3841 p_business_group_id => l_epe.business_group_id,
3842 p_effective_date => l_effective_date,
3843 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3844 p_complete_year_flag => 'Y',
3845 p_annual_target => l_annual_target, --12378553
3846 p_payroll_id => l_payroll_id,
3847 p_element_type_id => l_element_type_id);
3848
3849 --7154229
3850 if(p_cmcd_val is null) then
3851 p_cmcd_val := l_cmcd_dflt_val;
3852 end if;
3853 hr_utility.set_location ('HMANI '||l_cmcd_dflt_val,290.3);
3854 END IF; --GEVITY
3855 end if;
3856
3857 -- End of hmani
3858
3859 else
3860 --
3861 -- When enter annual value flag is 'N', we need to
3862 -- convert defined values into annual values
3863 -- and then covert them into communicated min max values
3864 --
3865 if (nvl(l_vr_mn_elcn_val,l_abr.mn_elcn_val)) is not null then
3866 --GEVITY
3867 IF l_abr.rate_periodization_rl IS NOT NULL THEN
3868 --
3869 ben_distribute_rates.periodize_with_rule
3870 (p_formula_id => l_abr.rate_periodization_rl
3871 ,p_effective_date => nvl(p_lf_evt_ocrd_dt,l_effective_date)
3872 ,p_assignment_id => l_assignment_id
3873 ,p_convert_from_val => nvl(l_vr_mn_elcn_val,l_abr.mn_elcn_val)
3874 ,p_convert_from => 'DEFINED'
3875 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
3876 ,p_acty_base_rt_id => p_acty_base_rt_id
3877 ,p_business_group_id => l_epe.business_group_id
3878 ,p_enrt_rt_id => NULL
3879 ,p_ann_val => l_cmcd_ann_mn_val
3880 ,p_cmcd_val => l_cmcd_mn_val
3881 ,p_val => l_dfnd_dummy
3882 );
3883 --
3884 ELSE
3885 --
3886 l_cmcd_ann_mn_val := ben_distribute_rates.period_to_annual
3887 (p_amount => nvl(l_vr_mn_elcn_val,l_abr.mn_elcn_val),
3888 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3889 p_acty_ref_perd_cd => l_acty_ref_perd_cd,
3890 p_business_group_id => l_epe.business_group_id,
3894 p_payroll_id => l_payroll_id);
3891 p_effective_date => l_effective_date,
3892 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3893 p_complete_year_flag => 'Y',
3895 --
3896 if l_enrt_info_rt_freq_cd = 'PPF' then
3897 l_element_type_id := l_abr.element_type_id;
3898 else
3899 l_element_type_id := null;
3900 end if;
3901 --
3902 l_cmcd_mn_val := ben_distribute_rates.annual_to_period
3903 (p_amount =>l_cmcd_ann_mn_val ,
3904 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3905 p_acty_ref_perd_cd => l_enrt_info_rt_freq_cd,
3906 p_business_group_id => l_epe.business_group_id,
3907 p_effective_date => l_effective_date,
3908 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3909 p_complete_year_flag => 'Y',
3910 p_payroll_id => l_payroll_id,
3911 p_element_type_id => l_element_type_id);
3912 --
3913 END IF; --GEVITY
3914 end if;
3915
3916 if (nvl(l_vr_mx_elcn_val,l_abr.mx_elcn_val)) is not null then
3917 --GEVITY
3918 IF l_abr.rate_periodization_rl IS NOT NULL THEN
3919 --
3920 ben_distribute_rates.periodize_with_rule
3921 (p_formula_id => l_abr.rate_periodization_rl
3922 ,p_effective_date => nvl(p_lf_evt_ocrd_dt,l_effective_date)
3923 ,p_assignment_id => l_assignment_id
3924 ,p_convert_from_val => nvl(l_vr_mx_elcn_val,l_abr.mx_elcn_val)
3925 ,p_convert_from => 'DEFINED'
3926 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
3927 ,p_acty_base_rt_id => p_acty_base_rt_id
3928 ,p_business_group_id => l_epe.business_group_id
3929 ,p_enrt_rt_id => NULL
3930 ,p_ann_val => l_cmcd_ann_mx_val
3931 ,p_cmcd_val => l_cmcd_mx_val
3932 ,p_val => l_dfnd_dummy
3933 );
3934 --
3935 ELSE
3936 --
3937 --
3938 l_cmcd_ann_mx_val := ben_distribute_rates.period_to_annual
3939 (p_amount => nvl(l_vr_mx_elcn_val,l_abr.mx_elcn_val),
3940 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3941 p_acty_ref_perd_cd => l_acty_ref_perd_cd,
3942 p_business_group_id => l_epe.business_group_id,
3943 p_effective_date => l_effective_date,
3944 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3945 p_complete_year_flag => 'Y',
3946 p_payroll_id => l_payroll_id);
3947 --
3948
3949 if l_enrt_info_rt_freq_cd = 'PPF' then
3950 l_element_type_id := l_abr.element_type_id;
3951 else
3952 l_element_type_id := null;
3953 end if;
3954 --
3955 l_cmcd_mx_val := ben_distribute_rates.annual_to_period
3956 (p_amount =>l_cmcd_ann_mx_val,
3957 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3958 p_acty_ref_perd_cd => l_enrt_info_rt_freq_cd,
3959 p_business_group_id => l_epe.business_group_id,
3960 p_effective_date => l_effective_date,
3961 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3962 p_complete_year_flag => 'Y',
3963 p_payroll_id => l_payroll_id,
3964 p_element_type_id => l_element_type_id);
3965 --
3966 END IF; --GEVITY
3967 end if;
3968
3969 --hmani -- 3274902
3970 if l_abr.dflt_val is not null then
3971 --GEVITY
3972 IF l_abr.rate_periodization_rl IS NOT NULL THEN
3973 --
3974 ben_distribute_rates.periodize_with_rule
3975 (p_formula_id => l_abr.rate_periodization_rl
3976 ,p_effective_date => nvl(p_lf_evt_ocrd_dt,l_effective_date)
3977 ,p_assignment_id => l_assignment_id
3978 ,p_convert_from_val => l_abr.dflt_val
3979 ,p_convert_from => 'DEFINED'
3980 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
3981 ,p_acty_base_rt_id => p_acty_base_rt_id
3982 ,p_business_group_id => l_epe.business_group_id
3983 ,p_enrt_rt_id => NULL
3984 ,p_ann_val => l_cmcd_ann_dflt_val
3985 ,p_cmcd_val => l_cmcd_dflt_val
3986 ,p_val => l_dfnd_dummy
3987 );
3988 --
3989 ELSE
3990 --
3991 --
3992 l_cmcd_ann_dflt_val := ben_distribute_rates.period_to_annual
3993 (p_amount => l_abr.dflt_val,
3994 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
3995 p_acty_ref_perd_cd => l_acty_ref_perd_cd,
3996 p_business_group_id => l_epe.business_group_id,
3997 p_effective_date => l_effective_date,
3998 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
3999 p_complete_year_flag => 'Y',
4000 p_payroll_id => l_payroll_id);
4001 --
4005 else
4002
4003 if l_enrt_info_rt_freq_cd = 'PPF' then
4004 l_element_type_id := l_abr.element_type_id;
4006 l_element_type_id := null;
4007 end if;
4008 --
4009 l_cmcd_dflt_val := ben_distribute_rates.annual_to_period
4010 (p_amount =>l_cmcd_ann_dflt_val,
4011 p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id,
4012 p_acty_ref_perd_cd => l_enrt_info_rt_freq_cd,
4013 p_business_group_id => l_epe.business_group_id,
4014 p_effective_date => l_effective_date,
4015 p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt,
4016 p_complete_year_flag => 'Y',
4017 p_payroll_id => l_payroll_id,
4018 p_element_type_id => l_element_type_id);
4019 hr_utility.set_location ('HMANI '||l_cmcd_dflt_val,290.678);
4020 --
4021 END IF; --GEVITY
4022 end if;
4023
4024 --End of 3274902 hmani
4025
4026 end if;
4027 ---
4028
4029 p_cmcd_mn_elcn_val := l_cmcd_mn_val;
4030 p_cmcd_mx_elcn_val :=l_cmcd_mx_val;
4031 --p_cmcd_val := l_cmcd_dflt_val; --Bug 15853867
4032 --
4033 -- For selfservice enhancement : Communicated values are required
4034 -- on self service pages.
4035 --
4036 end if;
4037 --
4038 -- end fix 2569884
4039 end if;
4040 --
4041 -- 3274902
4042 -- Cmcd_dflt_val is not getting calculated or returned since there is no
4043 -- parameter added to the benrates package.
4044 -- As a workaround to fix the issue with minimal code impact, p_iss_val paramter
4045 -- has been chosen and the l_cmcd_dflt val has been returned in the p_iss_val
4046 -- We here check that the mode is not CWB since CWB only uses iss_val
4047
4048 ben_env_object.get(p_rec => l_env);
4049 hr_utility.set_location(' ben_env_object: Mode ' || l_env.mode_cd, 10);
4050
4051 if l_env.mode_cd <> 'W' and p_iss_val is null then
4052 p_iss_val := l_cmcd_dflt_val ;
4053 end if;
4054
4055 -- End of 3274902
4056
4057
4058 -- set remaining outputs, variable rate outputs override abr outputs.
4059 --
4060 if l_abr.entr_val_at_enrt_flag = 'Y' then
4061 p_bnft_rt_typ_cd := l_abr.bnft_rt_typ_cd;
4062 p_rt_typ_cd := l_abr.rt_typ_cd;
4063 -- p_dflt_val := l_abr.dflt_val; -- 2445318
4064 else
4065 p_bnft_rt_typ_cd := null;
4066 p_rt_typ_cd := null;
4067 end if;
4068
4069 if l_vr_mn_elcn_val is not null then
4070 p_mn_elcn_val := l_vr_mn_elcn_val;
4071 end if;
4072
4073 if l_vr_mx_elcn_val is not null then
4074 p_mx_elcn_val := l_vr_mx_elcn_val;
4075 end if;
4076
4077 if l_vr_incrmt_elcn_val is not null then
4078 p_incrmt_elcn_val := l_vr_incrmt_elcn_val;
4079 end if;
4080 -- 2445318 Already handled
4081 --if l_vr_dflt_elcn_val is not null then
4082 -- p_dflt_val := l_vr_dflt_elcn_val;
4083 --end if;
4084
4085 if l_vr_tx_typ_cd is not null then
4086 p_tx_typ_cd := l_vr_tx_typ_cd;
4087 end if;
4088
4089 if l_vr_acty_typ_cd is not null then
4090 p_acty_typ_cd := l_vr_acty_typ_cd;
4091 end if;
4092
4093 if l_vr_ann_mn_elcn_val is not null then
4094 p_ann_mn_elcn_val := l_vr_ann_mn_elcn_val;
4095 --
4096 -- For selfservice enhancement : Communicated values are required
4097 -- on self service pages.
4098 --
4099 p_cmcd_mn_elcn_val := l_cmcd_mn_val;
4100
4101 end if;
4102
4103 if l_vr_ann_mx_elcn_val is not null then
4104 p_ann_mx_elcn_val := l_vr_ann_mx_elcn_val;
4105 --
4106 -- For selfservice enhancement : Communicated values are required
4107 -- on self service pages.
4108 --
4109 p_cmcd_mx_elcn_val := l_cmcd_mx_val;
4110 --
4111 end if;
4112 -- Bug 4637525
4113 --
4114 hr_utility.set_location('ACE l_abr.rt_mlt_cd = ' || l_abr.rt_mlt_cd , 9898);
4115 hr_utility.set_location('ACE l_env.mode_cd = ' || l_env.mode_cd , 9898);
4116 hr_utility.set_location('ACE l_abr.entr_val_at_enrt_flag = ' || l_abr.entr_val_at_enrt_flag , 9898);
4117 hr_utility.set_location('ACE l_abr.acty_typ_cd = ' || l_abr.acty_typ_cd , 9898);
4118 hr_utility.set_location('ACE l_compensation_value = ' || l_compensation_value , 9898);
4119 --
4120 if nvl(l_env.mode_cd,'~') = 'W' and
4121 l_abr.entr_val_at_enrt_flag = 'Y' and
4122 l_abr.rt_mlt_cd in ('CL' ) and
4123 l_abr.acty_typ_cd like 'CWB%' and
4124 l_compensation_value is not null and
4125 nvl(l_vr_trtmt_cd,' ') <> 'RPLC'
4126 then
4127 --
4128 benutils.rt_typ_calc
4129 (p_rt_typ_cd => l_abr.rt_typ_cd
4130 ,p_val => p_mn_elcn_val
4131 ,p_val_2 => l_compensation_value
4132 ,p_calculated_val => l_cwb_mn_elcn_val);
4133 --
4134 hr_utility.set_location('l_cwb_mn_elcn_val is '||l_cwb_mn_elcn_val,951);
4135 --
4136 --
4137 benutils.rt_typ_calc
4138 (p_rt_typ_cd => l_abr.rt_typ_cd
4139 ,p_val => p_mx_elcn_val
4140 ,p_val_2 => l_compensation_value
4141 ,p_calculated_val => l_cwb_mx_elcn_val);
4142 --
4143 hr_utility.set_location('l_cwb_mx_elcn_val is '|| l_cwb_mx_elcn_val,951);
4144 --
4145 -- 5371364 : Do not Operate (i.e multiply/divide..) the Increment Value.
4146 l_cwb_incrmt_elcn_val := p_incrmt_elcn_val;
4147 /*
4148 benutils.rt_typ_calc
4152 ,p_calculated_val => l_cwb_incrmt_elcn_val);
4149 (p_rt_typ_cd => l_abr.rt_typ_cd
4150 ,p_val => p_incrmt_elcn_val
4151 ,p_val_2 => l_compensation_value
4153 */
4154 --
4155
4156 hr_utility.set_location('l_cwb_incrmt_elcn_val is '|| l_cwb_incrmt_elcn_val,951);
4157 --
4158 benutils.rt_typ_calc
4159 (p_rt_typ_cd => l_abr.rt_typ_cd
4160 ,p_val => l_vr_dflt_elcn_val
4161 ,p_val_2 => l_compensation_value
4162 ,p_calculated_val => l_cwb_dflt_val);
4163 --
4164 hr_utility.set_location('l_cwb_dflt_val is '|| l_cwb_dflt_val,951);
4165 --
4166 --
4167 -- Round the values. Bug 4873847.
4168 --
4169 if (l_abr.rndg_cd is not null or
4170 l_abr.rndg_rl is not null) and
4171 p_perform_rounding_flg then
4172
4173 if l_cwb_mn_elcn_val is not null then
4174 l_rounded_value := benutils.do_rounding
4175 (p_rounding_cd => l_abr.rndg_cd,
4176 p_rounding_rl => l_abr.rndg_rl,
4177 p_value => l_cwb_mn_elcn_val,
4178 p_effective_date => l_effective_date);
4179 l_cwb_mn_elcn_val := l_rounded_value;
4180 end if;
4181 --
4182 if l_cwb_mx_elcn_val is not null then
4183 l_rounded_value := benutils.do_rounding
4184 (p_rounding_cd => l_abr.rndg_cd,
4185 p_rounding_rl => l_abr.rndg_rl,
4186 p_value => l_cwb_mx_elcn_val,
4187 p_effective_date => l_effective_date);
4188 l_cwb_mx_elcn_val := l_rounded_value;
4189 end if;
4190 --
4191 if l_cwb_dflt_val is not null then
4192 l_rounded_value := benutils.do_rounding
4193 (p_rounding_cd => l_abr.rndg_cd,
4194 p_rounding_rl => l_abr.rndg_rl,
4195 p_value => l_cwb_dflt_val,
4196 p_effective_date => l_effective_date);
4197 l_cwb_dflt_val := l_rounded_value;
4198 end if;
4199 end if;
4200 --
4201 p_mx_elcn_val := nvl(l_cwb_mx_elcn_val, p_mx_elcn_val);
4202 p_mn_elcn_val := nvl(l_cwb_mn_elcn_val, p_mn_elcn_val);
4203 p_incrmt_elcn_val := nvl(l_cwb_incrmt_elcn_val,p_incrmt_elcn_val);
4204 l_vr_dflt_elcn_val := nvl(l_cwb_dflt_val, l_vr_dflt_elcn_val );
4205 p_dflt_val := l_vr_dflt_elcn_val;
4206 --
4207 hr_utility.set_location('ACE p_mn_elcn_val = ' || p_mn_elcn_val , 9898);
4208 hr_utility.set_location('ACE p_mx_elcn_val = ' || p_mx_elcn_val , 9898);
4209 hr_utility.set_location('ACE p_incrmt_elcn_val = ' || p_incrmt_elcn_val , 9898);
4210 hr_utility.set_location('ACE l_vr_dflt_elcn_val = ' || l_vr_dflt_elcn_val , 9898);
4211 --
4212 end if;
4213 --
4214 -- Bug 4637525
4215
4216 if l_abr.entr_ann_val_flag = 'Y' then
4217 p_dsply_mn_elcn_val := nvl(l_vr_ann_mx_elcn_val,l_abr.ann_mn_elcn_val);
4218 p_dsply_mx_elcn_val := nvl(l_vr_ann_mx_elcn_val,l_abr.ann_mx_elcn_val);
4219 p_comp_lvl_fctr_id := l_abr.comp_lvl_fctr_id;
4220 else
4221 p_dsply_mn_elcn_val := p_mn_elcn_val;
4222 p_dsply_mx_elcn_val := p_mx_elcn_val;
4223 end if;
4224
4225 /* Bg 6015724 : Shifting this code part above
4226 --Bug 2677804. Use l_effective_date to resolve the open enrollment issue.
4227 if l_rt_ovridn_flag = 'Y' and
4228 nvl(l_rt_ovridn_thru_dt, hr_api.g_eot) >= l_effective_date then -- p_effective_date then
4229 p_val := l_rt_val;
4230 end if;
4231 */
4232
4233 hr_utility.set_location ('Leaving '||l_package,999);
4234 exception
4235 --
4236 when others then
4237 --
4238 p_val := null;
4239 p_mn_elcn_val := null;
4240 p_mx_elcn_val := null;
4241 p_ann_val := null;
4242 p_ann_mn_elcn_val := null;
4243 p_ann_mx_elcn_val := null;
4244 p_cmcd_val := null;
4245 p_cmcd_mn_elcn_val := null;
4246 p_cmcd_mx_elcn_val := null;
4247 p_cmcd_acty_ref_perd_cd := null;
4248 p_incrmt_elcn_val := null;
4249 p_dflt_val := null;
4250 p_tx_typ_cd := null;
4251 p_acty_typ_cd := null;
4252 p_nnmntry_uom := null;
4253 p_entr_val_at_enrt_flag := null;
4254 p_dsply_on_enrt_flag := null;
4255 p_use_to_calc_net_flx_cr_flag := null;
4256 p_rt_usg_cd := null;
4257 p_bnft_prvdr_pool_id := null;
4258 p_actl_prem_id := null;
4259 p_cvg_calc_amt_mthd_id := null;
4260 p_bnft_rt_typ_cd := null;
4261 p_rt_typ_cd := null;
4262 p_rt_mlt_cd := null;
4263 p_comp_lvl_fctr_id := null;
4264 p_entr_ann_val_flag := null;
4265 p_ptd_comp_lvl_fctr_id := null;
4266 p_clm_comp_lvl_fctr_id := null;
4267 p_ann_dflt_val := null;
4268 p_rt_strt_dt := null;
4269 p_rt_strt_dt_cd := null;
4270 p_rt_strt_dt_rl := null;
4271 p_prtt_rt_val_id := null;
4272 p_dsply_mn_elcn_val := null;
4273 p_dsply_mx_elcn_val := null;
4274 p_pp_in_yr_used_num := null;
4275 p_ordr_num := null;
4276
4277 raise;
4278
4279 end main;
4280
4281 --------------------------------------------------------------------------------
4282 -- Main_w
4286 ,p_elig_per_elctbl_chc_id IN number
4283 --------------------------------------------------------------------------------
4284 PROCEDURE main_w
4285 (p_person_id IN number
4287 ,p_enrt_bnft_id IN number default null
4288 ,p_acty_base_rt_id IN number
4289 ,p_effective_date IN date
4290 ,p_lf_evt_ocrd_dt IN date default null
4291 ,p_calc_only_rt_val_flag in varchar2 default 'N'
4292 ,p_pl_id in number default null
4293 ,p_oipl_id in number default null
4294 ,p_pgm_id in number default null
4295 ,p_pl_typ_id in number default null
4296 ,p_per_in_ler_id in number default null
4297 ,p_ler_id in number default null
4298 ,p_bnft_amt in number default null
4299 ,p_business_group_id in number default null
4300 ,p_val OUT NOCOPY number
4301 ,p_ann_val OUT NOCOPY number
4302 ,p_cmcd_val OUT NOCOPY number) is
4303
4304 l_package varchar2(80) := g_package||'.main_w';
4305
4306 l_calc_only_rt_val_flag boolean := false;
4307 l_dummy_char varchar2(200);
4308 l_dummy_num number;
4309 l_dummy_date date;
4310 l_element_type_id number;
4311 l_effective_date date := nvl(p_lf_evt_ocrd_dt,p_effective_date);
4312 cursor c_enrt_rt is
4313 select ecr.rt_mlt_cd,
4314 ecr.enrt_rt_id,
4315 ecr.cmcd_acty_ref_perd_cd,
4316 enb.elig_per_elctbl_chc_id,
4317 ecr.acty_base_rt_id,
4318 ecr.business_group_id
4319 from ben_enrt_rt ecr,
4320 ben_enrt_bnft enb
4321 where enb.enrt_bnft_id = p_enrt_bnft_id
4322 and ecr.enrt_bnft_id = enb.enrt_bnft_id
4323 and ecr.acty_base_rt_id = p_acty_base_rt_id; --Bug 4143012 get the correct rate
4324 --
4325 cursor c_acty_base_rt is
4326 select element_type_id,rate_periodization_rl
4327 from ben_acty_base_rt_f abr
4328 where abr.acty_base_rt_id = p_acty_base_rt_id
4329 and l_effective_date between abr.effective_start_date
4330 and abr.effective_end_date;
4331 --
4332 cursor c_rt_strt_dt(p_enrt_rt_id NUMBER) is
4333 select enr.rt_strt_dt
4334 from ben_enrt_rt enr
4335 where enrt_rt_id = p_enrt_rt_id;
4336 l_rt_strt_dt date;
4337 --
4338
4339 l_enrt_rt c_enrt_rt%rowtype;
4340 l_global_asg_rec ben_global_enrt.g_global_asg_rec_type;
4341 --GEVITY
4342 l_assignment_id NUMBER;
4343 l_payroll_id NUMBER;
4344 l_organization_id NUMBER;
4345 l_rate_periodization_rl NUMBER;
4346 l_dfnd_dummy number;
4347 l_ann_dummy number;
4348 l_cmcd_dummy number;
4349 --END GEVITY
4350 l_trace_param varchar2(30);
4351 l_trace_on boolean;
4352 --
4353 begin
4354 l_trace_param := null;
4355 l_trace_on := false;
4356 --
4357 l_trace_param := fnd_profile.value('BEN_SS_TRACE_VALUE');
4358 --
4359 if l_trace_param = 'BENACTBR' then
4360 l_trace_on := true;
4361 else
4362 l_trace_on := false;
4363 end if;
4364 --
4365 if l_trace_on then
4366 hr_utility.trace_on(null,'BENACTBR');
4367 end if;
4368 --
4369 hr_utility.set_location('l_trace_param : '|| l_trace_param, 5);
4370 hr_utility.set_location ('Entering '||l_package,10);
4371 --
4372 ben_env_object.init(p_business_group_id => p_business_group_id,
4373 p_effective_date => p_effective_date,
4374 p_thread_id => 1,
4375 p_chunk_size => 1,
4376 p_threads => 1,
4377 p_max_errors => 1,
4378 p_benefit_action_id => null);
4379
4380 if p_calc_only_rt_val_flag = 'Y' then
4381 l_calc_only_rt_val_flag := true;
4382 end if;
4383 -- This procedure calls the date calculation routine to get the defined, annual
4384 -- and communicated rate values when a coverage value was entered in self-service.
4385
4386 ben_determine_activity_base_rt.main
4387 (p_person_id => p_person_id
4388 ,p_elig_per_elctbl_chc_id => p_elig_per_elctbl_chc_id
4389 ,p_enrt_bnft_id => p_enrt_bnft_id
4390 ,p_acty_base_rt_id => p_acty_base_rt_id
4391 ,p_effective_date => p_effective_date
4392 ,p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt
4393 ,p_perform_rounding_flg => true
4394 ,p_calc_only_rt_val_flag => l_calc_only_rt_val_flag -- to get cmcd, must be false.
4395 ,p_pl_id => p_pl_id -- when calc_only_rt_val_flag is false,
4396 ,p_oipl_id => p_oipl_id -- pl, oipl, pl_typ id's can be null.
4397 ,p_pgm_id => p_pgm_id
4398 ,p_pl_typ_id => p_pl_typ_id
4399 ,p_per_in_ler_id => p_per_in_ler_id
4400 ,p_ler_id => p_ler_id
4401 ,p_bnft_amt => p_bnft_amt
4402 ,p_business_group_id => p_business_group_id
4403 ,p_called_from_ss => true --6314463
4404 ,p_val => p_val
4405 ,p_mn_elcn_val => l_dummy_num
4406 ,p_mx_elcn_val => l_dummy_num
4407 ,p_ann_val => p_ann_val
4408 ,p_ann_mn_elcn_val => l_dummy_num
4409 ,p_ann_mx_elcn_val => l_dummy_num
4410 ,p_cmcd_val => p_cmcd_val
4411 ,p_cmcd_mn_elcn_val => l_dummy_num
4412 ,p_cmcd_mx_elcn_val => l_dummy_num
4413 ,p_cmcd_acty_ref_perd_cd => l_dummy_char
4414 ,p_incrmt_elcn_val => l_dummy_num
4415 ,p_dflt_val => l_dummy_num
4416 ,p_tx_typ_cd => l_dummy_char
4420 ,p_dsply_on_enrt_flag => l_dummy_char
4417 ,p_acty_typ_cd => l_dummy_char
4418 ,p_nnmntry_uom => l_dummy_char
4419 ,p_entr_val_at_enrt_flag => l_dummy_char
4421 ,p_use_to_calc_net_flx_cr_flag=> l_dummy_char
4422 ,p_rt_usg_cd => l_dummy_char
4423 ,p_bnft_prvdr_pool_id => l_dummy_num
4424 ,p_actl_prem_id => l_dummy_num
4425 ,p_cvg_calc_amt_mthd_id => l_dummy_num
4426 ,p_bnft_rt_typ_cd => l_dummy_char
4427 ,p_rt_typ_cd => l_dummy_char
4428 ,p_rt_mlt_cd => l_dummy_char
4429 ,p_comp_lvl_fctr_id => l_dummy_num
4430 ,p_entr_ann_val_flag => l_dummy_char
4431 ,p_ptd_comp_lvl_fctr_id => l_dummy_num
4432 ,p_clm_comp_lvl_fctr_id => l_dummy_num
4433 ,p_ann_dflt_val => l_dummy_num
4434 ,p_rt_strt_dt => l_dummy_date
4435 ,p_rt_strt_dt_cd => l_dummy_char
4436 ,p_rt_strt_dt_rl => l_dummy_num
4437 ,p_prtt_rt_val_id => l_dummy_num
4438 ,p_dsply_mn_elcn_val => l_dummy_num
4439 ,p_dsply_mx_elcn_val => l_dummy_num
4440 ,p_pp_in_yr_used_num => l_dummy_num
4441 ,p_ordr_num => l_dummy_num
4442 ,p_iss_val => l_dummy_num);
4443
4444 hr_utility.set_location ('Output Values From ben_determine_activity_base_rt.main '||l_package,900);
4445 hr_utility.set_location (' p_val: '||p_val,900);
4446 hr_utility.set_location (' p_ann_val: '||p_ann_val,900);
4447 hr_utility.set_location (' p_cmcd_val: '||p_cmcd_val,900);
4448
4449 --
4450 if p_enrt_bnft_id is not null then
4451 --
4452 open c_enrt_rt;
4453 fetch c_enrt_rt into l_enrt_rt;
4454 close c_enrt_rt;
4455 if l_enrt_rt.rt_mlt_cd = 'SAREC' then
4456 --
4457 open c_acty_base_rt;
4458 fetch c_acty_base_rt into l_element_type_id,l_rate_periodization_rl;
4459 close c_acty_base_rt;
4460 /* Replaced with ben_element_entry.get_abr_assignment call
4461 ben_global_enrt.get_asg -- assignment
4462 (p_person_id => p_person_id
4463 ,p_effective_date => l_effective_date -- Bug 2407041 p_effective_date
4464 ,p_global_asg_rec => l_global_asg_rec);
4465 */
4466 --
4467 ben_element_entry.get_abr_assignment
4468 (p_person_id => p_person_id
4469 ,p_effective_date => l_effective_date
4470 ,p_acty_base_rt_id => p_acty_base_rt_id
4471 ,p_organization_id => l_organization_id
4472 ,p_payroll_id => l_payroll_id
4473 ,p_assignment_id => l_assignment_id
4474 );
4475 --
4476 --GEVITY
4477 IF l_rate_periodization_rl IS NOT NULL THEN
4478 --
4479 ben_distribute_rates.periodize_with_rule
4480 (p_formula_id => l_rate_periodization_rl
4481 ,p_effective_date => l_effective_date
4482 ,p_assignment_id => l_assignment_id
4483 ,p_convert_from_val => p_bnft_amt
4484 ,p_convert_from => 'ANNUAL'
4485 ,p_elig_per_elctbl_chc_id => l_enrt_rt.elig_per_elctbl_chc_id
4486 ,p_acty_base_rt_id => l_enrt_rt.acty_base_rt_id
4487 ,p_business_group_id => l_enrt_rt.business_group_id
4488 ,p_enrt_rt_id => l_enrt_rt.enrt_rt_id
4489 ,p_ann_val => l_dfnd_dummy
4490 ,p_cmcd_val => p_cmcd_val
4491 ,p_val => l_dfnd_dummy
4492 );
4493 --
4494 ELSE
4495 -- 5534498
4496 open c_rt_strt_dt(l_enrt_rt.enrt_rt_id);
4497 fetch c_rt_strt_dt into l_rt_strt_dt;
4498 close c_rt_strt_dt;
4499 --
4500 p_cmcd_val := ben_distribute_rates.annual_to_period
4501 (p_amount => p_bnft_amt,
4502 p_enrt_rt_id => l_enrt_rt.enrt_rt_id,
4503 p_acty_ref_perd_cd => l_enrt_rt.cmcd_acty_ref_perd_cd,
4504 p_business_group_id => p_business_group_id,
4505 p_effective_date => p_effective_date,
4506 p_use_balance_flag => 'Y',
4507 p_payroll_id => l_payroll_id,
4508 p_element_type_id => l_element_type_id,
4509 -- 5534498
4510 p_person_id => p_person_id,
4511 p_start_date => l_rt_strt_dt
4512 );
4513 --
4514 END IF; --GEVITY
4515 --
4516 end if;
4517 --
4518 end if;
4519
4520 hr_utility.set_location ('Output Values: '||l_package,900);
4521 hr_utility.set_location (' p_val: '||p_val,900);
4522 hr_utility.set_location (' p_ann_val: '||p_ann_val,900);
4523 hr_utility.set_location (' p_cmcd_val: '||p_cmcd_val,900);
4524
4525 hr_utility.set_location ('Leaving '|| l_package,999);
4526 --
4527 if l_trace_on then
4528 hr_utility.trace_off;
4529 l_trace_param := null;
4530 l_trace_on := false;
4531 end if;
4532
4533 exception
4534 --
4535 when others then
4536 --
4537 p_val := null;
4538 p_ann_val := null;
4539 p_cmcd_val := null;
4540 fnd_msg_pub.add;
4541 if l_trace_on then
4542 hr_utility.trace_off;
4543 l_trace_on := false;
4544 l_trace_param := null;
4545 end if;
4546 end main_w;
4547 end ben_determine_activity_base_rt;