DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_CA_EMP_FEDTAX_INF_API

Source


4 -- Package Variables
1 Package Body pay_ca_emp_fedtax_inf_api as
2 /* $Header: pycatapi.pkb 120.5 2012/02/07 07:03:02 pracagra ship $ */
3 --
5 --
6 g_package  varchar2(33) := '  pay_ca_emp_fedtax_inf_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |------------------------< create_ca_emp_fedtax_inf >----------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_ca_emp_fedtax_inf
13   (p_validate                       in  boolean   default false
14   ,p_emp_fed_tax_inf_id             out nocopy number
15   ,p_effective_start_date           out nocopy date
16   ,p_effective_end_date             out nocopy date
17   ,p_legislation_code               in  varchar2
18   ,p_assignment_id                  in  number
19   ,p_business_group_id              in  number
20   ,p_employment_province            in  varchar2  default null
21   ,p_tax_credit_amount              in  number    default null
22   ,p_claim_code                     in  varchar2  default null
23   ,p_basic_exemption_flag           in  varchar2  default null
24   ,p_additional_tax                 in  number    default null
25   ,p_annual_dedn                    in  number    default null
26   ,p_total_expense_by_commission    in  number    default null
27   ,p_total_remnrtn_by_commission    in  number    default null
28   ,p_prescribed_zone_dedn_amt       in  number    default null
29   ,p_other_fedtax_credits           in  varchar2  default null
30   ,p_cpp_qpp_exempt_flag            in  varchar2  default null
31   ,p_fed_exempt_flag                in  varchar2  default null
32   ,p_ei_exempt_flag                 in  varchar2  default null
33   ,p_tax_calc_method                in  varchar2  default null
34   ,p_fed_override_amount            in  number    default null
35   ,p_fed_override_rate              in  number    default null
36   ,p_ca_tax_information_category    in  varchar2  default null
37   ,p_ca_tax_information1            in  varchar2  default null
38   ,p_ca_tax_information2            in  varchar2  default null
39   ,p_ca_tax_information3            in  varchar2  default null
40   ,p_ca_tax_information4            in  varchar2  default null
41   ,p_ca_tax_information5            in  varchar2  default null
42   ,p_ca_tax_information6            in  varchar2  default null
43   ,p_ca_tax_information7            in  varchar2  default null
44   ,p_ca_tax_information8            in  varchar2  default null
45   ,p_ca_tax_information9            in  varchar2  default null
46   ,p_ca_tax_information10           in  varchar2  default null
47   ,p_ca_tax_information11           in  varchar2  default null
48   ,p_ca_tax_information12           in  varchar2  default null
49   ,p_ca_tax_information13           in  varchar2  default null
50   ,p_ca_tax_information14           in  varchar2  default null
51   ,p_ca_tax_information15           in  varchar2  default null
52   ,p_ca_tax_information16           in  varchar2  default null
53   ,p_ca_tax_information17           in  varchar2  default null
54   ,p_ca_tax_information18           in  varchar2  default null
55   ,p_ca_tax_information19           in  varchar2  default null
56   ,p_ca_tax_information20           in  varchar2  default null
57   ,p_ca_tax_information21           in  varchar2  default null
58   ,p_ca_tax_information22           in  varchar2  default null
59   ,p_ca_tax_information23           in  varchar2  default null
60   ,p_ca_tax_information24           in  varchar2  default null
61   ,p_ca_tax_information25           in  varchar2  default null
62   ,p_ca_tax_information26           in  varchar2  default null
63   ,p_ca_tax_information27           in  varchar2  default null
64   ,p_ca_tax_information28           in  varchar2  default null
65   ,p_ca_tax_information29           in  varchar2  default null
66   ,p_ca_tax_information30           in  varchar2  default null
67   ,p_object_version_number          out nocopy number
68   ,p_fed_lsf_amount                 in  number    default null
69   ,p_cpp_election_date              in date  default null     --For Bug Number 13258136, defaulted for Bug 13690645
70   ,p_cpp_revocation_date            in date  default null     --For Bug Number 13258136, defaulted for Bug 13690645
71   ,p_effective_date                 in  date
72   ) is
73   --
74   -- Declare cursors and local variables
75   --
79   l_proc varchar2(72) := g_package||'create_ca_emp_fedtax_inf';
76   l_emp_fed_tax_inf_id   pay_ca_emp_fed_tax_info_f.emp_fed_tax_inf_id%TYPE;
77   l_effective_start_date pay_ca_emp_fed_tax_info_f.effective_start_date%TYPE;
78   l_effective_end_date   pay_ca_emp_fed_tax_info_f.effective_end_date%TYPE;
80   l_object_version_number pay_ca_emp_fed_tax_info_f.object_version_number%TYPE;
81   l_rec_present varchar2(1);
82   l_tax_credit_amount   number  := 0;
83   l_additional_tax   number   := 0;
84   l_annual_dedn     number   := 0;
85   l_total_expense_by_commission    number   := 0;
86   l_total_remnrtn_by_commission   number   := 0;
87   l_prescribed_zone_dedn_amt   number   := 0;
88   l_other_fedtax_credits      number   := 0;
89   l_fed_override_amount      number   := 0;
90   l_fed_override_rate      number   := 0;
91   l_fed_lsf_amount   number  := 0;
92   --
93 begin
94   --
95   hr_utility.set_location('Entering:'|| l_proc, 10);
96   --
97   -- Issue a savepoint if operating in validation only mode
98   --
99   savepoint create_ca_emp_fedtax_inf;
100   --
101   hr_utility.set_location(l_proc, 20);
102   --
103   -- Process Logic
104   --
105 
106   perform_assignment_validation(p_assignment_id => p_assignment_id,
107                                 p_effective_date => p_effective_date);
108 
109 --
110   tax_record_already_present(p_assignment_id => p_assignment_id,
111                              p_effective_date => p_effective_date,
112                              p_rec_present => l_rec_present); /* added*/
113 
114 if l_rec_present <> 'Y' then
115 /* Defaulting all the number fields which are null */
116 hr_utility.trace('call rowhandler');
117    l_tax_credit_amount := convert_null_to_zero(p_tax_credit_amount);
118    l_additional_tax := convert_null_to_zero(p_additional_tax);
119    l_annual_dedn    := convert_null_to_zero(p_annual_dedn);
120    l_total_expense_by_commission  := convert_null_to_zero(p_total_expense_by_commission);
121    l_total_remnrtn_by_commission  := convert_null_to_zero(p_total_remnrtn_by_commission);
122    l_prescribed_zone_dedn_amt := convert_null_to_zero(p_prescribed_zone_dedn_amt);
123    l_other_fedtax_credits    := convert_null_to_zero(p_other_fedtax_credits);
124    l_fed_override_amount    := convert_null_to_zero(p_fed_override_amount);
125    l_fed_override_rate    := convert_null_to_zero(p_fed_override_rate);
126    l_fed_lsf_amount := convert_null_to_zero(p_fed_lsf_amount);
127 hr_utility.trace('call rowhandler');
128 /*
129   begin
130     --
131     -- Start of API User Hook for the before hook of create_ca_emp_fedtax_inf
132     --
133     pay_ca_emp_fedtax_inf_bk1.create_ca_emp_fedtax_inf_b
134       (
135        p_legislation_code               =>  p_legislation_code
136       ,p_assignment_id                  =>  p_assignment_id
137       ,p_business_group_id              =>  p_business_group_id
138       ,p_employment_province            =>  p_employment_province
139       ,p_tax_credit_amount              =>  p_tax_credit_amount
140       ,p_claim_code                     =>  p_claim_code
141       ,p_basic_exemption_flag           =>  p_basic_exemption_flag
142       ,p_additional_tax                 =>  l_additional_tax
143       ,p_annual_dedn                    =>  l_annual_dedn
144       ,p_total_expense_by_commission    =>  l_total_expense_by_commission
145       ,p_total_remnrtn_by_commission    =>  l_total_remnrtn_by_commission
146       ,p_prescribed_zone_dedn_amt       =>  l_prescribed_zone_dedn_amt
147       ,p_other_fedtax_credits           =>  l_other_fedtax_credits
148       ,p_cpp_qpp_exempt_flag            =>  p_cpp_qpp_exempt_flag
149       ,p_fed_exempt_flag                =>  p_fed_exempt_flag
150       ,p_ei_exempt_flag                 =>  p_ei_exempt_flag
151       ,p_tax_calc_method                =>  p_tax_calc_method
152       ,p_fed_override_amount            =>  l_fed_override_amount
153       ,p_fed_override_rate              =>  l_fed_override_rate
154       ,p_ca_tax_information_category    =>  p_ca_tax_information_category
155       ,p_ca_tax_information1            =>  p_ca_tax_information1
156       ,p_ca_tax_information2            =>  p_ca_tax_information2
157       ,p_ca_tax_information3            =>  p_ca_tax_information3
158       ,p_ca_tax_information4            =>  p_ca_tax_information4
159       ,p_ca_tax_information5            =>  p_ca_tax_information5
160       ,p_ca_tax_information6            =>  p_ca_tax_information6
161       ,p_ca_tax_information7            =>  p_ca_tax_information7
162       ,p_ca_tax_information8            =>  p_ca_tax_information8
163       ,p_ca_tax_information9            =>  p_ca_tax_information9
164       ,p_ca_tax_information10           =>  p_ca_tax_information10
165       ,p_ca_tax_information11           =>  p_ca_tax_information11
166       ,p_ca_tax_information12           =>  p_ca_tax_information12
167       ,p_ca_tax_information13           =>  p_ca_tax_information13
168       ,p_ca_tax_information14           =>  p_ca_tax_information14
169       ,p_ca_tax_information15           =>  p_ca_tax_information15
170       ,p_ca_tax_information16           =>  p_ca_tax_information16
171       ,p_ca_tax_information17           =>  p_ca_tax_information17
172       ,p_ca_tax_information18           =>  p_ca_tax_information18
173       ,p_ca_tax_information19           =>  p_ca_tax_information19
174       ,p_ca_tax_information20           =>  p_ca_tax_information20
175       ,p_ca_tax_information21           =>  p_ca_tax_information21
176       ,p_ca_tax_information22           =>  p_ca_tax_information22
177       ,p_ca_tax_information23           =>  p_ca_tax_information23
178       ,p_ca_tax_information24           =>  p_ca_tax_information24
179       ,p_ca_tax_information25           =>  p_ca_tax_information25
180       ,p_ca_tax_information26           =>  p_ca_tax_information26
181       ,p_ca_tax_information27           =>  p_ca_tax_information27
185       ,p_fed_lsf_amount                 =>  l_fed_lsf_amount
182       ,p_ca_tax_information28           =>  p_ca_tax_information28
183       ,p_ca_tax_information29           =>  p_ca_tax_information29
184       ,p_ca_tax_information30           =>  p_ca_tax_information30
186       ,p_cpp_election_date              =>  p_cpp_election_date             --For Bug Number 13258136
187       ,p_cpp_revocation_date            =>  p_cpp_revocation_date           --For Bug Number 13258136
188       ,p_effective_date                 => trunc(p_effective_date)
189       );
190   exception
191     when hr_api.cannot_find_prog_unit then
192       hr_api.cannot_find_prog_unit_error
193         (
194          p_module_name => 'CREATE_ca_emp_fedtax_inf'
195         ,p_hook_type   => 'BP'
196         );
197     --
198     -- End of API User Hook for the before hook of create_ca_emp_fedtax_inf
199     --
200   end;
201 */
202   --
203 
204 hr_utility.trace('call rowhandler');
205   pay_cft_ins.ins
206     (
207      p_emp_fed_tax_inf_id            => l_emp_fed_tax_inf_id
208     ,p_effective_start_date          => l_effective_start_date
209     ,p_effective_end_date            => l_effective_end_date
210     ,p_legislation_code              => p_legislation_code
211     ,p_assignment_id                 => p_assignment_id
212     ,p_business_group_id             => p_business_group_id
213     ,p_employment_province           => p_employment_province
214     ,p_tax_credit_amount             => p_tax_credit_amount
215     ,p_claim_code                    => p_claim_code
216     ,p_basic_exemption_flag          => p_basic_exemption_flag
217     ,p_additional_tax                => p_additional_tax
218     ,p_annual_dedn                   => p_annual_dedn
219     ,p_total_expense_by_commission   => p_total_expense_by_commission
220     ,p_total_remnrtn_by_commission   => p_total_remnrtn_by_commission
221     ,p_prescribed_zone_dedn_amt      => p_prescribed_zone_dedn_amt
222     ,p_other_fedtax_credits          => p_other_fedtax_credits
223     ,p_cpp_qpp_exempt_flag           => p_cpp_qpp_exempt_flag
224     ,p_fed_exempt_flag               => p_fed_exempt_flag
225     ,p_ei_exempt_flag                => p_ei_exempt_flag
226     ,p_tax_calc_method               => p_tax_calc_method
227     ,p_fed_override_amount           => p_fed_override_amount
228     ,p_fed_override_rate             => p_fed_override_rate
229     ,p_ca_tax_information_category   => p_ca_tax_information_category
230     ,p_ca_tax_information1           => p_ca_tax_information1
231     ,p_ca_tax_information2           => p_ca_tax_information2
232     ,p_ca_tax_information3           => p_ca_tax_information3
233     ,p_ca_tax_information4           => p_ca_tax_information4
234     ,p_ca_tax_information5           => p_ca_tax_information5
235     ,p_ca_tax_information6           => p_ca_tax_information6
236     ,p_ca_tax_information7           => p_ca_tax_information7
237     ,p_ca_tax_information8           => p_ca_tax_information8
238     ,p_ca_tax_information9           => p_ca_tax_information9
239     ,p_ca_tax_information10          => p_ca_tax_information10
240     ,p_ca_tax_information11          => p_ca_tax_information11
241     ,p_ca_tax_information12          => p_ca_tax_information12
242     ,p_ca_tax_information13          => p_ca_tax_information13
243     ,p_ca_tax_information14          => p_ca_tax_information14
244     ,p_ca_tax_information15          => p_ca_tax_information15
245     ,p_ca_tax_information16          => p_ca_tax_information16
246     ,p_ca_tax_information17          => p_ca_tax_information17
247     ,p_ca_tax_information18          => p_ca_tax_information18
248     ,p_ca_tax_information19          => p_ca_tax_information19
249     ,p_ca_tax_information20          => p_ca_tax_information20
250     ,p_ca_tax_information21          => p_ca_tax_information21
251     ,p_ca_tax_information22          => p_ca_tax_information22
252     ,p_ca_tax_information23          => p_ca_tax_information23
253     ,p_ca_tax_information24          => p_ca_tax_information24
254     ,p_ca_tax_information25          => p_ca_tax_information25
255     ,p_ca_tax_information26          => p_ca_tax_information26
256     ,p_ca_tax_information27          => p_ca_tax_information27
257     ,p_ca_tax_information28          => p_ca_tax_information28
258     ,p_ca_tax_information29          => p_ca_tax_information29
259     ,p_ca_tax_information30          => p_ca_tax_information30
260     ,p_object_version_number         => l_object_version_number
261     ,p_fed_lsf_amount                => p_fed_lsf_amount
262     ,p_cpp_election_date             => p_cpp_election_date             --For Bug Number 13258136
263     ,p_cpp_revocation_date           => p_cpp_revocation_date           --For Bug Number 13258136
264     ,p_effective_date                => trunc(p_effective_date)
265     );
266   --
267 /*
268   begin
269     --
270     -- Start of API User Hook for the after hook of create_ca_emp_fedtax_inf
271     --
272     pay_ca_emp_fedtax_inf_bk1.create_ca_emp_fedtax_inf_a
273       (
274        p_emp_fed_tax_inf_id             =>  l_emp_fed_tax_inf_id
275       ,p_effective_start_date           =>  l_effective_start_date
276       ,p_effective_end_date             =>  l_effective_end_date
277       ,p_legislation_code               =>  p_legislation_code
278       ,p_assignment_id                  =>  p_assignment_id
279       ,p_business_group_id              =>  p_business_group_id
280       ,p_employment_province            =>  p_employment_province
281       ,p_tax_credit_amount              =>  p_tax_credit_amount
282       ,p_claim_code                     =>  p_claim_code
283       ,p_basic_exemption_flag           =>  p_basic_exemption_flag
287       ,p_total_remnrtn_by_commission    =>  p_total_remnrtn_by_commission
284       ,p_additional_tax                 =>  p_additional_tax
285       ,p_annual_dedn                    =>  p_annual_dedn
286       ,p_total_expense_by_commission    =>  p_total_expense_by_commission
288       ,p_prescribed_zone_dedn_amt       =>  p_prescribed_zone_dedn_amt
289       ,p_other_fedtax_credits           =>  p_other_fedtax_credits
290       ,p_cpp_qpp_exempt_flag            =>  p_cpp_qpp_exempt_flag
291       ,p_fed_exempt_flag                =>  p_fed_exempt_flag
292       ,p_ei_exempt_flag                 =>  p_ei_exempt_flag
293       ,p_tax_calc_method                =>  p_tax_calc_method
294       ,p_fed_override_amount            =>  p_fed_override_amount
295       ,p_fed_override_rate              =>  p_fed_override_rate
296       ,p_ca_tax_information_category    =>  p_ca_tax_information_category
297       ,p_ca_tax_information1            =>  p_ca_tax_information1
298       ,p_ca_tax_information2            =>  p_ca_tax_information2
299       ,p_ca_tax_information3            =>  p_ca_tax_information3
300       ,p_ca_tax_information4            =>  p_ca_tax_information4
301       ,p_ca_tax_information5            =>  p_ca_tax_information5
302       ,p_ca_tax_information6            =>  p_ca_tax_information6
303       ,p_ca_tax_information7            =>  p_ca_tax_information7
304       ,p_ca_tax_information8            =>  p_ca_tax_information8
305       ,p_ca_tax_information9            =>  p_ca_tax_information9
306       ,p_ca_tax_information10           =>  p_ca_tax_information10
307       ,p_ca_tax_information11           =>  p_ca_tax_information11
308       ,p_ca_tax_information12           =>  p_ca_tax_information12
309       ,p_ca_tax_information13           =>  p_ca_tax_information13
310       ,p_ca_tax_information14           =>  p_ca_tax_information14
311       ,p_ca_tax_information15           =>  p_ca_tax_information15
312       ,p_ca_tax_information16           =>  p_ca_tax_information16
313       ,p_ca_tax_information17           =>  p_ca_tax_information17
314       ,p_ca_tax_information18           =>  p_ca_tax_information18
315       ,p_ca_tax_information19           =>  p_ca_tax_information19
316       ,p_ca_tax_information20           =>  p_ca_tax_information20
317       ,p_ca_tax_information21           =>  p_ca_tax_information21
318       ,p_ca_tax_information22           =>  p_ca_tax_information22
319       ,p_ca_tax_information23           =>  p_ca_tax_information23
320       ,p_ca_tax_information24           =>  p_ca_tax_information24
321       ,p_ca_tax_information25           =>  p_ca_tax_information25
322       ,p_ca_tax_information26           =>  p_ca_tax_information26
323       ,p_ca_tax_information27           =>  p_ca_tax_information27
324       ,p_ca_tax_information28           =>  p_ca_tax_information28
325       ,p_ca_tax_information29           =>  p_ca_tax_information29
326       ,p_ca_tax_information30           =>  p_ca_tax_information30
327       ,p_object_version_number          =>  l_object_version_number
328       ,p_fed_lsf_amount                 =>  p_fed_lsf_amount
329       ,p_cpp_election_date              =>  p_cpp_election_date             --For Bug Number 13258136
330       ,p_cpp_revocation_date            =>  p_cpp_revocation_date           --For Bug Number 13258136
331       ,p_effective_date                      => trunc(p_effective_date)
332       );
333   exception
334     when hr_api.cannot_find_prog_unit then
335       hr_api.cannot_find_prog_unit_error
336         (p_module_name => 'CREATE_ca_emp_fedtax_inf'
337         ,p_hook_type   => 'AP'
338         );
339     --
340     -- End of API User Hook for the after hook of create_ca_emp_fedtax_inf
341     --
342   end;
343 */
344   --
345   hr_utility.set_location(l_proc, 60);
346   --
347   -- When in validation only mode raise the Validate_Enabled exception
348   --
349   if p_validate then
350     raise hr_api.validate_enabled;
351   end if;
352   --
353   -- Set all output arguments
354   --
355   p_emp_fed_tax_inf_id := l_emp_fed_tax_inf_id;
356   p_effective_start_date := l_effective_start_date;
357   p_effective_end_date := l_effective_end_date;
358   p_object_version_number := l_object_version_number;
359   --
360   hr_utility.set_location(' Leaving:'||l_proc, 70);
361   --
362 end if;
363 exception
364   --
365   when hr_api.validate_enabled then
366     --
367     -- As the Validate_Enabled exception has been raised
368     -- we must rollback to the savepoint
369     --
370     ROLLBACK TO create_ca_emp_fedtax_inf;
371     --
372     -- Only set output warning arguments
373     -- (Any key or derived arguments must be set to null
374     -- when validation only mode is being used.)
375     --
376     p_emp_fed_tax_inf_id := null;
377     p_effective_start_date := null;
378     p_effective_end_date := null;
379     p_object_version_number  := null;
380     hr_utility.set_location(' Leaving:'||l_proc, 80);
381     --
382   when others then
383     --
384     -- A validation or unexpected error has occured
385     --
386 hr_utility.trace('In exeception');
387     ROLLBACK TO create_ca_emp_fedtax_inf;
388     raise;
389     --
390 end create_ca_emp_fedtax_inf;
391 -- ----------------------------------------------------------------------------
392 -- |------------------------< update_ca_emp_fedtax_inf >--- ------------------|
393 -- ----------------------------------------------------------------------------
397   ,p_emp_fed_tax_inf_id             in  number
394 --
395 procedure update_ca_emp_fedtax_inf
396   (p_validate                       in  boolean   default false
398   ,p_effective_start_date           out nocopy date
399   ,p_effective_end_date             out nocopy date
400   ,p_legislation_code               in  varchar2  default hr_api.g_varchar2
401   ,p_assignment_id                  in  number    default hr_api.g_number
402   ,p_business_group_id              in  number    default hr_api.g_number
403   ,p_employment_province            in  varchar2  default hr_api.g_varchar2
404   ,p_tax_credit_amount              in  number    default hr_api.g_number
405   ,p_claim_code                     in  varchar2  default hr_api.g_varchar2
406   ,p_basic_exemption_flag           in  varchar2  default hr_api.g_varchar2
407   ,p_additional_tax                 in  number    default hr_api.g_number
408   ,p_annual_dedn                    in  number    default hr_api.g_number
409   ,p_total_expense_by_commission    in  number    default hr_api.g_number
410   ,p_total_remnrtn_by_commission    in  number    default hr_api.g_number
411   ,p_prescribed_zone_dedn_amt       in  number    default hr_api.g_number
412   ,p_other_fedtax_credits           in  varchar2  default hr_api.g_varchar2
413   ,p_cpp_qpp_exempt_flag            in  varchar2  default hr_api.g_varchar2
414   ,p_fed_exempt_flag                in  varchar2  default hr_api.g_varchar2
415   ,p_ei_exempt_flag                 in  varchar2  default hr_api.g_varchar2
416   ,p_tax_calc_method                in  varchar2  default hr_api.g_varchar2
417   ,p_fed_override_amount            in  number    default hr_api.g_number
418   ,p_fed_override_rate              in  number    default hr_api.g_number
419   ,p_ca_tax_information_category    in  varchar2  default hr_api.g_varchar2
420   ,p_ca_tax_information1            in  varchar2  default hr_api.g_varchar2
421   ,p_ca_tax_information2            in  varchar2  default hr_api.g_varchar2
422   ,p_ca_tax_information3            in  varchar2  default hr_api.g_varchar2
423   ,p_ca_tax_information4            in  varchar2  default hr_api.g_varchar2
424   ,p_ca_tax_information5            in  varchar2  default hr_api.g_varchar2
425   ,p_ca_tax_information6            in  varchar2  default hr_api.g_varchar2
426   ,p_ca_tax_information7            in  varchar2  default hr_api.g_varchar2
427   ,p_ca_tax_information8            in  varchar2  default hr_api.g_varchar2
428   ,p_ca_tax_information9            in  varchar2  default hr_api.g_varchar2
429   ,p_ca_tax_information10           in  varchar2  default hr_api.g_varchar2
430   ,p_ca_tax_information11           in  varchar2  default hr_api.g_varchar2
431   ,p_ca_tax_information12           in  varchar2  default hr_api.g_varchar2
432   ,p_ca_tax_information13           in  varchar2  default hr_api.g_varchar2
433   ,p_ca_tax_information14           in  varchar2  default hr_api.g_varchar2
434   ,p_ca_tax_information15           in  varchar2  default hr_api.g_varchar2
435   ,p_ca_tax_information16           in  varchar2  default hr_api.g_varchar2
436   ,p_ca_tax_information17           in  varchar2  default hr_api.g_varchar2
437   ,p_ca_tax_information18           in  varchar2  default hr_api.g_varchar2
438   ,p_ca_tax_information19           in  varchar2  default hr_api.g_varchar2
439   ,p_ca_tax_information20           in  varchar2  default hr_api.g_varchar2
440   ,p_ca_tax_information21           in  varchar2  default hr_api.g_varchar2
441   ,p_ca_tax_information22           in  varchar2  default hr_api.g_varchar2
442   ,p_ca_tax_information23           in  varchar2  default hr_api.g_varchar2
443   ,p_ca_tax_information24           in  varchar2  default hr_api.g_varchar2
444   ,p_ca_tax_information25           in  varchar2  default hr_api.g_varchar2
445   ,p_ca_tax_information26           in  varchar2  default hr_api.g_varchar2
446   ,p_ca_tax_information27           in  varchar2  default hr_api.g_varchar2
447   ,p_ca_tax_information28           in  varchar2  default hr_api.g_varchar2
448   ,p_ca_tax_information29           in  varchar2  default hr_api.g_varchar2
449   ,p_ca_tax_information30           in  varchar2  default hr_api.g_varchar2
450   ,p_object_version_number          in out nocopy number
451   ,p_fed_lsf_amount                in  number    default hr_api.g_number
452   ,p_cpp_election_date              in date  default null     --For Bug Number 13258136, defaulted for Bug 13690645
453   ,p_cpp_revocation_date            in date  default null     --For Bug Number 13258136, defaulted for Bug 13690645
454   ,p_effective_date                 in  date
455   ,p_datetrack_mode                 in  varchar2
456   ) is
457   --
458   -- Declare cursors and local variables
459   --
460   l_proc varchar2(72) := g_package||'update_ca_emp_fedtax_inf';
461   l_object_version_number pay_ca_emp_fed_tax_info_f.object_version_number%TYPE;
462   l_effective_start_date pay_ca_emp_fed_tax_info_f.effective_start_date%TYPE;
463   l_effective_end_date pay_ca_emp_fed_tax_info_f.effective_end_date%TYPE;
464   --
465 begin
466   --
467   hr_utility.set_location('Entering:'|| l_proc, 10);
468   --
469   -- Issue a savepoint if operating in validation only mode
470   --
471   savepoint update_ca_emp_fedtax_inf;
472   --
473   hr_utility.set_location(l_proc, 20);
474   --
475   -- Process Logic
476   --
477   l_object_version_number := p_object_version_number;
478   --
479 /*
480   begin
481     --
482     -- Start of API User Hook for the before hook of update_ca_emp_fedtax_inf
483     --
484     pay_ca_emp_fedtax_inf_bk2.update_ca_emp_fedtax_inf_b
485       (
486        p_emp_fed_tax_inf_id             =>  p_emp_fed_tax_inf_id
487       ,p_legislation_code               =>  p_legislation_code
491       ,p_tax_credit_amount              =>  p_tax_credit_amount
488       ,p_assignment_id                  =>  p_assignment_id
489       ,p_business_group_id              =>  p_business_group_id
490       ,p_employment_province            =>  p_employment_province
492       ,p_claim_code                     =>  p_claim_code
493       ,p_basic_exemption_flag           =>  p_basic_exemption_flag
494       ,p_additional_tax                 =>  p_additional_tax
495       ,p_annual_dedn                    =>  p_annual_dedn
496       ,p_total_expense_by_commission    =>  p_total_expense_by_commission
497       ,p_total_remnrtn_by_commission    =>  p_total_remnrtn_by_commission
498       ,p_prescribed_zone_dedn_amt       =>  p_prescribed_zone_dedn_amt
499       ,p_other_fedtax_credits           =>  p_other_fedtax_credits
500       ,p_cpp_qpp_exempt_flag            =>  p_cpp_qpp_exempt_flag
501       ,p_fed_exempt_flag                =>  p_fed_exempt_flag
502       ,p_ei_exempt_flag                 =>  p_ei_exempt_flag
503       ,p_tax_calc_method                =>  p_tax_calc_method
504       ,p_fed_override_amount            =>  p_fed_override_amount
505       ,p_fed_override_rate              =>  p_fed_override_rate
506       ,p_ca_tax_information_category    =>  p_ca_tax_information_category
507       ,p_ca_tax_information1            =>  p_ca_tax_information1
508       ,p_ca_tax_information2            =>  p_ca_tax_information2
509       ,p_ca_tax_information3            =>  p_ca_tax_information3
510       ,p_ca_tax_information4            =>  p_ca_tax_information4
511       ,p_ca_tax_information5            =>  p_ca_tax_information5
512       ,p_ca_tax_information6            =>  p_ca_tax_information6
513       ,p_ca_tax_information7            =>  p_ca_tax_information7
514       ,p_ca_tax_information8            =>  p_ca_tax_information8
515       ,p_ca_tax_information9            =>  p_ca_tax_information9
516       ,p_ca_tax_information10           =>  p_ca_tax_information10
517       ,p_ca_tax_information11           =>  p_ca_tax_information11
518       ,p_ca_tax_information12           =>  p_ca_tax_information12
519       ,p_ca_tax_information13           =>  p_ca_tax_information13
520       ,p_ca_tax_information14           =>  p_ca_tax_information14
521       ,p_ca_tax_information15           =>  p_ca_tax_information15
522       ,p_ca_tax_information16           =>  p_ca_tax_information16
523       ,p_ca_tax_information17           =>  p_ca_tax_information17
524       ,p_ca_tax_information18           =>  p_ca_tax_information18
525       ,p_ca_tax_information19           =>  p_ca_tax_information19
526       ,p_ca_tax_information20           =>  p_ca_tax_information20
527       ,p_ca_tax_information21           =>  p_ca_tax_information21
528       ,p_ca_tax_information22           =>  p_ca_tax_information22
529       ,p_ca_tax_information23           =>  p_ca_tax_information23
530       ,p_ca_tax_information24           =>  p_ca_tax_information24
531       ,p_ca_tax_information25           =>  p_ca_tax_information25
532       ,p_ca_tax_information26           =>  p_ca_tax_information26
533       ,p_ca_tax_information27           =>  p_ca_tax_information27
534       ,p_ca_tax_information28           =>  p_ca_tax_information28
535       ,p_ca_tax_information29           =>  p_ca_tax_information29
536       ,p_ca_tax_information30           =>  p_ca_tax_information30
537       ,p_object_version_number          =>  p_object_version_number
538       ,p_fed_lsf_amount                 =>  p_fed_lsf_amount
539       ,p_cpp_election_date              =>  p_cpp_election_date             --For Bug Number 13258136
540       ,p_cpp_revocation_date            =>  p_cpp_revocation_date           --For Bug Number 13258136
541     ,p_effective_date                      => trunc(p_effective_date)
542     ,p_datetrack_mode                      => p_datetrack_mode
543       );
544   exception
545     when hr_api.cannot_find_prog_unit then
546       hr_api.cannot_find_prog_unit_error
547         (p_module_name => 'UPDATE_ca_emp_fedtax_inf'
548         ,p_hook_type   => 'BP'
549         );
550     --
551     -- End of API User Hook for the before hook of update_ca_emp_fedtax_inf
552     --
553   end;
554   --
555 */
556   pay_cft_upd.upd
557     (
558      p_emp_fed_tax_inf_id            => p_emp_fed_tax_inf_id
559     ,p_effective_start_date          => l_effective_start_date
560     ,p_effective_end_date            => l_effective_end_date
561     ,p_legislation_code              => p_legislation_code
562     ,p_assignment_id                 => p_assignment_id
563     ,p_business_group_id             => p_business_group_id
564     ,p_employment_province           => p_employment_province
565     ,p_tax_credit_amount             => p_tax_credit_amount
566     ,p_claim_code                    => p_claim_code
567     ,p_basic_exemption_flag          => p_basic_exemption_flag
568     ,p_additional_tax                => p_additional_tax
569     ,p_annual_dedn                   => p_annual_dedn
570     ,p_total_expense_by_commission   => p_total_expense_by_commission
571     ,p_total_remnrtn_by_commission   => p_total_remnrtn_by_commission
572     ,p_prescribed_zone_dedn_amt      => p_prescribed_zone_dedn_amt
573     ,p_other_fedtax_credits          => p_other_fedtax_credits
574     ,p_cpp_qpp_exempt_flag           => p_cpp_qpp_exempt_flag
575     ,p_fed_exempt_flag               => p_fed_exempt_flag
576     ,p_ei_exempt_flag                => p_ei_exempt_flag
577     ,p_tax_calc_method               => p_tax_calc_method
578     ,p_fed_override_amount           => p_fed_override_amount
579     ,p_fed_override_rate             => p_fed_override_rate
580     ,p_ca_tax_information_category   => p_ca_tax_information_category
581     ,p_ca_tax_information1           => p_ca_tax_information1
585     ,p_ca_tax_information5           => p_ca_tax_information5
582     ,p_ca_tax_information2           => p_ca_tax_information2
583     ,p_ca_tax_information3           => p_ca_tax_information3
584     ,p_ca_tax_information4           => p_ca_tax_information4
586     ,p_ca_tax_information6           => p_ca_tax_information6
587     ,p_ca_tax_information7           => p_ca_tax_information7
588     ,p_ca_tax_information8           => p_ca_tax_information8
589     ,p_ca_tax_information9           => p_ca_tax_information9
590     ,p_ca_tax_information10          => p_ca_tax_information10
591     ,p_ca_tax_information11          => p_ca_tax_information11
592     ,p_ca_tax_information12          => p_ca_tax_information12
593     ,p_ca_tax_information13          => p_ca_tax_information13
594     ,p_ca_tax_information14          => p_ca_tax_information14
595     ,p_ca_tax_information15          => p_ca_tax_information15
596     ,p_ca_tax_information16          => p_ca_tax_information16
597     ,p_ca_tax_information17          => p_ca_tax_information17
598     ,p_ca_tax_information18          => p_ca_tax_information18
599     ,p_ca_tax_information19          => p_ca_tax_information19
600     ,p_ca_tax_information20          => p_ca_tax_information20
601     ,p_ca_tax_information21          => p_ca_tax_information21
602     ,p_ca_tax_information22          => p_ca_tax_information22
603     ,p_ca_tax_information23          => p_ca_tax_information23
604     ,p_ca_tax_information24          => p_ca_tax_information24
605     ,p_ca_tax_information25          => p_ca_tax_information25
606     ,p_ca_tax_information26          => p_ca_tax_information26
607     ,p_ca_tax_information27          => p_ca_tax_information27
608     ,p_ca_tax_information28          => p_ca_tax_information28
609     ,p_ca_tax_information29          => p_ca_tax_information29
610     ,p_ca_tax_information30          => p_ca_tax_information30
611     ,p_object_version_number         => l_object_version_number
612     ,p_fed_lsf_amount                => p_fed_lsf_amount
613     ,p_cpp_election_date             => p_cpp_election_date             --For Bug Number 13258136
614     ,p_cpp_revocation_date           => p_cpp_revocation_date           --For Bug Number 13258136
615     ,p_effective_date                => trunc(p_effective_date)
616     ,p_datetrack_mode                => p_datetrack_mode
617     );
618   --
619 /*
620   begin
621     --
622     -- Start of API User Hook for the after hook of update_ca_emp_fedtax_inf
623     --
624     pay_ca_emp_fedtax_inf_bk2.update_ca_emp_fedtax_inf_a
625       (
626        p_emp_fed_tax_inf_id             =>  p_emp_fed_tax_inf_id
627       ,p_effective_start_date           =>  l_effective_start_date
628       ,p_effective_end_date             =>  l_effective_end_date
629       ,p_legislation_code               =>  p_legislation_code
630       ,p_assignment_id                  =>  p_assignment_id
631       ,p_business_group_id              =>  p_business_group_id
632       ,p_employment_province            =>  p_employment_province
633       ,p_tax_credit_amount              =>  p_tax_credit_amount
634       ,p_claim_code                     =>  p_claim_code
635       ,p_basic_exemption_flag           =>  p_basic_exemption_flag
636       ,p_additional_tax                 =>  p_additional_tax
637       ,p_annual_dedn                    =>  p_annual_dedn
638       ,p_total_expense_by_commission    =>  p_total_expense_by_commission
639       ,p_total_remnrtn_by_commission    =>  p_total_remnrtn_by_commission
640       ,p_prescribed_zone_dedn_amt       =>  p_prescribed_zone_dedn_amt
641       ,p_other_fedtax_credits           =>  p_other_fedtax_credits
642       ,p_cpp_qpp_exempt_flag            =>  p_cpp_qpp_exempt_flag
643       ,p_fed_exempt_flag                =>  p_fed_exempt_flag
644       ,p_ei_exempt_flag                 =>  p_ei_exempt_flag
645       ,p_tax_calc_method                =>  p_tax_calc_method
646       ,p_fed_override_amount            =>  p_fed_override_amount
647       ,p_fed_override_rate              =>  p_fed_override_rate
648       ,p_ca_tax_information_category    =>  p_ca_tax_information_category
649       ,p_ca_tax_information1            =>  p_ca_tax_information1
650       ,p_ca_tax_information2            =>  p_ca_tax_information2
651       ,p_ca_tax_information3            =>  p_ca_tax_information3
652       ,p_ca_tax_information4            =>  p_ca_tax_information4
653       ,p_ca_tax_information5            =>  p_ca_tax_information5
654       ,p_ca_tax_information6            =>  p_ca_tax_information6
655       ,p_ca_tax_information7            =>  p_ca_tax_information7
656       ,p_ca_tax_information8            =>  p_ca_tax_information8
657       ,p_ca_tax_information9            =>  p_ca_tax_information9
658       ,p_ca_tax_information10           =>  p_ca_tax_information10
659       ,p_ca_tax_information11           =>  p_ca_tax_information11
660       ,p_ca_tax_information12           =>  p_ca_tax_information12
661       ,p_ca_tax_information13           =>  p_ca_tax_information13
662       ,p_ca_tax_information14           =>  p_ca_tax_information14
663       ,p_ca_tax_information15           =>  p_ca_tax_information15
664       ,p_ca_tax_information16           =>  p_ca_tax_information16
665       ,p_ca_tax_information17           =>  p_ca_tax_information17
666       ,p_ca_tax_information18           =>  p_ca_tax_information18
667       ,p_ca_tax_information19           =>  p_ca_tax_information19
668       ,p_ca_tax_information20           =>  p_ca_tax_information20
669       ,p_ca_tax_information21           =>  p_ca_tax_information21
670       ,p_ca_tax_information22           =>  p_ca_tax_information22
671       ,p_ca_tax_information23           =>  p_ca_tax_information23
672       ,p_ca_tax_information24           =>  p_ca_tax_information24
673       ,p_ca_tax_information25           =>  p_ca_tax_information25
674       ,p_ca_tax_information26           =>  p_ca_tax_information26
678       ,p_ca_tax_information30           =>  p_ca_tax_information30
675       ,p_ca_tax_information27           =>  p_ca_tax_information27
676       ,p_ca_tax_information28           =>  p_ca_tax_information28
677       ,p_ca_tax_information29           =>  p_ca_tax_information29
679       ,p_object_version_number          =>  l_object_version_number
680       ,p_fed_lsf_amount                 =>  p_fed_lsf_amount
681       ,p_cpp_election_date              =>  p_cpp_election_date             --For Bug Number 13258136
682       ,p_cpp_revocation_date            =>  p_cpp_revocation_date           --For Bug Number 13258136
683       ,p_effective_date                 =>  trunc(p_effective_date)
684       ,p_datetrack_mode                 =>  p_datetrack_mode
685       );
686   exception
687     when hr_api.cannot_find_prog_unit then
688       hr_api.cannot_find_prog_unit_error
689         (p_module_name => 'UPDATE_ca_emp_fedtax_inf'
690         ,p_hook_type   => 'AP'
691         );
692     --
693     -- End of API User Hook for the after hook of update_ca_emp_fedtax_inf
694     --
695   end;
696 */
697   --
698   hr_utility.set_location(l_proc, 60);
699   --
700   -- When in validation only mode raise the Validate_Enabled exception
701   --
702   if p_validate then
703     raise hr_api.validate_enabled;
704   end if;
705   --
706   -- Set all output arguments
707   --
708   p_object_version_number := l_object_version_number;
709   p_effective_start_date := l_effective_start_date;
710   p_effective_end_date := l_effective_end_date;
711   --
712   hr_utility.set_location(' Leaving:'||l_proc, 70);
713   --
714 exception
715   --
716   when hr_api.validate_enabled then
717     --
718     -- As the Validate_Enabled exception has been raised
719     -- we must rollback to the savepoint
720     --
721     ROLLBACK TO update_ca_emp_fedtax_inf;
722     --
723     -- Only set output warning arguments
724     -- (Any key or derived arguments must be set to null
725     -- when validation only mode is being used.)
726     --
727     hr_utility.set_location(' Leaving:'||l_proc, 80);
728     --
729   when others then
730     --
731     -- A validation or unexpected error has occured
732     --
733     ROLLBACK TO update_ca_emp_fedtax_inf;
734     raise;
735     --
736 end update_ca_emp_fedtax_inf;
737 -- ----------------------------------------------------------------------------
738 -- |------------------------< delete_ca_emp_fedtax_inf >----------------------|
739 -- ----------------------------------------------------------------------------
740 --
741 procedure delete_ca_emp_fedtax_inf
742   (p_validate                       in  boolean  default false
743   ,p_emp_fed_tax_inf_id             in  number
744   ,p_effective_start_date           out nocopy date
745   ,p_effective_end_date             out nocopy date
746   ,p_object_version_number          in out nocopy number
747   ,p_effective_date                 in  date
748   ,p_datetrack_mode                 in  varchar2
749   ) is
750   --
751   -- Declare cursors and local variables
752   --
753   l_proc varchar2(72) := g_package||'update_ca_emp_fedtax_inf';
754   l_object_version_number pay_ca_emp_fed_tax_info_f.object_version_number%TYPE;
755   l_effective_start_date pay_ca_emp_fed_tax_info_f.effective_start_date%TYPE;
756   l_effective_end_date pay_ca_emp_fed_tax_info_f.effective_end_date%TYPE;
757   --
758 begin
759   --
760   hr_utility.set_location('Entering:'|| l_proc, 10);
761   --
762   -- Issue a savepoint if operating in validation only mode
763   --
764   savepoint delete_ca_emp_fedtax_inf;
765   --
766   hr_utility.set_location(l_proc, 20);
767   --
768   -- Process Logic
769   --
770   l_object_version_number := p_object_version_number;
771   --
772   --
773 /*
774   begin
775     --
776     -- Start of API User Hook for the before hook of delete_ca_emp_fedtax_inf
777     --
778     pay_ca_emp_fedtax_inf_bk3.delete_ca_emp_fedtax_inf_b
779       (
780        p_emp_fed_tax_inf_id             =>  p_emp_fed_tax_inf_id
781       ,p_object_version_number          =>  p_object_version_number
782     ,p_effective_date                      => trunc(p_effective_date)
783     ,p_datetrack_mode                      => p_datetrack_mode
784       );
785   exception
786     when hr_api.cannot_find_prog_unit then
787       hr_api.cannot_find_prog_unit_error
788         (p_module_name => 'DELETE_ca_emp_fedtax_inf'
789         ,p_hook_type   => 'BP'
790         );
791     --
792     -- End of API User Hook for the before hook of delete_ca_emp_fedtax_inf
793     --
794   end;
795 */
796   --
797   pay_cft_del.del
798     (
799      p_emp_fed_tax_inf_id            => p_emp_fed_tax_inf_id
800     ,p_effective_start_date          => l_effective_start_date
801     ,p_effective_end_date            => l_effective_end_date
802     ,p_object_version_number         => l_object_version_number
803     ,p_effective_date                => p_effective_date
804     ,p_datetrack_mode                => p_datetrack_mode
805     );
806   --
807 /*
808   begin
809     --
810     -- Start of API User Hook for the after hook of delete_ca_emp_fedtax_inf
811     --
812     pay_ca_emp_fedtax_inf_bk3.delete_ca_emp_fedtax_inf_a
813       (
814        p_emp_fed_tax_inf_id             =>  p_emp_fed_tax_inf_id
815       ,p_effective_start_date           =>  l_effective_start_date
816       ,p_effective_end_date             =>  l_effective_end_date
820       );
817       ,p_object_version_number          =>  l_object_version_number
818     ,p_effective_date                      => trunc(p_effective_date)
819     ,p_datetrack_mode                      => p_datetrack_mode
821   exception
822     when hr_api.cannot_find_prog_unit then
823       hr_api.cannot_find_prog_unit_error
824         (p_module_name => 'DELETE_ca_emp_fedtax_inf'
825         ,p_hook_type   => 'AP'
826         );
827     --
828     -- End of API User Hook for the after hook of delete_ca_emp_fedtax_inf
829     --
830   end;
831 */
832   --
833   hr_utility.set_location(l_proc, 60);
834   --
835   -- When in validation only mode raise the Validate_Enabled exception
836   --
837   if p_validate then
838     raise hr_api.validate_enabled;
839   end if;
840   --
841   hr_utility.set_location(' Leaving:'||l_proc, 70);
842   --
843 exception
844   --
845   when hr_api.validate_enabled then
846     --
847     -- As the Validate_Enabled exception has been raised
848     -- we must rollback to the savepoint
849     --
850     ROLLBACK TO delete_ca_emp_fedtax_inf;
851     --
852     -- Only set output warning arguments
853     -- (Any key or derived arguments must be set to null
854     -- when validation only mode is being used.)
855     --
856     p_effective_start_date := null;
857     p_effective_end_date := null;
858     --
859   when others then
860     --
861     -- A validation or unexpected error has occured
862     --
863     ROLLBACK TO delete_ca_emp_fedtax_inf;
864     raise;
865     --
866 end delete_ca_emp_fedtax_inf;
867 --
868 -- ----------------------------------------------------------------------------
869 -- |-------------------------------< lck >------------------------------------|
870 -- ----------------------------------------------------------------------------
871 --
872 procedure lck
873   (
874   p_emp_fed_tax_inf_id                   in     number
875   ,p_object_version_number          in     number
876   ,p_effective_date                 in     date
877   ,p_datetrack_mode                 in     varchar2
878   ,p_validation_start_date          out  nocopy   date
879   ,p_validation_end_date            out  nocopy   date
880   ) is
881   --
882   --
883   -- Declare cursors and local variables
884   --
885   l_proc varchar2(72) := g_package||'lck';
886   l_validation_start_date date;
887   l_validation_end_date date;
888   --
889 begin
890   --
891   hr_utility.set_location('Entering:'|| l_proc, 10);
892   --
893   pay_cft_shd.lck
894     (
895      p_emp_fed_tax_inf_id         => p_emp_fed_tax_inf_id
896      ,p_validation_start_date      => l_validation_start_date
897      ,p_validation_end_date        => l_validation_end_date
898      ,p_object_version_number      => p_object_version_number
899      ,p_effective_date             => p_effective_date
900      ,p_datetrack_mode             => p_datetrack_mode
901     );
902   --
903   hr_utility.set_location(' Leaving:'||l_proc, 70);
904   --
905 end lck;
906 --
907 /** Business Processes added manually */
908 
909 procedure pull_tax_records( p_assignment_id   in number,
910                             p_new_start_date  in date,
911                             p_default_date    in date) is
912        l_ef_date DATE;
913        l_proc VARCHAR2(50) := 'pay_ca_emp_fedtax_inf_api.pull_tax_records';
914 
915 begin
916        hr_utility.set_location('Entering: ' || l_proc, 5);
917 
918        if p_new_start_date < p_default_date then
919                 l_ef_date := p_default_date;
920        elsif p_new_start_date > p_default_date then
921                 l_ef_date := p_new_start_date;
922        else -- do nothing
923           return;
924        end if;
925 
926        /* First update the tax rules records */
927 
928   update PAY_CA_EMP_FED_TAX_INFO_F
929        set    effective_start_date = p_new_start_date
930        where  assignment_id = p_assignment_id
931        and    l_ef_date between effective_start_date and effective_end_date;
932 
933        if sql%notfound then
934           hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
935           hr_utility.set_message_token('PROCEDURE',l_proc);
936           hr_utility.set_message_token('STEP','2');
937           hr_utility.raise_error;
938        end if;
939 
940  /* Next delete any orphaned rows */
941        if p_new_start_date > p_default_date then
942                hr_utility.set_location(l_proc, 10);
943                delete PAY_CA_EMP_FED_TAX_INFO_F
944                where  assignment_id = p_assignment_id
945                and    p_new_start_date >  effective_start_date;
946 
947 
948         end if;
949 
950        hr_utility.set_location('Leaving: ' || l_proc, 20);
951 
952 end pull_tax_records;
953 
954 procedure check_hiring_date( p_assignment_id   in number,
955                              p_default_date    in date,
956                              p_s_start_date    in date) is
957 
958 begin
959 
960     /* If the hiring date has been changed and pulled back, for the
961        assignment then pull back the start date of the tax rules records
962     */
963 
964     if p_s_start_date < p_default_date then
965        pull_tax_records(p_assignment_id     => p_assignment_id,
966                         p_new_start_date    => p_s_start_date,
970     /* If the hiring date has been pulled forward then the person api
967                         p_default_date      => p_default_date);
968 
969 
971        pulls forward the element entries but does not pull forward the
972        tax rules record. So, we will pull them forward */
973 
974     elsif p_s_start_date > p_default_date then
975 
976        pull_tax_records(p_assignment_id     => p_assignment_id,
977                         p_new_start_date    => p_s_start_date,
978                         p_default_date      => p_default_date);
979     end if;
980 
981 end check_hiring_date;
982 
983 procedure tax_record_already_present(p_assignment_id in number,
984                                      p_effective_date in date,
985                                      p_rec_present out nocopy varchar2) is
986 cursor csr_chk_assignment_rec is
987        select  '1'
988        from   pay_ca_emp_fed_tax_info_f   paf
989        where  paf.assignment_id         = p_assignment_id;
990 /*
991        and    p_effective_date between paf.effective_start_date and
992                                      paf.effective_end_date ;
993 */
994 cursor csr_get_default_date (p_assignment number) is
995          select min(effective_start_date)
996            from   pay_ca_emp_fed_tax_info_f   fti
997              where  fti.assignment_id         = p_assignment_id;
998 
999 l_present varchar2(2);
1000 l_default_date date;
1001 rec_present varchar2(1);
1002 begin
1003 open csr_chk_assignment_rec;
1004 fetch csr_chk_assignment_rec into l_present;
1005 if csr_chk_assignment_rec%FOUND then
1006        p_rec_present := 'Y';
1007           /* Get the default date */
1008           open csr_get_default_date(p_assignment_id);
1009 
1010              fetch csr_get_default_date into l_default_date;
1011 
1012                if l_default_date is null then
1013 
1014              close csr_get_default_date;
1015              hr_utility.set_message(801 , 'HR_6153_ALL_PROCEDURE_FAIL');
1016              hr_utility.set_message_token('PROCEDURE',
1017              'pay_ca_emp_fedtax_inf_api.tax_record_already_present');
1018              hr_utility.set_message_token('STEP','1');
1019              hr_utility.raise_error;
1020 
1021           end if;
1022 
1023          close csr_get_default_date;
1024 
1025          /* Now check for pull back of the hiring date */
1026                    check_hiring_date(p_assignment_id  => p_assignment_id,
1027                                      p_default_date   => l_default_date,
1028                                      p_s_start_date   => p_effective_date);
1029 
1030 
1031 else
1032  p_rec_present := 'N';
1033 end if;
1034 end tax_record_already_present;
1035 /* ends tax_record_already_present */
1036 
1037 procedure perform_assignment_validation(p_assignment_id in varchar2,
1038                                      p_effective_date in date)
1039 is
1040 l_location_id number;
1041 l_country varchar2(30);
1042 cursor csr_chk_assignment is
1043        select  paf.location_id
1044        from   PER_ASSIGNMENTS_F   paf
1045        where  paf.assignment_id         = p_assignment_id
1046        and    p_effective_date between paf.effective_start_date and
1047                                      paf.effective_end_date ;
1048 cursor csr_get_location(p_location_id number) is
1049    select hrl.country from hr_locations hrl
1050    where hrl.location_id = p_location_id;
1051 
1052 begin
1053 /* Check whether the assignment is present as of that date or not and
1054 the location id of it. Raise error message if assignment is not present
1055 or location_id is null */
1056 open csr_chk_assignment;
1057 fetch csr_chk_assignment into l_location_id;
1058 
1059   if csr_chk_assignment%NOTFOUND then
1060                hr_utility.set_message(800 , 'HR_74004_ASSIGNMENT_ABSENT');
1061                hr_utility.raise_error;
1062   else
1063    if l_location_id is NULL then
1064                hr_utility.set_message(800, 'HR_74005_LOCATION_ABSENT');
1065                hr_utility.raise_error;
1066    else
1067     open csr_get_location(l_location_id);
1068     fetch csr_get_location into l_country;
1069     if l_country is null or l_country <> 'CA' then
1070                hr_utility.set_message(800, 'HR_74006_LOCATION_WRONG');
1071                hr_utility.raise_error;
1072     end if;
1073    end if;
1074   end if;
1075 end perform_assignment_validation;
1076 
1077 /******* end perform validation ***/
1078 
1079 procedure check_basic_exemption(p_basic_exemption_flag in varchar2,
1080                                 p_tax_credit_amount in number) is
1081 begin
1082 if p_basic_exemption_flag = 'Y'  then
1083  if p_tax_credit_amount is not null then
1084                hr_utility.set_message(800, 'HR_74007_BOTH_NOT_NULL');
1085                hr_utility.raise_error;
1086  end if;
1087 elsif p_basic_exemption_flag = 'N' then
1088  if p_tax_credit_amount is NULL then
1089                hr_utility.set_message(800, 'HR_74008_BOTH_NULL');
1090                hr_utility.raise_error;
1091  end if;
1092 elsif p_basic_exemption_flag is NULL then
1093  if p_tax_credit_amount is NULL then
1094                hr_utility.set_message(800, 'HR_74008_BOTH_NULL');
1095                hr_utility.raise_error;
1096  end if;
1097 end if;
1098 end check_basic_exemption;
1099 
1100 
1101 procedure check_employment_province(p_employment_province in varchar2) is
1102 
1103 cursor csr_employment_province is
1104 select '1' from hr_lookups lkp
1105 where lkp.lookup_code = p_employment_province
1106 and   lkp.lookup_type = 'CA_PROVINCE';
1107 
1108 l_employment_province varchar2(30);
1109 
1110 begin
1111 open csr_employment_province;
1112 fetch csr_employment_province into l_employment_province;
1113 if  csr_employment_province%NOTFOUND then
1114                hr_utility.set_message(800, 'HR_74009_EMPL_PROV_WRONG');
1115                hr_utility.raise_error;
1116 end if;
1117 end check_employment_province;
1118 
1119 function convert_null_to_zero(p_value in number) return number is
1120 begin
1121  if p_value is null then
1122   return 0;
1123  else
1124   return p_value;
1125  end if;
1126 end convert_null_to_zero;
1127 
1128 /** End business processes **/
1129 end pay_ca_emp_fedtax_inf_api;