373: WHERE jrttv1.regime_code = jai_constants.vat_regime
374: UNION
375: SELECT 'VAT REVERSAL' tax_type FROM DUAL
376: ) jrttv
377: WHERE cp_source = jai_pa_billing_pkg.gv_source_projects
378: AND jpdi.draft_invoice_id = jpdil.draft_invoice_id
379: AND jpdil.draft_invoice_line_id = jcdt.source_doc_line_id
380: AND jcdt.source_doc_id = jpdi.draft_invoice_id
381: AND jcdt.source_doc_type = jai_pa_billing_pkg.gv_source_projects
377: WHERE cp_source = jai_pa_billing_pkg.gv_source_projects
378: AND jpdi.draft_invoice_id = jpdil.draft_invoice_id
379: AND jpdil.draft_invoice_line_id = jcdt.source_doc_line_id
380: AND jcdt.source_doc_id = jpdi.draft_invoice_id
381: AND jcdt.source_doc_type = jai_pa_billing_pkg.gv_source_projects
382: AND jcdt.tax_type = jrttv.tax_type
383: AND jpdi.draft_invoice_id = p_delivery_id
384: GROUP BY jpdi.draft_invoice_id, jcdt.tax_type, jcdt.tax_id, jcdt.tax_rate;
385: /* end bug# 6012570 (5876390) */
590: upper(jai_constants.source_wsh)
591: -- added by Allen Yang for bug 9485355 (12.1.3 non-shippable Enhancement), begin
592: ,upper(jai_constants.source_nsh)
593: -- added by Allen Yang for bug 9485355 (12.1.3 non-shippable Enhancement), end
594: , jai_pa_billing_pkg.gv_source_projects /* Bug# 6012570 (5876390) */
595: )
596: THEN
597:
598: if jai_pa_billing_pkg.gv_debug then
594: , jai_pa_billing_pkg.gv_source_projects /* Bug# 6012570 (5876390) */
595: )
596: THEN
597:
598: if jai_pa_billing_pkg.gv_debug then
599: jai_cmn_utils_pkg.print_log ( jai_pa_billing_pkg.file, '3 rgm_om_ar_vat_accnt_pkg.process_order_invoice . Psource:'||p_source);
600: end if;
601:
602: /* Start Bug# 6012570 (5876390) */
595: )
596: THEN
597:
598: if jai_pa_billing_pkg.gv_debug then
599: jai_cmn_utils_pkg.print_log ( jai_pa_billing_pkg.file, '3 rgm_om_ar_vat_accnt_pkg.process_order_invoice . Psource:'||p_source);
600: end if;
601:
602: /* Start Bug# 6012570 (5876390) */
603: if upper(p_source) = upper(jai_constants.source_wsh) then
606: lv_source_table_name := jai_constants.tname_dlry_dtl;
607: lv_called_from := jai_constants.vat_repo_call_from_om_ar;
608: lv_attribute_context := jai_constants.contxt_delivery;
609:
610: elsif p_source = jai_pa_billing_pkg.gv_source_projects then
611: record_debug_messages ('6 Projects Draft Invoice PROCESSING');
612: lv_source_trx_type := jai_pa_billing_pkg.gv_trx_type_draft_invoice; -- 'DRAFT_INVOICE';
613: lv_source_table_name := jai_pa_billing_pkg.gv_draft_invoice_table; -- 'JAI_PA_DRAFT_INVOICES';
614: lv_called_from := p_called_from;
608: lv_attribute_context := jai_constants.contxt_delivery;
609:
610: elsif p_source = jai_pa_billing_pkg.gv_source_projects then
611: record_debug_messages ('6 Projects Draft Invoice PROCESSING');
612: lv_source_trx_type := jai_pa_billing_pkg.gv_trx_type_draft_invoice; -- 'DRAFT_INVOICE';
613: lv_source_table_name := jai_pa_billing_pkg.gv_draft_invoice_table; -- 'JAI_PA_DRAFT_INVOICES';
614: lv_called_from := p_called_from;
615: lv_attribute_context := jai_pa_billing_pkg.gv_draft_invoice_release; -- 'DRAFT_INVOICE_RELEASE';
616: -- added by Allen Yang for bug 9485355 (12.1.3 non-shippable Enhancement), begin
609:
610: elsif p_source = jai_pa_billing_pkg.gv_source_projects then
611: record_debug_messages ('6 Projects Draft Invoice PROCESSING');
612: lv_source_trx_type := jai_pa_billing_pkg.gv_trx_type_draft_invoice; -- 'DRAFT_INVOICE';
613: lv_source_table_name := jai_pa_billing_pkg.gv_draft_invoice_table; -- 'JAI_PA_DRAFT_INVOICES';
614: lv_called_from := p_called_from;
615: lv_attribute_context := jai_pa_billing_pkg.gv_draft_invoice_release; -- 'DRAFT_INVOICE_RELEASE';
616: -- added by Allen Yang for bug 9485355 (12.1.3 non-shippable Enhancement), begin
617: elsif p_source = upper(jai_constants.source_nsh) then
611: record_debug_messages ('6 Projects Draft Invoice PROCESSING');
612: lv_source_trx_type := jai_pa_billing_pkg.gv_trx_type_draft_invoice; -- 'DRAFT_INVOICE';
613: lv_source_table_name := jai_pa_billing_pkg.gv_draft_invoice_table; -- 'JAI_PA_DRAFT_INVOICES';
614: lv_called_from := p_called_from;
615: lv_attribute_context := jai_pa_billing_pkg.gv_draft_invoice_release; -- 'DRAFT_INVOICE_RELEASE';
616: -- added by Allen Yang for bug 9485355 (12.1.3 non-shippable Enhancement), begin
617: elsif p_source = upper(jai_constants.source_nsh) then
618: record_debug_messages ('6 Non-Shippable Item PROCESSING');
619: lv_source_trx_type := jai_constants.source_ttype_non_shippable;
633: /* Bug 5739005 vkantamn --Parameters needed in cur_get_deliveries */
634: FOR rec_cur_get_deliveries IN cur_get_deliveries(p_source, lv_source_trx_type, lv_source_table_name)
635: LOOP
636:
637: if jai_pa_billing_pkg.gv_debug then
638: jai_cmn_utils_pkg.print_log ( jai_pa_billing_pkg.file, '4 rgm_om_ar_vat_accnt_pkg.process_order_invoice. Loop TaxId:'||rec_cur_get_deliveries.tax_id);
639: end if;
640:
641: record_debug_messages (' ************7 PROCESSING Delivery id -> '|| p_delivery_id||'Delivery Details ID -> '||rec_cur_get_deliveries.delivery_detail_id||' ************' );
634: FOR rec_cur_get_deliveries IN cur_get_deliveries(p_source, lv_source_trx_type, lv_source_table_name)
635: LOOP
636:
637: if jai_pa_billing_pkg.gv_debug then
638: jai_cmn_utils_pkg.print_log ( jai_pa_billing_pkg.file, '4 rgm_om_ar_vat_accnt_pkg.process_order_invoice. Loop TaxId:'||rec_cur_get_deliveries.tax_id);
639: end if;
640:
641: record_debug_messages (' ************7 PROCESSING Delivery id -> '|| p_delivery_id||'Delivery Details ID -> '||rec_cur_get_deliveries.delivery_detail_id||' ************' );
642: /*******************************
659: /* Start Bug# 6012570 (5876390) */
660: if upper(p_source) = upper(jai_constants.source_wsh) then
661: ln_source_id := rec_cur_get_deliveries.delivery_detail_id;
662:
663: elsif p_source = jai_pa_billing_pkg.gv_source_projects then
664: ln_source_id := rec_cur_get_deliveries.delivery_id; /* this is draft_invoice_id */
665: -- added by Allen Yang for bug 9485355 (12.1.3 non-shippable Enhancement), begin
666: elsif p_source = upper(jai_constants.source_nsh) then
667: ln_source_id := rec_cur_get_deliveries.order_line_id;
799:
800: record_debug_messages ('11 Before call to jai_cmn_rgm_recording_pkg.insert_vat_repository_entry');
801:
802:
803: if jai_pa_billing_pkg.gv_debug then
804: jai_cmn_utils_pkg.print_log ( jai_pa_billing_pkg.file, '6 rgm_om_ar_vat_accnt_pkg.process_order_invoice. Bef jai_cmn_rgm_recording_pkg.insert_vat_repository_entry');
805: end if;
806:
807: jai_cmn_rgm_recording_pkg.insert_vat_repository_entry (
800: record_debug_messages ('11 Before call to jai_cmn_rgm_recording_pkg.insert_vat_repository_entry');
801:
802:
803: if jai_pa_billing_pkg.gv_debug then
804: jai_cmn_utils_pkg.print_log ( jai_pa_billing_pkg.file, '6 rgm_om_ar_vat_accnt_pkg.process_order_invoice. Bef jai_cmn_rgm_recording_pkg.insert_vat_repository_entry');
805: end if;
806:
807: jai_cmn_rgm_recording_pkg.insert_vat_repository_entry (
808: pn_repository_id => ln_repository_id ,
847: -----------------------------------------------------------------------------------------------------------------
848: --Modified by Bo Li for replacing old attribtue columns with new ones End
849: );
850:
851: if jai_pa_billing_pkg.gv_debug then
852: jai_cmn_utils_pkg.print_log ( jai_pa_billing_pkg.file, '7 rgm_om_ar_vat_accnt_pkg.process_order_invoice. After callto insert_vat_repository_entry'
853: ||', ln_repository_id:'||ln_repository_id
854: ||', lv_process_flag:'||lv_process_flag
855: ||', lv_process_message:'||lv_process_message
848: --Modified by Bo Li for replacing old attribtue columns with new ones End
849: );
850:
851: if jai_pa_billing_pkg.gv_debug then
852: jai_cmn_utils_pkg.print_log ( jai_pa_billing_pkg.file, '7 rgm_om_ar_vat_accnt_pkg.process_order_invoice. After callto insert_vat_repository_entry'
853: ||', ln_repository_id:'||ln_repository_id
854: ||', lv_process_flag:'||lv_process_flag
855: ||', lv_process_message:'||lv_process_message
856: );
910: ||', p_attribute_context -> ' || jai_constants.contxt_delivery
911: );
912:
913:
914: if jai_pa_billing_pkg.gv_debug then
915: jai_cmn_utils_pkg.print_log ( jai_pa_billing_pkg.file, '9 rgm_om_ar_vat_accnt_pkg.process_order_invoice. Before callto jai_cmn_rgm_recording_pkg.do_vat_accounting.');
916: end if;
917:
918: jai_cmn_rgm_recording_pkg.do_vat_accounting (
911: );
912:
913:
914: if jai_pa_billing_pkg.gv_debug then
915: jai_cmn_utils_pkg.print_log ( jai_pa_billing_pkg.file, '9 rgm_om_ar_vat_accnt_pkg.process_order_invoice. Before callto jai_cmn_rgm_recording_pkg.do_vat_accounting.');
916: end if;
917:
918: jai_cmn_rgm_recording_pkg.do_vat_accounting (
919: pn_regime_id => p_regime_id ,
943: pv_reference_name => /*jai_constants.JAI_CMN_TAXES_ALL*/'JA_IN_TAX_CODES' ,
944: pn_reference_id => rec_cur_get_deliveries.tax_id
945: );
946:
947: if jai_pa_billing_pkg.gv_debug then
948: jai_cmn_utils_pkg.print_log ( jai_pa_billing_pkg.file, '9 rgm_om_ar_vat_accnt_pkg.process_order_invoice. After callto do_vat_accounting.'
949: ||', lv_process_flag:'||lv_process_flag
950: ||', lv_process_message:'||lv_process_message
951: );
944: pn_reference_id => rec_cur_get_deliveries.tax_id
945: );
946:
947: if jai_pa_billing_pkg.gv_debug then
948: jai_cmn_utils_pkg.print_log ( jai_pa_billing_pkg.file, '9 rgm_om_ar_vat_accnt_pkg.process_order_invoice. After callto do_vat_accounting.'
949: ||', lv_process_flag:'||lv_process_flag
950: ||', lv_process_message:'||lv_process_message
951: );
952: end if;