DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PFF_BUS

Source


1 Package Body ben_pff_bus as
2 /* $Header: bepffrhi.pkb 120.0 2005/05/28 10:42:25 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_pff_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_pct_fl_tm_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 --   pct_fl_tm_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_pct_fl_tm_fctr_id(p_pct_fl_tm_fctr_id                in number,
37                            p_object_version_number       in number) is
38   --
39   l_proc         varchar2(72) := g_package||'chk_pct_fl_tm_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_pff_shd.api_updating
47     (p_pct_fl_tm_fctr_id                => p_pct_fl_tm_fctr_id,
48      p_object_version_number       => p_object_version_number);
49   --
50   if (l_api_updating
51      and nvl(p_pct_fl_tm_fctr_id,hr_api.g_number)
52      <>  ben_pff_shd.g_old_rec.pct_fl_tm_fctr_id) then
53     --
54     -- raise error as PK has changed
55     --
56     ben_pff_shd.constraint_error('BEN_PCT_FL_TM_FCTR_PK');
57     --
58   elsif not l_api_updating then
59     --
60     -- check if PK is null
61     --
62     if p_pct_fl_tm_fctr_id is not null then
63       --
64       -- raise error as PK is not null
65       --
66       ben_pff_shd.constraint_error('BEN_PCT_FL_TM_FCTR_PK');
67       --
68     end if;
69     --
70   end if;
71   --
72   hr_utility.set_location('Leaving:'||l_proc, 10);
73   --
74 End chk_pct_fl_tm_fctr_id;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |------< chk_rndg_rl >------|
78 -- ----------------------------------------------------------------------------
79 --
80 -- Description
81 --   This procedure is used to check that the Formula Rule is valid.
82 --
83 -- Pre Conditions
84 --   None.
85 --
86 -- In Parameters
87 --   pct_fl_tm_fctr_id PK of record being inserted or updated.
88 --   rndg_rl Value of formula rule id.
89 --   effective_date effective date
90 --   object_version_number Object version number of record being
91 --                                      inserted or updated.
92 --
93 -- Post Success
94 --   Processing continues
95 --
96 -- Post Failure
97 --   Error handled by procedure
98 --
99 -- Access Status
100 --   Internal table handler use only.
101 --
102 Procedure chk_rndg_rl(p_pct_fl_tm_fctr_id                in number,
103                              p_business_group_id        in number,
104                              p_rndg_rl              in number,
105                              p_rndg_cd                in varchar2,
106                              p_effective_date              in date,
107                              p_object_version_number       in number) is
108   --
109   l_proc         varchar2(72) := g_package||'chk_rndg_rl';
110   l_api_updating boolean;
111   l_dummy        varchar2(1);
112   --
113   cursor c1 is
114     select null
115     from   ff_formulas_f ff
116            ,per_business_groups pbg
117     where  ff.formula_id = p_rndg_rl
118     and    ff.formula_type_id = -169
119     and    pbg.business_group_id = p_business_group_id
120     and    nvl(ff.business_group_id, p_business_group_id) =
121                p_business_group_id
122     and    nvl(ff.legislation_code, pbg.legislation_code) =
123                pbg.legislation_code
124     and    p_effective_date
125            between ff.effective_start_date
126            and     ff.effective_end_date;
127   --
128 Begin
129   --
130   hr_utility.set_location('Entering:'||l_proc, 5);
131   --
132   l_api_updating := ben_pff_shd.api_updating
133     (p_pct_fl_tm_fctr_id                => p_pct_fl_tm_fctr_id,
134      p_object_version_number       => p_object_version_number);
135   --
136   if (l_api_updating
137       and nvl(p_rndg_rl,hr_api.g_number)
138       <> ben_pff_shd.g_old_rec.rndg_rl
139       or not l_api_updating)
140       and p_rndg_rl is not null then
141     --
142     -- check if value of formula rule is valid.
143     --
144     open c1;
145       --
146       -- fetch value from cursor if it returns a record then the
147       -- formula is valid otherwise its invalid
148       --
149       fetch c1 into l_dummy;
150       if c1%notfound then
151         --
152         close c1;
153         --
154         -- raise error
155         --
156         fnd_message.set_name('BEN','BEN_91042_INVALID_RNDG_RL');
157         fnd_message.raise_error;
158         --
159       end if;
160       --
161     close c1;
162     --
163   end if;
164   --
165   -- Unless Rounding Code = Rule, Rounding rule must be blank.
166   if  nvl(p_rndg_cd,hr_api.g_varchar2)  <> 'RL' and p_rndg_rl is not null then
167         --
168         fnd_message.set_name('BEN', 'BEN_91043_RNDG_RL_NOT_NULL');
169         fnd_message.raise_error;
170         --
171   elsif  nvl(p_rndg_cd,hr_api.g_varchar2) = 'RL' and p_rndg_rl is null then
172         --
173         fnd_message.set_name('BEN', 'BEN_92340_RNDG_RL_NULL');
174         fnd_message.raise_error;
175         --
176   end if;
177   --
178   hr_utility.set_location('Leaving:'||l_proc,10);
179   --
180 end chk_rndg_rl;
181 --
182 -- ----------------------------------------------------------------------------
183 -- |------< chk_rndg_cd >------|
184 -- ----------------------------------------------------------------------------
185 --
186 -- Description
187 --   This procedure is used to check that the lookup value is valid.
188 --
189 -- Pre Conditions
190 --   None.
191 --
192 -- In Parameters
193 --   pct_fl_tm_fctr_id PK of record being inserted or updated.
194 --   rndg_cd Value of lookup code.
195 --   effective_date effective date
196 --   object_version_number Object version number of record being
197 --                         inserted or updated.
198 --
199 -- Post Success
200 --   Processing continues
201 --
202 -- Post Failure
203 --   Error handled by procedure
204 --
205 -- Access Status
206 --   Internal table handler use only.
207 --
208 Procedure chk_rndg_cd(p_pct_fl_tm_fctr_id                in number,
209                             p_rndg_cd               in varchar2,
210                             p_effective_date              in date,
211                             p_object_version_number       in number) is
212   --
213   l_proc         varchar2(72) := g_package||'chk_rndg_cd';
214   l_api_updating boolean;
215   --
216 Begin
217   --
218   hr_utility.set_location('Entering:'||l_proc, 5);
219   --
220   l_api_updating := ben_pff_shd.api_updating
221     (p_pct_fl_tm_fctr_id                => p_pct_fl_tm_fctr_id,
222      p_object_version_number       => p_object_version_number);
223   --
224   if (l_api_updating
225       and p_rndg_cd
226       <> nvl(ben_pff_shd.g_old_rec.rndg_cd,hr_api.g_varchar2)
227       or not l_api_updating)
228       and p_rndg_cd is not null then
229     --
230     -- check if value of lookup falls within lookup type.
231     --
232     if hr_api.not_exists_in_hr_lookups
233           (p_lookup_type    => 'BEN_RNDG',
234            p_lookup_code    => p_rndg_cd,
235            p_effective_date => p_effective_date) then
236       --
237       -- raise error as does not exist as lookup
238       --
239       fnd_message.set_name('BEN','BEN_91040_INVALID_RNDG_CD');
240       fnd_message.raise_error;
241       --
242     end if;
243     --
244   end if;
245   --
246   hr_utility.set_location('Leaving:'||l_proc,10);
247   --
248 end chk_rndg_cd;
249 --
250 -- ----------------------------------------------------------------------------
251 -- |------< chk_use_sum_of_all_asnts_flag >------|
252 -- ----------------------------------------------------------------------------
253 --
254 -- Description
255 --   This procedure is used to check that the lookup value is valid.
256 --
257 -- Pre Conditions
258 --   None.
259 --
260 -- In Parameters
261 --   pct_fl_tm_fctr_id PK of record being inserted or updated.
262 --   use_sum_of_all_asnts_flag Value of lookup code.
263 --   effective_date effective date
264 --   object_version_number Object version number of record being
265 --                         inserted or updated.
266 --
267 -- Post Success
268 --   Processing continues
269 --
270 -- Post Failure
271 --   Error handled by procedure
272 --
273 -- Access Status
274 --   Internal table handler use only.
275 --
276 Procedure chk_use_sum_of_all_asnts_flag(p_pct_fl_tm_fctr_id                in number,
277                             p_use_sum_of_all_asnts_flag               in varchar2,
278                             p_effective_date              in date,
279                             p_object_version_number       in number) is
280   --
281   l_proc         varchar2(72) := g_package||'chk_use_sum_of_all_asnts_flag';
282   l_api_updating boolean;
283   --
284 Begin
285   --
286   hr_utility.set_location('Entering:'||l_proc, 5);
287   --
288   l_api_updating := ben_pff_shd.api_updating
289     (p_pct_fl_tm_fctr_id                => p_pct_fl_tm_fctr_id,
290      p_object_version_number       => p_object_version_number);
291   --
292   if (l_api_updating
293       and p_use_sum_of_all_asnts_flag
294       <> nvl(ben_pff_shd.g_old_rec.use_sum_of_all_asnts_flag,hr_api.g_varchar2)
295       or not l_api_updating)
296       and p_use_sum_of_all_asnts_flag is not null then
297     --
298     -- check if value of lookup falls within lookup type.
299     --
300     if hr_api.not_exists_in_hr_lookups
301           (p_lookup_type    => 'YES_NO',
302            p_lookup_code    => p_use_sum_of_all_asnts_flag,
303            p_effective_date => p_effective_date) then
304       --
305       -- raise error as does not exist as lookup
306       --
307       fnd_message.set_name('BEN','BEN_91059_INVALID_SUM_ALL_ASNT');
308       fnd_message.raise_error;
309       --
310     end if;
311     --
312   end if;
313   --
314   hr_utility.set_location('Leaving:'||l_proc,10);
315   --
316 end chk_use_sum_of_all_asnts_flag;
317 --
318 -- ----------------------------------------------------------------------------
319 -- |------< chk_use_prmry_asnt_only_flag >------|
320 -- ----------------------------------------------------------------------------
321 --
322 -- Description
323 --   This procedure is used to check that the lookup value is valid.
324 --
325 -- Pre Conditions
326 --   None.
327 --
328 -- In Parameters
329 --   pct_fl_tm_fctr_id PK of record being inserted or updated.
330 --   use_prmry_asnt_only_flag Value of lookup code.
331 --   effective_date effective date
332 --   object_version_number Object version number of record being
333 --                         inserted or updated.
334 --
335 -- Post Success
336 --   Processing continues
337 --
338 -- Post Failure
339 --   Error handled by procedure
340 --
341 -- Access Status
342 --   Internal table handler use only.
343 --
344 Procedure chk_use_prmry_asnt_only_flag(p_pct_fl_tm_fctr_id                in number,
345                             p_use_prmry_asnt_only_flag               in varchar2,
346                             p_effective_date              in date,
347                             p_object_version_number       in number) is
348   --
349   l_proc         varchar2(72) := g_package||'chk_use_prmry_asnt_only_flag';
350   l_api_updating boolean;
351   --
352 Begin
353   --
354   hr_utility.set_location('Entering:'||l_proc, 5);
355   --
356   l_api_updating := ben_pff_shd.api_updating
357     (p_pct_fl_tm_fctr_id                => p_pct_fl_tm_fctr_id,
358      p_object_version_number       => p_object_version_number);
359   --
360   if (l_api_updating
361       and p_use_prmry_asnt_only_flag
362       <> nvl(ben_pff_shd.g_old_rec.use_prmry_asnt_only_flag,hr_api.g_varchar2)
363       or not l_api_updating)
364       and p_use_prmry_asnt_only_flag is not null then
365     --
366     -- check if value of lookup falls within lookup type.
367     --
368     if hr_api.not_exists_in_hr_lookups
369           (p_lookup_type    => 'YES_NO',
370            p_lookup_code    => p_use_prmry_asnt_only_flag,
371            p_effective_date => p_effective_date) then
372       --
373       -- raise error as does not exist as lookup
374       --
375       fnd_message.set_name('BEN','BEN_91058_INVALID_PRMRY_ASNT');
376       fnd_message.raise_error;
377       --
378     end if;
379     --
380   end if;
381   --
382   hr_utility.set_location('Leaving:'||l_proc,10);
383   --
384 end chk_use_prmry_asnt_only_flag;
385 --
386 -- ----------------------------------------------------------------------------
387 -- |------< chk_no_mx_pct_val_flag >------|
388 -- ----------------------------------------------------------------------------
389 --
390 -- Description
391 --   This procedure is used to check that the lookup value is valid.
392 --
393 -- Pre Conditions
394 --   None.
395 --
396 -- In Parameters
397 --   pct_fl_tm_fctr_id PK of record being inserted or updated.
398 --   no_mx_pct_val_flag Value of lookup code.
399 --   effective_date effective date
400 --   object_version_number Object version number of record being
401 --                         inserted or updated.
402 --
403 -- Post Success
404 --   Processing continues
405 --
406 -- Post Failure
407 --   Error handled by procedure
408 --
409 -- Access Status
410 --   Internal table handler use only.
411 --
412 Procedure chk_no_mx_pct_val_flag(p_pct_fl_tm_fctr_id                in number,
413                             p_no_mx_pct_val_flag               in varchar2,
414                             p_effective_date              in date,
415                             p_object_version_number       in number) is
416   --
417   l_proc         varchar2(72) := g_package||'chk_no_mx_pct_val_flag';
418   l_api_updating boolean;
419   --
420 Begin
421   --
422   hr_utility.set_location('Entering:'||l_proc, 5);
423   --
424   l_api_updating := ben_pff_shd.api_updating
425     (p_pct_fl_tm_fctr_id                => p_pct_fl_tm_fctr_id,
426      p_object_version_number       => p_object_version_number);
427   --
428   if (l_api_updating
429       and p_no_mx_pct_val_flag
430       <> nvl(ben_pff_shd.g_old_rec.no_mx_pct_val_flag,hr_api.g_varchar2)
431       or not l_api_updating)
432       and p_no_mx_pct_val_flag is not null then
433     --
434     -- check if value of lookup falls within lookup type.
435     --
436     if hr_api.not_exists_in_hr_lookups
437           (p_lookup_type    => 'YES_NO',
438            p_lookup_code    => p_no_mx_pct_val_flag,
439            p_effective_date => p_effective_date) then
440       --
441       -- raise error as does not exist as lookup
442       --
443       fnd_message.set_name('BEN','BEN_91052_INVALID_MAX_FLAG');
444       fnd_message.raise_error;
445       --
446     end if;
447     --
448   end if;
449   --
450   hr_utility.set_location('Leaving:'||l_proc,10);
451   --
452 end chk_no_mx_pct_val_flag;
453 --
454 -- ----------------------------------------------------------------------------
455 -- |------< chk_no_mn_pct_val_flag >------|
456 -- ----------------------------------------------------------------------------
457 --
458 -- Description
459 --   This procedure is used to check that the lookup value is valid.
460 --
461 -- Pre Conditions
462 --   None.
463 --
464 -- In Parameters
465 --   pct_fl_tm_fctr_id PK of record being inserted or updated.
466 --   no_mn_pct_val_flag Value of lookup code.
467 --   effective_date effective date
468 --   object_version_number Object version number of record being
469 --                         inserted or updated.
470 --
471 -- Post Success
472 --   Processing continues
473 --
474 -- Post Failure
475 --   Error handled by procedure
476 --
477 -- Access Status
478 --   Internal table handler use only.
479 --
480 Procedure chk_no_mn_pct_val_flag(p_pct_fl_tm_fctr_id                in number,
481                             p_no_mn_pct_val_flag               in varchar2,
482                             p_effective_date              in date,
483                             p_object_version_number       in number) is
484   --
485   l_proc         varchar2(72) := g_package||'chk_no_mn_pct_val_flag';
486   l_api_updating boolean;
487   --
488 Begin
489   --
490   hr_utility.set_location('Entering:'||l_proc, 5);
491   --
492   l_api_updating := ben_pff_shd.api_updating
493     (p_pct_fl_tm_fctr_id                => p_pct_fl_tm_fctr_id,
494      p_object_version_number       => p_object_version_number);
495   --
496   if (l_api_updating
497       and p_no_mn_pct_val_flag
498       <> nvl(ben_pff_shd.g_old_rec.no_mn_pct_val_flag,hr_api.g_varchar2)
499       or not l_api_updating)
500       and p_no_mn_pct_val_flag is not null then
501     --
502     -- check if value of lookup falls within lookup type.
503     --
504     if hr_api.not_exists_in_hr_lookups
505           (p_lookup_type    => 'YES_NO',
506            p_lookup_code    => p_no_mn_pct_val_flag,
507            p_effective_date => p_effective_date) then
508       --
509       -- raise error as does not exist as lookup
510       --
511       fnd_message.set_name('BEN','BEN_91051_INVALID_MIN_FLAG');
512       fnd_message.raise_error;
513       --
514     end if;
515     --
516   end if;
517   --
518   hr_utility.set_location('Leaving:'||l_proc,10);
519   --
520 end chk_no_mn_pct_val_flag;
521 
522 ------------------------------------------------------------------------
523 ----
524 -- |------< chk_mn_mx_pct_val >------|
525 --
526 ------------------------------------------------------------------------
527 ----
528 --
529 -- Description
530 --   This procedure is used to check that minimum percent value is always less than
531 --    max percent value.
532 --
533 -- Pre Conditions
534 --   None.
535 --
536 -- In Parameters
537 --   pct_fl_tm_fctr_id PK of record being inserted or updated.
538 --   mn_pct_val Value of Minimum percentage.
539 --   mx_pct_val Value of Maximum percentage.
540 --   effective_date effective date
541 --   object_version_number Object version number of record being
542 --                         inserted or updated.
543 --
544 -- Post Success
545 --   Processing continues
546 --
547 -- Post Failure
548 --   Error handled by procedure
549 --
550 -- Access Status
551 --   Internal table handler use only.
552 --
553 Procedure chk_mn_mx_pct_val(p_pct_fl_tm_fctr_id                in number,
554                          p_no_mn_pct_val_flag  in varchar2,
555                          p_mn_pct_val                  in number,
556                          p_no_mx_pct_val_flag  in varchar2,
557                          p_mx_pct_val                   in number,
558                          p_object_version_number       in number) is
559   --
560   l_proc   varchar2(72)  := g_package || 'chk_mn_mx_pct_val';
561   l_api_updating   boolean;
562   l_dummy  varchar2(1);
563   --
564 Begin
565   --
566   hr_utility.set_location('Entering:'||l_proc, 5);
567   --
568   --
569   if p_mn_pct_val is not null and p_mx_pct_val is not null then
570       --
571       -- raise error if max value not greater than min value
572       --
573      -- Bug Fix 1873685
574      if  (p_mx_pct_val < p_mn_pct_val)  then
575      -- if  (p_mx_pct_val <= p_mn_pct_val)  then
576      -- End fix 1873685
577       fnd_message.set_name('BEN','BEN_91069_INVALID_MIN_MAX');
578       fnd_message.raise_error;
579     end if;
580       --
581       --
582   end if;
583     --
584       -- If No Minimum Percent value flag set to "on" (Y),
585       --    then minimum percent value must be blank.
586       --
587     if  nvl( p_no_mn_pct_val_flag, hr_api.g_varchar2)  = 'Y'
588          and p_mn_pct_val is not null
589     then
590       fnd_message.set_name('BEN','BEN_91054_MIN_VAL_NOT_NULL');
591       fnd_message.raise_error;
592     elsif   nvl( p_no_mn_pct_val_flag, hr_api.g_varchar2)  = 'N'
593          and p_mn_pct_val is null
594     then
595       fnd_message.set_name('BEN','BEN_91055_MIN_VAL_REQUIRED');
596       fnd_message.raise_error;
597     end if;
598       --
599       -- If No Maximum Percent value flag set to "on" (Y),
600       --    then maximum percent value must be blank.
601       --
602     if  nvl( p_no_mx_pct_val_flag, hr_api.g_varchar2)  = 'Y'
603          and p_mx_pct_val is not null
604     then
605       fnd_message.set_name('BEN','BEN_91056_MAX_VAL_NOT_NULL');
606       fnd_message.raise_error;
607     elsif   nvl( p_no_mx_pct_val_flag, hr_api.g_varchar2)  = 'N'
608          and p_mx_pct_val is null
609     then
610       fnd_message.set_name('BEN','BEN_91057_MAX_VAL_REQUIRED');
611       fnd_message.raise_error;
612     end if;
613    --
614   hr_utility.set_location('Leaving:'||l_proc,10);
615   --
616 end chk_mn_mx_pct_val;
617 
618 ------------------------------------------------------------------------
619 ----
620 -- |------< chk_name >------|
621 --
622 ------------------------------------------------------------------------
623 ----
624 --
625 -- Description
626 --   This procedure is used to check that the Name is unique in a business group.
627 --
628 -- Pre Conditions
629 --   None.
630 --
631 -- In Parameters
632 --   pct_fl_tm_fctr_id PK of record being inserted or updated.
633 --   name Value of Name.
634 --   effective_date effective date
635 --   object_version_number Object version number of record being
636 --                         inserted or updated.
637 --
638 -- Post Success
639 --   Processing continues
640 --
641 -- Post Failure
642 --   Error handled by procedure
643 --
644 -- Access Status
645 --   Internal table handler use only.
646 --
647 Procedure chk_name(p_pct_fl_tm_fctr_id                in number,
648                          p_business_group_id                in number,
649                          p_name                    in varchar2,
650                          p_effective_date              in date,
651                          p_object_version_number       in number) is
652   --
653   l_proc         varchar2(72):= g_package||'chk_name';
654   l_api_updating boolean;
655   l_dummy        varchar2(1);
656   --
657   cursor c1 is
658     select null
659     from   ben_pct_fl_tm_fctr  pff
660     where  pff.business_group_id = p_business_group_id and
661                  pff.name = p_name;
662 Begin
663   --
664   hr_utility.set_location('Entering:'||l_proc, 5);
665   --
666   l_api_updating := ben_pff_shd.api_updating
667     (p_pct_fl_tm_fctr_id                => p_pct_fl_tm_fctr_id,
668      -- p_effective_date              => p_effective_date,
669      p_object_version_number       => p_object_version_number);
670   --
671   if (l_api_updating
672       and nvl(p_name,hr_api.g_varchar2)
673       <> ben_pff_shd.g_old_rec.name
674       or not l_api_updating)
675       and p_name is not null then
676     --
677     -- check if name already used.
678     --
679     open c1;
680       --
681       -- fetch value from cursor if it returns a record then the
682 
683       -- name is invalid otherwise its valid
684       --
685       fetch c1 into l_dummy;
686       if c1%found then
687         --
688         close c1;
689         --
690         -- raise error
691         --
692         fnd_message.set_name('BEN','BEN_91009_NAME_NOT_UNIQUE');
693         fnd_message.raise_error;
694         --
695       end if;
696       --
697     close c1;
698   end if;
699   --
700   hr_utility.set_location('Leaving:'||l_proc,10);
701   --
702 end chk_name;
703   --
704 
705 --Bug 2978945 begin
706 
707 -- ----------------------------------------------------------------------- --
708 -- -----------------------< chk_child_records >-----------------------------|
709 -- -------------------------------------------------------------------------
710 --
711 -- Description
712 --   This procedure is used to check that Percent Full Time child records do
713 --   not exist when the user deletes the record in the
714 --   BEN_PCT_FL_TM_FCTR table.
715 --
716 -- Pre Conditions
717 --   None.
718 --
719 -- In Parameters
720 --   pct_fl_tm_fctr_id        PK of record being inserted or updated.
721 --
722 -- Post Success
723 --   Processing continues
724 --
725 -- Post Failure
726 --   Error handled by procedure
727 --
728 -- Access Status
729 --   Internal table handler use only.
730 --
731 procedure chk_child_records(p_pct_fl_tm_fctr_id  in number) is
732   --
733   l_proc         varchar2(72):= g_package||'chk_child_records';
734 
735 begin
736   --
737   hr_utility.set_location('Entering:'||l_proc, 5);
738 
739  --Used in variable rate profiles
740    If (ben_batch_utils.rows_exist
741              (p_base_table_name => 'BEN_PCT_FL_TM_RT_F',
742               p_base_key_column => 'pct_fl_tm_fctr_id',
743               p_base_key_value  => p_pct_fl_tm_fctr_id
744              )) Then
745 		ben_utility.child_exists_error('BEN_PCT_FL_TM_RT_F');
746    End If;
747 
748   --Used in eligibility profiles
749    If (ben_batch_utils.rows_exist
750              (p_base_table_name => 'BEN_ELIG_PCT_FL_TM_PRTE_F',
751               p_base_key_column => 'pct_fl_tm_fctr_id',
752               p_base_key_value  => p_pct_fl_tm_fctr_id
753              )) Then
754 		ben_utility.child_exists_error('BEN_ELIG_PCT_FL_TM_PRTE_F');
755   End If;
756 
757   hr_utility.set_location('Leaving:'||l_proc,10);
758   --
759 
760 end chk_child_records;
761 
762 --Bug 2978945
763 --
764 -- ----------------------------------------------------------------------------
765 -- |---------------------------< insert_validate >----------------------------|
766 -- ----------------------------------------------------------------------------
767 Procedure insert_validate(p_rec in ben_pff_shd.g_rec_type
768                          ,p_effective_date in date) is
769 --
770   l_proc  varchar2(72) := g_package||'insert_validate';
771 --
772 Begin
773   hr_utility.set_location('Entering:'||l_proc, 5);
774   --
775   -- Call all supporting business operations
776   --
777   --
778   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
779   --
780   chk_pct_fl_tm_fctr_id
781   (p_pct_fl_tm_fctr_id     => p_rec.pct_fl_tm_fctr_id,
782    p_object_version_number => p_rec.object_version_number);
783   --
784   chk_rndg_cd
785   (p_pct_fl_tm_fctr_id     => p_rec.pct_fl_tm_fctr_id,
786    p_rndg_cd               => p_rec.rndg_cd,
787    p_effective_date        => p_effective_date,
788    p_object_version_number => p_rec.object_version_number);
789   --
790   --
791   chk_rndg_rl
792   (p_pct_fl_tm_fctr_id     => p_rec.pct_fl_tm_fctr_id,
793    p_business_group_id     => p_rec.business_group_id,
794    p_rndg_rl               => p_rec.rndg_rl,
795    p_rndg_cd               =>  p_rec.rndg_cd,
796    p_effective_date        => p_effective_date,
797    p_object_version_number => p_rec.object_version_number);
798   --
799   chk_use_sum_of_all_asnts_flag
800   (p_pct_fl_tm_fctr_id          => p_rec.pct_fl_tm_fctr_id,
801    p_use_sum_of_all_asnts_flag  => p_rec.use_sum_of_all_asnts_flag,
802    p_effective_date             => p_effective_date,
803    p_object_version_number      => p_rec.object_version_number);
804   --
805   chk_use_prmry_asnt_only_flag
806   (p_pct_fl_tm_fctr_id          => p_rec.pct_fl_tm_fctr_id,
807    p_use_prmry_asnt_only_flag   => p_rec.use_prmry_asnt_only_flag,
808    p_effective_date             => p_effective_date,
809    p_object_version_number      => p_rec.object_version_number);
810   --
811   chk_no_mx_pct_val_flag
812   (p_pct_fl_tm_fctr_id     => p_rec.pct_fl_tm_fctr_id,
813    p_no_mx_pct_val_flag    => p_rec.no_mx_pct_val_flag,
814    p_effective_date        => p_effective_date,
815    p_object_version_number => p_rec.object_version_number);
816   --
817   chk_no_mn_pct_val_flag
818   (p_pct_fl_tm_fctr_id     => p_rec.pct_fl_tm_fctr_id,
819    p_no_mn_pct_val_flag    => p_rec.no_mn_pct_val_flag,
820    p_effective_date        => p_effective_date,
821    p_object_version_number => p_rec.object_version_number);
822   --
823   chk_mn_mx_pct_val
824   (p_pct_fl_tm_fctr_id     => p_rec.pct_fl_tm_fctr_id,
825    p_no_mn_pct_val_flag    => p_rec.no_mn_pct_val_flag,
826    p_mn_pct_val            => p_rec.mn_pct_val,
827    p_no_mx_pct_val_flag    => p_rec.no_mx_pct_val_flag,
828    p_mx_pct_val            => p_rec.mx_pct_val,
829    p_object_version_number => p_rec.object_version_number);
830   --
831   chk_name
832   (p_pct_fl_tm_fctr_id     => p_rec.pct_fl_tm_fctr_id,
833    p_business_group_id     => p_rec.business_group_id,
834    p_name                  => p_rec.name,
835    p_effective_date        => p_effective_date,
836    p_object_version_number => p_rec.object_version_number);
837  --
838   hr_utility.set_location(' Leaving:'||l_proc, 10);
839 End insert_validate;
840 --
841 -- ----------------------------------------------------------------------------
842 -- |---------------------------< update_validate >----------------------------|
843 -- ----------------------------------------------------------------------------
844 Procedure update_validate(p_rec in ben_pff_shd.g_rec_type
845                          ,p_effective_date in date) is
846 --
847   l_proc  varchar2(72) := g_package||'update_validate';
848 --
849 Begin
850   hr_utility.set_location('Entering:'||l_proc, 5);
851   --
852   -- Call all supporting business operations
853   --
854   --
855   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
856   --
857   chk_pct_fl_tm_fctr_id
858   (p_pct_fl_tm_fctr_id          => p_rec.pct_fl_tm_fctr_id,
859    p_object_version_number      => p_rec.object_version_number);
860   --
861   chk_rndg_cd
862   (p_pct_fl_tm_fctr_id          => p_rec.pct_fl_tm_fctr_id,
863    p_rndg_cd                    => p_rec.rndg_cd,
864    p_effective_date             => p_effective_date,
865    p_object_version_number      => p_rec.object_version_number);
866  --
867   chk_rndg_rl
868   (p_pct_fl_tm_fctr_id          => p_rec.pct_fl_tm_fctr_id,
869    p_business_group_id          => p_rec.business_group_id,
870    p_rndg_rl                   => p_rec.rndg_rl,
871    p_rndg_cd                    =>  p_rec.rndg_cd,
872    p_effective_date             => p_effective_date,
873    p_object_version_number      => p_rec.object_version_number);
874   --
875   --
876   chk_use_sum_of_all_asnts_flag
877   (p_pct_fl_tm_fctr_id          => p_rec.pct_fl_tm_fctr_id,
878    p_use_sum_of_all_asnts_flag  => p_rec.use_sum_of_all_asnts_flag,
879    p_effective_date             => p_effective_date,
880    p_object_version_number      => p_rec.object_version_number);
881   --
882   chk_use_prmry_asnt_only_flag
883   (p_pct_fl_tm_fctr_id          => p_rec.pct_fl_tm_fctr_id,
884    p_use_prmry_asnt_only_flag   => p_rec.use_prmry_asnt_only_flag,
885    p_effective_date             => p_effective_date,
886    p_object_version_number      => p_rec.object_version_number);
887   --
888   chk_no_mx_pct_val_flag
889   (p_pct_fl_tm_fctr_id          => p_rec.pct_fl_tm_fctr_id,
890    p_no_mx_pct_val_flag         => p_rec.no_mx_pct_val_flag,
891    p_effective_date             => p_effective_date,
892    p_object_version_number      => p_rec.object_version_number);
893   --
894   chk_no_mn_pct_val_flag
895   (p_pct_fl_tm_fctr_id          => p_rec.pct_fl_tm_fctr_id,
896    p_no_mn_pct_val_flag         => p_rec.no_mn_pct_val_flag,
897    p_effective_date             => p_effective_date,
898    p_object_version_number      => p_rec.object_version_number);
899   --
900   chk_mn_mx_pct_val
901   (p_pct_fl_tm_fctr_id          => p_rec.pct_fl_tm_fctr_id,
902    p_no_mn_pct_val_flag         => p_rec.no_mn_pct_val_flag,
903    p_mn_pct_val                 => p_rec.mn_pct_val,
904    p_no_mx_pct_val_flag         => p_rec.no_mx_pct_val_flag,
905    p_mx_pct_val                 => p_rec.mx_pct_val,
906    p_object_version_number      => p_rec.object_version_number);
907  --
908   chk_name
909   (p_pct_fl_tm_fctr_id          => p_rec.pct_fl_tm_fctr_id,
910    p_business_group_id          => p_rec.business_group_id,
911    p_name                       => p_rec.name,
912    p_effective_date             => p_effective_date,
913    p_object_version_number      => p_rec.object_version_number);
914   --
915   --
916   hr_utility.set_location(' Leaving:'||l_proc, 10);
917 End update_validate;
918 --
919 -- ----------------------------------------------------------------------------
920 -- |---------------------------< delete_validate >----------------------------|
921 -- ----------------------------------------------------------------------------
922 Procedure delete_validate(p_rec in ben_pff_shd.g_rec_type
923                          ,p_effective_date in date) is
924 --
925   l_proc  varchar2(72) := g_package||'delete_validate';
926 --
927 Begin
928   hr_utility.set_location('Entering:'||l_proc, 5);
929   --
930   -- Call all supporting business operations
931   --
932   chk_child_records(p_pct_fl_tm_fctr_id => p_rec.pct_fl_tm_fctr_id); --Bug 2978945
933   hr_utility.set_location(' Leaving:'||l_proc, 10);
934 End delete_validate;
935 --
936 --
937 --  ---------------------------------------------------------------------------
938 --  |---------------------< return_legislation_code >-------------------------|
939 --  ---------------------------------------------------------------------------
940 --
941 function return_legislation_code
942   (p_pct_fl_tm_fctr_id in number) return varchar2 is
943   --
944   -- Declare cursor
945   --
946   cursor csr_leg_code is
947     select a.legislation_code
948     from   per_business_groups a,
949            ben_pct_fl_tm_fctr b
950     where b.pct_fl_tm_fctr_id      = p_pct_fl_tm_fctr_id
951     and   a.business_group_id = b.business_group_id;
952   --
953   -- Declare local variables
954   --
955   l_legislation_code  varchar2(150);
956   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
957   --
958 begin
959   --
960   hr_utility.set_location('Entering:'|| l_proc, 10);
961   --
962   -- Ensure that all the mandatory parameter are not null
963   --
964   hr_api.mandatory_arg_error(p_api_name       => l_proc,
965                              p_argument       => 'pct_fl_tm_fctr_id',
966                              p_argument_value => p_pct_fl_tm_fctr_id);
967   --
968   open csr_leg_code;
969     --
970     fetch csr_leg_code into l_legislation_code;
971     --
972     if csr_leg_code%notfound then
973       --
974       close csr_leg_code;
975       --
976       -- The primary key is invalid therefore we must error
977       --
978       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
979       fnd_message.raise_error;
980       --
981     end if;
982     --
983   close csr_leg_code;
984   --
985   hr_utility.set_location(' Leaving:'|| l_proc, 20);
986   --
987   return l_legislation_code;
988   --
989 end return_legislation_code;
990 --
991 end ben_pff_bus;