diff --git a/pom.xml b/pom.xml
index 503f9bf7e..b92b41c26 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
br.com.rjconsultores
ModelWeb
- 1.52.0
+ 1.53.0
diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java
index 0fba72dee..ecdf3447e 100644
--- a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java
+++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java
@@ -905,8 +905,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
sql.append(" bpe.pRedBC ");
sql.append("from boleto c ");
sql.append(" join bpe bpe on c.boleto_id = bpe.boleto_id ");
- sql.append(" and bpe.activo = (case when TO_CHAR(c.feccreacion, 'yyyymmdd') <> ");
- sql.append(" to_char(to_date(substr(bpe.dhrecbto,0,10), 'YYYY-MM-DD'), 'yyyymmdd') then 0 else 1 end) ");
+ sql.append(" and bpe.activo = (case when c.motivocancelacion_id = 17 and c.boletooriginal_id is null then 0 else 1 end)");
sql.append(" join estado e on e.codibge = bpe.uf ");
sql.append(" join marca ma on c.marca_id = ma.marca_id ");
sql.append(" join empresa ep on ma.empresa_id = ep.empresa_id ");
@@ -1001,8 +1000,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
sql.append(" inner join marca m on m.marca_id = bori.marca_id and m.activo = 1 ");
sql.append(" inner join empresa e on e.empresa_id = m.empresa_id ");
sql.append(" inner join bpe bpe on bpe.boleto_id = bori.boleto_id ");
- sql.append(" and bpe.activo = (case when TO_CHAR(bori.feccreacion, 'yyyymmdd') <> ");
- sql.append(" to_char(to_date(substr(bpe.dhrecbto,0,10), 'YYYY-MM-DD'), 'yyyymmdd') then 0 else 1 end) ");
+ sql.append(" and bpe.activo = (case when bori.motivocancelacion_id = 17 and bori.boletooriginal_id is null then 0 else 1 end) ");
sql.append(" inner join estado est_bpe on bpe.uf = est_bpe.codibge ");
sql.append(" left join bpe bpeori on bpeori.chbpe = bpe.chbpe_substituicao and bpeori.activo = 1 ");
sql.append(" left join boleto b on b.boleto_id = bpeori.boleto_id ");
@@ -1102,8 +1100,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
sql.append(" inner join marca m on m.marca_id = bori.marca_id and m.activo = 1 ");
sql.append(" inner join empresa e on e.empresa_id = m.empresa_id ");
sql.append(" inner join bpe bpe on bpe.boleto_id = bori.boleto_id ");
- sql.append(" and bpe.activo = (case when TO_CHAR(bori.feccreacion, 'yyyymmdd') <> ");
- sql.append(" to_char(to_date(substr(bpe.dhrecbto,0,10), 'YYYY-MM-DD'), 'yyyymmdd') then 0 else 1 end) ");
+ sql.append(" and (case when bori.motivocancelacion_id = 17 and bori.boletooriginal_id is null then 0 else 1 end) ");
sql.append(" inner join estado est_bpe on bpe.uf = est_bpe.codibge ");
sql.append(" left join boleto b on b.boleto_id = coalesce(bori.boletoanterior_id, bori.boletooriginal_id) ");
sql.append(" left join bpe bpeori on b.boleto_id = bpeori.boleto_id and bpeori.activo = 1 ");