DBA Data[Home] [Help]

APPS.PORCPTWF SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 14

  PROCEDURE NAME:	Select_Orders

  DESCRIPTION:          This server procedure is defined as a concurrent
			PL/SQL executable program and is scheduled to run
			from the Concurrent Manager at a regular intervals
			(e.g. every day).

                        This procedure does the following:
			- Open a cursor on RCV_CONFIRM_RECEIPT_V table to
			  select open PO shipments.  The records are grouped
			  by PO number, Requester ID and Due date.

                        - For each unique PO number, Requester ID and Due date
		 	  it calls the Start_Rcpt_Process to initiate the
		 	  Confirm Receipt workflow process.

  CHANGE HISTORY:       WLAU       1/15/1997     Created
                        WLAU       2/25/1997     Added WF_PURGE.total to delete
                                                 the completed WF activities
===========================================================================*/

TYPE rcpt_record IS RECORD (

  line_number        NUMBER,
  expected_qty       NUMBER,
  quantity_received  NUMBER,
  ordered_qty NUMBER,
  unit_of_measure    VARCHAR2(25),
  item_description   VARCHAR2(240),
  currency_code  VARCHAR2(15),
  unit_price NUMBER,
  po_distribution_id NUMBER);
Line: 90

        SELECT int_err.error_message_name
          INTO x_message_token
          FROM po_interface_errors int_err
         WHERE int_err.batch_id = x_group_id
           AND int_err.interface_transaction_id =
               (SELECT MIN(int_err2.interface_transaction_id)
                  FROM po_interface_errors int_err2
                 WHERE int_err2.batch_id = x_group_id);
Line: 129

  x_inserted_txn              BOOLEAN;
Line: 130

  x_insert_txns_count         NUMBER := 0;
Line: 141

  x_insert_txns_status        NUMBER;
Line: 158

  type select_shipments_Cursor is ref cursor ;
Line: 159

  Porcpt_Shipment select_shipments_Cursor;
Line: 165

      SELECT rcv_interface_groups_s.nextval
        INTO   x_group_id
        FROM   sys.dual;
Line: 178

          	SELECT rcv.po_header_id,
		  po_line_location_id,
                  expected_receipt_qty,
		  primary_uom,
                  -- Bug 4672728
                  primary_uom_non_tl,
		  item_id,
                  primary_uom_class,
                  to_organization_id,
		  po_distribution_id,
		  null,
		  null,
		  null
             FROM  POR_RCV_ALL_ITEMS_V1 rcv
            WHERE ((expected_receipt_date is not NULL
                  AND trunc(rcv.expected_receipt_date + 1) <=
							trunc(SYSDATE))
                 OR EXISTS (SELECT 1 FROM ap_holds aph
                      WHERE aph.line_location_id = rcv.po_line_location_id
		        AND aph.hold_lookup_code in ('QTY REC', 'AMT REC')
		        AND aph.release_lookup_code IS NULL
		        AND rcv.quantity_invoiced > quantity_delivered
		        AND rcv.quantity_invoiced <= ordered_qty))
              AND NVL(receipt_required_flag,'N') = 'Y'
              AND destination_type_code = 'EXPENSE'
              AND requestor_id is not NULL
              AND expected_receipt_qty > 0
              AND po_header_ID = x_po_header_ID
              AND requestor_ID = x_requester_ID;
Line: 209

          	SELECT po_header_id,
		  po_line_location_id,
                  expected_receipt_qty,
		  primary_uom,
                  -- Bug 4672728
                  primary_uom_non_tl,
		  item_id,
                  primary_uom_class,
                  to_organization_id,
		  po_distribution_id,
		  null,
		  null,
		  null
            FROM  POR_RCV_ALL_ITEMS_V1 rcv
            WHERE ((expected_receipt_date is not NULL
                  AND trunc(rcv.expected_receipt_date + 1) <=
							trunc(SYSDATE))
                 OR EXISTS (SELECT 1 FROM ap_holds aph
                      WHERE aph.line_location_id = rcv.po_line_location_id
		        AND aph.hold_lookup_code in ('QTY REC', 'AMT REC')
		        AND aph.release_lookup_code IS NULL
		        AND rcv.quantity_invoiced > quantity_delivered
		        AND rcv.quantity_invoiced <= ordered_qty))
              AND NVL(receipt_required_flag,'N') = 'Y'
              AND requestor_id is not NULL
              AND expected_receipt_qty > 0
              AND po_header_ID = x_po_header_ID
              AND requestor_ID = x_requester_ID;
Line: 255

	 	x_insert_txns_status := POR_RCV_ORD_SV.groupPoTransaction( t_po_header_id,
					 t_line_location_id,
					 t_expected_receipt_qty,
                                         -- Bug 4672728 - We need to pass the
					 -- non translated UOM for standard UOM conversion
					 --t_ordered_uom,
					 t_ordered_uom_non_tl,
					 SYSDATE,
					 t_item_id,
					 t_primary_uom_class,
					 t_org_id,
					 t_po_distribution_id,
					 x_group_id,
					 'AUTO_RECEIVE',
					 t_Comments,
                            		 t_PackingSlip,
                            		 t_WayBillNum);
Line: 275

	IF x_insert_txns_status = 0 THEN
            x_RCV_txns_rc :=  por_rcv_ord_sv.process_transactions(X_group_id, 'AUTO_RECEIVE');
Line: 300

  PROCEDURE NAME:	Select_Orders

  DESCRIPTION:          This server procedure is defined as a concurrent
			PL/SQL executable program and is scheduled to run
			from the Concurrent Manager at a regular intervals
			(e.g. every day).

                        This procedure does the following:
			- Open a cursor on RCV_CONFIRM_RECEIPT_V table to
			  select open PO shipments.  The records are grouped
			  by PO number, Requester ID and Due date.

                        - For each unique PO number, Requester ID and Due date
		 	  it calls the Start_Rcpt_Process to initiate the
		 	  Confirm Receipt workflow process.

  CHANGE HISTORY:       WLAU       1/15/1997     Created
                        WLAU       2/25/1997     Added WF_PURGE.total to delete
                                                 the completed WF activities
===========================================================================*/

 PROCEDURE Select_Orders  IS


   -- Define cursor for selecting records to start the Purchasing
   -- Confirm Receipt workflow process.  Records are retrieved from
   -- the RCV_CONFIRM_RECEIPT_V view which is shared by the
     -- Receive Orders Web Page.

     type select_orders_Cursor is ref cursor ;
Line: 331

    Porcpt_c select_orders_Cursor;
Line: 380

        SELECT rcv.po_header_ID,  rcv.requestor_ID,
               rcv.expected_receipt_date, rcv.revision_num,
               rcv.po_distribution_id, po_num_rel_num
        FROM  POR_RCV_ALL_ITEMS_V1 rcv
        WHERE ( (rcv.expected_receipt_date is not NULL
                AND trunc(rcv.expected_receipt_date + 1) <=
                                                trunc(SYSDATE)
                 )
	       OR EXISTS (SELECT 1 FROM ap_holds aph
                 WHERE aph.line_location_id = rcv.po_line_location_id
	           AND aph.hold_lookup_code in ('QTY REC', 'AMT REC')
	           AND aph.release_lookup_code IS NULL
	           AND rcv.quantity_invoiced > quantity_delivered
	           AND rcv.quantity_invoiced <= ordered_qty
                  )
               )
          AND is_complex_po(rcv.po_header_ID)<>'Y' -- Bug 15921367
          AND NVL(receipt_required_flag,'N') = 'Y'
          AND destination_type_code = 'EXPENSE'
          AND requestor_ID is not NULL
	  AND expected_receipt_qty > 0
        GROUP BY rcv.po_header_ID, rcv.requestor_ID,
                 rcv.expected_receipt_date, rcv.revision_num,
                 rcv.po_distribution_id, po_num_rel_num;
Line: 406

        SELECT rcv.po_header_ID, rcv.requestor_ID,
               rcv.expected_receipt_date, rcv.revision_num,
               rcv.po_distribution_id, po_num_rel_num
	FROM  POR_RCV_ALL_ITEMS_V1 rcv
        WHERE ( (rcv.expected_receipt_date is not NULL
                AND trunc(rcv.expected_receipt_date + 1) <=
                                                trunc(SYSDATE)
                 )
	       OR EXISTS (SELECT 1 FROM ap_holds aph
                 WHERE aph.line_location_id = rcv.po_line_location_id
	           AND aph.hold_lookup_code in ('QTY REC', 'AMT REC')
	           AND aph.release_lookup_code IS NULL
	           AND rcv.quantity_invoiced > quantity_delivered
	           AND rcv.quantity_invoiced <= ordered_qty
                  )
               )
          AND is_complex_po(rcv.po_header_ID)<>'Y' -- Bug 15921367
          AND NVL(receipt_required_flag,'N') = 'Y'
          AND requestor_ID is not NULL
	  AND expected_receipt_qty > 0
        GROUP BY rcv.po_header_ID, rcv.requestor_ID,
                 rcv.expected_receipt_date, rcv.revision_num,
                 rcv.po_distribution_id, po_num_rel_num;
Line: 449

     		select PORL.auto_receive_flag
     		into  x_auto_receive_flag
                from  PO_REQUISITION_LINES PORL,
                      PO_REQ_DISTRIBUTIONS PORD,
		      PO_DISTRIBUTIONS pod
                where PORD.DISTRIBUTION_ID = POD.REQ_DISTRIBUTION_ID AND
		  PORD.REQUISITION_LINE_ID = PORL.requisition_line_id AND
		  POD.PO_DISTRIBUTION_ID = x_po_distribution_id;
Line: 474

             select sysdate into x_sys_date from dual;
Line: 487

                SELECT count(1) into x_item_key_count
                FROM wf_items
                WHERE item_type = 'PORCPT'
	          AND item_key like x_po_header_id||';'|| x_requester_id||';%'
Line: 507

		   update po_distributions
		   set wf_item_key = ''
		   where po_header_id = x_po_header_ID
		     and wf_item_key like x_po_header_ID||';'||x_requester_id||';%';
Line: 544

	Select_Internal_Orders;
Line: 549

             wf_core.context ('PORCPTWF','Select_Orders','No data found');
Line: 551

       	     wf_core.context ('PORCPTWF','Select_Orders','SQL error ' || sqlcode);
Line: 555

  END Select_Orders;
Line: 572

  x_inserted_txn_status              NUMBER := 0;
Line: 589

  type select_shipments_Cursor is ref cursor ;
Line: 590

  Porcpt_Shipment select_shipments_Cursor;
Line: 596

      SELECT rcv_interface_groups_s.nextval
        INTO   x_group_id
        FROM   sys.dual;
Line: 606

		SELECT REQUISITION_LINE_ID,
			EXPECTED_RECEIPT_QTY,
			PRIMARY_UOM,
			ITEM_ID,
			PRIMARY_UOM_CLASS,
			TO_ORGANIZATION_ID,
			COMMENTS,
 			PACKING_SLIP,
 			WAYBILL_AIRBILL_NUM
            FROM  POR_CONFIRM_INTERNAL_RECEIPT_V
            WHERE expected_receipt_date is not NULL
              AND expected_receipt_date = x_exp_receipt_date
              AND destination_type_code = 'EXPENSE'
              AND requestor_id is not NULL
              AND expected_receipt_qty > 0
              AND so_header_ID = x_header_ID
              AND requestor_ID = x_requester_ID;
Line: 625

		SELECT REQUISITION_LINE_ID,
			EXPECTED_RECEIPT_QTY,
			PRIMARY_UOM,
			ITEM_ID,
			PRIMARY_UOM_CLASS,
			TO_ORGANIZATION_ID,
			COMMENTS,
 			PACKING_SLIP,
 			WAYBILL_AIRBILL_NUM
            FROM  POR_CONFIRM_INTERNAL_RECEIPT_V
            WHERE expected_receipt_date is not NULL
              AND expected_receipt_date = x_exp_receipt_date
              AND requestor_id is not NULL
              AND expected_receipt_qty > 0
              AND so_header_ID = x_header_ID
              AND requestor_ID = x_requester_ID;
Line: 659

             x_inserted_txn_status :=   POR_RCV_ORD_SV.groupInternalTransaction (t_req_line_id,
                        t_expected_receipt_qty,
                        t_ordered_uom,
                        t_item_id,
			t_primary_uom_class,
			t_org_id,
                        t_comments,
                        t_packingSlip,
                        t_waybillNum,
			x_group_id,
			x_exp_receipt_date,
			'WP4_CONFIRM');
Line: 676

	IF x_inserted_txn_status = 0 THEN

            x_RCV_txns_rc :=  por_rcv_ord_sv.process_transactions(X_group_id, 'AUTO_RECEIVE');
Line: 702

PROCEDURE Select_Internal_Orders  IS


   -- Define cursor for selecting records to start the Purchasing
   -- Confirm Receipt workflow process.  Records are retrieved from
   -- the RCV_CONFIRM_RECEIPT_V view which is shared by the
     -- Receive Orders Web Page.

     type select_orders_Cursor is ref cursor ;
Line: 712

    Porcpt_c select_orders_Cursor;
Line: 762

             SELECT 	so_header_ID,
			requestor_ID,
			expected_receipt_date,
			requisition_line_ID,
			requisition_header_ID
              FROM POR_CONFIRM_INTERNAL_RECEIPT_V
             WHERE expected_receipt_date is not NULL
               AND trunc(expected_receipt_date + 1) <= trunc(SYSDATE)
 	       AND destination_type_code = 'EXPENSE'
               AND requestor_ID is not NULL
	       AND expected_receipt_qty > 0
            GROUP BY so_header_ID, requestor_ID,  expected_receipt_date, requisition_line_ID, requisition_header_ID;
Line: 778

             SELECT 	so_header_ID,
			requestor_ID,
			expected_receipt_date,
			requisition_line_ID,
			requisition_header_ID
              FROM  POR_CONFIRM_INTERNAL_RECEIPT_V
              WHERE expected_receipt_date is not NULL
                AND trunc(expected_receipt_date + 1) <= trunc(SYSDATE)
 	        AND requestor_ID is not NULL
		  AND expected_receipt_qty > 0
             GROUP BY so_header_ID, requestor_ID,  expected_receipt_date, requisition_line_ID, requisition_header_ID;
Line: 812

     		select PORL.auto_receive_flag
     		into  x_auto_receive_flag
                from  PO_REQUISITION_LINES PORL
                where PORL.requisition_line_id = x_requisition_line_ID;
Line: 850

               SELECT count(1) into x_item_key_count
               FROM wf_items
               WHERE item_type = 'PORCPT'
	         AND item_key like x_header_id||';'|| x_requester_id||';%'
Line: 894

             wf_core.context ('PORCPTWF','Select_Internal_Orders','No data found');
Line: 896

       	     wf_core.context ('PORCPTWF','Select_Internal_Orders','SQL error ' || sqlcode);
Line: 900

  END Select_Internal_Orders;
Line: 1029

      	Select 'X'
        Into   dummy
      	From   per_workforce_current_x
      	Where  person_id = x_requester_id;
Line: 1045

                select agent_id
                into x_buyer_id
                from po_headers
                where po_header_id=x_header_id;
Line: 1178

       SELECT poh.segment1,
	      pov.vendor_name,
              poh.agent_id,
              poh.note_to_receiver
         INTO x_po_number,
	      x_supplier_name,
              x_buyer_id,
              x_note_to_receiver
	 FROM PO_HEADERS poh,
              PO_VENDORS pov
        WHERE po_header_id = x_po_header_id
          AND poh.vendor_id = pov.vendor_id (+);
Line: 1369

    select ORDER_NUMBER
      into x_so_number
      from oe_order_headers_all osh
     where osh.HEADER_ID = x_so_header_id;
Line: 1611

	SELECT FND.user_id
	       INTO   x_user_id
	       FROM   FND_USER FND
	       WHERE  FND.USER_NAME = x_requester_username
	       AND    FND.START_DATE < sysdate
	       AND    nvl(FND.END_DATE, sysdate + 1) >= sysdate
	       AND    ROWNUM = 1;
Line: 1624

        select MIN(fr.responsibility_id)
        into x_resp_id
        from fnd_user_resp_groups fur,
             fnd_responsibility_vl fr,
             financials_system_parameters fsp
          where fur.user_id = x_user_id
            and fur.responsibility_application_id in (x_ip_resp_appl_id, x_po_resp_appl_id)
            and fur.responsibility_id = fr.responsibility_id
            and fr.start_date < sysdate
            and nvl(fr.end_date, sysdate +1) >= sysdate
            and fur.start_date < sysdate
            and nvl(fur.end_date, sysdate +1) >= Sysdate
            AND nvl(fnd_profile.value_specific('ORG_ID', NULL,
                fr.responsibility_id, fur.responsibility_application_id),-1) = nvl(x_org_id,-1)
                and nvl(fsp.org_id,-1) = nvl(x_org_id,-1)
                and nvl(fsp.business_group_id,-1) =
                    nvl(fnd_profile.value_specific('PER_BUSINESS_GROUP_ID', NULL,
                        fr.responsibility_id, fur.responsibility_application_id),-1);
Line: 1646

  /* Bug 6277620- FP of 6054138 - Select the ip/po responsibility first and if not found then look for custom responsibilities*/
  /* Added 'x_resp_id is null' condition for the 13412804(Fp of 13372606) */
   if ((x_resp_id = -1) or (x_resp_id is null)) THEN
      BEGIN
        select MIN(fr.responsibility_id)
        into x_resp_id
        from fnd_user_resp_groups fur,
             fnd_responsibility_vl fr,
             financials_system_parameters fsp
          where fur.user_id = x_user_id
	          and fur.responsibility_id = fr.responsibility_id
            and fr.start_date < sysdate
            and nvl(fr.end_date, sysdate +1) >= sysdate
            and fur.start_date < sysdate
            and nvl(fur.end_date, sysdate +1) >= Sysdate
            AND nvl(fnd_profile.value_specific('ORG_ID', NULL,
                fr.responsibility_id, fur.responsibility_application_id),-1) = nvl(x_org_id,-1)
                and nvl(fsp.org_id,-1) = nvl(x_org_id,-1)
                and nvl(fsp.business_group_id,-1) =
                    nvl(fnd_profile.value_specific('PER_BUSINESS_GROUP_ID', NULL,
                        fr.responsibility_id, fur.responsibility_application_id),-1);
Line: 1675

       SELECT MIN(responsibility_application_id)
       INTO x_resp_appl_id
       FROM fnd_user_resp_groups  fur,
            fnd_responsibility_vl fr,
            financials_system_parameters fsp
       WHERE
            fur.responsibility_id = fr.responsibility_id and
            fr.responsibility_id = x_resp_id and
            fur.user_id = x_user_id and
            fr.start_date < sysdate and
            nvl(fr.end_date, sysdate +1) >= sysdate and
            fur.start_date < sysdate and
            nvl(fur.end_date, sysdate +1) >= Sysdate AND
            nvl(fnd_profile.value_specific('ORG_ID', NULL, fr.responsibility_id,
                fur.responsibility_application_id),-1) = nvl(x_org_id,-1) and
            nvl(fsp.org_id,-1) = nvl(x_org_id,-1) and
            nvl(fsp.business_group_id,-1) =
            nvl(fnd_profile.value_specific('PER_BUSINESS_GROUP_ID', NULL,
            fr.responsibility_id, fur.responsibility_application_id),-1);
Line: 1716

			procedure to insert the receipt records into the
			receiving transaction interface table.

			The Receiving Transaction Manager is then called in
			'ON-LINE' mode to process the receipt records immediately.

                        If there are errors returned from the Receiving
			Transaction Manager, the error status is set the
			workflow item attribute for notifying the buyer and
			requester of the error.


  CHANGE HISTORY:       WLAU       1/15/1997     Created
===========================================================================*/


  PROCEDURE   Process_Rcv_Trans 	 (   itemtype        in varchar2,
                                             itemkey         in varchar2,
                                             actid           in number,
                                             funmode         in varchar2,
                                             result          out NOCOPY varchar2    ) IS
       TYPE shipment_orders_cursor IS ref CURSOR;
Line: 1741

  x_inserted_txn              BOOLEAN;
Line: 1742

  x_insert_txns_count         NUMBER := 0;
Line: 1755

  x_insert_txns_status        NUMBER;
Line: 1816

          SELECT rcv_interface_groups_s.nextval
          INTO   x_group_id
	    FROM   sys.dual;
Line: 1828

          	SELECT po_header_id,
		  po_line_location_id,
                  expected_receipt_qty,
		  primary_uom,
		  item_id,
                  primary_uom_class,
                  to_organization_id,
		  po_distribution_id,
		  null,
		  null,
		  null
             FROM  POR_RCV_ALL_ITEMS_V1 rcv
            WHERE ((expected_receipt_date is not NULL
				    AND trunc(expected_receipt_date+1)<=    --bug 16556483
			           trunc(to_date(x_ntf_trigerred_date, 'DD/MM/YYYY')))
                OR EXISTS (SELECT 1 FROM ap_holds aph
                WHERE aph.line_location_id = rcv.po_line_location_id
                  AND aph.hold_lookup_code in ('QTY REC', 'AMT REC')
	          AND aph.release_lookup_code IS NULL
	          AND rcv.quantity_invoiced > quantity_delivered
                  AND rcv.quantity_invoiced <= ordered_qty ))
              AND NVL(receipt_required_flag,'N') = 'Y'
              AND destination_type_code = 'EXPENSE'
              AND requestor_id is not NULL
              AND expected_receipt_qty > 0
              AND po_header_ID = x_po_header_ID
              AND requestor_ID = x_requester_ID;
Line: 1857

          	SELECT po_header_id,
		  po_line_location_id,
                  expected_receipt_qty,
		  primary_uom,
		  item_id,
                  primary_uom_class,
                  to_organization_id,
		  po_distribution_id,
		  null,
		  null,
		  null
            FROM  POR_RCV_ALL_ITEMS_V1 rcv
            WHERE ((expected_receipt_date is not NULL
				  AND trunc(expected_receipt_date+1)<=     --bug 16556483
			           trunc(to_date(x_ntf_trigerred_date, 'DD/MM/YYYY')))
                OR EXISTS (SELECT 1 FROM ap_holds aph
                WHERE aph.line_location_id = rcv.po_line_location_id
                  AND aph.hold_lookup_code in ('QTY REC', 'AMT REC')
	          AND aph.release_lookup_code IS NULL
	          AND rcv.quantity_invoiced > quantity_delivered
                  AND rcv.quantity_invoiced <= ordered_qty ))
              AND NVL(receipt_required_flag,'N') = 'Y'
              AND requestor_id is not NULL
              AND expected_receipt_qty > 0
              AND po_header_ID = x_po_header_ID
              AND requestor_ID = x_requester_ID;
Line: 1908

   	     po_wf_debug_pkg.insert_debug(itemtype,itemkey,x_progress);
Line: 1914

		x_insert_txns_status := POR_RCV_ORD_SV.groupPoTransaction( t_po_header_id,
					 t_line_location_id,
					 t_expected_receipt_qty,
					 t_ordered_uom,
					 SYSDATE,
					 t_item_id,
					 t_primary_uom_class,
					 t_org_id,
					 t_po_distribution_id,
					 x_group_id,
					 'WP4_CONFIRM',
					 t_Comments,
                            		 t_PackingSlip,
                            		 t_WayBillNum);
Line: 1929

        IF x_insert_txns_status = 0 THEN
  	   x_RCV_txns_rc :=  por_rcv_ord_sv.process_transactions(X_group_id, 'WF');
Line: 1938

	      update po_distributions
	      set wf_item_key = ''
	      where po_header_id = x_po_header_ID
		and wf_item_key like x_po_header_ID||';'||x_requester_id||';%';
Line: 1975

		SELECT count(*)
            	 INTO x_tmp_count
             	FROM POR_RCV_ALL_ITEMS_V1
            	WHERE expected_receipt_date is not NULL
             	 AND NVL(receipt_required_flag,'N') = 'Y'
              	AND destination_type_code = 'EXPENSE'
             	 AND requestor_id is not NULL
              	AND po_header_ID = x_po_header_ID;
Line: 1984

           	 SELECT count(*)
           	  INTO x_tmp_count1
            	 FROM POR_RCV_ALL_ITEMS_V1 rcv
           	 WHERE ((expected_receipt_date is not NULL
					   AND trunc(expected_receipt_date+1)<=     --bug 16556483
			           trunc(to_date(x_ntf_trigerred_date, 'DD/MM/YYYY')))
                     OR EXISTS (SELECT 1 FROM ap_holds aph
                     WHERE aph.line_location_id = rcv.po_line_location_id
                       AND aph.hold_lookup_code in ('QTY REC', 'AMT REC')
	               AND aph.release_lookup_code IS NULL
	               AND rcv.quantity_invoiced > quantity_delivered
                       AND rcv.quantity_invoiced <= ordered_qty ))
            	   AND NVL(receipt_required_flag,'N') = 'Y'
            	   AND destination_type_code = 'EXPENSE'
            	   AND requestor_id is not NULL
            	   AND expected_receipt_qty = 0
           	   AND po_header_ID = x_po_header_ID
           	   AND requestor_ID = x_requester_ID;
Line: 2003

		SELECT count(*)
            	 INTO x_tmp_count
             	FROM POR_RCV_ALL_ITEMS_V1
            	WHERE expected_receipt_date is not NULL
             	 AND NVL(receipt_required_flag,'N') = 'Y'
             	 AND requestor_id is not NULL
              	AND po_header_ID = x_po_header_ID;
Line: 2011

           	 SELECT count(*)
           	  INTO x_tmp_count1
            	 FROM POR_RCV_ALL_ITEMS_V1 rcv
           	 WHERE ((expected_receipt_date is not NULL
                       AND trunc(expected_receipt_date+1)<=	  --bug 16556483
			           trunc(to_date(x_ntf_trigerred_date, 'DD/MM/YYYY')))
                     OR EXISTS (SELECT 1 FROM ap_holds aph
                     WHERE aph.line_location_id = rcv.po_line_location_id
                       AND aph.hold_lookup_code in ('QTY REC', 'AMT REC')
	               AND aph.release_lookup_code IS NULL
	               AND rcv.quantity_invoiced > quantity_delivered
                       AND rcv.quantity_invoiced <= ordered_qty ))
            	   AND NVL(receipt_required_flag,'N') = 'Y'
            	   AND requestor_id is not NULL
            	   AND expected_receipt_qty = 0
           	   AND po_header_ID = x_po_header_ID
           	   AND requestor_ID = x_requester_ID;
Line: 2050

             x_rcv_trans_status := 'RCV_RCPT_INSERT_FAILED';
Line: 2172

    select multi_org_flag
    from fnd_product_groups
    where rownum < 2;
Line: 2177

    select org_id
    from po_headers_all
    where po_header_id = x_header_id;
Line: 2182

    select org_id
    from oe_order_headers_all
    where header_id = x_header_id;
Line: 2302

             SELECT po_header_ID,  requestor_ID,
                    expected_receipt_date,
                    revision_num
             FROM  POR_RCV_ALL_ITEMS_V1
             WHERE expected_receipt_date is not NULL
               AND expected_receipt_date + 1 <= SYSDATE
               AND NVL(receipt_required_flag,'N') = 'Y'
 	       AND destination_type_code = 'EXPENSE'
               AND requestor_ID is not NULL
               AND expected_receipt_qty > 0
            GROUP BY po_header_ID, requestor_ID,  expected_receipt_date, revision_num;
Line: 2316

              SELECT po_header_ID,  requestor_ID, expected_receipt_date, revision_num
              FROM  POR_RCV_ALL_ITEMS_V1
              WHERE expected_receipt_date is not NULL
                AND expected_receipt_date + 1 <= SYSDATE
                AND NVL(receipt_required_flag,'N') = 'Y'
 	        AND requestor_ID is not NULL
                AND expected_receipt_qty > 0
             GROUP BY po_header_ID, requestor_ID,  expected_receipt_date, revision_num;
Line: 2383

                  po_wf_debug_pkg.insert_debug(x_wf_itemtype,x_wf_itemkey,'purge_orders SQL error ' || sqlcode || ' error message: ' || substr(sqlerrm,1,512));
Line: 2449

        po_wf_debug_pkg.insert_debug(x_item_type, x_item_key, x_progress);
Line: 2459

	          SELECT COUNT(*) INTO
		  X_COUNT
                  FROM  POR_CONFIRM_INTERNAL_RECEIPT_V
                  WHERE expected_receipt_date is not NULL
                  AND expected_receipt_date = x_exp_receipt_date
                  AND NVL(receipt_required_flag,'N') = 'Y'
 	          AND destination_type_code = 'EXPENSE'
                  AND requestor_ID is not NULL
                  AND expected_receipt_qty > 0
                  AND so_header_ID = x_so_header_id
		  AND requestor_ID = x_requester_id;
Line: 2471

	          SELECT  COUNT(*)
		  INTO X_COUNT
		  FROM  POR_CONFIRM_INTERNAL_RECEIPT_V
		  WHERE expected_receipt_date is not NULL
		  AND expected_receipt_date = x_exp_receipt_date
		  AND NVL(receipt_required_flag,'N') = 'Y'
		  AND requestor_ID is not NULL
		  AND expected_receipt_qty > 0
		  AND so_header_ID = x_so_header_id
		  AND requestor_ID = x_requester_id;
Line: 2497

        po_wf_debug_pkg.insert_debug(x_item_type, x_item_key, x_progress);
Line: 2503

        po_wf_debug_pkg.insert_debug(x_item_type, x_item_key, x_progress);
Line: 2508

        po_wf_debug_pkg.insert_debug(x_item_type, x_item_key, x_progress);
Line: 2541

		po_wf_debug_pkg.insert_debug(itemtype, itemkey, x_progress);
Line: 2548

    ELSE /* the reminder should have an updated line count */

-- ash_debug.debug('does_item_exist x_count 1' , x_count);
Line: 2580

 select expected_receipt_date
  into l_expDate from POR_RCV_ALL_ITEMS_V1 where po_header_id= l_po_header_id;
Line: 2599

       select prh.segment1
       INTO x_req_number
       from po_requisition_headers prh,
            po_requisition_lines prl,po_distributions pod,
            po_req_distributions pord
       where pod.po_distribution_id  = x_po_distribution_id    and
       pord.distribution_id      = pod.req_distribution_id     and
       pord.requisition_line_id  = prl.requisition_line_id     and
       prl.requisition_header_id = prh.requisition_header_id;
Line: 2744

      	Select 'X'
        Into   dummy
      	From  per_workforce_current_x
      	Where  person_id = x_requester_id;
Line: 2768

	Select 	cwk.supervisor_id
        into	x_manager_id
	From	per_workforce_current_x cwk
	Where	cwk.person_id = x_requester_id;
Line: 2829

  x_inserted_txn_status         NUMBER;
Line: 2881

          SELECT rcv_interface_groups_s.nextval
          INTO   x_group_id
	    FROM   sys.dual;
Line: 2892

		SELECT REQUISITION_LINE_ID,
			EXPECTED_RECEIPT_QTY,
			ORDERED_UOM,
			ITEM_ID,
			PRIMARY_UOM_CLASS,
			TO_ORGANIZATION_ID,
			COMMENTS,
 			PACKING_SLIP,
 			WAYBILL_AIRBILL_NUM
            FROM  POR_CONFIRM_INTERNAL_RECEIPT_V
            WHERE expected_receipt_date is not NULL
              AND expected_receipt_date = x_exp_receipt_date
              AND destination_type_code = 'EXPENSE'
              AND requestor_id is not NULL
              AND expected_receipt_qty > 0
              AND so_header_ID = x_header_ID
              AND requestor_ID = x_requester_ID;
Line: 2911

		SELECT REQUISITION_LINE_ID,
			EXPECTED_RECEIPT_QTY,
			ORDERED_UOM,
			ITEM_ID,
			PRIMARY_UOM_CLASS,
			TO_ORGANIZATION_ID,
			COMMENTS,
 			PACKING_SLIP,
 			WAYBILL_AIRBILL_NUM
            FROM  POR_CONFIRM_INTERNAL_RECEIPT_V
            WHERE expected_receipt_date is not NULL
              AND expected_receipt_date = x_exp_receipt_date
              AND requestor_id is not NULL
              AND expected_receipt_qty > 0
              AND so_header_ID = x_header_ID
              AND requestor_ID = x_requester_ID;
Line: 2950

   	        po_wf_debug_pkg.insert_debug(itemtype,itemkey,x_progress);
Line: 2954

             x_inserted_txn_status :=   POR_RCV_ORD_SV.groupInternalTransaction (t_req_line_id,
                        t_expected_receipt_qty,
                        t_ordered_uom,
                        t_item_id,
			t_primary_uom_class,
			t_org_id,
                        t_comments,
                        t_packingSlip,
                        t_waybillNum,
			x_group_id,
			SYSDATE,
			'WP4_CONFIRM');
Line: 2967

	IF x_inserted_txn_status = 0 THEN

  	   x_RCV_txns_rc :=  por_rcv_ord_sv.process_transactions(X_group_id, 'WF');
Line: 2999

		SELECT count(*)
            	 INTO x_tmp_count
             	FROM POR_CONFIRM_INTERNAL_RECEIPT_V
            	WHERE expected_receipt_date is not NULL
             	 AND NVL(receipt_required_flag,'N') = 'Y'
              	AND destination_type_code = 'EXPENSE'
             	 AND requestor_id is not NULL
              	AND so_header_ID = x_header_ID;
Line: 3008

           	SELECT count(*)
           	  INTO x_tmp_count1
            	  FROM POR_CONFIRM_INTERNAL_RECEIPT_V
           	 WHERE expected_receipt_date is not NULL
           	   AND expected_receipt_date = x_exp_receipt_date
            	   AND NVL(receipt_required_flag,'N') = 'Y'
            	   AND destination_type_code = 'EXPENSE'
            	   AND requestor_id is not NULL
            	   AND expected_receipt_qty = 0
           	   AND so_header_ID = x_header_ID
           	   AND requestor_ID = x_requester_id;
Line: 3020

	       SELECT count(*)
            	 INTO x_tmp_count
             	 FROM POR_CONFIRM_INTERNAL_RECEIPT_V
            	WHERE expected_receipt_date is not NULL
             	  AND NVL(receipt_required_flag,'N') = 'Y'
             	  AND requestor_id is not NULL
              	  AND so_header_ID = x_header_ID;
Line: 3028

           	SELECT count(*)
           	  INTO x_tmp_count1
            	  FROM POR_CONFIRM_INTERNAL_RECEIPT_V
           	 WHERE expected_receipt_date is not NULL
           	   AND expected_receipt_date = x_exp_receipt_date
            	   AND NVL(receipt_required_flag,'N') = 'Y'
            	   AND requestor_id is not NULL
            	   AND expected_receipt_qty = 0
           	   AND so_header_ID = x_header_ID
           	   AND requestor_ID = X_REQUESTER_ID;
Line: 3061

               x_rcv_trans_status := 'RCV_RCPT_INSERT_FAILED';
Line: 3224

type select_line_info_Cursor is ref cursor ;
Line: 3225

Porcpt_LineInfo select_line_info_Cursor;
Line: 3240

                 SELECT so_line_number,
			expected_receipt_qty,
	                quantity_delivered,
	                ordered_qty,
                        primary_uom,
	                item_description,
	                currency_code,
	                unit_price,
			req_number
                FROM  POR_CONFIRM_INTERNAL_RECEIPT_V
                WHERE expected_receipt_date is not NULL
                  AND trunc(expected_receipt_date) = trunc(x_exp_receipt_date)
                  AND NVL(receipt_required_flag,'N') = 'Y'
 	          AND destination_type_code = 'EXPENSE'
                  AND requestor_ID is not NULL
                  AND expected_receipt_qty > 0
                  AND so_header_ID = x_header_id
	          AND requestor_ID = x_requester_id
                ORDER BY so_line_number;
Line: 3262

                 SELECT so_line_number,
			expected_receipt_qty,
	                quantity_delivered,
	                ordered_qty,
                        primary_uom,
	                item_description,
	                currency_code,
	                unit_price,
			req_number
             FROM  POR_CONFIRM_INTERNAL_RECEIPT_V
             WHERE expected_receipt_date is not NULL
               AND trunc(expected_receipt_date) = trunc(x_exp_receipt_date)
               AND NVL(receipt_required_flag,'N') = 'Y'
 	       AND requestor_ID is not NULL
               AND expected_receipt_qty > 0
               AND so_header_ID = x_header_id
	       AND requestor_ID = x_requester_id
             ORDER BY so_line_number;
Line: 3288

                 SELECT po_line_number,
                        expected_receipt_qty,
	                quantity_delivered,
	                ordered_qty,
                        primary_uom,
	                item_description,
	                currency_code,
	                unit_price,
	                po_distribution_id
                FROM  POR_RCV_ALL_ITEMS_V1
                WHERE expected_receipt_date is not NULL
                  AND trunc(expected_receipt_date) = trunc(x_exp_receipt_date)
                  AND NVL(receipt_required_flag,'N') = 'Y'
 	          AND destination_type_code = 'EXPENSE'
                  AND requestor_ID is not NULL
                  AND expected_receipt_qty > 0
                  AND po_header_ID = x_header_id
	          AND requestor_ID = x_requester_id
                ORDER BY po_line_number;
Line: 3310

             SELECT po_line_number,
                    expected_receipt_qty,
	            quantity_delivered,
	            ordered_qty,
                    primary_uom,
	            item_description,
	            currency_code,
	            unit_price,
	            po_distribution_id
             FROM  POR_RCV_ALL_ITEMS_V1
             WHERE expected_receipt_date is not NULL
               AND trunc(expected_receipt_date) = trunc(x_exp_receipt_date)
               AND NVL(receipt_required_flag,'N') = 'Y'
 	       AND requestor_ID is not NULL
               AND expected_receipt_qty > 0
               AND po_header_ID = x_header_id
	       AND requestor_ID = x_requester_id
             ORDER BY po_line_number;
Line: 3417

type select_line_info_Cursor is ref cursor ;
Line: 3418

 Porcpt_LineInfo select_line_info_Cursor;
Line: 3614

  type select_line_info_Cursor is ref cursor ;
Line: 3615

  Porcpt_LineInfo select_line_info_Cursor;
Line: 3646

        po_wf_debug_pkg.insert_debug(itemtype, itemkey, x_progress);
Line: 3656

	 SELECT rcv.po_distribution_id,
  	        rcv.quantity_invoiced,
                rcv.quantity_delivered
	 FROM  POR_RCV_ALL_ITEMS_V1 rcv, po_headers_all poh
	 WHERE poh.PO_HEADER_ID = x_po_header_id AND rcv.po_header_ID = x_po_header_ID
	   AND rcv.requestor_ID = x_requester_ID
           AND ((rcv.expected_receipt_date is not null
	      AND trunc(rcv.expected_receipt_date + 1) <= trunc(SYSDATE))
	      OR EXISTS (SELECT 1 FROM ap_holds aph
              WHERE aph.line_location_id = rcv.po_line_location_id
	        AND aph.hold_lookup_code in ('QTY REC', 'AMT REC')
	        AND aph.release_lookup_code IS NULL
	        AND rcv.quantity_invoiced > quantity_delivered
	        AND rcv.quantity_invoiced <= ordered_qty))
		AND NVL(rcv.receipt_required_flag,'N') = 'Y'
	    AND rcv.destination_type_code = 'EXPENSE'
	    AND rcv.expected_receipt_qty > 0
		AND NVL (poh.closed_code,'OPEN') NOT IN ('CLOSED','FINALLY_CLOSED')
          ORDER BY po_distribution_id;
Line: 3682

	 SELECT rcv.po_distribution_id,
  	        rcv.quantity_invoiced,
                rcv.quantity_delivered
	 FROM  POR_RCV_ALL_ITEMS_V1 rcv, po_headers_all poh
	 WHERE poh.PO_HEADER_ID = x_po_header_id AND rcv.po_header_ID = x_po_header_ID
	   AND rcv.requestor_ID = x_requester_ID
           AND ((rcv.expected_receipt_date is not null
	      AND trunc(rcv.expected_receipt_date + 1) <= trunc(SYSDATE))
	      OR EXISTS (SELECT 1 FROM ap_holds aph
              WHERE aph.line_location_id = rcv.po_line_location_id
	        AND aph.hold_lookup_code in ('QTY REC', 'AMT REC')
	        AND aph.release_lookup_code IS NULL
	        AND rcv.quantity_invoiced > quantity_delivered
	        AND rcv.quantity_invoiced <= ordered_qty))
  	    AND NVL(rcv.receipt_required_flag,'N') = 'Y'
	    AND rcv.expected_receipt_qty > 0
		AND NVL (poh.closed_code,'OPEN') NOT IN ('CLOSED','FINALLY_CLOSED')
          ORDER BY po_distribution_id;
Line: 3727

         UPDATE PO_DISTRIBUTIONS_ALL
         SET    WF_ITEM_KEY = conf_item_key,
	        invoiced_val_in_ntfn = x_qty_inv
         WHERE po_distribution_id = x_dist_id;
Line: 3738

        po_wf_debug_pkg.insert_debug(itemtype, itemkey, x_progress);
Line: 3755

        po_wf_debug_pkg.insert_debug(itemtype, itemkey, x_progress);
Line: 3769

			procedure to insert the receipt records into the
			receiving transaction interface table.

			The Receiving Transaction Manager is then called in
			'ON-LINE' mode to process the receipt records immediately.

                        If there are errors returned from the Receiving
			Transaction Manager, the error status is set the
			workflow item attribute for notifying the buyer and
			requester of the error.

  CHANGE HISTORY:       SVASAMSE  13/05/2003   Created
===========================================================================*/

PROCEDURE  Process_rcv_amt_billed(itemtype  in varchar2,
                          itemkey   in varchar2,
                          actid     in number,
                          funmode   in varchar2,
                          result    out NOCOPY varchar2)
IS
 TYPE shipment_orders_cursor IS ref CURSOR;
Line: 3800

  x_insert_txns_status        NUMBER;
Line: 3847

    SELECT rcv_interface_groups_s.nextval
    INTO   x_group_id
    FROM   sys.dual;
Line: 3852

      SELECT po_header_id,
             po_line_location_id,
             decode(SIGN(invoiced_val_in_ntfn-quantity_delivered),1,
		     (invoiced_val_in_ntfn-quantity_delivered),0)
					expected_receipt_qty,
             primary_uom,
             item_id,
             primary_uom_class,
             to_organization_id,
             po_distribution_id,
             null,
             null,
             null
      FROM  POR_RCV_ALL_ITEMS_V1
      WHERE po_header_ID = x_po_header_ID
        AND wf_item_key = itemKey;
Line: 3898

	  po_wf_debug_pkg.insert_debug(itemtype, itemkey, x_progress);
Line: 3902

    x_insert_txns_status := POR_RCV_ORD_SV.groupPoTransaction(
                               t_po_header_id,
                               t_line_location_id,
                               t_expected_receipt_qty,
                               t_ordered_uom,
                               SYSDATE,
                               t_item_id,
                               t_primary_uom_class,
                               t_org_id,
                               t_po_distribution_id,
                               x_group_id,
                               'WP4_CONFIRM',
                               t_Comments,
                               t_PackingSlip,
                               t_WayBillNum);
Line: 3918

    IF x_insert_txns_status = 0 THEN
      x_RCV_txns_rc := por_rcv_ord_sv.process_transactions(X_group_id, 'WF');
Line: 3926

	update po_distributions
	set wf_item_key = ''
	where wf_item_key = itemKey;
Line: 3946

      x_rcv_trans_status := 'RCV_RCPT_INSERT_FAILED';
Line: 3999

  select sysdate
  into x_sys_date
  from dual;