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

📄 c_payment_trg.sql

📁 Java写的ERP系统
💻 SQL
字号:
CREATE OR REPLACE TRIGGER C_Payment_Trg
BEFORE INSERT OR UPDATE
	ON C_Payment
FOR EACH ROW
DECLARE
	v_NextNo				NUMBER(10);
BEGIN
/*************************************************************************
 * 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+CPM
 * Copyright (C) 1999-2001 Jorg Janke, ComPiere, Inc. All Rights Reserved.
 *************************************************************************
 * $Id: C_Payment_Trg.sql,v 1.6 2003/04/28 04:19:34 jjanke Exp $
 ***
 * Title:	Payment Document Updates
 * Description:
 *		Update Document No as summary of payment info
 ************************************************************************/

	IF (INSERTING AND :new.DocumentNo = '.') THEN
		IF (:new.TenderType = 'C') THEN
			:new.DocumentNo := :new.CreditCardType || ' ' 
				|| COALESCE(SUBSTR(:new.CreditCardNumber, LENGTH(:new.CreditCardNumber)-3), :new.C_Payment_ID) 
				|| ' ' || :new.CreditCardExpMM || '/' || :new.CreditCardExpYY;
		ELSE
			:new.DocumentNo := :new.RoutingNo || ' ' || :new.AccountNo;
			IF (:new.TenderType = 'K') THEN		--	add also check no
				:new.DocumentNo := :new.DocumentNo || ' ' || :new.CheckNo;
			END IF;
		END IF;
	END IF;
	
	IF (UPDATING AND :new.R_PnRef IS NOT NULL AND :new.R_PnRef <> :new.DocumentNo) THEN
		:new.DocumentNo := :new.R_PnRef;
	END IF;

	--	If information is empty use ID
	IF (TRIM(:new.DocumentNo) IS NULL) THEN
		:new.DocumentNo := :new.C_Payment_ID;
	END IF;

END C_Payment_Trg;
/

⌨️ 快捷键说明

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