⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c_cash_trg.sql

📁 Java写的ERP系统
💻 SQL
字号:
CREATE OR REPLACE TRIGGER C_Cash_Trg
BEFORE INSERT OR UPDATE
	ON C_Cash
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-2002 Jorg Janke, ComPiere, Inc. All Rights Reserved.
 *************************************************************************
 * $Id: C_Cash_Trg.sql,v 1.2 2002/07/06 03:01:56 jjanke Exp $
 ***
 * Title:	Cash Trigger
 * Description:
 *		Truncate Statement Date
 *		Update Statement Balances when Beginning Balance chages
 ************************************************************************/
BEGIN
	-- Truncate Statement Date
	:new.StatementDate := TRUNC(:new.StatementDate);

	--	Update StatementDifference
	IF (UPDATING AND :new.BeginningBalance <> :old.BeginningBalance) THEN
		SELECT NVL(SUM(Amount),0)
		  INTO :new.StatementDifference
		FROM C_CashLine
		WHERE C_Cash_ID = :new.C_Cash_ID;
		--	Update Ending Balance
		:new.EndingBalance := :new.BeginningBalance + :new.StatementDifference;
	END IF;
END C_Cash_Trg;
/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -