diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTaxasLinha.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTaxasLinha.java index 49ad0a06d..fd63c97e2 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTaxasLinha.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTaxasLinha.java @@ -28,15 +28,14 @@ public class RelatorioTaxasLinha extends Relatorio { */ public RelatorioTaxasLinha(Map parametros, Connection conexao) throws Exception { super(parametros, conexao); - // TODO Auto-generated constructor stub this.setCustomDataSource(new DataSource(this) { public void initDados() throws Exception { - Connection conexao = this.relatorio.getConexao(); Map parametros = this.relatorio.getParametros(); - String sql = getSql(); + String puntosVentaIds = (String) parametros.get("NUMPUNTOVENTA"); + String sql = getSql(puntosVentaIds); NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); stmt.setInt("TIPO_DATA", (Integer) parametros.get("TIPO_DATA")); @@ -48,11 +47,6 @@ public class RelatorioTaxasLinha extends Relatorio { else stmt.setNull("EMPRESA_ID", java.sql.Types.INTEGER); - if (parametros.get("NUMPUNTOVENTA") != null) - stmt.setString("NUMPUNTOVENTA", (String) parametros.get("NUMPUNTOVENTA")); - else - stmt.setNull("NUMPUNTOVENTA", java.sql.Types.VARCHAR); - if (parametros.get("ORIGEN_ID") != null) stmt.setInt("ORIGEN_ID", (Integer) parametros.get("ORIGEN_ID")); else @@ -64,7 +58,6 @@ public class RelatorioTaxasLinha extends Relatorio { stmt.setNull("DESTINO_ID", java.sql.Types.INTEGER); this.resultSet = stmt.executeQuery(); - } public Object valueCustomFields(String fieldName) throws Exception { @@ -110,7 +103,6 @@ public class RelatorioTaxasLinha extends Relatorio { } return null; } - }); } @@ -121,8 +113,6 @@ public class RelatorioTaxasLinha extends Relatorio { */ @Override protected void processaParametros() throws Exception { - // TODO Auto-generated method stub - } public HashMap getConfigImposto(Integer puntoVentaId) throws Exception { @@ -140,8 +130,7 @@ public class RelatorioTaxasLinha extends Relatorio { return cacheConfig; } - private String getSql() { - + private String getSql(String puntosVentaIds) { StringBuilder sql = new StringBuilder(); sql.append(" SELECT RT.PREFIXO, "); @@ -187,7 +176,11 @@ public class RelatorioTaxasLinha extends Relatorio { sql.append(" AND DECODE(:TIPO_DATA, 1, CJ.FECCORRIDA, 2, CJ.FECHORVENTA) BETWEEN "); sql.append(" :DATA_INICIAL AND :DATA_FINAL "); sql.append(" AND EM.EMPRESA_ID = NVL(:EMPRESA_ID, EM.EMPRESA_ID) "); - sql.append(" AND PV.NUMPUNTOVENTA = NVL(:NUMPUNTOVENTA, PV.NUMPUNTOVENTA) "); + + if (!puntosVentaIds.equals("Todas")) { + sql.append(" AND PV.NUMPUNTOVENTA IN (").append(puntosVentaIds).append(") "); + } + sql.append(" AND PO.PARADA_ID = NVL(:ORIGEN_ID, PO.PARADA_ID) "); sql.append(" AND PD.PARADA_ID = NVL(:DESTINO_ID, PD.PARADA_ID) "); sql.append(" GROUP BY RT.PREFIXO, "); @@ -205,5 +198,4 @@ public class RelatorioTaxasLinha extends Relatorio { return sql.toString(); } - } diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTaxasLinha.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTaxasLinha.jasper index 51fa6b743..0bcd6f4a9 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTaxasLinha.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTaxasLinha.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTaxasLinha.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTaxasLinha.jrxml index 8bad4edee..068996cbf 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTaxasLinha.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTaxasLinha.jrxml @@ -1,7 +1,7 @@ - - + +