src-db/database/model/functions/C_PAYMENTTERM_DUEDATE.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Wed, 03 Sep 2008 17:55:37 +0000
changeset 1605 8a0fe0193bef
parent 756 ae11e4610537
child 6701 690d2af86089
permissions -rw-r--r--
Merge r2.5x intro trunk
carlos@0
     1
<?xml version="1.0"?>
adrian@94
     2
  <database name="FUNCTION C_PAYMENTTERM_DUEDATE">
adrian@94
     3
    <function name="C_PAYMENTTERM_DUEDATE" type="TIMESTAMP">
juanpablo@1605
     4
      <parameter name="p_paymentterm_id" type="VARCHAR" mode="in">
antonio@735
     5
        <default/>
antonio@735
     6
      </parameter>
antonio@735
     7
      <parameter name="p_docdate" type="TIMESTAMP" mode="in">
antonio@735
     8
        <default/>
antonio@735
     9
      </parameter>
juanpablo@1605
    10
      <parameter name="p_bpartner_id" type="VARCHAR" mode="in">
antonio@735
    11
        <default/>
antonio@735
    12
      </parameter>
gorkaion@239
    13
      <body><![CDATA[/*************************************************************************
carlos@0
    14
* The contents of this file are subject to the Openbravo  Public  License
carlos@0
    15
* Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
carlos@0
    16
* Version 1.1  with a permitted attribution clause; you may not  use this
carlos@0
    17
* file except in compliance with the License. You  may  obtain  a copy of
carlos@0
    18
* the License at http://www.openbravo.com/legal/license.html
carlos@0
    19
* Software distributed under the License  is  distributed  on  an "AS IS"
carlos@0
    20
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
carlos@0
    21
* License for the specific  language  governing  rights  and  limitations
carlos@0
    22
* under the License.
carlos@0
    23
* The Original Code is Openbravo ERP.
carlos@0
    24
* The Initial Developer of the Original Code is Openbravo SL
carlos@0
    25
* All portions are Copyright (C) 2001-2006 Openbravo SL
carlos@0
    26
* All Rights Reserved.
carlos@0
    27
* Contributor(s):  ______________________________________.
carlos@0
    28
************************************************************************/
carlos@0
    29
/*************************************************************************
antonio@735
    30
* Title: Get Due DATE
carlos@0
    31
* Description:
carlos@0
    32
* Grace days are not considered!
carlos@0
    33
************************************************************************/
carlos@0
    34
    v_DueDate DATE;
carlos@0
    35
    --
carlos@0
    36
  TYPE RECORD IS REF CURSOR;
carlos@0
    37
    Cur_PT RECORD;
carlos@0
    38
  BEGIN
carlos@0
    39
    FOR Cur_PT IN
carlos@0
    40
      (SELECT *  FROM C_PaymentTerm  WHERE C_PaymentTerm_ID = p_PaymentTerm_ID)
carlos@0
    41
    LOOP
carlos@0
    42
      -- Pending: Vendor invoices not arranged
carlos@0
    43
      v_DueDate := C_PaymentDueDate(p_BPartner_ID, 'Y', Cur_PT.FixMonthDay, Cur_PT.FixMonthDay2, Cur_PT.FixMonthDay3, Cur_PT.NetDays, Cur_PT.FixMonthOffset, Cur_PT.NetDay, Cur_PT.IsNextbusinessday, p_DocDate) ;
carlos@0
    44
    END LOOP;
carlos@0
    45
    RETURN COALESCE(v_DueDate, TRUNC(p_DocDate)) ;
antonio@735
    46
END C_PAYMENTTERM_DUEDATE
gorkaion@239
    47
]]></body>
adrian@94
    48
    </function>
adrian@94
    49
  </database>