[Home] [Help]
PACKAGE BODY: APPS.GHR_COMPL_AGENCY_COSTS_API
Source
1 Package Body ghr_compl_agency_costs_api as
2 /* $Header: ghcstapi.pkb 120.0 2005/05/29 03:05:00 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' ghr_compl_agency_costs_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------<create_agency_costs> >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_agency_costs
13 (p_validate in boolean default false
14 ,p_effective_date in date
15 ,p_complaint_id in number
16 ,p_phase in varchar2 default null
17 ,p_stage in varchar2 default null
18 ,p_category in varchar2 default null
19 ,p_amount in number default null
20 ,p_cost_date in date default null
21 ,p_description in varchar2 default null
22 ,p_compl_agency_cost_id out nocopy number
23 ,p_object_version_number out nocopy number
24
25 ) is
26
27 --
28 -- Declare cursors and local variables
29 --
30
31 l_proc varchar2(72) := g_package||'create_agency_costs';
32 l_compl_agency_cost_id number;
33 l_object_version_number number;
34 begin
35 hr_utility.set_location('Entering:'|| l_proc, 10);
36 --
37 -- Issue a savepoint
38 --
39 savepoint create_agency_costs;
40 hr_utility.set_location(l_proc, 20);
41 --
42 -- Truncate the time portion from all IN date parameters
43 --
44 --
45 -- Call Before Process User Hook
46 --
47 begin
48 ghr_compl_agency_costs_bk1.create_agency_costs_b
49 (p_effective_date => trunc(p_effective_date)
50 ,p_complaint_id => p_complaint_id
51 ,p_phase => p_phase
52 ,p_stage => p_stage
53 ,p_category => p_category
54 ,p_amount => p_amount
55 ,p_cost_date => p_cost_date
56 ,p_description => p_description
57 );
58 exception
59 when hr_api.cannot_find_prog_unit then
60 hr_api.cannot_find_prog_unit_error
61 (p_module_name => 'CREATE_AGENCY_COSTS'
62 ,p_hook_type => 'BP'
63 );
64 end;
65 --
66 --
67 --
68 -- Validation in addition to Row Handlers
69 --
70
71 hr_utility.set_location(l_proc, 40);
72 --
73 -- Process Logic
74 --
75 ghr_cst_ins.ins
76 (p_effective_date => p_effective_date
77 ,p_complaint_id => p_complaint_id
78 ,p_phase => p_phase
79 ,p_stage => p_stage
80 ,p_category => p_category
81 ,p_amount => p_amount
82 ,p_cost_date => p_cost_date
83 ,p_description => p_description
84 ,p_compl_agency_cost_id => l_compl_agency_cost_id
85 ,p_object_version_number => l_object_version_number
86 );
87 hr_utility.set_location(l_proc, 50);
88 --
89 --
90 -- Call After Process User Hook
91 --
92 begin
93 ghr_compl_agency_costs_bk1.create_agency_costs_a
94 (p_effective_date => trunc(p_effective_date)
95 ,p_complaint_id => p_complaint_id
96 ,p_phase => p_phase
97 ,p_stage => p_stage
98 ,p_category => p_category
99 ,p_amount => p_amount
100 ,p_cost_date => p_cost_date
101 ,p_description => p_description
102 ,p_compl_agency_cost_id => l_compl_agency_cost_id
103 ,p_object_version_number => l_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_AGENCY_COSTS'
109 ,p_hook_type => 'AP'
110 );
111 end;
112 --
113 -- When in validation only mode raise the Validate_Enabled exception
114 --
115 if p_validate then
116 raise hr_api.validate_enabled;
117 end if;
118 --
119 -- Set all output arguments
120 --
121 p_compl_agency_cost_id := l_compl_agency_cost_id;
122 p_object_version_number := l_object_version_number;
123 --
124 hr_utility.set_location(' Leaving:'||l_proc, 70);
125 exception
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_agency_costs;
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_compl_agency_cost_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_agency_costs;
145 --
146 -- Reset IN OUT parameters and set OUT parameters
147 --
148 p_compl_agency_cost_id := null;
149 p_object_version_number := null;
150 hr_utility.set_location(' Leaving:'||l_proc, 90);
151 raise;
152 end create_agency_costs;
153 --
154
155
156 procedure update_agency_costs
157 (p_validate in boolean default false
158 ,p_effective_date in date
159 ,p_compl_agency_cost_id in number
160 ,p_complaint_id in number default hr_api.g_number
161 ,p_phase in varchar2 default hr_api.g_varchar2
162 ,p_stage in varchar2 default hr_api.g_varchar2
163 ,p_category in varchar2 default hr_api.g_varchar2
164 ,p_amount in number default hr_api.g_number
165 ,p_cost_date in date default hr_api.g_date
166 ,p_description in varchar2 default hr_api.g_varchar2
167 ,p_object_version_number in out nocopy number
168 )
169
170 is
171 l_proc varchar2(72) := g_package||'update_agency_costs';
172 l_object_version_number number;
173 -- Initial OVN.
174 l_i_object_version_number number;
175 begin
176 hr_utility.set_location('Entering:'|| l_proc, 5);
177 --
178 savepoint update_agency_costs;
179 --
180 -- Remember IN OUT parameter IN values
181 l_i_object_version_number := p_object_version_number;
182 --
183 -- Truncate the time portion from all IN date parameters
184 --
185
186 --
187 -- Call Before Process User Hook
188 --
189 begin
190 ghr_compl_agency_costs_bk2.update_agency_costs_b
191 (p_effective_date => trunc(p_effective_date)
192 ,p_complaint_id => p_complaint_id
193 ,p_phase => p_phase
194 ,p_stage => p_stage
195 ,p_category => p_category
196 ,p_amount => p_amount
197 ,p_cost_date => p_cost_date
198 ,p_description => p_description
199 ,p_compl_agency_cost_id => p_compl_agency_cost_id
200 ,p_object_version_number => p_object_version_number
201 );
202 exception
203 when hr_api.cannot_find_prog_unit then
204 hr_api.cannot_find_prog_unit_error
205 (p_module_name => 'UPDATE_AGENCY_COSTS'
206 ,p_hook_type => 'BP'
207 );
208 end;
209 --
210 -- Validation in addition to Row Handlers
211 --
212 -- Store the original ovn in case we rollback when p_validate is true
213 --
214 l_object_version_number := p_object_version_number;
215
216 hr_utility.set_location(l_proc, 6);
217
218 ghr_cst_upd.upd
219 (p_effective_date => p_effective_date
220 ,p_complaint_id => p_complaint_id
221 ,p_phase => p_phase
222 ,p_stage => p_stage
223 ,p_category => p_category
224 ,p_amount => p_amount
225 ,p_cost_date => p_cost_date
226 ,p_description => p_description
227 ,p_compl_agency_cost_id => p_compl_agency_cost_id
228 ,p_object_version_number => l_object_version_number
229 );
230 --
231 -- Call After Process User Hook
232 --
233 begin
234 ghr_compl_agency_costs_bk2.update_agency_costs_a
235 (p_effective_date => trunc(p_effective_date)
236 ,p_complaint_id => p_complaint_id
237 ,p_phase => p_phase
238 ,p_stage => p_stage
239 ,p_category => p_category
240 ,p_amount => p_amount
241 ,p_cost_date => p_cost_date
242 ,p_description => p_description
243 ,p_compl_agency_cost_id => p_compl_agency_cost_id
244 ,p_object_version_number => l_object_version_number
245 );
246 exception
247 when hr_api.cannot_find_prog_unit then
248 hr_api.cannot_find_prog_unit_error
249 (p_module_name => 'UPDATE_AGENCY_COSTS'
250 ,p_hook_type => 'AP'
251 );
252 end;
253 --
254 -- When in validation only mode raise the Validate_Enabled exception
255 --
256 if p_validate then
257 raise hr_api.validate_enabled;
258 end if;
259 --
260 -- Set all output arguments
261 --
262 p_object_version_number := l_object_version_number;
263 --
264 hr_utility.set_location(' Leaving:'||l_proc, 70);
265 exception
266 when hr_api.validate_enabled then
267 --
268 -- As the Validate_Enabled exception has been raised
269 -- we must rollback to the savepoint
270 --
271 rollback to update_agency_costs;
272 --
273 -- Only set output warning arguments
274 -- (Any key or derived arguments must be set to null
275 -- when validation only mode is being used.)
276 --
277 p_object_version_number := l_i_object_version_number;
278 hr_utility.set_location(' Leaving:'||l_proc, 80);
279 when others then
280 --
281 -- A validation or unexpected error has occured
282 --
283 rollback to update_agency_costs;
284 --
285 -- Reset IN OUT parameters and set OUT parameters
286 --
287 p_object_version_number := l_i_object_version_number;
288 hr_utility.set_location(' Leaving:'||l_proc, 90);
289 raise;
290
291 end update_agency_costs;
292
293 -- ----------------------------------------------------------------------------
294 -- |-----------------------< delete_agency_costs >-----------------------|
295 -- ----------------------------------------------------------------------------
296 --
297 procedure delete_agency_costs
298 (p_validate in boolean default false
299 ,p_compl_agency_cost_id in number
300 ,p_object_version_number in number
301 ) is
302 --
303 -- Declare cursors and local variables
304 --
305 l_proc varchar2(72) := g_package||'delete_agency_costs';
306 l_exists boolean := false;
307
308 begin
309 hr_utility.set_location('Entering:'|| l_proc, 5);
310 --
311 --
312 savepoint delete_agency_costs;
313 --
314 -- Truncate the time portion from all IN date parameters
315 --
316
317 --
318 -- Call Before Process User Hook
319 --
320 begin
321 ghr_compl_agency_costs_bk3.delete_agency_costs_b
322 (p_compl_agency_cost_id => p_compl_agency_cost_id
323 ,p_object_version_number => p_object_version_number
324 );
325 exception
326 when hr_api.cannot_find_prog_unit then
327 hr_api.cannot_find_prog_unit_error
328 (p_module_name => 'DELETE_AGENCY_COSTS'
329 ,p_hook_type => 'BP'
330 );
331 end;
332 --
333 -- Validation in addition to Row Handlers
334 --
335 -- Process Logic
336 ghr_cst_del.del
337 (p_compl_agency_cost_id => p_compl_agency_cost_id
338 ,p_object_version_number => p_object_version_number
339 );
340 --
341 hr_utility.set_location(l_proc, 8);
342 --
343 -- Call After Process User Hook
344 --
345 begin
346 ghr_compl_agency_costs_bk3.delete_agency_costs_a
347 (p_compl_agency_cost_id => p_compl_agency_cost_id
348 ,p_object_version_number => p_object_version_number
349 );
350 exception
351 when hr_api.cannot_find_prog_unit then
352 hr_api.cannot_find_prog_unit_error
353 (p_module_name => 'DELETE_AGENCY_COSTS'
354 ,p_hook_type => 'AP'
355 );
356 end;
357 --
358 -- When in validation only mode raise the Validate_Enabled exception
359 --
360 if p_validate then
361 raise hr_api.validate_enabled;
362 end if;
363 --
364 hr_utility.set_location(' Leaving:'||l_proc, 11);
365 exception
366 when hr_api.validate_enabled then
367 -- we must rollback to the savepoint
368 --
369 ROLLBACK TO delete_agency_costs;
370 --
371 When Others then
372 ROLLBACK TO delete_agency_costs;
376 end delete_agency_costs;
373 raise;
374
375 hr_utility.set_location(' Leaving:'||l_proc, 12);
377 end ghr_compl_agency_costs_api;
378