use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class WReport method copyFormat.
// createNewFormat
/**
* Copy existing Format
* @param AD_PrintFormat_ID print format
* @param To_Client_ID to client
*/
private void copyFormat(int AD_PrintFormat_ID, int To_Client_ID) {
MPrintFormat pf = MPrintFormat.copyToClient(Env.getCtx(), AD_PrintFormat_ID, To_Client_ID);
launchReport(pf);
}
use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class WReport method launchReport.
// copyFormatFromClient
/**
* Launch Report
* @param pp Key=AD_PrintFormat_ID
*/
private void launchReport(KeyNamePair pp) {
MPrintFormat pf = MPrintFormat.get(Env.getCtx(), pp.getKey(), false);
launchReport(pf);
}
use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class CompletePrintOrder method getReportEngine.
// doIt
/*
* get the a Report Engine Instance using the view table
* @param tableName
*/
private ReportEngine getReportEngine(String formatName, String tableName) {
// Get Format & Data
int format_id = MPrintFormat.getPrintFormat_ID(formatName, MTable.getTable_ID(tableName), getAD_Client_ID());
MPrintFormat format = MPrintFormat.get(getCtx(), format_id, true);
if (format == null) {
addLog("@NotFound@ @AD_PrintFormat_ID@");
return null;
}
// query
MQuery query = new MQuery(tableName);
query.addRestriction("PP_Order_ID", MQuery.EQUAL, p_PP_Order_ID);
// Engine
PrintInfo info = new PrintInfo(tableName, MTable.getTable_ID(tableName), p_PP_Order_ID);
ReportEngine re = new ReportEngine(getCtx(), format, query, info);
return re;
}
use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class WReport method copyFormat.
// createNewFormat
/**
* Copy existing Format
* @param AD_PrintFormat_ID print format
* @param To_Client_ID to client
*/
private File copyFormat(int AD_PrintFormat_ID, int To_Client_ID, HttpServletRequest request, GridTab m_curTab, MQuery m_query) {
WebSessionCtx wsc = WebSessionCtx.get(request);
MPrintFormat pf = MPrintFormat.copyToClient(wsc.ctx, AD_PrintFormat_ID, To_Client_ID);
File file = launchReport(pf, request, m_curTab, m_query);
return file;
}
use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class WGenForm method onPrint.
public void onPrint() {
// Loop through all items
List<File> pdfList = new ArrayList<File>();
for (int i = 0; i < m_ids.length; i++) {
int RecordID = m_ids[i];
ReportEngine re = null;
if (genForm.getPrintFormat() != null) {
MPrintFormat format = genForm.getPrintFormat();
MTable table = MTable.get(Env.getCtx(), format.getAD_Table_ID());
MQuery query = new MQuery(table.getTableName());
query.addRestriction(table.getTableName() + "_ID", MQuery.EQUAL, RecordID);
// Engine
PrintInfo info = new PrintInfo(table.getTableName(), table.get_Table_ID(), RecordID);
re = new ReportEngine(Env.getCtx(), format, query, info);
} else {
re = ReportEngine.get(Env.getCtx(), genForm.getReportEngineType(), RecordID);
}
if (re != null)
pdfList.add(re.getPDF());
}
if (pdfList.size() > 1) {
try {
File outFile = File.createTempFile(genForm.getClass().getName(), ".pdf");
AEnv.mergePdf(pdfList, outFile);
Clients.clearBusy();
Window win = new SimplePDFViewer(getFormName(), new FileInputStream(outFile));
SessionManager.getAppDesktop().showWindow(win, "center");
} catch (Exception e) {
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
} else if (pdfList.size() > 0) {
Clients.clearBusy();
try {
Window win = new SimplePDFViewer(getFormName(), new FileInputStream(pdfList.get(0)));
SessionManager.getAppDesktop().showWindow(win, "center");
} catch (Exception e) {
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
}
}
Aggregations