Integrate bug fixing from Teo Sarca

BUG ID 1619076 - Bank statement's StatementDifference becames NULL
This commit is contained in:
Carlos Ruiz 2006-12-20 08:27:06 +00:00
parent 013a2e75f9
commit 4164f5a8a8
1 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
@ -13,6 +13,7 @@
* For the text or an alternative of this public license, you may reach us * * For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html * * or via info@compiere.org or http://www.compiere.org/license.html *
* Contributor(s): Teo Sarca *
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
@ -26,6 +27,9 @@ import org.compiere.util.*;
* *
* @author Eldir Tomassen/Jorg Janke * @author Eldir Tomassen/Jorg Janke
* @version $Id: MBankStatementLine.java,v 1.3 2006/07/30 00:51:02 jjanke Exp $ * @version $Id: MBankStatementLine.java,v 1.3 2006/07/30 00:51:02 jjanke Exp $
*
* Carlos Ruiz - globalqss - integrate bug fixing from Teo Sarca
* [ 1619076 ] Bank statement's StatementDifference becames NULL
*/ */
public class MBankStatementLine extends X_C_BankStatementLine public class MBankStatementLine extends X_C_BankStatementLine
{ {
@ -205,7 +209,7 @@ import org.compiere.util.*;
private void updateHeader() private void updateHeader()
{ {
String sql = "UPDATE C_BankStatement bs" String sql = "UPDATE C_BankStatement bs"
+ " SET StatementDifference=(SELECT SUM(StmtAmt) FROM C_BankStatementLine bsl " + " SET StatementDifference=(SELECT COALESCE(SUM(StmtAmt),0) FROM C_BankStatementLine bsl "
+ "WHERE bsl.C_BankStatement_ID=bs.C_BankStatement_ID AND bsl.IsActive='Y') " + "WHERE bsl.C_BankStatement_ID=bs.C_BankStatement_ID AND bsl.IsActive='Y') "
+ "WHERE C_BankStatement_ID=" + getC_BankStatement_ID(); + "WHERE C_BankStatement_ID=" + getC_BankStatement_ID();
DB.executeUpdate(sql, get_TrxName()); DB.executeUpdate(sql, get_TrxName());