Search in sources :

Example 6 with MQuery

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);
}
Also used : MQuery(org.compiere.model.MQuery) PrintInfo(org.compiere.model.PrintInfo)

Example 7 with MQuery

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;
}
Also used : MQuery(org.compiere.model.MQuery) PrintInfo(org.compiere.model.PrintInfo) Properties(java.util.Properties)

Example 8 with MQuery

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;
}
Also used : Rectangle(java.awt.Rectangle) Page(org.compiere.print.layout.Page) MQuery(org.compiere.model.MQuery) Point(java.awt.Point) Point(java.awt.Point)

Example 9 with MQuery

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(" ");
}
Also used : GridWindow(org.compiere.model.GridWindow) GridWindowVO(org.compiere.model.GridWindowVO) MQuery(org.compiere.model.MQuery)

Example 10 with MQuery

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(" ");
}
Also used : GridWindow(org.compiere.model.GridWindow) GridWindowVO(org.compiere.model.GridWindowVO) MQuery(org.compiere.model.MQuery)

Aggregations

MQuery (org.compiere.model.MQuery)109 PrintInfo (org.compiere.model.PrintInfo)19 GridField (org.compiere.model.GridField)15 MPrintFormat (org.compiere.print.MPrintFormat)14 ReportEngine (org.compiere.print.ReportEngine)12 Point (java.awt.Point)11 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)9 GridWindowVO (org.compiere.model.GridWindowVO)9 SQLException (java.sql.SQLException)8 GridTab (org.compiere.model.GridTab)8 GridWindow (org.compiere.model.GridWindow)7 PreparedStatement (java.sql.PreparedStatement)6 ResultSet (java.sql.ResultSet)6 AWindow (org.compiere.apps.AWindow)6 File (java.io.File)5 IOException (java.io.IOException)5 Language (org.compiere.util.Language)4 AdempiereException (org.adempiere.exceptions.AdempiereException)3 MClient (org.compiere.model.MClient)3 MLookup (org.compiere.model.MLookup)3