[Home] [Help]
PACKAGE BODY: APPS.BEN_LSF_BUS
Source
1 Package Body ben_lsf_bus as
2 /* $Header: belsfrhi.pkb 120.0 2005/05/28 03:37:45 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_lsf_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_los_fctr_id >------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description
15 -- This procedure is used to check that the primary key for the table
16 -- is created properly. It should be null on insert and
17 -- should not be able to be updated.
18 --
19 -- Pre Conditions
20 -- None.
21 --
22 -- In Parameters
23 -- los_fctr_id PK of record being inserted or updated.
24 -- object_version_number Object version number of record being
25 -- inserted or updated.
26 --
27 -- Post Success
28 -- Processing continues
29 --
30 -- Post Failure
31 -- Errors handled by the procedure
32 --
33 -- Access Status
34 -- Internal table handler use only.
35 --
36 Procedure chk_los_fctr_id(p_los_fctr_id in number,
37 p_object_version_number in number) is
38 --
39 l_proc varchar2(72) := g_package||'chk_los_fctr_id';
40 l_api_updating boolean;
41 --
42 Begin
43 --
44 hr_utility.set_location('Entering:'||l_proc, 5);
45 --
46 l_api_updating := ben_lsf_shd.api_updating
47 (p_los_fctr_id => p_los_fctr_id,
48 p_object_version_number => p_object_version_number);
49 --
50 if (l_api_updating
51 and nvl(p_los_fctr_id,hr_api.g_number)
52 <> ben_lsf_shd.g_old_rec.los_fctr_id) then
53 --
54 -- raise error as PK has changed
55 --
56 ben_lsf_shd.constraint_error('BEN_LOS_FCTR_PK');
57 --
58 elsif not l_api_updating then
59 --
60 -- check if PK is null
61 --
62 if p_los_fctr_id is not null then
63 --
64 -- raise error as PK is not null
65 --
66 ben_lsf_shd.constraint_error('BEN_LOS_FCTR_PK');
67 --
68 end if;
69 --
70 end if;
71 --
72 hr_utility.set_location('Leaving:'||l_proc, 10);
73 --
74 End chk_los_fctr_id;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |------< chk_oab_fast_formula_id >------|
78 -- ----------------------------------------------------------------------------
79 --
80 -- Description
81 -- This procedure checks that a referenced foreign key actually exists
82 -- in the referenced table.
83 --
84 -- Pre-Conditions
85 -- None.
86 --
87 -- In Parameters
88 -- p_los_fctr_id PK
89 -- p_oab_fast_formula_id ID of FK column
90 -- p_effective_date Session Date of record
91 -- p_object_version_number object version number
92 --
93 -- Post Success
94 -- Processing continues
95 --
96 -- Post Failure
97 -- Error raised.
98 --
99 -- Access Status
100 -- Internal table handler use only.
101 --
102 /* Procedure chk_oab_fast_formula_id (p_los_fctr_id in number,
103 p_oab_fast_formula_id in number,
104 p_effective_date in date,
105 p_object_version_number in number) is
106 --
107 l_proc varchar2(72) := g_package||'chk_oab_fast_formula_id';
108 l_api_updating boolean;
109 l_dummy varchar2(1);
110 --
111 cursor c1 is
112 select null
113 from ben_oab_fast_formula_f a
114 where a.OAB_FAST_FORMULA_ID = p_oab_fast_formula_id -- 88888
115 and p_effective_date
116 between a.effective_start_date
117 and a.effective_end_date;
118 --
119 Begin
120 --
121 hr_utility.set_location('Entering:'||l_proc,5);
122 --
123 l_api_updating := ben_lsf_shd.api_updating
124 (p_los_fctr_id => p_los_fctr_id,
125 p_object_version_number => p_object_version_number);
126 --
127 if (l_api_updating
128 and nvl(p_oab_fast_formula_id,hr_api.g_number)
129 <> nvl(ben_lsf_shd.g_old_rec.oab_fast_formula_id,hr_api.g_number)
130 or not l_api_updating) then
131 --
132 -- check if oab_fast_formula_id value exists in ben_oab_fast_formula_f table
133 --
134 open c1;
135 --
136 fetch c1 into l_dummy;
137 if c1%notfound then
138 --
139 close c1;
140 --
141 -- raise error as FK does not relate to PK in ben_oab_fast_formula_f
142 -- table.
143 --
144 ben_lsf_shd.constraint_error('{ForeignKeyConstraint}');
145 --
146 end if;
147 --
148 close c1;
149 --
150 end if;
151 --
152 hr_utility.set_location('Leaving:'||l_proc,10);
153 --
154 End chk_oab_fast_formula_id;
155 --
156 */
157 -- ----------------------------------------------------------------------------
158 -- |------< chk_los_uom >------|
159 -- ----------------------------------------------------------------------------
160 --
161 -- Description
162 -- This procedure is used to check that the lookup value is valid.
163 --
164 -- Pre Conditions
165 -- None.
166 --
167 -- In Parameters
168 -- los_fctr_id PK of record being inserted or updated.
169 -- los_uom Value of lookup code.
170 -- effective_date effective date
171 -- object_version_number Object version number of record being
172 -- inserted or updated.
173 --
174 -- Post Success
175 -- Processing continues
176 --
177 -- Post Failure
178 -- Error handled by procedure
179 --
180 -- Access Status
181 -- Internal table handler use only.
182 --
183 Procedure chk_los_uom(p_los_fctr_id in number,
184 p_los_uom in varchar2,
185 p_effective_date in date,
186 p_object_version_number in number) is
187 --
188 l_proc varchar2(72) := g_package||'chk_los_uom';
189 l_api_updating boolean;
190 --
191 Begin
192 --
193 hr_utility.set_location('Entering:'||l_proc, 5);
194 --
195 l_api_updating := ben_lsf_shd.api_updating
196 (p_los_fctr_id => p_los_fctr_id,
197 p_object_version_number => p_object_version_number);
198 --
199 if (l_api_updating
200 and p_los_uom
201 <> nvl(ben_lsf_shd.g_old_rec.los_uom,hr_api.g_varchar2)
202 or not l_api_updating)
203 and p_los_uom is not null then
204 --
205 -- check if value of lookup falls within lookup type.
206 --
207 if hr_api.not_exists_in_hr_lookups
208 (p_lookup_type => 'BEN_TM_UOM',
209 p_lookup_code => p_los_uom,
210 p_effective_date => p_effective_date) then
211 --
212 -- raise error as does not exist as lookup
213 --
214 fnd_message.set_name('BEN','BEN_91048_INVALID_UOM');
215 fnd_message.raise_error;
216 --
217 end if;
218 --
219 end if;
220 --
221 hr_utility.set_location('Leaving:'||l_proc,10);
222 --
223 end chk_los_uom;
224 --
225 ------------------------------------------------------------------------
226 -- |----------------< chk_los_calc_rl >-----------------------------|
227 ------------------------------------------------------------------------
228 ----
229 --
230 -- Description
231 -- This procedure is used to check that the Formula Rule is valid.
232 --
233 -- Pre Conditions
234 -- None.
235 --
236 -- In Parameters
237 -- los_fctr_id PK of record being inserted or updated.
238 -- los_calc_rl Value of formula rule id.
239 -- effective_date effective date
240 -- object_version_number Object version number of record being
241 -- inserted or updated.
242 --
243 -- Post Success
244 -- Processing continues
245 --
246 -- Post Failure
247 -- Error handled by procedure
248 --
249 -- Access Status
250 -- Internal table handler use only.
251 --
252 Procedure chk_los_calc_rl(p_los_fctr_id in number,
253 p_business_group_id in number,
254 p_los_calc_rl in number,
255 p_effective_date in date,
256 p_object_version_number in number) is
257 --
258 l_proc varchar2(72):= g_package||'chk_los_calc_rl';
259 l_api_updating boolean;
260 l_dummy varchar2(1);
261 --
262 cursor c1 is
263 select null
264 from ff_formulas_f ff
265 ,per_business_groups pbg
266 where ff.formula_id = p_los_calc_rl
267 and ff.formula_type_id = -510
268 and pbg.business_group_id = p_business_group_id
269 and nvl(ff.business_group_id, p_business_group_id) =
270 p_business_group_id
271 and nvl(ff.legislation_code, pbg.legislation_code) =
272 pbg.legislation_code
273 and p_effective_date
274 between ff.effective_start_date
275 and ff.effective_end_date;
276 --
277 Begin
278 --
279 hr_utility.set_location('Entering:'||l_proc, 5);
280 --
281 l_api_updating :=ben_lsf_shd.api_updating
282 (p_los_fctr_id => p_los_fctr_id,
283 --p_effective_date => p_effective_date,
284 p_object_version_number => p_object_version_number);
285 --
286 if (l_api_updating
287 and nvl(p_los_calc_rl,hr_api.g_number)
288 <>BEN_LSF_SHD.g_old_rec.los_calc_rl
289 or not l_api_updating)
290 and p_los_calc_rl is not null then
291 --
292 -- check if value of formula rule is valid.
293 --
294 open c1;
295 --
296 -- fetch value from cursor if it returns a record then the
297 --
298 -- formula is valid otherwise its invalid
299 --
300 fetch c1 into l_dummy;
301 if c1%notfound then
302 --
303 close c1;
304 --
305 -- raise error
306 --
307 fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
308 fnd_message.set_token('ID',p_los_calc_rl);
309 fnd_message.set_token('TYPE_ID',-510);
310 fnd_message.raise_error;
311 --
312 end if;
313 --
314 close c1;
315 --
316 end if;
317 --
318 hr_utility.set_location('Leaving:'||l_proc,10);
319 --
320 end chk_los_calc_rl;
321 --
322 -- ----------------------------------------------------------------------------
323 -- |------< chk_los_alt_val_to_use_cd >------|
324 -- ----------------------------------------------------------------------------
325 --
326 -- Description
327 -- This procedure is used to check that the lookup value is valid.
328 --
329 -- Pre Conditions
330 -- None.
331 --
332 -- In Parameters
333 -- los_fctr_id PK of record being inserted or updated.
334 -- los_alt_val_to_use_cd Value of lookup code.
335 -- effective_date effective date
336 -- object_version_number Object version number of record being
337 -- inserted or updated.
338 --
339 -- Post Success
340 -- Processing continues
341 --
342 -- Post Failure
343 -- Error handled by procedure
344 --
345 -- Access Status
346 -- Internal table handler use only.
347 --
348 Procedure chk_los_alt_val_to_use_cd(p_los_fctr_id in number,
349 p_los_alt_val_to_use_cd in varchar2,
350 p_effective_date in date,
351 p_object_version_number in number) is
352 --
353 l_proc varchar2(72) := g_package||'chk_los_alt_val_to_use_cd';
354 l_api_updating boolean;
355 --
356 Begin
357 --
358 hr_utility.set_location('Entering:'||l_proc, 5);
359 --
360 l_api_updating := ben_lsf_shd.api_updating
361 (p_los_fctr_id => p_los_fctr_id,
362 p_object_version_number => p_object_version_number);
363 --
364 if (l_api_updating
365 and p_los_alt_val_to_use_cd
366 <> nvl(ben_lsf_shd.g_old_rec.los_alt_val_to_use_cd,hr_api.g_varchar2)
367 or not l_api_updating)
368 and p_los_alt_val_to_use_cd is not null then
369 --
370 -- check if value of lookup falls within lookup type.
371 --
372 if hr_api.not_exists_in_hr_lookups
373 (p_lookup_type => 'BEN_LOS_ALT_VAL_TO_USE',
374 p_lookup_code => p_los_alt_val_to_use_cd,
375 p_effective_date => p_effective_date) then
376 --
377 -- raise error as does not exist as lookup
378 --
379 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
380 fnd_message.set_token('FIELD', 'p_los_alt_val_to_use_cd');
381 fnd_message.set_token('TYPE', 'BEN_LOS_ALT_VAL_TO_USE');
382 fnd_message.raise_error;
383 --
384 end if;
385 --
386 end if;
387 --
388 hr_utility.set_location('Leaving:'||l_proc,10);
389 --
390 end chk_los_alt_val_to_use_cd;
391 --
392 -- ----------------------------------------------------------------------------
393 -- |------< chk_los_dt_to_use_cd >------|
394 -- ----------------------------------------------------------------------------
395 --
396 -- Description
397 -- This procedure is used to check that the lookup value is valid.
398 --
399 -- Pre Conditions
400 -- None.
401 --
402 -- In Parameters
403 -- los_fctr_id PK of record being inserted or updated.
404 -- los_dt_to_use_cd Value of lookup code.
405 -- effective_date effective date
406 -- object_version_number Object version number of record being
407 -- inserted or updated.
408 --
409 -- Post Success
413 -- Error handled by procedure
410 -- Processing continues
411 --
412 -- Post Failure
414 --
415 -- Access Status
416 -- Internal table handler use only.
417 --
418 Procedure chk_los_dt_to_use_cd(p_los_fctr_id in number,
419 p_los_dt_to_use_cd in varchar2,
420 p_effective_date in date,
421 p_object_version_number in number) is
422 --
423 l_proc varchar2(72) := g_package||'chk_los_dt_to_use_cd';
424 l_api_updating boolean;
425 --
426 Begin
427 --
428 hr_utility.set_location('Entering:'||l_proc, 5);
429 --
430 l_api_updating := ben_lsf_shd.api_updating
431 (p_los_fctr_id => p_los_fctr_id,
432 p_object_version_number => p_object_version_number);
433 --
434 if (l_api_updating
435 and p_los_dt_to_use_cd
436 <> nvl(ben_lsf_shd.g_old_rec.los_dt_to_use_cd,hr_api.g_varchar2)
437 or not l_api_updating)
438 and p_los_dt_to_use_cd is not null then
439 --
440 -- check if value of lookup falls within lookup type.
441 --
442 if hr_api.not_exists_in_hr_lookups
443 (p_lookup_type => 'BEN_LOS_DT_TO_USE',
444 p_lookup_code => p_los_dt_to_use_cd,
445 p_effective_date => p_effective_date) then
446 --
447 -- raise error as does not exist as lookup
448 --
449 fnd_message.set_name('BEN','BEN_91063_INVLD_LOS_DT_USE_CD');
450 fnd_message.raise_error;
451 --
452 end if;
453 --
454 end if;
455 --
456 hr_utility.set_location('Leaving:'||l_proc,10);
457 --
458 end chk_los_dt_to_use_cd;
459 --
460 -- ----------------------------------------------------------------------------
461 -- |------< chk_rndg_cd >------|
462 -- ----------------------------------------------------------------------------
463 --
464 -- Description
465 -- This procedure is used to check that the lookup value is valid.
466 --
467 -- Pre Conditions
468 -- None.
469 --
470 -- In Parameters
471 -- los_fctr_id PK of record being inserted or updated.
472 -- rndg_cd Value of lookup code.
473 -- effective_date effective date
474 -- object_version_number Object version number of record being
475 -- inserted or updated.
476 --
477 -- Post Success
478 -- Processing continues
479 --
480 -- Post Failure
481 -- Error handled by procedure
482 --
483 -- Access Status
484 -- Internal table handler use only.
485 --
486 Procedure chk_rndg_cd(p_los_fctr_id in number,
487 p_rndg_cd in varchar2,
488 p_effective_date in date,
489 p_object_version_number in number) is
490 --
491 l_proc varchar2(72) := g_package||'chk_rndg_cd';
492 l_api_updating boolean;
493 --
494 Begin
495 --
496 hr_utility.set_location('Entering:'||l_proc, 5);
497 --
498 l_api_updating := ben_lsf_shd.api_updating
499 (p_los_fctr_id => p_los_fctr_id,
500 p_object_version_number => p_object_version_number);
501 --
502 if (l_api_updating
503 and p_rndg_cd
504 <> nvl(ben_lsf_shd.g_old_rec.rndg_cd,hr_api.g_varchar2)
505 or not l_api_updating)
506 and p_rndg_cd is not null then
507 --
508 -- check if value of lookup falls within lookup type.
509 --
510 if hr_api.not_exists_in_hr_lookups
511 (p_lookup_type => 'BEN_RNDG',
512 p_lookup_code => p_rndg_cd,
513 p_effective_date => p_effective_date) then
514 --
515 -- raise error as does not exist as lookup
516 --
517 fnd_message.set_name('BEN','BEN_91041_INVALID_RNDG_CD');
518 fnd_message.raise_error;
519 --
520 end if;
521 --
522 end if;
523 --
524 hr_utility.set_location('Leaving:'||l_proc,10);
525 --
526 end chk_rndg_cd;
527 --
528 -- ----------------------------------------------------------------------------
529 -- |------< chk_los_det_cd >------|
530 -- ----------------------------------------------------------------------------
531 --
532 -- Description
533 -- This procedure is used to check that the lookup value is valid.
534 --
535 -- Pre Conditions
536 -- None.
537 --
538 -- In Parameters
539 -- los_fctr_id PK of record being inserted or updated.
540 -- los_det_cd Value of lookup code.
541 -- effective_date effective date
542 -- object_version_number Object version number of record being
543 -- inserted or updated.
544 --
545 -- Post Success
546 -- Processing continues
547 --
548 -- Post Failure
549 -- Error handled by procedure
550 --
551 -- Access Status
552 -- Internal table handler use only.
553 --
554 Procedure chk_los_det_cd(p_los_fctr_id in number,
555 p_los_det_cd in varchar2,
556 p_effective_date in date,
560 l_api_updating boolean;
557 p_object_version_number in number) is
558 --
559 l_proc varchar2(72) := g_package||'chk_los_det_cd';
561 --
562 Begin
563 --
564 hr_utility.set_location('Entering:'||l_proc, 5);
565 --
566 l_api_updating := ben_lsf_shd.api_updating
567 (p_los_fctr_id => p_los_fctr_id,
568 p_object_version_number => p_object_version_number);
569 --
570 if (l_api_updating
571 and p_los_det_cd
572 <> nvl(ben_lsf_shd.g_old_rec.los_det_cd,hr_api.g_varchar2)
573 or not l_api_updating)
574 and p_los_det_cd is not null then
575 --
576 -- check if value of lookup falls within lookup type.
577 --
578 if hr_api.not_exists_in_hr_lookups
579 (p_lookup_type => 'BEN_LOS_DET',
580 p_lookup_code => p_los_det_cd,
581 p_effective_date => p_effective_date) then
582 --
583 -- raise error as does not exist as lookup
584 --
585 fnd_message.set_name('BEN','BEN_91065_INVLD_LOS_DET_CD');
586 fnd_message.raise_error;
587 --
588 end if;
589 --
590 end if;
591 --
592 hr_utility.set_location('Leaving:'||l_proc,10);
593 --
594 end chk_los_det_cd;
595 --
596 Procedure chk_no_mn_los_num_apls_flag(p_los_fctr_id in number,
597 p_no_mn_los_num_apls_flag in varchar2,
598 p_effective_date in date,
599 p_object_version_number in number) is
600 --
601 --
602 l_proc varchar2(72) := g_package||'chk_no_mn_los_num_apls_flag';
603 l_api_updating boolean;
604 --
605 Begin
606 --
607 hr_utility.set_location('Entering:'||l_proc, 5);
608 --
609 l_api_updating := ben_lsf_shd.api_updating
610 (p_los_fctr_id => p_los_fctr_id,
611 -- p_effective_date => p_effective_date,
612 p_object_version_number => p_object_version_number);
613 --
614 if (l_api_updating
615 and p_no_mn_los_num_apls_flag
616 <> nvl(ben_lsf_shd.g_old_rec.no_mn_los_num_apls_flag,hr_api.g_varchar2)
617 or not l_api_updating)
618 and p_no_mn_los_num_apls_flag is not null then
619 --
620 -- check if value of lookup falls within lookup type.
621 --
622 if hr_api.not_exists_in_hr_lookups
623 (p_lookup_type => 'YES_NO',
624 p_lookup_code => p_no_mn_los_num_apls_flag,
625 p_effective_date => p_effective_date) then
626 --
627 -- raise error as does not exist as lookup
628 --
629 fnd_message.set_name('BEN','BEN_91051_INVALID_MIN_FLAG');
630 fnd_message.raise_error;
631 --
632 end if;
633 --
634 end if;
635 --
636 hr_utility.set_location('Leaving:'||l_proc,10);
637 --
638 end chk_no_mn_los_num_apls_flag;
639
640
641 Procedure chk_no_mx_los_num_apls_flag(p_los_fctr_id in number,
642 p_no_mx_los_num_apls_flag in varchar2,
643 p_effective_date in date,
644 p_object_version_number in number) is
645 --
646 --
647 l_proc varchar2(72) := g_package||'chk_no_mx_los_num_apls_flag';
648 l_api_updating boolean;
649 --
650 Begin
651 --
652 hr_utility.set_location('Entering:'||l_proc, 5);
653 --
654 l_api_updating := ben_lsf_shd.api_updating
655 (p_los_fctr_id => p_los_fctr_id,
656 -- p_effective_date => p_effective_date,
657 p_object_version_number => p_object_version_number);
658 --
659 if (l_api_updating
660 and p_no_mx_los_num_apls_flag
661 <> nvl(ben_lsf_shd.g_old_rec.no_mx_los_num_apls_flag,hr_api.g_varchar2)
662 or not l_api_updating)
663 and p_no_mx_los_num_apls_flag is not null then
664 --
665 -- check if value of lookup falls within lookup type.
666 --
667 if hr_api.not_exists_in_hr_lookups
668 (p_lookup_type => 'YES_NO',
669 p_lookup_code => p_no_mx_los_num_apls_flag,
670 p_effective_date => p_effective_date) then
671 --
672 -- raise error as does not exist as lookup
673 --
674 fnd_message.set_name('BEN','BEN_91052_INVALID_MAX_FLAG');
675 fnd_message.raise_error;
676 --
677 end if;
678 --
679 end if;
680 --
681 hr_utility.set_location('Leaving:'||l_proc,10);
682 --
683 end chk_no_mx_los_num_apls_flag;
684
685
686 --
687 ------------------------------------------------------------------------
688 ----
689 -- |------< chk_los_det_rl >------|
690 --
691 ------------------------------------------------------------------------
692 ----
693 --
694 -- Description
695 -- This procedure is used to check that the Formula Rule is valid.
696 --
697 -- Pre Conditions
698 -- None.
699 --
700 -- In Parameters
701 -- los_fctr_id PK of record being inserted or updated.
705 -- inserted or updated.
702 -- los_det_rl Value of formula rule id.
703 -- effective_date effective date
704 -- object_version_number Object version number of record being
706 --
707 -- Post Success
708 -- Processing continues
709 --
710 -- Post Failure
711 -- Error handled by procedure
712 --
713 -- Access Status
714 -- Internal table handler use only.
715 --
716 Procedure chk_los_det_rl(p_los_fctr_id in number,
717 p_business_group_id in number,
718 p_los_det_rl in number,
719 p_los_det_cd in varchar2,
720 p_effective_date in date,
721 p_object_version_number in number) is
722 --
723 l_proc varchar2(72):= g_package||'chk_los_det_rl';
724 l_api_updating boolean;
725 l_dummy varchar2(1);
726 --
727 cursor c1 is
728 select null
729 from ff_formulas_f ff
730 ,per_business_groups pbg
731 where ff.formula_id = p_los_det_rl
732 and ff.formula_type_id = -170
733 and pbg.business_group_id = p_business_group_id
734 and nvl(ff.business_group_id, p_business_group_id) =
735 p_business_group_id
736 and nvl(ff.legislation_code, pbg.legislation_code) =
737 pbg.legislation_code
738 and p_effective_date
739 between ff.effective_start_date
740 and ff.effective_end_date;
741 --
742 Begin
743 --
744 hr_utility.set_location('Entering:'||l_proc, 5);
745 --
746 l_api_updating :=ben_lsf_shd.api_updating
747 (p_los_fctr_id => p_los_fctr_id,
748 -- p_effective_date => p_effective_date,
749 p_object_version_number => p_object_version_number);
750 --
751 if (l_api_updating
752 and nvl(p_los_det_rl,hr_api.g_number)
753 <>BEN_LSF_SHD.g_old_rec.los_det_rl
754 or not l_api_updating)
755 and p_los_det_rl is not null then
756 --
757 -- check if value of formula rule is valid.
758 --
759 open c1;
760 --
761 -- fetch value from cursor if it returns a record then the
762
763 -- formula is valid otherwise its invalid
764 --
765 fetch c1 into l_dummy;
766 if c1%notfound then
767 --
768 close c1;
769 --
770 -- raise error
771 --
772 fnd_message.set_name('BEN','BEN_91066_INVLD_LOS_DET_RL');
773 fnd_message.raise_error;
774 --
775 end if;
776 --
777 close c1;
778 --
779 end if;
780 --
781 -- Bug No 4242978 Moved out the following if conditions outside the outer if
782 -- as they have to called from insert_validate also
783 --
784 -- Unless LOS determination Code = Rule, LOS determination rule must be blank.
785 if nvl(p_los_det_cd,hr_api.g_varchar2) <> 'RL' and p_los_det_rl is not null then
786 --
787 fnd_message.set_name('BEN', 'BEN_91071_LOS_DET_RL_NOT_NULL');
788 fnd_message.raise_error;
789 --
790 elsif nvl(p_los_det_cd,hr_api.g_varchar2) = 'RL' and p_los_det_rl is null then
791 --
792 fnd_message.set_name('BEN', 'BEN_91098_LOS_DET_RL_NULL');
793 fnd_message.raise_error;
794 --
795 end if;
796 --
797 hr_utility.set_location('Leaving:'||l_proc,10);
798 --
799 end chk_los_det_rl;
800
801
802 --
803 ------------------------------------------------------------------------
804 ----
805 -- |------< chk_rndg_rl >------|
806 --
807 ------------------------------------------------------------------------
808 ----
809 --
810 -- Description
811 -- This procedure is used to check that the Formula Rule is valid.
812 --
813 -- Pre Conditions
814 -- None.
815 --
816 -- In Parameters
817 -- los_fctr_id PK of record being inserted or updated.
818 -- rndg_rl Value of formula rule id.
819 -- effective_date effective date
820 -- object_version_number Object version number of record being
821 -- inserted or updated.
822 --
823 -- Post Success
824 -- Processing continues
825 --
826 -- Post Failure
827 -- Error handled by procedure
828 --
829 -- Access Status
830 -- Internal table handler use only.
831 --
832 Procedure chk_rndg_rl(p_los_fctr_id in number,
833 p_business_group_id in number,
834 p_rndg_rl in number,
835 p_rndg_cd in varchar2,
836 p_effective_date in date,
837 p_object_version_number in number) is
838 --
839 l_proc varchar2(72):= g_package||'chk_rndg_rl';
840 l_api_updating boolean;
841 l_dummy varchar2(1);
842 --
843 cursor c1 is
844 select null
845 from ff_formulas_f ff
846 ,per_business_groups pbg
847 where ff.formula_id = p_rndg_rl
851 p_business_group_id
848 and ff.formula_type_id = -169
849 and pbg.business_group_id = p_business_group_id
850 and nvl(ff.business_group_id, p_business_group_id) =
852 and nvl(ff.legislation_code, pbg.legislation_code) =
853 pbg.legislation_code
854 and p_effective_date
855 between ff.effective_start_date
856 and ff.effective_end_date;
857 --
858 Begin
859 --
860 hr_utility.set_location('Entering:'||l_proc, 5);
861 --
862 l_api_updating :=ben_lsf_shd.api_updating -- 888888
863 (p_los_fctr_id => p_los_fctr_id,
864 -- p_effective_date => p_effective_date,
865 p_object_version_number => p_object_version_number);
866 --
867 if (l_api_updating
868 and nvl(p_rndg_rl,hr_api.g_number)
869 <>BEN_LSF_SHD.g_old_rec.rndg_rl
870 or not l_api_updating)
871 and p_rndg_rl is not null then
872 --
873 -- check if value of formula rule is valid.
874 --
875 open c1;
876 --
877 -- fetch value from cursor if it returns a record then the
878
879 -- formula is valid otherwise its invalid
880 --
881 fetch c1 into l_dummy;
882 if c1%notfound then
883 --
884 close c1;
885 --
886 -- raise error
887 --
888 fnd_message.set_name('BEN','BEN_91042_INVALID_RNDG_RL');
889 fnd_message.raise_error;
890 --
891 end if;
892 --
893 close c1;
894 --
895 end if;
896 --
897 -- Unless Rounding Code = Rule, Rounding rule must be blank.
898 if nvl(p_rndg_cd,hr_api.g_varchar2) <> 'RL' and p_rndg_rl is not null then
899 --
900 fnd_message.set_name('BEN', 'BEN_91043_RNDG_RL_NOT_NULL');
901 fnd_message.raise_error;
902 --
903 elsif nvl(p_rndg_cd,hr_api.g_varchar2) = 'RL' and p_rndg_rl is null then
904 --
905 fnd_message.set_name('BEN', 'BEN_92340_RNDG_RL_NULL');
906 fnd_message.raise_error;
907 --
908 end if;
909 --
910 --
911 hr_utility.set_location('Leaving:'||l_proc,10);
912 --
913 end chk_rndg_rl;
914
915
916 --
917 ------------------------------------------------------------------------
918 ----
919 -- |------< chk_los_dt_to_use_rl >------|
920 --
921 ------------------------------------------------------------------------
922 ----
923 --
924 -- Description
925 -- This procedure is used to check that the Formula Rule is valid.
926 --
927 -- Pre Conditions
928 -- None.
929 --
930 -- In Parameters
931 -- los_fctr_id PK of record being inserted or updated.
932 -- los_dt_to_use_rl Value of formula rule id.
933 -- effective_date effective date
934 -- object_version_number Object version number of record being
935 -- inserted or updated.
936 --
937 -- Post Success
938 -- Processing continues
939 --
940 -- Post Failure
941 -- Error handled by procedure
942 --
943 -- Access Status
944 -- Internal table handler use only.
945 --
946 Procedure chk_los_dt_to_use_rl(p_los_fctr_id in number,
947 p_business_group_id in number,
948 p_los_dt_to_use_rl in number,
949 p_los_dt_to_use_cd in varchar2,
950 p_effective_date in date,
951 p_object_version_number in number) is
952 --
953 l_proc varchar2(72):= g_package||'chk_los_dt_to_use_rl';
954 l_api_updating boolean;
955 l_dummy varchar2(1);
956 --
957 cursor c1 is
958 select null
959 from ff_formulas_f ff
960 ,per_business_groups pbg
961 where ff.formula_id = p_los_dt_to_use_rl
962 and ff.formula_type_id = -156
963 and pbg.business_group_id = p_business_group_id
964 and nvl(ff.business_group_id, p_business_group_id) =
965 p_business_group_id
966 and nvl(ff.legislation_code, pbg.legislation_code) =
967 pbg.legislation_code
968 and p_effective_date
969 between ff.effective_start_date
970 and ff.effective_end_date;
971 --
972 Begin
973 --
974 hr_utility.set_location('Entering:'||l_proc, 5);
975 --
976 l_api_updating :=ben_lsf_shd.api_updating -- 88888
977 (p_los_fctr_id => p_los_fctr_id,
978 -- p_effective_date => p_effective_date,
979 p_object_version_number => p_object_version_number);
980 --
981 if (l_api_updating
982 and nvl(p_los_dt_to_use_rl,hr_api.g_number)
983 <>BEN_LSF_SHD.g_old_rec.los_dt_to_use_rl
984 or not l_api_updating)
985 and p_los_dt_to_use_rl is not null then
986 --
987 -- check if value of formula rule is valid.
988 --
989 open c1;
990 --
991 -- fetch value from cursor if it returns a record then the
992
993 -- formula is valid otherwise its invalid
994 --
998 close c1;
995 fetch c1 into l_dummy;
996 if c1%notfound then
997 --
999 --
1000 -- raise error
1001 --
1002 fnd_message.set_name('BEN','BEN_91064_INVLD_LOS_DT_USE_RL');
1003 fnd_message.raise_error;
1004 --
1005 end if;
1006 --
1007 close c1;
1008 --
1009 end if;
1010 --
1011 --
1012 -- Unless los_dt_to_use Code = Rule, los_dt_to_use rule must be blank.
1013 if nvl(p_los_dt_to_use_cd,hr_api.g_varchar2) <> 'RL' and p_los_dt_to_use_rl is not null then
1014 --
1015 fnd_message.set_name('BEN', 'BEN_91072_LOS_DT_RL_NOT_NULL');
1016 fnd_message.raise_error;
1017 --
1018 elsif nvl(p_los_dt_to_use_cd,hr_api.g_varchar2) = 'RL' and p_los_dt_to_use_rl is null then
1019 --
1020 fnd_message.set_name('BEN', 'BEN_91099_LOS_DT_RL_NULL');
1021 fnd_message.raise_error;
1022 --
1023 end if;
1024 --
1025 hr_utility.set_location('Leaving:'||l_proc,10);
1026 --
1027 end chk_los_dt_to_use_rl;
1028
1029 ------------------------------------------------------------------------
1030 ----
1031 -- |------< chk_name >------|
1032 --
1033 ------------------------------------------------------------------------
1034 ----
1035 --
1036 -- Description
1037 -- This procedure is used to check that the Name is unique in a business group.
1038 --
1039 -- Pre Conditions
1040 -- None.
1041 --
1042 -- In Parameters
1043 -- los_fctr_id PK of record being inserted or updated.
1044 -- name Value of Name.
1045 -- effective_date effective date
1046 -- object_version_number Object version number of record being
1047 -- inserted or updated.
1048 --
1049 -- Post Success
1050 -- Processing continues
1051 --
1052 -- Post Failure
1053 -- Error handled by procedure
1054 --
1055 -- Access Status
1056 -- Internal table handler use only.
1057 --
1058 Procedure chk_name(p_los_fctr_id in number,
1059 p_business_group_id in number,
1060 p_name in varchar2,
1061 p_effective_date in date,
1062 p_object_version_number in number) is
1063 --
1064 l_proc varchar2(72):= g_package||'chk_name';
1065 l_api_updating boolean;
1066 l_dummy varchar2(1);
1067 --
1068 cursor c1 is
1069 select null
1070 from ben_los_fctr lsf
1071 where lsf.business_group_id = p_business_group_id and
1072 lsf.name = p_name;
1073 Begin
1074 --
1075 hr_utility.set_location('Entering:'||l_proc, 5);
1076 --
1077 l_api_updating := ben_lsf_shd.api_updating
1078 (p_los_fctr_id => p_los_fctr_id,
1079 -- p_effective_date => p_effective_date,
1080 p_object_version_number => p_object_version_number);
1081 --
1082 if (l_api_updating
1083 and nvl(p_name,hr_api.g_varchar2)
1084 <> ben_lsf_shd.g_old_rec.name
1085 or not l_api_updating)
1086 and p_name is not null then
1087 --
1088 -- check if name already used.
1089 --
1090 open c1;
1091 --
1092 -- fetch value from cursor if it returns a record then the
1093
1094 -- name is invalid otherwise its valid
1095 --
1096 fetch c1 into l_dummy;
1097 if c1%found then
1098 --
1099 close c1;
1100 --
1101 -- raise error
1102 --
1103 fnd_message.set_name('BEN','BEN_91009_NAME_NOT_UNIQUE');
1104 fnd_message.raise_error;
1105 --
1106 end if;
1107 --
1108 close c1;
1109 end if;
1110 --
1111 hr_utility.set_location('Leaving:'||l_proc,10);
1112 --
1113 end chk_name;
1114 --
1115 ------------------------------------------------------------------------
1116 ----
1117 -- |------< chk_mn_mx_los_num >------|
1118 --
1119 ------------------------------------------------------------------------
1120 ----
1121 --
1122 -- Description
1123 -- This procedure is used to check that minimum los num is always less than
1124 -- max los num.
1125 --
1126 -- Pre Conditions
1127 -- None.
1128 --
1129 -- In Parameters
1130 -- los_fctr_id PK of record being inserted or updated.
1131 -- mn_los_num Value of Minimum percentage.
1132 -- mx_los_num Value of Maximum percentage.
1133 -- effective_date effective date
1134 -- object_version_number Object version number of record being
1135 -- inserted or updated.
1136 --
1137 -- Post Success
1138 -- Processing continues
1139 --
1140 -- Post Failure
1141 -- Error handled by procedure
1142 --
1143 -- Access Status
1144 -- Internal table handler use only.
1145 --
1146 Procedure chk_mn_mx_los_num(p_los_fctr_id in number,
1147 p_no_mn_los_num_apls_flag in varchar2,
1148 p_mn_los_num in number,
1149 p_no_mx_los_num_apls_flag in varchar2,
1153 p_los_dt_to_use_cd in varchar2,
1150 p_mx_los_num in number,
1151 p_los_calc_rl in number,
1152 p_los_det_cd in varchar2,
1154 p_object_version_number in number) is
1155 --
1156 l_proc varchar2(72) := g_package || 'chk_mn_mx_los_num';
1157 l_api_updating boolean;
1158 l_dummy varchar2(1);
1159 --
1160 Begin
1161 --
1162 hr_utility.set_location('Entering:'||l_proc, 5);
1163 /*--
1164 -- los_calc_rl and (los_det_cd and los_dt_to_use_cd together) are
1165 -- mutually exclusive.
1166 --
1167 if ( p_los_calc_rl is not null and (p_los_det_cd is not null or
1168 p_los_dt_to_use_cd is not null)) or
1169 ( p_los_calc_rl is null and (p_los_det_cd is null or
1170 p_los_dt_to_use_cd is null))
1171 then
1172 --
1173 fnd_message.set_name('BEN','BEN_9XXXX_INV_CALC_RL_N_CDS');
1174 fnd_message.raise_error;
1175 --
1176 end if;
1177 -- */
1178 if p_mn_los_num is not null and p_mx_los_num is not null then
1179 --
1180 -- raise error if max value not greater than min value
1181 --
1182 -- Bug Fix 1873685
1183 if (p_mx_los_num < p_mn_los_num) then
1184 -- if (p_mx_los_num <= p_mn_los_num) then
1185 -- End fix 1873685
1186 fnd_message.set_name('BEN','BEN_91069_INVALID_MIN_MAX');
1187 fnd_message.raise_error;
1188 end if;
1189 --
1190 --
1191 end if;
1192 --
1193 -- If No Minimum Percent value flag set to "on" (Y),
1194 -- then minimum percent value and calc rule must be blank.
1195 --
1196 if nvl( p_no_mn_los_num_apls_flag, hr_api.g_varchar2) = 'Y'
1197 and (p_mn_los_num is not null /*or p_los_calc_rl is not null*/) then
1198 --
1199 fnd_message.set_name('BEN','BEN_92350_MIN_VAL_RULE');
1200 fnd_message.raise_error;
1201 --
1202 end if;
1203 --
1204 if nvl( p_no_mn_los_num_apls_flag, hr_api.g_varchar2) = 'N' and
1205 nvl(p_no_mx_los_num_apls_flag, hr_api.g_varchar2) = 'N' and
1206 p_mn_los_num is null and p_mx_los_num is null /* and
1207 p_los_calc_rl is null*/ then
1208 --
1209 fnd_message.set_name('BEN','BEN_92300_MIN_VAL_OR_RULE_REQ');
1210 fnd_message.raise_error;
1211 --
1212 end if;
1213 --
1214 -- If No Maximum Percent value flag set to "on" (Y),
1215 -- then maximum percent value and calc rule must be blank.
1216 --
1217 if nvl( p_no_mx_los_num_apls_flag, hr_api.g_varchar2) = 'Y'
1218 and (p_mx_los_num is not null /* or p_los_calc_rl is not null */) then
1219 --
1220 fnd_message.set_name('BEN','BEN_92301_MAX_VAL_RULE');
1221 fnd_message.raise_error;
1222 --
1223 end if;
1224 --
1225 -- if p_los_calc_rl is null then
1226 if p_no_mn_los_num_apls_flag = 'Y' or p_mn_los_num is not null then
1227 --
1228 if p_no_mx_los_num_apls_flag = 'N' and p_mx_los_num is null then
1229 --
1230 fnd_message.set_name('BEN','BEN_91057_MAX_VAL_REQUIRED');
1231 fnd_message.raise_error;
1232 --
1233 end if;
1234 elsif p_no_mx_los_num_apls_flag = 'Y' or p_mx_los_num is not null then
1235 --
1236 if p_no_mn_los_num_apls_flag = 'N' and p_mn_los_num is null then
1237 --
1238 fnd_message.set_name('BEN','BEN_91055_MIN_VAL_REQUIRED');
1239 fnd_message.raise_error;
1240 --
1241 end if;
1242 end if;
1243 -- end if;
1244 --
1245 hr_utility.set_location('Leaving:'||l_proc,10);
1246 --
1247 end chk_mn_mx_los_num;
1248
1249 --
1250
1251 -- ----------------------------------------------------------------------- --
1252 -- -----------------------< chk_child_records >-----------------------------|
1253 -- -------------------------------------------------------------------------
1254 --
1255 -- Description
1256 -- This procedure is used to check that los factor child records do not exist
1257 -- when the user deletes the record in the ben_los_fctr table.
1258 --
1259 -- Pre Conditions
1260 -- None.
1261 --
1262 -- In Parameters
1263 -- los_fctr_id PK of record being inserted or updated.
1264 --
1265 -- Post Success
1266 -- Processing continues
1267 --
1268 -- Post Failure
1269 -- Error handled by procedure
1270 --
1271 -- Access Status
1272 -- Internal table handler use only.
1273 --
1274 procedure chk_child_records(p_los_fctr_id in number) is
1275 --
1276 l_proc varchar2(72):= g_package||'chk_child_records';
1277
1278 --
1279 /* cursor chk_cmbn_age_los_fctr is select null
1280 from ben_cmbn_age_los_fctr cla
1281 where cla.los_fctr_id = p_los_fctr_id;*/
1282 begin
1283 --
1284 hr_utility.set_location('Entering:'||l_proc, 5);
1285 --
1286
1287 --
1291 -- the user cannot delete the los factor
1288 /* open chk_cmbn_age_los_fctr;
1289 --
1290 -- fetch value from cursor if it returns a record then the
1292 --
1293 fetch chk_cmbn_age_los_fctr into v_dummy;
1294 if chk_cmbn_age_los_fctr%found then
1295 close chk_cmbn_age_los_fctr;
1296 --
1297 -- raise error
1298 --
1299 fnd_message.set_name('BEN','BEN_91739_LOS_CHLD_RCD_EXISTS');
1300 fnd_message.raise_error;
1301 --
1302 end if;
1303 --
1304 close chk_cmbn_age_los_fctr;*/ --Bug 2978945 Used the common function instead of cursor
1305 --
1306
1307 -- check if los factor record exists in the ben_cmbn_age_los_fctr table
1308 If (ben_batch_utils.rows_exist
1309 (p_base_table_name => 'ben_cmbn_age_los_fctr',
1310 p_base_key_column => 'los_fctr_id',
1311 p_base_key_value => p_los_fctr_id
1312 )) Then
1313 ben_utility.child_exists_error('ben_cmbn_age_los_fctr');
1314 End If;
1315
1316 -- check if los factor record exists in the variable rates
1317 If (ben_batch_utils.rows_exist
1318 (p_base_table_name => 'ben_los_rt_f',
1319 p_base_key_column => 'los_fctr_id',
1320 p_base_key_value => p_los_fctr_id
1321 )) Then
1322 ben_utility.child_exists_error('ben_los_rt_f');
1323 End If;
1324
1325
1326 -- check if los factor record exists in the eligibility rates
1327 If (ben_batch_utils.rows_exist
1328 (p_base_table_name => 'ben_elig_los_prte_f',
1329 p_base_key_column => 'los_fctr_id',
1330 p_base_key_value => p_los_fctr_id
1331 )) Then
1332 ben_utility.child_exists_error('ben_elig_los_prte_f');
1333 End If;
1334
1335 hr_utility.set_location('Leaving:'||l_proc,10);
1336 --
1337 end chk_child_records;
1338
1339 -- ----------------------------------------------------------------------------
1340 -- |---------------------------< insert_validate >----------------------------|
1341 -- ----------------------------------------------------------------------------
1342 Procedure insert_validate(p_rec in ben_lsf_shd.g_rec_type
1343 ,p_effective_date in date) is
1344 --
1345 l_proc varchar2(72) := g_package||'insert_validate';
1346 --
1347 Begin
1348 hr_utility.set_location('Entering:'||l_proc, 5);
1349 --
1350 -- Call all supporting business operations
1351 --
1352 --
1353 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
1354 --
1355 chk_los_fctr_id
1356 (p_los_fctr_id => p_rec.los_fctr_id,
1357 p_object_version_number => p_rec.object_version_number);
1358 --
1359 chk_name
1360 (p_los_fctr_id => p_rec.los_fctr_id,
1361 p_business_group_id => p_rec.business_group_id,
1362 p_name => p_rec.name,
1363 p_effective_date => p_effective_date,
1364 p_object_version_number => p_rec.object_version_number);
1365 --
1366 --
1367 chk_los_uom
1368 (p_los_fctr_id => p_rec.los_fctr_id,
1369 p_los_uom => p_rec.los_uom,
1370 p_effective_date => p_effective_date,
1371 p_object_version_number => p_rec.object_version_number);
1372 --
1373 chk_los_calc_rl
1374 (p_los_fctr_id => p_rec.los_fctr_id,
1375 p_business_group_id => p_rec.business_group_id,
1376 p_los_calc_rl => p_rec.los_calc_rl,
1377 p_effective_date => p_effective_date,
1378 p_object_version_number => p_rec.object_version_number);
1379 --
1380 chk_los_alt_val_to_use_cd
1381 (p_los_fctr_id => p_rec.los_fctr_id,
1382 p_los_alt_val_to_use_cd => p_rec.los_alt_val_to_use_cd,
1383 p_effective_date => p_effective_date,
1384 p_object_version_number => p_rec.object_version_number);
1385 --
1386 chk_los_dt_to_use_cd
1387 (p_los_fctr_id => p_rec.los_fctr_id,
1388 p_los_dt_to_use_cd => p_rec.los_dt_to_use_cd,
1389 p_effective_date => p_effective_date,
1390 p_object_version_number => p_rec.object_version_number);
1391 --
1392 chk_los_dt_to_use_rl
1393 (p_los_fctr_id => p_rec.los_fctr_id,
1394 p_business_group_id => p_rec.business_group_id,
1395 p_los_dt_to_use_rl => p_rec.los_dt_to_use_rl,
1396 p_los_dt_to_use_cd => p_rec.los_dt_to_use_cd,
1397 p_effective_date => p_effective_date,
1398 p_object_version_number => p_rec.object_version_number);
1399 --
1400 chk_rndg_cd
1401 (p_los_fctr_id => p_rec.los_fctr_id,
1402 p_rndg_cd => p_rec.rndg_cd,
1403 p_effective_date => p_effective_date,
1404 p_object_version_number => p_rec.object_version_number);
1405 --
1406 chk_rndg_rl
1407 (p_los_fctr_id => p_rec.los_fctr_id,
1408 p_business_group_id => p_rec.business_group_id,
1409 p_rndg_rl => p_rec.rndg_rl,
1410 p_rndg_cd => p_rec.rndg_cd,
1411 p_effective_date => p_effective_date,
1412 p_object_version_number => p_rec.object_version_number);
1413 --
1414 chk_los_det_cd
1415 (p_los_fctr_id => p_rec.los_fctr_id,
1416 p_los_det_cd => p_rec.los_det_cd,
1417 p_effective_date => p_effective_date,
1421 chk_los_det_rl
1418 p_object_version_number => p_rec.object_version_number);
1419 --
1420 --
1422 (p_los_fctr_id => p_rec.los_fctr_id,
1423 p_business_group_id => p_rec.business_group_id,
1424 p_los_det_rl => p_rec.los_det_rl,
1425 p_los_det_cd => p_rec.los_det_cd,
1426 p_effective_date => p_effective_date,
1427 p_object_version_number => p_rec.object_version_number);
1428 --
1429 --
1430 chk_no_mn_los_num_apls_flag
1431 (p_los_fctr_id => p_rec.los_fctr_id,
1432 p_no_mn_los_num_apls_flag => p_rec.no_mn_los_num_apls_flag,
1433 p_effective_date => p_effective_date,
1434 p_object_version_number => p_rec.object_version_number);
1435 --
1436 chk_no_mx_los_num_apls_flag
1437 (p_los_fctr_id => p_rec.los_fctr_id,
1438 p_no_mx_los_num_apls_flag => p_rec.no_mx_los_num_apls_flag,
1439 p_effective_date => p_effective_date,
1440 p_object_version_number => p_rec.object_version_number);
1441
1442 --
1443 chk_mn_mx_los_num
1444 (p_los_fctr_id => p_rec.los_fctr_id,
1445 p_no_mn_los_num_apls_flag => p_rec.no_mn_los_num_apls_flag,
1446 p_mn_los_num => p_rec.mn_los_num,
1447 p_no_mx_los_num_apls_flag => p_rec.no_mx_los_num_apls_flag,
1448 p_mx_los_num => p_rec.mx_los_num,
1449 p_los_calc_rl => p_rec.los_calc_rl,
1450 p_los_det_cd => p_rec.los_det_cd,
1451 p_los_dt_to_use_cd => p_rec.los_dt_to_use_cd,
1452 p_object_version_number => p_rec.object_version_number);
1453 --
1454 --
1455 hr_utility.set_location(' Leaving:'||l_proc, 10);
1456 End insert_validate;
1457 --
1458 -- ----------------------------------------------------------------------------
1459 -- |---------------------------< update_validate >----------------------------|
1460 -- ----------------------------------------------------------------------------
1461 Procedure update_validate(p_rec in ben_lsf_shd.g_rec_type
1462 ,p_effective_date in date) is
1463 --
1464 l_proc varchar2(72) := g_package||'update_validate';
1465 --
1466 Begin
1467 hr_utility.set_location('Entering:'||l_proc, 5);
1468 --
1469 -- Call all supporting business operations
1470 --
1471 --
1472 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
1473 --
1474 chk_los_fctr_id
1475 (p_los_fctr_id => p_rec.los_fctr_id,
1476 p_object_version_number => p_rec.object_version_number);
1477 --
1478 chk_name
1479 (p_los_fctr_id => p_rec.los_fctr_id,
1480 p_business_group_id => p_rec.business_group_id,
1481 p_name => p_rec.name,
1482 p_effective_date => p_effective_date,
1483 p_object_version_number => p_rec.object_version_number);
1484 --
1485 --
1486 chk_los_uom
1487 (p_los_fctr_id => p_rec.los_fctr_id,
1488 p_los_uom => p_rec.los_uom,
1489 p_effective_date => p_effective_date,
1490 p_object_version_number => p_rec.object_version_number);
1491 --
1492 chk_los_calc_rl
1493 (p_los_fctr_id => p_rec.los_fctr_id,
1494 p_business_group_id => p_rec.business_group_id,
1495 p_los_calc_rl => p_rec.los_calc_rl,
1496 p_effective_date => p_effective_date,
1497 p_object_version_number => p_rec.object_version_number);
1498 --
1499 chk_los_alt_val_to_use_cd
1500 (p_los_fctr_id => p_rec.los_fctr_id,
1501 p_los_alt_val_to_use_cd => p_rec.los_alt_val_to_use_cd,
1502 p_effective_date => p_effective_date,
1503 p_object_version_number => p_rec.object_version_number);
1504 --
1505 chk_los_dt_to_use_cd
1506 (p_los_fctr_id => p_rec.los_fctr_id,
1507 p_los_dt_to_use_cd => p_rec.los_dt_to_use_cd,
1508 p_effective_date => p_effective_date,
1509 p_object_version_number => p_rec.object_version_number);
1510 --
1511 chk_los_dt_to_use_rl
1512 (p_los_fctr_id => p_rec.los_fctr_id,
1513 p_business_group_id => p_rec.business_group_id,
1514 p_los_dt_to_use_rl => p_rec.los_dt_to_use_rl,
1515 p_los_dt_to_use_cd => p_rec.los_dt_to_use_cd,
1516 p_effective_date => p_effective_date,
1517 p_object_version_number => p_rec.object_version_number);
1518 --
1519 chk_rndg_cd
1520 (p_los_fctr_id => p_rec.los_fctr_id,
1521 p_rndg_cd => p_rec.rndg_cd,
1522 p_effective_date => p_effective_date,
1523 p_object_version_number => p_rec.object_version_number);
1524 --
1525 chk_rndg_rl
1526 (p_los_fctr_id => p_rec.los_fctr_id,
1527 p_business_group_id => p_rec.business_group_id,
1528 p_rndg_rl => p_rec.rndg_rl,
1529 p_rndg_cd => p_rec.rndg_cd,
1530 p_effective_date => p_effective_date,
1531 p_object_version_number => p_rec.object_version_number);
1532 --
1533 chk_los_det_cd
1534 (p_los_fctr_id => p_rec.los_fctr_id,
1535 p_los_det_cd => p_rec.los_det_cd,
1536 p_effective_date => p_effective_date,
1537 p_object_version_number => p_rec.object_version_number);
1538 --
1539 --
1540 chk_los_det_rl
1541 (p_los_fctr_id => p_rec.los_fctr_id,
1542 p_business_group_id => p_rec.business_group_id,
1543 p_los_det_rl => p_rec.los_det_rl,
1544 p_los_det_cd => p_rec.los_det_cd,
1545 p_effective_date => p_effective_date,
1546 p_object_version_number => p_rec.object_version_number);
1547 --
1548 --
1549 chk_no_mn_los_num_apls_flag
1550 (p_los_fctr_id => p_rec.los_fctr_id,
1551 p_no_mn_los_num_apls_flag => p_rec.no_mn_los_num_apls_flag,
1552 p_effective_date => p_effective_date,
1553 p_object_version_number => p_rec.object_version_number);
1554 --
1555 chk_no_mx_los_num_apls_flag
1556 (p_los_fctr_id => p_rec.los_fctr_id,
1557 p_no_mx_los_num_apls_flag => p_rec.no_mx_los_num_apls_flag,
1558 p_effective_date => p_effective_date,
1559 p_object_version_number => p_rec.object_version_number);
1560
1561 --
1562 chk_mn_mx_los_num
1563 (p_los_fctr_id => p_rec.los_fctr_id,
1564 p_no_mn_los_num_apls_flag => p_rec.no_mn_los_num_apls_flag,
1565 p_mn_los_num => p_rec.mn_los_num,
1566 p_no_mx_los_num_apls_flag => p_rec.no_mx_los_num_apls_flag,
1567 p_mx_los_num => p_rec.mx_los_num,
1568 p_los_calc_rl => p_rec.los_calc_rl,
1569 p_los_det_cd => p_rec.los_det_cd,
1570 p_los_dt_to_use_cd => p_rec.los_dt_to_use_cd,
1571 p_object_version_number => p_rec.object_version_number);
1572 --
1573 --
1574 hr_utility.set_location(' Leaving:'||l_proc, 10);
1575 End update_validate;
1576 --
1577 -- ----------------------------------------------------------------------------
1578 -- |---------------------------< delete_validate >----------------------------|
1579 -- ----------------------------------------------------------------------------
1580 Procedure delete_validate(p_rec in ben_lsf_shd.g_rec_type
1581 ,p_effective_date in date) is
1582 --
1583 l_proc varchar2(72) := g_package||'delete_validate';
1584 --
1585 Begin
1586 hr_utility.set_location('Entering:'||l_proc, 5);
1587 --
1588 -- Call all supporting business operations
1589 chk_child_records(p_los_fctr_id => p_rec.los_fctr_id);
1590 --
1591 hr_utility.set_location(' Leaving:'||l_proc, 10);
1592 End delete_validate;
1593 --
1594 --
1595 -- ---------------------------------------------------------------------------
1596 -- |---------------------< return_legislation_code >-------------------------|
1597 -- ---------------------------------------------------------------------------
1598 --
1599 function return_legislation_code
1600 (p_los_fctr_id in number) return varchar2 is
1601 --
1602 -- Declare cursor
1603 --
1604 cursor csr_leg_code is
1605 select a.legislation_code
1606 from per_business_groups a,
1607 ben_los_fctr b
1608 where b.los_fctr_id = p_los_fctr_id
1609 and a.business_group_id = b.business_group_id;
1610 --
1611 -- Declare local variables
1612 --
1613 l_legislation_code varchar2(150);
1614 l_proc varchar2(72) := g_package||'return_legislation_code';
1615 --
1616 begin
1617 --
1618 hr_utility.set_location('Entering:'|| l_proc, 10);
1619 --
1620 -- Ensure that all the mandatory parameter are not null
1621 --
1622 hr_api.mandatory_arg_error(p_api_name => l_proc,
1623 p_argument => 'los_fctr_id',
1624 p_argument_value => p_los_fctr_id);
1625 --
1626 open csr_leg_code;
1627 --
1628 fetch csr_leg_code into l_legislation_code;
1629 --
1630 if csr_leg_code%notfound then
1631 --
1632 close csr_leg_code;
1633 --
1634 -- The primary key is invalid therefore we must error
1635 --
1636 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
1637 fnd_message.raise_error;
1638 --
1639 end if;
1640 --
1641 close csr_leg_code;
1642 --
1643 hr_utility.set_location(' Leaving:'|| l_proc, 20);
1644 --
1645 return l_legislation_code;
1646 --
1647 end return_legislation_code;
1648 --
1649 end ben_lsf_bus;