diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioGratuidade.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioGratuidade.java index 372cf4ecc..d469e1aac 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioGratuidade.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioGratuidade.java @@ -35,8 +35,11 @@ public class RelatorioGratuidade extends Relatorio { String empresa = parametros.get("empresa") != null ? parametros.get("empresa").toString() : ""; String agencia = parametros.get("agencia") != null ? parametros.get("agencia").toString() : ""; String ruta = parametros.get("ruta") != null ? parametros.get("ruta").toString() : ""; - - String sql = getSql(empresa, agencia, ruta, fecInicio, fecFinal); + String origem = parametros.get("origem") != null ? parametros.get("origem").toString() : ""; + String destino = parametros.get("destino") != null ? parametros.get("destino").toString() : ""; + String categoria = parametros.get("categoria") != null ? parametros.get("categoria").toString() : ""; + + String sql = getSql(empresa, agencia, ruta, fecInicio, fecFinal, origem, destino, categoria); System.out.println(sql); @@ -44,15 +47,24 @@ public class RelatorioGratuidade extends Relatorio { NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); stmt.setTimestamp("fecInicio", new java.sql.Timestamp(sdf.parse(fecInicio).getTime())); stmt.setTimestamp("fecFinal", new java.sql.Timestamp(sdf.parse(fecFinal).getTime())); - if (empresa != null && !empresa.equals("")){ + if(empresa != null && !empresa.equals("")){ stmt.setInt("empresa_id", Integer.parseInt(empresa)); } - if (agencia != null && !agencia.equals("")){ + if(agencia != null && !agencia.equals("")){ stmt.setInt("puntoventa_id", Integer.parseInt(agencia)); } - if (ruta != null && !ruta.equals("")){ + if(ruta != null && !ruta.equals("")){ stmt.setInt("ruta_id", Integer.parseInt(ruta)); } + if(origem != null && !origem.equals("")){ + stmt.setInt("origem_id", Integer.parseInt(origem)); + } + if(destino != null && !destino.equals("")){ + stmt.setInt("destino_id", Integer.parseInt(destino)); + } + if(categoria != null && !categoria.equals("")){ + stmt.setInt("categoria_id", Integer.parseInt(categoria)); + } ResultSet rset = null; @@ -97,7 +109,7 @@ public class RelatorioGratuidade extends Relatorio { protected void processaParametros() throws Exception { } - private String getSql(String empresa, String agencia, String ruta, String fecInicio, String fecFinal) { + private String getSql(String empresa, String agencia, String ruta, String fecInicio, String fecFinal, String origem, String destino, String categoria) { StringBuffer sql = new StringBuffer(); sql.append("SELECT b.feccorrida, ori.cveparada origen, des.cveparada destino, "); sql.append("b.numkmviaje, r.descruta, b.corrida_id, b.fechorviaje, "); @@ -133,6 +145,15 @@ public class RelatorioGratuidade extends Relatorio { if (!ruta.isEmpty()){ sql.append(" AND b.ruta_id = :ruta_id "); } + if(!origem.isEmpty()){ + sql.append(" AND ori.parada_id = :origem_id "); + } + if(!destino.isEmpty()){ + sql.append(" AND des.parada_id = :destino_id "); + } + if(!categoria.isEmpty()){ + sql.append(" AND c.categoria_id = :categoria_id "); + } return sql.toString(); } diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioGratuidadeController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioGratuidadeController.java index 66e1a71dd..dfd9659d5 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioGratuidadeController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioGratuidadeController.java @@ -16,15 +16,19 @@ import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; import org.zkoss.zul.Datebox; +import com.rjconsultores.ventaboletos.entidad.Categoria; import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.Ruta; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioGratuidade; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.service.CategoriaService; import com.rjconsultores.ventaboletos.service.EmpresaService; import com.rjconsultores.ventaboletos.service.PuntoVentaService; import com.rjconsultores.ventaboletos.service.RutaService; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar; +import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; @@ -36,24 +40,27 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer { @Autowired private DataSource dataSourceRead; - @Autowired private EmpresaService empresaService; - @Autowired private PuntoVentaService puntoVentaService; - @Autowired private RutaService rutaService; + @Autowired + private CategoriaService categoriaService; private Datebox datInicial; private Datebox datFinal; private MyComboboxEstandar cmbTeste; private MyComboboxPuntoVenta cmbAgencia; private MyComboboxEstandar cmbLinha; + private MyComboboxParada cmbOrigem; + private MyComboboxParada cmbDestino; + private MyComboboxEstandar cmbTipoGratuidade; private List lsEmpresas; private List lsLinhas; + private List lsCategorias; private void executarRelatorio() throws Exception { @@ -72,7 +79,16 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer { if (cmbLinha.getSelectedIndex() != -1) { parametros.put("ruta", ((Ruta) cmbLinha.getSelectedItem().getValue()).getRutaId()); } - + if(cmbOrigem.getSelectedIndex() != -1){ + parametros.put("origem", ((Parada) cmbOrigem.getSelectedItem().getValue()).getParadaId()); + } + if(cmbDestino.getSelectedIndex() != -1){ + parametros.put("destino", ((Parada) cmbDestino.getSelectedItem().getValue()).getParadaId()); + } + if(cmbTipoGratuidade.getSelectedIndex() != -1){ + parametros.put("categoria", ((Categoria) cmbTipoGratuidade.getSelectedItem().getValue()).getCategoriaId()); + } + parametros.put("TITULO", Labels.getLabel("relatorioGratuidadeController.window.title")); Relatorio relatorio = new RelatorioGratuidade(parametros, dataSourceRead.getConnection()); @@ -94,6 +110,7 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer { lsLinhas = rutaService.obtenerTodos(); lsEmpresas = empresaService.obtenerTodos(); + lsCategorias = categoriaService.obtenerTodos(); super.doAfterCompose(comp); } @@ -113,6 +130,14 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer { public void setLsLinhas(List lsLinhas) { this.lsLinhas = lsLinhas; } + + public List getLsCategorias() { + return lsCategorias; + } + + public void setLsCategorias(List lsCategorias) { + this.lsCategorias = lsCategorias; + } public Datebox getDatInicial() { return datInicial; @@ -146,4 +171,28 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer { this.cmbLinha = cmbLinha; } + public MyComboboxParada getCmbOrigem() { + return cmbOrigem; + } + + public void setCmbOrigem(MyComboboxParada cmbOrigem) { + this.cmbOrigem = cmbOrigem; + } + + public MyComboboxParada getCmbDestino() { + return cmbDestino; + } + + public void setCmbDestino(MyComboboxParada cmbDestino) { + this.cmbDestino = cmbDestino; + } + + public MyComboboxEstandar getCmbTipoGratuidade() { + return cmbTipoGratuidade; + } + + public void setCmbTipoGratuidade(MyComboboxEstandar cmbTipoGratuidade) { + this.cmbTipoGratuidade = cmbTipoGratuidade; + } + } diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index 590340f0a..1774f984d 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -5754,6 +5754,9 @@ relatorioGratuidadeController.window.title = Reporte Gratuidade relatorioGratuidadeController.lbEmpresa.value = Empresa relatorioGratuidadeController.lbAgencia.value = Punto Venta relatorioGratuidadeController.lbLinhas.value = Ruta +relatorioGratuidadeController.lbOrigem.value = Origem +relatorioGratuidadeController.lbDestino.value = Destino +relatorioGratuidadeController.lbTipoGratuidade.value = Tipo de Gratuidade relatorioGratuidadeController.lbDataIni.value = Fecha Inicio relatorioGratuidadeController.lbDataFin.value = Fecha Final diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 9452e61e4..299730193 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -5840,6 +5840,9 @@ relatorioGratuidadeController.window.title = Relatório Gratuidade relatorioGratuidadeController.lbEmpresa.value = Empresa relatorioGratuidadeController.lbAgencia.value = Agência relatorioGratuidadeController.lbLinhas.value = Linha +relatorioGratuidadeController.lbOrigem.value = Origem +relatorioGratuidadeController.lbDestino.value = Destino +relatorioGratuidadeController.lbTipoGratuidade.value = Tipo de Gratuidade relatorioGratuidadeController.lbDataIni.value = Data Inicio relatorioGratuidadeController.lbDataFin.value = Data Final diff --git a/web/gui/relatorios/filtroRelatorioGratuidade.zul b/web/gui/relatorios/filtroRelatorioGratuidade.zul index a0c5740e6..7712789cd 100644 --- a/web/gui/relatorios/filtroRelatorioGratuidade.zul +++ b/web/gui/relatorios/filtroRelatorioGratuidade.zul @@ -7,7 +7,7 @@ @@ -40,6 +40,32 @@ use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar" model="@{winFiltroRelatorioGratuidade$composer.lsLinhas}" /> + + + + + + + + + +