From 32117e0eafccbc9f9d91452c7a139c3a9154756c Mon Sep 17 00:00:00 2001 From: julio Date: Wed, 11 Oct 2017 00:08:49 +0000 Subject: [PATCH] =?UTF-8?q?corre=C3=A7=C3=B5es=20na=20exporta=C3=A7=C3=A3o?= =?UTF-8?q?=20fiscal=20-=20bug=20#9386?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@74694 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../dao/hibernate/FiscalHibernateDAO.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java index 190cb9df5..3071e82c9 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java @@ -1399,7 +1399,7 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO sb.append(" (case when r2.numserie20 is null then '000001' else r2.coofinal end) as coofinal,"); sb.append(" (case when r2.numserie20 is null then '0000' else r2.crz end) as crz,"); sb.append(" (case when r2.numserie20 is null then '0000' else r2.cro end) as cro,"); - sb.append(" (case when r2.numserie20 is null then '000000' else r2.coo end) as r2_coo,"); + sb.append(" (case when r2.numserie20 is null then '000001' else r2.coo end) as r2_coo,"); sb.append(" to_char(c.feccreacion, 'yyyymmdd') as datamov,"); sb.append(" (case when r4.caja_id is null then '000001' else r4.coo end) as r4_coo,"); sb.append(" (case when s.aliasorigen_id is null then ei.codestabelecimento else eis.codestabelecimento end) as codestabelecimento,"); @@ -1439,15 +1439,15 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO sb.append(" left join empresa_imposto eis on eis.empresa_id = c.empresacorrida_id and eis.estado_id = eos.estado_id"); sb.append(" left join fiscal_r4 r4 on r4.caja_id = c.caja_id"); sb.append(" left join fiscal_r2 r2 on r2.numserie20 = imp.numserie20 and r2.datamov = to_char(c.feccreacion, 'YYYYMMDD')"); - sb.append(" where c.activo = 1 and po.activo = 1 and co.activo = 1 and eo.activo = 1 and ei.activo = 1"); - sb.append(" and coalesce(case when s.aliasorigen_id is null then ei.activo else eis.activo end, 0) = 1"); - sb.append(" and c.serieimpfiscal is not null"); - sb.append(" and ((c.indreimpresion = 0 and c.motivocancelacion_id is null and c.numfoliosistema is not null) or (c.indstatusboleto = 'E' and c.indreimpresion = 1))"); - sb.append(" and (coalesce(c.preciopagado,0) + coalesce(c.importetaxaembarque,0) + coalesce(c.importeseguro,0) + coalesce(c.importepedagio,0) + coalesce(c.importeoutros,0)) > 0"); - sb.append(" and c.feccreacion >= to_date(?,'DD/MM/YYYY HH24:MI:SS') and c.feccreacion <= to_date(?,'DD/MM/YYYY HH24:MI:SS')"); - sb.append(" and c.empresacorrida_id = ?"); - sb.append(" and ((case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) = ?)"); - // sb.append(" and r2.numserie20 = 'BE091410100011239069'"); + sb.append(" where c.activo = 1 and po.activo = 1 and co.activo = 1 and eo.activo = 1 and ei.activo = 1 "); + sb.append(" and coalesce(case when s.aliasorigen_id is null then ei.activo else eis.activo end, 0) = 1 "); + sb.append(" and c.serieimpfiscal is not null "); + sb.append(" and ((c.indreimpresion = 0 and c.motivocancelacion_id is null and c.numfoliosistema is not null) or (c.indstatusboleto = 'E' and c.indreimpresion = 1)) "); + sb.append(" and (coalesce(c.preciopagado,0) + coalesce(c.importetaxaembarque,0) + coalesce(c.importeseguro,0) + coalesce(c.importepedagio,0) + coalesce(c.importeoutros,0)) > 0 "); + sb.append(" and ((case when coalesce(r.indtribtarifa,0) = 1 then c.preciopagado else 0 end) + (case when coalesce(r.indtribtaxaembarque,0) = 1 then c.importetaxaembarque else 0 end) + (case when coalesce(r.indtribpedagio,0) = 1 then c.importepedagio else 0 end)) > 0 "); + sb.append(" and c.feccreacion >= to_date(?,'DD/MM/YYYY HH24:MI:SS') and c.feccreacion <= to_date(?,'DD/MM/YYYY HH24:MI:SS') "); + sb.append(" and c.empresacorrida_id = ? "); + sb.append(" and ((case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) = ?) "); try { PreparedStatement ps = connection.prepareStatement(sb.toString()); @@ -3926,6 +3926,7 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO sql.append(" and c.serieimpfiscal is not null "); sql.append(" and ((c.indreimpresion = 0 and c.motivocancelacion_id is null and c.numfoliosistema is not null) or (c.indstatusboleto = 'E' and c.indreimpresion = 1)) "); sql.append(" and (coalesce(c.preciopagado,0) + coalesce(c.importetaxaembarque,0) + coalesce(c.importeseguro,0) + coalesce(c.importepedagio,0) + coalesce(c.importeoutros,0)) > 0 "); + sql.append(" and ((case when coalesce(r.indtribtarifa,0) = 1 then c.preciopagado else 0 end) + (case when coalesce(r.indtribtaxaembarque,0) = 1 then c.importetaxaembarque else 0 end) + (case when coalesce(r.indtribpedagio,0) = 1 then c.importepedagio else 0 end)) > 0 "); sql.append(" and c.feccreacion >= :DATE_INICIO and c.feccreacion <= :DATE_FIM "); sql.append(" and c.empresacorrida_id = :EMPRESA_ID "); sql.append(" and ((case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) = :CVEESTADO ) ");