458: /*if order_number_from is not null then
459: BEGIN
460: SELECT HEADER_ID
461: INTO l_header_id_from
462: FROM OE_ORDER_HEADERS_ALL
463: WHERE ORDER_NUMBER = order_number_from;
464: END;
465: end if;
466: if order_number_from is not null then
466: if order_number_from is not null then
467: BEGIN
468: SELECT HEADER_ID
469: INTO l_header_id_to
470: FROM OE_ORDER_HEADERS_ALL
471: WHERE ORDER_NUMBER = order_number_to;
472: END;
473: end if;*/
474:
480: -- changed for MOAC
481: if order_number_from is not null and order_number_to is null
482: then
483: if l_input_org_id is not null then
484: l_header_id_stmt:= ' (SELECT header_id from oe_order_headers where order_number >=:m and org_id = :o)';
485: else
486: l_header_id_stmt:= ' (SELECT header_id from oe_order_headers where order_nu
487: mber >=:m)';
488: end if;
482: then
483: if l_input_org_id is not null then
484: l_header_id_stmt:= ' (SELECT header_id from oe_order_headers where order_number >=:m and org_id = :o)';
485: else
486: l_header_id_stmt:= ' (SELECT header_id from oe_order_headers where order_nu
487: mber >=:m)';
488: end if;
489: elsif order_number_from is null and order_number_to is not null
490: then
488: end if;
489: elsif order_number_from is null and order_number_to is not null
490: then
491: if l_input_org_id is not null then
492: l_header_id_stmt:= ' (SELECT Header_id from oe_order_headers where order_number <=:n and org_id = :o)';
493: else
494: l_header_id_stmt:= ' (SELECT Header_id from oe_order_headers where order_number <=:n)';
495: end if;
496: elsif order_number_from is not null and order_number_to is not null
490: then
491: if l_input_org_id is not null then
492: l_header_id_stmt:= ' (SELECT Header_id from oe_order_headers where order_number <=:n and org_id = :o)';
493: else
494: l_header_id_stmt:= ' (SELECT Header_id from oe_order_headers where order_number <=:n)';
495: end if;
496: elsif order_number_from is not null and order_number_to is not null
497: then
498: if l_input_org_id is not null then
495: end if;
496: elsif order_number_from is not null and order_number_to is not null
497: then
498: if l_input_org_id is not null then
499: l_header_id_stmt:= ' (SELECT Header_id from oe_order_headers where order_number between :m and :n and org_id = :o)';
500: else
501: l_header_id_stmt:= ' (SELECT Header_id from oe_order_headers where order_number between :m and :n)';
502: end if;
503: end if;
497: then
498: if l_input_org_id is not null then
499: l_header_id_stmt:= ' (SELECT Header_id from oe_order_headers where order_number between :m and :n and org_id = :o)';
500: else
501: l_header_id_stmt:= ' (SELECT Header_id from oe_order_headers where order_number between :m and :n)';
502: end if;
503: end if;
504:
505:
547: l_cnt_stmt := l_cnt_stmt || ' header_id <= :m and ';
548: end if;*/
549:
550: IF l_input_org_id IS NOT NULL THEN
551: l_org_id_stmt := ' header_id IN (SELECT header_id from oe_order_headers where org_id = :o)';
552: END IF;
553:
554: if l_header_id_stmt is not null
555: then
772:
773: BEGIN
774: SELECT ORDER_NUMBER,SOLD_TO_ORG_ID,ORDER_TYPE_ID,ORG_ID
775: INTO l_order_number,l_sold_to_org_id,l_order_type_id,l_org_id
776: FROM OE_ORDER_HEADERS
777: WHERE HEADER_ID = l_header_id;
778:
779: EXCEPTION WHEN OTHERS THEN
780: IF l_debug_level > 0 THEN
1080: if c_attr_tbl(j).attribute_id in (46, 47, 48,49) then
1081:
1082: -- get the instrument id for cc number
1083: l_sql_stmt_txn := 'select itev.instrument_id'||' ,ooh.Context '||
1084: ' from oe_order_headers ooh, oe_payments op, iby_trxn_extensions_v itev '||
1085: ' where '||
1086: ' ooh.header_id = :y'||' and ooh.header_id = op.header_id and op.line_id is null and nvl(op.payment_collection_event,''PREPAY'') = ''INVOICE'' and op.trxn_extension_id = itev.trxn_extension_id';
1087: else
1088: l_sql_stmt_txn := 'select '||c_attr_tbl(j).column_name||' ,Context '||
1085: ' where '||
1086: ' ooh.header_id = :y'||' and ooh.header_id = op.header_id and op.line_id is null and nvl(op.payment_collection_event,''PREPAY'') = ''INVOICE'' and op.trxn_extension_id = itev.trxn_extension_id';
1087: else
1088: l_sql_stmt_txn := 'select '||c_attr_tbl(j).column_name||' ,Context '||
1089: ' from oe_order_headers '||
1090: ' where '||
1091: ' header_id = :y';
1092: end if;
1093: