diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDescontos.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDescontos.java index 1ef37064e..269a5098c 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDescontos.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDescontos.java @@ -35,7 +35,9 @@ public class RelatorioDescontos extends Relatorio { Timestamp fecVentaFinal = new Timestamp((DateUtil.fimFecha((Date) parametros.get("fecVentaFinal"))).getTime()); String codconvenio = (String) parametros.get("codconvenio"); - String query = getQuery(idPuntoVenta, codconvenio); + Integer tipoPuntoVenta = (Integer) parametros.get("tipoPuntoVenta"); + + String query = getQuery(idPuntoVenta, codconvenio, tipoPuntoVenta); System.out.println(query); NamedParameterStatement statement = new NamedParameterStatement(coneConnection, query); @@ -47,7 +49,11 @@ public class RelatorioDescontos extends Relatorio { } if(codconvenio != null && !codconvenio.isEmpty()) { statement.setString("codconvenio", codconvenio); - } + } + + if (tipoPuntoVenta != null && tipoPuntoVenta != -1) { + statement.setInt("tipoPuntoVenta", tipoPuntoVenta); + } ResultSet resultSet = statement.executeQuery(); @@ -84,7 +90,7 @@ public class RelatorioDescontos extends Relatorio { } } - private String getQuery(Integer idPuntoVenta, String codconvenio) { + private String getQuery(Integer idPuntoVenta, String codconvenio, Integer tipoPuntoVenta) { String query = " SELECT " @@ -127,6 +133,8 @@ public class RelatorioDescontos extends Relatorio { + " JOIN CONVENIO_DET CONV_D ON CONV_D.CONVENIODET_ID = BOL.CONVENIODET_ID " + " JOIN CONVENIO CONV ON CONV.CONVENIO_ID = CONV_D.CONVENIO_ID " + " JOIN PUNTO_VENTA PUNT_V ON PUNT_V.PUNTOVENTA_ID = BOL.PUNTOVENTA_ID " + + " JOIN TIPO_PTOVTA TPVTA ON PUNT_V.TIPOPTOVTA_ID = TPVTA.TIPOPTOVTA_ID " + + " JOIN PARADA ORIG ON ORIG.PARADA_ID = BOL.ORIGEN_ID " + " JOIN PARADA DEST ON DEST.PARADA_ID = BOL.DESTINO_ID " + " INNER JOIN USUARIO U ON U.USUARIO_ID = BOL.USUARIO_ID " @@ -146,16 +154,13 @@ public class RelatorioDescontos extends Relatorio { if (codconvenio != null && !codconvenio.isEmpty()) { query += " AND (CONV.CVECONVENIO = :codconvenio)"; } -// -// query += " GROUP BY (CONV.CVECONVENIO || ' - ' || CONV.DESCCONVENIO), BOL.EMPRESACORRIDA_ID, PUNT_V.NOMBPUNTOVENTA, "; -// query += " BOL.FECHORVENTA, BOL.FECHORVIAJE, BOL.CORRIDA_ID, ORIG.CVEPARADA, DEST.CVEPARADA, BOL.PRECIOPAGADO, " ; -// query += " BOL.IMPORTETAXAEMBARQUE, BOL.IMPORTEPEDAGIO, BOL.NOMBPASAJERO, BOL.NUMIDENTIFICACION, U.CVEUSUARIO " ; - query += " ORDER BY BOL.EMPRESACORRIDA_ID, (CONV.CVECONVENIO || ' - ' || CONV.DESCCONVENIO)"; -// " BOL.EMPRESACORRIDA_ID, PUNT_V.NOMBPUNTOVENTA, "; -// query += " BOL.FECHORVENTA, BOL.FECHORVIAJE, BOL.CORRIDA_ID, ORIG.CVEPARADA, DEST.CVEPARADA, BOL.PRECIOPAGADO, " ; -// query += " BOL.IMPORTETAXAEMBARQUE, BOL.IMPORTEPEDAGIO, BOL.NOMBPASAJERO, BOL.NUMIDENTIFICACION, U.CVEUSUARIO " ; + + if (tipoPuntoVenta != null && tipoPuntoVenta != -1) { + query += " AND (PUNT_V.TIPOPTOVTA_ID = :tipoPuntoVenta)"; + } + + query += " ORDER BY BOL.EMPRESACORRIDA_ID, (CONV.CVECONVENIO || ' - ' || CONV.DESCCONVENIO)"; - return query; } diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDescontosTipo2.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDescontosTipo2.java new file mode 100644 index 000000000..6e20d62eb --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDescontosTipo2.java @@ -0,0 +1,177 @@ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +public class RelatorioDescontosTipo2 extends Relatorio { + + List> dadosRelatorio = new ArrayList>(); + + public RelatorioDescontosTipo2(Map parametros, Connection conexao) throws Exception { + super(parametros, conexao); + + setCustomDataSource(new DataSource(this){ + @Override + public void initDados() throws Exception { + Connection coneConnection = relatorio.getConexao(); + Map parametros = relatorio.getParametros(); + + Integer idPuntoVenta = (Integer) parametros.get("idPuntoVenta"); + Timestamp fecVentaInicial = new Timestamp((DateUtil.inicioFecha((Date) parametros.get("fecVentaInicial"))).getTime()); + Timestamp fecVentaFinal = new Timestamp((DateUtil.fimFecha((Date) parametros.get("fecVentaFinal"))).getTime()); + String codconvenio = (String) parametros.get("codconvenio"); + + Integer tipoPuntoVenta = (Integer) parametros.get("tipoPuntoVenta"); + + String query = getQuery(idPuntoVenta, codconvenio, tipoPuntoVenta); + System.out.println(query); + + NamedParameterStatement statement = new NamedParameterStatement(coneConnection, query); + statement.setTimestamp("fecVentaInicial", fecVentaInicial); + statement.setTimestamp("fecVentaFinal", fecVentaFinal); + + if(idPuntoVenta != null && idPuntoVenta != -1) { + statement.setInt("idPuntoVenta", idPuntoVenta); + } + if(codconvenio != null && !codconvenio.isEmpty()) { + statement.setString("codconvenio", codconvenio); + } + + if (tipoPuntoVenta != null && tipoPuntoVenta != -1) { + statement.setInt("tipoPuntoVenta", tipoPuntoVenta); + } + + ResultSet resultSet = statement.executeQuery(); + + preencherDadosRelatorio(resultSet); + } + + + }); + } + + private void preencherDadosRelatorio(ResultSet resultSet) throws SQLException { + while (resultSet.next()) { + HashMap singleData = new HashMap(); + singleData.put("codConvenio", resultSet.getString("codConvenio")); + singleData.put("nomeAgencia", resultSet.getString("nomeAgencia")); + singleData.put("dataEmissao", resultSet.getDate("dataEmissao")); + singleData.put("dataViagem", resultSet.getTimestamp("dataViagem")); + singleData.put("codServico", resultSet.getString("codServico")); + singleData.put("codOrigem", resultSet.getString("codOrigem")); + singleData.put("codDestino", resultSet.getString("codDestino")); + singleData.put("tarifaComDesconto", resultSet.getDouble("tarifaComDesconto")); + singleData.put("tut", resultSet.getDouble("tut")); + singleData.put("pedagio", resultSet.getDouble("pedagio")); + singleData.put("nomepassageiro", resultSet.getString("nomepassageiro")); + singleData.put("documento", resultSet.getString("documento")); + singleData.put("bilheteiro", resultSet.getString("bilheteiro")); + singleData.put("empresacorrida", resultSet.getInt("empresacorrida")); + singleData.put("empresa", resultSet.getString("empresa")); + singleData.put("CANAL_DE_VENDA", resultSet.getString("CANAL_DE_VENDA")); + singleData.put("email", resultSet.getString("email")); + singleData.put("telefone", resultSet.getString("telefone")); + dadosRelatorio.add(singleData); + } + + if(!dadosRelatorio.isEmpty()) { + setCollectionDataSource(new JRBeanCollectionDataSource(dadosRelatorio)); + } + } + + private String getQuery(Integer idPuntoVenta, String codconvenio, Integer tipoPuntoVenta) { + + String query = " SELECT " + + + " (CONV.CVECONVENIO || ' - ' || CONV.DESCCONVENIO) AS codConvenio, " + + " PUNT_V.NOMBPUNTOVENTA AS nomeAgencia, " + + " BOL.FECHORVENTA AS dataEmissao, " + + " BOL.FECHORVIAJE AS dataViagem, " + + " BOL.CORRIDA_ID AS codServico, " + + " ORIG.CVEPARADA AS codOrigem, " + + " DEST.CVEPARADA AS codDestino, " + + + " (case " + + " when ( bol.indcancelacion = 1 ) " + + " then (-1 *(Abs( BOL.PRECIOPAGADO ) )) " + + " else " + + " BOL.PRECIOPAGADO " + + " END) AS tarifaComDesconto, " + + + + " (case " + + " when ( bol.indcancelacion = 1 ) " + + " then (-1 *(Abs( BOL.IMPORTETAXAEMBARQUE ) )) " + + " else " + + " BOL.IMPORTETAXAEMBARQUE " + + " END) AS tut, " + + + " (case " + + " when ( bol.indcancelacion = 1 ) " + + " then (-1 *(Abs( BOL.IMPORTEPEDAGIO ) )) " + + " else " + + " BOL.IMPORTEPEDAGIO " + + " END) AS pedagio, " + + + " BOL.NOMBPASAJERO AS nomepassageiro, " + + " BOL.DESCNUMDOC AS documento," + + " U.CVEUSUARIO AS bilheteiro, " + + " BOL.EMPRESACORRIDA_ID AS empresacorrida, " + + " EMP.NOMBEMPRESA AS empresa, " + + + " TPVTA.desctipo AS CANAL_DE_VENDA, " + + " BOL.DESCCORREO AS email, " + + " BOL.DESCTELEFONO AS telefone " + + + " FROM BOLETO BOL " + + " JOIN CONVENIO_DET CONV_D ON CONV_D.CONVENIODET_ID = BOL.CONVENIODET_ID " + + " JOIN CONVENIO CONV ON CONV.CONVENIO_ID = CONV_D.CONVENIO_ID " + + " JOIN PUNTO_VENTA PUNT_V ON PUNT_V.PUNTOVENTA_ID = BOL.PUNTOVENTA_ID " + + " JOIN TIPO_PTOVTA TPVTA ON PUNT_V.TIPOPTOVTA_ID = TPVTA.TIPOPTOVTA_ID " + + + " JOIN PARADA ORIG ON ORIG.PARADA_ID = BOL.ORIGEN_ID " + + " JOIN PARADA DEST ON DEST.PARADA_ID = BOL.DESTINO_ID " + + " INNER JOIN USUARIO U ON U.USUARIO_ID = BOL.USUARIO_ID " + + " JOIN EMPRESA EMP ON EMP.EMPRESA_ID = BOL.EMPRESACORRIDA_ID " + + " WHERE " + + " BOL.INDSTATUSOPERACION = 'F' " + + " AND BOL.ACTIVO = 1 " + + " AND BOL.FECHORVENTA BETWEEN :fecVentaInicial AND :fecVentaFinal "; + + if(!((String)parametros.get("EMPRESAIDS")).equals("")){ + query +=" AND BOL.EMPRESACORRIDA_ID IN ( " + (String)parametros.get("EMPRESAIDS") + ")" ; + } + + if(idPuntoVenta != null && idPuntoVenta != -1) { + query += " AND (BOL.PUNTOVENTA_ID = :idPuntoVenta) "; + } + if (codconvenio != null && !codconvenio.isEmpty()) { + query += " AND (CONV.CVECONVENIO = :codconvenio)"; + } + + if (tipoPuntoVenta != null && tipoPuntoVenta != -1) { + query += " AND (PUNT_V.TIPOPTOVTA_ID = :tipoPuntoVenta)"; + } + + query += " ORDER BY BOL.EMPRESACORRIDA_ID, (CONV.CVECONVENIO || ' - ' || CONV.DESCCONVENIO)"; + + return query; + } + + @Override + protected void processaParametros() throws Exception {} +} \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDescontosTipo2_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDescontosTipo2_es.properties new file mode 100644 index 000000000..7221b71de --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDescontosTipo2_es.properties @@ -0,0 +1,29 @@ +label.codConvenio = Convênio +label.fecVentaInicial = Data da Venda Inicial: +label.fecVentaFinal = Data da Venda Final: +label.puntoVenta = Agência: +cabecalho.dataHora = Data/Hora: +cabecalho.impressorPor = Impresso por: +cabecalho.pagina = Página +cabecalho.de = de +label.empresa = Empresa +label.codigo = Código: +label.nomeAgencia = Agc. Emissora +label.dataEmissao = Data Emissão +label.dataViagem = Data Viagem +label.codServico = Serviço +label.codOrigem = Origem +label.codDestino = Destino +label.tarifaComDesconto = Tarifa c/ des +label.tut = TUT +label.pedagio = Pedágio +label.totalPorConvenio = Total deste Convênio +label.totalGeral = Total Geral +label.total = Total +msg.noData = Não foi possivel obter dados com os parâmetros informados. +label.bilheteiro = Bilheteiro +label.nomepassageiro = Passageiro +label.documentopassageiro = Doc. P. +label.canalDeVenda = Canal Venda +label.email = e-mail +label.telefone = Telefone \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDescontosTipo2_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDescontosTipo2_pt_BR.properties new file mode 100644 index 000000000..7221b71de --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDescontosTipo2_pt_BR.properties @@ -0,0 +1,29 @@ +label.codConvenio = Convênio +label.fecVentaInicial = Data da Venda Inicial: +label.fecVentaFinal = Data da Venda Final: +label.puntoVenta = Agência: +cabecalho.dataHora = Data/Hora: +cabecalho.impressorPor = Impresso por: +cabecalho.pagina = Página +cabecalho.de = de +label.empresa = Empresa +label.codigo = Código: +label.nomeAgencia = Agc. Emissora +label.dataEmissao = Data Emissão +label.dataViagem = Data Viagem +label.codServico = Serviço +label.codOrigem = Origem +label.codDestino = Destino +label.tarifaComDesconto = Tarifa c/ des +label.tut = TUT +label.pedagio = Pedágio +label.totalPorConvenio = Total deste Convênio +label.totalGeral = Total Geral +label.total = Total +msg.noData = Não foi possivel obter dados com os parâmetros informados. +label.bilheteiro = Bilheteiro +label.nomepassageiro = Passageiro +label.documentopassageiro = Doc. P. +label.canalDeVenda = Canal Venda +label.email = e-mail +label.telefone = Telefone \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDescontosTipo2.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDescontosTipo2.jasper new file mode 100644 index 000000000..da20f8f6f Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDescontosTipo2.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDescontosTipo2.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDescontosTipo2.jrxml new file mode 100644 index 000000000..8c9037e5d --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDescontosTipo2.jrxml @@ -0,0 +1,617 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <band height="102" splitType="Stretch"> + <textField isStretchWithOverflow="true" pattern="dd/MM/yyyy HH:mm" isBlankWhenNull="false"> + <reportElement uuid="b8a08223-0a24-43a7-8ebe-17a3db2d83fe" mode="Transparent" x="1124" y="59" width="73" height="24" forecolor="#000000" backcolor="#FFFFFF"/> + <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none"> + <font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/> + <paragraph lineSpacing="Single"/> + </textElement> + <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement uuid="d095c344-00e0-4532-8035-8b93ef192a56" x="1024" y="59" width="100" height="24"/> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <font size="8" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$R{cabecalho.dataHora}]]></textFieldExpression> + </textField> + <textField pattern="" isBlankWhenNull="false"> + <reportElement uuid="eceda28e-b177-4d40-a99f-bce905486f71" mode="Transparent" x="0" y="0" width="1200" height="25" forecolor="#000000" backcolor="#FFFFFF"/> + <box> + <pen lineWidth="0.5"/> + <topPen lineWidth="0.5"/> + <leftPen lineWidth="0.5"/> + <bottomPen lineWidth="0.5"/> + <rightPen lineWidth="0.5"/> + </box> + <textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none"> + <font fontName="SansSerif" size="18" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/> + <paragraph lineSpacing="Single"/> + </textElement> + <textFieldExpression><![CDATA[$P{nomeRelatorio}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true" evaluationTime="Report" pattern="" isBlankWhenNull="false"> + <reportElement uuid="17bc8d21-5221-4757-ade1-9b3d1b4c10ce" mode="Transparent" x="1178" y="46" width="19" height="12" forecolor="#000000" backcolor="#FFFFFF"/> + <textElement textAlignment="Center" verticalAlignment="Top" rotation="None" markup="none"> + <font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/> + <paragraph lineSpacing="Single"/> + </textElement> + <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false"> + <reportElement uuid="8857ff4c-243b-4073-9466-98722a23eccf" mode="Transparent" x="1024" y="32" width="173" height="12" forecolor="#000000" backcolor="#FFFFFF"/> + <textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none"> + <font fontName="SansSerif" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/> + <paragraph lineSpacing="Single"/> + </textElement> + <textFieldExpression><![CDATA[$R{cabecalho.pagina} + " " + $V{PAGE_NUMBER} + " " + $R{cabecalho.de}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true"> + <reportElement uuid="65e099b5-ddc7-4f45-a453-38ab8cc4cb7c" mode="Transparent" x="1024" y="84" width="173" height="12" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" forecolor="#000000" backcolor="#FFFFFF"/> + <textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none"> + <font fontName="SansSerif" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/> + <paragraph lineSpacing="Single"/> + </textElement> + <textFieldExpression><![CDATA[$R{cabecalho.impressorPor} + " " + $P{usuario}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true" pattern="dd/MM/yyyy"> + <reportElement uuid="145289a7-0f0a-4aa0-aab7-2bad8b44292e" x="113" y="49" width="100" height="12" isPrintWhenDetailOverflows="true"/> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{fecVentaInicial}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true" pattern="dd/MM/yyyy"> + <reportElement uuid="74a3108b-f2bf-4a05-8a0e-ef3bc6e23e78" x="113" y="61" width="100" height="12" isPrintWhenDetailOverflows="true"/> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{fecVentaFinal}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true" isBlankWhenNull="true"> + <reportElement uuid="4ea6cfd8-2183-4d3a-b7fc-51ece4715dd9" x="113" y="37" width="100" height="12" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true"/> + <textElement> + <font size="8"/> + <paragraph lineSpacing="Single"/> + </textElement> + <textFieldExpression><![CDATA[$P{codconvenio}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true" isBlankWhenNull="true"> + <reportElement uuid="c95a7200-7032-4a56-abca-615be605f781" x="113" y="73" width="100" height="12" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true"/> + <textElement> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{puntoVenta}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement uuid="0fb0788e-1dae-4756-8d2d-076ed62e733c" x="3" y="37" width="110" height="12"> + <printWhenExpression><![CDATA[new Boolean($P{codconvenio} != null && !$P{codconvenio}.isEmpty())]]></printWhenExpression> + </reportElement> + <textElement> + <font size="8" isBold="false" pdfFontName="Helvetica-Bold"/> + </textElement> + <textFieldExpression><![CDATA[$R{label.codConvenio}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement uuid="1ffb28ce-353b-45c6-95a3-ba5c40faa4b5" x="3" y="49" width="110" height="12"/> + <textElement> + <font size="8" isBold="false" pdfFontName="Helvetica-Bold"/> + </textElement> + <textFieldExpression><![CDATA[$R{label.fecVentaInicial}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement uuid="c52ee81b-b6a0-44cd-b0e0-c61177419f22" x="3" y="61" width="110" height="12"/> + <textElement> + <font size="8" isBold="false" pdfFontName="Helvetica-Bold"/> + </textElement> + <textFieldExpression><![CDATA[$R{label.fecVentaFinal}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement uuid="2c80eede-1c35-4bec-8c97-3ea0ea54ed16" x="3" y="73" width="110" height="12"> + <printWhenExpression><![CDATA[new Boolean($P{puntoVenta} != null)]]></printWhenExpression> + </reportElement> + <textElement> + <font size="8" isBold="false" pdfFontName="Helvetica-Bold"/> + </textElement> + <textFieldExpression><![CDATA[$R{label.puntoVenta}]]></textFieldExpression> + </textField> + <line> + <reportElement uuid="d6ec8319-dcf8-42f7-bb0f-64235db1f2da" x="40" y="97" width="1157" height="1"/> + <graphicElement> + <pen lineWidth="0.5"/> + </graphicElement> + </line> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioDescontosController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioDescontosController.java index e6c8133c7..7c21bc5ac 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioDescontosController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioDescontosController.java @@ -15,14 +15,20 @@ import org.zkoss.util.resource.Labels; import org.zkoss.zhtml.Messagebox; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; +import org.zkoss.zul.Combobox; +import org.zkoss.zul.Comboitem; import org.zkoss.zul.Datebox; import org.zkoss.zul.Paging; +import org.zkoss.zul.Radiogroup; import org.zkoss.zul.Textbox; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioDescontos; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioDescontosTipo2; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; @@ -42,6 +48,9 @@ public class RelatorioDescontosController extends MyGenericForwardComposer { @Autowired private transient PagedListWrapper plwEmpresa; + @Autowired + private TipoPuntoVentaService tipoPuntoVentaService; + private MyComboboxPuntoVenta cmbAgencia; private Datebox fecVentaInicial; private Datebox fecVentaFinal; @@ -51,12 +60,16 @@ public class RelatorioDescontosController extends MyGenericForwardComposer { private Paging pagingEmpresaSel; private MyListbox empresaList; private MyListbox empresaSelList; + private Combobox cmbTipoPontoVenta; + private List lsTipoPuntoVenta; + private Radiogroup rdbGroup; @Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); empresaList.setItemRenderer(new RenderRelatorioGenericoEmpresasSel()); empresaSelList.setItemRenderer(new RenderRelatorioGenericoEmpresasSel()); + lsTipoPuntoVenta = tipoPuntoVentaService.obtenerTodos(); } public void onClick$btnExecutarRelatorio(Event ev) throws Exception { @@ -84,6 +97,7 @@ public class RelatorioDescontosController extends MyGenericForwardComposer { executarRelatorio(); } + @SuppressWarnings({ "rawtypes", "unchecked"}) private void executarRelatorio() throws Exception { Map parametros = new HashMap(); parametros.put("fecVentaInicial", fecVentaInicial.getValue()); @@ -110,7 +124,20 @@ public class RelatorioDescontosController extends MyGenericForwardComposer { } parametros.put("EMPRESAIDS", empresaIds.toString()); - Relatorio relatorio = new RelatorioDescontos(parametros, dataSourceRead.getConnection()); + Comboitem itemTipoPontoVenta = cmbTipoPontoVenta.getSelectedItem(); + + if (itemTipoPontoVenta != null) { + TipoPuntoVenta tipoPontoVenta = (TipoPuntoVenta) itemTipoPontoVenta.getValue(); + parametros.put("tipoPuntoVenta", tipoPontoVenta == null ? null : tipoPontoVenta.getTipoptovtaId().intValue()); + } + + Relatorio relatorio; + if(rdbGroup.getSelectedItem().getValue().equals("1")) { + relatorio = new RelatorioDescontos(parametros, dataSourceRead.getConnection()); + } else { + relatorio = new RelatorioDescontosTipo2(parametros, dataSourceRead.getConnection()); + } + Map args = new HashMap(); args.put("relatorio", relatorio); @@ -238,5 +265,20 @@ public class RelatorioDescontosController extends MyGenericForwardComposer { public void setEmpresaList(MyListbox empresaList) { this.empresaList = empresaList; } - + + public Combobox getCmbTipoPontoVenta() { + return cmbTipoPontoVenta; + } + + public void setCmbTipoPontoVenta(Combobox cmbTipoPontoVenta) { + this.cmbTipoPontoVenta = cmbTipoPontoVenta; + } + + public List getLsTipoPuntoVenta() { + return lsTipoPuntoVenta; + } + + public void setLsTipoPuntoVenta(List lsTipoPuntoVenta) { + this.lsTipoPuntoVenta = lsTipoPuntoVenta; + } } \ No newline at end of file diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index 79dd318dd..4b91c00e3 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -7449,6 +7449,9 @@ relatorioDescontosController.lbEmpresa.value = Empresa relatorioDescontosController.btnPesquisa.label = Buscar relatorioDescontosController.btnLimpar.label = Limpar relatorioDescontosController.lbIdEmpresa.value = Id +relatorioDescontosController.lbTipoRelatorio.value= Tipo Relatório: +relatorioDescontosController.lbTipoRelatorioTipo1.value= Tipo 1 +relatorioDescontosController.lbTipoRelatorioTipo2.value= Tipo 2 # Filtro Relatorio de Agências Não Importadas filtroRelatorioAgenciasNaoImportadas.lbDataIni.value = Fecha Inicio diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 66c27352c..b2c17e686 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -7989,6 +7989,9 @@ relatorioDescontosController.lbEmpresa.value = Empresa relatorioDescontosController.btnPesquisa.label = Buscar relatorioDescontosController.btnLimpar.label = Limpar relatorioDescontosController.lbIdEmpresa.value = Id +relatorioDescontosController.lbTipoRelatorio.value= Tipo Relatório: +relatorioDescontosController.lbTipoRelatorioTipo1.value= Tipo 1 +relatorioDescontosController.lbTipoRelatorioTipo2.value= Tipo 2 indexController.mniRelatorioAgenciaFechamento.label= Resumo Venda por Agencia diff --git a/web/gui/relatorios/filtroRelatorioDescontos.zul b/web/gui/relatorios/filtroRelatorioDescontos.zul index 14c5bff11..4226ac2f0 100644 --- a/web/gui/relatorios/filtroRelatorioDescontos.zul +++ b/web/gui/relatorios/filtroRelatorioDescontos.zul @@ -5,7 +5,7 @@ - + @@ -29,6 +29,14 @@ + + + + +