Fixed sql for Query class.
We can't use aliase for Table names. Developer must use Table name.
This commit is contained in:
parent
cc06e54751
commit
2c00825d7d
|
@ -44,6 +44,9 @@ import org.compiere.util.TimeUtil;
|
||||||
*/
|
*/
|
||||||
public class MCash extends X_C_Cash implements DocAction
|
public class MCash extends X_C_Cash implements DocAction
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Cash Journal for currency, org and date
|
* Get Cash Journal for currency, org and date
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
|
@ -57,14 +60,16 @@ public class MCash extends X_C_Cash implements DocAction
|
||||||
Timestamp dateAcct, int C_Currency_ID, String trxName)
|
Timestamp dateAcct, int C_Currency_ID, String trxName)
|
||||||
{
|
{
|
||||||
// Existing Journal
|
// Existing Journal
|
||||||
String whereClause = "c.AD_Org_ID=?" // #1
|
String whereClause = "C_Cash.AD_Org_ID=?" // #1
|
||||||
+ " AND TRUNC(c.StatementDate)=?" // #2
|
+ " AND TRUNC(C_Cash.StatementDate)=?" // #2
|
||||||
+ " AND c.Processed='N'"
|
+ " AND C_Cash.Processed='N'"
|
||||||
+ " AND EXISTS (SELECT * FROM C_CashBook cb "
|
+ " AND EXISTS (SELECT * FROM C_CashBook cb "
|
||||||
+ "WHERE c.C_CashBook_ID=cb.C_CashBook_ID AND cb.AD_Org_ID=c.AD_Org_ID"
|
+ "WHERE C_Cash.C_CashBook_ID=cb.C_CashBook_ID AND cb.AD_Org_ID=C_Cash.AD_Org_ID"
|
||||||
+ " AND cb.C_Currency_ID=?)"; // #3
|
+ " AND cb.C_Currency_ID=?)"; // #3
|
||||||
MCash retValue = new Query(ctx,MCash.Table_Name,whereClause,trxName)
|
MCash retValue = new Query(ctx, MCash.Table_Name, whereClause, trxName)
|
||||||
.setParameters(new Object[]{AD_Org_ID,TimeUtil.getDay(dateAcct),C_Currency_ID}).first();
|
.setParameters(new Object[]{AD_Org_ID,TimeUtil.getDay(dateAcct),C_Currency_ID})
|
||||||
|
.first()
|
||||||
|
;
|
||||||
|
|
||||||
if (retValue != null)
|
if (retValue != null)
|
||||||
return retValue;
|
return retValue;
|
||||||
|
@ -94,12 +99,14 @@ public class MCash extends X_C_Cash implements DocAction
|
||||||
public static MCash get (Properties ctx, int C_CashBook_ID,
|
public static MCash get (Properties ctx, int C_CashBook_ID,
|
||||||
Timestamp dateAcct, String trxName)
|
Timestamp dateAcct, String trxName)
|
||||||
{
|
{
|
||||||
String whereClause ="c.C_CashBook_ID=?" // #1
|
String whereClause ="C_CashBook_ID=?" // #1
|
||||||
+ " AND TRUNC(c.StatementDate)=?" // #2
|
+ " AND TRUNC(StatementDate)=?" // #2
|
||||||
+ " AND c.Processed='N'";
|
+ " AND Processed='N'";
|
||||||
|
|
||||||
MCash retValue = new Query(ctx,MCash.Table_Name,whereClause,trxName)
|
MCash retValue = new Query(ctx, MCash.Table_Name, whereClause, trxName)
|
||||||
.setParameters(new Object[]{C_CashBook_ID,TimeUtil.getDay(dateAcct)}).first();
|
.setParameters(new Object[]{C_CashBook_ID, TimeUtil.getDay(dateAcct)})
|
||||||
|
.first()
|
||||||
|
;
|
||||||
|
|
||||||
if (retValue != null)
|
if (retValue != null)
|
||||||
return retValue;
|
return retValue;
|
||||||
|
@ -202,8 +209,11 @@ public class MCash extends X_C_Cash implements DocAction
|
||||||
}
|
}
|
||||||
|
|
||||||
String whereClause ="C_Cash_ID=?";
|
String whereClause ="C_Cash_ID=?";
|
||||||
List <MCashLine> list = new Query(getCtx(),MCashLine.Table_Name, whereClause, get_TrxName())
|
List <MCashLine> list = new Query(getCtx(), MCashLine.Table_Name, whereClause, get_TrxName())
|
||||||
.setParameters(new Object[]{getC_Cash_ID()}).setOrderBy("Line").list();
|
.setParameters(new Object[]{getC_Cash_ID()})
|
||||||
|
.setOrderBy("Line")
|
||||||
|
.list()
|
||||||
|
;
|
||||||
|
|
||||||
m_lines = list.toArray(new MCashLine[list.size()]);
|
m_lines = list.toArray(new MCashLine[list.size()]);
|
||||||
return m_lines;
|
return m_lines;
|
||||||
|
|
Loading…
Reference in New Issue