diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java index f30584e33..0758ee2b4 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java @@ -604,7 +604,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { sql.append(" inner join ciudad cd on d.ciudad_id = cd.ciudad_id "); sql.append(" inner join estado ed on ed.estado_id = cd.estado_id "); sql.append(" left join empresa_imposto ei on ei.empresa_id = ep.empresa_id and ei.estado_id = e.estado_id and ei.activo = 1 "); - sql.append("where c.activo = 1 and bpe.tipoamb = 1 bpe.codstat in (100,150) "); + sql.append("where c.activo = 1 and bpe.tipoamb = 1 and bpe.codstat in (100,150) "); sql.append(" and (bpe.tipoevento <> 110115 or bpe.tipoevento is null) "); sql.append(" and (to_char(bpe.fecmodif, 'mm/yyyy') < to_char(bpecan.fecmodif, 'mm/yyyy') or bpecan.fecmodif is null) "); sql.append(" and (case when ei.indtribviagem = 1 then c.fechorviaje else c.feccreacion end) >= :DATE_INICIO "); @@ -685,7 +685,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { sql.append(" left join boleto bant on bant.boleto_id = (case when bpeori.tipoevento is not null then coalesce(b.boletoanterior_id, b.boletooriginal_id) else null end) "); sql.append(" left join bpe bpeant on bpeant.boleto_id = bant.boleto_id "); sql.append(" left join punto_venta ptvo on ptvo.puntoventa_id = coalesce(bant.puntoventa_id, bori.puntoventa_id,b.ptovtaventa_id) "); - sql.append("where (bpe.codstat in (100,135,150) and bpe.chbpe_substituicao is not null "); + sql.append("where ( (bpe.codstat in (100,135,150) and bpe.chbpe_substituicao is not null) "); sql.append(" or (bpe.codstat = 135 and to_char(b.feccreacion, 'mm/yyyy') < to_char(bori.feccreacion, 'mm/yyyy')) ) "); sql.append(" and (bpe.codstat in (100,135,150) and bpe.tipoevento <> 110115 or bpe.tipoevento is null) "); sql.append(" and (bpe.codstat in (100,135,150) and bpeori.tipoevento <> 110115 or bpeori.tipoevento is null) ");