From 2cc7c9a4495990c5fa6b4b1672a63ad3ea026432 Mon Sep 17 00:00:00 2001 From: julio Date: Fri, 11 Jan 2019 18:15:05 +0000 Subject: [PATCH] fixes bug#13207 dev:julio qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@88781 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../dao/hibernate/BpeHibernateDAO.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java index 33b6c4747..40f6f931a 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java @@ -64,7 +64,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { sql.append(" bpe.chbpe, "); sql.append(" coalesce(chbpe_substituicao, ' ') as chbpe_sub, "); sql.append(" to_char(c.feccreacion, 'yyyymmdd') as dhrecbto, "); - sql.append(" coalesce(to_char(c.fechorviaje, 'yyyymmdd'), to_char(to_timestamp_tz(bpe.dhvalidade, 'YYYY-MM-DD" + "\"T\"" + "HH24:MI:SSTZH:TZM'), 'yyyymmdd')) as dh_emisao, "); + sql.append(" coalesce(to_char(c.fechorventa, 'yyyymmdd'), to_char(to_timestamp_tz(bpe.dhvalidade, 'YYYY-MM-DD" + "\"T\"" + "HH24:MI:SSTZH:TZM'), 'yyyymmdd')) as dh_emisao, "); sql.append(" coalesce(bpe.tiposubstituicao, '0') as tp_bpe, "); sql.append(" bpe.retorno_id as retorno, "); sql.append(" bpe.nprot, "); @@ -101,7 +101,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { sql.append(" left join empresa_imposto ei on ei.empresa_id = ep.empresa_id and ei.estado_id = e.estado_id "); sql.append("where c.activo = 1 and e.activo = 1 and ei.activo = 1 "); sql.append(" and bpe.tipoamb = 1 and ep.activo = 1 "); - sql.append(" and bpe.codstat in (100,135,150) "); + 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')"); @@ -581,7 +581,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { sql.append(" DBMS_LOB.substr(coalesce(bpe.xmlregular, bpe.xmlcontingencia), 3000, 6001) as xml_bpe_3 "); sql.append("from boleto c "); sql.append(" join bpe bpe on c.boleto_id = bpe.boleto_id and bpe.activo = 1 "); - sql.append(" left join bpe bpecan on bpecan.chbpe = bpe.chbpe and bpecan.codstat = 135 and bpe.codstat = 100 "); + sql.append(" left join bpe bpecan on bpecan.chbpe = bpe.chbpe and bpecan.codstat in (101,135) and bpe.codstat = 100 "); sql.append(" and (bpecan.tipoevento = 110111 or bpecan.tipoevento is null) and bpecan.activo = 1 "); sql.append(" join estado e on e.codibge = bpe.uf "); sql.append(" join marca ma on c.marca_id = ma.marca_id "); @@ -596,7 +596,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 and bpe.codstat in (100,150) "); + 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 "); @@ -675,10 +675,10 @@ 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(" 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 (bpeori.codstat in (100,135,150) and bpeori.tipoevento <> 110115 or bpeori.tipoevento is null) "); + sql.append("where ( (bpe.codstat in (100,101,102,135,150) and bpe.chbpe_substituicao is not null) "); + sql.append(" or (bpe.codstat in (101,135) and to_char(b.feccreacion, 'mm/yyyy') < to_char(bori.feccreacion, 'mm/yyyy')) ) "); + sql.append(" and (bpe.codstat in (100,101,102,135,150) and bpe.tipoevento <> 110115 or bpe.tipoevento is null) "); + sql.append(" and (bpeori.codstat in (100,101,102,135,150) and bpeori.tipoevento <> 110115 or bpeori.tipoevento is null) "); sql.append(" and bori.feccreacion >= :DATE_INICIO "); sql.append(" and bori.feccreacion <= :DATE_FIM "); sql.append(" and est_bpe.cveestado in ( ").append(ufs).append(" ) "); @@ -752,9 +752,9 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { 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 "); - sql.append(" (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 (bpeori.codstat in (100,135,150) and bpeori.tipoevento <> 110115 or bpeori.tipoevento is null) "); + sql.append(" (bpe.codstat in (101,135) and to_char(b.feccreacion, 'mm/yyyy') < to_char(bori.feccreacion, 'mm/yyyy')) "); + sql.append(" and (bpe.codstat in (100,101,102,135,150) and bpe.tipoevento <> 110115 or bpe.tipoevento is null) "); + sql.append(" and (bpeori.codstat in (100,101,102,135,150) and bpeori.tipoevento <> 110115 or bpeori.tipoevento is null) "); sql.append(" and bori.feccreacion >= :DATE_INICIO "); sql.append(" and bori.feccreacion <= :DATE_FIM "); sql.append(" and est_bpe.cveestado in ( ").append(ufs).append(" ) ");