1: package body HXC_SUPERVISOR_DASHBOARD AS
2: /* $Header: hxcsupdash.pkb 120.0.12020000.7 2013/03/13 06:56:33 pravesk noship $ */
3:
4: g_package varchar2(33) := ' hxc_supervisor_dashboard.';
5: g_debug BOOLEAN := hr_utility.debug_enabled;
6:
7: /*
8: Procedure which will dump data into temporary table
9: hxc_tcd_timecards and hxc_tcd_status_count.
300: * this detail must be preserved after the period generation. Hence the duplicate values are deleted here.
301: */
302:
303: IF g_debug THEN
304: hr_utility.trace('deleting temp extra records');
305: END IF;
306:
307: DELETE FROM hxc_temp_tcd
308: WHERE resource_id in (SELECT distinct resource_id FROM hxc_temp_tcd WHERE period_exist = 'P' or period_exist = 'p')
316: WHERE resource_id in (SELECT distinct resource_id FROM hxc_temp_tcd WHERE period_exist = 'r')
317: AND period_exist = 'R';
318:
319: IF g_debug THEN
320: hr_utility.trace('deleting temp extra records completed');
321: END IF;
322:
323: END delete_temp_extra_rec;
324:
328: BEGIN
329:
330: IF g_debug THEN
331: l_proc := g_package||'delete_extra_rec';
332: hr_utility.set_location('Entering:'|| l_proc, 10);
333: END IF;
334:
335: DELETE
336: FROM HXC_TCD_TIMECARDS htt
374:
375:
376: IF g_debug THEN
377: l_proc := g_package||'delete_extra_rec';
378: hr_utility.set_location('Leaving:'|| l_proc, 20);
379: END IF;
380:
381: END delete_extra_rec;
382:
385: AS
386: BEGIN
387: IF g_debug THEN
388: l_proc := g_package||'delete_person_temp';
389: hr_utility.set_location('Entering:'|| l_proc, 10);
390: END IF;
391:
392: DELETE FROM HXC_TEMP_TCD
393: WHERE recurring_period_id <> p_recurring_period
395: AND PERIOD_EXIST = 'T';
396:
397: IF g_debug THEN
398: l_proc := g_package||'delete_person_temp';
399: hr_utility.set_location('Leaving:'|| l_proc, 20);
400: END IF;
401:
402: END delete_person_temp;
403:
408: BEGIN
409:
410: IF g_debug THEN
411: l_proc := g_package||'clear_all_temp_tab';
412: hr_utility.set_location('Entering:'|| l_proc, 10);
413: END IF;
414:
415: DELETE FROM HXC_TEMP_TCD
416: WHERE user_id = p_user_id;
424: COMMIT;
425:
426: IF g_debug THEN
427: l_proc := g_package||'clear_all_temp_tab';
428: hr_utility.set_location('Leaving:'|| l_proc, 20);
429: END IF;
430:
431: END clear_all_temp_tab;
432:
449: BEGIN
450:
451: IF g_debug THEN
452: l_proc := g_package||'clear_all_inactive_logins';
453: hr_utility.set_location('Entering:'|| l_proc, 10);
454: END IF;
455:
456: OPEN c_get_inactive_sessions;
457: LOOP
471: COMMIT;
472:
473: IF g_debug THEN
474: l_proc := g_package||'clear_all_inactive_logins';
475: hr_utility.set_location('Leaving:'|| l_proc, 20);
476: END IF;
477:
478: END clear_all_inactive_logins;
479:
487: BEGIN
488:
489: IF g_debug THEN
490: l_proc := g_package||'build_person_sql';
491: hr_utility.set_location('Entering:'|| l_proc, 10);
492: END IF;
493:
494: IF p_org_id IS NULL OR p_org_id = ''
495: THEN
506: p_sql := p_sql || ' AND location_id = :6 ';
507: END IF;
508:
509: IF g_debug THEN
510: hr_utility.trace('build_person_sql returing query :: '||p_sql);
511: hr_utility.set_location('Leaving:'|| l_proc, 20);
512: END IF;
513:
514: RETURN p_sql;
507: END IF;
508:
509: IF g_debug THEN
510: hr_utility.trace('build_person_sql returing query :: '||p_sql);
511: hr_utility.set_location('Leaving:'|| l_proc, 20);
512: END IF;
513:
514: RETURN p_sql;
515:
546:
547: BEGIN
548:
549: IF g_debug THEN
550: hr_utility.trace('Entering semi-monthly period generation ');
551: END IF;
552:
553: l_act_end_date := p_start_date - 1; --From the period start date fetching the end date.
554: l_end_day := to_number(to_char(l_act_end_date,'DD')); --Fetching the day from the actual end date
561: l_bool_mid_period := TRUE;
562: END IF;
563:
564: IF g_debug THEN
565: hr_utility.trace('l_act_end_date :: '||l_act_end_date);
566: hr_utility.trace('p_stop_date :: '||p_stop_date);
567: END IF;
568:
569: WHILE (l_act_end_date < p_stop_date)
562: END IF;
563:
564: IF g_debug THEN
565: hr_utility.trace('l_act_end_date :: '||l_act_end_date);
566: hr_utility.trace('p_stop_date :: '||p_stop_date);
567: END IF;
568:
569: WHILE (l_act_end_date < p_stop_date)
570: LOOP
603: l_count := l_count + 1;
604: END LOOP;
605:
606: IF g_debug THEN
607: hr_utility.trace('Leaving semi-monthly period generation ');
608: END IF;
609:
610: RETURN l_period_end_date;
611:
619: BEGIN
620:
621: IF g_debug THEN
622: l_proc := g_package||'build_all_person_sql';
623: hr_utility.set_location('Entering:'|| l_proc, 10);
624: END IF;
625:
626: IF p_org_id IS NULL OR p_org_id = ''
627: THEN
638: p_sql := p_sql || ' AND location_id = :9 ';
639: END IF;
640:
641: IF g_debug THEN
642: hr_utility.trace('p_sql generated for all_person is :: '||p_sql);
643: hr_utility.set_location('Leaving:'|| l_proc, 20);
644: END IF;
645:
646: RETURN p_sql;
639: END IF;
640:
641: IF g_debug THEN
642: hr_utility.trace('p_sql generated for all_person is :: '||p_sql);
643: hr_utility.set_location('Leaving:'|| l_proc, 20);
644: END IF;
645:
646: RETURN p_sql;
647:
756:
757: BEGIN
758:
759: IF g_debug THEN
760: hr_utility.trace('Entering update assignment changes ');
761: END IF;
762:
763: OPEN c_emp_hire_records(l_user_id,'R');
764: LOOP
862:
863: open c_get_suspended_assignments(l_user_id);
864: loop
865: fetch c_get_suspended_assignments BULK COLLECT INTO l_start_time, l_stop_time, l_resource_id, l_exist LIMIT 500;
866: hr_utility.trace('count :: '||l_resource_id.count);
867: exit when l_resource_id.count = 0;
868:
869: FORALL i IN l_resource_id.FIRST..l_resource_id.LAST
870: UPDATE hxc_temp_tcd
880:
881: open c_get_assginment_dates(l_user_id);
882: loop
883: fetch c_get_assginment_dates BULK COLLECT INTO l_resource_id,l_start_time,l_stop_time,l_period_start_date, l_period_end_date LIMIT 500;
884: hr_utility.trace('count :: '||l_resource_id.count);
885: exit when l_resource_id.count = 0;
886:
887:
888: FORALL i IN l_resource_id.FIRST..l_resource_id.LAST
897:
898: close c_get_assginment_dates;
899:
900: IF g_debug THEN
901: hr_utility.trace('Leaving update assignment changes ');
902: END IF;
903:
904: END update_assignment_changes;
905:
933: BEGIN
934:
935: IF g_debug THEN
936: l_proc := g_package||'update_person_det';
937: hr_utility.set_location('Entering:'|| l_proc, 10);
938: END IF;
939:
940: OPEN c_person_temp(p_user_id);
941: LOOP
956: END LOOP;
957: CLOSE c_person_temp;
958:
959: IF g_debug THEN
960: hr_utility.set_location('Leaving:'|| l_proc, 20);
961: END IF;
962:
963: END update_person_det;
964:
987: BEGIN
988:
989: IF g_debug THEN
990: l_proc := g_package||'update_payroll';
991: hr_utility.set_location('Entering:'|| l_proc, 10);
992: END IF;
993:
994: OPEN c_payroll_temp(p_user_id);
995: LOOP
1006: END LOOP;
1007: CLOSE c_payroll_temp;
1008:
1009: IF g_debug THEN
1010: hr_utility.set_location('Leaving:'|| l_proc, 20);
1011: END IF;
1012:
1013: END update_payroll;
1014:
1035: BEGIN
1036:
1037: IF g_debug THEN
1038: l_proc := g_package||'update_organization';
1039: hr_utility.set_location('Entering:'|| l_proc, 10);
1040: END IF;
1041:
1042: OPEN c_organization_temp(p_user_id);
1043: LOOP
1055: END LOOP;
1056: CLOSE c_organization_temp;
1057:
1058: IF g_debug THEN
1059: hr_utility.set_location('Leaving:'|| l_proc, 20);
1060: END IF;
1061:
1062: END update_organization;
1063:
1087: BEGIN
1088:
1089: IF g_debug THEN
1090: l_proc := g_package||'update_location';
1091: hr_utility.set_location('Entering:'|| l_proc, 10);
1092: END IF;
1093:
1094: OPEN c_location_temp(p_user_id);
1095: LOOP
1107: END LOOP;
1108: CLOSE c_location_temp;
1109:
1110: IF g_debug THEN
1111: hr_utility.set_location('Leaving:'|| l_proc, 20);
1112: END IF;
1113:
1114: END update_location;
1115:
1137: BEGIN
1138:
1139: IF g_debug THEN
1140: l_proc := g_package||'update_supervisor';
1141: hr_utility.set_location('Entering:'|| l_proc, 10);
1142: END IF;
1143:
1144: OPEN c_supervisor_temp(p_user_id);
1145: LOOP
1157: END LOOP;
1158: CLOSE c_supervisor_temp;
1159:
1160: IF g_debug THEN
1161: hr_utility.set_location('Leaving:'|| l_proc, 20);
1162: END IF;
1163:
1164: END update_supervisor;
1165:
1191: BEGIN
1192:
1193: IF g_debug THEN
1194: l_proc := g_package||'update_person_types';
1195: hr_utility.set_location('Entering:'|| l_proc, 10);
1196: END IF;
1197:
1198: OPEN c_person_types(p_user_id);
1199: LOOP
1212: END LOOP;
1213: CLOSE c_person_types;
1214:
1215: IF g_debug THEN
1216: hr_utility.set_location('Leaving:'|| l_proc, 20);
1217: END IF;
1218:
1219: END update_person_types;
1220:
1243: BEGIN
1244:
1245: IF g_debug THEN
1246: l_proc := g_package||'update_application';
1247: hr_utility.set_location('Entering:'|| l_proc, 10);
1248: END IF;
1249:
1250: OPEN c_timecard_ne(p_user_id);
1251: LOOP
1263: END LOOP;
1264: CLOSE c_timecard_ne;
1265:
1266: IF g_debug THEN
1267: hr_utility.set_location('Leaving:'|| l_proc, 20);
1268: END IF;
1269:
1270: END update_application;
1271:
1294: BEGIN
1295:
1296: IF g_debug THEN
1297: l_proc := g_package||'insert_approval_meaning';
1298: hr_utility.set_location('Entering:'|| l_proc, 10);
1299: END IF;
1300:
1301: OPEN c_approval_status(p_user_id);
1302: LOOP
1315: END LOOP;
1316: CLOSE c_approval_status;
1317:
1318: IF g_debug THEN
1319: hr_utility.set_location('Leaving:'|| l_proc, 20);
1320: END IF;
1321:
1322: END insert_approval_meaning;
1323:
1347: BEGIN
1348:
1349: IF g_debug THEN
1350: l_proc := g_package||'update_last_update_det';
1351: hr_utility.set_location('Entering:'|| l_proc, 10);
1352: END IF;
1353:
1354: OPEN c_last_update_det(p_user_id);
1355: LOOP
1372: END LOOP;
1373: CLOSE c_last_update_det;
1374:
1375: IF g_debug THEN
1376: hr_utility.set_location('Leaving:'|| l_proc, 20);
1377: END IF;
1378:
1379:
1380: END update_last_update_det;
1400: BEGIN
1401:
1402: IF g_debug THEN
1403: l_proc := g_package||'update_last_update_det';
1404: hr_utility.set_location('Entering:'|| l_proc, 10);
1405: END IF;
1406:
1407: OPEN c_update_last_modified_by(p_user_id);
1408: LOOP
1424: END LOOP;
1425: CLOSE c_update_last_modified_by;
1426:
1427: IF g_debug THEN
1428: hr_utility.set_location('Leaving:'|| l_proc, 20);
1429: END IF;
1430:
1431:
1432: END update_last_update_by;
1482: BEGIN
1483:
1484: IF g_debug THEN
1485: l_proc := g_package||'insert_notification_id';
1486: hr_utility.set_location('Entering:'|| l_proc, 10);
1487: END IF;
1488: hr_utility.trace('PNS fnd_global.user_id '||fnd_global.user_id);
1489: SELECT user_name
1490: INTO l_user_name
1484: IF g_debug THEN
1485: l_proc := g_package||'insert_notification_id';
1486: hr_utility.set_location('Entering:'|| l_proc, 10);
1487: END IF;
1488: hr_utility.trace('PNS fnd_global.user_id '||fnd_global.user_id);
1489: SELECT user_name
1490: INTO l_user_name
1491: FROM fnd_user
1492: WHERE user_id = fnd_global.user_id;
1519:
1520: END LOOP; --END LOOP FOR c_timecards
1521: CLOSE c_timecards;
1522: IF g_debug THEN
1523: hr_utility.set_location('Leaving:'|| l_proc, 20);
1524: END IF;
1525:
1526: END insert_notification_id;
1527:
1537: BEGIN
1538:
1539: IF g_debug THEN
1540: l_proc := g_package||'insert_timecard_exist';
1541: hr_utility.set_location('Entering:'|| l_proc, 10);
1542: END IF;
1543:
1544: INSERT INTO HXC_TCD_TIMECARDS
1545: (
1592: WHERE timecard_exist = 'Y'
1593: AND user_id = p_user_id;
1594:
1595: IF g_debug THEN
1596: hr_utility.set_location('Leaving:'|| l_proc, 20);
1597: END IF;
1598:
1599: END insert_timecard_exist;
1600:
1684: BEGIN
1685:
1686: IF g_debug THEN
1687: l_proc := g_package||'insert_timecard_not_exist';
1688: hr_utility.set_location('Entering:'|| l_proc, 10);
1689: END IF;
1690:
1691: OPEN c_temp_data(l_user_id);
1692: LOOP
1699: IF (g_recurring_det.EXISTS(l_timecard(i).recurring_period_id))
1700: THEN
1701:
1702: IF g_debug THEN
1703: hr_utility.set_location(l_proc, 20);
1704: END IF;
1705:
1706: l_recurring_period_id := g_recurring_det(l_timecard(i).recurring_period_id).recurring_period_id;
1707: l_period_type := g_recurring_det(l_timecard(i).recurring_period_id).period_type;
1711:
1712: ELSE
1713:
1714: IF g_debug THEN
1715: hr_utility.set_location(l_proc, 30);
1716: END IF;
1717:
1718: OPEN c_get_recurring_period_det(l_timecard(i).recurring_period_id);
1719: FETCH c_get_recurring_period_det INTO l_recurring_period_id,
1739: IF (g_rec_period_type.EXISTS(l_timecard(i).recurring_period_id))
1740: THEN
1741:
1742: IF g_debug THEN
1743: hr_utility.set_location(l_proc, 21);
1744: END IF;
1745: l_number_per_fiscal_year := g_rec_period_type(l_timecard(i).recurring_period_id).number_per_fiscal_year;
1746: ELSE
1747: SELECT ptt.number_per_fiscal_year INTO l_number_per_fiscal_year
1756:
1757: IF l_period_type = 'Calendar Month' THEN
1758:
1759: IF g_debug THEN
1760: hr_utility.set_location(l_proc, 40);
1761: hr_utility.trace('PNS:Calendar Monthly ');
1762: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
1763: hr_utility.trace('PNS:l_day '||l_day);
1764: END IF;
1757: IF l_period_type = 'Calendar Month' THEN
1758:
1759: IF g_debug THEN
1760: hr_utility.set_location(l_proc, 40);
1761: hr_utility.trace('PNS:Calendar Monthly ');
1762: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
1763: hr_utility.trace('PNS:l_day '||l_day);
1764: END IF;
1765:
1758:
1759: IF g_debug THEN
1760: hr_utility.set_location(l_proc, 40);
1761: hr_utility.trace('PNS:Calendar Monthly ');
1762: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
1763: hr_utility.trace('PNS:l_day '||l_day);
1764: END IF;
1765:
1766: l_period_stop_date := l_start_date - 1;
1759: IF g_debug THEN
1760: hr_utility.set_location(l_proc, 40);
1761: hr_utility.trace('PNS:Calendar Monthly ');
1762: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
1763: hr_utility.trace('PNS:l_day '||l_day);
1764: END IF;
1765:
1766: l_period_stop_date := l_start_date - 1;
1767:
1767:
1768: l_st_day := to_number(to_char(l_start_date,'DD'));
1769: l_cr_day := to_number(to_char(l_timecard(i).start_time,'DD'));
1770:
1771: hr_utility.trace('PNS:l_st_day '||l_st_day);
1772: hr_utility.trace('PNS:l_cr_day '||l_cr_day);
1773:
1774: if l_st_day > l_cr_day then
1775: l_diff := l_st_day - l_cr_day;
1768: l_st_day := to_number(to_char(l_start_date,'DD'));
1769: l_cr_day := to_number(to_char(l_timecard(i).start_time,'DD'));
1770:
1771: hr_utility.trace('PNS:l_st_day '||l_st_day);
1772: hr_utility.trace('PNS:l_cr_day '||l_cr_day);
1773:
1774: if l_st_day > l_cr_day then
1775: l_diff := l_st_day - l_cr_day;
1776: l_start_time := add_months(l_timecard(i).start_time,-1);
1798:
1799: OPEN c_get_monthly_periods(l_start_time, l_stop_time);
1800: LOOP
1801: IF g_debug THEN
1802: hr_utility.trace('PNS l_start_date: '||l_start_time);
1803: hr_utility.trace('PNS l_stop_time: '||l_stop_time);
1804: END IF;
1805: FETCH c_get_monthly_periods BULK COLLECT INTO l_period_start_date,
1806: l_period_end_date
1799: OPEN c_get_monthly_periods(l_start_time, l_stop_time);
1800: LOOP
1801: IF g_debug THEN
1802: hr_utility.trace('PNS l_start_date: '||l_start_time);
1803: hr_utility.trace('PNS l_stop_time: '||l_stop_time);
1804: END IF;
1805: FETCH c_get_monthly_periods BULK COLLECT INTO l_period_start_date,
1806: l_period_end_date
1807: LIMIT 500;
1882:
1883: ELSIF l_period_type = 'Year'
1884: THEN
1885: IF g_debug THEN
1886: hr_utility.set_location(l_proc, 40);
1887: hr_utility.trace('PNS:Year ');
1888: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
1889: END IF;
1890:
1883: ELSIF l_period_type = 'Year'
1884: THEN
1885: IF g_debug THEN
1886: hr_utility.set_location(l_proc, 40);
1887: hr_utility.trace('PNS:Year ');
1888: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
1889: END IF;
1890:
1891: l_period_stop_date := l_start_date - 1;
1884: THEN
1885: IF g_debug THEN
1886: hr_utility.set_location(l_proc, 40);
1887: hr_utility.trace('PNS:Year ');
1888: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
1889: END IF;
1890:
1891: l_period_stop_date := l_start_date - 1;
1892:
1921:
1922: OPEN c_get_yearly_periods(l_start_time, l_stop_time);
1923: LOOP
1924: IF g_debug THEN
1925: hr_utility.trace('PNS l_start_date: '||l_start_time);
1926: hr_utility.trace('PNS l_stop_time: '||l_stop_time);
1927: END IF;
1928: FETCH c_get_yearly_periods BULK COLLECT INTO l_period_start_date,
1929: l_period_end_date
1922: OPEN c_get_yearly_periods(l_start_time, l_stop_time);
1923: LOOP
1924: IF g_debug THEN
1925: hr_utility.trace('PNS l_start_date: '||l_start_time);
1926: hr_utility.trace('PNS l_stop_time: '||l_stop_time);
1927: END IF;
1928: FETCH c_get_yearly_periods BULK COLLECT INTO l_period_start_date,
1929: l_period_end_date
1930: LIMIT 500;
2004:
2005: ELSIF l_period_type = 'Quarter'
2006: THEN
2007: IF g_debug THEN
2008: hr_utility.set_location(l_proc, 40);
2009: hr_utility.trace('PNS:Quarter ');
2010: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
2011: hr_utility.trace('PNS:l_day '||l_day);
2012: END IF;
2005: ELSIF l_period_type = 'Quarter'
2006: THEN
2007: IF g_debug THEN
2008: hr_utility.set_location(l_proc, 40);
2009: hr_utility.trace('PNS:Quarter ');
2010: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
2011: hr_utility.trace('PNS:l_day '||l_day);
2012: END IF;
2013:
2006: THEN
2007: IF g_debug THEN
2008: hr_utility.set_location(l_proc, 40);
2009: hr_utility.trace('PNS:Quarter ');
2010: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
2011: hr_utility.trace('PNS:l_day '||l_day);
2012: END IF;
2013:
2014: l_period_stop_date := l_start_date - 1;
2007: IF g_debug THEN
2008: hr_utility.set_location(l_proc, 40);
2009: hr_utility.trace('PNS:Quarter ');
2010: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
2011: hr_utility.trace('PNS:l_day '||l_day);
2012: END IF;
2013:
2014: l_period_stop_date := l_start_date - 1;
2015:
2043:
2044: OPEN c_get_quarterly_periods(l_start_time, l_stop_time);
2045: LOOP
2046: IF g_debug THEN
2047: hr_utility.trace('PNS l_start_date: '||l_start_time);
2048: hr_utility.trace('PNS l_stop_time: '||l_stop_time);
2049: END IF;
2050: FETCH c_get_quarterly_periods BULK COLLECT INTO l_period_start_date,
2051: l_period_end_date
2044: OPEN c_get_quarterly_periods(l_start_time, l_stop_time);
2045: LOOP
2046: IF g_debug THEN
2047: hr_utility.trace('PNS l_start_date: '||l_start_time);
2048: hr_utility.trace('PNS l_stop_time: '||l_stop_time);
2049: END IF;
2050: FETCH c_get_quarterly_periods BULK COLLECT INTO l_period_start_date,
2051: l_period_end_date
2052: LIMIT 500;
2127:
2128: ELSIF l_period_type = 'Semi-Month'
2129: THEN
2130: IF g_debug THEN
2131: hr_utility.set_location(l_proc, 40);
2132: hr_utility.trace('PNS:Semi-Monthly ');
2133: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
2134: hr_utility.trace('PNS:l_day '||l_day);
2135: END IF;
2128: ELSIF l_period_type = 'Semi-Month'
2129: THEN
2130: IF g_debug THEN
2131: hr_utility.set_location(l_proc, 40);
2132: hr_utility.trace('PNS:Semi-Monthly ');
2133: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
2134: hr_utility.trace('PNS:l_day '||l_day);
2135: END IF;
2136:
2129: THEN
2130: IF g_debug THEN
2131: hr_utility.set_location(l_proc, 40);
2132: hr_utility.trace('PNS:Semi-Monthly ');
2133: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
2134: hr_utility.trace('PNS:l_day '||l_day);
2135: END IF;
2136:
2137: l_act_start_date1 := l_start_date;
2130: IF g_debug THEN
2131: hr_utility.set_location(l_proc, 40);
2132: hr_utility.trace('PNS:Semi-Monthly ');
2133: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
2134: hr_utility.trace('PNS:l_day '||l_day);
2135: END IF;
2136:
2137: l_act_start_date1 := l_start_date;
2138:
2300: ELSE --weekly (or) bi-weekly
2301: l_start_date_day := to_number(to_char(to_date(l_timecard(i).start_time),'D'));
2302:
2303: IF g_debug THEN
2304: hr_utility.set_location(l_proc, 40);
2305: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
2306: hr_utility.trace('PNS:l_day '||l_day);
2307: END IF;
2308:
2301: l_start_date_day := to_number(to_char(to_date(l_timecard(i).start_time),'D'));
2302:
2303: IF g_debug THEN
2304: hr_utility.set_location(l_proc, 40);
2305: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
2306: hr_utility.trace('PNS:l_day '||l_day);
2307: END IF;
2308:
2309: IF l_start_date_day > l_day
2302:
2303: IF g_debug THEN
2304: hr_utility.set_location(l_proc, 40);
2305: hr_utility.trace('PNS:l_start_date_day '||l_start_date_day);
2306: hr_utility.trace('PNS:l_day '||l_day);
2307: END IF;
2308:
2309: IF l_start_date_day > l_day
2310: THEN
2312: -- l_start_time := l_timecard(i).start_time + l_count_day;
2313: l_start_time := l_timecard(i).start_time - l_count_day;
2314:
2315: IF g_debug THEN
2316: hr_utility.set_location(l_proc, 50);
2317: hr_utility.trace('PNS Record:l_count_day '||l_count_day);
2318: END IF;
2319:
2320: ELSIF l_start_date_day < l_day
2313: l_start_time := l_timecard(i).start_time - l_count_day;
2314:
2315: IF g_debug THEN
2316: hr_utility.set_location(l_proc, 50);
2317: hr_utility.trace('PNS Record:l_count_day '||l_count_day);
2318: END IF;
2319:
2320: ELSIF l_start_date_day < l_day
2321: THEN
2322: l_count_day := l_day - l_start_date_day;
2323: l_start_time := (l_timecard(i).start_time - trunc(365 / l_number_per_fiscal_year)) + l_count_day; --code for year 366
2324:
2325: IF g_debug THEN
2326: hr_utility.set_location(l_proc, 60);
2327: hr_utility.trace('PNS:l_count_day '||l_count_day);
2328: hr_utility.trace('PNS: l_start_time'||l_start_time);
2329: END IF;
2330:
2323: l_start_time := (l_timecard(i).start_time - trunc(365 / l_number_per_fiscal_year)) + l_count_day; --code for year 366
2324:
2325: IF g_debug THEN
2326: hr_utility.set_location(l_proc, 60);
2327: hr_utility.trace('PNS:l_count_day '||l_count_day);
2328: hr_utility.trace('PNS: l_start_time'||l_start_time);
2329: END IF;
2330:
2331: ELSE
2324:
2325: IF g_debug THEN
2326: hr_utility.set_location(l_proc, 60);
2327: hr_utility.trace('PNS:l_count_day '||l_count_day);
2328: hr_utility.trace('PNS: l_start_time'||l_start_time);
2329: END IF;
2330:
2331: ELSE
2332: IF g_debug THEN
2329: END IF;
2330:
2331: ELSE
2332: IF g_debug THEN
2333: hr_utility.set_location(l_proc, 70);
2334: END IF;
2335: l_start_time := l_timecard(i).start_time;
2336:
2337: END IF; -- l_start_date_day > l_day
2339: IF mod(((l_stop_time - l_start_time)+1), trunc(365 / l_number_per_fiscal_year)) <> 0
2340: THEN
2341: l_stop_time := l_stop_time + ( trunc(365 / l_number_per_fiscal_year) - mod(((l_stop_time - l_start_time)+1), trunc(365 / l_number_per_fiscal_year)) );
2342: IF g_debug THEN
2343: hr_utility.set_location(l_proc, 80);
2344: hr_utility.trace('PNS: l_stop_time '||l_stop_time);
2345: END IF;
2346:
2347: END IF; --mod
2340: THEN
2341: l_stop_time := l_stop_time + ( trunc(365 / l_number_per_fiscal_year) - mod(((l_stop_time - l_start_time)+1), trunc(365 / l_number_per_fiscal_year)) );
2342: IF g_debug THEN
2343: hr_utility.set_location(l_proc, 80);
2344: hr_utility.trace('PNS: l_stop_time '||l_stop_time);
2345: END IF;
2346:
2347: END IF; --mod
2348:
2349: --code for leap year
2350: OPEN c_get_periods(l_number_per_fiscal_year, l_start_time, l_stop_time, 365);
2351: LOOP
2352: IF g_debug THEN
2353: hr_utility.trace('PNS l_number_per_fiscal_year: '||l_number_per_fiscal_year);
2354: hr_utility.trace('PNS l_timecard(i).start_time: '||l_timecard(i).start_time);
2355: hr_utility.trace('PNS l_start_date: '||l_start_time);
2356: hr_utility.trace('PNS l_stop_time: '||l_stop_time);
2357: END IF;
2350: OPEN c_get_periods(l_number_per_fiscal_year, l_start_time, l_stop_time, 365);
2351: LOOP
2352: IF g_debug THEN
2353: hr_utility.trace('PNS l_number_per_fiscal_year: '||l_number_per_fiscal_year);
2354: hr_utility.trace('PNS l_timecard(i).start_time: '||l_timecard(i).start_time);
2355: hr_utility.trace('PNS l_start_date: '||l_start_time);
2356: hr_utility.trace('PNS l_stop_time: '||l_stop_time);
2357: END IF;
2358: FETCH c_get_periods BULK COLLECT INTO l_period_start_date,
2351: LOOP
2352: IF g_debug THEN
2353: hr_utility.trace('PNS l_number_per_fiscal_year: '||l_number_per_fiscal_year);
2354: hr_utility.trace('PNS l_timecard(i).start_time: '||l_timecard(i).start_time);
2355: hr_utility.trace('PNS l_start_date: '||l_start_time);
2356: hr_utility.trace('PNS l_stop_time: '||l_stop_time);
2357: END IF;
2358: FETCH c_get_periods BULK COLLECT INTO l_period_start_date,
2359: l_period_end_date
2352: IF g_debug THEN
2353: hr_utility.trace('PNS l_number_per_fiscal_year: '||l_number_per_fiscal_year);
2354: hr_utility.trace('PNS l_timecard(i).start_time: '||l_timecard(i).start_time);
2355: hr_utility.trace('PNS l_start_date: '||l_start_time);
2356: hr_utility.trace('PNS l_stop_time: '||l_stop_time);
2357: END IF;
2358: FETCH c_get_periods BULK COLLECT INTO l_period_start_date,
2359: l_period_end_date
2360: LIMIT 500;
2532:
2533: BEGIN
2534: IF g_debug THEN
2535: l_proc := g_package||'insert_timecard_count';
2536: hr_utility.set_location('Entering:'|| l_proc, 10);
2537: END IF;
2538:
2539: INSERT INTO HXC_TCD_STATUS_COUNT(supervisor_id,supervisor_name,not_enetered,working,error, submitted,rejected,approved,user_id)
2540: SELECT
2586: user_id;
2587:
2588: IF g_debug THEN
2589: l_proc := g_package||'insert_timecard_count';
2590: hr_utility.set_location('Leaving:'|| l_proc, 20);
2591: END IF;
2592:
2593: END insert_timecard_count;
2594:
2628: END update_total;
2629:
2630: --Begin of Go Method
2631: BEGIN
2632: /*hr_utility.trace_on(null,'sdb');
2633: g_debug := true;*/
2634: IF g_debug THEN
2635: hr_utility.trace('Parameter:p_start_date'||p_start_date);
2636: l_proc := g_package||'GO';
2631: BEGIN
2632: /*hr_utility.trace_on(null,'sdb');
2633: g_debug := true;*/
2634: IF g_debug THEN
2635: hr_utility.trace('Parameter:p_start_date'||p_start_date);
2636: l_proc := g_package||'GO';
2637: hr_utility.set_location('Entering:'|| l_proc, 10);
2638: END IF;
2639: clear_all_temp_tab(l_user_id);
2633: g_debug := true;*/
2634: IF g_debug THEN
2635: hr_utility.trace('Parameter:p_start_date'||p_start_date);
2636: l_proc := g_package||'GO';
2637: hr_utility.set_location('Entering:'|| l_proc, 10);
2638: END IF;
2639: clear_all_temp_tab(l_user_id);
2640: clear_all_inactive_logins;
2641:
2639: clear_all_temp_tab(l_user_id);
2640: clear_all_inactive_logins;
2641:
2642: IF g_debug THEN
2643: hr_utility.trace('Parameter:p_supervisor_id'||p_supervisor_id);
2644: hr_utility.trace('Parameter:p_start_date'||p_start_date);
2645: hr_utility.trace('Parameter:p_end_date'||p_end_date);
2646: hr_utility.trace('Parameter:p_organization_id'||p_organization_id);
2647: hr_utility.trace('Parameter:p_location_id'||p_location_id);
2640: clear_all_inactive_logins;
2641:
2642: IF g_debug THEN
2643: hr_utility.trace('Parameter:p_supervisor_id'||p_supervisor_id);
2644: hr_utility.trace('Parameter:p_start_date'||p_start_date);
2645: hr_utility.trace('Parameter:p_end_date'||p_end_date);
2646: hr_utility.trace('Parameter:p_organization_id'||p_organization_id);
2647: hr_utility.trace('Parameter:p_location_id'||p_location_id);
2648: hr_utility.trace('Parameter:p_recurring_period'||p_recurring_period);
2641:
2642: IF g_debug THEN
2643: hr_utility.trace('Parameter:p_supervisor_id'||p_supervisor_id);
2644: hr_utility.trace('Parameter:p_start_date'||p_start_date);
2645: hr_utility.trace('Parameter:p_end_date'||p_end_date);
2646: hr_utility.trace('Parameter:p_organization_id'||p_organization_id);
2647: hr_utility.trace('Parameter:p_location_id'||p_location_id);
2648: hr_utility.trace('Parameter:p_recurring_period'||p_recurring_period);
2649: END IF;
2642: IF g_debug THEN
2643: hr_utility.trace('Parameter:p_supervisor_id'||p_supervisor_id);
2644: hr_utility.trace('Parameter:p_start_date'||p_start_date);
2645: hr_utility.trace('Parameter:p_end_date'||p_end_date);
2646: hr_utility.trace('Parameter:p_organization_id'||p_organization_id);
2647: hr_utility.trace('Parameter:p_location_id'||p_location_id);
2648: hr_utility.trace('Parameter:p_recurring_period'||p_recurring_period);
2649: END IF;
2650:
2643: hr_utility.trace('Parameter:p_supervisor_id'||p_supervisor_id);
2644: hr_utility.trace('Parameter:p_start_date'||p_start_date);
2645: hr_utility.trace('Parameter:p_end_date'||p_end_date);
2646: hr_utility.trace('Parameter:p_organization_id'||p_organization_id);
2647: hr_utility.trace('Parameter:p_location_id'||p_location_id);
2648: hr_utility.trace('Parameter:p_recurring_period'||p_recurring_period);
2649: END IF;
2650:
2651: IF p_reptng_emp = 'DIRECT_REPORTEES'
2644: hr_utility.trace('Parameter:p_start_date'||p_start_date);
2645: hr_utility.trace('Parameter:p_end_date'||p_end_date);
2646: hr_utility.trace('Parameter:p_organization_id'||p_organization_id);
2647: hr_utility.trace('Parameter:p_location_id'||p_location_id);
2648: hr_utility.trace('Parameter:p_recurring_period'||p_recurring_period);
2649: END IF;
2650:
2651: IF p_reptng_emp = 'DIRECT_REPORTEES'
2652: THEN
2650:
2651: IF p_reptng_emp = 'DIRECT_REPORTEES'
2652: THEN
2653: IF g_debug THEN
2654: hr_utility.set_location(l_proc, 20);
2655: END IF;
2656:
2657: l_direct_sql := build_person_sql(l_direct_sql, l_org_id, l_location_id);
2658:
2656:
2657: l_direct_sql := build_person_sql(l_direct_sql, l_org_id, l_location_id);
2658:
2659: IF g_debug THEN
2660: hr_utility.trace('l_direct_sql:'||l_direct_sql);
2661: END IF;
2662:
2663:
2664: IF l_org_id = -1 AND l_location_id = -1 THEN
2692:
2693: ELSIF p_reptng_emp = 'ALL_EMPLOYEES'
2694: THEN
2695: IF g_debug THEN
2696: hr_utility.set_location(l_proc, 30);
2697: END IF;
2698:
2699: l_all_direct_sql := build_all_person_sql(l_all_direct_sql, l_org_id, l_location_id);
2700:
2698:
2699: l_all_direct_sql := build_all_person_sql(l_all_direct_sql, l_org_id, l_location_id);
2700:
2701: IF g_debug THEN
2702: hr_utility.trace('l_all_direct_sql:'||l_all_direct_sql);
2703: END IF;
2704:
2705:
2706: IF l_org_id = -1 AND l_location_id = -1 THEN
2741: IF l_person_det.COUNT > 0
2742: THEN
2743:
2744: IF g_debug THEN
2745: hr_utility.set_location(l_proc, 40);
2746: END IF;
2747:
2748: FOR l_index in l_person_det.First..l_person_det.Last
2749: LOOP
2766: END LOOP;
2767: END IF;
2768: END LOOP;
2769: IF g_debug THEN
2770: hr_utility.set_location(l_proc, 70);
2771: END IF;
2772: --DELETE FROM HXC_TEMP_TCD;
2773: FOR i IN l_person_det.FIRST..l_person_det.LAST
2774: LOOP
2824: END LOOP;
2825:
2826:
2827: IF g_debug THEN
2828: hr_utility.set_location(l_proc, 80);
2829: END IF;
2830:
2831: END IF;
2832:
2832:
2833: IF p_recurring_period IS NOT NULL
2834: THEN
2835: IF g_debug THEN
2836: hr_utility.set_location(l_proc, 90);
2837: END IF;
2838: delete_person_temp(p_recurring_period,l_user_id);
2839: END IF;
2840:
2838: delete_person_temp(p_recurring_period,l_user_id);
2839: END IF;
2840:
2841: IF g_debug THEN
2842: hr_utility.set_location(l_proc, 100);
2843: END IF;
2844:
2845: OPEN c_get_timecard(l_user_id);
2846: LOOP
2850: IF l_timecards_ne.COUNT > 0
2851: THEN
2852:
2853: IF g_debug THEN
2854: hr_utility.set_location(l_proc, 110);
2855: hr_utility.trace('Timecard Count from c_get_timecard :'||l_timecards_ne.COUNT);
2856: END IF;
2857:
2858: FOR i IN l_timecards_ne.FIRST..l_timecards_ne.LAST
2851: THEN
2852:
2853: IF g_debug THEN
2854: hr_utility.set_location(l_proc, 110);
2855: hr_utility.trace('Timecard Count from c_get_timecard :'||l_timecards_ne.COUNT);
2856: END IF;
2857:
2858: FOR i IN l_timecards_ne.FIRST..l_timecards_ne.LAST
2859: LOOP
2998: CLOSE c_get_timecard;
2999:
3000:
3001: IF g_debug THEN
3002: hr_utility.set_location(l_proc, 120);
3003: END IF;
3004: delete_temp_extra_rec(l_user_id);
3005: -- delete_extra_rec(l_user_id);
3006: update_assignment_changes(l_user_id);
3025: p_msg:='yes';
3026: p_level:='no';
3027:
3028: IF g_debug THEN
3029: hr_utility.set_location('Leaving:'||l_proc, 130);
3030: END IF;
3031: --hr_utility.trace_off();
3032: EXCEPTION
3033: when connect_by_detected
3027:
3028: IF g_debug THEN
3029: hr_utility.set_location('Leaving:'||l_proc, 130);
3030: END IF;
3031: --hr_utility.trace_off();
3032: EXCEPTION
3033: when connect_by_detected
3034: then
3035:
3033: when connect_by_detected
3034: then
3035:
3036: IF g_debug THEN
3037: hr_utility.set_location(l_proc, 140);
3038: END IF;
3039: p_msg := 'CONNECT_BY_ERROR';
3040: p_level := 'ERROR';
3041:
3040: p_level := 'ERROR';
3041:
3042: when others
3043: then
3044: hr_utility.trace('Other exception occured');
3045: raise;
3046:
3047: END GO;
3048:
3144: BEGIN
3145:
3146: IF g_debug THEN
3147: l_proc := g_package||' Generate XML';
3148: hr_utility.set_location('Entering : '|| l_proc, 10);
3149: END IF;
3150:
3151:
3152: SELECT full_name INTO l_supervisor_name
3177: l_language_code := USERENV('LANG');
3178:
3179: IF g_debug THEN
3180: l_proc := g_package||' Generating XML';
3181: hr_utility.set_location('Entering : '|| l_proc, 20);
3182: END IF;
3183:
3184: l_report_info := '
3185:
3200: dbms_lob.copy(l_pre_xml, xmlresult1, dbms_lob.getlength(xmlresult1) - l_resultOffset, length(l_report_info), l_resultOffset +1);
3201:
3202: IF g_debug THEN
3203: l_proc := g_package||' Generate XML';
3204: hr_utility.set_location('Entering : '|| l_proc, 30);
3205: END IF;
3206:
3207: l_time_period := p_start_time ||' - '||p_stop_time;
3208: dbms_lob.writeappend(l_pre_xml, length('
3228:
3229: IF p_supervisor_id IS NOT NULL
3230: THEN
3231: IF g_debug THEN
3232: hr_utility.trace('PNS CHECK p_supervisor_id'||p_supervisor_id);
3233: END IF;
3234: l_dynamic_sql := l_dynamic_sql || ' AND supervisor_id =' || p_supervisor_id;
3235: END IF;
3236: IF g_debug THEN
3233: END IF;
3234: l_dynamic_sql := l_dynamic_sql || ' AND supervisor_id =' || p_supervisor_id;
3235: END IF;
3236: IF g_debug THEN
3237: hr_utility.trace('PNS CHECK p_column_name out'||p_column_name);
3238: END IF;
3239:
3240: IF p_column_name IS NOT NULL
3241: THEN
3239:
3240: IF p_column_name IS NOT NULL
3241: THEN
3242: IF g_debug THEN
3243: hr_utility.trace('PNS CHECK p_column_name in'||p_column_name);
3244: END IF;
3245:
3246: l_dynamic_sql := l_dynamic_sql || ' AND approval_status = ''' || p_timecard_status ||'''';
3247: END IF;
3246: l_dynamic_sql := l_dynamic_sql || ' AND approval_status = ''' || p_timecard_status ||'''';
3247: END IF;
3248:
3249: IF g_debug THEN
3250: hr_utility.trace('PNS CHECK l_dynamic_sql'||l_dynamic_sql);
3251: END IF;
3252:
3253: l_dynamic_sql := l_dynamic_sql || ' ORDER BY period_start_date
3254: , period_end_date
3309:
3310: p_pre_xml := l_pre_xml;
3311: IF g_debug THEN
3312: l_proc := g_package||' Generate XML';
3313: hr_utility.set_location('Leaving : '|| l_proc, 40);
3314: END IF;
3315:
3316: END generate_supervisor_xml;
3317: