📄 s_resource_trg.sql
字号:
CREATE OR REPLACE TRIGGER S_Resource_Trg
AFTER INSERT OR UPDATE
ON S_Resource
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_Resource_Trg.sql,v 1.2 2002/10/23 03:16:57 jjanke Exp $
***
* Title: S_Resource
* Description:
* Syncronize Resource with Product
************************************************************************/
NextNo M_Product.M_Product_ID%TYPE;
v_C_UOM_ID M_Product.C_UOM_ID%TYPE;
v_M_Product_Category_ID M_Product.M_Product_Category_ID%TYPE;
v_C_TaxCategory_ID M_Product.C_TaxCategory_ID%TYPE;
BEGIN
IF (INSERTING) THEN
-- Get ResourceType Info
SELECT C_UOM_ID, M_Product_Category_ID, C_TaxCategory_ID
INTO v_C_UOM_ID, v_M_Product_Category_ID, v_C_TaxCategory_ID
FROM S_ResourceType
WHERE S_ResourceType_ID = :new.S_ResourceType_ID;
--
AD_Sequence_Next('M_Product', :new.AD_Client_ID, NextNo);
INSERT INTO M_PRODUCT
(M_Product_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,
Value, Name, Description,
DOCUMENTNOTE, HELP, UPC, SKU, C_UOM_ID,
SALESREP_ID, ISSUMMARY, ProductType, ISSTOCKED, ISPURCHASED, ISSOLD, ISBOM,
ISINVOICEPRINTDETAILS, ISPICKLISTPRINTDETAILS, ISVERIFIED,
C_REVENUERECOGNITION_ID, M_Product_Category_ID, CLASSIFICATION,
VOLUME,WEIGHT, SHELFWIDTH,SHELFHEIGHT,SHELFDEPTH,UNITSPERPALLET,
C_TaxCategory_ID, S_Resource_ID, S_EXPENSETYPE_ID,
DISCONTINUED,DISCONTINUEDBY, PROCESSING)
VALUES
(NextNo, :new.AD_Client_ID,:new.AD_Org_ID,:new.IsActive,:new.Created,:new.CreatedBy,:new.Updated,:new.UpdatedBy,
:new.Value, :new.Name, :new.Description,
null, null, null, null, v_C_UOM_ID,
null, 'N', 'R', 'N', 'N', 'Y', 'N',
'N', 'N', 'N',
null, v_M_Product_Category_ID, null,
0,0, 0,0,0,0,
v_C_TaxCategory_ID, :new.S_Resource_ID, null,
'N',null, null);
ELSIF (UPDATING) THEN
UPDATE M_Product
SET IsActive = :new.IsActive,
Updated = :new.Updated,
UpdatedBy = :new.UpdatedBy,
Value = :new.Value,
Name = :new.Name,
Description = :new.Description
WHERE S_Resource_ID = :new.S_Resource_ID;
END IF;
END S_Resource_Trg;
/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -