diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioVendasPacotesBoletos.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioVendasPacotesBoletos.java index a8ec08266..3937dc429 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioVendasPacotesBoletos.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioVendasPacotesBoletos.java @@ -11,10 +11,12 @@ import java.util.Map; import org.apache.log4j.Logger; +import com.rjconsultores.ventaboletos.enums.SituacaoVendaPacote; 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.relatorios.utilitarios.RelatorioVendasPacotesBoletosBean.RelatorioVendasPacotesBoletosItemBean; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; @@ -27,8 +29,10 @@ public class RelatorioVendasPacotesBoletos extends Relatorio { private List lsDadosRelatorio; - private Timestamp fecInicio; - private Timestamp fecFinal; + private Timestamp fecVendaInicio; + private Timestamp fecVendaFinal; + private Timestamp fecPacoteInicio; + private Timestamp fecPacoteFinal; private Integer empresaId; private Integer origenId; private Integer destinoId; @@ -44,8 +48,10 @@ public class RelatorioVendasPacotesBoletos extends Relatorio { @Override public void initDados() throws Exception { Map parametros = this.relatorio.getParametros(); - fecInicio = new java.sql.Timestamp(sdf.parse(parametros.get("fecInicio").toString()).getTime()); - fecFinal = new java.sql.Timestamp(sdf.parse(parametros.get("fecFinal").toString()).getTime()); + fecVendaInicio = parametros.get("fecVendaInicio") != null ? new java.sql.Timestamp(DateUtil.inicioFecha(sdf.parse(parametros.get("fecVendaInicio").toString())).getTime()) : null; + fecVendaFinal = parametros.get("fecVendaFinal") != null ? new java.sql.Timestamp(DateUtil.fimFecha(sdf.parse(parametros.get("fecVendaFinal").toString())).getTime()) : null; + fecPacoteInicio = parametros.get("fecPacoteInicio") != null ? new java.sql.Timestamp(DateUtil.inicioFecha(sdf.parse(parametros.get("fecPacoteInicio").toString())).getTime()) : null; + fecPacoteFinal = parametros.get("fecPacoteFinal") != null ? new java.sql.Timestamp(DateUtil.fimFecha(sdf.parse(parametros.get("fecPacoteFinal").toString())).getTime()) : null; 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; @@ -54,7 +60,6 @@ public class RelatorioVendasPacotesBoletos extends Relatorio { Connection conexao = this.relatorio.getConexao(); processarVendasPacote(conexao); - processarVendasPacoteCancelados(conexao); processarVendasPacoteTotais(); setNomeSubReporte(nomeSubReporte); @@ -112,6 +117,8 @@ public class RelatorioVendasPacotesBoletos extends Relatorio { private List carregarItens(ResultSet rset, RelatorioVendasPacotesBoletosBean relatorioVendasPacotesBoletosBean, List itens) throws SQLException { RelatorioVendasPacotesBoletosBean.RelatorioVendasPacotesBoletosItemBean relatorioVendasPacotesBoletosItemBean = relatorioVendasPacotesBoletosBean.new RelatorioVendasPacotesBoletosItemBean(); + relatorioVendasPacotesBoletosItemBean.setNumruta(rset.getString("numruta")); + relatorioVendasPacotesBoletosItemBean.setDescruta(rset.getString("descruta")); relatorioVendasPacotesBoletosItemBean.setNomconvenio(rset.getString("nomconvenio")); relatorioVendasPacotesBoletosItemBean.setDesctipotarifa(rset.getString("desctipotarifa")); relatorioVendasPacotesBoletosItemBean.setQtde(rset.getLong("qtde")); @@ -121,6 +128,8 @@ public class RelatorioVendasPacotesBoletos extends Relatorio { relatorioVendasPacotesBoletosItemBean.setSimporteseguro(rset.getBigDecimal("simporteseguro")); relatorioVendasPacotesBoletosItemBean.setSpreciobase(rset.getBigDecimal("spreciobase")); relatorioVendasPacotesBoletosItemBean.setDesconto(rset.getBigDecimal("desconto")); + relatorioVendasPacotesBoletosItemBean.setSituacao(SituacaoVendaPacote.getSituacaoVendaPacote(rset.getInt("situacao"))); + relatorioVendasPacotesBoletosItemBean.setQtdeImpresso(rset.getInt("qtdeimpresso")); if(itens == null) { itens = new ArrayList(); @@ -149,63 +158,23 @@ public class RelatorioVendasPacotesBoletos extends Relatorio { 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.setTimestamp("fecInicio", fecInicio); + if(fecVendaInicio != null) { + stmt.setTimestamp("fecVendaInicio", fecVendaInicio); } - if(fecFinal != null) { - stmt.setTimestamp("fecFinal", fecFinal); + if(fecVendaFinal != null) { + stmt.setTimestamp("fecVendaFinal", fecVendaFinal); + } + if(fecPacoteInicio != null) { + stmt.setTimestamp("fecPacoteInicio", fecPacoteInicio); + } + if(fecPacoteFinal != null) { + stmt.setTimestamp("fecPacoteFinal", fecPacoteFinal); } if (empresaId != null && empresaId > 0){ stmt.setInt("empresaId", empresaId); @@ -229,25 +198,36 @@ public class RelatorioVendasPacotesBoletos extends Relatorio { 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, TVP.NOMCONVENIO, TTP.DESCTIPOTARIFA, ") + sQuery.append("SELECT DES.CVEPARADA AS CVEDESTINO, ORI.CVEPARADA AS CVEORIGEM, ORI.DESCPARADA AS ORIGEM, DES.DESCPARADA AS DESTINO, R.NUMRUTA, R.DESCRUTA, PC.NOMCONVENIO, TTP.DESCTIPOTARIFA, VP.SITUACAO, ") + .append("SUM(CASE WHEN B.MOTIVOCANCELACION_ID = 16 THEN 1 ELSE 0 END) AS QTDEIMPRESSO, ") .append("COUNT(TVP.TARIFAVENDAPACOTE_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 VENDA_PACOTE VP ") - .append("LEFT JOIN PACOTE P ON P.PACOTE_ID = VP.PACOTE_ID ") + .append("INNER JOIN PACOTE P ON P.PACOTE_ID = VP.PACOTE_ID AND P.ACTIVO = 1 ") .append("LEFT JOIN TARIFA_VENDA_PACOTE TVP ON TVP.VENDAPACOTE_ID = VP.VENDAPACOTE_ID ") - .append("LEFT JOIN BOLETO B ON B.BOLETO_ID = TVP.BOLETO_ID ") - .append("LEFT JOIN PACOTE_TARIFA PT ON PT.PACOTETARIFA_ID = TVP.PACOTETARIFA_ID ") - .append("LEFT JOIN TIPO_TARIFA_PACOTE TTP ON TTP.TIPOTARIFAPACOTE_ID = PT.TIPOTARIFAPACOTE_ID ") + .append("INNER JOIN BOLETO B ON B.BOLETO_ID = TVP.BOLETO_ID ") + .append("LEFT JOIN RUTA R ON R.RUTA_ID = B.RUTA_ID ") .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("WHERE P.ACTIVO = 1 ") - .append("AND B.ACTIVO = 1 "); + .append("LEFT JOIN PACOTE_TARIFA PT ON PT.PACOTETARIFA_ID = TVP.PACOTETARIFA_ID ") + .append("LEFT JOIN TIPO_TARIFA_PACOTE TTP ON TTP.TIPOTARIFAPACOTE_ID = PT.TIPOTARIFAPACOTE_ID ") + .append("LEFT JOIN PACOTE_CONVENIO PC ON PC.PACOTECONVENIO_ID = TVP.PACOTECONVENIO_ID AND PC.ACTIVO = 1 ") + .append("WHERE 1=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(fecVendaInicio != null) { + sQuery.append("AND VP.DATAVENDA >= :fecVendaInicio "); + } + + if(fecVendaFinal != null) { + sQuery.append("AND VP.DATAVENDA <= :fecVendaFinal "); + } + + if(fecPacoteInicio != null) { + sQuery.append("AND VP.DATAPACOTE >= :fecPacoteInicio "); + } + + if(fecPacoteFinal != null) { + sQuery.append("AND VP.DATAPACOTE <= :fecPacoteFinal "); } if(empresaId != null && empresaId > 0){ @@ -270,16 +250,8 @@ public class RelatorioVendasPacotesBoletos extends Relatorio { sQuery.append("AND TTP.TIPOTARIFAPACOTE_ID = :tipoTarifaPacoteId "); } - if(fecInicio != null) { - sQuery.append("AND VP.DATAVENDA >= :fecInicio "); - } - - if(fecFinal != null) { - sQuery.append("AND VP.DATAVENDA <= :fecFinal "); - } - - sQuery.append("GROUP BY DES.CVEPARADA,ORI.CVEPARADA,ORI.DESCPARADA,DES.DESCPARADA,TVP.NOMCONVENIO,TTP.DESCTIPOTARIFA ") - .append("ORDER BY DES.CVEPARADA,ORI.CVEPARADA,ORI.DESCPARADA,DES.DESCPARADA,TVP.NOMCONVENIO,TTP.DESCTIPOTARIFA "); + sQuery.append("GROUP BY DES.CVEPARADA, ORI.CVEPARADA, ORI.DESCPARADA, DES.DESCPARADA, R.NUMRUTA, R.DESCRUTA, PC.NOMCONVENIO, TTP.DESCTIPOTARIFA, VP.SITUACAO ") + .append("ORDER BY DES.CVEPARADA, ORI.CVEPARADA, ORI.DESCPARADA, DES.DESCPARADA, R.NUMRUTA, R.DESCRUTA, PC.NOMCONVENIO, TTP.DESCTIPOTARIFA, VP.SITUACAO "); return sQuery.toString(); } diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletosItem_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletosItem_es.properties index ca5622f37..665da9364 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletosItem_es.properties +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletosItem_es.properties @@ -8,4 +8,9 @@ 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 +label.spreciototal=Valor Total +label.cancelado=Cancelado +label.sim=Si +label.nao=No +label.ruta=Ruta +label.impresso=Impresso \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletosItem_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletosItem_pt_BR.properties index ca5622f37..f68b4fe4a 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletosItem_pt_BR.properties +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletosItem_pt_BR.properties @@ -8,4 +8,9 @@ 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 +label.spreciototal=Valor Total +label.cancelado=Cancelado +label.sim=Sim +label.nao=Não +label.ruta=Rota +label.impresso=Impresso \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletos_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletos_es.properties index 41b496b90..af32ee071 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletos_es.properties +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletos_es.properties @@ -4,7 +4,8 @@ msg.noData=N #Labels cabeçalho cabecalho.nome=Relatório Vendas de Pacotes - Boletos cabecalho.relatorio=Relatório: -cabecalho.periodo=Período: +cabecalho.periodoVenda=Data Venda: +cabecalho.periodoPacote=Data Pacote: cabecalho.periodoA=à cabecalho.dataHora=Data/Hora: cabecalho.impressorPor=Impressor por: diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletos_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletos_pt_BR.properties index 5af027d30..829f9c49a 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletos_pt_BR.properties +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioVendasPacotesBoletos_pt_BR.properties @@ -4,7 +4,8 @@ msg.noData=N #Labels cabeçalho cabecalho.nome=Relatório Vendas de Pacotes - Boletos cabecalho.relatorio=Relatório: -cabecalho.periodo=Período: +cabecalho.periodoVenda=Data Venda: +cabecalho.periodoPacote=Data Pacote: cabecalho.periodoA=à cabecalho.dataHora=Data/Hora: cabecalho.impressorPor=Impressor por: diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletosItem.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletosItem.jasper index 4730b7c36..fd41593f2 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletosItem.jasper 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 index e3723938e..f50464b4d 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletosItem.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasBoletosItem.jrxml @@ -1,7 +1,7 @@ - - + + @@ -13,6 +13,7 @@ + @@ -50,56 +51,56 @@ - + - + - + - + - + - + - + - + @@ -109,28 +110,28 @@ - + - + - + - + - + - + - + - + @@ -139,70 +140,80 @@ - + - + + + + + + + + + + + - + - + - + - + - + - + - + - + @@ -212,28 +223,28 @@ - + - + - + - + - + - + - + - + @@ -242,15 +253,25 @@ - + - + + + + + + + + + + + @@ -259,49 +280,49 @@ - + - + - + - + - + - + - + @@ -314,41 +335,44 @@ - + - + - + - + - + - + - + - + - + - + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletos.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletos.jasper index 068c03708..0b285766a 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletos.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletos.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletos.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletos.jrxml index 77ce23acf..31ebdbb96 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletos.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletos.jrxml @@ -1,11 +1,9 @@ - + - - @@ -17,18 +15,19 @@ + + - - <band height="122" splitType="Stretch"> + <band height="142" splitType="Stretch"> <textField> <reportElement x="0" y="0" width="620" height="20" uuid="43b2c28d-4760-4890-b00d-25e931e79c74"/> <textElement markup="none"> @@ -55,29 +54,36 @@ <textElement> <font isBold="true"/> </textElement> - <textFieldExpression><![CDATA[$R{cabecalho.periodo} + " " + $P{fecInicio} + " " + $R{cabecalho.periodoA} + " " + $P{fecFinal}]]></textFieldExpression> + <textFieldExpression><![CDATA[$R{cabecalho.periodoVenda} + " " + $P{periodoVenda}]]></textFieldExpression> </textField> <textField> - <reportElement x="0" y="60" width="802" height="20" uuid="bc1ac781-2bb6-40ef-92dd-d4f07f327d18"/> + <reportElement x="0" y="80" 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> + <textFieldExpression><![CDATA[$R{cabecalho.origem} + " " + $P{origem} + " / " + $R{cabecalho.destino} + " " + $P{destino}]]></textFieldExpression> </textField> <textField> - <reportElement x="0" y="80" width="802" height="20" uuid="1cfececb-aab4-4ec7-a002-b7a45c567252"/> + <reportElement x="0" y="100" width="802" height="20" uuid="1cfececb-aab4-4ec7-a002-b7a45c567252"/> <textElement> <font isBold="true"/> </textElement> <textFieldExpression><![CDATA[$R{cabecalho.usuario} + " " + $P{usuario}]]></textFieldExpression> </textField> <textField> - <reportElement x="0" y="100" width="802" height="20" uuid="8b436394-0e3c-420e-b2dd-2b62ee7ed988"/> + <reportElement x="0" y="120" width="802" height="20" uuid="8b436394-0e3c-420e-b2dd-2b62ee7ed988"/> <textElement> <font isBold="true"/> </textElement> <textFieldExpression><![CDATA[$R{cabecalho.tipoTarifaPacote} + " " + $P{tipoTarifaPacote}]]></textFieldExpression> </textField> + <textField> + <reportElement x="0" y="60" width="620" height="20" uuid="5cf60597-1643-473f-ad7d-9a5748fcf2a6"/> + <textElement> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$R{cabecalho.periodoPacote} + " " + $P{periodoPacote}]]></textFieldExpression> + </textField> </band> @@ -115,27 +121,6 @@ - - - - - - - - - - - - - - - - - - - - - @@ -143,29 +128,6 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletosItem.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletosItem.jasper index a79803da9..42b105212 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletosItem.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletosItem.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletosItem.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletosItem.jrxml index 3dd63f3b8..8aaf5700d 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletosItem.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioVendasPacotesBoletosItem.jrxml @@ -1,7 +1,7 @@ - - + + @@ -14,6 +14,9 @@ + + + @@ -53,70 +56,70 @@ - + - + - + - + - + - + - + - + - + - + @@ -126,31 +129,31 @@ - + - + - + - + - + - + - + - + - + @@ -161,75 +164,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + @@ -239,31 +272,31 @@ - + - + - + - + - + - + - + - + - + @@ -274,6 +307,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -282,56 +345,56 @@ - + - + - + - + - + - + - + - + @@ -344,28 +407,28 @@ - + - + - + - + - + - + - + - + @@ -373,6 +436,9 @@ + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioVendasPacotesBoletosBean.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioVendasPacotesBoletosBean.java index 5a148393c..f1d69a314 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioVendasPacotesBoletosBean.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioVendasPacotesBoletosBean.java @@ -3,6 +3,8 @@ package com.rjconsultores.ventaboletos.relatorios.utilitarios; import java.math.BigDecimal; import java.util.List; +import com.rjconsultores.ventaboletos.enums.SituacaoVendaPacote; + public class RelatorioVendasPacotesBoletosBean { private String cveorigen; @@ -39,6 +41,8 @@ public class RelatorioVendasPacotesBoletosBean { public class RelatorioVendasPacotesBoletosItemBean { + private String numruta; + private String descruta; private String nomconvenio; private String desctipotarifa; private String desccategoria; @@ -49,6 +53,8 @@ public class RelatorioVendasPacotesBoletosBean { private BigDecimal simporteseguro; private BigDecimal desconto; private BigDecimal spreciobase; + private SituacaoVendaPacote situacao; + private Integer qtdeImpresso; public String getNomconvenio() { return nomconvenio; @@ -134,37 +140,6 @@ public class RelatorioVendasPacotesBoletosBean { return spreciototal; } - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((desctipotarifa == null) ? 0 : desctipotarifa.hashCode()); - result = prime * result + ((nomconvenio == null) ? 0 : nomconvenio.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - RelatorioVendasPacotesBoletosItemBean other = (RelatorioVendasPacotesBoletosItemBean) obj; - if (desctipotarifa == null) { - if (other.desctipotarifa != null) - return false; - } else if (!desctipotarifa.equals(other.desctipotarifa)) - return false; - if (nomconvenio == null) { - if (other.nomconvenio != null) - return false; - } else if (!nomconvenio.equals(other.nomconvenio)) - return false; - return true; - } - public BigDecimal getSpreciobase() { return spreciobase; } @@ -181,6 +156,106 @@ public class RelatorioVendasPacotesBoletosBean { this.desccategoria = desccategoria; } + public Boolean getCancelado() { + return SituacaoVendaPacote.CANCELADO.equals(getSituacao()); + } + + public SituacaoVendaPacote getSituacao() { + return situacao; + } + + public void setSituacao(SituacaoVendaPacote situacao) { + this.situacao = situacao; + } + + public String getNumruta() { + return numruta; + } + + public void setNumruta(String numruta) { + this.numruta = numruta; + } + + public String getDescruta() { + return descruta; + } + + public void setDescruta(String descruta) { + this.descruta = descruta; + } + + public String getNumDescRuta() { + StringBuilder str = new StringBuilder(); + str.append(getNumruta()) + .append(" - ") + .append(getDescruta()); + return str.toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((desccategoria == null) ? 0 : desccategoria.hashCode()); + result = prime * result + ((descruta == null) ? 0 : descruta.hashCode()); + result = prime * result + ((desctipotarifa == null) ? 0 : desctipotarifa.hashCode()); + result = prime * result + ((nomconvenio == null) ? 0 : nomconvenio.hashCode()); + result = prime * result + ((numruta == null) ? 0 : numruta.hashCode()); + result = prime * result + ((situacao == null) ? 0 : situacao.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + RelatorioVendasPacotesBoletosItemBean other = (RelatorioVendasPacotesBoletosItemBean) obj; + if (desccategoria == null) { + if (other.desccategoria != null) + return false; + } else if (!desccategoria.equals(other.desccategoria)) + return false; + if (descruta == null) { + if (other.descruta != null) + return false; + } else if (!descruta.equals(other.descruta)) + return false; + if (desctipotarifa == null) { + if (other.desctipotarifa != null) + return false; + } else if (!desctipotarifa.equals(other.desctipotarifa)) + return false; + if (nomconvenio == null) { + if (other.nomconvenio != null) + return false; + } else if (!nomconvenio.equals(other.nomconvenio)) + return false; + if (numruta == null) { + if (other.numruta != null) + return false; + } else if (!numruta.equals(other.numruta)) + return false; + if (situacao != other.situacao) + return false; + return true; + } + + public Integer getQtdeImpresso() { + return qtdeImpresso; + } + + public void setQtdeImpresso(Integer qtdeImpresso) { + this.qtdeImpresso = qtdeImpresso; + } + + public Boolean getImpresso() { + return qtdeImpresso != null && qtdeImpresso > 0; + } + } @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 c4555c97d..7066bf2ee 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 @@ -10,9 +10,7 @@ import java.util.Map; import javax.sql.DataSource; -import net.sf.jasperreports.engine.JasperReport; -import net.sf.jasperreports.engine.util.JRLoader; - +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; @@ -22,13 +20,11 @@ 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; @@ -39,6 +35,9 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParadaCve; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxUsuario; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; +import net.sf.jasperreports.engine.JasperReport; +import net.sf.jasperreports.engine.util.JRLoader; + @Controller("relatorioVendasPacotesBoletosController") @Scope("prototype") public class RelatorioVendasPacotesBoletosController extends MyGenericForwardComposer { @@ -56,12 +55,12 @@ public class RelatorioVendasPacotesBoletosController extends MyGenericForwardCom private List lsEmpresa; private List lsTipoTarifaPacote; - private Datebox dataInicial; - private Datebox dataFinal; + private Datebox dataVendaInicial; + private Datebox dataVendaFinal; + private Datebox dataPacoteInicial; + private Datebox dataPacoteFinal; private MyComboboxEstandar cmbEmpresa; private MyComboboxEstandar cmbTipoTarifaPacote; - private Radio rVendaPacotesBoletos; - private Radio rVendaBoletos; private MyComboboxParada cmbParadaOrigem; private MyComboboxParadaCve cmbParadaOrigemCve; @@ -120,12 +119,33 @@ public class RelatorioVendasPacotesBoletosController extends MyGenericForwardCom public void onClick$btnExecutarRelatorio(Event ev) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); - Date dataDe = dataInicial.getValue(); - Date dataAte = dataFinal.getValue(); + Date dataVendaDe = dataVendaInicial.getValue(); + Date dataVendaAte = dataVendaFinal.getValue(); + Date dataPacoteDe = dataPacoteInicial.getValue(); + Date dataPacoteAte = dataPacoteFinal.getValue(); Map parametros = new HashMap(); - parametros.put("fecInicio", sdf.format(dataDe)); - parametros.put("fecFinal", sdf.format(dataAte)); + String periodoVenda = ""; + String periodoPacote = ""; + if(dataVendaDe != null) { + parametros.put("fecVendaInicio", sdf.format(dataVendaDe)); + periodoVenda += parametros.get("fecVendaInicio") + " "; + } + if(dataVendaAte != null) { + parametros.put("fecVendaFinal", sdf.format(dataVendaAte)); + periodoVenda += Labels.getLabel("lb.ate") + " " + parametros.get("fecVendaFinal"); + } + if(dataPacoteDe != null) { + parametros.put("fecPacoteInicio", sdf.format(dataPacoteDe)); + periodoPacote += parametros.get("fecPacoteInicio") + " "; + } + if(dataPacoteAte != null) { + parametros.put("fecPacoteFinal", sdf.format(dataPacoteAte)); + periodoPacote += Labels.getLabel("lb.ate") + " " + parametros.get("fecPacoteFinal"); + } + + parametros.put("periodoVenda", StringUtils.isNotBlank(periodoVenda) ? periodoVenda : "Todos"); + parametros.put("periodoPacote", StringUtils.isNotBlank(periodoPacote) ? periodoPacote : "Todos"); Comboitem cbiEmpresa = cmbEmpresa.getSelectedItem(); String empresaId = null; @@ -169,13 +189,7 @@ public class RelatorioVendasPacotesBoletosController extends MyGenericForwardCom parametros.put("tipoTarifaPacote", tipoTarifaPacote.getDesctipotarifa()); } - Relatorio relatorio = null; - - if(rVendaPacotesBoletos.isSelected()) { - relatorio = gerarRelatorioVendaPacotesBoletos(parametros); - } else if(rVendaBoletos.isSelected()) { - relatorio = gerarRelatorioVendaBoletos(parametros); - } + Relatorio relatorio = gerarRelatorioVendaPacotesBoletos(parametros); Map args = new HashMap(); args.put("relatorio", relatorio); @@ -194,13 +208,6 @@ public class RelatorioVendasPacotesBoletosController extends MyGenericForwardCom 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) { cmbParadaOrigem.setComboItemByParada((Parada) cmbParadaOrigemCve.getSelectedItem().getValue()); diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index cbe6774f9..0da014f1c 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -52,10 +52,11 @@ MSG.necesita.formaPago = Forma de pago obligatória MSG.Error.invalida.competencia = Competência inválida MSG.Error.necessita.puntoVenta = Punto Venta obligatório -# Labels Defaul +# Labels Default lb.id = ID lb.dec = Descripción lb.Equivalencia = Equivalencia +lb.ate = até # Reporte relatorio.lb.btnExecutarRelatorio = Ejecutar reporte @@ -6044,8 +6045,10 @@ relatorioVendasPacotesDetalhadoController.lblUsuario.value = Usuário # Relatorio Vendas Pacotes Boletos relatorioVendasPacotesBoletosController.window.title = Reporte Ventas de Paquetes - Boletos -relatorioVendasPacotesBoletosController.lbDataIni.value = Fecha Inicio -relatorioVendasPacotesBoletosController.lbDataFin.value = Fecha Final +relatorioVendasPacotesBoletosController.lbDataVendaIni.value = Fec Venda Inicial +relatorioVendasPacotesBoletosController.lbDataVendaFin.value = Fec Venda Final +relatorioVendasPacotesBoletosController.lbDataPacoteIni.value = Fec Paquete Inicial +relatorioVendasPacotesBoletosController.lbDataPacoteFin.value = Fec Paquete Final relatorioVendasPacotesBoletosController.lblEmpresa.value = Empresa relatorioVendasPacotesBoletosController.lblTipoTarifaPacote.value = Tipo Tarifa relatorioVendasPacotesBoletosController.lblPacote.value = Pacote diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index fc098090c..f015ee397 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -54,10 +54,11 @@ MSG.necesita.formaPago = Forma de Pagamento Obrigatória MSG.Error.invalida.competencia = Competência inválida MSG.Error.necessita.puntoVenta = Ponto de Venda (Agência) Obrigatório -# Labels Defaul +# Labels Default lb.id = ID lb.dec = Descrição lb.Equivalencia = Equivalencia +lb.ate = até # Relatório relatorio.lb.btnExecutarRelatorio = Executar Relatório @@ -6231,8 +6232,10 @@ relatorioVendasPacotesDetalhadoController.lblUsuario.value = Usuário # Relatorio Vendas Pacotes Boletos relatorioVendasPacotesBoletosController.window.title = Relatório Vendas de Pacotes - Bilhetes -relatorioVendasPacotesBoletosController.lbDataIni.value = Data Inicial -relatorioVendasPacotesBoletosController.lbDataFin.value = Data Final +relatorioVendasPacotesBoletosController.lbDataVendaIni.value = Dt Venda Inicial +relatorioVendasPacotesBoletosController.lbDataVendaFin.value = Dt Venda Final +relatorioVendasPacotesBoletosController.lbDataPacoteIni.value = Dt Pacote Inicial +relatorioVendasPacotesBoletosController.lbDataPacoteFin.value = Dt Pacote Final relatorioVendasPacotesBoletosController.lblEmpresa.value = Empresa relatorioVendasPacotesBoletosController.lblTipoTarifaPacote.value = Tipo Tarifa relatorioVendasPacotesBoletosController.lblPacote.value = Pacote diff --git a/web/gui/relatorios/filtroRelatorioVendasPacotesBoletos.zul b/web/gui/relatorios/filtroRelatorioVendasPacotesBoletos.zul index c110265ad..07529f25b 100644 --- a/web/gui/relatorios/filtroRelatorioVendasPacotesBoletos.zul +++ b/web/gui/relatorios/filtroRelatorioVendasPacotesBoletos.zul @@ -69,27 +69,28 @@ - - + +