DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_WCI_RATES_API

Source


1 Package Body pay_wci_rates_api as
2 /* $Header: pypwrapi.pkb 115.2 2002/12/05 15:26:16 swinton noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := 'pay_wci_rates_api';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------<create_wci_rate>--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_wci_rate
13   (p_validate                      in     boolean  default false
14   ,p_account_id                    in     number
15   ,p_code                          in     varchar2
16   ,p_rate                          in     number   default null
17   ,p_description                   in     varchar2 default null
18   ,p_comments                      in     varchar2 default null
19   ,p_rate_id                       out    nocopy number
20   ,p_object_version_number         out    nocopy number
21   ) is
22   --
23   -- Declare cursors and local variables
24   --
25   l_proc                  varchar2(72) := g_package||'update_wci_rate';
26   l_business_group_id     number;
27   --
28   cursor csr_business_group_id is
29     select business_group_id
30     from pay_wci_accounts
31     where account_id = p_account_id;
32 
33 begin
34 
35   hr_utility.set_location('Entering:'|| l_proc, 10);
36   --
37   -- Derive necessary parameters
38   --
39   open csr_business_group_id;
40   fetch csr_business_group_id into l_business_group_id;
41   close csr_business_group_id;
42   --
43   -- Issue a savepoint
44   --
45   savepoint create_wci_rate;
46   hr_utility.set_location(l_proc, 20);
47   --
48   -- Truncate the time portion from all IN date parameters
49   --
50   -- Call Before Process User Hook
51   --
52   begin
53     pay_wci_rates_bk1.create_wci_rate_b
54       (p_business_group_id             => l_business_group_id
55       ,p_account_id                    => p_account_id
56       ,p_code                          => p_code
57       ,p_rate                          => p_rate
58       ,p_description                   => p_description
59       ,p_comments                      => p_comments
60       ,p_object_version_number         => p_object_version_number
61       );
62   exception
63     when hr_api.cannot_find_prog_unit then
64       hr_api.cannot_find_prog_unit_error
65         (p_module_name => 'create_wci_rate'
66         ,p_hook_type   => 'BP'
67         );
68   end;
69   hr_utility.set_location(l_proc, 30);
70   --
71   -- Validation in addition to Row Handlers
72   --
73   hr_utility.set_location(l_proc, 40);
74   --
75   -- Process Logic
76   --
77   -- Call the row handler
78   --
79   pay_pwr_ins.ins
80      (p_rate_id                     => p_rate_id
81      ,p_business_group_id           => l_business_group_id
82      ,p_account_id                  => p_account_id
83      ,p_code                        => p_code
84      ,p_rate                        => p_rate
85      ,p_description                 => p_description
86      ,p_comments                    => p_comments
87      ,p_object_version_number       => p_object_version_number
88     );
89 
90   hr_utility.set_location(l_proc, 50);
91   --
92   -- Call After Process User Hook
93   --
94   begin
95     pay_wci_rates_bk1.create_wci_rate_a
96       (p_business_group_id             => l_business_group_id
97       ,p_account_id                    => p_account_id
98       ,p_code                          => p_code
99       ,p_rate                          => p_rate
100       ,p_description                   => p_description
101       ,p_comments                      => p_comments
102       ,p_rate_id                       => p_rate_id
103       ,p_object_version_number         => p_object_version_number
104       );
105   exception
106     when hr_api.cannot_find_prog_unit then
107       hr_api.cannot_find_prog_unit_error
108         (p_module_name => 'create_wci_rate'
109         ,p_hook_type   => 'AP'
110         );
111   end;
112   hr_utility.set_location(l_proc, 60);
113   --
114   -- When in validation only mode raise the Validate_Enabled exception
115   --
116   if p_validate then
117     raise hr_api.validate_enabled;
118   end if;
119   --
120   -- Set all output arguments
121   --
122   hr_utility.set_location(' Leaving:'||l_proc, 70);
123 
124 exception
125 
126   when hr_api.validate_enabled then
127     --
128     -- As the Validate_Enabled exception has been raised
129     -- we must rollback to the savepoint
130     --
131     rollback to create_wci_rate;
132     --
133     -- Only set output warning arguments
134     -- (Any key or derived arguments must be set to null
135     -- when validation only mode is being used.)
136     --
137     p_rate_id                := null;
138     p_object_version_number  := null;
139     hr_utility.set_location(' Leaving:'||l_proc, 80);
140   when others then
141     --
142     -- A validation or unexpected error has occured
143     --
144     rollback to create_wci_rate;
145     --
146     -- Bugfix 2692195
147     -- Reset all OUT/IN OUT parameters
148     --
149     p_rate_id := null;
150     p_object_version_number := null;
151     --
152     hr_utility.set_location(' Leaving:'||l_proc, 90);
153     raise;
154 end create_wci_rate;
155 --
156 -- ----------------------------------------------------------------------------
157 -- |--------------------------< update_wci_rate >--------------------------|
158 -- ----------------------------------------------------------------------------
159 --
160 procedure update_wci_rate
161   (p_validate                      in     boolean  default false
162   ,p_rate_id                       in     number
163   ,p_object_version_number         in out nocopy number
164   ,p_code                          in     varchar2 default hr_api.g_varchar2
165   ,p_rate                          in     number   default hr_api.g_number
166   ,p_description                   in     varchar2 default hr_api.g_varchar2
167   ,p_comments                      in     varchar2 default hr_api.g_varchar2
168   ) is
169   --
170   -- Declare cursors and local variables
171   --
172   l_proc                  varchar2(72) := g_package||'update_wci_rate';
173   l_business_group_id     number;
174   l_account_id            number;
175   l_object_version_number number;
176   --
177   cursor csr_record_details is
178     select business_group_id, account_id
179     from pay_wci_rates
180     where rate_id = p_rate_id;
181 
182 begin
183 
184   hr_utility.set_location('Entering:'|| l_proc, 10);
185   --
186   -- Store in out parameters
187   --
188   l_object_version_number := p_object_version_number;
189   --
190   -- Issue a savepoint
191   --
192   savepoint update_wci_rate;
193   hr_utility.set_location(l_proc, 20);
194   --
195   -- Truncate the time portion from all IN date parameters
196   --
197   -- Derive necessary parameters
198   --
199   open csr_record_details;
200   fetch csr_record_details into l_business_group_id, l_account_id;
201   close csr_record_details;
202   --
203   -- Call Before Process User Hook
204   --
205   begin
206     pay_wci_rates_bk2.update_wci_rate_b
207       (p_rate_id                       => p_rate_id
208       ,p_object_version_number         => l_object_version_number
209       ,p_business_group_id             => l_business_group_id
210       ,p_account_id                    => l_account_id
211       ,p_code                          => p_code
212       ,p_rate                          => p_rate
213       ,p_description                   => p_description
214       ,p_comments                      => p_comments
215       );
216   exception
217     when hr_api.cannot_find_prog_unit then
218       hr_api.cannot_find_prog_unit_error
219         (p_module_name => 'update_wci_rate'
220         ,p_hook_type   => 'BP'
221         );
222   end;
223   hr_utility.set_location(l_proc, 30);
224   --
225   -- Validation in addition to Row Handlers
226   --
227   hr_utility.set_location(l_proc, 40);
228   --
229   -- Process Logic
230   --
231   -- Call the row handler
232   --
233   pay_pwr_upd.upd
234      (p_rate_id                      => p_rate_id
235      ,p_object_version_number        => l_object_version_number
236      ,p_code                         => p_code
237      ,p_rate                         => p_rate
238      ,p_description                  => p_description
239      ,p_comments                     => p_comments
240     );
241 
242   hr_utility.set_location(l_proc, 50);
243   --
244   -- Call After Process User Hook
245   --
246   begin
247     pay_wci_rates_bk2.update_wci_rate_a
248       (p_rate_id                       => p_rate_id
249       ,p_object_version_number         => l_object_version_number
250       ,p_business_group_id             => l_business_group_id
251       ,p_account_id                    => l_account_id
252       ,p_code                          => p_code
253       ,p_rate                          => p_rate
254       ,p_description                   => p_description
255       ,p_comments                      => p_comments
256       );
257   exception
258     when hr_api.cannot_find_prog_unit then
259       hr_api.cannot_find_prog_unit_error
260         (p_module_name => 'update_wci_rate'
261         ,p_hook_type   => 'AP'
262         );
263   end;
264   hr_utility.set_location(l_proc, 60);
265   --
266   -- When in validation only mode raise the Validate_Enabled exception
267   --
268   if p_validate then
269     raise hr_api.validate_enabled;
270   end if;
271   --
272   -- Set all output arguments
273   --
274   p_object_version_number  := l_object_version_number;
275   --
276   hr_utility.set_location(' Leaving:'||l_proc, 70);
277 
278 exception
279 
280   when hr_api.validate_enabled then
281     --
282     -- As the Validate_Enabled exception has been raised
283     -- we must rollback to the savepoint
284     --
285     rollback to update_wci_rate;
286     --
287     -- Only set output warning arguments
288     -- (Any key or derived arguments must be set to null
289     -- when validation only mode is being used.)
290     --
291     p_object_version_number  := l_object_version_number;
292     hr_utility.set_location(' Leaving:'||l_proc, 80);
293   when others then
294     --
295     -- A validation or unexpected error has occured
296     --
297     rollback to update_wci_rate;
298     --
299     -- Bugfix 2692195
300     -- Reset all OUT/IN OUT parameters
301     --
302     p_object_version_number := l_object_version_number;
303     --
304     hr_utility.set_location(' Leaving:'||l_proc, 90);
305     raise;
306 end update_wci_rate;
307 --
308 -- ----------------------------------------------------------------------------
309 -- |--------------------------< delete_wci_rate >--------------------------|
310 -- ----------------------------------------------------------------------------
311 --
312 procedure delete_wci_rate
313   (p_validate                      in     boolean  default false
314   ,p_object_version_number         in     number
315   ,p_rate_id                       in     number
316   ) is
317   --
318   -- Declare cursors and local variables
319   --
320 
321   l_proc                  varchar2(72) := g_package||'delete_wci_rate';
322   l_business_group_id     number;
323   --
324   cursor csr_business_group_id is
325     select business_group_id
326     from pay_wci_rates
327     where rate_id = p_rate_id;
328 
329 begin
330 
331   hr_utility.set_location('Entering:'|| l_proc, 10);
332   --
333   -- Issue a savepoint
334   --
335   savepoint delete_wci_rate;
336   hr_utility.set_location(l_proc, 20);
337   --
338   -- Truncate the time portion from all IN date parameters
339   --
340   -- Derive necessary parameters
341   --
342   open csr_business_group_id;
343   fetch csr_business_group_id into l_business_group_id;
344   close csr_business_group_id;
345 
346   --
347   -- Call Before Process User Hook
348   --
349   begin
350     pay_wci_rates_bk3.delete_wci_rate_b
351       (p_rate_id                       => p_rate_id
352       ,p_object_version_number         => p_object_version_number
353       ,p_business_group_id             => l_business_group_id
354       );
355   exception
356     when hr_api.cannot_find_prog_unit then
357       hr_api.cannot_find_prog_unit_error
358         (p_module_name => 'delete_wci_rate'
359         ,p_hook_type   => 'BP'
360         );
361   end;
362   hr_utility.set_location(l_proc, 30);
363   --
364   -- Validation in addition to Row Handlers
365   --
366   hr_utility.set_location(l_proc, 40);
367   --
368   -- Process Logic
369   --
370   -- Call the row handler
371   --
372   pay_pwr_del.del
373      (p_rate_id                      => p_rate_id
374      ,p_object_version_number        => p_object_version_number
375     );
376 
377   hr_utility.set_location(l_proc, 50);
378   --
379   -- Call After Process User Hook
380   --
381   begin
382     pay_wci_rates_bk3.delete_wci_rate_a
383       (p_rate_id                       => p_rate_id
384       ,p_object_version_number         => p_object_version_number
385       ,p_business_group_id               => l_business_group_id
386       );
387   exception
388     when hr_api.cannot_find_prog_unit then
389       hr_api.cannot_find_prog_unit_error
390         (p_module_name => 'delete_wci_rate'
391         ,p_hook_type   => 'AP'
392         );
393   end;
394   hr_utility.set_location(l_proc, 60);
395   --
396   -- When in validation only mode raise the Validate_Enabled exception
397   --
398   if p_validate then
399     raise hr_api.validate_enabled;
400   end if;
401   --
402   -- Set all output arguments
403   --
404   hr_utility.set_location(' Leaving:'||l_proc, 70);
405 
406 exception
407 
408   when hr_api.validate_enabled then
409     --
410     -- As the Validate_Enabled exception has been raised
411     -- we must rollback to the savepoint
412     --
413     rollback to delete_wci_rate;
414     --
415     -- Only set output warning arguments
416     -- (Any key or derived arguments must be set to null
417     -- when validation only mode is being used.)
418     --
419     hr_utility.set_location(' Leaving:'||l_proc, 80);
420   when others then
421     --
422     -- A validation or unexpected error has occured
423     --
424     rollback to delete_wci_rate;
425     hr_utility.set_location(' Leaving:'||l_proc, 90);
426     raise;
427 
428 end delete_wci_rate;
429 --
430 end pay_wci_rates_api;