use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class InvoicePrint method doIt.
// prepare
/**
* Perform process.
* @return Message
* @throws Exception
*/
protected String doIt() throws java.lang.Exception {
// Need to have Template
if (p_EMailPDF && p_R_MailText_ID == 0)
throw new AdempiereUserError("@NotFound@: @R_MailText_ID@");
log.info("C_BPartner_ID=" + m_C_BPartner_ID + ", C_Invoice_ID=" + m_C_Invoice_ID + ", EmailPDF=" + p_EMailPDF + ",R_MailText_ID=" + p_R_MailText_ID + ", DateInvoiced=" + m_dateInvoiced_From + "-" + m_dateInvoiced_To + ", DocumentNo=" + m_DocumentNo_From + "-" + m_DocumentNo_To);
MMailText mText = null;
if (p_R_MailText_ID != 0) {
mText = new MMailText(getCtx(), p_R_MailText_ID, get_TrxName());
if (mText.get_ID() != p_R_MailText_ID)
throw new AdempiereUserError("@NotFound@: @R_MailText_ID@ - " + p_R_MailText_ID);
}
// Too broad selection
if (m_C_BPartner_ID == 0 && m_C_Invoice_ID == 0 && m_dateInvoiced_From == null && m_dateInvoiced_To == null && m_DocumentNo_From == null && m_DocumentNo_To == null)
throw new AdempiereUserError("@RestrictSelection@");
MClient client = MClient.get(getCtx());
// Get Info
StringBuffer sql = new StringBuffer(// 1..3
"SELECT i.C_Invoice_ID,bp.AD_Language,c.IsMultiLingualDocument," + // Prio: 1. BPartner 2. DocType, 3. PrintFormat (Org) // see ReportCtl+MInvoice
" COALESCE(bp.Invoice_PrintFormat_ID, dt.AD_PrintFormat_ID, pf.Invoice_PrintFormat_ID)," + // 4
" dt.DocumentCopies+bp.DocumentCopies," + // 5
" bpc.AD_User_ID, i.DocumentNo," + // 6..7
" bp.C_BPartner_ID " + // 8
"FROM C_Invoice i" + " INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID)" + " LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID)" + " INNER JOIN AD_Client c ON (i.AD_Client_ID=c.AD_Client_ID)" + " INNER JOIN AD_PrintForm pf ON (i.AD_Client_ID=pf.AD_Client_ID)" + " INNER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID)" + " WHERE i.AD_Client_ID=? AND i.AD_Org_ID=? AND i.isSOTrx='Y' AND " + // more them 1 PF
" pf.AD_Org_ID IN (0,i.AD_Org_ID) AND ");
boolean needAnd = false;
if (m_C_Invoice_ID != 0)
sql.append("i.C_Invoice_ID=").append(m_C_Invoice_ID);
else {
if (m_C_BPartner_ID != 0) {
sql.append("i.C_BPartner_ID=").append(m_C_BPartner_ID);
needAnd = true;
}
if (m_dateInvoiced_From != null && m_dateInvoiced_To != null) {
if (needAnd)
sql.append(" AND ");
sql.append("TRUNC(i.DateInvoiced, 'DD') BETWEEN ").append(DB.TO_DATE(m_dateInvoiced_From, true)).append(" AND ").append(DB.TO_DATE(m_dateInvoiced_To, true));
needAnd = true;
} else if (m_dateInvoiced_From != null) {
if (needAnd)
sql.append(" AND ");
sql.append("TRUNC(i.DateInvoiced, 'DD') >= ").append(DB.TO_DATE(m_dateInvoiced_From, true));
needAnd = true;
} else if (m_dateInvoiced_To != null) {
if (needAnd)
sql.append(" AND ");
sql.append("TRUNC(i.DateInvoiced, 'DD') <= ").append(DB.TO_DATE(m_dateInvoiced_To, true));
needAnd = true;
} else if (m_DocumentNo_From != null && m_DocumentNo_To != null) {
if (needAnd)
sql.append(" AND ");
sql.append("i.DocumentNo BETWEEN ").append(DB.TO_STRING(m_DocumentNo_From)).append(" AND ").append(DB.TO_STRING(m_DocumentNo_To));
} else if (m_DocumentNo_From != null) {
if (needAnd)
sql.append(" AND ");
if (m_DocumentNo_From.indexOf('%') == -1)
sql.append("i.DocumentNo >= ").append(DB.TO_STRING(m_DocumentNo_From));
else
sql.append("i.DocumentNo LIKE ").append(DB.TO_STRING(m_DocumentNo_From));
}
if (p_EMailPDF) {
if (needAnd) {
sql.append(" AND ");
}
/* if emailed to customer only select COmpleted & CLosed invoices */
sql.append("i.DocStatus IN ('CO','CL') ");
}
}
// more than 1 PF record
sql.append(" ORDER BY i.C_Invoice_ID, pf.AD_Org_ID DESC");
log.fine(sql.toString());
MPrintFormat format = null;
int old_AD_PrintFormat_ID = -1;
int old_C_Invoice_ID = -1;
int C_BPartner_ID = 0;
int count = 0;
int errors = 0;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
pstmt.setInt(1, Env.getAD_Client_ID(Env.getCtx()));
pstmt.setInt(2, Env.getAD_Org_ID(Env.getCtx()));
rs = pstmt.executeQuery();
while (rs.next()) {
int C_Invoice_ID = rs.getInt(1);
if (// multiple pf records
C_Invoice_ID == old_C_Invoice_ID)
continue;
old_C_Invoice_ID = C_Invoice_ID;
// Set Language when enabled
// Base Language
Language language = Language.getLoginLanguage();
String AD_Language = rs.getString(2);
if (AD_Language != null && "Y".equals(rs.getString(3)))
language = Language.getLanguage(AD_Language);
//
int AD_PrintFormat_ID = rs.getInt(4);
int copies = rs.getInt(5);
if (copies == 0)
copies = 1;
int AD_User_ID = rs.getInt(6);
MUser to = new MUser(getCtx(), AD_User_ID, get_TrxName());
String DocumentNo = rs.getString(7);
C_BPartner_ID = rs.getInt(8);
//
String documentDir = client.getDocumentDir();
if (documentDir == null || documentDir.length() == 0)
documentDir = ".";
//
if (p_EMailPDF && (to.get_ID() == 0 || to.getEMail() == null || to.getEMail().length() == 0)) {
addLog(C_Invoice_ID, null, null, DocumentNo + " @RequestActionEMailNoTo@");
errors++;
continue;
}
if (AD_PrintFormat_ID == 0) {
addLog(C_Invoice_ID, null, null, DocumentNo + " No Print Format");
errors++;
continue;
}
// Get Format & Data
if (AD_PrintFormat_ID != old_AD_PrintFormat_ID) {
format = MPrintFormat.get(getCtx(), AD_PrintFormat_ID, false);
old_AD_PrintFormat_ID = AD_PrintFormat_ID;
}
format.setLanguage(language);
format.setTranslationLanguage(language);
// query
MQuery query = new MQuery("C_Invoice_Header_v");
query.addRestriction("C_Invoice_ID", MQuery.EQUAL, new Integer(C_Invoice_ID));
// Engine
PrintInfo info = new PrintInfo(DocumentNo, X_C_Invoice.Table_ID, C_Invoice_ID, C_BPartner_ID);
info.setCopies(copies);
ReportEngine re = new ReportEngine(getCtx(), format, query, info);
boolean printed = false;
if (p_EMailPDF) {
String subject = mText.getMailHeader() + " - " + DocumentNo;
EMail email = client.createEMail(to.getEMail(), subject, null);
if (!email.isValid()) {
addLog(C_Invoice_ID, null, null, DocumentNo + " @RequestActionEMailError@ Invalid EMail: " + to);
errors++;
continue;
}
// Context
mText.setUser(to);
// Context
mText.setBPartner(C_BPartner_ID);
mText.setPO(new MInvoice(getCtx(), C_Invoice_ID, get_TrxName()));
String message = mText.getMailText(true);
if (mText.isHtml())
email.setMessageHTML(subject, message);
else {
email.setSubject(subject);
email.setMessageText(message);
}
//
File invoice = null;
if (!Ini.isClient())
invoice = new File(MInvoice.getPDFFileName(documentDir, C_Invoice_ID));
File attachment = re.getPDF(invoice);
log.fine(to + " - " + attachment);
email.addAttachment(attachment);
//
String msg = email.send();
MUserMail um = new MUserMail(mText, getAD_User_ID(), email);
um.saveEx();
if (msg.equals(EMail.SENT_OK)) {
addLog(C_Invoice_ID, null, null, DocumentNo + " @RequestActionEMailOK@ - " + to.getEMail());
count++;
printed = true;
} else {
addLog(C_Invoice_ID, null, null, DocumentNo + " @RequestActionEMailError@ " + msg + " - " + to.getEMail());
errors++;
}
} else {
ServerReportCtl.startDocumentPrint(ReportEngine.INVOICE, // No custom print format
null, C_Invoice_ID, // No custom printer
null, null);
count++;
printed = true;
}
// Print Confirm
if (printed) {
StringBuffer sb = new StringBuffer("UPDATE C_Invoice " + "SET DatePrinted=SysDate, IsPrinted='Y' WHERE C_Invoice_ID=").append(C_Invoice_ID);
int no = DB.executeUpdate(sb.toString(), get_TrxName());
}
}
// for all entries
} catch (Exception e) {
log.log(Level.SEVERE, "doIt - " + sql, e);
throw new Exception(e);
} finally {
DB.close(rs, pstmt);
}
//
if (p_EMailPDF)
return "@Sent@=" + count + " - @Errors@=" + errors;
return "@Printed@=" + count;
}
use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class SimulatedPickList method print.
/**
* Print result generate for this report
*/
void print() throws Exception {
// Base Language
Language language = Language.getLoginLanguage();
MPrintFormat pf = null;
int pfid = 0;
// get print format for client, else copy system to client
RowSet pfrs = MPrintFormat.getAccessiblePrintFormats(MTable.getTable_ID(X_RV_PP_Product_BOMLine_Storage_TableName), -1, null);
pfrs.next();
pfid = pfrs.getInt("AD_PrintFormat_ID");
if (pfrs.getInt("AD_Client_ID") != 0)
pf = MPrintFormat.get(getCtx(), pfid, false);
else
pf = MPrintFormat.copyToClient(getCtx(), pfid, getAD_Client_ID());
pfrs.close();
if (pf == null)
raiseError("Error: ", "No Print Format");
pf.setLanguage(language);
pf.setTranslationLanguage(language);
// query
MQuery query = new MQuery(X_RV_PP_Product_BOMLine_Storage_TableName);
query.addRestriction(X_T_BOMLine.COLUMNNAME_AD_PInstance_ID, MQuery.EQUAL, AD_PInstance_ID, getParamenterName(X_T_BOMLine.COLUMNNAME_AD_PInstance_ID), getParamenterInfo(X_T_BOMLine.COLUMNNAME_AD_PInstance_ID));
query.addRestriction(X_T_BOMLine.COLUMNNAME_M_Warehouse_ID, MQuery.EQUAL, p_M_Warehouse_ID, getParamenterName(X_T_BOMLine.COLUMNNAME_M_Warehouse_ID), getParamenterInfo(X_T_BOMLine.COLUMNNAME_M_Warehouse_ID));
query.addRestriction(X_T_BOMLine.COLUMNNAME_M_Warehouse_ID, MQuery.EQUAL, p_M_Warehouse_ID, getParamenterName("DateTrx"), getParamenterInfo("DateTrx"));
PrintInfo info = new PrintInfo(X_RV_PP_Product_BOMLine_Storage_TableName, MTable.getTable_ID(X_RV_PP_Product_BOMLine_Storage_TableName), getRecord_ID());
ReportEngine re = new ReportEngine(getCtx(), pf, query, info);
ReportCtl.preview(re);
// records are deleted when process ends
while (re.getView().isDisplayable()) {
Env.sleep(1);
}
}
use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class PrintBOM method print.
/**
* Print result generate for this report
*/
void print() throws Exception {
// Base Language
Language language = Language.getLoginLanguage();
MPrintFormat pf = null;
int pfid = 0;
// get print format for client, else copy system to client
RowSet pfrs = MPrintFormat.getAccessiblePrintFormats(X_RV_PP_Product_BOMLine_Table_ID, -1, null);
pfrs.next();
pfid = pfrs.getInt("AD_PrintFormat_ID");
if (pfrs.getInt("AD_Client_ID") != 0)
pf = MPrintFormat.get(getCtx(), pfid, false);
else
pf = MPrintFormat.copyToClient(getCtx(), pfid, getAD_Client_ID());
pfrs.close();
if (pf == null)
raiseError("Error: ", "No Print Format");
pf.setLanguage(language);
pf.setTranslationLanguage(language);
// query
MQuery query = MQuery.get(getCtx(), AD_PInstance_ID, X_RV_PP_Product_BOMLine_Table_Name);
query.addRestriction("AD_PInstance_ID", MQuery.EQUAL, AD_PInstance_ID);
PrintInfo info = new PrintInfo(X_RV_PP_Product_BOMLine_Table_Name, X_RV_PP_Product_BOMLine_Table_ID, getRecord_ID());
ReportEngine re = new ReportEngine(getCtx(), pf, query, info);
ReportCtl.preview(re);
// records are deleted when process ends
while (re.getView().isDisplayable()) {
Env.sleep(1);
}
}
use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class VPrintDocument method print.
@Override
public void print(PO document, String printFormantName, int windowNo) {
JFrame window = Env.getWindow(windowNo);
if (ADialog.ask(windowNo, window, "PrintShipments")) {
window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
// see also ProcessDialog.printShipments/Invoices
int retValue = ADialogDialog.A_CANCEL;
do {
String keyColumnName = document.get_KeyColumns()[0];
MPrintFormat format = MPrintFormat.get(Env.getCtx(), MPrintFormat.getPrintFormat_ID(printFormantName, document.get_Table_ID(), 0), false);
MQuery query = new MQuery(document.get_TableName());
query.addRestriction(keyColumnName, MQuery.EQUAL, document.get_ValueAsInt(keyColumnName));
// Engine
PrintInfo info = new PrintInfo(document.get_TableName(), document.get_Table_ID(), document.get_ValueAsInt(keyColumnName));
ReportEngine re = new ReportEngine(Env.getCtx(), format, query, info);
re.print();
new Viewer(re);
ADialogDialog d = new ADialogDialog(window, Env.getHeader(Env.getCtx(), windowNo), Msg.getMsg(Env.getCtx(), "PrintoutOK?"), JOptionPane.QUESTION_MESSAGE);
retValue = d.getReturnCode();
} while (retValue == ADialogDialog.A_CANCEL);
window.setCursor(Cursor.getDefaultCursor());
}
}
use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class ReportStarter method startProcess.
/**
* Start the process.
* Called then pressing the Process button in R_Request.
* It should only return false, if the function could not be performed
* as this causes the process to abort.
* @author rlemeill
* @param ctx context
* @param pi standard process info
* @param trx
* @return true if success
*/
public boolean startProcess(Properties ctx, ProcessInfo pi, Trx trx) {
processInfo = pi;
String Name = pi.getTitle();
int AD_PInstance_ID = pi.getAD_PInstance_ID();
int Record_ID = pi.getRecord_ID();
log.info("Name=" + Name + " AD_PInstance_ID=" + AD_PInstance_ID + " Record_ID=" + Record_ID);
String trxName = null;
if (trx != null) {
trxName = trx.getTrxName();
}
ReportData reportData = getReportData(pi, trxName);
if (reportData == null) {
reportResult(AD_PInstance_ID, "Can not find report data", trxName);
return false;
}
String reportPath = reportData.getReportFilePath();
if (Util.isEmpty(reportPath, true)) {
reportResult(AD_PInstance_ID, "Can not find report", trxName);
return false;
}
JasperData data = null;
File reportFile = null;
String fileExtension = "";
HashMap<String, Object> params = new HashMap<String, Object>();
addProcessParameters(AD_PInstance_ID, params, trxName);
addProcessInfoParameters(params, pi.getParameter());
reportFile = getReportFile(reportPath, (String) params.get("ReportType"));
if (reportFile == null || reportFile.exists() == false) {
log.severe("No report file found for given type, falling back to " + reportPath);
reportFile = getReportFile(reportPath);
}
if (reportFile == null || reportFile.exists() == false) {
String tmp = "Can not find report file at path - " + reportPath;
log.severe(tmp);
reportResult(AD_PInstance_ID, tmp, trxName);
}
if (reportFile != null) {
data = processReport(reportFile);
if (data.getJasperReport() == null) {
log.severe("Could not load Jasper Report " + reportPath);
return false;
}
fileExtension = reportFile.getName().substring(reportFile.getName().lastIndexOf("."), reportFile.getName().length());
} else {
return false;
}
JasperReport jasperReport = data.getJasperReport();
String jasperName = data.getJasperName();
String name = jasperReport.getName();
File reportDir = data.getReportDir();
// Add reportDir to class path
ClassLoader scl = ClassLoader.getSystemClassLoader();
try {
java.net.URLClassLoader ucl = new java.net.URLClassLoader(new java.net.URL[] { reportDir.toURI().toURL() }, scl);
net.sf.jasperreports.engine.util.JRResourcesUtil.setThreadClassLoader(ucl);
} catch (MalformedURLException me) {
log.warning("Could not add report directory to classpath: " + me.getMessage());
}
if (jasperReport != null) {
File[] subreports;
// Subreports
if (reportPath.startsWith("http://") || reportPath.startsWith("https://")) {
// Locate and download subreports from remote webcontext
subreports = getHttpSubreports(jasperName + "Subreport", reportPath, fileExtension);
} else if (reportPath.startsWith("attachment:")) {
subreports = getAttachmentSubreports(reportPath);
} else if (reportPath.startsWith("resource:")) {
subreports = getResourceSubreports(name + "Subreport", reportPath, fileExtension);
} else // TODO: Implement file:/ lookup for subreports
{
// Locate subreports from local/remote filesystem
subreports = reportDir.listFiles(new FileFilter(jasperName + "Subreport", reportDir, fileExtension));
}
for (int i = 0; i < subreports.length; i++) {
// @Trifon - begin
if (subreports[i].getName().toLowerCase().endsWith(".jasper") || subreports[i].getName().toLowerCase().endsWith(".jrxml")) {
JasperData subData = processReport(subreports[i]);
if (subData.getJasperReport() != null) {
params.put(subData.getJasperName(), subData.getJasperFile().getAbsolutePath());
}
}
// @Trifon - end
}
if (Record_ID > 0)
params.put("RECORD_ID", new Integer(Record_ID));
// contribution from Ricardo (ralexsander)
// in iReports you can 'SELECT' AD_Client_ID, AD_Org_ID and AD_User_ID using only AD_PINSTANCE_ID
params.put("AD_PINSTANCE_ID", new Integer(AD_PInstance_ID));
// FR [3123850] - Add continiuosly needed parameters to Jasper Starter - Carlos Ruiz - GlobalQSS
params.put("AD_CLIENT_ID", new Integer(Env.getAD_Client_ID(Env.getCtx())));
params.put("AD_ROLE_ID", new Integer(Env.getAD_Role_ID(Env.getCtx())));
params.put("AD_USER_ID", new Integer(Env.getAD_User_ID(Env.getCtx())));
Language currLang = Env.getLanguage(Env.getCtx());
String printerName = null;
MPrintFormat printFormat = null;
PrintInfo printInfo = null;
ProcessInfoParameter[] pip = pi.getParameter();
// Get print format and print info parameters
if (pip != null) {
for (int i = 0; i < pip.length; i++) {
if (ServerReportCtl.PARAM_PRINT_FORMAT.equalsIgnoreCase(pip[i].getParameterName())) {
printFormat = (MPrintFormat) pip[i].getParameter();
}
if (ServerReportCtl.PARAM_PRINT_INFO.equalsIgnoreCase(pip[i].getParameterName())) {
printInfo = (PrintInfo) pip[i].getParameter();
}
if (ServerReportCtl.PARAM_PRINTER_NAME.equalsIgnoreCase(pip[i].getParameterName())) {
printerName = (String) pip[i].getParameter();
}
}
}
if (printFormat != null) {
if (printInfo != null) {
// Set the language of the print format if we're printing a document
if (printInfo.isDocument()) {
currLang = printFormat.getLanguage();
}
}
// Set printer name unless already set.
if (printerName == null) {
printerName = printFormat.getPrinterName();
}
}
params.put("CURRENT_LANG", currLang.getAD_Language());
params.put(JRParameter.REPORT_LOCALE, currLang.getLocale());
// Resources
File resFile = null;
if (reportPath.startsWith("attachment:") && attachment != null) {
resFile = getAttachmentResourceFile(jasperName, currLang);
} else if (reportPath.startsWith("resource:")) {
resFile = getResourcesForResourceFile(jasperName, currLang);
// TODO: Implement file:/ for resources
} else {
resFile = new File(jasperName + "_" + currLang.getLocale().getLanguage() + ".properties");
if (!resFile.exists()) {
resFile = null;
}
if (resFile == null) {
resFile = new File(jasperName + ".properties");
if (!resFile.exists()) {
resFile = null;
}
}
}
if (resFile != null) {
try {
PropertyResourceBundle res = new PropertyResourceBundle(new FileInputStream(resFile));
params.put("RESOURCE", res);
} catch (IOException e) {
;
}
}
Connection conn = null;
try {
conn = trx != null ? trx.getConnection() : getConnection();
jasperPrint = JasperFillManager.fillReport(jasperReport, params, conn);
if (reportData.isDirectPrint() && !processInfo.isPrintPreview()) {
log.info("ReportStarter.startProcess print report -" + jasperPrint.getName());
//RF 1906632
if (!processInfo.isBatch()) {
// Get printer job
PrinterJob printerJob = org.compiere.print.CPrinter.getPrinterJob(printerName);
// Set print request attributes
// Paper Attributes:
PrintRequestAttributeSet prats = new HashPrintRequestAttributeSet();
// add: copies, job-name, priority
if (// @Trifon
printInfo == null || printInfo.isDocumentCopy() || printInfo.getCopies() < 1)
prats.add(new Copies(1));
else
prats.add(new Copies(printInfo.getCopies()));
Locale locale = Language.getLoginLanguage().getLocale();
// @Trifon
String printFormat_name = printFormat == null ? "" : printFormat.getName();
int numCopies = printInfo == null ? 0 : printInfo.getCopies();
prats.add(new JobName(printFormat_name + "_" + pi.getRecord_ID(), locale));
prats.add(PrintUtil.getJobPriority(jasperPrint.getPages().size(), numCopies, true));
// Create print service exporter
JRPrintServiceExporter exporter = new JRPrintServiceExporter();
;
// Set parameters
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE, printerJob.getPrintService());
exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET, printerJob.getPrintService().getAttributes());
exporter.setParameter(JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET, prats);
exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG, Boolean.FALSE);
exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG, Boolean.FALSE);
// Print report / document
exporter.exportReport();
} else {
// Used For the PH
try {
File PDF = File.createTempFile("mail", ".pdf");
JasperExportManager.exportReportToPdfFile(jasperPrint, PDF.getAbsolutePath());
processInfo.setPDFReport(PDF);
} catch (IOException e) {
log.severe("ReportStarter.startProcess: Can not make PDF File - " + e.getMessage());
}
}
// You can use JasperPrint to create PDF
// JasperExportManager.exportReportToPdfFile(jasperPrint, "BasicReport.pdf");
} else {
log.info("ReportStarter.startProcess run report -" + jasperPrint.getName());
JRViewerProvider viewerLauncher = getReportViewerProvider();
//viewerLauncher.openViewer(jasperPrint, pi.getTitle()+" - " + reportPath);
viewerLauncher.openViewer(jasperPrint, pi.getTitle() + "_" + pi.getRecord_ID() + ".pdf");
}
} catch (JRException e) {
log.severe("ReportStarter.startProcess: Can not run report - " + e.getMessage());
} finally {
if (conn != null && trx == null)
try {
conn.close();
} catch (SQLException e) {
throw new AdempiereException("@Error@ " + e);
}
}
}
reportResult(AD_PInstance_ID, null, trxName);
return true;
}
Aggregations