183:
184: if csr_bal_type_id%notfound then
185: close csr_bal_type_id;
186: /* need a pop-message */
187: hr_utility.trace('Balance name :'||p_balance_name||'doesnot exist');
188: raise hr_utility.hr_error;
189: else
190: close csr_bal_type_id;
191: end if;
184: if csr_bal_type_id%notfound then
185: close csr_bal_type_id;
186: /* need a pop-message */
187: hr_utility.trace('Balance name :'||p_balance_name||'doesnot exist');
188: raise hr_utility.hr_error;
189: else
190: close csr_bal_type_id;
191: end if;
192:
195: fetch csr_def_bal_id into l_defined_balance_id;
196: if csr_def_bal_id%notfound then
197: close csr_def_bal_id;
198: /* need a pop-message */
199: hr_utility.trace('Balance Dimension :'||p_balance_dimension||'doesnot exist');
200: raise hr_utility.hr_error;
201: else
202: close csr_def_bal_id;
203: end if;
196: if csr_def_bal_id%notfound then
197: close csr_def_bal_id;
198: /* need a pop-message */
199: hr_utility.trace('Balance Dimension :'||p_balance_dimension||'doesnot exist');
200: raise hr_utility.hr_error;
201: else
202: close csr_def_bal_id;
203: end if;
204:
309: if p_report_type = 'RL2' then
310:
311: /* Default settings for Year End Preprocess. */
312:
313: hr_utility.trace('in getting selection information ');
314: p_period_start := p_year_start;
315: p_period_end := p_year_end;
316: p_defined_balance_id := 0;
317: p_group_by_gre := FALSE;
323:
324: /* An invalid report type has been passed so fail. */
325:
326: else
327: hr_utility.trace('in error of getting selection information ');
328:
329: raise hr_utility.hr_error;
330:
331: end if;
325:
326: else
327: hr_utility.trace('in error of getting selection information ');
328:
329: raise hr_utility.hr_error;
330:
331: end if;
332:
333: end get_selection_information;
354: and lookup_code = p_footnote_code))
355: );
356: begin
357:
358: hr_utility.trace('chk_rl2_footnote - checking footnote exists');
359: hr_utility.trace('c_chk_footnote - opening cursor');
360:
361: open c_chk_footnote;
362: fetch c_chk_footnote into l_flag;
355: );
356: begin
357:
358: hr_utility.trace('chk_rl2_footnote - checking footnote exists');
359: hr_utility.trace('c_chk_footnote - opening cursor');
360:
361: open c_chk_footnote;
362: fetch c_chk_footnote into l_flag;
363: if c_chk_footnote%FOUND then
360:
361: open c_chk_footnote;
362: fetch c_chk_footnote into l_flag;
363: if c_chk_footnote%FOUND then
364: hr_utility.trace('c_chk_footnote - found in cursor');
365: l_flag := 'Y';
366: else
367: hr_utility.trace('c_chk_footnote - not found in cursor');
368: l_flag := 'N';
363: if c_chk_footnote%FOUND then
364: hr_utility.trace('c_chk_footnote - found in cursor');
365: l_flag := 'Y';
366: else
367: hr_utility.trace('c_chk_footnote - not found in cursor');
368: l_flag := 'N';
369: end if;
370:
371: hr_utility.trace('c_chk_footnote - closing cursor');
367: hr_utility.trace('c_chk_footnote - not found in cursor');
368: l_flag := 'N';
369: end if;
370:
371: hr_utility.trace('c_chk_footnote - closing cursor');
372: close c_chk_footnote;
373:
374: if l_flag = 'Y' then
375: hr_utility.trace('chk_rl2_footnote - returning true');
371: hr_utility.trace('c_chk_footnote - closing cursor');
372: close c_chk_footnote;
373:
374: if l_flag = 'Y' then
375: hr_utility.trace('chk_rl2_footnote - returning true');
376: return (TRUE);
377: else
378: hr_utility.trace('chk_rl2_footnote - returning false');
379: return(FALSE);
374: if l_flag = 'Y' then
375: hr_utility.trace('chk_rl2_footnote - returning true');
376: return (TRUE);
377: else
378: hr_utility.trace('chk_rl2_footnote - returning false');
379: return(FALSE);
380: end if;
381:
382: end chk_rl2_footnote;
396: BEGIN
397:
398: If p_data = 'EMPLOYEE_DATA' then
399:
400: hr_utility.trace('deleting plsql table'|| p_data);
401:
402: if pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data.count > 0 then
403: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data.delete;
404: end if;
414: End if;
415:
416: If p_data = 'PRE_DATA' then
417:
418: hr_utility.trace('deleting plsql table'|| p_data);
419:
420: if pay_ca_eoy_rl2_archive.ltr_ppa_arch_data.count > 0 then
421: pay_ca_eoy_rl2_archive.ltr_ppa_arch_data.delete;
422: end if;
454: BEGIN
455:
456: if p_tab_rec_data.count > 0 then
457: for i in p_tab_rec_data.first .. p_tab_rec_data.last loop
458: hr_utility.trace('Defining category '||
459: p_tab_rec_data(i).action_info_category);
460: hr_utility.trace('action_context_id = '|| p_action_context_id);
461: hr_utility.trace('jurisdiction_code '||
462: p_tab_rec_data(i).jurisdiction_code);
456: if p_tab_rec_data.count > 0 then
457: for i in p_tab_rec_data.first .. p_tab_rec_data.last loop
458: hr_utility.trace('Defining category '||
459: p_tab_rec_data(i).action_info_category);
460: hr_utility.trace('action_context_id = '|| p_action_context_id);
461: hr_utility.trace('jurisdiction_code '||
462: p_tab_rec_data(i).jurisdiction_code);
463: hr_utility.trace('act_info1 is'|| p_tab_rec_data(i).act_info1);
464:
457: for i in p_tab_rec_data.first .. p_tab_rec_data.last loop
458: hr_utility.trace('Defining category '||
459: p_tab_rec_data(i).action_info_category);
460: hr_utility.trace('action_context_id = '|| p_action_context_id);
461: hr_utility.trace('jurisdiction_code '||
462: p_tab_rec_data(i).jurisdiction_code);
463: hr_utility.trace('act_info1 is'|| p_tab_rec_data(i).act_info1);
464:
465: hr_utility.trace('act_info2 is'|| p_tab_rec_data(i).act_info2);
459: p_tab_rec_data(i).action_info_category);
460: hr_utility.trace('action_context_id = '|| p_action_context_id);
461: hr_utility.trace('jurisdiction_code '||
462: p_tab_rec_data(i).jurisdiction_code);
463: hr_utility.trace('act_info1 is'|| p_tab_rec_data(i).act_info1);
464:
465: hr_utility.trace('act_info2 is'|| p_tab_rec_data(i).act_info2);
466:
467: hr_utility.trace('act_info3 is'|| p_tab_rec_data(i).act_info3);
461: hr_utility.trace('jurisdiction_code '||
462: p_tab_rec_data(i).jurisdiction_code);
463: hr_utility.trace('act_info1 is'|| p_tab_rec_data(i).act_info1);
464:
465: hr_utility.trace('act_info2 is'|| p_tab_rec_data(i).act_info2);
466:
467: hr_utility.trace('act_info3 is'|| p_tab_rec_data(i).act_info3);
468:
469: hr_utility.trace('act_info4 is'|| p_tab_rec_data(i).act_info4);
463: hr_utility.trace('act_info1 is'|| p_tab_rec_data(i).act_info1);
464:
465: hr_utility.trace('act_info2 is'|| p_tab_rec_data(i).act_info2);
466:
467: hr_utility.trace('act_info3 is'|| p_tab_rec_data(i).act_info3);
468:
469: hr_utility.trace('act_info4 is'|| p_tab_rec_data(i).act_info4);
470:
471: hr_utility.trace('act_info5 is'|| p_tab_rec_data(i).act_info5);
465: hr_utility.trace('act_info2 is'|| p_tab_rec_data(i).act_info2);
466:
467: hr_utility.trace('act_info3 is'|| p_tab_rec_data(i).act_info3);
468:
469: hr_utility.trace('act_info4 is'|| p_tab_rec_data(i).act_info4);
470:
471: hr_utility.trace('act_info5 is'|| p_tab_rec_data(i).act_info5);
472:
473: hr_utility.trace('act_info6 is'|| p_tab_rec_data(i).act_info6);
467: hr_utility.trace('act_info3 is'|| p_tab_rec_data(i).act_info3);
468:
469: hr_utility.trace('act_info4 is'|| p_tab_rec_data(i).act_info4);
470:
471: hr_utility.trace('act_info5 is'|| p_tab_rec_data(i).act_info5);
472:
473: hr_utility.trace('act_info6 is'|| p_tab_rec_data(i).act_info6);
474:
475: hr_utility.trace('act_info30 is'|| p_tab_rec_data(i).act_info30);
469: hr_utility.trace('act_info4 is'|| p_tab_rec_data(i).act_info4);
470:
471: hr_utility.trace('act_info5 is'|| p_tab_rec_data(i).act_info5);
472:
473: hr_utility.trace('act_info6 is'|| p_tab_rec_data(i).act_info6);
474:
475: hr_utility.trace('act_info30 is'|| p_tab_rec_data(i).act_info30);
476:
477: pay_action_information_api.create_action_information(
471: hr_utility.trace('act_info5 is'|| p_tab_rec_data(i).act_info5);
472:
473: hr_utility.trace('act_info6 is'|| p_tab_rec_data(i).act_info6);
474:
475: hr_utility.trace('act_info30 is'|| p_tab_rec_data(i).act_info30);
476:
477: pay_action_information_api.create_action_information(
478: p_action_information_id => l_action_information_id_1,
479: p_object_version_number => l_object_version_number_1,
654: /* Populate RL2 Amendment Employee Data for an assignment_action */
655:
656: open c_get_employee_data(p_assignment_action_id);
657:
658: hr_utility.trace('Populating RL2 Amendment Employee Data ');
659: hr_utility.trace('P_assignment_action_id :'||to_char(p_assignment_action_id));
660:
661: fetch c_get_employee_data into ltr_amend_arch_data(0);
662: close c_get_employee_data;
655:
656: open c_get_employee_data(p_assignment_action_id);
657:
658: hr_utility.trace('Populating RL2 Amendment Employee Data ');
659: hr_utility.trace('P_assignment_action_id :'||to_char(p_assignment_action_id));
660:
661: fetch c_get_employee_data into ltr_amend_arch_data(0);
662: close c_get_employee_data;
663:
665: /* Populate RL2 YEPP Employee Data for an assignment_action */
666:
667: open c_get_employee_data(p_locked_action_id);
668:
669: hr_utility.trace('Populating RL2 YEPP Employee Data ');
670: hr_utility.trace('P_locked_action_id :'||to_char(p_locked_action_id));
671:
672: fetch c_get_employee_data into ltr_yepp_arch_data(0);
673: close c_get_employee_data;
666:
667: open c_get_employee_data(p_locked_action_id);
668:
669: hr_utility.trace('Populating RL2 YEPP Employee Data ');
670: hr_utility.trace('P_locked_action_id :'||to_char(p_locked_action_id));
671:
672: fetch c_get_employee_data into ltr_yepp_arch_data(0);
673: close c_get_employee_data;
674:
675:
676: /* Populate RL2 Amendment Footnotes */
677: open c_get_footnotes(p_assignment_action_id);
678:
679: hr_utility.trace('Populating RL2 Amendment Footnote ');
680:
681: ln_amend_footnote_count := 0;
682: loop
683: fetch c_get_footnotes into ltr_amend_footnote(ln_amend_footnote_count);
682: loop
683: fetch c_get_footnotes into ltr_amend_footnote(ln_amend_footnote_count);
684: exit when c_get_footnotes%NOTFOUND;
685:
686: hr_utility.trace('Amend Message: '||ltr_amend_footnote(ln_amend_footnote_count).message);
687: hr_utility.trace('Amend Value: '||ltr_amend_footnote(ln_amend_footnote_count).value);
688:
689: ln_amend_footnote_count := ln_amend_footnote_count + 1;
690: end loop;
683: fetch c_get_footnotes into ltr_amend_footnote(ln_amend_footnote_count);
684: exit when c_get_footnotes%NOTFOUND;
685:
686: hr_utility.trace('Amend Message: '||ltr_amend_footnote(ln_amend_footnote_count).message);
687: hr_utility.trace('Amend Value: '||ltr_amend_footnote(ln_amend_footnote_count).value);
688:
689: ln_amend_footnote_count := ln_amend_footnote_count + 1;
690: end loop;
691:
698: loop
699: fetch c_get_footnotes into ltr_yepp_footnote(ln_yepp_footnote_count);
700: exit when c_get_footnotes%NOTFOUND;
701:
702: hr_utility.trace('YEPP Message: '||ltr_yepp_footnote(ln_yepp_footnote_count).message);
703: hr_utility.trace('YEPP Value: '||ltr_yepp_footnote(ln_yepp_footnote_count).value);
704:
705: ln_yepp_footnote_count := ln_yepp_footnote_count + 1;
706: end loop;
699: fetch c_get_footnotes into ltr_yepp_footnote(ln_yepp_footnote_count);
700: exit when c_get_footnotes%NOTFOUND;
701:
702: hr_utility.trace('YEPP Message: '||ltr_yepp_footnote(ln_yepp_footnote_count).message);
703: hr_utility.trace('YEPP Value: '||ltr_yepp_footnote(ln_yepp_footnote_count).value);
704:
705: ln_yepp_footnote_count := ln_yepp_footnote_count + 1;
706: end loop;
707:
706: end loop;
707:
708: close c_get_footnotes;
709:
710: hr_utility.trace('Comparing RL2 Amend and RL2 YEPP Data ');
711:
712: if (ltr_yepp_arch_data.count = ltr_amend_arch_data.count) then
713:
714: if (ltr_yepp_arch_data.count <> 0) then
742: (ltr_yepp_arch_data(0).act_info28 <> ltr_amend_arch_data(0).act_info28) or
743: (ltr_yepp_arch_data(0).act_info29 <> ltr_amend_arch_data(0).act_info29)) then
744:
745: lv_flag := 'Y';
746: hr_utility.trace('lv_flag has been set to Y for Employee Data');
747: end if;
748:
749: end if;
750:
749: end if;
750:
751: else
752: lv_flag := 'Y';
753: hr_utility.trace('lv_flag has been set to Y for Employee Data');
754: end if;
755:
756:
757: /* Compare RL2 Amendment Footnotes and RL2 YEPP Footnotes for an
756:
757: /* Compare RL2 Amendment Footnotes and RL2 YEPP Footnotes for an
758: assignment_action */
759:
760: hr_utility.trace('Comparing RL2 Amend and RL2 YEPP Footnotes');
761:
762: if lv_flag <> 'Y' then
763:
764: if ln_yepp_footnote_count <> ln_amend_footnote_count then
779: (ltr_yepp_footnote(i).value is not null and
780: ltr_amend_footnote(i).value is null)) then
781:
782: lv_flag := 'Y';
783: hr_utility.trace('Footnote with diff value :'||ltr_yepp_footnote(i).message);
784: exit;
785: end if;
786: end if;
787: end loop;
794:
795: if lv_flag <> 'Y' then
796:
797: lv_flag := 'N';
798: hr_utility.trace('No value difference for Asg Action: '|| to_char(p_assignment_action_id));
799:
800: end if;
801:
802: hr_utility.trace('lv_flag :'||lv_flag);
798: hr_utility.trace('No value difference for Asg Action: '|| to_char(p_assignment_action_id));
799:
800: end if;
801:
802: hr_utility.trace('lv_flag :'||lv_flag);
803:
804: return lv_flag;
805:
806: end compare_archive_data;
1021:
1022: /* Get the report type, report qualifier, business group id and the
1023: gre for which the archiving has to be done */
1024:
1025: hr_utility.trace('getting report type ');
1026:
1027: select effective_date,
1028: report_type,
1029: business_group_id,
1035: l_pre_org_id
1036: from pay_payroll_actions
1037: where payroll_action_id = pactid;
1038:
1039: hr_utility.trace('getting dates');
1040:
1041: get_dates(l_report_type,
1042: l_effective_date,
1043: l_period_end,
1045: l_quarter_end,
1046: l_year_start,
1047: l_year_end);
1048:
1049: hr_utility.trace('getting selection information');
1050: hr_utility.trace('report type '|| l_report_type);
1051: hr_utility.trace('quarter start '|| to_char(l_quarter_start,'dd-mm-yyyy'));
1052: hr_utility.trace('quarter end '|| to_char(l_quarter_end,'dd-mm-yyyy'));
1053: hr_utility.trace('year start '|| to_char(l_year_start,'dd-mm-yyyy'));
1046: l_year_start,
1047: l_year_end);
1048:
1049: hr_utility.trace('getting selection information');
1050: hr_utility.trace('report type '|| l_report_type);
1051: hr_utility.trace('quarter start '|| to_char(l_quarter_start,'dd-mm-yyyy'));
1052: hr_utility.trace('quarter end '|| to_char(l_quarter_end,'dd-mm-yyyy'));
1053: hr_utility.trace('year start '|| to_char(l_year_start,'dd-mm-yyyy'));
1054: hr_utility.trace('year end '|| to_char(l_year_end,'dd-mm-yyyy'));
1047: l_year_end);
1048:
1049: hr_utility.trace('getting selection information');
1050: hr_utility.trace('report type '|| l_report_type);
1051: hr_utility.trace('quarter start '|| to_char(l_quarter_start,'dd-mm-yyyy'));
1052: hr_utility.trace('quarter end '|| to_char(l_quarter_end,'dd-mm-yyyy'));
1053: hr_utility.trace('year start '|| to_char(l_year_start,'dd-mm-yyyy'));
1054: hr_utility.trace('year end '|| to_char(l_year_end,'dd-mm-yyyy'));
1055:
1048:
1049: hr_utility.trace('getting selection information');
1050: hr_utility.trace('report type '|| l_report_type);
1051: hr_utility.trace('quarter start '|| to_char(l_quarter_start,'dd-mm-yyyy'));
1052: hr_utility.trace('quarter end '|| to_char(l_quarter_end,'dd-mm-yyyy'));
1053: hr_utility.trace('year start '|| to_char(l_year_start,'dd-mm-yyyy'));
1054: hr_utility.trace('year end '|| to_char(l_year_end,'dd-mm-yyyy'));
1055:
1056: get_selection_information
1049: hr_utility.trace('getting selection information');
1050: hr_utility.trace('report type '|| l_report_type);
1051: hr_utility.trace('quarter start '|| to_char(l_quarter_start,'dd-mm-yyyy'));
1052: hr_utility.trace('quarter end '|| to_char(l_quarter_end,'dd-mm-yyyy'));
1053: hr_utility.trace('year start '|| to_char(l_year_start,'dd-mm-yyyy'));
1054: hr_utility.trace('year end '|| to_char(l_year_end,'dd-mm-yyyy'));
1055:
1056: get_selection_information
1057: (l_report_type,
1050: hr_utility.trace('report type '|| l_report_type);
1051: hr_utility.trace('quarter start '|| to_char(l_quarter_start,'dd-mm-yyyy'));
1052: hr_utility.trace('quarter end '|| to_char(l_quarter_end,'dd-mm-yyyy'));
1053: hr_utility.trace('year start '|| to_char(l_year_start,'dd-mm-yyyy'));
1054: hr_utility.trace('year end '|| to_char(l_year_end,'dd-mm-yyyy'));
1055:
1056: get_selection_information
1057: (l_report_type,
1058: l_quarter_start,
1066: l_group_by_medicare,
1067: l_tax_unit_context,
1068: l_jurisdiction_context);
1069:
1070: hr_utility.trace('Out of get selection information');
1071: open c_eoy_qbin;
1072:
1073: /* Loop for all rows returned for SQL statement. */
1074:
1071: open c_eoy_qbin;
1072:
1073: /* Loop for all rows returned for SQL statement. */
1074:
1075: hr_utility.trace('Entering loop');
1076:
1077: loop
1078:
1079: fetch c_eoy_qbin into l_person_id,
1086: /* If the new row is the same as the previous row according to the way
1087: the rows are grouped then discard the row ie. grouping by Prov Reporting
1088: Est requires a single row for each person / PRE combination. */
1089:
1090: hr_utility.trace('Prov Reporting Est is '
1091: || l_pre_org_id);
1092: hr_utility.trace('previous Prov Reporting Est is '||
1093: l_prev_pre_org_id);
1094: hr_utility.trace('person_id is '||
1088: Est requires a single row for each person / PRE combination. */
1089:
1090: hr_utility.trace('Prov Reporting Est is '
1091: || l_pre_org_id);
1092: hr_utility.trace('previous Prov Reporting Est is '||
1093: l_prev_pre_org_id);
1094: hr_utility.trace('person_id is '||
1095: to_char(l_person_id));
1096: hr_utility.trace('previous person_id is '||
1090: hr_utility.trace('Prov Reporting Est is '
1091: || l_pre_org_id);
1092: hr_utility.trace('previous Prov Reporting Est is '||
1093: l_prev_pre_org_id);
1094: hr_utility.trace('person_id is '||
1095: to_char(l_person_id));
1096: hr_utility.trace('previous person_id is '||
1097: to_char(l_prev_person_id));
1098:
1092: hr_utility.trace('previous Prov Reporting Est is '||
1093: l_prev_pre_org_id);
1094: hr_utility.trace('person_id is '||
1095: to_char(l_person_id));
1096: hr_utility.trace('previous person_id is '||
1097: to_char(l_prev_person_id));
1098:
1099: if (l_person_id = l_prev_person_id and
1100: l_pre_org_id = l_prev_pre_org_id) then
1098:
1099: if (l_person_id = l_prev_person_id and
1100: l_pre_org_id = l_prev_pre_org_id) then
1101:
1102: hr_utility.trace('Not creating assignment action');
1103:
1104: else
1105: /* Check whether the person has 0 payment or not */
1106:
1163: end loop;
1164: close c_all_qbin_gres;
1165: /* end of checking whether the person has 0 payment */
1166:
1167: hr_utility.trace('prev person is '|| to_char(l_prev_person_id));
1168: hr_utility.trace('person is '|| to_char(l_person_id));
1169: hr_utility.trace('assignment is '|| to_char(l_assignment_id));
1170:
1171:
1164: close c_all_qbin_gres;
1165: /* end of checking whether the person has 0 payment */
1166:
1167: hr_utility.trace('prev person is '|| to_char(l_prev_person_id));
1168: hr_utility.trace('person is '|| to_char(l_person_id));
1169: hr_utility.trace('assignment is '|| to_char(l_assignment_id));
1170:
1171:
1172: /* Have a new unique row according to the way the rows are grouped.
1165: /* end of checking whether the person has 0 payment */
1166:
1167: hr_utility.trace('prev person is '|| to_char(l_prev_person_id));
1168: hr_utility.trace('person is '|| to_char(l_person_id));
1169: hr_utility.trace('assignment is '|| to_char(l_assignment_id));
1170:
1171:
1172: /* Have a new unique row according to the way the rows are grouped.
1173: The inclusion of the person is dependent on having a non zero
1176: indicate their inclusion in the magnetic tape report. */
1177:
1178: /* Set up the context of tax unit id */
1179:
1180: hr_utility.trace('Setting context');
1181:
1182: if ((l_value <> 0) or (ln_no_gross_earnings <> 0)) then
1183: /* Get the primary assignment */
1184: open c_get_asg_id(l_person_id);
1186:
1187: if c_get_asg_id%NOTFOUND then
1188: close c_get_asg_id;
1189: pay_core_utils.push_message(800,'HR_74004_ASSIGNMENT_ABSENT','A');
1190: raise hr_utility.hr_error;
1191: else
1192: close c_get_asg_id;
1193: end if;
1194:
1200: from dual;
1201:
1202: /* Insert into pay_assignment_actions. */
1203:
1204: hr_utility.trace('creating assignment_action');
1205:
1206: /* Passing tax unit id as null */
1207:
1208: hr_nonrun_asact.insact(lockingactid,l_primary_asg,
1213: to do an additional checking against the assignment
1214: table
1215: */
1216:
1217: hr_utility.trace('updating assignment_action' || to_char(lockingactid));
1218:
1219: update pay_assignment_actions aa
1220: set aa.serial_number = to_char(l_person_id)
1221: where aa.assignment_action_id = lockingactid;
1230: l_prev_pre_org_id := l_pre_org_id;
1231:
1232: end loop;
1233:
1234: hr_utility.trace('Action creation done');
1235: close c_eoy_qbin;
1236:
1237: end eoy_action_creation;
1238:
1352: /* payroll action level database items */
1353:
1354: BEGIN
1355:
1356: /* hr_utility.trace_on('Y','RL2'); */
1357:
1358: initialization_process('PRE_DATA');
1359:
1360: select to_char(effective_date,'YYYY'),business_group_id,effective_date
1382: l_transmitter_org_id,
1383: l_transmitter_gre_ind;
1384:
1385: l_arch_gre_step := 40;
1386: hr_utility.trace('eoy_archive_gre_data 1');
1387:
1388: if employer_info%FOUND then
1389:
1390: close employer_info;
1387:
1388: if employer_info%FOUND then
1389:
1390: close employer_info;
1391: hr_utility.trace('got employer data ');
1392:
1393: l_employer_info_found := 'Y';
1394:
1395: begin
1470: l_accounting_contact_language:= 'TEST_DATA';
1471: l_proprietor_sin := 'TEST_DATA';
1472: l_arch_gre_step := 424;
1473:
1474: hr_utility.trace('eoy_archive_gre_data 2');
1475: close employer_info;
1476:
1477: pay_core_utils.push_message(801,'PAY_74014_NO_TRANSMITTER_ORG','A');
1478: pay_core_utils.push_token('orgind','Prov Reporting Est: '
1476:
1477: pay_core_utils.push_message(801,'PAY_74014_NO_TRANSMITTER_ORG','A');
1478: pay_core_utils.push_token('orgind','Prov Reporting Est: '
1479: ||p_pre_org_id);
1480: hr_utility.raise_error;
1481: end if; /* end if for employer_info%FOUND */
1482:
1483:
1484: /* archive Releve 2 data */
1618: /* Inserting rows into pay_action_information table
1619: Transmitter PRE Information */
1620:
1621: if ltr_ppa_arch_data.count >0 then
1622: hr_utility.trace('Archiving PRE Data');
1623: archive_data_records(
1624: p_action_context_id => p_payroll_action_id
1625: ,p_action_context_type=> 'PA'
1626: ,p_assignment_id => null
1632: /* Inserting rows into pay_action_information table
1633: Employer Information (Could be just a PRE or Transmitter PRE) */
1634:
1635: if pay_ca_eoy_rl2_archive.ltr_ppa_arch_er_data.count >0 then
1636: hr_utility.trace('Archiving Employer Data');
1637: archive_data_records(
1638: p_action_context_id => p_payroll_action_id
1639: ,p_action_context_type=> 'PA'
1640: ,p_assignment_id => null
1645:
1646: EXCEPTION
1647: when others then
1648: g_archive_flag := 'N';
1649: hr_utility.trace('Error in eoy_archive_gre_data at step :' ||
1650: to_char(l_arch_gre_step) || 'sqlcode : ' || to_char(sqlcode));
1651: if l_arch_gre_step = 40 then
1652: pay_core_utils.push_message(801,'PAY_74014_NO_TRANSMITTER_ORG','A');
1653: pay_core_utils.push_token('orgind','Prov Reporting Est: '
1652: pay_core_utils.push_message(801,'PAY_74014_NO_TRANSMITTER_ORG','A');
1653: pay_core_utils.push_token('orgind','Prov Reporting Est: '
1654: ||p_pre_org_id);
1655: end if;
1656: hr_utility.raise_error;
1657:
1658: END eoy_archive_gre_data;
1659:
1660: /* Name : chk_gre_archive
1675: and action_context_id = p_payroll_action_id;
1676:
1677: begin
1678:
1679: hr_utility.trace('chk_gre_archive - checking g_archive_flag');
1680:
1681: if g_archive_flag = 'Y' then
1682: hr_utility.trace('chk_gre_archive - g_archive_flag is Y');
1683: return (TRUE);
1678:
1679: hr_utility.trace('chk_gre_archive - checking g_archive_flag');
1680:
1681: if g_archive_flag = 'Y' then
1682: hr_utility.trace('chk_gre_archive - g_archive_flag is Y');
1683: return (TRUE);
1684: else
1685:
1686: hr_utility.trace('chk_gre_archive - opening cursor');
1682: hr_utility.trace('chk_gre_archive - g_archive_flag is Y');
1683: return (TRUE);
1684: else
1685:
1686: hr_utility.trace('chk_gre_archive - opening cursor');
1687:
1688: open c_chk_payroll_action;
1689: fetch c_chk_payroll_action into l_flag;
1690: if c_chk_payroll_action%FOUND then
1687:
1688: open c_chk_payroll_action;
1689: fetch c_chk_payroll_action into l_flag;
1690: if c_chk_payroll_action%FOUND then
1691: hr_utility.trace('chk_gre_archive - found in cursor');
1692: g_archive_flag := 'Y';
1693: else
1694: hr_utility.trace('chk_gre_archive - not found in cursor');
1695: g_archive_flag := 'N';
1690: if c_chk_payroll_action%FOUND then
1691: hr_utility.trace('chk_gre_archive - found in cursor');
1692: g_archive_flag := 'Y';
1693: else
1694: hr_utility.trace('chk_gre_archive - not found in cursor');
1695: g_archive_flag := 'N';
1696: end if;
1697:
1698: hr_utility.trace('chk_gre_archive - closing cursor');
1694: hr_utility.trace('chk_gre_archive - not found in cursor');
1695: g_archive_flag := 'N';
1696: end if;
1697:
1698: hr_utility.trace('chk_gre_archive - closing cursor');
1699: close c_chk_payroll_action;
1700: if g_archive_flag = 'Y' then
1701: hr_utility.trace('chk_gre_archive - returning true');
1702: return (TRUE);
1697:
1698: hr_utility.trace('chk_gre_archive - closing cursor');
1699: close c_chk_payroll_action;
1700: if g_archive_flag = 'Y' then
1701: hr_utility.trace('chk_gre_archive - returning true');
1702: return (TRUE);
1703: else
1704: hr_utility.trace('chk_gre_archive - returning false');
1705: return(FALSE);
1700: if g_archive_flag = 'Y' then
1701: hr_utility.trace('chk_gre_archive - returning true');
1702: return (TRUE);
1703: else
1704: hr_utility.trace('chk_gre_archive - returning false');
1705: return(FALSE);
1706: end if;
1707: end if;
1708: end chk_gre_archive;
1734: raise_application_error(-20001,'eoy_archinit: Assignment actions not created!!!');
1735: end if;
1736: close c_get_min_chunk;
1737:
1738: hr_utility.set_location ('eoy_archinit min chunk is ' || to_char(g_min_chunk),12);
1739: l_step := 2;
1740: l_archive := chk_gre_archive(p_payroll_action_id);
1741:
1742: l_step := 3;
1739: l_step := 2;
1740: l_archive := chk_gre_archive(p_payroll_action_id);
1741:
1742: l_step := 3;
1743: hr_utility.trace ('eoy_archinit g_archive_flag is ' || g_archive_flag);
1744: exception
1745: when others then
1746: raise_application_error(-20001,'eoy_archinit at '
1747: ||to_char(l_step)||' - '||to_char(sqlcode) || '-' || sqlerrm);
2073: and cp_eff_date between start_date and end_date;
2074:
2075: BEGIN
2076:
2077: --hr_utility.trace_on(null,'RL2');
2078: hr_utility.set_location ('archive_data',1);
2079: hr_utility.trace('getting assignment');
2080: l_negative_balance_exists := 'N';
2081: l_has_been_paid := 'N';
2074:
2075: BEGIN
2076:
2077: --hr_utility.trace_on(null,'RL2');
2078: hr_utility.set_location ('archive_data',1);
2079: hr_utility.trace('getting assignment');
2080: l_negative_balance_exists := 'N';
2081: l_has_been_paid := 'N';
2082:
2075: BEGIN
2076:
2077: --hr_utility.trace_on(null,'RL2');
2078: hr_utility.set_location ('archive_data',1);
2079: hr_utility.trace('getting assignment');
2080: l_negative_balance_exists := 'N';
2081: l_has_been_paid := 'N';
2082:
2083: lv_BoxL_Excess_amt := '0';
2115: where payroll_action_id = l_payroll_action_id;
2116:
2117: exception when no_data_found then
2118: /* need a pop-message */
2119: hr_utility.trace('assignment_action_id doesnot exist to archive emp_info'
2120: ||to_char(p_assactid));
2121: end;
2122:
2123: /* If the chunk of the assignment is same as the minimun chunk
2125: archived then archive the gre data i.e. the employer data */
2126:
2127: if l_chunk = g_min_chunk and g_archive_flag = 'N' then
2128:
2129: hr_utility.trace('eoy_archive_data archiving employer data');
2130: hr_utility.trace('l_payroll_action_id '|| to_char(l_payroll_action_id));
2131: hr_utility.trace('l_pre_org_id '|| l_pre_org_id);
2132:
2133: eoy_archive_gre_data(p_payroll_action_id =>l_payroll_action_id,
2126:
2127: if l_chunk = g_min_chunk and g_archive_flag = 'N' then
2128:
2129: hr_utility.trace('eoy_archive_data archiving employer data');
2130: hr_utility.trace('l_payroll_action_id '|| to_char(l_payroll_action_id));
2131: hr_utility.trace('l_pre_org_id '|| l_pre_org_id);
2132:
2133: eoy_archive_gre_data(p_payroll_action_id =>l_payroll_action_id,
2134: p_pre_org_id=>l_pre_org_id);
2127: if l_chunk = g_min_chunk and g_archive_flag = 'N' then
2128:
2129: hr_utility.trace('eoy_archive_data archiving employer data');
2130: hr_utility.trace('l_payroll_action_id '|| to_char(l_payroll_action_id));
2131: hr_utility.trace('l_pre_org_id '|| l_pre_org_id);
2132:
2133: eoy_archive_gre_data(p_payroll_action_id =>l_payroll_action_id,
2134: p_pre_org_id=>l_pre_org_id);
2135:
2132:
2133: eoy_archive_gre_data(p_payroll_action_id =>l_payroll_action_id,
2134: p_pre_org_id=>l_pre_org_id);
2135:
2136: hr_utility.trace('eoy_archive_data archived employer data');
2137:
2138: end if;
2139:
2140: hr_utility.set_location ('archive_data',2);
2136: hr_utility.trace('eoy_archive_data archived employer data');
2137:
2138: end if;
2139:
2140: hr_utility.set_location ('archive_data',2);
2141:
2142: hr_utility.trace('assignment '|| to_char(l_asgid));
2143: hr_utility.trace('date_earned '|| to_char(l_date_earned));
2144: hr_utility.trace('tax_unit_id '|| to_char(l_tax_unit_id));
2138: end if;
2139:
2140: hr_utility.set_location ('archive_data',2);
2141:
2142: hr_utility.trace('assignment '|| to_char(l_asgid));
2143: hr_utility.trace('date_earned '|| to_char(l_date_earned));
2144: hr_utility.trace('tax_unit_id '|| to_char(l_tax_unit_id));
2145: hr_utility.trace('business_group_id '|| to_char(l_business_group_id));
2146:
2139:
2140: hr_utility.set_location ('archive_data',2);
2141:
2142: hr_utility.trace('assignment '|| to_char(l_asgid));
2143: hr_utility.trace('date_earned '|| to_char(l_date_earned));
2144: hr_utility.trace('tax_unit_id '|| to_char(l_tax_unit_id));
2145: hr_utility.trace('business_group_id '|| to_char(l_business_group_id));
2146:
2147: /* Derive the beginning and end of the effective year */
2140: hr_utility.set_location ('archive_data',2);
2141:
2142: hr_utility.trace('assignment '|| to_char(l_asgid));
2143: hr_utility.trace('date_earned '|| to_char(l_date_earned));
2144: hr_utility.trace('tax_unit_id '|| to_char(l_tax_unit_id));
2145: hr_utility.trace('business_group_id '|| to_char(l_business_group_id));
2146:
2147: /* Derive the beginning and end of the effective year */
2148:
2141:
2142: hr_utility.trace('assignment '|| to_char(l_asgid));
2143: hr_utility.trace('date_earned '|| to_char(l_date_earned));
2144: hr_utility.trace('tax_unit_id '|| to_char(l_tax_unit_id));
2145: hr_utility.trace('business_group_id '|| to_char(l_business_group_id));
2146:
2147: /* Derive the beginning and end of the effective year */
2148:
2149: hr_utility.trace('getting begin and end dates');
2145: hr_utility.trace('business_group_id '|| to_char(l_business_group_id));
2146:
2147: /* Derive the beginning and end of the effective year */
2148:
2149: hr_utility.trace('getting begin and end dates');
2150:
2151: l_step := 2;
2152:
2153: l_year_start := trunc(p_effective_date, 'Y');
2152:
2153: l_year_start := trunc(p_effective_date, 'Y');
2154: l_year_end := add_months(trunc(p_effective_date, 'Y'),12) - 1;
2155:
2156: hr_utility.trace('year start '|| to_char(l_year_start));
2157: hr_utility.trace('year end '|| to_char(l_year_end));
2158:
2159:
2160: l_step := 3;
2153: l_year_start := trunc(p_effective_date, 'Y');
2154: l_year_end := add_months(trunc(p_effective_date, 'Y'),12) - 1;
2155:
2156: hr_utility.trace('year start '|| to_char(l_year_start));
2157: hr_utility.trace('year end '|| to_char(l_year_end));
2158:
2159:
2160: l_step := 3;
2161:
2181:
2182: /* We can archive the balance level dbis also because for employee level
2183: balances jurisdiction is always a context. */
2184:
2185: hr_utility.trace('max assignment_action_id : ' || to_char(l_aaid));
2186:
2187: pay_balance_pkg.set_context('ASSIGNMENT_ACTION_ID',l_aaid);
2188: pay_balance_pkg.set_context('JURISDICTION_CODE', l_jurisdiction);
2189:
2186:
2187: pay_balance_pkg.set_context('ASSIGNMENT_ACTION_ID',l_aaid);
2188: pay_balance_pkg.set_context('JURISDICTION_CODE', l_jurisdiction);
2189:
2190: hr_utility.trace('Archiving the balance dbi ' || l_jurisdiction);
2191:
2192: /* RL2 Slip number generation */
2193:
2194: begin
2203: and hoi.organization_id = to_number(l_pre_org_id)
2204: and hoi.org_information4 = 'P02';
2205:
2206:
2207: hr_utility.trace('l_transmitter_id : ' || to_char(l_transmitter_id));
2208:
2209: hr_utility.trace('3');
2210:
2211: select to_number(target.ORG_INFORMATION18)
2205:
2206:
2207: hr_utility.trace('l_transmitter_id : ' || to_char(l_transmitter_id));
2208:
2209: hr_utility.trace('3');
2210:
2211: select to_number(target.ORG_INFORMATION18)
2212: into l_rl2_last_slip_number
2213: from hr_organization_information target
2214: where target.organization_id = l_transmitter_id
2215: and target.org_information_context = 'Prov Reporting Est'
2216: and target.ORG_INFORMATION3 = 'Y';
2217:
2218: hr_utility.trace('l_rl2_last_slip_number b4 adding sequence= '|| l_rl2_last_slip_number);
2219:
2220: select l_rl2_last_slip_number + pay_ca_eoy_rl2_s.nextval - 1
2221: into l_rl2_curr_slip_number from dual;
2222:
2219:
2220: select l_rl2_last_slip_number + pay_ca_eoy_rl2_s.nextval - 1
2221: into l_rl2_curr_slip_number from dual;
2222:
2223: hr_utility.trace('1');
2224:
2225: l_rl2_slip_number_last_digit := mod(l_rl2_curr_slip_number,7);
2226:
2227: hr_utility.trace('l_rl2_curr_slip_number : '||l_rl2_curr_slip_number);
2223: hr_utility.trace('1');
2224:
2225: l_rl2_slip_number_last_digit := mod(l_rl2_curr_slip_number,7);
2226:
2227: hr_utility.trace('l_rl2_curr_slip_number : '||l_rl2_curr_slip_number);
2228: hr_utility.trace('l_rl2_slip_number_last_digit : '||
2229: l_rl2_slip_number_last_digit);
2230:
2231: l_rl2_slip_number := (l_rl2_curr_slip_number)||
2224:
2225: l_rl2_slip_number_last_digit := mod(l_rl2_curr_slip_number,7);
2226:
2227: hr_utility.trace('l_rl2_curr_slip_number : '||l_rl2_curr_slip_number);
2228: hr_utility.trace('l_rl2_slip_number_last_digit : '||
2229: l_rl2_slip_number_last_digit);
2230:
2231: l_rl2_slip_number := (l_rl2_curr_slip_number)||
2232: l_rl2_slip_number_last_digit;
2230:
2231: l_rl2_slip_number := (l_rl2_curr_slip_number)||
2232: l_rl2_slip_number_last_digit;
2233:
2234: hr_utility.trace('l_rl2_slip_number : ' || l_rl2_slip_number);
2235:
2236: begin
2237: select hoi.org_information1,hoi.org_information2
2238: into l_pre_source_of_income,l_pre_description
2241: and hoi.org_information_context = 'Prov Reporting Est2';
2242:
2243: exception
2244: when no_data_found then
2245: hr_utility.trace('No RL2 Source of Income at PRE level');
2246: hr_utility.trace('l_transmitter_id :'||to_char(l_transmitter_id));
2247: l_pre_source_of_income := NULL;
2248: l_pre_description := NULL;
2249: end;
2242:
2243: exception
2244: when no_data_found then
2245: hr_utility.trace('No RL2 Source of Income at PRE level');
2246: hr_utility.trace('l_transmitter_id :'||to_char(l_transmitter_id));
2247: l_pre_source_of_income := NULL;
2248: l_pre_description := NULL;
2249: end;
2250:
2249: end;
2250:
2251: exception
2252: when no_data_found then
2253: hr_utility.trace('Problem in generation of RL2 Slip Number');
2254: hr_utility.trace('l_transmitter_id :'||to_char(l_transmitter_id));
2255: /* need a pop-message if rl2 slip number not generated */
2256: l_rl2_slip_number := 0;
2257:
2250:
2251: exception
2252: when no_data_found then
2253: hr_utility.trace('Problem in generation of RL2 Slip Number');
2254: hr_utility.trace('l_transmitter_id :'||to_char(l_transmitter_id));
2255: /* need a pop-message if rl2 slip number not generated */
2256: l_rl2_slip_number := 0;
2257:
2258: end;
2257:
2258: end;
2259:
2260: /* Initialise the PL/SQL table before populating it */
2261: hr_utility.trace('Initialising Pl/SQL table');
2262:
2263: l_count := 0;
2264:
2265: l_count := l_count + 1;
2335: -- RL2 Box O
2336: l_count := l_count + 1;
2337: l_balance_type_tab(l_count) := 'Withdrawal under the Home Buyers Plan';
2338:
2339: hr_utility.trace('Assignment action id is ' || to_char(p_assactid));
2340:
2341: for i in 1 .. l_count
2342: loop
2343: hr_utility.trace('Initialising values');
2339: hr_utility.trace('Assignment action id is ' || to_char(p_assactid));
2340:
2341: for i in 1 .. l_count
2342: loop
2343: hr_utility.trace('Initialising values');
2344: l_user_entity_value_tab(i) := 0;
2345: end loop;
2346:
2347: open c_all_gres(p_assactid);
2347: open c_all_gres(p_assactid);
2348:
2349: loop
2350:
2351: hr_utility.trace('Fetching all GREs');
2352: fetch c_all_gres into l_tax_unit_id,l_reporting_type;
2353: exit when c_all_gres%NOTFOUND;
2354:
2355: hr_utility.trace('Tax unit id is ' || to_char(l_tax_unit_id));
2351: hr_utility.trace('Fetching all GREs');
2352: fetch c_all_gres into l_tax_unit_id,l_reporting_type;
2353: exit when c_all_gres%NOTFOUND;
2354:
2355: hr_utility.trace('Tax unit id is ' || to_char(l_tax_unit_id));
2356: hr_utility.trace('Person_id is ' || lv_serial_number);
2357: hr_utility.trace('Asgid is ' || to_char(l_asgid));
2358: hr_utility.trace('Reporting_type is ' || l_reporting_type);
2359: hr_utility.trace('Effective date is ' || to_char(p_effective_date));
2352: fetch c_all_gres into l_tax_unit_id,l_reporting_type;
2353: exit when c_all_gres%NOTFOUND;
2354:
2355: hr_utility.trace('Tax unit id is ' || to_char(l_tax_unit_id));
2356: hr_utility.trace('Person_id is ' || lv_serial_number);
2357: hr_utility.trace('Asgid is ' || to_char(l_asgid));
2358: hr_utility.trace('Reporting_type is ' || l_reporting_type);
2359: hr_utility.trace('Effective date is ' || to_char(p_effective_date));
2360:
2353: exit when c_all_gres%NOTFOUND;
2354:
2355: hr_utility.trace('Tax unit id is ' || to_char(l_tax_unit_id));
2356: hr_utility.trace('Person_id is ' || lv_serial_number);
2357: hr_utility.trace('Asgid is ' || to_char(l_asgid));
2358: hr_utility.trace('Reporting_type is ' || l_reporting_type);
2359: hr_utility.trace('Effective date is ' || to_char(p_effective_date));
2360:
2361: begin
2354:
2355: hr_utility.trace('Tax unit id is ' || to_char(l_tax_unit_id));
2356: hr_utility.trace('Person_id is ' || lv_serial_number);
2357: hr_utility.trace('Asgid is ' || to_char(l_asgid));
2358: hr_utility.trace('Reporting_type is ' || l_reporting_type);
2359: hr_utility.trace('Effective date is ' || to_char(p_effective_date));
2360:
2361: begin
2362: /* Getting Payroll Run Level Max Assignment Action Id for
2355: hr_utility.trace('Tax unit id is ' || to_char(l_tax_unit_id));
2356: hr_utility.trace('Person_id is ' || lv_serial_number);
2357: hr_utility.trace('Asgid is ' || to_char(l_asgid));
2358: hr_utility.trace('Reporting_type is ' || l_reporting_type);
2359: hr_utility.trace('Effective date is ' || to_char(p_effective_date));
2360:
2361: begin
2362: /* Getting Payroll Run Level Max Assignment Action Id for
2363: the given tax_unit_id in the reporting year. Fix for bug#3638928 */
2368: l_year_end);
2369: fetch c_get_max_asg_act_id into l_aaid;
2370: close c_get_max_asg_act_id;
2371:
2372: hr_utility.trace('l_aaid is ' || to_char(l_aaid));
2373: hr_utility.trace('l_count is ' || to_char(l_count));
2374:
2375: ln_no_gross_earnings := ln_no_gross_earnings +
2376: nvl(pay_ca_balance_pkg.call_ca_balance_get_value
2369: fetch c_get_max_asg_act_id into l_aaid;
2370: close c_get_max_asg_act_id;
2371:
2372: hr_utility.trace('l_aaid is ' || to_char(l_aaid));
2373: hr_utility.trace('l_count is ' || to_char(l_count));
2374:
2375: ln_no_gross_earnings := ln_no_gross_earnings +
2376: nvl(pay_ca_balance_pkg.call_ca_balance_get_value
2377: ('RL2 No Gross Earnings',
2389:
2390: if l_tax_unit_id <> l_prev_tax_unit_id or
2391: l_prev_tax_unit_id is null then
2392:
2393: hr_utility.trace('l_business_group_id is '||to_char(l_business_group_id));
2394:
2395: pay_balance_pkg.set_context('TAX_UNIT_ID',l_tax_unit_id);
2396: pay_balance_pkg.set_context('ASSIGNMENT_ACTION_ID',l_aaid);
2397: Pay_balance_pkg.set_context('JURISDICTION_CODE', 'QC');
2398:
2399: for i in 1 .. l_count
2400: loop
2401:
2402: hr_utility.trace('l_balance_type is ' || l_balance_type_tab(i));
2403: hr_utility.trace('i is ' || i);
2404:
2405: -- T4A earnings should not go to BOX A of RL2
2406:
2399: for i in 1 .. l_count
2400: loop
2401:
2402: hr_utility.trace('l_balance_type is ' || l_balance_type_tab(i));
2403: hr_utility.trace('i is ' || i);
2404:
2405: -- T4A earnings should not go to BOX A of RL2
2406:
2407: if l_reporting_type = 'T4A/RL2' and
2425: l_business_group_id,
2426: 'QC'
2427: ),0);
2428:
2429: hr_utility.trace('Fed Result = ' || fed_result);
2430: else
2431: fed_result := 0;
2432: hr_utility.trace('Fed Result = ' || fed_result);
2433: end if;/*end if for l_balance_type_tab(i)='Gross Earnings' */
2428:
2429: hr_utility.trace('Fed Result = ' || fed_result);
2430: else
2431: fed_result := 0;
2432: hr_utility.trace('Fed Result = ' || fed_result);
2433: end if;/*end if for l_balance_type_tab(i)='Gross Earnings' */
2434:
2435: /* Based on defined_balance_id get the balance value
2436: for each assignment action */
2452: end if;
2453:
2454: end if; -- end if for 'T4A/RL2' validation
2455:
2456: hr_utility.trace('Balance Type is '||l_balance_type_tab(i));
2457: hr_utility.trace('archive value is '||l_user_entity_value_tab(i));
2458: l_prev_tax_unit_id := l_tax_unit_id ;
2459:
2460: end loop; -- end loop for all balances plsql table
2453:
2454: end if; -- end if for 'T4A/RL2' validation
2455:
2456: hr_utility.trace('Balance Type is '||l_balance_type_tab(i));
2457: hr_utility.trace('archive value is '||l_user_entity_value_tab(i));
2458: l_prev_tax_unit_id := l_tax_unit_id ;
2459:
2460: end loop; -- end loop for all balances plsql table
2461: end if; --end if for l_tax_unit_id <> l_prev_tax_unit_id validation
2461: end if; --end if for l_tax_unit_id <> l_prev_tax_unit_id validation
2462:
2463: exception
2464: when no_data_found then
2465: hr_utility.trace('This Tax unit id has no payroll run, so skip it');
2466: /* need a pop-message asgid has no payroll run in tax-unit-id */
2467: end;
2468: end loop;
2469: close c_all_gres;
2467: end;
2468: end loop;
2469: close c_all_gres;
2470:
2471: hr_utility.trace('l_no_of_payroll_run is ' || l_no_of_payroll_run);
2472:
2473: ln_index := pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data.count;
2474: ln_footnote_index := pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_ft_data.count;
2475:
2472:
2473: ln_index := pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data.count;
2474: ln_footnote_index := pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_ft_data.count;
2475:
2476: hr_utility.trace('ln_index :'||to_char(ln_index));
2477: hr_utility.trace('ln_footnote_index :'||to_char(ln_footnote_index));
2478:
2479: if ((l_no_of_payroll_run > 0) and
2480: ((l_has_been_paid = 'Y') or (ln_no_gross_earnings <> 0)) ) then
2473: ln_index := pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data.count;
2474: ln_footnote_index := pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_ft_data.count;
2475:
2476: hr_utility.trace('ln_index :'||to_char(ln_index));
2477: hr_utility.trace('ln_footnote_index :'||to_char(ln_footnote_index));
2478:
2479: if ((l_no_of_payroll_run > 0) and
2480: ((l_has_been_paid = 'Y') or (ln_no_gross_earnings <> 0)) ) then
2481:
2483: := l_rl2_slip_number;
2484: for i in 1 .. l_count
2485: loop
2486:
2487: hr_utility.trace('in the employee info archive loop');
2488: hr_utility.trace('Balance name is '|| l_balance_type_tab(i));
2489: hr_utility.trace('value tab is '|| l_user_entity_value_tab(i));
2490: /*
2491: lv_BoxL_excess_amt := '0';
2484: for i in 1 .. l_count
2485: loop
2486:
2487: hr_utility.trace('in the employee info archive loop');
2488: hr_utility.trace('Balance name is '|| l_balance_type_tab(i));
2489: hr_utility.trace('value tab is '|| l_user_entity_value_tab(i));
2490: /*
2491: lv_BoxL_excess_amt := '0';
2492: lv_BoxO_excess_amt := '0';
2485: loop
2486:
2487: hr_utility.trace('in the employee info archive loop');
2488: hr_utility.trace('Balance name is '|| l_balance_type_tab(i));
2489: hr_utility.trace('value tab is '|| l_user_entity_value_tab(i));
2490: /*
2491: lv_BoxL_excess_amt := '0';
2492: lv_BoxO_excess_amt := '0';
2493: */
2495: if l_balance_type_tab(i) =
2496: 'Life Annuity Payments registered plan' then
2497: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info3
2498: := l_user_entity_value_tab(i);
2499: hr_utility.trace('ln_index :'||to_char(ln_index));
2500:
2501: elsif l_balance_type_tab(i) =
2502: 'Life Annuity Payments Unregistered plan' then
2503:
2513:
2514: elsif l_balance_type_tab(i) = 'Other Payments' then
2515: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info5
2516: := l_user_entity_value_tab(i);
2517: hr_utility.trace('Box C :'||pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info5);
2518:
2519: elsif l_balance_type_tab(i) =
2520: 'Refund of RRSP Premiums paid to surviving spouse' then
2521: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info6
2599:
2600: end if;
2601:
2602:
2603: hr_utility.trace('value tab is '|| l_user_entity_value_tab(i));
2604:
2605: if to_number(nvl(l_user_entity_value_tab(i),'0')) < 0 then
2606:
2607: hr_utility.trace('Negative balance exists');
2603: hr_utility.trace('value tab is '|| l_user_entity_value_tab(i));
2604:
2605: if to_number(nvl(l_user_entity_value_tab(i),'0')) < 0 then
2606:
2607: hr_utility.trace('Negative balance exists');
2608: l_negative_balance_exists := 'Y';
2609: end if;
2610:
2611: if l_user_entity_value_tab(i) <> 0 then
2620:
2621: l_footnote_amount
2622: := to_number(nvl(l_user_entity_value_tab(i),0));
2623: ln_footnote_index := ln_footnote_index;
2624: hr_utility.trace(' Box A ln_footnote_index :'
2625: ||to_char(ln_footnote_index));
2626:
2627: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_ft_data
2628: (ln_footnote_index).action_info_category := 'CA FOOTNOTES';
2637: (ln_footnote_index).act_info6 := 'RL2';
2638:
2639: if l_footnote_amount < 0 then
2640:
2641: hr_utility.trace('Negative balance exists');
2642: l_negative_balance_exists := 'Y';
2643: end if;
2644:
2645: end if; /* end if for chk_rl2_footnote */
2652: ('Benefits from RRSP RRIF DPSP and Annuities',
2653: 'Other Payments') then
2654: begin
2655:
2656: hr_utility.trace('RL2 Footnote archive start ');
2657: lv_footnote_bal := l_footnote_balance_type_tab;
2658: l_footnote_code := NULL;
2659: old_l_footnote_code := NULL;
2660: l_footnote_amount := 0;
2659: old_l_footnote_code := NULL;
2660: l_footnote_amount := 0;
2661:
2662: open c_footnote_info(lv_footnote_bal);
2663: hr_utility.trace('lv_footnote_bal is '||lv_footnote_bal);
2664:
2665: loop
2666: fetch c_footnote_info into l_footnote_code,
2667: l_footnote_balance;
2666: fetch c_footnote_info into l_footnote_code,
2667: l_footnote_balance;
2668: exit when c_footnote_info%NOTFOUND;
2669:
2670: hr_utility.trace('l_footnote_amount_balance is '||
2671: l_footnote_balance);
2672: hr_utility.trace('l_footnote_code is '||
2673: l_footnote_code);
2674:
2668: exit when c_footnote_info%NOTFOUND;
2669:
2670: hr_utility.trace('l_footnote_amount_balance is '||
2671: l_footnote_balance);
2672: hr_utility.trace('l_footnote_code is '||
2673: l_footnote_code);
2674:
2675: if ( l_footnote_code <> old_l_footnote_code or
2676: old_l_footnote_code is null )
2676: old_l_footnote_code is null )
2677: then
2678: if old_l_footnote_code is not null then
2679:
2680: hr_utility.trace('old_l_footnote_code is '||
2681: old_l_footnote_code);
2682: hr_utility.trace('l_footnote_amount is '||
2683: to_char(l_footnote_amount));
2684:
2678: if old_l_footnote_code is not null then
2679:
2680: hr_utility.trace('old_l_footnote_code is '||
2681: old_l_footnote_code);
2682: hr_utility.trace('l_footnote_amount is '||
2683: to_char(l_footnote_amount));
2684:
2685: if chk_rl2_footnote(old_l_footnote_code) and
2686: l_footnote_amount <> 0 then
2684:
2685: if chk_rl2_footnote(old_l_footnote_code) and
2686: l_footnote_amount <> 0 then
2687:
2688: hr_utility.trace('RL2 footnote archiving ');
2689: ln_footnote_index := ln_footnote_index + 1;
2690: hr_utility.trace('old_l_ftcode ln_footnote_index :'
2691: ||to_char(ln_footnote_index));
2692:
2686: l_footnote_amount <> 0 then
2687:
2688: hr_utility.trace('RL2 footnote archiving ');
2689: ln_footnote_index := ln_footnote_index + 1;
2690: hr_utility.trace('old_l_ftcode ln_footnote_index :'
2691: ||to_char(ln_footnote_index));
2692:
2693: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_ft_data
2694: (ln_footnote_index).action_info_category
2709: (ln_footnote_index).act_info6 := 'RL2';
2710:
2711: if l_footnote_amount < 0 then
2712:
2713: hr_utility.trace('Negative balance exists');
2714: l_negative_balance_exists := 'Y';
2715: end if;
2716:
2717: end if;/* end if for chk_rl2_footnote */
2729: -- get the footnote_balance
2730:
2731: open c_all_gres_for_footnote(p_assactid);
2732: loop
2733: hr_utility.trace('Fetching all GREs for footnotes');
2734: fetch c_all_gres_for_footnote into l_tax_unit_id,
2735: l_reporting_type;
2736: exit when c_all_gres_for_footnote%NOTFOUND;
2737:
2734: fetch c_all_gres_for_footnote into l_tax_unit_id,
2735: l_reporting_type;
2736: exit when c_all_gres_for_footnote%NOTFOUND;
2737:
2738: hr_utility.trace('Tax unit id is ' || l_tax_unit_id);
2739: hr_utility.trace('Asgid is ' || l_asgid);
2740: hr_utility.trace('Reporting_type is ' || l_reporting_type);
2741: hr_utility.trace('Effective date is '|| p_effective_date);
2742:
2735: l_reporting_type;
2736: exit when c_all_gres_for_footnote%NOTFOUND;
2737:
2738: hr_utility.trace('Tax unit id is ' || l_tax_unit_id);
2739: hr_utility.trace('Asgid is ' || l_asgid);
2740: hr_utility.trace('Reporting_type is ' || l_reporting_type);
2741: hr_utility.trace('Effective date is '|| p_effective_date);
2742:
2743: begin
2736: exit when c_all_gres_for_footnote%NOTFOUND;
2737:
2738: hr_utility.trace('Tax unit id is ' || l_tax_unit_id);
2739: hr_utility.trace('Asgid is ' || l_asgid);
2740: hr_utility.trace('Reporting_type is ' || l_reporting_type);
2741: hr_utility.trace('Effective date is '|| p_effective_date);
2742:
2743: begin
2744: open c_get_max_asg_act_id(to_number(lv_serial_number),
2737:
2738: hr_utility.trace('Tax unit id is ' || l_tax_unit_id);
2739: hr_utility.trace('Asgid is ' || l_asgid);
2740: hr_utility.trace('Reporting_type is ' || l_reporting_type);
2741: hr_utility.trace('Effective date is '|| p_effective_date);
2742:
2743: begin
2744: open c_get_max_asg_act_id(to_number(lv_serial_number),
2745: l_tax_unit_id,
2747: l_year_end);
2748: fetch c_get_max_asg_act_id into l_aaid;
2749: close c_get_max_asg_act_id;
2750:
2751: hr_utility.trace('l_aaid is ' || l_aaid);
2752: hr_utility.trace('l_count is ' || l_count);
2753:
2754: l_no_of_payroll_run := l_no_of_payroll_run + 1;
2755:
2748: fetch c_get_max_asg_act_id into l_aaid;
2749: close c_get_max_asg_act_id;
2750:
2751: hr_utility.trace('l_aaid is ' || l_aaid);
2752: hr_utility.trace('l_count is ' || l_count);
2753:
2754: l_no_of_payroll_run := l_no_of_payroll_run + 1;
2755:
2756: if ( l_tax_unit_id <> l_prev_tax_unit_id or
2774: l_business_group_id,
2775: 'QC'
2776: ),0) ;
2777:
2778: hr_utility.trace('l_footnote_amount is '
2779: || to_char(l_footnote_amount));
2780: end if;
2781:
2782: l_prev_tax_unit_id := l_tax_unit_id ;
2782: l_prev_tax_unit_id := l_tax_unit_id ;
2783: exception
2784: when no_data_found then
2785: /* need a pop-message asgid has not payrollrun in tx*/
2786: hr_utility.trace('This Tax unit id has no payroll run'
2787: ||' so skip it');
2788: end;
2789: end loop;
2790: close c_all_gres_for_footnote;
2792: -- end of getting balance
2793:
2794: if l_footnote_amount <> 0 then
2795: l_no_of_fn_codes := l_no_of_fn_codes + 1;
2796: hr_utility.trace('l_no_of_fn_codes is '
2797: || l_no_of_fn_codes);
2798: end if;
2799:
2800: end loop; -- c_footnote_info loop
2803: -- Archiving the last footnote code and amount
2804: if chk_rl2_footnote(l_footnote_code) and
2805: l_footnote_amount <> 0 then
2806:
2807: hr_utility.trace('p_assactid is ' ||to_char(p_assactid));
2808: hr_utility.trace('before ftnote archive l_footnote_code is '
2809: || l_footnote_code);
2810: hr_utility.trace('l_footnote_amount is '
2811: || to_char(l_footnote_amount));
2804: if chk_rl2_footnote(l_footnote_code) and
2805: l_footnote_amount <> 0 then
2806:
2807: hr_utility.trace('p_assactid is ' ||to_char(p_assactid));
2808: hr_utility.trace('before ftnote archive l_footnote_code is '
2809: || l_footnote_code);
2810: hr_utility.trace('l_footnote_amount is '
2811: || to_char(l_footnote_amount));
2812:
2806:
2807: hr_utility.trace('p_assactid is ' ||to_char(p_assactid));
2808: hr_utility.trace('before ftnote archive l_footnote_code is '
2809: || l_footnote_code);
2810: hr_utility.trace('l_footnote_amount is '
2811: || to_char(l_footnote_amount));
2812:
2813: hr_utility.trace('RL2 footnote archiving ');
2814: ln_footnote_index := ln_footnote_index + 1;
2809: || l_footnote_code);
2810: hr_utility.trace('l_footnote_amount is '
2811: || to_char(l_footnote_amount));
2812:
2813: hr_utility.trace('RL2 footnote archiving ');
2814: ln_footnote_index := ln_footnote_index + 1;
2815: hr_utility.trace('after close c_footnote_info ln_footnote_index :'
2816: ||to_char(ln_footnote_index));
2817:
2811: || to_char(l_footnote_amount));
2812:
2813: hr_utility.trace('RL2 footnote archiving ');
2814: ln_footnote_index := ln_footnote_index + 1;
2815: hr_utility.trace('after close c_footnote_info ln_footnote_index :'
2816: ||to_char(ln_footnote_index));
2817:
2818: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_ft_data
2819: (ln_footnote_index).action_info_category := 'CA FOOTNOTES';
2827: (ln_footnote_index).act_info6 := 'RL2';
2828:
2829: if l_footnote_amount < 0 then
2830:
2831: hr_utility.trace('Negative balance exists');
2832: l_negative_balance_exists := 'Y';
2833: end if;
2834:
2835: end if;/* end if for chk_rl2_footnote */
2834:
2835: end if;/* end if for chk_rl2_footnote */
2836:
2837: end;
2838: hr_utility.trace('RL2 Footnote archive end ');
2839: end if; /* end if for l_footnote_balance_type_tab in validation */
2840: -- End of footnote archiving
2841:
2842: end if; /* end if for l_user_entity_value_tab(i) <>0 */
2843:
2844: end loop; /* end loop for plsql table balances */
2845:
2846: /* Bug#3358604 Adding Box L,O excess Amount to Box C */
2847: hr_utility.trace('lv_BoxL_excess_amt : '||lv_BoxL_excess_amt);
2848: hr_utility.trace('lv_BoxO_excess_amt : '||lv_BoxO_excess_amt);
2849:
2850: if ((lv_BoxL_Excess_amt > 0) or (lv_BoxO_Excess_amt > 0)) then
2851: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info5
2844: end loop; /* end loop for plsql table balances */
2845:
2846: /* Bug#3358604 Adding Box L,O excess Amount to Box C */
2847: hr_utility.trace('lv_BoxL_excess_amt : '||lv_BoxL_excess_amt);
2848: hr_utility.trace('lv_BoxO_excess_amt : '||lv_BoxO_excess_amt);
2849:
2850: if ((lv_BoxL_Excess_amt > 0) or (lv_BoxO_Excess_amt > 0)) then
2851: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info5
2852: := to_char(NVL(to_number(pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info5),0)
2850: if ((lv_BoxL_Excess_amt > 0) or (lv_BoxO_Excess_amt > 0)) then
2851: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info5
2852: := to_char(NVL(to_number(pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info5),0)
2853: + to_number(lv_BoxL_excess_amt) + to_number(lv_BoxO_excess_amt));
2854: hr_utility.trace('Box C : '||pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info5);
2855: end if;
2856:
2857: /* Set the Negative Balance Flag for Archiving */
2858: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info30
2857: /* Set the Negative Balance Flag for Archiving */
2858: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info30
2859: := l_negative_balance_exists;
2860:
2861: hr_utility.trace('after loop act_info4 is: '
2862: || pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info4);
2863:
2864: end if; /* end if for ((l_no_of_payroll_run >0) and (l_has_been_paid='Y'))*/
2865:
2955: l_per_eit_description;
2956:
2957: -- Added Source of Income 'Other' to be archived as footnote Bug#3531136
2958: ln_footnote_index := ln_footnote_index + 1;
2959: hr_utility.trace('Archiving Source of Income Other as Footnote ln_footnote_index :'
2960: ||to_char(ln_footnote_index));
2961:
2962: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_ft_data
2963: (ln_footnote_index).action_info_category := 'CA FOOTNOTES';
2978: l_pre_description;
2979:
2980: -- Added Source of Income 'Other' to be archived as footnote Bug#3531136
2981: ln_footnote_index := ln_footnote_index + 1;
2982: hr_utility.trace('Archiving Source of Income Other as Footnote ln_footnote_index :'
2983: ||to_char(ln_footnote_index));
2984:
2985: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_ft_data
2986: (ln_footnote_index).action_info_category := 'CA FOOTNOTES';
2997: end if;
2998: end if;
2999:
3000:
3001: hr_utility.trace('Before counter of asgid '|| l_asgid);
3002:
3003: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).action_info_category
3004: := 'CAEOY RL2 EMPLOYEE INFO';
3005:
3012: -- RL2 Box N SIN of Spouse
3013: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info16
3014: := l_beneficiary_sin;
3015:
3016: hr_utility.trace('Employee Info ln_index: '||to_char(ln_index));
3017: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info18
3018: := l_first_name;
3019:
3020: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data(ln_index).act_info20
3116: ,p_tab_rec_data => pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_ft_data);
3117: ln_footnote_index := null;
3118: end if;
3119:
3120: --hr_utility.trace_on('Y','SAM');
3121: hr_utility.trace('Started Provincial YE Amendment');
3122:
3123: select to_char(effective_date,'YYYY'),
3124: report_type,
3117: ln_footnote_index := null;
3118: end if;
3119:
3120: --hr_utility.trace_on('Y','SAM');
3121: hr_utility.trace('Started Provincial YE Amendment');
3122:
3123: select to_char(effective_date,'YYYY'),
3124: report_type,
3125: to_number(pay_ca_eoy_rl1_amend_arch.get_parameter('PRE_ORGANIZATION_ID',
3129: ln_fapp_pre_org_id
3130: from pay_payroll_actions
3131: where payroll_action_id = l_payroll_action_id;
3132:
3133: hr_utility.trace('lv_fapp_report_type :'||lv_fapp_report_type);
3134:
3135:
3136: /* Archive the Pre-Printed form number for the RL2
3137: Amendment Pre-Process if one exists*/
3173: open c_get_fapp_locked_action_id(p_assactid);
3174: fetch c_get_fapp_locked_action_id into ln_fapp_locked_action_id;
3175: close c_get_fapp_locked_action_id;
3176:
3177: hr_utility.trace('RL2 Amend Action ID : '||to_char(p_assactid));
3178: hr_utility.trace('ln_fapp_locked_action_id :'|| to_char(ln_fapp_locked_action_id));
3179:
3180: lv_fapp_flag := compare_archive_data(p_assactid,
3181: ln_fapp_locked_action_id);
3174: fetch c_get_fapp_locked_action_id into ln_fapp_locked_action_id;
3175: close c_get_fapp_locked_action_id;
3176:
3177: hr_utility.trace('RL2 Amend Action ID : '||to_char(p_assactid));
3178: hr_utility.trace('ln_fapp_locked_action_id :'|| to_char(ln_fapp_locked_action_id));
3179:
3180: lv_fapp_flag := compare_archive_data(p_assactid,
3181: ln_fapp_locked_action_id);
3182:
3181: ln_fapp_locked_action_id);
3182:
3183: end if; -- report type validation for FAPP
3184:
3185: hr_utility.trace('Archiving RL2 Amendment Flag : ' || lv_fapp_flag);
3186: pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data2(ln_index).act_info2
3187: := lv_fapp_flag;
3188:
3189: if pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data2.count >0 then
3196: ,p_tab_rec_data => pay_ca_eoy_rl2_archive.ltr_ppa_arch_ee_data2);
3197: ln_index := null;
3198: end if;
3199:
3200: hr_utility.trace('End of Provincial YE Amendment PP Validation');
3201:
3202: end eoy_archive_data;
3203:
3204:
3230: l_business_group
3231: from pay_payroll_actions
3232: where payroll_action_id = pactid;
3233:
3234: hr_utility.trace('in range cursor step 1');
3235:
3236: sqlstr := 'select distinct asg.person_id
3237: from pay_all_payrolls_f ppy,
3238: pay_payroll_actions ppa,
3274: order by asg.person_id';
3275:
3276: l_archive := chk_gre_archive(pactid);
3277: if g_archive_flag = 'N' then
3278: hr_utility.trace('eoy_range_cursor archiving employer data');
3279: /* Now the archiver has provision for archiving
3280: payroll_action_level data . So make use of that */
3281: eoy_archive_gre_data(pactid,
3282: l_pre_org_id);
3279: /* Now the archiver has provision for archiving
3280: payroll_action_level data . So make use of that */
3281: eoy_archive_gre_data(pactid,
3282: l_pre_org_id);
3283: hr_utility.trace('eoy_range_cursor archived employer data');
3284: end if;
3285:
3286: end eoy_range_cursor;
3287: