IDEMPIERE-2134 Issues found on Payment Selection process

* Payment Selection Manual:
** WPaySelect.onEvent: improved to refresh lines on onlydue, paymentrule and paymentdate changes
** PaySelect.getPaymentRuleData: is getting also inactive payment rules
** WPaySelect is showing correctly the schedule records of an invoice, but the due date is wrong - leading to wrong schedule records shown with only due invoices flag
** PaySelect.getDocTypeData: Is just selecting API/APC, can also include AR documents

* Payment Selection Create (button on window)
** running PaySelectionCreateFrom repeated the invoices - must just add new
** issotrx set based on payment rule - direct debit Y, otherwise N
** The process is getting the records from C_Invoice instead of C_Invoice_V (as manual does) - this must be leading to error on selected schedule records for only due parameter (test required to confirm)

* Payment Print/Export
** deleted not used PayPrint.getPaySelectionData
This commit is contained in:
Carlos Ruiz 2014-08-11 17:04:53 +02:00
parent f4f2cb9555
commit 2c04735527
8 changed files with 237 additions and 66 deletions

View File

@ -59,7 +59,7 @@ BEGIN
INTO v_Amount
FROM C_InvoicePaySchedule
WHERE C_InvoicePaySchedule_ID=p_C_InvoicePaySchedule_ID
AND DiscountDate <= v_PayDate;
AND DiscountDate >= v_PayDate;
--
RETURN v_Amount;
END IF;

View File

@ -64,7 +64,7 @@ BEGIN
INTO v_Amount
FROM C_InvoicePaySchedule
WHERE C_InvoicePaySchedule_ID=p_C_InvoicePaySchedule_ID
AND DiscountDate <= v_PayDate;
AND DiscountDate >= v_PayDate;
--
RETURN v_Amount;
END IF;

View File

@ -0,0 +1,87 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Aug 11, 2014 11:38:21 AM CEST
-- IDEMPIERE-2134 Issues found on Payment Selection process
UPDATE AD_Process_Para SET DefaultValue='N',Updated=TO_DATE('2014-08-11 11:38:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=184
;
CREATE OR REPLACE FUNCTION invoiceDiscount
(
p_C_Invoice_ID IN NUMBER,
p_PayDate IN DATE,
p_C_InvoicePaySchedule_ID IN NUMBER
)
RETURN NUMBER
/*************************************************************************
* 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_Invoice_Discount.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $
***
* Title: Calculate Payment Discount Amount
* Description:
* - Calculate discountable amount (i.e. with or without tax)
* - Calculate and return payment discount
************************************************************************/
AS
v_Amount NUMBER;
v_IsDiscountLineAmt CHAR(1);
v_GrandTotal NUMBER;
v_TotalLines NUMBER;
v_C_PaymentTerm_ID NUMBER(10);
v_C_Currency_ID NUMBER(10);
v_DocDate DATE;
v_PayDate DATE := SysDate;
v_IsPayScheduleValid CHAR(1);
BEGIN
SELECT ci.IsDiscountLineAmt, i.GrandTotal, i.TotalLines,
i.C_PaymentTerm_ID, i.DateInvoiced, i.IsPayScheduleValid, C_Currency_ID
INTO v_IsDiscountLineAmt, v_GrandTotal, v_TotalLines,
v_C_PaymentTerm_ID, v_DocDate, v_IsPayScheduleValid, v_C_Currency_ID
FROM AD_ClientInfo ci, C_Invoice i
WHERE ci.AD_Client_ID=i.AD_Client_ID
AND i.C_Invoice_ID=p_C_Invoice_ID;
-- What Amount is the Discount Base?
IF (v_IsDiscountLineAmt = 'Y') THEN
v_Amount := v_TotalLines;
ELSE
v_Amount := v_GrandTotal;
END IF;
-- Anything to discount?
IF (v_Amount = 0) THEN
RETURN 0;
END IF;
IF (p_PayDate IS NOT NULL) THEN
v_PayDate := p_PayDate;
END IF;
-- Valid Payment Schedule
IF (v_IsPayScheduleValid='Y' AND p_C_InvoicePaySchedule_ID > 0) THEN
SELECT COALESCE(MAX(DiscountAmt),0)
INTO v_Amount
FROM C_InvoicePaySchedule
WHERE C_InvoicePaySchedule_ID=p_C_InvoicePaySchedule_ID
AND DiscountDate >= v_PayDate;
--
RETURN v_Amount;
END IF;
-- return discount amount
RETURN paymentTermDiscount (v_Amount, v_C_Currency_ID, v_C_PaymentTerm_ID, v_DocDate, p_PayDate);
-- Most likely if invoice not found
EXCEPTION
WHEN OTHERS THEN
RETURN NULL;
END invoiceDiscount;
/
SELECT register_migration_script('201408111139_IDEMPIERE-2134.sql') FROM dual
;

View File

@ -0,0 +1,90 @@
-- Aug 11, 2014 11:38:21 AM CEST
-- IDEMPIERE-2134 Issues found on Payment Selection process
UPDATE AD_Process_Para SET DefaultValue='N',Updated=TO_TIMESTAMP('2014-08-11 11:38:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=184
;
CREATE OR REPLACE FUNCTION invoiceDiscount
(
p_C_Invoice_ID NUMERIC,
p_paydate timestamp with time zone,
p_C_InvoicePaySchedule_ID NUMERIC
)
RETURNS numeric AS $body$
/*************************************************************************
* 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.
*
* converted to postgreSQL by Karsten Thiemann (Schaeffer AG),
* kthiemann@adempiere.org
*************************************************************************
***
* Title: Calculate Payment Discount Amount
* Description:
* - Calculate discountable amount (i.e. with or without tax)
* - Calculate and return payment discount
* Test:
* select invoiceDiscount(109, now(), 103) from ad_system; => 0
************************************************************************/
DECLARE
v_Amount NUMERIC;
v_IsDiscountLineAmt CHAR(1);
v_GrandTotal NUMERIC;
v_TotalLines NUMERIC;
v_C_PaymentTerm_ID NUMERIC(10);
v_C_Currency_ID NUMERIC(10);
v_DocDate timestamp with time zone;
v_PayDate timestamp with time zone := now();
v_IsPayScheduleValid CHAR(1);
BEGIN
SELECT ci.IsDiscountLineAmt, i.GrandTotal, i.TotalLines,
i.C_PaymentTerm_ID, i.DateInvoiced, i.IsPayScheduleValid, C_Currency_ID
INTO v_IsDiscountLineAmt, v_GrandTotal, v_TotalLines,
v_C_PaymentTerm_ID, v_DocDate, v_IsPayScheduleValid, v_C_Currency_ID
FROM AD_ClientInfo ci, C_Invoice i
WHERE ci.AD_Client_ID=i.AD_Client_ID
AND i.C_Invoice_ID=p_C_Invoice_ID;
-- What Amount is the Discount Base?
IF (v_IsDiscountLineAmt = 'Y') THEN
v_Amount := v_TotalLines;
ELSE
v_Amount := v_GrandTotal;
END IF;
-- Anything to discount?
IF (v_Amount = 0) THEN
RETURN 0;
END IF;
IF (p_PayDate IS NOT NULL) THEN
v_PayDate := p_PayDate;
END IF;
-- Valid Payment Schedule
IF (v_IsPayScheduleValid='Y' AND p_C_InvoicePaySchedule_ID > 0) THEN
SELECT COALESCE(MAX(DiscountAmt),0)
INTO v_Amount
FROM C_InvoicePaySchedule
WHERE C_InvoicePaySchedule_ID=p_C_InvoicePaySchedule_ID
AND DiscountDate >= v_PayDate;
--
RETURN v_Amount;
END IF;
-- return discount amount
RETURN paymentTermDiscount (v_Amount, v_C_Currency_ID, v_C_PaymentTerm_ID, v_DocDate, p_PayDate);
-- Most likely if invoice not found
EXCEPTION
WHEN OTHERS THEN
RETURN NULL;
END;
$body$ LANGUAGE plpgsql STABLE;
SELECT register_migration_script('201408111139_IDEMPIERE-2134.sql') FROM dual
;

View File

@ -19,11 +19,15 @@ package org.compiere.process;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.DBException;
import org.compiere.model.MPaySelection;
import org.compiere.model.MPaySelectionLine;
import org.compiere.model.X_C_Order;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -115,21 +119,27 @@ public class PaySelectionCreateFrom extends SvrProcess
StringBuilder sql = new StringBuilder("SELECT C_Invoice_ID,")
// Open
.append(" currencyConvert(invoiceOpen(i.C_Invoice_ID, 0)")
.append(",i.C_Currency_ID, ?,?, i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),") // ##1/2 Currency_To,PayDate
.append(" currencyConvert(invoiceOpen(i.C_Invoice_ID, i.C_InvoicePaySchedule_ID)")
.append(",i.C_Currency_ID, ?,?, i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID) AS PayAmt,") // ##1/2 Currency_To,PayDate
// Discount
.append(" currencyConvert(paymentTermDiscount(i.GrandTotal,i.C_Currency_ID,i.C_PaymentTerm_ID,i.DateInvoiced, ?)") // ##3 PayDate
.append(",i.C_Currency_ID, ?,?,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),") // ##4/5 Currency_To,PayDate
.append(" currencyConvert(invoiceDiscount(i.C_Invoice_ID,?,i.C_InvoicePaySchedule_ID)") // ##3 PayDate
.append(",i.C_Currency_ID, ?,?,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID) AS DiscountAmt,") // ##4/5 Currency_To,PayDate
.append(" PaymentRule, IsSOTrx ") // 4..6
.append("FROM C_Invoice i ")
.append("WHERE IsSOTrx='N' AND IsPaid='N' AND DocStatus IN ('CO','CL')")
.append("FROM C_Invoice_v i WHERE ");
if (X_C_Order.PAYMENTRULE_DirectDebit.equals(p_PaymentRule))
sql.append("IsSOTrx='Y'");
else
sql.append("IsSOTrx='N'");
sql.append(" AND IsPaid='N' AND DocStatus IN ('CO','CL')")
.append(" AND AD_Client_ID=?") // ##6
// Existing Payments - Will reselect Invoice if prepared but not paid
.append(" AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl")
.append(" INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID)")
.append(" LEFT OUTER JOIN C_Payment pmt ON (pmt.C_Payment_ID=psc.C_Payment_ID)")
.append(" WHERE i.C_Invoice_ID=psl.C_Invoice_ID AND psl.IsActive='Y'")
.append(" AND (pmt.DocStatus IS NULL OR pmt.DocStatus NOT IN ('VO','RE')) )");
.append(" AND (pmt.DocStatus IS NULL OR pmt.DocStatus NOT IN ('VO','RE')) )")
// Don't generate again invoices already on this payment selection
.append(" AND i.C_Invoice_ID NOT IN (SELECT i.C_Invoice_ID FROM C_PaySelectionLine psl WHERE psl.C_PaySelection_ID=?)"); // ##7
// Disputed
if (!p_IncludeInDispute)
sql.append(" AND i.IsInDispute='N'");
@ -143,7 +153,7 @@ public class PaySelectionCreateFrom extends SvrProcess
sql.append(" AND (");
else
sql.append(" AND ");
sql.append("paymentTermDiscount(invoiceOpen(C_Invoice_ID, 0), C_Currency_ID, C_PaymentTerm_ID, DateInvoiced, ?) > 0"); // ##
sql.append("invoiceDiscount(i.C_Invoice_ID,?,i.C_InvoicePaySchedule_ID) > 0"); // ##
}
// OnlyDue
if (p_OnlyDue)
@ -152,7 +162,8 @@ public class PaySelectionCreateFrom extends SvrProcess
sql.append(" OR ");
else
sql.append(" AND ");
sql.append("paymentTermDueDays(C_PaymentTerm_ID, DateInvoiced, ?) >= 0"); // ##
// sql.append("paymentTermDueDays(C_PaymentTerm_ID, DateInvoiced, ?) >= 0"); // ##
sql.append("i.DueDate<=?"); // ##
if (p_OnlyDiscount)
sql.append(")");
}
@ -197,6 +208,7 @@ public class PaySelectionCreateFrom extends SvrProcess
pstmt.setTimestamp(index++, psel.getPayDate());
//
pstmt.setInt(index++, psel.getAD_Client_ID());
pstmt.setInt(index++, p_C_PaySelection_ID);
if (p_PaymentRule != null)
pstmt.setString(index++, p_PaymentRule);
if (p_OnlyDiscount)
@ -229,9 +241,13 @@ public class PaySelectionCreateFrom extends SvrProcess
}
}
}
catch (SQLException e)
{
throw new DBException(e);
}
catch (Exception e)
{
log.log(Level.SEVERE, sql.toString(), e);
throw new AdempiereException(e);
}
finally
{

View File

@ -39,6 +39,8 @@ import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.WListbox;
import org.adempiere.webui.editor.WDateEditor;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.event.WTableModelEvent;
import org.adempiere.webui.event.WTableModelListener;
import org.adempiere.webui.panel.ADForm;
@ -76,7 +78,7 @@ import org.zkoss.zul.Space;
* @version $Id: VPaySelect.java,v 1.3 2006/07/30 00:51:28 jjanke Exp $
*/
public class WPaySelect extends PaySelect
implements IFormController, EventListener<Event>, WTableModelListener, IProcessUI
implements IFormController, EventListener<Event>, WTableModelListener, IProcessUI, ValueChangeListener
{
/** @todo withholding */
@ -164,6 +166,8 @@ public class WPaySelect extends PaySelect
onlyDue.setText(Msg.getMsg(Env.getCtx(), "OnlyDue"));
dataStatus.setText(" ");
dataStatus.setPre(true);
onlyDue.addActionListener(this);
fieldPayDate.addValueChangeListener(this);
//
bGenerate.addActionListener(this);
bCancel.addActionListener(this);
@ -322,11 +326,18 @@ public class WPaySelect extends PaySelect
dispose();
// Update Open Invoices
else if (e.getTarget() == fieldBPartner || e.getTarget() == bRefresh || e.getTarget() == fieldDtype)
else if (e.getTarget() == fieldBPartner || e.getTarget() == bRefresh || e.getTarget() == fieldDtype
|| e.getTarget() == fieldPaymentRule || e.getTarget() == onlyDue)
loadTableInfo();
} // actionPerformed
@Override
public void valueChange(ValueChangeEvent e) {
if (e.getSource() == fieldPayDate)
loadTableInfo();
}
/**
* Table Model Listener
* @param e event

View File

@ -17,6 +17,8 @@
*****************************************************************************/
package org.compiere.apps.form;
import static org.compiere.model.SystemIDs.REFERENCE_PAYMENTRULE;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@ -28,11 +30,9 @@ import org.compiere.model.MLookupFactory;
import org.compiere.model.MLookupInfo;
import org.compiere.model.MPaySelectionCheck;
import org.compiere.model.MPaymentBatch;
import static org.compiere.model.SystemIDs.*;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Language;
import org.compiere.util.ValueNamePair;
@ -54,45 +54,6 @@ public class PayPrint {
/** Logger */
public static CLogger log = CLogger.getCLogger(PayPrint.class);
public ArrayList<KeyNamePair> getPaySelectionData()
{
ArrayList<KeyNamePair> data = new ArrayList<KeyNamePair>();
log.config("");
int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
// Load PaySelect
String sql = "SELECT C_PaySelection_ID, Name || ' - ' || TotalAmt FROM C_PaySelection "
+ "WHERE AD_Client_ID=? AND Processed='Y' AND IsActive='Y'"
+ "ORDER BY PayDate DESC";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, AD_Client_ID);
rs = pstmt.executeQuery();
//
while (rs.next())
{
KeyNamePair pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
data.add(pp);
}
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql, e);
}
finally
{
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
return data;
}
public String bank;
public String currency;
public BigDecimal balance;

View File

@ -25,6 +25,8 @@ import java.util.ArrayList;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.DBException;
import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn;
import org.compiere.minigrid.IMiniTable;
@ -173,7 +175,7 @@ public class PaySelect
try
{
sql = MRole.getDefault().addAccessSQL(
"SELECT doc.c_doctype_id,doc.name FROM c_doctype doc WHERE doc.ad_client_id = ? AND doc.docbasetype in ('API','APC') ORDER BY 2", "doc",
"SELECT doc.c_doctype_id,doc.name FROM c_doctype doc WHERE doc.ad_client_id = ? AND doc.docbasetype in ('API','APC','ARI','ARC') ORDER BY 2", "doc",
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
KeyNamePair dt = new KeyNamePair(0, "");
@ -214,7 +216,7 @@ public class PaySelect
i.GrandTotal-paymentTermDiscount(i.GrandTotal,i.C_PaymentTerm_ID,i.DateInvoiced,SysDate) AS DueAmount,
currencyConvert(i.GrandTotal-paymentTermDiscount(i.GrandTotal,i.C_PaymentTerm_ID,i.DateInvoiced,SysDate,null),
i.C_Currency_ID,xx100,SysDate) AS PayAmt
FROM C_Invoice i, C_BPartner bp, C_Currency c, C_PaymentTerm p
FROM C_Invoice_v i, C_BPartner bp, C_Currency c, C_PaymentTerm p
WHERE i.IsSOTrx='N'
AND i.C_BPartner_ID=bp.C_BPartner_ID
AND i.C_Currency_ID=c.C_Currency_ID
@ -226,16 +228,16 @@ public class PaySelect
m_sql = miniTable.prepareTable(new ColumnInfo[] {
// 0..4
new ColumnInfo(" ", "i.C_Invoice_ID", IDColumn.class, false, false, null),
new ColumnInfo(Msg.translate(ctx, "DueDate"), "paymentTermDueDate(i.C_PaymentTerm_ID, i.DateInvoiced) AS DateDue", Timestamp.class, true, true, null),
new ColumnInfo(Msg.translate(ctx, "DueDate"), "i.DueDate AS DateDue", Timestamp.class, true, true, null),
new ColumnInfo(Msg.translate(ctx, "C_BPartner_ID"), "bp.Name", KeyNamePair.class, true, false, "i.C_BPartner_ID"),
new ColumnInfo(Msg.translate(ctx, "DocumentNo"), "i.DocumentNo", String.class),
new ColumnInfo(Msg.translate(ctx, "C_Currency_ID"), "c.ISO_Code", KeyNamePair.class, true, false, "i.C_Currency_ID"),
// 5..9
new ColumnInfo(Msg.translate(ctx, "GrandTotal"), "i.GrandTotal", BigDecimal.class),
new ColumnInfo(Msg.translate(ctx, "DiscountAmt"), "paymentTermDiscount(i.GrandTotal,i.C_Currency_ID,i.C_PaymentTerm_ID,i.DateInvoiced, ?)", BigDecimal.class),
new ColumnInfo(Msg.getMsg(ctx, "DiscountDate"), "SysDate-paymentTermDueDays(i.C_PaymentTerm_ID,i.DateInvoiced,SysDate)", Timestamp.class),
new ColumnInfo(Msg.getMsg(ctx, "AmountDue"), "currencyConvert(invoiceOpen(i.C_Invoice_ID,i.C_InvoicePaySchedule_ID),i.C_Currency_ID, ?,?,i.C_ConversionType_ID, i.AD_Client_ID,i.AD_Org_ID)", BigDecimal.class),
new ColumnInfo(Msg.getMsg(ctx, "AmountPay"), "currencyConvert(invoiceOpen(i.C_Invoice_ID,i.C_InvoicePaySchedule_ID)-paymentTermDiscount(i.GrandTotal,i.C_Currency_ID,i.C_PaymentTerm_ID,i.DateInvoiced, ?),i.C_Currency_ID, ?,?,i.C_ConversionType_ID, i.AD_Client_ID,i.AD_Org_ID)", BigDecimal.class)
new ColumnInfo(Msg.translate(ctx, "DiscountAmt"), "invoiceDiscount(i.C_Invoice_ID,?,i.C_InvoicePaySchedule_ID)", BigDecimal.class),
new ColumnInfo(Msg.getMsg(ctx, "DiscountDate"), "COALESCE((SELECT discountdate from C_InvoicePaySchedule ips WHERE ips.C_InvoicePaySchedule_ID=i.C_InvoicePaySchedule_ID),i.DateInvoiced+p.DiscountDays+p.GraceDays) AS DiscountDate", Timestamp.class),
new ColumnInfo(Msg.getMsg(ctx, "AmountDue"), "currencyConvert(invoiceOpen(i.C_Invoice_ID,i.C_InvoicePaySchedule_ID),i.C_Currency_ID, ?,?,i.C_ConversionType_ID, i.AD_Client_ID,i.AD_Org_ID) AS AmountDue", BigDecimal.class),
new ColumnInfo(Msg.getMsg(ctx, "AmountPay"), "currencyConvert(invoiceOpen(i.C_Invoice_ID,i.C_InvoicePaySchedule_ID)-invoiceDiscount(i.C_Invoice_ID,?,i.C_InvoicePaySchedule_ID),i.C_Currency_ID, ?,?,i.C_ConversionType_ID, i.AD_Client_ID,i.AD_Org_ID) AS AmountPay", BigDecimal.class)
},
// FROM
"C_Invoice_v i"
@ -271,7 +273,7 @@ public class PaySelect
MLookupInfo info = MLookupFactory.getLookup_List(language, AD_Reference_ID);
String sql = info.Query.substring(0, info.Query.indexOf(" ORDER BY"))
+ " AND " + info.KeyColumn
+ " IN (SELECT PaymentRule FROM C_BankAccountDoc WHERE C_BankAccount_ID=?) "
+ " IN (SELECT PaymentRule FROM C_BankAccountDoc WHERE C_BankAccount_ID=? AND IsActive='Y') "
+ info.Query.substring(info.Query.indexOf(" ORDER BY"));
PreparedStatement pstmt = null;
ResultSet rs = null;
@ -283,7 +285,7 @@ public class PaySelect
ValueNamePair vp = null;
while (rs.next())
{
vp = new ValueNamePair(rs.getString(2), rs.getString(3)); // returns also not active
vp = new ValueNamePair(rs.getString(2), rs.getString(3));
data.add(vp);
}
}
@ -321,7 +323,7 @@ public class PaySelect
}
//
if (onlyDue)
sql += " AND paymentTermDueDate(i.C_PaymentTerm_ID, i.DateInvoiced) <= ?";
sql += " AND i.DueDate <= ?";
//
KeyNamePair pp = bpartner;
int C_BPartner_ID = pp.getKey();
@ -362,7 +364,11 @@ public class PaySelect
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql, e);
throw new DBException(e);
}
catch (Exception e)
{
throw new AdempiereException(e);
}
finally
{