DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_CA_EMP_FEDTAX_INF_API

Source


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