src-db/database/model/functions/M_INOUT_POST.xml
changeset 28196 69f3a1a1c22d
parent 27386 6db6e5448fd2
child 28208 1adc9a58e28a
child 28213 7dbcbbf94ecf
equal deleted inserted replaced
28195:4359653f248d 28196:69f3a1a1c22d
    20   * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
    20   * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
    21   * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
    21   * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
    22   * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
    22   * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
    23   * All Rights Reserved.
    23   * All Rights Reserved.
    24   * Contributor(s): Openbravo SLU
    24   * Contributor(s): Openbravo SLU
    25   * Contributions are Copyright (C) 2001-2015 Openbravo, S.L.U.
    25   * Contributions are Copyright (C) 2001-2016 Openbravo, S.L.U.
    26   *
    26   *
    27   * Specifically, this derivative work is based upon the following Compiere
    27   * Specifically, this derivative work is based upon the following Compiere
    28   * file and version.
    28   * file and version.
    29   *************************************************************************
    29   *************************************************************************
    30   * $Id: M_InOut_Post.sql,v 1.8 2003/09/05 04:58:06 jjanke Exp $
    30   * $Id: M_InOut_Post.sql,v 1.8 2003/09/05 04:58:06 jjanke Exp $
   117     
   117     
   118     v_bp_isactive c_bpartner.isactive%Type;
   118     v_bp_isactive c_bpartner.isactive%Type;
   119     v_IsQtyVariable M_Product.IsQuantityVariable%TYPE;
   119     v_IsQtyVariable M_Product.IsQuantityVariable%TYPE;
   120     v_IsReversedDoc CHAR(1);
   120     v_IsReversedDoc CHAR(1);
   121 
   121 
   122     v_uuid VARCHAR2(32) := get_uuid();
   122     v_uuid VARCHAR2(32);
   123     v_qtyordered NUMBER;
   123     v_qtyordered NUMBER;
   124 
   124 
   125   BEGIN
   125   BEGIN
   126   
   126   
   127     IF(p_PInstance_ID IS NOT NULL) THEN
   127     IF(p_PInstance_ID IS NOT NULL) THEN
  1158               WHERE M_RESERVATION.C_OrderLine_ID=Cur_InOutLine.C_OrderLine_ID
  1158               WHERE M_RESERVATION.C_OrderLine_ID=Cur_InOutLine.C_OrderLine_ID
  1159               AND IsActive='Y')
  1159               AND IsActive='Y')
  1160 	    LOOP
  1160 	    LOOP
  1161 	      IF (Cur_Reservation.Res_Status = 'CL') THEN
  1161 	      IF (Cur_Reservation.Res_Status = 'CL') THEN
  1162 
  1162 
       
  1163 		v_uuid := get_uuid();
       
  1164 
  1163 		-- Get the ordered quantity from the order line
  1165 		-- Get the ordered quantity from the order line
  1164 	        SELECT qtyordered
  1166 	        SELECT qtyordered
  1165 	        INTO v_qtyordered
  1167 	        INTO v_qtyordered
  1166 	        FROM C_ORDERLINE
  1168 	        FROM C_ORDERLINE
  1167 	        WHERE C_OrderLine_ID=Cur_Reservation.C_OrderLine_ID;
  1169 	        WHERE C_OrderLine_ID=Cur_Reservation.C_OrderLine_ID;
  1180 		  Cur_Reservation.ad_user_id, Cur_Reservation.c_bpartner_id, Cur_Reservation.m_warehouse_id,
  1182 		  Cur_Reservation.ad_user_id, Cur_Reservation.c_bpartner_id, Cur_Reservation.m_warehouse_id,
  1181 		  Cur_Reservation.m_attributesetinstance_id, Cur_Reservation.m_locator_id, 'DR', 'PR',
  1183 		  Cur_Reservation.m_attributesetinstance_id, Cur_Reservation.m_locator_id, 'DR', 'PR',
  1182 		  Cur_Reservation.managereservation_pe, Cur_Reservation.reservedgoodmnt_pe
  1184 		  Cur_Reservation.managereservation_pe, Cur_Reservation.reservedgoodmnt_pe
  1183 	        );
  1185 	        );
  1184 
  1186 
  1185            -- Add a reservation stock with the ordered quantity
  1187 		-- Add a reservation stock with the ordered quantity
  1186       	   INSERT INTO M_RESERVATION_STOCK (
  1188 		INSERT INTO M_RESERVATION_STOCK (
  1187      	      m_reservation_stock_id, ad_client_id, ad_org_id, isactive,
  1189 		  m_reservation_stock_id, ad_client_id, ad_org_id, isactive,
  1188    	        created, createdby, updated, updatedby,
  1190    	          created, createdby, updated, updatedby,
  1189 		        m_reservation_id, c_orderline_id, quantity, isallocated,
  1191 		  m_reservation_id, c_orderline_id, quantity, isallocated,
  1190 		        m_locator_id, m_attributesetinstance_id
  1192 		  m_locator_id, m_attributesetinstance_id )
  1191 	        )
  1193 		SELECT get_uuid(), ad_client_id, ad_org_id, 'Y',
  1192           SELECT get_uuid(), ad_client_id, ad_org_id, 'Y',
  1194 		  now(), v_user, now(), v_user,
  1193             now(), v_user, now(), v_user,
  1195 		  v_uuid, c_orderline_id, v_qtyordered, isallocated,
  1194             v_uuid, c_orderline_id, v_qtyordered, isallocated,
  1196 		  m_locator_id, m_attributesetinstance_id
  1195             m_locator_id, m_attributesetinstance_id
  1197 		FROM M_RESERVATION_STOCK
  1196           FROM M_RESERVATION_STOCK
  1198 		WHERE M_RESERVATION_STOCK.M_Reservation_ID=Cur_Reservation.M_Reservation_ID
  1197           WHERE M_RESERVATION_STOCK.M_Reservation_ID=Cur_Reservation.M_Reservation_ID
  1199 		AND IsActive='Y';
  1198           AND IsActive='Y';
       
  1199 
  1200 
  1200 	        -- Process the reservation
  1201 	        -- Process the reservation
  1201 	        M_RESERVATION_POST(null, v_uuid, 'PR', v_user);
  1202 	        M_RESERVATION_POST(null, v_uuid, 'PR', v_user);
  1202 
  1203 
  1203 	      END IF;
  1204 	      END IF;