diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioReceitaDiariaAgencia.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioReceitaDiariaAgencia.java index 5bfc3b57d..4ed79eaaa 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioReceitaDiariaAgencia.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioReceitaDiariaAgencia.java @@ -13,6 +13,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +import com.rjconsultores.ventaboletos.entidad.Estado; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.relatorios.negocio.CalculoImposto; import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource; @@ -48,10 +49,10 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio { return BigDecimal.ZERO; } else if (fieldName.equals("RECEITA_TOTAL")) { - return ((BigDecimal) this.getByName("RECEITA_TARIFA")).add((BigDecimal) this.getByName("RECEITA_SEGURO")).add((BigDecimal) this.getByName("RECEITA_BAGAGEM")).subtract((BigDecimal) this.getByName("TOTAL_DEVOL")); + return ((BigDecimal) this.getByName("RECEITA_TARIFA")).add((BigDecimal) this.getByName("RECEITA_SEGURO")).add((BigDecimal) this.getByName("RECEITA_BAGAGEM")).add((BigDecimal) this.getByName("RECEITA_EMBARQUE")).subtract((BigDecimal) this.getByName("TOTAL_DEVOL")); } else if (fieldName.equals("RECEITA_LIQUIDA")) { - return ((BigDecimal) this.getByName("RECEITA_TARIFA")).add((BigDecimal) this.getByName("RECEITA_SEGURO")).add((BigDecimal) this.getByName("RECEITA_BAGAGEM")).subtract((BigDecimal) this.getByName("TOTAL_DEVOL")).subtract((BigDecimal) this.getByName("IMPOSTOS")); + return ((BigDecimal) this.getByName("RECEITA_TARIFA")).add((BigDecimal) this.getByName("RECEITA_SEGURO")).add((BigDecimal) this.getByName("RECEITA_BAGAGEM")).add((BigDecimal) this.getByName("RECEITA_EMBARQUE")).subtract((BigDecimal) this.getByName("TOTAL_DEVOL")).subtract((BigDecimal) this.getByName("IMPOSTOS")); } else if (fieldName.equals("DIFERENCA_COMISSAO")) { return ((BigDecimal) this.getByName("VALOR_COMISSAO")).subtract((BigDecimal) this.getByName("ANTECIPACAO")); @@ -78,10 +79,23 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio { else stmt.setString("NUMPUNTOVENTA", null); - if (parametros.get("ESTADO_ID") != null) - stmt.setInt("ESTADO_ID", (Integer) parametros.get("ESTADO_ID")); - else + if (parametros.get("ESTADO_ID") != null){ + StringBuilder strEstadoList = new StringBuilder(); + + for (Estado s : (ArrayList) parametros.get("ESTADO_ID")) { + strEstadoList.append("," + s.getEstadoId() + ","); + } + + stmt.setString("ESTADO_ID", strEstadoList.toString()); + stmt.setString("ISESTADOTODOS", "N"); + } + else{ stmt.setNull("ESTADO_ID", java.sql.Types.INTEGER); + stmt.setString("ISESTADOTODOS", "S"); + + } + + if (parametros.get("EMPRESA_ID") != null) stmt.setInt("EMPRESA_ID", (Integer) parametros.get("EMPRESA_ID")); else @@ -274,6 +288,9 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio { row.put("RECEITA_OUTROS_GAP", ((BigDecimal) row.get("RECEITA_OUTROS_GAP")).add((tipoVentaId.equals(18) || tipoVentaId.equals(39)) && this.resultSet.getBigDecimal("IMPORTEOUTROS") != null ? this.resultSet.getBigDecimal("IMPORTEOUTROS") : BigDecimal.ZERO)); row.put("RECEITA_PEDAGIO", ((BigDecimal) row.get("RECEITA_PEDAGIO")).add(!tipoVentaId.equals(18) && !tipoVentaId.equals(39) && this.resultSet.getBigDecimal("IMPORTEPEDAGIO") != null ? this.resultSet.getBigDecimal("IMPORTEPEDAGIO") : BigDecimal.ZERO)); row.put("RECEITA_PEDAGIO_GAP", ((BigDecimal) row.get("RECEITA_PEDAGIO_GAP")).add((tipoVentaId.equals(18) || tipoVentaId.equals(39)) && this.resultSet.getBigDecimal("IMPORTEPEDAGIO") != null ? this.resultSet.getBigDecimal("IMPORTEPEDAGIO") : BigDecimal.ZERO)); + row.put("RECEITA_EMBARQUE", ((BigDecimal) row.get("RECEITA_EMBARQUE")).add(!tipoVentaId.equals(18) && !tipoVentaId.equals(39) && this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") != null ? this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") : BigDecimal.ZERO)); + row.put("RECEITA_EMBARQUE_GAP", ((BigDecimal) row.get("RECEITA_EMBARQUE_GAP")).add((tipoVentaId.equals(18) || tipoVentaId.equals(39)) && this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") != null ? this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") : BigDecimal.ZERO)); + row.put("IMPOSTOS", ((BigDecimal) row.get("IMPOSTOS")).add(!tipoVentaId.equals(18) || (tipoVentaId.equals(18) && (Boolean) this.relatorio.getParametros().get("B_CONTEMPLAR_GAP")) ? getValorImposto(puntoVentaId, this.resultSet.getString("INTERESTADUAL"), this.resultSet.getBigDecimal("PRECIOPAGADO"), this.resultSet.getBigDecimal("IMPORTESEGURO"), this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE"), this.resultSet.getBigDecimal("IMPORTEPEDAGIO")) : BigDecimal.ZERO)); // Realiza os calculos de comissão se o tipo de venda não for "EM ABERTO" e se for venda normal, ou se for GAP e o check estiver marcado if (!tipoVentaId.equals(9) && ((!tipoVentaId.equals(18) && !tipoVentaId.equals(39)) || ((tipoVentaId.equals(18) || tipoVentaId.equals(39)) && (Boolean) this.relatorio.getParametros().get("B_CONTEMPLAR_GAP")))) @@ -556,10 +573,12 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio { sql.append(" AND CJ.INDREIMPRESION = 0 "); sql.append(" AND PV.TIPOPTOVTA_ID = NVL(:TIPOPTOVTA_ID, PV.TIPOPTOVTA_ID) "); sql.append(" AND TP.TIPOPTOVTA_ID = PV.TIPOPTOVTA_ID "); - sql.append(" AND CJ.EMPRESAPUNTOVENTA_ID = NVL(:EMPRESA_ID, CJ.EMPRESAPUNTOVENTA_ID) "); - sql.append(" AND ES.ESTADO_ID = NVL(:ESTADO_ID, ES.ESTADO_ID) "); + sql.append(" AND CJ.EMPRESACORRIDA_ID = NVL(:EMPRESA_ID, CJ.EMPRESACORRIDA_ID) "); + //sql.append(" AND ES.ESTADO_ID = NVL(:ESTADO_ID, ES.ESTADO_ID) "); sql.append(" AND ((INSTR(:NUMPUNTOVENTA, ',' || TRIM(PV.NUMPUNTOVENTA) || ',') > 0 AND "); sql.append(" :ISNUMPUNTOVENTATODOS = 'N') OR (:ISNUMPUNTOVENTATODOS = 'S')) "); + sql.append(" AND ((INSTR(:ESTADO_ID, ',' || TRIM(ES.ESTADO_ID) || ',') > 0 AND "); + sql.append(" :ISESTADOTODOS = 'N') OR (:ISESTADOTODOS = 'S')) "); return sql.toString(); } diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jasper index 3ba3c58cc..0a7e4d34a 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jrxml index 81a169597..ab459343d 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioReceitaDiariaAgencia.jrxml @@ -1,7 +1,7 @@ - - - + + +