25: third party invoices only once. All RECEIVE and CORRECT of RECEIVE
26: type of transactions are considered for generating third party invoices.
27:
28: If a CORRECT to RECEIVE happens after third party invoice is
29: generated, third_party_flag in JAI_RCV_TRANSACTIONS is set to 'G'
30: to indicate that third party invoice has already been generated.
31:
32: This clean up also has introduced two tables which help in tracking
33: third party invoices.
75: (1) Added conditions in procedure process_receipt
76: in cursor c_thirdparty_tax_rec.
77: (a) Added shipment header id condition
78: (b) added aliases.
79: (c) Removed two separate conditions on jai_rcv_Transactions
80: and clubbed into a single one.
81: (2) Added aliases for the following cursors.
82: (a) c_get_thirdparty_count
83: (b) c_get_thirdparty_null_site_cnt
144: )
145: is
146:
147: /* Added by Ramananda for removal of SQL LITERALs */
148: lv_ttype_receive JAI_RCV_TRANSACTIONS.transaction_type%type;
149: lv_ttype_correct JAI_RCV_TRANSACTIONS.transaction_type%type;
150:
151: cursor c_pending_tp_receipts(cp_org_id number) is
152: /* modified cursor - included org_id parameter for bug 4695630 */
145: is
146:
147: /* Added by Ramananda for removal of SQL LITERALs */
148: lv_ttype_receive JAI_RCV_TRANSACTIONS.transaction_type%type;
149: lv_ttype_correct JAI_RCV_TRANSACTIONS.transaction_type%type;
150:
151: cursor c_pending_tp_receipts(cp_org_id number) is
152: /* modified cursor - included org_id parameter for bug 4695630 */
153: /* Modified by Ramananda for removal of SQL LITERALs :bug#4428980*/
151: cursor c_pending_tp_receipts(cp_org_id number) is
152: /* modified cursor - included org_id parameter for bug 4695630 */
153: /* Modified by Ramananda for removal of SQL LITERALs :bug#4428980*/
154: select shipment_header_id -- Bug 4941642
155: from JAI_RCV_TRANSACTIONS jrt
156: where ( transaction_type = lv_ttype_receive --'RECEIVE'
157: or
158: (transaction_type = lv_ttype_correct and parent_transaction_type = lv_ttype_receive) --'CORRECT', 'RECEIVE'
159: )
297: );
298:
299:
300: if nvl(p_simulation, 'N') <> 'Y' then
301: update JAI_RCV_TRANSACTIONS jrt
302: set third_party_flag = lv_process_flag
303: where shipment_header_id = r_pending_tp_receipts.shipment_header_id
304: and ( transaction_type = 'RECEIVE'
305: or
420: where shipment_header_id = p_shipment_header_id
421: and transaction_type = 'RECEIVE';
422:
423: /* Added by Ramananda for removal of SQL LITERALs */
424: lv_ttype_receive JAI_RCV_TRANSACTIONS.transaction_type%type;
425: lv_ttype_correct JAI_RCV_TRANSACTIONS.transaction_type%type;
426:
427: /* Bug 4941642. Added by Lakshmi Gopalsami
428: Added aliases for the following cursors and
421: and transaction_type = 'RECEIVE';
422:
423: /* Added by Ramananda for removal of SQL LITERALs */
424: lv_ttype_receive JAI_RCV_TRANSACTIONS.transaction_type%type;
425: lv_ttype_correct JAI_RCV_TRANSACTIONS.transaction_type%type;
426:
427: /* Bug 4941642. Added by Lakshmi Gopalsami
428: Added aliases for the following cursors and
429: Added alias and shipment_header_id and
444: where jrlt.shipment_header_id = p_shipment_header_id
445: and EXISTS
446: (
447: select 1
448: from JAI_RCV_TRANSACTIONS jrt
449: where jrt.shipment_header_id = jrlt.shipment_header_id
450: AND jrt.shipment_line_id = jrlt.shipment_line_id
451: AND ( jrt.transaction_type = lv_ttype_receive --'RECEIVE'
452: or
477: where jrlt.shipment_header_id = p_shipment_header_id
478: and EXISTS
479: (
480: select 1
481: from JAI_RCV_TRANSACTIONS jrt
482: where jrt.shipment_header_id = jrlt.shipment_header_id
483: AND jrt.shipment_line_id = jrlt.shipment_line_id
484: AND ( jrt.transaction_type = lv_ttype_receive --'RECEIVE'
485: or
511: where jrlt.shipment_header_id = p_shipment_header_id
512: and EXISTS
513: (
514: select 1
515: from JAI_RCV_TRANSACTIONS jrt
516: where jrt.shipment_header_id = jrlt.shipment_header_id
517: AND jrt.shipment_line_id = jrlt.shipment_line_id
518: AND ( jrt.transaction_type = lv_ttype_receive
519: or
600: from dual;
601:
602: cursor c_check_if_already_processed(p_shipment_header_id number) is
603: select count(transaction_id)
604: from JAI_RCV_TRANSACTIONS
605: where shipment_header_id = p_shipment_header_id
606: and third_party_flag not in ('N', 'X');
607:
608:
670: , jai_cmn_taxes_all jcta --added by eric for inclusive tax
671: where
672: ( jrtv.transaction_id, jrtv.shipment_line_id ) IN
673: ( select transaction_id, shipment_line_id
674: from JAI_RCV_TRANSACTIONS jrt
675: where shipment_header_id = pn_shipment_header_id
676: and ( transaction_type = lv_ttype_receive --'RECEIVE'
677: or
678: (transaction_type = lv_ttype_correct
865: (
866: /*Bug 4941642. Added by Lakshmi Gopalsami
867: (1) Added shipment header id condition
868: (2) added aliases.
869: (3) Removed two separate conditions on jai_rcv_Transactions
870: and clubbed into a single one.
871: */
872: select
873: jrtv.vendor_id
881: , jai_cmn_taxes_all jcta --added by eric for inclusive tax
882: where
883: ( jrtv.transaction_id, jrtv.shipment_line_id ) IN
884: ( select transaction_id, shipment_line_id
885: from JAI_RCV_TRANSACTIONS jrt
886: where shipment_header_id = p_shipment_header_id
887: and ( transaction_type = lv_ttype_receive --'RECEIVE'
888: or
889: (transaction_type = lv_ttype_correct
1265:
1266: /*Bug 4941642. Added by Lakshmi Gopalsami
1267: (1) Added shipment header id condition
1268: (2) added aliases.
1269: (3) Removed two separate conditions on jai_rcv_Transactions
1270: and clubbed into a single one.
1271: */
1272: FOR Tax_rec IN
1273: ( SELECT
1278: , jai_cmn_taxes_all jcta --added by eric for inclusive tax
1279: WHERE jrlt.shipment_header_id = p_shipment_header_id
1280: AND (jrlt.transaction_id, jrlt.shipment_line_id) in
1281: ( SELECT jrt.transaction_id,jrt.shipment_line_id
1282: FROM JAI_RCV_TRANSACTIONS jrt
1283: WHERE jrt.shipment_header_id = p_shipment_header_id
1284: AND ( jrt.transaction_type = lv_ttype_receive
1285: or
1286: (jrt.transaction_type = lv_ttype_correct