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 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: 405

        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 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: 447

     		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: 472

             select sysdate into x_sys_date from dual;
Line: 485

                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: 505

		   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: 542

	Select_Internal_Orders;
Line: 547

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

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

  END Select_Orders;
Line: 570

  x_inserted_txn_status              NUMBER := 0;
Line: 587

  type select_shipments_Cursor is ref cursor ;
Line: 588

  Porcpt_Shipment select_shipments_Cursor;
Line: 594

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

		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: 623

		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: 657

             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: 674

	IF x_inserted_txn_status = 0 THEN

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

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: 710

    Porcpt_c select_orders_Cursor;
Line: 760

             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: 776

             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: 810

     		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: 848

               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: 892

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

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

  END Select_Internal_Orders;
Line: 1027

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

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

       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: 1367

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

	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: 1622

        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: 1644

  /* Bug 6277620- FP of 6054138 - Select the ip/po responsibility first and if not found then look for custom responsibilities*/
   if (x_resp_id = -1) 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: 1672

       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: 1713

			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: 1738

  x_inserted_txn              BOOLEAN;
Line: 1739

  x_insert_txns_count         NUMBER := 0;
Line: 1752

  x_insert_txns_status        NUMBER;
Line: 1813

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

          	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(to_date(to_char(expected_receipt_date+1), 'DD/MM/YYYY'))<=
			           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: 1854

          	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(to_date(to_char(expected_receipt_date+1), 'DD/MM/YYYY'))<=
			           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: 1905

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

		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: 1926

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

	      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: 1972

		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: 1981

           	 SELECT count(*)
           	  INTO x_tmp_count1
            	 FROM POR_RCV_ALL_ITEMS_V1 rcv
           	 WHERE ((expected_receipt_date is not NULL
                       AND trunc(to_date(to_char(expected_receipt_date+1), 'DD/MM/YYYY'))<=
			           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: 2000

		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: 2008

           	 SELECT count(*)
           	  INTO x_tmp_count1
            	 FROM POR_RCV_ALL_ITEMS_V1 rcv
           	 WHERE ((expected_receipt_date is not NULL
                       AND trunc(to_date(to_char(expected_receipt_date+1), 'DD/MM/YYYY'))<=
			           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: 2047

             x_rcv_trans_status := 'RCV_RCPT_INSERT_FAILED';
Line: 2169

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

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

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

             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: 2313

              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: 2380

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

	          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: 2465

	          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: 2529

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

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

       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: 2699

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

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

  x_inserted_txn_status         NUMBER;
Line: 2836

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

		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: 2866

		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: 2905

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

             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: 2922

	IF x_inserted_txn_status = 0 THEN

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

		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: 2963

           	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: 2975

	       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: 2983

           	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: 3016

               x_rcv_trans_status := 'RCV_RCPT_INSERT_FAILED';
Line: 3179

type select_line_info_Cursor is ref cursor ;
Line: 3180

Porcpt_LineInfo select_line_info_Cursor;
Line: 3195

                 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: 3217

                 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: 3243

                 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: 3265

             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: 3372

type select_line_info_Cursor is ref cursor ;
Line: 3373

 Porcpt_LineInfo select_line_info_Cursor;
Line: 3569

  type select_line_info_Cursor is ref cursor ;
Line: 3570

  Porcpt_LineInfo select_line_info_Cursor;
Line: 3606

	 SELECT rcv.po_distribution_id,
  	        rcv.quantity_invoiced,
                rcv.quantity_delivered
	 FROM  POR_RCV_ALL_ITEMS_V1 rcv
	 WHERE 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
          ORDER BY po_distribution_id;
Line: 3631

	 SELECT rcv.po_distribution_id,
  	        rcv.quantity_invoiced,
                rcv.quantity_delivered
	 FROM  POR_RCV_ALL_ITEMS_V1 rcv
	 WHERE 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
          ORDER BY po_distribution_id;
Line: 3675

         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: 3709

			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: 3740

  x_insert_txns_status        NUMBER;
Line: 3787

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

      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: 3838

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

    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: 3858

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

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

      x_rcv_trans_status := 'RCV_RCPT_INSERT_FAILED';
Line: 3939

  select sysdate
  into x_sys_date
  from dual;