1: package body PAY_RETRO_NOTIF_PKG as
2: /* $Header: payretno.pkb 120.26.12020000.3 2012/09/20 06:13:54 apudiped ship $ */
3: -------------------------------------------------------------------------------
4: g_package varchar2(80) := 'PAY_RETRO_NOTIF_PKG.';
5: g_traces BOOLEAN := hr_utility.debug_enabled; --See if hr_utility.traces should show
6: g_dbg BOOLEAN := FALSE; --Extra debugging messages
7:
8: g_event_group pay_event_groups.event_group_id%type;
9: g_business_group_id per_business_groups.business_group_id%type;
58: p_adv_flag := l_adv_flag;
59: p_report_date := l_report_date;
60: --
61: if (g_traces) then
62: hr_utility.trace('Full param string: '||l_legparam);
63: hr_utility.trace('Got report date in get_pact_details '
64: ||to_char(l_report_date,'DD-MON-YYYY HH24:MI:SS'));
65: end if;
66:
59: p_report_date := l_report_date;
60: --
61: if (g_traces) then
62: hr_utility.trace('Full param string: '||l_legparam);
63: hr_utility.trace('Got report date in get_pact_details '
64: ||to_char(l_report_date,'DD-MON-YYYY HH24:MI:SS'));
65: end if;
66:
67: end get_pact_details;
100: --
101: open c_set_check;
102: fetch c_set_check into l_dummy;
103: if c_set_check%FOUND then
104: hr_utility.set_message(801, 'HR_6395_SETUP_SET_EXISTS');
105: hr_utility.raise_error;
106: end if;
107: close c_set_check;
108: --
101: open c_set_check;
102: fetch c_set_check into l_dummy;
103: if c_set_check%FOUND then
104: hr_utility.set_message(801, 'HR_6395_SETUP_SET_EXISTS');
105: hr_utility.raise_error;
106: end if;
107: close c_set_check;
108: --
109: end validate_asg_set;
172: argument1 => p_payroll_action_id);
173:
174: IF l_req_id = 0 THEN
175: fnd_message.retrieve(l_errbuf);
176: hr_utility.trace('Error when submitting request: ' || SQLERRM || ' ' || SQLCODE);
177: raise zero_req_id;
178: ELSE
179: --
180: if p_adv_flag = 'Y' then
199: -- update fnd_concurrent_requests
200: -- set PARENT_REQUEST_ID = to_number(c_req_id)
201: -- where request_id = l_req_id;
202: -- ELSE
203: -- hr_utility.set_message(801, 'HR_51002_REPORT_CANT_SUBMITTED');
204: -- hr_utility.raise_error;
205: -- END IF;
206: --
207: END IF;
200: -- set PARENT_REQUEST_ID = to_number(c_req_id)
201: -- where request_id = l_req_id;
202: -- ELSE
203: -- hr_utility.set_message(801, 'HR_51002_REPORT_CANT_SUBMITTED');
204: -- hr_utility.raise_error;
205: -- END IF;
206: --
207: END IF;
208:
207: END IF;
208:
209: exception
210: when zero_req_id then
211: hr_utility.set_message(801, 'HR_51002_REPORT_CANT_SUBMITTED');
212: hr_utility.raise_error;
213: when others then
214: l_errbuf := SQLERRM;
215: hr_utility.trace('Error when submitting request: ' || SQLERRM || ' ' || SQLCODE);
208:
209: exception
210: when zero_req_id then
211: hr_utility.set_message(801, 'HR_51002_REPORT_CANT_SUBMITTED');
212: hr_utility.raise_error;
213: when others then
214: l_errbuf := SQLERRM;
215: hr_utility.trace('Error when submitting request: ' || SQLERRM || ' ' || SQLCODE);
216: hr_utility.set_message(801, 'HR_51002_REPORT_CANT_SUBMITTED');
211: hr_utility.set_message(801, 'HR_51002_REPORT_CANT_SUBMITTED');
212: hr_utility.raise_error;
213: when others then
214: l_errbuf := SQLERRM;
215: hr_utility.trace('Error when submitting request: ' || SQLERRM || ' ' || SQLCODE);
216: hr_utility.set_message(801, 'HR_51002_REPORT_CANT_SUBMITTED');
217: hr_utility.raise_error;
218:
219: end run_report;
212: hr_utility.raise_error;
213: when others then
214: l_errbuf := SQLERRM;
215: hr_utility.trace('Error when submitting request: ' || SQLERRM || ' ' || SQLCODE);
216: hr_utility.set_message(801, 'HR_51002_REPORT_CANT_SUBMITTED');
217: hr_utility.raise_error;
218:
219: end run_report;
220: --
213: when others then
214: l_errbuf := SQLERRM;
215: hr_utility.trace('Error when submitting request: ' || SQLERRM || ' ' || SQLCODE);
216: hr_utility.set_message(801, 'HR_51002_REPORT_CANT_SUBMITTED');
217: hr_utility.raise_error;
218:
219: end run_report;
220: --
221: procedure create_retro_asg_set(p_asg_set_name in varchar2,
781: group by payroll_id
782: order by min_date asc) a
783: where rownum=1;
784:
785: hr_utility.trace('The payroll id is '||l_payroll_id_ear_date);
786:
787: select start_date
788: into l_min_run_ear_date
789: from per_time_periods
789: from per_time_periods
790: where l_min_ear_date_ptp between start_date and end_date
791: and payroll_id = l_payroll_id_ear_date;
792:
793: hr_utility.trace('The start date finally calculated is '||l_min_run_ear_date);
794:
795: select min_date,
796: payroll_id
797: into l_min_eff_date_ptp,
807: group by payroll_id
808: order by min_date asc) a
809: where rownum=1;
810:
811: hr_utility.trace('The payroll id wrt eff date is '||l_payroll_id_eff_date);
812:
813: select start_date
814: into l_min_run_eff_date
815: from per_time_periods
815: from per_time_periods
816: where l_min_eff_date_ptp between start_date and end_date
817: and payroll_id = l_payroll_id_eff_date;
818:
819: hr_utility.trace('The start date wrt effective date finally calculated is '||l_min_run_eff_date);
820:
821: exception
822: when no_data_found then
823: hr_utility.trace('The case comes where the assignment has no payroll actions as yet');
819: hr_utility.trace('The start date wrt effective date finally calculated is '||l_min_run_eff_date);
820:
821: exception
822: when no_data_found then
823: hr_utility.trace('The case comes where the assignment has no payroll actions as yet');
824: end;
825:
826: /*Changes end for the bug 12695674*/
827:
853: end if;
854: end if;
855: --
856: if (g_dbg) then
857: hr_utility.set_location(l_proc,100);
858: hr_utility.trace(' Processing ASG '||p_assignment_id);
859: hr_utility.trace(' p_min_creation_date: '||to_char(p_min_creation_date,'YYYY/MM/DD HH24:MI:SS'));
860: hr_utility.trace(' p_time_processing_started: '||to_char(p_time_processing_started,'YYYY/MM/DD HH24:MI:SS'));
861: hr_utility.trace(' l_min_eff_date: '||to_char(l_min_eff_date,'YYYY/MM/DD HH24:MI:SS'));
854: end if;
855: --
856: if (g_dbg) then
857: hr_utility.set_location(l_proc,100);
858: hr_utility.trace(' Processing ASG '||p_assignment_id);
859: hr_utility.trace(' p_min_creation_date: '||to_char(p_min_creation_date,'YYYY/MM/DD HH24:MI:SS'));
860: hr_utility.trace(' p_time_processing_started: '||to_char(p_time_processing_started,'YYYY/MM/DD HH24:MI:SS'));
861: hr_utility.trace(' l_min_eff_date: '||to_char(l_min_eff_date,'YYYY/MM/DD HH24:MI:SS'));
862: hr_utility.trace(' l_min_grp_eff_date: '||to_char(l_min_grp_eff_date,'YYYY/MM/DD HH24:MI:SS'));
855: --
856: if (g_dbg) then
857: hr_utility.set_location(l_proc,100);
858: hr_utility.trace(' Processing ASG '||p_assignment_id);
859: hr_utility.trace(' p_min_creation_date: '||to_char(p_min_creation_date,'YYYY/MM/DD HH24:MI:SS'));
860: hr_utility.trace(' p_time_processing_started: '||to_char(p_time_processing_started,'YYYY/MM/DD HH24:MI:SS'));
861: hr_utility.trace(' l_min_eff_date: '||to_char(l_min_eff_date,'YYYY/MM/DD HH24:MI:SS'));
862: hr_utility.trace(' l_min_grp_eff_date: '||to_char(l_min_grp_eff_date,'YYYY/MM/DD HH24:MI:SS'));
863: end if;
856: if (g_dbg) then
857: hr_utility.set_location(l_proc,100);
858: hr_utility.trace(' Processing ASG '||p_assignment_id);
859: hr_utility.trace(' p_min_creation_date: '||to_char(p_min_creation_date,'YYYY/MM/DD HH24:MI:SS'));
860: hr_utility.trace(' p_time_processing_started: '||to_char(p_time_processing_started,'YYYY/MM/DD HH24:MI:SS'));
861: hr_utility.trace(' l_min_eff_date: '||to_char(l_min_eff_date,'YYYY/MM/DD HH24:MI:SS'));
862: hr_utility.trace(' l_min_grp_eff_date: '||to_char(l_min_grp_eff_date,'YYYY/MM/DD HH24:MI:SS'));
863: end if;
864:
857: hr_utility.set_location(l_proc,100);
858: hr_utility.trace(' Processing ASG '||p_assignment_id);
859: hr_utility.trace(' p_min_creation_date: '||to_char(p_min_creation_date,'YYYY/MM/DD HH24:MI:SS'));
860: hr_utility.trace(' p_time_processing_started: '||to_char(p_time_processing_started,'YYYY/MM/DD HH24:MI:SS'));
861: hr_utility.trace(' l_min_eff_date: '||to_char(l_min_eff_date,'YYYY/MM/DD HH24:MI:SS'));
862: hr_utility.trace(' l_min_grp_eff_date: '||to_char(l_min_grp_eff_date,'YYYY/MM/DD HH24:MI:SS'));
863: end if;
864:
865: /* only do something if there were process events */
858: hr_utility.trace(' Processing ASG '||p_assignment_id);
859: hr_utility.trace(' p_min_creation_date: '||to_char(p_min_creation_date,'YYYY/MM/DD HH24:MI:SS'));
860: hr_utility.trace(' p_time_processing_started: '||to_char(p_time_processing_started,'YYYY/MM/DD HH24:MI:SS'));
861: hr_utility.trace(' l_min_eff_date: '||to_char(l_min_eff_date,'YYYY/MM/DD HH24:MI:SS'));
862: hr_utility.trace(' l_min_grp_eff_date: '||to_char(l_min_grp_eff_date,'YYYY/MM/DD HH24:MI:SS'));
863: end if;
864:
865: /* only do something if there were process events */
866: --
949: l_ele_type_id(l_entry_id(i)) := l_type_id(i);
950: l_ret_comp_id(l_entry_id(i)) := l_retro_component_id(i);
951: else
952: if (g_dbg) then
953: hr_utility.trace('>> Element has no retro_component. Not adding '||l_entry_id(i)||' to store.');
954: end if;
955: end if;
956: --
957: end if;
1037: ,p_owner_type => 'S'
1038: ,p_system_reprocess_date => l_detailed_output(cnt).effective_date );
1039: --
1040: if (g_dbg) then
1041: hr_utility.trace('>DP >Entry Saved id = '||l_detailed_output(cnt).element_entry_id);
1042: hr_utility.trace('>DP >effective_date = '||l_detailed_output(cnt).effective_date);
1043: hr_utility.trace('>DP >update type = '||l_detailed_output(cnt).update_type);
1044: end if;
1045: end if;
1038: ,p_system_reprocess_date => l_detailed_output(cnt).effective_date );
1039: --
1040: if (g_dbg) then
1041: hr_utility.trace('>DP >Entry Saved id = '||l_detailed_output(cnt).element_entry_id);
1042: hr_utility.trace('>DP >effective_date = '||l_detailed_output(cnt).effective_date);
1043: hr_utility.trace('>DP >update type = '||l_detailed_output(cnt).update_type);
1044: end if;
1045: end if;
1046: else
1039: --
1040: if (g_dbg) then
1041: hr_utility.trace('>DP >Entry Saved id = '||l_detailed_output(cnt).element_entry_id);
1042: hr_utility.trace('>DP >effective_date = '||l_detailed_output(cnt).effective_date);
1043: hr_utility.trace('>DP >update type = '||l_detailed_output(cnt).update_type);
1044: end if;
1045: end if;
1046: else
1047: -- In debug mode
1044: end if;
1045: end if;
1046: else
1047: -- In debug mode
1048: hr_utility.trace('>DP >Entry Saved id = '||l_detailed_output(cnt).element_entry_id);
1049: hr_utility.trace('>DP >effective_date = '||l_detailed_output(cnt).effective_date);
1050: hr_utility.trace('>DP >update type = '||l_detailed_output(cnt).update_type);
1051: end if;
1052: --
1045: end if;
1046: else
1047: -- In debug mode
1048: hr_utility.trace('>DP >Entry Saved id = '||l_detailed_output(cnt).element_entry_id);
1049: hr_utility.trace('>DP >effective_date = '||l_detailed_output(cnt).effective_date);
1050: hr_utility.trace('>DP >update type = '||l_detailed_output(cnt).update_type);
1051: end if;
1052: --
1053: end if;
1046: else
1047: -- In debug mode
1048: hr_utility.trace('>DP >Entry Saved id = '||l_detailed_output(cnt).element_entry_id);
1049: hr_utility.trace('>DP >effective_date = '||l_detailed_output(cnt).effective_date);
1050: hr_utility.trace('>DP >update type = '||l_detailed_output(cnt).update_type);
1051: end if;
1052: --
1053: end if;
1054:
1148: ,p_owner_type => 'S'
1149: ,p_system_reprocess_date => l_reprocess_date);
1150: --
1151: if (g_dbg) then
1152: hr_utility.trace('>DE >Entry Saved id = '||l_detailed_output(cnt).element_entry_id);
1153: hr_utility.trace('>DE >effective_date = '||l_detailed_output(cnt).effective_date);
1154: hr_utility.trace('>DE >update type = '||l_detailed_output(cnt).update_type);
1155: hr_utility.trace('>DE >Reprocess Date = '||l_reprocess_date);
1156: end if;
1149: ,p_system_reprocess_date => l_reprocess_date);
1150: --
1151: if (g_dbg) then
1152: hr_utility.trace('>DE >Entry Saved id = '||l_detailed_output(cnt).element_entry_id);
1153: hr_utility.trace('>DE >effective_date = '||l_detailed_output(cnt).effective_date);
1154: hr_utility.trace('>DE >update type = '||l_detailed_output(cnt).update_type);
1155: hr_utility.trace('>DE >Reprocess Date = '||l_reprocess_date);
1156: end if;
1157: end if;
1150: --
1151: if (g_dbg) then
1152: hr_utility.trace('>DE >Entry Saved id = '||l_detailed_output(cnt).element_entry_id);
1153: hr_utility.trace('>DE >effective_date = '||l_detailed_output(cnt).effective_date);
1154: hr_utility.trace('>DE >update type = '||l_detailed_output(cnt).update_type);
1155: hr_utility.trace('>DE >Reprocess Date = '||l_reprocess_date);
1156: end if;
1157: end if;
1158: --
1151: if (g_dbg) then
1152: hr_utility.trace('>DE >Entry Saved id = '||l_detailed_output(cnt).element_entry_id);
1153: hr_utility.trace('>DE >effective_date = '||l_detailed_output(cnt).effective_date);
1154: hr_utility.trace('>DE >update type = '||l_detailed_output(cnt).update_type);
1155: hr_utility.trace('>DE >Reprocess Date = '||l_reprocess_date);
1156: end if;
1157: end if;
1158: --
1159: else
1156: end if;
1157: end if;
1158: --
1159: else
1160: hr_utility.trace('>DE >Entry Saved id = '||l_detailed_output(cnt).element_entry_id);
1161: hr_utility.trace('>DE >effective_date = '||l_detailed_output(cnt).effective_date);
1162: hr_utility.trace('>DE >update type = '||l_detailed_output(cnt).update_type);
1163: --
1164: end if;
1157: end if;
1158: --
1159: else
1160: hr_utility.trace('>DE >Entry Saved id = '||l_detailed_output(cnt).element_entry_id);
1161: hr_utility.trace('>DE >effective_date = '||l_detailed_output(cnt).effective_date);
1162: hr_utility.trace('>DE >update type = '||l_detailed_output(cnt).update_type);
1163: --
1164: end if;
1165: --
1158: --
1159: else
1160: hr_utility.trace('>DE >Entry Saved id = '||l_detailed_output(cnt).element_entry_id);
1161: hr_utility.trace('>DE >effective_date = '||l_detailed_output(cnt).effective_date);
1162: hr_utility.trace('>DE >update type = '||l_detailed_output(cnt).update_type);
1163: --
1164: end if;
1165: --
1166: end if;
1192: l_ret_comp_id.delete;
1193: --
1194: --
1195: if (g_traces) then
1196: hr_utility.set_location(l_proc,900);
1197: end if;
1198: end process_assignment;
1199:
1200: procedure initialise_globals(p_event_group in number,
1254:
1255: begin
1256: --
1257:
1258: hr_utility.trace('In archinit');
1259:
1260: get_pact_details (p_payroll_action_id,
1261: l_asg_set_name,
1262: l_bus_grp,
1355: l_asg_id pay_assignment_actions.assignment_id%type;
1356: --
1357: begin
1358: --
1359: hr_utility.trace('In process_action');
1360:
1361: select assignment_id
1362: into l_asg_id
1363: from pay_assignment_actions
1385: l_min_creation_date date; -- date stored for last execution
1386: l_global_env pay_interpreter_pkg.t_global_env_rec;
1387:
1388: BEGIN
1389: hr_utility.set_location(l_proc,10);
1390: --
1391: initialise_globals(p_event_group => p_event_group,
1392: p_business_group_id => p_business_group_id,
1393: p_payroll_action_id => null,
1396: p_adv_flag => 'Y',
1397: p_report_date => p_time_started
1398: );
1399: --
1400: hr_utility.set_location(l_proc,15);
1401: --
1402: generate_dates_and_process(p_assignment_id);
1403: --
1404: hr_utility.set_location(l_proc,20);
1400: hr_utility.set_location(l_proc,15);
1401: --
1402: generate_dates_and_process(p_assignment_id);
1403: --
1404: hr_utility.set_location(l_proc,20);
1405: --
1406: END run_asg_adv_retronot;
1407:
1408:
1476: l_bus_grp number;
1477: l_adv_flag varchar2(1);
1478: --
1479: begin
1480: hr_utility.trace('In range_cursor');
1481: /* Effective date will be set to sysdate for CC*/
1482: sqlstr := 'select distinct asg.person_id
1483: from
1484: per_assignments_f asg,
1511: l_payroll_id);
1512: --
1513: end if;
1514:
1515: hr_utility.trace('l_asg_set_name = '||l_asg_set_name);
1516: commit;
1517: hr_utility.trace('Out range_cursor');
1518: --
1519: end range_cursor;
1513: end if;
1514:
1515: hr_utility.trace('l_asg_set_name = '||l_asg_set_name);
1516: commit;
1517: hr_utility.trace('Out range_cursor');
1518: --
1519: end range_cursor;
1520: --
1521: -------------------------- action_creation ---------------------------------
1591: FETCH c_get_report_type INTO l_report_type;
1592: CLOSE c_get_report_type;
1593:
1594: IF(g_traces) THEN
1595: hr_utility.trace('In action_creation');
1596: hr_utility.trace('l_report_type : '|| l_report_type);
1597: END if;
1598:
1599: l_range_person := pay_ac_utility.range_person_on(
1592: CLOSE c_get_report_type;
1593:
1594: IF(g_traces) THEN
1595: hr_utility.trace('In action_creation');
1596: hr_utility.trace('l_report_type : '|| l_report_type);
1597: END if;
1598:
1599: l_range_person := pay_ac_utility.range_person_on(
1600: p_report_type => l_report_type
1604:
1605: if l_range_person THEN -- 7508169. Use the new cursor c_actions_range_on cursor to fetch the assignment_ids
1606:
1607: IF(g_traces) then
1608: hr_utility.trace('l_range_person is true');
1609: END if;
1610:
1611: for asgrec in c_actions_range_on(pactid, chunk) loop
1612: --
1621:
1622: ELSE -- Retain Old Logic- No Range Person
1623:
1624: IF(g_traces) then
1625: hr_utility.trace('l_range_person is false');
1626: END if;
1627:
1628: for asgrec in c_actions(pactid, stperson, endperson) loop
1629: --
1676:
1677: l_proc varchar2(160) := g_package||'deinitialise';
1678:
1679: begin
1680: hr_utility.set_location(l_proc,10);
1681: --
1682: get_pact_details (pactid,
1683: l_asg_set_name,
1684: l_bus_grp,
1735: -- where report_id = pactid;
1736: --
1737: end if;
1738: --
1739: hr_utility.set_location(l_proc,900);
1740: --
1741: end deinitialise;
1742: --
1743: -------------------------------------------------------------------------------