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