diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/BusquedaTarifaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/BusquedaTarifaController.java index c8683b3ab..e2dbd0efd 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/BusquedaTarifaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/BusquedaTarifaController.java @@ -5,6 +5,23 @@ */ package com.rjconsultores.ventaboletos.web.gui.controladores.tarifas; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Controller; +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.zk.ui.event.EventListener; +import org.zkoss.zul.Combobox; +import org.zkoss.zul.Paging; + import com.rjconsultores.ventaboletos.entidad.Categoria; import com.rjconsultores.ventaboletos.entidad.ClaseServicio; import com.rjconsultores.ventaboletos.entidad.Marca; @@ -20,7 +37,6 @@ import com.rjconsultores.ventaboletos.service.CategoriaService; import com.rjconsultores.ventaboletos.service.ClaseServicioService; import com.rjconsultores.ventaboletos.service.MarcaService; import com.rjconsultores.ventaboletos.service.MonedaService; -import com.rjconsultores.ventaboletos.service.ParadaService; import com.rjconsultores.ventaboletos.service.RutaService; import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService; import com.rjconsultores.ventaboletos.service.ViaService; @@ -33,25 +49,6 @@ import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper; import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTarifa; import com.trg.search.Filter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import oracle.net.aso.r; - -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Controller; -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.zk.ui.event.EventListener; -import org.zkoss.zul.Combobox; -import org.zkoss.zul.Paging; - /** * * @author rodrigo @@ -60,93 +57,90 @@ import org.zkoss.zul.Paging; @Scope("prototype") public class BusquedaTarifaController extends MyGenericForwardComposer { - @Autowired - private transient PagedListWrapper plwTarifa; - private Paging pagingTarifa; - @Autowired - private MarcaService marcaService; - @Autowired - private ClaseServicioService claseServicioService; - @Autowired - private MonedaService monedaService; - @Autowired - private VigenciaTarifaService vigenciaTarifaService; - @Autowired - private CategoriaService categoriaService; - @Autowired - private TipoPuntoVentaService tipoPuntoVentaService; - @Autowired - private ParadaService paradaService; - @Autowired - private RutaService rutaService; - @Autowired - private ViaService viaService; - private List lsMarcas; - private List lsClaseServico; - private List lsTramos; - private List lsMonedas; - private List lsVigencias; - private List lsCategoria; - private List lsTipoPontoVenta; - private List lsRuta; - private List lsVia; - - private MyListbox tarifaList; - private Combobox cmbMarca; - private Combobox cmbOrigem; - private Combobox cmbDestino; - private Combobox cmbMoneda; - private Combobox cmbClaseServicio; - private Combobox cmbVigenciaTarifa; - private Combobox cmbCategoria; - private Combobox cmbTipoPontoVenta; - private Combobox cmbRuta; - private Combobox cmbVia; - - - private static final Logger log = Logger.getLogger(BusquedaTarifaController.class); + @Autowired + private transient PagedListWrapper plwTarifa; + private Paging pagingTarifa; + @Autowired + private MarcaService marcaService; + @Autowired + private ClaseServicioService claseServicioService; + @Autowired + private MonedaService monedaService; + @Autowired + private VigenciaTarifaService vigenciaTarifaService; + @Autowired + private CategoriaService categoriaService; + @Autowired + private TipoPuntoVentaService tipoPuntoVentaService; + @Autowired + private RutaService rutaService; + @Autowired + private ViaService viaService; + private List lsMarcas; + private List lsClaseServico; + private List lsTramos; + private List lsMonedas; + private List lsVigencias; + private List lsCategoria; + private List lsTipoPontoVenta; + private List lsRuta; + private List lsVia; - public List getLsVigencias() { - return lsVigencias; - } + private MyListbox tarifaList; + private Combobox cmbMarca; + private Combobox cmbOrigem; + private Combobox cmbDestino; + private Combobox cmbMoneda; + private Combobox cmbClaseServicio; + private Combobox cmbVigenciaTarifa; + private Combobox cmbCategoria; + private Combobox cmbTipoPontoVenta; + private Combobox cmbRuta; + private Combobox cmbVia; - public void setLsVigencias(List lsVigencias) { - this.lsVigencias = lsVigencias; - } + private static final Logger log = Logger.getLogger(BusquedaTarifaController.class); - public Combobox getCmbVigenciaTarifa() { - return cmbVigenciaTarifa; - } + public List getLsVigencias() { + return lsVigencias; + } - public void setCmbVigenciaTarifa(Combobox cmbVigenciaTarifa) { - this.cmbVigenciaTarifa = cmbVigenciaTarifa; - } + public void setLsVigencias(List lsVigencias) { + this.lsVigencias = lsVigencias; + } - public Combobox getCmbClaseServicio() { - return cmbClaseServicio; - } + public Combobox getCmbVigenciaTarifa() { + return cmbVigenciaTarifa; + } - public void setCmbClaseServicio(Combobox cmbClaseServicio) { - this.cmbClaseServicio = cmbClaseServicio; - } + public void setCmbVigenciaTarifa(Combobox cmbVigenciaTarifa) { + this.cmbVigenciaTarifa = cmbVigenciaTarifa; + } - public Combobox getCmbMarca() { - return cmbMarca; - } + public Combobox getCmbClaseServicio() { + return cmbClaseServicio; + } - public void setCmbMarca(Combobox cmbMarca) { - this.cmbMarca = cmbMarca; - } + public void setCmbClaseServicio(Combobox cmbClaseServicio) { + this.cmbClaseServicio = cmbClaseServicio; + } - public Combobox getCmbMoneda() { - return cmbMoneda; - } + public Combobox getCmbMarca() { + return cmbMarca; + } - public void setCmbMoneda(Combobox cmbMoneda) { - this.cmbMoneda = cmbMoneda; - } - - public Combobox getCmbRuta() { + public void setCmbMarca(Combobox cmbMarca) { + this.cmbMarca = cmbMarca; + } + + public Combobox getCmbMoneda() { + return cmbMoneda; + } + + public void setCmbMoneda(Combobox cmbMoneda) { + this.cmbMoneda = cmbMoneda; + } + + public Combobox getCmbRuta() { return cmbRuta; } @@ -163,62 +157,62 @@ public class BusquedaTarifaController extends MyGenericForwardComposer { } public List getLsClaseServico() { - return lsClaseServico; - } + return lsClaseServico; + } - public void setLsClaseServico(List lsClaseServico) { - this.lsClaseServico = lsClaseServico; - } + public void setLsClaseServico(List lsClaseServico) { + this.lsClaseServico = lsClaseServico; + } - public List getLsMarcas() { - return lsMarcas; - } + public List getLsMarcas() { + return lsMarcas; + } - public void setLsMarcas(List lsMarcas) { - this.lsMarcas = lsMarcas; - } + public void setLsMarcas(List lsMarcas) { + this.lsMarcas = lsMarcas; + } - public List getLsMonedas() { - return lsMonedas; - } + public List getLsMonedas() { + return lsMonedas; + } - public void setLsMonedas(List lsMonedas) { - this.lsMonedas = lsMonedas; - } + public void setLsMonedas(List lsMonedas) { + this.lsMonedas = lsMonedas; + } - public List getLsTramos() { - return lsTramos; - } + public List getLsTramos() { + return lsTramos; + } - public void setLsTramos(List lsTramos) { - this.lsTramos = lsTramos; - } + public void setLsTramos(List lsTramos) { + this.lsTramos = lsTramos; + } - public MyListbox getTarifaList() { - return tarifaList; - } + public MyListbox getTarifaList() { + return tarifaList; + } - public void setTarifaList(MyListbox tarifaList) { - this.tarifaList = tarifaList; - } + public void setTarifaList(MyListbox tarifaList) { + this.tarifaList = tarifaList; + } - public List getLsCategoria() { - return lsCategoria; - } + public List getLsCategoria() { + return lsCategoria; + } - public void setLsCategoria(List lsCategoria) { - this.lsCategoria = lsCategoria; - } + public void setLsCategoria(List lsCategoria) { + this.lsCategoria = lsCategoria; + } - public List getLsTipoPontoVenta() { - return lsTipoPontoVenta; - } + public List getLsTipoPontoVenta() { + return lsTipoPontoVenta; + } - public void setLsTipoPontoVenta(List lsTipoPontoVenta) { - this.lsTipoPontoVenta = lsTipoPontoVenta; - } - - public List getLsRuta() { + public void setLsTipoPontoVenta(List lsTipoPontoVenta) { + this.lsTipoPontoVenta = lsTipoPontoVenta; + } + + public List getLsRuta() { return lsRuta; } @@ -235,234 +229,252 @@ public class BusquedaTarifaController extends MyGenericForwardComposer { } public Combobox getCmbCategoria() { - return cmbCategoria; + return cmbCategoria; + } + + public void setCmbCategoria(Combobox cmbCategoria) { + this.cmbCategoria = cmbCategoria; + } + + public Combobox getCmbTipoPontoVenta() { + return cmbTipoPontoVenta; + } + + public void setCmbTipoPontoVenta(Combobox cmbTipoPontoVenta) { + this.cmbTipoPontoVenta = cmbTipoPontoVenta; + } + + public void onClick$btnPesquisa(Event ev) throws InterruptedException { + refreshLista(); + } + + public void onClick$btnRefresh(Event ev) throws InterruptedException { + refreshLista(); + } + + public void onClick$btnNovo(Event ev) { + verTarifa(new Tarifa()); + } + + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); + + cmbMarca.addEventListener("onBlur", new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + Marca marca = getIfSelected(cmbMarca); + + lsRuta = new ArrayList(); + lsRuta.add(null); + if (marca != null) { + lsRuta.addAll(rutaService.obtenerPorEmpresa(marca.getEmpresa())); + } + else { + lsRuta.addAll(rutaService.obtenerTodos()); + } + + refreshLista(); + } + }); + + tarifaList.setItemRenderer(new RenderTarifa()); + tarifaList.addEventListener("onDoubleClick", new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + Tarifa t = (Tarifa) tarifaList.getSelected(); + verTarifa(t); + } + }); + + lsMarcas = marcaService.buscarMarcaPorEmpresa(UsuarioLogado.getUsuarioLogado().getEmpresa()); + + lsClaseServico = new ArrayList(); + lsClaseServico.add(null); + lsClaseServico.addAll(claseServicioService.obtenerTodos()); + + lsMonedas = new ArrayList(); + lsMonedas.add(null); + lsMonedas.addAll(monedaService.obtenerTodos()); + + lsVigencias = new ArrayList(); + lsVigencias.add(null); + lsVigencias.addAll(vigenciaTarifaService.obtenerTodos()); + + lsCategoria = new ArrayList(); + lsCategoria.add(null); + lsCategoria.addAll(categoriaService.obtenerTodos()); + + lsTipoPontoVenta = new ArrayList(); + lsTipoPontoVenta.add(null); + lsTipoPontoVenta.addAll(tipoPuntoVentaService.obtenerTodos()); + + lsRuta = new ArrayList(); + lsRuta.add(null); + lsRuta.addAll(rutaService.obtenerTodos()); + + lsVia = new ArrayList(); + lsVia.add(null); + lsVia.addAll(viaService.obtenerTodos()); + + refreshLista(); + } + + private void verTarifa(Tarifa t) { + if (t == null) { + return; + } + + Map args = new HashMap(); + args.put("tarifa", t); + args.put("tarifaList", tarifaList); + + openWindow("/gui/tarifas/editarTarifas.zul", + Labels.getLabel("editarTarifaController.window.title"), args, MODAL); + } + + @SuppressWarnings("unchecked") + private T getIfSelected(Combobox cb) { + return (T) (cb.getSelectedItem() != null ? cb.getSelectedItem().getValue() : null); } - public void setCmbCategoria(Combobox cmbCategoria) { - this.cmbCategoria = cmbCategoria; - } + private void refreshLista() throws InterruptedException { + Moneda moneda = getIfSelected(cmbMoneda); + Marca marca = getIfSelected(cmbMarca); + ClaseServicio claseServicio = getIfSelected(cmbClaseServicio); + VigenciaTarifa vigenciaTarifa = getIfSelected(cmbVigenciaTarifa); + Categoria categoria = getIfSelected(cmbCategoria); + TipoPuntoVenta tipoPuntoVenta = getIfSelected(cmbTipoPontoVenta); + Parada origem = getIfSelected(cmbOrigem); + Parada destino = getIfSelected(cmbDestino); + Ruta ruta = getIfSelected(cmbRuta); + Via via = getIfSelected(cmbVia); - public Combobox getCmbTipoPontoVenta() { - return cmbTipoPontoVenta; - } + if ((moneda == null) && (!cmbMoneda.getText().isEmpty())) { - public void setCmbTipoPontoVenta(Combobox cmbTipoPontoVenta) { - this.cmbTipoPontoVenta = cmbTipoPontoVenta; - } + Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Moneda.", + Labels.getLabel("editarTarifaController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); - public void onClick$btnPesquisa(Event ev) throws InterruptedException { - refreshLista(); - } + return; + } - public void onClick$btnRefresh(Event ev) throws InterruptedException { - refreshLista(); - } + if ((marca == null) && (!cmbMarca.getText().isEmpty())) { + Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Marca.", + Labels.getLabel("editarTarifaController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); - public void onClick$btnNovo(Event ev) { - verTarifa(new Tarifa()); - } + return; + } - @Override - public void doAfterCompose(Component comp) throws Exception { - super.doAfterCompose(comp); + if ((claseServicio == null) && (!cmbClaseServicio.getText().isEmpty())) { + Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Clase servicio.", + Labels.getLabel("editarTarifaController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); - tarifaList.setItemRenderer(new RenderTarifa()); - tarifaList.addEventListener("onDoubleClick", new EventListener() { + return; + } - @Override - public void onEvent(Event event) throws Exception { - Tarifa t = (Tarifa) tarifaList.getSelected(); - verTarifa(t); - } - }); + if ((vigenciaTarifa == null) && (!cmbVigenciaTarifa.getText().isEmpty())) { + Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Vigencia Tarifa.", + Labels.getLabel("editarTarifaController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); - lsMarcas = marcaService.buscarMarcaPorEmpresa(UsuarioLogado.getUsuarioLogado().getEmpresa()); + return; + } - lsClaseServico = new ArrayList(); - lsClaseServico.add(null); - lsClaseServico.addAll(claseServicioService.obtenerTodos()); + if ((origem == null) && (!cmbOrigem.getText().isEmpty())) { + Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Origen.", + Labels.getLabel("editarTarifaController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); - lsMonedas = new ArrayList(); - lsMonedas.add(null); - lsMonedas.addAll(monedaService.obtenerTodos()); + return; + } - lsVigencias = new ArrayList(); - lsVigencias.add(null); - lsVigencias.addAll(vigenciaTarifaService.obtenerTodos()); + if ((destino == null) && (!cmbDestino.getText().isEmpty())) { + Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Destino.", + Labels.getLabel("editarTarifaController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); - lsCategoria = new ArrayList(); - lsCategoria.add(null); - lsCategoria.addAll(categoriaService.obtenerTodos()); + return; + } - lsTipoPontoVenta = new ArrayList(); - lsTipoPontoVenta.add(null); - lsTipoPontoVenta.addAll(tipoPuntoVentaService.obtenerTodos()); - - lsRuta = new ArrayList(); - lsRuta.add(null); - lsRuta.addAll(rutaService.obtenerTodos()); - - lsVia = new ArrayList(); - lsVia.add(null); - lsVia.addAll(viaService.obtenerTodos()); + if ((tipoPuntoVenta == null) && (!cmbTipoPontoVenta.getText().isEmpty())) { + Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Tipo Punto de Venta.", + Labels.getLabel("editarTarifaController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); - refreshLista(); - } + return; + } - private void verTarifa(Tarifa t) { - if (t == null) { - return; - } + if ((categoria == null) && (!cmbCategoria.getText().isEmpty())) { + Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Tipo de Pasajero.", + Labels.getLabel("editarTarifaController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); - Map args = new HashMap(); - args.put("tarifa", t); - args.put("tarifaList", tarifaList); + return; + } - openWindow("/gui/tarifas/editarTarifas.zul", - Labels.getLabel("editarTarifaController.window.title"), args, MODAL); - } + if ((ruta == null) && (!cmbRuta.getText().isEmpty())) { + Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Ruta.", + Labels.getLabel("editarTarifaController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); - private void refreshLista() throws InterruptedException { - Moneda moneda = (Moneda) (cmbMoneda.getSelectedItem() != null ? cmbMoneda.getSelectedItem().getValue() : null); - Marca marca = (Marca) (cmbMarca.getSelectedItem() != null ? cmbMarca.getSelectedItem().getValue() : null); - ClaseServicio claseServicio = (ClaseServicio) (cmbClaseServicio.getSelectedItem() != null ? cmbClaseServicio.getSelectedItem().getValue() : null); - VigenciaTarifa vigenciaTarifa = (VigenciaTarifa) (cmbVigenciaTarifa.getSelectedItem() != null ? cmbVigenciaTarifa.getSelectedItem().getValue() : null); - Categoria categoria = (Categoria) (cmbCategoria.getSelectedItem() != null ? cmbCategoria.getSelectedItem().getValue() : null); - TipoPuntoVenta tipoPuntoVenta = (TipoPuntoVenta) (cmbTipoPontoVenta.getSelectedItem() != null ? cmbTipoPontoVenta.getSelectedItem().getValue() : null); - Parada origem = (Parada) (cmbOrigem.getSelectedItem() != null ? cmbOrigem.getSelectedItem().getValue() : null); - Parada destino = (Parada) (cmbDestino.getSelectedItem() != null ? cmbDestino.getSelectedItem().getValue() : null); - Ruta ruta = (Ruta) (cmbRuta.getSelectedItem() != null ? cmbRuta.getSelectedItem().getValue() : null); - Via via = (Via) (cmbVia.getSelectedItem() != null ? cmbVia.getSelectedItem().getValue() : null); - - if ((moneda == null) && (!cmbMoneda.getText().isEmpty())) { - - Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Moneda.", - Labels.getLabel("editarTarifaController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); + return; + } - return; - } + if ((via == null) && (!cmbVia.getText().isEmpty())) { + Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Via.", + Labels.getLabel("editarTarifaController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); - if ((marca == null) && (!cmbMarca.getText().isEmpty())) { - Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Marca.", - Labels.getLabel("editarTarifaController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); + return; + } - return; - } + HibernateSearchObject tarifaBusqueda = new HibernateSearchObject(Tarifa.class, pagingTarifa.getPageSize()); + tarifaBusqueda.addFilterEqual("activo", Boolean.TRUE); - if ((claseServicio == null) && (!cmbClaseServicio.getText().isEmpty())) { - Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Clase servicio.", - Labels.getLabel("editarTarifaController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); + tarifaBusqueda.addFilterEqual("moneda", moneda); + if (marca != null) { + tarifaBusqueda.addFilterEqual("marca", marca); + } + else { + tarifaBusqueda.addFilterIn("marca", lsMarcas); + } + tarifaBusqueda.addFilterEqual("claseServicio", claseServicio); + tarifaBusqueda.addFilterEqual("vigenciaTarifa", vigenciaTarifa); + tarifaBusqueda.addFilterEqual("tramo.origem", origem); + tarifaBusqueda.addFilterEqual("tramo.destino", destino); - return; - } + if (categoria != null) { + tarifaBusqueda.addFilterSome("lsTarifaCategoria", + Filter.equal("categoria.categoriaId", categoria.getCategoriaId())); + } - if ((vigenciaTarifa == null) && (!cmbVigenciaTarifa.getText().isEmpty())) { - Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Vigencia Tarifa.", - Labels.getLabel("editarTarifaController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); + if (tipoPuntoVenta != null) { + tarifaBusqueda.addFilterSome("lsTarifaTipoptovta", + Filter.equal("tipoPuntoVenta.tipoptovtaId", + tipoPuntoVenta.getTipoptovtaId())); + } - return; - } - - if ((origem == null) && (!cmbOrigem.getText().isEmpty())) { - Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Origen.", - Labels.getLabel("editarTarifaController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); - - return; - } - - if ((destino == null) && (!cmbDestino.getText().isEmpty())) { - try { - Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Destino.", - Labels.getLabel("editarTarifaController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); - - return; - } catch (Exception ex) { - log.error(ex); - } - } - - if ((tipoPuntoVenta == null) && (!cmbTipoPontoVenta.getText().isEmpty())) { - Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Tipo Punto de Venta.", - Labels.getLabel("editarTarifaController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); - - return; - } - - if ((categoria == null) && (!cmbCategoria.getText().isEmpty())) { - Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Tipo de Pasajero.", - Labels.getLabel("editarTarifaController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); - - return; - } - - if ((ruta == null) && (!cmbRuta.getText().isEmpty())) { - Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Ruta.", - Labels.getLabel("editarTarifaController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); - - return; - } - - if ((via == null) && (!cmbVia.getText().isEmpty())) { - Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Via.", - Labels.getLabel("editarTarifaController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); - - return; - } - - HibernateSearchObject tarifaBusqueda = - new HibernateSearchObject(Tarifa.class, pagingTarifa.getPageSize()); - tarifaBusqueda.addFilterEqual("activo", Boolean.TRUE); - - tarifaBusqueda.addFilterEqual("moneda", moneda); - if(marca != null){ - tarifaBusqueda.addFilterEqual("marca", marca); - }else{ - tarifaBusqueda.addFilterIn("marca", lsMarcas); - } - tarifaBusqueda.addFilterEqual("claseServicio", claseServicio); - tarifaBusqueda.addFilterEqual("vigenciaTarifa", vigenciaTarifa); - tarifaBusqueda.addFilterEqual("tramo.origem", origem); - tarifaBusqueda.addFilterEqual("tramo.destino", destino); - - if (categoria != null) { - tarifaBusqueda.addFilterSome("lsTarifaCategoria", - Filter.equal("categoria.categoriaId", categoria.getCategoriaId())); - } - - if (tipoPuntoVenta != null) { - tarifaBusqueda.addFilterSome("lsTarifaTipoptovta", - Filter.equal("tipoPuntoVenta.tipoptovtaId", - tipoPuntoVenta.getTipoptovtaId())); - } - if (ruta != null) { - tarifaBusqueda.addFilterEqual("ruta", ruta); + tarifaBusqueda.addFilterEqual("ruta", ruta); } if (via != null) { - tarifaBusqueda.addFilterEqual("tramo.via", via); + tarifaBusqueda.addFilterEqual("tramo.via", via); } - plwTarifa.init(tarifaBusqueda, tarifaList, pagingTarifa); - if (tarifaList.getData().length == 0) { - try { - Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), - Labels.getLabel("editarTarifaController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - } catch (InterruptedException ex) { - } - } - } + plwTarifa.init(tarifaBusqueda, tarifaList, pagingTarifa); + if (tarifaList.getData().length == 0) { + try { + Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), + Labels.getLabel("editarTarifaController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } + catch (InterruptedException ex) { + } + } + } - }