From 032448c95735b853a830dd90de5e3c0453f65f92 Mon Sep 17 00:00:00 2001 From: julio Date: Wed, 15 May 2019 21:02:30 +0000 Subject: [PATCH] fixes bug#14368 dev:julio qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@93341 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../dao/hibernate/BpeHibernateDAO.java | 17 ++++++++++++----- .../exportacao/bpe/ExportacaoBPEVo.java | 11 +++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java index 5b00f965f..0fa0bd062 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java @@ -45,6 +45,9 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { @Override public ExportacaoBPEVo buscarRegistroExportacaoBpe(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado) { + + log.info("Inicio da consulta buscarRegistroExportacaoBpe: " + new Date()); + ExportacaoBPEVo exportacaoBPEVo = new ExportacaoBPEVo(); List registros = new ArrayList(); @@ -111,8 +114,8 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { sql.append(" and bpe.tipoamb = 1 and ep.activo = 1 "); sql.append(" and bpe.codstat in (100,101,102,135,150) "); sql.append(" and (bpe.tipoevento <> 110115 or bpe.tipoevento is null) "); - sql.append(" and (case when ei.indtribviagem = 1 then c.fechorviaje else c.feccreacion end) >= to_date(?,'DD/MM/YYYY HH24:MI:SS') "); - sql.append(" and (case when ei.indtribviagem = 1 then c.fechorviaje else c.feccreacion end) <= to_date(?,'DD/MM/YYYY HH24:MI:SS')"); + sql.append(" and c.feccreacion >= to_date(?,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and c.feccreacion <= to_date(?,'DD/MM/YYYY HH24:MI:SS') "); sql.append(" and ep.empresa_id = ? "); sql.append(" and e.cveestado = ? "); sql.append("order by to_number(c.numfoliosistema), to_number(num_bpe), dh_emisao "); @@ -123,7 +126,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { ps.setString(2, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); ps.setLong(3, Long.valueOf(empresaId)); ps.setString(4, cveestado); - + ResultSet rs = ps.executeQuery(); while (rs.next()) { @@ -194,6 +197,8 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { rs.close(); ps.close(); + log.info("Fim buscarRegistroExportacaoBpe: " + new Date()); + } catch (Exception e) { log.error(e.getMessage(), e); } @@ -622,8 +627,10 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { sql.append("where c.activo = 1 and bpe.tipoamb = 1 and bpe.codstat in (100,102,150) "); sql.append(" and (bpe.fecmodif < (case when (to_char(bpe.fecmodif, 'mm/yyyy') <> to_char(bpecan.fecmodif, 'mm/yyyy') ) "); sql.append(" then bpecan.fecmodif else bpe.fecmodif end) or bpecan.fecmodif is null) "); - sql.append(" and (case when ei.indtribviagem = 1 then c.fechorviaje else c.feccreacion end) >= :DATE_INICIO "); - sql.append(" and (case when ei.indtribviagem = 1 then c.fechorviaje else c.feccreacion end) <= :DATE_FIM "); +// sql.append(" and (case when ei.indtribviagem = 1 then c.fechorviaje else c.feccreacion end) >= :DATE_INICIO "); +// sql.append(" and (case when ei.indtribviagem = 1 then c.fechorviaje else c.feccreacion end) <= :DATE_FIM "); + sql.append(" and c.feccreacion >= :DATE_INICIO "); + sql.append(" and c.feccreacion <= :DATE_FIM "); sql.append(" and ep.empresa_id = :EMPRESA_ID "); sql.append(" and e.cveestado in ( ").append(ufs).append(" ) "); diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEVo.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEVo.java index 14596e7c1..56d43287f 100644 --- a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEVo.java +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEVo.java @@ -133,17 +133,20 @@ public class ExportacaoBPEVo { if (comp.getTpComp().equals(TipoComp.PEDAGIO)) { vPedagio = (isInterMunicipal && !registro.getIndPedadioEstdual()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; - vPedagio = (!isInterMunicipal && !registro.getIndPedagioMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; + if (vPedagio.equals("0.0")) + vPedagio = (!isInterMunicipal && !registro.getIndPedagioMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; } if (comp.getTpComp().equals(TipoComp.TAXA_EMBARQUE)) { vTxEmbarque = (isInterMunicipal && !registro.getIndTxEmbarqueEstadual()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; - vTxEmbarque = (!isInterMunicipal && !registro.getIndTxEmbarqueMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; + if (vTxEmbarque.equals("0.0")) + vTxEmbarque = (!isInterMunicipal && !registro.getIndTxEmbarqueMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; } if (comp.getTpComp().equals(TipoComp.SEGURO)) { vSeguro = (isInterMunicipal && !registro.getIndSeguroEstadual()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; - vSeguro = (!isInterMunicipal && !registro.getIndSeguroMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; + if (vSeguro.equals("0.0")) + vSeguro = (!isInterMunicipal && !registro.getIndSeguroMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; } } } @@ -209,7 +212,7 @@ public class ExportacaoBPEVo { BigDecimal isentas = registro.getValortotal().subtract(baseCalculoICMS); if (pRedBC != null) { - isentas = txEmbarque.add(pedagio).add(pedagio).add(seguro); + isentas = txEmbarque.add(pedagio).add(seguro); } BigDecimal outras = new BigDecimal(pRedBC == null ? "0.0" : pRedBC);