452: IF l_found THEN
453: IF ((l_end_date IS NULL) OR
454: (fnd_date.canonical_to_date(l_end_date) > l_term_date)) THEN
455: l_flag := 'Y';
456: hr_utility.trace('changing flag to: ' || l_flag);
457: hr_utility.trace('end date is <' || l_end_date || '>');
458: END IF;
459: ELSE
460: hr_utility.trace('no data found...');
453: IF ((l_end_date IS NULL) OR
454: (fnd_date.canonical_to_date(l_end_date) > l_term_date)) THEN
455: l_flag := 'Y';
456: hr_utility.trace('changing flag to: ' || l_flag);
457: hr_utility.trace('end date is <' || l_end_date || '>');
458: END IF;
459: ELSE
460: hr_utility.trace('no data found...');
461: NULL;
456: hr_utility.trace('changing flag to: ' || l_flag);
457: hr_utility.trace('end date is <' || l_end_date || '>');
458: END IF;
459: ELSE
460: hr_utility.trace('no data found...');
461: NULL;
462: END IF;
463: hr_utility.trace('leaving function get_student_loan_flag...');
464: --
459: ELSE
460: hr_utility.trace('no data found...');
461: NULL;
462: END IF;
463: hr_utility.trace('leaving function get_student_loan_flag...');
464: --
465: --
466: RETURN l_flag;
467: --
637: where link1.element_type_id = g_paye_details_id
638: and e1.assignment_id = p_assignment_id
639: and e1.element_link_id = link1.element_link_id);
640: begin
641: hr_utility.set_location('Entering get_tax_details',1);
642: hr_utility.trace('Assignemnt ID : ' || p_assignment_id);
643: hr_utility.trace('PAYE Details ID : ' || p_paye_details_id);
644: hr_utility.trace('PAYE ID : ' || p_paye_id);
645: hr_utility.trace('Effective Date : ' || p_eff_date);
638: and e1.assignment_id = p_assignment_id
639: and e1.element_link_id = link1.element_link_id);
640: begin
641: hr_utility.set_location('Entering get_tax_details',1);
642: hr_utility.trace('Assignemnt ID : ' || p_assignment_id);
643: hr_utility.trace('PAYE Details ID : ' || p_paye_details_id);
644: hr_utility.trace('PAYE ID : ' || p_paye_id);
645: hr_utility.trace('Effective Date : ' || p_eff_date);
646:
639: and e1.element_link_id = link1.element_link_id);
640: begin
641: hr_utility.set_location('Entering get_tax_details',1);
642: hr_utility.trace('Assignemnt ID : ' || p_assignment_id);
643: hr_utility.trace('PAYE Details ID : ' || p_paye_details_id);
644: hr_utility.trace('PAYE ID : ' || p_paye_id);
645: hr_utility.trace('Effective Date : ' || p_eff_date);
646:
647:
640: begin
641: hr_utility.set_location('Entering get_tax_details',1);
642: hr_utility.trace('Assignemnt ID : ' || p_assignment_id);
643: hr_utility.trace('PAYE Details ID : ' || p_paye_details_id);
644: hr_utility.trace('PAYE ID : ' || p_paye_id);
645: hr_utility.trace('Effective Date : ' || p_eff_date);
646:
647:
648: --Bug 6900025 assigning proper date earned to l_effective_date
641: hr_utility.set_location('Entering get_tax_details',1);
642: hr_utility.trace('Assignemnt ID : ' || p_assignment_id);
643: hr_utility.trace('PAYE Details ID : ' || p_paye_details_id);
644: hr_utility.trace('PAYE ID : ' || p_paye_id);
645: hr_utility.trace('Effective Date : ' || p_eff_date);
646:
647:
648: --Bug 6900025 assigning proper date earned to l_effective_date
649: --Bug 7410767 Modified the p_eff_date check
657: --l_effective_date := to_date(to_char(p_eff_date,'DD-MM')||to_char(fnd_number.canonical_to_number(to_char(p_eff_date,'YYYY') - 1)),'DD-MM-YYYY');
658: l_effective_date := add_months( p_eff_date,-12);
659: end if;
660:
661: hr_utility.trace('l_effective_date value'||l_effective_date);
662: open csr_max_run_result(p_paye_id,l_effective_date);
663: fetch csr_max_run_result into l_paye_rr_id;
664: close csr_max_run_result;
665:
666: open csr_max_run_result(p_paye_details_id,l_effective_date);
667: fetch csr_max_run_result into l_paye_details_rr_id;
668: close csr_max_run_result;
669:
670: hr_utility.trace('Fetching run result 1');
671: -- 1. First we try to fetch it from the latest PAYE run results
672: open csr_run_result(l_paye_rr_id, p_paye_id);
673: fetch csr_run_result into p_tax_code,
674: p_tax_basis,
676: p_prev_tax;
677: close csr_run_result;
678: -- 2. Tax code is not found, fetch from the latest PAYE Details run results
679: if p_tax_code is null then
680: hr_utility.trace('Fetching run result 2');
681: open csr_run_result(l_paye_details_rr_id, p_paye_details_id);
682: fetch csr_run_result into p_tax_code,
683: p_tax_basis,
684: p_prev_pay,
686: close csr_run_result;
687:
688: -- 3. Still not found, fetch the value from the PAYE
689: if p_tax_code is null then
690: hr_utility.trace('Fetching run result 3');
691: open csr_paye_details(p_assignment_id);
692: fetch csr_paye_details into p_tax_code,
693: p_tax_basis,
694: p_prev_pay,
695: p_prev_tax;
696: close csr_paye_details;
697: end if;
698: end if;
699: hr_utility.set_location('Leaving get_tax_details',999);
700: end;
701:
702: procedure get_ff_data(X_SESSION_DATE in date,
703: X_ASSIGNMENT_ID in number,
910: l_agg_active_start date;
911: l_agg_active_end date;
912: begin
913: --
914: hr_utility.trace('DATE_EARN ' || x_date_earned);
915: hr_utility.trace('X_PERSON_ID ' || X_PERSON_ID);
916: hr_utility.trace('X_ASSIGNMENT_END_DATE ' || fnd_date.date_to_displaydate(X_ASSIGNMENT_END_DATE));
917: hr_utility.trace('X_TRANSFER_DATE ' || fnd_date.date_to_displaydate(X_TRANSFER_DATE));
918: l_asg_action_exists := FALSE;
911: l_agg_active_end date;
912: begin
913: --
914: hr_utility.trace('DATE_EARN ' || x_date_earned);
915: hr_utility.trace('X_PERSON_ID ' || X_PERSON_ID);
916: hr_utility.trace('X_ASSIGNMENT_END_DATE ' || fnd_date.date_to_displaydate(X_ASSIGNMENT_END_DATE));
917: hr_utility.trace('X_TRANSFER_DATE ' || fnd_date.date_to_displaydate(X_TRANSFER_DATE));
918: l_asg_action_exists := FALSE;
919: open agg_paye(X_PERSON_ID, X_ASSIGNMENT_END_DATE);
912: begin
913: --
914: hr_utility.trace('DATE_EARN ' || x_date_earned);
915: hr_utility.trace('X_PERSON_ID ' || X_PERSON_ID);
916: hr_utility.trace('X_ASSIGNMENT_END_DATE ' || fnd_date.date_to_displaydate(X_ASSIGNMENT_END_DATE));
917: hr_utility.trace('X_TRANSFER_DATE ' || fnd_date.date_to_displaydate(X_TRANSFER_DATE));
918: l_asg_action_exists := FALSE;
919: open agg_paye(X_PERSON_ID, X_ASSIGNMENT_END_DATE);
920: fetch agg_paye into l_agg_paye_flag;
913: --
914: hr_utility.trace('DATE_EARN ' || x_date_earned);
915: hr_utility.trace('X_PERSON_ID ' || X_PERSON_ID);
916: hr_utility.trace('X_ASSIGNMENT_END_DATE ' || fnd_date.date_to_displaydate(X_ASSIGNMENT_END_DATE));
917: hr_utility.trace('X_TRANSFER_DATE ' || fnd_date.date_to_displaydate(X_TRANSFER_DATE));
918: l_asg_action_exists := FALSE;
919: open agg_paye(X_PERSON_ID, X_ASSIGNMENT_END_DATE);
920: fetch agg_paye into l_agg_paye_flag;
921: close agg_paye;
919: open agg_paye(X_PERSON_ID, X_ASSIGNMENT_END_DATE);
920: fetch agg_paye into l_agg_paye_flag;
921: close agg_paye;
922: --
923: hr_utility.trace('Agg PAYE in ff data:'||l_agg_paye_flag);
924: hr_utility.trace(to_char(X_TRANSFER_DATE));
925: -- Use the tfr date as includes all processes for the assignment.
926: if nvl(l_agg_paye_flag,'X') = 'Y' then
927: -- 5144323: get_aggregation end date
920: fetch agg_paye into l_agg_paye_flag;
921: close agg_paye;
922: --
923: hr_utility.trace('Agg PAYE in ff data:'||l_agg_paye_flag);
924: hr_utility.trace(to_char(X_TRANSFER_DATE));
925: -- Use the tfr date as includes all processes for the assignment.
926: if nvl(l_agg_paye_flag,'X') = 'Y' then
927: -- 5144323: get_aggregation end date
928: OPEN get_aggregation_end;
927: -- 5144323: get_aggregation end date
928: OPEN get_aggregation_end;
929: FETCH get_aggregation_end INTO l_aggregation_end;
930: CLOSE get_aggregation_end;
931: hr_utility.trace('After get_aggregation_end, l_aggregation_end='||fnd_date.date_to_displaydate(l_aggregation_end));
932: l_agg_active_start := pay_gb_eoy_archive.get_agg_active_start(X_ASSIGNMENT_ID, X_TAX_REFERENCE, X_ASSIGNMENT_END_DATE);
933: l_agg_active_end := pay_gb_eoy_archive.get_agg_active_end(X_ASSIGNMENT_ID, X_TAX_REFERENCE, X_ASSIGNMENT_END_DATE);
934: --
935: -- 5144343: Get aggregated action within the aggregation period only
943: l_found := FALSE;
944: if l_asg_action_id is not null then
945: l_found := TRUE;
946: end if;
947: hr_utility.trace('asg action for agg: '||to_char(l_asg_action_id));
948: open payroll_details(l_asg_action_id);
949: fetch payroll_details into l_payroll_action_id, l_effective_date,
950: l_payroll_id;
951: close payroll_details;
948: open payroll_details(l_asg_action_id);
949: fetch payroll_details into l_payroll_action_id, l_effective_date,
950: l_payroll_id;
951: close payroll_details;
952: hr_utility.trace('asg action: '||to_char(l_asg_action_id));
953: --
954: else
955: -- NOT Aggregated PAYE
956: hr_utility.trace('Not aggregated so get latest action of asg');
952: hr_utility.trace('asg action: '||to_char(l_asg_action_id));
953: --
954: else
955: -- NOT Aggregated PAYE
956: hr_utility.trace('Not aggregated so get latest action of asg');
957: --
958: open get_latest_id(X_ASSIGNMENT_ID, X_TRANSFER_DATE);
959: fetch get_latest_id into l_asg_action_id;
960: close get_latest_id;
959: fetch get_latest_id into l_asg_action_id;
960: close get_latest_id;
961: --
962: if l_asg_action_id is not null then
963: hr_utility.trace('single asg action found: '||to_char(l_asg_action_id));
964: l_latest_asg_action_id := l_asg_action_id;
965: l_asg_action_exists := TRUE;
966: open taxable_or_paye_exists(l_asg_action_id);
967: fetch taxable_or_paye_exists into l_tax_paye_exists;
966: open taxable_or_paye_exists(l_asg_action_id);
967: fetch taxable_or_paye_exists into l_tax_paye_exists;
968: l_found := taxable_or_paye_exists%found;
969: IF l_found THEN
970: hr_utility.trace(' Non zero results found: TRUE');
971: ELSE
972: hr_utility.trace(' Non zero results found: FALSE');
973: END IF;
974: close taxable_or_paye_exists;
968: l_found := taxable_or_paye_exists%found;
969: IF l_found THEN
970: hr_utility.trace(' Non zero results found: TRUE');
971: ELSE
972: hr_utility.trace(' Non zero results found: FALSE');
973: END IF;
974: close taxable_or_paye_exists;
975: else
976: hr_utility.trace('No Master-Child action');
972: hr_utility.trace(' Non zero results found: FALSE');
973: END IF;
974: close taxable_or_paye_exists;
975: else
976: hr_utility.trace('No Master-Child action');
977: open get_last_action(X_ASSIGNMENT_ID, X_TRANSFER_DATE);
978: fetch get_last_action into l_asg_action_id;
979: close get_last_action;
980:
985: --
986: if l_found then
987: -- Above 2 cursors found the last assignment action has
988: -- Taxable Pay or PAYE balances, so obtain payroll action details
989: hr_utility.trace('Asg action has paye or taxable pay');
990: open payroll_details(l_asg_action_id);
991: fetch payroll_details into l_payroll_action_id, l_effective_date,
992: l_payroll_id;
993: close payroll_details;
996: -- Above cursors did not find asg action that has Taxable
997: -- Pay or PAYE balances, so use less efficient cursor
998: -- to search for the last action that has PAYE or Taxable
999: -- Pay. Do this only if there was any asg action for the assignment.
1000: hr_utility.trace('Asg action has NO paye or taxable pay');
1001: IF l_asg_action_exists then
1002: BEGIN
1003: hr_utility.trace('Use c_act');
1004: open c_act;
999: -- Pay. Do this only if there was any asg action for the assignment.
1000: hr_utility.trace('Asg action has NO paye or taxable pay');
1001: IF l_asg_action_exists then
1002: BEGIN
1003: hr_utility.trace('Use c_act');
1004: open c_act;
1005: fetch c_act into l_asg_action_id, l_payroll_action_id,
1006: l_effective_date, l_payroll_id;
1007: l_found := c_act%found;
1005: fetch c_act into l_asg_action_id, l_payroll_action_id,
1006: l_effective_date, l_payroll_id;
1007: l_found := c_act%found;
1008: close c_act;
1009: hr_utility.trace(l_asg_action_id);
1010: hr_utility.trace(l_payroll_action_id);
1011:
1012: IF NOT(l_found) THEN -- 4136320: No actions with payments, so query the last run details
1013: open payroll_details( greatest(l_asg_action_id, l_latest_asg_action_id) );
1006: l_effective_date, l_payroll_id;
1007: l_found := c_act%found;
1008: close c_act;
1009: hr_utility.trace(l_asg_action_id);
1010: hr_utility.trace(l_payroll_action_id);
1011:
1012: IF NOT(l_found) THEN -- 4136320: No actions with payments, so query the last run details
1013: open payroll_details( greatest(l_asg_action_id, l_latest_asg_action_id) );
1014: fetch payroll_details into l_payroll_action_id, l_effective_date,
1016: l_found := payroll_details%found;
1017: close payroll_details;
1018: END IF;
1019:
1020: hr_utility.trace(l_asg_action_id);
1021: hr_utility.trace(l_payroll_action_id);
1022: hr_utility.trace(l_effective_date);
1023: hr_utility.trace(l_payroll_id);
1024: -- Handle exceptions in c_act, set found = false.
1017: close payroll_details;
1018: END IF;
1019:
1020: hr_utility.trace(l_asg_action_id);
1021: hr_utility.trace(l_payroll_action_id);
1022: hr_utility.trace(l_effective_date);
1023: hr_utility.trace(l_payroll_id);
1024: -- Handle exceptions in c_act, set found = false.
1025: EXCEPTION WHEN OTHERS THEN
1018: END IF;
1019:
1020: hr_utility.trace(l_asg_action_id);
1021: hr_utility.trace(l_payroll_action_id);
1022: hr_utility.trace(l_effective_date);
1023: hr_utility.trace(l_payroll_id);
1024: -- Handle exceptions in c_act, set found = false.
1025: EXCEPTION WHEN OTHERS THEN
1026: hr_utility.trace('c_act raised: '|| sqlerrm(sqlcode));
1019:
1020: hr_utility.trace(l_asg_action_id);
1021: hr_utility.trace(l_payroll_action_id);
1022: hr_utility.trace(l_effective_date);
1023: hr_utility.trace(l_payroll_id);
1024: -- Handle exceptions in c_act, set found = false.
1025: EXCEPTION WHEN OTHERS THEN
1026: hr_utility.trace('c_act raised: '|| sqlerrm(sqlcode));
1027: l_found := FALSE;
1022: hr_utility.trace(l_effective_date);
1023: hr_utility.trace(l_payroll_id);
1024: -- Handle exceptions in c_act, set found = false.
1025: EXCEPTION WHEN OTHERS THEN
1026: hr_utility.trace('c_act raised: '|| sqlerrm(sqlcode));
1027: l_found := FALSE;
1028: END;
1029: ELSE
1030: -- No prior action exists at all, so must set found to false.
1027: l_found := FALSE;
1028: END;
1029: ELSE
1030: -- No prior action exists at all, so must set found to false.
1031: hr_utility.trace('No Asg Action found');
1032: l_found := FALSE;
1033: END IF;
1034: end if; -- use c_act cursor if more performant cursors do not find vals
1035: end if; -- Aggregated PAYE
1038: -- has been set in one of the above 3 places. Therefore set the out
1039: -- params as necessary. Otherwise, set the out params to -9999
1040: --
1041: if l_found then
1042: hr_utility.trace('Found');
1043: l_override_date := override_date(x_assignment_id);
1044: l_taxable_update_action := l_asg_action_id;
1045: l_taxable_update_payroll := l_payroll_id;
1046: x_payroll_action_id := l_payroll_action_id;
1048: -- Bug 5478073: Get tax year start for termination and latest action
1049: OPEN csr_get_term_tax_year_start;
1050: FETCH csr_get_term_tax_year_start INTO l_termination_ty_start;
1051: CLOSE csr_get_term_tax_year_start;
1052: hr_utility.trace('After csr_get_term_tax_year_start, l_termination_ty_start='||fnd_date.date_to_displaydate(l_termination_ty_start));
1053: --
1054: OPEN csr_get_action_tax_year_start(l_asg_action_id);
1055: FETCH csr_get_action_tax_year_start INTO l_latest_action_ty_start;
1056: CLOSE csr_get_action_tax_year_start;
1053: --
1054: OPEN csr_get_action_tax_year_start(l_asg_action_id);
1055: FETCH csr_get_action_tax_year_start INTO l_latest_action_ty_start;
1056: CLOSE csr_get_action_tax_year_start;
1057: hr_utility.trace('After csr_get_action_tax_year_start, l_latest_action_ty_start='||fnd_date.date_to_displaydate(l_latest_action_ty_start));
1058: --
1059: -- Bug 2332796. Use the least of date paid and override
1060: -- date to get the time period for EOY expiry check.
1061: --
1089: x_date_earned := l_taxable_update_date;
1090: end if;
1091:
1092: else
1093: hr_utility.trace('Not found : ' || X_SESSION_DATE);
1094: l_taxable_update_date := NULL;
1095: X_DATE_EARNED := X_SESSION_DATE;
1096: X_ASSIGNMENT_ACTION_ID := -9999;
1097: x_payroll_action_id := -9999;
1194: open csr_tax_ref(X_ASSIGNMENT_ID,X_ASSIGNMENT_END_DATE);
1195: fetch csr_tax_ref into l_tax_reference;
1196: close csr_tax_ref;
1197: --
1198: hr_utility.trace('Tax Ref: '||l_tax_reference);
1199: --
1200: person_address(X_PERSON_ID,
1201: X_SESSION_DATE,
1202: X_ADDRESS_LINE1,
1258: --
1259: open csr_tax_ref(X_ASSIGNMENT_ID,X_ASSIGNMENT_END_DATE);
1260: fetch csr_tax_ref into l_tax_reference;
1261: close csr_tax_ref;
1262: hr_utility.trace('Tax Ref: '||l_tax_reference);
1263: --
1264: person_address(X_PERSON_ID,
1265: X_SESSION_DATE,
1266: X_ADDRESS_LINE1,
1449: rec_employer_details csr_employer_details%ROWTYPE;
1450: --
1451: BEGIN
1452: --
1453: hr_utility.set_location('Entering: '||l_proc,1);
1454: --
1455: -- Get the parameter payroll_id, if this has been used.
1456: --
1457: -- Added for P45PT1. Bug 6345375
1472: RAISE test_indicator_error;
1473: END IF;
1474: END IF;
1475: --
1476: hr_utility.trace('Payroll_ID: '||to_char(l_payroll_id));
1477: -- Return Range Cursor
1478: -- Note: There must be one and only one entry of :payroll_action_id in
1479: -- the string, and the statement must be ordered by person_id
1480: --
1509: AND to_date('05/04/'||to_char(l_chk_start_date,'YYYY'),'dd/mm/yyyy'))
1510: AND (l_chk_end_date BETWEEN to_date('01/01/'||to_char(l_chk_start_date,'YYYY'),'dd/mm/yyyy')
1511: AND to_date('05/04/'||to_char(l_chk_start_date,'YYYY'),'dd/mm/yyyy')))
1512: THEN
1513: hr_utility.set_location('Start Date and End Date are in the same tax year ',6);
1514: ELSE
1515: fnd_file.put_line (fnd_file.LOG, 'The Start Date and the End Date must be within the tax year.');
1516: hr_utility.set_location('The Start Date and the End Date must be within the tax year.',8);
1517: RAISE p45_one_taxyear_error;
1512: THEN
1513: hr_utility.set_location('Start Date and End Date are in the same tax year ',6);
1514: ELSE
1515: fnd_file.put_line (fnd_file.LOG, 'The Start Date and the End Date must be within the tax year.');
1516: hr_utility.set_location('The Start Date and the End Date must be within the tax year.',8);
1517: RAISE p45_one_taxyear_error;
1518: END IF;
1519: END;
1520: -- End of BUG 5671777-11
1569: --
1570: END IF;
1571: CLOSE csr_employer_details;
1572: --
1573: hr_utility.set_location(l_proc,10);
1574: --
1575: --
1576: IF l_payroll_id is not null then
1577: -- Payroll ID has been used in param, restrict by this.
1574: --
1575: --
1576: IF l_payroll_id is not null then
1577: -- Payroll ID has been used in param, restrict by this.
1578: hr_utility.set_location(l_proc,20);
1579: sqlstr := 'select distinct paaf.person_id '||
1580: 'from pay_payroll_actions ppa, '||
1581: 'per_all_assignments_f paaf '||
1582: 'where ppa.payroll_action_id = :payroll_action_id '||
1585: ' order by paaf.person_id';
1586: --
1587: ELSE
1588: -- Normal range not restricting by payroll_id.
1589: hr_utility.set_location(l_proc,30);
1590: sqlstr := 'select distinct person_id '||
1591: 'from per_people_f ppf, '||
1592: 'pay_payroll_actions ppa '||
1593: 'where ppa.payroll_action_id = :payroll_action_id '||
1593: 'where ppa.payroll_action_id = :payroll_action_id '||
1594: 'and ppa.business_group_id = ppf.business_group_id '||
1595: 'order by ppf.person_id';
1596: END IF;
1597: hr_utility.set_location(' Leaving: '||l_proc,100);
1598: EXCEPTION
1599: --
1600: -- Start of BUG 5671777-11
1601: --
1620: sqlstr := 'select 1 '||
1621: '/* ERROR - Employer Details Fetch failed with: '||
1622: sqlerrm(sqlcode)||' */ '||
1623: 'from dual where to_char(:payroll_action_id) = dummy';
1624: hr_utility.set_location(' Leaving: '||l_proc,110);
1625: END range_cursor;
1626: ---------------------------------------------------------------------------
1627: -- Function: range_person_on.
1628: -- Description: Returns true if the range_person performance enhancement is
1649: l_action_param_val varchar2(30);
1650: l_report_param_val varchar2(30);
1651: --
1652: BEGIN
1653: hr_utility.set_location('range_person_on',10);
1654: --
1655: BEGIN
1656: open csr_action_parameter;
1657: fetch csr_action_parameter into l_action_param_val;
1656: open csr_action_parameter;
1657: fetch csr_action_parameter into l_action_param_val;
1658: close csr_action_parameter;
1659: --
1660: hr_utility.set_location('range_person_on',20);
1661: open csr_range_format_param(p_report_format);
1662: fetch csr_range_format_param into l_report_param_val;
1663: close csr_range_format_param;
1664: --
1661: open csr_range_format_param(p_report_format);
1662: fetch csr_range_format_param into l_report_param_val;
1663: close csr_range_format_param;
1664: --
1665: hr_utility.set_location('range_person_on',30);
1666: EXCEPTION WHEN NO_DATA_FOUND THEN
1667: l_return := FALSE;
1668: END;
1669: --
1666: EXCEPTION WHEN NO_DATA_FOUND THEN
1667: l_return := FALSE;
1668: END;
1669: --
1670: hr_utility.set_location('range_person_on',40);
1671: IF l_action_param_val = 'Y' AND l_report_param_val = 'Y' THEN
1672: l_return := TRUE;
1673: hr_utility.trace('Range Person = True');
1674: ELSE
1669: --
1670: hr_utility.set_location('range_person_on',40);
1671: IF l_action_param_val = 'Y' AND l_report_param_val = 'Y' THEN
1672: l_return := TRUE;
1673: hr_utility.trace('Range Person = True');
1674: ELSE
1675: l_return := FALSE;
1676: END IF;
1677: --
2272: --
2273: l_agg_start_date DATE;
2274: l_agg_end_date DATE;
2275: BEGIN
2276: hr_utility.set_location('Entering: '||l_proc,1);
2277: --
2278: IF NOT g_asg_creation_cache_populated THEN
2279: OPEN csr_user_entity('X_TAX_REF_TRANSFER');
2280: FETCH csr_user_entity INTO g_tax_ref_transfer_eid;
2310: ELSE
2311: l_range_person_on := 'NO';
2312: open csr_all_assignments;
2313: END IF;
2314: hr_utility.trace('Range person on: '||l_range_person_on);
2315: --
2316: -- Use First half of cursor where range_person not set,
2317: -- use second half for range_person on (performance enhancement)
2318: --
2328: end if;
2329: --
2330: --
2331: l_archive := TRUE;
2332: hr_utility.trace(to_char(rec_asg.assignment_id)||
2333: ' '||rec_asg.agg_paye_flag||' '||
2334: to_char(rec_asg.asg_end_date,'dd-mon-yyyy')||':');
2335: hr_utility.trace('----------------------------');
2336: --
2331: l_archive := TRUE;
2332: hr_utility.trace(to_char(rec_asg.assignment_id)||
2333: ' '||rec_asg.agg_paye_flag||' '||
2334: to_char(rec_asg.asg_end_date,'dd-mon-yyyy')||':');
2335: hr_utility.trace('----------------------------');
2336: --
2337: -- initialize the included asg table and index
2338: l_inc_asg_index := 0;
2339: l_inc_asg_tab := l_empty_asg_tab;
2350: l_non_p45_message := 'Future Active asg exists';
2351: l_archive := FALSE;
2352: -- This asg is to be excluded
2353: ELSE
2354: hr_utility.set_location(l_proc,5);
2355: IF rec_asg.agg_paye_flag = 'Y' then
2356: --
2357: -- Check current asg for existing p45 actions
2358: IF return_p45_issued_flag(rec_asg.assignment_id) = 'Y' then
2355: IF rec_asg.agg_paye_flag = 'Y' then
2356: --
2357: -- Check current asg for existing p45 actions
2358: IF return_p45_issued_flag(rec_asg.assignment_id) = 'Y' then
2359: hr_utility.set_location(l_proc,6);
2360: -- Cannot archive this assignment, set msg.
2361: l_non_p45_message := 'Agg: P45 exists';
2362: l_archive := FALSE;
2363: ELSE
2360: -- Cannot archive this assignment, set msg.
2361: l_non_p45_message := 'Agg: P45 exists';
2362: l_archive := FALSE;
2363: ELSE
2364: hr_utility.set_location(l_proc,7);
2365: -- 5144323: Get aggregation period start and end
2366: OPEN get_agg_start(rec_asg.person_id, rec_asg.asg_end_date);
2367: FETCH get_agg_start INTO l_agg_start_date;
2368: CLOSE get_agg_start;
2370: OPEN get_agg_end(rec_asg.person_id, rec_asg.asg_end_date);
2371: FETCH get_agg_end INTO l_agg_end_date;
2372: CLOSE get_agg_end;
2373: --
2374: hr_utility.trace('l_agg_start_date='||
2375: fnd_date.date_to_displaydate(l_agg_start_date)||
2376: ', l_agg_end_date='||
2377: fnd_date.date_to_displaydate(l_agg_end_date));
2378: --
2387: -- when P45 action is created
2388: l_inc_asg_index := l_inc_asg_index + 1;
2389: l_inc_asg_tab(l_inc_asg_index) := rec_all_aggs.assignment_id;
2390: --
2391: hr_utility.set_location(l_proc,10);
2392: IF rec_asg.asg_end_date < rec_all_aggs.effective_end_date THEN
2393: -- Asg exists that is not ended as of the effective end
2394: -- of the current assignment
2395: l_non_p45_message := 'Agg: asg exists not ended: '||
2397: -- Exclude main assignment, exit loop (performance)
2398: l_archive := FALSE;
2399: EXIT;
2400: ELSE
2401: hr_utility.set_location(l_proc,20);
2402: IF rec_asg.asg_end_date = rec_all_aggs.effective_end_date
2403: AND rec_asg.assignment_id > rec_all_aggs.assignment_id THEN
2404: -- Other lower Asg ID exists, and ending on the same date.
2405: -- Exclude this assignment exit loop
2406: l_non_p45_message := 'Agg: Lower asg ID, same end date exists';
2407: l_archive := FALSE;
2408: EXIT;
2409: ELSE
2410: hr_utility.set_location(l_proc,30);
2411: l_check_main_flag := true;
2412: --
2413: END IF; -- lower asg id
2414: END IF; -- existing later assignments
2429: END IF; -- archive flag check
2430: -- end bug fix for 5380921 --
2431: END IF; -- for current asg leaver check.
2432: ELSE -- Non Aggregated PAYE
2433: hr_utility.set_location(l_proc,35);
2434: IF return_P45_issued_flag(rec_asg.assignment_id) = 'Y' THEN
2435: hr_utility.set_location(l_proc,40);
2436: l_non_p45_message := 'Leaver action exists';
2437: l_archive := FALSE;
2431: END IF; -- for current asg leaver check.
2432: ELSE -- Non Aggregated PAYE
2433: hr_utility.set_location(l_proc,35);
2434: IF return_P45_issued_flag(rec_asg.assignment_id) = 'Y' THEN
2435: hr_utility.set_location(l_proc,40);
2436: l_non_p45_message := 'Leaver action exists';
2437: l_archive := FALSE;
2438: ELSE
2439: hr_utility.set_location(l_proc,50);
2435: hr_utility.set_location(l_proc,40);
2436: l_non_p45_message := 'Leaver action exists';
2437: l_archive := FALSE;
2438: ELSE
2439: hr_utility.set_location(l_proc,50);
2440: IF payment_made(rec_asg.assignment_id, rec_asg.asg_end_date,
2441: rec_asg.period_of_service_id) THEN
2442: -- Final Payment made.
2443: hr_utility.set_location(l_proc,60);
2439: hr_utility.set_location(l_proc,50);
2440: IF payment_made(rec_asg.assignment_id, rec_asg.asg_end_date,
2441: rec_asg.period_of_service_id) THEN
2442: -- Final Payment made.
2443: hr_utility.set_location(l_proc,60);
2444: l_archive := TRUE;
2445: ELSE
2446: -- Has there been an override that is before the p45
2447: -- run date but after the eff end of the asg.
2451: l_archive := FALSE;
2452: ELSIF l_override_date <= g_effective_date AND
2453: l_override_date >= rec_asg.asg_end_date THEN
2454: l_archive := TRUE;
2455: hr_utility.set_location(l_proc,65);
2456: ELSE
2457: l_non_p45_message := to_char(rec_asg.asg_end_date)||':'||
2458: to_char(l_override_date)||':'||
2459: to_char(g_effective_date);
2467: ELSE
2468: ---------------------------------------
2469: -- Tax Reference transfer
2470: ---------------------------------------
2471: hr_utility.set_location(l_proc,70);
2472: l_transfer_flag := 'Y';
2473: if p45_existing_action(p_assignment_id => rec_asg.assignment_id,
2474: p_period_of_service_id => rec_asg.period_of_service_id,
2475: p_mode => 'TRANSFER')
2477: l_non_p45_message := 'Transfer action exists';
2478: l_archive := FALSE;
2479: else
2480: IF rec_asg.agg_paye_flag = 'Y' then
2481: hr_utility.set_location(l_proc,80);
2482: for rec_all_aggs in csr_person_agg_asg(rec_asg.person_id, g_tax_ref,
2483: rec_asg.assignment_id, rec_asg.period_of_service_id,
2484: rec_asg.asg_end_date, hr_general.start_of_time,
2485: hr_general.end_of_time) loop
2491: -- Exclude main assignment, exit loop (performance)
2492: l_archive := FALSE;
2493: exit;
2494: else
2495: hr_utility.set_location(l_proc,90);
2496: if rec_asg.asg_end_date = rec_all_aggs.effective_end_date
2497: and rec_asg.assignment_id > rec_all_aggs.assignment_id
2498: then
2499: -- Other lower Asg ID exists, and ending on the same date.
2503: l_archive := FALSE;
2504: exit;
2505: else
2506: -- No reason to exclude this asg.
2507: hr_utility.set_location(l_proc,95);
2508: end if; -- Lower asg id
2509: end if; -- future active for this agg
2510: end loop; -- Aggregated loop
2511: ELSE
2509: end if; -- future active for this agg
2510: end loop; -- Aggregated loop
2511: ELSE
2512: -- Not aggregated and no existing action, so archive.
2513: hr_utility.set_location(l_proc,105);
2514: l_archive := TRUE;
2515: END IF; -- Agg asg
2516: end if; -- existing tfr action
2517: END IF; -- TRANSFER
2518: --------------------------------------------
2519: -- Archive the assignment if not excluded
2520: --------------------------------------------
2521: if l_archive = FALSE then
2522: hr_utility.trace('No P45 for '||to_char(rec_asg.assignment_id)||
2523: '. Reason:');
2524: hr_utility.trace(l_non_p45_message);
2525: fnd_file.put_line(fnd_file.log,
2526: rec_asg.assignment_number||': '|| l_non_p45_message);
2520: --------------------------------------------
2521: if l_archive = FALSE then
2522: hr_utility.trace('No P45 for '||to_char(rec_asg.assignment_id)||
2523: '. Reason:');
2524: hr_utility.trace(l_non_p45_message);
2525: fnd_file.put_line(fnd_file.log,
2526: rec_asg.assignment_number||': '|| l_non_p45_message);
2527: l_non_p45_message := null;
2528: else
2525: fnd_file.put_line(fnd_file.log,
2526: rec_asg.assignment_number||': '|| l_non_p45_message);
2527: l_non_p45_message := null;
2528: else
2529: hr_utility.set_location(l_proc,107);
2530: -- Final check for all, has latest asg action got NI Tax code
2531: -- NB Placing this check here at the end for performance reasons.
2532: -- Using regular payment date for final payment date.
2533: if NOT (tax_code_ni(rec_asg.assignment_id,rec_asg.regular_payment_date))
2531: -- NB Placing this check here at the end for performance reasons.
2532: -- Using regular payment date for final payment date.
2533: if NOT (tax_code_ni(rec_asg.assignment_id,rec_asg.regular_payment_date))
2534: then
2535: hr_utility.trace('ARCHIVING FOR '||to_char(rec_asg.assignment_id));
2536: SELECT pay_assignment_actions_s.nextval
2537: INTO l_actid
2538: FROM dual;
2539: --
2536: SELECT pay_assignment_actions_s.nextval
2537: INTO l_actid
2538: FROM dual;
2539: --
2540: hr_utility.set_location(l_proc,110);
2541: hr_nonrun_asact.insact(l_actid,rec_asg.assignment_id,
2542: pactid,chunk,NULL);
2543: --
2544: hr_utility.set_location(l_proc,120);
2540: hr_utility.set_location(l_proc,110);
2541: hr_nonrun_asact.insact(l_actid,rec_asg.assignment_id,
2542: pactid,chunk,NULL);
2543: --
2544: hr_utility.set_location(l_proc,120);
2545: -- Archive the tax ref transfer flag and the Asg end date.
2546: --
2547: ff_archive_api.create_archive_item
2548: (p_archive_item_id => l_archive_item_id,
2564: p_object_version_number => l_ovn,
2565: p_some_warning => l_some_warning);
2566: --
2567: FOR l_count IN 1..l_inc_asg_index LOOP
2568: hr_utility.set_location(l_proc,125);
2569: hr_utility.trace('Including asg id='||l_inc_asg_tab(l_count));
2570: ff_archive_api.create_archive_item
2571: (p_archive_item_id => l_archive_item_id,
2572: p_user_entity_id => g_p45_inc_assignment,
2565: p_some_warning => l_some_warning);
2566: --
2567: FOR l_count IN 1..l_inc_asg_index LOOP
2568: hr_utility.set_location(l_proc,125);
2569: hr_utility.trace('Including asg id='||l_inc_asg_tab(l_count));
2570: ff_archive_api.create_archive_item
2571: (p_archive_item_id => l_archive_item_id,
2572: p_user_entity_id => g_p45_inc_assignment,
2573: p_archive_value => l_inc_asg_tab(l_count),
2577: p_object_version_number => l_ovn,
2578: p_some_warning => l_some_warning);
2579: END LOOP;
2580: else
2581: hr_utility.set_location(l_proc,130);
2582: hr_utility.trace('No P45 for '||to_char(rec_asg.assignment_id)||
2583: '. Tax Code = NI');
2584: fnd_file.put_line(fnd_file.log,
2585: rec_asg.assignment_number||': Tax Code = NI');
2578: p_some_warning => l_some_warning);
2579: END LOOP;
2580: else
2581: hr_utility.set_location(l_proc,130);
2582: hr_utility.trace('No P45 for '||to_char(rec_asg.assignment_id)||
2583: '. Tax Code = NI');
2584: fnd_file.put_line(fnd_file.log,
2585: rec_asg.assignment_number||': Tax Code = NI');
2586: end if; -- NI Tax Code
2595: close csr_all_assignments;
2596: end if;
2597: END IF;
2598: --
2599: hr_utility.set_location(' Leaving: '||l_proc,999);
2600:
2601: END arch_act_creation;
2602:
2603: ---------------------------------------------------------------------------
2626: FROM pay_payroll_actions
2627: WHERE payroll_action_id = p_payroll_action_id;
2628: --
2629: BEGIN
2630: hr_utility.set_location('Entering: '||l_proc,1);
2631: IF NOT g_asg_process_cache_populated THEN
2632: -- does session date need to be set?
2633: -- fnd_sessions used in cursor employer_addr (only when asg terminated
2634: -- with null last std proc date).
2753: AND effective_end_date;
2754: --
2755: g_asg_process_cache_populated := true;
2756: END IF; -- NOT g_asg_process_cache_populated
2757: hr_utility.set_location(' Leaving: '||l_proc,999);
2758: END archinit;
2759: --
2760: PROCEDURE archive_code(p_assactid IN NUMBER, p_effective_date IN DATE)
2761: IS
2971: p_value VARCHAR2) IS
2972: l_proc CONSTANT VARCHAR2(40):= g_package||'archive_asg_info';
2973: BEGIN
2974: IF p_value IS NOT NULL THEN
2975: hr_utility.set_location(l_proc||' '||p_user_entity_id,10);
2976: ff_archive_api.create_archive_item
2977: (p_archive_item_id => l_archive_item_id,
2978: p_user_entity_id => p_user_entity_id,
2979: p_archive_value => p_value,
2984: END IF;
2985: END archive_asg_info;
2986: --
2987: BEGIN
2988: --hr_utility.trace_on(null,'KT');
2989: hr_utility.set_location('Entering: '||l_proc,1);
2990: hr_utility.trace('Assact ID : ' || p_assactid);
2991: -- Get the AAC level info.
2992: OPEN csr_asg_act_info(p_assactid);
2985: END archive_asg_info;
2986: --
2987: BEGIN
2988: --hr_utility.trace_on(null,'KT');
2989: hr_utility.set_location('Entering: '||l_proc,1);
2990: hr_utility.trace('Assact ID : ' || p_assactid);
2991: -- Get the AAC level info.
2992: OPEN csr_asg_act_info(p_assactid);
2993: FETCH csr_asg_act_info INTO l_assignment_id,
2986: --
2987: BEGIN
2988: --hr_utility.trace_on(null,'KT');
2989: hr_utility.set_location('Entering: '||l_proc,1);
2990: hr_utility.trace('Assact ID : ' || p_assactid);
2991: -- Get the AAC level info.
2992: OPEN csr_asg_act_info(p_assactid);
2993: FETCH csr_asg_act_info INTO l_assignment_id,
2994: l_termination_date,
3013: l_date_of_birth,
3014: l_sex;
3015: CLOSE csr_basic_asg_info;
3016: --
3017: hr_utility.trace('FP Date: ' ||to_char(l_final_process_date));
3018: hr_utility.trace('Term Date: ' || to_char(l_termination_date));
3019: hr_utility.trace('LSP Date: ' || to_char(l_lsp_date));
3020: -- transfer date used in selection of last assignment action
3021: IF l_tax_ref_transfer = 'Y' then
3014: l_sex;
3015: CLOSE csr_basic_asg_info;
3016: --
3017: hr_utility.trace('FP Date: ' ||to_char(l_final_process_date));
3018: hr_utility.trace('Term Date: ' || to_char(l_termination_date));
3019: hr_utility.trace('LSP Date: ' || to_char(l_lsp_date));
3020: -- transfer date used in selection of last assignment action
3021: IF l_tax_ref_transfer = 'Y' then
3022: l_transfer_date := l_termination_date;
3015: CLOSE csr_basic_asg_info;
3016: --
3017: hr_utility.trace('FP Date: ' ||to_char(l_final_process_date));
3018: hr_utility.trace('Term Date: ' || to_char(l_termination_date));
3019: hr_utility.trace('LSP Date: ' || to_char(l_lsp_date));
3020: -- transfer date used in selection of last assignment action
3021: IF l_tax_ref_transfer = 'Y' then
3022: l_transfer_date := l_termination_date;
3023: ELSE
3026: -- should be no time limit hence transfer date is set to end of time
3027: l_transfer_date := hr_general.end_of_time;
3028: END IF;
3029: --
3030: hr_utility.trace(l_last_name||' '||to_char(l_asg_effective_end_date)||
3031: to_char(l_assignment_id)||' '||to_char(l_termination_date)||
3032: ' '||l_tax_ref_transfer||' '||to_char(p_effective_date)||
3033: ' '||to_char(l_transfer_date));
3034: hr_utility.trace('--------------------------------------');
3030: hr_utility.trace(l_last_name||' '||to_char(l_asg_effective_end_date)||
3031: to_char(l_assignment_id)||' '||to_char(l_termination_date)||
3032: ' '||l_tax_ref_transfer||' '||to_char(p_effective_date)||
3033: ' '||to_char(l_transfer_date));
3034: hr_utility.trace('--------------------------------------');
3035: IF g_do_edi_validation THEN
3036: IF pay_gb_eoy_magtape.validate_input(upper(l_assignment_number),
3037: 'FULL_EDI') > 0 THEN
3038: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3034: hr_utility.trace('--------------------------------------');
3035: IF g_do_edi_validation THEN
3036: IF pay_gb_eoy_magtape.validate_input(upper(l_assignment_number),
3037: 'FULL_EDI') > 0 THEN
3038: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3039: hr_utility.set_message_token('ITEM_NAME', 'Assignment Number');
3040: hr_utility.raise_error;
3041: END IF;
3042: IF pay_gb_eoy_magtape.validate_input(l_last_name,
3035: IF g_do_edi_validation THEN
3036: IF pay_gb_eoy_magtape.validate_input(upper(l_assignment_number),
3037: 'FULL_EDI') > 0 THEN
3038: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3039: hr_utility.set_message_token('ITEM_NAME', 'Assignment Number');
3040: hr_utility.raise_error;
3041: END IF;
3042: IF pay_gb_eoy_magtape.validate_input(l_last_name,
3043: 'EDI_SURNAME') > 0 THEN
3036: IF pay_gb_eoy_magtape.validate_input(upper(l_assignment_number),
3037: 'FULL_EDI') > 0 THEN
3038: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3039: hr_utility.set_message_token('ITEM_NAME', 'Assignment Number');
3040: hr_utility.raise_error;
3041: END IF;
3042: IF pay_gb_eoy_magtape.validate_input(l_last_name,
3043: 'EDI_SURNAME') > 0 THEN
3044: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3040: hr_utility.raise_error;
3041: END IF;
3042: IF pay_gb_eoy_magtape.validate_input(l_last_name,
3043: 'EDI_SURNAME') > 0 THEN
3044: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3045: hr_utility.set_message_token('ITEM_NAME', 'Surname');
3046: hr_utility.raise_error;
3047: END IF;
3048: IF pay_gb_eoy_magtape.validate_input(l_first_name,
3041: END IF;
3042: IF pay_gb_eoy_magtape.validate_input(l_last_name,
3043: 'EDI_SURNAME') > 0 THEN
3044: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3045: hr_utility.set_message_token('ITEM_NAME', 'Surname');
3046: hr_utility.raise_error;
3047: END IF;
3048: IF pay_gb_eoy_magtape.validate_input(l_first_name,
3049: 'EDI_SURNAME') > 0 THEN
3042: IF pay_gb_eoy_magtape.validate_input(l_last_name,
3043: 'EDI_SURNAME') > 0 THEN
3044: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3045: hr_utility.set_message_token('ITEM_NAME', 'Surname');
3046: hr_utility.raise_error;
3047: END IF;
3048: IF pay_gb_eoy_magtape.validate_input(l_first_name,
3049: 'EDI_SURNAME') > 0 THEN
3050: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3046: hr_utility.raise_error;
3047: END IF;
3048: IF pay_gb_eoy_magtape.validate_input(l_first_name,
3049: 'EDI_SURNAME') > 0 THEN
3050: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3051: hr_utility.set_message_token('ITEM_NAME', 'Forename');
3052: hr_utility.raise_error;
3053: END IF;
3054: IF pay_gb_eoy_magtape.validate_input(l_ni_number,
3047: END IF;
3048: IF pay_gb_eoy_magtape.validate_input(l_first_name,
3049: 'EDI_SURNAME') > 0 THEN
3050: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3051: hr_utility.set_message_token('ITEM_NAME', 'Forename');
3052: hr_utility.raise_error;
3053: END IF;
3054: IF pay_gb_eoy_magtape.validate_input(l_ni_number,
3055: 'FULL_EDI') > 0 THEN
3048: IF pay_gb_eoy_magtape.validate_input(l_first_name,
3049: 'EDI_SURNAME') > 0 THEN
3050: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3051: hr_utility.set_message_token('ITEM_NAME', 'Forename');
3052: hr_utility.raise_error;
3053: END IF;
3054: IF pay_gb_eoy_magtape.validate_input(l_ni_number,
3055: 'FULL_EDI') > 0 THEN
3056: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3052: hr_utility.raise_error;
3053: END IF;
3054: IF pay_gb_eoy_magtape.validate_input(l_ni_number,
3055: 'FULL_EDI') > 0 THEN
3056: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3057: hr_utility.set_message_token('ITEM_NAME', 'NI Number');
3058: hr_utility.raise_error;
3059: END IF;
3060: END IF;
3053: END IF;
3054: IF pay_gb_eoy_magtape.validate_input(l_ni_number,
3055: 'FULL_EDI') > 0 THEN
3056: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3057: hr_utility.set_message_token('ITEM_NAME', 'NI Number');
3058: hr_utility.raise_error;
3059: END IF;
3060: END IF;
3061: --
3054: IF pay_gb_eoy_magtape.validate_input(l_ni_number,
3055: 'FULL_EDI') > 0 THEN
3056: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3057: hr_utility.set_message_token('ITEM_NAME', 'NI Number');
3058: hr_utility.raise_error;
3059: END IF;
3060: END IF;
3061: --
3062: hr_utility.set_location(l_proc,10);
3058: hr_utility.raise_error;
3059: END IF;
3060: END IF;
3061: --
3062: hr_utility.set_location(l_proc,10);
3063: -- Archive info obtained so far
3064: archive_asg_info(g_assignment_number_eid, l_assignment_number);
3065: archive_asg_info(g_deceased_flag_eid, l_deceased_flag);
3066: archive_asg_info(g_aggregated_paye_flag_eid, l_agg_paye_flag);
3097: X_DATE_EARNED => l_date_earned,
3098: X_PAYROLL_ACTION_ID => l_last_pay_action_id,
3099: X_TRANSFER_DATE => l_transfer_date);
3100: --
3101: hr_utility.trace('Last asg action: '||to_char(l_last_asg_action_id));
3102: hr_utility.trace('Date earned : ' || to_char(l_date_earned));
3103: --
3104: IF g_do_edi_validation THEN
3105: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line1),
3098: X_PAYROLL_ACTION_ID => l_last_pay_action_id,
3099: X_TRANSFER_DATE => l_transfer_date);
3100: --
3101: hr_utility.trace('Last asg action: '||to_char(l_last_asg_action_id));
3102: hr_utility.trace('Date earned : ' || to_char(l_date_earned));
3103: --
3104: IF g_do_edi_validation THEN
3105: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line1),
3106: 'EDI_SURNAME') > 0 THEN
3103: --
3104: IF g_do_edi_validation THEN
3105: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line1),
3106: 'EDI_SURNAME') > 0 THEN
3107: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3108: hr_utility.set_message_token('ITEM_NAME', 'Address Line 1');
3109: hr_utility.raise_error;
3110: END IF;
3111: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line2),
3104: IF g_do_edi_validation THEN
3105: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line1),
3106: 'EDI_SURNAME') > 0 THEN
3107: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3108: hr_utility.set_message_token('ITEM_NAME', 'Address Line 1');
3109: hr_utility.raise_error;
3110: END IF;
3111: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line2),
3112: 'EDI_SURNAME') > 0 THEN
3105: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line1),
3106: 'EDI_SURNAME') > 0 THEN
3107: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3108: hr_utility.set_message_token('ITEM_NAME', 'Address Line 1');
3109: hr_utility.raise_error;
3110: END IF;
3111: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line2),
3112: 'EDI_SURNAME') > 0 THEN
3113: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3109: hr_utility.raise_error;
3110: END IF;
3111: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line2),
3112: 'EDI_SURNAME') > 0 THEN
3113: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3114: hr_utility.set_message_token('ITEM_NAME', 'Address Line 2');
3115: hr_utility.raise_error;
3116: END IF;
3117: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line3),
3110: END IF;
3111: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line2),
3112: 'EDI_SURNAME') > 0 THEN
3113: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3114: hr_utility.set_message_token('ITEM_NAME', 'Address Line 2');
3115: hr_utility.raise_error;
3116: END IF;
3117: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line3),
3118: 'EDI_SURNAME') > 0 THEN
3111: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line2),
3112: 'EDI_SURNAME') > 0 THEN
3113: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3114: hr_utility.set_message_token('ITEM_NAME', 'Address Line 2');
3115: hr_utility.raise_error;
3116: END IF;
3117: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line3),
3118: 'EDI_SURNAME') > 0 THEN
3119: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3115: hr_utility.raise_error;
3116: END IF;
3117: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line3),
3118: 'EDI_SURNAME') > 0 THEN
3119: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3120: hr_utility.set_message_token('ITEM_NAME', 'Address Line 3');
3121: hr_utility.raise_error;
3122: END IF;
3123: IF pay_gb_eoy_magtape.validate_input(upper(l_town_or_city),
3116: END IF;
3117: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line3),
3118: 'EDI_SURNAME') > 0 THEN
3119: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3120: hr_utility.set_message_token('ITEM_NAME', 'Address Line 3');
3121: hr_utility.raise_error;
3122: END IF;
3123: IF pay_gb_eoy_magtape.validate_input(upper(l_town_or_city),
3124: 'FULL_EDI') > 0 THEN
3117: IF pay_gb_eoy_magtape.validate_input(upper(l_address_line3),
3118: 'EDI_SURNAME') > 0 THEN
3119: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3120: hr_utility.set_message_token('ITEM_NAME', 'Address Line 3');
3121: hr_utility.raise_error;
3122: END IF;
3123: IF pay_gb_eoy_magtape.validate_input(upper(l_town_or_city),
3124: 'FULL_EDI') > 0 THEN
3125: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3121: hr_utility.raise_error;
3122: END IF;
3123: IF pay_gb_eoy_magtape.validate_input(upper(l_town_or_city),
3124: 'FULL_EDI') > 0 THEN
3125: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3126: hr_utility.set_message_token('ITEM_NAME', 'Town or City');
3127: hr_utility.raise_error;
3128: END IF;
3129: IF pay_gb_eoy_magtape.validate_input(upper(l_county),
3122: END IF;
3123: IF pay_gb_eoy_magtape.validate_input(upper(l_town_or_city),
3124: 'FULL_EDI') > 0 THEN
3125: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3126: hr_utility.set_message_token('ITEM_NAME', 'Town or City');
3127: hr_utility.raise_error;
3128: END IF;
3129: IF pay_gb_eoy_magtape.validate_input(upper(l_county),
3130: 'FULL_EDI') > 0 THEN
3123: IF pay_gb_eoy_magtape.validate_input(upper(l_town_or_city),
3124: 'FULL_EDI') > 0 THEN
3125: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3126: hr_utility.set_message_token('ITEM_NAME', 'Town or City');
3127: hr_utility.raise_error;
3128: END IF;
3129: IF pay_gb_eoy_magtape.validate_input(upper(l_county),
3130: 'FULL_EDI') > 0 THEN
3131: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3127: hr_utility.raise_error;
3128: END IF;
3129: IF pay_gb_eoy_magtape.validate_input(upper(l_county),
3130: 'FULL_EDI') > 0 THEN
3131: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3132: hr_utility.set_message_token('ITEM_NAME', 'County');
3133: hr_utility.raise_error;
3134: END IF;
3135: IF pay_gb_eoy_magtape.validate_input(l_postal_code,
3128: END IF;
3129: IF pay_gb_eoy_magtape.validate_input(upper(l_county),
3130: 'FULL_EDI') > 0 THEN
3131: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3132: hr_utility.set_message_token('ITEM_NAME', 'County');
3133: hr_utility.raise_error;
3134: END IF;
3135: IF pay_gb_eoy_magtape.validate_input(l_postal_code,
3136: 'FULL_EDI') > 0 THEN
3129: IF pay_gb_eoy_magtape.validate_input(upper(l_county),
3130: 'FULL_EDI') > 0 THEN
3131: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3132: hr_utility.set_message_token('ITEM_NAME', 'County');
3133: hr_utility.raise_error;
3134: END IF;
3135: IF pay_gb_eoy_magtape.validate_input(l_postal_code,
3136: 'FULL_EDI') > 0 THEN
3137: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3133: hr_utility.raise_error;
3134: END IF;
3135: IF pay_gb_eoy_magtape.validate_input(l_postal_code,
3136: 'FULL_EDI') > 0 THEN
3137: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3138: hr_utility.set_message_token('ITEM_NAME', 'Postcode');
3139: hr_utility.raise_error;
3140: END IF;
3141: END IF;
3134: END IF;
3135: IF pay_gb_eoy_magtape.validate_input(l_postal_code,
3136: 'FULL_EDI') > 0 THEN
3137: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3138: hr_utility.set_message_token('ITEM_NAME', 'Postcode');
3139: hr_utility.raise_error;
3140: END IF;
3141: END IF;
3142: -- Archive info obtained so far
3135: IF pay_gb_eoy_magtape.validate_input(l_postal_code,
3136: 'FULL_EDI') > 0 THEN
3137: hr_utility.set_message(801, 'PAY_78037_EDI_ILLEGAL_CHARS');
3138: hr_utility.set_message_token('ITEM_NAME', 'Postcode');
3139: hr_utility.raise_error;
3140: END IF;
3141: END IF;
3142: -- Archive info obtained so far
3143: archive_asg_info(g_p45_final_action, l_last_asg_action_id);
3161: IF l_last_asg_action_id = -9999 THEN
3162: OPEN csr_get_term_period_no(l_termination_date, l_payroll_id);
3163: FETCH csr_get_term_period_no INTO l_period_no;
3164: CLOSE csr_get_term_period_no;
3165: hr_utility.trace('After csr_get_term_period_no, l_termination_date='||fnd_date.date_to_displaydate(l_termination_date));
3166: hr_utility.trace('l_payroll_id='||l_payroll_id);
3167: hr_utility.trace('l_period_no='||l_period_no);
3168: ELSE
3169: OPEN csr_period_number(l_last_pay_action_id);
3162: OPEN csr_get_term_period_no(l_termination_date, l_payroll_id);
3163: FETCH csr_get_term_period_no INTO l_period_no;
3164: CLOSE csr_get_term_period_no;
3165: hr_utility.trace('After csr_get_term_period_no, l_termination_date='||fnd_date.date_to_displaydate(l_termination_date));
3166: hr_utility.trace('l_payroll_id='||l_payroll_id);
3167: hr_utility.trace('l_period_no='||l_period_no);
3168: ELSE
3169: OPEN csr_period_number(l_last_pay_action_id);
3170: FETCH csr_period_number INTO l_period_no;
3163: FETCH csr_get_term_period_no INTO l_period_no;
3164: CLOSE csr_get_term_period_no;
3165: hr_utility.trace('After csr_get_term_period_no, l_termination_date='||fnd_date.date_to_displaydate(l_termination_date));
3166: hr_utility.trace('l_payroll_id='||l_payroll_id);
3167: hr_utility.trace('l_period_no='||l_period_no);
3168: ELSE
3169: OPEN csr_period_number(l_last_pay_action_id);
3170: FETCH csr_period_number INTO l_period_no;
3171: CLOSE csr_period_number;
3168: ELSE
3169: OPEN csr_period_number(l_last_pay_action_id);
3170: FETCH csr_period_number INTO l_period_no;
3171: CLOSE csr_period_number;
3172: hr_utility.trace('After csr_period_number, l_last_pay_action_id='||l_last_pay_action_id);
3173: hr_utility.trace('l_period_no='||l_period_no);
3174: END IF;
3175: --
3176: -- Get element id for PAYE element
3169: OPEN csr_period_number(l_last_pay_action_id);
3170: FETCH csr_period_number INTO l_period_no;
3171: CLOSE csr_period_number;
3172: hr_utility.trace('After csr_period_number, l_last_pay_action_id='||l_last_pay_action_id);
3173: hr_utility.trace('l_period_no='||l_period_no);
3174: END IF;
3175: --
3176: -- Get element id for PAYE element
3177: OPEN csr_paye_element;
3178: FETCH csr_paye_element INTO l_paye_element_id;
3179: CLOSE csr_paye_element;
3180:
3181: -- BEGIN BUG FIX FOR 4595939 --
3182: hr_utility.trace('Date earned : ' || l_date_earned);
3183: hr_utility.trace('Final Process date : ' || l_final_process_date);
3184:
3185: if l_date_earned = sysdate then
3186: l_eff_date := l_final_process_date;
3179: CLOSE csr_paye_element;
3180:
3181: -- BEGIN BUG FIX FOR 4595939 --
3182: hr_utility.trace('Date earned : ' || l_date_earned);
3183: hr_utility.trace('Final Process date : ' || l_final_process_date);
3184:
3185: if l_date_earned = sysdate then
3186: l_eff_date := l_final_process_date;
3187: else
3231: FETCH csr_max_run_result INTO l_max_run_result_id;
3232: CLOSE csr_max_run_result;
3233: -- if max run result found then get values from run result values else look at element entries
3234: IF l_max_run_result_id is not null THEN
3235: hr_utility.trace('Max run result found : ' || l_max_run_result_id);
3236: OPEN csr_result_value(l_tax_code_ipv_id);
3237: FETCH csr_result_value INTO l_tax_code_t;
3238: CLOSE csr_result_value;
3239: l_tax_code := nvl(l_tax_code_t, l_tax_code);
3256: END IF;
3257: */
3258: /*
3259: ELSE
3260: hr_utility.trace('Max run resuls not found');
3261: OPEN csr_paye_details(l_assignment_id,l_date_earned);
3262: FETCH csr_paye_details INTO l_tax_code,
3263: l_tax_basis,
3264: l_prev_pay_char,
3266: CLOSE csr_paye_details;
3267: END IF;
3268: */
3269: -- END;
3270: hr_utility.trace('tax code: '||l_tax_code||' '||l_tax_basis);
3271: --
3272: -- Get Balance items.
3273: -- Nb. parameter names of the following procedure are inconsistent with
3274: -- the actual values returned.
3280: --
3281: IF g_do_edi_validation THEN
3282: IF l_tax_basis = 'N' THEN
3283: IF l_taxable > 999999.99 THEN
3284: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3285: hr_utility.set_message_token('ITEM_NAME', 'Pay in this Employment');
3286: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3287: hr_utility.raise_error;
3288: END IF;
3281: IF g_do_edi_validation THEN
3282: IF l_tax_basis = 'N' THEN
3283: IF l_taxable > 999999.99 THEN
3284: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3285: hr_utility.set_message_token('ITEM_NAME', 'Pay in this Employment');
3286: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3287: hr_utility.raise_error;
3288: END IF;
3289: IF l_paye > 999999.99 THEN
3282: IF l_tax_basis = 'N' THEN
3283: IF l_taxable > 999999.99 THEN
3284: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3285: hr_utility.set_message_token('ITEM_NAME', 'Pay in this Employment');
3286: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3287: hr_utility.raise_error;
3288: END IF;
3289: IF l_paye > 999999.99 THEN
3290: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3283: IF l_taxable > 999999.99 THEN
3284: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3285: hr_utility.set_message_token('ITEM_NAME', 'Pay in this Employment');
3286: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3287: hr_utility.raise_error;
3288: END IF;
3289: IF l_paye > 999999.99 THEN
3290: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3291: hr_utility.set_message_token('ITEM_NAME', 'Tax in this Employment');
3286: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3287: hr_utility.raise_error;
3288: END IF;
3289: IF l_paye > 999999.99 THEN
3290: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3291: hr_utility.set_message_token('ITEM_NAME', 'Tax in this Employment');
3292: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3293: hr_utility.raise_error;
3294: END IF;
3287: hr_utility.raise_error;
3288: END IF;
3289: IF l_paye > 999999.99 THEN
3290: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3291: hr_utility.set_message_token('ITEM_NAME', 'Tax in this Employment');
3292: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3293: hr_utility.raise_error;
3294: END IF;
3295: ELSE
3288: END IF;
3289: IF l_paye > 999999.99 THEN
3290: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3291: hr_utility.set_message_token('ITEM_NAME', 'Tax in this Employment');
3292: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3293: hr_utility.raise_error;
3294: END IF;
3295: ELSE
3296: IF nvl(l_taxable,0) + nvl(to_number(l_prev_pay_char),0) > 999999.99
3289: IF l_paye > 999999.99 THEN
3290: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3291: hr_utility.set_message_token('ITEM_NAME', 'Tax in this Employment');
3292: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3293: hr_utility.raise_error;
3294: END IF;
3295: ELSE
3296: IF nvl(l_taxable,0) + nvl(to_number(l_prev_pay_char),0) > 999999.99
3297: THEN
3294: END IF;
3295: ELSE
3296: IF nvl(l_taxable,0) + nvl(to_number(l_prev_pay_char),0) > 999999.99
3297: THEN
3298: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3299: hr_utility.set_message_token('ITEM_NAME', 'Total pay to date');
3300: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3301: hr_utility.raise_error;
3302: END IF;
3295: ELSE
3296: IF nvl(l_taxable,0) + nvl(to_number(l_prev_pay_char),0) > 999999.99
3297: THEN
3298: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3299: hr_utility.set_message_token('ITEM_NAME', 'Total pay to date');
3300: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3301: hr_utility.raise_error;
3302: END IF;
3303: IF nvl(l_paye,0) + nvl(to_number(l_prev_tax_char),0) > 999999.99 THEN
3296: IF nvl(l_taxable,0) + nvl(to_number(l_prev_pay_char),0) > 999999.99
3297: THEN
3298: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3299: hr_utility.set_message_token('ITEM_NAME', 'Total pay to date');
3300: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3301: hr_utility.raise_error;
3302: END IF;
3303: IF nvl(l_paye,0) + nvl(to_number(l_prev_tax_char),0) > 999999.99 THEN
3304: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3297: THEN
3298: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3299: hr_utility.set_message_token('ITEM_NAME', 'Total pay to date');
3300: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3301: hr_utility.raise_error;
3302: END IF;
3303: IF nvl(l_paye,0) + nvl(to_number(l_prev_tax_char),0) > 999999.99 THEN
3304: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3305: hr_utility.set_message_token('ITEM_NAME', 'Total tax to date');
3300: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3301: hr_utility.raise_error;
3302: END IF;
3303: IF nvl(l_paye,0) + nvl(to_number(l_prev_tax_char),0) > 999999.99 THEN
3304: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3305: hr_utility.set_message_token('ITEM_NAME', 'Total tax to date');
3306: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3307: hr_utility.raise_error;
3308: END IF;
3301: hr_utility.raise_error;
3302: END IF;
3303: IF nvl(l_paye,0) + nvl(to_number(l_prev_tax_char),0) > 999999.99 THEN
3304: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3305: hr_utility.set_message_token('ITEM_NAME', 'Total tax to date');
3306: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3307: hr_utility.raise_error;
3308: END IF;
3309: END IF; -- l_tax_basis = 'N'
3302: END IF;
3303: IF nvl(l_paye,0) + nvl(to_number(l_prev_tax_char),0) > 999999.99 THEN
3304: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3305: hr_utility.set_message_token('ITEM_NAME', 'Total tax to date');
3306: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3307: hr_utility.raise_error;
3308: END IF;
3309: END IF; -- l_tax_basis = 'N'
3310: IF l_address_line1 IS NULL THEN
3303: IF nvl(l_paye,0) + nvl(to_number(l_prev_tax_char),0) > 999999.99 THEN
3304: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3305: hr_utility.set_message_token('ITEM_NAME', 'Total tax to date');
3306: hr_utility.set_message_token('MAX_VALUE', '999999.99');
3307: hr_utility.raise_error;
3308: END IF;
3309: END IF; -- l_tax_basis = 'N'
3310: IF l_address_line1 IS NULL THEN
3311: hr_utility.set_message(801, 'PAY_GB_MISSING_VALUE');
3307: hr_utility.raise_error;
3308: END IF;
3309: END IF; -- l_tax_basis = 'N'
3310: IF l_address_line1 IS NULL THEN
3311: hr_utility.set_message(801, 'PAY_GB_MISSING_VALUE');
3312: hr_utility.set_message_token('ITEM_NAME', 'Address');
3313: hr_utility.raise_error;
3314: END IF;
3315: IF l_tax_code IS NULL THEN
3308: END IF;
3309: END IF; -- l_tax_basis = 'N'
3310: IF l_address_line1 IS NULL THEN
3311: hr_utility.set_message(801, 'PAY_GB_MISSING_VALUE');
3312: hr_utility.set_message_token('ITEM_NAME', 'Address');
3313: hr_utility.raise_error;
3314: END IF;
3315: IF l_tax_code IS NULL THEN
3316: hr_utility.set_message(801, 'PAY_GB_MISSING_VALUE');
3309: END IF; -- l_tax_basis = 'N'
3310: IF l_address_line1 IS NULL THEN
3311: hr_utility.set_message(801, 'PAY_GB_MISSING_VALUE');
3312: hr_utility.set_message_token('ITEM_NAME', 'Address');
3313: hr_utility.raise_error;
3314: END IF;
3315: IF l_tax_code IS NULL THEN
3316: hr_utility.set_message(801, 'PAY_GB_MISSING_VALUE');
3317: hr_utility.set_message_token('ITEM_NAME', 'Tax Code');
3312: hr_utility.set_message_token('ITEM_NAME', 'Address');
3313: hr_utility.raise_error;
3314: END IF;
3315: IF l_tax_code IS NULL THEN
3316: hr_utility.set_message(801, 'PAY_GB_MISSING_VALUE');
3317: hr_utility.set_message_token('ITEM_NAME', 'Tax Code');
3318: hr_utility.raise_error;
3319: ELSIF length(ltrim(l_tax_code,'S')) > 6 THEN
3320: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3313: hr_utility.raise_error;
3314: END IF;
3315: IF l_tax_code IS NULL THEN
3316: hr_utility.set_message(801, 'PAY_GB_MISSING_VALUE');
3317: hr_utility.set_message_token('ITEM_NAME', 'Tax Code');
3318: hr_utility.raise_error;
3319: ELSIF length(ltrim(l_tax_code,'S')) > 6 THEN
3320: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3321: hr_utility.set_message_token('ITEM_NAME', 'Tax Code length');
3314: END IF;
3315: IF l_tax_code IS NULL THEN
3316: hr_utility.set_message(801, 'PAY_GB_MISSING_VALUE');
3317: hr_utility.set_message_token('ITEM_NAME', 'Tax Code');
3318: hr_utility.raise_error;
3319: ELSIF length(ltrim(l_tax_code,'S')) > 6 THEN
3320: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3321: hr_utility.set_message_token('ITEM_NAME', 'Tax Code length');
3322: hr_utility.set_message_token('MAX_VALUE', '6 characters');
3316: hr_utility.set_message(801, 'PAY_GB_MISSING_VALUE');
3317: hr_utility.set_message_token('ITEM_NAME', 'Tax Code');
3318: hr_utility.raise_error;
3319: ELSIF length(ltrim(l_tax_code,'S')) > 6 THEN
3320: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3321: hr_utility.set_message_token('ITEM_NAME', 'Tax Code length');
3322: hr_utility.set_message_token('MAX_VALUE', '6 characters');
3323: hr_utility.raise_error;
3324: END IF;
3317: hr_utility.set_message_token('ITEM_NAME', 'Tax Code');
3318: hr_utility.raise_error;
3319: ELSIF length(ltrim(l_tax_code,'S')) > 6 THEN
3320: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3321: hr_utility.set_message_token('ITEM_NAME', 'Tax Code length');
3322: hr_utility.set_message_token('MAX_VALUE', '6 characters');
3323: hr_utility.raise_error;
3324: END IF;
3325: END IF; -- g_do_edi_validation
3318: hr_utility.raise_error;
3319: ELSIF length(ltrim(l_tax_code,'S')) > 6 THEN
3320: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3321: hr_utility.set_message_token('ITEM_NAME', 'Tax Code length');
3322: hr_utility.set_message_token('MAX_VALUE', '6 characters');
3323: hr_utility.raise_error;
3324: END IF;
3325: END IF; -- g_do_edi_validation
3326: -- Check Whether it is Week or Month
3319: ELSIF length(ltrim(l_tax_code,'S')) > 6 THEN
3320: hr_utility.set_message(801, 'PAY_78034_VALUE_EXCEEDS_MAX');
3321: hr_utility.set_message_token('ITEM_NAME', 'Tax Code length');
3322: hr_utility.set_message_token('MAX_VALUE', '6 characters');
3323: hr_utility.raise_error;
3324: END IF;
3325: END IF; -- g_do_edi_validation
3326: -- Check Whether it is Week or Month
3327: OPEN csr_week_or_month(l_last_pay_action_id);
3345: fnd_number.number_to_canonical(l_taxable));
3346: archive_asg_info(g_tax_paid_eid,
3347: fnd_number.number_to_canonical(l_paye));
3348: --
3349: hr_utility.set_location(' Leaving: '||l_proc,999);
3350: --hr_utility.trace_off;
3351: END archive_code;
3352: --
3353: PROCEDURE spawn_reports
3346: archive_asg_info(g_tax_paid_eid,
3347: fnd_number.number_to_canonical(l_paye));
3348: --
3349: hr_utility.set_location(' Leaving: '||l_proc,999);
3350: --hr_utility.trace_off;
3351: END archive_code;
3352: --
3353: PROCEDURE spawn_reports
3354: IS
3394: --
3395: rec_print_options csr_get_print_options%ROWTYPE;
3396: --
3397: BEGIN
3398: hr_utility.set_location('Entering: '||l_proc,1);
3399: -- get pertinent SRS parameters from the pay_mag_tape tables
3400: BEGIN
3401: LOOP
3402: l_count := l_count + 1;
3436: THEN l_report_short_name := 'PAYGB45L';
3437: ELSE l_report_short_name := 'PAYRPP45';
3438: END IF;
3439: --
3440: hr_utility.set_location(l_proc,10);
3441: -- Get printer options from archive request
3442: OPEN csr_get_print_options(l_payroll_action_id);
3443: FETCH csr_get_print_options INTO rec_print_options;
3444: CLOSE csr_get_print_options;
3452: copies => l_number_of_copies,
3453: save_output => hr_general.char_to_bool
3454: (rec_print_options.save_output),
3455: print_together => l_print_together);
3456: hr_utility.trace('Print options set call returned: '||
3457: hr_general.bool_to_char(l_print_return));
3458: -- Submit report
3459: l_request_id := fnd_request.submit_request
3460: (application => 'PAY',
3467: end if; -- get_errored_actions%notfound
3468: --
3469: close get_errored_actions;
3470: -- Set up formula inputs
3471: hr_utility.set_location(l_proc,20);
3472: OPEN csr_get_formula_id('PAY_GB_P45_REPORT_SUBMISSION');
3473: FETCH csr_get_formula_id INTO l_formula_id;
3474: CLOSE csr_get_formula_id;
3475: --
3482: pay_mag_tape.internal_prm_names(4) := 'PAYROLL_ACTION_ID';
3483: pay_mag_tape.internal_prm_values(4) := to_char(l_payroll_action_id);
3484: --
3485: -- Exit procedure, C code will fire formula
3486: hr_utility.set_location(' Leaving: '||l_proc,999);
3487: END spawn_reports;
3488: --
3489: PROCEDURE edi_act_creation(pactid IN NUMBER,
3490: stperson IN NUMBER,
3640: -- WHERE pai.locked_action_id = act.assignment_action_id);
3641: and pai.locked_action_id(+) = act.assignment_action_id
3642: and decode(pai.locked_action_id, null,1,2) = 1;
3643: BEGIN
3644: hr_utility.set_location('Entering: '||l_proc,1);
3645: --
3646: IF NOT g_asg_creation_cache_populated THEN
3647: OPEN csr_user_entity('X_PAYROLL_ID');
3648: FETCH csr_user_entity INTO g_payroll_id_eid;
3658: --
3659: g_asg_creation_cache_populated := true;
3660: END IF;
3661: --
3662: hr_utility.trace('Payroll ID : ' || g_payroll_id);
3663: hr_utility.trace('Tax Ref : ' || g_tax_ref);
3664: hr_utility.trace('Start : ' || g_start_date);
3665: hr_utility.trace('End : ' || g_end_date);
3666: hr_utility.trace('Bus ID : ' || g_business_group_id);
3659: g_asg_creation_cache_populated := true;
3660: END IF;
3661: --
3662: hr_utility.trace('Payroll ID : ' || g_payroll_id);
3663: hr_utility.trace('Tax Ref : ' || g_tax_ref);
3664: hr_utility.trace('Start : ' || g_start_date);
3665: hr_utility.trace('End : ' || g_end_date);
3666: hr_utility.trace('Bus ID : ' || g_business_group_id);
3667: hr_utility.trace('Chunk : ' || chunk);
3660: END IF;
3661: --
3662: hr_utility.trace('Payroll ID : ' || g_payroll_id);
3663: hr_utility.trace('Tax Ref : ' || g_tax_ref);
3664: hr_utility.trace('Start : ' || g_start_date);
3665: hr_utility.trace('End : ' || g_end_date);
3666: hr_utility.trace('Bus ID : ' || g_business_group_id);
3667: hr_utility.trace('Chunk : ' || chunk);
3668: hr_utility.trace('EID : ' || g_payroll_id_eid);
3661: --
3662: hr_utility.trace('Payroll ID : ' || g_payroll_id);
3663: hr_utility.trace('Tax Ref : ' || g_tax_ref);
3664: hr_utility.trace('Start : ' || g_start_date);
3665: hr_utility.trace('End : ' || g_end_date);
3666: hr_utility.trace('Bus ID : ' || g_business_group_id);
3667: hr_utility.trace('Chunk : ' || chunk);
3668: hr_utility.trace('EID : ' || g_payroll_id_eid);
3669: IF range_person_on('PAY_GB_P45_EDI') then
3662: hr_utility.trace('Payroll ID : ' || g_payroll_id);
3663: hr_utility.trace('Tax Ref : ' || g_tax_ref);
3664: hr_utility.trace('Start : ' || g_start_date);
3665: hr_utility.trace('End : ' || g_end_date);
3666: hr_utility.trace('Bus ID : ' || g_business_group_id);
3667: hr_utility.trace('Chunk : ' || chunk);
3668: hr_utility.trace('EID : ' || g_payroll_id_eid);
3669: IF range_person_on('PAY_GB_P45_EDI') then
3670: --
3663: hr_utility.trace('Tax Ref : ' || g_tax_ref);
3664: hr_utility.trace('Start : ' || g_start_date);
3665: hr_utility.trace('End : ' || g_end_date);
3666: hr_utility.trace('Bus ID : ' || g_business_group_id);
3667: hr_utility.trace('Chunk : ' || chunk);
3668: hr_utility.trace('EID : ' || g_payroll_id_eid);
3669: IF range_person_on('PAY_GB_P45_EDI') then
3670: --
3671: -- Range Person functionality enabled, use new cursor.
3664: hr_utility.trace('Start : ' || g_start_date);
3665: hr_utility.trace('End : ' || g_end_date);
3666: hr_utility.trace('Bus ID : ' || g_business_group_id);
3667: hr_utility.trace('Chunk : ' || chunk);
3668: hr_utility.trace('EID : ' || g_payroll_id_eid);
3669: IF range_person_on('PAY_GB_P45_EDI') then
3670: --
3671: -- Range Person functionality enabled, use new cursor.
3672: --
3669: IF range_person_on('PAY_GB_P45_EDI') then
3670: --
3671: -- Range Person functionality enabled, use new cursor.
3672: --
3673: hr_utility.set_location(l_proc,20);
3674: FOR rec_asg IN csr_range_assignments LOOP
3675: --
3676: hr_utility.set_location(l_proc,25);
3677: SELECT pay_assignment_actions_s.nextval
3672: --
3673: hr_utility.set_location(l_proc,20);
3674: FOR rec_asg IN csr_range_assignments LOOP
3675: --
3676: hr_utility.set_location(l_proc,25);
3677: SELECT pay_assignment_actions_s.nextval
3678: INTO l_actid
3679: FROM dual;
3680: --
3677: SELECT pay_assignment_actions_s.nextval
3678: INTO l_actid
3679: FROM dual;
3680: --
3681: hr_utility.set_location(l_proc,27);
3682: hr_nonrun_asact.insact(l_actid,rec_asg.assignment_id,
3683: pactid,chunk,NULL);
3684: -- Interlock the archive action
3685: hr_utility.set_location(l_proc,29);
3681: hr_utility.set_location(l_proc,27);
3682: hr_nonrun_asact.insact(l_actid,rec_asg.assignment_id,
3683: pactid,chunk,NULL);
3684: -- Interlock the archive action
3685: hr_utility.set_location(l_proc,29);
3686: hr_nonrun_asact.insint(l_actid, rec_asg.archive_action);
3687: END LOOP;
3688: --
3689: ELSE
3689: ELSE
3690: --
3691: -- Range Person functionality not enabled, use original cursor
3692: --
3693: hr_utility.set_location(l_proc,30);
3694: FOR rec_asg IN csr_assignments LOOP
3695: --
3696: SELECT pay_assignment_actions_s.nextval
3697: INTO l_actid
3704: END LOOP;
3705: --
3706: END IF; -- range person check.
3707: --
3708: hr_utility.set_location(' Leaving: '||l_proc,999);
3709: END edi_act_creation;
3710:
3711: --
3712: -- Populate P45 form with archived information where appropriate
3817: IF cur_get_asg_archive_items%NOTFOUND THEN
3818: null;
3819: ELSE
3820: l_pay_in_emp := (l_cur_get_asg_archive_items.pay_td_pounds + (l_cur_get_asg_archive_items.pay_td_pence/100));
3821: hr_utility.trace('l_pay_in_emp : '||to_char(l_pay_in_emp));
3822: l_tax_in_emp := (l_cur_get_asg_archive_items.tax_td_pounds + (l_cur_get_asg_archive_items.tax_td_pence/100));
3823: hr_utility.trace('l_tax_in_emp : '||to_char(l_tax_in_emp));
3824: l_prev_pay := (l_cur_get_asg_archive_items.prev_pay_in_pounds + (l_cur_get_asg_archive_items.prev_pay_in_pence/100));
3825: hr_utility.trace('l_prev_pay : '||to_char(l_prev_pay));
3819: ELSE
3820: l_pay_in_emp := (l_cur_get_asg_archive_items.pay_td_pounds + (l_cur_get_asg_archive_items.pay_td_pence/100));
3821: hr_utility.trace('l_pay_in_emp : '||to_char(l_pay_in_emp));
3822: l_tax_in_emp := (l_cur_get_asg_archive_items.tax_td_pounds + (l_cur_get_asg_archive_items.tax_td_pence/100));
3823: hr_utility.trace('l_tax_in_emp : '||to_char(l_tax_in_emp));
3824: l_prev_pay := (l_cur_get_asg_archive_items.prev_pay_in_pounds + (l_cur_get_asg_archive_items.prev_pay_in_pence/100));
3825: hr_utility.trace('l_prev_pay : '||to_char(l_prev_pay));
3826: l_prev_tax := (l_cur_get_asg_archive_items.prev_tax_in_pounds + (l_cur_get_asg_archive_items.prev_tax_in_pence/100));
3827: hr_utility.trace('l_prev_tax : '||to_char(l_prev_tax));
3821: hr_utility.trace('l_pay_in_emp : '||to_char(l_pay_in_emp));
3822: l_tax_in_emp := (l_cur_get_asg_archive_items.tax_td_pounds + (l_cur_get_asg_archive_items.tax_td_pence/100));
3823: hr_utility.trace('l_tax_in_emp : '||to_char(l_tax_in_emp));
3824: l_prev_pay := (l_cur_get_asg_archive_items.prev_pay_in_pounds + (l_cur_get_asg_archive_items.prev_pay_in_pence/100));
3825: hr_utility.trace('l_prev_pay : '||to_char(l_prev_pay));
3826: l_prev_tax := (l_cur_get_asg_archive_items.prev_tax_in_pounds + (l_cur_get_asg_archive_items.prev_tax_in_pence/100));
3827: hr_utility.trace('l_prev_tax : '||to_char(l_prev_tax));
3828: l_total_pay_pounds := trunc(l_pay_in_emp + l_prev_pay);
3829: hr_utility.trace('l_total_pay_pounds : '||to_char(l_total_pay_pounds));
3823: hr_utility.trace('l_tax_in_emp : '||to_char(l_tax_in_emp));
3824: l_prev_pay := (l_cur_get_asg_archive_items.prev_pay_in_pounds + (l_cur_get_asg_archive_items.prev_pay_in_pence/100));
3825: hr_utility.trace('l_prev_pay : '||to_char(l_prev_pay));
3826: l_prev_tax := (l_cur_get_asg_archive_items.prev_tax_in_pounds + (l_cur_get_asg_archive_items.prev_tax_in_pence/100));
3827: hr_utility.trace('l_prev_tax : '||to_char(l_prev_tax));
3828: l_total_pay_pounds := trunc(l_pay_in_emp + l_prev_pay);
3829: hr_utility.trace('l_total_pay_pounds : '||to_char(l_total_pay_pounds));
3830: l_total_pay_pence := (mod((l_pay_in_emp + l_prev_pay),1)*100);
3831: hr_utility.trace('l_total_pay_pence : '||to_char(l_total_pay_pence));
3825: hr_utility.trace('l_prev_pay : '||to_char(l_prev_pay));
3826: l_prev_tax := (l_cur_get_asg_archive_items.prev_tax_in_pounds + (l_cur_get_asg_archive_items.prev_tax_in_pence/100));
3827: hr_utility.trace('l_prev_tax : '||to_char(l_prev_tax));
3828: l_total_pay_pounds := trunc(l_pay_in_emp + l_prev_pay);
3829: hr_utility.trace('l_total_pay_pounds : '||to_char(l_total_pay_pounds));
3830: l_total_pay_pence := (mod((l_pay_in_emp + l_prev_pay),1)*100);
3831: hr_utility.trace('l_total_pay_pence : '||to_char(l_total_pay_pence));
3832: l_total_tax_pounds := trunc(l_tax_in_emp + l_prev_tax);
3833: hr_utility.trace('l_total_tax_pounds : '||to_char(l_total_tax_pounds));
3827: hr_utility.trace('l_prev_tax : '||to_char(l_prev_tax));
3828: l_total_pay_pounds := trunc(l_pay_in_emp + l_prev_pay);
3829: hr_utility.trace('l_total_pay_pounds : '||to_char(l_total_pay_pounds));
3830: l_total_pay_pence := (mod((l_pay_in_emp + l_prev_pay),1)*100);
3831: hr_utility.trace('l_total_pay_pence : '||to_char(l_total_pay_pence));
3832: l_total_tax_pounds := trunc(l_tax_in_emp + l_prev_tax);
3833: hr_utility.trace('l_total_tax_pounds : '||to_char(l_total_tax_pounds));
3834: l_total_tax_pence := (mod((l_tax_in_emp + l_prev_tax),1)*100);
3835: hr_utility.trace('l_total_tax_pence : '||to_char(l_total_tax_pence));
3829: hr_utility.trace('l_total_pay_pounds : '||to_char(l_total_pay_pounds));
3830: l_total_pay_pence := (mod((l_pay_in_emp + l_prev_pay),1)*100);
3831: hr_utility.trace('l_total_pay_pence : '||to_char(l_total_pay_pence));
3832: l_total_tax_pounds := trunc(l_tax_in_emp + l_prev_tax);
3833: hr_utility.trace('l_total_tax_pounds : '||to_char(l_total_tax_pounds));
3834: l_total_tax_pence := (mod((l_tax_in_emp + l_prev_tax),1)*100);
3835: hr_utility.trace('l_total_tax_pence : '||to_char(l_total_tax_pence));
3836: x_ni1 := l_cur_get_asg_archive_items.nino1;
3837: x_ni2 := l_cur_get_asg_archive_items.nino2;
3831: hr_utility.trace('l_total_pay_pence : '||to_char(l_total_pay_pence));
3832: l_total_tax_pounds := trunc(l_tax_in_emp + l_prev_tax);
3833: hr_utility.trace('l_total_tax_pounds : '||to_char(l_total_tax_pounds));
3834: l_total_tax_pence := (mod((l_tax_in_emp + l_prev_tax),1)*100);
3835: hr_utility.trace('l_total_tax_pence : '||to_char(l_total_tax_pence));
3836: x_ni1 := l_cur_get_asg_archive_items.nino1;
3837: x_ni2 := l_cur_get_asg_archive_items.nino2;
3838: x_ni3 := l_cur_get_asg_archive_items.nino3;
3839: x_ni4 := l_cur_get_asg_archive_items.nino4;
4129: l_action_sequence number;
4130:
4131: l_proc CONSTANT VARCHAR2(100):= g_package||'get_p45_agg_asg_action_id';
4132: BEGIN
4133: hr_utility.set_location('Entering: '||l_proc,1);
4134: p_agg_assignment_id := null;
4135: p_final_payment_date := null;
4136: p_p45_agg_asg_action_id := null;
4137: p_p45_issue_date := null;
4135: p_final_payment_date := null;
4136: p_p45_agg_asg_action_id := null;
4137: p_p45_issue_date := null;
4138:
4139: hr_utility.trace('g_p45_inc_assignment ' || g_p45_inc_assignment);
4140:
4141: hr_utility.set_location(l_proc,10);
4142: -- Start of BUG 5671777-2
4143: --
4137: p_p45_issue_date := null;
4138:
4139: hr_utility.trace('g_p45_inc_assignment ' || g_p45_inc_assignment);
4140:
4141: hr_utility.set_location(l_proc,10);
4142: -- Start of BUG 5671777-2
4143: --
4144: -- fetch P45 for another assignment that included the given assignment.
4145: --
4145: --
4146: for r_rec in csr_get_all_asg(p_assignment_id) loop
4147: l_assignment_action_id := null;
4148: l_issue_date := null;
4149: hr_utility.set_location(l_proc,14);
4150: --
4151: -- fetch the p45 issue date and assignment action id
4152: --
4153: get_p45_asg_action_id(p_assignment_id => r_rec.assignment_id,
4155: p_issue_date => l_issue_date,
4156: p_action_sequence => l_action_sequence);
4157:
4158: if l_assignment_action_id is not null then
4159: hr_utility.set_location(l_proc,17);
4160:
4161: open csr_get_p45_another_asg(p_assignment_id,l_assignment_action_id);
4162: fetch csr_get_p45_another_asg into l_dummy;
4163: l_found := csr_get_p45_another_asg%found;
4177: -- End of Bug 5617777-2
4178: for r_rec in csr_get_all_asg(p_assignment_id) loop
4179: l_assignment_action_id := null;
4180: l_issue_date := null;
4181: hr_utility.set_location(l_proc,20);
4182: --
4183: -- fetch the p45 issue date and assignment action id
4184: --
4185: get_p45_asg_action_id(p_assignment_id => r_rec.assignment_id,
4188: p_action_sequence => l_action_sequence);
4189: --
4190:
4191: if l_assignment_action_id is not null then
4192: hr_utility.set_location(l_proc,30);
4193: --
4194: /*
4195: -- get the final payment date/effective_date
4196: --
4200: close csr_get_final_payment;
4201: --
4202:
4203: if l_found then
4204: hr_utility.set_location(l_proc,40);
4205: */
4206: --
4207: -- fetch the last active/susp status of the aggregated assignemnt
4208: --
4218: close csr_aggr_paye_flag;
4219: --
4220:
4221: if nvl(l_agg_paye_flag, 'X') = 'Y' then
4222: hr_utility.set_location(l_proc,50);
4223:
4224: --
4225: -- fetch the Tax reference for the agg. asg. on the last active/susp status date of the asg
4226: --
4230: close csr_get_paye_ref;
4231: --
4232:
4233: if l_found then
4234: hr_utility.set_location(l_proc,60);
4235: --
4236: -- fetch the last active/susp status of the given assignemnt
4237: --
4238: open csr_asg_last_active_date(p_assignment_id);
4251:
4252: if l_found and l_paye_reference = l_agg_paye_reference and
4253: l_period_of_service_id = l_agg_period_of_service_id then
4254:
4255: hr_utility.set_location(l_proc,70);
4256:
4257: --
4258: -- check for both assignments share aggregated active period of employment or not
4259: --
4264: close csr_agg_asg_active_period;
4265: --
4266:
4267: if l_found then
4268: hr_utility.set_location(l_proc,80);
4269: --
4270: -- to fetch the latest aggregation start date near to final payment date.
4271: --
4272: open csr_latest_aggr_start_date(r_rec.person_id, l_agg_asg_last_active_date);
4274: close csr_latest_aggr_start_date;
4275: --
4276:
4277: if l_latest_aggr_start_date is not null then
4278: hr_utility.set_location(l_proc,90);
4279: --
4280: -- to check whther the given assignment present between
4281: -- the earliest aggregation start date and final payment date
4282: --
4286: close csr_asg_present_status;
4287: end if;
4288:
4289: if l_found then
4290: hr_utility.set_location(l_proc,100);
4291: --
4292: -- returning the final payment date, asg. action id and agg.asg. id
4293: --
4294: p_agg_assignment_id := r_rec.assignment_id;
4306: --end if;
4307: end if;
4308: end loop;
4309: end if; -- l_found
4310: hr_utility.set_location('Leaving: '||l_proc,110);
4311: --
4312: END get_p45_agg_asg_action_id;
4313:
4314: -- Bug 7028893.Added function PAYE_RETURN_P45_ISSUED_FLAG.
4336: l_proc CONSTANT VARCHAR2(100):= g_package||'paye_return_p45_issued_flag';
4337: l_effective_date date;
4338: --
4339: BEGIN
4340: hr_utility.set_location('Entering: '||l_proc,10);
4341: --
4342: -- check for the p45 issue date and assignment action id through P45 process
4343: --
4344: get_p45_asg_action_id(p_assignment_id => p_assignment_id,
4346: p_issue_date => l_issue_date,
4347: p_action_sequence => l_action_sequence);
4348: --
4349:
4350: hr_utility.set_location(l_proc,20);
4351: if l_assignment_action_id is null then
4352: hr_utility.set_location(l_proc,30);
4353:
4354: --
4348: --
4349:
4350: hr_utility.set_location(l_proc,20);
4351: if l_assignment_action_id is null then
4352: hr_utility.set_location(l_proc,30);
4353:
4354: --
4355: -- check for the P45 manualy issued or not
4356: --
4355: -- check for the P45 manualy issued or not
4356: --
4357: l_issue_date := get_p45_eit_manual_issue_dt(p_assignment_id);
4358: if l_issue_date is null then
4359: hr_utility.set_location(l_proc,40);
4360: --
4361: -- check for the P45 issued for any of the aggregated assignment
4362: --
4363: get_p45_agg_asg_action_id(p_assignment_id => p_assignment_id,
4366: p_p45_issue_date => l_issue_date,
4367: p_p45_agg_asg_action_id => l_p45_agg_asg_action_id);
4368:
4369: if l_agg_assignment_id is null then
4370: hr_utility.set_location(l_proc,50);
4371: l_return_p45_issued_flag := 'N';
4372: end if;
4373: end if;
4374: --
4373: end if;
4374: --
4375:
4376: end if;
4377: hr_utility.set_location('Leaving: '||l_proc,60);
4378:
4379: -- Fetching effective date for payroll action id
4380: open csr_get_effective_date(p_payroll_action_id);
4381: fetch csr_get_effective_date into l_effective_date;
4406: l_return_p45_issued_flag VARCHAR2(1) := 'Y';
4407: l_proc CONSTANT VARCHAR2(100):= g_package||'return_p45_issued_flag';
4408: --
4409: BEGIN
4410: hr_utility.set_location('Entering: '||l_proc,10);
4411: --
4412: -- check for the p45 issue date and assignment action id through P45 process
4413: --
4414: get_p45_asg_action_id(p_assignment_id => p_assignment_id,
4416: p_issue_date => l_issue_date,
4417: p_action_sequence => l_action_sequence);
4418: --
4419:
4420: hr_utility.set_location(l_proc,20);
4421: if l_assignment_action_id is null then
4422: hr_utility.set_location(l_proc,30);
4423:
4424: --
4418: --
4419:
4420: hr_utility.set_location(l_proc,20);
4421: if l_assignment_action_id is null then
4422: hr_utility.set_location(l_proc,30);
4423:
4424: --
4425: -- check for the P45 manualy issued or not
4426: --
4424: --
4425: -- check for the P45 manualy issued or not
4426: --
4427: if get_p45_eit_manual_issue_dt(p_assignment_id) is null then
4428: hr_utility.set_location(l_proc,40);
4429: --
4430: -- check for the P45 issued for any of the aggregated assignment
4431: --
4432: get_p45_agg_asg_action_id(p_assignment_id => p_assignment_id,
4435: p_p45_issue_date => l_issue_date,
4436: p_p45_agg_asg_action_id => l_p45_agg_asg_action_id);
4437:
4438: if l_agg_assignment_id is null then
4439: hr_utility.set_location(l_proc,50);
4440: l_return_p45_issued_flag := 'N';
4441: end if;
4442: end if;
4443: --
4442: end if;
4443: --
4444:
4445: end if;
4446: hr_utility.set_location('Leaving: '||l_proc,60);
4447: return l_return_p45_issued_flag;
4448: --
4449: END return_p45_issued_flag;
4450: