DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_NCR_API

Source


1 Package Body pay_ncr_api as
2 /* $Header: pyncrapi.pkb 120.0 2005/05/29 06:51:38 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := ' pay_ncr_api. ';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-----------------------< create_pay_net_calc_rule >-----------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_pay_net_calc_rule
13   (p_validate                      in            boolean  default false
14   ,p_business_group_id             in            number
15   ,p_accrual_plan_id               in            number
16   ,p_input_value_id                in            number
17   ,p_add_or_subtract               in            varchar2
18   ,p_date_input_value_id           in            number   default null
19   ,p_net_calculation_rule_id          out nocopy number
20   ,p_object_version_number            out nocopy number
21   ) is
22   --
23   -- Declare cursors and local variables
24   --
25 
26   l_proc                    varchar2(72) := g_package||'create_pay_net_calc_rule';
27   l_object_version_number   number;
28   l_net_calculation_rule_id number;
29 
30 begin
31   hr_utility.set_location('Entering:'|| l_proc, 10);
32   --
33   -- Issue a savepoint
34   --
35   savepoint create_pay_net_calc_rule;
36   hr_utility.set_location(l_proc, 20);
37 
38   --
39   -- Call Before Process User Hook
40   --
41   begin
42     pay_net_calc_rule_bk1.create_pay_net_calc_rule_b
43       (p_business_group_id   => p_business_group_id
44       ,p_accrual_plan_id     => p_accrual_plan_id
45       ,p_input_value_id      => p_input_value_id
46       ,p_add_or_subtract     => p_add_or_subtract
47       ,p_date_input_value_id => p_date_input_value_id
48       );
49   exception
50     when hr_api.cannot_find_prog_unit then
51       hr_api.cannot_find_prog_unit_error
52         (p_module_name => 'create_pay_net_calc_rule'
53         ,p_hook_type   => 'BP'
54         );
55   end;
56   hr_utility.set_location(l_proc, 30);
57   --
58   -- Validation in addition to Row Handlers
59   --
60 
61 
62 
63   hr_utility.set_location(l_proc, 40);
64   --
65   -- Process Logic
66   --
67 
68   pay_ncr_ins.ins (
69        p_net_calculation_rule_id => l_net_calculation_rule_id,
70        p_accrual_plan_id         => p_accrual_plan_id,
71        p_business_group_id       => p_business_group_id,
72        p_input_value_id          => p_input_value_id,
73        p_add_or_subtract         => p_add_or_subtract,
74        p_date_input_value_id     => p_date_input_value_id,
75        p_object_version_number   => l_object_version_number
76        );
77 
78 
79   hr_utility.set_location(l_proc, 50);
80   --
81   -- Call After Process User Hook
82   --
83   begin
84     pay_net_calc_rule_bk1.create_pay_net_calc_rule_a
85       (p_business_group_id       => p_business_group_id
86       ,p_accrual_plan_id         => p_accrual_plan_id
87       ,p_input_value_id          => p_input_value_id
88       ,p_add_or_subtract         => p_add_or_subtract
89       ,p_date_input_value_id     => p_date_input_value_id
90       ,p_net_calculation_rule_id => l_net_calculation_rule_id
91       ,p_object_version_number   => l_object_version_number
92       );
93   exception
94     when hr_api.cannot_find_prog_unit then
95       hr_api.cannot_find_prog_unit_error
96         (p_module_name => 'create_pay_net_calc_rule'
97         ,p_hook_type   => 'AP'
98         );
99   end;
100   hr_utility.set_location(l_proc, 60);
101   --
102   -- When in validation only mode raise the Validate_Enabled exception
103   --
104   if p_validate then
105     raise hr_api.validate_enabled;
106   end if;
107   --
108   -- Set all output arguments
109   --
110   p_net_calculation_rule_id := l_net_calculation_rule_id;
111   p_object_version_number   := l_object_version_number;
112 
113   --
114   hr_utility.set_location(' Leaving:'||l_proc, 70);
115 exception
116   when hr_api.validate_enabled then
117     --
118     -- As the Validate_Enabled exception has been raised
119     -- we must rollback to the savepoint
120     --
121     rollback to create_pay_net_calc_rule;
122     --
123     -- Only set output warning arguments
124     -- (Any key or derived arguments must be set to null
125     -- when validation only mode is being used.)
126     --
127     p_net_calculation_rule_id := null;
128     p_object_version_number   := null;
129 
130     hr_utility.set_location(' Leaving:'||l_proc, 80);
131   when others then
132     --
133     -- A validation or unexpected error has occured
134     --
135     rollback to create_pay_net_calc_rule;
136     hr_utility.set_location(' Leaving:'||l_proc, 90);
137     raise;
138 end create_pay_net_calc_rule;
139 --
140 -- ----------------------------------------------------------------------------
141 -- |-----------------------< update_pay_net_calc_rule >-----------------------|
142 -- ----------------------------------------------------------------------------
143 --
144 procedure update_pay_net_calc_rule
145   (p_validate                      in     boolean  default false
146   ,p_net_calculation_rule_id       in     number
147   ,p_accrual_plan_id               in     number   default hr_api.g_number
148   ,p_input_value_id                in     number   default hr_api.g_number
149   ,p_add_or_subtract               in     varchar2 default hr_api.g_varchar2
150   ,p_date_input_value_id           in     number   default hr_api.g_number
151   ,p_object_version_number         in out nocopy number
152   ) is
153   --
154   -- Declare cursors and local variables
155   --
156 
157   l_proc                    varchar2(72) := g_package||'update_pay_net_calc_rule';
158   l_object_version_number   number;
159 
160 begin
161   hr_utility.set_location('Entering:'|| l_proc, 10);
162   --
163   -- Issue a savepoint
164   --
165   savepoint update_pay_net_calc_rule;
166   hr_utility.set_location(l_proc, 20);
167 
168   --
169   -- Call Before Process User Hook
170   --
171   begin
172     pay_net_calc_rule_bk2.update_pay_net_calc_rule_b
173       (p_net_calculation_rule_id => p_net_calculation_rule_id
174       ,p_accrual_plan_id         => p_accrual_plan_id
175       ,p_input_value_id          => p_input_value_id
176       ,p_add_or_subtract         => p_add_or_subtract
177       ,p_date_input_value_id     => p_date_input_value_id
178       ,p_object_version_number   => p_object_version_number
179       );
180   exception
181     when hr_api.cannot_find_prog_unit then
182       hr_api.cannot_find_prog_unit_error
183         (p_module_name => 'update_pay_net_calc_rule'
184         ,p_hook_type   => 'BP'
185         );
186   end;
187   hr_utility.set_location(l_proc, 30);
188   --
189   -- Validation in addition to Row Handlers
190   --
191 
192 
193 
194   hr_utility.set_location(l_proc, 40);
195   --
196   -- Process Logic
197   --
198   l_object_version_number := p_object_version_number;
199 
200   pay_ncr_upd.upd (
201        p_net_calculation_rule_id => p_net_calculation_rule_id,
202        p_accrual_plan_id         => p_accrual_plan_id,
203        p_input_value_id          => p_input_value_id,
204        p_add_or_subtract         => p_add_or_subtract,
205        p_date_input_value_id     => p_date_input_value_id,
206        p_object_version_number   => l_object_version_number
207        );
208 
209 
210   hr_utility.set_location(l_proc, 50);
211   --
212   -- Call After Process User Hook
213   --
214   begin
215     pay_net_calc_rule_bk2.update_pay_net_calc_rule_a
216       (p_net_calculation_rule_id => p_net_calculation_rule_id
217       ,p_accrual_plan_id         => p_accrual_plan_id
218       ,p_input_value_id          => p_input_value_id
219       ,p_add_or_subtract         => p_add_or_subtract
220       ,p_date_input_value_id     => p_date_input_value_id
221       ,p_object_version_number   => l_object_version_number
222       );
223   exception
224     when hr_api.cannot_find_prog_unit then
225       hr_api.cannot_find_prog_unit_error
226         (p_module_name => 'update_pay_net_calc_rule'
227         ,p_hook_type   => 'AP'
228         );
229   end;
230   hr_utility.set_location(l_proc, 60);
231   --
232   -- When in validation only mode raise the Validate_Enabled exception
233   --
234   if p_validate then
235     raise hr_api.validate_enabled;
236   end if;
237   --
238   -- Set all output arguments
239   --
240 
241   p_object_version_number   := l_object_version_number;
242 
243   --
244   hr_utility.set_location(' Leaving:'||l_proc, 70);
245 exception
246   when hr_api.validate_enabled then
247     --
248     -- As the Validate_Enabled exception has been raised
249     -- we must rollback to the savepoint
250     --
251     rollback to update_pay_net_calc_rule;
252     --
253     -- Only set output warning arguments
254     -- (Any key or derived arguments must be set to null
255     -- when validation only mode is being used.)
256     --
257 
258     p_object_version_number   := null;
259 
260     hr_utility.set_location(' Leaving:'||l_proc, 80);
261   when others then
262     --
263     -- A validation or unexpected error has occured
264     --
265     rollback to update_pay_net_calc_rule;
266     hr_utility.set_location(' Leaving:'||l_proc, 90);
267     raise;
268 end update_pay_net_calc_rule;
269 --
270 
271 -- ----------------------------------------------------------------------------
272 -- |-----------------------< delete_pay_net_calc_rule >-----------------------|
273 -- ----------------------------------------------------------------------------
274 --
275 procedure delete_pay_net_calc_rule
276   (p_validate                      in     boolean  default false
277   ,p_net_calculation_rule_id       in     number
278   ,p_object_version_number         in     number
279   ) is
280   --
281   -- Declare cursors and local variables
282   --
283 
284   l_proc                    varchar2(72) := g_package||'delete_pay_net_calc_rule';
285 
286 begin
287   hr_utility.set_location('Entering:'|| l_proc, 10);
288   --
289   -- Issue a savepoint
290   --
291   savepoint delete_pay_net_calc_rule;
292   hr_utility.set_location(l_proc, 20);
293 
294   --
295   -- Call Before Process User Hook
296   --
297   begin
298     pay_net_calc_rule_bk3.delete_pay_net_calc_rule_b
299       (p_net_calculation_rule_id => p_net_calculation_rule_id
300       ,p_object_version_number   => p_object_version_number
301       );
302   exception
303     when hr_api.cannot_find_prog_unit then
304       hr_api.cannot_find_prog_unit_error
305         (p_module_name => 'delete_pay_net_calc_rule'
306         ,p_hook_type   => 'BP'
307         );
308   end;
309   hr_utility.set_location(l_proc, 30);
310   --
311   -- Validation in addition to Row Handlers
312   --
313 
314 
315 
316   hr_utility.set_location(l_proc, 40);
317   --
318   -- Process Logic
319   --
320 
321   pay_ncr_del.del (
322        p_net_calculation_rule_id => p_net_calculation_rule_id,
323        p_object_version_number   => p_object_version_number
324        );
325 
326 
327   hr_utility.set_location(l_proc, 50);
328   --
329   -- Call After Process User Hook
330   --
331   begin
332     pay_net_calc_rule_bk3.delete_pay_net_calc_rule_a
333       (p_net_calculation_rule_id => p_net_calculation_rule_id
334       ,p_object_version_number   => p_object_version_number
335       );
336   exception
337     when hr_api.cannot_find_prog_unit then
338       hr_api.cannot_find_prog_unit_error
339         (p_module_name => 'delete_pay_net_calc_rule'
340         ,p_hook_type   => 'AP'
341         );
342   end;
343   hr_utility.set_location(l_proc, 60);
344   --
345   -- When in validation only mode raise the Validate_Enabled exception
346   --
347   if p_validate then
348     raise hr_api.validate_enabled;
349   end if;
350   --
351   -- Set all output arguments
352   --
353 
354   --
355   hr_utility.set_location(' Leaving:'||l_proc, 70);
356 exception
357   when hr_api.validate_enabled then
358     --
359     -- As the Validate_Enabled exception has been raised
360     -- we must rollback to the savepoint
361     --
362     rollback to delete_pay_net_calc_rule;
363     --
364     -- Only set output warning arguments
365     -- (Any key or derived arguments must be set to null
366     -- when validation only mode is being used.)
367     --
368 
369 
370     hr_utility.set_location(' Leaving:'||l_proc, 80);
371   when others then
372     --
373     -- A validation or unexpected error has occured
374     --
375     rollback to delete_pay_net_calc_rule;
376     hr_utility.set_location(' Leaving:'||l_proc, 90);
377     raise;
378 end delete_pay_net_calc_rule;
379 --
380 end pay_ncr_api;