diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDevolucaoBilhetes.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDevolucaoBilhetes.java index d4d35a772..79d9156ce 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDevolucaoBilhetes.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioDevolucaoBilhetes.java @@ -44,7 +44,8 @@ public class RelatorioDevolucaoBilhetes extends Relatorio { Date dataDevolucaoInicial = parametros.get("dataDevolucaoInicial") == null ? null : (Date) parametros.get("dataDevolucaoInicial"); Date dataDevolucaoFinal = parametros.get("dataDevolucaoFinal") == null ? null : (Date) parametros.get("dataDevolucaoFinal"); Boolean isApenasBilhetesImpressos = parametros.get("isApenasBilhetesImpressos") == null ? Boolean.FALSE : Boolean.valueOf(parametros.get("isApenasBilhetesImpressos").toString()); - + Boolean isBpe = (Boolean) parametros.get("isBpe"); + String puntoVentas = null; for (PuntoVenta pv : lsPuntoVenta) { if (lsPuntoVenta.indexOf(pv) == 0) { @@ -63,7 +64,7 @@ public class RelatorioDevolucaoBilhetes extends Relatorio { } } - String sql = getSql(empresaId, puntoVentas, estados, dataVendaInicial, dataVendaFinal, dataDevolucaoInicial, dataDevolucaoFinal, isApenasBilhetesImpressos); + String sql = getSql(empresaId, puntoVentas, estados, dataVendaInicial, dataVendaFinal, dataDevolucaoInicial, dataDevolucaoFinal, isApenasBilhetesImpressos, isBpe); log.debug(sql); NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); @@ -130,6 +131,9 @@ public class RelatorioDevolucaoBilhetes extends Relatorio { db.setIsenta(rset.getInt("ISENTA") == 1); db.setTotalBilhete(rset.getBigDecimal("TOTAL")); + db.setChbpe((String) rset.getObject("CHBPE")); + db.setChbpeSubstituicao((String) rset.getObject("CHBPE_SUBSTITUICAO")); + db.setValorIcms(BigDecimal.ZERO); db.setValorIsenta(BigDecimal.ZERO); @@ -215,7 +219,7 @@ public class RelatorioDevolucaoBilhetes extends Relatorio { this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDev)); } - private String getSql(Integer empresaId, String puntoVentas, String estados, Date dataVendaInicial, Date dataVendaFinal, Date dataDevolucaoInicial, Date dataDevolucaoFinal, Boolean isApenasBilhetesImpressos) { + private String getSql(Integer empresaId, String puntoVentas, String estados, Date dataVendaInicial, Date dataVendaFinal, Date dataDevolucaoInicial, Date dataDevolucaoFinal, Boolean isApenasBilhetesImpressos, Boolean isBpe) { StringBuilder sql = new StringBuilder(); sql.append("SELECT DISTINCT "); @@ -248,6 +252,8 @@ public class RelatorioDevolucaoBilhetes extends Relatorio { sql.append(" NVL(EI.INDTARIFAMUNICIPAL,0) AS INDTARIFAMUNICIPAL, NVL(EI.INDSEGUROMUNICIPAL,0) AS INDSEGUROMUNICIPAL, NVL(EI.INDTXEMBARQUEMUNICIPAL,0) AS INDTXEMBARQUEMUNICIPAL, NVL(EI.INDPEDAGIOMUNICIPAL,0) AS INDPEDAGIOMUNICIPAL, "); sql.append(" NVL(EI.INDTARIFAESTADUAL,0) AS INDTARIFAESTADUAL, NVL(EI.INDSEGUROESTADUAL,0) AS INDSEGUROESTADUAL, NVL(EI.INDTXEMBARQUEESTADUAL,0) AS INDTXEMBARQUEESTADUAL, NVL(EI.INDPEDAGIOESTDUAL,0) AS INDPEDAGIOESTDUAL, "); sql.append(" NVL(B.PRECIOPAGADO,0) + NVL(B.IMPORTEOUTROS,0) + NVL(B.IMPORTEPEDAGIO,0) + NVL(B.IMPORTESEGURO,0) + NVL(B.IMPORTETAXAEMBARQUE,0) AS TOTAL "); + sql.append(isBpe ? ", BPE.CHBPE AS CHBPE " : " "); + sql.append(isBpe ? ", BPE.CHBPE_SUBSTITUICAO as CHBPE_SUBSTITUICAO " : " "); sql.append("FROM BOLETO B "); sql.append("INNER JOIN MARCA M ON M.MARCA_ID = B.MARCA_ID AND M.ACTIVO = 1 "); sql.append("INNER JOIN EMPRESA E ON E.EMPRESA_ID = M.EMPRESA_ID "); @@ -276,6 +282,7 @@ public class RelatorioDevolucaoBilhetes extends Relatorio { sql.append("LEFT JOIN AIDF AIDF ON AIDF.AIDF_ID = B.AIDF_ID AND B.TIPOVENTA_ID = 3 "); sql.append("LEFT JOIN ESTADO ESAIDF ON ESAIDF.ESTADO_ID = AIDF.ESTADO_ID "); sql.append("LEFT JOIN BOLETO BORI ON BORI.BOLETO_ID = B.BOLETOORIGINAL_ID "); + sql.append(isBpe ? "LEFT JOIN BPE BPE ON BPE.BOLETO_ID = B.BOLETO_ID " : ""); sql.append("WHERE B.MOTIVOCANCELACION_ID IN (31,32,10,37,99,36) "); sql.append("AND B.INDSTATUSBOLETO = 'C' "); sql.append("AND B.INDCANCELACION = 1 "); diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDevolucaoBilhetes_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDevolucaoBilhetes_es.properties index 6972352da..9db277c43 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDevolucaoBilhetes_es.properties +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDevolucaoBilhetes_es.properties @@ -31,4 +31,6 @@ label.outras=Outras label.fechorDevolucao=Dt Devolução label.impEstornarInterestadual=Receita Interestadual label.impEstornarIntermunicipal=Receita Intermunicipal -label.impEstornarTotal=ReceitaTotal \ No newline at end of file +label.impEstornarTotal=ReceitaTotal +label.chaveBpe=Chave BPE +label.chaveSubstituicaoBpe=Chave Substituição \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDevolucaoBilhetes_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDevolucaoBilhetes_pt_BR.properties index 6972352da..9db277c43 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDevolucaoBilhetes_pt_BR.properties +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioDevolucaoBilhetes_pt_BR.properties @@ -31,4 +31,6 @@ label.outras=Outras label.fechorDevolucao=Dt Devolução label.impEstornarInterestadual=Receita Interestadual label.impEstornarIntermunicipal=Receita Intermunicipal -label.impEstornarTotal=ReceitaTotal \ No newline at end of file +label.impEstornarTotal=ReceitaTotal +label.chaveBpe=Chave BPE +label.chaveSubstituicaoBpe=Chave Substituição \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDevolucaoBilhetes.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDevolucaoBilhetes.jasper index f39f7db57..3991834df 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDevolucaoBilhetes.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDevolucaoBilhetes.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDevolucaoBilhetes.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDevolucaoBilhetes.jrxml index 330b69a9b..952b5eeac 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDevolucaoBilhetes.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioDevolucaoBilhetes.jrxml @@ -1,8 +1,8 @@ - - + +