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

📄 c_order_trg.sql

📁 Java写的ERP系统
💻 SQL
字号:
CREATE OR REPLACE TRIGGER C_Order_Trg
AFTER UPDATE OF PaymentRule, C_PaymentTerm_ID, DateAcct, 
		Description, POReference,
		C_Payment_ID, C_CashLine_ID,
		C_BPartner_ID, C_BPartner_Location_ID, M_Warehouse_ID, 
		M_Shipper_ID, C_Currency_ID
	ON C_Order
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_Order_Trg.sql,v 1.3 2003/04/15 05:09:26 jjanke Exp $
 ***
 * Title:	Order Trigger
 * Description:
 *		Update potentially existing Invoices with Payment Info
 *		Sync Header Changes to Lines
 ************************************************************************/
BEGIN
	--	Propagate Description changes
	UPDATE C_Invoice
	  SET Description		= :new.Description,
		  POReference		= :new.POReference
	WHERE	C_Order_ID = :new.C_Order_ID;

	--	Propagate Changes of Payment Info to existing invoices
	UPDATE C_Invoice
	  SET PaymentRule		= :new.PaymentRule,
		  C_PaymentTerm_ID	= :new.C_PaymentTerm_ID,
		  DateAcct			= :new.DateAcct,
		  C_Payment_ID		= :new.C_Payment_ID,
		  C_CashLine_ID		= :new.C_CashLine_ID
	WHERE	C_Order_ID = :new.C_Order_ID
	  AND	DocStatus NOT IN ('RE','CL');	--	Don't touch Closed/Reversed entries

	--	Sync Lines
	UPDATE C_OrderLine
      SET C_BPartner_ID          = :new.C_BPartner_ID,
          C_BPartner_Location_ID = :new.C_BPartner_Location_ID,
          DATEORDERED            = :new.DATEORDERED,
          DATEPROMISED           = :new.DATEPROMISED,
          M_Warehouse_ID         = :new.M_Warehouse_ID,
          M_Shipper_ID           = :new.M_Shipper_ID,
          C_Currency_ID          = :new.C_Currency_ID
	WHERE C_Order_ID = :new.C_Order_ID;


END C_Order_Trg;
/

⌨️ 快捷键说明

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