21:
22: Description : This package holds building blocks used in the generation
23: of nacha Tape.
24:
25: Uses : hr_utility
26:
27: Change List
28: -----------
29: Date Name Vers Bug No Description
276: ld_payment_date DATE;
277: ln_run_result_id NUMBER;
278:
279: begin
280: hr_utility.trace('Entering pay_nacha_tape.get_third_party_details');
281: hr_utility.trace('p_amount = ' || p_amount);
282: hr_utility.trace('p_ppm_id = ' || p_ppm_id);
283:
284: open csr_ele_details;
277: ln_run_result_id NUMBER;
278:
279: begin
280: hr_utility.trace('Entering pay_nacha_tape.get_third_party_details');
281: hr_utility.trace('p_amount = ' || p_amount);
282: hr_utility.trace('p_ppm_id = ' || p_ppm_id);
283:
284: open csr_ele_details;
285: hr_utility.trace('Open cursor csr_ele_details');
278:
279: begin
280: hr_utility.trace('Entering pay_nacha_tape.get_third_party_details');
281: hr_utility.trace('p_amount = ' || p_amount);
282: hr_utility.trace('p_ppm_id = ' || p_ppm_id);
283:
284: open csr_ele_details;
285: hr_utility.trace('Open cursor csr_ele_details');
286:
281: hr_utility.trace('p_amount = ' || p_amount);
282: hr_utility.trace('p_ppm_id = ' || p_ppm_id);
283:
284: open csr_ele_details;
285: hr_utility.trace('Open cursor csr_ele_details');
286:
287: LOOP
288: fetch csr_ele_details into lv_ref_no,
289: lv_fips_code,
289: lv_fips_code,
290: lv_med_ind,
291: ld_payment_date,
292: ln_run_result_id;
293: hr_utility.trace('After fetch csr_ele_details');
294: if csr_ele_details%notfound then
295: hr_utility.trace('Not Found csr_ele_details');
296: exit;
297: end if;
291: ld_payment_date,
292: ln_run_result_id;
293: hr_utility.trace('After fetch csr_ele_details');
294: if csr_ele_details%notfound then
295: hr_utility.trace('Not Found csr_ele_details');
296: exit;
297: end if;
298:
299: if not (g_used_results_tab.EXISTS(ln_run_result_id)) then
303: p_fips_code := lv_fips_code;
304: p_med_ind := lv_med_ind;
305:
306: close csr_ele_details;
307: hr_utility.trace('Exiting pay_nacha_tape.get_third_party_details - success');
308: return;
309: end if;
310:
311: end LOOP;
312:
313: close csr_ele_details;
314:
315: -- if we got here then we did not find a element that matches our needs
316: hr_utility.trace('Exiting pay_nacha_tape.get_third_part_details - error');
317: hr_utility.set_message(801,'PAY_GARNISH_ELE_NOT_FOUND');
318: hr_utility.raise_error;
319:
320: end get_third_party_details;
313: close csr_ele_details;
314:
315: -- if we got here then we did not find a element that matches our needs
316: hr_utility.trace('Exiting pay_nacha_tape.get_third_part_details - error');
317: hr_utility.set_message(801,'PAY_GARNISH_ELE_NOT_FOUND');
318: hr_utility.raise_error;
319:
320: end get_third_party_details;
321:
314:
315: -- if we got here then we did not find a element that matches our needs
316: hr_utility.trace('Exiting pay_nacha_tape.get_third_part_details - error');
317: hr_utility.set_message(801,'PAY_GARNISH_ELE_NOT_FOUND');
318: hr_utility.raise_error;
319:
320: end get_third_party_details;
321:
322: /* ****************************************************************
331: FUNCTION get_formula_id (p_formula_name varchar2)
332: RETURN varchar2 IS
333: ff_formula_id varchar2(9);
334: BEGIN
335: hr_utility.set_location('pay_us_nacha_tape.get_formula_id',1);
336: --
337: select TO_CHAR(FORMULA_ID) INTO ff_formula_id
338: from FF_FORMULAS_F
339: where g_effective_date between EFFECTIVE_START_DATE and
339: where g_effective_date between EFFECTIVE_START_DATE and
340: EFFECTIVE_END_DATE
341: and FORMULA_NAME = p_formula_name;
342: --
343: hr_utility.trace('Formula ID : '||ff_formula_id);
344: RETURN ff_formula_id;
345: exception
346: when no_data_found then
347: hr_utility.set_message(801,'FFX37_FORMULA_NOT_FOUND');
343: hr_utility.trace('Formula ID : '||ff_formula_id);
344: RETURN ff_formula_id;
345: exception
346: when no_data_found then
347: hr_utility.set_message(801,'FFX37_FORMULA_NOT_FOUND');
348: hr_utility.set_message_token('1',p_formula_name);
349: hr_utility.raise_error;
350: END get_formula_id;
351: ----
344: RETURN ff_formula_id;
345: exception
346: when no_data_found then
347: hr_utility.set_message(801,'FFX37_FORMULA_NOT_FOUND');
348: hr_utility.set_message_token('1',p_formula_name);
349: hr_utility.raise_error;
350: END get_formula_id;
351: ----
352: ----
345: exception
346: when no_data_found then
347: hr_utility.set_message(801,'FFX37_FORMULA_NOT_FOUND');
348: hr_utility.set_message_token('1',p_formula_name);
349: hr_utility.raise_error;
350: END get_formula_id;
351: ----
352: ----
353: --.
364: FUNCTION get_transfer_param ( p_param_name varchar2 )
365: RETURN Number IS
366: param_value number;
367: BEGIN
368: hr_utility.set_location('pay_us_nacha_tape.get_effective_date',20);
369: IF pay_mag_tape.internal_prm_names(3) = p_param_name
370: THEN
371: param_value := fnd_number.canonical_to_number(pay_mag_tape.internal_prm_values(3));
372: ELSIF pay_mag_tape.internal_prm_names(4) = p_param_name
402: PROCEDURE write_file_header IS
403:
404: BEGIN
405:
406: hr_utility.trace('Writing File Header');
407: hr_utility.trace('.... Writing File Header Context');
408:
409: pay_mag_tape.internal_cxt_values(1) := '3';
410: pay_mag_tape.internal_cxt_names(2) := 'ORG_PAY_METHOD_ID';
403:
404: BEGIN
405:
406: hr_utility.trace('Writing File Header');
407: hr_utility.trace('.... Writing File Header Context');
408:
409: pay_mag_tape.internal_cxt_values(1) := '3';
410: pay_mag_tape.internal_cxt_names(2) := 'ORG_PAY_METHOD_ID';
411: pay_mag_tape.internal_cxt_values(2) := g_org_payment_method_id;
411: pay_mag_tape.internal_cxt_values(2) := g_org_payment_method_id;
412: pay_mag_tape.internal_cxt_names(3) := 'DATE_EARNED';
413: pay_mag_tape.internal_cxt_values(3) := fnd_date.date_to_canonical(g_effective_date);
414: --
415: hr_utility.trace('.... Writing File Header Parameters');
416:
417: pay_mag_tape.internal_prm_values(1) := '6';
418: pay_mag_tape.internal_prm_values(2) := g_file_header;
419: pay_mag_tape.internal_prm_names(3) := 'TRANSFER_THIRD_PARTY';
424: pay_mag_tape.internal_prm_values(5) := g_date;
425: pay_mag_tape.internal_prm_names(6) := 'CREATION_TIME';
426: pay_mag_tape.internal_prm_values(6) := g_time;
427:
428: hr_utility.trace('Leaving File Header');
429:
430: hr_utility.set_location('run_formula.File_head',6);
431:
432: END; /* end write_file_header */
426: pay_mag_tape.internal_prm_values(6) := g_time;
427:
428: hr_utility.trace('Leaving File Header');
429:
430: hr_utility.set_location('run_formula.File_head',6);
431:
432: END; /* end write_file_header */
433:
434: /******************************************************************
442: PROCEDURE write_batch_header
443: IS
444:
445: BEGIN
446: hr_utility.trace('Writing Batch Header');
447:
448: g_overflow_batch := 'N';
449: hr_utility.trace('.... g_overflow_batch is : '|| g_overflow_batch);
450:
445: BEGIN
446: hr_utility.trace('Writing Batch Header');
447:
448: g_overflow_batch := 'N';
449: hr_utility.trace('.... g_overflow_batch is : '|| g_overflow_batch);
450:
451: -- Bug 3331019
452: if (nvl(hr_general2.get_oracle_db_version, 0) < 10.0) then
453: OPEN csr_assignments (g_legal_company_id,
465: g_batch_number := g_batch_number + 1;
466:
467: -- Context for NACHA_BATCH_HEADER
468: -- first context is number of contexts
469: hr_utility.trace('.... Writing Batch Header Context');
470:
471: pay_mag_tape.internal_cxt_values(1) := '4';
472: pay_mag_tape.internal_cxt_names(2) := 'TAX_UNIT_ID';
473: pay_mag_tape.internal_cxt_values(2) := TO_CHAR(g_legal_company_id);
478:
479: -- Parameters for NACHA_BATCH_HEADER
480: -- first parameter is number of parameters
481: -- second parameter is formula is
482: hr_utility.trace('.... Writing Batch Header Parameters');
483:
484: pay_mag_tape.internal_prm_values(1) := '8';
485: pay_mag_tape.internal_prm_values(2) := g_batch_header;
486:
508: pay_mag_tape.internal_prm_values(8) := 'PPD';
509: end if;
510:
511:
512: hr_utility.trace('Leaving Batch Header');
513:
514: END; /* write_batch_header */
515:
516: /******************************************************************
526: PROCEDURE write_entry_detail IS
527:
528: BEGIN
529:
530: hr_utility.trace('Writing Entry Detail');
531:
532: hr_utility.trace('.... Writing Entry Detail Context');
533: g_count := g_count + 1;
534:
528: BEGIN
529:
530: hr_utility.trace('Writing Entry Detail');
531:
532: hr_utility.trace('.... Writing Entry Detail Context');
533: g_count := g_count + 1;
534:
535: -- Context Setup for NACHA_ENTRY_DETAIL
536: -- First context value is number of contexts
551: -- Parameter Setup for NACHA_ENTRY_DETAIL
552: -- First parameter value is number of parameters
553: -- second parameter value is formula id
554:
555: hr_utility.trace('.... Writing Entry Detail Parameters');
556:
557: pay_mag_tape.internal_prm_values(1) := '11';
558: pay_mag_tape.internal_prm_values(2) := g_entry_detail;
559:
575:
576: pay_mag_tape.internal_prm_names(11) := 'TEST_FILE';
577: pay_mag_tape.internal_prm_values(11) := g_test_file;
578:
579: hr_utility.set_location('run_formula.Assignment',7);
580: IF g_temp_count = 0 THEN
581: -- If this is the first entry detail of a batch, reset these
582: -- parameters.
583: pay_mag_tape.internal_prm_names(4) := 'TRANSFER_ENTRY_COUNT';
589: pay_mag_tape.internal_prm_names(9) := 'TRANSFER_ORG_PAY_TOT';
590: pay_mag_tape.internal_prm_values(9) := '0';
591:
592: g_temp_count := 1;
593: hr_utility.set_location('run_formula.Assignment',8);
594: END IF;
595:
596: IF g_csr_org_pay_third_party = 'Y' THEN
597: g_addenda_write := 'Y';
614: and b.EFFECTIVE_END_DATE);
615: end if;
616:
617:
618: hr_utility.trace('Leaving Entry Detail');
619:
620: END; /* write_entry_detail */
621:
622: /******************************************************************
632: PROCEDURE write_addenda IS
633:
634: BEGIN
635:
636: hr_utility.trace('Writing Addenda');
637:
638: g_addenda_write := 'N';
639:
640: get_third_party_details(
644: v_attach_number,
645: v_fips_code,
646: v_med_ind);
647:
648: hr_utility.trace('.... Writing Addenda Context');
649:
650: -- Context Setup for NACHA_ADDENDA
651: -- First context value is number of Context Values
652:
663: pay_mag_tape.internal_cxt_values(6) := g_org_payment_method_id;
664: pay_mag_tape.internal_cxt_names(7) := 'TAX_UNIT_ID';
665: pay_mag_tape.internal_cxt_values(7) := TO_CHAR(g_legal_company_id);
666:
667: hr_utility.trace('.... Writing Addenda Parameters');
668:
669: -- Parameter Setup for NACHA_ADDENDA
670: -- First Parameter Value is number of parameters
671: pay_mag_tape.internal_prm_values(1) := '14';
699: -- we do not change the count till after so we can have the same trace number
700: -- in both entry detail and addenda rec
701:
702: g_addenda_count := g_addenda_count + 1;
703: hr_utility.trace('Leaving Addenda');
704:
705: END; /* write_addenda */
706:
707: /******************************************************************
717: PROCEDURE write_org_entry_detail IS
718:
719: BEGIN
720:
721: hr_utility.trace('Writing Org Entry Detail');
722:
723: If g_nacha_balance_flag = 'Y' then
724:
725: g_count := g_count + 1;
733: end if;
734:
735: -- Context Setup for NACHA_ORG_PAY_ENTRY_DETAIL
736: -- first context is number of context values
737: hr_utility.trace('.... Writing Org Entry Detail Context');
738:
739: pay_mag_tape.internal_cxt_values(1) := '3';
740: pay_mag_tape.internal_cxt_names(2) := 'ORG_PAY_METHOD_ID';
741: pay_mag_tape.internal_cxt_values(2) := g_csr_org_pay_meth_id;
744:
745: -- Parameter Setup for NACHA_ORG_PAY_ENTRY_DETAIL
746: -- first parameter is number of parameters
747: -- second parameter is formula is
748: hr_utility.trace('.... Writing Org Entry Detail Parameters');
749:
750: pay_mag_tape.internal_prm_values(1) := '10';
751: pay_mag_tape.internal_prm_values(2) := g_org_pay_entry_detail;
752:
770: CLOSE csr_assignments;
771: else
772: CLOSE csr_assignments_no_rule;
773: end if;
774: hr_utility.set_location('run_formula.org_pay_entry_detail',9);
775:
776: hr_utility.trace('Leaving Org Entry Detail');
777:
778: END; /* write_org_entry_detail */
772: CLOSE csr_assignments_no_rule;
773: end if;
774: hr_utility.set_location('run_formula.org_pay_entry_detail',9);
775:
776: hr_utility.trace('Leaving Org Entry Detail');
777:
778: END; /* write_org_entry_detail */
779:
780:
790:
791: PROCEDURE write_batch_control IS
792:
793: BEGIN
794: hr_utility.trace('Writing Batch Control');
795:
796: g_batch_control_write := 'N';
797:
798: g_hash := g_hash + get_transfer_param ('TRANSFER_ENTRY_HASH');
800:
801: -- Context Setup for NACHA_BATCH_CONTROL
802: -- First context value is number of context values
803:
804: hr_utility.trace('.... Writing Batch Control Context');
805:
806: pay_mag_tape.internal_cxt_values(1) := '4';
807: pay_mag_tape.internal_cxt_names(2) := 'TAX_UNIT_ID';
808: pay_mag_tape.internal_cxt_values(2) := TO_CHAR(g_legal_company_id);
813:
814: -- Parameter Setup for NACHA_BATCH_CONTROL
815: -- First parameter value is number of parameters
816:
817: hr_utility.trace('.... Writing Batch Control Parameters');
818:
819: pay_mag_tape.internal_prm_values(1) := '7';
820: pay_mag_tape.internal_prm_values(2) := g_batch_control;
821:
827:
828: pay_mag_tape.internal_prm_names(7) := 'BATCH_NUMBER';
829: pay_mag_tape.internal_prm_values(7) := TO_CHAR(g_batch_number);
830:
831: hr_utility.set_location('run_formula.Batch_ctrl',9);
832:
833: hr_utility.trace('Leaving Batch Control');
834:
835: END; /* write_batch_control */
829: pay_mag_tape.internal_prm_values(7) := TO_CHAR(g_batch_number);
830:
831: hr_utility.set_location('run_formula.Batch_ctrl',9);
832:
833: hr_utility.trace('Leaving Batch Control');
834:
835: END; /* write_batch_control */
836:
837:
847: PROCEDURE write_file_control IS
848:
849: BEGIN
850:
851: hr_utility.trace('Writing File Control');
852:
853: v_block_count := CEIL(((2 * g_batch_number ) +
854: g_count + g_addenda_count + 2)/10);
855: g_pad_count := (v_block_count * 10) -
855: g_pad_count := (v_block_count * 10) -
856: ((2 * g_batch_number ) +
857: g_count + g_addenda_count + 2);
858:
859: hr_utility.trace('.... Writing File Control Context');
860:
861: -- dscully - added contexts for NACHA_BALANCED_NACHA_FILE DBI
862: pay_mag_tape.internal_cxt_values(1) := '3';
863: pay_mag_tape.internal_cxt_names(2) := 'ORG_PAY_METHOD_ID';
864: pay_mag_tape.internal_cxt_values(2) := g_org_payment_method_id;
865: pay_mag_tape.internal_cxt_names(3) := 'DATE_EARNED';
866: pay_mag_tape.internal_cxt_values(3) := fnd_date.date_to_canonical(g_effective_date);
867:
868: hr_utility.trace('.... Writing File Control Parameters');
869:
870: pay_mag_tape.internal_prm_values(1) := '8';
871: pay_mag_tape.internal_prm_values(2) := g_file_control;
872: pay_mag_tape.internal_prm_names(3) := 'BATCH_NUMBER';
881: pay_mag_tape.internal_prm_values(7) := fnd_number.number_to_canonical(g_amount);
882: pay_mag_tape.internal_prm_names(8) := 'TRANSFER_PAD_COUNT';
883: pay_mag_tape.internal_prm_values(8) := TO_CHAR(g_pad_count);
884: --
885: hr_utility.set_location('run_formula.File_Control',11);
886: hr_utility.trace('Leaving File Control');
887:
888: END; /* write_file_control */
889:
882: pay_mag_tape.internal_prm_names(8) := 'TRANSFER_PAD_COUNT';
883: pay_mag_tape.internal_prm_values(8) := TO_CHAR(g_pad_count);
884: --
885: hr_utility.set_location('run_formula.File_Control',11);
886: hr_utility.trace('Leaving File Control');
887:
888: END; /* write_file_control */
889:
890:
899: PROCEDURE write_padding IS
900:
901: BEGIN
902:
903: hr_utility.trace('Writing Padding');
904:
905: hr_utility.trace('.... Writing Padding Context');
906: pay_mag_tape.internal_cxt_values(1) := '1';
907:
901: BEGIN
902:
903: hr_utility.trace('Writing Padding');
904:
905: hr_utility.trace('.... Writing Padding Context');
906: pay_mag_tape.internal_cxt_values(1) := '1';
907:
908: hr_utility.trace('.... Writing Padding Parameters');
909:
904:
905: hr_utility.trace('.... Writing Padding Context');
906: pay_mag_tape.internal_cxt_values(1) := '1';
907:
908: hr_utility.trace('.... Writing Padding Parameters');
909:
910: pay_mag_tape.internal_prm_values(1) := '3';
911: pay_mag_tape.internal_prm_values(2) := g_padding;
912: pay_mag_tape.internal_prm_names(3) := 'TRANSFER_PAD_COUNT';
911: pay_mag_tape.internal_prm_values(2) := g_padding;
912: pay_mag_tape.internal_prm_names(3) := 'TRANSFER_PAD_COUNT';
913: pay_mag_tape.internal_prm_values(3) := TO_CHAR(g_pad_count);
914:
915: hr_utility.set_location('run_formula.padding',12);
916: IF g_pad_count = 1 THEN
917: CLOSE csr_nacha_batch;
918: ELSE
919: g_pad_count := g_pad_count - 1;
918: ELSE
919: g_pad_count := g_pad_count - 1;
920: END IF;
921:
922: hr_utility.trace('Leaving Padding');
923:
924: END; /* write_padding */
925:
926: /*****************************END of Local Functions ****************/
926: /*****************************END of Local Functions ****************/
927:
928:
929: BEGIN
930: hr_utility.trace('Entering pay_us_nacha_tape.run_formula');
931: pay_mag_tape.internal_prm_names(1) := 'NO_OF_PARAMETERS';
932: pay_mag_tape.internal_prm_names(2) := 'NEW_FORMULA_ID';
933: pay_mag_tape.internal_prm_values(1) := '2';
934:
933: pay_mag_tape.internal_prm_values(1) := '2';
934:
935: pay_mag_tape.internal_cxt_names(1) := 'NUMBER_OF_CONTEXT';
936: pay_mag_tape.internal_cxt_values(1) := '1';
937: hr_utility.set_location('pay_us_nacha_tape.run_formula',1);
938:
939: hr_utility.set_location ('run_formula loop',1);
940:
941: /****************Level 1.1 The first major if clause ***************/
935: pay_mag_tape.internal_cxt_names(1) := 'NUMBER_OF_CONTEXT';
936: pay_mag_tape.internal_cxt_values(1) := '1';
937: hr_utility.set_location('pay_us_nacha_tape.run_formula',1);
938:
939: hr_utility.set_location ('run_formula loop',1);
940:
941: /****************Level 1.1 The first major if clause ***************/
942: IF NOT csr_nacha_batch%ISOPEN and g_business_group_id is NULL THEN
943: /* main */
941: /****************Level 1.1 The first major if clause ***************/
942: IF NOT csr_nacha_batch%ISOPEN and g_business_group_id is NULL THEN
943: /* main */
944:
945: hr_utility.set_location('run_formula.Init',5);
946: g_payroll_action_id := fnd_number.canonical_to_number(
947: pay_mag_tape.internal_prm_values(3));
948:
949: /* Select all the relevent information using payroll action id */
965: and opm.ORG_PAYMENT_METHOD_ID = ppa.org_payment_method_id
966: and ppa.effective_date between opm.EFFECTIVE_START_DATE
967: and opm.EFFECTIVE_END_DATE;
968: if SQL%NOTFOUND then
969: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
970: hr_utility.set_message_token('PROCEDURE','pay_us_nacha_tape');
971: hr_utility.set_message_token('STEP','1');
972: hr_utility.raise_error;
973: end if;
966: and ppa.effective_date between opm.EFFECTIVE_START_DATE
967: and opm.EFFECTIVE_END_DATE;
968: if SQL%NOTFOUND then
969: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
970: hr_utility.set_message_token('PROCEDURE','pay_us_nacha_tape');
971: hr_utility.set_message_token('STEP','1');
972: hr_utility.raise_error;
973: end if;
974:
967: and opm.EFFECTIVE_END_DATE;
968: if SQL%NOTFOUND then
969: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
970: hr_utility.set_message_token('PROCEDURE','pay_us_nacha_tape');
971: hr_utility.set_message_token('STEP','1');
972: hr_utility.raise_error;
973: end if;
974:
975: /* Set The default to Zero */
968: if SQL%NOTFOUND then
969: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
970: hr_utility.set_message_token('PROCEDURE','pay_us_nacha_tape');
971: hr_utility.set_message_token('STEP','1');
972: hr_utility.raise_error;
973: end if;
974:
975: /* Set The default to Zero */
976: g_file_id_modifier := '0';
1024: CLOSE csr_org_flex_info;
1025: END IF;
1026:
1027: IF g_org_payment_method_id is not null THEN
1028: hr_utility.trace('g_org_payment_method_id = ' ||
1029: g_org_payment_method_id);
1030: hr_utility.trace('g_csr_org_pay_third_party = ' ||
1031: g_csr_org_pay_third_party);
1032: write_file_header;
1026:
1027: IF g_org_payment_method_id is not null THEN
1028: hr_utility.trace('g_org_payment_method_id = ' ||
1029: g_org_payment_method_id);
1030: hr_utility.trace('g_csr_org_pay_third_party = ' ||
1031: g_csr_org_pay_third_party);
1032: write_file_header;
1033: ELSE
1034: hr_utility.set_message(801, 'HR_7711_SCL_FLEX_NOT_FOUND');
1030: hr_utility.trace('g_csr_org_pay_third_party = ' ||
1031: g_csr_org_pay_third_party);
1032: write_file_header;
1033: ELSE
1034: hr_utility.set_message(801, 'HR_7711_SCL_FLEX_NOT_FOUND');
1035: hr_utility.raise_error;
1036: END IF;
1037:
1038: OPEN csr_nacha_batch(g_business_group_id,g_payroll_action_id);
1031: g_csr_org_pay_third_party);
1032: write_file_header;
1033: ELSE
1034: hr_utility.set_message(801, 'HR_7711_SCL_FLEX_NOT_FOUND');
1035: hr_utility.raise_error;
1036: END IF;
1037:
1038: OPEN csr_nacha_batch(g_business_group_id,g_payroll_action_id);
1039:
1039:
1040: /****************Level 1.2 The second major else if clause ***************/
1041: ELSE /* main */
1042:
1043: hr_utility.set_location ('run_formula loop',2);
1044:
1045: IF g_addenda_write = 'Y' THEN
1046:
1047: write_addenda;
1059: IF csr_assignments%FOUND THEN
1060:
1061:
1062: IF v_amount > 99999999.99 THEN
1063: hr_utility.set_message(801,'PAY_US_PAYMENT_OVERFLOW');
1064: pay_core_utils.push_message(801,'PAY_US_PAYMENT_OVERFLOW','P');
1065: pay_core_utils.push_token('ASSIGNMENT_NO',g_assignment_id);
1066: raise_application_error(-20101, 'Error in pay_us_nacha_tape.run_formula');
1067:
1069:
1070:
1071: g_overflow_amount := g_overflow_amount + v_amount;
1072:
1073: hr_utility.trace('G_OVERFLOW_AMOUNT is : '|| g_overflow_amount);
1074: hr_utility.trace('G_ROWID value is : '|| g_rowid);
1075:
1076: if g_overflow_amount > 99999999.99 then
1077: g_overflow_amount := 0;
1070:
1071: g_overflow_amount := g_overflow_amount + v_amount;
1072:
1073: hr_utility.trace('G_OVERFLOW_AMOUNT is : '|| g_overflow_amount);
1074: hr_utility.trace('G_ROWID value is : '|| g_rowid);
1075:
1076: if g_overflow_amount > 99999999.99 then
1077: g_overflow_amount := 0;
1078: g_overflow_flag := 'Y';
1094:
1095: g_overflow_amount := g_overflow_amount + v_amount;
1096:
1097: IF v_amount > 99999999.99 THEN
1098: hr_utility.set_message(801,'PAY_US_PAYMENT_OVERFLOW');
1099: pay_core_utils.push_message(801,'PAY_US_PAYMENT_OVERFLOW','P');
1100: pay_core_utils.push_token('ASSIGNMENT_NO',g_assignment_id);
1101: raise_application_error(-20101, 'Error in pay_us_nacha_tape.run_formula');
1102: END IF;
1100: pay_core_utils.push_token('ASSIGNMENT_NO',g_assignment_id);
1101: raise_application_error(-20101, 'Error in pay_us_nacha_tape.run_formula');
1102: END IF;
1103:
1104: hr_utility.trace('G_OVERFLOW_AMOUNT is : '|| g_overflow_amount);
1105: hr_utility.trace('G_ROWID value is : '|| g_rowid);
1106:
1107: if g_overflow_amount > 99999999.99 then
1108: g_overflow_amount := 0;
1101: raise_application_error(-20101, 'Error in pay_us_nacha_tape.run_formula');
1102: END IF;
1103:
1104: hr_utility.trace('G_OVERFLOW_AMOUNT is : '|| g_overflow_amount);
1105: hr_utility.trace('G_ROWID value is : '|| g_rowid);
1106:
1107: if g_overflow_amount > 99999999.99 then
1108: g_overflow_amount := 0;
1109: g_overflow_flag := 'Y';
1122: /****************Level 1.3 The third major else if clause ***************/
1123:
1124: ELSE /* g_addenda_write = 'Y' */
1125:
1126: hr_utility.trace('g_overflow_batch flag is : '|| g_overflow_batch);
1127:
1128: IF g_overflow_batch = 'Y' then
1129: write_batch_header;
1130: ELSE /* g_overflow_batch */
1135: g_nacha_balance_flag;
1136: IF csr_nacha_batch %FOUND THEN
1137:
1138: /* to reset rowid when GRE changes. Bug 1967949 */
1139: hr_utility.trace('b4 g_legal_company_id is : ' || g_legal_company_id);
1140: hr_utility.trace('b4 g_reset_greid is : ' || g_reset_greid);
1141: hr_utility.trace('b4 g_rowid is : ' || g_rowid);
1142:
1143: IF g_reset_greid <> g_legal_company_id then
1136: IF csr_nacha_batch %FOUND THEN
1137:
1138: /* to reset rowid when GRE changes. Bug 1967949 */
1139: hr_utility.trace('b4 g_legal_company_id is : ' || g_legal_company_id);
1140: hr_utility.trace('b4 g_reset_greid is : ' || g_reset_greid);
1141: hr_utility.trace('b4 g_rowid is : ' || g_rowid);
1142:
1143: IF g_reset_greid <> g_legal_company_id then
1144:
1137:
1138: /* to reset rowid when GRE changes. Bug 1967949 */
1139: hr_utility.trace('b4 g_legal_company_id is : ' || g_legal_company_id);
1140: hr_utility.trace('b4 g_reset_greid is : ' || g_reset_greid);
1141: hr_utility.trace('b4 g_rowid is : ' || g_rowid);
1142:
1143: IF g_reset_greid <> g_legal_company_id then
1144:
1145: g_rowid := null;
1146: g_reset_greid := g_legal_company_id;
1147:
1148: END IF;
1149:
1150: hr_utility.trace('a4 g_legal_company_id is : ' || g_legal_company_id);
1151: hr_utility.trace('a4 g_reset_greid is : ' || g_reset_greid);
1152: hr_utility.trace('a4 g_rowid is : ' || g_rowid);
1153:
1154: /* to reset rowid when GRE changes. Bug 1967949 */
1147:
1148: END IF;
1149:
1150: hr_utility.trace('a4 g_legal_company_id is : ' || g_legal_company_id);
1151: hr_utility.trace('a4 g_reset_greid is : ' || g_reset_greid);
1152: hr_utility.trace('a4 g_rowid is : ' || g_rowid);
1153:
1154: /* to reset rowid when GRE changes. Bug 1967949 */
1155:
1148: END IF;
1149:
1150: hr_utility.trace('a4 g_legal_company_id is : ' || g_legal_company_id);
1151: hr_utility.trace('a4 g_reset_greid is : ' || g_reset_greid);
1152: hr_utility.trace('a4 g_rowid is : ' || g_rowid);
1153:
1154: /* to reset rowid when GRE changes. Bug 1967949 */
1155:
1156:
1174:
1175: END run_formula;
1176:
1177: --BEGIN
1178: -- hr_utility.trace_on(null, 'NACHA');
1179: END pay_us_nacha_tape;