From 9d3663627dc11038669949ffea736eebddb83576 Mon Sep 17 00:00:00 2001 From: edgar Date: Mon, 9 Jan 2017 18:27:09 +0000 Subject: [PATCH] issue #8301 - Logo Empresa git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@64723 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../relatorios/impl/RelatorioTabelaPreco.java | 33 ++++++++++++------ .../RelatorioTabelaPrecoArtesp.jasper | Bin 34475 -> 35120 bytes .../RelatorioTabelaPrecoArtesp.jrxml | 18 ++++++---- .../RelatorioTabelaPrecoController.java | 7 ++-- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTabelaPreco.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTabelaPreco.java index a973cf8c4..d6425dbbf 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTabelaPreco.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTabelaPreco.java @@ -1,9 +1,8 @@ package com.rjconsultores.ventaboletos.relatorios.impl; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.util.HashMap; @@ -11,6 +10,7 @@ import java.util.Map; import javax.imageio.ImageIO; +import com.rjconsultores.ventaboletos.entidad.Marca; import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.service.SegVKMService; @@ -32,27 +32,25 @@ public class RelatorioTabelaPreco extends Relatorio { Connection conexao = this.relatorio.getConexao(); NamedParameterStatement stmt = new NamedParameterStatement(conexao, getSql()); ResultSet rset = stmt.executeQuery(); - - BufferedImage artespLogo= - ImageIO.read(getClass().getResource(this.relatorio.getBaseDir()+"/imagens/artesp.png")); - parametros.put("artesp_logo", artespLogo); + + setReportImages(); String series = RelatorioTabelaPreco.this.segVKMService.seriePorEmpresa((Integer) parametros.get("EMPRESA_ID")); while (rset.next()) { Map dataResult = new HashMap(); - + if (isLayoutArtesp) { dataResult.put("seguroOpcional", RelatorioTabelaPreco.this.segVKMService.buscarSeguroPorKm(rset.getLong("kmReal"), - series, (Integer) parametros.get("ORGAO_CONCEDENTE_ID"))); + series, (Integer) parametros.get("ORGAO_CONCEDENTE_ID"))); } - + dataResult.put("origem", rset.getString("origem")); dataResult.put("destino", rset.getString("destino")); dataResult.put("tarifa", rset.getBigDecimal("tarifa")); dataResult.put("pedagio", rset.getBigDecimal("pedagio")); dataResult.put("taxaEmbarque", rset.getBigDecimal("taxaEmbarque")); - + dataResult.put("outros", rset.getBigDecimal("outros")); dataResult.put("tipoClasse", rset.getString("tipoClasse")); dataResult.put("empresa", rset.getString("empresa")); @@ -73,6 +71,19 @@ public class RelatorioTabelaPreco extends Relatorio { }); } + protected void setReportImages() throws IOException { + BufferedImage empresaLogo = null; + Marca marca = (Marca) parametros.get("MARCA"); + if (marca != null && marca.getLogotipomarca() != null) { + empresaLogo = ImageIO.read(new ByteArrayInputStream(marca.getLogotipomarca())); + } + BufferedImage artespLogo = ImageIO.read(getClass().getResource(getBaseDir() + "/imagens/artesp.png")); + + parametros.put("artesp_logo", artespLogo); + parametros.put("empresa_logo", empresaLogo); + + } + @Override protected void processaParametros() throws Exception { } diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTabelaPrecoArtesp.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTabelaPrecoArtesp.jasper index 1af1d1acf8f3b3d203e6340474c2b0129a61667c..483ba40ec5930503f547018dc4c8a9c88d653964 100644 GIT binary patch delta 4569 zcmd^Cdvuh=6~Dimm@Ih!A)ACipaGJY2i-gfNr*fQBs`Qn!9)od7Fa@blTCIvsHL!q zuYy4i4ir!kgHRPuG`bRlPb@`Ilp_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TFn$WM;bnP#|T^B#e*q_(koY6qW1~uEL%S{tsyI BN&^4@ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTabelaPrecoArtesp.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTabelaPrecoArtesp.jrxml index 4a056c25c..9265ecbd5 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTabelaPrecoArtesp.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTabelaPrecoArtesp.jrxml @@ -1,10 +1,10 @@ - + - + @@ -35,22 +35,28 @@ - <band height="36" splitType="Stretch"> + <band height="47" splitType="Stretch"> <textField> - <reportElement uuid="5d83d8a8-01aa-4022-9583-6808e65d2ec8" mode="Opaque" x="0" y="0" width="321" height="33" backcolor="#FFFF66"/> + <reportElement uuid="5d83d8a8-01aa-4022-9583-6808e65d2ec8" mode="Opaque" x="0" y="0" width="321" height="47" backcolor="#FFFF66"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="SansSerif" size="20" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$F{origem}]]></textFieldExpression> </textField> <textField> - <reportElement uuid="2c5b01a1-51db-478a-a307-83c9df5cea6e" x="321" y="0" width="539" height="33"/> - <textElement verticalAlignment="Middle"> + <reportElement uuid="2c5b01a1-51db-478a-a307-83c9df5cea6e" x="363" y="0" width="497" height="47"> + <printWhenExpression><![CDATA[($P{empresa_logo})==null]]></printWhenExpression> + </reportElement> + <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="SansSerif" size="14" isBold="true"/> <paragraph leftIndent="4"/> </textElement> <textFieldExpression><![CDATA[$F{empresa}]]></textFieldExpression> </textField> + <image onErrorType="Blank"> + <reportElement uuid="71c314ae-5bbd-41d2-a548-b80de625c9b0" x="363" y="0" width="497" height="47"/> + <imageExpression><![CDATA[$P{empresa_logo}]]></imageExpression> + </image> </band> diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTabelaPrecoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTabelaPrecoController.java index 764b89a75..91c1980e9 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTabelaPrecoController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTabelaPrecoController.java @@ -1,6 +1,5 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; -import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -18,7 +17,6 @@ import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; import org.zkoss.zul.Checkbox; import org.zkoss.zul.Comboitem; -import org.zkoss.zul.ListModelArray; import org.zkoss.zul.ListModelList; import org.zkoss.zul.Paging; @@ -30,10 +28,10 @@ import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioTabelaPreco; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.service.MarcaService; import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService; import com.rjconsultores.ventaboletos.service.ParadaService; import com.rjconsultores.ventaboletos.service.SegVKMService; -import com.rjconsultores.ventaboletos.service.TramoService; import com.rjconsultores.ventaboletos.service.VigenciaTarifaService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar; @@ -77,6 +75,8 @@ public class RelatorioTabelaPrecoController extends MyGenericForwardComposer { private DataSource dataSourceRead; @Autowired private SegVKMService segVKMService; + @Autowired + private MarcaService marcaService; private List destinoList; private List lsVigencia; @@ -118,6 +118,7 @@ public class RelatorioTabelaPrecoController extends MyGenericForwardComposer { Empresa empresa = (Empresa) itemEmpresa.getValue(); parametros.put("EMPRESA_ID", empresa.getEmpresaId()); parametros.put("EMPRESA", empresa.getNombempresa()); + parametros.put("MARCA",marcaService.buscarMarcaPorEmpresa(Arrays.asList(empresa)).get(0)); } if (cmbOrgaoConcedente.getSelectedItem() != null) {