Search in sources :

Example 1 with AReport

use of org.compiere.print.AReport in project adempiere by adempiere.

the class APanel method cmd_report.

//  cmd_refresh
/**
	 *	Print standard Report
	 */
private void cmd_report() {
    log.info("");
    if (!MRole.getDefault().isCanReport(m_curTab.getAD_Table_ID())) {
        ADialog.error(m_curWindowNo, this, "AccessCannotReport");
        return;
    }
    cmd_save(false);
    //	Query
    MQuery query = new MQuery(m_curTab.getTableName());
    //	Link for detail records
    String queryColumn = m_curTab.getLinkColumnName();
    //	Current row otherwise
    if (queryColumn.length() == 0)
        queryColumn = m_curTab.getKeyColumnName();
    //	Find display
    String infoName = null;
    String infoDisplay = null;
    for (int i = 0; i < m_curTab.getFieldCount(); i++) {
        GridField field = m_curTab.getField(i);
        if (field.isKey())
            infoName = field.getHeader();
        if ((field.getColumnName().equals("Name") || field.getColumnName().equals("DocumentNo")) && field.getValue() != null)
            infoDisplay = field.getValue().toString();
        if (infoName != null && infoDisplay != null)
            break;
    }
    if (queryColumn.length() != 0) {
        if (queryColumn.endsWith("_ID"))
            query.addRestriction(queryColumn, MQuery.EQUAL, new Integer(Env.getContextAsInt(m_ctx, m_curWindowNo, queryColumn)), infoName, infoDisplay);
        else
            query.addRestriction(queryColumn, MQuery.EQUAL, Env.getContext(m_ctx, m_curWindowNo, queryColumn), infoName, infoDisplay);
    }
    new AReport(m_curTab.getAD_Table_ID(), aReport.getButton(), query, this, m_curWindowNo, m_curTab.getWhereExtended());
}
Also used : AReport(org.compiere.print.AReport) MQuery(org.compiere.model.MQuery) GridField(org.compiere.model.GridField) Point(java.awt.Point)

Aggregations

Point (java.awt.Point)1 GridField (org.compiere.model.GridField)1 MQuery (org.compiere.model.MQuery)1 AReport (org.compiere.print.AReport)1