28: l_validation_end_date date;
29: --
30: begin
31: --
32: hr_utility.set_location('Entering:'|| l_proc, 10);
33: --
34: pay_sta_shd.lck
35: (
36: p_emp_state_tax_rule_id => p_emp_state_tax_rule_id
40: ,p_effective_date => p_effective_date
41: ,p_datetrack_mode => p_datetrack_mode
42: );
43: --
44: hr_utility.set_location(' Leaving:'||l_proc, 70);
45: --
46: end lck;
47:
48: -- ----------------------------------------------------------------------------
306: -- Process Logic
307: --
308: begin
309: --
310: hr_utility.set_location('Entering:'|| l_proc, 10);
311: --
312: -- Issue a savepoint
313: --
314: savepoint create_state_tax_rule;
315:
316: --
317: l_effective_date := trunc(p_effective_date);
318: --
319: hr_utility.set_location(l_proc, 20);
320: --
321: -- Validate the assignment_id passed in
322: --
323: open csr_bus_grp;
326: close csr_bus_grp;
327: --
328: -- The assignment does not exist in PER_ASSIGNMENTS_F
329: --
330: hr_utility.set_message(801, 'HR_51253_PYP_ASS__NOT_VALID');
331: hr_utility.raise_error;
332: end if;
333: close csr_bus_grp;
334: --
327: --
328: -- The assignment does not exist in PER_ASSIGNMENTS_F
329: --
330: hr_utility.set_message(801, 'HR_51253_PYP_ASS__NOT_VALID');
331: hr_utility.raise_error;
332: end if;
333: close csr_bus_grp;
334: --
335: -- Validation checks whether it is appropriate to run this process
340: if l_defaulting_date is null then
341: --
342: -- No Federal tax rule exists for this assignment
343: --
344: hr_utility.set_message(801, 'HR_7182_DT_NO_MIN_MAX_ROWS');
345: hr_utility.set_message_token('TABLE_NAME','PAY_US_EMP_FED_TAX_RULES_F');
346: hr_utility.raise_error;
347: end if;
348: --
341: --
342: -- No Federal tax rule exists for this assignment
343: --
344: hr_utility.set_message(801, 'HR_7182_DT_NO_MIN_MAX_ROWS');
345: hr_utility.set_message_token('TABLE_NAME','PAY_US_EMP_FED_TAX_RULES_F');
346: hr_utility.raise_error;
347: end if;
348: --
349: --
342: -- No Federal tax rule exists for this assignment
343: --
344: hr_utility.set_message(801, 'HR_7182_DT_NO_MIN_MAX_ROWS');
345: hr_utility.set_message_token('TABLE_NAME','PAY_US_EMP_FED_TAX_RULES_F');
346: hr_utility.raise_error;
347: end if;
348: --
349: --
350: open csr_state_tax_rule;
353: close csr_state_tax_rule;
354: --
355: -- This state tax rule already exists
356: --
357: hr_utility.set_message(801, 'HR_7719_TAX_ONE_RULE_ONLY');
358: hr_utility.raise_error;
359: end if;
360: close csr_state_tax_rule;
361: --
354: --
355: -- This state tax rule already exists
356: --
357: hr_utility.set_message(801, 'HR_7719_TAX_ONE_RULE_ONLY');
358: hr_utility.raise_error;
359: end if;
360: close csr_state_tax_rule;
361: --
362: --
366: close csr_state_jd;
367: --
368: -- The jurisdiction_code for this state code cannot be found
369: -- (Invalid state code)
370: hr_utility.set_message(801, 'HR_7952_ADDR_NO_STATE_CODE');
371: hr_utility.raise_error;
372: end if;
373: close csr_state_jd;
374: --
367: --
368: -- The jurisdiction_code for this state code cannot be found
369: -- (Invalid state code)
370: hr_utility.set_message(801, 'HR_7952_ADDR_NO_STATE_CODE');
371: hr_utility.raise_error;
372: end if;
373: close csr_state_jd;
374: --
375: if p_default_flag = 'Y' then
377: open csr_fed_or_def;
378: --
379: fetch csr_fed_or_def into l_def_pref;
380: --
381: hr_utility.set_location(l_proc,30);
382: --
383: if csr_fed_or_def%NOTFOUND then
384: --
385: CLOSE csr_fed_or_def;
383: if csr_fed_or_def%NOTFOUND then
384: --
385: CLOSE csr_fed_or_def;
386: if p_state_code = '07' then
387: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',41);
388: l_filing_status_code := '07';
389: l_withholding_allowances := 0;
390: elsif p_state_code = '22' then
391: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',42);
387: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',41);
388: l_filing_status_code := '07';
389: l_withholding_allowances := 0;
390: elsif p_state_code = '22' then
391: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',42);
392: l_filing_status_code := '04';
393: l_withholding_allowances := 0;
394: else
395: l_filing_status_code := '01';
393: l_withholding_allowances := 0;
394: else
395: l_filing_status_code := '01';
396: l_withholding_allowances := 0;
397: hr_utility.set_location(l_proc,43);
398: end if;
399: elsif csr_fed_or_def%FOUND then
400: --
401: CLOSE csr_fed_or_def;
402: --
403: if l_def_pref = 'SINGLE_ZERO' or l_def_pref is null then
404: --
405: if p_state_code = '07' then
406: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',51);
407: l_filing_status_code := '07';
408: l_withholding_allowances := 0;
409: elsif p_state_code = '22' then
410: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',52);
406: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',51);
407: l_filing_status_code := '07';
408: l_withholding_allowances := 0;
409: elsif p_state_code = '22' then
410: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',52);
411: l_filing_status_code := '04';
412: l_withholding_allowances := 0;
413: else
414: hr_utility.set_location(l_proc,53);
410: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',52);
411: l_filing_status_code := '04';
412: l_withholding_allowances := 0;
413: else
414: hr_utility.set_location(l_proc,53);
415: l_filing_status_code := '01';
416: l_withholding_allowances := 0;
417: end if;
418: --
417: end if;
418: --
419: elsif l_def_pref = 'FED_DEF' then
420: --
421: hr_utility.set_location(l_proc,60);
422: open csr_filing_status;
423: --
424: fetch csr_filing_status into l_filing_status_code, l_withholding_allowances;
425: l_filing_status_code := lpad(l_filing_status_code,2,'0');
426: --
427: if csr_filing_status%NOTFOUND then
428: --
429: if p_state_code = '07' then
430: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',71);
431: l_filing_status_code := '07';
432: l_withholding_allowances := 0;
433: elsif p_state_code = '22' then
434: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',72);
430: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',71);
431: l_filing_status_code := '07';
432: l_withholding_allowances := 0;
433: elsif p_state_code = '22' then
434: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',72);
435: l_filing_status_code := '04';
436: l_withholding_allowances := 0;
437: else
438: hr_utility.set_location(l_proc,73);
434: hr_utility.set_location('pay_us_emp_dt_tax_rules.ins_def_state',72);
435: l_filing_status_code := '04';
436: l_withholding_allowances := 0;
437: else
438: hr_utility.set_location(l_proc,73);
439: l_filing_status_code := '01';
440: l_withholding_allowances := 0;
441: end if;
442: --
648: -- end;
649: --
650: -- Insert State Tax record
651: --
652: hr_utility.set_location(l_proc,80);
653: --
654: --
655: pay_sta_ins.ins
656: (
810: -- End of API User Hook for the after hook of create_state_tax_rule
811: --
812: -- end;
813: --
814: hr_utility.set_location(l_proc, 90);
815: --
816: -- When in validation only mode raise the Validate_Enabled exception
817: --
818: if p_validate then
825: p_effective_start_date := l_effective_start_date;
826: p_effective_end_date := l_effective_end_date;
827: p_object_version_number := l_object_version_number;
828: --
829: hr_utility.set_location(' Leaving:'||l_proc, 100);
830: --
831: exception
832: --
833: when hr_api.validate_enabled then
844: p_emp_state_tax_rule_id := null;
845: p_effective_start_date := null;
846: p_effective_end_date := null;
847: p_object_version_number := null;
848: hr_utility.set_location(' Leaving:'||l_proc, 120);
849: --
850: when others then
851: --
852: -- A validation or unexpected error has occurred
970: l_effective_end_date pay_us_emp_state_tax_rules_f.effective_end_date%TYPE;
971: --
972: begin
973: --
974: hr_utility.set_location('Entering:'|| l_proc, 10);
975: --
976: -- Issue a savepoint
977: --
978: savepoint update_state_tax_rule;
980: --
981: l_effective_date := trunc(p_effective_date);
982: l_excessive_wa_reject_date := trunc(p_excessive_wa_reject_date);
983: --
984: hr_utility.set_location(l_proc, 20);
985: --
986: -- Process Logic
987: --
988: l_object_version_number := p_object_version_number;
1176: --
1177: -- end;
1178: --
1179: --
1180: hr_utility.set_location(l_proc, 60);
1181: --
1182: -- When in validation only mode raise the Validate_Enabled exception
1183: --
1184: if p_validate then
1190: -- p_object_version_number := l_object_version_number;
1191: p_effective_start_date := l_effective_start_date;
1192: p_effective_end_date := l_effective_end_date;
1193: --
1194: hr_utility.set_location(' Leaving:'||l_proc, 70);
1195: --
1196: exception
1197: --
1198: when hr_api.validate_enabled then
1208: --
1209: p_object_version_number := l_object_version_number;
1210: p_effective_start_date := null;
1211: p_effective_end_date := null;
1212: hr_utility.set_location(' Leaving:'||l_proc, 90);
1213: --
1214: when others then
1215: --
1216: -- A validation or unexpected error has occurred