61: --
62: c_package constant varchar2(31) := 'pay_yrend_reports_pkg.';
63: c_commit_num constant number := 1000;
64: --
65: g_debug boolean := hr_utility.debug_enabled;
66: --
67: ----------------------------------- range_cursor ----------------------------------
68: procedure range_cursor (pactid in number, sqlstr out nocopy varchar2) is
69:
102: and act.payroll_action_id = ' || l_eoy_payroll_action_id ||
103: ' and act.tax_unit_id = ' || l_tax_unit_id ||
104: ' order by to_number(act.serial_number)';
105:
106: --hr_utility.trace('Session ID = '||to_char(USERENV('SESSIONID')));
107: end range_cursor;
108:
109: ---------------------------------- action_creation ----------------------------------
110: procedure action_creation(pactid in number,
217:
218: l_procedure_name VARCHAR2(100);
219:
220: begin
221: -- hr_utility.trace_on(null, 'W2REG');
222: l_procedure_name := 'action_creation';
223: hr_utility.set_location(l_procedure_name, 1);
224: --
225: -- Query has been added to fetch tax_unit_id, year to be passed to the cursor
219:
220: begin
221: -- hr_utility.trace_on(null, 'W2REG');
222: l_procedure_name := 'action_creation';
223: hr_utility.set_location(l_procedure_name, 1);
224: --
225: -- Query has been added to fetch tax_unit_id, year to be passed to the cursor
226: select pay_yrend_reports_pkg.get_parameter('ASSIGN_SET',ppa1.legislative_parameters),
227: pay_yrend_reports_pkg.get_parameter('T_U_ID',ppa1.legislative_parameters),
249: ('T_U_ID',ppa1.legislative_parameters) =
250: pay_yrend_reports_pkg.get_parameter
251: ('TRANSFER_GRE',ppa.legislative_parameters);
252:
253: hr_utility.trace('l_assign_set= ' || l_assign_set);
254: hr_utility.trace('l_tax_unit_id=' || l_tax_unit_id);
255: hr_utility.trace('l_eoy_payroll_action_id=' || l_eoy_payroll_action_id);
256: hr_utility.trace('l_assign_year=' || l_assign_year);
257: hr_utility.trace('pactid=' || pactid);
250: pay_yrend_reports_pkg.get_parameter
251: ('TRANSFER_GRE',ppa.legislative_parameters);
252:
253: hr_utility.trace('l_assign_set= ' || l_assign_set);
254: hr_utility.trace('l_tax_unit_id=' || l_tax_unit_id);
255: hr_utility.trace('l_eoy_payroll_action_id=' || l_eoy_payroll_action_id);
256: hr_utility.trace('l_assign_year=' || l_assign_year);
257: hr_utility.trace('pactid=' || pactid);
258: hr_utility.trace('stperson=' || stperson);
251: ('TRANSFER_GRE',ppa.legislative_parameters);
252:
253: hr_utility.trace('l_assign_set= ' || l_assign_set);
254: hr_utility.trace('l_tax_unit_id=' || l_tax_unit_id);
255: hr_utility.trace('l_eoy_payroll_action_id=' || l_eoy_payroll_action_id);
256: hr_utility.trace('l_assign_year=' || l_assign_year);
257: hr_utility.trace('pactid=' || pactid);
258: hr_utility.trace('stperson=' || stperson);
259: hr_utility.trace('endperson=' || endperson);
252:
253: hr_utility.trace('l_assign_set= ' || l_assign_set);
254: hr_utility.trace('l_tax_unit_id=' || l_tax_unit_id);
255: hr_utility.trace('l_eoy_payroll_action_id=' || l_eoy_payroll_action_id);
256: hr_utility.trace('l_assign_year=' || l_assign_year);
257: hr_utility.trace('pactid=' || pactid);
258: hr_utility.trace('stperson=' || stperson);
259: hr_utility.trace('endperson=' || endperson);
260: hr_utility.set_location(l_procedure_name, 10);
253: hr_utility.trace('l_assign_set= ' || l_assign_set);
254: hr_utility.trace('l_tax_unit_id=' || l_tax_unit_id);
255: hr_utility.trace('l_eoy_payroll_action_id=' || l_eoy_payroll_action_id);
256: hr_utility.trace('l_assign_year=' || l_assign_year);
257: hr_utility.trace('pactid=' || pactid);
258: hr_utility.trace('stperson=' || stperson);
259: hr_utility.trace('endperson=' || endperson);
260: hr_utility.set_location(l_procedure_name, 10);
261:
254: hr_utility.trace('l_tax_unit_id=' || l_tax_unit_id);
255: hr_utility.trace('l_eoy_payroll_action_id=' || l_eoy_payroll_action_id);
256: hr_utility.trace('l_assign_year=' || l_assign_year);
257: hr_utility.trace('pactid=' || pactid);
258: hr_utility.trace('stperson=' || stperson);
259: hr_utility.trace('endperson=' || endperson);
260: hr_utility.set_location(l_procedure_name, 10);
261:
262: if l_assign_set is not null then
255: hr_utility.trace('l_eoy_payroll_action_id=' || l_eoy_payroll_action_id);
256: hr_utility.trace('l_assign_year=' || l_assign_year);
257: hr_utility.trace('pactid=' || pactid);
258: hr_utility.trace('stperson=' || stperson);
259: hr_utility.trace('endperson=' || endperson);
260: hr_utility.set_location(l_procedure_name, 10);
261:
262: if l_assign_set is not null then
263: hr_utility.set_location(l_procedure_name, 20);
256: hr_utility.trace('l_assign_year=' || l_assign_year);
257: hr_utility.trace('pactid=' || pactid);
258: hr_utility.trace('stperson=' || stperson);
259: hr_utility.trace('endperson=' || endperson);
260: hr_utility.set_location(l_procedure_name, 10);
261:
262: if l_assign_set is not null then
263: hr_utility.set_location(l_procedure_name, 20);
264: open c_actions_with_asg_set(pactid, stperson, endperson,
259: hr_utility.trace('endperson=' || endperson);
260: hr_utility.set_location(l_procedure_name, 10);
261:
262: if l_assign_set is not null then
263: hr_utility.set_location(l_procedure_name, 20);
264: open c_actions_with_asg_set(pactid, stperson, endperson,
265: l_assign_year, l_tax_unit_id,
266: l_assign_set, l_eoy_payroll_action_id);
267: num := 0;
281: select pay_assignment_actions_s.nextval
282: into lockingactid
283: from dual;
284:
285: hr_utility.set_location(l_procedure_name, 30);
286: -- insert the action record.
287: hr_nonrun_asact.insact(lockingactid,assignid,pactid,chunk,greid);
288:
289: /* update pay_assignment_actions with the year end assignment_actions into serial number
305: --
306: -- BUG2538173
307: --
308: elsif l_state_code is not null then
309: hr_utility.set_location(l_procedure_name, 40);
310: open c_state_context('TAX_UNIT_ID');
311: fetch c_state_context into l_tuid_context;
312: close c_state_context;
313:
314: open c_state_context('JURISDICTION_CODE');
315: fetch c_state_context into l_juri_context;
316: close c_state_context;
317:
318: hr_utility.set_location(l_procedure_name, 50);
319: c_actions_with_state_sql :=
320: 'select act.assignment_action_id,
321: act.assignment_id,
322: act.tax_unit_id,
336: AND paf.effective_end_date >= ''' || l_start_date || '''
337: AND paf.assignment_type = ''E''
338: and to_number(act.serial_number) between ' || stperson || ' and ' ||endperson;
339:
340: hr_utility.set_location(l_procedure_name, 60);
341: if l_locality_code is null then
342: open c_state_ueid('A_SIT_SUBJ_WHABLE_PER_JD_GRE_YTD');
343: fetch c_state_ueid into l_subj_whable;
344: close c_state_ueid;
346: open c_state_ueid('A_SIT_SUBJ_NWHABLE_PER_JD_GRE_YTD');
347: fetch c_state_ueid into l_subj_nwhable;
348: close c_state_ueid;
349:
350: hr_utility.set_location(l_procedure_name, 70);
351: c_actions_with_state_sql := c_actions_with_state_sql ||
352: ' AND exists ( select 1 from dual
353: where 1 =
354: --bug 7392315
373: -- County
374: --
375: elsif length(l_locality_code) = 11 and
376: substr(l_locality_code, 8,4) = '0000' then
377: hr_utility.set_location(l_procedure_name, 80);
378: open c_state_ueid('A_COUNTY_SUBJ_WHABLE_PER_JD_GRE_YTD');
379: fetch c_state_ueid into l_subj_whable;
380: close c_state_ueid;
381:
382: open c_state_ueid('A_COUNTY_SUBJ_NWHABLE_PER_JD_GRE_YTD');
383: fetch c_state_ueid into l_subj_nwhable;
384: close c_state_ueid;
385:
386: hr_utility.set_location(l_procedure_name, 90);
387: c_actions_with_state_sql := c_actions_with_state_sql ||
388: ' AND exists ( select 1 from dual
389: where 1 =
390: (select decode(sign(nvl(sum(to_number(fai.value)),0)),-1,1,0,0,1)
405: -- City
406: --
407: elsif length(l_locality_code) = 11 and
408: substr(l_locality_code, 8,4) <> '0000' then
409: hr_utility.set_location(l_procedure_name, 100);
410:
411: open c_state_ueid('A_CITY_SUBJ_WHABLE_PER_JD_GRE_YTD');
412: fetch c_state_ueid into l_subj_whable;
413: close c_state_ueid;
414:
415: open c_state_ueid('A_CITY_SUBJ_NWHABLE_PER_JD_GRE_YTD');
416: fetch c_state_ueid into l_subj_nwhable;
417: close c_state_ueid;
418: hr_utility.trace('l_subj_whable='||l_subj_whable);
419: hr_utility.trace('l_subj_nwhable='||l_subj_nwhable);
420:
421: c_actions_with_state_sql := c_actions_with_state_sql ||
422: ' AND exists ( select 1 from dual
415: open c_state_ueid('A_CITY_SUBJ_NWHABLE_PER_JD_GRE_YTD');
416: fetch c_state_ueid into l_subj_nwhable;
417: close c_state_ueid;
418: hr_utility.trace('l_subj_whable='||l_subj_whable);
419: hr_utility.trace('l_subj_nwhable='||l_subj_nwhable);
420:
421: c_actions_with_state_sql := c_actions_with_state_sql ||
422: ' AND exists ( select 1 from dual
423: where 1 =
439: -- School District
440: --
441: elsif length(l_locality_code) = 8 then
442:
443: hr_utility.set_location(l_procedure_name, 120);
444: open c_state_ueid('A_SCHOOL_SUBJ_WHABLE_PER_JD_GRE_YTD');
445: fetch c_state_ueid into l_subj_whable;
446: close c_state_ueid;
447:
466: and fic2.context_id = ' || l_juri_context || '
467: and substr(ltrim(rtrim(fic2.context)),1,8) = ''' || l_locality_code || '''))';
468:
469: end if;
470: hr_utility.set_location(l_procedure_name, 150);
471:
472: num := 0;
473: OPEN c_actions_with_state FOR c_actions_with_state_sql;
474: loop
474: loop
475: fetch c_actions_with_state into lockedactid,assignid,greid,p_person_id;
476: if c_actions_with_state%found then
477: num := num + 1;
478: hr_utility.trace('In the c_actions_with_state%found in action cursor');
479: else
480: hr_utility.trace('In the c_actions_with_state%notfound in action cursor');
481: exit;
482: end if;
476: if c_actions_with_state%found then
477: num := num + 1;
478: hr_utility.trace('In the c_actions_with_state%found in action cursor');
479: else
480: hr_utility.trace('In the c_actions_with_state%notfound in action cursor');
481: exit;
482: end if;
483:
484: hr_utility.set_location(l_procedure_name, 160);
480: hr_utility.trace('In the c_actions_with_state%notfound in action cursor');
481: exit;
482: end if;
483:
484: hr_utility.set_location(l_procedure_name, 160);
485: select pay_assignment_actions_s.nextval
486: into lockingactid
487: from dual;
488:
496: end loop;
497: close c_actions_with_state;
498: -- end of l_state_code
499: else
500: hr_utility.set_location(l_procedure_name, 170);
501: open c_actions_without_asg_set(pactid, stperson, endperson,
502: l_assign_year, l_tax_unit_id,
503: l_eoy_payroll_action_id,l_effective_date,l_start_date);
504: num := 0;
514: -- we need to insert one action for each of the
515: -- rows that we return from the cursor (i.e. one
516: -- for each assignment/pre-payment/reversal).
517:
518: hr_utility.set_location(l_procedure_name, 180);
519: select pay_assignment_actions_s.nextval
520: into lockingactid
521: from dual;
522:
539:
540: end loop;
541: close c_actions_without_asg_set;
542: end if;
543: hr_utility.set_location(l_procedure_name, 250);
544: end action_creation;
545:
546: ---------------------------------- sort_action ----------------------------------
547: procedure sort_action
596: from pay_payroll_actions ppa1 /* PYUGEN payroll action id */
597: where ppa1.payroll_action_id = payactid;
598: exception
599: when no_data_found then
600: hr_utility.trace('Error in Sort Procedure - getting legislative param');
601: raise;
602: end;
603: sqlstr := 'select paa1.rowid
604: /* we need the row id of the assignment actions that are
725: --
726: begin
727: --
728: if g_debug then
729: hr_utility.set_location(l_proc,0);
730: hr_utility.trace('pay_yrend_report_pkg start deinitialize code');
731: end if;
732: --
733: -- following procedure will be called ordinarily
726: begin
727: --
728: if g_debug then
729: hr_utility.set_location(l_proc,0);
730: hr_utility.trace('pay_yrend_report_pkg start deinitialize code');
731: end if;
732: --
733: -- following procedure will be called ordinarily
734: -- without calling directly.
762: end loop;
763: close csr_del;
764: --
765: if g_debug then
766: hr_utility.trace('pay_yrend_report_pkg delete '||to_char(l_del_cnt)||' records');
767: end if;
768: --
769: if l_del_cnt > 0 then
770: --
774: --
775: end if;
776: --
777: if g_debug then
778: hr_utility.set_location(l_proc,1000);
779: hr_utility.trace('pay_yrend_report_pkg end deinitialize code');
780: end if;
781: --
782: end deinitialize_code;
775: end if;
776: --
777: if g_debug then
778: hr_utility.set_location(l_proc,1000);
779: hr_utility.trace('pay_yrend_report_pkg end deinitialize code');
780: end if;
781: --
782: end deinitialize_code;
783: --