DBA Data[Home] [Help]

APPS.JAI_CMN_RGM_PROCESSING_PKG dependencies on JAI_CONSTANTS

Line 322: IF p_inv_accounting_chk_done = jai_constants.no THEN

318: g_debug := 'Y';
319: lv_codepath := jai_general_pkg.plot_codepath(1,lv_codepath, 'PROCESS_PAYMENT', 'START');
320:
321: -- Accounting check for the invoice_distribution, whether it is accounted or not
322: IF p_inv_accounting_chk_done = jai_constants.no THEN
323: OPEN c_invoice_distribution(p_inv_dist_id);
324: FETCH c_invoice_distribution INTO r_dist;
325: CLOSE c_invoice_distribution;
326:

Line 336: p_process_flag := jai_constants.not_accounted;

332: IF g_debug='Y' THEN
333: fnd_file.put_line(fnd_file.log,'AccntChkFail. InvId,LineNum,DisNum:'||r_dist.invoice_id||','
334: ||r_dist.invoice_line_number||','||r_dist.distribution_line_number);
335: END IF;
336: p_process_flag := jai_constants.not_accounted;
337: --p_process_message := 'Invoice is not accounted';
338: RETURN;
339: END IF;
340:

Line 354: p_process_flag := jai_constants.already_processed;

350: RETURN;
351: -- if the following is satisfied then it means this is a reversal of a parent line which is processed and hence should return back
352: ELSIF r_ref.reversal_flag = 'Y' THEN
353: lv_codepath := jai_general_pkg.plot_codepath(5, lv_codepath);
354: p_process_flag := jai_constants.already_processed;
355: RETURN;
356: END IF;
357:
358: IF g_debug='Y' THEN fnd_file.put_line(fnd_file.log,'ProPay.r_ref:'||r_ref.reference_id||',taxty:'||r_ref.tax_type); END IF;

Line 367: p_process_flag := jai_constants.already_processed;

363:
364: -- if the following is satisfied, then it means the payment against the invoice is already processed
365: IF ln_rgm_reposotory_id IS NOT NULL THEN
366: lv_codepath := jai_general_pkg.plot_codepath(6, lv_codepath);
367: p_process_flag := jai_constants.already_processed;
368: RETURN;
369: END IF;
370:
371: lv_codepath := jai_general_pkg.plot_codepath(7, lv_codepath);

Line 379: IF p_payment_table_name = jai_constants.ap_payments THEN

375: FETCH c_invoice_distribution INTO r_dist;
376: CLOSE c_invoice_distribution;
377: END IF;
378:
379: IF p_payment_table_name = jai_constants.ap_payments THEN
380:
381: lv_codepath := jai_general_pkg.plot_codepath(8, lv_codepath);
382: OPEN c_invoice_payment(p_payment_document_id);
383: FETCH c_invoice_payment INTO r_payment;

Line 402: lv_src_trx_type := jai_constants.future_payment;

398: -- To Derive Src Trx Type and Transaction Date for Normal Payment
399: IF r_payment.amount > 0 THEN
400: IF r_payment.future_pay_due_date IS NOT NULL THEN
401: lv_codepath := jai_general_pkg.plot_codepath(10, lv_codepath);
402: lv_src_trx_type := jai_constants.future_payment;
403: ld_transaction_date := r_payment.future_pay_due_date;
404: ELSE
405: lv_codepath := jai_general_pkg.plot_codepath(11, lv_codepath);
406: lv_src_trx_type := jai_constants.payment;

Line 406: lv_src_trx_type := jai_constants.payment;

402: lv_src_trx_type := jai_constants.future_payment;
403: ld_transaction_date := r_payment.future_pay_due_date;
404: ELSE
405: lv_codepath := jai_general_pkg.plot_codepath(11, lv_codepath);
406: lv_src_trx_type := jai_constants.payment;
407: ld_transaction_date := r_payment.check_date;
408: END IF;
409:
410: -- Void Case

Line 414: lv_src_trx_type := jai_constants.payment_voided;

410: -- Void Case
411: ELSE
412: IF r_payment.void_date IS NOT NULL THEN
413: lv_codepath := jai_general_pkg.plot_codepath(12, lv_codepath);
414: lv_src_trx_type := jai_constants.payment_voided;
415: ld_transaction_date := r_payment.void_date;
416: ELSE
417: lv_codepath := jai_general_pkg.plot_codepath(13, lv_codepath);
418: lv_src_trx_type := jai_constants.payment_reversal;

Line 418: lv_src_trx_type := jai_constants.payment_reversal;

414: lv_src_trx_type := jai_constants.payment_voided;
415: ld_transaction_date := r_payment.void_date;
416: ELSE
417: lv_codepath := jai_general_pkg.plot_codepath(13, lv_codepath);
418: lv_src_trx_type := jai_constants.payment_reversal;
419: ld_transaction_date := r_payment.check_date;
420: END IF;
421: END IF;
422:

Line 423: ELSIF p_payment_table_name = jai_constants.ap_prepayments THEN

419: ld_transaction_date := r_payment.check_date;
420: END IF;
421: END IF;
422:
423: ELSIF p_payment_table_name = jai_constants.ap_prepayments THEN
424:
425: lv_codepath := jai_general_pkg.plot_codepath(14, lv_codepath);
426: OPEN c_invoice_distribution(p_payment_document_id);
427: FETCH c_invoice_distribution INTO r_prepayment;

Line 439: lv_src_trx_type := jai_constants.prepay_unapplication;

435:
436: -- if the following condition is satisfied, then it means a prepayment unapplication onto invoice
437: IF r_prepayment.parent_reversal_id IS NOT NULL THEN
438: lv_codepath := jai_general_pkg.plot_codepath(15, lv_codepath);
439: lv_src_trx_type := jai_constants.prepay_unapplication;
440: ELSE
441: lv_codepath := jai_general_pkg.plot_codepath(16, lv_codepath);
442: lv_src_trx_type := jai_constants.prepay_application;
443: END IF;

Line 442: lv_src_trx_type := jai_constants.prepay_application;

438: lv_codepath := jai_general_pkg.plot_codepath(15, lv_codepath);
439: lv_src_trx_type := jai_constants.prepay_unapplication;
440: ELSE
441: lv_codepath := jai_general_pkg.plot_codepath(16, lv_codepath);
442: lv_src_trx_type := jai_constants.prepay_application;
443: END IF;
444:
445: END IF;
446:

Line 469: ELSIF lv_src_trx_type = jai_constants.payment_voided THEN

465: ln_recovered_amount := -r_parent_ref.recovered_amount;
466: ln_discounted_amount := -r_parent_ref.discounted_amount;
467:
468: -- following elsif is added to take care of void scenarios, where in the recovered amt againt the main payment is reversed
469: ELSIF lv_src_trx_type = jai_constants.payment_voided THEN
470:
471: lv_codepath := jai_general_pkg.plot_codepath(18, lv_codepath);
472: OPEN c_repo_recovered_amt(p_source, p_payment_table_name, r_payment.reversal_inv_pmt_id, r_ref.reference_id);
473: FETCH c_repo_recovered_amt INTO ln_parent_recovered_amt;

Line 485: ELSIF lv_src_trx_type = jai_constants.prepay_unapplication THEN

481:
482: ln_discounted_amount := -ln_parent_recovered_amt * ( nvl(r_payment.discount_taken,0)/nvl(r_payment.amount,1) );
483:
484: -- following elsif is added to take care of Prepay Unapply scenarios, where in the recovered amt againt the main payment is reversed
485: ELSIF lv_src_trx_type = jai_constants.prepay_unapplication THEN
486: lv_codepath := jai_general_pkg.plot_codepath(20, lv_codepath);
487: OPEN c_repo_recovered_amt(p_source, p_payment_table_name, r_prepayment.parent_reversal_id, r_ref.reference_id);
488: FETCH c_repo_recovered_amt INTO ln_parent_recovered_amt;
489: CLOSE c_repo_recovered_amt;

Line 567: IF lv_process_flag <> jai_constants.successful THEN

563: p_process_flag => lv_process_flag,
564: p_process_message => lv_process_message
565: );
566:
567: IF lv_process_flag <> jai_constants.successful THEN
568: lv_codepath := jai_general_pkg.plot_codepath(27.1, lv_codepath);
569: FND_FILE.put_line(fnd_file.log, 'Error Flag:'||lv_process_flag||' Error Message:'||lv_process_message);
570: return;
571: END IF;

Line 579: p_organization_type => jai_constants.orgn_type_io ,/*5694855*/

575: jai_cmn_rgm_recording_pkg.insert_repository_entry(
576: p_repository_id => ln_rgm_reposotory_id,
577: p_regime_id => p_regime_id,
578: p_tax_type => r_ref.tax_type,
579: p_organization_type => jai_constants.orgn_type_io ,/*5694855*/
580: p_organization_id => ln_organization_id ,/*5694855*/
581: p_location_id => ln_location_id,/*5694855*/
582: p_service_type_code => lv_service_type_code,/*5694855*/
583: p_source => p_source,

Line 602: p_accntg_required_flag => jai_constants.yes,

598: p_batch_id => p_batch_id,
599: p_called_from => lv_called_from, --rchandan for bug#4428980
600: p_process_flag => p_process_flag,
601: p_process_message => p_process_message,
602: p_accntg_required_flag => jai_constants.yes,
603: p_accounting_date => ld_accounting_date,
604: p_balancing_orgn_type => null,
605: p_balancing_orgn_id => null,
606: p_balancing_location_id => null,

Line 609: p_currency_code => jai_constants.func_curr,

605: p_balancing_orgn_id => null,
606: p_balancing_location_id => null,
607: p_balancing_tax_type => null,
608: p_balancing_accnt_name => null,
609: p_currency_code => jai_constants.func_curr,
610: p_curr_conv_date => null,
611: p_curr_conv_type => null,
612: p_curr_conv_rate => null
613: );

Line 615: IF p_process_flag <> jai_constants.successful THEN

611: p_curr_conv_type => null,
612: p_curr_conv_rate => null
613: );
614:
615: IF p_process_flag <> jai_constants.successful THEN
616: lv_codepath := jai_general_pkg.plot_codepath(28, lv_codepath);
617: RETURN;
618: END IF;
619:

Line 638: p_process_flag := jai_constants.unexpected_error;

634: END IF;
635:
636: EXCEPTION
637: WHEN OTHERS THEN
638: p_process_flag := jai_constants.unexpected_error;
639: p_process_message := 'Process Payment Error:'||SQLERRM;
640: FND_FILE.put_line( fnd_file.log, p_process_message);
641: FND_FILE.put_line( fnd_file.log, 'Error Codepath:'||lv_codepath);
642:

Line 675: AND registration_type = jai_constants.regn_type_others

671: CURSOR c_regime_orgs(cp_regime_id IN NUMBER, cp_orgn_type IN VARCHAR2, cp_registration_num IN VARCHAR2,p_att_type_code jai_rgm_registrations.attribute_type_code%TYPE,cp_organization_id IN NUMBER ) IS/*Bug 5879769 bduvarag*/
672: SELECT a.organization_id org_id,a.location_id /*Bug 5879769 bduvarag*/
673: FROM JAI_RGM_ORG_REGNS_V a
674: WHERE regime_id = cp_regime_id
675: AND registration_type = jai_constants.regn_type_others
676: AND attribute_type_code = p_att_type_code--rchandan for bug#4428980
677: AND organization_type = cp_orgn_type
678: AND attribute_value = cp_registration_num
679: AND a.organization_id = nvl(cp_organization_id,a.organization_id) /*5694855*/;

Line 740: retcode := jai_constants.request_error;

736:
737: FND_FILE.put_line(fnd_file.log, 'Start Date('||to_char(p_trx_from_Date,'DD-MON-YYYY')
738: ||') of Transaction Processing cannot be less than Regime Effective Date('||to_char(ld_rgm_effective_from,'DD-MON-YYYY')||')'
739: );
740: retcode := jai_constants.request_error;
741:
742: RETURN;
743:
744: END IF;

Line 748: FOR loop_io IN c_regime_orgs(p_regime_id, jai_constants.orgn_type_io, p_rgm_registration_num,'PRIMARY',p_organization_id) LOOP/*Bug 5879769 bduvarag*/

744: END IF;
745:
746: ld_trx_start_date := p_trx_from_date;
747:
748: FOR loop_io IN c_regime_orgs(p_regime_id, jai_constants.orgn_type_io, p_rgm_registration_num,'PRIMARY',p_organization_id) LOOP/*Bug 5879769 bduvarag*/
749:
750: /* start changes by ssumaith - code review comments - bug# 6109941*/
751: OPEN cur_fetch_ou(loop_io.org_id);
752: FETCH cur_fetch_ou INTO ln_org_id;

Line 757: fnd_file.put_line(fnd_file.log,'P_organization_type :' || jai_constants.orgn_type_io);

753: CLOSE cur_fetch_ou;
754: /* ends additions by ssumaith - bug#6109941*/
755:
756: /*Added by nprashar for bug # 6636517*/
757: fnd_file.put_line(fnd_file.log,'P_organization_type :' || jai_constants.orgn_type_io);
758: fnd_file.put_line(fnd_file.log,'P_organization_id :' ||ln_org_id);
759: fnd_file.put_line(fnd_file.log,'P_Location_id :' ||loop_io.location_id); /*Ends here for bug #6636517*/
760: /***************** Processing of AP Start Here *********************/
761: process_payments(

Line 763: p_organization_type => jai_constants.orgn_type_io, /* ssumaith - bug# 6109941 */

759: fnd_file.put_line(fnd_file.log,'P_Location_id :' ||loop_io.location_id); /*Ends here for bug #6636517*/
760: /***************** Processing of AP Start Here *********************/
761: process_payments(
762: p_regime_id => p_regime_id,
763: p_organization_type => jai_constants.orgn_type_io, /* ssumaith - bug# 6109941 */
764: p_organization_id => loop_io.org_id,/*5694855*/ /* ssumaith 6109941 */
765: p_trx_from_date => ld_trx_start_date,
766: p_trx_to_date => p_trx_till_date,
767: p_org_id => ln_org_id,

Line 774: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN

770: p_process_flag => lv_process_flag,
771: p_process_message => lv_process_message
772: );
773:
774: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
775: GOTO end_of_batch;
776: END IF;
777:
778: /***************** Processing of AR Start Here *********************/

Line 781: p_organization_type => jai_constants.orgn_type_io,

777:
778: /***************** Processing of AR Start Here *********************/
779: jai_ar_rgm_processing_pkg.process_records(
780: p_regime_id => p_regime_id,
781: p_organization_type => jai_constants.orgn_type_io,
782: p_organization_id => loop_io.org_id ,/*5694855*/
783: p_from_date => ld_trx_start_date,
784: p_to_date => p_trx_till_date,
785: p_org_id => ln_org_id,

Line 791: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN

787: p_process_flag => lv_process_flag,
788: p_process_message => lv_process_message
789: );
790:
791: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
792: GOTO end_of_batch;
793: END IF;
794:
795: END LOOP; -- Operating Units loop of Registration Number

Line 799: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN

795: END LOOP; -- Operating Units loop of Registration Number
796:
797: <>
798:
799: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
800: FND_FILE.put_line( FND_FILE.log, 'Problem Message:'||lv_process_message);
801: fnd_file.put_line(fnd_file.log,'Problem Message:'||lv_process_message);
802: retcode := jai_constants.request_warning;
803: errbuf := lv_process_message;

Line 802: retcode := jai_constants.request_warning;

798:
799: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
800: FND_FILE.put_line( FND_FILE.log, 'Problem Message:'||lv_process_message);
801: fnd_file.put_line(fnd_file.log,'Problem Message:'||lv_process_message);
802: retcode := jai_constants.request_warning;
803: errbuf := lv_process_message;
804: END IF;
805:
806: -- FINAL Commit to permanently save the transactions

Line 812: retcode := jai_constants.request_error;

808:
809: EXCEPTION
810: WHEN OTHERS THEN
811: ROLLBACK;
812: retcode := jai_constants.request_error;
813: errbuf := 'Unexpected Error Occured:'||SQLERRM;
814: FND_FILE.put_line( fnd_file.log, 'Unexpected Error Occured:'||SQLERRM);
815:
816: END process_batch;

Line 885: AND aid.line_type_lookup_code = jai_constants.misc_line

881: AND aid.invoice_id = ai.invoice_id
882: and aid.accounting_event_id = xah.event_id
883: AND ai.invoice_type_lookup_code IN (lv_standard_lookup, lv_debit_lookup)
884: AND ai.cancelled_date IS NULL
885: AND aid.line_type_lookup_code = jai_constants.misc_line
886: AND aid.posted_flag = 'Y'
887: AND trunc(xah.accounting_date) between cp_start_date AND cp_till_date
888: AND trunc(aid.accounting_date) between cp_start_date AND cp_till_date
889: and ai.org_id = p_org_id

Line 904: AND line_type_lookup_code = jai_constants.prepay_line

900: parent_reversal_id ,
901: org_id
902: FROM ap_invoice_distributions_all
903: WHERE org_id = p_org_id
904: AND line_type_lookup_code = jai_constants.prepay_line
905: AND invoice_id IN ( SELECT invoice_id
906: FROM ap_invoice_distributions_all
907: WHERE po_distribution_id IN ( SELECT pda.po_distribution_id
908: FROM po_line_locations_all pll,

Line 932: AND a.line_type_lookup_code = jai_constants.misc_line -- <> 'PREPAY'

928: a.invoicE_line_number, /* INVOICE LINES UPTAKE */
929: a.parent_reversal_id, a.reversal_flag, a.rcv_transaction_id, a.po_distribution_id
930: FROM ap_invoice_distributions_all a, jai_rgm_trx_refs b /* second table is used for join just to take IL records */
931: WHERE a.invoice_id = cp_invoice_id
932: AND a.line_type_lookup_code = jai_constants.misc_line -- <> 'PREPAY'
933: AND b.source = jai_constants.source_ap
934: and b.invoice_id = a.invoice_id
935: and b.line_id = a.invoice_distribution_id
936: ORDER BY a.invoice_distribution_id;

Line 933: AND b.source = jai_constants.source_ap

929: a.parent_reversal_id, a.reversal_flag, a.rcv_transaction_id, a.po_distribution_id
930: FROM ap_invoice_distributions_all a, jai_rgm_trx_refs b /* second table is used for join just to take IL records */
931: WHERE a.invoice_id = cp_invoice_id
932: AND a.line_type_lookup_code = jai_constants.misc_line -- <> 'PREPAY'
933: AND b.source = jai_constants.source_ap
934: and b.invoice_id = a.invoice_id
935: and b.line_id = a.invoice_distribution_id
936: ORDER BY a.invoice_distribution_id;
937:

Line 949: and c.registration_type = jai_constants.regn_type_tax_types

945: AND a.invoice_distribution_id = cp_inv_distribution_id
946: AND a.tax_id = b.tax_id
947: AND b.tax_type = c.attribute_code
948: and c.regime_id = cp_regime_id
949: and c.registration_type = jai_constants.regn_type_tax_types
950: --
951: -- 5763527, modified and condition as below
952: AND ( mod_cr_percentage = 100
953: or ( mod_cr_percentage > 0 and mod_cr_percentage < 100 and nvl(recoverable_flag,'Y') <> 'N')

Line 969: AND d.registration_type = jai_constants.regn_type_tax_types

965: AND a.tax_id = b.tax_id
966: AND a.line_number = cp_line_number /*INVOICE LINES UPTAKE cp_dist_line_number */
967: AND b.tax_type = attribute_code
968: and d.regime_id = cp_regime_id
969: AND d.registration_type = jai_constants.regn_type_tax_types
970: AND b.mod_cr_percentage > 0;
971:
972:
973: CURSOR c_item_id(cp_po_distribution_id IN NUMBER) IS

Line 995: where source = jai_constants.source_ap

991: AND a.creation_date < cp_start_date
992: AND nvl(b.future_pay_due_date, v_today) <= v_today
993: AND a.amount <> 0 /* ssumaith bug# 6104491 */
994: AND a.invoice_payment_id NOT IN (select source_document_id from jai_rgm_trx_records -- CHK is this required
995: where source = jai_constants.source_ap
996: and source_table_name = jai_constants.ap_payments
997: and source_document_id = a.invoice_payment_id
998: )
999: ORDER BY invoice_payment_id;

Line 996: and source_table_name = jai_constants.ap_payments

992: AND nvl(b.future_pay_due_date, v_today) <= v_today
993: AND a.amount <> 0 /* ssumaith bug# 6104491 */
994: AND a.invoice_payment_id NOT IN (select source_document_id from jai_rgm_trx_records -- CHK is this required
995: where source = jai_constants.source_ap
996: and source_table_name = jai_constants.ap_payments
997: and source_document_id = a.invoice_payment_id
998: )
999: ORDER BY invoice_payment_id;
1000:

Line 1067: AND ainvd.line_type_lookup_code = jai_constants.misc_line -- <> 'PREPAY'

1063: AND apc.org_id = p_org_id
1064:
1065: )/*5694855*/
1066:
1067: AND ainvd.line_type_lookup_code = jai_constants.misc_line -- <> 'PREPAY'
1068: AND jrtr.source = jai_constants.source_ap
1069: AND jrtr.invoice_id = ainvd.invoice_id
1070: AND apinvp.invoice_id = ainvd.invoice_id --added by csahoo for bug#6436576
1071: AND jrtr.line_id = ainvd.invoice_distribution_id

Line 1068: AND jrtr.source = jai_constants.source_ap

1064:
1065: )/*5694855*/
1066:
1067: AND ainvd.line_type_lookup_code = jai_constants.misc_line -- <> 'PREPAY'
1068: AND jrtr.source = jai_constants.source_ap
1069: AND jrtr.invoice_id = ainvd.invoice_id
1070: AND apinvp.invoice_id = ainvd.invoice_id --added by csahoo for bug#6436576
1071: AND jrtr.line_id = ainvd.invoice_distribution_id
1072: ORDER BY

Line 1092: WHERE source = jai_constants.source_ap

1088: */
1089: CURSOR c_payment_chk(cp_source IN VARCHAR2, cp_source_table_name IN VARCHAR2, cp_source_document_id IN NUMBER) IS
1090: SELECT 1
1091: FROM jai_rgm_trx_records
1092: WHERE source = jai_constants.source_ap
1093: AND source_table_name = jai_constants.ap_payments
1094: AND source_document_id = cp_source_document_id;
1095:
1096: /*OPEN c_payment_chk(jai_constants.source_ap, jai_constants.ap_payments, inv_payment.invoice_payment_id);

Line 1093: AND source_table_name = jai_constants.ap_payments

1089: CURSOR c_payment_chk(cp_source IN VARCHAR2, cp_source_table_name IN VARCHAR2, cp_source_document_id IN NUMBER) IS
1090: SELECT 1
1091: FROM jai_rgm_trx_records
1092: WHERE source = jai_constants.source_ap
1093: AND source_table_name = jai_constants.ap_payments
1094: AND source_document_id = cp_source_document_id;
1095:
1096: /*OPEN c_payment_chk(jai_constants.source_ap, jai_constants.ap_payments, inv_payment.invoice_payment_id);
1097: FETCH c_payment_chk INTO ln_chk;

Line 1096: /*OPEN c_payment_chk(jai_constants.source_ap, jai_constants.ap_payments, inv_payment.invoice_payment_id);

1092: WHERE source = jai_constants.source_ap
1093: AND source_table_name = jai_constants.ap_payments
1094: AND source_document_id = cp_source_document_id;
1095:
1096: /*OPEN c_payment_chk(jai_constants.source_ap, jai_constants.ap_payments, inv_payment.invoice_payment_id);
1097: FETCH c_payment_chk INTO ln_chk;
1098: CLOSE c_payment_chk; */
1099:
1100: r_ref c_reference%ROWTYPE;

Line 1170: OPEN c_reference(jai_constants.source_ap, ap_acc_dist.invoice_id, ap_acc_dist.invoice_distribution_id); -- , r_tax_dist_dtl.tax_id);

1166: r_tax_dist_dtl := null;
1167: r_parent_dist := null;
1168: r_parent_ref := null;
1169:
1170: OPEN c_reference(jai_constants.source_ap, ap_acc_dist.invoice_id, ap_acc_dist.invoice_distribution_id); -- , r_tax_dist_dtl.tax_id);
1171: FETCH c_reference INTO r_ref;
1172: CLOSE c_reference;
1173:
1174: -- following condition is satisfied if the invoice line is already inserted into REFERENCEs table

Line 1259: OPEN c_reference(jai_constants.source_ap, ap_acc_dist.invoice_id, ap_acc_dist.parent_reversal_id); -- , r_tax_dist_dtl.tax_id);

1255: FETCH c_item_id INTO ln_item_id;
1256: CLOSE c_item_id;
1257:
1258: IF ap_acc_dist.parent_reversal_id is not null then /* condition introduced for AP LINES Uptake Project */
1259: OPEN c_reference(jai_constants.source_ap, ap_acc_dist.invoice_id, ap_acc_dist.parent_reversal_id); -- , r_tax_dist_dtl.tax_id);
1260: FETCH c_reference INTO r_parent_ref;
1261: CLOSE c_reference;
1262: END IF;
1263:

Line 1272: p_source => jai_constants.source_ap,

1268:
1269: jai_cmn_rgm_recording_pkg.insert_reference(
1270: p_reference_id => ln_reference_id, -- OUT Variable
1271: p_organization_id => p_organization_id,/*5694855*/
1272: p_source => jai_constants.source_ap,
1273: p_invoice_id => ap_acc_dist.invoice_id,
1274: p_line_id => ap_acc_dist.invoice_distribution_id,
1275: p_tax_type => r_tax_dist_dtl.tax_type,
1276: p_tax_id => r_tax_dist_dtl.tax_id,

Line 1280: p_party_type => jai_constants.party_type_vendor,

1276: p_tax_id => r_tax_dist_dtl.tax_id,
1277: p_tax_rate => r_tax_dist_dtl.tax_rate,
1278: p_recoverable_ptg => r_tax_dist_dtl.recoverable_ptg,
1279: p_recoverable_amount => ln_recoverable_amount,
1280: p_party_type => jai_constants.party_type_vendor,
1281: p_party_id => ap_acc_dist.vendor_id,
1282: p_party_site_id => ap_acc_dist.vendor_site_id,
1283: p_tax_amount => ap_acc_dist.amount,
1284: p_recovered_amount => 0,

Line 1299: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN

1295: p_process_flag => lv_process_flag,
1296: p_process_message => lv_process_message
1297: );
1298:
1299: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
1300: -- RAISE_APPLICATION_ERROR( -20201, p_process_flag||':'||p_process_message);
1301: -- ERROR RECORDING should be there for all errored records, so that we can code the processing in future. CHK
1302: ROLLBACK TO start_of_ref;
1303: p_process_flag := lv_process_flag;

Line 1325: FOR invo IN c_batch_references(p_batch_id, jai_constants.source_ap) LOOP

1321: END LOOP; -- ap_acc_dist for Operating Unit
1322:
1323: -- Logic to Make Register Entry for the Invoice Distributions that are populated into REFERENCES table and which are PAID
1324: -- Prior to the start date of this concurrent program. This is because localization only considers invoices that are accounted
1325: FOR invo IN c_batch_references(p_batch_id, jai_constants.source_ap) LOOP
1326:
1327: -- Logic to Process the PAST DATED PAYMENTS that are not processed due to Invoice Accounting did not happen
1328: FOR inv_payment IN c_previous_payments_of_inv(invo.invoice_id, p_trx_from_date) LOOP
1329:

Line 1330: FOR dist IN c_invoice_batch_refs(jai_constants.source_ap, p_batch_id, invo.invoice_id) LOOP

1326:
1327: -- Logic to Process the PAST DATED PAYMENTS that are not processed due to Invoice Accounting did not happen
1328: FOR inv_payment IN c_previous_payments_of_inv(invo.invoice_id, p_trx_from_date) LOOP
1329:
1330: FOR dist IN c_invoice_batch_refs(jai_constants.source_ap, p_batch_id, invo.invoice_id) LOOP
1331:
1332: lv_process_flag := null;
1333:
1334: SAVEPOINT process_payment;

Line 1340: p_source => jai_constants.source_ap,

1336: process_payment(
1337: p_batch_id => p_batch_id,
1338: p_regime_id => p_regime_id,
1339: p_org_id => inv_payment.org_id,
1340: p_source => jai_constants.source_ap,
1341: p_payment_table_name => jai_constants.ap_payments,
1342: p_payment_document_id => inv_payment.invoice_payment_id,
1343: p_invoice_id => dist.invoice_id,
1344: p_inv_dist_id => dist.line_id,

Line 1341: p_payment_table_name => jai_constants.ap_payments,

1337: p_batch_id => p_batch_id,
1338: p_regime_id => p_regime_id,
1339: p_org_id => inv_payment.org_id,
1340: p_source => jai_constants.source_ap,
1341: p_payment_table_name => jai_constants.ap_payments,
1342: p_payment_document_id => inv_payment.invoice_payment_id,
1343: p_invoice_id => dist.invoice_id,
1344: p_inv_dist_id => dist.line_id,
1345: p_inv_accounting_chk_done => jai_constants.yes,

Line 1345: p_inv_accounting_chk_done => jai_constants.yes,

1341: p_payment_table_name => jai_constants.ap_payments,
1342: p_payment_document_id => inv_payment.invoice_payment_id,
1343: p_invoice_id => dist.invoice_id,
1344: p_inv_dist_id => dist.line_id,
1345: p_inv_accounting_chk_done => jai_constants.yes,
1346: p_process_flag => lv_process_flag,
1347: p_process_message => lv_process_message
1348: );
1349:

Line 1354: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN

1350:
1351: -- "FP" Means means future payment and it is not yet matured, so
1352: --IF p_process_flag = 'FP' THEN
1353: --ELS
1354: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
1355: ROLLBACK TO process_payment;
1356: --retcode := jai_constants.request_warning;
1357: p_process_flag := lv_process_flag;
1358: p_process_message := lv_process_message;

Line 1356: --retcode := jai_constants.request_warning;

1352: --IF p_process_flag = 'FP' THEN
1353: --ELS
1354: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
1355: ROLLBACK TO process_payment;
1356: --retcode := jai_constants.request_warning;
1357: p_process_flag := lv_process_flag;
1358: p_process_message := lv_process_message;
1359: END IF;
1360:

Line 1374: FOR dist IN c_invoice_batch_refs(jai_constants.source_ap, p_batch_id, invo.invoice_id) LOOP

1370:
1371: -- Logic to Process the PAST DATED PREPAYMENTS that are not processed due to Invoice Accounting did not happen
1372: FOR pp IN c_period_payments( p_trx_from_date, p_trx_to_date) LOOP
1373:
1374: FOR dist IN c_invoice_batch_refs(jai_constants.source_ap, p_batch_id, invo.invoice_id) LOOP
1375:
1376: lv_process_flag := null;
1377:
1378: SAVEPOINT process_prepayment;

Line 1383: p_source => jai_constants.source_ap,

1379: process_payment(
1380: p_batch_id => p_batch_id,
1381: p_regime_id => p_regime_id,
1382: p_org_id => pp.org_id,
1383: p_source => jai_constants.source_ap,
1384: p_payment_table_name => jai_constants.ap_prepayments,
1385: p_payment_document_id => pp.invoice_distribution_id,
1386: p_invoice_id => dist.invoice_id,
1387: p_inv_dist_id => dist.line_id,

Line 1384: p_payment_table_name => jai_constants.ap_prepayments,

1380: p_batch_id => p_batch_id,
1381: p_regime_id => p_regime_id,
1382: p_org_id => pp.org_id,
1383: p_source => jai_constants.source_ap,
1384: p_payment_table_name => jai_constants.ap_prepayments,
1385: p_payment_document_id => pp.invoice_distribution_id,
1386: p_invoice_id => dist.invoice_id,
1387: p_inv_dist_id => dist.line_id,
1388: p_inv_accounting_chk_done => jai_constants.yes,

Line 1388: p_inv_accounting_chk_done => jai_constants.yes,

1384: p_payment_table_name => jai_constants.ap_prepayments,
1385: p_payment_document_id => pp.invoice_distribution_id,
1386: p_invoice_id => dist.invoice_id,
1387: p_inv_dist_id => dist.line_id,
1388: p_inv_accounting_chk_done => jai_constants.yes,
1389: p_process_flag => lv_process_flag,
1390: p_process_message => lv_process_message
1391: );
1392:

Line 1393: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN

1389: p_process_flag => lv_process_flag,
1390: p_process_message => lv_process_message
1391: );
1392:
1393: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
1394: ROLLBACK TO process_prepayment;
1395: -- retcode := jai_constants.request_warning;
1396: p_process_flag := lv_process_flag;
1397: p_process_message := lv_process_message;

Line 1395: -- retcode := jai_constants.request_warning;

1391: );
1392:
1393: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
1394: ROLLBACK TO process_prepayment;
1395: -- retcode := jai_constants.request_warning;
1396: p_process_flag := lv_process_flag;
1397: p_process_message := lv_process_message;
1398: END IF;
1399:

Line 1429: p_source => jai_constants.source_ap,

1425: process_payment(
1426: p_batch_id => p_batch_id,
1427: p_regime_id => p_regime_id,
1428: p_org_id => inv_payment.org_id,
1429: p_source => jai_constants.source_ap,
1430: p_payment_table_name => jai_constants.ap_payments,
1431: p_payment_document_id => inv_payment.invoice_payment_id,
1432: p_invoice_id => inv_payment.invoice_id,
1433: p_inv_dist_id => inv_payment.invoice_distribution_id,

Line 1430: p_payment_table_name => jai_constants.ap_payments,

1426: p_batch_id => p_batch_id,
1427: p_regime_id => p_regime_id,
1428: p_org_id => inv_payment.org_id,
1429: p_source => jai_constants.source_ap,
1430: p_payment_table_name => jai_constants.ap_payments,
1431: p_payment_document_id => inv_payment.invoice_payment_id,
1432: p_invoice_id => inv_payment.invoice_id,
1433: p_inv_dist_id => inv_payment.invoice_distribution_id,
1434: p_inv_accounting_chk_done => jai_constants.no,

Line 1434: p_inv_accounting_chk_done => jai_constants.no,

1430: p_payment_table_name => jai_constants.ap_payments,
1431: p_payment_document_id => inv_payment.invoice_payment_id,
1432: p_invoice_id => inv_payment.invoice_id,
1433: p_inv_dist_id => inv_payment.invoice_distribution_id,
1434: p_inv_accounting_chk_done => jai_constants.no,
1435: p_process_flag => lv_process_flag,
1436: p_process_message => lv_process_message
1437: );
1438:

Line 1439: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN

1435: p_process_flag => lv_process_flag,
1436: p_process_message => lv_process_message
1437: );
1438:
1439: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
1440: ROLLBACK TO process_payment;
1441: -- retcode := jai_constants.request_warning;
1442: p_process_flag := lv_process_flag;
1443: p_process_message := lv_process_message;

Line 1441: -- retcode := jai_constants.request_warning;

1437: );
1438:
1439: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
1440: ROLLBACK TO process_payment;
1441: -- retcode := jai_constants.request_warning;
1442: p_process_flag := lv_process_flag;
1443: p_process_message := lv_process_message;
1444: END IF;
1445:

Line 1467: p_source => jai_constants.source_ap,

1463: process_payment(
1464: p_batch_id => p_batch_id,
1465: p_regime_id => p_regime_id,
1466: p_org_id => pp.org_id,
1467: p_source => jai_constants.source_ap,
1468: p_payment_table_name => jai_constants.ap_prepayments,
1469: p_payment_document_id => pp.invoice_distribution_id,
1470: p_invoice_id => dist.invoice_id,
1471: p_inv_dist_id => dist.invoice_distribution_id,

Line 1468: p_payment_table_name => jai_constants.ap_prepayments,

1464: p_batch_id => p_batch_id,
1465: p_regime_id => p_regime_id,
1466: p_org_id => pp.org_id,
1467: p_source => jai_constants.source_ap,
1468: p_payment_table_name => jai_constants.ap_prepayments,
1469: p_payment_document_id => pp.invoice_distribution_id,
1470: p_invoice_id => dist.invoice_id,
1471: p_inv_dist_id => dist.invoice_distribution_id,
1472: p_inv_accounting_chk_done => jai_constants.no,

Line 1472: p_inv_accounting_chk_done => jai_constants.no,

1468: p_payment_table_name => jai_constants.ap_prepayments,
1469: p_payment_document_id => pp.invoice_distribution_id,
1470: p_invoice_id => dist.invoice_id,
1471: p_inv_dist_id => dist.invoice_distribution_id,
1472: p_inv_accounting_chk_done => jai_constants.no,
1473: p_process_flag => lv_process_flag,
1474: p_process_message => lv_process_message
1475: );
1476:

Line 1477: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN

1473: p_process_flag => lv_process_flag,
1474: p_process_message => lv_process_message
1475: );
1476:
1477: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
1478: ROLLBACK TO process_prepayment;
1479: -- retcode := jai_constants.request_warning;
1480: p_process_flag := lv_process_flag;
1481: p_process_message := lv_process_message;

Line 1479: -- retcode := jai_constants.request_warning;

1475: );
1476:
1477: IF lv_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
1478: ROLLBACK TO process_prepayment;
1479: -- retcode := jai_constants.request_warning;
1480: p_process_flag := lv_process_flag;
1481: p_process_message := lv_process_message;
1482: END IF;
1483:

Line 1497: -- retcode := jai_constants.request_error;

1493:
1494: EXCEPTION
1495: WHEN OTHERS THEN
1496: ROLLBACK;
1497: -- retcode := jai_constants.request_error;
1498: -- errbuf := 'Unexpected Error Occured:'||SQLERRM;
1499: p_process_flag := jai_constants.unexpected_error;
1500: p_process_message := 'Unexpected Error Occured in Process_Payments:'||SQLERRM;
1501: FND_FILE.put_line( fnd_file.log, 'Unexpected Error Occured:'||p_process_message);

Line 1499: p_process_flag := jai_constants.unexpected_error;

1495: WHEN OTHERS THEN
1496: ROLLBACK;
1497: -- retcode := jai_constants.request_error;
1498: -- errbuf := 'Unexpected Error Occured:'||SQLERRM;
1499: p_process_flag := jai_constants.unexpected_error;
1500: p_process_message := 'Unexpected Error Occured in Process_Payments:'||SQLERRM;
1501: FND_FILE.put_line( fnd_file.log, 'Unexpected Error Occured:'||p_process_message);
1502:
1503: END process_payments;

Line 1693: lv_debug VARCHAR2(5); -- := jai_constants.no /* This should be either 'Y' or 'N' */ File.Sql.35 by Brathod

1689: lv_vat_invoice_number VARCHAR2(100);
1690: ln_failure_delivery_ctr NUMBER;
1691: ln_success_delivery_Ctr NUMBER;
1692: ln_regime_id NUMBER;
1693: lv_debug VARCHAR2(5); -- := jai_constants.no /* This should be either 'Y' or 'N' */ File.Sql.35 by Brathod
1694: ln_order_type_id JAI_OM_WSH_LINES_ALL.ORDER_TYPE_ID%TYPE;
1695: lv_inv_num_already_generated VARCHAR2(10); --:= jai_constants.value_false File.Sql.35 by Brathod
1696: ln_batch_id NUMBER;
1697: lv_regime_code JAI_RGM_DEFINITIONS.REGIME_CODE%TYPE;

Line 1695: lv_inv_num_already_generated VARCHAR2(10); --:= jai_constants.value_false File.Sql.35 by Brathod

1691: ln_success_delivery_Ctr NUMBER;
1692: ln_regime_id NUMBER;
1693: lv_debug VARCHAR2(5); -- := jai_constants.no /* This should be either 'Y' or 'N' */ File.Sql.35 by Brathod
1694: ln_order_type_id JAI_OM_WSH_LINES_ALL.ORDER_TYPE_ID%TYPE;
1695: lv_inv_num_already_generated VARCHAR2(10); --:= jai_constants.value_false File.Sql.35 by Brathod
1696: ln_batch_id NUMBER;
1697: lv_regime_code JAI_RGM_DEFINITIONS.REGIME_CODE%TYPE;
1698: ln_current_party_id NUMBER;
1699: ln_current_party_site_id NUMBER;

Line 1713: WHERE regime_code = jai_constants.vat_regime;

1709: lv_doc_type_class varchar2(2); /*kunkumar for bug #5233925*/
1710: CURSOR c_regime_cur(cp_trx_Date DATE) IS
1711: SELECT regime_id
1712: FROM JAI_RGM_DEFINITIONS
1713: WHERE regime_code = jai_constants.vat_regime;
1714:
1715:
1716: CURSOR c_shipment_info(cp_Delivery_id JAI_OM_WSH_LINES_ALL.DELIVERY_ID%TYPE) IS
1717: SELECT order_type_id , excise_invoice_no

Line 1725: AND attribute_type_code = jai_constants.regn_type_others

1721: CURSOR c_same_inv_no(cp_organization_id JAI_OM_WSH_LINES_ALL.ORGANIZATION_ID%TYPE , cp_location_id JAI_OM_WSH_LINES_ALL.location_id%TYPE ) IS
1722: SELECT attribute_Value
1723: FROM JAI_RGM_ORG_REGNS_V
1724: WHERE regime_id = p_regime_id
1725: AND attribute_type_code = jai_constants.regn_type_others
1726: AND attribute_code = jai_constants.attr_code_same_inv_no
1727: AND organization_id = cp_organization_id
1728: AND location_id = cp_location_id;
1729:

Line 1726: AND attribute_code = jai_constants.attr_code_same_inv_no

1722: SELECT attribute_Value
1723: FROM JAI_RGM_ORG_REGNS_V
1724: WHERE regime_id = p_regime_id
1725: AND attribute_type_code = jai_constants.regn_type_others
1726: AND attribute_code = jai_constants.attr_code_same_inv_no
1727: AND organization_id = cp_organization_id
1728: AND location_id = cp_location_id;
1729:
1730: CURSOR c_excise_invoice_not_done ( cp_Delivery_id JAI_OM_WSH_LINES_ALL.DELIVERY_ID%TYPE)IS

Line 1769: lv_inv_num_already_generated := jai_constants.value_false; -- File.Sql.35 by Brathod

1765: ||aiyer for the bug 5369250
1766: ||convert from canonical to date format
1767: */
1768: ld_override_invoice_date := fnd_date.canonical_to_date(p_override_invoice_date);
1769: lv_inv_num_already_generated := jai_constants.value_false; -- File.Sql.35 by Brathod
1770: lv_debug := NVL(P_DEBUG,jai_constants.no);
1771: ln_current_party_id := -9999;
1772: ln_current_party_site_id := -9999;
1773: IF lv_debug = 'Y' THEN

Line 1770: lv_debug := NVL(P_DEBUG,jai_constants.no);

1766: ||convert from canonical to date format
1767: */
1768: ld_override_invoice_date := fnd_date.canonical_to_date(p_override_invoice_date);
1769: lv_inv_num_already_generated := jai_constants.value_false; -- File.Sql.35 by Brathod
1770: lv_debug := NVL(P_DEBUG,jai_constants.no);
1771: ln_current_party_id := -9999;
1772: ln_current_party_site_id := -9999;
1773: IF lv_debug = 'Y' THEN
1774: Fnd_File.PUT_LINE(Fnd_File.LOG, ' 1. Entered in the proc with parameters :');

Line 1790: lv_inv_gen_process_flag := jai_constants.successful;

1786: END IF;
1787: ln_conc_progam_id := FND_GLOBAL.conc_program_id;
1788: ln_conc_request_id := FND_GLOBAL.conc_request_id;
1789: ln_conc_prog_appl_id := FND_GLOBAL.prog_appl_id;
1790: lv_inv_gen_process_flag := jai_constants.successful;
1791: lv_acct_process_flag := jai_constants.successful;
1792: lv_inv_gen_process_message := NULL;
1793: lv_acct_process_message := NULL;
1794: ln_batch_id := ln_conc_request_id;

Line 1791: lv_acct_process_flag := jai_constants.successful;

1787: ln_conc_progam_id := FND_GLOBAL.conc_program_id;
1788: ln_conc_request_id := FND_GLOBAL.conc_request_id;
1789: ln_conc_prog_appl_id := FND_GLOBAL.prog_appl_id;
1790: lv_inv_gen_process_flag := jai_constants.successful;
1791: lv_acct_process_flag := jai_constants.successful;
1792: lv_inv_gen_process_message := NULL;
1793: lv_acct_process_message := NULL;
1794: ln_batch_id := ln_conc_request_id;
1795:

Line 1879: IF NVL(lv_Same_invoice_no,jai_constants.no) = jai_constants.yes THEN

1875: OPEN c_same_inv_no(mainrec.organization_id , mainrec.location_id );
1876: FETCH c_same_inv_no INTO lv_Same_invoice_no;
1877: CLOSE c_same_inv_no;
1878:
1879: IF NVL(lv_Same_invoice_no,jai_constants.no) = jai_constants.yes THEN
1880:
1881: IF lv_debug = 'Y' THEN
1882: Fnd_File.PUT_LINE(Fnd_File.LOG, ' lv_Same_invoice_no = Y , Hence we need not call inv num generation routine - using excise inv num instead');
1883: END IF;

Line 1906: lv_inv_gen_process_flag := jai_constants.expected_error;

1902: || It means the delivery is still existing in the JAI_OM_OE_GEN_TAXINV_T table
1903: || It means that the excise invoice generation was either not processed or errored out.
1904: || We need to raise an error saying that excise invoice number needs to be run before VAT processing can happen.
1905: */
1906: lv_inv_gen_process_flag := jai_constants.expected_error;
1907: lv_inv_gen_process_message := 'Excise Invoice Generation is not generated yet for this Delivery. Please run the excise invoice number generation number for delivery : '
1908: || mainrec.delivery_id;
1909:
1910: /*

Line 1976: lv_inv_gen_process_flag := jai_constants.successful; /*ssumaith bug# 6176277 */

1972:
1973: IF lv_debug = 'Y' THEN
1974: Fnd_File.PUT_LINE(Fnd_File.LOG, ' Before going to process accounting for generating accounting');
1975: END IF;
1976: lv_inv_gen_process_flag := jai_constants.successful; /*ssumaith bug# 6176277 */
1977:
1978: GOTO Processaccounting;
1979: END IF;
1980:

Line 2019: lv_party_has_changed := jai_constants.value_true;

2015: || Hence a new loop needs to start
2016: */
2017: ln_current_party_id := mainrec.party_id;
2018: ln_current_party_site_id := mainrec.party_site_id;
2019: lv_party_has_changed := jai_constants.value_true;
2020: ELSE
2021: lv_party_has_changed := jai_constants.value_false;
2022: END IF;
2023:

Line 2021: lv_party_has_changed := jai_constants.value_false;

2017: ln_current_party_id := mainrec.party_id;
2018: ln_current_party_site_id := mainrec.party_site_id;
2019: lv_party_has_changed := jai_constants.value_true;
2020: ELSE
2021: lv_party_has_changed := jai_constants.value_false;
2022: END IF;
2023:
2024: IF lv_Debug = 'Y' THEN
2025: Fnd_File.PUT_LINE(Fnd_File.LOG, ' lv_party_has_changed :' || lv_party_has_changed);

Line 2029: IF p_process_action in (jai_constants.om_action_gen_inv_n_accnt ,jai_constants.om_action_gen_invoice) THEN

2025: Fnd_File.PUT_LINE(Fnd_File.LOG, ' lv_party_has_changed :' || lv_party_has_changed);
2026: Fnd_File.PUT_LINE(Fnd_File.LOG, ' lv_inv_num_already_generated :' || lv_inv_num_already_generated);
2027: END IF;
2028:
2029: IF p_process_action in (jai_constants.om_action_gen_inv_n_accnt ,jai_constants.om_action_gen_invoice) THEN
2030: IF NVL(p_single_invoice_num,jai_constants.No) = jai_constants.yes THEN
2031: IF lv_inv_num_already_generated = jai_constants.value_false AND lv_party_has_changed = jai_constants.value_true THEN
2032: IF lv_Debug = 'Y' THEN
2033: Fnd_File.PUT_LINE(Fnd_File.LOG, ' before call to jai_cmn_rgm_setup_pkg.Gen_Invoice_number with ln_order_type_id' || ln_order_type_id || 'date ' || mainrec.delivery_date );

Line 2030: IF NVL(p_single_invoice_num,jai_constants.No) = jai_constants.yes THEN

2026: Fnd_File.PUT_LINE(Fnd_File.LOG, ' lv_inv_num_already_generated :' || lv_inv_num_already_generated);
2027: END IF;
2028:
2029: IF p_process_action in (jai_constants.om_action_gen_inv_n_accnt ,jai_constants.om_action_gen_invoice) THEN
2030: IF NVL(p_single_invoice_num,jai_constants.No) = jai_constants.yes THEN
2031: IF lv_inv_num_already_generated = jai_constants.value_false AND lv_party_has_changed = jai_constants.value_true THEN
2032: IF lv_Debug = 'Y' THEN
2033: Fnd_File.PUT_LINE(Fnd_File.LOG, ' before call to jai_cmn_rgm_setup_pkg.Gen_Invoice_number with ln_order_type_id' || ln_order_type_id || 'date ' || mainrec.delivery_date );
2034: END IF;

Line 2031: IF lv_inv_num_already_generated = jai_constants.value_false AND lv_party_has_changed = jai_constants.value_true THEN

2027: END IF;
2028:
2029: IF p_process_action in (jai_constants.om_action_gen_inv_n_accnt ,jai_constants.om_action_gen_invoice) THEN
2030: IF NVL(p_single_invoice_num,jai_constants.No) = jai_constants.yes THEN
2031: IF lv_inv_num_already_generated = jai_constants.value_false AND lv_party_has_changed = jai_constants.value_true THEN
2032: IF lv_Debug = 'Y' THEN
2033: Fnd_File.PUT_LINE(Fnd_File.LOG, ' before call to jai_cmn_rgm_setup_pkg.Gen_Invoice_number with ln_order_type_id' || ln_order_type_id || 'date ' || mainrec.delivery_date );
2034: END IF;
2035: jai_cmn_rgm_setup_pkg.Gen_Invoice_number(

Line 2052: IF lv_inv_gen_process_flag = jai_constants.successful THEN

2048: END IF;
2049: /*
2050: check the return status and update the JAI_OM_WSH_LINES_ALL table to set the vat invoice number
2051: */
2052: IF lv_inv_gen_process_flag = jai_constants.successful THEN
2053: IF lv_vat_invoice_number IS NOT NULL THEN
2054: ln_success_delivery_Ctr := NVL(ln_success_Delivery_Ctr,0) + 1;
2055: lv_inv_num_already_generated := jai_constants.value_true;
2056: UPDATE JAI_OM_WSH_LINES_ALL

Line 2055: lv_inv_num_already_generated := jai_constants.value_true;

2051: */
2052: IF lv_inv_gen_process_flag = jai_constants.successful THEN
2053: IF lv_vat_invoice_number IS NOT NULL THEN
2054: ln_success_delivery_Ctr := NVL(ln_success_Delivery_Ctr,0) + 1;
2055: lv_inv_num_already_generated := jai_constants.value_true;
2056: UPDATE JAI_OM_WSH_LINES_ALL
2057: SET VAT_INVOICE_NO = lv_vat_invoice_number,
2058: VAT_INVOICE_DATE = nvl(ld_override_invoice_date ,sysdate),
2059: LAST_UPDATE_DATE = sysdate,

Line 2074: lv_inv_gen_process_flag := jai_constants.unexpected_error;

2070: last_update_login = fnd_global.conc_login_id,
2071: last_update_date = sysdate /*added by srjayara for bug 4702156*/
2072: WHERE delivery_id = mainrec.delivery_id;
2073: ELSE
2074: lv_inv_gen_process_flag := jai_constants.unexpected_error;
2075: lv_acct_process_flag := jai_constants.expected_error;
2076: ln_failure_delivery_ctr := NVL(ln_failure_Delivery_ctr,0) + 1;
2077: END IF;
2078: ELSE

Line 2075: lv_acct_process_flag := jai_constants.expected_error;

2071: last_update_date = sysdate /*added by srjayara for bug 4702156*/
2072: WHERE delivery_id = mainrec.delivery_id;
2073: ELSE
2074: lv_inv_gen_process_flag := jai_constants.unexpected_error;
2075: lv_acct_process_flag := jai_constants.expected_error;
2076: ln_failure_delivery_ctr := NVL(ln_failure_Delivery_ctr,0) + 1;
2077: END IF;
2078: ELSE
2079: ln_failure_delivery_ctr := NVL(ln_failure_Delivery_ctr,0) + 1;

Line 2086: IF lv_inv_num_already_generated = jai_constants.value_true AND lv_party_has_changed = jai_constants.value_false THEN

2082: /*
2083: || Party / party site has not changed and an invoice num was already generated .
2084: || So this can be used for all the deliveries of the current party / party site.
2085: */
2086: IF lv_inv_num_already_generated = jai_constants.value_true AND lv_party_has_changed = jai_constants.value_false THEN
2087: IF lv_vat_invoice_number IS NOT NULL THEN
2088: /*
2089: || Update the vat_invoice_num field in JAI_OM_WSH_LINES_ALL table for the current delivery.
2090: */

Line 2161: IF lv_inv_gen_process_flag = jai_constants.successful THEN

2157: || lv_vat_invoice_number || '+++');
2158: Fnd_File.PUT_LINE(Fnd_File.LOG, ' +++ after call to jai_cmn_rgm_setup_pkg.Gen_Invoice_number with lv_inv_gen_process_flag = '
2159: || lv_inv_gen_process_flag || 'lv_inv_gen_process_message '|| lv_inv_gen_process_message || '+++');
2160: END IF;
2161: IF lv_inv_gen_process_flag = jai_constants.successful THEN
2162: IF lv_vat_invoice_number IS NOT NULL THEN
2163: ln_success_delivery_Ctr := NVL(ln_success_Delivery_Ctr,0) + 1;
2164:
2165: UPDATE JAI_OM_WSH_LINES_ALL

Line 2185: lv_inv_gen_process_flag := jai_constants.unexpected_error;

2181: last_update_date = sysdate
2182: WHERE delivery_id = mainrec.delivery_id;
2183:
2184: ELSE
2185: lv_inv_gen_process_flag := jai_constants.unexpected_error;
2186: lv_inv_gen_process_message := 'No VAT Invoice Number Generated';
2187: ln_failure_delivery_ctr := NVL(ln_failure_Delivery_ctr,0) + 1;
2188: END IF;
2189: ELSE

Line 2213: IF p_process_action in (jai_constants.om_action_gen_inv_n_accnt,jai_constants.om_action_gen_accounting) THEN

2209: IF lv_debug = 'Y' THEN
2210: Fnd_File.PUT_LINE(Fnd_File.LOG, ' In process accounting section with p_process_action = ' || p_process_action);
2211: END IF;
2212:
2213: IF p_process_action in (jai_constants.om_action_gen_inv_n_accnt,jai_constants.om_action_gen_accounting) THEN
2214: /*
2215: || Only In case the parameter p_process_action in ('PROCESS ALL','PROCESS ACCOUNTING') AND
2216: ||
2217: */

Line 2227: IF lv_inv_gen_process_flag = jai_constants.successful THEN

2223: END IF;
2224: IF lv_Debug = 'Y' THEN
2225: Fnd_File.PUT_LINE(Fnd_File.LOG, ' lv_inv_gen_process_flag = ' || lv_inv_gen_process_flag );
2226: END IF;
2227: IF lv_inv_gen_process_flag = jai_constants.successful THEN
2228:
2229: IF lv_vat_invoice_number IS NULL THEN
2230: lv_vat_invoice_number:= mainrec.vat_invoice_no;
2231: END IF;

Line 2233: IF p_process_action = jai_constants.om_action_gen_accounting THEN

2229: IF lv_vat_invoice_number IS NULL THEN
2230: lv_vat_invoice_number:= mainrec.vat_invoice_no;
2231: END IF;
2232: --Added the following condtion and assignment by kunkumar for forward porting Bug#6012489
2233: IF p_process_action = jai_constants.om_action_gen_accounting THEN
2234: lv_vat_invoice_number := mainrec.vat_invoice_no;
2235: END IF;
2236: --End Added by kunkumar for Bug#6012489
2237: IF lv_Debug = 'Y' THEN

Line 2242: P_SOURCE => jai_constants.source_wsh ,

2238: Fnd_File.PUT_LINE(Fnd_File.LOG, 'Before Call to jai_cmn_rgm_vat_accnt_pkg.process_order_invoice ');
2239: END IF;
2240: jai_cmn_rgm_vat_accnt_pkg.process_order_invoice(
2241: P_REGIME_ID => ln_regime_id ,
2242: P_SOURCE => jai_constants.source_wsh ,
2243: P_ORGANIZATION_ID => mainrec.organization_id,
2244: P_LOCATION_ID => mainrec.location_id ,
2245: P_DELIVERY_ID => mainrec.delivery_id ,
2246: P_CUSTOMER_TRX_ID => NULL ,

Line 2259: IF lv_acct_process_flag = jai_constants.successful THEN

2255: );
2256: IF lv_Debug = 'Y' THEN
2257: Fnd_File.PUT_LINE(Fnd_File.LOG, 'after Call to jai_cmn_rgm_vat_accnt_pkg.process_order_invoice with status = ' || lv_acct_process_flag);
2258: END IF;
2259: IF lv_acct_process_flag = jai_constants.successful THEN
2260: /*
2261: || If the control comes here it means that Accounting got processed successfully.
2262: || Check here if Delivery for successfully processed and invoice got successfully processed
2263: || and only then do a commit

Line 2265: IF lv_inv_gen_process_flag = jai_constants.successful AND lv_acct_process_flag = jai_constants.successful THEN

2261: || If the control comes here it means that Accounting got processed successfully.
2262: || Check here if Delivery for successfully processed and invoice got successfully processed
2263: || and only then do a commit
2264: */
2265: IF lv_inv_gen_process_flag = jai_constants.successful AND lv_acct_process_flag = jai_constants.successful THEN
2266: /*
2267: || Both the activities have been succesfully completed
2268: || Can commit the changes made to the delivery.
2269: */

Line 2286: IF lv_inv_gen_process_flag <> jai_constants.successful OR lv_acct_process_flag <> jai_constants.successful THEN

2282: ln_failure_delivery_ctr := NVL(ln_failure_Delivery_ctr,0) + 1;
2283: Fnd_File.PUT_LINE(Fnd_File.LOG, 'Error Encountered after call to process_order_invoice is ' || lv_acct_process_message);
2284: END IF;
2285:
2286: IF lv_inv_gen_process_flag <> jai_constants.successful OR lv_acct_process_flag <> jai_constants.successful THEN
2287:
2288: /*
2289: || There have been some errors which have happened during accounting
2290: */

Line 2293: IF lv_inv_gen_process_flag <> jai_constants.successful THEN

2289: || There have been some errors which have happened during accounting
2290: */
2291: ROLLBACK;
2292:
2293: IF lv_inv_gen_process_flag <> jai_constants.successful THEN
2294: UPDATE JAI_RGM_INVOICE_GEN_T
2295: SET vat_inv_gen_err_message = substr(lv_inv_gen_process_message,1,1000),
2296: vat_inv_gen_status = 'E',
2297: request_id = ln_conc_request_id, /*following columns added by srjayara for bug 4702156*/

Line 2305: IF lv_acct_process_flag <> jai_constants.successful THEN

2301: last_update_date = sysdate
2302: WHERE delivery_id = mainrec.delivery_id;
2303: END IF;
2304:
2305: IF lv_acct_process_flag <> jai_constants.successful THEN
2306: UPDATE JAI_RGM_INVOICE_GEN_T
2307: SET vat_acct_err_message = substr(lv_acct_process_message,1,1000),
2308: vat_acct_status = 'E',
2309: request_id = ln_conc_request_id, /*following columns added by srjayara for bug 4702156*/

Line 2320: END IF; /* END IF For IF lv_inv_gen_process_flag = jai_constants.successful THEN */

2316: END IF;
2317: COMMIT;
2318: END IF;
2319:
2320: END IF; /* END IF For IF lv_inv_gen_process_flag = jai_constants.successful THEN */
2321: END IF; /* END IF For IF p_process_action in ('ALL','PROCESS ACCOUNTING') THEN */
2322: <>
2323: NULL;
2324: END LOOP;

Line 2372: lv_inv_gen_process_flag := jai_constants.unexpected_error;

2368: RETCODE := '2';
2369: Fnd_File.PUT_LINE(Fnd_File.LOG,'Unexpected Error occured in procedure jai_cmn_rgm_processing_pkg.process '||substr(sqlerrm,1,300));
2370: lb_completion_status := FND_CONCURRENT.SET_COMPLETION_STATUS('ERROR',substr(sqlerrm,1,1000));
2371: ERRBUF := substr(sqlerrm,1,1000);
2372: lv_inv_gen_process_flag := jai_constants.unexpected_error;
2373: lv_acct_process_flag := jai_constants.unexpected_error;
2374: lv_inv_gen_process_message := sqlerrm;
2375: lv_acct_process_message := sqlerrm;
2376:

Line 2373: lv_acct_process_flag := jai_constants.unexpected_error;

2369: Fnd_File.PUT_LINE(Fnd_File.LOG,'Unexpected Error occured in procedure jai_cmn_rgm_processing_pkg.process '||substr(sqlerrm,1,300));
2370: lb_completion_status := FND_CONCURRENT.SET_COMPLETION_STATUS('ERROR',substr(sqlerrm,1,1000));
2371: ERRBUF := substr(sqlerrm,1,1000);
2372: lv_inv_gen_process_flag := jai_constants.unexpected_error;
2373: lv_acct_process_flag := jai_constants.unexpected_error;
2374: lv_inv_gen_process_message := sqlerrm;
2375: lv_acct_process_message := sqlerrm;
2376:
2377: END PROCESS;