datafixes.sql

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

SQL
36
字号
/*************************************************************************
 * 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-2003 Jorg Janke, ComPiere, Inc. All Rights Reserved.
 *************************************************************************
 * $Id: datafixes.sql,v 1.2 2003/03/14 06:11:22 jjanke Exp $
 ***
 * Title:	Data Fixes
 * Description:
 ************************************************************************/

--	Set Receipt in Payment
UPDATE C_Payment p
  SET IsReceipt = (SELECT CASE DocBaseType WHEN 'ARR' THEN 'Y' ELSE 'N' END
	FROM C_DocType dt WHERE p.C_DocType_ID=dt.C_DocType_ID)
WHERE IsReceipt <> (SELECT	CASE DocBaseType WHEN 'ARR' THEN 'Y' ELSE 'N' END
	FROM C_DocType dt WHERE p.C_DocType_ID=dt.C_DocType_ID)
/
--	Set Default
UPDATE C_Payment
  SET OverUnderAmt = 0
WHERE OverUnderAmt IS NULL
/

--	Fix TotalAmount
UPDATE	C_PaySelection ps
  SET	TotalAmt = (SELECT COALESCE(SUM(PayAmt),0) FROM C_PaySelectionLine psl
	WHERE ps.C_PaySelection_ID = psl.C_PaySelection_ID)
/


COMMIT
/

⌨️ 快捷键说明

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