src-db/database/model/functions/M_CREATE_RESERVE_FROM_SOL.xml
changeset 18652 649b5e295f8c
parent 18650 151688afa57e
child 18663 157c92ecd0e2
equal deleted inserted replaced
18651:66c2483f9825 18652:649b5e295f8c
     1 <?xml version="1.0"?>
     1 <?xml version="1.0"?>
     2   <database name="FUNCTION M_CREATE_RESERVE_FROM_SOL">
     2   <database name="FUNCTION M_CREATE_RESERVE_FROM_SOL">
     3     <function name="M_CREATE_RESERVE_FROM_SOL" type="VARCHAR">
     3     <function name="M_CREATE_RESERVE_FROM_SOL" type="NULL">
     4       <parameter name="p_orderline_id" type="VARCHAR" mode="in">
     4       <parameter name="p_orderline_id" type="VARCHAR" mode="in">
     5         <default/>
     5         <default/>
     6       </parameter>
     6       </parameter>
     7       <parameter name="p_process_reserve" type="CHAR" mode="in">
     7       <parameter name="p_process_reserve" type="CHAR" mode="in">
     8         <default/>
     8         <default/>
     9       </parameter>
     9       </parameter>
    10       <parameter name="p_user_id" type="VARCHAR" mode="in">
    10       <parameter name="p_user_id" type="VARCHAR" mode="in">
       
    11         <default/>
       
    12       </parameter>
       
    13       <parameter name="p_reservation_id" type="VARCHAR" mode="out">
    11         <default/>
    14         <default/>
    12       </parameter>
    15       </parameter>
    13       <body><![CDATA[/*************************************************************************
    16       <body><![CDATA[/*************************************************************************
    14 * The contents of this file are subject to the Openbravo  Public  License
    17 * The contents of this file are subject to the Openbravo  Public  License
    15 * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
    18 * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
    25 * All portions are Copyright (C) 2012 Openbravo SLU
    28 * All portions are Copyright (C) 2012 Openbravo SLU
    26 * All Rights Reserved.
    29 * All Rights Reserved.
    27 * Contributor(s):  ______________________________________.
    30 * Contributor(s):  ______________________________________.
    28 ************************************************************************/
    31 ************************************************************************/
    29 /*************
    32 /*************
    30 * Function to create reservations for the given Sales Order Line.
    33 * Procedure to create reservations for the given Sales Order Line.
    31 **************/
    34 **************/
    32   v_product_id        VARCHAR2(32);
    35   v_product_id        VARCHAR2(32);
    33   v_uom_id            VARCHAR2(32);
    36   v_uom_id            VARCHAR2(32);
    34   v_client_id         VARCHAR2(32);
    37   v_client_id         VARCHAR2(32);
    35   v_org_id            VARCHAR2(32);
    38   v_org_id            VARCHAR2(32);
    57 
    60 
    58   INSERT INTO m_reservation(
    61   INSERT INTO m_reservation(
    59     m_reservation_id, ad_client_id, ad_org_id, isactive,
    62     m_reservation_id, ad_client_id, ad_org_id, isactive,
    60     created, createdby, updated, updatedby,
    63     created, createdby, updated, updatedby,
    61     c_orderline_id,
    64     c_orderline_id,
    62     m_product_id, c_uom_id, quantity, reservedqty, pendingqty,
    65     m_product_id, c_uom_id, quantity, reservedqty, releasedqty,
    63     res_status, res_process
    66     res_status, res_process
    64   ) VALUES (
    67   ) VALUES (
    65     v_reservation_id, v_client_id, v_org_id, 'Y',
    68     v_reservation_id, v_client_id, v_org_id, 'Y',
    66     now(), p_user_id, now(), p_user_id,
    69     now(), p_user_id, now(), p_user_id,
    67     p_orderline_id,
    70     p_orderline_id,
    68     v_product_id, v_uom_id, v_qtyordered, 0, v_qtyordered - v_qtydelivered,
    71     v_product_id, v_uom_id, v_qtyordered, 0, v_qtydelivered,
    69     'DR', 'CO'
    72     'DR', 'CO'
    70   );
    73   );
    71 
    74 
    72   IF (p_process_reserve = 'Y') THEN
    75   IF (p_process_reserve = 'Y') THEN
    73     M_RESERVATION_POST(null, v_reservation_id, 'PR', p_user_id);
    76     M_RESERVATION_POST(null, v_reservation_id, 'PR', p_user_id);
    74   END IF;
    77   END IF;
    75 
    78 
    76   RETURN v_reservation_id;
    79   p_reservation_id := v_reservation_id;
       
    80 RETURN;
    77 END M_CREATE_RESERVE_FROM_SOL]]></body>
    81 END M_CREATE_RESERVE_FROM_SOL]]></body>
    78     </function>
    82     </function>
    79   </database>
    83   </database>