diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java index 3887b523c..b1a7b0da8 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java @@ -50,7 +50,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { StringBuilder sql = new StringBuilder(); sql.append("select distinct "); sql.append(" c.boleto_id, "); - sql.append(" c.num_bpe, "); + sql.append(" coalesce(c.num_bpe, c.numfoliosistema) as num_bpe, "); sql.append(" c.numfoliosistema as numfoliosistema, "); sql.append(" coalesce(c.preciopagado,0) + coalesce(c.importetaxaembarque,0) + coalesce(c.importeseguro,0) + coalesce(c.importepedagio,0) + coalesce(c.importeoutros,0) as valortotal, "); sql.append(" bpe.codstat as codstatus, "); @@ -99,13 +99,14 @@ 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.errocontingencia is null "); //sql.append(" and bpe.codstat <> 150 "); // não deve ser enviados os registros de contigencia sql.append(" and (tipoevento <> 110115 or 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 ep.empresa_id = ? "); sql.append(" and e.cveestado = ? "); - sql.append("order by to_number(c.numfoliosistema), to_number(c.num_bpe), dhrecbto "); + sql.append("order by to_number(c.numfoliosistema), to_number(num_bpe), dhrecbto "); try { PreparedStatement ps = connection.prepareStatement(sql.toString()); @@ -227,11 +228,6 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { sql.append(" DBMS_LOB.substr(bpe.xmlregular, 3000) as xml_bpe, "); sql.append(" DBMS_LOB.substr(bpe.xmlregular, 3000, 3001) as xml_bpe_2, "); sql.append(" DBMS_LOB.substr(bpe.xmlregular, 3000, 6001) as xml_bpe_3 "); - - // sql.append(" DBMS_LOB.substr(bpe.xmlregular, 4000) as xml_bpe, "); - // sql.append(" DBMS_LOB.substr(bpe.xmlregular, 4000, 4001) as xml_bpe_2, "); - // sql.append(" DBMS_LOB.substr(bpe.xmlregular, 4000, 8001) as xml_bpe_3 "); - sql.append(" from bpe bpe "); sql.append(" where bpe.activo = 1 "); sql.append(" and bpe.tipoamb = 1 ");