[Home] [Help]
PACKAGE BODY: APPS.BEN_EIV_BUS
Source
1 Package Body ben_eiv_bus as
2 /* $Header: beeivrhi.pkb 115.4 2002/12/22 20:25:28 pabodla noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_eiv_bus.'; -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code varchar2(150) default null;
14 g_extra_input_value_id number default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |---------------------< return_legislation_code >-------------------------|
18 -- ---------------------------------------------------------------------------
19 --
20 Function return_legislation_code
21 (p_extra_input_value_id in number
22 )
23 Return Varchar2 Is
24 --
25 -- Declare cursor
26 --
27 cursor csr_leg_code is
28 select pbg.legislation_code
29 from per_business_groups pbg
30 , ben_extra_input_values eiv
31 where eiv.extra_input_value_id = p_extra_input_value_id
32 and pbg.business_group_id = eiv.business_group_id;
33 --
34 -- Declare local variables
35 --
36 l_legislation_code varchar2(150);
37 l_proc varchar2(72) := g_package||'return_legislation_code';
38 --
39 Begin
40 --
41 hr_utility.set_location('Entering:'|| l_proc, 10);
42 --
43 -- Ensure that all the mandatory parameter are not null
44 --
45 hr_api.mandatory_arg_error
46 (p_api_name => l_proc
47 ,p_argument => 'extra_input_value_id'
48 ,p_argument_value => p_extra_input_value_id
49 );
50 --
51 if ( nvl(ben_eiv_bus.g_extra_input_value_id, hr_api.g_number)
52 = p_extra_input_value_id) then
53 --
54 -- The legislation code has already been found with a previous
55 -- call to this function. Just return the value in the global
56 -- variable.
57 --
58 l_legislation_code := ben_eiv_bus.g_legislation_code;
59 hr_utility.set_location(l_proc, 20);
60 else
61 --
62 -- The ID is different to the last call to this function
63 -- or this is the first call to this function.
64 --
65 open csr_leg_code;
66 fetch csr_leg_code into l_legislation_code;
67 --
68 if csr_leg_code%notfound then
69 --
70 -- The primary key is invalid therefore we must error
71 --
72 close csr_leg_code;
73 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
74 fnd_message.raise_error;
75 end if;
76 hr_utility.set_location(l_proc,30);
77 --
78 -- Set the global variables so the values are
79 -- available for the next call to this function.
80 --
81 close csr_leg_code;
82 ben_eiv_bus.g_extra_input_value_id := p_extra_input_value_id;
83 ben_eiv_bus.g_legislation_code := l_legislation_code;
84 end if;
85 hr_utility.set_location(' Leaving:'|| l_proc, 40);
86 return l_legislation_code;
87 end return_legislation_code;
88 --
89 -- ---------------------------------------------------------------------------
90 -- |------------------------< chk_inp_val_unique >----------------------------|
91 -- ----------------------------------------------------------------------------
92 --
93 -- Description
94 -- ensure that the input value is unique
95 -- within acty_base_rt_id
96 --
97 -- Pre Conditions
98 -- None.
99 --
100 -- In Parameters
101 -- p_extra_input_value_id is extra_input_value_id
102 -- p_acty_base_rt_id is acty_base_rt_id
103 -- p_input_value_id is input_value_id
104 --
105 -- Post Success
106 -- Processing continues
107 --
108 -- Post Failureccess Status
109 -- Internal table handler use only.
110 --
111 -- ----------------------------------------------------------------------------
112 Procedure chk_inp_val_unique
113 ( p_extra_input_value_id in number
114 ,p_acty_base_rt_id in number
115 ,p_input_value_id in number
116 ,p_object_version_number in number
117 )
118 is
119 l_proc varchar2(72) := g_package||'chk_inp_val_unique';
120 l_api_updating boolean;
121 l_dummy char(1);
122 cursor c1 is select null
123 from ben_extra_input_values
124 Where extra_input_value_id <> nvl(p_extra_input_value_id,-1)
125 and acty_base_rt_id = p_acty_base_rt_id
126 and input_value_id = p_input_value_id;
127 --
128 Begin
129 hr_utility.set_location('Entering:'||l_proc, 5);
130 --
131 l_api_updating := ben_eiv_shd.api_updating
132 (p_extra_input_value_id => p_extra_input_value_id,
133 p_object_version_number => p_object_version_number);
134
135 if (l_api_updating
136 and nvl(p_input_value_id,hr_api.g_number)
137 <> ben_eiv_shd.g_old_rec.input_value_id
138 or not l_api_updating) then
139
140 open c1;
141 fetch c1 into l_dummy;
142 if c1%found then
143 close c1;
144 fnd_message.set_name('BEN','BEN_93186_INP_VAL_NOT_UNIQUE');
145 fnd_message.raise_error;
146 end if;
147 end if;
148 --
149 hr_utility.set_location('Leaving:'||l_proc, 15);
150 End chk_inp_val_unique;
151 --
152 -- ---------------------------------------------------------------------------
153 -- |------------------------< chk_rl_exists >----------------------------|
154 -- ----------------------------------------------------------------------------
155 --
156 -- Description
157 -- ensure that the input value is unique
158 -- within acty_base_rt_id
159 --
160 -- Pre Conditions
161 -- None.
162 --
163 -- In Parameters
164 -- p_extra_input_value_id is extra_input_value_id
165 -- p_acty_base_rt_id is acty_base_rt_id
166 -- p_input_value_id is input_value_id
167 --
168 -- Post Success
169 -- Processing continues
170 --
171 -- Post Failureccess Status
172 -- Internal table handler use only.
173 --
174 -- ----------------------------------------------------------------------------
175 Procedure chk_rl_exists
176 ( p_acty_base_rt_id in number
177 , p_effective_date in date
178 )
179 is
180 l_proc varchar2(72) := g_package||'chk_rl_exists';
181 l_input_va_calc_rl number(15);
182
183 cursor c1 is select input_va_calc_rl
184 from ben_acty_base_rt_f
185 Where acty_base_rt_id = p_acty_base_rt_id
186 and p_effective_date between
187 effective_start_date and effective_end_date;
188 --
189 Begin
190 hr_utility.set_location('Entering:'||l_proc, 5);
191 --
192 open c1;
193 fetch c1 into l_input_va_calc_rl;
194 close c1;
195
196 if (l_input_va_calc_rl is null)
197 then
198 fnd_message.set_name('BEN','BEN_93187_INP_VAL_NOT_ALLOWED');
199 fnd_message.raise_error;
200 end if;
201 --
202 hr_utility.set_location('Leaving:'||l_proc, 15);
203 End chk_rl_exists;
204 --
205 -- ----------------------------------------------------------------------------
206 -- |---------------------------< insert_validate >----------------------------|
207 -- ----------------------------------------------------------------------------
208 Procedure insert_validate
209 (p_rec in ben_eiv_shd.g_rec_type
210 ,p_effective_date in date
211 ) is
212 --
213 l_proc varchar2(72) := g_package||'insert_validate';
214 --
215 Begin
216 hr_utility.set_location('Entering:'||l_proc, 5);
217 --
218 -- Call all supporting business operations
219 --
220 hr_api.validate_bus_grp_id
221 (p_business_group_id => p_rec.business_group_id);
222 --
223 -- Check If RL exists on Rate
224 chk_rl_exists
225 (
226 p_rec.acty_base_rt_id,
227 p_effective_date
228 );
229 --
230 -- Check Input Value Id for duplicates
231 --
232 chk_inp_val_unique
233 ( p_rec.extra_input_value_id
234 ,p_rec.acty_base_rt_id
235 ,p_rec.input_value_id
236 ,p_rec.object_version_number
237 );
238 --
239 hr_utility.set_location(' Leaving:'||l_proc, 10);
240 End insert_validate;
241 --
242 -- ----------------------------------------------------------------------------
243 -- |---------------------------< update_validate >----------------------------|
244 -- ----------------------------------------------------------------------------
245 Procedure update_validate
246 (p_rec in ben_eiv_shd.g_rec_type
247 ,p_effective_date in date
248 ) is
249 --
250 l_proc varchar2(72) := g_package||'update_validate';
251 --
252 Begin
253 hr_utility.set_location('Entering:'||l_proc, 5);
254 --
255 -- Call all supporting business operations
256 --
257 hr_api.validate_bus_grp_id
258 (p_business_group_id => p_rec.business_group_id );
259 --
260 -- Check Input Value Id for duplicates
261 --
262 chk_inp_val_unique
263 ( p_rec.extra_input_value_id
264 ,p_rec.acty_base_rt_id
265 ,p_rec.input_value_id
266 ,p_rec.object_version_number
267 );
268 --
269 hr_utility.set_location(' Leaving:'||l_proc, 10);
270 End update_validate;
271 --
272 -- ----------------------------------------------------------------------------
273 -- |---------------------------< delete_validate >----------------------------|
274 -- ----------------------------------------------------------------------------
275 Procedure delete_validate
276 (p_rec in ben_eiv_shd.g_rec_type
277 ,p_effective_date in date
278 ) is
279 --
280 l_proc varchar2(72) := g_package||'delete_validate';
281 --
282 Begin
283 hr_utility.set_location('Entering:'||l_proc, 5);
284 --
285 -- Call all supporting business operations
286 --
287 hr_utility.set_location(' Leaving:'||l_proc, 10);
288 End delete_validate;
289 --
290 end ben_eiv_bus;