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;
|
||||
/** Transaction Name */
|
||||
private String m_trxName = null;
|
||||
/** Where filter */
|
||||
private String m_whereExtended = null;
|
||||
|
||||
/**
|
||||
* Set PrintFormat.
|
||||
|
@ -1571,5 +1573,13 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
|||
// re.print(false, 1, false, "Epson Stylus COLOR 900 ESC/P 2"); // Dialog
|
||||
System.exit(0);
|
||||
} // main
|
||||
|
||||
|
||||
public void setWhereExtended(String whereExtended) {
|
||||
m_whereExtended = whereExtended;
|
||||
}
|
||||
|
||||
public String getWhereExtended() {
|
||||
return m_whereExtended;
|
||||
}
|
||||
|
||||
} // ReportEngine
|
||||
|
|
|
@ -893,7 +893,7 @@ public final class APanel extends CPanel
|
|||
if (query != null && query.isActive() && !role.isQueryMax(query.getRecordCount()))
|
||||
return query;
|
||||
//
|
||||
StringBuffer where = new StringBuffer();
|
||||
StringBuffer where = new StringBuffer(mTab.getWhereExtended());
|
||||
// Query automatically if high volume and no query
|
||||
boolean require = mTab.isHighVolume();
|
||||
if (!require && !m_onlyCurrentRows) // No Trx Window
|
||||
|
@ -1947,7 +1947,7 @@ public final class APanel extends CPanel
|
|||
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
|
||||
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ public final class Find extends CDialog
|
|||
m_findFields = findFields;
|
||||
//
|
||||
m_query = new MQuery (tableName);
|
||||
m_query.addRestriction(whereExtended);
|
||||
m_query.addRestriction(Env.parseContext(Env.getCtx(), m_targetWindowNo, whereExtended, false));
|
||||
// Required for Column Validation
|
||||
Env.setContext(Env.getCtx(), m_targetWindowNo, "Find_Table_ID", m_AD_Table_ID);
|
||||
// Context for Advanced Search Grid is WINDOW_FIND
|
||||
|
@ -870,6 +870,7 @@ public final class Find extends CDialog
|
|||
{
|
||||
// Create Query String
|
||||
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)
|
||||
{
|
||||
String value = valueField.getText().toUpperCase();
|
||||
|
@ -995,6 +996,7 @@ public final class Find extends CDialog
|
|||
advancedTable.stopEditor(true);
|
||||
//
|
||||
m_query = new MQuery(m_tableName);
|
||||
m_query.addRestriction(Env.parseContext(Env.getCtx(), m_targetWindowNo, m_whereExtended, false));
|
||||
StringBuffer code = new StringBuffer();
|
||||
for (int row = 0; row < advancedTable.getRowCount(); row++)
|
||||
{
|
||||
|
@ -1047,9 +1049,7 @@ public final class Find extends CDialog
|
|||
if (!(parsedValue instanceof Integer)) {
|
||||
continue;
|
||||
}
|
||||
m_query
|
||||
|
||||
.addRestriction(getSubCategoryWhereClause(((Integer) parsedValue).intValue()));
|
||||
m_query.addRestriction(getSubCategoryWhereClause(((Integer) parsedValue).intValue()));
|
||||
}
|
||||
else
|
||||
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)
|
||||
{
|
||||
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);
|
||||
} // 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 */
|
||||
private MQuery m_query;
|
||||
/** The Popup */
|
||||
|
@ -99,6 +127,8 @@ public class AReport implements ActionListener
|
|||
private static CLogger log = CLogger.getCLogger(AReport.class);
|
||||
/** The parent window for locking/unlocking during process execution */
|
||||
ASyncProcess parent;
|
||||
/** The filter to apply to this report */
|
||||
String m_whereExtended;
|
||||
/** The parent window number */
|
||||
int WindowNo;
|
||||
|
||||
|
@ -204,6 +234,7 @@ public class AReport implements ActionListener
|
|||
{
|
||||
// It's a default report using the standard printing engine
|
||||
ReportEngine re = new ReportEngine (Env.getCtx(), pf, m_query, info);
|
||||
re.setWhereExtended(m_whereExtended);
|
||||
ReportCtl.preview(re);
|
||||
}
|
||||
} // launchReport
|
||||
|
|
|
@ -1159,7 +1159,7 @@ public class Viewer extends CFrame
|
|||
else
|
||||
{
|
||||
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());
|
||||
find.dispose();
|
||||
find = null;
|
||||
|
|
Loading…
Reference in New Issue