📄 c_revenuerecognition_plan_trg.sql
字号:
CREATE OR REPLACE TRIGGER C_RevenueRecognition_Plan_Trg
AFTER INSERT
ON C_RevenueRecognition_Plan
FOR EACH ROW
DECLARE
/******************************************************************************
* ** Compiere Product ** Copyright (c) 1999-2001 Accorto, Inc. USA
* Open Source Software Provided "AS IS" without warranty or liability
* When you use any parts (changed or unchanged), add "Powered by Compiere" to
* your product name; See license details http://www.compiere.org/license.html
******************************************************************************
* Create Service Plan for new RevenueRegognition Plans
*/
v_IsTimeBased CHAR(1);
v_NextNo NUMBER;
v_Qty NUMBER;
v_M_Product_ID NUMBER;
BEGIN
-- Is RevenueRecognition Time Based?
SELECT IsTimeBased
INTO v_IsTimeBased
FROM C_RevenueRecognition
WHERE C_RevenueRecognition_ID=:new.C_RevenueRecognition_ID;
-- Add Service Plan
IF (v_IsTimeBased = 'Y') THEN
-- Get InvoiveQty
SELECT QtyInvoiced, M_Product_ID
INTO v_Qty, v_M_Product_ID
FROM C_InvoiceLine
WHERE C_InvoiceLine_ID=:new.C_InvoiceLine_ID;
-- Insert
AD_Sequence_Next ('C_ServiceLevel', :new.AD_Client_ID, v_NextNo);
INSERT INTO C_ServiceLevel
(C_ServiceLevel_ID, C_RevenueRecognition_Plan_ID,
AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,
M_Product_ID, Description, ServiceLevelInvoiced, ServiceLevelProvided,
Processing,Processed)
VALUES
(v_NextNo, :new.C_RevenueRecognition_Plan_ID,
:new.AD_Client_ID,:new.AD_Org_ID,'Y',SysDate,:new.CreatedBy,SysDate,:new.UpdatedBy,
v_M_Product_ID, NULL, v_Qty, 0,
'N', 'N');
END IF;
END C_RevenueRecognition_Plan_Trg;
/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -