112: lv_sort3 VARCHAR2(60);
113: ld_session_date DATE;
114:
115: BEGIN
116: hr_utility.trace('Entered get_payroll_action_info');
117: ln_tax_unit_id := 0;
118: ln_person_id := 0;
119: ln_asg_set := 0;
120: open c_payroll_action_info(p_payroll_action_id);
130: lv_sort3,
131: ld_session_date;
132: close c_payroll_action_info;
133:
134: hr_utility.trace('ld_end_date = ' || to_char(ld_end_date));
135: hr_utility.trace('ld_start_date = ' || to_char(ld_start_date));
136: hr_utility.trace('ln_tax_unit_id = '|| to_char(ln_tax_unit_id));
137: hr_utility.trace('ln_person_id = ' || to_char(ln_person_id));
138: hr_utility.trace('ln_asg_set = ' || to_char(ln_asg_set));
131: ld_session_date;
132: close c_payroll_action_info;
133:
134: hr_utility.trace('ld_end_date = ' || to_char(ld_end_date));
135: hr_utility.trace('ld_start_date = ' || to_char(ld_start_date));
136: hr_utility.trace('ln_tax_unit_id = '|| to_char(ln_tax_unit_id));
137: hr_utility.trace('ln_person_id = ' || to_char(ln_person_id));
138: hr_utility.trace('ln_asg_set = ' || to_char(ln_asg_set));
139:
132: close c_payroll_action_info;
133:
134: hr_utility.trace('ld_end_date = ' || to_char(ld_end_date));
135: hr_utility.trace('ld_start_date = ' || to_char(ld_start_date));
136: hr_utility.trace('ln_tax_unit_id = '|| to_char(ln_tax_unit_id));
137: hr_utility.trace('ln_person_id = ' || to_char(ln_person_id));
138: hr_utility.trace('ln_asg_set = ' || to_char(ln_asg_set));
139:
140: p_end_date := ld_end_date;
133:
134: hr_utility.trace('ld_end_date = ' || to_char(ld_end_date));
135: hr_utility.trace('ld_start_date = ' || to_char(ld_start_date));
136: hr_utility.trace('ln_tax_unit_id = '|| to_char(ln_tax_unit_id));
137: hr_utility.trace('ln_person_id = ' || to_char(ln_person_id));
138: hr_utility.trace('ln_asg_set = ' || to_char(ln_asg_set));
139:
140: p_end_date := ld_end_date;
141: p_start_date := ld_start_date;
134: hr_utility.trace('ld_end_date = ' || to_char(ld_end_date));
135: hr_utility.trace('ld_start_date = ' || to_char(ld_start_date));
136: hr_utility.trace('ln_tax_unit_id = '|| to_char(ln_tax_unit_id));
137: hr_utility.trace('ln_person_id = ' || to_char(ln_person_id));
138: hr_utility.trace('ln_asg_set = ' || to_char(ln_asg_set));
139:
140: p_end_date := ld_end_date;
141: p_start_date := ld_start_date;
142: p_business_group_id := ln_business_group_id;
148: p_sort_option2 := lv_sort2;
149: p_sort_option3 := lv_sort3;
150: p_session_date := ld_session_date;
151:
152: hr_utility.trace('Leaving get_payroll_action_info');
153:
154: EXCEPTION
155: when others then
156: hr_utility.trace('Error in ' || gv_procedure_name ||
152: hr_utility.trace('Leaving get_payroll_action_info');
153:
154: EXCEPTION
155: when others then
156: hr_utility.trace('Error in ' || gv_procedure_name ||
157: to_char(sqlcode) || '-' || sqlerrm);
158: raise hr_utility.hr_error;
159:
160: END get_payroll_action_info;
154: EXCEPTION
155: when others then
156: hr_utility.trace('Error in ' || gv_procedure_name ||
157: to_char(sqlcode) || '-' || sqlerrm);
158: raise hr_utility.hr_error;
159:
160: END get_payroll_action_info;
161:
162:
190: ln_agent_tax_unit_id pay_assignment_actions.tax_unit_id%type;
191: ln_year number;
192:
193: BEGIN
194: hr_utility.trace('Entered w2crpt_range_cursor');
195: ln_person_id := 0;
196: ln_asg_set := 0;
197: lv_print := null;
198: hr_utility.trace('p_payroll_action_id = ' ||
194: hr_utility.trace('Entered w2crpt_range_cursor');
195: ln_person_id := 0;
196: ln_asg_set := 0;
197: lv_print := null;
198: hr_utility.trace('p_payroll_action_id = ' ||
199: to_char(p_payroll_action_id));
200:
201: get_payroll_action_info(p_payroll_action_id => p_payroll_action_id
202: ,p_start_date => ld_start_date
214: -- Bug 3601799 - Added condition.
215: IF ln_person_id IS NOT NULL OR ln_asg_set IS NOT NULL THEN
216: ln_year := to_number(to_char(ld_end_date,'YYYY'));
217:
218: hr_utility.trace('Checking for Preprocess Agent GRE setup');
219: hr_us_w2_rep.get_agent_tax_unit_id(ln_business_group_id
220: ,ln_year
221: ,ln_agent_tax_unit_id
222: ,lv_error_mesg ) ;
245: pay_core_utils.push_token('record_name',' ');
246: pay_core_utils.push_token('description',substr(lv_error_mesg,136,45));
247: end if;
248:
249: hr_utility.raise_error;
250:
251: end if;
252:
253:
258: from per_all_assignments_f asg
259: where person_id = ' || ln_person_id ||
260: ' and :p_payroll_action_id is not null ';
261:
262: hr_utility.trace('Range for person_id not null');
263:
264: elsif ln_asg_set is not null then
265:
266: lv_sql_string :=
271: and asgset.assignment_id = paf.assignment_id
272: and asgset.include_or_exclude = ''I''
273: and :payroll_action_id is not null ';
274:
275: hr_utility.trace('Range for asg_set not null');
276: end if;
277:
278: -- Bug 3601799
279: -- This query string will be executed when for All parameter is passed.
296: and paa.tax_unit_id = ' || ln_tax_unit_id || '
297: and :payroll_action_id is not null
298: order by paa.serial_number';
299:
300: hr_utility.trace('Range for all the persons.');
301: END IF;
302:
303: p_sqlstr := lv_sql_string;
304: hr_utility.trace('p_sqlstr = ' ||p_sqlstr);
300: hr_utility.trace('Range for all the persons.');
301: END IF;
302:
303: p_sqlstr := lv_sql_string;
304: hr_utility.trace('p_sqlstr = ' ||p_sqlstr);
305: hr_utility.trace('Leaving w2crpt_range_cursor');
306: END w2crpt_range_cursor;
307:
308:
301: END IF;
302:
303: p_sqlstr := lv_sql_string;
304: hr_utility.trace('p_sqlstr = ' ||p_sqlstr);
305: hr_utility.trace('Leaving w2crpt_range_cursor');
306: END w2crpt_range_cursor;
307:
308:
309: /************************************************************
518: /* Create an assignment action for this person */
519: select pay_assignment_actions_s.nextval
520: into ln_w2c_asg_action
521: from dual;
522: hr_utility.trace('New w2c Action = ' || ln_w2c_asg_action);
523:
524: /* Insert into pay_assignment_actions. */
525: hr_nonrun_asact.insact(ln_w2c_asg_action
526: ,ln_primary_assignment_id
539: ,ln_prev_yepp_lock_action
540: ,ln_prev_w2c_action_id;
541: if get_interlocked_action%notfound then
542: close get_interlocked_action;
543: hr_utility.raise_error;
544: end if;
545: close get_interlocked_action;
546:
547: if lv_prev_report_type = 'YREND' then
563:
564: /***************************************************************
565: ** Interlock last w2c archive action with current w2c rep action
566: ***************************************************************/
567: hr_utility.trace('Locking Action'||ln_w2c_asg_action);
568: hr_utility.trace('Locked Action' || ln_asg_act_to_lock);
569: hr_nonrun_asact.insint(ln_w2c_asg_action
570: ,ln_asg_act_to_lock);
571:
564: /***************************************************************
565: ** Interlock last w2c archive action with current w2c rep action
566: ***************************************************************/
567: hr_utility.trace('Locking Action'||ln_w2c_asg_action);
568: hr_utility.trace('Locked Action' || ln_asg_act_to_lock);
569: hr_nonrun_asact.insint(ln_w2c_asg_action
570: ,ln_asg_act_to_lock);
571:
572: elsif lv_report_type = 'W-2C PAPER' then
613: /* Create an assignment action for this person */
614: select pay_assignment_actions_s.nextval
615: into ln_w2c_asg_action
616: from dual;
617: hr_utility.trace('New w2c Action = ' || ln_w2c_asg_action);
618:
619: /* Insert into pay_assignment_actions. */
620: hr_nonrun_asact.insact(ln_w2c_asg_action
621: ,ln_primary_assignment_id
634: ,ln_prev_yepp_lock_action
635: ,ln_prev_w2c_action_id;
636: if get_interlocked_action%notfound then
637: close get_interlocked_action;
638: hr_utility.raise_error;
639: end if;
640: close get_interlocked_action;
641:
642: if lv_prev_report_type = 'YREND' then
663:
664: END action_creation;
665:
666: BEGIN
667: hr_utility.trace('Entered action_creation ');
668: ln_assignment_id := 0;
669: ln_tax_unit_id := 0;
670: ln_asg_action_id := 0;
671: ln_primary_assignment_id := 0;
678: ln_set_person_id := 0 ;
679: ln_asg_set := 0 ;
680: lv_message := null;
681:
682: hr_utility.trace('p_payroll_action_id = '|| to_char(p_payroll_action_id));
683: hr_utility.trace('p_start_person_id ='|| to_char(p_start_person_id));
684: hr_utility.trace('p_end_person_id = '|| to_char(p_end_person_id));
685: hr_utility.trace('p_chunk = ' || to_char(p_chunk));
686:
679: ln_asg_set := 0 ;
680: lv_message := null;
681:
682: hr_utility.trace('p_payroll_action_id = '|| to_char(p_payroll_action_id));
683: hr_utility.trace('p_start_person_id ='|| to_char(p_start_person_id));
684: hr_utility.trace('p_end_person_id = '|| to_char(p_end_person_id));
685: hr_utility.trace('p_chunk = ' || to_char(p_chunk));
686:
687: get_payroll_action_info(p_payroll_action_id => p_payroll_action_id
680: lv_message := null;
681:
682: hr_utility.trace('p_payroll_action_id = '|| to_char(p_payroll_action_id));
683: hr_utility.trace('p_start_person_id ='|| to_char(p_start_person_id));
684: hr_utility.trace('p_end_person_id = '|| to_char(p_end_person_id));
685: hr_utility.trace('p_chunk = ' || to_char(p_chunk));
686:
687: get_payroll_action_info(p_payroll_action_id => p_payroll_action_id
688: ,p_start_date => ld_start_date
681:
682: hr_utility.trace('p_payroll_action_id = '|| to_char(p_payroll_action_id));
683: hr_utility.trace('p_start_person_id ='|| to_char(p_start_person_id));
684: hr_utility.trace('p_end_person_id = '|| to_char(p_end_person_id));
685: hr_utility.trace('p_chunk = ' || to_char(p_chunk));
686:
687: get_payroll_action_info(p_payroll_action_id => p_payroll_action_id
688: ,p_start_date => ld_start_date
689: ,p_end_date => ld_end_date
702: action_creation(p_start_person_id);
703:
704: /* ASSIGNMENT SET ID IS NOT NULL */
705: elsif ln_asg_set is not null then
706: hr_utility.trace('Entered Asg Set logic');
707: hr_utility.trace('Asg Set ='||to_char(ln_asg_set));
708: hr_utility.trace('p_start_person_id ='||to_char(p_start_person_id));
709: hr_utility.trace('End Person ='||to_char(p_end_person_id));
710:
703:
704: /* ASSIGNMENT SET ID IS NOT NULL */
705: elsif ln_asg_set is not null then
706: hr_utility.trace('Entered Asg Set logic');
707: hr_utility.trace('Asg Set ='||to_char(ln_asg_set));
708: hr_utility.trace('p_start_person_id ='||to_char(p_start_person_id));
709: hr_utility.trace('End Person ='||to_char(p_end_person_id));
710:
711: open c_selected_asg_set(p_start_person_id
704: /* ASSIGNMENT SET ID IS NOT NULL */
705: elsif ln_asg_set is not null then
706: hr_utility.trace('Entered Asg Set logic');
707: hr_utility.trace('Asg Set ='||to_char(ln_asg_set));
708: hr_utility.trace('p_start_person_id ='||to_char(p_start_person_id));
709: hr_utility.trace('End Person ='||to_char(p_end_person_id));
710:
711: open c_selected_asg_set(p_start_person_id
712: ,p_end_person_id
705: elsif ln_asg_set is not null then
706: hr_utility.trace('Entered Asg Set logic');
707: hr_utility.trace('Asg Set ='||to_char(ln_asg_set));
708: hr_utility.trace('p_start_person_id ='||to_char(p_start_person_id));
709: hr_utility.trace('End Person ='||to_char(p_end_person_id));
710:
711: open c_selected_asg_set(p_start_person_id
712: ,p_end_person_id
713: ,ln_asg_set);
710:
711: open c_selected_asg_set(p_start_person_id
712: ,p_end_person_id
713: ,ln_asg_set);
714: hr_utility.trace('Opened cusor c_selected_asg_set');
715: loop
716: fetch c_selected_asg_set into ln_set_person_id;
717: if c_selected_asg_set%notfound then
718: hr_utility.trace('No Person found for reporting in this chunk');
714: hr_utility.trace('Opened cusor c_selected_asg_set');
715: loop
716: fetch c_selected_asg_set into ln_set_person_id;
717: if c_selected_asg_set%notfound then
718: hr_utility.trace('No Person found for reporting in this chunk');
719: exit;
720: end if;
721:
722: action_creation(ln_set_person_id);
726:
727: -- Bug 3601799 -- Added this elsif if the report is run for All.
728: /* PERSON ID and ASSIGNMENT SET ID are NULL */
729: elsif ln_person_id is null and ln_asg_set is null then
730: hr_utility.trace('Report run for All persons Logic.');
731: open c_select_all_person(p_start_person_id
732: ,p_end_person_id
733: ,ld_start_date
734: ,ln_business_group_id
732: ,p_end_person_id
733: ,ld_start_date
734: ,ln_business_group_id
735: ,ln_tax_unit_id);
736: hr_utility.trace('Opened cusor c_select_all_person');
737: loop
738: fetch c_select_all_person into ln_person_id;
739: if c_select_all_person%notfound then
740: hr_utility.trace('No Person found for reporting in this chunk.');
736: hr_utility.trace('Opened cusor c_select_all_person');
737: loop
738: fetch c_select_all_person into ln_person_id;
739: if c_select_all_person%notfound then
740: hr_utility.trace('No Person found for reporting in this chunk.');
741: exit;
742: end if;
743:
744: action_creation(ln_person_id);
793: if ld_end_date > ld_session_date then
794: ld_session_date := ld_end_date;
795: end if;
796:
797: hr_utility.trace('Beginning of the sort_action cursor');
798: p_sql_string :=
799: 'select mt.rowid
800: from hr_organization_units hou, hr_locations_all hl,
801: per_periods_of_service pps, per_all_assignments_f paf,
847: ||substr(hr_us_w2_rep.get_per_item(to_number(substr(mt.serial_number,1,5)), ''A_PER_MIDDLE_NAMES''),1,1))';
848:
849:
850: p_sql_length := length(p_sql_string); -- return the length of the string.
851: hr_utility.trace('End of the sort_Action cursor');
852: END sort_action;
853:
854: BEGIN
855: -- hr_utility.trace_on(null,'W2CRPT');
851: hr_utility.trace('End of the sort_Action cursor');
852: END sort_action;
853:
854: BEGIN
855: -- hr_utility.trace_on(null,'W2CRPT');
856: gv_package := 'pay_us_w2c_rpt';
857:
858: END pay_us_w2c_rpt;