DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_CPT_DEL

Source


1 Package Body pay_cpt_del as
2 /* $Header: pycprrhi.pkb 120.3 2008/06/27 04:51:00 sneelapa noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_cpt_del.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< dt_delete_dml >-----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml delete logic for the datetrack
17 --   delete modes: ZAP, DELETE, FUTURE_CHANGE and DELETE_NEXT_CHANGE. The
18 --   execution is as follows:
19 --   1) To set and unset the g_api_dml status as required (as we are about to
20 --      perform dml).
21 --   2) If the delete mode is DELETE_NEXT_CHANGE then delete where the
22 --      effective start date is equal to the validation start date.
23 --   3) If the delete mode is not DELETE_NEXT_CHANGE then delete
24 --      all rows for the entity where the effective start date is greater
25 --      than or equal to the validation start date.
26 --   4) To raise any errors.
27 --
28 -- Prerequisites:
29 --   This is an internal private procedure which must be called from the
30 --   delete_dml procedure.
31 --
32 -- In Parameters:
33 --   A Pl/Sql record structre.
34 --
35 -- Post Success:
36 --   The specified row will be delete from the schema.
37 --
38 -- Post Failure:
39 --   On the delete dml failure it is important to note that we always reset the
40 --   g_api_dml status to false.
41 --   If any other error is reported, the error will be raised after the
42 --   g_api_dml status is reset.
43 --
44 -- Developer Implementation Notes:
45 --   This is an internal private procedure which must be called from the
46 --   delete_dml procedure.
47 --
48 -- Access Status:
49 --   Internal Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure dt_delete_dml
54 	(p_rec 			 in out nocopy pay_cpt_shd.g_rec_type,
55 	 p_effective_date	 in	date,
56 	 p_datetrack_mode	 in	varchar2,
57 	 p_validation_start_date in	date,
58 	 p_validation_end_date	 in	date) is
59 --
60   l_proc	varchar2(72) := g_package||'dt_delete_dml';
61 --
62 Begin
63   hr_utility.set_location('Entering:'||l_proc, 5);
64   If (p_datetrack_mode = 'DELETE_NEXT_CHANGE') then
65     hr_utility.set_location(l_proc, 10);
66     pay_cpt_shd.g_api_dml := true;  -- Set the api dml status
67     --
68     -- Delete the where the effective start date is equal
69     -- to the validation end date.
70     --
71     delete from pay_ca_emp_prov_tax_info_f
72     where       emp_province_tax_inf_id = p_rec.emp_province_tax_inf_id
73     and	  effective_start_date = p_validation_start_date;
74     --
75     pay_cpt_shd.g_api_dml := false;   -- Unset the api dml status
76   Else
77     hr_utility.set_location(l_proc, 15);
78     pay_cpt_shd.g_api_dml := true;  -- Set the api dml status
79     --
80     -- Delete the row(s) where the effective start date is greater than
81     -- or equal to the validation start date.
82     --
83     delete from pay_ca_emp_prov_tax_info_f
84     where        emp_province_tax_inf_id = p_rec.emp_province_tax_inf_id
85     and	  effective_start_date >= p_validation_start_date;
86     --
87     pay_cpt_shd.g_api_dml := false;   -- Unset the api dml status
88   End If;
89   --
90   hr_utility.set_location(' Leaving:'||l_proc, 20);
91 --
92 Exception
93   When Others Then
94     pay_cpt_shd.g_api_dml := false;   -- Unset the api dml status
95     Raise;
96 End dt_delete_dml;
97 --
98 -- ----------------------------------------------------------------------------
99 -- |------------------------------< delete_dml >------------------------------|
100 -- ----------------------------------------------------------------------------
101 Procedure delete_dml
102 	(p_rec 			 in out nocopy pay_cpt_shd.g_rec_type,
103 	 p_effective_date	 in	date,
104 	 p_datetrack_mode	 in	varchar2,
105 	 p_validation_start_date in	date,
106 	 p_validation_end_date	 in	date) is
107 --
108   l_proc	varchar2(72) := g_package||'delete_dml';
109 --
110 Begin
111   hr_utility.set_location('Entering:'||l_proc, 5);
112   --
113   dt_delete_dml(p_rec			=> p_rec,
114 		p_effective_date	=> p_effective_date,
115 		p_datetrack_mode	=> p_datetrack_mode,
116        		p_validation_start_date	=> p_validation_start_date,
117 		p_validation_end_date	=> p_validation_end_date);
118   --
119   hr_utility.set_location(' Leaving:'||l_proc, 10);
120 End delete_dml;
121 --
122 -- ----------------------------------------------------------------------------
123 -- |----------------------------< dt_pre_delete >-----------------------------|
124 -- ----------------------------------------------------------------------------
125 -- {Start Of Comments}
126 --
127 -- Description:
128 --   The dt_pre_delete process controls the execution of dml
129 --   for the datetrack modes: DELETE, FUTURE_CHANGE
130 --   and DELETE_NEXT_CHANGE only.
131 --
132 -- Prerequisites:
133 --   This is an internal procedure which is called from the pre_delete
134 --   procedure.
135 --
136 -- In Parameters:
137 --   A Pl/Sql record structre.
138 --
139 -- Post Success:
140 --   Processing continues.
141 --
142 -- Post Failure:
143 --   If an error has occurred, an error message and exception will be raised
144 --   but not handled.
145 --
146 -- Developer Implementation Notes:
147 --   This is an internal procedure which is required by Datetrack. Don't
148 --   remove or modify.
149 --
150 -- Access Status:
151 --   Internal Row Handler Use Only.
152 --
153 -- {End Of Comments}
154 -- ----------------------------------------------------------------------------
155 Procedure dt_pre_delete
156 	(p_rec 			 in out nocopy pay_cpt_shd.g_rec_type,
157 	 p_effective_date	 in	date,
158 	 p_datetrack_mode	 in	varchar2,
159 	 p_validation_start_date in	date,
160 	 p_validation_end_date	 in	date) is
161 --
162   l_proc	varchar2(72) := g_package||'dt_pre_delete';
163 --
164 Begin
165   hr_utility.set_location('Entering:'||l_proc, 5);
166   --
167   If (p_datetrack_mode <> 'ZAP') then
168     --
169     p_rec.effective_start_date := pay_cpt_shd.g_old_rec.effective_start_date;
170     --
171     If (p_datetrack_mode = 'DELETE') then
172       p_rec.effective_end_date := p_validation_start_date - 1;
173     Else
174       p_rec.effective_end_date := p_validation_end_date;
175     End If;
176     --
177     -- Update the current effective end date record
178     --
179     pay_cpt_shd.upd_effective_end_date
180       (p_effective_date	        => p_effective_date,
181        p_base_key_value	        => p_rec.emp_province_tax_inf_id,
182        p_new_effective_end_date => p_rec.effective_end_date,
183        p_validation_start_date  => p_validation_start_date,
184        p_validation_end_date	=> p_validation_end_date,
185        p_object_version_number  => p_rec.object_version_number);
186   Else
187     p_rec.effective_start_date := null;
188     p_rec.effective_end_date   := null;
189   End If;
190   hr_utility.set_location(' Leaving:'||l_proc, 10);
191 End dt_pre_delete;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |------------------------------< pre_delete >------------------------------|
195 -- ----------------------------------------------------------------------------
196 -- {Start Of Comments}
197 --
198 -- Description:
199 --   This private procedure contains any processing which is required before
200 --   the delete dml.
201 --
202 -- Prerequisites:
203 --   This is an internal procedure which is called from the del procedure.
204 --
205 -- In Parameters:
206 --   A Pl/Sql record structre.
207 --
208 -- Post Success:
209 --   Processing continues.
210 --
211 -- Post Failure:
212 --   If an error has occurred, an error message and exception will be raised
213 --   but not handled.
214 --
215 -- Developer Implementation Notes:
216 --   Any pre-processing required before the delete dml is issued should be
217 --   coded within this procedure. It is important to note that any 3rd party
218 --   maintenance should be reviewed before placing in this procedure. The call
219 --   to the dt_delete_dml procedure should NOT be removed.
220 --
221 -- Access Status:
222 --   Internal Row Handler Use Only.
223 --
224 -- {End Of Comments}
225 -- ----------------------------------------------------------------------------
226 Procedure pre_delete
227 	(p_rec 			 in out nocopy pay_cpt_shd.g_rec_type,
228 	 p_effective_date	 in	date,
229 	 p_datetrack_mode	 in	varchar2,
230 	 p_validation_start_date in	date,
231 	 p_validation_end_date	 in	date) is
232 --
233   l_proc	varchar2(72) := g_package||'pre_delete';
234 --
235   --
236 --
237 Begin
238   hr_utility.set_location('Entering:'||l_proc, 5);
239   --
240   --
241   --
242   dt_pre_delete
243     (p_rec 		     => p_rec,
244      p_effective_date	     => p_effective_date,
245      p_datetrack_mode	     => p_datetrack_mode,
246      p_validation_start_date => p_validation_start_date,
247      p_validation_end_date   => p_validation_end_date);
248   --
249   hr_utility.set_location(' Leaving:'||l_proc, 10);
250 End pre_delete;
251 --
252 -- ----------------------------------------------------------------------------
253 -- |-----------------------------< post_delete >------------------------------|
254 -- ----------------------------------------------------------------------------
255 -- {Start Of Comments}
256 --
257 -- Description:
258 --   This private procedure contains any processing which is required after the
259 --   delete dml.
260 --
261 -- Prerequisites:
262 --   This is an internal procedure which is called from the del procedure.
263 --
264 -- In Parameters:
265 --   A Pl/Sql record structre.
266 --
267 -- Post Success:
268 --   Processing continues.
269 --
270 -- Post Failure:
271 --   If an error has occurred, an error message and exception will be raised
272 --   but not handled.
273 --
274 -- Developer Implementation Notes:
275 --   Any post-processing required after the delete dml is issued should be
276 --   coded within this procedure. It is important to note that any 3rd party
277 --   maintenance should be reviewed before placing in this procedure.
278 --
279 -- Access Status:
280 --   Internal Row Handler Use Only.
281 --
282 -- {End Of Comments}
283 -- ----------------------------------------------------------------------------
284 Procedure post_delete
285 	(p_rec 			 in pay_cpt_shd.g_rec_type,
286 	 p_effective_date	 in date,
287 	 p_datetrack_mode	 in varchar2,
288 	 p_validation_start_date in date,
289 	 p_validation_end_date	 in date) is
290 --
291   l_proc	varchar2(72) := g_package||'post_delete';
292 --
293 Begin
294   hr_utility.set_location('Entering:'||l_proc, 5);
295 --
296   --
297   -- Start of API User Hook for post_delete.
298   --
299   begin
300     --
301     pay_cpt_rkd.after_delete
302       (
303   p_emp_province_tax_inf_id       =>p_rec.emp_province_tax_inf_id
304  ,p_datetrack_mode                =>p_datetrack_mode
305  ,p_validation_start_date         =>p_validation_start_date
306  ,p_validation_end_date           =>p_validation_end_date
307  ,p_effective_start_date          =>p_rec.effective_start_date
308  ,p_effective_end_date            =>p_rec.effective_end_date
309  ,p_effective_start_date_o        =>pay_cpt_shd.g_old_rec.effective_start_date
310  ,p_effective_end_date_o          =>pay_cpt_shd.g_old_rec.effective_end_date
311  ,p_legislation_code_o            =>pay_cpt_shd.g_old_rec.legislation_code
312  ,p_assignment_id_o               =>pay_cpt_shd.g_old_rec.assignment_id
313  ,p_business_group_id_o           =>pay_cpt_shd.g_old_rec.business_group_id
314  ,p_province_code_o               =>pay_cpt_shd.g_old_rec.province_code
315  ,p_jurisdiction_code_o           =>pay_cpt_shd.g_old_rec.jurisdiction_code
316  ,p_tax_credit_amount_o           =>pay_cpt_shd.g_old_rec.tax_credit_amount
317  ,p_basic_exemption_flag_o        =>pay_cpt_shd.g_old_rec.basic_exemption_flag
318  ,p_deduction_code_o              =>pay_cpt_shd.g_old_rec.deduction_code
319  ,p_extra_info_not_provided_o     =>pay_cpt_shd.g_old_rec.extra_info_not_provided
320  ,p_marriage_status_o             =>pay_cpt_shd.g_old_rec.marriage_status
321  ,p_no_of_infirm_dependants_o     =>pay_cpt_shd.g_old_rec.no_of_infirm_dependants
322  ,p_non_resident_status_o         =>pay_cpt_shd.g_old_rec.non_resident_status
323  ,p_disability_status_o           =>pay_cpt_shd.g_old_rec.disability_status
324  ,p_no_of_dependants_o            =>pay_cpt_shd.g_old_rec.no_of_dependants
325  ,p_annual_dedn_o                 =>pay_cpt_shd.g_old_rec.annual_dedn
326  ,p_total_expense_by_commissio_o =>pay_cpt_shd.g_old_rec.total_expense_by_commission
327  ,p_total_remnrtn_by_commissio_o =>pay_cpt_shd.g_old_rec.total_remnrtn_by_commission
328  ,p_prescribed_zone_dedn_amt_o    =>pay_cpt_shd.g_old_rec.prescribed_zone_dedn_amt
329  ,p_additional_tax_o              =>pay_cpt_shd.g_old_rec.additional_tax
330  ,p_prov_override_rate_o          =>pay_cpt_shd.g_old_rec.prov_override_rate
331  ,p_prov_override_amount_o        =>pay_cpt_shd.g_old_rec.prov_override_amount
332  ,p_prov_exempt_flag_o            =>pay_cpt_shd.g_old_rec.prov_exempt_flag
333  ,p_pmed_exempt_flag_o            =>pay_cpt_shd.g_old_rec.pmed_exempt_flag
334  ,p_wc_exempt_flag_o              =>pay_cpt_shd.g_old_rec.wc_exempt_flag
335  ,p_qpp_exempt_flag_o             =>pay_cpt_shd.g_old_rec.qpp_exempt_flag
336  ,p_tax_calc_method_o             =>pay_cpt_shd.g_old_rec.tax_calc_method
337  ,p_other_tax_credit_o            =>pay_cpt_shd.g_old_rec.other_tax_credit
338  ,p_ca_tax_information_categor_o =>pay_cpt_shd.g_old_rec.ca_tax_information_category
339  ,p_ca_tax_information1_o         =>pay_cpt_shd.g_old_rec.ca_tax_information1
340  ,p_ca_tax_information2_o         =>pay_cpt_shd.g_old_rec.ca_tax_information2
341  ,p_ca_tax_information3_o         =>pay_cpt_shd.g_old_rec.ca_tax_information3
342  ,p_ca_tax_information4_o         =>pay_cpt_shd.g_old_rec.ca_tax_information4
343  ,p_ca_tax_information5_o         =>pay_cpt_shd.g_old_rec.ca_tax_information5
344  ,p_ca_tax_information6_o         =>pay_cpt_shd.g_old_rec.ca_tax_information6
345  ,p_ca_tax_information7_o         =>pay_cpt_shd.g_old_rec.ca_tax_information7
346  ,p_ca_tax_information8_o         =>pay_cpt_shd.g_old_rec.ca_tax_information8
347  ,p_ca_tax_information9_o         =>pay_cpt_shd.g_old_rec.ca_tax_information9
348  ,p_ca_tax_information10_o        =>pay_cpt_shd.g_old_rec.ca_tax_information10
349  ,p_ca_tax_information11_o        =>pay_cpt_shd.g_old_rec.ca_tax_information11
350  ,p_ca_tax_information12_o        =>pay_cpt_shd.g_old_rec.ca_tax_information12
351  ,p_ca_tax_information13_o        =>pay_cpt_shd.g_old_rec.ca_tax_information13
352  ,p_ca_tax_information14_o        =>pay_cpt_shd.g_old_rec.ca_tax_information14
353  ,p_ca_tax_information15_o        =>pay_cpt_shd.g_old_rec.ca_tax_information15
354  ,p_ca_tax_information16_o        =>pay_cpt_shd.g_old_rec.ca_tax_information16
355  ,p_ca_tax_information17_o        =>pay_cpt_shd.g_old_rec.ca_tax_information17
356  ,p_ca_tax_information18_o        =>pay_cpt_shd.g_old_rec.ca_tax_information18
357  ,p_ca_tax_information19_o        =>pay_cpt_shd.g_old_rec.ca_tax_information19
358  ,p_ca_tax_information20_o        =>pay_cpt_shd.g_old_rec.ca_tax_information20
359  ,p_ca_tax_information21_o        =>pay_cpt_shd.g_old_rec.ca_tax_information21
360  ,p_ca_tax_information22_o        =>pay_cpt_shd.g_old_rec.ca_tax_information22
361  ,p_ca_tax_information23_o        =>pay_cpt_shd.g_old_rec.ca_tax_information23
362  ,p_ca_tax_information24_o        =>pay_cpt_shd.g_old_rec.ca_tax_information24
363  ,p_ca_tax_information25_o        =>pay_cpt_shd.g_old_rec.ca_tax_information25
364  ,p_ca_tax_information26_o        =>pay_cpt_shd.g_old_rec.ca_tax_information26
365  ,p_ca_tax_information27_o        =>pay_cpt_shd.g_old_rec.ca_tax_information27
366  ,p_ca_tax_information28_o        =>pay_cpt_shd.g_old_rec.ca_tax_information28
367  ,p_ca_tax_information29_o        =>pay_cpt_shd.g_old_rec.ca_tax_information29
368  ,p_ca_tax_information30_o        =>pay_cpt_shd.g_old_rec.ca_tax_information30
369  ,p_object_version_number_o       =>pay_cpt_shd.g_old_rec.object_version_number
370  ,p_prov_lsp_amount_o             =>pay_cpt_shd.g_old_rec.prov_lsp_amount
371  ,p_ppip_exempt_flag_o             =>pay_cpt_shd.g_old_rec.ppip_exempt_flag
372       );
373     --
374   exception
375     --
376     when hr_api.cannot_find_prog_unit then
377       --
378       hr_api.cannot_find_prog_unit_error
379         (p_module_name => 'pay_ca_emp_prov_tax_info_f'
380         ,p_hook_type   => 'AD');
381       --
382   end;
383   --
384   -- End of API User Hook for post_delete.
385   --
386   --
387   hr_utility.set_location(' Leaving:'||l_proc, 10);
388 End post_delete;
389 --
390 -- ----------------------------------------------------------------------------
391 -- |---------------------------------< del >----------------------------------|
392 -- ----------------------------------------------------------------------------
393 Procedure del
394   (
395   p_rec			in out 	nocopy pay_cpt_shd.g_rec_type,
396   p_effective_date	in 	date,
397   p_datetrack_mode	in 	varchar2
398   ) is
399 --
400   l_proc			varchar2(72) := g_package||'del';
401   l_validation_start_date	date;
402   l_validation_end_date		date;
403 --
404 Begin
405   hr_utility.set_location('Entering:'||l_proc, 5);
406   --
407   -- Ensure that the DateTrack delete mode is valid
408   --
409   dt_api.validate_dt_del_mode(p_datetrack_mode => p_datetrack_mode);
410   --
411   -- We must lock the row which we need to delete.
412   --
413   pay_cpt_shd.lck
414 	(p_effective_date	 => p_effective_date,
415       	 p_datetrack_mode	 => p_datetrack_mode,
416       	 p_emp_province_tax_inf_id	 => p_rec.emp_province_tax_inf_id,
417       	 p_object_version_number => p_rec.object_version_number,
418       	 p_validation_start_date => l_validation_start_date,
419       	 p_validation_end_date	 => l_validation_end_date);
420   --
421   -- Call the supporting delete validate operation
422   --
423   pay_cpt_bus.delete_validate
424 	(p_rec			 => p_rec,
425 	 p_effective_date	 => p_effective_date,
426 	 p_datetrack_mode	 => p_datetrack_mode,
427 	 p_validation_start_date => l_validation_start_date,
428 	 p_validation_end_date	 => l_validation_end_date);
429   --
430   -- Call the supporting pre-delete operation
431   --
432   pre_delete
433 	(p_rec			 => p_rec,
434 	 p_effective_date	 => p_effective_date,
435 	 p_datetrack_mode	 => p_datetrack_mode,
436 	 p_validation_start_date => l_validation_start_date,
437 	 p_validation_end_date	 => l_validation_end_date);
438   --
439   -- Delete the row.
440   --
441   delete_dml
442 	(p_rec			 => p_rec,
443 	 p_effective_date	 => p_effective_date,
444 	 p_datetrack_mode	 => p_datetrack_mode,
445 	 p_validation_start_date => l_validation_start_date,
446 	 p_validation_end_date	 => l_validation_end_date);
447   --
448   -- Call the supporting post-delete operation
449   --
450 /*
451   post_delete
452 	(p_rec			 => p_rec,
453 	 p_effective_date	 => p_effective_date,
454 	 p_datetrack_mode	 => p_datetrack_mode,
455 	 p_validation_start_date => l_validation_start_date,
456 	 p_validation_end_date	 => l_validation_end_date);
457 */
458 End del;
459 --
460 -- ----------------------------------------------------------------------------
461 -- |---------------------------------< del >----------------------------------|
462 -- ----------------------------------------------------------------------------
463 Procedure del
464   (
465   p_emp_province_tax_inf_id	  in 	 number,
466   p_effective_start_date     out nocopy date,
467   p_effective_end_date	     out nocopy date,
468   p_object_version_number in out nocopy number,
469   p_effective_date	  in     date,
470   p_datetrack_mode  	  in     varchar2
471   ) is
472 --
473   l_rec		pay_cpt_shd.g_rec_type;
474   l_proc	varchar2(72) := g_package||'del';
475 --
476 Begin
477   hr_utility.set_location('Entering:'||l_proc, 5);
478   --
479   -- As the delete procedure accepts a plsql record structure we do need to
480   -- convert the  arguments into the record structure.
481   -- We don't need to call the supplied conversion argument routine as we
482   -- only need a few attributes.
483   --
484   l_rec.emp_province_tax_inf_id		:= p_emp_province_tax_inf_id;
485   l_rec.object_version_number 	:= p_object_version_number;
486   --
487   -- Having converted the arguments into the pay_cpt_rec
488   -- plsql record structure we must call the corresponding entity
489   -- business process
490   --
491   del(l_rec, p_effective_date, p_datetrack_mode);
492   --
493   -- Set the out arguments
494   --
495   p_object_version_number := l_rec.object_version_number;
496   p_effective_start_date  := l_rec.effective_start_date;
497   p_effective_end_date    := l_rec.effective_end_date;
498   --
499   hr_utility.set_location(' Leaving:'||l_proc, 10);
500 End del;
501 --
502 end pay_cpt_del;