[Home] [Help]
669:
670:
671: FND_FILE.put_line(FND_FILE.log, '^Trx Post Processor');
672:
673: p_codepath := jai_general_pkg.plot_codepath(1, p_codepath, 'receipt_transactions_pkg.trx_post_proc', 'START');
674:
675: OPEN c_trx(p_transaction_id);
676: FETCH c_trx INTO r_trx;
677: CLOSE c_trx;
677: CLOSE c_trx;
678:
679: IF r_trx.transaction_type IN ('RECEIVE','MATCH') THEN
680:
681: p_codepath := jai_general_pkg.plot_codepath(2, p_codepath);
682: -- Cenvat Claim is not required for the transaction if the following if condition is satisfied
683: IF r_trx.cenvat_rg_status NOT IN ('Y', 'P', 'E') THEN
684:
685: p_codepath := jai_general_pkg.plot_codepath(3, p_codepath);
681: p_codepath := jai_general_pkg.plot_codepath(2, p_codepath);
682: -- Cenvat Claim is not required for the transaction if the following if condition is satisfied
683: IF r_trx.cenvat_rg_status NOT IN ('Y', 'P', 'E') THEN
684:
685: p_codepath := jai_general_pkg.plot_codepath(3, p_codepath);
686: IF r_trx.item_class IN ('FGIN', 'FGEX') THEN
687: p_codepath := jai_general_pkg.plot_codepath(4, p_codepath);
688: ln_cenvat_amount := 0;
689: ln_cenvat_claimed_ptg := 0;
683: IF r_trx.cenvat_rg_status NOT IN ('Y', 'P', 'E') THEN
684:
685: p_codepath := jai_general_pkg.plot_codepath(3, p_codepath);
686: IF r_trx.item_class IN ('FGIN', 'FGEX') THEN
687: p_codepath := jai_general_pkg.plot_codepath(4, p_codepath);
688: ln_cenvat_amount := 0;
689: ln_cenvat_claimed_ptg := 0;
690: END IF;
691:
748: p_process_status => p_process_status,
749: p_process_message => p_process_message
750: );
751: */
752: p_codepath := jai_general_pkg.plot_codepath(9, p_codepath, 'receipt_transactions_pkg.trx_post_proc', 'END');
753:
754: /* Added by Ramananda for bug#4407165 */
755: EXCEPTION
756: WHEN OTHERS THEN
885: lv_process_message := r_trx.process_message;
886: lv_cenvat_rg_flag := r_trx.cenvat_rg_status;
887: lv_cenvat_rg_message := r_trx.cenvat_rg_message;
888:
889: lv_codepath := jai_general_pkg.plot_codepath(1, lv_codepath, 'receipt_transactions_pkg.process_deferred_cenvat_claim', 'START');
890:
891: SAVEPOINT start_deferred_claim;
892:
893: IF lb_debug THEN
899: OPEN c_receipt_cenvat_dtl(r_trx.tax_transaction_id);
900: FETCH c_receipt_cenvat_dtl INTO r_receipt_cenvat_dtl;
901: CLOSE c_receipt_cenvat_dtl;
902:
903: lv_codepath := jai_general_pkg.plot_codepath(2, lv_codepath);
904:
905: IF r_trx.item_class IN ('CGIN','CGEX') THEN
906:
907: lv_codepath := jai_general_pkg.plot_codepath(3, lv_codepath);
903: lv_codepath := jai_general_pkg.plot_codepath(2, lv_codepath);
904:
905: IF r_trx.item_class IN ('CGIN','CGEX') THEN
906:
907: lv_codepath := jai_general_pkg.plot_codepath(3, lv_codepath);
908: IF r_trx.transaction_type IN ('RECEIVE','MATCH') THEN
909:
910: IF r_receipt_cenvat_dtl.cenvat_claimed_ptg = 0 THEN
911: lv_codepath := jai_general_pkg.plot_codepath(4, lv_codepath);
907: lv_codepath := jai_general_pkg.plot_codepath(3, lv_codepath);
908: IF r_trx.transaction_type IN ('RECEIVE','MATCH') THEN
909:
910: IF r_receipt_cenvat_dtl.cenvat_claimed_ptg = 0 THEN
911: lv_codepath := jai_general_pkg.plot_codepath(4, lv_codepath);
912: lv_2nd_claim_flag := 'N';
913:
914: ELSIF r_receipt_cenvat_dtl.cenvat_claimed_ptg = 100 THEN
915: lv_codepath := jai_general_pkg.plot_codepath(5, lv_codepath);
911: lv_codepath := jai_general_pkg.plot_codepath(4, lv_codepath);
912: lv_2nd_claim_flag := 'N';
913:
914: ELSIF r_receipt_cenvat_dtl.cenvat_claimed_ptg = 100 THEN
915: lv_codepath := jai_general_pkg.plot_codepath(5, lv_codepath);
916: -- Already 100% is Claimed, some problem in code and thats why execution came till here. so process next record
917: GOTO next_record;
918:
919: -- second claim case
918:
919: -- second claim case
920: ELSIF r_receipt_cenvat_dtl.cenvat_claimed_ptg < 100 THEN
921:
922: lv_codepath := jai_general_pkg.plot_codepath(6, lv_codepath);
923: -- 2nd Claim should be done only to the tune of JAI_RCV_CENVAT_CLAIMS.
924: lv_2nd_claim_flag := 'Y';
925:
926: ELSE
923: -- 2nd Claim should be done only to the tune of JAI_RCV_CENVAT_CLAIMS.
924: lv_2nd_claim_flag := 'Y';
925:
926: ELSE
927: lv_codepath := jai_general_pkg.plot_codepath(7, lv_codepath);
928: GOTO next_record;
929: END IF;
930:
931: ELSE
929: END IF;
930:
931: ELSE
932:
933: lv_codepath := jai_general_pkg.plot_codepath(8, lv_codepath);
934: IF r_trx.cenvat_claimed_ptg = 0 THEN
935: lv_2nd_claim_flag := 'N';
936: ELSE
937: lv_codepath := jai_general_pkg.plot_codepath(8.1, lv_codepath);
933: lv_codepath := jai_general_pkg.plot_codepath(8, lv_codepath);
934: IF r_trx.cenvat_claimed_ptg = 0 THEN
935: lv_2nd_claim_flag := 'N';
936: ELSE
937: lv_codepath := jai_general_pkg.plot_codepath(8.1, lv_codepath);
938: -- transactions other than RECEIVE should not be processed for 2nd Claim
939: GOTO next_record;
940: END IF;
941:
941:
942: END IF;
943:
944: ELSE
945: lv_codepath := jai_general_pkg.plot_codepath(9, lv_codepath);
946: lv_2nd_claim_flag := 'N';
947: END IF;
948:
949: IF lv_2nd_claim_flag = 'Y' THEN
966: p_excise_processing_reqd => jai_constants.yes, --File.Sql.35 Cbabu
967: p_vat_processing_reqd => jai_constants.yes --File.Sql.35 Cbabu
968: );
969:
970: lv_codepath := jai_general_pkg.plot_codepath(10, lv_codepath);
971:
972: -- flag value 'X' is removed from the following ELSIF conditions because it is not an ERROR Status. MYXZ
973: IF lv_common_err_mesg IS NOT NULL THEN
974: -- A common error occured. So, Whole Processing for Transaction should be stopped
975: ROLLBACK TO start_deferred_claim;
976: FND_FILE.put_line(FND_FILE.log, '*** Common Error for Transaction_id:'||r_trx.transaction_id
977: ||fnd_global.local_chr(10)||fnd_global.local_chr(9)||'- Error:'||lv_common_err_mesg
978: );
979: lv_codepath := jai_general_pkg.plot_codepath(11, lv_codepath);
980:
981: ELSIF lv_process_flag IN ('E') AND lv_cenvat_rg_flag IN ('E') THEN
982: lv_codepath := jai_general_pkg.plot_codepath(12, lv_codepath);
983: FND_FILE.put_line(FND_FILE.log, '*** FLAGS ERROR *** Transaction_id:'||r_trx.transaction_id
978: );
979: lv_codepath := jai_general_pkg.plot_codepath(11, lv_codepath);
980:
981: ELSIF lv_process_flag IN ('E') AND lv_cenvat_rg_flag IN ('E') THEN
982: lv_codepath := jai_general_pkg.plot_codepath(12, lv_codepath);
983: FND_FILE.put_line(FND_FILE.log, '*** FLAGS ERROR *** Transaction_id:'||r_trx.transaction_id
984: ||fnd_global.local_chr(10)||fnd_global.local_chr(9)||'- ProcessErr:'||lv_process_message
985: ||fnd_global.local_chr(10)||fnd_global.local_chr(9)||'- CenvatErr:'||lv_cenvat_rg_message
986: );
988: ||fnd_global.local_chr(10)||fnd_global.local_chr(9)||'- ProcessErr:'||lv_process_message
989: ||fnd_global.local_chr(10)||fnd_global.local_chr(9)||'- CenvatErr:'||lv_cenvat_rg_message );
990: */
991: ELSIF lv_process_flag IN ('E') THEN
992: lv_codepath := jai_general_pkg.plot_codepath(13, lv_codepath);
993: FND_FILE.put_line(FND_FILE.log, '*** PROCESS ERROR *** Transaction_id:'||r_trx.transaction_id
994: ||fnd_global.local_chr(10)||fnd_global.local_chr(9)||'- ErrorMessage:'||lv_process_message
995: );
996: /*dbms_output.put_line('*** PROCESS ERROR *** Transaction_id:'||r_trx.transaction_id
996: /*dbms_output.put_line('*** PROCESS ERROR *** Transaction_id:'||r_trx.transaction_id
997: ||fnd_global.local_chr(10)||fnd_global.local_chr(9)||'- ErrorMessage:'||lv_process_message );
998: */
999: ELSIF lv_cenvat_rg_flag IN ('E') THEN
1000: lv_codepath := jai_general_pkg.plot_codepath(14, lv_codepath);
1001: FND_FILE.put_line(FND_FILE.log, '*** CENVAT ERROR *** Transaction_id:'||r_trx.transaction_id
1002: ||fnd_global.local_chr(10)||fnd_global.local_chr(9)||'- ErrorMessage:'||lv_cenvat_rg_message
1003: );
1004: /*dbms_output.put_line('*** CENVAT ERROR *** Transaction_id:'||r_trx.transaction_id
1006: );*/
1007: END IF;
1008:
1009: IF lv_process_flag IN ('X') AND lv_cenvat_rg_flag IN ('X') THEN
1010: lv_codepath := jai_general_pkg.plot_codepath(15, lv_codepath);
1011: FND_FILE.put_line(FND_FILE.log, ' Transaction Cant be processed for trx:'||r_trx.transaction_id
1012: ||fnd_global.local_chr(10)||fnd_global.local_chr(9)||'- ProcessMessage(X):'||lv_process_message
1013: ||fnd_global.local_chr(10)||fnd_global.local_chr(9)||'- CenvatMessgae(X):'||lv_cenvat_rg_message
1014: );
1016: ||fnd_global.local_chr(10)||fnd_global.local_chr(9)||'- ProcessMessage(X):'||lv_process_message
1017: ||fnd_global.local_chr(10)||fnd_global.local_chr(9)||'- CenvatMessgae(X):'||lv_cenvat_rg_message);
1018: */
1019: ELSIF lv_process_flag IN ('X') THEN
1020: lv_codepath := jai_general_pkg.plot_codepath(16, lv_codepath);
1021: FND_FILE.put_line(FND_FILE.log, 'Process Message(X):'||lv_process_message);
1022: /*dbms_output.put_line('M: Err4:'||lv_process_message);*/
1023: ELSIF lv_cenvat_rg_flag IN ('X') THEN
1024: lv_codepath := jai_general_pkg.plot_codepath(17, lv_codepath);
1020: lv_codepath := jai_general_pkg.plot_codepath(16, lv_codepath);
1021: FND_FILE.put_line(FND_FILE.log, 'Process Message(X):'||lv_process_message);
1022: /*dbms_output.put_line('M: Err4:'||lv_process_message);*/
1023: ELSIF lv_cenvat_rg_flag IN ('X') THEN
1024: lv_codepath := jai_general_pkg.plot_codepath(17, lv_codepath);
1025: FND_FILE.put_line(FND_FILE.log, 'Cenvat Messgae(X):'||lv_cenvat_rg_message);
1026: /*dbms_output.put_line('M: Err3:'||lv_cenvat_rg_message);*/
1027: END IF;
1028:
1026: /*dbms_output.put_line('M: Err3:'||lv_cenvat_rg_message);*/
1027: END IF;
1028:
1029: IF lv_process_flag = 'E' OR lv_cenvat_rg_flag = 'E' THEN
1030: lv_codepath := jai_general_pkg.plot_codepath(18, lv_codepath);
1031: p_process_flag := lv_cenvat_rg_flag;
1032: p_process_message := lv_cenvat_rg_message;
1033: fnd_file.put_line(fnd_file.log, 'M: Err5:'||p_process_message);
1034: END IF;
1036: -- UNCLAIM PROCESSING
1037: -- following Unclaim Processing will not happen for
1038: ELSIf temp_rec.process_flag = 'U' AND r_trx.transaction_type IN ('RECEIVE', 'MATCH') THEN
1039:
1040: lv_codepath := jai_general_pkg.plot_codepath(19, lv_codepath);
1041: SAVEPOINT start_unclaim;
1042:
1043: -- Costing(Average and Standard)/Expense Logic for Excise Amount
1044:
1051: IF r_trx.organization_type = 'T' THEN
1052: lv_breakup_type := 'RG23D';
1053: END IF;
1054:
1055: lv_codepath := jai_general_pkg.plot_codepath(21, lv_codepath);
1056: jai_rcv_excise_processing_pkg.get_tax_amount_breakup(
1057: p_shipment_line_id => loop_trx.shipment_line_id,
1058: p_transaction_id => loop_trx.transaction_id,
1059: p_curr_conv_rate => r_trx.currency_conversion_rate,
1078: IF ln_process_special_amount = 0 THEN
1079: GOTO skip_unclaim_record;
1080: END IF;
1081:
1082: lv_codepath := jai_general_pkg.plot_codepath(22, lv_codepath);
1083: --lv_codepath := '';
1084: jai_rcv_deliver_rtr_pkg.process_transaction (
1085: p_transaction_id => loop_trx.transaction_id,
1086: p_simulate => p_simulate_flag,
1091: p_process_special_amount => ln_process_special_amount
1092: );
1093:
1094: IF p_process_flag IN ('E', 'X') THEN
1095: lv_codepath := jai_general_pkg.plot_codepath(23, lv_codepath);
1096: FND_FILE.put_line(FND_FILE.log, 'Unclaim PRC_FLG_Error: RollingBack to process_trxn_flag');
1097: /*dbms_output.put_line('Unclaim PRC_FLG_Error: RollingBack to process_trxn_flag');*/
1098: --p_codepath := jai_general_pkg.plot_codepath(6, p_codepath);
1099: ROLLBACK TO start_unclaim;
1094: IF p_process_flag IN ('E', 'X') THEN
1095: lv_codepath := jai_general_pkg.plot_codepath(23, lv_codepath);
1096: FND_FILE.put_line(FND_FILE.log, 'Unclaim PRC_FLG_Error: RollingBack to process_trxn_flag');
1097: /*dbms_output.put_line('Unclaim PRC_FLG_Error: RollingBack to process_trxn_flag');*/
1098: --p_codepath := jai_general_pkg.plot_codepath(6, p_codepath);
1099: ROLLBACK TO start_unclaim;
1100: -- following is to take care that if one transaction of RECEIVE childs fail, then loop should not
1101: -- be executed as the loop is related to CHILDs of RECEIVE Transaction
1102: EXIT;
1100: -- following is to take care that if one transaction of RECEIVE childs fail, then loop should not
1101: -- be executed as the loop is related to CHILDs of RECEIVE Transaction
1102: EXIT;
1103: ElSIF p_process_flag = 'Y' THEN
1104: --p_codepath := jai_general_pkg.plot_codepath(7, p_codepath);
1105: p_process_message := 'Successful';
1106: ELSE
1107: FND_FILE.put_line(FND_FILE.log, 'Unclaim#PRC_FLG#'||p_process_flag);
1108: --p_codepath := jai_general_pkg.plot_codepath(8, p_codepath);
1104: --p_codepath := jai_general_pkg.plot_codepath(7, p_codepath);
1105: p_process_message := 'Successful';
1106: ELSE
1107: FND_FILE.put_line(FND_FILE.log, 'Unclaim#PRC_FLG#'||p_process_flag);
1108: --p_codepath := jai_general_pkg.plot_codepath(8, p_codepath);
1109: /*dbms_output.put_line('Unclaim#PRC_FLG#'||p_process_flag);*/
1110: END IF;
1111:
1112: UPDATE JAI_RCV_TRANSACTIONS
1118: NULL;
1119:
1120: END LOOP;
1121:
1122: lv_codepath := jai_general_pkg.plot_codepath(27, lv_codepath);
1123:
1124: UPDATE JAI_RCV_TRANSACTIONS
1125: SET CENVAT_RG_STATUS = 'X',
1126: cenvat_rg_message = 'Cenvat Unclaimed'
1169: jai_constants.tax_type_cvd_edu_cess, jai_constants.tax_type_sh_exc_edu_cess,
1170: jai_constants.tax_type_sh_cvd_edu_cess) -- By kunkumar for bug 5989740
1171: AND modvat_flag ='Y';
1172:
1173: lv_codepath := jai_general_pkg.plot_codepath(27.1, lv_codepath);
1174:
1175: END IF;
1176:
1177: << next_record >>
1179: If lv_common_err_mesg IS NOT NULL
1180: OR lv_cenvat_rg_flag IN ('E', jai_constants.unexpected_error, jai_constants.expected_error)
1181: THEN
1182:
1183: lv_codepath := jai_general_pkg.plot_codepath(28, lv_codepath);
1184: ROLLBACK TO start_deferred_claim;
1185: p_process_flag := lv_cenvat_rg_flag;
1186: p_process_message := lv_cenvat_rg_message;
1187: ln_errored_cnt := ln_errored_cnt + 1;
1193: WHERE CURRENT OF c_trxs_to_be_claimed;
1194:
1195: ELSE
1196:
1197: lv_codepath := jai_general_pkg.plot_codepath(29, lv_codepath);
1198: -- Finally after the processing is completed, we need to delete the record from temp table
1199: DELETE FROM JAI_RCV_CENVAT_CLAIM_T
1200: WHERE CURRENT OF c_trxs_to_be_claimed;
1201:
1200: WHERE CURRENT OF c_trxs_to_be_claimed;
1201:
1202: END IF;
1203:
1204: lv_codepath := jai_general_pkg.plot_codepath(30, lv_codepath);
1205: fnd_file.put_line(fnd_file.log, 'Trx_id:'||temp_rec.transaction_id||'. Codepath:'||lv_codepath);
1206: /*dbms_output.put_line('Trx_id:'||temp_rec.transaction_id||'. Codepath:'||lv_codepath);*/
1207:
1208: END LOOP;
1914: ||', cenvat_rg_status:'||trx.cenvat_rg_flag
1915: ||', cenvat_claimed_ptg:'||trx.cenvat_claimed_ptg
1916: );
1917:
1918: -- lv_codepath := jai_general_pkg.plot_codepath(1, lv_codepath, 'process_batch', 'start'); /* 1 */
1919:
1920: SAVEPOINT process_trxn;
1921:
1922: lv_process_flag := trx.process_flag;
2287: p_organization_id => ln_organization_id,
2288: p_location_id => ln_location_id,
2289: p_called_from => 'P', -- Required for excise invoice generation for RTV
2290: p_order_invoice_type_id => NULL,
2291: p_fin_year => jai_general_pkg.get_fin_year(ln_organization_id),
2292: p_excise_inv_no => lv_gen_excise_invoice_no,
2293: p_errbuf => lv_errbuf
2294: );
2295:
2707: FND_FILE.put_line(FND_FILE.log, '^Start of Trx:'||p_transaction_id||'. Time:'||to_char(SYSDATE,'dd/mm/yyyy hh24:mi:ss')
2708: ||', PrcSpecialReason:'||p_process_special_reason||', PrcSplQty:'||p_process_special_qty
2709: );
2710:
2711: p_codepath := jai_general_pkg.plot_codepath(1, p_codepath, 'receipt_transactions_pkg.process_transaction', 'START');
2712:
2713: lv_statement_id := '1';
2714:
2715: --added the cursor and 2 assignments here by Ramananda for bug#4519697
2738: p_simulate_flag => p_simulate_flag,
2739: p_codepath => p_codepath
2740: );
2741:
2742: p_codepath := jai_general_pkg.plot_codepath(2, p_codepath);
2743:
2744: -- ERROR occured in Validate transaction. So proceed with next transaction
2745: -- We should not check for 'X' here. Because Cenvat can be 'N' which should be processed
2746: -- process_flag = 'E' means somehow an error occured in Validate transaction
2764: FND_FILE.put_line(FND_FILE.log, lv_object_code||'Localization doesnot support this transaction type');
2765: RETURN;
2766: END IF;
2767:
2768: p_codepath := jai_general_pkg.plot_codepath(3, p_codepath);
2769:
2770: ------------ Start of PROCESS_FLAG Execution ----------
2771: -- IF p_process_flag IN ('N','E') THEN
2772: IF p_simulate_flag = 'Y'
2779: lv_execution_point := 'START_PROCESS_FLAG';
2780:
2781: IF lv_transaction_type IN ( 'RECEIVE', 'RETURN TO VENDOR') THEN
2782: lv_statement_id := '4';
2783: p_codepath := jai_general_pkg.plot_codepath(4, p_codepath);
2784:
2785: jai_rcv_rcv_rtv_pkg.process_transaction(
2786: p_transaction_id => p_transaction_id,
2787: p_simulation => p_simulate_flag,
2793:
2794: ELSIF lv_transaction_type IN ('DELIVER', 'RETURN TO RECEIVING') THEN
2795:
2796: lv_statement_id := '5';
2797: p_codepath := jai_general_pkg.plot_codepath(5, p_codepath);
2798:
2799: jai_rcv_deliver_rtr_pkg.process_transaction (
2800: p_transaction_id => p_transaction_id,
2801: p_simulate => p_simulate_flag,
2812:
2813: lv_statement_id := '6';
2814: IF p_process_flag IN ('E', 'X') THEN
2815: FND_FILE.put_line(FND_FILE.log, 'PRC_FLG_Error: RollingBack to process_trxn_flag');
2816: p_codepath := jai_general_pkg.plot_codepath(6, p_codepath);
2817: ROLLBACK TO process_trxn_flag;
2818: ElSIF p_process_flag = 'Y' THEN
2819: p_codepath := jai_general_pkg.plot_codepath(7, p_codepath);
2820: p_process_message := 'Successful';
2815: FND_FILE.put_line(FND_FILE.log, 'PRC_FLG_Error: RollingBack to process_trxn_flag');
2816: p_codepath := jai_general_pkg.plot_codepath(6, p_codepath);
2817: ROLLBACK TO process_trxn_flag;
2818: ElSIF p_process_flag = 'Y' THEN
2819: p_codepath := jai_general_pkg.plot_codepath(7, p_codepath);
2820: p_process_message := 'Successful';
2821: ELSE
2822: FND_FILE.put_line(FND_FILE.log, '1#PRC_FLG#'||p_process_flag);
2823: p_codepath := jai_general_pkg.plot_codepath(8, p_codepath);
2819: p_codepath := jai_general_pkg.plot_codepath(7, p_codepath);
2820: p_process_message := 'Successful';
2821: ELSE
2822: FND_FILE.put_line(FND_FILE.log, '1#PRC_FLG#'||p_process_flag);
2823: p_codepath := jai_general_pkg.plot_codepath(8, p_codepath);
2824: END IF;
2825:
2826: END IF;
2827:
2863: FND_FILE.put_line(FND_FILE.log, 'ln_part_i_register_id:'||ln_part_i_register_id);
2864:
2865: ELSIF r_trx.item_class IN ('RMIN', 'RMEX', 'CCIN', 'CCEX', 'CGIN', 'CGEX') THEN
2866:
2867: lv_register_type := jai_general_pkg.get_rg_register_type( p_item_class => r_trx.item_class);
2868:
2869: FND_FILE.put_line(FND_FILE.log, 'Register Type:'||lv_register_type);
2870:
2871: -- to determine the way in which CGIN Items are Processed
2943:
2944: IF lv_transaction_type IN ( 'RECEIVE', 'RETURN TO VENDOR', 'DELIVER', 'RETURN TO RECEIVING') THEN
2945: -- this call passes the cenvat related accounting and register entries based on transaction type
2946: lv_statement_id := '8';
2947: p_codepath := jai_general_pkg.plot_codepath(9, p_codepath);
2948:
2949: jai_rcv_excise_processing_pkg.process_transaction(
2950: p_transaction_id => p_transaction_id,
2951: p_process_status => p_cenvat_rg_flag,
2966:
2967: lv_statement_id := '9';
2968: IF p_cenvat_rg_flag IN ('E', 'X') THEN
2969: FND_FILE.put_line(FND_FILE.log, 'CEN_FLG_Error: RollingBack to process_cenvat_rg_flag');
2970: p_codepath := jai_general_pkg.plot_codepath(10, p_codepath);
2971: ROLLBACK TO process_cenvat_rg_flag;
2972: ElSIF p_cenvat_rg_flag = 'Y' THEN
2973: p_cenvat_rg_message := 'Successful';
2974: p_codepath := jai_general_pkg.plot_codepath(11, p_codepath);
2970: p_codepath := jai_general_pkg.plot_codepath(10, p_codepath);
2971: ROLLBACK TO process_cenvat_rg_flag;
2972: ElSIF p_cenvat_rg_flag = 'Y' THEN
2973: p_cenvat_rg_message := 'Successful';
2974: p_codepath := jai_general_pkg.plot_codepath(11, p_codepath);
2975: ELSE
2976: FND_FILE.put_line(FND_FILE.log, '1#CENVAT_FLG#'||p_cenvat_rg_flag);
2977: p_codepath := jai_general_pkg.plot_codepath(12, p_codepath);
2978: END IF;
2973: p_cenvat_rg_message := 'Successful';
2974: p_codepath := jai_general_pkg.plot_codepath(11, p_codepath);
2975: ELSE
2976: FND_FILE.put_line(FND_FILE.log, '1#CENVAT_FLG#'||p_cenvat_rg_flag);
2977: p_codepath := jai_general_pkg.plot_codepath(12, p_codepath);
2978: END IF;
2979:
2980: END IF;
2981:
2982: FND_FILE.put_line(FND_FILE.log, '2#CENVAT_FLG#'||p_cenvat_rg_flag);
2983: /* End of CENVAT_RG_FLAG Execution */
2984:
2985: lv_statement_id := '10';
2986: p_codepath := jai_general_pkg.plot_codepath(13, p_codepath);
2987:
2988: /* Start of VAT Execution. Vijay Shankar for Bug#4250236(4245089) */
2989: IF p_simulate_flag = 'N'
2990: AND -- Vijay Shankar for Bug#4346453. RCV DFF Elim. Enh. lv_process_vat_flag IN ('N', 'E')
3002:
3003: IF lv_transaction_type IN ( 'RECEIVE', 'RETURN TO VENDOR') THEN
3004: -- this call passes the cenvat related accounting and register entries based on transaction type
3005: lv_statement_id := '11';
3006: p_codepath := jai_general_pkg.plot_codepath(14, p_codepath);
3007:
3008: jai_rcv_rgm_claims_pkg.process_vat(
3009: p_transaction_id => p_transaction_id,
3010: p_process_status => lv_process_vat_flag,
3019:
3020: lv_statement_id := '12';
3021: IF lv_process_vat_flag = jai_constants.successful THEN
3022: lv_process_vat_message := 'Successful';
3023: p_codepath := jai_general_pkg.plot_codepath(16, p_codepath);
3024: ELSIF lv_process_vat_flag <> jai_constants.successful THEN
3025: FND_FILE.put_line(FND_FILE.log, 'PrcVatFlg Err: RollingBack to process_vat_flag. Mesg:'||lv_process_vat_message);
3026: p_codepath := jai_general_pkg.plot_codepath(15, p_codepath);
3027: ROLLBACK TO process_vat_flag;
3022: lv_process_vat_message := 'Successful';
3023: p_codepath := jai_general_pkg.plot_codepath(16, p_codepath);
3024: ELSIF lv_process_vat_flag <> jai_constants.successful THEN
3025: FND_FILE.put_line(FND_FILE.log, 'PrcVatFlg Err: RollingBack to process_vat_flag. Mesg:'||lv_process_vat_message);
3026: p_codepath := jai_general_pkg.plot_codepath(15, p_codepath);
3027: ROLLBACK TO process_vat_flag;
3028: ELSE
3029: FND_FILE.put_line(FND_FILE.log, '1#PrcVatFlg#'||lv_process_vat_flag);
3030: p_codepath := jai_general_pkg.plot_codepath(17, p_codepath);
3026: p_codepath := jai_general_pkg.plot_codepath(15, p_codepath);
3027: ROLLBACK TO process_vat_flag;
3028: ELSE
3029: FND_FILE.put_line(FND_FILE.log, '1#PrcVatFlg#'||lv_process_vat_flag);
3030: p_codepath := jai_general_pkg.plot_codepath(17, p_codepath);
3031: END IF;
3032:
3033: END IF;
3034:
3035: FND_FILE.put_line(FND_FILE.log, '2#PrcVatFlg#'||lv_process_vat_flag);
3036: /* End of VAT Execution */
3037:
3038: lv_statement_id := '14';
3039: p_codepath := jai_general_pkg.plot_codepath(18, p_codepath);
3040:
3041: IF p_simulate_flag = 'N' THEN
3042:
3043: jai_rcv_transactions_pkg.update_process_flags(
3058: <
3059:
3060: FND_FILE.put_line(FND_FILE.log, '$End of Trx:'||p_transaction_id||'. Time:'||to_char(SYSDATE,'dd/mm/yyyy hh24:mi:ss'));
3061:
3062: p_codepath := jai_general_pkg.plot_codepath(99, p_codepath, null, 'END');
3063:
3064: EXCEPTION
3065: WHEN OTHERS THEN
3066: p_common_err_mesg := 'RECEIPT_TRANSACTIONS_PKG.process_transaction(StmtId:'||lv_statement_id||'). Error:'||SQLERRM;
3074: ELSE
3075: -- dont update any of the fields of JAI_RCV_TRANSACTIONS table
3076: NULL;
3077: END IF;
3078: p_codepath := jai_general_pkg.plot_codepath(999, p_codepath, null, 'END');
3079:
3080: END process_transaction;
3081:
3082: /* ~~~~~~~~~~~~~~~~~~~~ POPULATION of DETAILS Procedure ~~~~~~~~~~~~~~~~~~~~~~~~*/
3220: IF lb_debug THEN
3221: FND_FILE.put_line(FND_FILE.log, '^ POPULATE_DETAILS');
3222: END IF;
3223:
3224: p_codepath := jai_general_pkg.plot_codepath(1, p_codepath, 'populate_details', 'START');
3225:
3226: OPEN c_base_trx(p_transaction_id);
3227: FETCH c_base_trx INTO r_base_trx;
3228: CLOSE c_base_trx;
3232: FETCH c_trx INTO r_trx;
3233: CLOSE c_trx;
3234:
3235: IF r_base_trx.parent_transaction_id > 0 THEN
3236: p_codepath := jai_general_pkg.plot_codepath(2, p_codepath);
3237: OPEN c_base_trx(r_base_trx.parent_transaction_id);
3238: FETCH c_base_trx INTO r_parent_base_trx;
3239: CLOSE c_base_trx;
3240: END IF;
3271: CLOSE c_excise_invoice_no;
3272: end if;
3273:
3274: IF r_base_trx.transaction_type = 'CORRECT' THEN
3275: p_codepath := jai_general_pkg.plot_codepath(3, p_codepath);
3276: lv_transaction_type := r_parent_base_trx.transaction_type;
3277: ELSE
3278: p_codepath := jai_general_pkg.plot_codepath(4, p_codepath);
3279: lv_transaction_type := r_base_trx.transaction_type;
3274: IF r_base_trx.transaction_type = 'CORRECT' THEN
3275: p_codepath := jai_general_pkg.plot_codepath(3, p_codepath);
3276: lv_transaction_type := r_parent_base_trx.transaction_type;
3277: ELSE
3278: p_codepath := jai_general_pkg.plot_codepath(4, p_codepath);
3279: lv_transaction_type := r_base_trx.transaction_type;
3280: END IF;
3281:
3282: -- Vijay Shankar for Bug#3940588. RECEIPTS DEPLUG
3305:
3306: -- if both location and subinventory are NULL then goto the parent type i.e RTV to RECEIVE and RTR to DELIVER
3307: ELSIF nvl(r_base_trx.location_id, 0) = 0 AND nvl(r_base_trx.subinventory, '-XX') = '-XX' THEN
3308:
3309: p_codepath := jai_general_pkg.plot_codepath(5, p_codepath);
3310: -- following condition added by Vijay Shankar for Bug#4038024. Incase of CORRECT transactions, if location and subinventory
3311: -- are not present, then we need to look at parent transaction for location. this will mostly happen for DIRECT DELIVERY case
3312: IF lv_transaction_type IN ('RETURN TO RECEIVING', 'RETURN TO VENDOR')
3313: OR (r_base_trx.transaction_type = 'CORRECT' AND r_parent_base_trx.transaction_type IN ('RECEIVE', 'DELIVER')) -- BUG#3949502. (3927371)
3312: IF lv_transaction_type IN ('RETURN TO RECEIVING', 'RETURN TO VENDOR')
3313: OR (r_base_trx.transaction_type = 'CORRECT' AND r_parent_base_trx.transaction_type IN ('RECEIVE', 'DELIVER')) -- BUG#3949502. (3927371)
3314: THEN
3315:
3316: p_codepath := jai_general_pkg.plot_codepath(6, p_codepath);
3317: OPEN c_trx(r_base_trx.parent_transaction_id);
3318: FETCH c_trx INTO r_parent_trx;
3319: CLOSE c_trx;
3320:
3323: -- following IF condition added as part of porting from Bug#3949109 (3927371)
3324: -- Incase of Direct Delivery RECEIVE transaction may not have both the location and subinventory. In this case we need to fetch the
3325: -- subinventory from DELIVER transaction
3326: ELSIF lv_transaction_type = 'RECEIVE' AND r_base_trx.routing_header_id = 3 THEN -- this will not execute for correct transactions
3327: p_codepath := jai_general_pkg.plot_codepath(7, p_codepath);
3328: OPEN c_dlry_subinventory(r_base_trx.shipment_line_id, p_transaction_id, 'DELIVER');
3329: FETCH c_dlry_subinventory INTO lv_subinventory;
3330: CLOSE c_dlry_subinventory;
3331:
3334: IF (lv_transaction_type in ('RETURN TO RECEIVING', 'DELIVER') AND nvl(lv_subinventory,'-XX')='-XX')
3335: OR (lv_transaction_type in ('RETURN TO VENDOR', 'RECEIVE') AND nvl(ln_location_id,0)=0 AND nvl(lv_subinventory,'-XX')='-XX' )
3336: THEN
3337:
3338: p_codepath := jai_general_pkg.plot_codepath(8, p_codepath);
3339: IF lv_transaction_type IN ('DELIVER', 'RETURN TO RECEIVING') THEN
3340: lv_required_trx_type := 'DELIVER';
3341: ELSIF lv_transaction_type IN ('RECEIVE', 'RETURN TO VENDOR') THEN
3342: lv_required_trx_type := 'RECEIVE';
3347: p_shipment_line_id => r_base_trx.shipment_line_id,
3348: p_required_trx_type => lv_required_trx_type
3349: );
3350:
3351: p_codepath := jai_general_pkg.plot_codepath(9, p_codepath);
3352: IF ln_ancestor_trxn_id IS NOT NULL THEN
3353: p_codepath := jai_general_pkg.plot_codepath(10, p_codepath);
3354: OPEN c_base_trx(ln_ancestor_trxn_id);
3355: FETCH c_base_trx INTO r_ancestor_dtls;
3349: );
3350:
3351: p_codepath := jai_general_pkg.plot_codepath(9, p_codepath);
3352: IF ln_ancestor_trxn_id IS NOT NULL THEN
3353: p_codepath := jai_general_pkg.plot_codepath(10, p_codepath);
3354: OPEN c_base_trx(ln_ancestor_trxn_id);
3355: FETCH c_base_trx INTO r_ancestor_dtls;
3356: CLOSE c_base_trx;
3357:
3361:
3362: END IF;
3363:
3364: ELSE
3365: p_codepath := jai_general_pkg.plot_codepath(11, p_codepath);
3366: ln_location_id := r_base_trx.location_id;
3367: lv_subinventory := r_base_trx.subinventory;
3368: END IF;
3369:
3381: END IF ;
3382:
3383:
3384: IF lv_subinventory IS NOT NULL THEN
3385: p_codepath := jai_general_pkg.plot_codepath(12, p_codepath);
3386: OPEN c_loc_linked_to_org_subinv(r_base_trx.organization_id, lv_subinventory);
3387: FETCH c_loc_linked_to_org_subinv INTO r_subinv_dtls;
3388: CLOSE c_loc_linked_to_org_subinv;
3389:
3397: Commented the following condition.
3398: OR (r_base_trx.source_document_code = 'REQ' and */
3399: OR nvl(r_subinv_dtls.location_id, 0) <> 0 )
3400: THEN
3401: p_codepath := jai_general_pkg.plot_codepath(13, p_codepath);
3402: ln_location_id := r_subinv_dtls.location_id;
3403: END IF;
3404:
3405: lv_loc_subinv_type := r_subinv_dtls.loc_subinventory_type;
3408: END IF;
3409:
3410: -- IF nvl(ln_location_id, 0) = 0 THEN
3411: IF nvl(ln_location_id, 0) <> 0 THEN
3412: p_codepath := jai_general_pkg.plot_codepath(14, p_codepath);
3413: -- OPEN c_inv_org_linked_to_location(r_base_trx.organization_id);
3414: OPEN c_inv_org_linked_to_location(ln_location_id);
3415: FETCH c_inv_org_linked_to_location INTO ln_organization_id;
3416: CLOSE c_inv_org_linked_to_location;
3415: FETCH c_inv_org_linked_to_location INTO ln_organization_id;
3416: CLOSE c_inv_org_linked_to_location;
3417:
3418: IF r_base_trx.organization_id <> ln_organization_id THEN
3419: p_codepath := jai_general_pkg.plot_codepath(15, p_codepath);
3420: ln_location_id := 0;
3421: END IF;
3422: END IF;
3423:
3428: IF NVL(ln_location_id,0) = 0 THEN
3429: ln_location_id := r_base_trx.location_id;
3430: END IF;
3431:
3432: p_codepath := jai_general_pkg.plot_codepath(16, p_codepath);
3433: ln_tax_amount := get_trxn_tax_amount(
3434: p_transaction_id => p_transaction_id,
3435: p_shipment_line_id => r_base_trx.shipment_line_id,
3436: p_curr_conv_rate => r_base_trx.currency_conversion_rate,
3471: IF lb_debug THEN
3472: FND_FILE.put_line(FND_FILE.log, '... RecNum:'||r_shp_hdr_dtls.receipt_num ||',p_cenvat_amount:'||ln_cenvat_amount );
3473: END IF;
3474:
3475: p_codepath := jai_general_pkg.plot_codepath(17, p_codepath);
3476: jai_rcv_transactions_pkg.update_row(
3477: p_transaction_id => p_transaction_id,
3478: p_parent_transaction_type => r_parent_base_trx.transaction_type,
3479: p_receipt_num => r_shp_hdr_dtls.receipt_num,
3500: p_assessable_value => NULL -- This needs to be populated during Tax Calculation itself
3501: );
3502:
3503:
3504: p_codepath := jai_general_pkg.plot_codepath(18, p_codepath);
3505:
3506: --Start Added by Sanjikum for Bug#4495135
3507: ln_tax_apportion_factor := get_apportion_factor(p_transaction_id);
3508:
3505:
3506: --Start Added by Sanjikum for Bug#4495135
3507: ln_tax_apportion_factor := get_apportion_factor(p_transaction_id);
3508:
3509: p_codepath := jai_general_pkg.plot_codepath(19, p_codepath);
3510: --This update can't be merged with the above, as get_apportion_factor uses the column tax_transaction_id
3511: --which is updated only in the above update
3512:
3513: jai_rcv_transactions_pkg.update_row(
3515: p_tax_apportion_factor => ln_tax_apportion_factor
3516: );
3517: --End Added by Sanjikum for Bug#4495135
3518:
3519: p_codepath := jai_general_pkg.plot_codepath(20, p_codepath, 'populate_details', 'END');
3520:
3521: IF lb_debug THEN
3522: FND_FILE.put_line(FND_FILE.log, '$ POPULATE_DETAILS');
3523: END IF;
3709: ln_rg_count := 0;
3710: ln_rtv_cnt := 0;
3711: lv_codepath := '';
3712:
3713: lv_codepath := jai_general_pkg.plot_codepath(1, lv_codepath, 'cenvat_rg_pkg.validate_trx', 'START');
3714: IF lb_debug THEN
3715: FND_FILE.put_line(FND_FILE.log, '^VALIDATE_TRANSACTION. Prc_Flag->'||p_process_flag||', Cen_Flag->'||p_cenvat_rg_flag);
3716: END IF;
3717:
3731: /* Vijay Shankar for Bug#4250171. following added to support OPM Functionality for VAT Processing */
3732: IF p_called_from = CALLED_FROM_OPM
3733: OR r_trx.attribute_category in (OPM_RECEIPT, OPM_RETURNS)
3734: THEN
3735: lv_codepath := jai_general_pkg.plot_codepath(3, lv_codepath);
3736: p_process_flag := 'X';
3737: p_process_message := 'This Processing not required for OPM Transaction';
3738: p_cenvat_rg_flag := 'X';
3739: p_cenvat_rg_message := 'This Processing not required for OPM Transaction';
3771: OPEN c_taxes(r_trx.shipment_line_id);
3772: FETCH c_taxes into r_taxes;
3773: CLOSE c_taxes;
3774:
3775: lv_codepath := jai_general_pkg.plot_codepath(2, lv_codepath);
3776: lb_process_iso := process_iso_transaction(
3777: p_transaction_id => r_trx.transaction_id,
3778: p_shipment_line_id => r_trx.shipment_line_id
3779: );
3782: /* Process Flag is set to 'O' when some columns which are required are null or some specific scenarios */
3783:
3784: -- values other than 'Y' are added by Vijay Shankar for Bug#3940588. RECEIPTS DEPLUG
3785: IF p_process_flag IN ('Y', 'X', 'O', 'XT') THEN
3786: lv_codepath := jai_general_pkg.plot_codepath(3, lv_codepath);
3787: goto end_of_process_flag_validation;
3788: END IF;
3789:
3790:
3830:
3831: /* 1PROCESS_FLAG. START of PROCESS_FLAG BASIC VALIDATIONS */
3832: lv_statement_id := '6';
3833: if r_trx.organization_id is null then
3834: lv_codepath := jai_general_pkg.plot_codepath(3, lv_codepath);
3835: p_process_flag := 'O';
3836: p_process_message := jai_rcv_trx_processing_pkg.get_message('NO-ORG');
3837: goto end_of_process_flag_validation;
3838: end if;
3842: -- Common Checks between process_flag and cenvat_rg_flag
3843: if lv_transaction_type = 'RETURN TO VENDOR'
3844: AND (r_base_trx.source_document_code='PO' AND r_base_trx.po_header_id IS NULL)
3845: then
3846: lv_codepath := jai_general_pkg.plot_codepath(4, lv_codepath);
3847: p_process_flag := 'X';
3848: p_process_message := 'RTV against Unordered Receipt will not be processed';
3849: goto end_of_process_flag_validation;
3850: end if;
3853: /* 2PROCESS_FLAG. START of TRANSACTION VALIDATIONS To SEE WHETHER IT IS QUALIFIED w.r.t NON CENVAT TAXES(PROCESS_FLAG)*/
3854:
3855: lv_statement_id := '10';
3856: if r_taxes.total_cnt = 0 then
3857: lv_codepath := jai_general_pkg.plot_codepath(5, lv_codepath);
3858: p_process_flag := 'X';
3859: p_process_message := jai_rcv_trx_processing_pkg.get_message('NO-TAXES');
3860: goto end_of_process_flag_validation;
3861: end if;
3862:
3863: lv_statement_id := '11';
3864: -- Vijay Shankar for Bug#4346453. RCV DFF Elim. Enh. IF r_base_trx.attr_cat = 'India RMA Receipt' THEN
3865: if r_base_trx.source_document_code = source_rma then
3866: lv_codepath := jai_general_pkg.plot_codepath(6, lv_codepath);
3867: IF ( lv_transaction_type IN ('RECEIVE', 'RETURN TO VENDOR')
3868: -- Vijay Shankar for Bug#4346453. RCV DFF Elim. Enh. AND UPPER(r_base_trx.rma_type) NOT IN ('SCRAP')
3869: AND r_receipt_line.rma_type NOT IN ('SCRAP')
3870: )
3869: AND r_receipt_line.rma_type NOT IN ('SCRAP')
3870: )
3871: OR lv_transaction_type IN ('DELIVER', 'RETURN TO RECEIVING')
3872: THEN
3873: lv_codepath := jai_general_pkg.plot_codepath(7, lv_codepath);
3874: --Added the below by rchandan for Bug#6030615
3875: OPEN c_trx(p_transaction_id);
3876: FETCH c_trx into r_trx;
3877: CLOSE c_trx;
3883: -- Vijay Shankar for Bug#4346453. RCV DFF Elim. Enh. AND UPPER(r_base_trx.rma_type) IN ('SCRAP')
3884: AND r_receipt_line.rma_type IN ('SCRAP')
3885: AND r_taxes.excise_cnt = 0
3886: THEN
3887: lv_codepath := jai_general_pkg.plot_codepath(8, lv_codepath);
3888: p_process_flag := 'X';
3889: p_process_message := 'Excise Taxes donot exist in this RMA transaction';
3890: goto end_of_process_flag_validation;
3891: END IF;
3893: END IF;
3894:
3895: lv_statement_id := '12';
3896: IF NOT lb_process_iso THEN
3897: lv_codepath := jai_general_pkg.plot_codepath(9, lv_codepath);
3898: p_process_flag := 'X';
3899: p_process_message := 'ISO Processing Not Required';
3900: goto end_of_process_flag_validation;
3901: END IF;
3905: lv_statement_id := '13';
3906: --Ensures that if the Parent lines Accounting is not done, then the Accounting for this Line
3907: --would also be deferred.
3908: if r_trx.transaction_type = 'CORRECT' AND r_trx.parent_transaction_type in ('DELIVER','RETURN TO RECEIVING') then
3909: lv_codepath := jai_general_pkg.plot_codepath(10, lv_codepath);
3910: /* Fetch the Accounting of the parent transaction line */
3911: OPEN c_acct_count(r_trx.parent_transaction_id, r_trx.parent_transaction_type);
3912: FETCH c_acct_count into ln_account_count;
3913: CLOSE c_acct_count;
3912: FETCH c_acct_count into ln_account_count;
3913: CLOSE c_acct_count;
3914:
3915: if ln_account_count = 0 then
3916: lv_codepath := jai_general_pkg.plot_codepath(11, lv_codepath);
3917: p_process_flag := 'P';
3918: p_process_message := jai_rcv_trx_processing_pkg.get_message('NO-BASE-ACCT');
3919: goto end_of_process_flag_validation;
3920: end if;
3930:
3931: lv_statement_id := '14';
3932: -- values other than 'Y' are added by Vijay Shankar for Bug#3940588. RECEIPTS DEPLUG
3933: IF p_cenvat_rg_flag IN ('Y', 'X', 'O', 'XT') THEN
3934: lv_codepath := jai_general_pkg.plot_codepath(12, lv_codepath);
3935: goto end_of_cenvat_flag_validation;
3936: END IF;
3937:
3938: -- following condition is false if the call to this procedure happened from JAINMVAT (i.e deferred Claim Scree)
3942:
3943: lv_statement_id := '15';
3944: /* 1CENVAT_RG_FLAG. START of CENVAT_RG_FLAG BASIC VALIDATIONS */
3945: if r_trx.organization_id is null then
3946: lv_codepath := jai_general_pkg.plot_codepath(13, lv_codepath);
3947: p_cenvat_rg_flag := 'O';
3948: p_cenvat_rg_message := jai_rcv_trx_processing_pkg.get_message('NO-ORG');
3949:
3950: goto end_of_cenvat_flag_validation;
3951: end if;
3952:
3953: lv_statement_id := '16';
3954: if r_trx.location_id = 0 then
3955: lv_codepath := jai_general_pkg.plot_codepath(14, lv_codepath);
3956: p_cenvat_rg_flag := 'O';
3957: p_cenvat_rg_message := jai_rcv_trx_processing_pkg.get_message('NO-LOC-ORG-SETUP');
3958: goto end_of_cenvat_flag_validation;
3959: end if;
3963: lv_statement_id := '17';
3964: if lv_transaction_type = 'RETURN TO VENDOR'
3965: AND (r_base_trx.source_document_code='PO' AND r_base_trx.po_header_id IS NULL)
3966: then
3967: lv_codepath := jai_general_pkg.plot_codepath(15, lv_codepath);
3968: p_cenvat_rg_flag := 'X';
3969: p_cenvat_rg_message := 'RTV against Unordered Receipt will not be processed';
3970: goto end_of_cenvat_flag_validation;
3971: end if;
3971: end if;
3972:
3973: lv_statement_id := '18';
3974: if r_taxes.total_cnt = 0 then
3975: lv_codepath := jai_general_pkg.plot_codepath(16, lv_codepath);
3976: p_cenvat_rg_flag := 'X';
3977: p_cenvat_rg_message := jai_rcv_trx_processing_pkg.get_message('NO-TAXES');
3978: goto end_of_cenvat_flag_validation;
3979: end if;
3981: lv_statement_id := '19';
3982: if r_trx.transaction_type NOT IN ('RECEIVE', 'MATCH')
3983: AND r_receipt_cenvat_dtl.unclaim_cenvat_flag = 'Y'
3984: then
3985: lv_codepath := jai_general_pkg.plot_codepath(17, lv_codepath);
3986: p_cenvat_rg_flag := 'X';
3987: p_cenvat_rg_message := 'Parent is not eligible for Cenvat Claim';
3988: goto end_of_cenvat_flag_validation;
3989: end if;
3988: goto end_of_cenvat_flag_validation;
3989: end if;
3990:
3991: if r_taxes.excise_cnt = 0 then
3992: lv_codepath := jai_general_pkg.plot_codepath(18, lv_codepath);
3993: p_cenvat_rg_flag := 'X';
3994: p_cenvat_rg_message := 'Excise Taxes do not exist';
3995: goto end_of_cenvat_flag_validation;
3996: end if;
4001: close c_excise_tax_count;
4002:
4003: lv_statement_id := '21';
4004: if r_trx.organization_type = 'M' AND ln_excise_tax_count = 0 then
4005: lv_codepath := jai_general_pkg.plot_codepath(19, lv_codepath);
4006: p_cenvat_rg_flag := 'X';
4007: p_cenvat_rg_message := jai_rcv_trx_processing_pkg.get_message('NO-EXCISE-TAXES');
4008: goto end_of_cenvat_flag_validation;
4009: end if;
4008: goto end_of_cenvat_flag_validation;
4009: end if;
4010:
4011: if r_trx.organization_type = 'T' AND lv_transaction_type IN ('DELIVER', 'RETURN TO RECEIVING') then
4012: lv_codepath := jai_general_pkg.plot_codepath(20, lv_codepath);
4013: p_cenvat_rg_flag := 'X';
4014: p_cenvat_rg_message := 'No Cenvat/RG Entries are passed for '||lv_transaction_type;
4015: goto end_of_cenvat_flag_validation;
4016: end if;
4017:
4018: lv_statement_id := '22';
4019: if lv_transaction_type = 'RETURN TO VENDOR' then
4020:
4021: lv_codepath := jai_general_pkg.plot_codepath(21, lv_codepath);
4022: if r_trx.transaction_type = 'CORRECT' THEN
4023: lv_statement_id := '23';
4024: SELECT count(1) INTO ln_rtv_cnt
4025: FROM JAI_RCV_RTV_DTLS
4026: WHERE transaction_id = r_trx.parent_transaction_id;
4027:
4028: lv_statement_id := '24';
4029: if ln_rtv_cnt = 0 THEN
4030: lv_codepath := jai_general_pkg.plot_codepath(22, lv_codepath);
4031: p_cenvat_rg_flag := 'X';
4032: p_cenvat_rg_message := 'Parent RTV Transaction doesnt have Excise Invoice';
4033: goto end_of_cenvat_flag_validation;
4034: end if;
4048: /*
4049: || The above if was added by ssumaith for Iprocurement Bug#4281841.
4050: */
4051: --pramasub FP end IProc
4052: lv_codepath := jai_general_pkg.plot_codepath(23, lv_codepath);
4053: lv_excise_inv_gen_action := r_trx.attribute1; -- Vijay Shankar for Bug#4346453. RCV DFF Elim. Enh.
4054: p_cenvat_rg_flag := 'X';
4055: -- Vijay Shankar for Bug#4346453. RCV DFF Elim. Enh. p_cenvat_rg_message := 'DFF Value for Generate Excise Invoice is not given as ''Y''';
4056: p_cenvat_rg_message := 'Excise invoice not required';
4088:
4089: lv_statement_id := '25';
4090: if r_trx.organization_type = 'T' then
4091: if r_trx.item_trading_flag <> 'Y' then
4092: lv_codepath := jai_general_pkg.plot_codepath(24, lv_codepath);
4093: p_cenvat_rg_flag := 'O';
4094: p_cenvat_rg_message := jai_rcv_trx_processing_pkg.get_message('ITEM-TRADING-NO');
4095: goto end_of_cenvat_flag_validation;
4096: elsif r_trx.item_excisable <> 'Y' then
4093: p_cenvat_rg_flag := 'O';
4094: p_cenvat_rg_message := jai_rcv_trx_processing_pkg.get_message('ITEM-TRADING-NO');
4095: goto end_of_cenvat_flag_validation;
4096: elsif r_trx.item_excisable <> 'Y' then
4097: lv_codepath := jai_general_pkg.plot_codepath(25, lv_codepath);
4098: p_cenvat_rg_flag := 'O';
4099: p_cenvat_rg_message := 'Trading Item is not Excisable';
4100: goto end_of_cenvat_flag_validation;
4101: end if;
4102: end if;
4103:
4104: lv_statement_id := '26';
4105: if r_trx.item_class in ('OTIN','OTEX') then
4106: lv_codepath := jai_general_pkg.plot_codepath(26, lv_codepath);
4107: p_cenvat_rg_flag := 'O';
4108: p_cenvat_rg_message := jai_rcv_trx_processing_pkg.get_message('ITEM-CLASS-OTIN');
4109: goto end_of_cenvat_flag_validation;
4110: elsif r_trx.item_class NOT IN ('RMIN', 'RMEX', 'CGIN', 'CGEX', 'CCIN', 'CCEX', 'FGIN', 'FGEX') then
4107: p_cenvat_rg_flag := 'O';
4108: p_cenvat_rg_message := jai_rcv_trx_processing_pkg.get_message('ITEM-CLASS-OTIN');
4109: goto end_of_cenvat_flag_validation;
4110: elsif r_trx.item_class NOT IN ('RMIN', 'RMEX', 'CGIN', 'CGEX', 'CCIN', 'CCEX', 'FGIN', 'FGEX') then
4111: lv_codepath := jai_general_pkg.plot_codepath(27, lv_codepath);
4112: p_cenvat_rg_flag := 'O';
4113: p_cenvat_rg_message := jai_rcv_trx_processing_pkg.get_message('ITEM-CLASS-NULL');
4114: goto end_of_cenvat_flag_validation;
4115: end if;
4121: --commented the above and added the below by rchandan for Bug#6030615
4122: if r_base_trx.source_document_code NOT IN ('RMA','INVENTORY') and r_trx.item_class in ('FGIN', 'FGEX')
4123: and r_trx.organization_type = 'M' -- Changed by Vijay Shanker for Bug #4172424
4124: then
4125: p_codepath := jai_general_pkg.plot_codepath(28, p_codepath);
4126: p_cenvat_rg_flag := 'X';
4127: p_cenvat_rg_message := 'Cenvat Accounting not supported for FGIN Items';
4128: goto end_of_cenvat_flag_validation;
4129: end if;
4129: end if;
4130:
4131: lv_statement_id := '28';
4132: if r_trx.organization_type ='M' and r_trx.item_cenvatable = 'N' then
4133: lv_codepath := jai_general_pkg.plot_codepath(29, lv_codepath);
4134: p_cenvat_rg_flag := 'O';
4135: p_cenvat_rg_message := jai_rcv_trx_processing_pkg.get_message('ITEM-CENVATABLE-NO');
4136: goto end_of_cenvat_flag_validation;
4137: end if;
4145: IF r_base_trx.source_document_code = SOURCE_RMA
4146: AND r_receipt_line.rma_type NOT IN ('PRODUCTION INPUT', 'GOODS RETURN')
4147: THEN
4148: /* ENd of bug 5378630 */
4149: lv_codepath := jai_general_pkg.plot_codepath(30, lv_codepath);
4150: p_cenvat_rg_flag := 'X';
4151: p_cenvat_rg_message := 'RMA Processing Not Required';
4152: goto end_of_cenvat_flag_validation;
4153: END IF;
4155: /* Fetch whether RG has been hit */
4156: if r_trx.transaction_type = 'CORRECT' then
4157:
4158: lv_statement_id := '30';
4159: lv_codepath := jai_general_pkg.plot_codepath(31, lv_codepath);
4160: if r_trx.parent_transaction_type in ('RECEIVE', 'RETURN TO VENDOR') then
4161:
4162: lv_codepath := jai_general_pkg.plot_codepath(32, lv_codepath);
4163: if r_trx.organization_type = 'M' then
4158: lv_statement_id := '30';
4159: lv_codepath := jai_general_pkg.plot_codepath(31, lv_codepath);
4160: if r_trx.parent_transaction_type in ('RECEIVE', 'RETURN TO VENDOR') then
4161:
4162: lv_codepath := jai_general_pkg.plot_codepath(32, lv_codepath);
4163: if r_trx.organization_type = 'M' then
4164: lv_statement_id := '32';
4165: open c_rg_count(r_trx.parent_transaction_id, r_trx.organization_id);
4166: -- fetch c_rg_count into ln_rg_count;
4173: close c_parent_rg23d_entry;
4174: end if;
4175:
4176: if to_char(ld_parent_rg_entry_date, 'YYYYMM') <> to_char(SYSDATE, 'YYYYMM') THEN
4177: lv_codepath := jai_general_pkg.plot_codepath(33, lv_codepath);
4178: p_cenvat_rg_flag := 'XT';
4179: p_cenvat_rg_message := jai_rcv_trx_processing_pkg.get_message('BASE-MONTH-DIFFERENT');
4180: goto end_of_cenvat_flag_validation;
4181: end if;
4182:
4183: else
4184:
4185: lv_statement_id := '35';
4186: lv_codepath := jai_general_pkg.plot_codepath(34, lv_codepath);
4187: OPEN c_trx(r_trx.parent_transaction_id);
4188: FETCH c_trx into r_parent_trx;
4189: CLOSE c_trx;
4190:
4188: FETCH c_trx into r_parent_trx;
4189: CLOSE c_trx;
4190:
4191: if to_char(r_trx.transaction_date, 'YYYYMM') <> to_char(r_parent_trx.transaction_date, 'YYYYMM') THEN
4192: lv_codepath := jai_general_pkg.plot_codepath(35, lv_codepath);
4193: p_cenvat_rg_flag := 'XT';
4194: p_cenvat_rg_message := jai_rcv_trx_processing_pkg.get_message('BASE-MONTH-DIFFERENT');
4195: goto end_of_cenvat_flag_validation;
4196: end if;
4199:
4200: -- we dont do validation for ISO in case of trading because RG23D Entry should be passed even if accounting is not required
4201: lv_statement_id := '36';
4202: IF NOT lb_process_iso AND r_trx.organization_type = 'M' THEN
4203: lv_codepath := jai_general_pkg.plot_codepath(36, lv_codepath);
4204: p_cenvat_rg_flag := 'X';
4205: p_cenvat_rg_message := 'ISO Processing Not Required';
4206: goto end_of_cenvat_flag_validation;
4207: END IF;
4207: END IF;
4208:
4209: IF lv_transaction_type IN ('DELIVER', 'RETURN TO RECEIVING') THEN
4210:
4211: lv_codepath := jai_general_pkg.plot_codepath(37, lv_codepath);
4212: lv_statement_id := '37';
4213:
4214: -- this call is specific to DELIVER and RTR transactions
4215: lv_include_cenvat_in_cost := jai_rcv_deliver_rtr_pkg.include_cenvat_in_costing(
4221:
4222: lv_statement_id := '38';
4223: -- If cenvat is included in costing, then we need to reverse cenvat entries that are passed during RECEIVE Trxn
4224: IF lv_include_cenvat_in_cost = 'N' THEN
4225: lv_codepath := jai_general_pkg.plot_codepath(38, lv_codepath);
4226: p_cenvat_rg_flag := 'X';
4227: p_cenvat_rg_message := 'Cenvat Entries not Applicable for transaction type';
4228: goto end_of_cenvat_flag_validation;
4229: END IF;
4235: /* 3CENVAT_RG_FLAG. START of TRANSACTION VALIDATIONS To SEE WHETHER IT IS PENDING FOR SOMETHING INSPITE OF BEING QUALIFIED for PROCESSING*/
4236: lv_statement_id := '39';
4237: if r_trx.transaction_type = 'CORRECT' AND r_trx.parent_transaction_type in ('RECEIVE', 'RETURN TO VENDOR') then
4238: if ld_parent_rg_entry_date IS NULL then
4239: lv_codepath := jai_general_pkg.plot_codepath(39, lv_codepath);
4240: p_cenvat_rg_flag := 'P';
4241: p_cenvat_rg_message := jai_rcv_trx_processing_pkg.get_message('NO-BASE-RG');
4242: goto end_of_cenvat_flag_validation;
4243: end if;
4252: AND p_called_from<>'JAINMVAT'
4253: )
4254: )
4255: THEN
4256: lv_codepath := jai_general_pkg.plot_codepath(40, lv_codepath);
4257: p_cenvat_rg_flag := 'P';
4258: p_cenvat_rg_message := 'Pending for Claim';
4259: goto end_of_cenvat_flag_validation;
4260: END IF;
4264: lv_statement_id := '41';
4265: IF r_trx.transaction_type NOT IN ('RECEIVE', 'MATCH')
4266: AND nvl(r_receipt_cenvat_dtl.cenvat_claimed_amt,0) = 0 AND nvl(r_receipt_cenvat_dtl.cenvat_amount,0) <> 0
4267: THEN
4268: lv_codepath := jai_general_pkg.plot_codepath(41, lv_codepath);
4269: p_cenvat_rg_flag := 'P';
4270: p_cenvat_rg_message := 'Pending for Receipt Line Claim'; -- - '||lv_transaction_type;
4271: goto end_of_cenvat_flag_validation;
4272: END IF;
4275: -- Updation of excise invoice number for all transactions other than RTV
4276: if lv_transaction_type <> 'RETURN TO VENDOR' and r_trx.excise_invoice_no is null then
4277:
4278: lv_statement_id := '42';
4279: lv_codepath := jai_general_pkg.plot_codepath(42, lv_codepath);
4280: OPEN c_excise_invoice_no(r_trx.shipment_line_id);
4281: FETCH c_excise_invoice_no INTO r_exc_inv_no;
4282: CLOSE c_excise_invoice_no;
4283:
4302: end if;
4303:
4304: /* following condition added as part of DFF elimination. Vijay Shankar for Bug#4346453. RCV DFF Elim. Enh. */
4305: if r_trx.process_vat_status in (jai_constants.yes, 'X', 'O') then
4306: lv_codepath := jai_general_pkg.plot_codepath(42.0, lv_codepath);
4307: goto end_of_vat_validation;
4308: end if;
4309:
4310: if r_trx.location_id = 0 then
4307: goto end_of_vat_validation;
4308: end if;
4309:
4310: if r_trx.location_id = 0 then
4311: lv_codepath := jai_general_pkg.plot_codepath(42.1, lv_codepath);
4312: p_process_vat_flag := 'O';
4313: p_process_vat_message := jai_rcv_trx_processing_pkg.get_message('NO-LOC-ORG-SETUP');
4314: goto end_of_vat_validation;
4315: end if;
4315: end if;
4316:
4317: IF lv_transaction_type NOT IN ( 'RECEIVE', 'RETURN TO VENDOR') THEN
4318: lv_statement_id := '42.1';
4319: lv_codepath := jai_general_pkg.plot_codepath(42.2, lv_codepath);
4320: p_process_vat_flag := 'X';
4321: p_process_vat_message := 'VAT Processing not required for this Transaction Type';
4322: GOTO end_of_vat_validation;
4323: END IF;
4327: CLOSE c_recoverable_vat_tax_cnt;
4328:
4329: IF ln_recoverable_vat_tax_cnt = 0 THEN
4330: lv_statement_id := '42.2';
4331: lv_codepath := jai_general_pkg.plot_codepath(42.3, lv_codepath);
4332: p_process_vat_flag := 'X';
4333: p_process_vat_message := 'No VAT Taxes exist for receipt line';
4334: GOTO end_of_vat_validation;
4335: END IF;
4356: /* Excise */
4357: --if p_called_from in (CALLED_FROM_RCV_TRIGGER, CALLED_FROM_FND_REQUEST) then
4358: if lv_excise_inv_gen_action is null and r_trx.attribute1 is null then -- and r_trx.attribute3 is null then
4359: lv_statement_id := '60';
4360: lv_codepath := jai_general_pkg.plot_codepath(60, lv_codepath);
4361: /* Flag is set to 'P' only if validations that set the flag as 'X' are done */
4362: if p_cenvat_rg_flag in ('N', 'P') then -- FLAG 'P' is not considered as the transaction will be processed again and FLAG will be set to 'N'
4363: lv_excise_inv_gen_action := INV_GEN_STATUS_PENDING;
4364: elsif p_cenvat_rg_flag in ('X', 'O', 'XT') then
4366: end if;
4367:
4368: elsif p_called_from = CALLED_FROM_JAITIGRTV and r_trx.attribute1 = INV_GEN_STATUS_INV_NA then
4369: lv_statement_id := '61';
4370: lv_codepath := jai_general_pkg.plot_codepath(61, lv_codepath);
4371: p_cenvat_rg_flag := 'X';
4372: p_cenvat_rg_message := 'Excise Invoice is not applicable';
4373: end if;
4374:
4374:
4375: /* VAT */
4376: if lv_vat_inv_gen_action is null and r_trx.attribute2 is null then -- and r_trx.attribute4 is null then
4377: lv_statement_id := '62';
4378: lv_codepath := jai_general_pkg.plot_codepath(62, lv_codepath);
4379: if p_process_vat_flag in ('N') then
4380: lv_vat_inv_gen_action := INV_GEN_STATUS_PENDING;
4381: elsif p_process_vat_flag in ('X', 'O') then
4382: lv_vat_inv_gen_action := INV_GEN_STATUS_NA;
4384: end if;
4385: end if;
4386:
4387: IF p_simulate_flag = 'N' THEN
4388: lv_codepath := jai_general_pkg.plot_codepath(43, lv_codepath);
4389: lv_statement_id := '43';
4390: /* Call to update the Flag values as the validation is completed */
4391: jai_rcv_transactions_pkg.update_process_flags(
4392: p_transaction_id => p_transaction_id,
4422: END IF;
4423:
4424: -- this is the final place where we assign the value to p_codepath from local codepath
4425: lv_statement_id := '49';
4426: p_codepath := jai_general_pkg.plot_codepath(lv_codepath||',49', p_codepath, 'cenvat_rg_pkg.validate_trx', 'END');
4427: -- p_codepath := substr(p_codepath||lv_codepath, 1, 2000);
4428:
4429: FND_FILE.put_line( fnd_file.log, '$ VALIDATE_TRANSACTION PrcFlg:'||p_process_flag||', Msg:'||p_process_message
4430: ||', CenvatRgFlg:'||p_cenvat_rg_flag ||', Msg:'||p_cenvat_rg_message
4436: when others then
4437: p_process_flag := 'E';
4438: p_process_message := 'RECEIPT_TRANSACTION_PKG.Validate_transaction:'||SQLERRM||', Statement_id:'||lv_statement_id;
4439: FND_FILE.put_line( fnd_file.log, 'Error in '||p_process_message||'. localErrorPath:'||lv_codepath );
4440: p_codepath := jai_general_pkg.plot_codepath(lv_codepath||',-999', p_codepath, 'cenvat_rg_pkg.validate_trx', 'END');
4441:
4442: END validate_transaction;
4443:
4444:
4609: -- This cursor gives tax_amount in FOREIGN Currency
4610: CURSOR c_tax_amount(cp_shipment_line_id IN NUMBER, cp_curr_conv_rate IN NUMBER) IS
4611: SELECT
4612: sum(
4613: nvl(tax_amount, 0) / decode(currency, jai_general_pkg.INDIAN_CURRENCY, cp_curr_conv_rate, 1)
4614: ) non_inr_tax_amount,
4615: sum(
4616: nvl(tax_amount, 0) * decode(currency, jai_general_pkg.INDIAN_CURRENCY, 1, cp_curr_conv_rate)
4617: ) inr_tax_amount
4612: sum(
4613: nvl(tax_amount, 0) / decode(currency, jai_general_pkg.INDIAN_CURRENCY, cp_curr_conv_rate, 1)
4614: ) non_inr_tax_amount,
4615: sum(
4616: nvl(tax_amount, 0) * decode(currency, jai_general_pkg.INDIAN_CURRENCY, 1, cp_curr_conv_rate)
4617: ) inr_tax_amount
4618: FROM JAI_RCV_LINE_TAXES
4619: WHERE shipment_line_id = cp_shipment_line_id
4620: AND tax_type NOT IN ('TDS', 'Modvat Recovery');
4657: CURSOR c_tax_amount(cp_shipment_line_id IN NUMBER, cp_curr_conv_rate IN NUMBER, cp_organization_type IN VARCHAR2) IS
4658: SELECT
4659: sum(
4660: nvl(a.tax_amount, 0) * (b.mod_cr_percentage/100)
4661: * decode(a.currency, jai_general_pkg.INDIAN_CURRENCY, 1, cp_curr_conv_rate)
4662: ) manufacturing_cenvat,
4663: sum(
4664: nvl(a.tax_amount, 0) * decode(a.currency, jai_general_pkg.INDIAN_CURRENCY, 1, cp_curr_conv_rate)
4665: ) trading_cenvat
4660: nvl(a.tax_amount, 0) * (b.mod_cr_percentage/100)
4661: * decode(a.currency, jai_general_pkg.INDIAN_CURRENCY, 1, cp_curr_conv_rate)
4662: ) manufacturing_cenvat,
4663: sum(
4664: nvl(a.tax_amount, 0) * decode(a.currency, jai_general_pkg.INDIAN_CURRENCY, 1, cp_curr_conv_rate)
4665: ) trading_cenvat
4666: FROM JAI_RCV_LINE_TAXES a, JAI_CMN_TAXES_ALL b
4667: WHERE shipment_line_id = cp_shipment_line_id
4668: AND a.tax_id = b.tax_id
4753: CLOSE c_base_trx;
4754:
4755: lv_trxn_uom_code := r_trx.uom_code;
4756: lv_tax_uom_code := nvl(r_tax_trx.uom_code,
4757: jai_general_pkg.get_uom_code( p_uom => r_tax_trx.unit_of_measure)
4758: );
4759:
4760: IF lv_trxn_uom_code = lv_tax_uom_code THEN
4761: ln_uom_conv_rate := 1;
4759:
4760: IF lv_trxn_uom_code = lv_tax_uom_code THEN
4761: ln_uom_conv_rate := 1;
4762: ELSE
4763: ln_uom_conv_rate := jai_general_pkg.trxn_to_primary_conv_rate(
4764: p_transaction_uom_code => lv_trxn_uom_code,
4765: p_primary_uom_code => lv_tax_uom_code,
4766: p_inventory_item_id => r_trx.inventory_item_id
4767: );
4831: CLOSE c_base_trx;
4832:
4833: lv_trxn_uom_code := r_trx.uom_code;
4834: lv_tax_uom_code := nvl(r_tax_trx.uom_code,
4835: jai_general_pkg.get_uom_code( p_uom => r_tax_trx.unit_of_measure)
4836: );
4837:
4838: IF lv_trxn_uom_code = lv_tax_uom_code THEN
4839: ln_uom_conv_rate := 1;
4837:
4838: IF lv_trxn_uom_code = lv_tax_uom_code THEN
4839: ln_uom_conv_rate := 1;
4840: ELSE
4841: ln_uom_conv_rate := jai_general_pkg.trxn_to_primary_conv_rate(
4842: p_transaction_uom_code => lv_trxn_uom_code,
4843: p_primary_uom_code => lv_tax_uom_code,
4844: p_inventory_item_id => r_trx.inventory_item_id
4845: );