357: open csr_defined_balance;
358: fetch csr_defined_balance into l_defined_balance_id;
359: if csr_defined_balance%notfound then
360: close csr_defined_balance;
361: hr_utility.raise_error;
362: else
363: close csr_defined_balance;
364: end if;
365:
466: /* An invalid report type has been passed so fail. */
467:
468: else
469:
470: hr_utility.raise_error;
471:
472: end if;
473:
474: end get_selection_information;
740:
741: /* Get the report type, report qualifier, business group id and the
742: gre for which the archiving has to be done */
743:
744: hr_utility.trace('getting report type ');
745:
746: select effective_date,
747: report_type,
748: business_group_id,
755: where payroll_action_id = pactid;
756:
757: l_eoy_tax_unit_id := get_parameter('TRANSFER_GRE',l_legislative_parameters);
758:
759: hr_utility.trace('getting dates');
760:
761: get_dates(l_report_type,
762: l_effective_date,
763: l_period_end,
765: l_quarter_end,
766: l_year_start,
767: l_year_end);
768:
769: hr_utility.trace('getting selection information');
770: hr_utility.trace('report type '|| l_report_type);
771: hr_utility.trace('quarter start '|| to_char(l_quarter_start,'dd-mm-yyyy'));
772: hr_utility.trace('quarter end '|| to_char(l_quarter_end,'dd-mm-yyyy'));
773: hr_utility.trace('year start '|| to_char(l_year_start,'dd-mm-yyyy'));
766: l_year_start,
767: l_year_end);
768:
769: hr_utility.trace('getting selection information');
770: hr_utility.trace('report type '|| l_report_type);
771: hr_utility.trace('quarter start '|| to_char(l_quarter_start,'dd-mm-yyyy'));
772: hr_utility.trace('quarter end '|| to_char(l_quarter_end,'dd-mm-yyyy'));
773: hr_utility.trace('year start '|| to_char(l_year_start,'dd-mm-yyyy'));
774: hr_utility.trace('year end '|| to_char(l_year_end,'dd-mm-yyyy'));
767: l_year_end);
768:
769: hr_utility.trace('getting selection information');
770: hr_utility.trace('report type '|| l_report_type);
771: hr_utility.trace('quarter start '|| to_char(l_quarter_start,'dd-mm-yyyy'));
772: hr_utility.trace('quarter end '|| to_char(l_quarter_end,'dd-mm-yyyy'));
773: hr_utility.trace('year start '|| to_char(l_year_start,'dd-mm-yyyy'));
774: hr_utility.trace('year end '|| to_char(l_year_end,'dd-mm-yyyy'));
775:
768:
769: hr_utility.trace('getting selection information');
770: hr_utility.trace('report type '|| l_report_type);
771: hr_utility.trace('quarter start '|| to_char(l_quarter_start,'dd-mm-yyyy'));
772: hr_utility.trace('quarter end '|| to_char(l_quarter_end,'dd-mm-yyyy'));
773: hr_utility.trace('year start '|| to_char(l_year_start,'dd-mm-yyyy'));
774: hr_utility.trace('year end '|| to_char(l_year_end,'dd-mm-yyyy'));
775:
776: get_selection_information
769: hr_utility.trace('getting selection information');
770: hr_utility.trace('report type '|| l_report_type);
771: hr_utility.trace('quarter start '|| to_char(l_quarter_start,'dd-mm-yyyy'));
772: hr_utility.trace('quarter end '|| to_char(l_quarter_end,'dd-mm-yyyy'));
773: hr_utility.trace('year start '|| to_char(l_year_start,'dd-mm-yyyy'));
774: hr_utility.trace('year end '|| to_char(l_year_end,'dd-mm-yyyy'));
775:
776: get_selection_information
777: (l_report_type,
770: hr_utility.trace('report type '|| l_report_type);
771: hr_utility.trace('quarter start '|| to_char(l_quarter_start,'dd-mm-yyyy'));
772: hr_utility.trace('quarter end '|| to_char(l_quarter_end,'dd-mm-yyyy'));
773: hr_utility.trace('year start '|| to_char(l_year_start,'dd-mm-yyyy'));
774: hr_utility.trace('year end '|| to_char(l_year_end,'dd-mm-yyyy'));
775:
776: get_selection_information
777: (l_report_type,
778: l_quarter_start,
796: open c_eoy_gre;
797:
798: /* Loop for all rows returned for SQL statement. */
799:
800: hr_utility.trace('Entering loop');
801:
802: loop
803:
804: if l_eoy_tax_unit_id <> 99999 then
802: loop
803:
804: if l_eoy_tax_unit_id <> 99999 then
805:
806: hr_utility.trace('Fetching person id');
807:
808: fetch c_eoy_gre into l_person_id;
809:
810: l_tax_unit_id := l_eoy_tax_unit_id;
826: /* If the new row is the same as the previous row according to the way
827: the rows are grouped then discard the row ie. grouping by GRE
828: requires a single row for each person / GRE combination. */
829:
830: hr_utility.trace('tax unit id is '|| to_char(l_tax_unit_id));
831: hr_utility.trace('previous tax unit id is '||
832: to_char(l_prev_tax_unit_id));
833:
834: if ( l_person_id = l_prev_person_id and
827: the rows are grouped then discard the row ie. grouping by GRE
828: requires a single row for each person / GRE combination. */
829:
830: hr_utility.trace('tax unit id is '|| to_char(l_tax_unit_id));
831: hr_utility.trace('previous tax unit id is '||
832: to_char(l_prev_tax_unit_id));
833:
834: if ( l_person_id = l_prev_person_id and
835: l_tax_unit_id = l_prev_tax_unit_id) then
833:
834: if ( l_person_id = l_prev_person_id and
835: l_tax_unit_id = l_prev_tax_unit_id) then
836:
837: hr_utility.trace('Not creating Asg_action, duplicate');
838: null;
839:
840: else
841:
838: null;
839:
840: else
841:
842: hr_utility.trace('prev person is '|| to_char(l_prev_person_id));
843: hr_utility.trace('person is '|| to_char(l_person_id));
844: hr_utility.trace('assignment is '|| to_char(l_assignment_id));
845:
846:
839:
840: else
841:
842: hr_utility.trace('prev person is '|| to_char(l_prev_person_id));
843: hr_utility.trace('person is '|| to_char(l_person_id));
844: hr_utility.trace('assignment is '|| to_char(l_assignment_id));
845:
846:
847: /* Have a new unique row according to the way the rows are grouped.
840: else
841:
842: hr_utility.trace('prev person is '|| to_char(l_prev_person_id));
843: hr_utility.trace('person is '|| to_char(l_person_id));
844: hr_utility.trace('assignment is '|| to_char(l_assignment_id));
845:
846:
847: /* Have a new unique row according to the way the rows are grouped.
848: The inclusion of the person is dependent on having a non zero
854: open c_get_asg_id(l_person_id);
855: fetch c_get_asg_id into l_primary_asg;
856: if c_get_asg_id%NOTFOUND then
857: close c_get_asg_id;
858: hr_utility.trace('Primary Asg Not found');
859: hr_utility.raise_error;
860: else
861: close c_get_asg_id;
862: end if;
855: fetch c_get_asg_id into l_primary_asg;
856: if c_get_asg_id%NOTFOUND then
857: close c_get_asg_id;
858: hr_utility.trace('Primary Asg Not found');
859: hr_utility.raise_error;
860: else
861: close c_get_asg_id;
862: end if;
863:
871: begin
872: open c_get_latest_asg(l_person_id );
873: fetch c_get_latest_asg into ln_max_aa_id;
874: close c_get_latest_asg;
875: hr_utility.trace('Action creation Max assignment_action_id : ' ||
876: to_char(ln_max_aa_id));
877:
878: exception
879: when no_data_found then
882: 'Balance Assignment Action does not exist for : '
883: ||to_char(l_person_id));
884: end;
885:
886: hr_utility.trace('Setting context');
887: pay_ca_balance_view_pkg.set_context('TAX_UNIT_ID',l_tax_unit_id);
888: pay_ca_balance_view_pkg.set_context ('ASSIGNMENT_ACTION_ID',ln_max_aa_id);
889:
890: ln_non_taxable_earnings :=
891: nvl(pay_ca_balance_pkg.call_ca_balance_get_value
892: ('T4 Non Taxable Earnings',
893: 'YTD',ln_max_aa_id,l_primary_asg,NULL,'PER',
894: l_tax_unit_id,l_bus_group_id,NULL),0);
895: hr_utility.trace('T4 Non Taxable Earnings :'||
896: to_char(ln_non_taxable_earnings));
897:
898: ln_gross_earnings :=
899: nvl(pay_ca_balance_pkg.call_ca_balance_get_value
900: ('Gross Earnings',
901: 'YTD',ln_max_aa_id,l_primary_asg,NULL,'PER' ,
902:
903: l_tax_unit_id, l_bus_group_id, NULL),0);
904: hr_utility.trace('Gross Earnings :'||
905: to_char(ln_gross_earnings));
906:
907: ln_no_gross_earnings :=
908: nvl(pay_ca_balance_pkg.call_ca_balance_get_value
908: nvl(pay_ca_balance_pkg.call_ca_balance_get_value
909: ('T4 No Gross Earnings',
910: 'YTD',ln_max_aa_id, l_primary_asg,NULL,'PER' ,
911: l_tax_unit_id, l_bus_group_id, NULL),0);
912: hr_utility.trace('T4 No Gross Earnings :'||
913: to_char(ln_no_gross_earnings));
914:
915: /* End of adding code for bug#3267520, below If condition
916: is also part of this bug fix */
926: from dual;
927:
928: /* Insert into pay_assignment_actions. */
929:
930: hr_utility.trace('creating assignment action');
931:
932: hr_nonrun_asact.insact(lockingactid,l_primary_asg,
933: pactid,chunk,l_tax_unit_id);
934:
935: /* Update the serial number column with the person id
936: so that we can use in the Magnetic Media process
937: to do an additional check against the assignment table */
938:
939: hr_utility.trace('updating assignment action');
940:
941: update pay_assignment_actions aa
942: set aa.serial_number = to_char(l_person_id)
943: where aa.assignment_action_id = lockingactid;
941: update pay_assignment_actions aa
942: set aa.serial_number = to_char(l_person_id)
943: where aa.assignment_action_id = lockingactid;
944:
945: hr_utility.trace('Created Assignment action'||
946: to_char(lockingactid));
947:
948: End if; --Checking Gross Earnings, No Gross Earnings, NonTaxable Earn
949:
993: return l_user_entity_id;
994:
995: exception
996: when others then
997: hr_utility.trace('Error while getting the user_entity_id for '
998: || p_dbi_name);
999: hr_utility.raise_error;
1000:
1001: end get_user_entity_id;
995: exception
996: when others then
997: hr_utility.trace('Error while getting the user_entity_id for '
998: || p_dbi_name);
999: hr_utility.raise_error;
1000:
1001: end get_user_entity_id;
1002:
1003:
1066: ln_amend_box_count number;
1067:
1068:
1069: begin
1070: -- hr_utility.trace_on('Y','TEST');
1071: /* Initialization Process */
1072: lv_flag := 'N';
1073: if ltr_amend_arch_data.count > 0 then
1074: ltr_amend_arch_data.delete;
1132:
1133:
1134: /* Populate T4 Amendment Box Data for an assignment_action */
1135: open c_get_emp_t4box_data(p_assignment_action_id,p_jurisdiction);
1136: hr_utility.trace('Populating T4 Amendment Box Data ');
1137: hr_utility.trace('P_assignment_action_id :'||to_char(p_assignment_action_id));
1138: ln_amend_box_count := 0;
1139: loop
1140: fetch c_get_emp_t4box_data into ltr_amend_arch_data(ln_amend_box_count);
1133:
1134: /* Populate T4 Amendment Box Data for an assignment_action */
1135: open c_get_emp_t4box_data(p_assignment_action_id,p_jurisdiction);
1136: hr_utility.trace('Populating T4 Amendment Box Data ');
1137: hr_utility.trace('P_assignment_action_id :'||to_char(p_assignment_action_id));
1138: ln_amend_box_count := 0;
1139: loop
1140: fetch c_get_emp_t4box_data into ltr_amend_arch_data(ln_amend_box_count);
1141: exit when c_get_emp_t4box_data%NOTFOUND;
1139: loop
1140: fetch c_get_emp_t4box_data into ltr_amend_arch_data(ln_amend_box_count);
1141: exit when c_get_emp_t4box_data%NOTFOUND;
1142:
1143: hr_utility.trace('I :'||to_char(ln_amend_box_count));
1144: hr_utility.trace('Archive_Context1: '||to_char(ltr_amend_arch_data(ln_amend_box_count).archive_context1));
1145: hr_utility.trace('Archive_UE_id: '||to_char(ltr_amend_arch_data(ln_amend_box_count).archive_ue_id));
1146: hr_utility.trace('Archive_Value: '||ltr_amend_arch_data(ln_amend_box_count).archive_value);
1147: ln_amend_box_count := ln_amend_box_count + 1;
1140: fetch c_get_emp_t4box_data into ltr_amend_arch_data(ln_amend_box_count);
1141: exit when c_get_emp_t4box_data%NOTFOUND;
1142:
1143: hr_utility.trace('I :'||to_char(ln_amend_box_count));
1144: hr_utility.trace('Archive_Context1: '||to_char(ltr_amend_arch_data(ln_amend_box_count).archive_context1));
1145: hr_utility.trace('Archive_UE_id: '||to_char(ltr_amend_arch_data(ln_amend_box_count).archive_ue_id));
1146: hr_utility.trace('Archive_Value: '||ltr_amend_arch_data(ln_amend_box_count).archive_value);
1147: ln_amend_box_count := ln_amend_box_count + 1;
1148: end loop;
1141: exit when c_get_emp_t4box_data%NOTFOUND;
1142:
1143: hr_utility.trace('I :'||to_char(ln_amend_box_count));
1144: hr_utility.trace('Archive_Context1: '||to_char(ltr_amend_arch_data(ln_amend_box_count).archive_context1));
1145: hr_utility.trace('Archive_UE_id: '||to_char(ltr_amend_arch_data(ln_amend_box_count).archive_ue_id));
1146: hr_utility.trace('Archive_Value: '||ltr_amend_arch_data(ln_amend_box_count).archive_value);
1147: ln_amend_box_count := ln_amend_box_count + 1;
1148: end loop;
1149:
1142:
1143: hr_utility.trace('I :'||to_char(ln_amend_box_count));
1144: hr_utility.trace('Archive_Context1: '||to_char(ltr_amend_arch_data(ln_amend_box_count).archive_context1));
1145: hr_utility.trace('Archive_UE_id: '||to_char(ltr_amend_arch_data(ln_amend_box_count).archive_ue_id));
1146: hr_utility.trace('Archive_Value: '||ltr_amend_arch_data(ln_amend_box_count).archive_value);
1147: ln_amend_box_count := ln_amend_box_count + 1;
1148: end loop;
1149:
1150: close c_get_emp_t4box_data;
1149:
1150: close c_get_emp_t4box_data;
1151:
1152: /* Populate T4 Amendment Employee Data for an assignment_action */
1153: hr_utility.trace('Populating Amendment Employee Data ');
1154: hr_utility.trace('P_assignment_action_id :'||to_char(p_assignment_action_id));
1155: for i in 0 .. j
1156: loop
1157: open c_get_employee_data(p_assignment_action_id,ltr_emp_ue_id(i));
1150: close c_get_emp_t4box_data;
1151:
1152: /* Populate T4 Amendment Employee Data for an assignment_action */
1153: hr_utility.trace('Populating Amendment Employee Data ');
1154: hr_utility.trace('P_assignment_action_id :'||to_char(p_assignment_action_id));
1155: for i in 0 .. j
1156: loop
1157: open c_get_employee_data(p_assignment_action_id,ltr_emp_ue_id(i));
1158: fetch c_get_employee_data into ltr_amend_emp_data(i);
1156: loop
1157: open c_get_employee_data(p_assignment_action_id,ltr_emp_ue_id(i));
1158: fetch c_get_employee_data into ltr_amend_emp_data(i);
1159:
1160: hr_utility.trace('I :'||to_char(i));
1161: hr_utility.trace('Archive_Context1: '||to_char(ltr_amend_emp_data(i).archive_context1));
1162: hr_utility.trace('Archive_UE_id: '||to_char(ltr_amend_emp_data(i).archive_ue_id));
1163: hr_utility.trace('Archive_Value: '||ltr_amend_emp_data(i).archive_value);
1164:
1157: open c_get_employee_data(p_assignment_action_id,ltr_emp_ue_id(i));
1158: fetch c_get_employee_data into ltr_amend_emp_data(i);
1159:
1160: hr_utility.trace('I :'||to_char(i));
1161: hr_utility.trace('Archive_Context1: '||to_char(ltr_amend_emp_data(i).archive_context1));
1162: hr_utility.trace('Archive_UE_id: '||to_char(ltr_amend_emp_data(i).archive_ue_id));
1163: hr_utility.trace('Archive_Value: '||ltr_amend_emp_data(i).archive_value);
1164:
1165: close c_get_employee_data;
1158: fetch c_get_employee_data into ltr_amend_emp_data(i);
1159:
1160: hr_utility.trace('I :'||to_char(i));
1161: hr_utility.trace('Archive_Context1: '||to_char(ltr_amend_emp_data(i).archive_context1));
1162: hr_utility.trace('Archive_UE_id: '||to_char(ltr_amend_emp_data(i).archive_ue_id));
1163: hr_utility.trace('Archive_Value: '||ltr_amend_emp_data(i).archive_value);
1164:
1165: close c_get_employee_data;
1166: end loop;
1159:
1160: hr_utility.trace('I :'||to_char(i));
1161: hr_utility.trace('Archive_Context1: '||to_char(ltr_amend_emp_data(i).archive_context1));
1162: hr_utility.trace('Archive_UE_id: '||to_char(ltr_amend_emp_data(i).archive_ue_id));
1163: hr_utility.trace('Archive_Value: '||ltr_amend_emp_data(i).archive_value);
1164:
1165: close c_get_employee_data;
1166: end loop;
1167:
1167:
1168:
1169: /* Populate T4 YEPP Box Data for an assignment_action */
1170: open c_get_emp_t4box_data(p_locked_action_id,p_jurisdiction);
1171: hr_utility.trace('Populating T4 YEPP Box Data ');
1172: hr_utility.trace('P_locked_action_id :'||to_char(p_locked_action_id));
1173: ln_yepp_box_count := 0;
1174: loop
1175: fetch c_get_emp_t4box_data into ltr_yepp_arch_data(ln_yepp_box_count);
1168:
1169: /* Populate T4 YEPP Box Data for an assignment_action */
1170: open c_get_emp_t4box_data(p_locked_action_id,p_jurisdiction);
1171: hr_utility.trace('Populating T4 YEPP Box Data ');
1172: hr_utility.trace('P_locked_action_id :'||to_char(p_locked_action_id));
1173: ln_yepp_box_count := 0;
1174: loop
1175: fetch c_get_emp_t4box_data into ltr_yepp_arch_data(ln_yepp_box_count);
1176: exit when c_get_emp_t4box_data%NOTFOUND;
1174: loop
1175: fetch c_get_emp_t4box_data into ltr_yepp_arch_data(ln_yepp_box_count);
1176: exit when c_get_emp_t4box_data%NOTFOUND;
1177:
1178: hr_utility.trace('I :'||to_char(ln_yepp_box_count));
1179: hr_utility.trace('Archive_Context1: '||to_char(ltr_yepp_arch_data(ln_yepp_box_count).archive_context1));
1180: hr_utility.trace('Archive_UE_id: '||to_char(ltr_yepp_arch_data(ln_yepp_box_count).archive_ue_id));
1181: hr_utility.trace('Archive_Value: '||ltr_yepp_arch_data(ln_yepp_box_count).archive_value);
1182: ln_yepp_box_count := ln_yepp_box_count + 1;
1175: fetch c_get_emp_t4box_data into ltr_yepp_arch_data(ln_yepp_box_count);
1176: exit when c_get_emp_t4box_data%NOTFOUND;
1177:
1178: hr_utility.trace('I :'||to_char(ln_yepp_box_count));
1179: hr_utility.trace('Archive_Context1: '||to_char(ltr_yepp_arch_data(ln_yepp_box_count).archive_context1));
1180: hr_utility.trace('Archive_UE_id: '||to_char(ltr_yepp_arch_data(ln_yepp_box_count).archive_ue_id));
1181: hr_utility.trace('Archive_Value: '||ltr_yepp_arch_data(ln_yepp_box_count).archive_value);
1182: ln_yepp_box_count := ln_yepp_box_count + 1;
1183: end loop;
1176: exit when c_get_emp_t4box_data%NOTFOUND;
1177:
1178: hr_utility.trace('I :'||to_char(ln_yepp_box_count));
1179: hr_utility.trace('Archive_Context1: '||to_char(ltr_yepp_arch_data(ln_yepp_box_count).archive_context1));
1180: hr_utility.trace('Archive_UE_id: '||to_char(ltr_yepp_arch_data(ln_yepp_box_count).archive_ue_id));
1181: hr_utility.trace('Archive_Value: '||ltr_yepp_arch_data(ln_yepp_box_count).archive_value);
1182: ln_yepp_box_count := ln_yepp_box_count + 1;
1183: end loop;
1184:
1177:
1178: hr_utility.trace('I :'||to_char(ln_yepp_box_count));
1179: hr_utility.trace('Archive_Context1: '||to_char(ltr_yepp_arch_data(ln_yepp_box_count).archive_context1));
1180: hr_utility.trace('Archive_UE_id: '||to_char(ltr_yepp_arch_data(ln_yepp_box_count).archive_ue_id));
1181: hr_utility.trace('Archive_Value: '||ltr_yepp_arch_data(ln_yepp_box_count).archive_value);
1182: ln_yepp_box_count := ln_yepp_box_count + 1;
1183: end loop;
1184:
1185: close c_get_emp_t4box_data;
1184:
1185: close c_get_emp_t4box_data;
1186:
1187: /* Populate T4 YEPP Employee Data for an assignment_action */
1188: hr_utility.trace('Populating YEPP Employee Data ');
1189: hr_utility.trace('P_locked_action_id :'||to_char(P_locked_action_id));
1190: for i in 0 .. j
1191: loop
1192: open c_get_employee_data(P_locked_action_id,ltr_emp_ue_id(i));
1185: close c_get_emp_t4box_data;
1186:
1187: /* Populate T4 YEPP Employee Data for an assignment_action */
1188: hr_utility.trace('Populating YEPP Employee Data ');
1189: hr_utility.trace('P_locked_action_id :'||to_char(P_locked_action_id));
1190: for i in 0 .. j
1191: loop
1192: open c_get_employee_data(P_locked_action_id,ltr_emp_ue_id(i));
1193: fetch c_get_employee_data into ltr_yepp_emp_data(i);
1192: open c_get_employee_data(P_locked_action_id,ltr_emp_ue_id(i));
1193: fetch c_get_employee_data into ltr_yepp_emp_data(i);
1194: exit when c_get_employee_data%NOTFOUND;
1195:
1196: hr_utility.trace('I :'||to_char(i));
1197: hr_utility.trace('Archive_Context1: '||to_char(ltr_yepp_emp_data(i).archive_context1));
1198: hr_utility.trace('Archive_UE_id: '||to_char(ltr_yepp_emp_data(i).archive_ue_id));
1199: hr_utility.trace('Archive_Value: '||ltr_yepp_emp_data(i).archive_value);
1200:
1193: fetch c_get_employee_data into ltr_yepp_emp_data(i);
1194: exit when c_get_employee_data%NOTFOUND;
1195:
1196: hr_utility.trace('I :'||to_char(i));
1197: hr_utility.trace('Archive_Context1: '||to_char(ltr_yepp_emp_data(i).archive_context1));
1198: hr_utility.trace('Archive_UE_id: '||to_char(ltr_yepp_emp_data(i).archive_ue_id));
1199: hr_utility.trace('Archive_Value: '||ltr_yepp_emp_data(i).archive_value);
1200:
1201: close c_get_employee_data;
1194: exit when c_get_employee_data%NOTFOUND;
1195:
1196: hr_utility.trace('I :'||to_char(i));
1197: hr_utility.trace('Archive_Context1: '||to_char(ltr_yepp_emp_data(i).archive_context1));
1198: hr_utility.trace('Archive_UE_id: '||to_char(ltr_yepp_emp_data(i).archive_ue_id));
1199: hr_utility.trace('Archive_Value: '||ltr_yepp_emp_data(i).archive_value);
1200:
1201: close c_get_employee_data;
1202: end loop;
1195:
1196: hr_utility.trace('I :'||to_char(i));
1197: hr_utility.trace('Archive_Context1: '||to_char(ltr_yepp_emp_data(i).archive_context1));
1198: hr_utility.trace('Archive_UE_id: '||to_char(ltr_yepp_emp_data(i).archive_ue_id));
1199: hr_utility.trace('Archive_Value: '||ltr_yepp_emp_data(i).archive_value);
1200:
1201: close c_get_employee_data;
1202: end loop;
1203:
1203:
1204: /* Compare T4 Amendment Box Data and T4 YEPP Box Data for an
1205: assignment_action */
1206:
1207: hr_utility.trace('Comparing T4 Amend and T4 YEPP Box Data ');
1208:
1209: if ln_yepp_box_count <> ln_amend_box_count then
1210: lv_flag := 'Y';
1211: elsif ln_yepp_box_count = ln_amend_box_count then
1221: (ltr_yepp_arch_data(i).archive_value is not null and
1222: ltr_amend_arch_data(i).archive_value is null)) then
1223:
1224: lv_flag := 'Y';
1225: hr_utility.trace('Archive_UE_id with differnt value :'||to_char(ltr_yepp_arch_data(i).archive_ue_id));
1226: exit;
1227: end if;
1228: end if;
1229: end loop;
1232: /* Compare T4 Employee Data and T4 YEPP Employee Data for an
1233: assignment_action */
1234: If lv_flag <> 'Y' then
1235:
1236: hr_utility.trace('Comparing T4 Amend and T4 YEPP Employee Data ');
1237: for i in ltr_yepp_emp_data.first..ltr_yepp_emp_data.last
1238: loop
1239: if (ltr_yepp_emp_data(i).archive_ue_id =
1240: ltr_amend_emp_data(i).archive_ue_id) then
1246: (ltr_yepp_emp_data(i).archive_value is not null and
1247: ltr_amend_emp_data(i).archive_value is null)) then
1248:
1249: lv_flag := 'Y';
1250: hr_utility.trace('Archive_UE_id with different value :'||
1251: to_char(ltr_yepp_arch_data(i).archive_ue_id));
1252: exit;
1253: end if;
1254: end if;
1260: flag to 'N' */
1261:
1262: if lv_flag <> 'Y' then
1263: lv_flag := 'N';
1264: hr_utility.trace('No value difference for an Employee Asg Action: '||
1265: to_char(p_assignment_action_id));
1266: end if;
1267:
1268: hr_utility.trace('lv_flag :'||lv_flag);
1264: hr_utility.trace('No value difference for an Employee Asg Action: '||
1265: to_char(p_assignment_action_id));
1266: end if;
1267:
1268: hr_utility.trace('lv_flag :'||lv_flag);
1269: return lv_flag;
1270: -- hr_utility.trace_off;
1271: end compare_archive_data;
1272:
1266: end if;
1267:
1268: hr_utility.trace('lv_flag :'||lv_flag);
1269: return lv_flag;
1270: -- hr_utility.trace_off;
1271: end compare_archive_data;
1272:
1273:
1274:
1437: l_arch_gre_step := 30;
1438:
1439: /* Archive the Employer level data */
1440:
1441: --hr_utility.trace_on('Y','CAEOY');
1442: hr_utility.trace('getting employer data ');
1443:
1444: open cur_bg(p_tax_unit_id);
1445: fetch
1438:
1439: /* Archive the Employer level data */
1440:
1441: --hr_utility.trace_on('Y','CAEOY');
1442: hr_utility.trace('getting employer data ');
1443:
1444: open cur_bg(p_tax_unit_id);
1445: fetch
1446: cur_bg
1463: l_ei_rate;
1464:
1465: if employer_info%NOTFOUND then
1466:
1467: hr_utility.trace('cannot find employer data ');
1468: employer_info_found := 'N';
1469:
1470: l_employer_ein := null;
1471: l_address_line_1 := null;
1481:
1482: else
1483:
1484: close employer_info;
1485: hr_utility.trace('Employer data found !!!! ');
1486: employer_info_found := 'Y';
1487:
1488: end if;
1489:
1499: l_federal_youth_hire_ind*/
1500:
1501: if cur_employer_info%NOTFOUND then
1502:
1503: hr_utility.trace('cannot find employer data 2 ');
1504: employer_info_found := 'N';
1505:
1506: l_proprietor_sin_1 := null;
1507: l_proprietor_sin_2 := null;
1517:
1518: else
1519:
1520: close cur_employer_info;
1521: hr_utility.trace('Employer data found 2 !!!! ');
1522: employer_info_found := 'Y';
1523:
1524: end if;
1525:
1547:
1548: if cur_transmitter_info%NOTFOUND then
1549:
1550: close cur_transmitter_info;
1551: hr_utility.trace('Transmitter information not found');
1552:
1553: l_transmitter_name := null;
1554: l_transmitter_addr_line_1 := null;
1555: l_transmitter_addr_line_2 := null;
1568: l_technical_contact_language := null;
1569:
1570: employer_info_found := 'N';
1571:
1572: hr_utility.set_message(801,'PAY_74014_NO_TRANSMITTER_ORG');
1573: hr_utility.set_message_token('ORGIND','GRE');
1574: /* push message into pay_message_lines */
1575: pay_core_utils.push_message(801,'PAY_74014_NO_TRANSMITTER_ORG','P');
1576: pay_core_utils.push_token('ORGIND','GRE');
1569:
1570: employer_info_found := 'N';
1571:
1572: hr_utility.set_message(801,'PAY_74014_NO_TRANSMITTER_ORG');
1573: hr_utility.set_message_token('ORGIND','GRE');
1574: /* push message into pay_message_lines */
1575: pay_core_utils.push_message(801,'PAY_74014_NO_TRANSMITTER_ORG','P');
1576: pay_core_utils.push_token('ORGIND','GRE');
1577: hr_utility.raise_error;
1573: hr_utility.set_message_token('ORGIND','GRE');
1574: /* push message into pay_message_lines */
1575: pay_core_utils.push_message(801,'PAY_74014_NO_TRANSMITTER_ORG','P');
1576: pay_core_utils.push_token('ORGIND','GRE');
1577: hr_utility.raise_error;
1578:
1579: else
1580:
1581: close cur_transmitter_info;
1760:
1761: for i in 1..l_counter loop
1762:
1763: l_arch_gre_step := 42;
1764: hr_utility.trace('calling archive API ' || l_user_entity_name_tab(i));
1765: ff_archive_api.create_archive_item(
1766: p_archive_item_id => l_archive_item_id
1767: ,p_user_entity_id => get_user_entity_id(l_user_entity_name_tab(i))
1768: ,p_archive_value => l_user_entity_value_tab(i)
1771: ,p_legislation_code => 'CA'
1772: ,p_object_version_number => l_object_version_number
1773: ,p_some_warning => l_some_warning
1774: );
1775: hr_utility.trace('Ended calling archive API');
1776: l_arch_gre_step := 47;
1777:
1778: end loop;
1779:
1780: g_archive_flag := 'Y';
1781: exception
1782: when others then
1783: g_archive_flag := 'N';
1784: hr_utility.trace('Error in eoy_archive_gre_data at step :' ||
1785: to_char(l_arch_gre_step) || 'sqlcode : ' || to_char(sqlcode));
1786: if l_arch_gre_step = 30 and l_transmitter_name is null then
1787: hr_utility.set_message(801,'PAY_74014_NO_TRANSMITTER_ORG');
1788: hr_utility.set_message_token('ORGIND','GRE');
1783: g_archive_flag := 'N';
1784: hr_utility.trace('Error in eoy_archive_gre_data at step :' ||
1785: to_char(l_arch_gre_step) || 'sqlcode : ' || to_char(sqlcode));
1786: if l_arch_gre_step = 30 and l_transmitter_name is null then
1787: hr_utility.set_message(801,'PAY_74014_NO_TRANSMITTER_ORG');
1788: hr_utility.set_message_token('ORGIND','GRE');
1789: end if;
1790:
1791: hr_utility.raise_error;
1784: hr_utility.trace('Error in eoy_archive_gre_data at step :' ||
1785: to_char(l_arch_gre_step) || 'sqlcode : ' || to_char(sqlcode));
1786: if l_arch_gre_step = 30 and l_transmitter_name is null then
1787: hr_utility.set_message(801,'PAY_74014_NO_TRANSMITTER_ORG');
1788: hr_utility.set_message_token('ORGIND','GRE');
1789: end if;
1790:
1791: hr_utility.raise_error;
1792:
1787: hr_utility.set_message(801,'PAY_74014_NO_TRANSMITTER_ORG');
1788: hr_utility.set_message_token('ORGIND','GRE');
1789: end if;
1790:
1791: hr_utility.raise_error;
1792:
1793: end eoy_archive_gre_data;
1794:
1795: /* Name : chk_gre_archive
1811: where fai.context1 = p_payroll_action_id
1812: and archive_type = 'PA');
1813: begin
1814:
1815: hr_utility.trace('chk_gre_archive - checking g_archive_flag');
1816:
1817: if g_archive_flag = 'Y' then
1818: hr_utility.trace('chk_gre_archive - g_archive_flag is Y');
1819: return (TRUE);
1814:
1815: hr_utility.trace('chk_gre_archive - checking g_archive_flag');
1816:
1817: if g_archive_flag = 'Y' then
1818: hr_utility.trace('chk_gre_archive - g_archive_flag is Y');
1819: return (TRUE);
1820: else
1821:
1822: hr_utility.trace('chk_gre_archive - opening cursor');
1818: hr_utility.trace('chk_gre_archive - g_archive_flag is Y');
1819: return (TRUE);
1820: else
1821:
1822: hr_utility.trace('chk_gre_archive - opening cursor');
1823:
1824: open c_chk_payroll_action;
1825: fetch c_chk_payroll_action into l_flag;
1826: if c_chk_payroll_action%FOUND then
1823:
1824: open c_chk_payroll_action;
1825: fetch c_chk_payroll_action into l_flag;
1826: if c_chk_payroll_action%FOUND then
1827: hr_utility.trace('chk_gre_archive - found in cursor');
1828: g_archive_flag := 'Y';
1829: else
1830: hr_utility.trace('chk_gre_archive - not found in cursor');
1831: g_archive_flag := 'N';
1826: if c_chk_payroll_action%FOUND then
1827: hr_utility.trace('chk_gre_archive - found in cursor');
1828: g_archive_flag := 'Y';
1829: else
1830: hr_utility.trace('chk_gre_archive - not found in cursor');
1831: g_archive_flag := 'N';
1832: end if;
1833:
1834: hr_utility.trace('chk_gre_archive - closing cursor');
1830: hr_utility.trace('chk_gre_archive - not found in cursor');
1831: g_archive_flag := 'N';
1832: end if;
1833:
1834: hr_utility.trace('chk_gre_archive - closing cursor');
1835: close c_chk_payroll_action;
1836: if g_archive_flag = 'Y' then
1837: hr_utility.trace('chk_gre_archive - returning true');
1838: return (TRUE);
1833:
1834: hr_utility.trace('chk_gre_archive - closing cursor');
1835: close c_chk_payroll_action;
1836: if g_archive_flag = 'Y' then
1837: hr_utility.trace('chk_gre_archive - returning true');
1838: return (TRUE);
1839: else
1840: hr_utility.trace('chk_gre_archive - returning false');
1841: return(FALSE);
1836: if g_archive_flag = 'Y' then
1837: hr_utility.trace('chk_gre_archive - returning true');
1838: return (TRUE);
1839: else
1840: hr_utility.trace('chk_gre_archive - returning false');
1841: return(FALSE);
1842: end if;
1843: end if;
1844: end chk_gre_archive;
1870: raise_application_error(-20001,'eoy_archinit: Assignment actions not created!!!');
1871: end if;
1872: close c_get_min_chunk;
1873:
1874: hr_utility.set_location ('eoy_archinit min chunk is ' || to_char(g_min_chunk),12);
1875: l_step := 2;
1876: l_archive := chk_gre_archive(p_payroll_action_id);
1877:
1878: l_step := 3;
1875: l_step := 2;
1876: l_archive := chk_gre_archive(p_payroll_action_id);
1877:
1878: l_step := 3;
1879: hr_utility.trace ('eoy_archinit g_archive_flag is ' || g_archive_flag);
1880: exception
1881: when others then
1882: raise_application_error(-20001,'eoy_archinit at '
1883: ||to_char(l_step)||' - '||to_char(sqlcode) || '-' || sqlerrm);
2261: and cp_effec_date between pca.effective_start_date and
2262: pca.effective_end_date;
2263: begin
2264:
2265: -- hr_utility.trace_on(1,'ORACLE');
2266:
2267: l_negative_balance_exists := 'N';
2268: box_52_exists := 'N';
2269: lv_under18_flag := 'N';
2276: lv_ppip_archive_exempt_flag := Null;
2277: lv_qpp_exempt_flag := Null;
2278: lv_fapp_flag := 'N';
2279: l_count := 0;
2280: hr_utility.trace('p_assactida value '||p_assactid);
2281: hr_utility.trace('getting assignment');
2282:
2283:
2284: SELECT
2277: lv_qpp_exempt_flag := Null;
2278: lv_fapp_flag := 'N';
2279: l_count := 0;
2280: hr_utility.trace('p_assactida value '||p_assactid);
2281: hr_utility.trace('getting assignment');
2282:
2283:
2284: SELECT
2285: aa.assignment_id,
2327: where organization_id = l_tax_unit_id
2328: and org_information_context = 'Canada Employer Identification';
2329:
2330: l_step := 3;
2331: hr_utility.trace('eoy_archive_data archiving employer data');
2332: eoy_archive_gre_data(l_payroll_action_id,
2333: l_tax_unit_id,
2334: l_transmitter_gre_id);
2335:
2333: l_tax_unit_id,
2334: l_transmitter_gre_id);
2335:
2336: l_step := 4;
2337: hr_utility.trace('eoy_archive_data archived employer data');
2338: end if;
2339:
2340: /* Now, set up the jurisdiction context for the db items that
2341: need the jurisdiction as a context.Here we are archiving all the
2377:
2378: FETCH c_get_test_province
2379: INTO l_jurisdiction;
2380:
2381: hr_utility.trace('In jurisdiction loop ' || l_jurisdiction);
2382: EXIT WHEN c_get_test_province%NOTFOUND;
2383:
2384: /*
2385: SELECT
2415: open c_get_latest_asg(lv_serial_number,l_jurisdiction);
2416: fetch c_get_latest_asg into l_aaid,lv_actual_date;
2417: close c_get_latest_asg;
2418:
2419: hr_utility.trace('max assignment_action_id : ' || to_char(l_aaid));
2420:
2421: exception
2422: when no_data_found then
2423: l_aaid := -9999;
2427:
2428: pay_ca_balance_view_pkg.set_context ('ASSIGNMENT_ACTION_ID',l_aaid);
2429: pay_ca_balance_view_pkg.set_context( 'JURISDICTION_CODE', l_jurisdiction);
2430:
2431: hr_utility.trace('Archiving the balance dbi ' || l_jurisdiction);
2432:
2433: /* Assign values to the PL/SQL tables */
2434:
2435: l_step := 16;
2668: if (((ln_gross_earnings <> 0) and
2669: (ln_non_taxable_earnings <> ln_gross_earnings)) or
2670: (ln_no_gross_earnings <> 0)) then
2671:
2672: hr_utility.trace('Jurisdiction is ** ' || l_jurisdiction);
2673: earning_exists := 1;
2674: ff_archive_api.create_archive_item(
2675: p_archive_item_id => l_archive_item_id
2676: ,p_user_entity_id => get_user_entity_id('CAEOY_PROVINCE_OF_EMPLOYMENT')
2714: l_ei_ee_withheld_pjgy := result;
2715: elsif
2716: l_user_entity_name_tab(i) = 'CAEOY_T4_BOX52_PER_JD_GRE_YTD' then
2717: result := round(result);
2718: hr_utility.trace('box_52 Result = ' || to_char(result));
2719: if result > 0 then
2720: box_52_exists := 'Y';
2721: hr_utility.trace('box_52_exists');
2722: end if;
2717: result := round(result);
2718: hr_utility.trace('box_52 Result = ' || to_char(result));
2719: if result > 0 then
2720: box_52_exists := 'Y';
2721: hr_utility.trace('box_52_exists');
2722: end if;
2723: /* bug#3422384 Box26, Box24 */
2724: elsif l_user_entity_name_tab(i) = 'CAEOY_CPP_EE_TAXABLE_PER_JD_GRE_YTD' then
2725: ln_cpp_ee_taxable_pjgy := result;
2741:
2742: if l_jurisdiction = 'QC' and
2743: l_balance_type_tab(i) = 'Gross Earnings' then
2744:
2745: hr_utility.trace('Calculating QC only taxable benefit');
2746: hr_utility.trace('l_aaid ' || to_char(l_aaid));
2747: hr_utility.trace('l_asgid ' || to_char(l_asgid));
2748: hr_utility.trace('l_tax_unit_id ' || to_char(l_tax_unit_id));
2749: hr_utility.trace('l_business_group_id '||to_char(l_business_group_id));
2742: if l_jurisdiction = 'QC' and
2743: l_balance_type_tab(i) = 'Gross Earnings' then
2744:
2745: hr_utility.trace('Calculating QC only taxable benefit');
2746: hr_utility.trace('l_aaid ' || to_char(l_aaid));
2747: hr_utility.trace('l_asgid ' || to_char(l_asgid));
2748: hr_utility.trace('l_tax_unit_id ' || to_char(l_tax_unit_id));
2749: hr_utility.trace('l_business_group_id '||to_char(l_business_group_id));
2750: hr_utility.trace('l_jurisdiction ' || l_jurisdiction);
2743: l_balance_type_tab(i) = 'Gross Earnings' then
2744:
2745: hr_utility.trace('Calculating QC only taxable benefit');
2746: hr_utility.trace('l_aaid ' || to_char(l_aaid));
2747: hr_utility.trace('l_asgid ' || to_char(l_asgid));
2748: hr_utility.trace('l_tax_unit_id ' || to_char(l_tax_unit_id));
2749: hr_utility.trace('l_business_group_id '||to_char(l_business_group_id));
2750: hr_utility.trace('l_jurisdiction ' || l_jurisdiction);
2751:
2744:
2745: hr_utility.trace('Calculating QC only taxable benefit');
2746: hr_utility.trace('l_aaid ' || to_char(l_aaid));
2747: hr_utility.trace('l_asgid ' || to_char(l_asgid));
2748: hr_utility.trace('l_tax_unit_id ' || to_char(l_tax_unit_id));
2749: hr_utility.trace('l_business_group_id '||to_char(l_business_group_id));
2750: hr_utility.trace('l_jurisdiction ' || l_jurisdiction);
2751:
2752: qc_result := pay_ca_balance_pkg.call_ca_balance_get_value
2745: hr_utility.trace('Calculating QC only taxable benefit');
2746: hr_utility.trace('l_aaid ' || to_char(l_aaid));
2747: hr_utility.trace('l_asgid ' || to_char(l_asgid));
2748: hr_utility.trace('l_tax_unit_id ' || to_char(l_tax_unit_id));
2749: hr_utility.trace('l_business_group_id '||to_char(l_business_group_id));
2750: hr_utility.trace('l_jurisdiction ' || l_jurisdiction);
2751:
2752: qc_result := pay_ca_balance_pkg.call_ca_balance_get_value
2753: ( 'Taxable Benefits for Quebec',
2746: hr_utility.trace('l_aaid ' || to_char(l_aaid));
2747: hr_utility.trace('l_asgid ' || to_char(l_asgid));
2748: hr_utility.trace('l_tax_unit_id ' || to_char(l_tax_unit_id));
2749: hr_utility.trace('l_business_group_id '||to_char(l_business_group_id));
2750: hr_utility.trace('l_jurisdiction ' || l_jurisdiction);
2751:
2752: qc_result := pay_ca_balance_pkg.call_ca_balance_get_value
2753: ( 'Taxable Benefits for Quebec',
2754: 'YTD' ,
2760: l_business_group_id,
2761: l_jurisdiction
2762: ) ;
2763:
2764: hr_utility.trace('qc_result is' || to_char(qc_result));
2765:
2766: if qc_result is null then
2767: qc_result := 0;
2768: end if;
2908: -- code ended for bug 5698016
2909:
2910: + ln_non_taxable_earnings);
2911:
2912: hr_utility.trace(' Gross Earnings = ' || to_char(result));
2913:
2914: /* Added for Bug 4028693 */
2915: open c_get_employment_code(to_char(l_tax_unit_id),
2916: to_number(lv_serial_number));
2975: end if;
2976:
2977: end loop;
2978:
2979: hr_utility.trace(' Archiver Asg Act Id = ' || to_char(p_assactid));
2980: hr_utility.trace(' Negative Balance Exists Flag = ' || l_negative_balance_exists);
2981:
2982: /* Archiving the Negative Balance Exists Flag Bug#3289072 */
2983: if l_negative_balance_exists = 'Y' then
2976:
2977: end loop;
2978:
2979: hr_utility.trace(' Archiver Asg Act Id = ' || to_char(p_assactid));
2980: hr_utility.trace(' Negative Balance Exists Flag = ' || l_negative_balance_exists);
2981:
2982: /* Archiving the Negative Balance Exists Flag Bug#3289072 */
2983: if l_negative_balance_exists = 'Y' then
2984: l_user_entity_id :=
3060:
3061: l_negative_balance_exists := 'N';
3062:
3063: /* Archiving Exempt flags separately */
3064: hr_utility.trace('I am archiving CPP-QPP exempt flags for ' ||
3065: to_char(l_asgid));
3066: hr_utility.trace('effective date is ' || to_char(p_effective_date));
3067:
3068: /* Bug#3422384, checking whether the employee age is under 18 or over 70 */
3062:
3063: /* Archiving Exempt flags separately */
3064: hr_utility.trace('I am archiving CPP-QPP exempt flags for ' ||
3065: to_char(l_asgid));
3066: hr_utility.trace('effective date is ' || to_char(p_effective_date));
3067:
3068: /* Bug#3422384, checking whether the employee age is under 18 or over 70 */
3069: open c_get_date_of_birth(to_number(lv_serial_number),p_effective_date);
3070: fetch c_get_date_of_birth into ld_date_of_birth;
3070: fetch c_get_date_of_birth into ld_date_of_birth;
3071: close c_get_date_of_birth;
3072:
3073: if ld_date_of_birth is NULL then
3074: hr_utility.trace('Employee date of birth is NULL satisfied ');
3075: lv_over70_flag := 'N';
3076: lv_under18_flag := 'N';
3077: else
3078: hr_utility.trace('Employee date of birth found ');
3074: hr_utility.trace('Employee date of birth is NULL satisfied ');
3075: lv_over70_flag := 'N';
3076: lv_under18_flag := 'N';
3077: else
3078: hr_utility.trace('Employee date of birth found ');
3079:
3080: /* Backing out the changes made in 115.60 */
3081: /* if (( add_months(trunc(ld_date_of_birth,'MONTH'),(18*12)+1)) <= lv_actual_date ) then
3082: if ( lv_actual_date >= ( add_months(trunc(ld_date_of_birth,'MONTH'),(70*12)+1))) then */
3209: ,p_context2 => l_tax_unit_id
3210: ,p_some_warning => l_some_warning
3211: );
3212:
3213: hr_utility.trace('I am archiving EI exempt flag');
3214:
3215: /* Added extra validation to fix bug#3422384. For EI
3216: 1. If ei_exempt_flag in tax_information form is 'Y' and
3217: and Box18,Box24 = 0 then ei_exempt_flag= 'X'
3223: lv_ei_archive_exempt_flag := 'X';
3224:
3225: END IF;
3226:
3227: hr_utility.trace('assignment id ' || to_char(l_asgid) || '**');
3228: hr_utility.trace('cpp exempt flag is ' || lv_cpp_archive_exempt_flag || '**');
3229: hr_utility.trace('ei exempt flag is ' || lv_ei_archive_exempt_flag || '**');
3230:
3231: ff_archive_api.create_archive_item(
3224:
3225: END IF;
3226:
3227: hr_utility.trace('assignment id ' || to_char(l_asgid) || '**');
3228: hr_utility.trace('cpp exempt flag is ' || lv_cpp_archive_exempt_flag || '**');
3229: hr_utility.trace('ei exempt flag is ' || lv_ei_archive_exempt_flag || '**');
3230:
3231: ff_archive_api.create_archive_item(
3232: p_archive_item_id => l_archive_item_id
3225: END IF;
3226:
3227: hr_utility.trace('assignment id ' || to_char(l_asgid) || '**');
3228: hr_utility.trace('cpp exempt flag is ' || lv_cpp_archive_exempt_flag || '**');
3229: hr_utility.trace('ei exempt flag is ' || lv_ei_archive_exempt_flag || '**');
3230:
3231: ff_archive_api.create_archive_item(
3232: p_archive_item_id => l_archive_item_id
3233: ,p_user_entity_id => get_user_entity_id('CAEOY_EI_EXEMPT')
3242: ,p_context2 => l_tax_unit_id
3243: ,p_some_warning => l_some_warning
3244: );
3245:
3246: hr_utility.trace('I have archived exempt flags');
3247:
3248:
3249: /* Archiving T4 Employment Code */
3250: open c_get_employment_code(to_char(l_tax_unit_id),
3271: ,p_context2 => l_tax_unit_id
3272: ,p_some_warning => l_some_warning
3273: );
3274:
3275: hr_utility.trace('Archived Employment code single prov');
3276:
3277: else
3278:
3279: ff_archive_api.create_archive_item(
3290: ,p_context2 => l_tax_unit_id
3291: ,p_some_warning => l_some_warning
3292: );
3293:
3294: hr_utility.trace('Archived employment code all prov');
3295:
3296: end if;
3297:
3298: end loop; -- c_get_employment_code
3309: l_registration_no := NULL;
3310: old_l_value := 0;
3311: l_value := 0;
3312:
3313: --hr_utility.trace_on('Y','ORACLE');
3314:
3315: hr_utility.trace('l_aaid is ' || to_char(l_aaid));
3316: hr_utility.trace('l_asgid is ' || to_char(l_asgid));
3317: hr_utility.trace('l_tax_unit_id is ' || to_char(l_tax_unit_id));
3311: l_value := 0;
3312:
3313: --hr_utility.trace_on('Y','ORACLE');
3314:
3315: hr_utility.trace('l_aaid is ' || to_char(l_aaid));
3316: hr_utility.trace('l_asgid is ' || to_char(l_asgid));
3317: hr_utility.trace('l_tax_unit_id is ' || to_char(l_tax_unit_id));
3318: hr_utility.trace('l_business group_id is ' || to_char(l_business_group_id));
3319:
3312:
3313: --hr_utility.trace_on('Y','ORACLE');
3314:
3315: hr_utility.trace('l_aaid is ' || to_char(l_aaid));
3316: hr_utility.trace('l_asgid is ' || to_char(l_asgid));
3317: hr_utility.trace('l_tax_unit_id is ' || to_char(l_tax_unit_id));
3318: hr_utility.trace('l_business group_id is ' || to_char(l_business_group_id));
3319:
3320: begin
3313: --hr_utility.trace_on('Y','ORACLE');
3314:
3315: hr_utility.trace('l_aaid is ' || to_char(l_aaid));
3316: hr_utility.trace('l_asgid is ' || to_char(l_asgid));
3317: hr_utility.trace('l_tax_unit_id is ' || to_char(l_tax_unit_id));
3318: hr_utility.trace('l_business group_id is ' || to_char(l_business_group_id));
3319:
3320: begin
3321:
3314:
3315: hr_utility.trace('l_aaid is ' || to_char(l_aaid));
3316: hr_utility.trace('l_asgid is ' || to_char(l_asgid));
3317: hr_utility.trace('l_tax_unit_id is ' || to_char(l_tax_unit_id));
3318: hr_utility.trace('l_business group_id is ' || to_char(l_business_group_id));
3319:
3320: begin
3321:
3322:
3330: */
3331: l_balance_name1 := 'T4_BOX52';
3332: box_52_exists := 'N';
3333:
3334: hr_utility.trace('BOX name is ' || l_balance_name1);
3335: hr_utility.trace('l_asgid ' || l_asgid);
3336: hr_utility.trace('l_business_group_id ' || l_business_group_id);
3337: hr_utility.trace('p_effective_date ' || to_char(p_effective_date));
3338:
3331: l_balance_name1 := 'T4_BOX52';
3332: box_52_exists := 'N';
3333:
3334: hr_utility.trace('BOX name is ' || l_balance_name1);
3335: hr_utility.trace('l_asgid ' || l_asgid);
3336: hr_utility.trace('l_business_group_id ' || l_business_group_id);
3337: hr_utility.trace('p_effective_date ' || to_char(p_effective_date));
3338:
3339: open c_balance_feed_info(l_balance_name1);
3332: box_52_exists := 'N';
3333:
3334: hr_utility.trace('BOX name is ' || l_balance_name1);
3335: hr_utility.trace('l_asgid ' || l_asgid);
3336: hr_utility.trace('l_business_group_id ' || l_business_group_id);
3337: hr_utility.trace('p_effective_date ' || to_char(p_effective_date));
3338:
3339: open c_balance_feed_info(l_balance_name1);
3340: fetch c_balance_feed_info into l_registration_no, l_balance_name, l_screen_entry_value;
3333:
3334: hr_utility.trace('BOX name is ' || l_balance_name1);
3335: hr_utility.trace('l_asgid ' || l_asgid);
3336: hr_utility.trace('l_business_group_id ' || l_business_group_id);
3337: hr_utility.trace('p_effective_date ' || to_char(p_effective_date));
3338:
3339: open c_balance_feed_info(l_balance_name1);
3340: fetch c_balance_feed_info into l_registration_no, l_balance_name, l_screen_entry_value;
3341:
3338:
3339: open c_balance_feed_info(l_balance_name1);
3340: fetch c_balance_feed_info into l_registration_no, l_balance_name, l_screen_entry_value;
3341:
3342: hr_utility.trace('CURSOR count ' || c_balance_feed_info%rowcount);
3343:
3344: if c_balance_feed_info%rowcount = 0 and nvl(l_status_indian,'N') = 'N' then
3345: l_balance_name1 := 'T4_BOX20';
3346: if c_balance_feed_info%isopen then
3347: close c_balance_feed_info;
3348: end if;
3349: end if;
3350:
3351: hr_utility.trace('BOX name is ' || l_balance_name1);
3352: if not c_balance_feed_info%isopen then
3353: open c_balance_feed_info(l_balance_name1);
3354: fetch c_balance_feed_info into l_registration_no, l_balance_name, l_screen_entry_value;
3355: hr_utility.trace('CURSOR count BOX20 is ' || c_balance_feed_info%rowcount);
3351: hr_utility.trace('BOX name is ' || l_balance_name1);
3352: if not c_balance_feed_info%isopen then
3353: open c_balance_feed_info(l_balance_name1);
3354: fetch c_balance_feed_info into l_registration_no, l_balance_name, l_screen_entry_value;
3355: hr_utility.trace('CURSOR count BOX20 is ' || c_balance_feed_info%rowcount);
3356: end if;
3357:
3358: loop
3359: hr_utility.trace('start of c_balance_feed_info CURSOR');
3355: hr_utility.trace('CURSOR count BOX20 is ' || c_balance_feed_info%rowcount);
3356: end if;
3357:
3358: loop
3359: hr_utility.trace('start of c_balance_feed_info CURSOR');
3360: exit when c_balance_feed_info%NOTFOUND;
3361:
3362: -- exception handling added by sneelapa for bug 6399498
3363: -- screen_entry_value will be NON NUMERIC data for certain Element Entry Values
3382: if l_value is null then
3383: l_value := 0;
3384: end if;
3385:
3386: hr_utility.trace('l_value is ' || to_char(l_value));
3387: hr_utility.trace('old_l_value is ' || old_l_value);
3388: hr_utility.trace('old_l_registration_no is ' || old_l_registration_no);
3389: hr_utility.trace('l_registration_no is ' || l_registration_no);
3390:
3383: l_value := 0;
3384: end if;
3385:
3386: hr_utility.trace('l_value is ' || to_char(l_value));
3387: hr_utility.trace('old_l_value is ' || old_l_value);
3388: hr_utility.trace('old_l_registration_no is ' || old_l_registration_no);
3389: hr_utility.trace('l_registration_no is ' || l_registration_no);
3390:
3391: if l_registration_no <> 'NOT FOUND' then
3384: end if;
3385:
3386: hr_utility.trace('l_value is ' || to_char(l_value));
3387: hr_utility.trace('old_l_value is ' || old_l_value);
3388: hr_utility.trace('old_l_registration_no is ' || old_l_registration_no);
3389: hr_utility.trace('l_registration_no is ' || l_registration_no);
3390:
3391: if l_registration_no <> 'NOT FOUND' then
3392: if old_l_registration_no is null and l_value <> 0 then
3385:
3386: hr_utility.trace('l_value is ' || to_char(l_value));
3387: hr_utility.trace('old_l_value is ' || old_l_value);
3388: hr_utility.trace('old_l_registration_no is ' || old_l_registration_no);
3389: hr_utility.trace('l_registration_no is ' || l_registration_no);
3390:
3391: if l_registration_no <> 'NOT FOUND' then
3392: if old_l_registration_no is null and l_value <> 0 then
3393: old_l_registration_no := l_registration_no;
3416: end loop;
3417:
3418: close c_balance_feed_info;
3419:
3420: hr_utility.trace('old_l_value is ' || to_char(old_l_value));
3421: hr_utility.trace('l_registration no is ' || l_registration_no);
3422:
3423: -- modified for bug 6399498, for QA reported issue in this bug.
3424: -- if l_registration_no is not null and old_l_value <> 0 then
3417:
3418: close c_balance_feed_info;
3419:
3420: hr_utility.trace('old_l_value is ' || to_char(old_l_value));
3421: hr_utility.trace('l_registration no is ' || l_registration_no);
3422:
3423: -- modified for bug 6399498, for QA reported issue in this bug.
3424: -- if l_registration_no is not null and old_l_value <> 0 then
3425: if l_registration_no is not null then
3423: -- modified for bug 6399498, for QA reported issue in this bug.
3424: -- if l_registration_no is not null and old_l_value <> 0 then
3425: if l_registration_no is not null then
3426:
3427: hr_utility.trace('l_registration no is ' || 'archiving');
3428: -- hr_utility.trace_off;
3429:
3430: ff_archive_api.create_archive_item(
3431: p_archive_item_id => l_archive_item_id
3424: -- if l_registration_no is not null and old_l_value <> 0 then
3425: if l_registration_no is not null then
3426:
3427: hr_utility.trace('l_registration no is ' || 'archiving');
3428: -- hr_utility.trace_off;
3429:
3430: ff_archive_api.create_archive_item(
3431: p_archive_item_id => l_archive_item_id
3432: ,p_user_entity_id =>
3444: /* end registration number archiving */
3445:
3446: begin
3447: l_counter := 0;
3448: hr_utility.trace('selecting people');
3449:
3450: open get_person_info(l_asgid);
3451:
3452: fetch get_person_info
3487:
3488: for l_out_cnt in
3489: l_outputs.first..l_outputs.last
3490: loop
3491: hr_utility.trace('inside loop for SIN validation');
3492: if l_outputs(l_out_cnt).name='RETURN_VALUE' then
3493: l_return_value := l_outputs(l_out_cnt).value;
3494: end if;
3495: if l_outputs(l_out_cnt).name='INVALID_MESG' then
3506: l_invalid_sin := 'A';
3507: end if;
3508:
3509: l_person_arch_step := 2;
3510: hr_utility.trace('selected people');
3511: /* Initialise l_count */
3512: l_count := 0;
3513:
3514: --hr_utility.trace_on('Y','ORACLE');
3510: hr_utility.trace('selected people');
3511: /* Initialise l_count */
3512: l_count := 0;
3513:
3514: --hr_utility.trace_on('Y','ORACLE');
3515:
3516: l_counter := l_counter + 1;
3517: l_user_entity_name_tab(l_counter) := 'CAEOY_PERSON_ID';
3518: l_user_entity_value_tab(l_counter) := l_person_id;
3574: l_employee_number := null;
3575: l_national_identifier := null;
3576: l_middle_names := null;
3577: l_employee_phone_no := null;
3578: hr_utility.raise_error;
3579: when others then
3580: hr_utility.trace('Error in archiving person '||
3581: to_char(l_person_id) || 'at step :' ||
3582: to_char(l_person_arch_step) ||
3576: l_middle_names := null;
3577: l_employee_phone_no := null;
3578: hr_utility.raise_error;
3579: when others then
3580: hr_utility.trace('Error in archiving person '||
3581: to_char(l_person_id) || 'at step :' ||
3582: to_char(l_person_arch_step) ||
3583: 'sqlcode : ' || to_char(sqlcode));
3584: end;
3592: l_province_code := addr.province;
3593: l_postal_code := replace(addr.postal_code,' ');
3594: l_country_code := addr.addr_line_5;
3595:
3596: hr_utility.trace('selected address');
3597:
3598: l_counter := 0;
3599: l_counter := l_counter + 1;
3600: l_user_entity_name_tab(l_counter) := 'CAEOY_EMPLOYEE_ADDRESS_LINE1';
3638:
3639: l_context_id := l_taxunit_context_id;
3640: l_context_val := l_tax_unit_id;
3641:
3642: hr_utility.trace('archiving address');
3643: ff_archive_api.create_archive_item(
3644: p_archive_item_id => l_archive_item_id
3645: ,p_user_entity_id => get_user_entity_id(l_user_entity_name_tab(i))
3646: ,p_archive_value => l_user_entity_value_tab(i)
3649: ,p_legislation_code => 'CA'
3650: ,p_object_version_number => l_object_version_number
3651: ,p_some_warning => l_some_warning
3652: );
3653: hr_utility.trace('archived address');
3654: end loop;
3655: end if;
3656: hr_utility.trace('end of eoy_archive_data');
3657: l_step := 37;
3652: );
3653: hr_utility.trace('archived address');
3654: end loop;
3655: end if;
3656: hr_utility.trace('end of eoy_archive_data');
3657: l_step := 37;
3658:
3659:
3660: -- Federal YE Amendment Pre-Process Validation (T4 Amendmendment Archiver code)
3660: -- Federal YE Amendment Pre-Process Validation (T4 Amendmendment Archiver code)
3661:
3662: Begin
3663:
3664: hr_utility.trace('Started Federal YE Amendment PP Validation ');
3665: select effective_date,report_type
3666: into ld_fapp_effective_date,lv_fapp_report_type
3667: from pay_payroll_actions
3668: where payroll_action_id = l_payroll_action_id;
3666: into ld_fapp_effective_date,lv_fapp_report_type
3667: from pay_payroll_actions
3668: where payroll_action_id = l_payroll_action_id;
3669:
3670: hr_utility.trace('Fed Amend Pre-Process Pactid :'||
3671: to_char(l_payroll_action_id));
3672: hr_utility.trace('lv_fapp_report_type :'||lv_fapp_report_type);
3673:
3674: IF lv_fapp_report_type = 'CAEOY_T4_AMEND_PP' then
3668: where payroll_action_id = l_payroll_action_id;
3669:
3670: hr_utility.trace('Fed Amend Pre-Process Pactid :'||
3671: to_char(l_payroll_action_id));
3672: hr_utility.trace('lv_fapp_report_type :'||lv_fapp_report_type);
3673:
3674: IF lv_fapp_report_type = 'CAEOY_T4_AMEND_PP' then
3675: begin
3676:
3677: open c_get_fapp_locked_action_id(p_assactid);
3678: fetch c_get_fapp_locked_action_id into ln_fapp_locked_action_id;
3679: close c_get_fapp_locked_action_id;
3680:
3681: hr_utility.trace('T4 Amend PP Action ID : '||to_char(p_assactid));
3682: hr_utility.trace('ln_fapp_locked_action_id :'||
3683: to_char(ln_fapp_locked_action_id));
3684: open c_get_fapp_lkd_actid_rtype(ln_fapp_locked_action_id);
3685: fetch c_get_fapp_lkd_actid_rtype
3678: fetch c_get_fapp_locked_action_id into ln_fapp_locked_action_id;
3679: close c_get_fapp_locked_action_id;
3680:
3681: hr_utility.trace('T4 Amend PP Action ID : '||to_char(p_assactid));
3682: hr_utility.trace('ln_fapp_locked_action_id :'||
3683: to_char(ln_fapp_locked_action_id));
3684: open c_get_fapp_lkd_actid_rtype(ln_fapp_locked_action_id);
3685: fetch c_get_fapp_lkd_actid_rtype
3686: into lv_fapp_locked_actid_reptype;
3684: open c_get_fapp_lkd_actid_rtype(ln_fapp_locked_action_id);
3685: fetch c_get_fapp_lkd_actid_rtype
3686: into lv_fapp_locked_actid_reptype;
3687: close c_get_fapp_lkd_actid_rtype;
3688: hr_utility.trace('lv_fapp_locked_actid_reptype :'||
3689: lv_fapp_locked_actid_reptype);
3690:
3691: open c_get_fapp_prov_emp(p_assactid);
3692: loop
3691: open c_get_fapp_prov_emp(p_assactid);
3692: loop
3693: fetch c_get_fapp_prov_emp into lv_fapp_prov;
3694: exit when c_get_fapp_prov_emp%NOTFOUND;
3695: hr_utility.trace('lv_fapp_prov : '||lv_fapp_prov);
3696: lv_fapp_flag := compare_archive_data(p_assactid,
3697: ln_fapp_locked_action_id,
3698: lv_fapp_prov);
3699:
3698: lv_fapp_prov);
3699:
3700: if lv_fapp_flag = 'Y' then
3701:
3702: hr_utility.trace('Jurisdiction is : ' || lv_fapp_prov);
3703: hr_utility.trace('Archiving T4 Amendment Flag is : ' || lv_fapp_flag);
3704:
3705: ff_archive_api.create_archive_item(
3706: p_archive_item_id => l_archive_item_id
3699:
3700: if lv_fapp_flag = 'Y' then
3701:
3702: hr_utility.trace('Jurisdiction is : ' || lv_fapp_prov);
3703: hr_utility.trace('Archiving T4 Amendment Flag is : ' || lv_fapp_flag);
3704:
3705: ff_archive_api.create_archive_item(
3706: p_archive_item_id => l_archive_item_id
3707: ,p_user_entity_id => get_user_entity_id('CAEOY_T4_AMENDMENT_FLAG'
3725:
3726: end; -- report_type validation
3727:
3728: END IF; -- report type validation for FAPP
3729: hr_utility.trace('End of Federal YE Amendment PP Validation');
3730:
3731: Exception when no_data_found then
3732: hr_utility.trace('Report type not found for given Payroll_action ');
3733: null;
3728: END IF; -- report type validation for FAPP
3729: hr_utility.trace('End of Federal YE Amendment PP Validation');
3730:
3731: Exception when no_data_found then
3732: hr_utility.trace('Report type not found for given Payroll_action ');
3733: null;
3734: End;
3735: -- End of Federal YE Amendment Pre-Process Validation
3736:
3756:
3757:
3758: begin
3759:
3760: --hr_utility.trace_on('Y','ORACLE');
3761:
3762: select legislative_parameters,
3763: trunc(effective_date,'Y'),
3764: effective_date,
3769: l_business_group
3770: from pay_payroll_actions
3771: where payroll_action_id = pactid;
3772:
3773: hr_utility.trace('legislative prameter is '|| l_legislative_parameters);
3774: l_eoy_tax_unit_id := get_parameter('TRANSFER_GRE',l_legislative_parameters);
3775:
3776: select org_information11
3777: into l_transmitter_gre_id
3778: from hr_organization_information
3779: where organization_id = l_eoy_tax_unit_id
3780: and org_information_context = 'Canada Employer Identification';
3781:
3782: hr_utility.trace('Transfer GRE is '|| to_char(l_eoy_tax_unit_id));
3783: hr_utility.trace('Transmitter GRE is '|| to_char(l_transmitter_gre_id));
3784:
3785: if l_eoy_tax_unit_id <> -99999 then
3786:
3779: where organization_id = l_eoy_tax_unit_id
3780: and org_information_context = 'Canada Employer Identification';
3781:
3782: hr_utility.trace('Transfer GRE is '|| to_char(l_eoy_tax_unit_id));
3783: hr_utility.trace('Transmitter GRE is '|| to_char(l_transmitter_gre_id));
3784:
3785: if l_eoy_tax_unit_id <> -99999 then
3786:
3787: sqlstr := 'select /*+ ORDERED INDEX (PPY PAY_PAYROLLS_F_FK2,
3820: l_archive := chk_gre_archive(pactid);
3821:
3822: if g_archive_flag = 'N' then
3823:
3824: hr_utility.trace('eoy_range_cursor archiving employer data');
3825:
3826: /* now the archiver has provision for archiving payroll_action_level
3827: data. So make use of that */
3828:
3825:
3826: /* now the archiver has provision for archiving payroll_action_level
3827: data. So make use of that */
3828:
3829: hr_utility.trace('eoy_range_cursor archiving employer data');
3830:
3831: eoy_archive_gre_data(pactid,
3832: l_eoy_tax_unit_id,
3833: l_transmitter_gre_id);