DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_RULES

Source


1 package body ben_rules as
2 /*$Header: benrules.pkb 120.1.12000000.1 2007/01/19 18:59:25 appldev ship $*/
3 --
4 /*
5 History
6   Version Date       Author     Comment
7   -------+----------+----------+---------------------------------------------------
8   115.0   08-Sep-99  maagrawa   Created.
9   115.1   18-Jan-00  pbodla     Fixed bug 4146(WWBUG 1120687)
10                                 p_business_group_id added to benutils.formula call.
11   115.4   30-Jun-06  swjain     5331889 - Passed ler_id and person_id in call to
12                                 benutils.formula in procedure chk_person_selection.
13   ---------------------------------------------------------------------------------
14 */
15 --
16 g_package    varchar2(80) := 'ben_rules';
17 --
18 function chk_person_selection
19     (p_person_selection_rule_id in number,
20      p_person_id                in number,
21      p_business_group_id        in number,
22      p_effective_date           in date,
23      p_ler_id                   in number) return boolean is
24   --
25   l_outputs       ff_exec.outputs_t;
26   l_assignment_id number;
27   --
28 begin
29   --
30   if p_person_selection_rule_id is null then
31     --
32     return true;
33     --
34   else
35     --
36     l_assignment_id := benutils.get_assignment_id
37                          (p_person_id         => p_person_id,
38                           p_business_group_id => p_business_group_id,
39                           p_effective_date    => p_effective_date);
40     --
41     l_outputs := benutils.formula
42       (p_formula_id     => p_person_selection_rule_id,
43        p_effective_date => p_effective_date,
44        p_business_group_id => p_business_group_id,
45        p_assignment_id  => l_assignment_id,
46        p_param1         => 'BEN_IV_PERSON_ID',           -- Bug 5331889
47        p_param1_value   => to_char(p_person_id),
48        p_param2         => 'BEN_LER_IV_LER_ID',
49        p_param2_value   => to_char(p_ler_id)
50 );
51     --
52     if l_outputs(l_outputs.first).value = 'Y' then
53       --
54       return true;
55       --
56     elsif l_outputs(l_outputs.first).value = 'N' then
57       --
58       return false;
59       --
60     elsif l_outputs(l_outputs.first).value <> 'N' then
61       --
62       fnd_message.set_name('BEN','BEN_91329_FORMULA_RETURN');
63       raise ben_manage_life_events.g_record_error;
64       --
65     end if;
66     --
67   end if;
68   --
69 end chk_person_selection;
70 --
71 --
72 --
73 --
74 function chk_comp_object_selection
75            (p_oipl_id                  in number,
76             p_pl_id                    in number,
77             p_pgm_id                   in number,
78             p_pl_typ_id                in number,
79             p_opt_id                   in number,
80             p_business_group_id        in number,
81             p_comp_selection_rule_id   in number,
82             p_effective_date           in date) return boolean is
83   --
84   l_package   varchar2(80) := g_package||'.chk_comp_object_selection';
85   l_outputs   ff_exec.outputs_t;
86   l_return    varchar2(30);
87   --
88 begin
89   --
90   hr_utility.set_location ('Entering '||l_package,10);
91   --
92   if p_comp_selection_rule_id is not null then
93     --
94     -- Call formula initialise routine
95     --
96     hr_utility.set_location ('call formula '||l_package,20);
97     l_outputs := benutils.formula
98        (p_formula_id        => p_comp_selection_rule_id,
99         p_effective_date    => p_effective_date,
100         p_business_group_id => p_business_group_id,
101         p_assignment_id     => null,
102         p_organization_id   => null,
103         p_pl_id             => p_pl_id,
104         p_pl_typ_id         => p_pl_typ_id,
105         p_pgm_id            => p_pgm_id,
106         p_opt_id            => p_opt_id,
107         p_jurisdiction_code => null);
108     --
109     -- Formula will return Y or N
110     --
111     l_return := l_outputs(l_outputs.first).value;
112     --
113     if l_return = 'N' then
114       --
115       hr_utility.set_location ('Ret N '||l_package,10);
116       return false;
117       --
118     elsif l_return = 'Y' then
119       --
120       hr_utility.set_location ('Ret Y '||l_package,10);
121       return true;
122       --
123     elsif l_return <> 'Y' then
124       --
125       -- Defensive coding for Non Y return
126       --
127       fnd_message.set_name('BEN','BEN_91329_FORMULA_RETURN');
128       fnd_message.raise_error;
129       --
130     end if;
131     --
132   else
133     --
134     hr_utility.set_location ('Leaving TRUE '||l_package,10);
135     return true;
136     --
137   end if;
138   --
139 end chk_comp_object_selection;
140 
141 
142 end ben_rules;