[Home] [Help]
PACKAGE BODY: APPS.PAY_FED_BUS
Source
1 Package Body pay_fed_bus as
2 /* $Header: pyfedrhi.pkb 120.1.12000000.4 2007/07/26 11:08:20 vaprakas noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_fed_bus.'; -- Global package name
9 --
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------< chk_sui_state_code >------|
13 -- ----------------------------------------------------------------------------
14 --
15 -- Description
16 -- This procedure checks that a referenced foreign key actually exists
17 -- in the referenced table.
18 --
19 -- Pre-Conditions
20 -- None.
21 --
22 -- In Parameters
23 -- p_emp_fed_tax_rule_id PK
24 -- p_sui_state_code ID of FK column
25 --
26 -- Post Success
27 -- Processing continues
28 --
29 -- Post Failure
30 -- Error raised.
31 --
32 -- Access Status
33 -- Internal table handler use only.
34 --
35 Procedure chk_sui_state_code
36 (p_emp_fed_tax_rule_id in number
37 ,p_sui_state_code in pay_us_emp_fed_tax_rules_f.sui_state_code%TYPE
38 ) is
39 --
40 l_proc varchar2(72) := g_package||'chk_sui_state_code';
41 l_dummy varchar2(1);
42 --
43 cursor csr_state_code is
44 select null
45 from pay_us_states pus
46 where pus.state_code = p_sui_state_code;
47 --
48 Begin
49 --
50 hr_utility.set_location('Entering:'||l_proc,5);
51 --
52 -- If the value is being inserted or updated...
53 --
54 if (p_emp_fed_tax_rule_id is not null
55 and nvl(p_sui_state_code,hr_api.g_varchar2)
56 <> pay_fed_shd.g_old_rec.sui_state_code)
57 or (p_emp_fed_tax_rule_id is null) then
58 --
59 -- Check that the mandatory parameters have been set
60 --
61 if p_sui_state_code is null then
62 hr_utility.set_message(801, 'PAY_72797_FED_SUI_STA_NOT_NULL');
63 hr_utility.raise_error;
64 end if;
65 --
66 -- check if sui_state_code value exists in pay_us_states table
67 --
68 open csr_state_code;
69 --
70 fetch csr_state_code into l_dummy;
71 if csr_state_code%notfound then
72 --
73 close csr_state_code;
74 --
75 -- raise error as FK does not relate to PK in pay_us_states table.
76 --
77 pay_fed_shd.constraint_error('PAY_US_EMP_FED_TAX_RULES_FK1');
78 --
79 end if;
80 --
81 close csr_state_code;
82 --
83 end if;
84 --
85 hr_utility.set_location('Leaving:'||l_proc,10);
86 --
87 End chk_sui_state_code;
88 --
89 -- ----------------------------------------------------------------------------
90 -- |------< chk_assignment_id >------|
91 -- ----------------------------------------------------------------------------
92 --
93 -- Description
94 -- This procedure validates the assignment_id with the following checks:
95 -- - the assignment_id exists in PER_ASSIGNMENTS_F
96 -- - the assignment's business group must match the tax record's bus grp.
97 -- The tax record's business_group_id is also validated by checking that it
98 -- matches an existing business_group_id in PER_ASSIGNMENTS_F.
99 --
100 -- Pre-Conditions
101 -- None.
102 --
103 -- In Parameters
104 -- p_emp_fed_tax_rule_id PK
105 -- p_assignment_id ID of FK column
106 -- p_business_group_id business group id
107 -- p_object_version_number object version number
108 -- p_effective_date session date
109 --
110 -- Post Success
111 -- Processing continues
112 --
113 -- Post Failure
114 -- Error raised.
115 --
116 -- Access Status
117 -- Internal table handler use only.
118 --
119 Procedure chk_assignment_id
120 (p_emp_fed_tax_rule_id in number
121 ,p_assignment_id in pay_us_emp_fed_tax_rules_f.assignment_id%TYPE
122 ,p_business_group_id in
123 pay_us_emp_fed_tax_rules_f.business_group_id%TYPE
124 ,p_object_version_number in number
125 ,p_effective_date in date
126 ) is
127 --
128 l_proc varchar2(72) := g_package||'chk_assignment_id';
129 l_dummy varchar2(1);
130 l_api_updating boolean;
131 l_business_group_id per_assignments_f.business_group_id%TYPE;
132 --
133 cursor csr_bg_id is
134 select business_group_id
135 from per_assignments_f asg
136 where asg.assignment_id = p_assignment_id
137 and p_effective_date between asg.effective_start_date
138 and asg.effective_end_date;
139 --
140 Begin
141 --
142 hr_utility.set_location('Entering:'||l_proc,5);
143 --
144 -- Check that the mandatory parameters have been set
145 --
146 if p_assignment_id is null then
147 hr_utility.set_message(801, 'PAY_72780_FED_ASG_NOT_NULL');
148 hr_utility.raise_error;
149 end if;
150 --
151 if p_business_group_id is null then
152 hr_utility.set_message(801, 'PAY_72782_FED_BG_NOT_NULL');
153 hr_utility.raise_error;
154 end if;
155 --
156 hr_api.mandatory_arg_error
157 (p_api_name => l_proc
158 ,p_argument => 'effective_date'
159 ,p_argument_value => p_effective_date
160 );
161 --
162 l_api_updating := pay_fed_shd.api_updating
163 (p_emp_fed_tax_rule_id => p_emp_fed_tax_rule_id,
164 p_effective_date => p_effective_date,
165 p_object_version_number => p_object_version_number);
166 --
167 -- Since assignment_id cannot be updated, the case of
168 -- l_api_updating = TRUE is not considered
169 --
170 if (not l_api_updating) then
171 --
172 open csr_bg_id;
173 --
174 fetch csr_bg_id into l_business_group_id;
175 if csr_bg_id%notfound then
176 --
177 close csr_bg_id;
178 --
179 -- raise error as assignment_id not found in per_assignments_f
180 -- table.
181 --
182 hr_utility.set_message(801, 'HR_51746_ASG_INV_ASG_ID');
183 hr_utility.raise_error;
184 --
185 else
186 --
187 if p_business_group_id <> l_business_group_id then
188 --
189 close csr_bg_id;
190 --
191 hr_utility.set_message(801, 'PAY_72781_FED_BG_MATCH_ASG');
192 hr_utility.raise_error;
193 --
194 end if;
195 --
196 close csr_bg_id;
197 --
198 end if;
199 --
200 end if;
201 --
202 hr_utility.set_location('Leaving:'||l_proc,10);
203 --
204 End chk_assignment_id;
205 --
206 -- ----------------------------------------------------------------------------
207 -- |------< chk_sui_jurisdiction_code >------|
208 -- ----------------------------------------------------------------------------
209 --
210 -- Description
211 -- This procedure validates the sui_jurisdiction_code against PAY_STATE_RULES
212 -- where the state is the same as the sui_state_code
213 --
214 -- Pre-Conditions
215 -- Valid sui_state_code
216 --
217 -- In Parameters
218 -- p_emp_fed_tax_rule_id PK
219 -- p_sui_jurisdiction_code
220 -- p_sui_state_code
221 --
222 -- Post Success
223 -- Processing continues
224 --
225 -- Post Failure
226 -- Error raised.
227 --
228 -- Access Status
229 -- Internal table handler use only.
230 --
231 Procedure chk_sui_jurisdiction_code
232 (p_emp_fed_tax_rule_id in number
233 ,p_sui_jurisdiction_code in
234 pay_us_emp_fed_tax_rules_f.sui_jurisdiction_code%TYPE
235 ,p_sui_state_code in pay_us_emp_fed_tax_rules_f.sui_state_code%TYPE
236 ) is
237 --
238 l_proc varchar2(72) := g_package||'chk_sui_jurisdiction_code';
239 l_dummy varchar2(1);
240 --
241 cursor csr_sui_jd is
242 select null
243 from pay_us_states pus, pay_state_rules psr
244 where pus.state_code = p_sui_state_code
245 and pus.state_abbrev = psr.state_code
246 and psr.jurisdiction_code = p_sui_jurisdiction_code;
247 --
248 Begin
249 --
250 hr_utility.set_location('Entering:'||l_proc,5);
251 --
252 -- Check that the mandatory parameters have been set
253 --
254 hr_api.mandatory_arg_error
255 (p_api_name => l_proc
256 ,p_argument => 'sui_state_code'
257 ,p_argument_value => p_sui_state_code
258 );
259 --
260 -- If the value is being inserted or updated...
261 --
262 if (p_emp_fed_tax_rule_id is not null
263 and nvl(p_sui_jurisdiction_code,hr_api.g_varchar2)
264 <> nvl(pay_fed_shd.g_old_rec.sui_jurisdiction_code,hr_api.g_varchar2)
265 or (p_emp_fed_tax_rule_id is null)) then
266 --
267 -- Check that the mandatory parameters have been set
268 --
269 if p_sui_jurisdiction_code is null then
270 hr_utility.set_message(801, 'PAY_72796_FED_SUI_JD_NOT_NULL');
271 hr_utility.raise_error;
272 end if;
273 --
274 -- check if sui_jurisdiction_code value exists in pay_state_rules table
275 --
276 open csr_sui_jd;
277 --
278 fetch csr_sui_jd into l_dummy;
279 if csr_sui_jd%notfound then
280 --
281 close csr_sui_jd;
282 --
283 -- raise error as code does not exist in pay_state_rules table.
284 --
285 hr_utility.set_message(801, 'PAY_8003_1099R_JU_CODE');
286 hr_utility.raise_error;
287 --
288 end if;
289 --
290 close csr_sui_jd;
291 --
292 end if;
293 --
294 hr_utility.set_location('Leaving:'||l_proc,10);
295 --
296 End chk_sui_jurisdiction_code;
297 --
298 -- ----------------------------------------------------------------------------
299 -- |------< chk_additional_wa_amount >------|
300 -- ----------------------------------------------------------------------------
301 --
302 -- Description
303 -- This procedure checks that additional_wa_amount >= 0
304 --
305 -- Pre-Conditions
306 -- None.
307 --
308 -- In Parameters
309 -- p_emp_fed_tax_rule_id PK
310 -- p_additional_wa_amount
311 --
312 -- Post Success
313 -- Processing continues
314 --
315 -- Post Failure
316 -- Error raised.
317 --
318 -- Access Status
319 -- Internal table handler use only.
320 --
321 Procedure chk_additional_wa_amount
322 (p_emp_fed_tax_rule_id in number
323 ,p_additional_wa_amount in
324 pay_us_emp_fed_tax_rules_f.additional_wa_amount%TYPE
325 ) is
326 --
327 l_proc varchar2(72) := g_package||'chk_additional_wa_amount';
328 --
329 Begin
330 --
331 hr_utility.set_location('Entering:'||l_proc,5);
332 --
333 -- If the value is being inserted or updated...
334 --
335 if (p_emp_fed_tax_rule_id is not null
336 and nvl(p_additional_wa_amount,hr_api.g_number) <>
337 pay_fed_shd.g_old_rec.additional_wa_amount)
338 or (p_emp_fed_tax_rule_id is null) then
339 --
340 -- Check that the mandatory parameters have been set
341 --
342 if p_additional_wa_amount is null then
343 hr_utility.set_message(801, 'PAY_72779_FED_ADDL_WA_NOT_NULL');
344 hr_utility.raise_error;
345 end if;
346 --
347 -- check if additional_wa_amount value is in a valid range
348 --
349 if p_additional_wa_amount < 0 then
350 --
351 -- raise error as given value is invalid
352 --
353 hr_utility.set_message(801,'PAY_72778_FED_ADDL_WA_POSITIVE');
354 hr_utility.raise_error;
355 --
356 end if;
357 --
358 end if;
359 --
360 hr_utility.set_location('Leaving:'||l_proc,10);
361 --
362 End chk_additional_wa_amount;
363 --
364 -- ----------------------------------------------------------------------------
365 -- |------< chk_filing_status_code >------|
366 -- ----------------------------------------------------------------------------
367 --
368 -- Description
369 -- This procedure validates the filing_status_code against hr_lookups.
370 --
371 -- Pre-Conditions
372 -- None.
373 --
374 -- In Parameters
375 -- p_emp_fed_tax_rule_id PK
376 -- p_filing_status_code
377 -- p_effective_date session date
378 -- p_validation_start_date
379 -- p_validation_end_date
380 --
381 -- Post Success
382 -- Processing continues
383 --
384 -- Post Failure
385 -- Error raised.
386 --
387 -- Access Status
388 -- Internal table handler use only.
389 --
390 Procedure chk_filing_status_code
391 (p_emp_fed_tax_rule_id in number
392 ,p_filing_status_code in
393 pay_us_emp_fed_tax_rules_f.filing_status_code%TYPE
394 ,p_effective_date in date
395 ,p_validation_start_date in date
396 ,p_validation_end_date in date
397 ) is
398 --
399 l_proc varchar2(72) := g_package||'chk_filing_status_code';
400 --
401 Begin
402 --
403 hr_utility.set_location('Entering:'||l_proc,5);
404 --
405 -- Check that the mandatory parameters have been set
406 --
407 hr_api.mandatory_arg_error
408 (p_api_name => l_proc
409 ,p_argument => 'effective_date'
410 ,p_argument_value => p_effective_date
411 );
412 --
413 -- If the value is being inserted or updated...
414 --
415 if (p_emp_fed_tax_rule_id is not null
416 and nvl(p_filing_status_code,hr_api.g_varchar2)
417 <> pay_fed_shd.g_old_rec.filing_status_code)
418 or (p_emp_fed_tax_rule_id is null) then
419 --
420 -- Check that the mandatory parameters have been set
421 --
422 if p_filing_status_code is null then
423 hr_utility.set_message(801, 'PAY_72786_FED_FIL_STAT_NOT_NUL');
424 hr_utility.raise_error;
425 end if;
429 if hr_api.not_exists_in_dt_hr_lookups
426 --
427 -- check if filing_status_code value exists in hr_lookups table
428 --
430 (p_effective_date => p_effective_date
431 ,p_validation_start_date => p_validation_start_date
432 ,p_validation_end_date => p_validation_end_date
433 ,p_lookup_type => 'US_FIT_FILING_STATUS'
434 ,p_lookup_code => p_filing_status_code
435 ) then
436 --
437 -- raise error as filing_status_code does not exist in hr_lookups
438 -- table.
439 --
440 hr_utility.set_message(801,'HR_52966_INVALID_LOOKUP');
441 hr_utility.set_message_token('COLUMN','federal filing_status_code');
442 hr_utility.set_message_token('LOOKUP_TYPE','US_FIT_FILING_STATUS');
443 hr_utility.raise_error;
444 --
445 end if;
446 --
447 end if;
448 --
449 hr_utility.set_location('Leaving:'||l_proc,10);
450 --
451 End chk_filing_status_code;
452 --
453 -- ----------------------------------------------------------------------------
454 -- |------< chk_fit_override_amount >------|
455 -- ----------------------------------------------------------------------------
456 --
457 -- Description
458 -- This procedure checks that fit_override_amount >= 0
459 --
460 -- Pre-Conditions
461 -- None.
462 --
463 -- In Parameters
464 -- p_emp_fed_tax_rule_id PK
465 -- p_fit_override_amount
466 --
467 -- Post Success
468 -- Processing continues
469 --
470 -- Post Failure
471 -- Error raised.
472 --
473 -- Access Status
474 -- Internal table handler use only.
475 --
476 Procedure chk_fit_override_amount
477 (p_emp_fed_tax_rule_id in number
478 ,p_fit_override_amount in
479 pay_us_emp_fed_tax_rules_f.fit_override_amount%TYPE
480 ) is
481 --
482 l_proc varchar2(72) := g_package||'chk_fit_override_amount';
483 --
484 Begin
485 --
486 hr_utility.set_location('Entering:'||l_proc,5);
487 --
488 -- If the value is being inserted or updated...
489 --
490 if (p_emp_fed_tax_rule_id is not null
491 and nvl(p_fit_override_amount,hr_api.g_number)
492 <> nvl(pay_fed_shd.g_old_rec.fit_override_amount,hr_api.g_number))
493 or (p_emp_fed_tax_rule_id is null) then
494 --
495 -- Check that the mandatory parameters have been set
496 --
497 if p_fit_override_amount is null then
498 hr_utility.set_message(801, 'PAY_72791_FED_OVD_AMT_NOT_NUL');
499 hr_utility.raise_error;
500 end if;
501 --
502 -- check if fit_override_amount value is in a valid range
503 --
504 if p_fit_override_amount < 0 then
505 --
506 -- raise error as given value is invalid
507 --
508 hr_utility.set_message(801,'PAY_72790_FED_OVRD_AMT_POSITIV');
509 hr_utility.raise_error;
510 --
511 end if;
512 --
513 end if;
514 --
515 hr_utility.set_location('Leaving:'||l_proc,10);
516 --
517 End chk_fit_override_amount;
518 --
519 -- ----------------------------------------------------------------------------
520 -- |------< chk_fit_override_rate >------|
521 -- ----------------------------------------------------------------------------
522 --
523 -- Description
524 -- This procedure checks that fit_override_rate is between 0 and 100
525 --
526 -- Pre-Conditions
527 -- None.
528 --
529 -- In Parameters
530 -- p_emp_fed_tax_rule_id PK
531 -- p_fit_override_rate
532 --
533 -- Post Success
534 -- Processing continues
535 --
536 -- Post Failure
537 -- Error raised.
538 --
539 -- Access Status
540 -- Internal table handler use only.
541 --
542 Procedure chk_fit_override_rate
543 (p_emp_fed_tax_rule_id in number
544 ,p_fit_override_rate in
545 pay_us_emp_fed_tax_rules_f.fit_override_rate%TYPE
546 ) is
547 --
548 l_proc varchar2(72) := g_package||'chk_fit_override_rate';
549 --
550 Begin
551 --
552 hr_utility.set_location('Entering:'||l_proc,5);
553 --
554 -- If the value is being inserted or updated...
555 --
556 if (p_emp_fed_tax_rule_id is not null
557 and nvl(p_fit_override_rate,hr_api.g_number)
558 <> nvl(pay_fed_shd.g_old_rec.fit_override_rate,hr_api.g_number))
559 or (p_emp_fed_tax_rule_id is null) then
560 --
561 -- Check that the mandatory parameters have been set
562 --
563 if p_fit_override_rate is null then
564 hr_utility.set_message(801, 'PAY_72793_FED_OVD_RT_NOT_NULL');
565 hr_utility.raise_error;
566 end if;
567 --
568 -- check if fit_override_rate value is in a valid range
569 --
570 if p_fit_override_rate < 0 or p_fit_override_rate > 100 then
571 --
572 -- raise error as given value is invalid
573 --
574 hr_utility.set_message(801,'PAY_72792_FED_OVD_RT_IN_RANGE');
575 hr_utility.raise_error;
576 --
577 end if;
578 --
579 end if;
580 --
584 --
581 hr_utility.set_location('Leaving:'||l_proc,10);
582 --
583 End chk_fit_override_rate;
585 -- ----------------------------------------------------------------------------
586 -- |------< chk_withholding_allowances >------|
587 -- ----------------------------------------------------------------------------
588 --
589 -- Description
590 -- This procedure checks that withholding_allowances >= 0
591 --
592 -- Pre-Conditions
593 -- None.
594 --
595 -- In Parameters
596 -- p_emp_fed_tax_rule_id PK
597 -- p_withholding_allowances
598 --
599 -- Post Success
600 -- Processing continues
601 --
602 -- Post Failure
603 -- Error raised.
604 --
605 -- Access Status
606 -- Internal table handler use only.
607 --
608 Procedure chk_withholding_allowances
609 (p_emp_fed_tax_rule_id in number
610 ,p_withholding_allowances in
611 pay_us_emp_fed_tax_rules_f.withholding_allowances%TYPE
612 ) is
613 --
614 l_proc varchar2(72) := g_package||'chk_withholding_allowances';
615 --
616 Begin
617 --
618 hr_utility.set_location('Entering:'||l_proc,5);
619 --
620 -- If the value is being inserted or updated...
621 --
622 if (p_emp_fed_tax_rule_id is not null
623 and nvl(p_withholding_allowances,hr_api.g_number)
624 <> nvl(pay_fed_shd.g_old_rec.withholding_allowances,hr_api.g_number))
625 or (p_emp_fed_tax_rule_id is null) then
626 --
627 -- Check that the mandatory parameters have been set
628 --
629 if p_withholding_allowances is null then
630 hr_utility.set_message(801, 'PAY_72800_FED_WA_NOT_NULL');
631 hr_utility.raise_error;
632 end if;
633 --
634 -- check if withholding_allowances value is in a valid range
635 --
636 if p_withholding_allowances < 0 then
637 --
638 -- raise error as given value is invalid
639 --
640 hr_utility.set_message(801,'PAY_72799_FED_WA_POSITIVE');
641 hr_utility.raise_error;
642 --
643 end if;
644 --
645 end if;
646 --
647 hr_utility.set_location('Leaving:'||l_proc,10);
648 --
649 End chk_withholding_allowances;
650 --
651 -- ----------------------------------------------------------------------------
652 -- |------< chk_eic_filing_status_code >------|
653 -- ----------------------------------------------------------------------------
654 --
655 -- Description
656 -- This procedure validates the eic_filing_status_code against hr_lookups.
657 --
658 -- Pre-Conditions
659 -- None.
660 --
661 -- In Parameters
662 -- p_emp_fed_tax_rule_id PK
663 -- p_eic_filing_status_code ID of FK column
664 -- p_effective_date session date
665 -- p_validation_start_date date
666 -- p_validation_end_date date
667 --
668 -- Post Success
669 -- Processing continues
670 --
671 -- Post Failure
672 -- Error raised.
673 --
674 -- Access Status
675 -- Internal table handler use only.
676 --
677 Procedure chk_eic_filing_status_code
678 (p_emp_fed_tax_rule_id in number
679 ,p_eic_filing_status_code in
680 pay_us_emp_fed_tax_rules_f.eic_filing_status_code%TYPE
681 ,p_effective_date in date
682 ,p_validation_start_date in date
683 ,p_validation_end_date in date
684 ) is
685 --
686 l_proc varchar2(72) := g_package||'chk_eic_filing_status_code';
687 --
688 Begin
689 --
690 hr_utility.set_location('Entering:'||l_proc,5);
691 --
692 -- Check that the mandatory parameters have been set
693 --
694 hr_api.mandatory_arg_error
695 (p_api_name => l_proc
696 ,p_argument => 'effective_date'
697 ,p_argument_value => p_effective_date
698 );
699 --
700 -- If the value is being updated or inserted...
701 --
702 if ((p_emp_fed_tax_rule_id is not null
703 and nvl(p_eic_filing_status_code,hr_api.g_varchar2)
704 <> nvl(pay_fed_shd.g_old_rec.eic_filing_status_code,hr_api.g_varchar2))
705 or
706 (p_emp_fed_tax_rule_id is null)) then
707 --
708 -- Validate only if attribute is not null
709 --
710 if p_eic_filing_status_code is not null then
711 --
712 -- check if eic_filing_status_code value exists in hr_lookups table
713 --
714 if hr_api.not_exists_in_dt_hr_lookups
715 (p_effective_date => p_effective_date
716 ,p_validation_start_date => p_validation_start_date
717 ,p_validation_end_date => p_validation_end_date
718 ,p_lookup_type => 'US_EIC_FILING_STATUS'
719 ,p_lookup_code => p_eic_filing_status_code
720 ) then
721 --
722 -- raise error as eic_filing_status_code does not exist in hr_lookups
723 -- table.
724 --
725 pay_fed_shd.constraint_error('PAY_USFTR_EIC_FILING_STATU_CHK');
726 --
727 end if;
728 --
729 end if;
730 --
731 end if;
732 --
736 --
733 hr_utility.set_location('Leaving:'||l_proc,10);
734 --
735 End chk_eic_filing_status_code;
737 -- ----------------------------------------------------------------------------
738 -- |------< chk_fit_additional_tax >------|
739 -- ----------------------------------------------------------------------------
740 --
741 -- Description
742 -- This procedure checks that fit_additional_tax >= 0
743 --
744 -- Pre-Conditions
745 -- None.
746 --
747 -- In Parameters
748 -- p_emp_fed_tax_rule_id PK
749 -- p_fit_additional_tax
750 --
751 -- Post Success
752 -- Processing continues
753 --
754 -- Post Failure
755 -- Error raised.
756 --
757 -- Access Status
758 -- Internal table handler use only.
759 --
760 Procedure chk_fit_additional_tax
761 (p_emp_fed_tax_rule_id in number
762 ,p_fit_additional_tax in
763 pay_us_emp_fed_tax_rules_f.fit_additional_tax%TYPE
764 ) is
765 --
766 l_proc varchar2(72) := g_package||'chk_fit_additional_tax';
767 --
768 Begin
769 --
770 hr_utility.set_location('Entering:'||l_proc,5);
771 --
772 -- If the value is being updated or inserted...
773 --
774 if ((p_emp_fed_tax_rule_id is not null
775 and nvl(p_fit_additional_tax,hr_api.g_number)
776 <> nvl(pay_fed_shd.g_old_rec.fit_additional_tax,hr_api.g_number))
777 or
778 (p_emp_fed_tax_rule_id is null)) then
779 --
780 -- Validate only if attribute is not null
781 --
782 if p_fit_additional_tax is not null then
783 --
784 -- check if fit_additional_tax value is in a valid range
785 --
786 if p_fit_additional_tax < 0 then
787 --
788 -- raise error as given value is invalid
789 --
790 hr_utility.set_message(801,'PAY_72777_FED_ADD_TAX_POSITIVE');
791 hr_utility.raise_error;
792 --
793 end if;
794 --
795 end if;
796 --
797 end if;
798 --
799 hr_utility.set_location('Leaving:'||l_proc,10);
800 --
801 End chk_fit_additional_tax;
802 --
803 -- ----------------------------------------------------------------------------
804 -- |------< chk_supp_tax_override_rate >------|
805 -- ----------------------------------------------------------------------------
806 --
807 -- Description
808 -- This procedure checks that supp_tax_override_rate between 0 and 100
809 --
810 -- Pre-Conditions
811 -- None.
812 --
813 -- In Parameters
814 -- p_emp_fed_tax_rule_id PK
815 -- p_supp_tax_override_rate
816 --
817 -- Post Success
818 -- Processing continues
819 --
820 -- Post Failure
821 -- Error raised.
822 --
823 -- Access Status
824 -- Internal table handler use only.
825 --
826 Procedure chk_supp_tax_override_rate
827 (p_emp_fed_tax_rule_id in number
828 ,p_supp_tax_override_rate in
829 pay_us_emp_fed_tax_rules_f.supp_tax_override_rate%TYPE
830 ) is
831 --
832 l_proc varchar2(72) := g_package||'chk_supp_tax_override_rate';
833 --
834 Begin
835 --
836 hr_utility.set_location('Entering:'||l_proc,5);
837 --
838 -- If the value is being updated or inserted...
839 --
840 if ((p_emp_fed_tax_rule_id is not null
841 and nvl(p_supp_tax_override_rate,hr_api.g_number)
842 <> nvl(pay_fed_shd.g_old_rec.supp_tax_override_rate,hr_api.g_number))
843 or
844 (p_emp_fed_tax_rule_id is null)) then
845 --
846 -- Validate only if attribute is not null
847 --
848 if p_supp_tax_override_rate is not null then
849 --
850 -- check if supp_tax_override_rate value is in a valid range
851 --
852 if p_supp_tax_override_rate < 0 or p_supp_tax_override_rate > 100 then
853 --
854 -- raise error as given value is invalid
855 --
856 hr_utility.set_message(801,'PAY_72798_FED_SUPP_RT_IN_RANGE');
857 hr_utility.raise_error;
858 --
859 end if;
860 --
861 end if;
862 --
863 end if;
864 --
865 hr_utility.set_location('Leaving:'||l_proc,10);
866 --
867 End chk_supp_tax_override_rate;
868 --
869 -- ----------------------------------------------------------------------------
870 -- |------------------------------< chk_delete >------------------------------|
871 -- ----------------------------------------------------------------------------
872 --
873 -- Description
874 -- Tax rules may be deleted from pay_us_emp_fed_tax_rules_f only when the
875 -- assignment is being deleted.
876 --
877 -- Pre-Conditions
878 -- None
879 --
880 -- In Parameters
881 -- p_emp_fed_tax_rule_id PK
882 -- p_assignment_id assignment id
883 -- p_effective_date session date
884 -- p_object_version_number object version number
885 -- p_validation_start_date date
886 -- p_validation_end_date date
887 -- p_delete_routine varchar2
888 --
892 -- Post Failure
889 -- Post Success
890 -- Processing continues
891 --
893 -- Error raised.
894 --
895 -- Access Status
896 -- Internal table handler use only.
897 --
898 procedure chk_delete
899 (p_emp_fed_tax_rule_id in number
900 ,p_assignment_id in number
901 ,p_effective_date in date
902 ,p_datetrack_mode in varchar2
903 ,p_validation_start_date in date
904 ,p_validation_end_date in date
905 ,p_delete_routine in varchar2
906 ) is
907 --
908 l_effective_date date;
909 l_exists varchar2(1);
910 l_proc varchar2(72) := g_package||'chk_delete';
911 l_state_rule_exists varchar2(1);
912 --
913 cursor csr_check_payroll(p_csr_tmp_date in date) is
914 select null
915 from dual
916 where exists (select null
917 from pay_payroll_actions ppa,
918 pay_assignment_actions paa
919 where ppa.payroll_action_id = paa.payroll_action_id
920 and ppa.action_type in ('Q','R','B','I','V')
921 and ppa.date_earned > p_csr_tmp_date
922 and paa.assignment_id = pay_fed_shd.g_old_rec.assignment_id
923 and paa.action_status = 'C'
924 );
925 --
926 -- Cursor to check for existing state tax rules
927 --
928 cursor csr_state_tax_rules
929 is
930 select null
931 from pay_us_emp_state_tax_rules_f sta
932 where sta.assignment_id = p_assignment_id
933 and sta.effective_end_date > l_effective_date;
934 --
935 begin
936 hr_utility.set_location('Entering:'|| l_proc, 1);
937 --
938 -- Check mandatory parameters have been set
939 --
940 hr_api.mandatory_arg_error
941 (p_api_name => l_proc
942 ,p_argument => 'effective_date'
943 ,p_argument_value => p_effective_date
944 );
945 --
946 hr_api.mandatory_arg_error
947 (p_api_name => l_proc
948 ,p_argument => 'datetrack_mode'
949 ,p_argument_value => p_datetrack_mode
950 );
951 --
952 hr_utility.set_location(l_proc, 2);
953 --
954 -- Validate that this routine is called from Assignment code
955 --
956 if nvl(p_delete_routine,'X') <> 'ASSIGNMENT' then
957 hr_utility.set_message(801, 'HR_6674_PAY_ASSIGN');
958 hr_utility.raise_error;
959 end if;
960 --
961 --
962 if p_datetrack_mode in('ZAP', 'DELETE') then
963 --
964 if p_datetrack_mode = hr_api.g_zap then
965 l_effective_date := trunc(hr_api.g_sot);
966 else
967 l_effective_date := trunc(p_effective_date);
968 end if;
969 --
970 -- Check if payroll has been run for this assignment
971 --
972 open csr_check_payroll(l_effective_date);
973 fetch csr_check_payroll into l_exists;
974 if csr_check_payroll%FOUND then
975 hr_utility.set_location(l_proc,15);
976 close csr_check_payroll;
977 hr_utility.set_message(801, 'PAY_52235_TAX_RULE_DELETE');
978 hr_utility.raise_error;
979 end if;
980 close csr_check_payroll;
981 --
982 elsif p_datetrack_mode in('DELETE_NEXT_CHANGE', 'FUTURE_CHANGE') then
983 --
984 null;
985 --
986 else
987 --
988 hr_utility.set_message(801, 'HR_7204_DT_DEL_MODE_INVALID');
989 hr_utility.raise_error;
990 --
991 end if;
992 --
993 -- If any state tax rules exist for this assignment, raise an error.
994 --
995 open csr_state_tax_rules;
996 fetch csr_state_tax_rules into l_state_rule_exists;
997 if csr_state_tax_rules%found then
998 close csr_state_tax_rules;
999 hr_utility.set_message(801,'HR_7215_DT_CHILD_EXISTS');
1000 hr_utility.set_message_token('TABLE_NAME','PAY_US_EMP_STATE_TAX_RULES_F');
1001 hr_utility.raise_error;
1002 end if;
1003 close csr_state_tax_rules;
1004 --
1005 --
1006 End chk_delete;
1007 --
1008 -- ----------------------------------------------------------------------------
1009 -- |----------------------< chk_non_updateable_args >-------------------------|
1010 -- ----------------------------------------------------------------------------
1011 -- {Start Of Comments}
1012 --
1013 -- Description:
1014 -- This procedure checks that columns where updates are not allowed, have not
1015 -- been changed from their original value.
1016 --
1017 -- Prerequisites:
1018 -- None.
1019 --
1020 -- In Parameters
1021 -- p_rec record structure of row being updated
1022 -- effective_date Effective Date of session
1023 --
1024 -- Post Success:
1025 -- Processing continues.
1026 --
1027 -- Post Failure:
1028 -- Error raised.
1029 --
1030 -- Developer Implementation Notes:
1031 -- None.
1032 --
1033 -- Access Status:
1034 -- Internal Row Handler Use Only.
1035 --
1036 -- {End Of Comments}
1037 -- ----------------------------------------------------------------------------
1041 ) is
1038 Procedure chk_non_updateable_args
1039 (p_rec in pay_fed_shd.g_rec_type
1040 ,p_effective_date in date
1042 --
1043 l_proc varchar2(72) := g_package||'chk_non_updateable_args';
1044 l_error exception;
1045 l_argument varchar2(30);
1046 --
1047 Begin
1048 hr_utility.set_location('Entering:'||l_proc, 10);
1049 --
1050 -- Only proceed with validation if a row exists for
1051 -- the current record in the HR schema
1052 --
1053 if not pay_fed_shd.api_updating
1054 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1055 ,p_object_version_number => p_rec.object_version_number
1056 ,p_effective_date => p_effective_date
1057 ) then
1058 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1059 hr_utility.set_message_token('PROCEDURE', l_proc);
1060 hr_utility.set_message_token('STEP', '20');
1061 end if;
1062 hr_utility.set_location(l_proc, 30);
1063 --
1064 if (nvl(p_rec.assignment_id, hr_api.g_number) <>
1065 pay_fed_shd.g_old_rec.assignment_id)then
1066 l_argument := 'assignment_id';
1067 raise l_error;
1068 end if;
1069 hr_utility.set_location(l_proc, 40);
1070 --
1071 if (nvl(p_rec.business_group_id, hr_api.g_number) <>
1072 pay_fed_shd.g_old_rec.business_group_id)then
1073 l_argument := 'business_group_id';
1074 raise l_error;
1075 end if;
1076 hr_utility.set_location(l_proc, 50);
1077 exception
1078 when l_error then
1079 hr_api.argument_changed_error
1080 (p_api_name => l_proc
1081 ,p_argument => l_argument
1082 );
1083 when others then
1084 raise;
1085 hr_utility.set_location(' Leaving:'||l_proc, 60);
1086 end chk_non_updateable_args;
1087 --
1088 -- ----------------------------------------------------------------------------
1089 -- |--------------------------< dt_update_validate >--------------------------|
1090 -- ----------------------------------------------------------------------------
1091 -- {Start Of Comments}
1092 --
1093 -- Description:
1094 -- This procedure is used for referential integrity of datetracked
1095 -- parent entities when a datetrack update operation is taking place
1096 -- and where there is no cascading of update defined for this entity.
1097 --
1098 -- Prerequisites:
1099 -- This procedure is called from the update_validate.
1100 --
1101 -- In Parameters:
1102 --
1103 -- Post Success:
1104 -- Processing continues.
1105 --
1106 -- Post Failure:
1107 --
1108 -- Developer Implementation Notes:
1109 -- This procedure should not need maintenance unless the HR Schema model
1110 -- changes.
1111 --
1112 -- Access Status:
1113 -- Internal Row Handler Use Only.
1114 --
1115 -- {End Of Comments}
1116 -- ----------------------------------------------------------------------------
1117 Procedure dt_update_validate
1118 (
1119 p_datetrack_mode in varchar2,
1120 p_validation_start_date in date,
1121 p_validation_end_date in date) Is
1122 --
1123 l_proc varchar2(72) := g_package||'dt_update_validate';
1124 l_integrity_error Exception;
1125 l_table_name all_tables.table_name%TYPE;
1126 --
1127 Begin
1128 hr_utility.set_location('Entering:'||l_proc, 5);
1129 --
1130 -- Ensure that the p_datetrack_mode argument is not null
1131 --
1132 hr_api.mandatory_arg_error
1133 (p_api_name => l_proc,
1134 p_argument => 'datetrack_mode',
1135 p_argument_value => p_datetrack_mode);
1136 --
1137 -- Only perform the validation if the datetrack update mode is valid
1138 --
1139 If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
1140 --
1141 --
1142 -- Ensure the arguments are not null
1143 --
1144 hr_api.mandatory_arg_error
1145 (p_api_name => l_proc,
1146 p_argument => 'validation_start_date',
1147 p_argument_value => p_validation_start_date);
1148 --
1149 hr_api.mandatory_arg_error
1150 (p_api_name => l_proc,
1151 p_argument => 'validation_end_date',
1152 p_argument_value => p_validation_end_date);
1153 --
1154 --
1155 --
1156 End If;
1157 --
1158 hr_utility.set_location(' Leaving:'||l_proc, 10);
1159 Exception
1160 When l_integrity_error Then
1161 --
1162 -- A referential integrity check was violated therefore
1163 -- we must error
1164 --
1165 hr_utility.set_message(801, 'HR_7216_DT_UPD_INTEGRITY_ERR');
1166 hr_utility.set_message_token('TABLE_NAME', l_table_name);
1167 hr_utility.raise_error;
1168 When Others Then
1169 --
1170 -- An unhandled or unexpected error has occurred which
1171 -- we must report
1172 --
1173 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1174 hr_utility.set_message_token('PROCEDURE', l_proc);
1175 hr_utility.set_message_token('STEP','15');
1176 hr_utility.raise_error;
1177 End dt_update_validate;
1178 --
1179 -- ----------------------------------------------------------------------------
1183 --
1180 -- |--------------------------< dt_delete_validate >--------------------------|
1181 -- ----------------------------------------------------------------------------
1182 -- {Start Of Comments}
1184 -- Description:
1185 -- This procedure is used for referential integrity of datetracked
1186 -- child entities when either a datetrack DELETE or ZAP is in operation
1187 -- and where there is no cascading of delete defined for this entity.
1188 -- For the datetrack mode of DELETE or ZAP we must ensure that no
1189 -- datetracked child rows exist between the validation start and end
1190 -- dates.
1191 --
1192 -- Prerequisites:
1193 -- This procedure is called from the delete_validate.
1194 --
1195 -- In Parameters:
1196 --
1197 -- Post Success:
1198 -- Processing continues.
1199 --
1200 -- Post Failure:
1201 -- If a row exists by determining the returning Boolean value from the
1202 -- generic dt_api.rows_exist function then we must supply an error via
1203 -- the use of the local exception handler l_rows_exist.
1204 --
1205 -- Developer Implementation Notes:
1206 -- This procedure should not need maintenance unless the HR Schema model
1207 -- changes.
1208 --
1209 -- Access Status:
1210 -- Internal Row Handler Use Only.
1211 --
1212 -- {End Of Comments}
1213 -- ----------------------------------------------------------------------------
1214 Procedure dt_delete_validate
1215 (p_emp_fed_tax_rule_id in number,
1216 p_datetrack_mode in varchar2,
1217 p_validation_start_date in date,
1218 p_validation_end_date in date) Is
1219 --
1220 l_proc varchar2(72) := g_package||'dt_delete_validate';
1221 l_rows_exist Exception;
1222 l_table_name all_tables.table_name%TYPE;
1223 --
1224 Begin
1225 hr_utility.set_location('Entering:'||l_proc, 5);
1226 --
1227 -- Ensure that the p_datetrack_mode argument is not null
1228 --
1229 hr_api.mandatory_arg_error
1230 (p_api_name => l_proc,
1231 p_argument => 'datetrack_mode',
1232 p_argument_value => p_datetrack_mode);
1233 --
1234 -- Only perform the validation if the datetrack mode is either
1235 -- DELETE or ZAP
1236 --
1237 If (p_datetrack_mode = 'DELETE' or
1238 p_datetrack_mode = 'ZAP') then
1239 --
1240 --
1241 -- Ensure the arguments are not null
1242 --
1243 hr_api.mandatory_arg_error
1244 (p_api_name => l_proc,
1245 p_argument => 'validation_start_date',
1246 p_argument_value => p_validation_start_date);
1247 --
1248 hr_api.mandatory_arg_error
1249 (p_api_name => l_proc,
1250 p_argument => 'validation_end_date',
1251 p_argument_value => p_validation_end_date);
1252 --
1253 hr_api.mandatory_arg_error
1254 (p_api_name => l_proc,
1255 p_argument => 'emp_fed_tax_rule_id',
1256 p_argument_value => p_emp_fed_tax_rule_id);
1257 --
1258 --
1259 --
1260 End If;
1261 --
1262 hr_utility.set_location(' Leaving:'||l_proc, 10);
1263 Exception
1264 When l_rows_exist Then
1265 --
1266 -- A referential integrity check was violated therefore
1267 -- we must error
1268 --
1269 hr_utility.set_message(801, 'HR_7215_DT_CHILD_EXISTS');
1270 hr_utility.set_message_token('TABLE_NAME', l_table_name);
1271 hr_utility.raise_error;
1272 When Others Then
1273 --
1274 -- An unhandled or unexpected error has occurred which
1275 -- we must report
1276 --
1277 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1278 hr_utility.set_message_token('PROCEDURE', l_proc);
1279 hr_utility.set_message_token('STEP','15');
1280 hr_utility.raise_error;
1281 End dt_delete_validate;
1282 --
1283 -- ----------------------------------------------------------------------------
1284 -- |---------------------------< insert_validate >----------------------------|
1285 -- ----------------------------------------------------------------------------
1286 Procedure insert_validate
1287 (p_rec in pay_fed_shd.g_rec_type,
1288 p_effective_date in date,
1289 p_datetrack_mode in varchar2,
1290 p_validation_start_date in date,
1291 p_validation_end_date in date) is
1292 --
1293 l_proc varchar2(72) := g_package||'insert_validate';
1294 --
1295 Begin
1296 hr_utility.set_location('Entering:'||l_proc, 5);
1297 --
1298 -- Call all supporting business operations
1299 --
1300 chk_assignment_id
1301 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1302 ,p_assignment_id => p_rec.assignment_id
1303 ,p_business_group_id => p_rec.business_group_id
1304 ,p_object_version_number => p_rec.object_version_number
1305 ,p_effective_date => p_effective_date
1306 );
1307 --
1308 chk_sui_state_code
1309 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1310 ,p_sui_state_code => p_rec.sui_state_code
1311 );
1312 --
1313 chk_sui_jurisdiction_code
1314 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1315 ,p_sui_jurisdiction_code => p_rec.sui_jurisdiction_code
1319 chk_additional_wa_amount
1316 ,p_sui_state_code => p_rec.sui_state_code
1317 );
1318 --
1320 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1321 ,p_additional_wa_amount => p_rec.additional_wa_amount
1322 );
1323 --
1324 chk_filing_status_code
1325 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1326 ,p_filing_status_code => p_rec.filing_status_code
1327 ,p_effective_date => p_effective_date
1328 ,p_validation_start_date => p_validation_start_date
1329 ,p_validation_end_date => p_validation_end_date
1330 );
1331 --
1332 chk_fit_override_amount
1333 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1334 ,p_fit_override_amount => p_rec.fit_override_amount
1335 );
1336 --
1337 chk_fit_override_rate
1338 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1339 ,p_fit_override_rate => p_rec.fit_override_rate
1340 );
1341 --
1342 chk_withholding_allowances
1343 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1344 ,p_withholding_allowances => p_rec.withholding_allowances
1345 );
1346 --
1347 chk_eic_filing_status_code
1348 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1349 ,p_eic_filing_status_code => p_rec.eic_filing_status_code
1350 ,p_effective_date => p_effective_date
1351 ,p_validation_start_date => p_validation_start_date
1352 ,p_validation_end_date => p_validation_end_date
1353 );
1354 --
1355 chk_fit_additional_tax
1356 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1357 ,p_fit_additional_tax => p_rec.fit_additional_tax
1358 );
1359 --
1360 chk_supp_tax_override_rate
1361 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1362 ,p_supp_tax_override_rate => p_rec.supp_tax_override_rate
1363 );
1364 --
1365 hr_utility.set_location(' Leaving:'||l_proc, 10);
1366 End insert_validate;
1367 --
1368 -- ----------------------------------------------------------------------------
1369 -- |---------------------------< update_validate >----------------------------|
1370 -- ----------------------------------------------------------------------------
1371 Procedure update_validate
1372 (p_rec in pay_fed_shd.g_rec_type,
1373 p_effective_date in date,
1374 p_datetrack_mode in varchar2,
1375 p_validation_start_date in date,
1376 p_validation_end_date in date) is
1377 --
1378 l_proc varchar2(72) := g_package||'update_validate';
1379 --
1380 Begin
1381 hr_utility.set_location('Entering:'||l_proc, 5);
1382 --
1383 -- Call all supporting business operations
1384 --
1385 chk_non_updateable_args
1386 (p_rec => p_rec
1387 ,p_effective_date => p_effective_date
1388 );
1389 --
1390 chk_sui_state_code
1391 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1392 ,p_sui_state_code => p_rec.sui_state_code
1393 );
1394 --
1395 chk_sui_jurisdiction_code
1396 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1397 ,p_sui_jurisdiction_code => p_rec.sui_jurisdiction_code
1398 ,p_sui_state_code => p_rec.sui_state_code
1399 );
1400 --
1401 chk_additional_wa_amount
1402 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1403 ,p_additional_wa_amount => p_rec.additional_wa_amount
1404 );
1405 --
1406 chk_filing_status_code
1407 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1408 ,p_filing_status_code => p_rec.filing_status_code
1409 ,p_effective_date => p_effective_date
1410 ,p_validation_start_date => p_validation_start_date
1411 ,p_validation_end_date => p_validation_end_date
1412 );
1413 --
1414 chk_fit_override_amount
1415 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1416 ,p_fit_override_amount => p_rec.fit_override_amount
1417 );
1418 --
1419 chk_fit_override_rate
1420 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1421 ,p_fit_override_rate => p_rec.fit_override_rate
1422 );
1423 --
1424 chk_withholding_allowances
1425 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1426 ,p_withholding_allowances => p_rec.withholding_allowances
1427 );
1428 --
1429 chk_eic_filing_status_code
1430 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1431 ,p_eic_filing_status_code => p_rec.eic_filing_status_code
1432 ,p_effective_date => p_effective_date
1433 ,p_validation_start_date => p_validation_start_date
1434 ,p_validation_end_date => p_validation_end_date
1435 );
1436 --
1437 chk_fit_additional_tax
1438 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1439 ,p_fit_additional_tax => p_rec.fit_additional_tax
1440 );
1441 --
1442 chk_supp_tax_override_rate
1443 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1444 ,p_supp_tax_override_rate => p_rec.supp_tax_override_rate
1445 );
1446 --
1447 -- Call the datetrack update integrity operation
1448 --
1449 dt_update_validate
1450 (
1451 p_datetrack_mode => p_datetrack_mode,
1452 p_validation_start_date => p_validation_start_date,
1453 p_validation_end_date => p_validation_end_date);
1454 --
1455 hr_utility.set_location(' Leaving:'||l_proc, 10);
1456 End update_validate;
1457 --
1458 -- ----------------------------------------------------------------------------
1459 -- |---------------------------< delete_validate >----------------------------|
1460 -- ----------------------------------------------------------------------------
1461 Procedure delete_validate
1462 (p_rec in pay_fed_shd.g_rec_type
1463 ,p_effective_date in date
1464 ,p_datetrack_mode in varchar2
1465 ,p_validation_start_date in date
1466 ,p_validation_end_date in date
1467 ,p_delete_routine in varchar2
1468 ) is
1469 --
1470 l_proc varchar2(72) := g_package||'delete_validate';
1471 --
1472 Begin
1473 hr_utility.set_location('Entering:'||l_proc, 5);
1474 --
1475 -- Call all supporting business operations
1476 --
1477 chk_delete
1478 (p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id
1479 ,p_assignment_id => pay_fed_shd.g_old_rec.assignment_id
1480 ,p_effective_date => p_effective_date
1481 ,p_datetrack_mode => p_datetrack_mode
1482 ,p_validation_start_date => p_validation_start_date
1483 ,p_validation_end_date => p_validation_end_date
1484 ,p_delete_routine => p_delete_routine
1485 );
1486 --
1487 --
1488 --
1489 dt_delete_validate
1490 (p_datetrack_mode => p_datetrack_mode,
1491 p_validation_start_date => p_validation_start_date,
1492 p_validation_end_date => p_validation_end_date,
1493 p_emp_fed_tax_rule_id => p_rec.emp_fed_tax_rule_id);
1494 --
1495 hr_utility.set_location(' Leaving:'||l_proc, 10);
1496 End delete_validate;
1497 --
1498 --
1499 -- ---------------------------------------------------------------------------
1500 -- |---------------------< return_legislation_code >-------------------------|
1501 -- ---------------------------------------------------------------------------
1502 --
1503 function return_legislation_code
1504 (p_emp_fed_tax_rule_id in number) return varchar2 is
1505 --
1506 -- Declare cursor
1507 --
1508 cursor csr_leg_code is
1509 select bus.legislation_code
1510 from per_business_groups bus,
1511 pay_us_emp_fed_tax_rules_f fed
1512 where fed.emp_fed_tax_rule_id = p_emp_fed_tax_rule_id
1513 and bus.business_group_id = fed.business_group_id;
1514 --
1515 -- Declare local variables
1516 --
1517 l_legislation_code varchar2(150);
1518 l_proc varchar2(72) := g_package||'return_legislation_code';
1519 --
1520 begin
1521 --
1522 hr_utility.set_location('Entering:'|| l_proc, 10);
1523 --
1524 -- Ensure that all the mandatory parameter are not null
1525 --
1526 hr_api.mandatory_arg_error(p_api_name => l_proc,
1527 p_argument => 'emp_fed_tax_rule_id',
1528 p_argument_value => p_emp_fed_tax_rule_id);
1529 --
1530 if nvl(g_fed_tax_rule_id, hr_api.g_number) = p_emp_fed_tax_rule_id then
1531 --
1532 -- The legislation code has already been found with a previous
1533 -- call to this function. Just return the value in the global
1534 -- variable.
1535 --
1536 l_legislation_code := g_legislation_code;
1537 hr_utility.set_location(l_proc, 20);
1538 --
1539 else
1540 --
1541 -- The ID is different to the last call to this function
1542 -- or this is the first call to this function.
1543 --
1544 open csr_leg_code;
1545 --
1546 fetch csr_leg_code into l_legislation_code;
1547 --
1548 if csr_leg_code%notfound then
1549 --
1550 close csr_leg_code;
1551 --
1552 -- The primary key is invalid therefore we must error
1553 --
1554 hr_utility.set_message(801,'HR_7220_INVALID_PRIMARY_KEY');
1555 hr_utility.raise_error;
1556 --
1557 end if;
1558 hr_utility.set_location(' Leaving:'|| l_proc, 30);
1559 --
1560 -- Set the global variables to the values are
1561 -- available for the next call to this function
1562 --
1563 close csr_leg_code;
1564 g_fed_tax_rule_id := p_emp_fed_tax_rule_id;
1568 --
1565 g_legislation_code := l_legislation_code;
1566 end if;
1567 hr_utility.set_location(' Leaving:'|| l_proc, 40);
1569 return l_legislation_code;
1570 --
1571 end return_legislation_code;
1572 --
1573 end pay_fed_bus;