bug#11600

dev: julio
qua:

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@85052 d1611594-4594-4d17-8e1d-87c2c4800839
master
julio 2018-09-04 12:24:01 +00:00
parent 4193ad90df
commit 4723cfcb24
1 changed files with 12 additions and 8 deletions

View File

@ -103,7 +103,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
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 bpe.chbpe is not null ");
sql.append(" and bpe.codstat in (100,135,150) ");
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')");
@ -234,7 +234,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
sql.append(" from bpe bpe ");
sql.append(" where bpe.activo = 1 ");
sql.append(" and bpe.tipoamb = 1 ");
sql.append(" and bpe.codstat in ('100') ");
sql.append(" and bpe.codstat in (100) ");
sql.append(" and bpe.chbpe = ? ");
try {
@ -493,7 +493,11 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
df.setXml(xml);
String municipioOrigem = StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getCMunIni() : rs.getString("municipioOrigem");
String estadoOrigem = (StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getUFIni().value() : rs.getString("estadoOrigem"));
if (estadoOrigem.equals("AL"))
System.out.println("SS");
String estadoDestino = (StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getUFFim().value() : rs.getString("estadoDestino"));
boolean isInterEstadual = !estadoOrigem.equals(estadoDestino);
@ -604,7 +608,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 <> 135 ");
sql.append("where c.activo = 1 and bpe.tipoamb = 1 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,10 +689,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.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.tipoevento <> 110115 or bpe.tipoevento is null) ");
sql.append(" and (bpeori.tipoevento <> 110115 or bpeori.tipoevento is null) ");
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) ");
sql.append(" and bori.feccreacion >= :DATE_INICIO ");
sql.append(" and bori.feccreacion <= :DATE_FIM ");
sql.append(" and est_bpe.cveestado in ( ").append(ufs).append(" ) ");
@ -770,8 +774,8 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
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.tipoevento <> 110115 or bpe.tipoevento is null) ");
sql.append(" and (bpeori.tipoevento <> 110115 or bpeori.tipoevento is null) ");
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) ");
sql.append(" and bori.feccreacion >= :DATE_INICIO ");
sql.append(" and bori.feccreacion <= :DATE_FIM ");
sql.append(" and est_bpe.cveestado in ( ").append(ufs).append(" ) ");