Fix [2815103] - Report is not inheriting the where from tab
https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2815103&group_id=176962
This commit is contained in:
parent
4a8ad604cd
commit
8905fc346d
|
@ -158,6 +158,8 @@ public class ReportEngine implements PrintServiceAttributeListener
|
||||||
private View m_view = null;
|
private View m_view = null;
|
||||||
/** Transaction Name */
|
/** Transaction Name */
|
||||||
private String m_trxName = null;
|
private String m_trxName = null;
|
||||||
|
/** Where filter */
|
||||||
|
private String m_whereExtended = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set PrintFormat.
|
* Set PrintFormat.
|
||||||
|
@ -1572,4 +1574,12 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
} // main
|
} // main
|
||||||
|
|
||||||
|
public void setWhereExtended(String whereExtended) {
|
||||||
|
m_whereExtended = whereExtended;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWhereExtended() {
|
||||||
|
return m_whereExtended;
|
||||||
|
}
|
||||||
|
|
||||||
} // ReportEngine
|
} // ReportEngine
|
||||||
|
|
|
@ -893,7 +893,7 @@ public final class APanel extends CPanel
|
||||||
if (query != null && query.isActive() && !role.isQueryMax(query.getRecordCount()))
|
if (query != null && query.isActive() && !role.isQueryMax(query.getRecordCount()))
|
||||||
return query;
|
return query;
|
||||||
//
|
//
|
||||||
StringBuffer where = new StringBuffer();
|
StringBuffer where = new StringBuffer(mTab.getWhereExtended());
|
||||||
// Query automatically if high volume and no query
|
// Query automatically if high volume and no query
|
||||||
boolean require = mTab.isHighVolume();
|
boolean require = mTab.isHighVolume();
|
||||||
if (!require && !m_onlyCurrentRows) // No Trx Window
|
if (!require && !m_onlyCurrentRows) // No Trx Window
|
||||||
|
@ -1947,7 +1947,7 @@ public final class APanel extends CPanel
|
||||||
infoName, infoDisplay);
|
infoName, infoDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
new AReport (m_curTab.getAD_Table_ID(), aReport.getButton(), query, this, m_curWindowNo);
|
new AReport (m_curTab.getAD_Table_ID(), aReport.getButton(), query, this, m_curWindowNo, m_curTab.getWhereExtended());
|
||||||
} // cmd_report
|
} // cmd_report
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ public final class Find extends CDialog
|
||||||
m_findFields = findFields;
|
m_findFields = findFields;
|
||||||
//
|
//
|
||||||
m_query = new MQuery (tableName);
|
m_query = new MQuery (tableName);
|
||||||
m_query.addRestriction(whereExtended);
|
m_query.addRestriction(Env.parseContext(Env.getCtx(), m_targetWindowNo, whereExtended, false));
|
||||||
// Required for Column Validation
|
// Required for Column Validation
|
||||||
Env.setContext(Env.getCtx(), m_targetWindowNo, "Find_Table_ID", m_AD_Table_ID);
|
Env.setContext(Env.getCtx(), m_targetWindowNo, "Find_Table_ID", m_AD_Table_ID);
|
||||||
// Context for Advanced Search Grid is WINDOW_FIND
|
// Context for Advanced Search Grid is WINDOW_FIND
|
||||||
|
@ -870,6 +870,7 @@ public final class Find extends CDialog
|
||||||
{
|
{
|
||||||
// Create Query String
|
// Create Query String
|
||||||
m_query = new MQuery(m_tableName);
|
m_query = new MQuery(m_tableName);
|
||||||
|
m_query.addRestriction(Env.parseContext(Env.getCtx(), m_targetWindowNo, m_whereExtended, false));
|
||||||
if (hasValue && !valueField.getText().equals("%") && valueField.getText().length() != 0)
|
if (hasValue && !valueField.getText().equals("%") && valueField.getText().length() != 0)
|
||||||
{
|
{
|
||||||
String value = valueField.getText().toUpperCase();
|
String value = valueField.getText().toUpperCase();
|
||||||
|
@ -995,6 +996,7 @@ public final class Find extends CDialog
|
||||||
advancedTable.stopEditor(true);
|
advancedTable.stopEditor(true);
|
||||||
//
|
//
|
||||||
m_query = new MQuery(m_tableName);
|
m_query = new MQuery(m_tableName);
|
||||||
|
m_query.addRestriction(Env.parseContext(Env.getCtx(), m_targetWindowNo, m_whereExtended, false));
|
||||||
StringBuffer code = new StringBuffer();
|
StringBuffer code = new StringBuffer();
|
||||||
for (int row = 0; row < advancedTable.getRowCount(); row++)
|
for (int row = 0; row < advancedTable.getRowCount(); row++)
|
||||||
{
|
{
|
||||||
|
@ -1047,9 +1049,7 @@ public final class Find extends CDialog
|
||||||
if (!(parsedValue instanceof Integer)) {
|
if (!(parsedValue instanceof Integer)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
m_query
|
m_query.addRestriction(getSubCategoryWhereClause(((Integer) parsedValue).intValue()));
|
||||||
|
|
||||||
.addRestriction(getSubCategoryWhereClause(((Integer) parsedValue).intValue()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_query.addRestriction(ColumnSQL, Operator, parsedValue,
|
m_query.addRestriction(ColumnSQL, Operator, parsedValue,
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class AReport implements ActionListener
|
||||||
*/
|
*/
|
||||||
public AReport (int AD_Table_ID, JComponent invoker, MQuery query)
|
public AReport (int AD_Table_ID, JComponent invoker, MQuery query)
|
||||||
{
|
{
|
||||||
new AReport(AD_Table_ID, invoker, query, null, 0);
|
this (AD_Table_ID, invoker, query, null, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,6 +89,34 @@ public class AReport implements ActionListener
|
||||||
getPrintFormats (AD_Table_ID, invoker);
|
getPrintFormats (AD_Table_ID, invoker);
|
||||||
} // AReport
|
} // AReport
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param AD_Table_ID table
|
||||||
|
* @param invoker component to display popup (optional)
|
||||||
|
* @param query query
|
||||||
|
* @param parent The invoking parent window
|
||||||
|
* @param whereExtended The filtering where clause
|
||||||
|
* @param WindowNo The invoking parent window number
|
||||||
|
*/
|
||||||
|
public AReport (int AD_Table_ID, JComponent invoker, MQuery query, ASyncProcess parent, int WindowNo, String whereExtended)
|
||||||
|
{
|
||||||
|
log.config("AD_Table_ID=" + AD_Table_ID + " " + query);
|
||||||
|
if (!MRole.getDefault().isCanReport(AD_Table_ID))
|
||||||
|
{
|
||||||
|
ADialog.error(0, invoker, "AccessCannotReport", query.getTableName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_query = query;
|
||||||
|
this.parent = parent;
|
||||||
|
this.WindowNo = WindowNo;
|
||||||
|
this.m_whereExtended = whereExtended;
|
||||||
|
|
||||||
|
// See What is there
|
||||||
|
getPrintFormats (AD_Table_ID, invoker);
|
||||||
|
} // AReport
|
||||||
|
|
||||||
/** The Query */
|
/** The Query */
|
||||||
private MQuery m_query;
|
private MQuery m_query;
|
||||||
/** The Popup */
|
/** The Popup */
|
||||||
|
@ -99,6 +127,8 @@ public class AReport implements ActionListener
|
||||||
private static CLogger log = CLogger.getCLogger(AReport.class);
|
private static CLogger log = CLogger.getCLogger(AReport.class);
|
||||||
/** The parent window for locking/unlocking during process execution */
|
/** The parent window for locking/unlocking during process execution */
|
||||||
ASyncProcess parent;
|
ASyncProcess parent;
|
||||||
|
/** The filter to apply to this report */
|
||||||
|
String m_whereExtended;
|
||||||
/** The parent window number */
|
/** The parent window number */
|
||||||
int WindowNo;
|
int WindowNo;
|
||||||
|
|
||||||
|
@ -204,6 +234,7 @@ public class AReport implements ActionListener
|
||||||
{
|
{
|
||||||
// It's a default report using the standard printing engine
|
// It's a default report using the standard printing engine
|
||||||
ReportEngine re = new ReportEngine (Env.getCtx(), pf, m_query, info);
|
ReportEngine re = new ReportEngine (Env.getCtx(), pf, m_query, info);
|
||||||
|
re.setWhereExtended(m_whereExtended);
|
||||||
ReportCtl.preview(re);
|
ReportCtl.preview(re);
|
||||||
}
|
}
|
||||||
} // launchReport
|
} // launchReport
|
||||||
|
|
|
@ -1159,7 +1159,7 @@ public class Viewer extends CFrame
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Find find = new Find (this, m_WindowNo, title,
|
Find find = new Find (this, m_WindowNo, title,
|
||||||
AD_Tab_ID, AD_Table_ID, tableName, "", findFields, 1);
|
AD_Tab_ID, AD_Table_ID, tableName, m_reportEngine.getWhereExtended(), findFields, 1);
|
||||||
m_reportEngine.setQuery(find.getQuery());
|
m_reportEngine.setQuery(find.getQuery());
|
||||||
find.dispose();
|
find.dispose();
|
||||||
find = null;
|
find = null;
|
||||||
|
|
Loading…
Reference in New Issue