📄 c_bankstatementline_trg.sql
字号:
CREATE OR REPLACE TRIGGER C_BankStatementLine_Trg
AFTER DELETE OR INSERT OR UPDATE
ON C_BankStatementLine
FOR EACH ROW
/*************************************************************************
* 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-2001 Jorg Janke, ComPiere, Inc. All Rights Reserved.
*************************************************************************
* $Id: C_BankStatementLine_Trg.sql,v 1.4 2003/01/27 06:22:11 jjanke Exp $
***
* Title: Update Balance of Statement, RO check
* Description:
************************************************************************/
DECLARE
v_Difference NUMBER := 0;
v_ID NUMBER;
v_RO NUMBER;
BEGIN
-- Differnce, ID
IF (UPDATING OR INSERTING) THEN
v_Difference := :new.StmtAmt;
v_ID := :new.C_BankStatement_ID;
END IF;
IF (DELETING OR UPDATING) THEN
v_Difference := v_Difference - :old.StmtAmt;
v_ID := :old.C_BankStatement_ID;
END IF;
-- ReadOnly Check
SELECT COUNT(*)
INTO v_RO
FROM C_BankStatement
WHERE C_BankStatement_ID=v_ID
AND Processed='Y';
IF (v_RO > 0) THEN
RAISE_APPLICATION_ERROR(-20501, 'Document processed/posted');
END IF;
-- Update header
UPDATE C_BankStatement
SET StatementDifference = StatementDifference + v_Difference,
EndingBalance = EndingBalance + v_Difference
WHERE C_BankStatement_ID = v_ID;
END C_BankStatementLine_Trg;
/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -