diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioConferenciaFormularioFisico.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioConferenciaFormularioFisico.java index 2362257f2..9805dcc91 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioConferenciaFormularioFisico.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioConferenciaFormularioFisico.java @@ -25,68 +25,74 @@ public class RelatorioConferenciaFormularioFisico extends Relatorio { this.setCollectionDataSource(new JRBeanCollectionDataSource(formularios)); } - private String getSql(Integer puntoventaId) { + private String getSql(Integer puntoventaId, Integer tipoventaId) { StringBuffer sql = new StringBuffer(); - sql.append("select "); - sql.append(" e.numcaja as ter, "); - sql.append(" p.nombpuntoventa as caixa, "); - sql.append(" c.numseriepreimpresa as serie, "); - sql.append(" u.nombusuario as usuario, "); - sql.append(" t.turno_id as turno, "); - sql.append(" min(c.fechorventa) as abertura, "); - sql.append(" max(c.fechorventa) as fechamento, "); - sql.append(" min(c.numfoliopreimpreso), "); - sql.append(" max(c.numfoliopreimpreso), "); - sql.append(" max(c.numfoliopreimpreso) - min(c.numfoliopreimpreso) as dif1, "); - sql.append(" min(c.numfoliosistema), "); - sql.append(" max(c.numfoliosistema), "); - sql.append(" max(c.numfoliosistema) - min(c.numfoliosistema) as dif2 "); - sql.append("from "); - sql.append(" caja c "); - sql.append(" inner join estacion e on e.estacion_id = c.estacion_id "); - sql.append(" inner join punto_venta p on p.puntoventa_id = c.puntoventa_id "); - sql.append(" inner join usuario u on u.usuario_id = c.usuario_id "); - sql.append(" inner join turno t on t.turno_id = c.turno_id "); - sql.append("where "); - sql.append(" c.empresacorrida_id = ? "); - sql.append(" and c.feccorte between ? and ? "); + sql.append("select distinct t1.*, t2.numfoliosistema as minlogico, t3.numfoliosistema as maxlogico "); + sql.append("from "); + sql.append("(select "); + sql.append(" e.numcaja as ter, "); + sql.append(" p.nombpuntoventa as caixa, "); + sql.append(" c.numseriepreimpresa as serie, "); + sql.append(" u.usuario_id || ' - ' || u.nombusuario as usuario, "); + sql.append(" t.turno_id as turno, "); + sql.append(" min(c.fechorventa) as abertura, "); + sql.append(" max(c.fechorventa) as fechamento, "); + sql.append(" min(c.numfoliopreimpreso) as minfisico, "); + sql.append(" max(c.numfoliopreimpreso) as maxfisico, "); + sql.append(" max(c.numfoliopreimpreso) - min(c.numfoliopreimpreso) as dif1, "); + sql.append(" count(case when (c.indreimpresion = 1 and c.indstatusboleto = 'E') then -1 else 1 end) as total "); + sql.append("from "); + sql.append(" caja c "); + sql.append(" inner join estacion e on e.estacion_id = c.estacion_id "); + sql.append(" inner join punto_venta p on p.puntoventa_id = c.puntoventa_id "); + sql.append(" inner join usuario u on u.usuario_id = c.usuario_id "); + sql.append(" inner join turno t on t.turno_id = c.turno_id "); + sql.append(" where "); + sql.append(" c.empresacorrida_id = ? "); + sql.append(" and c.feccorte between ? and ? "); if (puntoventaId != null && puntoventaId != -1){ - sql.append(" and c.puntoventa_id = ? "); + sql.append(" and c.puntoventa_id = " + puntoventaId); } sql.append(" and c.activo <> 0 "); - sql.append("group by "); - sql.append(" e.numcaja, "); - sql.append(" p.nombpuntoventa, "); - sql.append(" c.numseriepreimpresa, "); - sql.append(" u.nombusuario, "); - sql.append(" t.turno_id "); - sql.append("order by "); - sql.append(" u.nombusuario, min(c.fechorventa)"); - + sql.append(" and c.numfoliopreimpreso is not null "); + sql.append(" and c.numfoliosistema is not null "); + sql.append("group by "); + sql.append(" e.numcaja, "); + sql.append(" p.nombpuntoventa, "); + sql.append(" c.numseriepreimpresa, "); + sql.append(" u.usuario_id || ' - ' || u.nombusuario, "); + sql.append(" t.turno_id "); + sql.append("having min(c.numfoliopreimpreso) > 0 "); + sql.append("order by "); + sql.append(" u.nombusuario, min(c.fechorventa)) t1 "); + sql.append("inner join (select numfoliosistema, numfoliopreimpreso, numseriepreimpresa from caja) t2 on t1.minfisico = t2.numfoliopreimpreso and t1.serie = t2.numseriepreimpresa "); + sql.append("inner join (select numfoliosistema, numfoliopreimpreso, numseriepreimpresa from caja) t3 on t1.maxfisico = t3.numfoliopreimpreso and t1.serie = t3.numseriepreimpresa "); + sql.append("inner join det_abasto_boleto dab on t1.minfisico between dab.numfolioinicial and dab.numfoliofinal and dab.numseriepreimpresa = t1.serie "); + sql.append("inner join abasto_boleto abb on abb.abastoboleto_id = dab.abastoboleto_id "); + if (tipoventaId != null){ + sql.append("where abb.articulo_id = " + tipoventaId); + } return sql.toString(); } @Override protected void processaParametros() throws Exception { Integer puntoventaId = (Integer) getParametros().get("PUNTOVENTA_ID"); + Integer tipoventaId = (Integer) getParametros().get("TIPOVENTA_ID"); Integer empresaId = (Integer) getParametros().get("EMPRESA_ID"); Date fecInicio = (Date) getParametros().get("DATA_INICIAL"); Date fecFinal = (Date) getParametros().get("DATA_FINAL"); fecInicio = DateUtil.inicioFecha(fecInicio); fecFinal = DateUtil.fimFecha(fecFinal); - String sql = getSql(puntoventaId); + String sql = getSql(puntoventaId, tipoventaId); PreparedStatement pstmt = getConexao().prepareStatement(sql); pstmt.setInt(1, empresaId); pstmt.setTimestamp(2, new java.sql.Timestamp(fecInicio.getTime())); pstmt.setTimestamp(3, new java.sql.Timestamp(fecFinal.getTime())); - if (puntoventaId != null) { - pstmt.setInt(4, puntoventaId); - } - List formularios = new ArrayList(); ResultSet rs = pstmt.executeQuery(); @@ -97,16 +103,16 @@ public class RelatorioConferenciaFormularioFisico extends Relatorio { formulario.setBilheteFisicoAbertura(rs.getInt(8)); formulario.setBilheteFisicoFechamento(rs.getInt(9)); formulario.setDif1(rs.getInt(10)); - formulario.setBilheteLogicoAbertura(rs.getInt(11)); - formulario.setBilheteLogicoFechamento(rs.getInt(12)); - formulario.setDif2(rs.getInt(13)); + formulario.setBilheteLogicoAbertura(rs.getInt(12)); + formulario.setBilheteLogicoFechamento(rs.getInt(13)); + formulario.setDif2(rs.getInt(10)); formulario.setCaixa(rs.getString(2)); formulario.setFechamento(rs.getDate(7)); formulario.setSerie(rs.getString(3)); formulario.setTerminal(rs.getInt(1)); formulario.setTurno(rs.getInt(5)); formulario.setUsuario(rs.getString(4)); - formulario.setTotal(rs.getInt(13)); + formulario.setTotal(rs.getInt(11)); formularios.add(formulario); } diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioConferenciaFormularioFisico.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioConferenciaFormularioFisico.jasper index 5a994266e..aa1ca586d 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioConferenciaFormularioFisico.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioConferenciaFormularioFisico.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioConferenciaFormularioFisico.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioConferenciaFormularioFisico.jrxml index ba7a85578..392569ef9 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioConferenciaFormularioFisico.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioConferenciaFormularioFisico.jrxml @@ -2,7 +2,7 @@ - + @@ -27,134 +27,25 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -180,7 +71,7 @@ - + @@ -217,108 +108,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioConferenciaFormularioFisicoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioConferenciaFormularioFisicoController.java index f9746e1a1..98caf6c8c 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioConferenciaFormularioFisicoController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioConferenciaFormularioFisicoController.java @@ -2,6 +2,7 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; import java.sql.Connection; import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.sql.DataSource; @@ -14,13 +15,19 @@ import org.zkoss.util.resource.Labels; import org.zkoss.zhtml.Messagebox; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; +import org.zkoss.zul.Comboitem; +import org.zkoss.zul.ComboitemRenderer; import org.zkoss.zul.Datebox; +import com.rjconsultores.ventaboletos.entidad.Articulo; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoVenta; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioConferenciaFormularioFisico; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; -import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEmpresa; +import com.rjconsultores.ventaboletos.service.ArticuloService; +import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; @@ -31,17 +38,39 @@ public class RelatorioConferenciaFormularioFisicoController extends MyGenericFo private static final long serialVersionUID = 1L; private static Logger log = Logger.getLogger(RelatorioConferenciaFormularioFisicoController.class); - private MyComboboxEmpresa cmbEmpresa; + private MyComboboxEstandar cmbEmpresa; private MyComboboxPuntoVenta cmbPuntoVenta; + private MyComboboxEstandar cmbTipoVenda; private Datebox datInicial; private Datebox datFinal; + + @Autowired + private EmpresaService empresaService; + @Autowired + private ArticuloService articuloService; + + private List lsEmpresas; + private List lsTiposVenda; @Autowired private DataSource dataSourceRead; @Override public void doAfterCompose(Component comp) throws Exception { + lsEmpresas = empresaService.obtenerTodos(); + lsTiposVenda = articuloService.obtenerTodos(); + super.doAfterCompose(comp); + + cmbTipoVenda.setItemRenderer(new ComboitemRenderer() { + @Override + public void render(Comboitem cmbtm, Object o) throws Exception { + Articulo tipo = (Articulo) o; + + cmbtm.setLabel(tipo.getDescarticulo()); + cmbtm.setValue(tipo); + } + }); } public void onClick$btnExecutarRelatorio(Event ev) throws Exception { @@ -75,6 +104,7 @@ public class RelatorioConferenciaFormularioFisicoController extends MyGenericFo parametros.put("AGENCIA", cmbPuntoVenta.getSelectedIndex() != -1 ? ((PuntoVenta)cmbPuntoVenta.getSelectedItem().getValue()).getNombpuntoventa(): null); parametros.put("EMPRESA", ((Empresa)cmbEmpresa.getSelectedItem().getValue()).getNombempresa()); parametros.put("PUNTOVENTA_ID", cmbPuntoVenta.getSelectedIndex() != -1 ? ((PuntoVenta)cmbPuntoVenta.getSelectedItem().getValue()).getPuntoventaId() : null); + parametros.put("TIPOVENTA_ID", cmbTipoVenda.getSelectedIndex() != -1 ? ((Articulo)cmbTipoVenda.getSelectedItem().getValue()).getArticuloId() : null); parametros.put("DATA_INICIAL", datInicial.getValue()); parametros.put("DATA_FINAL", datFinal.getValue()); parametros.put("EMPRESA_ID", ((Empresa)cmbEmpresa.getSelectedItem().getValue()).getEmpresaId()); @@ -89,11 +119,11 @@ public class RelatorioConferenciaFormularioFisicoController extends MyGenericFo Labels.getLabel("indexController.mniRelatorioConferenciaFormularioFisico.label"), args, MODAL); } - public MyComboboxEmpresa getCmbEmpresa() { + public MyComboboxEstandar getCmbEmpresa() { return cmbEmpresa; } - public void setCmbEmpresa(MyComboboxEmpresa cmbEmpresa) { + public void setCmbEmpresa(MyComboboxEstandar cmbEmpresa) { this.cmbEmpresa = cmbEmpresa; } @@ -119,5 +149,22 @@ public class RelatorioConferenciaFormularioFisicoController extends MyGenericFo public void setDatFinal(Datebox datFinal) { this.datFinal = datFinal; + } + + public List getLsEmpresas() { + return lsEmpresas; + } + + public void setLsEmpresas(List lsEmpresas) { + this.lsEmpresas = lsEmpresas; + } + + public List getLsTiposVenda() { + return lsTiposVenda; + } + + public void setLsTiposVenda(List lsTiposVenda) { + this.lsTiposVenda = lsTiposVenda; } + } diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index 21340c6c1..20498c73d 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -6488,9 +6488,10 @@ busquedaOCDParamController.SomenteCartao.label = Solo tarjeta busquedaOCDParamController.TodasFormasPagamento.label = Todas las formas de pago # Relatorio Conferencia Formulario Fisico -relatorioArquivoBGMController.lbDataIni.value = Data Inicial -relatorioArquivoBGMController.lbDataFin.value = Data Final -relatorioArquivoBGMController.lbEmpresa.value = Empresa -relatorioArquivoBGMController.lbPuntoVenta.value = Agência -relatorioArquivoBGMController.msg.erro.puntoventa = O Campo Agência é obrigatório! -relatorioArquivoBGMController.msg.erro.empresa = O Campo Empresa é obrigatório! \ No newline at end of file +relatorioConferenciaFormularioFisicoController.lbDataIni.value = Data Inicial +relatorioConferenciaFormularioFisicoController.lbDataFin.value = Data Final +relatorioConferenciaFormularioFisicoController.lbEmpresa.value = Empresa +relatorioConferenciaFormularioFisicoController.lbTipoVenda.value = Tipo Venda +relatorioConferenciaFormularioFisicoController.lbPuntoVenta.value = Agência +relatorioConferenciaFormularioFisicoController.msg.erro.puntoventa = O Campo Agência é obrigatório! +relatorioConferenciaFormularioFisicoController.msg.erro.empresa = O Campo Empresa é obrigatório! \ No newline at end of file diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 1f20513bd..4aebb6755 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -6627,9 +6627,11 @@ busquedaImportacionFiscalEcfReducaoZController.window.title=Impressão Fiscal :: relatorioConferenciaFormularioFisicoController.lbDataIni.value = Data Inicial relatorioConferenciaFormularioFisicoController.lbDataFin.value = Data Final relatorioConferenciaFormularioFisicoController.lbEmpresa.value = Empresa +relatorioConferenciaFormularioFisicoController.lbTipoVenda.value = Tipo Venda relatorioConferenciaFormularioFisicoController.lbPuntoVenta.value = Agência relatorioConferenciaFormularioFisicoController.msg.erro.puntoventa = O Campo Agência é obrigatório! relatorioConferenciaFormularioFisicoController.msg.erro.empresa = O Campo Empresa é obrigatório! + busquedaImportacionFiscalEcfPendenciaReducaoZController.window.title=Impressão Fiscal :: Pendência Redução Z busquedaImportacionFiscalEcfReducaoZController.window.title=Impressão Fiscal :: ECF Integrado c/ Redução Z busquedaImportacionFiscalEcfPendenciaReducaoZController.window.title=Impressão Fiscal :: Pendência Redução Z diff --git a/web/gui/relatorios/filtroRelatorioConferenciaFormularioFisico.zul b/web/gui/relatorios/filtroRelatorioConferenciaFormularioFisico.zul index d58a25863..ba2ef3934 100644 --- a/web/gui/relatorios/filtroRelatorioConferenciaFormularioFisico.zul +++ b/web/gui/relatorios/filtroRelatorioConferenciaFormularioFisico.zul @@ -34,9 +34,10 @@