Attached Files | usLocalizationPackReports.diff [^] (11,009 bytes) 2015-09-04 11:34 [Show Content] [Hide Content]diff --git a/modules/org.openbravo.localization.us.checkprinting/src/org/openbravo/localization/us/checkprinting/ad_forms/CheckManagement.java b/modules/org.openbravo.localization.us.checkprinting/src/org/openbravo/localization/us/checkprinting/ad_forms/CheckManagement.java
--- a/modules/org.openbravo.localization.us.checkprinting/src/org/openbravo/localization/us/checkprinting/ad_forms/CheckManagement.java
+++ b/modules/org.openbravo.localization.us.checkprinting/src/org/openbravo/localization/us/checkprinting/ad_forms/CheckManagement.java
@@ -12,6 +12,8 @@
*/
package org.openbravo.localization.us.checkprinting.ad_forms;
+
+import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigDecimal;
@@ -42,9 +44,6 @@
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
-import net.sf.jasperreports.engine.export.JExcelApiExporter;
-import net.sf.jasperreports.engine.export.JExcelApiExporterParameter;
-import net.sf.jasperreports.engine.export.JRHtmlExporter;
import net.sf.jasperreports.engine.export.JRHtmlExporterParameter;
import org.hibernate.Query;
@@ -52,6 +51,8 @@
import org.openbravo.base.filter.IsIDFilter;
import org.openbravo.base.secureApp.HttpSecureAppServlet;
import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.client.application.report.ReportingUtils;
+import org.openbravo.client.application.report.ReportingUtils.ExportType;
import org.openbravo.dal.core.OBContext;
import org.openbravo.dal.core.SessionHandler;
import org.openbravo.dal.service.OBDal;
@@ -1192,14 +1193,10 @@
response.setHeader("Content-disposition", "inline" + "; filename=" + strFileName + "."
+ strOutputType);
- final JRHtmlExporter exporter = new JRHtmlExporter();
- exportParameters.put(JRHtmlExporterParameter.JASPER_PRINT, jasperPrint);
exportParameters.put(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);
exportParameters.put(JRHtmlExporterParameter.SIZE_UNIT,
JRHtmlExporterParameter.SIZE_UNIT_POINT);
- exportParameters.put(JRHtmlExporterParameter.OUTPUT_STREAM, os);
- exporter.setParameters(exportParameters);
- exporter.exportReport();
+ ReportingUtils.saveReport(jasperPrint, ExportType.HTML, exportParameters, os);
os.close();
}
else if (strOutputType.equals("pdf") || strOutputType.equalsIgnoreCase("xls"))
@@ -1277,15 +1274,7 @@
if (reportType.equalsIgnoreCase("pdf")) {
JasperExportManager.exportReportToPdfFile(jp, outputFile);
} else if (reportType.equalsIgnoreCase("xls")) {
- JExcelApiExporter exporter = new JExcelApiExporter();
- exportParameters.put(JExcelApiExporterParameter.JASPER_PRINT, jp);
- exportParameters.put(JExcelApiExporterParameter.OUTPUT_FILE_NAME, outputFile);
- exportParameters.put(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
- exportParameters.put(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,
- Boolean.TRUE);
- exportParameters.put(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE, true);
- exporter.setParameters(exportParameters);
- exporter.exportReport();
+ ReportingUtils.saveReport(jp, ExportType.XLS, null, new File(outputFile));
} else {
throw new JRException("Report type not supported");
}
diff --git a/modules/org.openbravo.localization.us.checkprinting/src/org/openbravo/localization/us/checkprinting/ad_forms/CheckPrintedCategory.java b/modules/org.openbravo.localization.us.checkprinting/src/org/openbravo/localization/us/checkprinting/ad_forms/CheckPrintedCategory.java
--- a/modules/org.openbravo.localization.us.checkprinting/src/org/openbravo/localization/us/checkprinting/ad_forms/CheckPrintedCategory.java
+++ b/modules/org.openbravo.localization.us.checkprinting/src/org/openbravo/localization/us/checkprinting/ad_forms/CheckPrintedCategory.java
@@ -12,6 +12,8 @@
*/
package org.openbravo.localization.us.checkprinting.ad_forms;
+
+import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
@@ -36,15 +38,14 @@
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperPrintManager;
import net.sf.jasperreports.engine.JasperReport;
-import net.sf.jasperreports.engine.export.JExcelApiExporter;
-import net.sf.jasperreports.engine.export.JExcelApiExporterParameter;
-import net.sf.jasperreports.engine.export.JRHtmlExporter;
import net.sf.jasperreports.engine.export.JRHtmlExporterParameter;
import net.sf.jasperreports.view.JasperViewer;
import org.openbravo.base.filter.IsIDFilter;
import org.openbravo.base.secureApp.HttpSecureAppServlet;
import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.client.application.report.ReportingUtils;
+import org.openbravo.client.application.report.ReportingUtils.ExportType;
import org.openbravo.dal.service.OBDal;
import org.openbravo.data.FieldProvider;
import org.openbravo.database.ConnectionProvider;
@@ -787,13 +788,9 @@
response.setHeader("Content-disposition", "inline" + "; filename=" + strFileName + "."
+ strOutputType);
- final JRHtmlExporter exporter = new JRHtmlExporter();
- exportParameters.put(JRHtmlExporterParameter.JASPER_PRINT, jasperPrint);
exportParameters.put(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);
exportParameters.put(JRHtmlExporterParameter.SIZE_UNIT, JRHtmlExporterParameter.SIZE_UNIT_POINT);
- exportParameters.put(JRHtmlExporterParameter.OUTPUT_STREAM, os);
- exporter.setParameters(exportParameters);
- exporter.exportReport();
+ ReportingUtils.saveReport(jasperPrint, ExportType.HTML, exportParameters, os);
os.close();
}
else if (strOutputType.equals("pdf") || strOutputType.equalsIgnoreCase("xls"))
@@ -872,15 +869,7 @@
if (reportType.equalsIgnoreCase("pdf")) {
JasperExportManager.exportReportToPdfFile(jp, outputFile);
} else if (reportType.equalsIgnoreCase("xls")) {
- JExcelApiExporter exporter = new JExcelApiExporter();
- exportParameters.put(JExcelApiExporterParameter.JASPER_PRINT, jp);
- exportParameters.put(JExcelApiExporterParameter.OUTPUT_FILE_NAME, outputFile);
- exportParameters.put(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
- exportParameters.put(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,
- Boolean.TRUE);
- exportParameters.put(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE, true);
- exporter.setParameters(exportParameters);
- exporter.exportReport();
+ ReportingUtils.saveReport(jp, ExportType.XLS, null, new File(outputFile));
} else {
throw new JRException("Report type not supported");
}
diff --git a/modules/org.openbravo.localization.us.checkprinting/src/org/openbravo/localization/us/checkprinting/ad_forms/CheckPrintingCategory.java b/modules/org.openbravo.localization.us.checkprinting/src/org/openbravo/localization/us/checkprinting/ad_forms/CheckPrintingCategory.java
--- a/modules/org.openbravo.localization.us.checkprinting/src/org/openbravo/localization/us/checkprinting/ad_forms/CheckPrintingCategory.java
+++ b/modules/org.openbravo.localization.us.checkprinting/src/org/openbravo/localization/us/checkprinting/ad_forms/CheckPrintingCategory.java
@@ -11,6 +11,8 @@
************************************************************************************
*/
package org.openbravo.localization.us.checkprinting.ad_forms;
+
+import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
@@ -33,15 +35,14 @@
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
-import net.sf.jasperreports.engine.export.JExcelApiExporter;
-import net.sf.jasperreports.engine.export.JExcelApiExporterParameter;
-import net.sf.jasperreports.engine.export.JRHtmlExporter;
import net.sf.jasperreports.engine.export.JRHtmlExporterParameter;
import org.openbravo.base.filter.IsIDFilter;
import org.openbravo.base.provider.OBProvider;
import org.openbravo.base.secureApp.HttpSecureAppServlet;
import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.client.application.report.ReportingUtils;
+import org.openbravo.client.application.report.ReportingUtils.ExportType;
import org.openbravo.dal.core.OBContext;
import org.openbravo.dal.service.OBDal;
import org.openbravo.data.FieldProvider;
@@ -1021,14 +1022,10 @@
log4j.debug("JR: Print HTML");
response.setHeader("Content-disposition", "inline" + "; filename=" + strFileName + "."
+ strOutputType);
- final JRHtmlExporter exporter = new JRHtmlExporter();
- exportParameters.put(JRHtmlExporterParameter.JASPER_PRINT, jasperPrint);
exportParameters.put(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);
exportParameters.put(JRHtmlExporterParameter.SIZE_UNIT,
JRHtmlExporterParameter.SIZE_UNIT_POINT);
- exportParameters.put(JRHtmlExporterParameter.OUTPUT_STREAM, os);
- exporter.setParameters(exportParameters);
- exporter.exportReport();
+ ReportingUtils.saveReport(jasperPrint, ExportType.HTML, exportParameters, os);
os.close();
} else if (strOutputType.equals("pdf") || strOutputType.equalsIgnoreCase("xls")) {
reportId = UUID.randomUUID();
@@ -1085,15 +1082,7 @@
if (reportType.equalsIgnoreCase("pdf")) {
JasperExportManager.exportReportToPdfFile(jp, outputFile);
} else if (reportType.equalsIgnoreCase("xls")) {
- JExcelApiExporter exporter = new JExcelApiExporter();
- exportParameters.put(JExcelApiExporterParameter.JASPER_PRINT, jp);
- exportParameters.put(JExcelApiExporterParameter.OUTPUT_FILE_NAME, outputFile);
- exportParameters.put(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
- exportParameters.put(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,
- Boolean.TRUE);
- exportParameters.put(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE, true);
- exporter.setParameters(exportParameters);
- exporter.exportReport();
+ ReportingUtils.saveReport(jp, ExportType.XLS, null, new File(outputFile));
} else {
throw new JRException("Report type not supported");
}
|