From 2c13a45c1aa602081b49e0d09d663c062485312b Mon Sep 17 00:00:00 2001 From: julio Date: Wed, 12 Apr 2017 14:40:58 +0000 Subject: [PATCH] fixes bug #8807 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@67983 d1611594-4594-4d17-8e1d-87c2c4800839 --- src/com/rjconsultores/ventaboletos/dao/FiscalDAO.java | 2 +- .../ventaboletos/dao/hibernate/FiscalHibernateDAO.java | 10 ++++++++-- .../ventaboletos/service/FiscalService.java | 2 +- .../ventaboletos/service/impl/FiscalServiceImpl.java | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/dao/FiscalDAO.java b/src/com/rjconsultores/ventaboletos/dao/FiscalDAO.java index 00e9224b2..318352c53 100644 --- a/src/com/rjconsultores/ventaboletos/dao/FiscalDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/FiscalDAO.java @@ -31,7 +31,7 @@ public interface FiscalDAO { public List buscaDatosFiscaisECFManual(Date inicio, Date fim, Integer empresaId, Integer estadoId, Connection connection) throws SQLException; - public List buscaDatosNaoFiscais(Date inicio, Date fim, Integer empresaId, Connection connection) throws SQLException; + public List buscaDatosNaoFiscais(Date inicio, Date fim, Integer empresaId, Integer estadoId, Connection connection) throws SQLException; public List buscarRegistroECFTipoCFC(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado); diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java index 4030cbffb..4250fc73e 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java @@ -1224,7 +1224,7 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO } @Override - public List buscaDatosNaoFiscais(Date inicio, Date fim, Integer empresaId, Connection connection) throws SQLException { + public List buscaDatosNaoFiscais(Date inicio, Date fim, Integer empresaId, Integer estadoId, Connection connection) throws SQLException { PreparedStatement stmt = null; ResultSet rset = null; @@ -1232,11 +1232,16 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO sQuery.append("SELECT TEE.TIPOEVENTOEXTRA_ID AS TIPOEVENTOEXTRAID, TEE.DESCTIPOEVENTO AS DESCTIPOEVENTO, ") .append(" TRUNC(CD.FECHORVTA) AS FECHORVTA, SUM(CD.PRECIO) AS TOTAL ") .append("FROM TIPO_EVENTO_EXTRA TEE ") - .append("LEFT JOIN EVENTO_EXTRA EE ON TEE.TIPOEVENTOEXTRA_ID = EE.TIPOEVENTOEXTRA_ID ") + .append("JOIN EVENTO_EXTRA EE ON TEE.TIPOEVENTOEXTRA_ID = EE.TIPOEVENTOEXTRA_ID ") + .append("JOIN PUNTO_VENTA PV ON PV.PUNTOVENTA_ID = EE.PUNTOVENTA_ID ") + .append("JOIN PARADA PA ON PA.PARADA_ID = PV.PARADA_ID ") + .append("JOIN CIUDAD CI ON CI.CIUDAD_ID = PA.CIUDAD_ID ") + .append("JOIN ESTADO ES ON ES.ESTADO_ID = CI.ESTADO_ID ") .append("LEFT JOIN CAJA_DIVERSOS CD ON EE.EVENTOEXTRA_ID = CD.EVENTOEXTRA_ID ") .append("WHERE TEE.ACTIVO = 1 ") .append("AND EE.EMPRESA_ID = ? ") .append("AND TRUNC(CD.FECHORVTA) BETWEEN ? AND ? ") + .append("AND ES.ESTADO_ID = ? ") .append("GROUP BY TEE.TIPOEVENTOEXTRA_ID, TEE.DESCTIPOEVENTO, TRUNC(CD.FECHORVTA) ") .append("ORDER BY TRUNC(CD.FECHORVTA), TEE.DESCTIPOEVENTO "); @@ -1244,6 +1249,7 @@ public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO stmt.setInt(1, empresaId); stmt.setDate(2, new java.sql.Date(inicio.getTime())); stmt.setDate(3, new java.sql.Date(fim.getTime())); + stmt.setInt(4, estadoId); rset = stmt.executeQuery(); List importacionNaoFiscalVOs = new ArrayList(); diff --git a/src/com/rjconsultores/ventaboletos/service/FiscalService.java b/src/com/rjconsultores/ventaboletos/service/FiscalService.java index 9d8fac3da..3fee9bec6 100644 --- a/src/com/rjconsultores/ventaboletos/service/FiscalService.java +++ b/src/com/rjconsultores/ventaboletos/service/FiscalService.java @@ -27,7 +27,7 @@ public interface FiscalService { public File importacionFiscalECFManual(Date inicio, Date fim, Empresa empresa, Estado estado); - public File importacionNaoFiscal(Date inicio, Date fim, Empresa empresa); + public File importacionNaoFiscal(Date inicio, Date fim, Empresa empresa, Estado estado); public File importacionFiscalECFCancelados(Date inicio, Date fim, Empresa empresa, Estado estado); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FiscalServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FiscalServiceImpl.java index b0cad420c..77b444777 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/FiscalServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/FiscalServiceImpl.java @@ -297,12 +297,12 @@ public class FiscalServiceImpl implements FiscalService { } @Override - public File importacionNaoFiscal(Date inicio, Date fim, Empresa empresa) { + public File importacionNaoFiscal(Date inicio, Date fim, Empresa empresa, Estado estado) { Connection connection = null; try { connection = getConnection(); - List importacionNaoFiscalVOs = fiscalDAO.buscaDatosNaoFiscais(inicio, fim, empresa.getEmpresaId(), connection); + List importacionNaoFiscalVOs = fiscalDAO.buscaDatosNaoFiscais(inicio, fim, empresa.getEmpresaId(), estado.getEstadoId(), connection); return new ArchivoIntegracionNaoFiscal().gerarArquivo(empresa.getCnpj(), importacionNaoFiscalVOs);