DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ESH_BUS

Source


1 Package Body ben_esh_bus as
2 /* $Header: beeshrhi.pkb 120.0 2005/05/28 02:56:41 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_esh_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_elig_schedd_hrs_prte_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 --   elig_schedd_hrs_prte_id PK of record being inserted or updated.
24 --   effective_date Effective Date of session
25 --   object_version_number Object version number of record being
29 --   Processing continues
26 --                         inserted or updated.
27 --
28 -- Post Success
30 --
31 -- Post Failure
32 --   Errors handled by the procedure
33 --
34 -- Access Status
35 --   Internal table handler use only.
36 --
37 Procedure chk_elig_schedd_hrs_prte_id(p_elig_schedd_hrs_prte_id     in number,
38                                       p_effective_date              in date,
39                                       p_object_version_number       in number) is
40   --
41   l_proc         varchar2(72) := g_package||'chk_elig_schedd_hrs_prte_id';
42   l_api_updating boolean;
43   --
44 Begin
45   --
46   hr_utility.set_location('Entering:'||l_proc, 5);
47   --
48   l_api_updating := ben_esh_shd.api_updating
49     (p_effective_date              => p_effective_date,
50      p_elig_schedd_hrs_prte_id                => p_elig_schedd_hrs_prte_id,
51      p_object_version_number       => p_object_version_number);
52   --
53   if (l_api_updating
54      and nvl(p_elig_schedd_hrs_prte_id,hr_api.g_number)
55      <>  ben_esh_shd.g_old_rec.elig_schedd_hrs_prte_id) then
56     --
57     -- raise error as PK has changed
58     --
59     ben_esh_shd.constraint_error('BEN_ELIG_SCH_HRS_PK');
60     --
61   elsif not l_api_updating then
62     --
63     -- check if PK is null
64     --
65     if p_elig_schedd_hrs_prte_id is not null then
66       --
67       -- raise error as PK is not null
68       --
69       ben_esh_shd.constraint_error('BEN_ELIG_SCH_HRS_PK');
70       --
71     end if;
72     --
73   end if;
74   --
75   hr_utility.set_location('Leaving:'||l_proc, 10);
76   --
77 End chk_elig_schedd_hrs_prte_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |------< chk_excld_flag >------|
81 -- ----------------------------------------------------------------------------
82 --
83 -- Description
84 --   This procedure is used to check that the lookup value is valid.
85 --
86 -- Pre Conditions
87 --   None.
88 --
89 -- In Parameters
90 --   elig_schedd_hrs_prte_id PK of record being inserted or updated.
91 --   excld_flag Value of lookup code.
92 --   effective_date effective date
93 --   object_version_number Object version number of record being
94 --                         inserted or updated.
95 --
96 -- Post Success
97 --   Processing continues
98 --
99 -- Post Failure
100 --   Error handled by procedure
101 --
102 -- Access Status
103 --   Internal table handler use only.
104 --
105 Procedure chk_excld_flag(p_elig_schedd_hrs_prte_id                in number,
106                             p_excld_flag               in varchar2,
107                             p_effective_date              in date,
108                             p_object_version_number       in number) is
109   --
110   l_proc         varchar2(72) := g_package||'chk_excld_flag';
111   l_api_updating boolean;
112   --
113 Begin
114   --
115   hr_utility.set_location('Entering:'||l_proc, 5);
116   --
117   l_api_updating := ben_esh_shd.api_updating
118     (p_elig_schedd_hrs_prte_id                => p_elig_schedd_hrs_prte_id,
119      p_effective_date              => p_effective_date,
120      p_object_version_number       => p_object_version_number);
121   --
122   if (l_api_updating
123       and p_excld_flag
124       <> nvl(ben_esh_shd.g_old_rec.excld_flag,hr_api.g_varchar2)
125       or not l_api_updating) then
126     --
127     -- check if value of lookup falls within lookup type.
128     --
129     --
130     if hr_api.not_exists_in_hr_lookups
131           (p_lookup_type    => 'YES_NO',
132            p_lookup_code    => p_excld_flag,
133            p_effective_date => p_effective_date) then
134       --
135       -- raise error as does not exist as lookup
136       --
137       fnd_message.set_name('PAY','HR_LOOKUP_DOES_NOT_EXIST');
138       fnd_message.raise_error;
139       --
140     end if;
141     --
142   end if;
143   --
144   hr_utility.set_location('Leaving:'||l_proc,10);
145   --
146 end chk_excld_flag;
147 
148 -- ---------------------------------------------------------------------------
149 -- |-----------------------< chk_duplicate_ordr_num >---------------------------|
150 -- ---------------------------------------------------------------------------
151 --
152 -- Description
153 --   Ensure that the Sequence Number is unique
154 --   within business_group
155 --
156 -- Pre Conditions
157 --   None.
158 --
159 -- In Parameters
160 --   p_elig_schedd_hrs_prte_id    p_elig_schedd_hrs_prte_id
161 --   p_eligy_prfl_id        eligy_prfl_id
162 --   p_ordr_num             Sequence Number
163 --   p_business_group_id    Business Group id.
164 --
165 -- Post Success
166 --   Processing continues
167 --
168 -- Post Failure
169 --   Errors handled by the procedure
170 --
171 -- Access Status
172 --   Internal table handler use only
173 --
174 -- ----------------------------------------------------------------------------
175 Procedure chk_duplicate_ordr_num
176           ( p_elig_schedd_hrs_prte_id     in   number
177            ,p_eligy_prfl_id         in   number
178            ,p_ordr_num              in   number
179            ,p_business_group_id     in   number)
180 is
181   l_proc     varchar2(72) := g_package||'chk_duplicate_ordr_num';
182   l_dummy    char(1);
186     where  elig_schedd_hrs_prte_id <> nvl(p_elig_schedd_hrs_prte_id,-1)
183   cursor c1 is
184     select null
185     from   ben_elig_schedd_hrs_prte_f
187     and    eligy_prfl_id = p_eligy_prfl_id
188     and    ordr_num = p_ordr_num
189     and    business_group_id = p_business_group_id;
190 --
191 Begin
192   hr_utility.set_location('Entering:'||l_proc, 5);
193   --
194   open c1;
195   fetch c1 into l_dummy;
196   if c1%found then
197     close c1;
198     fnd_message.set_name('BEN','BEN_91001_SEQ_NOT_UNIQUE');
199     fnd_message.raise_error;
200   end if;
201   close c1;
202   --
203   hr_utility.set_location('Leaving:'||l_proc, 15);
204 End chk_duplicate_ordr_num;
205 --
206 
207 -- ----------------------------------------------------------------------------
208 -- |------< chk_dup_criteria >------|
209 -- ----------------------------------------------------------------------------
210 --
211 -- Description
212 --   This procedure is used to check for duplicate criteria.
213 --
214 -- Pre Conditions
215 --   None.
216 --
217 -- In Parameters
218 --   elig_schedd_hrs_prte_id PK of record being inserted or updated.
219 --   effective_date effective date
220 --   object_version_number Object version number of record being
221 --                         inserted or updated.
222 --
223 -- Post Success
224 --   Processing continues
225 --
226 -- Post Failure
227 --   Error handled by procedure
228 --
229 -- Access Status
230 --   Internal table handler use only.
231 --
232 Procedure chk_dup_criteria(p_elig_schedd_hrs_prte_id     in number,
233                       p_freq_cd                     in varchar2,
234                       p_hrs_num                     in number,
235                       p_max_hrs_num                 in number,
236                       p_schedd_hrs_rl               in number,
237                       p_eligy_prfl_id               in number,
238                       p_validation_start_date       in date,
239                       p_validation_end_date         in date,
240                       p_business_group_id           in number,
241                       p_effective_date              in date,
242                       p_object_version_number       in number) is
243   --
244   l_proc         varchar2(72) := g_package||'chk_dup_criteria';
245   l_api_updating boolean;
246   l_exists       varchar2(1);
247   --
248   --
249   cursor c3 is
250      select null
251        from ben_elig_schedd_hrs_prte_f
252          where nvl(freq_cd,hr_api.g_number) = nvl(p_freq_cd,hr_api.g_number)
253            and nvl(hrs_num,hr_api.g_number) = nvl(p_hrs_num,hr_api.g_number)
254            and nvl(max_hrs_num,hr_api.g_number) = nvl(p_max_hrs_num,hr_api.g_number)
255            and nvl(schedd_hrs_rl,hr_api.g_number) = nvl(p_schedd_hrs_rl,hr_api.g_number)
256            and eligy_prfl_id = p_eligy_prfl_id
257            and elig_schedd_hrs_prte_id <> nvl(p_elig_schedd_hrs_prte_id,hr_api.g_number)
258            and business_group_id + 0 = p_business_group_id
259            and p_validation_start_date <= effective_end_date
260            and p_validation_end_date >= effective_start_date
261            ;
262   --
263   --
264 Begin
265   --
266   hr_utility.set_location('Entering:'||l_proc, 5);
267   --
268   l_api_updating := ben_esh_shd.api_updating
269     (p_elig_schedd_hrs_prte_id     => p_elig_schedd_hrs_prte_id,
270      p_effective_date              => p_effective_date,
271      p_object_version_number       => p_object_version_number);
272   --
273  /* if (l_api_updating
274       and p_freq_cd
275       <> nvl(ben_esh_shd.g_old_rec.freq_cd,hr_api.g_varchar2)
276       or not l_api_updating)
277       and p_freq_cd is not null then
278    */
279     --
280             --
281     open c3;
282     fetch c3 into l_exists;
283     if c3%found then
284       close c3;
285       --
286       -- raise error as this criteria already exists for this profile
287       --
288      fnd_message.set_name('BEN', 'BEN_91349_DUP_ELIG_CRITERIA');
289      fnd_message.raise_error;
290     --
291     end if;
292     close c3;
293     --
294   -- end if;
295   --
296   hr_utility.set_location('Leaving:'||l_proc,10);
297   --
298 end chk_dup_criteria;
299 --
300 
301 
302 --
303 -- ----------------------------------------------------------------------------
304 -- |------< chk_freq_cd >------|
305 -- ----------------------------------------------------------------------------
306 --
307 -- Description
308 --   This procedure is used to check that the lookup value is valid.
309 --
310 -- Pre Conditions
311 --   None.
312 --
313 -- In Parameters
314 --   elig_schedd_hrs_prte_id PK of record being inserted or updated.
315 --   freq_cd Value of lookup code.
316 --   effective_date effective date
317 --   object_version_number Object version number of record being
318 --                         inserted or updated.
319 --
320 -- Post Success
321 --   Processing continues
322 --
323 -- Post Failure
324 --   Error handled by procedure
325 --
326 -- Access Status
327 --   Internal table handler use only.
328 --
329 Procedure chk_freq_cd(p_elig_schedd_hrs_prte_id     in number,
330                       p_freq_cd                     in varchar2,
331                       p_hrs_num                     in number,
332                       p_max_hrs_num                 in number,
333                       p_effective_date              in date,
334                       p_object_version_number       in number) is
335   --
336   l_proc         varchar2(72) := g_package||'chk_freq_cd';
340   --
337   l_api_updating boolean;
338   l_exists       varchar2(1);
339   --
341 
342 Begin
343   --
344   hr_utility.set_location('Entering:'||l_proc, 5);
345   --
346   l_api_updating := ben_esh_shd.api_updating
347     (p_elig_schedd_hrs_prte_id     => p_elig_schedd_hrs_prte_id,
348      p_effective_date              => p_effective_date,
349      p_object_version_number       => p_object_version_number);
350   --
351   if (l_api_updating
352       and p_freq_cd
353       <> nvl(ben_esh_shd.g_old_rec.freq_cd,hr_api.g_varchar2)
354       or not l_api_updating)
355       and p_freq_cd is not null then
356     --
357     -- check if value of lookup falls within lookup type.
358     --
359     if hr_api.not_exists_in_hr_lookups
360           (p_lookup_type    => 'FREQUENCY',
361            p_lookup_code    => p_freq_cd,
362            p_effective_date => p_effective_date) then
363       --
364       -- raise error as does not exist as lookup
365       --
366       fnd_message.set_name('PAY','HR_LOOKUP_DOES_NOT_EXIST');
367       fnd_message.raise_error;
368       --
369     end if;
370     --
371     if p_hrs_num is null and p_max_hrs_num is null then
372     	fnd_message.set_name('BEN','BEN_93222_MIN_MAX_HRS_NOT_NULL');
373       	fnd_message.raise_error;
374     end if;
375     --
376   end if;
377   --
378   hr_utility.set_location('Leaving:'||l_proc,10);
379   --
380 end chk_freq_cd;
381 --
382 
383 -- ----------------------------------------------------------------------------
384 -- |------< check_determination_cd >------|
385 -- ----------------------------------------------------------------------------
386 --
387 -- Description
388 --   This procedure is used to check that the lookup value is valid.
389 --
390 -- Pre Conditions
391 --   None.
392 --
393 -- In Parameters
394 --   elig_schedd_hrs_prte_id PK of record being inserted or updated.
395 --   determination_cd Value of lookup code.
396 --   effective_date effective date
397 --   object_version_number Object version number of record being
398 --                         inserted or updated.
399 --
400 -- Post Success
401 --   Processing continues
402 --
403 -- Post Failure
404 --   Error handled by procedure
405 --
406 -- Access Status
407 --   Internal table handler use only.
408 --
409 Procedure check_determination_cd(p_elig_schedd_hrs_prte_id     in number,
410                       p_determination_cd                     in varchar2,
411                       p_determination_rl                     in number,
412                       p_effective_date              in date,
413                       p_object_version_number       in number) is
414   --
415   l_proc         varchar2(72) := g_package||'check_determination_cd';
416   l_api_updating boolean;
417   l_exists       varchar2(1);
418   --
419   --
420 Begin
421   --
422   hr_utility.set_location('Entering:'||l_proc, 5);
423   --
424   l_api_updating := ben_esh_shd.api_updating
425     (p_elig_schedd_hrs_prte_id     => p_elig_schedd_hrs_prte_id,
426      p_effective_date              => p_effective_date,
427      p_object_version_number       => p_object_version_number);
428   --
429   if (l_api_updating
430       and p_determination_cd
431       <> nvl(ben_esh_shd.g_old_rec.determination_cd,hr_api.g_varchar2)
432       or not l_api_updating)
433       and p_determination_cd is not null then
434     --
435     -- check if value of lookup falls within lookup type.
436     --
437     if hr_api.not_exists_in_hr_lookups
438           (p_lookup_type    => 'BEN_LOS_DET',
439            p_lookup_code    => p_determination_cd,
440            p_effective_date => p_effective_date) then
441       --
442       -- raise error as does not exist as lookup
443       --
444       fnd_message.set_name('PAY','HR_LOOKUP_DOES_NOT_EXIST');
445       fnd_message.raise_error;
446       --
447     end if;
448     --
449      if nvl(p_determination_cd,hr_api.g_number)='RL' and p_determination_rl is null then
450          -- raise error as rule is specified, but code is not 'RL'
451             --
452          fnd_message.set_name('BEN','BEN_91098_LOS_DET_RL_NULL');
453          fnd_message.raise_error;
454             --
455       end if;
456 
457       if p_determination_rl is not null and nvl(p_determination_cd,hr_api.g_varchar2) <> 'RL' then
458          -- raise error as rule is specified, but code is not 'RL'
459          --
460           fnd_message.set_name('BEN','BEN_91071_LOS_DET_RL_NOT_NULL');
461           fnd_message.raise_error;
462           --
463        end if;
464     --
465   end if;
466   --
467   hr_utility.set_location('Leaving:'||l_proc,10);
468   --
469 end check_determination_cd;
470 --
471 
472 
473 
474 
475 -- ----------------------------------------------------------------------------
476 -- |------< check_rounding_cd >------|
477 -- ----------------------------------------------------------------------------
478 --
479 -- Description
480 --   This procedure is used to check that the lookup value is valid.
481 --
482 -- Pre Conditions
483 --   None.
484 --
485 -- In Parameters
486 --   elig_schedd_hrs_prte_id PK of record being inserted or updated.
487 --   rounding_cd Value of lookup code.
488 --   effective_date effective date
489 --   object_version_number Object version number of record being
490 --                         inserted or updated.
491 --
492 -- Post Success
493 --   Processing continues
494 --
495 -- Post Failure
496 --   Error handled by procedure
497 --
501 Procedure check_rounding_cd(p_elig_schedd_hrs_prte_id     in number,
498 -- Access Status
499 --   Internal table handler use only.
500 --
502                       p_rounding_cd                     in varchar2,
503                       p_rounding_rl                     in number,
504                       p_effective_date              in date,
505                       p_object_version_number       in number) is
506   --
507   l_proc         varchar2(72) := g_package||'check_rounding_cd';
508   l_api_updating boolean;
509   l_exists       varchar2(1);
510   --
511   --
512 Begin
513   --
514   hr_utility.set_location('Entering:'||l_proc, 5);
515   --
516   l_api_updating := ben_esh_shd.api_updating
517     (p_elig_schedd_hrs_prte_id     => p_elig_schedd_hrs_prte_id,
518      p_effective_date              => p_effective_date,
519      p_object_version_number       => p_object_version_number);
520   --
521   if (l_api_updating
522       and p_rounding_cd
523       <> nvl(ben_esh_shd.g_old_rec.rounding_cd,hr_api.g_varchar2)
524       or not l_api_updating)
525       and p_rounding_cd is not null then
526     --
527     if nvl(p_rounding_cd,hr_api.g_number)='RL' and p_rounding_rl is null then
528          -- raise error as rule is specified, but code is not 'RL'
529           --
530              fnd_message.set_name('BEN','BEN_91733_RNDG_RULE');
531              fnd_message.raise_error;
532            --
533       end if;
534 
535      if p_rounding_rl is not null and nvl(p_rounding_cd,hr_api.g_varchar2) <> 'RL' then
536           -- raise error as rule is specified, but code is not 'RL'
537             --
538                fnd_message.set_name('BEN','BEN_91043_RNDG_RL_NOT_NULL');
539                fnd_message.raise_error;
540             --
541       end if;
542 
543 
544       -- check if value of lookup falls within lookup type.
545       --
546       if hr_api.not_exists_in_hr_lookups
547             (p_lookup_type    => 'BEN_RNDG',
551         -- raise error as does not exist as lookup
548              p_lookup_code    => p_rounding_cd,
549              p_effective_date => p_effective_date) then
550         --
552         --
553         fnd_message.set_name('PAY','HR_LOOKUP_DOES_NOT_EXIST');
554         fnd_message.raise_error;
555         --
556       end if;
557     --
558   end if;
559   --
560   hr_utility.set_location('Leaving:'||l_proc,10);
561   --
562 end check_rounding_cd;
563 --
564 -- ----------------------------------------------------------------------------
565 -- |---------------------------< match_formula_type >-------------------------|
566 -- ----------------------------------------------------------------------------
567 -- {Start Of Comments}
568 --
569 -- Description:
570 --              To check that the rule is of the correct type
571 -- Prerequisites:
572 --              None
573 -- In Parameters:
577 -- Returns:
574 --      p_formula_id    - formula_number of the corresponding rule
575 --      p_formula_type_id       - formula_type required
576 --      p_effective_date - effective date
578 --              boolean (true -> if the formula_type_id matches with the DB values
579 --                               false -> otherwise)
580 -- Post Success:
581 --              processing continues.
582 -- Post Failure:
583 --              error handled by procedure
584 -- Developer Implementation Notes:
585 --              Select the rule type from DB based on the number provided.
586 --              if the rule type matches return true, else false
587 -- Access Status:
588 --      Internal table handler use only.
589 -- {End Of Comments}
590 -- ----------------------------------------------------------------------------
591 
592 Function match_formula_type
593  (p_rl			number,
594   p_formula_type_id	number,
595   p_effective_date 	date)
596 Return Boolean
597 is
598   l_proc	varchar2(72) := g_package||'match_formula_type';
599   l_formula_type_id	ff_formula_types.formula_type_id%type;
600   l_exists       varchar2(1);
601   cursor c_rule is
602   	select null
603   	  from ff_formulas_f ff
604   	 where ff.formula_id = p_rl
605   	   and ff.formula_type_id = p_formula_type_id
606   	   and p_effective_date
607   	   between ff.effective_start_date and ff.effective_end_date;
608 --
609 Begin
610 
611 open c_rule;
612     fetch c_rule into l_exists;
613     if c_rule%notfound then
614 	close c_rule;
615 	hr_utility.set_location(' Leaving:'||l_proc, 10);
616 	return false;
617     end if;
618 hr_utility.set_location(' Leaving:'||l_proc, 10);
619 close c_rule;
620 return true;
621 --
622 
623 
624 End match_formula_type;
625 
626 
627 
628 
629 -- ----------------------------------------------------------------------------
630 -- |------< check_determination_rl >------|
631 -- ----------------------------------------------------------------------------
632 --
633 -- Description
634 --   This procedure is used to check that the lookup value is valid.
635 --
636 -- Pre Conditions
637 --   None.
638 --
639 -- In Parameters
640 --   elig_schedd_hrs_prte_id PK of record being inserted or updated.
641 --   determination_rl - Value of Determination Rule.
642 --   determination_cd - Value of the determination Code
643 --   effective_date - effective date
644 --   object_version_number Object version number of record being
645 --                         inserted or updated.
646 --
647 -- Post Success
648 --   Processing continues
649 --
650 -- Post Failure
651 --   Error handled by procedure
652 --
653 -- Access Status
654 --   Internal table handler use only.
655 --
656 Procedure check_determination_rl(p_elig_schedd_hrs_prte_id     in number,
657                       p_determination_rl                     in number,
658                       p_determination_cd	    in varchar2,
659                       p_effective_date              in date,
660                       p_object_version_number       in number) is
661   --
662   l_proc         varchar2(72) := g_package||'check_determination_rl';
663   l_api_updating boolean;
664   l_exists       varchar2(1);
665   --
666   --
667 Begin
668   --
669   hr_utility.set_location('Entering:'||l_proc, 5);
670   --
671   l_api_updating := ben_esh_shd.api_updating
672     (p_elig_schedd_hrs_prte_id     => p_elig_schedd_hrs_prte_id,
673      p_effective_date              => p_effective_date,
674      p_object_version_number       => p_object_version_number);
675   --
676   if (l_api_updating
677       and p_determination_rl
678       <> nvl(ben_esh_shd.g_old_rec.determination_rl,hr_api.g_number)
679       or not l_api_updating)
680     --  and p_determination_cd is not null
681       and p_determination_rl is not null then
682     --
683     -- check if formula exists.
684     --
685      if p_determination_rl is not null and nvl(p_determination_cd,hr_api.g_varchar2) <> 'RL' then
686         -- raise error as rule is specified, but code is not 'RL'
687   	   --
688            fnd_message.set_name('BEN','BEN_91071_LOS_DET_RL_NOT_NULL');
689     	   fnd_message.raise_error;
690     	      --
691       end if;
692 
693      if nvl(p_determination_cd,hr_api.g_number)='RL' and p_determination_rl is null then
694        	-- raise error as rule is specified, but code is not 'RL'
695           --
696   	   fnd_message.set_name('BEN','BEN_91098_LOS_DET_RL_NULL');
697 	   fnd_message.raise_error;
698 	  --
699       end if;
700 
701       if nvl(p_determination_cd,hr_api.g_varchar2)='RL' then
702     	        if not match_formula_type(p_rl => p_determination_rl,
703     			p_formula_type_id => -170,p_effective_date => p_effective_date) then
704     	      --
705     	      -- raise error as forumula type not exists
706 
707     	      	fnd_message.set_name('BEN','BEN_91066_INVLD_LOS_DET_RL');
708     	     	 fnd_message.raise_error;
709     	    	 end if;
710     	     --
711         end if;
712      --
713   end if;
714   --
715   hr_utility.set_location('Leaving:'||l_proc,10);
716   --
717 end check_determination_rl;
718 --
719 
720 --
721 
722 
723 -- ----------------------------------------------------------------------------
724 -- |------< check_rounding_rl >------|
728 --   This procedure is used to check that the lookup value is valid.
725 -- ----------------------------------------------------------------------------
726 --
727 -- Description
729 --
730 -- Pre Conditions
731 --   None.
732 --
733 -- In Parameters
734 --   elig_schedd_hrs_prte_id PK of record being inserted or updated.
735 --   rounding_rl - Value of rounding Rule.
736 --   rounding_cd - Value of the rounding Code
737 --   effective_date - effective date
738 --   object_version_number Object version number of record being
739 --                         inserted or updated.
740 --
741 -- Post Success
742 --   Processing continues
743 --
744 -- Post Failure
745 --   Error handled by procedure
746 --
747 -- Access Status
748 --   Internal table handler use only.
749 --
750 Procedure check_rounding_rl(p_elig_schedd_hrs_prte_id     in number,
751                       p_rounding_rl                     in number,
752                       p_rounding_cd	    in varchar2,
753                       p_effective_date              in date,
754                       p_object_version_number       in number) is
755   --
756   l_proc         varchar2(72) := g_package||'check_rounding_rl';
757   l_api_updating boolean;
758   l_exists       varchar2(1);
759   --
760   --
761 Begin
762   --
763   hr_utility.set_location('Entering:'||l_proc, 5);
764   --
765   l_api_updating := ben_esh_shd.api_updating
766     (p_elig_schedd_hrs_prte_id     => p_elig_schedd_hrs_prte_id,
767      p_effective_date              => p_effective_date,
768      p_object_version_number       => p_object_version_number);
769   --
770   if (l_api_updating
771       and p_rounding_rl
772       <> nvl(ben_esh_shd.g_old_rec.rounding_rl,hr_api.g_number)
773       or not l_api_updating)
774     --  and p_rounding_cd is not null
775       and p_rounding_rl is not null then
776     --
777 
778      if p_rounding_rl is not null and nvl(p_rounding_cd,hr_api.g_varchar2) <> 'RL' then
779          -- raise error as rule is specified, but code is not 'RL'
780 
781         	 fnd_message.set_name('BEN','BEN_91043_RNDG_RL_NOT_NULL');
782         	 fnd_message.raise_error;
783         	    --
784       end if;
785 
786       if nvl(p_rounding_cd,hr_api.g_number)='RL' and p_rounding_rl is null then
787      	  -- raise error as rule is specified, but code is not 'RL'
788      	     --
789      	        fnd_message.set_name('BEN','BEN_91733_RNDG_RULE');
790      	        fnd_message.raise_error;
791              --
792        end if;
793 
794       if nvl(p_rounding_cd,hr_api.g_varchar2)='RL' then
795                if not match_formula_type(p_rl => p_rounding_rl,
796          			p_formula_type_id => -169,p_effective_date => p_effective_date) then
797          	      -- raise error as forumula type not exists
798          	      --
799          	      fnd_message.set_name('BEN','BEN_91042_INVALID_RNDG_RL');
800          	      fnd_message.raise_error;
801          	     end if;
802          	     --
803         end if;
804      --
805   end if;
806   --
807   hr_utility.set_location('Leaving:'||l_proc,10);
808   --
809 end check_rounding_rl;
810 --
811 
812 -- ----------------------------------------------------------------------------
813 -- |------< check_schedd_hrs_rl >------|
814 -- ----------------------------------------------------------------------------
815 --
816 -- Description
817 --   This procedure is used to check that the lookup value is valid.
818 --
819 -- Pre Conditions
820 --   None.
821 --
822 -- In Parameters
823 --   elig_schedd_hrs_prte_id PK of record being inserted or updated.
824 --   schedd_hrs_rl - Value of schedd_hrs Rule.
825 --   schedd_hrs_cd - Value of the schedd_hrs Code
826 --   effective_date - effective date
827 --   object_version_number Object version number of record being
828 --                         inserted or updated.
829 --
830 -- Post Success
831 --   Processing continues
832 --
833 -- Post Failure
834 --   Error handled by procedure
835 --
836 -- Access Status
837 --   Internal table handler use only.
838 --
839 Procedure check_schedd_hrs_rl(p_elig_schedd_hrs_prte_id     in number,
840                       p_schedd_hrs_rl                     in number,
841                       p_effective_date              in date,
842                       p_object_version_number       in number) is
843   --
844   l_proc         varchar2(72) := g_package||'check_schedd_hrs_rl';
845   l_api_updating boolean;
846   l_exists       varchar2(1);
847   --
848   --
849 Begin
850   --
851   hr_utility.set_location('Entering:'||l_proc, 5);
852   --
853   l_api_updating := ben_esh_shd.api_updating
854     (p_elig_schedd_hrs_prte_id     => p_elig_schedd_hrs_prte_id,
855      p_effective_date              => p_effective_date,
856      p_object_version_number       => p_object_version_number);
857   --
858   if (l_api_updating
859       and p_schedd_hrs_rl
860       <> nvl(ben_esh_shd.g_old_rec.schedd_hrs_rl,hr_api.g_number)
861       or not l_api_updating)
862       and p_schedd_hrs_rl is not null then
863     --
864     -- check if formula exists.
865     --
866     if match_formula_type(p_rl => p_schedd_hrs_rl,p_formula_type_id => -548,
867     p_effective_date => p_effective_date) then
868       --
869       -- raise error as forumula type not exists
870       --
871       fnd_message.set_name('BEN','BEN_93221_SCH_HRS_RL_INVALID');
872       fnd_message.raise_error;
873       --
874     end if;
875     --
876     --
877   end if;
878   --
879   hr_utility.set_location('Leaving:'||l_proc,10);
880   --
884 -- ----------------------------------------------------------------------------
881 end check_schedd_hrs_rl;
882 --
883 
885 -- |------< check_min_or_max >------|
886 -- ----------------------------------------------------------------------------
887 --
888 -- Description
889 --   This procedure is used to check that the lookup value is valid.
890 --
891 -- Pre Conditions
892 --   None.
893 --
894 -- In Parameters
895 --   elig_schedd_hrs_prte_id PK of record being inserted or updated.
896 --   p_hrs_num and p_max_hrs_num
897 --   p_freq_cd
898 --   effective_date effective date
899 --   object_version_number Object version number of record being
900 --                         inserted or updated.
901 --
902 -- Post Success
903 --   Processing continues
904 --
905 -- Post Failure
906 --   Error handled by procedure
907 --
908 -- Access Status
909 --   Internal table handler use only.
910 --
911 Procedure check_min_or_max(p_elig_schedd_hrs_prte_id     in number,
912                       p_hrs_num                     in number,
913                       p_max_hrs_num		    in number,
914                       p_freq_cd			    in varchar2,
915                       p_effective_date              in date,
916                       p_object_version_number       in number) is
917   --
918   l_proc         varchar2(72) := g_package||'check_min_or_max';
919   l_api_updating boolean;
920   --
921   --
922 Begin
923   --
924   hr_utility.set_location('Entering:'||l_proc, 5);
925   --
926   l_api_updating := ben_esh_shd.api_updating
927     (p_elig_schedd_hrs_prte_id     => p_elig_schedd_hrs_prte_id,
928      p_effective_date              => p_effective_date,
929      p_object_version_number       => p_object_version_number);
930   --
931   if (l_api_updating and p_hrs_num <> nvl(ben_esh_shd.g_old_rec.hrs_num,hr_api.g_number))
932       or (l_api_updating and p_max_hrs_num <> nvl(ben_esh_shd.g_old_rec.max_hrs_num,hr_api.g_number))
933       or (l_api_updating and p_freq_cd <> nvl(ben_esh_shd.g_old_rec.freq_cd,hr_api.g_varchar2))
934       or not l_api_updating
935       or (nvl(p_hrs_num,hr_api.g_number) is not null and nvl(p_max_hrs_num,hr_api.g_number) is not null) then
936     --
937 	hr_utility.set_location('Inside:'||l_proc,8);
938 
939     -- check if min or max is null, if freq_cd is specified
940     -- note that this check is also there in the chk_freq_cd procedure.
941     if (p_hrs_num is null and p_max_hrs_num is null) then
942 	if p_freq_cd is not null then
943 		fnd_message.set_name('BEN', 'BEN_93222_MIN_MAX_HRS_NOT_NULL');
944       		fnd_message.raise_error;
945       	end if;
946     end if;
947     --
948 
949     -- check if freq_cd is not given
950     if (p_hrs_num is not null or p_max_hrs_num is not null) and p_freq_cd is null then
951     		fnd_message.set_name('BEN', 'BEN_93220_MIN_MAX_HRS_OR_RULE');
952           	fnd_message.raise_error;
953 
954     end if;
955 
956 
957 
958     -- check if value of min hours is greater than max hours
959     if not (p_hrs_num is null or p_max_hrs_num is null) then
960     	if nvl(p_hrs_num,hr_api.g_number) > nvl(p_max_hrs_num,hr_api.g_number) then
961 		fnd_message.set_name('BEN', 'BEN_91069_INVALID_MIN_MAX');
962 		fnd_message.raise_error;
963 	    end if;
964 
965     end if;
966     --
967   end if;
968   --
969   hr_utility.set_location('Leaving:'||l_proc,10);
970   --
971 end check_min_or_max;
972 --
973 
974 
975 
976 -- ----------------------------------------------------------------------------
977 -- |--------------------------< dt_update_validate >--------------------------|
978 -- ----------------------------------------------------------------------------
979 -- {Start Of Comments}
980 --
981 -- Description:
982 --   This procedure is used for referential integrity of datetracked
983 --   parent entities when a datetrack update operation is taking place
984 --   and where there is no cascading of update defined for this entity.
985 --
986 -- Prerequisites:
987 --   This procedure is called from the update_validate.
988 --
989 -- In Parameters:
990 --
991 -- Post Success:
992 --   Processing continues.
993 --
994 -- Post Failure:
995 --
996 -- Developer Implementation Notes:
997 --   This procedure should not need maintenance unless the HR Schema model
998 --   changes.
999 --
1000 -- Access Status:
1001 --   Internal Row Handler Use Only.
1002 --
1003 -- {End Of Comments}
1004 -- ----------------------------------------------------------------------------
1005 Procedure dt_update_validate
1006             (p_eligy_prfl_id                 in number default hr_api.g_number,
1007 	     p_datetrack_mode		     in varchar2,
1008              p_validation_start_date	     in date,
1009 	     p_validation_end_date	     in date) Is
1010 --
1011   l_proc	    varchar2(72) := g_package||'dt_update_validate';
1012   l_integrity_error Exception;
1013   l_table_name	    all_tables.table_name%TYPE;
1014 --
1015 Begin
1016   hr_utility.set_location('Entering:'||l_proc, 5);
1017   --
1018   -- Ensure that the p_datetrack_mode argument is not null
1019   --
1020   hr_api.mandatory_arg_error
1021     (p_api_name       => l_proc,
1022      p_argument       => 'datetrack_mode',
1023      p_argument_value => p_datetrack_mode);
1024   --
1025   -- Only perform the validation if the datetrack update mode is valid
1026   --
1027   If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
1028     --
1029     --
1030     -- Ensure the arguments are not null
1031     --
1032     hr_api.mandatory_arg_error
1033       (p_api_name       => l_proc,
1037     hr_api.mandatory_arg_error
1034        p_argument       => 'validation_start_date',
1035        p_argument_value => p_validation_start_date);
1036     --
1038       (p_api_name       => l_proc,
1039        p_argument       => 'validation_end_date',
1040        p_argument_value => p_validation_end_date);
1041     --
1042     If ((nvl(p_eligy_prfl_id, hr_api.g_number) <> hr_api.g_number) and
1043       NOT (dt_api.check_min_max_dates
1044             (p_base_table_name => 'ben_eligy_prfl_f',
1045              p_base_key_column => 'eligy_prfl_id',
1046              p_base_key_value  => p_eligy_prfl_id,
1047              p_from_date       => p_validation_start_date,
1048              p_to_date         => p_validation_end_date)))  Then
1049       l_table_name := 'ben_eligy_prfl_f';
1050       Raise l_integrity_error;
1051     End If;
1052     --
1053   End If;
1054   --
1055   hr_utility.set_location(' Leaving:'||l_proc, 10);
1056 Exception
1057   When l_integrity_error Then
1058     --
1059     -- A referential integrity check was violated therefore
1060     -- we must error
1061     --
1062     fnd_message.set_name('PAY', 'HR_7216_DT_UPD_INTEGRITY_ERR');
1063     fnd_message.set_token('TABLE_NAME', l_table_name);
1064     fnd_message.raise_error;
1065   When Others Then
1066     --
1067     -- An unhandled or unexpected error has occurred which
1068     -- we must report
1069     --
1070     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
1071     fnd_message.set_token('PROCEDURE', l_proc);
1072     fnd_message.set_token('STEP','15');
1073     fnd_message.raise_error;
1074 End dt_update_validate;
1075 --
1076 -- ----------------------------------------------------------------------------
1077 -- |--------------------------< dt_delete_validate >--------------------------|
1078 -- ----------------------------------------------------------------------------
1079 -- {Start Of Comments}
1080 --
1081 -- Description:
1082 --   This procedure is used for referential integrity of datetracked
1083 --   child entities when either a datetrack DELETE or ZAP is in operation
1084 --   and where there is no cascading of delete defined for this entity.
1085 --   For the datetrack mode of DELETE or ZAP we must ensure that no
1086 --   datetracked child rows exist between the validation start and end
1087 --   dates.
1088 --
1089 -- Prerequisites:
1090 --   This procedure is called from the delete_validate.
1091 --
1092 -- In Parameters:
1093 --
1094 -- Post Success:
1095 --   Processing continues.
1096 --
1097 -- Post Failure:
1098 --   If a row exists by determining the returning Boolean value from the
1099 --   generic dt_api.rows_exist function then we must supply an error via
1100 --   the use of the local exception handler l_rows_exist.
1101 --
1102 -- Developer Implementation Notes:
1103 --   This procedure should not need maintenance unless the HR Schema model
1104 --   changes.
1105 --
1106 -- Access Status:
1107 --   Internal Row Handler Use Only.
1108 --
1109 -- {End Of Comments}
1110 -- ----------------------------------------------------------------------------
1111 Procedure dt_delete_validate
1112             (p_elig_schedd_hrs_prte_id		in number,
1113              p_datetrack_mode		in varchar2,
1114 	     p_validation_start_date	in date,
1115 	     p_validation_end_date	in date) Is
1116 --
1117   l_proc	varchar2(72) 	:= g_package||'dt_delete_validate';
1118   l_rows_exist	Exception;
1119   l_table_name	all_tables.table_name%TYPE;
1120 --
1121 Begin
1122   hr_utility.set_location('Entering:'||l_proc, 5);
1123   --
1124   -- Ensure that the p_datetrack_mode argument is not null
1125   --
1126   hr_api.mandatory_arg_error
1127     (p_api_name       => l_proc,
1128      p_argument       => 'datetrack_mode',
1129      p_argument_value => p_datetrack_mode);
1130   --
1131   -- Only perform the validation if the datetrack mode is either
1132   -- DELETE or ZAP
1133   --
1134   If (p_datetrack_mode = 'DELETE' or
1135       p_datetrack_mode = 'ZAP') then
1136     --
1137     --
1138     -- Ensure the arguments are not null
1139     --
1140     hr_api.mandatory_arg_error
1141       (p_api_name       => l_proc,
1142        p_argument       => 'validation_start_date',
1143        p_argument_value => p_validation_start_date);
1144     --
1145     hr_api.mandatory_arg_error
1146       (p_api_name       => l_proc,
1147        p_argument       => 'validation_end_date',
1148        p_argument_value => p_validation_end_date);
1149     --
1150     hr_api.mandatory_arg_error
1151       (p_api_name       => l_proc,
1152        p_argument       => 'elig_schedd_hrs_prte_id',
1153        p_argument_value => p_elig_schedd_hrs_prte_id);
1154     --
1155     --
1156     --
1157   End If;
1158   --
1159   hr_utility.set_location(' Leaving:'||l_proc, 10);
1160 Exception
1161   When l_rows_exist Then
1162     --
1163     -- A referential integrity check was violated therefore
1164     -- we must error
1165     --
1166     fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
1167     fnd_message.set_token('TABLE_NAME', l_table_name);
1168     fnd_message.raise_error;
1169   When Others Then
1170     --
1171     -- An unhandled or unexpected error has occurred which
1172     -- we must report
1173     --
1174     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
1175     fnd_message.set_token('PROCEDURE', l_proc);
1176     fnd_message.set_token('STEP','15');
1177     fnd_message.raise_error;
1178 End dt_delete_validate;
1179 --
1180 -- ----------------------------------------------------------------------------
1181 -- |---------------------------< insert_validate >----------------------------|
1182 -- ----------------------------------------------------------------------------
1186 	 p_datetrack_mode	 in varchar2,
1183 Procedure insert_validate
1184 	(p_rec 			 in ben_esh_shd.g_rec_type,
1185 	 p_effective_date	 in date,
1187 	 p_validation_start_date in date,
1188 	 p_validation_end_date	 in date) is
1189 --
1190   l_proc	varchar2(72) := g_package||'insert_validate';
1191 --
1192 Begin
1193   hr_utility.set_location('Entering:'||l_proc, 5);
1194   --
1195   -- Call all supporting business operations
1196   --
1197   --
1198   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
1199   --
1200   chk_elig_schedd_hrs_prte_id
1201   (p_elig_schedd_hrs_prte_id          => p_rec.elig_schedd_hrs_prte_id,
1202    p_effective_date        => p_effective_date,
1203    p_object_version_number => p_rec.object_version_number);
1204   --
1205   chk_excld_flag
1206   (p_elig_schedd_hrs_prte_id => p_rec.elig_schedd_hrs_prte_id,
1207    p_excld_flag              => p_rec.excld_flag,
1208    p_effective_date          => p_effective_date,
1209    p_object_version_number   => p_rec.object_version_number);
1210   --
1211   chk_duplicate_ordr_num
1212       (p_elig_schedd_hrs_prte_id     => p_rec.elig_schedd_hrs_prte_id,
1213        p_eligy_prfl_id       	     => p_rec.eligy_prfl_id,
1214        p_ordr_num           	     => p_rec.ordr_num,
1215      p_business_group_id  	     => p_rec.business_group_id);
1216   --
1217 /*
1218 chk_dup_criteria(p_elig_schedd_hrs_prte_id      => p_rec.elig_schedd_hrs_prte_id,
1219                           p_freq_cd                 => p_rec.freq_cd,
1220                           p_hrs_num                 => p_rec.hrs_num,
1221                           p_max_hrs_num             => p_rec.max_hrs_num,
1222                           p_schedd_hrs_rl           => p_rec.schedd_hrs_rl,
1223                           p_eligy_prfl_id           => p_rec.eligy_prfl_id,
1224                           p_validation_start_date   => p_validation_start_date,
1225                           p_validation_end_date     => p_validation_end_date,
1226                           p_business_group_id       => p_rec.business_group_id,
1227                           p_effective_date          => p_effective_date,
1228                           p_object_version_number   => p_rec.object_version_number);
1229 */
1230 
1231   --
1232   chk_freq_cd
1233   (p_elig_schedd_hrs_prte_id => p_rec.elig_schedd_hrs_prte_id,
1234    p_freq_cd                 => p_rec.freq_cd,
1235    p_hrs_num                 => p_rec.hrs_num,
1236    p_max_hrs_num             => p_rec.max_hrs_num,
1237    p_effective_date          => p_effective_date,
1238    p_object_version_number   => p_rec.object_version_number);
1239   --
1240   check_determination_cd
1241     (p_elig_schedd_hrs_prte_id => p_rec.elig_schedd_hrs_prte_id,
1242      p_determination_cd        => p_rec.determination_cd,
1243      p_determination_rl          => p_rec.determination_rl,
1244      p_effective_date          => p_effective_date,
1245      p_object_version_number      => p_rec.object_version_number);
1246   --
1247   check_rounding_cd
1248       (p_elig_schedd_hrs_prte_id => p_rec.elig_schedd_hrs_prte_id,
1249        p_rounding_cd             => p_rec.rounding_cd,
1250        p_rounding_rl          => p_rec.rounding_rl,
1251        p_effective_date          => p_effective_date,
1252        p_object_version_number      => p_rec.object_version_number);
1253   --
1254   check_determination_rl
1255       (p_elig_schedd_hrs_prte_id   => p_rec.elig_schedd_hrs_prte_id,
1256        p_determination_rl          => p_rec.determination_rl,
1257        p_determination_cd	   => p_rec.determination_cd,
1258        p_effective_date           => p_effective_date,
1259        p_object_version_number    => p_rec.object_version_number);
1260   --
1261   check_rounding_rl
1262         (p_elig_schedd_hrs_prte_id   => p_rec.elig_schedd_hrs_prte_id,
1263          p_rounding_rl               => p_rec.rounding_rl,
1264          p_rounding_cd	             => p_rec.rounding_cd,
1265          p_effective_date            => p_effective_date,
1266          p_object_version_number     => p_rec.object_version_number);
1267   --
1268   check_schedd_hrs_rl
1269   	(p_elig_schedd_hrs_prte_id   => p_rec.elig_schedd_hrs_prte_id,
1270          p_schedd_hrs_rl             => p_rec.rounding_rl,
1271          p_effective_date            => p_effective_date,
1272          p_object_version_number     => p_rec.object_version_number);
1273   --
1274   check_min_or_max
1275   (p_elig_schedd_hrs_prte_id => p_rec.elig_schedd_hrs_prte_id,
1276    p_hrs_num                 => p_rec.hrs_num,
1277    p_max_hrs_num	     => p_rec.max_hrs_num,
1278    p_freq_cd		     => p_rec.freq_cd,
1279    p_effective_date          => p_effective_date,
1280    p_object_version_number     => p_rec.object_version_number);
1281   --
1282   hr_utility.set_location(' Leaving:'||l_proc, 10);
1283 End insert_validate;
1284 --
1285 -- ----------------------------------------------------------------------------
1286 -- |---------------------------< update_validate >----------------------------|
1287 -- ----------------------------------------------------------------------------
1288 Procedure update_validate
1289 	(p_rec 			 in ben_esh_shd.g_rec_type,
1290 	 p_effective_date	 in date,
1291 	 p_datetrack_mode	 in varchar2,
1292 	 p_validation_start_date in date,
1293 	 p_validation_end_date	 in date) is
1294 --
1295   l_proc	varchar2(72) := g_package||'update_validate';
1296 --
1297 Begin
1298   hr_utility.set_location('Entering:'||l_proc, 5);
1299   --
1300   -- Call all supporting business operations
1301   --
1302   --
1303   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
1304   --
1305   chk_elig_schedd_hrs_prte_id
1306   (p_elig_schedd_hrs_prte_id          => p_rec.elig_schedd_hrs_prte_id,
1307    p_effective_date        => p_effective_date,
1311   (p_elig_schedd_hrs_prte_id          => p_rec.elig_schedd_hrs_prte_id,
1308    p_object_version_number => p_rec.object_version_number);
1309   --
1310   chk_excld_flag
1312    p_excld_flag            => p_rec.excld_flag,
1313    p_effective_date        => p_effective_date,
1314    p_object_version_number => p_rec.object_version_number);
1315   --
1316     chk_duplicate_ordr_num
1317     (p_elig_schedd_hrs_prte_id      => p_rec.elig_schedd_hrs_prte_id,
1318      p_eligy_prfl_id       	    => p_rec.eligy_prfl_id,
1319      p_ordr_num           	    => p_rec.ordr_num,
1320      p_business_group_id  	    => p_rec.business_group_id);
1321   --
1322 /*
1323   chk_dup_criteria(p_elig_schedd_hrs_prte_id      => p_rec.elig_schedd_hrs_prte_id,
1324                         p_freq_cd                 => p_rec.freq_cd,
1325                         p_hrs_num                 => p_rec.hrs_num,
1326                         p_max_hrs_num             => p_rec.max_hrs_num,
1327                         p_schedd_hrs_rl           => p_rec.schedd_hrs_rl,
1328                         p_eligy_prfl_id           => p_rec.eligy_prfl_id,
1329                         p_validation_start_date   => p_validation_start_date,
1330                         p_validation_end_date     => p_validation_end_date,
1331                         p_business_group_id       => p_rec.business_group_id,
1332                         p_effective_date          => p_effective_date,
1333                         p_object_version_number   => p_rec.object_version_number);
1334 */
1335   --
1336   chk_freq_cd
1337   (p_elig_schedd_hrs_prte_id => p_rec.elig_schedd_hrs_prte_id,
1338    p_freq_cd                 => p_rec.freq_cd,
1339    p_hrs_num                 => p_rec.hrs_num,
1340    p_max_hrs_num             => p_rec.max_hrs_num,
1341    p_effective_date          => p_effective_date,
1342    p_object_version_number   => p_rec.object_version_number);
1343   --
1344   check_determination_cd
1345       (p_elig_schedd_hrs_prte_id => p_rec.elig_schedd_hrs_prte_id,
1346        p_determination_cd        => p_rec.determination_cd,
1347        p_determination_rl          => p_rec.determination_rl,
1348        p_effective_date          => p_effective_date,
1349        p_object_version_number   => p_rec.object_version_number);
1350   --
1351     check_rounding_cd
1352         (p_elig_schedd_hrs_prte_id => p_rec.elig_schedd_hrs_prte_id,
1353          p_rounding_cd             => p_rec.rounding_cd,
1354          p_rounding_rl          => p_rec.rounding_rl,
1355          p_effective_date          => p_effective_date,
1356          p_object_version_number   => p_rec.object_version_number);
1357   --
1358   check_determination_rl
1359         (p_elig_schedd_hrs_prte_id   => p_rec.elig_schedd_hrs_prte_id,
1360          p_determination_rl          => p_rec.determination_rl,
1361          p_determination_cd	   => p_rec.determination_cd,
1362          p_effective_date           => p_effective_date,
1363          p_object_version_number    => p_rec.object_version_number);
1364   --
1365     check_rounding_rl
1366           (p_elig_schedd_hrs_prte_id   => p_rec.elig_schedd_hrs_prte_id,
1367            p_rounding_rl          => p_rec.rounding_rl,
1368            p_rounding_cd	   => p_rec.rounding_cd,
1369            p_effective_date           => p_effective_date,
1370          p_object_version_number    => p_rec.object_version_number);
1371 --
1372   check_schedd_hrs_rl
1373   	(p_elig_schedd_hrs_prte_id   => p_rec.elig_schedd_hrs_prte_id,
1374          p_schedd_hrs_rl             => p_rec.rounding_rl,
1375          p_effective_date            => p_effective_date,
1376          p_object_version_number     => p_rec.object_version_number);
1377   --
1378  check_min_or_max
1379   (p_elig_schedd_hrs_prte_id  => p_rec.elig_schedd_hrs_prte_id,
1380    p_hrs_num                 => p_rec.hrs_num,
1381    p_max_hrs_num	     => p_rec.max_hrs_num,
1382    p_freq_cd		     => p_rec.freq_cd,
1383    p_effective_date          => p_effective_date,
1384    p_object_version_number     => p_rec.object_version_number);
1385 
1386   --
1387   -- Call the datetrack update integrity operation
1388   --
1389   dt_update_validate
1390     (p_eligy_prfl_id                 => p_rec.eligy_prfl_id,
1391      p_datetrack_mode                => p_datetrack_mode,
1392      p_validation_start_date	     => p_validation_start_date,
1393      p_validation_end_date	     => p_validation_end_date);
1394   --
1395   hr_utility.set_location(' Leaving:'||l_proc, 10);
1396 End update_validate;
1397 --
1398 -- ----------------------------------------------------------------------------
1399 -- |---------------------------< delete_validate >----------------------------|
1400 -- ----------------------------------------------------------------------------
1401 Procedure delete_validate
1402 	(p_rec 			 in ben_esh_shd.g_rec_type,
1403 	 p_effective_date	 in date,
1404 	 p_datetrack_mode	 in varchar2,
1405 	 p_validation_start_date in date,
1406 	 p_validation_end_date	 in date) is
1407 --
1408   l_proc	varchar2(72) := g_package||'delete_validate';
1409 --
1410 Begin
1411   hr_utility.set_location('Entering:'||l_proc, 5);
1412   --
1413   -- Call all supporting business operations
1414   --
1415   dt_delete_validate
1416     (p_datetrack_mode		=> p_datetrack_mode,
1417      p_validation_start_date	=> p_validation_start_date,
1418      p_validation_end_date	=> p_validation_end_date,
1419      p_elig_schedd_hrs_prte_id		=> p_rec.elig_schedd_hrs_prte_id);
1420   --
1421   hr_utility.set_location(' Leaving:'||l_proc, 10);
1422 End delete_validate;
1423 --
1424 --
1425 --  ---------------------------------------------------------------------------
1426 --  |---------------------< return_legislation_code >-------------------------|
1427 --  ---------------------------------------------------------------------------
1428 --
1429 function return_legislation_code
1430   (p_elig_schedd_hrs_prte_id in number) return varchar2 is
1431   --
1432   -- Declare cursor
1433   --
1434   cursor csr_leg_code is
1435     select a.legislation_code
1436     from   per_business_groups a,
1437            ben_elig_schedd_hrs_prte_f b
1438     where b.elig_schedd_hrs_prte_id      = p_elig_schedd_hrs_prte_id
1439     and   a.business_group_id = b.business_group_id;
1440   --
1441   -- Declare local variables
1442   --
1443   l_legislation_code  varchar2(150);
1444   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
1445   --
1446 begin
1447   --
1448   hr_utility.set_location('Entering:'|| l_proc, 10);
1449   --
1450   -- Ensure that all the mandatory parameter are not null
1451   --
1452   hr_api.mandatory_arg_error(p_api_name       => l_proc,
1453                              p_argument       => 'elig_schedd_hrs_prte_id',
1454                              p_argument_value => p_elig_schedd_hrs_prte_id);
1455   --
1456   open csr_leg_code;
1457     --
1458     fetch csr_leg_code into l_legislation_code;
1459     --
1460     if csr_leg_code%notfound then
1461       --
1462       close csr_leg_code;
1463       --
1464       -- The primary key is invalid therefore we must error
1465       --
1466       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
1467       fnd_message.raise_error;
1468       --
1469     end if;
1470     --
1471   close csr_leg_code;
1472   --
1473   hr_utility.set_location(' Leaving:'|| l_proc, 20);
1474   --
1475   return l_legislation_code;
1476   --
1477 end return_legislation_code;
1478 --
1479 end ben_esh_bus;