DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_CFT_INS

Source


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