src-db/database/model/triggers/C_BANKACCOUNT_TRG.xml
changeset 756 ae11e4610537
parent 735 daced7e311c9
child 771 f0f606b4acf4
equal deleted inserted replaced
755:16b55e593268 756:ae11e4610537
       
     1 <?xml version="1.0"?>
       
     2   <database name="TRIGGER C_BANKACCOUNT_TRG">
       
     3     <trigger name="C_BANKACCOUNT_TRG" table="C_BANKACCOUNT" fires="after" insert="true" update="false" delete="false" foreach="row">
       
     4       <body><![CDATA[
       
     5 
       
     6 
       
     7 
       
     8 
       
     9     /*************************************************************************
       
    10     * The contents of this file are subject to the Compiere License
       
    11     * Version 2.5.0 ("License"); You may not use this file except in
       
    12     * compliance with the License. You may obtain a copy of the License at
       
    13     * http://www.compiere.org/license.html
       
    14     * Software distributed under the License is distributed on an
       
    15     * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
       
    16     * implied. See the License for the specific language governing rights
       
    17     * and limitations under the License.
       
    18     * The Original Code is  Compiere  ERP &  Business Solution
       
    19     * The Initial Developer of the Original Code is Jorg Janke  and ComPiere,
       
    20     Inc.
       
    21     * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
       
    22     * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
       
    23     * All Rights Reserved.
       
    24     * Contributor(s): Openbravo SL
       
    25     * Contributions are Copyright (C) 1999-2005 Openbravo, S.L
       
    26     *************************************************************************
       
    27     * $Id: C_BankAccount_Trg.sql,v 1.2 2002/01/04 04:29:54 jjanke Exp $
       
    28     ***
       
    29     * Title: New Accounting Defaults
       
    30     * Description:
       
    31     ************************************************************************/
       
    32     TYPE RECORD IS REF CURSOR;
       
    33   Cur_Defaults RECORD;
       
    34 BEGIN
       
    35   FOR Cur_Defaults IN
       
    36     (
       
    37     SELECT *
       
    38     FROM C_AcctSchema_Default d
       
    39     WHERE EXISTS
       
    40       (
       
    41       SELECT *
       
    42       FROM AD_ClientInfo c
       
    43       WHERE d.C_AcctSchema_ID IN(c.C_AcctSchema1_ID, c.C_AcctSchema2_ID, c.C_AcctSchema3_ID)
       
    44         AND AD_Client_ID=:new.AD_Client_ID
       
    45       )
       
    46     )
       
    47   LOOP
       
    48     INSERT
       
    49     INTO C_BankAccount_Acct
       
    50       (
       
    51         C_BankAccount_ID, C_AcctSchema_ID, AD_Client_ID,
       
    52         AD_Org_ID, IsActive, Created,
       
    53         CreatedBy, Updated, UpdatedBy,
       
    54         B_InTransit_Acct, B_Asset_Acct, B_Expense_Acct,
       
    55         B_InterestRev_Acct, B_InterestExp_Acct, B_UnIdentified_Acct,
       
    56         B_SettlementGain_Acct, B_SettlementLoss_Acct, B_RevaluationGain_Acct,
       
    57         B_RevaluationLoss_Acct, B_PaymentSelect_Acct, B_UnallocatedCash_Acct
       
    58       )
       
    59       VALUES
       
    60       (
       
    61         :new.C_BankAccount_ID, Cur_Defaults.C_AcctSchema_ID, :new.AD_Client_ID,
       
    62         :new.AD_ORG_ID,  'Y', now(),
       
    63         :new.CreatedBy, now(), :new.UpdatedBy,
       
    64         Cur_Defaults.B_InTransit_Acct, Cur_Defaults.B_Asset_Acct, Cur_Defaults.B_Expense_Acct,
       
    65         Cur_Defaults.B_InterestRev_Acct, Cur_Defaults.B_InterestExp_Acct, Cur_Defaults.B_UnIdentified_Acct,
       
    66         Cur_Defaults.B_SettlementGain_Acct, Cur_Defaults.B_SettlementLoss_Acct, Cur_Defaults.B_RevaluationGain_Acct,
       
    67         Cur_Defaults.B_RevaluationLoss_Acct, Cur_Defaults.B_PaymentSelect_Acct, Cur_Defaults.B_UnallocatedCash_Acct
       
    68       )
       
    69       ;
       
    70   END LOOP;
       
    71 END C_BANKACCOUNT_TRG
       
    72 ]]></body>
       
    73     </trigger>
       
    74   </database>