s_resourceassignment_trg.sql

来自「Java写的ERP系统」· SQL 代码 · 共 52 行

SQL
52
字号
CREATE OR REPLACE TRIGGER S_ResourceAssignment_Trg
AFTER INSERT OR UPDATE OR DELETE
  ON S_ResourceAssignment
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: S_ResourceAssignment_Trg.sql,v 1.2 2003/03/19 06:46:56 jjanke Exp $
 ***
 * Title:	S_Resource Assignment
 * Description:
 *			Syncronize Resource Assugnment with Expense Reports
 ************************************************************************/
	v_Description		NVARCHAR2(255);
BEGIN
	NULL;
	/**
	IF (INSERTING OR UPDATING) THEN
		v_Description := :new.Name;
		IF (:new.Description IS NOT NULL AND LENGTH(:new.Description) > 0) THEN
			v_Description := v_Description || ' (' || :new.Description || ')';			
		END IF;
		
		-- Update Expense Line
		UPDATE S_TimeExpenseLine
		  SET  Description = v_Description,
			Qty = :new.Qty
		WHERE S_ResourceAssignment_ID = :new.S_ResourceAssignment_ID
		  AND (Description <> v_Description OR Qty <> :new.Qty);
		  
		-- Update Order Line
		UPDATE C_OrderLine
		  SET  Description = v_Description,
			QtyOrdered = :new.Qty
		WHERE S_ResourceAssignment_ID = :new.S_ResourceAssignment_ID
		  AND (Description <> v_Description OR QtyOrdered <> :new.Qty);

		-- Update Invoice Line
		UPDATE C_InvoiceLine
		  SET  Description = v_Description,
			QtyInvoiced = :new.Qty
		WHERE S_ResourceAssignment_ID = :new.S_ResourceAssignment_ID
		  AND (Description <> v_Description OR QtyInvoiced <> :new.Qty);
	END IF;
	**/	
END S_ResourceAssignment_Trg;
/

⌨️ 快捷键说明

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