📄 c_tax_trg.sql
字号:
CREATE OR REPLACE TRIGGER C_Tax_Trg
AFTER INSERT OR UPDATE OF Name, Description, TaxIndicator
ON C_Tax
FOR EACH ROW
DECLARE
/*************************************************************************
* The contents of this file are subject to the Compiere License. You may
* obtain a copy of the License at http://www.compiere.org/license.html
* Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for details. Code: Compiere ERP+CRM
* Copyright (C) 1999-2002 Jorg Janke, ComPiere, Inc. All Rights Reserved.
*************************************************************************
* $Id: C_Tax_Trg.sql,v 1.2 2003/02/18 03:33:22 jjanke Exp $
***
* Title: Tax Changes
* Description:
* - New Accounting Defaults
* - Translation
************************************************************************/
CURSOR Cur_Defaults IS
SELECT * FROM C_AcctSchema_Default d
WHERE EXISTS (SELECT * FROM AD_ClientInfo c
WHERE d.C_AcctSchema_ID IN (c.C_AcctSchema1_ID, c.C_AcctSchema2_ID, c.C_AcctSchema3_ID)
AND AD_Client_ID=:new.AD_Client_ID);
BEGIN
IF (INSERTING) THEN
-- Tax Account Defaults
FOR cd IN Cur_Defaults LOOP
INSERT INTO C_Tax_Acct
(C_Tax_ID, C_AcctSchema_ID,
AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
T_Due_Acct, T_Liability_Acct, T_Credit_Acct, T_Receivables_Acct, T_Expense_Acct)
VALUES
(:new.C_Tax_ID, cd.C_AcctSchema_ID,
:new.AD_Client_ID, :new.AD_ORG_ID, 'Y', SysDate, :new.CreatedBy, SysDate, :new.UpdatedBy,
cd.T_Due_Acct, cd.T_Liability_Acct, cd.T_Credit_Acct, cd.T_Receivables_Acct, cd.T_Expense_Acct);
END LOOP;
-- Create Translation Rows
INSERT INTO C_Tax_Trl
(C_Tax_ID, AD_Language, AD_Client_ID, AD_Org_ID,
IsActive, Created, CreatedBy, Updated, UpdatedBy,
Name, Description, TaxIndicator, IsTranslated)
SELECT :new.C_Tax_ID, AD_Language, :new.AD_Client_ID, :new.AD_Org_ID,
:new.IsActive, :new.Created, :new.CreatedBy, :new.Updated, :new.UpdatedBy,
:new.Name, :new.Description, :new.TaxIndicator, 'N'
FROM AD_Language
WHERE IsActive = 'Y' AND IsSystemLanguage = 'Y';
END IF; -- Inserting
IF UPDATING THEN
UPDATE C_Tax_Trl
SET IsTranslated = 'N',
Updated=SysDate
WHERE C_Tax_ID = :new.C_Tax_ID;
END IF; -- Updating
END C_Tax_Trg;
/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -