src-db/database/model/functions/MRP_CHECK_PLANNINGMETHOD.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Wed, 03 Sep 2008 17:55:37 +0000
changeset 1605 8a0fe0193bef
parent 756 ae11e4610537
child 2586 683779f1e610
permissions -rw-r--r--
Merge r2.5x intro trunk
carlos@0
     1
<?xml version="1.0"?>
adrian@94
     2
  <database name="FUNCTION MRP_CHECK_PLANNINGMETHOD">
adrian@94
     3
    <function name="MRP_CHECK_PLANNINGMETHOD" type="NUMERIC">
juanpablo@1605
     4
      <parameter name="p_planningmethod_id" type="VARCHAR" mode="in">
antonio@735
     5
        <default/>
antonio@735
     6
      </parameter>
antonio@735
     7
      <parameter name="p_type" type="CHAR" mode="in">
antonio@735
     8
        <default/>
antonio@735
     9
      </parameter>
antonio@735
    10
      <parameter name="p_days" type="NUMERIC" mode="in">
antonio@735
    11
        <default/>
antonio@735
    12
      </parameter>
antonio@735
    13
      <parameter name="p_timehorizon" type="NUMERIC" mode="in">
antonio@735
    14
        <default/>
antonio@735
    15
      </parameter>
gorkaion@239
    16
      <body><![CDATA[/*************************************************************************
carlos@0
    17
* The contents of this file are subject to the Openbravo  Public  License
carlos@0
    18
* Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
carlos@0
    19
* Version 1.1  with a permitted attribution clause; you may not  use this
carlos@0
    20
* file except in compliance with the License. You  may  obtain  a copy of
carlos@0
    21
* the License at http://www.openbravo.com/legal/license.html
carlos@0
    22
* Software distributed under the License  is  distributed  on  an "AS IS"
carlos@0
    23
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
carlos@0
    24
* License for the specific  language  governing  rights  and  limitations
carlos@0
    25
* under the License.
carlos@0
    26
* The Original Code is Openbravo ERP.
carlos@0
    27
* The Initial Developer of the Original Code is Openbravo SL
carlos@0
    28
* All portions are Copyright (C) 2001-2006 Openbravo SL
carlos@0
    29
* All Rights Reserved.
carlos@0
    30
* Contributor(s):  ______________________________________.
carlos@0
    31
************************************************************************/
antonio@735
    32
  p_Days_Aux NUMBER:= 0;
antonio@735
    33
  v_Return NUMBER:= -1;
carlos@0
    34
BEGIN
gorkaion@239
    35
    if p_Days < 0 THEN
carlos@0
    36
      p_Days_Aux := 0;
carlos@0
    37
    ELSE
carlos@0
    38
      p_Days_Aux := p_Days;
carlos@0
    39
    END IF;
carlos@0
    40
carlos@0
    41
    SELECT p.WEIGHTING
carlos@0
    42
    INTO v_Return
carlos@0
    43
    FROM MRP_PLANNINGMETHODLINE p
carlos@0
    44
    WHERE p.MRP_PLANNINGMETHOD_ID = p_PlanningMethod_ID
carlos@0
    45
    AND p.INOUTTRXTYPE = p_Type
carlos@0
    46
    AND p_Days_Aux BETWEEN COALESCE(p.DaysFrom, 0) AND COALESCE(p.DaysTo, 999999999)
gorkaion@239
    47
    AND p_Days_Aux <= p_TimeHorizon;
carlos@0
    48
    RETURN v_Return;
carlos@0
    49
EXCEPTION
carlos@0
    50
  WHEN OTHERS THEN
carlos@0
    51
    RETURN -1;
adrian@170
    52
END MRP_CHECK_PLANNINGMETHOD
gorkaion@239
    53
]]></body>
adrian@94
    54
    </function>
adrian@94
    55
  </database>