182: tax unit id to balance adjustments,
183: also passing batch_line_id to
184: include_adjustment.
185: 115.16 A.Logue 13-JAN-2000 Ensure that error messages fetched from
186: hr_utility.get_message are of max length 240
187: to fit into pay_message_lines.
188: 115.14 A.Logue 07-OCT-1999 Pass batch_line_status to dim_expiry_date so that
189: it does not call the legislative expiry_date
190: procedure if the line is to be discarded (ie not 'V').
195: and hence can be called from the cursor (nb it
196: contains dynamic sql). Thus can remove the insert
197: sort implemented as part of 730491. This
198: should give an improvement of performance.
199: 115.12 A.Logue 18-MAY-1999 Change dbms_output to hr_utility.trace.
200: 115.11 A.Logue 14-MAY-1999 Order by line_id on line fetch.
201: 115.9 T.Battoo 20-APR-1999 setting the previous value for
202: latest balances - this code had been
203: deleted for some reason.
557: from pay_balance_batch_lines
558: where batch_id = p_batch_id;
559: --
560: begin
561: hr_utility.trace('Entering pay_balance_upload.remove_messages');
562: --
563: -- Remove the messages
564: --
565: for pmlrec in pml(p_batch_id) loop
567: where source_type = 'L'
568: and source_id = pmlrec.batch_line_id;
569: end loop;
570: --
571: hr_utility.set_location('pay_balance_upload.remove_messages',10);
572: delete from pay_message_lines
573: where source_type = 'H'
574: and source_id = p_batch_id;
575: --
572: delete from pay_message_lines
573: where source_type = 'H'
574: and source_id = p_batch_id;
575: --
576: hr_utility.trace('Exiting pay_balance_upload.remove_messages');
577: end remove_messages;
578: --
579: -----------------------------------------------------------------------------
580: -- NAME
630: l_run_type_name varchar2(80);
631: l_count NUMBER;
632: l_found BOOLEAN;
633: begin
634: hr_utility.trace('Entering pay_balance_upload.get_run_type_id');
635: --
636: -- Search for the defined balance in the Cache.
637: --
638: l_found := FALSE;
636: -- Search for the defined balance in the Cache.
637: --
638: l_found := FALSE;
639: if (p_run_type_id is not null) then
640: hr_utility.set_location('pay_balance_upload.get_run_type_id',10);
641: l_count := 1;
642: while (l_count < g_runtyp_tbl_nxt and l_found = FALSE) loop
643: if (p_run_type_id = g_runtyp_tbl_id(l_count)) then
644: p_run_type_id := g_runtyp_tbl_id(l_count);
648: l_count := l_count + 1;
649: end loop;
650: else
651: if (p_run_type_name is not null) then
652: hr_utility.set_location('pay_balance_upload.get_run_type_id',20);
653: l_run_type_name := upper(p_run_type_name);
654: l_count := 1;
655: while (l_count < g_runtyp_tbl_nxt and l_found = FALSE) loop
656: if (l_run_type_name = g_runtyp_tbl_name(l_count)) then
661: l_count := l_count + 1;
662: end loop;
663: end if;
664: end if;
665: hr_utility.set_location('pay_balance_upload.get_run_type_id',30);
666: --
667: -- If the balance is not in the Cache get it from the database.
668: --
669: if (l_found = FALSE) then
666: --
667: -- If the balance is not in the Cache get it from the database.
668: --
669: if (l_found = FALSE) then
670: hr_utility.set_location('pay_balance_upload.get_run_type_id',40);
671: --
672: open csr_run_type(p_business_group,
673: p_run_type_name,
674: p_run_type_id,
692: g_runtyp_tbl_id(g_runtyp_tbl_nxt) := l_run_type_rec.run_type_id;
693: g_runtyp_tbl_nxt := g_runtyp_tbl_nxt + 1;
694: end if;
695: --
696: hr_utility.trace('Exiting pay_balance_upload.get_run_type_id');
697: exception
698: when no_data_found then
699: hr_utility.set_location('pay_balance_upload.get_run_type_id',50);
700: -- close csr_tax_unit;
695: --
696: hr_utility.trace('Exiting pay_balance_upload.get_run_type_id');
697: exception
698: when no_data_found then
699: hr_utility.set_location('pay_balance_upload.get_run_type_id',50);
700: -- close csr_tax_unit;
701: hr_utility.trace('Exiting pay_balance_upload.get_run_type_id');
702: raise;
703: end;
697: exception
698: when no_data_found then
699: hr_utility.set_location('pay_balance_upload.get_run_type_id',50);
700: -- close csr_tax_unit;
701: hr_utility.trace('Exiting pay_balance_upload.get_run_type_id');
702: raise;
703: end;
704: --
705: -----------------------------------------------------------------------------
762: l_gre_name varchar2(80);
763: l_count NUMBER;
764: l_found BOOLEAN;
765: begin
766: hr_utility.trace('Entering pay_balance_upload.get_tax_unit_id');
767: --
768: -- Search for the defined balance in the Cache.
769: --
770: l_found := FALSE;
768: -- Search for the defined balance in the Cache.
769: --
770: l_found := FALSE;
771: if (p_tax_unit_id is not null) then
772: hr_utility.set_location('pay_balance_upload.get_tax_unit_id',10);
773: l_count := 1;
774: while (l_count < g_gre_tbl_nxt and l_found = FALSE) loop
775: if (p_tax_unit_id = g_gre_tbl_id(l_count)) then
776: p_tax_unit_id := g_gre_tbl_id(l_count);
780: l_count := l_count + 1;
781: end loop;
782: else
783: if (p_gre_name is not null) then
784: hr_utility.set_location('pay_balance_upload.get_tax_unit_id',20);
785: l_gre_name := upper(p_gre_name);
786: l_count := 1;
787: while (l_count < g_gre_tbl_nxt and l_found = FALSE) loop
788: if (l_gre_name = g_gre_tbl_name(l_count)) then
793: l_count := l_count + 1;
794: end loop;
795: end if;
796: end if;
797: hr_utility.set_location('pay_balance_upload.get_tax_unit_id',30);
798: --
799: -- If the balance is not in the Cache get it from the database.
800: --
801: if (l_found = FALSE) then
798: --
799: -- If the balance is not in the Cache get it from the database.
800: --
801: if (l_found = FALSE) then
802: hr_utility.set_location('pay_balance_upload.get_tax_unit_id',40);
803: begin
804: --
805: select plr.rule_mode
806: into g_leg_rule
856: g_gre_tbl_id(g_gre_tbl_nxt) := l_gre_rec.tax_unit_id;
857: g_gre_tbl_nxt := g_gre_tbl_nxt + 1;
858: end if;
859: --
860: hr_utility.trace('Exiting pay_balance_upload.get_tax_unit_id');
861: exception
862: when no_data_found then
863: hr_utility.set_location('pay_balance_upload.get_tax_unit_id',50);
864: -- close csr_tax_unit;
859: --
860: hr_utility.trace('Exiting pay_balance_upload.get_tax_unit_id');
861: exception
862: when no_data_found then
863: hr_utility.set_location('pay_balance_upload.get_tax_unit_id',50);
864: -- close csr_tax_unit;
865: hr_utility.trace('Exiting pay_balance_upload.get_tax_unit_id');
866: raise;
867: end;
861: exception
862: when no_data_found then
863: hr_utility.set_location('pay_balance_upload.get_tax_unit_id',50);
864: -- close csr_tax_unit;
865: hr_utility.trace('Exiting pay_balance_upload.get_tax_unit_id');
866: raise;
867: end;
868: -----------------------------------------------------------------------------
869: -- NAME
896: l_message_text varchar2(500);
897: --
898: begin
899: --
900: hr_utility.trace('Entering pay_balance_upload.write_message_line');
901: --
902: -- Set global error indicator.
903: --
904: status_indicator := SRS_ERROR;
911: -- The message token for the message text has been passed so extract the
912: -- message text.
913: --
914: else
915: hr_utility.set_message(801, p_message_token);
916: if p_token_name is not null then
917: --
918: -- Set the token value if specified.
919: --
916: if p_token_name is not null then
917: --
918: -- Set the token value if specified.
919: --
920: hr_utility.set_message_token
921: (p_token_name, p_token_value);
922: end if;
923: l_message_text := substrb(hr_utility.get_message, 1, 500);
924: end if;
919: --
920: hr_utility.set_message_token
921: (p_token_name, p_token_value);
922: end if;
923: l_message_text := substrb(hr_utility.get_message, 1, 500);
924: end if;
925: --
926: -- Create new message line.
927: --
924: end if;
925: --
926: -- Create new message line.
927: --
928: hr_utility.trace(l_message_text);
929: --
930: insert into pay_message_lines
931: (line_sequence
932: ,message_level
939: ,decode(p_meesage_level, HEADER, p_batch_id, LINE, p_batch_line_id)
940: ,decode(p_meesage_level, HEADER, 'H' , LINE, 'L')
941: ,substr(l_message_text, 1, 240));
942: --
943: hr_utility.trace('Exiting pay_balance_upload.write_message_line');
944: --
945: end write_message_line;
946: --
947: -----------------------------------------------------------------------------
997: statem varchar2(512);
998: --
999: begin
1000: --
1001: hr_utility.trace('Entering pay_balance_upload.dim_expiry_date');
1002: --
1003: if g_legislation_code is null then
1004: --
1005: -- Get the legislation code for the business group.
1015: --
1016: -- line is not valid and hence no point working
1017: -- out expiry date as it is not used anyway
1018: --
1019: hr_utility.trace('pay_balance_upload.dim_expiry_date invalid line');
1020: --
1021: l_expiry_date := p_upload_date;
1022: --
1023: --
1037: elsif l_legislation_code = 'GB' then
1038: --
1039: -- GB dimensions.
1040: --
1041: hr_utility.trace('pay_balance_upload.dim_expiry_date UK dimensions');
1042: --
1043: statem := 'BEGIN
1044: :l_expiry_date := pay_uk_bal_upload.expiry_date
1045: (:p_upload_date
1058: elsif (l_legislation_code = 'US') OR (l_legislation_code = 'BF') then
1059: --
1060: -- US + BF dimensions.
1061: --
1062: hr_utility.trace('pay_balance_upload.dim_expiry_date US or BF dimensions');
1063: --
1064: statem := 'BEGIN
1065: :l_expiry_date := pay_'||lower(l_legislation_code)||'_bal_upload.expiry_date
1066: (:p_upload_date
1100: ;
1101: --
1102: end if;
1103: --
1104: hr_utility.trace('Exiting pay_balance_upload.dim_expiry_date');
1105: --
1106: -- Return the expiry date for the dimension.
1107: --
1108: return (l_expiry_date);
1113: -- Ensures not to raise any error since it causes
1114: -- csr_batch_line_transfer to fail, and therefore it
1115: -- cannot be trapped in transfer_assignment.
1116: --
1117: hr_utility.trace('Error in pay_balance_upload.dim_expiry_date');
1118: hr_utility.trace(sqlerrm);
1119: return null;
1120:
1121: end dim_expiry_date;
1114: -- csr_batch_line_transfer to fail, and therefore it
1115: -- cannot be trapped in transfer_assignment.
1116: --
1117: hr_utility.trace('Error in pay_balance_upload.dim_expiry_date');
1118: hr_utility.trace(sqlerrm);
1119: return null;
1120:
1121: end dim_expiry_date;
1122: --
1307: l_batch_id number;
1308: --
1309: begin
1310: --
1311: hr_utility.trace('Entering pay_balance_upload.lock_batch_header');
1312: --
1313: -- Lock the specified batch header.
1314: --
1315: begin
1323: end if;
1324: raise;
1325: end;
1326: --
1327: hr_utility.trace('Exiting pay_balance_upload.lock_batch_header');
1328: --
1329: end lock_batch_header;
1330: --
1331: -----------------------------------------------------------------------------
1413: = nvl(BA.source_text2, '~nvl~')
1414: ;
1415: begin
1416: --
1417: hr_utility.trace('Entering pay_balance_upload.get_current_value');
1418: --
1419: if p_glbl_data_rec.include_adj_rule = 'N' then
1420: --
1421: -- Generic calculation without include_adjustment.
1566: -- running total. Also keep track of the earliest expiry date of the
1567: -- balance adjustments.
1568: --
1569: if l_include then
1570: hr_utility.set_location('pay_balance_upload.get_current_value',10);
1571: l_current_value :=
1572: l_current_value + l_bal_adjustment_rec.adjustment_amount;
1573: l_min_expiry_date :=
1574: least(l_min_expiry_date, l_bal_adjustment_rec.expiry_date);
1584: --
1585: p_current_value := l_current_value;
1586: p_min_expiry_date := l_min_expiry_date;
1587: --
1588: hr_utility.trace('Current Value = '|| l_current_value);
1589: hr_utility.trace('Exiting pay_balance_upload.get_current_value');
1590: --
1591: end get_current_value;
1592: --
1585: p_current_value := l_current_value;
1586: p_min_expiry_date := l_min_expiry_date;
1587: --
1588: hr_utility.trace('Current Value = '|| l_current_value);
1589: hr_utility.trace('Exiting pay_balance_upload.get_current_value');
1590: --
1591: end get_current_value;
1592: --
1593: -----------------------------------------------------------------------------
1648: --
1649: l_tax_unit_id number;
1650: begin
1651: --
1652: hr_utility.trace('Entering pay_balance_upload.calculate_adjustment');
1653: --
1654: -- Retrieve the current value for the initial balance as set by previous
1655: -- balance adjustments calculated for the assignment.
1656: --
1677: --
1678: -- The expiry date could not be derived successfully NB. this is signified
1679: -- by an expiry date of the end of time.
1680: --
1681: hr_utility.trace(p_batch_line_rec.dimension_name||' '||
1682: p_batch_line_rec.jurisdiction_code||' '||
1683: p_batch_line_rec.gre_name);
1684: hr_utility.trace('Adjustment Date '||l_adjustment_date);
1685: hr_utility.trace('Adjustment Value '|| l_adjustment_amount);
1680: --
1681: hr_utility.trace(p_batch_line_rec.dimension_name||' '||
1682: p_batch_line_rec.jurisdiction_code||' '||
1683: p_batch_line_rec.gre_name);
1684: hr_utility.trace('Adjustment Date '||l_adjustment_date);
1685: hr_utility.trace('Adjustment Value '|| l_adjustment_amount);
1686: hr_utility.trace('Adjustment Run Type '|| p_batch_line_rec.run_type_id);
1687:
1688: if nvl(l_adjustment_date, END_OF_TIME) = END_OF_TIME
1681: hr_utility.trace(p_batch_line_rec.dimension_name||' '||
1682: p_batch_line_rec.jurisdiction_code||' '||
1683: p_batch_line_rec.gre_name);
1684: hr_utility.trace('Adjustment Date '||l_adjustment_date);
1685: hr_utility.trace('Adjustment Value '|| l_adjustment_amount);
1686: hr_utility.trace('Adjustment Run Type '|| p_batch_line_rec.run_type_id);
1687:
1688: if nvl(l_adjustment_date, END_OF_TIME) = END_OF_TIME
1689: or l_adjustment_date > p_batch_line_rec.upload_date then
1682: p_batch_line_rec.jurisdiction_code||' '||
1683: p_batch_line_rec.gre_name);
1684: hr_utility.trace('Adjustment Date '||l_adjustment_date);
1685: hr_utility.trace('Adjustment Value '|| l_adjustment_amount);
1686: hr_utility.trace('Adjustment Run Type '|| p_batch_line_rec.run_type_id);
1687:
1688: if nvl(l_adjustment_date, END_OF_TIME) = END_OF_TIME
1689: or l_adjustment_date > p_batch_line_rec.upload_date then
1690:
1687:
1688: if nvl(l_adjustment_date, END_OF_TIME) = END_OF_TIME
1689: or l_adjustment_date > p_batch_line_rec.upload_date then
1690:
1691: hr_utility.set_message(801, 'HR_7030_ELE_ENTRY_INV_ADJ');
1692: hr_utility.set_message_token('ADJ_DATE', l_adjustment_date);
1693: raise hr_utility.hr_error;
1694: -- null; -- need to set up message and raise hr_utility.hr_error.
1695: end if;
1688: if nvl(l_adjustment_date, END_OF_TIME) = END_OF_TIME
1689: or l_adjustment_date > p_batch_line_rec.upload_date then
1690:
1691: hr_utility.set_message(801, 'HR_7030_ELE_ENTRY_INV_ADJ');
1692: hr_utility.set_message_token('ADJ_DATE', l_adjustment_date);
1693: raise hr_utility.hr_error;
1694: -- null; -- need to set up message and raise hr_utility.hr_error.
1695: end if;
1696: --
1689: or l_adjustment_date > p_batch_line_rec.upload_date then
1690:
1691: hr_utility.set_message(801, 'HR_7030_ELE_ENTRY_INV_ADJ');
1692: hr_utility.set_message_token('ADJ_DATE', l_adjustment_date);
1693: raise hr_utility.hr_error;
1694: -- null; -- need to set up message and raise hr_utility.hr_error.
1695: end if;
1696: --
1697: -- Amount cannot be set as the current value is greater than the amount to
1690:
1691: hr_utility.set_message(801, 'HR_7030_ELE_ENTRY_INV_ADJ');
1692: hr_utility.set_message_token('ADJ_DATE', l_adjustment_date);
1693: raise hr_utility.hr_error;
1694: -- null; -- need to set up message and raise hr_utility.hr_error.
1695: end if;
1696: --
1697: -- Amount cannot be set as the current value is greater than the amount to
1698: -- be set eg. QTD was 2000.00 while the YTD was 1500.00.
1699: --
1700: -- Negative ajustments of balances are valid.
1701: /*
1702: if l_adjustment_amount < 0 then
1703: hr_utility.set_message(801, 'HR_7030_ELE_ENTRY_INV_ADJ');
1704: raise hr_utility.hr_error;
1705: -- null; -- need to set up message and raise hr_utility.hr_error.
1706: end if;
1707: */
1700: -- Negative ajustments of balances are valid.
1701: /*
1702: if l_adjustment_amount < 0 then
1703: hr_utility.set_message(801, 'HR_7030_ELE_ENTRY_INV_ADJ');
1704: raise hr_utility.hr_error;
1705: -- null; -- need to set up message and raise hr_utility.hr_error.
1706: end if;
1707: */
1708: --
1701: /*
1702: if l_adjustment_amount < 0 then
1703: hr_utility.set_message(801, 'HR_7030_ELE_ENTRY_INV_ADJ');
1704: raise hr_utility.hr_error;
1705: -- null; -- need to set up message and raise hr_utility.hr_error.
1706: end if;
1707: */
1708: --
1709: -- Assignment is not to a payroll on the adjustment date NB. an optimisation
1715: ,l_adjustment_date);
1716: fetch csr_payroll into l_payroll_id;
1717: close csr_payroll;
1718: if l_payroll_id is null then
1719: hr_utility.set_message(801, 'HR_7789_SETUP_ASG_HAS_NO_PAYR');
1720: hr_utility.set_message_token('ADJ_DATE', l_adjustment_date);
1721: raise hr_utility.hr_error;
1722: -- null; -- need to set up message and raise hr_utility.hr_error.
1723: end if;
1716: fetch csr_payroll into l_payroll_id;
1717: close csr_payroll;
1718: if l_payroll_id is null then
1719: hr_utility.set_message(801, 'HR_7789_SETUP_ASG_HAS_NO_PAYR');
1720: hr_utility.set_message_token('ADJ_DATE', l_adjustment_date);
1721: raise hr_utility.hr_error;
1722: -- null; -- need to set up message and raise hr_utility.hr_error.
1723: end if;
1724: --
1717: close csr_payroll;
1718: if l_payroll_id is null then
1719: hr_utility.set_message(801, 'HR_7789_SETUP_ASG_HAS_NO_PAYR');
1720: hr_utility.set_message_token('ADJ_DATE', l_adjustment_date);
1721: raise hr_utility.hr_error;
1722: -- null; -- need to set up message and raise hr_utility.hr_error.
1723: end if;
1724: --
1725: -- In the US, each assignment always belongs to a legal company. If the
1718: if l_payroll_id is null then
1719: hr_utility.set_message(801, 'HR_7789_SETUP_ASG_HAS_NO_PAYR');
1720: hr_utility.set_message_token('ADJ_DATE', l_adjustment_date);
1721: raise hr_utility.hr_error;
1722: -- null; -- need to set up message and raise hr_utility.hr_error.
1723: end if;
1724: --
1725: -- In the US, each assignment always belongs to a legal company. If the
1726: -- legal compamy was not specified as a context then get the legal comapny
1790: ,p_batch_line_rec.source_text2
1791: ,p_batch_line_rec.run_type_id
1792: ,p_batch_line_rec.original_entry_id);
1793: --
1794: hr_utility.trace('Exiting pay_balance_upload.calculate_adjustment');
1795: --
1796: end calculate_adjustment;
1797: --
1798: -----------------------------------------------------------------------------
1814: l_start_ptr number;
1815: l_ptr number;
1816: begin
1817: --
1818: hr_utility.trace('Entering load_element_contexts');
1819: --
1820: p_start_ptr:= null;
1821: p_end_ptr := null;
1822: --
1870: p_end_ptr := g_element_link_contexts(p_element_link_id).end_ptr;
1871: --
1872: end if;
1873: --
1874: hr_utility.trace('Exitting load_element_contexts');
1875: --
1876: end load_element_contexts;
1877: --
1878:
1904: found boolean;
1905: --
1906: begin
1907: --
1908: hr_utility.trace('Entering set_entry_context');
1909: --
1910: load_element_contexts(p_element_link_id,
1911: l_start_ptr,
1912: l_end_ptr
1955: --
1956: end if;
1957: end if;
1958: --
1959: hr_utility.trace('Exitting set_entry_context');
1960: --
1961: end set_entry_context;
1962: -----------------------------------------------------------------------------
1963: -- NAME
1986: )
1987: is
1988: begin
1989: --
1990: hr_utility.trace('Entering create_entry_values');
1991: -- OK setup the contexts
1992: --
1993: if (p_jurisdiction_code is not null) then
1994: set_entry_context(
2045: p_num_entry_values := p_num_entry_values + 1;
2046: p_input_value_id_tbl(p_num_entry_values) := p_adj_iv_id;
2047: p_entry_value_tbl(p_num_entry_values) := to_char(p_adj_amount);
2048: --
2049: hr_utility.trace('Exitting create_entry_values');
2050: --
2051: end create_entry_values;
2052: -----------------------------------------------------------------------------
2053: -- NAME
2143: c_varchar2 constant varchar2(10) := '~nvl~';
2144: --
2145: begin
2146: --
2147: hr_utility.trace('Entering pay_balance_upload.apply_adjustments');
2148: --
2149: open csr_bal_adj;
2150: --
2151: -- Get the first balance adjustment.
2153: fetch csr_bal_adj into l_bal_adj_rec;
2154: --
2155: -- At least one balance adjustment exists.
2156: --
2157: hr_utility.set_location('pay_balance_upload.apply_adjustments', 10);
2158: if csr_bal_adj%found then
2159: --
2160: -- Keep track of balance adjustment information.
2161: --
2158: if csr_bal_adj%found then
2159: --
2160: -- Keep track of balance adjustment information.
2161: --
2162: hr_utility.trace('Adding to the Adjustment List');
2163: hr_utility.trace(' Line Id '|| l_bal_adj_rec.batch_line_id);
2164: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2165: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2166: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2159: --
2160: -- Keep track of balance adjustment information.
2161: --
2162: hr_utility.trace('Adding to the Adjustment List');
2163: hr_utility.trace(' Line Id '|| l_bal_adj_rec.batch_line_id);
2164: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2165: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2166: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2167: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2160: -- Keep track of balance adjustment information.
2161: --
2162: hr_utility.trace('Adding to the Adjustment List');
2163: hr_utility.trace(' Line Id '|| l_bal_adj_rec.batch_line_id);
2164: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2165: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2166: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2167: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2168: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2161: --
2162: hr_utility.trace('Adding to the Adjustment List');
2163: hr_utility.trace(' Line Id '|| l_bal_adj_rec.batch_line_id);
2164: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2165: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2166: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2167: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2168: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2169: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2162: hr_utility.trace('Adding to the Adjustment List');
2163: hr_utility.trace(' Line Id '|| l_bal_adj_rec.batch_line_id);
2164: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2165: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2166: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2167: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2168: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2169: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2170: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2163: hr_utility.trace(' Line Id '|| l_bal_adj_rec.batch_line_id);
2164: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2165: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2166: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2167: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2168: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2169: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2170: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2171: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2164: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2165: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2166: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2167: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2168: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2169: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2170: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2171: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2172: hr_utility.trace(' Source Number '|| l_bal_adj_rec.source_number);
2165: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2166: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2167: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2168: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2169: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2170: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2171: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2172: hr_utility.trace(' Source Number '|| l_bal_adj_rec.source_number);
2173: hr_utility.trace(' Source Text2 '|| l_bal_adj_rec.source_text2);
2166: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2167: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2168: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2169: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2170: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2171: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2172: hr_utility.trace(' Source Number '|| l_bal_adj_rec.source_number);
2173: hr_utility.trace(' Source Text2 '|| l_bal_adj_rec.source_text2);
2174: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2167: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2168: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2169: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2170: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2171: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2172: hr_utility.trace(' Source Number '|| l_bal_adj_rec.source_number);
2173: hr_utility.trace(' Source Text2 '|| l_bal_adj_rec.source_text2);
2174: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2175: hr_utility.trace(' IV ID '|| l_bal_adj_rec.ibf_input_value_id);
2168: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2169: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2170: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2171: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2172: hr_utility.trace(' Source Number '|| l_bal_adj_rec.source_number);
2173: hr_utility.trace(' Source Text2 '|| l_bal_adj_rec.source_text2);
2174: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2175: hr_utility.trace(' IV ID '|| l_bal_adj_rec.ibf_input_value_id);
2176: hr_utility.trace(' JIV ID '|| l_bal_adj_rec.jc_input_value_id);
2169: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2170: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2171: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2172: hr_utility.trace(' Source Number '|| l_bal_adj_rec.source_number);
2173: hr_utility.trace(' Source Text2 '|| l_bal_adj_rec.source_text2);
2174: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2175: hr_utility.trace(' IV ID '|| l_bal_adj_rec.ibf_input_value_id);
2176: hr_utility.trace(' JIV ID '|| l_bal_adj_rec.jc_input_value_id);
2177: l_ele_link_id := l_bal_adj_rec.element_link_id;
2170: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2171: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2172: hr_utility.trace(' Source Number '|| l_bal_adj_rec.source_number);
2173: hr_utility.trace(' Source Text2 '|| l_bal_adj_rec.source_text2);
2174: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2175: hr_utility.trace(' IV ID '|| l_bal_adj_rec.ibf_input_value_id);
2176: hr_utility.trace(' JIV ID '|| l_bal_adj_rec.jc_input_value_id);
2177: l_ele_link_id := l_bal_adj_rec.element_link_id;
2178: l_oee_id := l_bal_adj_rec.original_entry_id;
2171: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2172: hr_utility.trace(' Source Number '|| l_bal_adj_rec.source_number);
2173: hr_utility.trace(' Source Text2 '|| l_bal_adj_rec.source_text2);
2174: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2175: hr_utility.trace(' IV ID '|| l_bal_adj_rec.ibf_input_value_id);
2176: hr_utility.trace(' JIV ID '|| l_bal_adj_rec.jc_input_value_id);
2177: l_ele_link_id := l_bal_adj_rec.element_link_id;
2178: l_oee_id := l_bal_adj_rec.original_entry_id;
2179: l_bal_type_id := l_bal_adj_rec.balance_type_id;
2172: hr_utility.trace(' Source Number '|| l_bal_adj_rec.source_number);
2173: hr_utility.trace(' Source Text2 '|| l_bal_adj_rec.source_text2);
2174: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2175: hr_utility.trace(' IV ID '|| l_bal_adj_rec.ibf_input_value_id);
2176: hr_utility.trace(' JIV ID '|| l_bal_adj_rec.jc_input_value_id);
2177: l_ele_link_id := l_bal_adj_rec.element_link_id;
2178: l_oee_id := l_bal_adj_rec.original_entry_id;
2179: l_bal_type_id := l_bal_adj_rec.balance_type_id;
2180: l_adj_date := l_bal_adj_rec.adjustment_date;
2191: --
2192: p_num_lines := 1;
2193: p_batch_line_list(p_num_lines) := l_bal_adj_rec.batch_line_id;
2194: --
2195: hr_utility.set_location('pay_balance_upload.apply_adjustments', 15);
2196: -- Add to the list of entry values to be used with the next balance
2197: -- adjustment.
2198: --
2199: create_entry_values (
2211: );
2212: --
2213: -- Loop for all the balance adjustments in the list.
2214: --
2215: hr_utility.set_location('pay_balance_upload.apply_adjustments', 20);
2216: loop
2217: hr_utility.set_location('pay_balance_upload.apply_adjustments', 30);
2218: --
2219: -- Get the next balance adjustment.
2213: -- Loop for all the balance adjustments in the list.
2214: --
2215: hr_utility.set_location('pay_balance_upload.apply_adjustments', 20);
2216: loop
2217: hr_utility.set_location('pay_balance_upload.apply_adjustments', 30);
2218: --
2219: -- Get the next balance adjustment.
2220: --
2221: fetch csr_bal_adj into l_bal_adj_rec;
2253: and l_bal_adj_rec.balance_type_id <> l_bal_type_id
2254: )
2255: or csr_bal_adj%notfound then
2256: --
2257: hr_utility.set_location('pay_balance_upload.apply_adjustments', 40);
2258:
2259: l_payroll_action_id := null;
2260: --
2261: -- Firstly see if the last payroll action is available.
2314: );
2315:
2316: l_idx := g_payroll_actions.count + 1;
2317:
2318: hr_utility.trace('Adding new payroll action information to cache.');
2319: hr_utility.trace(' payroll_action_id = '|| l_payroll_action_id);
2320: hr_utility.trace(' effective_date = '|| l_adj_date);
2321: hr_utility.trace(' payroll_id = '|| l_payroll_id);
2322:
2315:
2316: l_idx := g_payroll_actions.count + 1;
2317:
2318: hr_utility.trace('Adding new payroll action information to cache.');
2319: hr_utility.trace(' payroll_action_id = '|| l_payroll_action_id);
2320: hr_utility.trace(' effective_date = '|| l_adj_date);
2321: hr_utility.trace(' payroll_id = '|| l_payroll_id);
2322:
2323: l_payroll_action_rec.payroll_action_id := l_payroll_action_id;
2316: l_idx := g_payroll_actions.count + 1;
2317:
2318: hr_utility.trace('Adding new payroll action information to cache.');
2319: hr_utility.trace(' payroll_action_id = '|| l_payroll_action_id);
2320: hr_utility.trace(' effective_date = '|| l_adj_date);
2321: hr_utility.trace(' payroll_id = '|| l_payroll_id);
2322:
2323: l_payroll_action_rec.payroll_action_id := l_payroll_action_id;
2324: l_payroll_action_rec.effective_date := l_adj_date;
2317:
2318: hr_utility.trace('Adding new payroll action information to cache.');
2319: hr_utility.trace(' payroll_action_id = '|| l_payroll_action_id);
2320: hr_utility.trace(' effective_date = '|| l_adj_date);
2321: hr_utility.trace(' payroll_id = '|| l_payroll_id);
2322:
2323: l_payroll_action_rec.payroll_action_id := l_payroll_action_id;
2324: l_payroll_action_rec.effective_date := l_adj_date;
2325: l_payroll_action_rec.payroll_id := l_payroll_id;
2353: -- used to set each initial balance is held against the corresponding
2354: -- batch line.
2355: --
2356: for l_index in 1..p_num_lines loop
2357: hr_utility.trace('Updating Line '||p_batch_line_list(l_index)||
2358: ' With Payroll Action '||l_payroll_action_id);
2359: update pay_balance_batch_lines BL
2360: set BL.batch_line_status = 'T' -- Transferred
2361: ,BL.payroll_action_id = l_payroll_action_id
2374: exit when csr_bal_adj%notfound;
2375: --
2376: -- Keep track of balance adjustment information.
2377: --
2378: hr_utility.trace('Adding to the Adjustment List');
2379: hr_utility.trace(' Line Id '|| l_bal_adj_rec.batch_line_id);
2380: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2381: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2382: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2375: --
2376: -- Keep track of balance adjustment information.
2377: --
2378: hr_utility.trace('Adding to the Adjustment List');
2379: hr_utility.trace(' Line Id '|| l_bal_adj_rec.batch_line_id);
2380: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2381: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2382: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2383: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2376: -- Keep track of balance adjustment information.
2377: --
2378: hr_utility.trace('Adding to the Adjustment List');
2379: hr_utility.trace(' Line Id '|| l_bal_adj_rec.batch_line_id);
2380: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2381: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2382: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2383: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2384: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2377: --
2378: hr_utility.trace('Adding to the Adjustment List');
2379: hr_utility.trace(' Line Id '|| l_bal_adj_rec.batch_line_id);
2380: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2381: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2382: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2383: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2384: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2385: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2378: hr_utility.trace('Adding to the Adjustment List');
2379: hr_utility.trace(' Line Id '|| l_bal_adj_rec.batch_line_id);
2380: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2381: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2382: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2383: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2384: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2385: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2386: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2379: hr_utility.trace(' Line Id '|| l_bal_adj_rec.batch_line_id);
2380: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2381: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2382: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2383: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2384: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2385: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2386: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2387: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2380: hr_utility.trace(' Ele Lnk '|| l_bal_adj_rec.element_link_id);
2381: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2382: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2383: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2384: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2385: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2386: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2387: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2388: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2381: hr_utility.trace(' OEE Id '|| l_bal_adj_rec.original_entry_id);
2382: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2383: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2384: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2385: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2386: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2387: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2388: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2389: hr_utility.trace(' IV ID '|| l_bal_adj_rec.ibf_input_value_id);
2382: hr_utility.trace(' Bal Type '|| l_bal_adj_rec.balance_type_id);
2383: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2384: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2385: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2386: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2387: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2388: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2389: hr_utility.trace(' IV ID '|| l_bal_adj_rec.ibf_input_value_id);
2390: hr_utility.trace(' JIV ID '|| l_bal_adj_rec.jc_input_value_id);
2383: hr_utility.trace(' Adj Date '|| l_bal_adj_rec.adjustment_date);
2384: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2385: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2386: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2387: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2388: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2389: hr_utility.trace(' IV ID '|| l_bal_adj_rec.ibf_input_value_id);
2390: hr_utility.trace(' JIV ID '|| l_bal_adj_rec.jc_input_value_id);
2391: l_ele_link_id := l_bal_adj_rec.element_link_id;
2384: hr_utility.trace(' Jur Code '|| l_bal_adj_rec.jurisdiction_code);
2385: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2386: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2387: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2388: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2389: hr_utility.trace(' IV ID '|| l_bal_adj_rec.ibf_input_value_id);
2390: hr_utility.trace(' JIV ID '|| l_bal_adj_rec.jc_input_value_id);
2391: l_ele_link_id := l_bal_adj_rec.element_link_id;
2392: l_oee_id := l_bal_adj_rec.original_entry_id;
2385: hr_utility.trace(' Tax Unit '|| l_bal_adj_rec.tax_unit_id);
2386: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2387: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2388: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2389: hr_utility.trace(' IV ID '|| l_bal_adj_rec.ibf_input_value_id);
2390: hr_utility.trace(' JIV ID '|| l_bal_adj_rec.jc_input_value_id);
2391: l_ele_link_id := l_bal_adj_rec.element_link_id;
2392: l_oee_id := l_bal_adj_rec.original_entry_id;
2393: l_bal_type_id := l_bal_adj_rec.balance_type_id;
2386: hr_utility.trace(' Source ID '|| l_bal_adj_rec.source_id);
2387: hr_utility.trace(' Source Text '|| l_bal_adj_rec.source_text);
2388: hr_utility.trace(' Run Type ID '|| l_bal_adj_rec.run_type_id);
2389: hr_utility.trace(' IV ID '|| l_bal_adj_rec.ibf_input_value_id);
2390: hr_utility.trace(' JIV ID '|| l_bal_adj_rec.jc_input_value_id);
2391: l_ele_link_id := l_bal_adj_rec.element_link_id;
2392: l_oee_id := l_bal_adj_rec.original_entry_id;
2393: l_bal_type_id := l_bal_adj_rec.balance_type_id;
2394: l_adj_date := l_bal_adj_rec.adjustment_date;
2423: l_entry_value_tbl
2424: );
2425: --
2426: end loop;
2427: hr_utility.set_location('pay_balance_upload.apply_adjustments', 50);
2428: --
2429: end if;
2430: --
2431: close csr_bal_adj;
2429: end if;
2430: --
2431: close csr_bal_adj;
2432: --
2433: hr_utility.trace('Exiting pay_balance_upload.apply_adjustments');
2434: --
2435: -- Trap any exceptions, put the error message into the message
2436: -- variable and raise an internal exception to indicate that there
2437: -- has been a failure. Close any open cursors.
2472: l_idx number;
2473: --
2474: begin
2475: --
2476: hr_utility.trace('Entering pay_balance_upload.cache_balances');
2477: --
2478: -- Clear the balance cache.
2479: --
2480: g_balances.delete;
2498: end if;
2499: --
2500: end loop;
2501: --
2502: hr_utility.trace('Exiting pay_balance_upload.cache_balances');
2503: --
2504: end cache_balances;
2505: --
2506: --
2553: l_chunk_size number;
2554: --
2555: begin
2556: --
2557: hr_utility.trace('Entering pay_balance_upload.lock_batch');
2558: --
2559: -- Lock the batch.
2560: --
2561: open csr_lock_batch(p_batch_id);
2595: p_glbl_data_rec.batch_id := l_batch_rec.batch_id;
2596: p_glbl_data_rec.upload_date := l_batch_rec.upload_date;
2597: p_glbl_data_rec.chunk_size := l_chunk_size;
2598: --
2599: hr_utility.trace('Exiting pay_balance_upload.lock_batch');
2600: --
2601: end lock_batch;
2602: --
2603: -----------------------------------------------------------------------------
2646: l_one_status boolean := FALSE;
2647: --
2648: begin
2649: --
2650: hr_utility.trace('Entering pay_balance_upload.set_batch_status');
2651: --
2652: open csr_status(p_glbl_data_rec.batch_id);
2653: --
2654: -- Loop for all the differnent statuses for the batch lines within a natch.
2705: where BH.batch_id = p_glbl_data_rec.batch_id;
2706: end if;
2707: close csr_status;
2708: --
2709: hr_utility.trace('Exiting pay_balance_upload.set_batch_status');
2710: --
2711: end set_batch_status;
2712: --
2713: -----------------------------------------------------------------------------
2822: l_ctx_idx number;
2823: --
2824: begin
2825: --
2826: hr_utility.trace('Entering pay_balance_upload.validate_batch_header');
2827: --
2828: -- Retrieve the batch header.
2829: --
2830: open csr_batch_header(p_glbl_data_rec.batch_id);
2838: end if;
2839: --
2840: -- See if the business group exists.
2841: --
2842: hr_utility.set_location('pay_balance_upload.validate_batch_header',10);
2843: open csr_business_group(l_batch_header_rec.business_group_id
2844: ,l_batch_header_rec.business_group_name
2845: ,p_glbl_data_rec.upload_date);
2846: fetch csr_business_group into l_bg_rec;
2855: close csr_business_group;
2856: --
2857: -- See if the payroll exists.
2858: --
2859: hr_utility.set_location('pay_balance_upload.validate_batch_header',20);
2860: open csr_payroll(l_batch_header_rec.business_group_id
2861: ,l_batch_header_rec.payroll_id
2862: ,l_batch_header_rec.payroll_name
2863: ,p_glbl_data_rec.upload_date);
2875: -- batch header being validated.
2876: --
2877: -- Batch Type is not valid.
2878: --
2879: hr_utility.set_location('pay_balance_upload.validate_batch_header',25);
2880: if l_batchtyp_invld then
2881: write_message_line
2882: (p_meesage_level => HEADER
2883: ,p_batch_id => l_batch_header_rec.batch_id
2887: end if;
2888: --
2889: -- Business group is not valid.
2890: --
2891: hr_utility.set_location('pay_balance_upload.validate_batch_header',30);
2892: if l_bg_invld then
2893: write_message_line
2894: (p_meesage_level => HEADER
2895: ,p_batch_id => l_batch_header_rec.batch_id
2899: end if;
2900: --
2901: -- Payroll is not valid.
2902: --
2903: hr_utility.set_location('pay_balance_upload.validate_batch_header',40);
2904: if l_pyrl_invld then
2905: write_message_line
2906: (p_meesage_level => HEADER
2907: ,p_batch_id => l_batch_header_rec.batch_id
2914: --
2915: if l_batchtyp_invld or
2916: l_bg_invld or
2917: l_pyrl_invld then
2918: hr_utility.set_location('pay_balance_upload.validate_batch_header',50);
2919: l_batch_header_rec.batch_status := 'E'; -- Error
2920: --
2921: -- All tests have succeeded so mark the batch header as valid.
2922: --
2920: --
2921: -- All tests have succeeded so mark the batch header as valid.
2922: --
2923: else
2924: hr_utility.set_location('pay_balance_upload.validate_batch_header',60);
2925: l_batch_header_rec.batch_status := 'V'; -- Valid
2926: end if;
2927: --
2928: -- Update the batch header with information retrieved during validation
2997: end if;
2998: --
2999: end if;
3000: --
3001: hr_utility.trace('Exiting pay_balance_upload.validate_batch_header');
3002: --
3003: end validate_batch_header;
3004: --
3005: -----------------------------------------------------------------------------
3048: l_dim_rec t_dimension_validation_rec:= p_dim_vald_rec;
3049: --
3050: begin
3051: --
3052: hr_utility.trace('Entering pay_balance_upload.which_contexts');
3053: --
3054: -- Indicator variables showing which contexts a balance dimension has.
3055: --
3056: l_dim_rec.jc_cntxt := FALSE;
3101: -- Set the indicator flags.
3102: --
3103: p_dim_vald_rec := l_dim_rec;
3104: --
3105: hr_utility.trace('Exiting pay_balance_upload.which_contexts');
3106: --
3107: end which_contexts;
3108: --
3109: -----------------------------------------------------------------------------
3171: l_status varchar2(30);
3172: ctx_id number;
3173: begin
3174: --
3175: hr_utility.trace('Entering pay_balance_upload.ins_latest_balance');
3176: open csr_get_def_bal (p_bal_type_id,
3177: p_bal_dimension_id);
3178: fetch csr_get_def_bal into l_defined_bal;
3179: close csr_get_def_bal;
3177: p_bal_dimension_id);
3178: fetch csr_get_def_bal into l_defined_bal;
3179: close csr_get_def_bal;
3180: --
3181: hr_utility.set_location('pay_balance_upload.ins_latest_balance',10);
3182: select pay_latest_balances_s.nextval
3183: into l_lat_bal_id
3184: from sys.dual;
3185: --
3194: p_status=>l_status);
3195:
3196: if (l_status='Y')
3197: then
3198: hr_utility.trace('latest balances table');
3199: insert into pay_latest_balances
3200: (latest_balance_id,
3201: assignment_id,
3202: defined_balance_id,
3255: -9999);
3256: --
3257: if p_tax_unit_id is not null then
3258: --
3259: hr_utility.set_location('pay_balance_upload.ins_latest_balance',20);
3260: open csr_get_context_id('TAX_UNIT_ID');
3261: fetch csr_get_context_id into ctx_id;
3262: close csr_get_context_id;
3263: --
3271: end if;
3272: --
3273: if p_jurisdiction_code is not null then
3274: --
3275: hr_utility.set_location('pay_balance_upload.ins_latest_balance',30);
3276: open csr_get_context_id('JURISDICTION_CODE');
3277: fetch csr_get_context_id into ctx_id;
3278: close csr_get_context_id;
3279: --
3286: p_jurisdiction_code);
3287: end if;
3288: if p_oee_id is not null then
3289: --
3290: hr_utility.set_location('pay_balance_upload.ins_latest_balance',40);
3291: open csr_get_context_id('ORIGINAL_ENTRY_ID');
3292: fetch csr_get_context_id into ctx_id;
3293: close csr_get_context_id;
3294: --
3303: --
3304: --
3305: if p_source_id is not null then
3306: --
3307: hr_utility.set_location('pay_balance_upload.ins_latest_balance',50);
3308: open csr_get_context_id('SOURCE_ID');
3309: fetch csr_get_context_id into ctx_id;
3310: close csr_get_context_id;
3311: --
3319: end if;
3320: --
3321: if p_source_text is not null then
3322: --
3323: hr_utility.set_location('pay_balance_upload.ins_latest_balance',50);
3324: open csr_get_context_id('SOURCE_TEXT');
3325: fetch csr_get_context_id into ctx_id;
3326: close csr_get_context_id;
3327: --
3335: end if;
3336: --
3337: if p_source_number is not null then
3338: --
3339: hr_utility.set_location('pay_balance_upload.ins_latest_balance',60);
3340: open csr_get_context_id('SOURCE_NUMBER');
3341: fetch csr_get_context_id into ctx_id;
3342: close csr_get_context_id;
3343: --
3351: end if;
3352: --
3353: if p_source_text2 is not null then
3354: --
3355: hr_utility.set_location('pay_balance_upload.ins_latest_balance',70);
3356: open csr_get_context_id('SOURCE_TEXT2');
3357: fetch csr_get_context_id into ctx_id;
3358: close csr_get_context_id;
3359: --
3366: p_source_text2);
3367: end if;
3368: --
3369: end if;
3370: hr_utility.trace('Exiting pay_balance_upload.ins_latest_balance');
3371: end ins_latest_balance;
3372: --
3373: -----------------------------------------------------------------------------
3374: -- NAME
3438: l_max_act_seq number;
3439: --
3440: begin
3441: --
3442: hr_utility.trace('Entering pay_balance_upload.load_latest_asg_balances');
3443: --
3444: open csr_latest_asg_balances(p_glbl_data_rec.batch_id
3445: ,p_glbl_data_rec.assignment_id);
3446: --
3455: -- Store the details of linein case of error
3456: --
3457: p_num_lines := 1;
3458: p_batch_line_list(p_num_lines) := l_lat_asg_balance.batch_line_id;
3459: hr_utility.trace(p_num_lines||' '||p_batch_line_list(p_num_lines));
3460: --
3461: if (l_lat_asg_balance.value <> 0) then
3462: hr_utility.set_location('pay_balance_upload.load_latest_asg_balances',
3463: 10);
3458: p_batch_line_list(p_num_lines) := l_lat_asg_balance.batch_line_id;
3459: hr_utility.trace(p_num_lines||' '||p_batch_line_list(p_num_lines));
3460: --
3461: if (l_lat_asg_balance.value <> 0) then
3462: hr_utility.set_location('pay_balance_upload.load_latest_asg_balances',
3463: 10);
3464: select /*+ ORDERED
3465: USE_NL(pbl ppa pbf paa rr rrv)
3466: INDEX(pbl PAY_BALANCE_BATCH_LINES_N51)
3518: l_lat_asg_balance.original_entry_id), -1) =
3519: nvl(nvl(l_lat_asg_balance.original_entry_id,
3520: pbl.original_entry_id), -1);
3521: else
3522: hr_utility.set_location('pay_balance_upload.load_latest_asg_balances',
3523: 20);
3524: --
3525: open csr_get_asg_act (l_lat_asg_balance.payroll_action_id,
3526: p_glbl_data_rec.assignment_id);
3534: close csr_get_asg_act;
3535: --
3536: end if;
3537: --
3538: hr_utility.set_location('pay_balance_upload.load_latest_asg_balances', 30);
3539: ins_latest_balance(l_lat_asg_balance.balance_type_id,
3540: l_lat_asg_balance.balance_dimension_id,
3541: l_lat_asg_balance.value,
3542: p_glbl_data_rec.assignment_id,
3555: close csr_latest_asg_balances;
3556: --
3557: p_num_lines := 0;
3558: --
3559: hr_utility.trace('Exiting pay_balance_upload.load_latest_asg_balances');
3560: --
3561: end load_latest_asg_balances;
3562: --
3563: -----------------------------------------------------------------------------
3719: l_context ff_contexts.context_name%type;
3720: --
3721: begin
3722: --
3723: hr_utility.trace('Entering pay_balance_upload.validate_dimension');
3724: --
3725: -- Search through list of dimensions that have already been validated NB
3726: -- the list of dimensions is held in a PLSQL table.
3727: --
4160: l_oee_cntxt_invld then
4161: p_batch_line_rec.batch_line_status := 'E'; -- Error
4162: end if;
4163: --
4164: hr_utility.trace('Exiting pay_balance_upload.validate_dimension');
4165: --
4166: end validate_dimension;
4167: --
4168: -----------------------------------------------------------------------------
4325: l_balance_found boolean := FALSE;
4326: --
4327: begin
4328: --
4329: hr_utility.trace('Entering pay_balance_upload.validate_balance');
4330: --
4331: -- Search through list of balances that have already been validated NB. the
4332: -- list of balances is held in a PLSQL table.
4333: --
4497: l_bal_invl_link then
4498: p_batch_line_rec.batch_line_status := 'E'; -- Error
4499: end if;
4500: --
4501: hr_utility.trace('Exiting pay_balance_upload.validate_balance');
4502: --
4503: end validate_balance;
4504: --
4505: -----------------------------------------------------------------------------
4606: l_pay_act_id number;
4607: --
4608: begin
4609: --
4610: hr_utility.trace('Entering pay_balance_upload.validate_assignment');
4611: --
4612: -- Assignment has already been validated, so there is no need to do the
4613: -- validation again NB. the assignment_id overrides the assignment_number.
4614: --
4761: p_asg_processed then
4762: p_batch_line_rec.batch_line_status := 'E'; -- Error
4763: end if;
4764: --
4765: hr_utility.trace('Exiting pay_balance_upload.validate_assignment');
4766: --
4767: end validate_assignment;
4768: --
4769: -----------------------------------------------------------------------------
4811: l_bal_vald_rec t_balance_validation_rec;
4812: --
4813: begin
4814: --
4815: hr_utility.trace('Entering pay_balance_upload.validate_batch_lines');
4816: --
4817: -- Clear the validation cache.
4818: --
4819: g_bal_vald.delete;
4902: end loop;
4903: --
4904: close csr_batch_line_validate;
4905: --
4906: hr_utility.trace('Exiting pay_balance_upload.validate_batch_lines');
4907: --
4908: end validate_batch_lines;
4909: --
4910: -----------------------------------------------------------------------------
4935: l_validation_supp varchar2(30);
4936: --
4937: begin
4938: --
4939: hr_utility.trace('Entering pay_balance_upload.validate_batch');
4940: --
4941: -- Ensure the batch header is valid.
4942: --
4943: validate_batch_header(p_glbl_data_rec);
5007: end if;
5008: end if;
5009: end if;
5010: --
5011: hr_utility.trace('Exiting pay_balance_upload.validate_batch');
5012: --
5013: end validate_batch;
5014: --
5015: -----------------------------------------------------------------------------
5076: nvl(substr(TBA2.jurisdiction_code,1,BT.jurisdiction_level), -1);
5077: --
5078: begin
5079: --
5080: hr_utility.trace('Entering pay_balance_upload.transfer_assignment');
5081: --
5082: open csr_batch_line_transfer(p_glbl_data_rec.batch_id
5083: ,p_glbl_data_rec.assignment_id);
5084: --
5090: --
5091: -- Get the next batch line for the assignment.
5092: --
5093: fetch csr_batch_line_transfer into l_batch_line_rec;
5094: hr_utility.trace('BATCH_LINE_ID = '||l_batch_line_rec.batch_line_id);
5095: hr_utility.trace('EXPIRY_DATE = '||l_batch_line_rec.expiry_date);
5096: --
5097: -- Terminate the loop either if there are no more batch lines to process
5098: -- or the batch line has been transferred already or is invalid. The
5091: -- Get the next batch line for the assignment.
5092: --
5093: fetch csr_batch_line_transfer into l_batch_line_rec;
5094: hr_utility.trace('BATCH_LINE_ID = '||l_batch_line_rec.batch_line_id);
5095: hr_utility.trace('EXPIRY_DATE = '||l_batch_line_rec.expiry_date);
5096: --
5097: -- Terminate the loop either if there are no more batch lines to process
5098: -- or the batch line has been transferred already or is invalid. The
5099: -- transfer of the batch lines for an assignment will only continue if all
5142:
5143: end loop;
5144: --
5145: if conflicts <> 0 then
5146: hr_utility.set_message(801, 'PAY_52152_INV_ASS_BALS');
5147: raise hr_utility.hr_error;
5148: end if;
5149: --
5150: -- Create all the balance adjustments for the assignment which will set the
5143: end loop;
5144: --
5145: if conflicts <> 0 then
5146: hr_utility.set_message(801, 'PAY_52152_INV_ASS_BALS');
5147: raise hr_utility.hr_error;
5148: end if;
5149: --
5150: -- Create all the balance adjustments for the assignment which will set the
5151: -- initial balances as specified by the batch lines for that assignment.
5177: --
5178: --
5179: delete from pay_temp_balance_adjustments;
5180: --
5181: hr_utility.trace('Exiting pay_balance_upload.transfer_assignment');
5182: --
5183: -- The transfer has failed.
5184: --
5185: exception
5182: --
5183: -- The transfer has failed.
5184: --
5185: exception
5186: when hr_utility.hr_error then
5187: --
5188: -- Close the batch line cursor if it is open.
5189: --
5190: if csr_batch_line_transfer%isopen then
5192: end if;
5193: --
5194: -- Extract the error message.
5195: --
5196: l_message := substrb(nvl(hr_utility.get_message, sqlerrm), 1, 240);
5197: --
5198: -- Undo all the work relating to the assignment.
5199: --
5200: rollback to assignment_savepoint;
5227: delete from pay_temp_balance_adjustments;
5228: --
5229: when others then
5230: --
5231: hr_utility.trace(sqlerrm);
5232: --
5233: -- Extract the error message.
5234: --
5235: l_message := substrb(sqlerrm, 1, 240);
5315: l_asg_count number := 0;
5316: --
5317: begin
5318: --
5319: hr_utility.trace('Entering pay_balance_upload.transfer_batch');
5320: --
5321: -- Cache the initial balance feed information for each balance found in
5322: -- the batch.
5323: --
5335: -- Get the next assignment.
5336: --
5337: fetch csr_assignment into p_glbl_data_rec.assignment_id;
5338: exit when csr_assignment%notfound;
5339: hr_utility.trace('ASG = '||p_glbl_data_rec.assignment_id);
5340: --
5341: -- Keep a count of the number of assignments that have been processed.
5342: --
5343: l_asg_count := l_asg_count + 1;
5372: lock_batch_header(p_glbl_data_rec.batch_id);
5373: end if;
5374: end if;
5375: --
5376: hr_utility.trace('Exiting pay_balance_upload.transfer_batch');
5377: --
5378: end transfer_batch;
5379: --
5380: -----------------------------------------------------------------------------
5406: l_asg_count number;
5407: --
5408: begin
5409: --
5410: hr_utility.trace('Entering pay_balance_upload.undo_transfer_batch');
5411: --
5412: l_asg_count := 0;
5413: --
5414: open csr_batch_line_undo_transfer(p_glbl_data_rec.batch_id);
5488: commit;
5489: end if;
5490: end if;
5491: --
5492: hr_utility.trace('Exiting pay_balance_upload.undo_transfer_batch');
5493: --
5494: end undo_transfer_batch;
5495: --
5496: -----------------------------------------------------------------------------
5517: and BL.batch_line_status = 'E';
5518: --
5519: begin
5520: --
5521: hr_utility.trace('Entering pay_balance_upload.purge_batch');
5522: --
5523: -- Delete batch line messages.
5524: --
5525: for errline in csr_get_err_lines(p_glbl_data_rec.batch_id) loop
5545: --
5546: delete from pay_balance_batch_headers BBH
5547: where BBH.batch_id = p_glbl_data_rec.batch_id;
5548: --
5549: hr_utility.trace('Exiting pay_balance_upload.purge_batch');
5550: --
5551: end purge_batch;
5552: --
5553: -----------------------------------------------------------------------------
5589: return;
5590: end if;
5591: --
5592: close csr_get_payroll_actions;
5593: hr_utility.set_message(801, 'HR_51053_ASA_PREV_PROCESSED');
5594: raise hr_utility.hr_error;
5595: end valid_latest_balance_run;
5596: --
5597: --
5590: end if;
5591: --
5592: close csr_get_payroll_actions;
5593: hr_utility.set_message(801, 'HR_51053_ASA_PREV_PROCESSED');
5594: raise hr_utility.hr_error;
5595: end valid_latest_balance_run;
5596: --
5597: --
5598: -----------------------------------------------------------------------------
5658: pay_balance_batch_headers pbh
5659: where pbh.batch_id = p_batch_id
5660: and pbh.business_group_id = pbg.business_group_id;
5661: begin
5662: hr_utility.trace('Entering pay_balance_upload.load_latest_balances');
5663: --
5664: -- Freeze the batch while processing it and initialise the global data
5665: -- structure.
5666: --
5707: -- then commit them.
5708: --
5709: commit;
5710: --
5711: hr_utility.trace('Exiting pay_balance_upload.load_latest_balances');
5712: end load_latest_balances;
5713: -----------------------------------------------------------------------------
5714: -- NAME
5715: -- post_transfer_batch
5747: and pbbl.batch_id = p_glbl_data_rec.batch_id
5748: ;
5749: begin
5750: --
5751: hr_utility.set_location('Entering:'||l_proc, 5);
5752:
5753: if p_glbl_data_rec.upload_mode = 'TRANSFER' then
5754:
5755: for l_batch in csr_batch loop
5753: if p_glbl_data_rec.upload_mode = 'TRANSFER' then
5754:
5755: for l_batch in csr_batch loop
5756: --
5757: hr_utility.trace(' payroll_action_id=:'||l_batch.payroll_action_id);
5758: --
5759: -- Completes the payroll action.
5760: --
5761: pay_bal_adjust.process_batch(l_batch.payroll_action_id);
5763: end loop;
5764:
5765: end if;
5766:
5767: hr_utility.set_location('Leaving:'||l_proc, 50);
5768:
5769: end post_transfer_batch;
5770:
5771: -----------------------------------------------------------------------------
5792: l_message varchar2(240);
5793: l_glbl_data_rec glbl_data_rec_type:= p_glbl_data_rec;
5794: begin
5795: --
5796: hr_utility.set_location('Entering:'||l_proc, 5);
5797:
5798: --
5799: -- Validate the batch.
5800: --
5820: -- Set the status of the batch.
5821: --
5822: set_batch_status(l_glbl_data_rec);
5823:
5824: hr_utility.set_location('Leaving:'||l_proc, 50);
5825: --
5826: exception
5827: --
5828: -- Treats the exception trapped here as a batch header error.
5826: exception
5827: --
5828: -- Treats the exception trapped here as a batch header error.
5829: --
5830: when hr_utility.hr_error then
5831: hr_utility.set_location(l_proc, 55);
5832:
5833: l_message := substrb(nvl(hr_utility.get_message, sqlerrm), 1, 240);
5834:
5827: --
5828: -- Treats the exception trapped here as a batch header error.
5829: --
5830: when hr_utility.hr_error then
5831: hr_utility.set_location(l_proc, 55);
5832:
5833: l_message := substrb(nvl(hr_utility.get_message, sqlerrm), 1, 240);
5834:
5835: write_message_line
5829: --
5830: when hr_utility.hr_error then
5831: hr_utility.set_location(l_proc, 55);
5832:
5833: l_message := substrb(nvl(hr_utility.get_message, sqlerrm), 1, 240);
5834:
5835: write_message_line
5836: (p_meesage_level => HEADER
5837: ,p_batch_id => l_glbl_data_rec.batch_id
5844: set batch_status = 'E'
5845: where batch_id = l_glbl_data_rec.batch_id;
5846:
5847: when others then
5848: hr_utility.set_location(l_proc, 60);
5849:
5850: l_message := substrb(sqlerrm, 1, 240);
5851:
5852: write_message_line
5909: l_null_batch_info t_batch_info_rec;
5910: --
5911: begin
5912: --
5913: hr_utility.trace('Entering pay_balance_upload.process');
5914: status_indicator := SRS_SUCCESS; -- Success
5915: g_legislation_code := null;
5916: --
5917: -- Reset the batch info.
5929: if l_batch_status = 'L' then
5930: --
5931: -- Set the return code and message for SRS.
5932: --
5933: hr_utility.trace('pay_balance_upload.process: batch locked');
5934: status_indicator := SRS_ERROR; -- Error
5935: errbuf := 'Batch currently being processed by another process';
5936: else
5937: --
5994: retcode := SRS_ERROR; -- Error
5995: errbuf := 'Invalid mode';
5996: end if;
5997: --
5998: hr_utility.trace('Exiting pay_balance_upload.process');
5999: --
6000: end process;
6001: --
6002: begin