diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioCancelamentoVendaCartao.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioCancelamentoVendaCartao.java index 4c9217b76..1a9479b41 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioCancelamentoVendaCartao.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioCancelamentoVendaCartao.java @@ -8,6 +8,7 @@ import java.util.HashMap; import java.util.Map; import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.enums.TipoFormapago; import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.service.ConstanteService; @@ -28,14 +29,12 @@ public class RelatorioCancelamentoVendaCartao extends Relatorio { public void initDados() throws Exception { Connection conexao = this.relatorio.getConexao(); Map parametros = this.relatorio.getParametros(); - final Integer CARTAO_CREDITO = 2; String sql = getSql(); NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); stmt.setTimestamp("data_inicial", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime())); stmt.setTimestamp("data_final", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).getTime())); - stmt.setInt("formaPagoCredito", CARTAO_CREDITO); stmt.setInt("empresaId", Integer.valueOf(parametros.get("EMPRESA_ID") + "")); ResultSet rset = stmt.executeQuery(); @@ -72,6 +71,9 @@ public class RelatorioCancelamentoVendaCartao extends Relatorio { } private String getSql() { + final int FORMA_PAGO_CREDITO = 2; + final int FORMA_PAGO_DEBITO = 3; + String tiposFormapago = String.format("%d, %d", FORMA_PAGO_CREDITO, FORMA_PAGO_DEBITO); StringBuilder sql = new StringBuilder(); /* Boletos apenas com venda e cancelamento direto com corrida */ @@ -101,7 +103,7 @@ public class RelatorioCancelamentoVendaCartao extends Relatorio { .append("INNER JOIN PUNTO_VENTA PO ON PO.PUNTOVENTA_ID = O.PUNTOVENTA_ID ") .append("WHERE O.FECINC BETWEEN :data_inicial AND :data_final ") .append("AND O.NSU is not null ") - .append("AND BFP.FORMAPAGO_ID = :formaPagoCredito ") + .append("AND BFP.FORMAPAGO_ID in ("+tiposFormapago+" ) ") .append("AND M.EMPRESA_ID = :empresaId "); if (parametros.get("NUMPUNTOVENTA") != null) { @@ -149,7 +151,7 @@ public class RelatorioCancelamentoVendaCartao extends Relatorio { .append("INNER JOIN PUNTO_VENTA PO ON PO.PUNTOVENTA_ID = O.PUNTOVENTA_ID ") .append("WHERE O.FECINC BETWEEN :data_inicial AND :data_final ") .append("AND O.NSU is not null ") - .append("AND BFP.FORMAPAGO_ID = :formaPagoCredito ") + .append("AND BFP.FORMAPAGO_ID in ("+tiposFormapago+" ) ") .append("AND M.EMPRESA_ID = :empresaId "); if (parametros.get("NUMPUNTOVENTA") != null) { @@ -197,7 +199,7 @@ public class RelatorioCancelamentoVendaCartao extends Relatorio { .append("INNER JOIN PUNTO_VENTA PO ON PO.PUNTOVENTA_ID = O.PUNTOVENTA_ID ") .append("WHERE O.FECINC BETWEEN :data_inicial AND :data_final ") .append("AND O.NSU is not null ") - .append("AND BFP.FORMAPAGO_ID = :formaPagoCredito ") + .append("AND BFP.FORMAPAGO_ID in ("+tiposFormapago+" ) ") .append("AND M.EMPRESA_ID = :empresaId "); if (parametros.get("NUMPUNTOVENTA") != null) {