[Home] [Help]
PACKAGE BODY: APPS.PAY_CFT_BUS
Source
1 Package Body pay_cft_bus as
2 /* $Header: pycatrhi.pkb 120.5.12020000.2 2012/11/27 10:17:35 pracagra ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_cft_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_emp_fed_tax_inf_id >------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description
15 -- This procedure is used to check that the primary key for the table
16 -- is created properly. It should be null on insert and
17 -- should not be able to be updated.
18 --
19 -- Pre Conditions
20 -- None.
21 --
22 -- In Parameters
23 -- emp_fed_tax_inf_id PK of record being inserted or updated.
24 -- effective_date Effective Date of session
25 -- object_version_number Object version number of record being
26 -- inserted or updated.
27 --
28 -- Post Success
29 -- Processing continues
30 --
31 -- Post Failure
32 -- Errors handled by the procedure
33 --
34 -- Access Status
35 -- Internal table handler use only.
36 --
37 Procedure chk_emp_fed_tax_inf_id(p_emp_fed_tax_inf_id in number,
38 p_effective_date in date,
39 p_object_version_number in number) is
40 --
41 l_proc varchar2(72) := g_package||'chk_emp_fed_tax_inf_id';
42 l_api_updating boolean;
43 --
44 Begin
45 --
46 hr_utility.set_location('Entering:'||l_proc, 5);
47 --
48 l_api_updating := pay_cft_shd.api_updating
49 (p_effective_date => p_effective_date,
50 p_emp_fed_tax_inf_id => p_emp_fed_tax_inf_id,
51 p_object_version_number => p_object_version_number);
52 --
53 if (l_api_updating
54 and nvl(p_emp_fed_tax_inf_id,hr_api.g_number)
55 <> pay_cft_shd.g_old_rec.emp_fed_tax_inf_id) then
56 --
57 -- raise error as PK has changed
58 --
59 pay_cft_shd.constraint_error('PAY_CA_EMP_FED_TAX_RULES_PK');
60 --
61 elsif not l_api_updating then
62 --
63 -- check if PK is null
64 --
65 if p_emp_fed_tax_inf_id is not null then
66 --
67 -- raise error as PK is not null
68 --
69 pay_cft_shd.constraint_error('PAY_CA_EMP_FED_TAX_RULES_PK');
70 --
71 end if;
72 --
73 end if;
74 --
75 hr_utility.set_location('Leaving:'||l_proc, 10);
76 --
77 End chk_emp_fed_tax_inf_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |------< chk_legislation_code >------|
81 -- ----------------------------------------------------------------------------
82 --
83 -- Description
84 -- This procedure is used to check that the lookup value is valid.
85 --
86 -- Pre Conditions
87 -- None.
88 --
89 -- In Parameters
90 -- emp_fed_tax_inf_id PK of record being inserted or updated.
91 -- legislation_code Value must be 'CA'.
92 -- effective_date effective date
93 -- object_version_number Object version number of record being
94 -- inserted or updated.
95 --
96 -- Post Success
97 -- Processing continues
98 --
99 -- Post Failure
100 -- Error handled by procedure
104 --
101 --
102 -- Access Status
103 -- Internal table handler use only.
105 Procedure chk_legislation_code(p_emp_fed_tax_inf_id in number,
106 p_legislation_code in varchar2,
107 p_effective_date in date,
108 p_object_version_number in number) is
109 --
110 l_proc varchar2(72) := g_package||'chk_legislation_code';
111 l_api_updating boolean;
112 --
113 Begin
114 --
115 hr_utility.set_location('Entering:'||l_proc, 5);
116 --
117 l_api_updating := pay_cft_shd.api_updating
118 (p_emp_fed_tax_inf_id => p_emp_fed_tax_inf_id,
119 p_effective_date => p_effective_date,
120 p_object_version_number => p_object_version_number);
121 --
122 if l_api_updating
123 and p_legislation_code
124 <> nvl(pay_cft_shd.g_old_rec.legislation_code,hr_api.g_varchar2)
125 or not l_api_updating then
126 ---
127 if p_legislation_code is null then
128 -- raise error as legislation_code is NULL
129 --
130 hr_utility.set_message(800, 'HR_74028_WRONG_LEGIS_CODE');
131 hr_utility.raise_error;
132 --
133 end if;
134 --
135 -- check if value of lookup falls within lookup type.
136 --
137 if p_legislation_code <> 'CA' then
138 -- raise error as legislation_code is not CA
139 --
140 hr_utility.set_message(800, 'HR_74028_WRONG_LEGIS_CODE');
141 hr_utility.raise_error;
142 --
143 end if;
144 --
145 end if;
146 --
147 hr_utility.set_location('Leaving:'||l_proc,10);
148 --
149 end chk_legislation_code;
150 --
151 -- ----------------------------------------------------------------------------
152 -- |------< chk_assignment_id >------|
153 -- ----------------------------------------------------------------------------
154 Procedure chk_assignment_id
155 (p_emp_fed_tax_inf_id in number
156 ,p_assignment_id in
157 pay_ca_emp_prov_tax_info_f.assignment_id%TYPE
158 ,p_business_group_id in
159 pay_ca_emp_prov_tax_info_f.business_group_id%TYPE
160 ,p_effective_date in date
161 ,p_object_version_number in number
162 ) is
163 --
164 l_proc varchar2(72) := g_package||'chk_assignment_id';
165 l_dummy varchar2(1);
166 l_api_updating boolean;
167 l_business_group_id per_assignments_f.business_group_id%TYPE;
168 l_location_id per_assignments_f.location_id%TYPE;
169 l_country varchar2(30);
170 --
171 cursor c1 is
172 select business_group_id,location_id
173 from per_assignments_f asg
174 where asg.assignment_id = p_assignment_id
175 and p_effective_date between asg.effective_start_date
176 and asg.effective_end_date;
177 --
178 cursor csr_get_location(p_location_id number) is
179 select hrl.country from hr_locations hrl
180 where hrl.location_id = p_location_id;
181 --
182 Begin
183 --
184 hr_utility.set_location('Entering:'||l_proc,5);
185 --
186 -- Check that the mandatory parameters have been set
187 --
188 --dbms_output.put_line('in assignment_id ');
189 if p_assignment_id is null then
190 hr_utility.set_message(800, 'HR_74023_ASSIGNMENT_ID_NULL');
191 hr_utility.raise_error;
192 end if;
193 --
194 --dbms_output.put_line('in assignment_id 2');
195 if p_business_group_id is null then
196 hr_utility.set_message(800, 'HR_74024_BUSINESS_GROUP_ID_NULL');
197 hr_utility.raise_error;
198 end if;
199 --
200 --dbms_output.put_line('in assignment_id 3');
201 hr_api.mandatory_arg_error
202 (p_api_name => l_proc
203 ,p_argument => 'effective_date'
204 ,p_argument_value => p_effective_date
205 );
206 --
207 --dbms_output.put_line('in assignment_id 4');
208 l_api_updating := pay_cft_shd.api_updating
209 (p_emp_fed_tax_inf_id => p_emp_fed_tax_inf_id,
210 p_effective_date => p_effective_date,
211 p_object_version_number => p_object_version_number);
212 --
213 -- Since assignment_id cannot be updated, the case of
214 -- l_api_updating = TRUE is not considered
215 --
216 if (l_api_updating ) then
217 if p_assignment_id <> pay_cft_shd.g_old_rec.assignment_id then
218 --dbms_output.put_line('cannot change assignment_id');
219 hr_utility.set_message(800, 'HR_74027_ASSIGNMENT_ID_CHANGED');
220 hr_utility.raise_error;
221 end if;
222 end if;
223
224 -- if (not l_api_updating) then
225 --
226 open c1;
227 --
228 --dbms_output.put_line('in assignment_id 5');
229 fetch c1 into l_business_group_id,l_location_id;
230 if c1%notfound then
231 --
232 close c1;
233 --
234 -- raise error as assignment_id not found in per_assignments_f
235 -- table.
236 --
237 --dbms_output.put_line('in assignment_id 6');
238 hr_utility.set_message(800, 'HR_74025_INVALID_ASSIGNMENT_ID');
239 hr_utility.raise_error;
240 --
241 else
242 --
243 close c1;
244 --
245 --dbms_output.put_line('in assignment_id 7');
246 if p_business_group_id <> l_business_group_id then
247 --
248 hr_utility.set_message(800, 'HR_74026_INVALID_BG_ID');
252 else
249 hr_utility.set_message_token('BG_ID' , l_business_group_id);
250 hr_utility.raise_error;
251 --
253
254 if l_location_id is NULL then
255 fnd_message.set_name('HR', 'HR_74005_LOCATION_ABSENT');
256 fnd_message.raise_error;
257 else
258 open csr_get_location(l_location_id);
259 fetch csr_get_location into l_country;
260 if l_country is null or l_country <> 'CA' then
261 close csr_get_location;
262 fnd_message.set_name('HR', 'HR_74006_LOCATION_WRONG');
263 fnd_message.raise_error;
264 end if;
265 close csr_get_location;
266 end if;
267 end if;
268 --
269 end if;
270 --
271 -- end if;
272 --
273 --dbms_output.put_line('in assignment_id 6');
274 hr_utility.set_location('Leaving:'||l_proc,10);
275 --
276 End chk_assignment_id;
277 -- ----------------------------------------------------------------------------
278 -- |------< chk_employment_province >------|
279 -- ----------------------------------------------------------------------------
280 --
281 -- Description
282 -- This procedure is used to check that the lookup value is valid.
283 --
284 -- Pre Conditions
285 -- None.
286 --
287 -- In Parameters
288 -- emp_fed_tax_inf_id PK of record being inserted or updated.
289 -- province_code Value of lookup code.
290 -- effective_date effective date
291 -- object_version_number Object version number of record being
292 -- inserted or updated.
293 --
294 -- Post Success
295 -- Processing continues
296 --
297 -- Post Failure
298 -- Error handled by procedure
299 --
300 -- Access Status
301 -- Internal table handler use only.
302 --
303 Procedure chk_employment_province(p_emp_fed_tax_inf_id in number,
304 p_employment_province in varchar2,
305 p_effective_date in date,
306 p_object_version_number in number) is
307 --
308 l_proc varchar2(72) := g_package||'chk_fed_code';
309 l_api_updating boolean;
310 --
311 Begin
312 --
313 hr_utility.set_location('Entering:'||l_proc, 5);
314 --
315 l_api_updating := pay_cft_shd.api_updating
316 (p_emp_fed_tax_inf_id => p_emp_fed_tax_inf_id,
317 p_effective_date => p_effective_date,
318 p_object_version_number => p_object_version_number);
319 --
320 if (l_api_updating
321 and p_employment_province
322 <> nvl(pay_cft_shd.g_old_rec.employment_province,hr_api.g_varchar2)
323 or not l_api_updating)
324 and p_employment_province is not null then
325 --
326 -- check if value of lookup falls within lookup type.
327 --
328 if hr_api.not_exists_in_hr_lookups
329 (p_lookup_type => 'CA_PROVINCE',
330 p_lookup_code => p_employment_province,
331 p_effective_date => p_effective_date) then
332 --
333 -- raise error as does not exist as lookup
334 --
335 hr_utility.set_message(800,'HR_EMPLOYMENT_PROVINCE_WRONG');
336 hr_utility.raise_error;
337 --
338 end if;
339 --
340 end if;
341 --
342 hr_utility.set_location('Leaving:'||l_proc,10);
343 --
344 end chk_employment_province;
345 -- ----------------------------------------------------------------------------
346 -- |------< chk_ei_exempt_flag >------|
347 -- ----------------------------------------------------------------------------
348 --
349 -- Description
350 -- This procedure is used to check that the lookup value is valid.
351 --
352 -- Pre Conditions
353 -- None.
354 --
355 -- In Parameters
356 -- emp_fed_tax_inf_id PK of record being inserted or updated.
357 -- ei_exempt_flag Value of lookup code.
358 -- effective_date effective date
359 -- object_version_number Object version number of record being
360 -- inserted or updated.
361 --
362 -- Post Success
363 -- Processing continues
364 --
365 -- Post Failure
366 -- Error handled by procedure
367 --
368 -- Access Status
369 -- Internal table handler use only.
370 --
371 Procedure chk_ei_exempt_flag(p_emp_fed_tax_inf_id in number,
372 p_ei_exempt_flag in varchar2,
373 p_effective_date in date,
374 p_object_version_number in number) is
375 --
376 l_proc varchar2(72) := g_package||'chk_ei_exempt_flag';
377 l_api_updating boolean;
378 --
379 Begin
380 --
381 hr_utility.set_location('Entering:'||l_proc, 5);
382 --
383 l_api_updating := pay_cft_shd.api_updating
384 (p_emp_fed_tax_inf_id => p_emp_fed_tax_inf_id,
385 p_effective_date => p_effective_date,
386 p_object_version_number => p_object_version_number);
387 --
388 if (l_api_updating
389 and p_ei_exempt_flag
390 <> nvl(pay_cft_shd.g_old_rec.ei_exempt_flag,hr_api.g_varchar2)
391 or not l_api_updating)
392 and p_ei_exempt_flag is not null then
393 --
394 -- check if value of lookup falls within lookup type.
395 --
396 if hr_api.not_exists_in_hr_lookups
397 (p_lookup_type => 'YES_NO',
401 -- raise error as does not exist as lookup
398 p_lookup_code => p_ei_exempt_flag,
399 p_effective_date => p_effective_date) then
400 --
402 --
403 hr_utility.set_message(800,'HR_EI_EXEMPT_FLAG_IS WRONG');
404 hr_utility.raise_error;
405 --
406 end if;
407 --
408 end if;
409 --
410 hr_utility.set_location('Leaving:'||l_proc,10);
411 --
412 end chk_ei_exempt_flag;
413 --
414 -- ----------------------------------------------------------------------------
415 -- |------< chk_fed_exempt_flag >------|
416 -- ----------------------------------------------------------------------------
417 --
418 -- Description
419 -- This procedure is used to check that the lookup value is valid.
420 --
421 -- Pre Conditions
422 -- None.
423 --
424 -- In Parameters
425 -- emp_fed_tax_inf_id PK of record being inserted or updated.
426 -- fed_exempt_flag Value of lookup code.
427 -- effective_date effective date
428 -- object_version_number Object version number of record being
429 -- inserted or updated.
430 --
431 -- Post Success
432 -- Processing continues
433 --
434 -- Post Failure
435 -- Error handled by procedure
436 --
437 -- Access Status
438 -- Internal table handler use only.
439 --
440 Procedure chk_fed_exempt_flag(p_emp_fed_tax_inf_id in number,
441 p_fed_exempt_flag in varchar2,
442 p_effective_date in date,
443 p_object_version_number in number) is
444 --
445 l_proc varchar2(72) := g_package||'chk_fed_exempt_flag';
446 l_api_updating boolean;
447 --
448 Begin
449 --
450 hr_utility.set_location('Entering:'||l_proc, 5);
451 --
452 l_api_updating := pay_cft_shd.api_updating
453 (p_emp_fed_tax_inf_id => p_emp_fed_tax_inf_id,
454 p_effective_date => p_effective_date,
455 p_object_version_number => p_object_version_number);
456 --
457 if (l_api_updating
458 and p_fed_exempt_flag
459 <> nvl(pay_cft_shd.g_old_rec.fed_exempt_flag,hr_api.g_varchar2)
460 or not l_api_updating)
461 and p_fed_exempt_flag is not null then
462 --
463 -- check if value of lookup falls within lookup type.
464 --
465 if hr_api.not_exists_in_hr_lookups
466 (p_lookup_type => 'YES_NO',
467 p_lookup_code => p_fed_exempt_flag,
468 p_effective_date => p_effective_date) then
469 --
470 -- raise error as does not exist as lookup
471 --
472 hr_utility.set_message(800,'HR_FED_EXEMPT_FLAG_IS_WRONG');
473 hr_utility.raise_error;
474 --
475 end if;
476 --
477 end if;
478 --
479 hr_utility.set_location('Leaving:'||l_proc,10);
480 --
481 end chk_fed_exempt_flag;
482 --
483 -- ----------------------------------------------------------------------------
484 -- |------< chk_cpp_qpp_exempt_flag >------|
485 -- ----------------------------------------------------------------------------
486 --
487 -- Description
488 -- This procedure is used to check that the lookup value is valid.
489 --
490 -- Pre Conditions
491 -- None.
492 --
493 -- In Parameters
494 -- emp_fed_tax_inf_id PK of record being inserted or updated.
495 -- cpp_qpp_exempt_flag Value of lookup code.
496 -- cpp_qpp_exempt_flag Value of lookup code.
497 -- cpp_election_date Date value entered for CPP Election Date
498 -- cpp_revocation_date Date value entered for CPP Election Date
499 -- effective_date effective date
500 -- object_version_number Object version number of record being
501 -- inserted or updated.
502 --
503 -- Post Success
504 -- Processing continues
505 --
506 -- Post Failure
507 -- Error handled by procedure
508 --
509 -- Access Status
510 -- Internal table handler use only.
511 --
512 Procedure chk_cpp_qpp_exempt_flag(p_emp_fed_tax_inf_id in number,
513 p_cpp_qpp_exempt_flag in varchar2,
514 p_cpp_election_date in date, --Added for bug 13542083
515 p_cpp_revocation_date in date, --Added for bug 13542083
516 p_effective_date in date,
517 p_object_version_number in number) is
518 --
519 l_proc varchar2(72) := g_package||'chk_cpp_qpp_exempt_flag';
520 l_api_updating boolean;
521 --
522 Begin
523 --
524 hr_utility.set_location('Entering:'||l_proc, 5);
525 --
526 l_api_updating := pay_cft_shd.api_updating
527 (p_emp_fed_tax_inf_id => p_emp_fed_tax_inf_id,
528 p_effective_date => p_effective_date,
529 p_object_version_number => p_object_version_number);
530 --
531 if (l_api_updating
532 and p_cpp_qpp_exempt_flag
533 <> nvl(pay_cft_shd.g_old_rec.cpp_qpp_exempt_flag,hr_api.g_varchar2)
534 or not l_api_updating)
535 and p_cpp_qpp_exempt_flag is not null then
536 --
537 -- check if value of lookup falls within lookup type.
538 --
539 if hr_api.not_exists_in_hr_lookups
540 (p_lookup_type => 'YES_NO',
541 p_lookup_code => p_cpp_qpp_exempt_flag,
542 p_effective_date => p_effective_date) then
543 --
547 hr_utility.raise_error;
544 -- raise error as does not exist as lookup
545 --
546 hr_utility.set_message(800,'HR_CPP_QPP_EXEMPT_FLAG_WRONG');
548 --
549 end if;
550
551 /*Changes for bug 13542083 - Start*/
552
553 /* Checking if CPP Election/Revocation date is already entered*/
554 if (p_cpp_election_date is not null or p_cpp_revocation_date is not null)
555 and (p_cpp_qpp_exempt_flag='Y') then
556 -- Error: The CPP Election or Revocation Date is already entered
557 hr_utility.set_message(801, 'PAY_74180_CPT30_DATE_ENTERED');
558 hr_utility.raise_error;
559 end if;
560
561 /*Changes for bug 13542083 - End*/
562 --
563 end if;
564 --
565 hr_utility.set_location('Leaving:'||l_proc,10);
566 --
567 end chk_cpp_qpp_exempt_flag;
568 --
569 -- ----------------------------------------------------------------------------
570 -- |------< chk_basic_exemption_flag >------|
571 -- ----------------------------------------------------------------------------
572 --
573 -- Description
574 -- This procedure is used to check that the lookup value is valid.
575 --
576 -- Pre Conditions
577 -- None.
578 --
579 -- In Parameters
580 -- emp_fed_tax_inf_id PK of record being inserted or updated.
581 -- basic_exemption_flag Value of lookup code.
582 -- effective_date effective date
583 -- object_version_number Object version number of record being
584 -- inserted or updated.
585 --
586 -- Post Success
587 -- Processing continues
588 --
589 -- Post Failure
590 -- Error handled by procedure
591 --
592 -- Access Status
593 -- Internal table handler use only.
594 --
595 Procedure chk_basic_exemption_flag(p_emp_fed_tax_inf_id in number,
596 p_basic_exemption_flag in varchar2,
597 p_tax_credit_amount in number,
598 p_effective_date in date,
599 p_object_version_number in number) is
600 --
601 l_proc varchar2(72) := g_package||'chk_basic_exemption_flag';
602 l_api_updating boolean;
603 --
604 Begin
605 --
606 hr_utility.set_location('Entering:'||l_proc, 5);
607 --
608 l_api_updating := pay_cft_shd.api_updating
609 (p_emp_fed_tax_inf_id => p_emp_fed_tax_inf_id,
610 p_effective_date => p_effective_date,
611 p_object_version_number => p_object_version_number);
612 --
613 if (l_api_updating
614 and p_basic_exemption_flag
615 <> nvl(pay_cft_shd.g_old_rec.basic_exemption_flag,hr_api.g_varchar2)
616 or not l_api_updating)
617 and p_basic_exemption_flag is not null then
618 --
619 -- check if value of lookup falls within lookup type.
620 --
621 if hr_api.not_exists_in_hr_lookups
622 (p_lookup_type => 'YES_NO',
623 p_lookup_code => p_basic_exemption_flag,
624 p_effective_date => p_effective_date) then
625 --
626 -- raise error as does not exist as lookup
627 --
628 hr_utility.set_message(800,'HR_BASIC_EXEMPT_IS_WRONG');
629 hr_utility.raise_error;
630 --
631 end if;
632 --
633 end if;
634 --
635 if nvl(p_basic_exemption_flag,'N') = 'N'
636 and p_tax_credit_amount is null
637 then
638 hr_utility.set_message(800,'HR_74008_BOTH_NULL');
639 hr_utility.raise_error;
640 --
641 end if;
642
643 if nvl(p_basic_exemption_flag,'N') = 'Y'
644 and p_tax_credit_amount is not null
645 then
646 hr_utility.set_message(800,'HR_74007_BOTH_NOT_NULL');
647 hr_utility.raise_error;
648 --
649 end if;
650 hr_utility.set_location('Leaving:'||l_proc,10);
651 --
652 end chk_basic_exemption_flag;
653 --
654 -- ----------------------------------------------------------------------------
655 -- |------< chk_tax_calc_method >------|
656 -- ----------------------------------------------------------------------------
657 --
658 -- Description
659 -- This procedure is used to check that the lookup value is valid.
660 --
661 -- Pre Conditions
662 -- None.
663 --
664 -- In Parameters
665 -- emp_fed_tax_inf_id PK of record being inserted or updated.
666 -- tax_calc_method Value of lookup code.
667 -- effective_date effective date
668 -- object_version_number Object version number of record being
669 -- inserted or updated.
670 --
671 -- Post Success
672 -- Processing continues
673 --
674 -- Post Failure
675 -- Error handled by procedure
676 --
677 -- Access Status
678 -- Internal table handler use only.
679 --
680 Procedure chk_tax_calc_method(p_emp_fed_tax_inf_id in number,
681 p_tax_calc_method in varchar2,
682 p_effective_date in date,
683 p_object_version_number in number) is
684 --
685 l_proc varchar2(72) := g_package||'chk_tax_calc_method';
686 l_api_updating boolean;
687 --
688 Begin
689 --
690 hr_utility.set_location('Entering:'||l_proc, 5);
691 --
692 l_api_updating := pay_cft_shd.api_updating
696 --
693 (p_emp_fed_tax_inf_id => p_emp_fed_tax_inf_id,
694 p_effective_date => p_effective_date,
695 p_object_version_number => p_object_version_number);
697 if (l_api_updating
698 and p_tax_calc_method
699 <> nvl(pay_cft_shd.g_old_rec.tax_calc_method,hr_api.g_varchar2)
700 or not l_api_updating)
701 and p_tax_calc_method is not null then
702 --
703 -- check if value of lookup falls within lookup type.
704 --
705 if hr_api.not_exists_in_hr_lookups
706 (p_lookup_type => 'CA_TAX_CALC_METHOD',
707 p_lookup_code => p_tax_calc_method,
708 p_effective_date => p_effective_date) then
709 --
710 -- raise error as does not exist as lookup
711 --
712 hr_utility.set_message(800,'HR_CA_TAX_CALC_METHOD');
713 hr_utility.raise_error;
714 --
715 end if;
716 --
717 end if;
718 --
719 hr_utility.set_location('Leaving:'||l_proc,10);
720 --
721 end chk_tax_calc_method;
722
723 --
724 --For Bug Number 13258136
725 -- ----------------------------------------------------------------------------
726 -- |------< chk_cpp_election_date>------|
727 -- ----------------------------------------------------------------------------
728 --
729 -- Description
730 -- This procedure is used to check that the cpp election date is valid.
731 --
732 -- Pre Conditions
733 -- None.
734 --
735 -- In Parameters
736 -- p_emp_fed_tax_inf_id PK of record being inserted or updated.
737 -- p_cpp_election_date
738 -- p_cpp_revocation_date
739 -- p_cpp_qpp_exempt_flag Added for bug 13542083
740 -- p_effective_date
741 -- p_object_version_number Object version number of record being
742 -- inserted or updated.
743 --
744 -- Out Parameters
745 -- p_cpp_election_warning
746 --
747 -- Post Success
748 -- Processing continues
749 --
750 -- Post Failure
751 -- Error handled by procedure
752 --
753 -- Access Status
754 -- Internal table handler use only.
755 --
756 Procedure chk_cpp_election_date(p_emp_fed_tax_inf_id in number,
757 p_cpp_election_date in date,
758 p_cpp_revocation_date in date,
759 p_cpp_qpp_exempt_flag in varchar2, --Added for bug 13542083
760 p_effective_date in date,
761 p_cpp_election_warning out nocopy boolean,
762 p_object_version_number in number) is
763 --
764 l_proc varchar2(72) := g_package||'chk_cpp_election_date';
765 l_api_updating boolean;
766 --
767 Begin
768 --
769 hr_utility.set_location('Entering:'||l_proc, 5);
770 p_cpp_election_warning:=FALSE;
771 --
772 l_api_updating := pay_cft_shd.api_updating
773 (p_emp_fed_tax_inf_id => p_emp_fed_tax_inf_id,
774 p_effective_date => p_effective_date,
775 p_object_version_number => p_object_version_number);
776 --
777 if ((l_api_updating and nvl(pay_cft_shd.g_old_rec.cpp_election_date,
778 hr_api.g_date)
779 <> nvl(p_cpp_election_date,hr_api.g_date))
780 or (not l_api_updating))
781 then
782 hr_utility.set_location(l_proc, 2);
783
784 /* Checking if revocation date is already entered*/
785 if (p_cpp_revocation_date is not null
786 and p_cpp_election_date is not null) then
787 -- Error: The CPP Election and Revocation Dates both have been entered
788 hr_utility.set_message(801, 'PAY_74164_CPP_DATES_EXCLUSIVE');
789 hr_utility.raise_error;
790 end if;
791
792 /* Checking if election date is the first of the month*/
793 if(p_cpp_election_date is not null) then
794 if (p_cpp_election_date <> to_date('01'||to_char(p_cpp_election_date, 'mm-yyyy'), 'dd-mm-yyyy')) then
795 p_cpp_election_warning:=TRUE;
796 end if;
797 end if;
798
799 /*Changes for bug 13542083 - Start*/
800
801 /* Checking if CPP Exempt Flag is checked*/
802 if (p_cpp_qpp_exempt_flag ='Y' and p_cpp_election_date is not null) then
803 -- Error: The CPP Election Date cannot be entered while CPP Exempt flag is checked.
804 hr_utility.set_message(801, 'PAY_74179_CPP_FLAG_CHECKED');
805 hr_utility.raise_error;
806 end if;
807
808 /*Changes for bug 13542083 - End*/
809
810 end if;
811
812 --
813 hr_utility.set_location('Leaving:'||l_proc,10);
814 --
815 end chk_cpp_election_date;
816 --For Bug Number 13258136
817 -- ----------------------------------------------------------------------------
818 -- |------< chk_cpp_revocation_date>------|
819 -- ----------------------------------------------------------------------------
820 --
821 -- Description
822 -- This procedure is used to check that the cpp revocation date is valid.
823 --
824 -- Pre Conditions
825 -- None.
826 --
827 -- In Parameters
828 -- p_emp_fed_tax_inf_id PK of record being inserted or updated.
829 -- p_cpp_election_date
830 -- p_cpp_revocation_date
831 -- p_cpp_qpp_exempt_flag Added for bug 13542083
832 -- p_effective_date
833 -- p_object_version_number Object version number of record being
834 -- inserted or updated.
835 --
836 -- Out Parameters
837 -- p_cpp_revocation_warning
841 --
838 --
839 -- Post Success
840 -- Processing continues
842 -- Post Failure
843 -- Error handled by procedure
844 --
845 -- Access Status
846 -- Internal table handler use only.
847 --
848 Procedure chk_cpp_revocation_date(p_emp_fed_tax_inf_id in number,
849 p_cpp_election_date in date,
850 p_cpp_revocation_date in date,
851 p_cpp_qpp_exempt_flag in varchar2, --Added for bug 13542083
852 p_effective_date in date,
853 p_cpp_revocation_warning out nocopy boolean,
854 p_object_version_number in number) is
855 --
856 l_proc varchar2(72) := g_package||'chk_cpp_revocation_date';
857 l_api_updating boolean;
858 --
859 --
860 Begin
861 --
862
863 hr_utility.set_location('Entering:'||l_proc, 5);
864 p_cpp_revocation_warning:=FALSE;
865 --
866 l_api_updating := pay_cft_shd.api_updating
867 (p_emp_fed_tax_inf_id => p_emp_fed_tax_inf_id,
868 p_effective_date => p_effective_date,
869 p_object_version_number => p_object_version_number);
870 --
871 --
872 if ((l_api_updating and nvl(pay_cft_shd.g_old_rec.cpp_revocation_date,
873 hr_api.g_date)
874 <> nvl(p_cpp_revocation_date,hr_api.g_date))
875 or (not l_api_updating)) then
876
877 hr_utility.set_location(l_proc, 2);
878
879 /* Checking if election date is already entered*/
880 if (p_cpp_election_date is not null
881 and p_cpp_revocation_date is not null) then
882 -- Error: The CPP Election and Revocation Dates both have been entered
883 hr_utility.set_message(801, 'PAY_74164_CPP_DATES_EXCLUSIVE');
884 hr_utility.raise_error;
885 end if;
886
887 /* Checking if revocation date is the first of the month*/
888 if(p_cpp_revocation_date is not null) then
889 if (p_cpp_revocation_date <> to_date('01'||to_char(p_cpp_revocation_date, 'mm-yyyy'), 'dd-mm-yyyy')) then
890 p_cpp_revocation_warning:=TRUE;
891 end if;
892 end if;
893
894 /*Changes for bug 13542083 - Start*/
895 /* Checking if CPP Exempt Flag is checked*/
896 if (p_cpp_qpp_exempt_flag ='Y' and p_cpp_revocation_date is not null) then
897 -- Error: The CPP Revocation Date cannot be entered while CPP Exempt flag is checked.
898 hr_utility.set_message(801, 'PAY_74179_CPP_FLAG_CHECKED');
899 hr_utility.raise_error;
900 end if;
901 /*Changes for bug 13542083 - End*/
902
903 --
904
905 hr_utility.set_location('Leaving:'||l_proc,10);
906 --
907 end if;
908
909
910 end chk_cpp_revocation_date;
911
912 -- ----------------------------------------------------------------------------
913 -- |--------------------------< dt_update_validate >--------------------------|
914 -- ----------------------------------------------------------------------------
915 -- {Start Of Comments}
916 --
917 -- Description:
918 -- This procedure is used for referential integrity of datetracked
919 -- parent entities when a datetrack update operation is taking place
920 -- and where there is no cascading of update defined for this entity.
921 --
922 -- Prerequisites:
923 -- This procedure is called from the update_validate.
924 --
925 -- In Parameters:
926 --
927 -- Post Success:
928 -- Processing continues.
929 --
930 -- Post Failure:
931 --
932 -- Developer Implementation Notes:
933 -- This procedure should not need maintenance unless the HR Schema model
934 -- changes.
935 --
936 -- Access Status:
937 -- Internal Row Handler Use Only.
938 --
939 -- {End Of Comments}
940 -- ----------------------------------------------------------------------------
941 Procedure dt_update_validate
942 (p_assignment_id in number default hr_api.g_number,
943 p_datetrack_mode in varchar2,
944 p_validation_start_date in date,
945 p_validation_end_date in date) Is
946 --
947 l_proc varchar2(72) := g_package||'dt_update_validate';
948 l_integrity_error Exception;
949 l_table_name all_tables.table_name%TYPE;
950 --
951 Begin
952 hr_utility.set_location('Entering:'||l_proc, 5);
953 --
954 -- Ensure that the p_datetrack_mode argument is not null
955 --
956 hr_api.mandatory_arg_error
957 (p_api_name => l_proc,
958 p_argument => 'datetrack_mode',
959 p_argument_value => p_datetrack_mode);
960 --
961 -- Only perform the validation if the datetrack update mode is valid
962 --
963 If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
964 --
965 --
966 -- Ensure the arguments are not null
967 --
968 hr_api.mandatory_arg_error
969 (p_api_name => l_proc,
970 p_argument => 'validation_start_date',
971 p_argument_value => p_validation_start_date);
972 --
973 hr_api.mandatory_arg_error
974 (p_api_name => l_proc,
975 p_argument => 'validation_end_date',
976 p_argument_value => p_validation_end_date);
977 --
978 If ((nvl(p_assignment_id, hr_api.g_number) <> hr_api.g_number) and
979 NOT (dt_api.check_min_max_dates
980 (p_base_table_name => 'per_all_assignments_f',
984 p_to_date => p_validation_end_date))) Then
981 p_base_key_column => 'assignment_id',
982 p_base_key_value => p_assignment_id,
983 p_from_date => p_validation_start_date,
985 l_table_name := 'all assignments';
986 Raise l_integrity_error;
987 End If;
988 --
989 End If;
990 --
991 hr_utility.set_location(' Leaving:'||l_proc, 10);
992 Exception
993 When l_integrity_error Then
994 --
995 -- A referential integrity check was violated therefore
996 -- we must error
997 --
998 hr_utility.set_message(800, 'HR_7216_DT_UPD_INTEGRITY_ERR');
999 hr_utility.set_message_token('TABLE_NAME', l_table_name);
1000 hr_utility.raise_error;
1001 When Others Then
1002 --
1003 -- An unhandled or unexpected error has occurred which
1004 -- we must report
1005 --
1006 hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
1007 hr_utility.set_message_token('PROCEDURE', l_proc);
1008 hr_utility.set_message_token('STEP','15');
1009 hr_utility.raise_error;
1010 End dt_update_validate;
1011 --
1012 -- ----------------------------------------------------------------------------
1013 -- |--------------------------< dt_delete_validate >--------------------------|
1014 -- ----------------------------------------------------------------------------
1015 -- {Start Of Comments}
1016 --
1017 -- Description:
1018 -- This procedure is used for referential integrity of datetracked
1019 -- child entities when either a datetrack DELETE or ZAP is in operation
1020 -- and where there is no cascading of delete defined for this entity.
1021 -- For the datetrack mode of DELETE or ZAP we must ensure that no
1022 -- datetracked child rows exist between the validation start and end
1023 -- dates.
1024 --
1025 -- Prerequisites:
1026 -- This procedure is called from the delete_validate.
1027 --
1028 -- In Parameters:
1029 --
1030 -- Post Success:
1031 -- Processing continues.
1032 --
1033 -- Post Failure:
1034 -- If a row exists by determining the returning Boolean value from the
1035 -- generic dt_api.rows_exist function then we must supply an error via
1036 -- the use of the local exception handler l_rows_exist.
1037 --
1038 -- Developer Implementation Notes:
1039 -- This procedure should not need maintenance unless the HR Schema model
1040 -- changes.
1041 --
1042 -- Access Status:
1043 -- Internal Row Handler Use Only.
1044 --
1045 -- {End Of Comments}
1046 -- ----------------------------------------------------------------------------
1047 Procedure dt_delete_validate
1048 (p_emp_fed_tax_inf_id in number,
1049 p_datetrack_mode in varchar2,
1050 p_validation_start_date in date,
1051 p_validation_end_date in date) Is
1052 --
1053 l_proc varchar2(72) := g_package||'dt_delete_validate';
1054 l_rows_exist Exception;
1055 l_table_name all_tables.table_name%TYPE;
1056 --
1057 Begin
1058 hr_utility.set_location('Entering:'||l_proc, 5);
1059 --
1060 -- Ensure that the p_datetrack_mode argument is not null
1061 --
1062 hr_api.mandatory_arg_error
1063 (p_api_name => l_proc,
1064 p_argument => 'datetrack_mode',
1065 p_argument_value => p_datetrack_mode);
1066 --
1067 -- Only perform the validation if the datetrack mode is either
1068 -- DELETE or ZAP
1069 --
1070 If (p_datetrack_mode = 'DELETE' or
1071 p_datetrack_mode = 'ZAP') then
1072 --
1073 --
1074 -- Ensure the arguments are not null
1075 --
1076 hr_api.mandatory_arg_error
1077 (p_api_name => l_proc,
1078 p_argument => 'validation_start_date',
1079 p_argument_value => p_validation_start_date);
1080 --
1081 hr_api.mandatory_arg_error
1082 (p_api_name => l_proc,
1083 p_argument => 'validation_end_date',
1084 p_argument_value => p_validation_end_date);
1085 --
1086 hr_api.mandatory_arg_error
1087 (p_api_name => l_proc,
1088 p_argument => 'emp_fed_tax_inf_id',
1089 p_argument_value => p_emp_fed_tax_inf_id);
1090 --
1091 --
1092 --
1093 End If;
1094 --
1095 hr_utility.set_location(' Leaving:'||l_proc, 10);
1096 Exception
1097 When l_rows_exist Then
1098 --
1099 -- A referential integrity check was violated therefore
1100 -- we must error
1101 --
1102 hr_utility.set_message(800, 'HR_7215_DT_CHILD_EXISTS');
1103 hr_utility.set_message_token('TABLE_NAME', l_table_name);
1104 hr_utility.raise_error;
1105 When Others Then
1106 --
1107 -- An unhandled or unexpected error has occurred which
1108 -- we must report
1109 --
1110 hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
1111 hr_utility.set_message_token('PROCEDURE', l_proc);
1112 hr_utility.set_message_token('STEP','15');
1113 hr_utility.raise_error;
1114 End dt_delete_validate;
1115 --
1116 -- ----------------------------------------------------------------------------
1117 -- |---------------------------< insert_validate >----------------------------|
1118 -- ----------------------------------------------------------------------------
1119 Procedure insert_validate
1120 (p_rec in pay_cft_shd.g_rec_type,
1121 p_effective_date in date,
1122 p_datetrack_mode in varchar2,
1123 p_validation_start_date in date,
1124 p_validation_end_date in date) is
1125 --
1126 l_proc varchar2(72) := g_package||'insert_validate';
1127 --
1128 Begin
1132 --
1129 hr_utility.set_location('Entering:'||l_proc, 5);
1130 --
1131 -- Call all supporting business operations
1133 --dbms_output.put_line('before fed_tax_inf_id ');
1134 chk_emp_fed_tax_inf_id
1135 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1136 p_effective_date => p_effective_date,
1137 p_object_version_number => p_rec.object_version_number);
1138 --
1139 --dbms_output.put_line('before legislation ');
1140 chk_legislation_code
1141 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1142 p_legislation_code => p_rec.legislation_code,
1143 p_effective_date => p_effective_date,
1144 p_object_version_number => p_rec.object_version_number);
1145
1146 --dbms_output.put_line('before assignment_id ');
1147 chk_assignment_id
1148 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id
1149 ,p_assignment_id => p_rec.assignment_id
1150 ,p_business_group_id => p_rec.business_group_id
1151 ,p_effective_date => p_effective_date
1152 ,p_object_version_number => p_rec.object_version_number
1153 );
1154 --dbms_output.put_line('after assignment_id ');
1155 --
1156 --dbms_output.put_line('before employment_prvince ');
1157 chk_employment_province
1158 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id
1159 ,p_employment_province => p_rec.employment_province
1160 ,p_effective_date => p_effective_date
1161 ,p_object_version_number => p_rec.object_version_number
1162 );
1163 --
1164 --dbms_output.put_line('before ei_exempt_flag ');
1165 chk_ei_exempt_flag
1166 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1167 p_ei_exempt_flag => p_rec.ei_exempt_flag,
1168 p_effective_date => p_effective_date,
1169 p_object_version_number => p_rec.object_version_number);
1170 --
1171 --dbms_output.put_line('before fed_exempt ');
1172 chk_fed_exempt_flag
1173 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1174 p_fed_exempt_flag => p_rec.fed_exempt_flag,
1175 p_effective_date => p_effective_date,
1176 p_object_version_number => p_rec.object_version_number);
1177 --
1178 --dbms_output.put_line('before cpp_qpp_exempt ');
1179 chk_cpp_qpp_exempt_flag
1180 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1181 p_cpp_qpp_exempt_flag => p_rec.cpp_qpp_exempt_flag,
1182 p_cpp_election_date => p_rec.cpp_election_date , --Added for bug 13542083
1183 p_cpp_revocation_date => p_rec.cpp_revocation_date , --Added for bug 13542083
1184 p_effective_date => p_effective_date,
1185 p_object_version_number => p_rec.object_version_number);
1186 --
1187 --dbms_output.put_line('before tax_calc_method ');
1188 chk_tax_calc_method
1189 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1190 p_tax_calc_method => p_rec.tax_calc_method,
1191 p_effective_date => p_effective_date,
1192 p_object_version_number => p_rec.object_version_number);
1193 --
1194 --dbms_output.put_line('before basic_exemption ');
1195 chk_basic_exemption_flag
1196 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1197 p_basic_exemption_flag => p_rec.basic_exemption_flag,
1198 p_tax_credit_amount => p_rec.tax_credit_amount,
1199 p_effective_date => p_effective_date,
1200 p_object_version_number => p_rec.object_version_number);
1201 --
1202 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
1203 --
1204 hr_utility.set_location(' Leaving:'||l_proc, 10);
1205 End insert_validate;
1206 --
1207 -- ----------------------------------------------------------------------------
1208 -- |---------------------------< update_validate >----------------------------|
1209 -- ----------------------------------------------------------------------------
1210 Procedure update_validate
1211 (p_rec in pay_cft_shd.g_rec_type,
1212 p_effective_date in date,
1213 p_datetrack_mode in varchar2,
1214 p_validation_start_date in date,
1215 p_validation_end_date in date) is
1216 --
1217 l_proc varchar2(72) := g_package||'update_validate';
1218 l_cpp_election_warning boolean; --For Bug Number 13258136
1219 l_cpp_revocation_warning boolean; --For Bug Number 13258136
1220 --
1221 Begin
1222 hr_utility.set_location('Entering:'||l_proc, 5);
1223 --
1224 -- Call all supporting business operations
1225 --
1226 chk_emp_fed_tax_inf_id
1227 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1228 p_effective_date => p_effective_date,
1229 p_object_version_number => p_rec.object_version_number);
1230 --
1231 chk_legislation_code
1232 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1233 p_legislation_code => p_rec.legislation_code,
1234 p_effective_date => p_effective_date,
1235 p_object_version_number => p_rec.object_version_number);
1236 --
1237 chk_assignment_id
1238 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id
1239 ,p_assignment_id => p_rec.assignment_id
1240 ,p_business_group_id => p_rec.business_group_id
1241 ,p_effective_date => p_effective_date
1242 ,p_object_version_number => p_rec.object_version_number
1243 );
1244 --
1245 chk_employment_province
1246 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id
1247 ,p_employment_province => p_rec.employment_province
1248 ,p_effective_date => p_effective_date
1249 ,p_object_version_number => p_rec.object_version_number
1250 );
1251 --
1252 chk_ei_exempt_flag
1253 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1254 p_ei_exempt_flag => p_rec.ei_exempt_flag,
1258 chk_fed_exempt_flag
1255 p_effective_date => p_effective_date,
1256 p_object_version_number => p_rec.object_version_number);
1257 --
1259 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1260 p_fed_exempt_flag => p_rec.fed_exempt_flag,
1261 p_effective_date => p_effective_date,
1262 p_object_version_number => p_rec.object_version_number);
1263 --
1264 chk_cpp_qpp_exempt_flag
1265 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1266 p_cpp_qpp_exempt_flag => p_rec.cpp_qpp_exempt_flag,
1267 p_cpp_election_date => p_rec.cpp_election_date , --Added for bug 13542083
1268 p_cpp_revocation_date => p_rec.cpp_revocation_date , --Added for bug 13542083
1269 p_effective_date => p_effective_date,
1270 p_object_version_number => p_rec.object_version_number);
1271 --
1272 chk_tax_calc_method
1273 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1274 p_tax_calc_method => p_rec.tax_calc_method,
1275 p_effective_date => p_effective_date,
1276 p_object_version_number => p_rec.object_version_number);
1277 --
1278 chk_basic_exemption_flag
1279 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1280 p_basic_exemption_flag => p_rec.basic_exemption_flag,
1281 p_tax_credit_amount => p_rec.tax_credit_amount,
1282 p_effective_date => p_effective_date,
1283 p_object_version_number => p_rec.object_version_number);
1284 --For Bug Number 13258136
1285 chk_cpp_election_date
1286 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1287 p_cpp_election_date => p_rec.cpp_election_date,
1288 p_cpp_revocation_date => p_rec.cpp_revocation_date,
1289 p_cpp_qpp_exempt_flag => p_rec.cpp_qpp_exempt_flag, --Added for bug 13542083
1290 p_effective_date => p_effective_date,
1291 p_cpp_election_warning => l_cpp_election_warning,
1292 p_object_version_number => p_rec.object_version_number);
1293 --For Bug Number 13258136
1294 chk_cpp_revocation_date
1295 (p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id,
1296 p_cpp_election_date => p_rec.cpp_election_date,
1297 p_cpp_revocation_date => p_rec.cpp_revocation_date,
1298 p_cpp_qpp_exempt_flag => p_rec.cpp_qpp_exempt_flag, --Added for bug 13542083
1299 p_effective_date => p_effective_date,
1300 p_cpp_revocation_warning=> l_cpp_revocation_warning,
1301 p_object_version_number => p_rec.object_version_number);
1302 --
1303 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
1304 --
1305 -- Call the datetrack update integrity operation
1306 --
1307 dt_update_validate
1308 (p_assignment_id => p_rec.assignment_id,
1309 p_datetrack_mode => p_datetrack_mode,
1310 p_validation_start_date => p_validation_start_date,
1311 p_validation_end_date => p_validation_end_date);
1312 --
1313 hr_utility.set_location(' Leaving:'||l_proc, 10);
1314 End update_validate;
1315 --
1316 -- ----------------------------------------------------------------------------
1317 -- |---------------------------< delete_validate >----------------------------|
1318 -- ----------------------------------------------------------------------------
1319 Procedure delete_validate
1320 (p_rec in pay_cft_shd.g_rec_type,
1321 p_effective_date in date,
1322 p_datetrack_mode in varchar2,
1323 p_validation_start_date in date,
1324 p_validation_end_date in date) is
1325 --
1326 l_proc varchar2(72) := g_package||'delete_validate';
1327 --
1328 Begin
1329 hr_utility.set_location('Entering:'||l_proc, 5);
1330 --
1331 -- Call all supporting business operations
1332 --
1333 dt_delete_validate
1334 (p_datetrack_mode => p_datetrack_mode,
1335 p_validation_start_date => p_validation_start_date,
1336 p_validation_end_date => p_validation_end_date,
1337 p_emp_fed_tax_inf_id => p_rec.emp_fed_tax_inf_id);
1338 --
1339 hr_utility.set_location(' Leaving:'||l_proc, 10);
1340 End delete_validate;
1341 --
1342 --
1343 -- ---------------------------------------------------------------------------
1344 -- |---------------------< return_legislation_code >-------------------------|
1345 -- ---------------------------------------------------------------------------
1346 --
1347 function return_legislation_code
1348 (p_emp_fed_tax_inf_id in number) return varchar2 is
1349 --
1350 -- Declare cursor
1351 --
1352 cursor csr_leg_code is
1353 select a.legislation_code
1354 from per_business_groups a,
1355 pay_ca_emp_fed_tax_info_f b
1356 where b.emp_fed_tax_inf_id = p_emp_fed_tax_inf_id
1357 and a.business_group_id = b.business_group_id;
1358 --
1359 -- Declare local variables
1360 --
1361 l_legislation_code varchar2(150);
1362 l_proc varchar2(72) := g_package||'return_legislation_code';
1363 --
1364 begin
1365 --
1366 hr_utility.set_location('Entering:'|| l_proc, 10);
1367 --
1368 -- Ensure that all the mandatory parameter are not null
1369 --
1370 hr_api.mandatory_arg_error(p_api_name => l_proc,
1371 p_argument => 'emp_fed_tax_inf_id',
1372 p_argument_value => p_emp_fed_tax_inf_id);
1373 --
1374 open csr_leg_code;
1375 --
1376 fetch csr_leg_code into l_legislation_code;
1377 --
1378 if csr_leg_code%notfound then
1379 --
1380 close csr_leg_code;
1381 --
1382 -- The primary key is invalid therefore we must error
1383 --
1387 end if;
1384 hr_utility.set_message(800,'HR_7220_INVALID_PRIMARY_KEY');
1385 hr_utility.raise_error;
1386 --
1388 --
1389 close csr_leg_code;
1390 --
1391 hr_utility.set_location(' Leaving:'|| l_proc, 20);
1392 --
1393 return l_legislation_code;
1394 --
1395 end return_legislation_code;
1396 --
1397 end pay_cft_bus;