use of org.compiere.model.MQuery in project adempiere by adempiere.
the class ReportEngine method main.
// printConfirm
/*************************************************************************
* Test
* @param args args
*/
public static void main(String[] args) {
org.compiere.Adempiere.startupEnvironment(true);
//
int AD_Table_ID = 100;
MQuery q = new MQuery("AD_Table");
q.addRestriction("AD_Table_ID", "<", 108);
//
MPrintFormat f = MPrintFormat.createFromTable(Env.getCtx(), AD_Table_ID);
PrintInfo i = new PrintInfo("test", AD_Table_ID, 108, 0);
i.setAD_Table_ID(AD_Table_ID);
ReportEngine re = new ReportEngine(Env.getCtx(), f, q, i);
re.layout();
/**
re.createCSV(new File("C:\\Temp\\test.csv"), ',', Language.getLanguage());
re.createHTML(new File("C:\\Temp\\test.html"), false, Language.getLanguage());
re.createXML(new File("C:\\Temp\\test.xml"));
re.createPS(new File ("C:\\Temp\\test.ps"));
re.createPDF(new File("C:\\Temp\\test.pdf"));
/****/
re.print();
// re.print(true, 1, false, "Epson Stylus COLOR 900 ESC/P 2"); // Dialog
// re.print(true, 1, false, "HP LaserJet 3300 Series PCL 6"); // Dialog
// re.print(false, 1, false, "Epson Stylus COLOR 900 ESC/P 2"); // Dialog
System.exit(0);
}
use of org.compiere.model.MQuery in project adempiere by adempiere.
the class ServerReportCtl method startStandardReport.
/**************************************************************************
* Start Standard Report.
* - Get Table Info & submit.<br>
* A report can be created from:
* <ol>
* <li>attached MPrintFormat, if any (see {@link ProcessInfo#setTransientObject(Object)}, {@link ProcessInfo#setSerializableObject(java.io.Serializable)}
* <li>process information (AD_Process.AD_PrintFormat_ID, AD_Process.AD_ReportView_ID)
* </ol>
* @param processInfo
* @return true if OK
*/
public static boolean startStandardReport(ProcessInfo processInfo) {
ReportEngine re = null;
//
// Create Report Engine by using attached MPrintFormat (if any)
Object o = processInfo.getTransientObject();
if (o == null)
o = processInfo.getSerializableObject();
if (o != null && o instanceof MPrintFormat) {
Properties ctx = Env.getCtx();
MPrintFormat format = (MPrintFormat) o;
String TableName = MTable.getTableName(ctx, format.getAD_Table_ID());
MQuery query = MQuery.get(ctx, processInfo.getAD_PInstance_ID(), TableName);
PrintInfo info = new PrintInfo(processInfo);
re = new ReportEngine(ctx, format, query, info);
createOutput(re, null);
return true;
} else //
// Create Report Engine normally
{
re = ReportEngine.get(Env.getCtx(), processInfo);
if (re == null) {
processInfo.setSummary("No ReportEngine");
return false;
}
}
createOutput(re, null);
return true;
}
use of org.compiere.model.MQuery in project adempiere by adempiere.
the class View method getDrillDown.
// getPaperHeight
/**
* Get Drill Down
* @param absolutePoint point
* @return Drill Down
*/
public MQuery getDrillDown(Point absolutePoint) {
int pageNo = (int) getPageNoAt(absolutePoint);
Rectangle pageRectangle = getRectangleOfPage(pageNo, false);
Point relativePoint = new Point((int) (absolutePoint.x / getScale() - pageRectangle.x), (int) (absolutePoint.y / getScale() - pageRectangle.y));
Page page = (Page) m_layout.getPages().get(pageNo - 1);
//
log.config("Relative=" + relativePoint + ", " + page);
// log.config("AbsolutePoint=" + absolutePoint + ", PageNo=" + pageNo + ", pageRectangle=" + pageRectangle);
MQuery retValue = page.getDrillDown(relativePoint);
if (retValue == null)
retValue = m_layout.getHeaderFooter().getDrillDown(relativePoint);
return retValue;
}
use of org.compiere.model.MQuery in project adempiere by adempiere.
the class TrxMaterial method dynInit.
/**
* Dynamic Layout (Grid).
* Based on AD_Window: Material Transactions
*/
public void dynInit(IStatusBar statusBar) {
m_staticQuery = new MQuery();
m_staticQuery.addRestriction("AD_Client_ID", MQuery.EQUAL, Env.getAD_Client_ID(Env.getCtx()));
// Hardcoded
int AD_Window_ID = 223;
GridWindowVO wVO = AEnv.getMWindowVO(m_WindowNo, AD_Window_ID, 0);
if (wVO == null)
return;
m_mWindow = new GridWindow(wVO);
m_mTab = m_mWindow.getTab(0);
m_mWindow.initTab(0);
//
m_mTab.setQuery(MQuery.getEqualQuery("1", "2"));
m_mTab.query(false);
statusBar.setStatusLine(" ", false);
statusBar.setStatusDB(" ");
}
use of org.compiere.model.MQuery in project adempiere by adempiere.
the class Stocktake method dynInit.
/**
* Dynamic Layout (Grid).
* Based on AD_Window: Stocktake (Indirect Use)
*/
public void dynInit(IStatusBar statusBar) {
m_staticQuery = new MQuery();
m_staticQuery.addRestriction("AD_Client_ID", MQuery.EQUAL, Env.getAD_Client_ID(Env.getCtx()));
// Hardcoded Window: Stocktake (Indirect Use)
int AD_Window_ID = 53278;
GridWindowVO wVO = AEnv.getMWindowVO(m_WindowNo, AD_Window_ID, 0);
if (wVO == null)
return;
m_mWindow = new GridWindow(wVO);
m_mTab = m_mWindow.getTab(0);
m_mWindow.initTab(0);
Env.setAutoCommit(Env.getCtx(), wVO.WindowNo, Env.isAutoCommit(Env.getCtx()));
//
m_mTab.setQuery(MQuery.getEqualQuery("1", "2"));
m_mTab.query(false);
statusBar.setStatusLine(" ", false);
statusBar.setStatusDB(" ");
}
Aggregations