DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_CFT_INS

Source


1 Package Body pay_cft_ins as
2 /* $Header: pycatrhi.pkb 120.5.12020000.2 2012/11/27 10:17:35 pracagra ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_cft_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_cft_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_fed_tax_info_f t
70     where  t.emp_fed_tax_inf_id       = p_rec.emp_fed_tax_inf_id
71     and    t.effective_start_date =
72              pay_cft_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_fed_tax_info_f.created_by%TYPE;
77   l_creation_date       pay_ca_emp_fed_tax_info_f.creation_date%TYPE;
78   l_last_update_date   	pay_ca_emp_fed_tax_info_f.last_update_date%TYPE;
79   l_last_updated_by     pay_ca_emp_fed_tax_info_f.last_updated_by%TYPE;
83   hr_utility.set_location('Entering:'||l_proc, 5);
80   l_last_update_login   pay_ca_emp_fed_tax_info_f.last_update_login%TYPE;
81 --
82 Begin
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_fed_tax_info_f',
90 	 p_base_key_column => 'emp_fed_tax_inf_id',
91 	 p_base_key_value  => p_rec.emp_fed_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_cft_shd.g_api_dml := true;  -- Set the api dml status
130   --
131   -- Insert the row into: pay_ca_emp_fed_tax_info_f
132   --
133   insert into pay_ca_emp_fed_tax_info_f
134   (	emp_fed_tax_inf_id,
135 	effective_start_date,
136 	effective_end_date,
137 	legislation_code,
138 	assignment_id,
139 	business_group_id,
140 	employment_province,
141 	tax_credit_amount,
142 	claim_code,
143 	basic_exemption_flag,
144 	additional_tax,
145 	annual_dedn,
146 	total_expense_by_commission,
147 	total_remnrtn_by_commission,
148 	prescribed_zone_dedn_amt,
149 	other_fedtax_credits,
150 	cpp_qpp_exempt_flag,
151 	fed_exempt_flag,
152 	ei_exempt_flag,
153 	tax_calc_method,
154 	fed_override_amount,
155 	fed_override_rate,
156 	ca_tax_information_category,
157 	ca_tax_information1,
158 	ca_tax_information2,
159 	ca_tax_information3,
160 	ca_tax_information4,
161 	ca_tax_information5,
162 	ca_tax_information6,
163 	ca_tax_information7,
164 	ca_tax_information8,
165 	ca_tax_information9,
166 	ca_tax_information10,
167 	ca_tax_information11,
168 	ca_tax_information12,
169 	ca_tax_information13,
170 	ca_tax_information14,
171 	ca_tax_information15,
172 	ca_tax_information16,
173 	ca_tax_information17,
174 	ca_tax_information18,
175 	ca_tax_information19,
176 	ca_tax_information20,
177 	ca_tax_information21,
178 	ca_tax_information22,
179 	ca_tax_information23,
180 	ca_tax_information24,
181 	ca_tax_information25,
182 	ca_tax_information26,
183 	ca_tax_information27,
184 	ca_tax_information28,
185 	ca_tax_information29,
186 	ca_tax_information30,
187 	object_version_number,
188 	fed_lsf_amount,
189 	cpp_election_date,             --For Bug Number 13258136
190 	cpp_revocation_date,           --For Bug Number 13258136
191 	created_by,
192    	creation_date,
193    	last_update_date,
194    	last_updated_by,
195    	last_update_login
196   )
197   Values
198   (	p_rec.emp_fed_tax_inf_id,
199 	p_rec.effective_start_date,
200 	p_rec.effective_end_date,
201 	p_rec.legislation_code,
202 	p_rec.assignment_id,
203 	p_rec.business_group_id,
204 	p_rec.employment_province,
205 	p_rec.tax_credit_amount,
206 	p_rec.claim_code,
207 	p_rec.basic_exemption_flag,
208 	p_rec.additional_tax,
209 	p_rec.annual_dedn,
210 	p_rec.total_expense_by_commission,
211 	p_rec.total_remnrtn_by_commission,
212 	p_rec.prescribed_zone_dedn_amt,
213 	p_rec.other_fedtax_credits,
214 	p_rec.cpp_qpp_exempt_flag,
215 	p_rec.fed_exempt_flag,
216 	p_rec.ei_exempt_flag,
217 	p_rec.tax_calc_method,
218 	p_rec.fed_override_amount,
219 	p_rec.fed_override_rate,
220 	p_rec.ca_tax_information_category,
221 	p_rec.ca_tax_information1,
222 	p_rec.ca_tax_information2,
223 	p_rec.ca_tax_information3,
224 	p_rec.ca_tax_information4,
225 	p_rec.ca_tax_information5,
226 	p_rec.ca_tax_information6,
227 	p_rec.ca_tax_information7,
228 	p_rec.ca_tax_information8,
229 	p_rec.ca_tax_information9,
230 	p_rec.ca_tax_information10,
231 	p_rec.ca_tax_information11,
232 	p_rec.ca_tax_information12,
233 	p_rec.ca_tax_information13,
234 	p_rec.ca_tax_information14,
235 	p_rec.ca_tax_information15,
236 	p_rec.ca_tax_information16,
237 	p_rec.ca_tax_information17,
238 	p_rec.ca_tax_information18,
239 	p_rec.ca_tax_information19,
240 	p_rec.ca_tax_information20,
241 	p_rec.ca_tax_information21,
242 	p_rec.ca_tax_information22,
243 	p_rec.ca_tax_information23,
244 	p_rec.ca_tax_information24,
245 	p_rec.ca_tax_information25,
246 	p_rec.ca_tax_information26,
247 	p_rec.ca_tax_information27,
248 	p_rec.ca_tax_information28,
249 	p_rec.ca_tax_information29,
250 	p_rec.ca_tax_information30,
251 	p_rec.object_version_number,
252 	p_rec.fed_lsf_amount,
253 	p_rec.cpp_election_date,             --For Bug Number 13258136
254 	p_rec.cpp_revocation_date,           --For Bug Number 13258136
255 	l_created_by,
256    	l_creation_date,
257    	l_last_update_date,
258    	l_last_updated_by,
259    	l_last_update_login
260   );
261   --
262   pay_cft_shd.g_api_dml := false;   -- Unset the api dml status
263   hr_utility.set_location(' Leaving:'||l_proc, 15);
264 --
265 Exception
266   When hr_api.check_integrity_violated Then
267     -- A check constraint has been violated
268     pay_cft_shd.g_api_dml := false;   -- Unset the api dml status
269     pay_cft_shd.constraint_error
270       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
271   When hr_api.unique_integrity_violated Then
272     -- Unique integrity has been violated
273     pay_cft_shd.g_api_dml := false;   -- Unset the api dml status
274     pay_cft_shd.constraint_error
275       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
276   When Others Then
277     pay_cft_shd.g_api_dml := false;   -- Unset the api dml status
278     Raise;
279 End dt_insert_dml;
280 --
281 -- ----------------------------------------------------------------------------
282 -- |------------------------------< insert_dml >------------------------------|
283 -- ----------------------------------------------------------------------------
284 Procedure insert_dml
285 	(p_rec 			 in out nocopy pay_cft_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||'insert_dml';
292 --
293 Begin
294   hr_utility.set_location('Entering:'||l_proc, 5);
295   --
296   dt_insert_dml(p_rec			=> p_rec,
297 		p_effective_date	=> p_effective_date,
298 		p_datetrack_mode	=> p_datetrack_mode,
299        		p_validation_start_date	=> p_validation_start_date,
300 		p_validation_end_date	=> p_validation_end_date);
301   --
302   hr_utility.set_location(' Leaving:'||l_proc, 10);
303 End insert_dml;
304 --
305 -- ----------------------------------------------------------------------------
306 -- |------------------------------< pre_insert >------------------------------|
307 -- ----------------------------------------------------------------------------
308 -- {Start Of Comments}
309 --
310 -- Description:
311 --   This private procedure contains any processing which is required before
312 --   the insert dml. Presently, if the entity has a corresponding primary
313 --   key which is maintained by an associating sequence, the primary key for
314 --   the entity will be populated with the next sequence value in
315 --   preparation for the insert dml.
316 --   Also, if comments are defined for this entity, the comments insert
317 --   logic will also be called, generating a comment_id if required.
318 --
319 -- Prerequisites:
320 --   This is an internal procedure which is called from the ins procedure.
321 --
322 -- In Parameters:
323 --   A Pl/Sql record structre.
324 --
325 -- Post Success:
326 --   Processing continues.
327 --
328 -- Post Failure:
329 --   If an error has occurred, an error message and exception will be raised
330 --   but not handled.
331 --
332 -- Developer Implementation Notes:
333 --   Any pre-processing required before the insert dml is issued should be
334 --   coded within this procedure. As stated above, a good example is the
335 --   generation of a primary key number via a corresponding sequence.
336 --   It is important to note that any 3rd party maintenance should be reviewed
337 --   before placing in this procedure.
338 --
339 -- Access Status:
340 --   Internal Row Handler Use Only.
341 --
342 -- {End Of Comments}
343 -- ----------------------------------------------------------------------------
344 Procedure pre_insert
345 	(p_rec  			in out nocopy pay_cft_shd.g_rec_type,
346 	 p_effective_date		in date,
347 	 p_datetrack_mode		in varchar2,
348 	 p_validation_start_date	in date,
349 	 p_validation_end_date		in date) is
350 --
351   l_proc	varchar2(72) := g_package||'pre_insert';
352 --
353   Cursor C_Sel1 is select pay_ca_emp_fed_tax_info_s.nextval from sys.dual;
354 --
355 Begin
356   hr_utility.set_location('Entering:'||l_proc, 5);
357   --
358   --
359   -- Select the next sequence number
360   --
361   Open C_Sel1;
362   Fetch C_Sel1 Into p_rec.emp_fed_tax_inf_id;
363   Close C_Sel1;
364   --
365   --
366   hr_utility.set_location(' Leaving:'||l_proc, 10);
367 End pre_insert;
368 --
369 -- ----------------------------------------------------------------------------
370 -- |-----------------------------< post_insert >------------------------------|
371 -- ----------------------------------------------------------------------------
372 -- {Start Of Comments}
373 --
374 -- Description:
375 --   This private procedure contains any processing which is required after the
376 --   insert dml.
377 --
378 -- Prerequisites:
379 --   This is an internal procedure which is called from the ins procedure.
380 --
381 -- In Parameters:
382 --   A Pl/Sql record structre.
383 --
384 -- Post Success:
385 --   Processing continues.
386 --
387 -- Post Failure:
388 --   If an error has occurred, an error message and exception will be raised
389 --   but not handled.
390 --
391 -- Developer Implementation Notes:
392 --   Any post-processing required after the insert dml is issued should be
393 --   coded within this procedure. It is important to note that any 3rd party
394 --   maintenance should be reviewed before placing in this procedure.
395 --
396 -- Access Status:
397 --   Internal Row Handler Use Only.
398 --
399 -- {End Of Comments}
400 -- ----------------------------------------------------------------------------
401 Procedure post_insert
402 	(p_rec 			 in pay_cft_shd.g_rec_type,
403 	 p_effective_date	 in date,
404 	 p_datetrack_mode	 in varchar2,
405 	 p_validation_start_date in date,
406 	 p_validation_end_date	 in date) is
407 --
408   l_proc	varchar2(72) := g_package||'post_insert';
409 --
410 Begin
411   hr_utility.set_location('Entering:'||l_proc, 5);
412 --
413   --
414   -- Start of API User Hook for post_insert.
415   --
416   begin
417     --
418     pay_cft_rki.after_insert
419       (
420   p_emp_fed_tax_inf_id            =>p_rec.emp_fed_tax_inf_id
421  ,p_effective_start_date          =>p_rec.effective_start_date
422  ,p_effective_end_date            =>p_rec.effective_end_date
423  ,p_legislation_code              =>p_rec.legislation_code
424  ,p_assignment_id                 =>p_rec.assignment_id
425  ,p_business_group_id             =>p_rec.business_group_id
426  ,p_employment_province           =>p_rec.employment_province
427  ,p_tax_credit_amount             =>p_rec.tax_credit_amount
428  ,p_claim_code                    =>p_rec.claim_code
429  ,p_basic_exemption_flag          =>p_rec.basic_exemption_flag
430  ,p_additional_tax                =>p_rec.additional_tax
431  ,p_annual_dedn                   =>p_rec.annual_dedn
432  ,p_total_expense_by_commission   =>p_rec.total_expense_by_commission
433  ,p_total_remnrtn_by_commission   =>p_rec.total_remnrtn_by_commission
434  ,p_prescribed_zone_dedn_amt      =>p_rec.prescribed_zone_dedn_amt
435  ,p_other_fedtax_credits          =>p_rec.other_fedtax_credits
436  ,p_cpp_qpp_exempt_flag           =>p_rec.cpp_qpp_exempt_flag
437  ,p_fed_exempt_flag               =>p_rec.fed_exempt_flag
438  ,p_ei_exempt_flag                =>p_rec.ei_exempt_flag
439  ,p_tax_calc_method               =>p_rec.tax_calc_method
440  ,p_fed_override_amount           =>p_rec.fed_override_amount
441  ,p_fed_override_rate             =>p_rec.fed_override_rate
442  ,p_ca_tax_information_category   =>p_rec.ca_tax_information_category
443  ,p_ca_tax_information1           =>p_rec.ca_tax_information1
444  ,p_ca_tax_information2           =>p_rec.ca_tax_information2
445  ,p_ca_tax_information3           =>p_rec.ca_tax_information3
446  ,p_ca_tax_information4           =>p_rec.ca_tax_information4
447  ,p_ca_tax_information5           =>p_rec.ca_tax_information5
448  ,p_ca_tax_information6           =>p_rec.ca_tax_information6
449  ,p_ca_tax_information7           =>p_rec.ca_tax_information7
450  ,p_ca_tax_information8           =>p_rec.ca_tax_information8
451  ,p_ca_tax_information9           =>p_rec.ca_tax_information9
452  ,p_ca_tax_information10          =>p_rec.ca_tax_information10
453  ,p_ca_tax_information11          =>p_rec.ca_tax_information11
454  ,p_ca_tax_information12          =>p_rec.ca_tax_information12
455  ,p_ca_tax_information13          =>p_rec.ca_tax_information13
456  ,p_ca_tax_information14          =>p_rec.ca_tax_information14
457  ,p_ca_tax_information15          =>p_rec.ca_tax_information15
458  ,p_ca_tax_information16          =>p_rec.ca_tax_information16
459  ,p_ca_tax_information17          =>p_rec.ca_tax_information17
460  ,p_ca_tax_information18          =>p_rec.ca_tax_information18
461  ,p_ca_tax_information19          =>p_rec.ca_tax_information19
462  ,p_ca_tax_information20          =>p_rec.ca_tax_information20
463  ,p_ca_tax_information21          =>p_rec.ca_tax_information21
464  ,p_ca_tax_information22          =>p_rec.ca_tax_information22
465  ,p_ca_tax_information23          =>p_rec.ca_tax_information23
466  ,p_ca_tax_information24          =>p_rec.ca_tax_information24
467  ,p_ca_tax_information25          =>p_rec.ca_tax_information25
468  ,p_ca_tax_information26          =>p_rec.ca_tax_information26
469  ,p_ca_tax_information27          =>p_rec.ca_tax_information27
470  ,p_ca_tax_information28          =>p_rec.ca_tax_information28
471  ,p_ca_tax_information29          =>p_rec.ca_tax_information29
472  ,p_ca_tax_information30          =>p_rec.ca_tax_information30
473  ,p_object_version_number         =>p_rec.object_version_number
474  ,p_fed_lsf_amount         	      =>p_rec.fed_lsf_amount
475  ,p_cpp_election_date             =>p_rec.cpp_election_date             --For Bug Number 13258136
476  ,p_cpp_revocation_date           =>p_rec.cpp_revocation_date           --For Bug Number 13258136
477  ,p_effective_date                =>p_effective_date
478  ,p_validation_start_date         =>p_validation_start_date
479  ,p_validation_end_date           =>p_validation_end_date
480       );
481     --
482   exception
483     --
484     when hr_api.cannot_find_prog_unit then
485       --
486       hr_api.cannot_find_prog_unit_error
487         (p_module_name => 'pay_ca_emp_fed_tax_info_f'
488         ,p_hook_type   => 'AI');
489       --
490   end;
491   --
492   -- End of API User Hook for post_insert.
493   --
494   --
495   hr_utility.set_location(' Leaving:'||l_proc, 10);
496 End post_insert;
497 --
498 -- ----------------------------------------------------------------------------
499 -- |-------------------------------< ins_lck >--------------------------------|
500 -- ----------------------------------------------------------------------------
501 -- {Start Of Comments}
502 --
503 -- Description:
504 --   The ins_lck process has one main function to perform. When inserting
505 --   a datetracked row, we must validate the DT mode.
506 --   be manipulated.
507 --
508 -- Prerequisites:
509 --   This procedure can only be called for the datetrack mode of INSERT.
510 --
511 -- In Parameters:
512 --
513 -- Post Success:
514 --   On successful completion of the ins_lck process the parental
515 --   datetracked rows will be locked providing the p_enforce_foreign_locking
516 --   argument value is TRUE.
517 --   If the p_enforce_foreign_locking argument value is FALSE then the
518 --   parential rows are not locked.
519 --
520 -- Post Failure:
521 --   The Lck process can fail for:
522 --   1) When attempting to lock the row the row could already be locked by
523 --      another user. This will raise the HR_Api.Object_Locked exception.
524 --   2) When attempting to the lock the parent which doesn't exist.
525 --      For the entity to be locked the parent must exist<>
526 --
527 -- Developer Implementation Notes:
528 --   None.
529 --
530 -- Access Status:
531 --   Internal Row Handler Use Only.
532 --
533 -- {End Of Comments}
534 -- ----------------------------------------------------------------------------
535 Procedure ins_lck
536 	(p_effective_date	 in  date,
537 	 p_datetrack_mode	 in  varchar2,
538 	 p_rec	 		 in  pay_cft_shd.g_rec_type,
539 	 p_validation_start_date out nocopy date,
540 	 p_validation_end_date	 out nocopy date) is
541 --
542   l_proc		  varchar2(72) := g_package||'ins_lck';
543   l_validation_start_date date;
544   l_validation_end_date	  date;
545 --
546 Begin
547   hr_utility.set_location('Entering:'||l_proc, 5);
548   --
549   -- Validate the datetrack mode mode getting the validation start
550   -- and end dates for the specified datetrack operation.
551   --
552   dt_api.validate_dt_mode
553 	(p_effective_date	   => p_effective_date,
554 	 p_datetrack_mode	   => p_datetrack_mode,
555 	 p_base_table_name	   => 'pay_ca_emp_fed_tax_info_f',
556 	 p_base_key_column	   => 'emp_fed_tax_inf_id',
557 	 p_base_key_value 	   => p_rec.emp_fed_tax_inf_id,
558 	 p_parent_table_name1      => 'per_all_assignments_f',
559 	 p_parent_key_column1      => 'assignment_id',
560 	 p_parent_key_value1       => p_rec.assignment_id,
561          p_enforce_foreign_locking => true,
562 	 p_validation_start_date   => l_validation_start_date,
563  	 p_validation_end_date	   => l_validation_end_date);
564   --
565   -- Set the validation start and end date OUT arguments
566   --
567   p_validation_start_date := l_validation_start_date;
568   p_validation_end_date   := l_validation_end_date;
569   --
570   hr_utility.set_location(' Leaving:'||l_proc, 10);
571 --
572 End ins_lck;
573 --
574 -- ----------------------------------------------------------------------------
575 -- |---------------------------------< ins >----------------------------------|
576 -- ----------------------------------------------------------------------------
577 Procedure ins
578   (
579   p_rec		   in out nocopy pay_cft_shd.g_rec_type,
580   p_effective_date in     date
581   ) is
582 --
583   l_proc			varchar2(72) := g_package||'ins';
584   l_datetrack_mode		varchar2(30) := 'INSERT';
585   l_validation_start_date	date;
586   l_validation_end_date		date;
587 --
588 Begin
589   hr_utility.set_location('Entering:'||l_proc, 5);
590   --
591   -- Call the lock operation
592   --
593   ins_lck
594 	(p_effective_date	 => p_effective_date,
595 	 p_datetrack_mode	 => l_datetrack_mode,
596 	 p_rec	 		 => p_rec,
597 	 p_validation_start_date => l_validation_start_date,
598 	 p_validation_end_date	 => l_validation_end_date);
599   --
600   -- Call the supporting insert validate operations
601   --
602 --dbms_output.put_line('before insert validate');
603   pay_cft_bus.insert_validate
604 	(p_rec			 => p_rec,
605 	 p_effective_date	 => p_effective_date,
606 	 p_datetrack_mode	 => l_datetrack_mode,
607 	 p_validation_start_date => l_validation_start_date,
608 	 p_validation_end_date	 => l_validation_end_date);
609 --dbms_output.put_line('after insert validate');
610   --
611   -- Call the supporting pre-insert operation
612   --
613   pre_insert
614  	(p_rec			 => p_rec,
615 	 p_effective_date	 => p_effective_date,
616 	 p_datetrack_mode	 => l_datetrack_mode,
617 	 p_validation_start_date => l_validation_start_date,
618 	 p_validation_end_date	 => l_validation_end_date);
619   --
620   -- Insert the row
621   --
622   insert_dml
623  	(p_rec			 => p_rec,
624 	 p_effective_date	 => p_effective_date,
625 	 p_datetrack_mode	 => l_datetrack_mode,
626 	 p_validation_start_date => l_validation_start_date,
627 	 p_validation_end_date	 => l_validation_end_date);
628   --
629   -- Call the supporting post-insert operation
630   --
631 /*
632   post_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 end ins;
640 --
641 -- ----------------------------------------------------------------------------
642 -- |---------------------------------< ins >----------------------------------|
643 -- ----------------------------------------------------------------------------
644 Procedure ins
645   (
646   p_emp_fed_tax_inf_id           out nocopy number,
647   p_effective_start_date         out nocopy date,
648   p_effective_end_date           out nocopy date,
649   p_legislation_code             in varchar2,
650   p_assignment_id                in number,
651   p_business_group_id            in number,
652   p_employment_province          in varchar2         default null,
653   p_tax_credit_amount            in number           default null,
654   p_claim_code                   in varchar2         default null,
655   p_basic_exemption_flag         in varchar2         default null,
656   p_additional_tax               in number           default null,
657   p_annual_dedn                  in number           default null,
658   p_total_expense_by_commission  in number           default null,
659   p_total_remnrtn_by_commission  in number           default null,
660   p_prescribed_zone_dedn_amt     in number           default null,
661   p_other_fedtax_credits         in varchar2         default null,
662   p_cpp_qpp_exempt_flag          in varchar2         default null,
663   p_fed_exempt_flag              in varchar2         default null,
667   p_fed_override_rate            in number           default null,
664   p_ei_exempt_flag               in varchar2         default null,
665   p_tax_calc_method              in varchar2         default null,
666   p_fed_override_amount          in number           default null,
668   p_ca_tax_information_category  in varchar2         default null,
669   p_ca_tax_information1          in varchar2         default null,
670   p_ca_tax_information2          in varchar2         default null,
671   p_ca_tax_information3          in varchar2         default null,
672   p_ca_tax_information4          in varchar2         default null,
673   p_ca_tax_information5          in varchar2         default null,
674   p_ca_tax_information6          in varchar2         default null,
675   p_ca_tax_information7          in varchar2         default null,
676   p_ca_tax_information8          in varchar2         default null,
677   p_ca_tax_information9          in varchar2         default null,
678   p_ca_tax_information10         in varchar2         default null,
679   p_ca_tax_information11         in varchar2         default null,
680   p_ca_tax_information12         in varchar2         default null,
681   p_ca_tax_information13         in varchar2         default null,
682   p_ca_tax_information14         in varchar2         default null,
683   p_ca_tax_information15         in varchar2         default null,
684   p_ca_tax_information16         in varchar2         default null,
685   p_ca_tax_information17         in varchar2         default null,
686   p_ca_tax_information18         in varchar2         default null,
687   p_ca_tax_information19         in varchar2         default null,
688   p_ca_tax_information20         in varchar2         default null,
689   p_ca_tax_information21         in varchar2         default null,
690   p_ca_tax_information22         in varchar2         default null,
691   p_ca_tax_information23         in varchar2         default null,
692   p_ca_tax_information24         in varchar2         default null,
693   p_ca_tax_information25         in varchar2         default null,
694   p_ca_tax_information26         in varchar2         default null,
695   p_ca_tax_information27         in varchar2         default null,
696   p_ca_tax_information28         in varchar2         default null,
697   p_ca_tax_information29         in varchar2         default null,
698   p_ca_tax_information30         in varchar2         default null,
699   p_object_version_number        out nocopy number,
700   p_fed_lsf_amount               in number           default null,
701   p_cpp_election_date            in date,             --For Bug Number 13258136
702   p_cpp_revocation_date          in date,             --For Bug Number 13258136
703   p_effective_date		 in date
704   ) is
705 --
706   l_rec		pay_cft_shd.g_rec_type;
707   l_proc	varchar2(72) := g_package||'ins';
708   l_effective_date    date;
709 --
710   cursor c1(asg_id number) is
711     select max(effective_start_date)
712     from   per_assignments_f asg
713     where asg.assignment_id = asg_id;
714 
715 Begin
716   hr_utility.set_location('Entering:'||l_proc, 5);
717   --
718   -- Call conversion function to turn arguments into the
719   -- p_rec structure.
720   --
721 /* What ever the effective date is tax record is always created from the
722    date when the assignment has started.  */
723 /*
724   open c1(p_assignment_id);
725   fetch c1 into l_effective_date;
726       if c1%notfound then
727         --
728         close c1;
729         --
730         -- raise error as assignment_id not found in per_assignments_f
731         -- table.
732         --
733 --dbms_output.put_line('in assignment_id 6');
734         hr_utility.set_message(800, 'HR_74025_INVALID_ASSIGNMENT_ID');
735         hr_utility.raise_error;
736       else
737 --       p_effective_date := l_effective_date;
738        close c1;
739       end if;
740 */
741        l_effective_date := p_effective_date;
742 
743   l_rec :=
744   pay_cft_shd.convert_args
745   (
746   null,
747   null,
748   null,
749   p_legislation_code,
750   p_assignment_id,
751   p_business_group_id,
752   p_employment_province,
753   p_tax_credit_amount,
754   p_claim_code,
755   p_basic_exemption_flag,
756   p_additional_tax,
757   p_annual_dedn,
758   p_total_expense_by_commission,
759   p_total_remnrtn_by_commission,
760   p_prescribed_zone_dedn_amt,
761   p_other_fedtax_credits,
762   p_cpp_qpp_exempt_flag,
763   p_fed_exempt_flag,
764   p_ei_exempt_flag,
765   p_tax_calc_method,
766   p_fed_override_amount,
767   p_fed_override_rate,
768   p_ca_tax_information_category,
769   p_ca_tax_information1,
770   p_ca_tax_information2,
771   p_ca_tax_information3,
772   p_ca_tax_information4,
773   p_ca_tax_information5,
774   p_ca_tax_information6,
775   p_ca_tax_information7,
776   p_ca_tax_information8,
777   p_ca_tax_information9,
778   p_ca_tax_information10,
779   p_ca_tax_information11,
780   p_ca_tax_information12,
781   p_ca_tax_information13,
782   p_ca_tax_information14,
783   p_ca_tax_information15,
784   p_ca_tax_information16,
785   p_ca_tax_information17,
786   p_ca_tax_information18,
787   p_ca_tax_information19,
788   p_ca_tax_information20,
789   p_ca_tax_information21,
790   p_ca_tax_information22,
791   p_ca_tax_information23,
792   p_ca_tax_information24,
793   p_ca_tax_information25,
794   p_ca_tax_information26,
795   p_ca_tax_information27,
796   p_ca_tax_information28,
797   p_ca_tax_information29,
798   p_ca_tax_information30,
799   null,
800   p_fed_lsf_amount,
801   p_cpp_election_date,              --For Bug Number 13258136
802   p_cpp_revocation_date             --For Bug Number 13258136
803   );
804   --
805   -- Having converted the arguments into the pay_cft_rec
806   -- plsql record structure we call the corresponding record
807   -- business process.
808   --
809   ins(l_rec, l_effective_date);
810   --
811   -- Set the OUT arguments.
812   --
813   p_emp_fed_tax_inf_id        	:= l_rec.emp_fed_tax_inf_id;
814   p_effective_start_date  	:= l_rec.effective_start_date;
815   p_effective_end_date    	:= l_rec.effective_end_date;
816   p_object_version_number 	:= l_rec.object_version_number;
817   --
818   --
819   hr_utility.set_location(' Leaving:'||l_proc, 10);
820 End ins;
821 --
822 end pay_cft_ins;