1: PACKAGE BODY hr_assignment AS
2: /* $Header: peassign.pkb 120.21.12020000.2 2012/07/05 01:30:58 amnaraya ship $ */
3: /*
4: ******************************************************************
5: * *
19: * England. *
20: * *
21: ****************************************************************** */
22: /*
23: Name : hr_assignment (BODY)
24:
25: Description : This package defines procedures required to
26: INSERT, UPDATE and DELETE assignments and all
27: associated tables :
257: procedure.Reverted Back the change done in
258: 115.22 and 115.27 to consider
259: p_new_primary_flag instead of 'N'
260: 115.39 01-Dec-04 jpthomas 4040403 Modified the procedure DEL_REF_INT_DELETE() in
261: the package HR_ASSIGNMENT to implement the
262: DELETE_NEXT_CHANGE and FUTURE_CHANGE for the
263: Assignment Budget Values records.
264: 115.40 27-DEC-04 kramajey 4071460 Modified the check_hours procedure to
265: to enable the proper validation
297: --
298: --
299: -- Package Variables
300: --
301: g_package varchar2(33) := ' hr_assignment.';
302: --
303: ----------------------- gen_probation_end ----------------------------
304: /*
305: NAME
328: v_date_probation_end DATE;
329: --
330: BEGIN
331: --
332: hr_utility.set_location('hr_assignment.gen_probation_end',1);
333: --
334: v_start_date := p_start_date;
335: v_date_probation_end := p_date_probation_end;
336: --
337: IF v_date_probation_end IS NULL THEN
338: --
339: -- generate new default probation end date
340: --
341: hr_utility.set_location('hr_assignment.gen_probation_end',2);
342: --
343: /*------ changes made for bug 5619940 ---- */
344: IF p_probation_period = 0
345: and ( p_probation_unit = 'D'
369: --
370: ELSIF
371: p_assignment_id IS NULL THEN
372: --
373: hr_utility.set_location('hr_assignment.gen_probation_end',3);
374: --
375: -- If the Assignment is a new one
376: -- ensure that the DATE_PROBATION_END is on or after the assignment
377: -- start date
389: -- date for the assignment.
390: --
391: BEGIN
392: --
393: hr_utility.set_location('hr_assignment.gen_probation_end',4);
394: select v_date_probation_end - min(effective_start_date)
395: into check_date
396: from per_assignments_f
397: where assignment_id = p_assignment_id
401: WHEN NO_DATA_FOUND THEN NULL;
402: --
403: END;
404: --
405: hr_utility.set_location('hr_assignment.gen_probation_end',5);
406: --
407: IF check_date < 0 THEN
408: hr_utility.set_message(801,'HR_6150_EMP_ASS_PROB_END');
409: hr_utility.raise_error;
431: ) is
432: --
433: begin
434: --
435: hr_utility.set_location('hr_assignment.gen_new_ass_sequence',1);
436: select nvl(max(assignment_sequence),0) +1
437: into p_assignment_sequence
438: from per_assignments_f
439: where person_id = p_person_id
522: duplicate := 'N';
523: --
524: BEGIN
525: --
526: hr_utility.set_location('hr_assignment.gen_new_ass_number',1);
527: select 'Y'
528: into duplicate
529: from sys.dual
530: where exists
554: ass_seq := p_assignment_sequence;
555: --
556: IF p_assignment_number IS NOT NULL THEN
557: --
558: hr_utility.set_location('hr_assignment.gen_new_ass_number',2);
559: IF validate_ass_number(p_assignment_id
560: ,p_business_group_id
561: ,p_assignment_number) THEN
562: NULL;
566: END IF;
567: --
568: ELSE
569: --
570: hr_utility.set_location('hr_assignment.gen_new_ass_number',3);
571: WHILE loop_count > 0 LOOP
572: --
573: IF ass_seq = 1 THEN
574: -- p_assignment_number := p_worker_number;
641: p_assignment_number := substr(p_worker_number,1,29-length(TO_CHAR(ass_seq)))||'-'||TO_CHAR(ass_seq);
642: -- p_assignment_number := p_worker_number||'-'||TO_CHAR(ass_seq);
643: END IF;
644: --
645: hr_utility.set_location('hr_assignment.gen_new_ass_number',4);
646: IF validate_ass_number(p_assignment_id
647: ,p_business_group_id
648: ,p_assignment_number) THEN
649: EXIT;
653: END IF;
654: --
655: END LOOP;
656: --
657: hr_utility.set_location('hr_assignment.gen_new_ass_number',5);
658: IF loop_count = 0 THEN
659: hr_utility.set_message(801,'HR_6148_EMP_ASS_LOOP_OUT');
660: hr_utility.raise_error;
661: END IF;
687: no_of_hours NUMBER;
688: --
689: BEGIN
690: --
691: hr_utility.set_location('hr_assignment.check_hours',1);
692: IF p_frequency = 'D' THEN
693: no_of_hours := 24;
694: ELSIF p_frequency = 'W' THEN
695: no_of_hours := 168;
788:
789:
790: BEGIN
791: --
792: hr_utility.set_location('hr_assignment.check_term',1);
793: p_start_date := p_sdate;
794: p_end_date := p_edate;
795: p_new_ass_end_date := null;
796:
810: FETCH csr_get_term_dates INTO p_atd
811: ,p_fpd;
812: CLOSE csr_get_term_dates;
813:
814: hr_utility.set_location('hr_assignment.check_term',2);
815:
816: IF p_atd IS NULL THEN null;
817: ELSE
818: --
818: --
819: -------------------------------------
820: -- Get the Effective End Date of the Assignment
821: -------------------------------------
822: hr_utility.set_location('hr_assignment.check_term',3);
823: --
824: select max(effective_end_date)
825: into p_ass_end_date
826: from per_assignments_f
832: -- If the mode is UPDATE_OVERRIDE and the current status is TERM_ASSIGN
833: -- then compare the session date with the earliest TERM_ASSIGN date
834: -- and store the earliest.
835: -------------------------------------
836: hr_utility.set_location('hr_assignment.check_term',4);
837: --
838: select min(a.effective_start_date)
839: into p_first_term_date
840: from per_assignments_f a
844: where s.assignment_status_type_id
845: = a.assignment_status_type_id
846: and s.per_system_status = 'TERM_ASSIGN');
847: --
848: hr_utility.set_location('hr_assignment.check_term',5);
849: IF p_mode = 'UPDATE_OVERRIDE' AND
850: p_current_status = 'TERM_ASSIGN' THEN
851: --
852: IF p_first_term_date IS NULL OR
879:
880: IF (p_mode = 'UPDATE_OVERRIDE' or p_mode = 'FUTURE_CHANGE')
881: AND p_start_date < p_atd + 1 THEN
882: --
883: hr_utility.set_location('hr_assignment.check_term',6);
884: --
885: p_flag := 'N';
886: --
887: BEGIN
885: p_flag := 'N';
886: --
887: BEGIN
888: --
889: hr_utility.set_location('hr_assignment.check_term',7);
890: --
891: select 'Y'
892: into p_flag
893: from per_assignments_f a
902: EXCEPTION
903: WHEN NO_DATA_FOUND THEN NULL;
904: END;
905: --
906: hr_utility.set_location('hr_assignment.check_term',8);
907: IF p_flag = 'Y' THEN
908: hr_utility.set_message(801,'HR_6200_EMP_ASS_TERM_EXISTS');
909: hr_utility.raise_error;
910: END IF;
920: -- otherwise
921: -- set the new_assignment_end_date = actual_termination_date
922: ---------------------------------------------------------------
923: IF p_mode = 'UPDATE_OVERRIDE' THEN
924: hr_utility.set_location('hr_assignment.check_term',9);
925: IF p_ass_end_date <= p_atd THEN
926: NULL;
927: ELSE
928: hr_utility.set_location('hr_assignment.check_term',10);
924: hr_utility.set_location('hr_assignment.check_term',9);
925: IF p_ass_end_date <= p_atd THEN
926: NULL;
927: ELSE
928: hr_utility.set_location('hr_assignment.check_term',10);
929: IF p_first_term_date <= p_start_date THEN
930: NULL;
931: ELSE
932: p_new_ass_end_date := p_atd;
941: -- open the assignment up to the actual term date.
942: ---------------------------------------------------------------
943: ELSIF
944: p_mode = 'FUTURE_CHANGE' THEN
945: hr_utility.set_location('hr_assignment.check_term',11);
946: IF p_first_term_date <= p_start_date THEN
947: p_new_ass_end_date := p_fpd;
948: ELSE
949: p_new_ass_end_date := p_atd;
988: -- therefore in this case issue an error.
989: ---------------------------------------------------------------
990: ELSIF
991: p_mode = 'DELETE_NEXT_CHANGE' THEN
992: hr_utility.set_location('hr_assignment.check_term',12);
993: IF p_end_date = p_ass_end_date THEN
994: hr_utility.set_location('hr_assignment.check_term',13);
995: IF p_first_term_date <= p_start_date THEN
996: p_new_ass_end_date := p_fpd;
990: ELSIF
991: p_mode = 'DELETE_NEXT_CHANGE' THEN
992: hr_utility.set_location('hr_assignment.check_term',12);
993: IF p_end_date = p_ass_end_date THEN
994: hr_utility.set_location('hr_assignment.check_term',13);
995: IF p_first_term_date <= p_start_date THEN
996: p_new_ass_end_date := p_fpd;
997: ELSE
998: p_new_ass_end_date := p_atd;
1002: p_flag := 'N';
1003: --
1004: BEGIN
1005: --
1006: hr_utility.set_location('hr_assignment.check_term',14);
1007: --
1008: select 'Y'
1009: , a.effective_start_date
1010: , a.effective_end_date
1023: EXCEPTION
1024: WHEN NO_DATA_FOUND THEN NULL;
1025: END;
1026: --
1027: hr_utility.set_location('hr_assignment.check_term',15);
1028: IF p_flag = 'Y' THEN
1029: hr_utility.set_location('hr_assignment.check_term',16);
1030: IF p_next_eff_start_date = p_atd + 1 THEN
1031: hr_utility.set_message(801,'HR_6200_EMP_ASS_TERM_EXISTS');
1025: END;
1026: --
1027: hr_utility.set_location('hr_assignment.check_term',15);
1028: IF p_flag = 'Y' THEN
1029: hr_utility.set_location('hr_assignment.check_term',16);
1030: IF p_next_eff_start_date = p_atd + 1 THEN
1031: hr_utility.set_message(801,'HR_6200_EMP_ASS_TERM_EXISTS');
1032: hr_utility.raise_error;
1033: ELSE
1031: hr_utility.set_message(801,'HR_6200_EMP_ASS_TERM_EXISTS');
1032: hr_utility.raise_error;
1033: ELSE
1034: IF p_first_term_date <= p_start_date THEN
1035: hr_utility.set_location('hr_assignment.check_term',17);
1036: p_new_ass_end_date := p_fpd;
1037: ELSE
1038: IF p_next_eff_end_date = p_ass_end_date THEN
1039: hr_utility.set_location('hr_assignment.check_term',18);
1035: hr_utility.set_location('hr_assignment.check_term',17);
1036: p_new_ass_end_date := p_fpd;
1037: ELSE
1038: IF p_next_eff_end_date = p_ass_end_date THEN
1039: hr_utility.set_location('hr_assignment.check_term',18);
1040: IF p_ass_end_date > p_atd THEN
1041: p_new_ass_end_date := p_atd;
1042: ELSE
1043: NULL;
1056: END IF; -- (p_mode = 'UPDATE_OVERRIDE')
1057: --
1058: END IF; -- (p_atd IS NULL)
1059: --
1060: hr_utility.set_location('hr_assignment.check_term',19);
1061: IF p_new_ass_end_date IS NOT NULL THEN
1062: ------------------------------------------------------------
1063: -- First check whether setting this end date will invalidate
1064: -- any child rows.
1062: ------------------------------------------------------------
1063: -- First check whether setting this end date will invalidate
1064: -- any child rows.
1065: ------------------------------------------------------------
1066: hr_assignment.del_ref_int_check
1067: ( p_assignment_id
1068: , 'END'
1069: , p_new_ass_end_date);
1070: p_newdate := p_new_ass_end_date;
1104: p_term_found := 'N';
1105: --
1106: begin
1107: --
1108: hr_utility.set_location('hr_assignment.warn_del_term',1);
1109: --
1110: select 'Y'
1111: into p_term_found
1112: from sys.dual
1127: exception
1128: when NO_DATA_FOUND then null;
1129: end;
1130: --
1131: hr_utility.set_location('hr_assignment.warn_del_term',2);
1132: if p_term_found = 'Y' then
1133: raise local_warning;
1134: end if;
1135: --
1166: --
1167: -- del_flag := 'N';
1168: --
1169: BEGIN
1170: hr_utility.set_location('hr_assignment.delete_ass_ref_int',1);
1171: --
1172: SELECT 'Y'
1173: into del_flag
1174: FROM SYS.DUAL
1182: WHEN NO_DATA_FOUND THEN NULL;
1183: END;
1184: --
1185: IF del_flag = 'Y' THEN
1186: hr_utility.set_location('hr_assignment.delete_ass_ref_int',2);
1187: --
1188: DELETE FROM PER_SPINAL_POINT_PLACEMENTS_F P
1189: WHERE P.business_group_id + 0 = p_business_group_id
1190: AND P.ASSIGNMENT_ID = p_assignment_id;
1194: del_flag := 'N';
1195: --
1196: BEGIN
1197: --
1198: hr_utility.set_location('hr_assignment.delete_ass_ref_int',3);
1199: --
1200: SELECT 'Y'
1201: into del_flag
1202: from sys.dual
1210: WHEN NO_DATA_FOUND THEN NULL;
1211: END;
1212: --
1213: IF del_flag = 'Y' THEN
1214: hr_utility.set_location('hr_assignment.delete_ass_ref_int',4);
1215: --
1216: DELETE FROM PER_SECONDARY_ASS_STATUSES
1217: WHERE business_group_id + 0 = p_business_group_id
1218: AND ASSIGNMENT_ID = p_assignment_id;
1221: --
1222: del_flag := 'N';
1223: --
1224: BEGIN
1225: hr_utility.set_location('hr_assignment.delete_ass_ref_int',5);
1226: --
1227: SELECT 'Y'
1228: into del_flag
1229: from sys.dual
1237: WHEN NO_DATA_FOUND THEN NULL;
1238: END;
1239: --
1240: IF del_flag = 'Y' THEN
1241: hr_utility.set_location('hr_assignment.delete_ass_ref_int',6);
1242: --
1243: DELETE FROM PER_ASSIGNMENT_BUDGET_VALUES_F BV
1244: WHERE BV.business_group_id + 0 = p_business_group_id
1245: AND BV.ASSIGNMENT_ID = p_assignment_id;
1270: --
1271: -------------------------------------------------
1272: -- Retrieve the ACTUAL TERMINATION DATE for the Period of Service
1273: -------------------------------------------------
1274: hr_utility.set_location('hr_assignment.get_act_term_date',1);
1275: --
1276: select actual_termination_date
1277: into p_actual_termination_date
1278: from per_periods_of_service
1329:
1330: --
1331: BEGIN
1332: --
1333: hr_utility.set_location('hr_assignment.check_future_primary',1);
1334: p_start_date := p_sdate;
1335: p_end_date := p_edate;
1336: --
1337: -------------------------------------
1363: -- NEXT_CHANGE - the next row
1364: -- FUTURE_CHANGES and UPDATE_OVERRIDE - All rows in future
1365: -------------------------------------
1366: begin
1367: hr_utility.set_location('hr_assignment.check_future_primary',2);
1368: --
1369: select 'Y'
1370: into p_change_flag
1371: from sys.dual
1388: -- retrieve the earliest occurrence of PRIMARY_FLAG = 'Y'. A new
1389: -- Primary Assignment will be required from this date.
1390: ---------------------------------------
1391: IF p_mode = 'ZAP' AND p_change_flag = 'Y' THEN
1392: hr_utility.set_location('hr_assignment.check_future_primary',3);
1393: --
1394: select min(effective_start_date)
1395: into p_primary_date_from_d
1396: from per_assignments_f
1477:
1478: -------------------------------------
1479: -- Get the Actual Termination Date and Final Process Date
1480: -------------------------------------
1481: hr_utility.set_location('hr_assignment.check_ass_for_primary',1);
1482: --
1483: -- #306211. If ATD was null, then NVL to EOT - 1, instead of EOT. This is
1484: -- because trying to add 1 to EOT (as happens in a number of places below)
1485: -- raises an ORA-1841 error. So use Dec 30 instead of Dec 31.
1491:
1492: -------------------------------------
1493: -- Get the Effective End Date of the Assignment
1494: -------------------------------------
1495: hr_utility.set_location('hr_assignment.check_ass_for_primary',2);
1496: --
1497: select max(effective_end_date)
1498: into p_ass_end_date
1499: from per_assignments_f
1517: ELSE
1518: -------------------------------------
1519: -- Get the Start Date of the First terminated status.
1520: -------------------------------------
1521: hr_utility.set_location('hr_assignment.check_ass_for_primary',3);
1522: --
1523: if l_assignment_type <> 'C' then
1524:
1525: select min(a.effective_start_date)
1531: where s.assignment_status_type_id
1532: = a.assignment_status_type_id
1533: and s.per_system_status = 'TERM_ASSIGN');
1534: --
1535: hr_utility.set_location('hr_assignment.check_ass_for_primary',4);
1536: IF p_first_term_date = p_atd + 1
1537: OR
1538: p_first_term_date IS NULL THEN NULL;
1539: ELSE
1711: -- back to p_new_primary_flag.
1712: -------------------------------------
1713: --
1714: IF p_mode <> 'ZAP' THEN
1715: hr_utility.set_location('hr_assignment.update_primary',1);
1716: do_primary_update(p_assignment_id
1717: ,p_sdate
1718: ,p_new_primary_flag -- Bug 3584122 'N'-- Bug 2468916 p_new_primary_flag
1719: ,'Y'
1727: -- Flag has to be set to 'Y' on all the changes on or after the
1728: -- Start Date
1729: -------------------------------------
1730: IF p_assignment_id <> p_new_primary_ass_id THEN
1731: hr_utility.set_location('hr_assignment.update_primary',2);
1732: do_primary_update(p_new_primary_ass_id
1733: ,p_sdate
1734: ,'Y'
1735: ,'N'
1743: -- P_NEW_PRIMARY_ASS_ID within the period_of_service
1744: -- future changes must have their Primary Flag set to 'N'. It is only
1745: -- necessary to update the ones that are currently 'Y'.
1746: -------------------------------------
1747: hr_utility.set_location('hr_assignment.update_primary',3);
1748: --
1749: FOR ass_rec IN get_future_primary_assignments LOOP
1750: do_primary_update(ass_rec.assignment_id
1751: ,p_sdate
1801: and P_START_DATE < effective_start_date))
1802: for update;
1803: --
1804: BEGIN
1805: hr_utility.set_location('hr_assignment.do_primary_update',1);
1806: p_start_date := p_sdate;
1807: --
1808: -------------------------------------
1809: -- If the Assignment is Current i.e. P_CURRENT_ASS = 'Y' then the form
1838: --
1839: -- See CURSOR select_ass_for_update
1840: ----------------------------------------------------------------------
1841: --
1842: hr_utility.set_location('hr_assignment.do_primary_update',2);
1843: --
1844: FOR ass_rec IN select_ass_for_update LOOP
1845: NULL;
1846: END LOOP;
1847: --
1848: IF p_current_ass = 'Y' THEN
1849: NULL;
1850: ELSE
1851: hr_utility.set_location('hr_assignment.do_primary_update',3);
1852: --
1853: update per_assignments_f
1854: set primary_flag = P_PRIMARY_FLAG
1855: , last_updated_by = P_LAST_UPDATED_BY
1857: , last_update_date = sysdate
1858: where assignment_id = P_ASSIGNMENT_ID
1859: and effective_start_date = P_START_DATE;
1860: --
1861: -- hr_utility.set_location('hr_assignment.do_primary_update',4); -- Fix For Bug # 8710298. Commented the Call.
1862: IF SQL%ROWCOUNT = 1 THEN
1863: NULL;
1864: ELSIF SQL%ROWCOUNT > 1 THEN
1865: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1867: hr_utility.set_message_token('STEP','1');
1868: hr_utility.raise_error;
1869: ELSE
1870: --
1871: hr_utility.set_location('hr_assignment.do_primary_update',5);
1872: --
1873: insert into per_assignments_f
1874: (
1875: ASSIGNMENT_ID
2102: --
2103: IF SQL%ROWCOUNT = 0 THEN
2104: NULL; -- This Assignment Start in the Future
2105: ELSE
2106: hr_utility.set_location('hr_assignment.do_primary_update',6);
2107: --
2108: update per_assignments_f
2109: set effective_start_date = P_START_DATE
2110: , primary_flag = P_PRIMARY_FLAG
2115: and P_START_DATE
2116: between effective_start_date and effective_end_date
2117: and primary_flag <> P_PRIMARY_FLAG;
2118: --
2119: -- hr_utility.set_location('hr_assignment.do_primary_update',7); -- Fix For Bug # 8710298. Commented the call.
2120: IF SQL%ROWCOUNT <> 1 THEN
2121: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
2122: hr_utility.set_message_token('PROCEDURE','DO_PRIMARY_UPDATE');
2123: hr_utility.set_message_token('STEP','3');
2122: hr_utility.set_message_token('PROCEDURE','DO_PRIMARY_UPDATE');
2123: hr_utility.set_message_token('STEP','3');
2124: hr_utility.raise_error;
2125: END IF; -- (SQL%ROWCOUNT <> 1)
2126: hr_utility.set_location('hr_assignment.do_primary_update',7); -- Fix For Bug # 8710298 . Moved the hr_utility.set_location call.
2127: END IF; -- (SQL%ROWCOUNT = 0)
2128: END IF; -- (SQL%ROWCOUNT = 1)
2129: END IF; -- (p_current_ass = 'Y')
2130: --
2127: END IF; -- (SQL%ROWCOUNT = 0)
2128: END IF; -- (SQL%ROWCOUNT = 1)
2129: END IF; -- (p_current_ass = 'Y')
2130: --
2131: hr_utility.set_location('hr_assignment.do_primary_update',8);
2132: --
2133: update per_assignments_f
2134: set primary_flag = P_PRIMARY_FLAG
2135: , last_updated_by = P_LAST_UPDATED_BY
2254: BEGIN
2255: --
2256: p_start_date := p_sdate;
2257:
2258: hr_utility.set_location('hr_assignment.get_new_primary_assignment',1);
2259:
2260: --
2261: -- Fetch the desired assignment details.
2262: --
2274: ,p_fpd;
2275: CLOSE csr_get_term_dates;
2276:
2277: --
2278: hr_utility.set_location('hr_assignment.get_new_primary_assignment',2);
2279: --
2280: ---------------------------------------------------
2281: -- open the cursor and read the first record if one exists
2282: -- If one doesn't exists then ERROR
2282: -- If one doesn't exists then ERROR
2283: -- Try and read another record
2284: -- If one exists then WARNING (prompt user in Form for which one)
2285: ---------------------------------------------------
2286: hr_utility.set_location('hr_assignment.get_new_primary_assignment',3);
2287: OPEN get_candidate_primary_ass;
2288: --
2289: hr_utility.set_location('hr_assignment.get_new_primary_assignment',4);
2290: FETCH get_candidate_primary_ass INTO p_new_primary_ass_id;
2285: ---------------------------------------------------
2286: hr_utility.set_location('hr_assignment.get_new_primary_assignment',3);
2287: OPEN get_candidate_primary_ass;
2288: --
2289: hr_utility.set_location('hr_assignment.get_new_primary_assignment',4);
2290: FETCH get_candidate_primary_ass INTO p_new_primary_ass_id;
2291: --
2292: IF get_candidate_primary_ass%NOTFOUND THEN
2293: hr_utility.set_location('hr_assignment.get_new_primary_assignment',5);
2289: hr_utility.set_location('hr_assignment.get_new_primary_assignment',4);
2290: FETCH get_candidate_primary_ass INTO p_new_primary_ass_id;
2291: --
2292: IF get_candidate_primary_ass%NOTFOUND THEN
2293: hr_utility.set_location('hr_assignment.get_new_primary_assignment',5);
2294: CLOSE get_candidate_primary_ass;
2295: hr_utility.set_message(801,'HR_6384_EMP_ASS_NO_PRIM');
2296: hr_utility.raise_error;
2297: ELSE
2294: CLOSE get_candidate_primary_ass;
2295: hr_utility.set_message(801,'HR_6384_EMP_ASS_NO_PRIM');
2296: hr_utility.raise_error;
2297: ELSE
2298: hr_utility.set_location('hr_assignment.get_new_primary_assignment',7);
2299: FETCH get_candidate_primary_ass INTO p_new_primary_ass_id;
2300: --
2301: hr_utility.set_location('hr_assignment.get_new_primary_assignment',8);
2302: IF get_candidate_primary_ass%FOUND THEN
2297: ELSE
2298: hr_utility.set_location('hr_assignment.get_new_primary_assignment',7);
2299: FETCH get_candidate_primary_ass INTO p_new_primary_ass_id;
2300: --
2301: hr_utility.set_location('hr_assignment.get_new_primary_assignment',8);
2302: IF get_candidate_primary_ass%FOUND THEN
2303: raise local_warning;
2304: END IF;
2305: --
2302: IF get_candidate_primary_ass%FOUND THEN
2303: raise local_warning;
2304: END IF;
2305: --
2306: hr_utility.set_location('hr_assignment.get_new_primary_assignment',9);
2307: CLOSE get_candidate_primary_ass;
2308: END IF;
2309: --
2310: EXCEPTION
2343: ,p_effective_end_date IN DATE) IS
2344:
2345: --
2346: BEGIN
2347: hr_utility.set_location('hr_assignment.load_budget_values',1);
2348: --
2349: /* 25/05/95 Fixed bug 273820 - performance of following statement
2350: NB the business_group_id no longer needs +0 appended to it, this
2351: is because the view per_default_budget_values is in fact returning
2408: PER_LETTER_REQUEST_LINES
2409: PAY_COST_ALLOCATIONS_F
2410: PER_ASSIGNMENT_EXTRA_INFO
2411: PAY_PERSONAL_PAYMENT_METHODS_F
2412: HR_ASSIGNMENT_SET_AMENDMENTS
2413: PAY_ASSIGNMENT_ACTIONS
2414: PER_COBRA_COV_ENROLLMENTS
2415: PER_COBRA_COVERAGE_BENEFITS_F
2416: OTA_DELEGATE_BOOKINGS (per_ota_predel_validation.ota_predel_asg_validation)
2446: p_end_date := p_edate;
2447: --
2448: --
2449: IF p_mode = 'ZAP' THEN
2450: hr_utility.set_location('hr_assignment.del_ref_int_check',0);
2451: p_del_flag := 'N';
2452: --
2453: BEGIN
2454: select 'Y'
2479: hr_utility.raise_error;
2480: END IF;
2481: END IF;
2482: --
2483: hr_utility.set_location('hr_assignment.del_ref_int_check',1);
2484: p_del_flag := 'N';
2485: --
2486: BEGIN
2487: select 'Y'
2511: /* Took out nocopy the check on letter requests as they are now Auto Deleted
2512: - 2/6/93
2513: */
2514: /*
2515: hr_utility.set_location('hr_assignment.del_ref_int_check',2);
2516: p_del_flag := 'N';
2517: --
2518: BEGIN
2519: select 'Y'
2540: END IF;
2541: */
2542: --
2543: --
2544: hr_utility.set_location('hr_assignment.del_ref_int_check',3);
2545: p_del_flag := 'N';
2546: --
2547: BEGIN
2548: select 'Y'
2574: -- as per_assignment_extra_info are now deleted along with other
2575: -- assignment related records.
2576: --
2577: --
2578: hr_utility.set_location('hr_assignment.del_ref_int_check',5);
2579: p_del_flag := 'N';
2580: /*
2581: N.B. PER_SECONDARY_ASS_STATUSES rows will now be deleted if they
2582: started after the Assignment End Date - changed 27/5/93.
2604: END IF;
2605: */
2606: --
2607: --
2608: hr_utility.set_location('hr_assignment.del_ref_int_check',6);
2609: p_del_flag := 'N';
2610:
2611: /* 2537091: PPMs will be deleted if they started after end date of assignment
2612: changed 04-OCT-2002
2637:
2638: */
2639: --
2640: --
2641: hr_utility.set_location('hr_assignment.del_ref_int_check',7);
2642: p_del_flag := 'N';
2643: --
2644: /* BEGIN
2645: select 'Y'
2704: --
2705: --
2706: IF p_mode = 'ZAP' THEN
2707: --
2708: hr_utility.set_location('hr_assignment.del_ref_int_check',8);
2709: p_del_flag := 'N';
2710: --
2711: BEGIN
2712: select 'Y'
2713: into p_del_flag
2714: from sys.dual
2715: where exists (
2716: select null
2717: from hr_assignment_set_amendments asa
2718: where asa.assignment_id = p_assignment_id
2719: and asa.include_or_exclude = 'I'
2720: and not exists (
2721: select null
2718: where asa.assignment_id = p_assignment_id
2719: and asa.include_or_exclude = 'I'
2720: and not exists (
2721: select null
2722: from hr_assignment_set_amendments asa2
2723: where asa2.assignment_set_id = asa.assignment_set_id
2724: and asa2.assignment_id <> asa.assignment_id)
2725: );
2726: EXCEPTION
2734: END IF;
2735: ------------------------------
2736: -- Cobra Coverage Enrollments
2737: --
2738: hr_utility.set_location('hr_assignment.del_ref_int_check',9);
2739: p_del_flag := 'N';
2740: --
2741: BEGIN
2742: select 'Y'
2763: END IF;
2764: ------------------------------
2765: -- Cobra Coverage Benefits
2766: --
2767: hr_utility.set_location('hr_assignment.del_ref_int_check',9);
2768: p_del_flag := 'N';
2769: --
2770: BEGIN
2771: select 'Y'
2797: --
2798: ------------------------------
2799: -- OTA_DELEGATE_BOOKINGS
2800: --
2801: hr_utility.set_location('hr_assignment.del_ref_int_check',10);
2802: --
2803: p_del_flag := 'N';
2804: --
2805: BEGIN
2842: IF p_mode = 'ZAP' THEN
2843: --
2844: -- OTA_DELEGATE_BOOKINGS
2845:
2846: hr_utility.set_location('hr_assignment.del_ref_int_check',11);
2847: per_ota_predel_validation.ota_predel_asg_validation(P_ASSIGNMENT_ID);
2848: END IF;
2849: ---
2850: END del_ref_int_check;
2857: Performs Third Party Delete on data that is not checked in
2858: del_ref_in_check. Removes data from the following tables
2859:
2860: For 'ZAP'
2861: HR_ASSIGNMENT_SET_AMENDMENTS
2862: PER_ASSIGNMENT_BUDGET_VALUES_F
2863: PER_SPINAL_POINT_PLACEMENTS_F
2864: PER_PAY_PROPOSALS
2865:
2977: --
2978: --
2979: p_end_date := p_edate;
2980: --
2981: hr_utility.set_location('hr_assignment.del_ref_int_delete',1);
2982: p_del_flag := 'N';
2983: --
2984: BEGIN
2985: --
3024:
3025: if l_min_start_date = p_val_st_date
3026: and p_datetrack_mode = 'DELETE_NEXT_CHANGE' then
3027:
3028: hr_assignment_internal.delete_first_spp
3029: (p_effective_date => p_edate,
3030: p_assignment_id => p_assignment_id,
3031: p_validation_start_date => p_val_st_date,
3032: p_validation_end_date => p_val_end_date,
3037:
3038: else
3039:
3040: IF p_mode = 'ZAP' THEN
3041: hr_utility.set_location('hr_assignment.delete_ass_ref_int',2);
3042:
3043: l_datetrack_mode := 'ZAP';
3044:
3045: --
3252:
3253: end if;
3254: close csr_grade_step;
3255:
3256: hr_utility.set_location('hr_assignment.delete_ass_ref_int',3);
3257: --
3258: -- Removed dml and inserted call to api
3259: --
3260: /*
3273: ELSE
3274: -- If mode is 'END' then do Date Effective Delete
3275: -- from p_end_date.
3276: --
3277: hr_utility.set_location('hr_assignment.delete_ass_ref_int',4);
3278: --
3279: -- Removed dml and using api
3280: --
3281: /*
3314: end if;
3315: close csr_grade_step;
3316:
3317:
3318: /*hr_utility.set_location('hr_assignment.delete_ass_ref_int',5);
3319: UPDATE PER_SPINAL_POINT_PLACEMENTS_F
3320: SET EFFECTIVE_END_DATE = p_end_date
3321: , LAST_UPDATED_BY = p_last_updated_by
3322: , LAST_UPDATE_LOGIN = p_last_update_login
3359: --
3360: IF p_del_flag = 'Y' THEN
3361: --
3362: IF p_mode = 'ZAP' THEN
3363: hr_utility.set_location('hr_assignment.del_ref_int_delet',30);
3364: DELETE FROM PER_ASSIGNMENT_BUDGET_VALUES_F ABV
3365: WHERE ABV.ASSIGNMENT_ID = p_assignment_id;
3366:
3367: --
3369: IF p_mode = 'END' THEN
3370: -- If mode is 'END' then do Date Effective Delete
3371: -- from p_end_date.
3372: --
3373: hr_utility.set_location('hr_assignment.del_ref_int_delete',40);
3374:
3375: DELETE FROM PER_ASSIGNMENT_BUDGET_VALUES_F ABV
3376: WHERE ABV.ASSIGNMENT_ID = p_assignment_id
3377: AND ABV.EFFECTIVE_START_DATE > p_end_date;
3375: DELETE FROM PER_ASSIGNMENT_BUDGET_VALUES_F ABV
3376: WHERE ABV.ASSIGNMENT_ID = p_assignment_id
3377: AND ABV.EFFECTIVE_START_DATE > p_end_date;
3378: --
3379: hr_utility.set_location('hr_assignment.del_ref_int_delete',45);
3380: UPDATE PER_ASSIGNMENT_BUDGET_VALUES_F
3381: SET EFFECTIVE_END_DATE = p_end_date
3382: , LAST_UPDATED_BY = p_last_updated_by
3383: , LAST_UPDATE_LOGIN = p_last_update_login
3392: -- If mode is 'FUTURE' then do Date Effective Delete for all future records
3393: -- from p_end_date. Further, open the current end dated record. Set the last date
3394: -- of assignment_budget_value record same as the last date of current assignmet.
3395: --
3396: hr_utility.set_location('hr_assignment.del_ref_int_delete',46);
3397: hr_utility.set_location('p_end_date '||p_end_date, 47);
3398:
3399: DELETE FROM PER_ASSIGNMENT_BUDGET_VALUES_F ABV
3400: WHERE ABV.ASSIGNMENT_ID = p_assignment_id
3401: AND ABV.EFFECTIVE_START_DATE > p_end_date
3402: AND ABV.EFFECTIVE_END_DATE <> hr_api.g_eot;--Added as a part of fix for bug#11078262
3403: --
3404: hr_utility.set_location(' No of rows deleted '||sql%rowcount,48);
3405: hr_utility.set_location('hr_assignment.del_ref_int_delete',49);
3406:
3407: select effective_end_date into l_ass_end_date
3408: from per_all_assignments_f
3409: where assignment_id = p_assignment_id
3435: --
3436: --
3437:
3438: IF p_mode = 'ZAP' THEN
3439: hr_utility.set_location('hr_assignment.del_ref_int_delete',5);
3440: p_del_flag := 'N';
3441: --
3442: BEGIN
3443: --
3447: into p_del_flag
3448: FROM SYS.DUAL
3449: WHERE EXISTS
3450: (SELECT NULL
3451: FROM HR_ASSIGNMENT_SET_AMENDMENTS
3452: WHERE ASSIGNMENT_ID = p_assignment_id);
3453: --
3454: EXCEPTION
3455: WHEN NO_DATA_FOUND THEN NULL;
3456: END;
3457: --
3458: IF p_del_flag = 'Y' THEN
3459: --
3460: hr_utility.set_location('hr_assignment.delete_ass_ref_int',6);
3461: DELETE FROM HR_ASSIGNMENT_SET_AMENDMENTS
3462: WHERE ASSIGNMENT_ID = p_assignment_id;
3463: END IF;
3464: --
3457: --
3458: IF p_del_flag = 'Y' THEN
3459: --
3460: hr_utility.set_location('hr_assignment.delete_ass_ref_int',6);
3461: DELETE FROM HR_ASSIGNMENT_SET_AMENDMENTS
3462: WHERE ASSIGNMENT_ID = p_assignment_id;
3463: END IF;
3464: --
3465: --
3463: END IF;
3464: --
3465: --
3466: --
3467: hr_utility.set_location('hr_assignment.del_ref_int_delete',9);
3468: p_del_flag := 'N';
3469: --
3470: BEGIN
3471: --
3482: END;
3483: --
3484: IF p_del_flag = 'Y' THEN
3485: --
3486: hr_utility.set_location('hr_assignment.delete_ass_ref_int',10);
3487: DELETE FROM PER_SECONDARY_ASS_STATUSES
3488: WHERE ASSIGNMENT_ID = p_assignment_id;
3489: END IF;
3490: --
3488: WHERE ASSIGNMENT_ID = p_assignment_id;
3489: END IF;
3490: --
3491: --
3492: hr_utility.set_location('hr_assignment.del_ref_int_delete',11);
3493: p_del_flag := 'N';
3494: --
3495: BEGIN
3496: --
3507: END;
3508: --
3509: IF p_del_flag = 'Y' THEN
3510: --
3511: hr_utility.set_location('hr_assignment.delete_ass_ref_int',12);
3512: DELETE FROM PER_PAY_PROPOSALS
3513: WHERE ASSIGNMENT_ID = p_assignment_id;
3514: END IF;
3515: --
3514: END IF;
3515: --
3516: /* This is being changed for Bug# 785427 */
3517:
3518: hr_utility.set_location('hr_assignment.del_ref_int_delete',11);
3519: p_del_flag := 'N';
3520:
3521: BEGIN
3522: select 'Y'
3532: END;
3533: --
3534: IF p_del_flag = 'Y' THEN
3535: --
3536: hr_utility.set_location('hr_assignment.delete_ass_ref_int',12);
3537: /* If the federal tax record exists then the state, county
3538: and city tax records also exist (due to the defaulting of
3539: tax records). So, delete from all 4 table. In addition, delete
3540: from the table pay_us_asg_reporting as well */
3558: --
3559:
3560: -- 03/18/1998 Bug #642566
3561: -- Remove per_assignment_extra_info records
3562: hr_utility.set_location('hr_assignment.del_ref_int_delete',14);
3563: p_del_flag := 'N';
3564: --
3565: BEGIN
3566: --
3577: END;
3578: --
3579: IF p_del_flag = 'Y' THEN
3580: --
3581: hr_utility.set_location('hr_assignment.delete_ass_ref_int',16);
3582: DELETE FROM PER_ASSIGNMENT_EXTRA_INFO
3583: WHERE ASSIGNMENT_ID = p_assignment_id;
3584: END IF;
3585: -- 03/18/1998 Change Ends
3687: ,p_cost_warning OUT NOCOPY BOOLEAN) IS
3688: --
3689: p_del_flag VARCHAR2(1) := 'N';
3690: l_exists NUMBER := 0;
3691: l_proc VARCHAR(72) := 'hr_assignment.tidy_up_ref_int';
3692: l_effective_start_Date DATE;
3693: l_effective_end_date DATE;
3694: --
3695: -- Retrieve all current Assignment Rate records for the assignment.
3717: AND p_mode='END';
3718: --
3719: BEGIN
3720: --
3721: hr_utility.set_location('hr_assignment.tidy_up_ref_int',1);
3722: --
3723: p_cost_warning := FALSE;
3724: BEGIN
3725: select 'Y'
3742: END;
3743: --
3744: IF p_del_flag = 'Y' THEN
3745: --
3746: hr_utility.set_location('hr_assignment.tidy_up_ref_int',2);
3747: --
3748: update per_secondary_ass_statuses
3749: set END_DATE = decode(p_new_end_date,to_date('31/12/4712','DD/MM/YYYY'),
3750: null,p_new_end_date)
3763: END IF;
3764: --
3765: p_del_flag := 'N';
3766: --
3767: hr_utility.set_location('hr_assignment.tidy_up_ref_int',3);
3768: --
3769: BEGIN
3770: select 'Y'
3771: into p_del_flag
3781: END;
3782: --
3783: IF p_del_flag = 'Y' THEN
3784: --
3785: hr_utility.set_location('hr_assignment.tidy_up_ref_int',4);
3786: --
3787: delete from per_secondary_ass_statuses
3788: where assignment_id = p_assignment_id
3789: and p_mode = 'END'
3791: END IF;
3792: --
3793: p_del_flag := 'N';
3794: --
3795: hr_utility.set_location('hr_assignment.tidy_up_ref_int',5);
3796: --
3797: BEGIN
3798: select 'Y'
3799: into p_del_flag
3813: END;
3814: --
3815: IF p_del_flag = 'Y' THEN
3816: --
3817: hr_utility.set_location('hr_assignment.tidy_up_ref_int',6);
3818:
3819: if p_mode = 'END' then
3820: hr_utility.set_location('hr_assignment.tidy_up_ref_int',7);
3821: update pay_cost_allocations_f
3816: --
3817: hr_utility.set_location('hr_assignment.tidy_up_ref_int',6);
3818:
3819: if p_mode = 'END' then
3820: hr_utility.set_location('hr_assignment.tidy_up_ref_int',7);
3821: update pay_cost_allocations_f
3822: set effective_end_date = p_new_end_date
3823: , last_updated_by = P_LAST_UPDATED_BY
3824: , last_update_login = P_LAST_UPDATE_LOGIN
3827: and ((p_mode = 'END'
3828: and p_new_end_date
3829: between effective_start_date and effective_end_date));
3830: elsif p_mode='FUTURE' then
3831: hr_utility.set_location('hr_assignment.tidy_up_ref_int',8);
3832:
3833: /*
3834: ** When dealing with delete FUTURE_CHANGE, only open out
3835: ** the costing record if no future costing record exists.
3842: where assignment_id = p_assignment_id
3843: and effective_start_date > p_old_end_date;
3844:
3845: if l_exists = 0 then
3846: hr_utility.set_location('hr_assignment.tidy_up_ref_int',9);
3847: update pay_cost_allocations_f
3848: set effective_end_date = p_new_end_date
3849: , last_updated_by = P_LAST_UPDATED_BY
3850: , last_update_login = P_LAST_UPDATE_LOGIN
3852: where assignment_id = p_assignment_id
3853: and (p_mode = 'FUTURE'
3854: and p_old_end_date = effective_end_date);
3855: else
3856: hr_utility.set_location('hr_assignment.tidy_up_ref_int',10);
3857: p_cost_warning := TRUE;
3858: end if;
3859:
3860: end if;
3875: hr_utility.set_location(p_new_end_date,11);
3876: hr_utility.set_location(p_mode,12);
3877: hr_utility.set_location(p_old_end_date,13);
3878:
3879: hr_utility.set_location('hr_assignment.tidy_up_ref_int',15);
3880:
3881: p_del_flag := 'N';
3882:
3883: --
3897: END;
3898: --
3899: IF p_del_flag = 'Y' THEN
3900: --
3901: hr_utility.set_location('hr_assignment.tidy_up_ref_int',20);
3902: --
3903: delete from per_assignment_budget_values_f abv
3904: where abv.assignment_id = p_assignment_id
3905: and p_mode = 'END'
3907: END IF;
3908:
3909: p_del_flag := 'N';
3910: --
3911: hr_utility.set_location('hr_assignment.tidy_up_ref_int',25);
3912:
3913:
3914: BEGIN
3915: select 'Y'
3927: END;
3928:
3929: IF p_del_flag = 'Y' THEN
3930: --
3931: hr_utility.set_location('hr_assignment.tidy_up_ref_int',30);
3932: --
3933: update per_assignment_budget_values_f abv
3934: set abv.effective_end_date = p_new_end_date
3935: , abv.last_updated_by = P_LAST_UPDATED_BY
3941:
3942: END IF;
3943:
3944: --
3945: hr_utility.set_location('hr_assignment.tidy_up_ref_int',35);
3946: --
3947: -- # 2437795
3948: -- Reversing TAX records
3949: --
3948: -- Reversing TAX records
3949: --
3950: IF p_mode = 'FUTURE' THEN
3951: --
3952: hr_utility.set_location('hr_assignment.tidy_up_ref_int',42);
3953: hr_utility.trace(' **** old end date = '||to_char(p_old_end_date,'dd-mon-yyyy'));
3954: declare
3955: cursor csr_asg is
3956: select max(effective_end_date)
3966: pay_us_update_tax_rec_pkg.reverse_term_emp_tax_records(p_assignment_id, l_end_date);
3967: end if;
3968: end;
3969: --
3970: hr_utility.set_location('hr_assignment.tidy_up_ref_int',45);
3971: END IF;
3972: -- end #2437795
3973: --
3974: --adhunter added for bug 2537091 04-OCT-02
3973: --
3974: --adhunter added for bug 2537091 04-OCT-02
3975: --need to handle pay_personal_payment_methods in the same way as the others above.
3976: --
3977: hr_utility.set_location('hr_assignment.tidy_up_ref_int',50);
3978: DECLARE
3979: l_effective_start_date date;
3980: l_effective_end_date date;
3981: --
4297: N.B. Strictly the FPD should also be set in the case when the operation
4298: is removing the assignment END date. However this is complicated
4299: by the fact that under certain circumstances the END date may be
4300: automatically moved to be at the ATD (see
4301: hr_assignment.check_term).
4302:
4303: This is not too problematic because a call to
4304: maintain_entries_asg will end any entries that are left open
4305: incorrectly.
4351: date of the current operation then cancellation of entries
4352: will be required
4353: -----------------------------------------------------------------*/
4354: --
4355: hr_utility.set_location('hr_assignment.test_for_cancel_reterm',1);
4356: if p_mode in ('CORRECTION'
4357: ,'UPDATE'
4358: ,'UPDATE_OVERRIDE'
4359: ,'UPDATE_CHANGE_INSERT' )
4455: l_cobra_term_exists VARCHAR2(1);
4456: local_warning exception;
4457: --
4458: BEGIN
4459: hr_utility.set_location('hr_assignment.check_for_cobra',1);
4460: BEGIN
4461: select 'Y'
4462: into l_cobra_term_exists
4463: from sys.dual
4479: EXCEPTION
4480: WHEN NO_DATA_FOUND THEN NULL;
4481: END;
4482: --
4483: hr_utility.set_location('hr_assignment.check_for_cobra',2);
4484: if l_cobra_term_exists = 'Y' then
4485: raise local_warning;
4486: end if;
4487: --
4590: where business_group_id = p_business_group_id);
4591: --
4592: begin
4593: --
4594: hr_utility.set_location('Entering hr_assignment.per_dflt_asg_cost_alloc_ff',25);
4595: --
4596: open c_formula_id(l_formula_name, p_business_group_id, p_effective_date);
4597: fetch c_formula_id into l_formula_id;
4598: --
4595: --
4596: open c_formula_id(l_formula_name, p_business_group_id, p_effective_date);
4597: fetch c_formula_id into l_formula_id;
4598: --
4599: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',26);
4600: --
4601: if c_formula_id%notfound then
4602: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',27);
4603: close c_formula_id;
4598: --
4599: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',26);
4600: --
4601: if c_formula_id%notfound then
4602: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',27);
4603: close c_formula_id;
4604: return 'N';
4605: end if;
4606: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',28);
4602: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',27);
4603: close c_formula_id;
4604: return 'N';
4605: end if;
4606: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',28);
4607: close c_formula_id;
4608: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff-formula_id :'
4609: || l_formula_id,29);
4610: -- Insert fnd_sessions row
4604: return 'N';
4605: end if;
4606: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',28);
4607: close c_formula_id;
4608: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff-formula_id :'
4609: || l_formula_id,29);
4610: -- Insert fnd_sessions row
4611: open c_session_date;
4612: fetch c_session_date into l_session_date;
4609: || l_formula_id,29);
4610: -- Insert fnd_sessions row
4611: open c_session_date;
4612: fetch c_session_date into l_session_date;
4613: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff' || l_session_date,30);
4614: if c_session_date%notfound then
4615: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',31);
4616: insert into fnd_sessions (SESSION_ID, EFFECTIVE_DATE) values(userenv('sessionid'), trunc(p_effective_date));
4617: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',32);
4611: open c_session_date;
4612: fetch c_session_date into l_session_date;
4613: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff' || l_session_date,30);
4614: if c_session_date%notfound then
4615: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',31);
4616: insert into fnd_sessions (SESSION_ID, EFFECTIVE_DATE) values(userenv('sessionid'), trunc(p_effective_date));
4617: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',32);
4618: end if;
4619: --
4613: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff' || l_session_date,30);
4614: if c_session_date%notfound then
4615: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',31);
4616: insert into fnd_sessions (SESSION_ID, EFFECTIVE_DATE) values(userenv('sessionid'), trunc(p_effective_date));
4617: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',32);
4618: end if;
4619: --
4620: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',33);
4621: -- Initialize the formula
4616: insert into fnd_sessions (SESSION_ID, EFFECTIVE_DATE) values(userenv('sessionid'), trunc(p_effective_date));
4617: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',32);
4618: end if;
4619: --
4620: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',33);
4621: -- Initialize the formula
4622: ff_exec.init_formula(l_formula_id,p_effective_date, l_inputs, l_outputs);
4623: --
4624: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',34);
4620: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',33);
4621: -- Initialize the formula
4622: ff_exec.init_formula(l_formula_id,p_effective_date, l_inputs, l_outputs);
4623: --
4624: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',34);
4625: --
4626: --set the inputs
4627: --
4628: for i in nvl(l_inputs.first,0) .. nvl(l_inputs.last,-1) loop
4636: l_inputs(i).value := trunc(p_effective_date);
4637: end if;
4638: end loop;
4639: --
4640: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',35);
4641: --
4642: ff_exec.run_formula(l_inputs, l_outputs);
4643: --
4644: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',36);
4640: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',35);
4641: --
4642: ff_exec.run_formula(l_inputs, l_outputs);
4643: --
4644: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',36);
4645: --
4646: for i in nvl(l_outputs.first,0) .. nvl(l_outputs.last,-1) loop
4647: if (l_outputs(i).name = 'USE_FORMULA') then
4648: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff-'|| l_outputs(i).value,361);
4644: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',36);
4645: --
4646: for i in nvl(l_outputs.first,0) .. nvl(l_outputs.last,-1) loop
4647: if (l_outputs(i).name = 'USE_FORMULA') then
4648: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff-'|| l_outputs(i).value,361);
4649: l_use_formula := nvl(l_outputs(i).value,'N');
4650: if (l_use_formula <> 'Y')then
4651: return 'N';
4652: end if;
4650: if (l_use_formula <> 'Y')then
4651: return 'N';
4652: end if;
4653: elsif (substr(l_outputs(i).name,1,26) = 'COST_ALLOCATION_KEYFLEX_ID') then
4654: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff-'|| l_outputs(i).value,362);
4655: l_rec(to_number(substr(l_outputs(i).name,27))).cost_allocation_keyflex_id := l_outputs(i).value;
4656: elsif (substr(l_outputs(i).name,1,10) = 'PROPORTION') then
4657: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff-'|| l_outputs(i).value,363);
4658: l_rec(to_number(substr(l_outputs(i).name,11))).PROPORTION := l_outputs(i).value;
4653: elsif (substr(l_outputs(i).name,1,26) = 'COST_ALLOCATION_KEYFLEX_ID') then
4654: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff-'|| l_outputs(i).value,362);
4655: l_rec(to_number(substr(l_outputs(i).name,27))).cost_allocation_keyflex_id := l_outputs(i).value;
4656: elsif (substr(l_outputs(i).name,1,10) = 'PROPORTION') then
4657: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff-'|| l_outputs(i).value,363);
4658: l_rec(to_number(substr(l_outputs(i).name,11))).PROPORTION := l_outputs(i).value;
4659: end if;
4660: end loop;
4661: --
4658: l_rec(to_number(substr(l_outputs(i).name,11))).PROPORTION := l_outputs(i).value;
4659: end if;
4660: end loop;
4661: --
4662: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',37);
4663: --
4664: if l_use_formula = 'Y' then
4665: for i in nvl(l_rec.first,0) .. nvl(l_rec.last,-1) loop
4666: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff l_rec(i).cost_all_kf_id'
4662: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',37);
4663: --
4664: if l_use_formula = 'Y' then
4665: for i in nvl(l_rec.first,0) .. nvl(l_rec.last,-1) loop
4666: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff l_rec(i).cost_all_kf_id'
4667: || l_rec(i).cost_allocation_keyflex_id,381);
4668: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff l_rec(i).proportion'
4669: || l_rec(i).proportion,382);
4670: if (nvl(l_rec(i).cost_allocation_keyflex_id, -1) <> -1) then
4664: if l_use_formula = 'Y' then
4665: for i in nvl(l_rec.first,0) .. nvl(l_rec.last,-1) loop
4666: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff l_rec(i).cost_all_kf_id'
4667: || l_rec(i).cost_allocation_keyflex_id,381);
4668: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff l_rec(i).proportion'
4669: || l_rec(i).proportion,382);
4670: if (nvl(l_rec(i).cost_allocation_keyflex_id, -1) <> -1) then
4671: --
4672: --
4669: || l_rec(i).proportion,382);
4670: if (nvl(l_rec(i).cost_allocation_keyflex_id, -1) <> -1) then
4671: --
4672: --
4673: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff - l_rec(i).proportion:'||l_rec(i).proportion,313);
4674: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff - l_rec(i).cost_kf_id:'||l_rec(i).cost_allocation_keyflex_id,314);
4675: --
4676: l_proportion := trunc(l_rec(i).proportion,4);
4677: --
4670: if (nvl(l_rec(i).cost_allocation_keyflex_id, -1) <> -1) then
4671: --
4672: --
4673: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff - l_rec(i).proportion:'||l_rec(i).proportion,313);
4674: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff - l_rec(i).cost_kf_id:'||l_rec(i).cost_allocation_keyflex_id,314);
4675: --
4676: l_proportion := trunc(l_rec(i).proportion,4);
4677: --
4678: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff - l_proportion1 :'||l_proportion,315);
4674: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff - l_rec(i).cost_kf_id:'||l_rec(i).cost_allocation_keyflex_id,314);
4675: --
4676: l_proportion := trunc(l_rec(i).proportion,4);
4677: --
4678: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff - l_proportion1 :'||l_proportion,315);
4679: if l_proportion > 1 then
4680: l_proportion := 1;
4681: end if;
4682: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff - l_proportion2 :'||l_proportion,316);
4678: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff - l_proportion1 :'||l_proportion,315);
4679: if l_proportion > 1 then
4680: l_proportion := 1;
4681: end if;
4682: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff - l_proportion2 :'||l_proportion,316);
4683: --
4684: if l_proportion > 0 then
4685: for r3 in c_cost_allocation_keyflex(l_rec(i).cost_allocation_keyflex_id) loop
4686: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',39);
4682: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff - l_proportion2 :'||l_proportion,316);
4683: --
4684: if l_proportion > 0 then
4685: for r3 in c_cost_allocation_keyflex(l_rec(i).cost_allocation_keyflex_id) loop
4686: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',39);
4687: --
4688: pay_cost_allocation_api.create_cost_allocation(
4689: p_validate =>false ,
4690: p_effective_date =>p_effective_date,
4729: p_segment30 =>r3.segment30,
4730: p_concat_segments =>r3.concatenated_segments
4731: );
4732: end loop;
4733: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',391);
4734: --
4735: end if;
4736: --
4737: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',40);
4733: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',391);
4734: --
4735: end if;
4736: --
4737: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',40);
4738: --
4739: end if;
4740: --
4741: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',41);
4737: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',40);
4738: --
4739: end if;
4740: --
4741: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',41);
4742: --
4743: end loop;
4744: --
4745: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',42);
4741: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',41);
4742: --
4743: end loop;
4744: --
4745: hr_utility.set_location('hr_assignment.per_dflt_asg_cost_alloc_ff',42);
4746: --
4747: return 'Y';
4748: --
4749: end if;
4747: return 'Y';
4748: --
4749: end if;
4750: --
4751: hr_utility.set_location('Leaving hr_assignment.per_dflt_asg_cost_alloc_ff',43);
4752: --
4753: return 'N';
4754: --
4755: end;
4873: or hr_psf_shd.system_availability_status(budget_unit3_id) = 'MONEY')
4874: );
4875: --
4876: BEGIN
4877: hr_utility.set_location('hr_assignment.load_assignment_allocation',1);
4878: --
4879: if nvl(fnd_profile.value('HR_DEFAULT_ASG_COST_ALLOC'),'N') <> 'Y' then
4880: return;
4881: end if;
4879: if nvl(fnd_profile.value('HR_DEFAULT_ASG_COST_ALLOC'),'N') <> 'Y' then
4880: return;
4881: end if;
4882: --
4883: hr_utility.set_location('hr_assignment.load_assignment_allocation',2);
4884: --
4885: if p_position_id is null then
4886: return;
4887: end if;
4885: if p_position_id is null then
4886: return;
4887: end if;
4888: --
4889: hr_utility.set_location('hr_assignment.load_assignment_allocation',3);
4890: hr_utility.set_location('hr_assignment.load_assignment_allocation - effec date :'|| p_effective_date,3);
4891: hr_utility.set_location('hr_assignment.load_assignment_allocation - p_position_id :'|| p_position_id,3);
4892: hr_utility.set_location('hr_assignment.load_assignment_allocation - assignment_id :'|| p_assignment_id,3);
4893: hr_utility.set_location('hr_assignment.load_assignment_allocation - business_group_id :'|| p_business_group_id,3);
4886: return;
4887: end if;
4888: --
4889: hr_utility.set_location('hr_assignment.load_assignment_allocation',3);
4890: hr_utility.set_location('hr_assignment.load_assignment_allocation - effec date :'|| p_effective_date,3);
4891: hr_utility.set_location('hr_assignment.load_assignment_allocation - p_position_id :'|| p_position_id,3);
4892: hr_utility.set_location('hr_assignment.load_assignment_allocation - assignment_id :'|| p_assignment_id,3);
4893: hr_utility.set_location('hr_assignment.load_assignment_allocation - business_group_id :'|| p_business_group_id,3);
4894: --
4887: end if;
4888: --
4889: hr_utility.set_location('hr_assignment.load_assignment_allocation',3);
4890: hr_utility.set_location('hr_assignment.load_assignment_allocation - effec date :'|| p_effective_date,3);
4891: hr_utility.set_location('hr_assignment.load_assignment_allocation - p_position_id :'|| p_position_id,3);
4892: hr_utility.set_location('hr_assignment.load_assignment_allocation - assignment_id :'|| p_assignment_id,3);
4893: hr_utility.set_location('hr_assignment.load_assignment_allocation - business_group_id :'|| p_business_group_id,3);
4894: --
4895: open c_asg_cost_allocations(p_assignment_id);
4888: --
4889: hr_utility.set_location('hr_assignment.load_assignment_allocation',3);
4890: hr_utility.set_location('hr_assignment.load_assignment_allocation - effec date :'|| p_effective_date,3);
4891: hr_utility.set_location('hr_assignment.load_assignment_allocation - p_position_id :'|| p_position_id,3);
4892: hr_utility.set_location('hr_assignment.load_assignment_allocation - assignment_id :'|| p_assignment_id,3);
4893: hr_utility.set_location('hr_assignment.load_assignment_allocation - business_group_id :'|| p_business_group_id,3);
4894: --
4895: open c_asg_cost_allocations(p_assignment_id);
4896: fetch c_asg_cost_allocations into l_dummy;
4889: hr_utility.set_location('hr_assignment.load_assignment_allocation',3);
4890: hr_utility.set_location('hr_assignment.load_assignment_allocation - effec date :'|| p_effective_date,3);
4891: hr_utility.set_location('hr_assignment.load_assignment_allocation - p_position_id :'|| p_position_id,3);
4892: hr_utility.set_location('hr_assignment.load_assignment_allocation - assignment_id :'|| p_assignment_id,3);
4893: hr_utility.set_location('hr_assignment.load_assignment_allocation - business_group_id :'|| p_business_group_id,3);
4894: --
4895: open c_asg_cost_allocations(p_assignment_id);
4896: fetch c_asg_cost_allocations into l_dummy;
4897: if c_asg_cost_allocations%found then
4894: --
4895: open c_asg_cost_allocations(p_assignment_id);
4896: fetch c_asg_cost_allocations into l_dummy;
4897: if c_asg_cost_allocations%found then
4898: hr_utility.set_location('hr_assignment.load_assignment_allocation',4);
4899: return;
4900: end if;
4901: --
4902: hr_utility.set_location('hr_assignment.load_assignment_allocation',5);
4898: hr_utility.set_location('hr_assignment.load_assignment_allocation',4);
4899: return;
4900: end if;
4901: --
4902: hr_utility.set_location('hr_assignment.load_assignment_allocation',5);
4903: --
4904: if (per_dflt_asg_cost_alloc_ff(p_assignment_id, p_business_group_id, p_position_id, p_effective_date) = 'Y') then
4905: hr_utility.set_location('hr_assignment.load_assignment_allocation',6);
4906: return;
4901: --
4902: hr_utility.set_location('hr_assignment.load_assignment_allocation',5);
4903: --
4904: if (per_dflt_asg_cost_alloc_ff(p_assignment_id, p_business_group_id, p_position_id, p_effective_date) = 'Y') then
4905: hr_utility.set_location('hr_assignment.load_assignment_allocation',6);
4906: return;
4907: end if;
4908: --
4909: hr_utility.set_location('hr_assignment.load_assignment_allocation',7);
4905: hr_utility.set_location('hr_assignment.load_assignment_allocation',6);
4906: return;
4907: end if;
4908: --
4909: hr_utility.set_location('hr_assignment.load_assignment_allocation',7);
4910: --
4911: open c0;
4912: fetch c0 into l_unit1, l_unit2, l_unit3;
4913: close c0;
4911: open c0;
4912: fetch c0 into l_unit1, l_unit2, l_unit3;
4913: close c0;
4914: --
4915: hr_utility.set_location('hr_assignment.load_assignment_allocation - ' || l_unit1,8);
4916: hr_utility.set_location('hr_assignment.load_assignment_allocation - ' || l_unit2,9);
4917: hr_utility.set_location('hr_assignment.load_assignment_allocation - ' || l_unit3,10);
4918: --
4919: open c2(l_unit1, l_unit2, l_unit3);
4912: fetch c0 into l_unit1, l_unit2, l_unit3;
4913: close c0;
4914: --
4915: hr_utility.set_location('hr_assignment.load_assignment_allocation - ' || l_unit1,8);
4916: hr_utility.set_location('hr_assignment.load_assignment_allocation - ' || l_unit2,9);
4917: hr_utility.set_location('hr_assignment.load_assignment_allocation - ' || l_unit3,10);
4918: --
4919: open c2(l_unit1, l_unit2, l_unit3);
4920: fetch c2 into l_period_value;
4913: close c0;
4914: --
4915: hr_utility.set_location('hr_assignment.load_assignment_allocation - ' || l_unit1,8);
4916: hr_utility.set_location('hr_assignment.load_assignment_allocation - ' || l_unit2,9);
4917: hr_utility.set_location('hr_assignment.load_assignment_allocation - ' || l_unit3,10);
4918: --
4919: open c2(l_unit1, l_unit2, l_unit3);
4920: fetch c2 into l_period_value;
4921: close c2;
4919: open c2(l_unit1, l_unit2, l_unit3);
4920: fetch c2 into l_period_value;
4921: close c2;
4922: --
4923: hr_utility.set_location('hr_assignment.load_assignment_allocation - '|| l_period_value,11);
4924: --
4925: if nvl(l_period_value,0) <> 0 then
4926: --
4927: hr_utility.set_location('hr_assignment.load_assignment_allocation ',12);
4923: hr_utility.set_location('hr_assignment.load_assignment_allocation - '|| l_period_value,11);
4924: --
4925: if nvl(l_period_value,0) <> 0 then
4926: --
4927: hr_utility.set_location('hr_assignment.load_assignment_allocation ',12);
4928: --
4929: for r1 in c1(l_unit1, l_unit2, l_unit3) loop
4930: --
4931: hr_utility.set_location('hr_assignment.load_assignment_allocation - '||r1.proportion,13);
4927: hr_utility.set_location('hr_assignment.load_assignment_allocation ',12);
4928: --
4929: for r1 in c1(l_unit1, l_unit2, l_unit3) loop
4930: --
4931: hr_utility.set_location('hr_assignment.load_assignment_allocation - '||r1.proportion,13);
4932: hr_utility.set_location('hr_assignment.load_assignment_allocation - '||r1.cost_allocation_keyflex_id,14);
4933: --
4934: l_proportion := trunc(r1.proportion/l_period_value,4);
4935: --
4928: --
4929: for r1 in c1(l_unit1, l_unit2, l_unit3) loop
4930: --
4931: hr_utility.set_location('hr_assignment.load_assignment_allocation - '||r1.proportion,13);
4932: hr_utility.set_location('hr_assignment.load_assignment_allocation - '||r1.cost_allocation_keyflex_id,14);
4933: --
4934: l_proportion := trunc(r1.proportion/l_period_value,4);
4935: --
4936: if l_proportion > 1 then
4986: end loop;
4987: --
4988: end if;
4989: --
4990: hr_utility.set_location('hr_assignment.load_assignment_allocation ',15);
4991: --
4992: end loop;
4993: --
4994: hr_utility.set_location('hr_assignment.load_assignment_allocation ',16);
4990: hr_utility.set_location('hr_assignment.load_assignment_allocation ',15);
4991: --
4992: end loop;
4993: --
4994: hr_utility.set_location('hr_assignment.load_assignment_allocation ',16);
4995: --
4996: end if;
4997: --
4998: hr_utility.set_location('hr_assignment.load_assignment_allocation ',17);
4994: hr_utility.set_location('hr_assignment.load_assignment_allocation ',16);
4995: --
4996: end if;
4997: --
4998: hr_utility.set_location('hr_assignment.load_assignment_allocation ',17);
4999: --
5000: END load_assignment_allocation;
5001: -----------------------------------------------------------------------
5002: -- update_assgn_context_value
5081: l_sql := '
5082: declare
5083: g_rec per_assignments_v%rowtype;
5084: begin
5085: HR_ASSIGNMENT.get_assgn_dff_value('||p_business_group_id||','||p_person_id||','||p_assignment_id||','||':1,g_rec);
5086: select g_rec.'||l_context_val||' into :2 from dual;
5087: end;';
5088:
5089: EXECUTE IMMEDIATE l_sql using
5390: END get_assgn_dff_value;
5391:
5392: --end for bug 6598795
5393: ---------------------------------------------------------------------------------------
5394: end hr_assignment;