julio 2017-06-12 19:59:03 +00:00
parent a992008ced
commit ea7d33bb35
9 changed files with 52 additions and 43 deletions

View File

@ -15,9 +15,11 @@ public class RelatorioImpressaoRmd extends Relatorio {
public RelatorioImpressaoRmd(final Map<String, Object> parametros, Connection conexao) throws Exception { public RelatorioImpressaoRmd(final Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao); super(parametros, conexao);
List<ImpressaoRMD> list = (List<ImpressaoRMD>) parametros.get("list"); this.setCustomXls(true);
List<ImpressaoRMD> list = (List<ImpressaoRMD>) parametros.get("list");
this.setCollectionDataSource(new JRBeanCollectionDataSource(list)); this.setCollectionDataSource(new JRBeanCollectionDataSource(list));
} }
@Override @Override

View File

@ -15,8 +15,9 @@ public class RelatorioImpressaoRmdBpr extends Relatorio {
public RelatorioImpressaoRmdBpr(final Map<String, Object> parametros, Connection conexao) throws Exception { public RelatorioImpressaoRmdBpr(final Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao); super(parametros, conexao);
List<ImpressaoRMD> list = (List<ImpressaoRMD>) parametros.get("list"); this.setCustomXls(true);
List<ImpressaoRMD> list = (List<ImpressaoRMD>) parametros.get("list");
this.setCollectionDataSource(new JRBeanCollectionDataSource(list)); this.setCollectionDataSource(new JRBeanCollectionDataSource(list));
} }

View File

@ -104,7 +104,7 @@ public class RenderRelatorioJasper {
* @see com.rjconsultores.ventaboletos.relatorios.utilitarios.IRenderRelatorio#render() * @see com.rjconsultores.ventaboletos.relatorios.utilitarios.IRenderRelatorio#render()
*/ */
public byte[] render(SaidaRelatorio saida) throws Exception { public byte[] render(SaidaRelatorio saida, boolean isCustomXls) throws Exception {
this.preRender(); this.preRender();
byte[] conteudo = null; byte[] conteudo = null;
@ -128,7 +128,7 @@ public class RenderRelatorioJasper {
break; break;
case XLS: case XLS:
conteudo = this.renderXls(); conteudo = this.renderXls(isCustomXls);
break; break;
} }
@ -136,28 +136,27 @@ public class RenderRelatorioJasper {
return conteudo; return conteudo;
} }
protected byte[] renderXls() throws Exception { protected byte[] renderXls(boolean isCustomXls) throws Exception {
JExcelApiExporter exporterXLS = new JExcelApiExporter(); JExcelApiExporter exporterXLS = new JExcelApiExporter();
ByteArrayOutputStream output = new ByteArrayOutputStream(); ByteArrayOutputStream output = new ByteArrayOutputStream();
exporterXLS.setParameter(JExcelApiExporterParameter.JASPER_PRINT, this.jasperPrint); exporterXLS.setParameter(JExcelApiExporterParameter.JASPER_PRINT, this.jasperPrint);
exporterXLS.setParameter(JExcelApiExporterParameter.OUTPUT_STREAM, output); exporterXLS.setParameter(JExcelApiExporterParameter.OUTPUT_STREAM, output);
exporterXLS.setParameter(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
exporterXLS.setParameter(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); if (!isCustomXls) {
exporterXLS.setParameter(JExcelApiExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); exporterXLS.setParameter(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
exporterXLS.setParameter(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); exporterXLS.setParameter(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);
exporterXLS.setParameter(JExcelApiExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
exporterXLS.setParameter(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
}
// collapseRowSpan // collapseRowSpan
// JRXlsExporterParameter. // JRXlsExporterParameter.
exporterXLS.exportReport(); exporterXLS.exportReport();
return output.toByteArray(); return output.toByteArray();
} }
protected byte[] renderPdf() throws Exception { protected byte[] renderPdf() throws Exception {
return JasperExportManager.exportReportToPdf(this.jasperPrint); return JasperExportManager.exportReportToPdf(this.jasperPrint);
} }
} }

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RelatorioImpressaoRMD" printOrder="Horizontal" pageWidth="948" pageHeight="765" columnWidth="924" leftMargin="10" rightMargin="14" topMargin="2" bottomMargin="18" uuid="d3d490c9-33e7-4eeb-97cc-1fa9be0f10d4"> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RelatorioImpressaoRMD" printOrder="Horizontal" pageWidth="948" pageHeight="730" columnWidth="923" leftMargin="11" rightMargin="14" topMargin="19" bottomMargin="19" uuid="d3d490c9-33e7-4eeb-97cc-1fa9be0f10d4">
<property name="ireport.zoom" value="1.1000000000000048"/> <property name="ireport.zoom" value="0.9090909090909131"/>
<property name="ireport.x" value="0"/> <property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/> <property name="ireport.y" value="0"/>
<field name="empresa" class="java.lang.String"/> <field name="empresa" class="java.lang.String"/>
@ -43,35 +43,35 @@
<textField> <textField>
<reportElement x="327" y="0" width="343" height="13" uuid="76bd1c26-ed5d-4155-916b-f90dbdb2b9dc"/> <reportElement x="327" y="0" width="343" height="13" uuid="76bd1c26-ed5d-4155-916b-f90dbdb2b9dc"/>
<textElement> <textElement>
<font size="10"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{empresa}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{empresa}]]></textFieldExpression>
</textField> </textField>
<textField> <textField>
<reportElement x="327" y="13" width="343" height="13" uuid="1bc67f62-16e9-4681-891c-4d2680466d91"/> <reportElement x="327" y="13" width="343" height="13" uuid="1bc67f62-16e9-4681-891c-4d2680466d91"/>
<textElement> <textElement>
<font size="10"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{enderecoEmpresa}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{enderecoEmpresa}]]></textFieldExpression>
</textField> </textField>
<textField> <textField>
<reportElement x="327" y="39" width="343" height="13" uuid="fe223feb-b29e-4f97-b359-272aa857ce87"/> <reportElement x="327" y="39" width="343" height="13" uuid="fe223feb-b29e-4f97-b359-272aa857ce87"/>
<textElement> <textElement>
<font size="10"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{ieEmpresa}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{ieEmpresa}]]></textFieldExpression>
</textField> </textField>
<textField> <textField>
<reportElement x="327" y="26" width="343" height="13" uuid="cc73dace-ff3e-40cf-8292-9519af0108d4"/> <reportElement x="327" y="26" width="343" height="13" uuid="cc73dace-ff3e-40cf-8292-9519af0108d4"/>
<textElement> <textElement>
<font size="10"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{cnpjEmpresa}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{cnpjEmpresa}]]></textFieldExpression>
</textField> </textField>
<textField pattern="dd/MM/yyyy"> <textField pattern="dd/MM/yyyy">
<reportElement x="327" y="52" width="343" height="13" uuid="b716c82c-1944-4691-b907-1d194b41ecfd"/> <reportElement x="327" y="52" width="343" height="13" uuid="b716c82c-1944-4691-b907-1d194b41ecfd"/>
<textElement> <textElement>
<font size="10"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{data}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{data}]]></textFieldExpression>
</textField> </textField>
@ -170,7 +170,7 @@
</band> </band>
</detail> </detail>
<pageFooter> <pageFooter>
<band height="153"> <band height="150">
<textField pattern="#,##0.00" isBlankWhenNull="true"> <textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="242" y="0" width="89" height="17" uuid="e6c0383c-5062-4b22-989b-d1619add3ade"/> <reportElement x="242" y="0" width="89" height="17" uuid="e6c0383c-5062-4b22-989b-d1619add3ade"/>
<textElement textAlignment="Right" verticalAlignment="Middle"> <textElement textAlignment="Right" verticalAlignment="Middle">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RelatorioImpressaoRMD" printOrder="Horizontal" pageWidth="948" pageHeight="765" columnWidth="923" leftMargin="11" rightMargin="14" topMargin="2" bottomMargin="19" uuid="d3d490c9-33e7-4eeb-97cc-1fa9be0f10d4"> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RelatorioImpressaoRMD" printOrder="Horizontal" pageWidth="948" pageHeight="730" columnWidth="923" leftMargin="11" rightMargin="14" topMargin="19" bottomMargin="19" uuid="d3d490c9-33e7-4eeb-97cc-1fa9be0f10d4">
<property name="ireport.zoom" value="1.1000000000000154"/> <property name="ireport.zoom" value="1.0000000000000144"/>
<property name="ireport.x" value="0"/> <property name="ireport.x" value="60"/>
<property name="ireport.y" value="0"/> <property name="ireport.y" value="0"/>
<field name="empresa" class="java.lang.String"/> <field name="empresa" class="java.lang.String"/>
<field name="enderecoEmpresa" class="java.lang.String"/> <field name="enderecoEmpresa" class="java.lang.String"/>
@ -43,35 +43,35 @@
<textField> <textField>
<reportElement x="316" y="0" width="341" height="13" uuid="76bd1c26-ed5d-4155-916b-f90dbdb2b9dc"/> <reportElement x="316" y="0" width="341" height="13" uuid="76bd1c26-ed5d-4155-916b-f90dbdb2b9dc"/>
<textElement> <textElement>
<font fontName="SansSerif" size="10"/> <font fontName="SansSerif" size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{empresa}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{empresa}]]></textFieldExpression>
</textField> </textField>
<textField> <textField>
<reportElement x="316" y="12" width="341" height="13" uuid="1bc67f62-16e9-4681-891c-4d2680466d91"/> <reportElement x="316" y="13" width="341" height="11" uuid="1bc67f62-16e9-4681-891c-4d2680466d91"/>
<textElement> <textElement>
<font fontName="SansSerif" size="10"/> <font fontName="SansSerif" size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{enderecoEmpresa}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{enderecoEmpresa}]]></textFieldExpression>
</textField> </textField>
<textField> <textField>
<reportElement x="316" y="24" width="341" height="13" uuid="fe223feb-b29e-4f97-b359-272aa857ce87"/> <reportElement x="316" y="24" width="341" height="12" uuid="fe223feb-b29e-4f97-b359-272aa857ce87"/>
<textElement> <textElement>
<font fontName="SansSerif" size="10"/> <font fontName="SansSerif" size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{cnpjEmpresa}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{cnpjEmpresa}]]></textFieldExpression>
</textField> </textField>
<textField> <textField>
<reportElement x="316" y="36" width="341" height="13" uuid="cc73dace-ff3e-40cf-8292-9519af0108d4"/> <reportElement x="316" y="36" width="341" height="12" uuid="cc73dace-ff3e-40cf-8292-9519af0108d4"/>
<textElement> <textElement>
<font fontName="SansSerif" size="10"/> <font fontName="SansSerif" size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{ieEmpresa}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{ieEmpresa}]]></textFieldExpression>
</textField> </textField>
<textField pattern="dd/MM/yyyy"> <textField pattern="dd/MM/yyyy">
<reportElement x="316" y="48" width="341" height="13" uuid="b716c82c-1944-4691-b907-1d194b41ecfd"/> <reportElement x="316" y="48" width="341" height="13" uuid="b716c82c-1944-4691-b907-1d194b41ecfd"/>
<textElement> <textElement>
<font fontName="SansSerif" size="10"/> <font fontName="SansSerif" size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{data}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{data}]]></textFieldExpression>
</textField> </textField>
@ -124,7 +124,7 @@
<textField pattern="#,##0.00" isBlankWhenNull="true"> <textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="169" y="0" width="92" height="14" uuid="f8fbd690-36bd-4d69-9af4-1490ec205698"/> <reportElement x="169" y="0" width="92" height="14" uuid="f8fbd690-36bd-4d69-9af4-1490ec205698"/>
<textElement textAlignment="Right"> <textElement textAlignment="Right">
<font fontName="SansSerif" size="10"/> <font fontName="SansSerif" size="11"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{valorContabil}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{valorContabil}]]></textFieldExpression>
</textField> </textField>
@ -173,37 +173,37 @@
</band> </band>
</detail> </detail>
<pageFooter> <pageFooter>
<band height="155"> <band height="150">
<textField pattern="#,##0.00" isBlankWhenNull="true"> <textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="169" y="0" width="92" height="18" uuid="e6c0383c-5062-4b22-989b-d1619add3ade"/> <reportElement x="169" y="0" width="92" height="14" uuid="e6c0383c-5062-4b22-989b-d1619add3ade"/>
<textElement textAlignment="Right" verticalAlignment="Middle"> <textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="10"/> <font fontName="SansSerif" size="11"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$V{sum_valorContabil}]]></textFieldExpression> <textFieldExpression><![CDATA[$V{sum_valorContabil}]]></textFieldExpression>
</textField> </textField>
<textField pattern="#,##0.00" isBlankWhenNull="true"> <textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="261" y="0" width="104" height="18" uuid="810c93ac-4d8b-4edb-800c-ec2753286bb1"/> <reportElement x="261" y="0" width="104" height="14" uuid="810c93ac-4d8b-4edb-800c-ec2753286bb1"/>
<textElement textAlignment="Right" verticalAlignment="Middle"> <textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="11"/> <font fontName="SansSerif" size="11"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$V{sum_baseCalculo}]]></textFieldExpression> <textFieldExpression><![CDATA[$V{sum_baseCalculo}]]></textFieldExpression>
</textField> </textField>
<textField pattern="#,##0.00" isBlankWhenNull="true"> <textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="405" y="0" width="93" height="18" uuid="0a93d431-1b76-4590-aa1b-9af22283a5b3"/> <reportElement x="405" y="0" width="93" height="14" uuid="0a93d431-1b76-4590-aa1b-9af22283a5b3"/>
<textElement textAlignment="Right" verticalAlignment="Middle"> <textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="11"/> <font fontName="SansSerif" size="11"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$V{sum_icms}]]></textFieldExpression> <textFieldExpression><![CDATA[$V{sum_icms}]]></textFieldExpression>
</textField> </textField>
<textField pattern="#,##0.00" isBlankWhenNull="true"> <textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="498" y="0" width="110" height="18" uuid="748316ed-feb8-4a2d-9103-764eeb74873d"/> <reportElement x="498" y="0" width="110" height="14" uuid="748316ed-feb8-4a2d-9103-764eeb74873d"/>
<textElement textAlignment="Right" verticalAlignment="Middle"> <textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="11"/> <font fontName="SansSerif" size="11"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$V{sum_isentos}]]></textFieldExpression> <textFieldExpression><![CDATA[$V{sum_isentos}]]></textFieldExpression>
</textField> </textField>
<textField pattern="#,##0.00" isBlankWhenNull="true"> <textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="608" y="0" width="115" height="18" uuid="66628be0-d424-4d61-96dc-aaf8652ded42"/> <reportElement x="608" y="0" width="115" height="14" uuid="66628be0-d424-4d61-96dc-aaf8652ded42"/>
<textElement textAlignment="Right" verticalAlignment="Middle"> <textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="11"/> <font fontName="SansSerif" size="11"/>
</textElement> </textElement>

View File

@ -1,6 +1,5 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios; package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import java.net.URL;
import java.sql.Connection; import java.sql.Connection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
@ -30,6 +29,7 @@ public abstract class Relatorio {
private JRBeanCollectionDataSource collectionDataSource; private JRBeanCollectionDataSource collectionDataSource;
private String[] nomeSubReporte; private String[] nomeSubReporte;
private String baseDir; private String baseDir;
protected Boolean customXls;
protected Relatorio(Map<String, Object> parametros, Connection conexao) { protected Relatorio(Map<String, Object> parametros, Connection conexao) {
this.parametros = parametros; this.parametros = parametros;
@ -121,7 +121,7 @@ public abstract class Relatorio {
this.render = new RenderRelatorioJasper(this); this.render = new RenderRelatorioJasper(this);
} }
conteudo = this.render.render(saida); conteudo = this.render.render(saida, (customXls == null ? false : customXls));
} catch (Exception e) { } catch (Exception e) {
throw e; throw e;
@ -169,4 +169,11 @@ public abstract class Relatorio {
this.baseDir = baseDir; this.baseDir = baseDir;
} }
public Boolean isCustomXls() {
return customXls;
}
public void setCustomXls(Boolean customXls) {
this.customXls = customXls;
}
} }

View File

@ -60,7 +60,7 @@
<label <label
value="${c:l('busquedaAidfController.docfiscal.label')}" /> value="${c:l('busquedaAidfController.docfiscal.label')}" />
<textbox id="txtDocFiscal" width="100px" <textbox id="txtDocFiscal" width="100px"
maxlength="20" value="@{winEditarAidf$composer.aidf.docfiscal}" maxlength="60" value="@{winEditarAidf$composer.aidf.docfiscal}"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox" use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"
constraint="no empty"/> constraint="no empty"/>
</row> </row>