DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_CPT_INS

Source


1 Package Body pay_cpt_ins 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_ins.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< dt_insert_dml >-----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml insert logic for datetrack. The
17 --   functions of this procedure are as follows:
18 --   1) Get the object_version_number.
19 --   2) To set the effective start and end dates to the corresponding
20 --      validation start and end dates. Also, the object version number
21 --      record attribute is set.
22 --   3) To set and unset the g_api_dml status as required (as we are about to
23 --      perform dml).
24 --   4) To insert the row into the schema with the derived effective start
25 --      and end dates and the object version number.
26 --   5) To trap any constraint violations that may have occurred.
27 --   6) To raise any other errors.
28 --
29 -- Prerequisites:
30 --   This is an internal private procedure which must be called from the
31 --   insert_dml and pre_update (logic permitting) procedure and must have
32 --   all mandatory arguments set.
33 --
34 -- In Parameters:
35 --   A Pl/Sql record structre.
36 --
37 -- Post Success:
38 --   The specified row will be inserted into the schema.
39 --
40 -- Post Failure:
41 --   On the insert dml failure it is important to note that we always reset the
42 --   g_api_dml status to false.
43 --   If a check or unique integrity constraint violation is raised the
44 --   constraint_error procedure will be called.
45 --   If any other error is reported, the error will be raised after the
46 --   g_api_dml status is reset.
47 --
48 -- Developer Implementation Notes:
49 --   This is an internal datetrack maintenance procedure which should
50 --   not be modified in anyway.
51 --
52 -- Access Status:
53 --   Internal Row Handler Use Only.
54 --
55 -- {End Of Comments}
56 -- ----------------------------------------------------------------------------
57 Procedure dt_insert_dml
58 	(p_rec 			 in out nocopy pay_cpt_shd.g_rec_type,
59 	 p_effective_date	 in	date,
60 	 p_datetrack_mode	 in	varchar2,
61 	 p_validation_start_date in	date,
62 	 p_validation_end_date	 in	date) is
63 --
64 -- Cursor to select 'old' created AOL who column values
65 --
66   Cursor C_Sel1 Is
67     select t.created_by,
68            t.creation_date
69     from   pay_ca_emp_prov_tax_info_f t
70     where  t.emp_province_tax_inf_id       = p_rec.emp_province_tax_inf_id
71     and    t.effective_start_date =
72              pay_cpt_shd.g_old_rec.effective_start_date
73     and    t.effective_end_date   = (p_validation_start_date - 1);
74 --
75   l_proc		varchar2(72) := g_package||'dt_insert_dml';
76   l_created_by          pay_ca_emp_prov_tax_info_f.created_by%TYPE;
77   l_creation_date       pay_ca_emp_prov_tax_info_f.creation_date%TYPE;
78   l_last_update_date   	pay_ca_emp_prov_tax_info_f.last_update_date%TYPE;
79   l_last_updated_by     pay_ca_emp_prov_tax_info_f.last_updated_by%TYPE;
80   l_last_update_login   pay_ca_emp_prov_tax_info_f.last_update_login%TYPE;
81 --
82 Begin
83   hr_utility.set_location('Entering:'||l_proc, 5);
84   --
85   -- Get the object version number for the insert
86   --
87   p_rec.object_version_number :=
88     dt_api.get_object_version_number
89 	(p_base_table_name => 'pay_ca_emp_prov_tax_info_f',
90 	 p_base_key_column => 'emp_province_tax_inf_id',
91 	 p_base_key_value  => p_rec.emp_province_tax_inf_id);
92   --
93   -- Set the effective start and end dates to the corresponding
94   -- validation start and end dates
95   --
96   p_rec.effective_start_date := p_validation_start_date;
97   p_rec.effective_end_date   := p_validation_end_date;
98   --
99   -- If the datetrack_mode is not INSERT then we must populate the WHO
100   -- columns with the 'old' creation values and 'new' updated values.
101   --
102   If (p_datetrack_mode <> 'INSERT') then
103     hr_utility.set_location(l_proc, 10);
104     --
105     -- Select the 'old' created values
106     --
107     Open C_Sel1;
108     Fetch C_Sel1 Into l_created_by, l_creation_date;
109     If C_Sel1%notfound Then
110       --
111       -- The previous 'old' created row has not been found. We need
112       -- to error as an internal datetrack problem exists.
113       --
114       Close C_Sel1;
115       hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
116       hr_utility.set_message_token('PROCEDURE', l_proc);
117       hr_utility.set_message_token('STEP','10');
118       hr_utility.raise_error;
119     End If;
120     Close C_Sel1;
121     --
122     -- Set the AOL updated WHO values
123     --
124     l_last_update_date   := sysdate;
125     l_last_updated_by    := fnd_global.user_id;
126     l_last_update_login  := fnd_global.login_id;
127   End If;
128   --
129   pay_cpt_shd.g_api_dml := true;  -- Set the api dml status
130   --
131   -- Insert the row into: pay_ca_emp_prov_tax_info_f
132   --
133   insert into pay_ca_emp_prov_tax_info_f
134   (	emp_province_tax_inf_id,
135 	effective_start_date,
136 	effective_end_date,
137 	legislation_code,
138 	assignment_id,
139 	business_group_id,
140 	province_code,
141 	jurisdiction_code,
142 	tax_credit_amount,
143 	basic_exemption_flag,
144 	deduction_code,
145 	extra_info_not_provided,
146 	marriage_status,
147 	no_of_infirm_dependants,
148 	non_resident_status,
149 	disability_status,
150 	no_of_dependants,
151 	annual_dedn,
152 	total_expense_by_commission,
153 	total_remnrtn_by_commission,
154 	prescribed_zone_dedn_amt,
155 	additional_tax,
156 	prov_override_rate,
157 	prov_override_amount,
158 	prov_exempt_flag,
159 	pmed_exempt_flag,
160 	wc_exempt_flag,
161 	qpp_exempt_flag,
162 	tax_calc_method,
163 	other_tax_credit,
164 	ca_tax_information_category,
165 	ca_tax_information1,
166 	ca_tax_information2,
167 	ca_tax_information3,
168 	ca_tax_information4,
169 	ca_tax_information5,
170 	ca_tax_information6,
171 	ca_tax_information7,
172 	ca_tax_information8,
173 	ca_tax_information9,
174 	ca_tax_information10,
175 	ca_tax_information11,
176 	ca_tax_information12,
177 	ca_tax_information13,
178 	ca_tax_information14,
179 	ca_tax_information15,
180 	ca_tax_information16,
181 	ca_tax_information17,
182 	ca_tax_information18,
183 	ca_tax_information19,
184 	ca_tax_information20,
185 	ca_tax_information21,
186 	ca_tax_information22,
187 	ca_tax_information23,
188 	ca_tax_information24,
189 	ca_tax_information25,
190 	ca_tax_information26,
191 	ca_tax_information27,
192 	ca_tax_information28,
193 	ca_tax_information29,
194 	ca_tax_information30,
195 	object_version_number,
196 	prov_lsp_amount,
197 	created_by,
198    	creation_date,
199    	last_update_date,
200    	last_updated_by,
201    	last_update_login,
202         ppip_exempt_flag
203   )
204   Values
205   (	p_rec.emp_province_tax_inf_id,
206 	p_rec.effective_start_date,
207 	p_rec.effective_end_date,
208 	p_rec.legislation_code,
209 	p_rec.assignment_id,
210 	p_rec.business_group_id,
211 	p_rec.province_code,
212 	p_rec.jurisdiction_code,
213 	p_rec.tax_credit_amount,
214 	p_rec.basic_exemption_flag,
215 	p_rec.deduction_code,
216 	p_rec.extra_info_not_provided,
217 	p_rec.marriage_status,
218 	p_rec.no_of_infirm_dependants,
219 	p_rec.non_resident_status,
220 	p_rec.disability_status,
221 	p_rec.no_of_dependants,
222 	p_rec.annual_dedn,
223 	p_rec.total_expense_by_commission,
224 	p_rec.total_remnrtn_by_commission,
225 	p_rec.prescribed_zone_dedn_amt,
226 	p_rec.additional_tax,
227 	p_rec.prov_override_rate,
228 	p_rec.prov_override_amount,
229 	p_rec.prov_exempt_flag,
230 	p_rec.pmed_exempt_flag,
231 	p_rec.wc_exempt_flag,
232 	p_rec.qpp_exempt_flag,
233 	p_rec.tax_calc_method,
234 	p_rec.other_tax_credit,
235 	p_rec.ca_tax_information_category,
236 	p_rec.ca_tax_information1,
237 	p_rec.ca_tax_information2,
238 	p_rec.ca_tax_information3,
239 	p_rec.ca_tax_information4,
240 	p_rec.ca_tax_information5,
241 	p_rec.ca_tax_information6,
242 	p_rec.ca_tax_information7,
243 	p_rec.ca_tax_information8,
244 	p_rec.ca_tax_information9,
245 	p_rec.ca_tax_information10,
246 	p_rec.ca_tax_information11,
247 	p_rec.ca_tax_information12,
248 	p_rec.ca_tax_information13,
249 	p_rec.ca_tax_information14,
250 	p_rec.ca_tax_information15,
251 	p_rec.ca_tax_information16,
252 	p_rec.ca_tax_information17,
253 	p_rec.ca_tax_information18,
254 	p_rec.ca_tax_information19,
255 	p_rec.ca_tax_information20,
256 	p_rec.ca_tax_information21,
257 	p_rec.ca_tax_information22,
258 	p_rec.ca_tax_information23,
259 	p_rec.ca_tax_information24,
260 	p_rec.ca_tax_information25,
261 	p_rec.ca_tax_information26,
262 	p_rec.ca_tax_information27,
263 	p_rec.ca_tax_information28,
264 	p_rec.ca_tax_information29,
265 	p_rec.ca_tax_information30,
266 	p_rec.object_version_number,
267 	p_rec.prov_lsp_amount,
268 	l_created_by,
269    	l_creation_date,
270    	l_last_update_date,
271    	l_last_updated_by,
272    	l_last_update_login,
273 	p_rec.ppip_exempt_flag
274   );
275   --
276   pay_cpt_shd.g_api_dml := false;   -- Unset the api dml status
277   hr_utility.set_location(' Leaving:'||l_proc, 15);
278 --
279 Exception
280   When hr_api.check_integrity_violated Then
281     -- A check constraint has been violated
282     pay_cpt_shd.g_api_dml := false;   -- Unset the api dml status
283     pay_cpt_shd.constraint_error
284       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
285   When hr_api.unique_integrity_violated Then
286     -- Unique integrity has been violated
287     pay_cpt_shd.g_api_dml := false;   -- Unset the api dml status
288     pay_cpt_shd.constraint_error
289       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
290   When Others Then
291     pay_cpt_shd.g_api_dml := false;   -- Unset the api dml status
292     Raise;
293 End dt_insert_dml;
294 --
295 -- ----------------------------------------------------------------------------
296 -- |------------------------------< insert_dml >------------------------------|
297 -- ----------------------------------------------------------------------------
298 Procedure insert_dml
299 	(p_rec 			 in out nocopy pay_cpt_shd.g_rec_type,
300 	 p_effective_date	 in	date,
301 	 p_datetrack_mode	 in	varchar2,
302 	 p_validation_start_date in	date,
303 	 p_validation_end_date	 in	date) is
304 --
305   l_proc	varchar2(72) := g_package||'insert_dml';
306 --
307 Begin
308   hr_utility.set_location('Entering:'||l_proc, 5);
309   --
310   dt_insert_dml(p_rec			=> p_rec,
311 		p_effective_date	=> p_effective_date,
312 		p_datetrack_mode	=> p_datetrack_mode,
313        		p_validation_start_date	=> p_validation_start_date,
314 		p_validation_end_date	=> p_validation_end_date);
315   --
316   hr_utility.set_location(' Leaving:'||l_proc, 10);
317 End insert_dml;
318 --
319 -- ----------------------------------------------------------------------------
320 -- |------------------------------< pre_insert >------------------------------|
321 -- ----------------------------------------------------------------------------
322 -- {Start Of Comments}
323 --
324 -- Description:
325 --   This private procedure contains any processing which is required before
326 --   the insert dml. Presently, if the entity has a corresponding primary
327 --   key which is maintained by an associating sequence, the primary key for
328 --   the entity will be populated with the next sequence value in
329 --   preparation for the insert dml.
330 --   Also, if comments are defined for this entity, the comments insert
331 --   logic will also be called, generating a comment_id if required.
332 --
333 -- Prerequisites:
334 --   This is an internal procedure which is called from the ins procedure.
335 --
336 -- In Parameters:
337 --   A Pl/Sql record structre.
338 --
339 -- Post Success:
340 --   Processing continues.
341 --
342 -- Post Failure:
343 --   If an error has occurred, an error message and exception will be raised
344 --   but not handled.
345 --
346 -- Developer Implementation Notes:
347 --   Any pre-processing required before the insert dml is issued should be
348 --   coded within this procedure. As stated above, a good example is the
349 --   generation of a primary key number via a corresponding sequence.
350 --   It is important to note that any 3rd party maintenance should be reviewed
351 --   before placing in this procedure.
352 --
353 -- Access Status:
354 --   Internal Row Handler Use Only.
355 --
356 -- {End Of Comments}
357 -- ----------------------------------------------------------------------------
358 Procedure pre_insert
359 	(p_rec  			in out nocopy pay_cpt_shd.g_rec_type,
360 	 p_effective_date		in date,
361 	 p_datetrack_mode		in varchar2,
362 	 p_validation_start_date	in date,
363 	 p_validation_end_date		in date) is
364 --
365   l_proc	varchar2(72) := g_package||'pre_insert';
366 --
367   Cursor C_Sel1 is select pay_ca_emp_prov_tax_info_s.nextval from sys.dual;
368 --
369 Begin
370   hr_utility.set_location('Entering:'||l_proc, 5);
371   --
372   --
373   -- Select the next sequence number
374   --
375   Open C_Sel1;
376   Fetch C_Sel1 Into p_rec.emp_province_tax_inf_id;
377   Close C_Sel1;
378   --
379   --
380   hr_utility.set_location(' Leaving:'||l_proc, 10);
381 End pre_insert;
382 --
383 -- ----------------------------------------------------------------------------
384 -- |-----------------------------< post_insert >------------------------------|
385 -- ----------------------------------------------------------------------------
386 -- {Start Of Comments}
387 --
388 -- Description:
389 --   This private procedure contains any processing which is required after the
390 --   insert dml.
391 --
392 -- Prerequisites:
393 --   This is an internal procedure which is called from the ins procedure.
394 --
395 -- In Parameters:
396 --   A Pl/Sql record structre.
397 --
398 -- Post Success:
399 --   Processing continues.
400 --
401 -- Post Failure:
402 --   If an error has occurred, an error message and exception will be raised
403 --   but not handled.
404 --
405 -- Developer Implementation Notes:
406 --   Any post-processing required after the insert dml is issued should be
407 --   coded within this procedure. It is important to note that any 3rd party
408 --   maintenance should be reviewed before placing in this procedure.
409 --
410 -- Access Status:
411 --   Internal Row Handler Use Only.
412 --
413 -- {End Of Comments}
414 -- ----------------------------------------------------------------------------
415 Procedure post_insert
416 	(p_rec 			 in pay_cpt_shd.g_rec_type,
417 	 p_effective_date	 in date,
418 	 p_datetrack_mode	 in varchar2,
419 	 p_validation_start_date in date,
420 	 p_validation_end_date	 in date) is
421 --
422   l_proc	varchar2(72) := g_package||'post_insert';
423 --
424 Begin
425   hr_utility.set_location('Entering:'||l_proc, 5);
426 --
427   --
428   -- Start of API User Hook for post_insert.
429   --
430   begin
431     --
432     pay_cpt_rki.after_insert
433       (
434   p_emp_province_tax_inf_id       =>p_rec.emp_province_tax_inf_id
435  ,p_effective_start_date          =>p_rec.effective_start_date
436  ,p_effective_end_date            =>p_rec.effective_end_date
437  ,p_legislation_code              =>p_rec.legislation_code
438  ,p_assignment_id                 =>p_rec.assignment_id
439  ,p_business_group_id             =>p_rec.business_group_id
440  ,p_province_code                 =>p_rec.province_code
441  ,p_jurisdiction_code             =>p_rec.jurisdiction_code
442  ,p_tax_credit_amount             =>p_rec.tax_credit_amount
443  ,p_basic_exemption_flag          =>p_rec.basic_exemption_flag
444  ,p_deduction_code                =>p_rec.deduction_code
445  ,p_extra_info_not_provided       =>p_rec.extra_info_not_provided
446  ,p_marriage_status               =>p_rec.marriage_status
447  ,p_no_of_infirm_dependants       =>p_rec.no_of_infirm_dependants
448  ,p_non_resident_status           =>p_rec.non_resident_status
449  ,p_disability_status             =>p_rec.disability_status
450  ,p_no_of_dependants              =>p_rec.no_of_dependants
451  ,p_annual_dedn                   =>p_rec.annual_dedn
452  ,p_total_expense_by_commission   =>p_rec.total_expense_by_commission
453  ,p_total_remnrtn_by_commission   =>p_rec.total_remnrtn_by_commission
454  ,p_prescribed_zone_dedn_amt      =>p_rec.prescribed_zone_dedn_amt
455  ,p_additional_tax                =>p_rec.additional_tax
456  ,p_prov_override_rate            =>p_rec.prov_override_rate
457  ,p_prov_override_amount          =>p_rec.prov_override_amount
458  ,p_prov_exempt_flag              =>p_rec.prov_exempt_flag
459  ,p_pmed_exempt_flag              =>p_rec.pmed_exempt_flag
460  ,p_wc_exempt_flag                =>p_rec.wc_exempt_flag
461  ,p_qpp_exempt_flag               =>p_rec.qpp_exempt_flag
462  ,p_tax_calc_method               =>p_rec.tax_calc_method
463  ,p_other_tax_credit              =>p_rec.other_tax_credit
464  ,p_ca_tax_information_category   =>p_rec.ca_tax_information_category
465  ,p_ca_tax_information1           =>p_rec.ca_tax_information1
466  ,p_ca_tax_information2           =>p_rec.ca_tax_information2
467  ,p_ca_tax_information3           =>p_rec.ca_tax_information3
468  ,p_ca_tax_information4           =>p_rec.ca_tax_information4
469  ,p_ca_tax_information5           =>p_rec.ca_tax_information5
470  ,p_ca_tax_information6           =>p_rec.ca_tax_information6
471  ,p_ca_tax_information7           =>p_rec.ca_tax_information7
472  ,p_ca_tax_information8           =>p_rec.ca_tax_information8
473  ,p_ca_tax_information9           =>p_rec.ca_tax_information9
474  ,p_ca_tax_information10          =>p_rec.ca_tax_information10
475  ,p_ca_tax_information11          =>p_rec.ca_tax_information11
476  ,p_ca_tax_information12          =>p_rec.ca_tax_information12
477  ,p_ca_tax_information13          =>p_rec.ca_tax_information13
478  ,p_ca_tax_information14          =>p_rec.ca_tax_information14
479  ,p_ca_tax_information15          =>p_rec.ca_tax_information15
480  ,p_ca_tax_information16          =>p_rec.ca_tax_information16
481  ,p_ca_tax_information17          =>p_rec.ca_tax_information17
482  ,p_ca_tax_information18          =>p_rec.ca_tax_information18
483  ,p_ca_tax_information19          =>p_rec.ca_tax_information19
484  ,p_ca_tax_information20          =>p_rec.ca_tax_information20
485  ,p_ca_tax_information21          =>p_rec.ca_tax_information21
486  ,p_ca_tax_information22          =>p_rec.ca_tax_information22
487  ,p_ca_tax_information23          =>p_rec.ca_tax_information23
488  ,p_ca_tax_information24          =>p_rec.ca_tax_information24
489  ,p_ca_tax_information25          =>p_rec.ca_tax_information25
490  ,p_ca_tax_information26          =>p_rec.ca_tax_information26
491  ,p_ca_tax_information27          =>p_rec.ca_tax_information27
492  ,p_ca_tax_information28          =>p_rec.ca_tax_information28
493  ,p_ca_tax_information29          =>p_rec.ca_tax_information29
494  ,p_ca_tax_information30          =>p_rec.ca_tax_information30
495  ,p_object_version_number         =>p_rec.object_version_number
496  ,p_prov_lsp_amount               =>p_rec.prov_lsp_amount
497  ,p_effective_date                =>p_effective_date
498  ,p_validation_start_date         =>p_validation_start_date
499  ,p_validation_end_date           =>p_validation_end_date
500  ,p_ppip_exempt_flag               =>p_rec.ppip_exempt_flag
501       );
502     --
503   exception
504     --
505     when hr_api.cannot_find_prog_unit then
506       --
507       hr_api.cannot_find_prog_unit_error
508         (p_module_name => 'pay_ca_emp_prov_tax_info_f'
509         ,p_hook_type   => 'AI');
510       --
511   end;
512   --
513   -- End of API User Hook for post_insert.
514   --
515   --
516   hr_utility.set_location(' Leaving:'||l_proc, 10);
517 End post_insert;
518 --
519 -- ----------------------------------------------------------------------------
520 -- |-------------------------------< ins_lck >--------------------------------|
521 -- ----------------------------------------------------------------------------
522 -- {Start Of Comments}
523 --
524 -- Description:
525 --   The ins_lck process has one main function to perform. When inserting
526 --   a datetracked row, we must validate the DT mode.
527 --   be manipulated.
528 --
529 -- Prerequisites:
530 --   This procedure can only be called for the datetrack mode of INSERT.
531 --
532 -- In Parameters:
533 --
534 -- Post Success:
535 --   On successful completion of the ins_lck process the parental
536 --   datetracked rows will be locked providing the p_enforce_foreign_locking
537 --   argument value is TRUE.
538 --   If the p_enforce_foreign_locking argument value is FALSE then the
539 --   parential rows are not locked.
540 --
541 -- Post Failure:
542 --   The Lck process can fail for:
543 --   1) When attempting to lock the row the row could already be locked by
544 --      another user. This will raise the HR_Api.Object_Locked exception.
545 --   2) When attempting to the lock the parent which doesn't exist.
546 --      For the entity to be locked the parent must exist<>
547 --
548 -- Developer Implementation Notes:
549 --   None.
550 --
551 -- Access Status:
552 --   Internal Row Handler Use Only.
553 --
554 -- {End Of Comments}
555 -- ----------------------------------------------------------------------------
556 Procedure ins_lck
557 	(p_effective_date	 in  date,
558 	 p_datetrack_mode	 in  varchar2,
559 	 p_rec	 		 in  pay_cpt_shd.g_rec_type,
560 	 p_validation_start_date out nocopy date,
561 	 p_validation_end_date	 out nocopy date) is
562 --
563   l_proc		  varchar2(72) := g_package||'ins_lck';
564   l_validation_start_date date;
565   l_validation_end_date	  date;
566 --
567 Begin
568   hr_utility.set_location('Entering:'||l_proc, 5);
569   --
570   -- Validate the datetrack mode mode getting the validation start
571   -- and end dates for the specified datetrack operation.
572   --
573   dt_api.validate_dt_mode
574 	(p_effective_date	   => p_effective_date,
575 	 p_datetrack_mode	   => p_datetrack_mode,
576 	 p_base_table_name	   => 'pay_ca_emp_prov_tax_info_f',
577 	 p_base_key_column	   => 'emp_province_tax_inf_id',
578 	 p_base_key_value 	   => p_rec.emp_province_tax_inf_id,
579 	 p_parent_table_name1      => 'per_all_assignments_f',
580 	 p_parent_key_column1      => 'assignment_id',
581 	 p_parent_key_value1       => p_rec.assignment_id,
582          p_enforce_foreign_locking => true,
583 	 p_validation_start_date   => l_validation_start_date,
584  	 p_validation_end_date	   => l_validation_end_date);
585   --
586   -- Set the validation start and end date OUT arguments
587   --
588   p_validation_start_date := l_validation_start_date;
589   p_validation_end_date   := l_validation_end_date;
590   --
591   hr_utility.set_location(' Leaving:'||l_proc, 10);
592 --
593 End ins_lck;
594 --
595 -- ----------------------------------------------------------------------------
596 -- |---------------------------------< ins >----------------------------------|
597 -- ----------------------------------------------------------------------------
598 Procedure ins
599   (
600   p_rec		   in out nocopy pay_cpt_shd.g_rec_type,
601   p_effective_date in     date
602   ) is
603 --
604   l_proc			varchar2(72) := g_package||'ins';
605   l_datetrack_mode		varchar2(30) := 'INSERT';
606   l_validation_start_date	date;
607   l_validation_end_date		date;
608 --
609 Begin
610   hr_utility.set_location('Entering:'||l_proc, 5);
611   --
612   -- Call the lock operation
613   --
614   ins_lck
615 	(p_effective_date	 => p_effective_date,
616 	 p_datetrack_mode	 => l_datetrack_mode,
617 	 p_rec	 		 => p_rec,
618 	 p_validation_start_date => l_validation_start_date,
619 	 p_validation_end_date	 => l_validation_end_date);
620   --
621   -- Call the supporting insert validate operations
622   --
623   pay_cpt_bus.insert_validate
624 	(p_rec			 => p_rec,
625 	 p_effective_date	 => p_effective_date,
626 	 p_datetrack_mode	 => l_datetrack_mode,
627 	 p_validation_start_date => l_validation_start_date,
628 	 p_validation_end_date	 => l_validation_end_date);
629   --
630   -- Call the supporting pre-insert operation
631   --
632   pre_insert
633  	(p_rec			 => p_rec,
634 	 p_effective_date	 => p_effective_date,
635 	 p_datetrack_mode	 => l_datetrack_mode,
636 	 p_validation_start_date => l_validation_start_date,
637 	 p_validation_end_date	 => l_validation_end_date);
638   --
639   -- Insert the row
640   --
641   insert_dml
642  	(p_rec			 => p_rec,
643 	 p_effective_date	 => p_effective_date,
644 	 p_datetrack_mode	 => l_datetrack_mode,
645 	 p_validation_start_date => l_validation_start_date,
646 	 p_validation_end_date	 => l_validation_end_date);
647   --
648   -- Call the supporting post-insert operation
649   --
650 /*
651   post_insert
652  	(p_rec			 => p_rec,
653 	 p_effective_date	 => p_effective_date,
654 	 p_datetrack_mode	 => l_datetrack_mode,
655 	 p_validation_start_date => l_validation_start_date,
656 	 p_validation_end_date	 => l_validation_end_date);
657 */
658 end ins;
659 --
660 -- ----------------------------------------------------------------------------
661 -- |---------------------------------< ins >----------------------------------|
662 -- ----------------------------------------------------------------------------
663 Procedure ins
664   (
665   p_emp_province_tax_inf_id      out nocopy number,
666   p_effective_start_date         out nocopy date,
667   p_effective_end_date           out nocopy date,
668   p_legislation_code             in varchar2,
669   p_assignment_id                in number,
670   p_business_group_id            in number,
671   p_province_code                in varchar2,
672   p_jurisdiction_code            in varchar2         default null,
673   p_tax_credit_amount            in number           default null,
674   p_basic_exemption_flag         in varchar2         default null,
675   p_deduction_code               in varchar2         default null,
676   p_extra_info_not_provided      in varchar2         default null,
677   p_marriage_status              in varchar2         default null,
678   p_no_of_infirm_dependants      in number           default null,
679   p_non_resident_status          in varchar2         default null,
680   p_disability_status            in varchar2         default null,
681   p_no_of_dependants             in number           default null,
682   p_annual_dedn                  in number           default null,
683   p_total_expense_by_commission  in number           default null,
684   p_total_remnrtn_by_commission  in number           default null,
685   p_prescribed_zone_dedn_amt     in number           default null,
686   p_additional_tax               in number           default null,
687   p_prov_override_rate           in number           default null,
688   p_prov_override_amount         in number           default null,
689   p_prov_exempt_flag             in varchar2         default null,
690   p_pmed_exempt_flag             in varchar2         default null,
691   p_wc_exempt_flag               in varchar2         default null,
692   p_qpp_exempt_flag              in varchar2         default null,
693   p_tax_calc_method              in varchar2         default null,
694   p_other_tax_credit             in number           default null,
695   p_ca_tax_information_category  in varchar2         default null,
696   p_ca_tax_information1          in varchar2         default null,
697   p_ca_tax_information2          in varchar2         default null,
698   p_ca_tax_information3          in varchar2         default null,
699   p_ca_tax_information4          in varchar2         default null,
700   p_ca_tax_information5          in varchar2         default null,
701   p_ca_tax_information6          in varchar2         default null,
702   p_ca_tax_information7          in varchar2         default null,
703   p_ca_tax_information8          in varchar2         default null,
704   p_ca_tax_information9          in varchar2         default null,
705   p_ca_tax_information10         in varchar2         default null,
706   p_ca_tax_information11         in varchar2         default null,
707   p_ca_tax_information12         in varchar2         default null,
708   p_ca_tax_information13         in varchar2         default null,
709   p_ca_tax_information14         in varchar2         default null,
710   p_ca_tax_information15         in varchar2         default null,
711   p_ca_tax_information16         in varchar2         default null,
712   p_ca_tax_information17         in varchar2         default null,
713   p_ca_tax_information18         in varchar2         default null,
714   p_ca_tax_information19         in varchar2         default null,
715   p_ca_tax_information20         in varchar2         default null,
716   p_ca_tax_information21         in varchar2         default null,
717   p_ca_tax_information22         in varchar2         default null,
718   p_ca_tax_information23         in varchar2         default null,
719   p_ca_tax_information24         in varchar2         default null,
720   p_ca_tax_information25         in varchar2         default null,
721   p_ca_tax_information26         in varchar2         default null,
722   p_ca_tax_information27         in varchar2         default null,
723   p_ca_tax_information28         in varchar2         default null,
724   p_ca_tax_information29         in varchar2         default null,
725   p_ca_tax_information30         in varchar2         default null,
726   p_object_version_number        out nocopy number,
727   p_prov_lsp_amount              in number           default null,
728   p_effective_date		 in date,
729   p_ppip_exempt_flag              in varchar2         default null
730   ) is
731 --
732   l_rec		    pay_cpt_shd.g_rec_type;
733   l_proc	    varchar2(72) := g_package||'ins';
734   l_effective_date  date;
735   cursor c1(asg_id number) is
736     select max(effective_start_date)
737     from   per_assignments_f asg
738     where asg.assignment_id = asg_id;
739 --
740 Begin
741   hr_utility.set_location('Entering:'||l_proc, 5);
742   --
743   -- Call conversion function to turn arguments into the
744   -- p_rec structure.
745   --
746 /*
747   open c1(p_assignment_id);
748   fetch c1 into l_effective_date;
749       if c1%notfound then
750         --
751         close c1;
752         --
753         -- raise error as assignment_id not found in per_assignments_f
754         -- table.
755         --
756 --dbms_output.put_line('in assignment_id 6');
757         hr_utility.set_message(800, 'HR_74025_INVALID_ASSIGNMENT_ID');
758         hr_utility.raise_error;
759       else
760 --       p_effective_date := l_effective_date;
761        close c1;
762       end if;
763  */
764        l_effective_date := p_effective_date;
765 
766   l_rec :=
767   pay_cpt_shd.convert_args
768   (
769   null,
770   null,
771   null,
772   p_legislation_code,
773   p_assignment_id,
774   p_business_group_id,
775   p_province_code,
776   p_jurisdiction_code,
777   p_tax_credit_amount,
778   p_basic_exemption_flag,
779   p_deduction_code,
780   p_extra_info_not_provided,
781   p_marriage_status,
782   p_no_of_infirm_dependants,
783   p_non_resident_status,
784   p_disability_status,
785   p_no_of_dependants,
786   p_annual_dedn,
787   p_total_expense_by_commission,
788   p_total_remnrtn_by_commission,
789   p_prescribed_zone_dedn_amt,
790   p_additional_tax,
791   p_prov_override_rate,
792   p_prov_override_amount,
793   p_prov_exempt_flag,
794   p_pmed_exempt_flag,
795   p_wc_exempt_flag,
796   p_qpp_exempt_flag,
797   p_tax_calc_method,
798   p_other_tax_credit,
799   p_ca_tax_information_category,
800   p_ca_tax_information1,
801   p_ca_tax_information2,
802   p_ca_tax_information3,
803   p_ca_tax_information4,
804   p_ca_tax_information5,
805   p_ca_tax_information6,
806   p_ca_tax_information7,
807   p_ca_tax_information8,
808   p_ca_tax_information9,
809   p_ca_tax_information10,
810   p_ca_tax_information11,
811   p_ca_tax_information12,
812   p_ca_tax_information13,
813   p_ca_tax_information14,
814   p_ca_tax_information15,
815   p_ca_tax_information16,
816   p_ca_tax_information17,
817   p_ca_tax_information18,
818   p_ca_tax_information19,
819   p_ca_tax_information20,
820   p_ca_tax_information21,
821   p_ca_tax_information22,
822   p_ca_tax_information23,
823   p_ca_tax_information24,
824   p_ca_tax_information25,
825   p_ca_tax_information26,
826   p_ca_tax_information27,
827   p_ca_tax_information28,
828   p_ca_tax_information29,
829   p_ca_tax_information30,
830   null,
831   p_prov_lsp_amount,
832   p_ppip_exempt_flag
833   );
834   --
835   -- Having converted the arguments into the pay_cpt_rec
836   -- plsql record structure we call the corresponding record
837   -- business process.
838   --
839   ins(l_rec, l_effective_date);
840   --
841   -- Set the OUT arguments.
842   --
843   p_emp_province_tax_inf_id        	:= l_rec.emp_province_tax_inf_id;
844   p_effective_start_date  	:= l_rec.effective_start_date;
845   p_effective_end_date    	:= l_rec.effective_end_date;
846   p_object_version_number 	:= l_rec.object_version_number;
847   --
848   --
849   hr_utility.set_location(' Leaving:'||l_proc, 10);
850 End ins;
851 --
852 end pay_cpt_ins;