src-db/database/model/functions/M_GET_OFFER_PRICE.xml
changeset 756 ae11e4610537
parent 735 daced7e311c9
child 1605 8a0fe0193bef
equal deleted inserted replaced
755:16b55e593268 756:ae11e4610537
       
     1 <?xml version="1.0"?>
       
     2   <database name="FUNCTION M_GET_OFFER_PRICE">
       
     3     <function name="M_GET_OFFER_PRICE" type="NUMERIC">
       
     4       <parameter name="p_offer_id" type="NUMERIC" mode="in">
       
     5         <default/>
       
     6       </parameter>
       
     7       <parameter name="p_pricestd" type="NUMERIC" mode="in">
       
     8         <default/>
       
     9       </parameter>
       
    10       <body><![CDATA[/*************************************************************************
       
    11 * The contents of this file are subject to the Openbravo  Public  License
       
    12 * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
       
    13 * Version 1.1  with a permitted attribution clause; you may not  use this
       
    14 * file except in compliance with the License. You  may  obtain  a copy of
       
    15 * the License at http://www.openbravo.com/legal/license.html
       
    16 * Software distributed under the License  is  distributed  on  an "AS IS"
       
    17 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
       
    18 * License for the specific  language  governing  rights  and  limitations
       
    19 * under the License.
       
    20 * The Original Code is Openbravo ERP.
       
    21 * The Initial Developer of the Original Code is Openbravo SL
       
    22 * All portions are Copyright (C) 2001-2006 Openbravo SL
       
    23 * All Rights Reserved.
       
    24 * Contributor(s):  ______________________________________.
       
    25 ************************************************************************/
       
    26 /*
       
    27 DEPRECATED!
       
    28 This function should not be used. Use instead M_Get_Offers_Price.
       
    29 */
       
    30   v_Price    NUMBER;
       
    31   v_Fixed    NUMBER;
       
    32   v_AddAmt   NUMBER;
       
    33   v_Discount NUMBER;
       
    34 BEGIN
       
    35   v_Price := p_PriceStd;
       
    36   IF v_Price IS NULL THEN
       
    37     v_Price := 0;
       
    38   END IF;
       
    39   IF p_Offer_ID IS NOT NULL THEN
       
    40     SELECT FIXED,
       
    41       COALESCE(ADDAMT, 0),
       
    42       COALESCE(DISCOUNT, 0)
       
    43     INTO  v_Fixed,
       
    44       v_AddAmt,
       
    45       v_Discount
       
    46     FROM M_OFFER
       
    47     WHERE M_OFFER_ID = p_Offer_ID;
       
    48     IF v_Fixed IS NOT NULL THEN
       
    49       v_Price := v_Fixed;
       
    50     ELSE
       
    51       v_Price :=(p_PriceStd - v_AddAmt) *(1 - v_Discount/100) ;
       
    52     END IF;
       
    53   END IF;
       
    54   RETURN v_Price;
       
    55 EXCEPTION
       
    56 WHEN OTHERS THEN
       
    57   RETURN NULL;
       
    58 END M_GET_OFFER_PRICE
       
    59 ]]></body>
       
    60     </function>
       
    61   </database>