diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioVendasBoletos.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioVendasBoletos.java new file mode 100644 index 000000000..1016b82d4 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioVendasBoletos.java @@ -0,0 +1,274 @@ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.sql.Connection; +import java.sql.Date; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; + +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasPacotesBoletosBean; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +public class RelatorioVendasBoletos extends Relatorio { + + private static Logger log = Logger.getLogger(RelatorioVendasBoletos.class); + + private SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + + private List lsDadosRelatorio; + + private Date fecInicio; + private Date fecFinal; + private Integer empresaId; + private Integer origenId; + private Integer destinoId; + + public RelatorioVendasBoletos(Map parametros, Connection conexao, final String... nomeSubReporte) throws Exception { + super(parametros, conexao); + + this.setCustomDataSource(new DataSource(this) { + + + @Override + public void initDados() throws Exception { + Map parametros = this.relatorio.getParametros(); + fecInicio = new java.sql.Date(sdf.parse(parametros.get("fecInicio").toString()).getTime()); + fecFinal = new java.sql.Date(sdf.parse(parametros.get("fecFinal").toString()).getTime()); + empresaId = parametros.get("empresaId") != null && !parametros.get("empresaId").equals("null") ? Integer.valueOf(parametros.get("empresaId").toString()) : null; + origenId = parametros.get("origenId") != null && !parametros.get("origenId").equals("null") ? Integer.valueOf(parametros.get("origenId").toString()) : null; + destinoId = parametros.get("destinoId") != null && !parametros.get("destinoId").equals("null") ? Integer.valueOf(parametros.get("destinoId").toString()) : null; + + Connection conexao = this.relatorio.getConexao(); + processarVendasPacote(conexao); + processarVendasPacoteCancelados(conexao); + + setNomeSubReporte(nomeSubReporte); + setLsDadosRelatorio(lsDadosRelatorio); + } + + }); + } + + private void processarVendasPacote(Connection conexao) { + ResultSet rset = null; + NamedParameterStatement stmt = null; + + try { + stmt = carregarNamedParameterStatement(conexao, false); + rset = stmt.executeQuery(); + + if(lsDadosRelatorio == null) { + lsDadosRelatorio = new ArrayList(); + } + + while (rset.next()) { + RelatorioVendasPacotesBoletosBean relatorioVendasBoletosBean = carregarRelatorioVendasBoletosBean(rset); + Integer idx = carregarIndice(relatorioVendasBoletosBean); + + if(idx != null) { + relatorioVendasBoletosBean = lsDadosRelatorio.get(idx); + } + + relatorioVendasBoletosBean.setRelatorioVendasPacotesBoletosItemBeans(carregarItens(rset, relatorioVendasBoletosBean, relatorioVendasBoletosBean.getRelatorioVendasPacotesBoletosItemBeans())); + + if(idx != null) { + lsDadosRelatorio.set(idx, relatorioVendasBoletosBean); + } else { + lsDadosRelatorio.add(relatorioVendasBoletosBean); + } + } + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if(rset != null) { + rset.close(); + } + if(stmt != null) { + stmt.close(); + } + } catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + + } + + private List carregarItens(ResultSet rset, RelatorioVendasPacotesBoletosBean relatorioVendasPacotesBoletosBean, List itens) throws SQLException { + RelatorioVendasPacotesBoletosBean.RelatorioVendasPacotesBoletosItemBean relatorioVendasPacotesBoletosItemBean = relatorioVendasPacotesBoletosBean.new RelatorioVendasPacotesBoletosItemBean(); + relatorioVendasPacotesBoletosItemBean.setDesccategoria(rset.getString("desccategoria")); + relatorioVendasPacotesBoletosItemBean.setQtde(rset.getLong("qtde")); + relatorioVendasPacotesBoletosItemBean.setSimportetaxaembarque(rset.getBigDecimal("simportetaxaembarque")); + relatorioVendasPacotesBoletosItemBean.setSimportepedagio(rset.getBigDecimal("simportepedagio")); + relatorioVendasPacotesBoletosItemBean.setSimporteoutros(rset.getBigDecimal("simporteoutros")); + relatorioVendasPacotesBoletosItemBean.setSimporteseguro(rset.getBigDecimal("simporteseguro")); + relatorioVendasPacotesBoletosItemBean.setSpreciobase(rset.getBigDecimal("spreciobase")); + relatorioVendasPacotesBoletosItemBean.setDesconto(rset.getBigDecimal("desconto")); + + if(itens == null) { + itens = new ArrayList(); + } + itens.add(relatorioVendasPacotesBoletosItemBean); + + return itens; + } + + private Integer carregarIndice(RelatorioVendasPacotesBoletosBean relatorioVendasBoletosBean) { + Integer idx = null; + if(lsDadosRelatorio.contains(relatorioVendasBoletosBean)) { + idx = lsDadosRelatorio.indexOf(relatorioVendasBoletosBean); + relatorioVendasBoletosBean = lsDadosRelatorio.get(idx); + } + return idx; + } + + private RelatorioVendasPacotesBoletosBean carregarRelatorioVendasBoletosBean(ResultSet rset) throws SQLException { + RelatorioVendasPacotesBoletosBean relatorioVendasPacotesBoletosBean = new RelatorioVendasPacotesBoletosBean(); + relatorioVendasPacotesBoletosBean.setDescdestino(rset.getString("destino")); + relatorioVendasPacotesBoletosBean.setDescorigen(rset.getString("origem")); + relatorioVendasPacotesBoletosBean.setCvedestino(rset.getString("cvedestino")); + relatorioVendasPacotesBoletosBean.setCveorigen(rset.getString("cveorigem")); + + return relatorioVendasPacotesBoletosBean; + } + + private void processarVendasPacoteCancelados(Connection conexao) { + ResultSet rset = null; + NamedParameterStatement stmt = null; + + try { + stmt = carregarNamedParameterStatement(conexao, true); + rset = stmt.executeQuery(); + + if(lsDadosRelatorio == null) { + lsDadosRelatorio = new ArrayList(); + } + + while (rset.next()) { + RelatorioVendasPacotesBoletosBean relatorioVendasBoletosBean = carregarRelatorioVendasBoletosBean(rset); + Integer idx = carregarIndice(relatorioVendasBoletosBean); + + if(idx != null) { + relatorioVendasBoletosBean = lsDadosRelatorio.get(idx); + } + + relatorioVendasBoletosBean.setRelatorioVendasPacotesBoletosItemBeansCancelados(carregarItens(rset, relatorioVendasBoletosBean, relatorioVendasBoletosBean.getRelatorioVendasPacotesBoletosItemBeansCancelados())); + + if(idx != null) { + lsDadosRelatorio.set(idx, relatorioVendasBoletosBean); + } else { + lsDadosRelatorio.add(relatorioVendasBoletosBean); + } + } + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if(rset != null) { + rset.close(); + } + if(stmt != null) { + stmt.close(); + } + } catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + + } + + private NamedParameterStatement carregarNamedParameterStatement(Connection conexao, boolean cancelados) throws SQLException { + String sql = getSqlPacotes(cancelados); + log.info(sql); + + NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); + + if(fecInicio != null) { + stmt.setDate("fecInicio", fecInicio); + } + if(fecFinal != null) { + stmt.setDate("fecFinal", fecFinal); + } + if (empresaId != null){ + stmt.setInt("empresaId", empresaId); + } + if(origenId != null) { + stmt.setInt("origenId", origenId); + } + if(destinoId != null) { + stmt.setInt("destinoId", destinoId); + } + + return stmt; + } + + protected String getSqlPacotes(boolean cancelado) { + StringBuilder sQuery = new StringBuilder(); + + sQuery.append("SELECT DES.CVEPARADA AS CVEDESTINO, ORI.CVEPARADA AS CVEORIGEM, ORI.DESCPARADA AS ORIGEM, DES.DESCPARADA AS DESTINO, CAT.DESCCATEGORIA AS DESCCATEGORIA, ") + .append("COUNT(B.BOLETO_ID) AS QTDE, SUM(B.IMPORTETAXAEMBARQUE) AS SIMPORTETAXAEMBARQUE, SUM(B.IMPORTEPEDAGIO) AS SIMPORTEPEDAGIO, ") + .append("SUM(B.IMPORTEOUTROS) AS SIMPORTEOUTROS, SUM(B.IMPORTESEGURO) AS SIMPORTESEGURO, SUM(B.PRECIOBASE) AS SPRECIOBASE, SUM(B.PRECIOBASE - B.PRECIOPAGADO) AS DESCONTO ") + .append("FROM BOLETO B ") + .append("LEFT JOIN PARADA ORI ON ORI.PARADA_ID = B.ORIGEN_ID ") + .append("LEFT JOIN PARADA DES ON DES.PARADA_ID = B.DESTINO_ID ") + .append("LEFT JOIN CATEGORIA CAT ON CAT.CATEGORIA_ID = B.CATEGORIA_ID ") + .append("WHERE B.ACTIVO = 1 "); + + if(!cancelado) { + sQuery.append("AND B.INDSTATUSBOLETO = 'V' ") + .append("AND B.MOTIVOCANCELACION_ID IS NULL "); + } else { + sQuery.append("AND B.MOTIVOCANCELACION_ID IS NOT NULL "); + } + + if(empresaId != null) { + sQuery.append("AND B.EMPRESACORRIDA_ID = :empresaId "); + } + + if(origenId != null) { + sQuery.append("AND B.ORIGEN_ID = :origenId "); + } + + if(destinoId != null) { + sQuery.append("AND B.DESTINO_ID = :destinoId "); + } + + if(fecInicio != null) { + sQuery.append("AND B.FECHORVENTA >= :fecInicio "); + } + + if(fecFinal != null) { + sQuery.append("AND B.FECHORVENTA <= :fecFinal "); + } + + sQuery.append("GROUP BY DES.CVEPARADA, ORI.CVEPARADA, ORI.DESCPARADA, DES.DESCPARADA, CAT.DESCCATEGORIA ") + .append("ORDER BY DES.CVEPARADA, ORI.CVEPARADA, ORI.DESCPARADA, DES.DESCPARADA, CAT.DESCCATEGORIA "); + + return sQuery.toString(); + } + + @Override + protected void processaParametros() throws Exception { + } + + public List getLsDadosRelatorio() { + return lsDadosRelatorio; + } + + public void setLsDadosRelatorio(List lsDadosRelatorio) { + this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio)); + this.lsDadosRelatorio = lsDadosRelatorio; + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasBoletosItem_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasBoletosItem_es.properties new file mode 100644 index 000000000..e13de24fc --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasBoletosItem_es.properties @@ -0,0 +1,10 @@ +#Labels +label.qtde=Qtde +label.categoria=Categoria +label.spreciobase=Valor Tarifário +label.simporteseguro=Valor Seguro +label.simportetaxaembarque=Taxa Embarque +label.simporteoutros=Valor Serviço +label.spreciopagado=Total c/ Desconto +label.desconto=Desconto +label.spreciototal=Valor Total \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasBoletosItem_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasBoletosItem_pt_BR.properties new file mode 100644 index 000000000..e13de24fc --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasBoletosItem_pt_BR.properties @@ -0,0 +1,10 @@ +#Labels +label.qtde=Qtde +label.categoria=Categoria +label.spreciobase=Valor Tarifário +label.simporteseguro=Valor Seguro +label.simportetaxaembarque=Taxa Embarque +label.simporteoutros=Valor Serviço +label.spreciopagado=Total c/ Desconto +label.desconto=Desconto +label.spreciototal=Valor Total \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasBoletos_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasBoletos_es.properties new file mode 100644 index 000000000..cd1b4b3da --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasBoletos_es.properties @@ -0,0 +1,18 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. + +#Labels cabeçalho +cabecalho.nome=Relatório Vendas de Boletos +cabecalho.relatorio=Relatório: +cabecalho.periodo=Período: +cabecalho.periodoA=à +cabecalho.dataHora=Data/Hora: +cabecalho.impressorPor=Impressor por: +cabecalho.pagina=Página +cabecalho.de=de +cabecalho.filtros=Filtros: +cabecalho.origem=Origem: +cabecalho.destino=Destino: +label.empresa=Empresa: +label.trecho=Trecho: +label.cancelados = - CANCELADOS \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasBoletos_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasBoletos_pt_BR.properties new file mode 100644 index 000000000..272e6fce8 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasBoletos_pt_BR.properties @@ -0,0 +1,18 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. + +#Labels cabeçalho +cabecalho.nome=Relatório Vendas de Boletos +cabecalho.relatorio=Relatório: +cabecalho.periodo=Período: +cabecalho.periodoA=à +cabecalho.dataHora=Data/Hora: +cabecalho.impressorPor=Impressor por: +cabecalho.pagina=Página +cabecalho.de=de +cabecalho.filtros=Filtros: +cabecalho.origem=Origem: +cabecalho.destino=Destino: +label.empresa=Empresa: +label.trecho=Trecho: +label.cancelados=- CANCELADOS \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletos.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletos.jasper new file mode 100644 index 000000000..da8e74a11 Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletos.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletos.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletos.jrxml new file mode 100644 index 000000000..cbb7ea38a --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletos.jrxml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + <band height="80" splitType="Stretch"> + <textField> + <reportElement x="0" y="0" width="620" height="20" uuid="43b2c28d-4760-4890-b00d-25e931e79c74"/> + <textElement markup="none"> + <font size="14" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$R{cabecalho.nome}]]></textFieldExpression> + </textField> + <textField pattern="dd/MM/yyyy HH:mm"> + <reportElement x="638" y="0" width="164" height="20" uuid="4d1bcd65-c9a6-44b4-8dca-cc3c4c20c9a5"/> + <textElement textAlignment="Right"> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> + </textField> + <textField> + <reportElement x="0" y="20" width="620" height="20" uuid="a16eb33b-78ca-4fb4-80c2-f5c85a0d09c3"/> + <textElement> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$R{label.empresa} + " " + $P{empresa}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="0" y="40" width="620" height="20" uuid="fd05bd35-30d9-4baf-aa56-f8e5d3c3268b"/> + <textElement> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$R{cabecalho.periodo} + " " + $P{fecInicio} + " " + $R{cabecalho.periodoA} + " " + $P{fecFinal}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="0" y="60" width="802" height="20" uuid="bc1ac781-2bb6-40ef-92dd-d4f07f327d18"/> + <textElement> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$R{cabecalho.origem} + " " + $P{origem} + " " + $R{cabecalho.destino} + " " + $P{destino}]]></textFieldExpression> + </textField> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletosItem.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletosItem.jasper new file mode 100644 index 000000000..4730b7c36 Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletosItem.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletosItem.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletosItem.jrxml new file mode 100644 index 000000000..e3723938e --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletosItem.jrxml @@ -0,0 +1,358 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <band splitType="Stretch"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioVendasPacotesBoletosBean.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioVendasPacotesBoletosBean.java index c908daf83..5a148393c 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioVendasPacotesBoletosBean.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioVendasPacotesBoletosBean.java @@ -41,6 +41,7 @@ public class RelatorioVendasPacotesBoletosBean { private String nomconvenio; private String desctipotarifa; + private String desccategoria; private Long qtde; private BigDecimal simportetaxaembarque; private BigDecimal simportepedagio; @@ -172,6 +173,14 @@ public class RelatorioVendasPacotesBoletosBean { this.spreciobase = spreciobase; } + public String getDesccategoria() { + return desccategoria; + } + + public void setDesccategoria(String desccategoria) { + this.desccategoria = desccategoria; + } + } @Override diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioVendasPacotesBoletosController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioVendasPacotesBoletosController.java index 078e4013c..3218a2bc1 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioVendasPacotesBoletosController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioVendasPacotesBoletosController.java @@ -1,5 +1,6 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; +import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -21,11 +22,13 @@ import org.zkoss.zk.ui.event.Event; import org.zkoss.zul.Comboitem; import org.zkoss.zul.ComboitemRenderer; import org.zkoss.zul.Datebox; +import org.zkoss.zul.Radio; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasBoletos; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioVendasPacotesBoletos; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.service.EmpresaService; @@ -57,6 +60,8 @@ public class RelatorioVendasPacotesBoletosController extends MyGenericForwardCom private Datebox dataFinal; private MyComboboxEstandar cmbEmpresa; private MyComboboxEstandar cmbTipoTarifaPacote; + private Radio rVendaPacotesBoletos; + private Radio rVendaBoletos; private MyComboboxParada cmbParadaOrigem; private MyComboboxParadaCve cmbParadaOrigemCve; @@ -166,13 +171,13 @@ public class RelatorioVendasPacotesBoletosController extends MyGenericForwardCom parametros.put("tipoTarifaPacote", tipoTarifaPacote.getDesctipotarifa()); } - JasperReport subRelatorioVendasPacotesBoletosItens = (JasperReport) JRLoader.loadObject(this.getClass().getResourceAsStream("/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletosItem.jasper")); - parametros.put("subreporte", subRelatorioVendasPacotesBoletosItens); - - JasperReport subRelatorioVendasPacotesBoletosItensTotais = (JasperReport) JRLoader.loadObject(this.getClass().getResourceAsStream("/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletosItemTotais.jasper")); - parametros.put("subreporteTotais", subRelatorioVendasPacotesBoletosItensTotais); - - Relatorio relatorio = new RelatorioVendasPacotesBoletos(parametros, dataSourceRead.getConnection(), "RelatorioVendasPacotesBoletosItem", "RelatorioVendasPacotesBoletosItemTotais"); + Relatorio relatorio = null; + + if(rVendaPacotesBoletos.isSelected()) { + relatorio = gerarRelatorioVendaPacotesBoletos(parametros); + } else if(rVendaBoletos.isSelected()) { + relatorio = gerarRelatorioVendaBoletos(parametros); + } Map args = new HashMap(); args.put("relatorio", relatorio); @@ -180,6 +185,23 @@ public class RelatorioVendasPacotesBoletosController extends MyGenericForwardCom openWindow("/component/reportView.zul", Labels.getLabel("relatorioVendasPacotesBoletosController.window.title"), args, MODAL); } + + private Relatorio gerarRelatorioVendaPacotesBoletos(Map parametros) throws SQLException, Exception { + JasperReport subRelatorioVendasPacotesBoletosItens = (JasperReport) JRLoader.loadObject(this.getClass().getResourceAsStream("/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletosItem.jasper")); + parametros.put("subreporte", subRelatorioVendasPacotesBoletosItens); + + JasperReport subRelatorioVendasPacotesBoletosItensTotais = (JasperReport) JRLoader.loadObject(this.getClass().getResourceAsStream("/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletosItemTotais.jasper")); + parametros.put("subreporteTotais", subRelatorioVendasPacotesBoletosItensTotais); + + return new RelatorioVendasPacotesBoletos(parametros, dataSourceRead.getConnection(), "RelatorioVendasPacotesBoletosItem", "RelatorioVendasPacotesBoletosItemTotais"); + } + + private Relatorio gerarRelatorioVendaBoletos(Map parametros) throws SQLException, Exception { + JasperReport subRelatorioVendasBoletosItens = (JasperReport) JRLoader.loadObject(this.getClass().getResourceAsStream("/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletosItem.jasper")); + parametros.put("subreporte", subRelatorioVendasBoletosItens); + + return new RelatorioVendasBoletos(parametros, dataSourceRead.getConnection(), "RelatorioVendasBoletosItem"); + } public void onSelect$cmbParadaOrigemCve(Event ev) { if (cmbParadaOrigemCve.getSelectedItem() != null) { diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index c69810028..9d46c17e2 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -5549,6 +5549,9 @@ relatorioVendasPacotesBoletosController.lblPacote.value = Pacote relatorioVendasPacotesBoletosController.lblOrigem.value = Origem relatorioVendasPacotesBoletosController.lblDestino.value = Destino relatorioVendasPacotesBoletosController.lblUsuario.value = Usuário +relatorioVendasPacotesBoletosController.lbTipoRelatorio.value = Tipo Relatório +relatorioVendasPacotesBoletosController.lbVendaPacotesBoletos.value = Vendas de Boletos no Pacote +relatorioVendasPacotesBoletosController.lbVendaBoletos.value = Vendas de Boletos Avulsos # Relatorio Venda Pacote Voucher RelatorioVendaPacoteVoucher.window.title = Voucher Venda Pacote diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index a2c117f10..a9f9c749d 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -5691,6 +5691,10 @@ relatorioVendasPacotesBoletosController.lblPacote.value = Pacote relatorioVendasPacotesBoletosController.lblOrigem.value = Origem relatorioVendasPacotesBoletosController.lblDestino.value = Destino relatorioVendasPacotesBoletosController.lblUsuario.value = Usuário +relatorioVendasPacotesBoletosController.lblUsuario.value = Usuário +relatorioVendasPacotesBoletosController.lbTipoRelatorio.value = Tipo Relatório +relatorioVendasPacotesBoletosController.lbVendaPacotesBoletos.value = Vendas de Boletos no Pacote +relatorioVendasPacotesBoletosController.lbVendaBoletos.value = Vendas de Boletos Avulsos # Relatorio Venda Pacote Voucher RelatorioVendaPacoteVoucher.window.title = Voucher Venda Pacote diff --git a/web/gui/relatorios/filtroRelatorioVendasPacotesBoletos.zul b/web/gui/relatorios/filtroRelatorioVendasPacotesBoletos.zul index 461f674a2..c110265ad 100644 --- a/web/gui/relatorios/filtroRelatorioVendasPacotesBoletos.zul +++ b/web/gui/relatorios/filtroRelatorioVendasPacotesBoletos.zul @@ -79,6 +79,18 @@ format="dd/MM/yyyy" lenient="false" constraint="no empty" maxlength="10" /> + + +