fixed bug #7586: Modificação na tela Alteração de Preço
imp.: Já havia sido implementado adc.: Modificado para mostrar a caixa de seleção de linhas com as que correspondem à empresa da marca selecionada git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@57289 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
28f2ae65f4
commit
516889b62f
|
@ -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<Tarifa> 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<Marca> lsMarcas;
|
||||
private List<ClaseServicio> lsClaseServico;
|
||||
private List<Tramo> lsTramos;
|
||||
private List<Moneda> lsMonedas;
|
||||
private List<VigenciaTarifa> lsVigencias;
|
||||
private List<Categoria> lsCategoria;
|
||||
private List<TipoPuntoVenta> lsTipoPontoVenta;
|
||||
private List<Ruta> lsRuta;
|
||||
private List<Via> lsVia;
|
||||
@Autowired
|
||||
private transient PagedListWrapper<Tarifa> 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<Marca> lsMarcas;
|
||||
private List<ClaseServicio> lsClaseServico;
|
||||
private List<Tramo> lsTramos;
|
||||
private List<Moneda> lsMonedas;
|
||||
private List<VigenciaTarifa> lsVigencias;
|
||||
private List<Categoria> lsCategoria;
|
||||
private List<TipoPuntoVenta> lsTipoPontoVenta;
|
||||
private List<Ruta> lsRuta;
|
||||
private List<Via> 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 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);
|
||||
|
||||
private static final Logger log = Logger.getLogger(BusquedaTarifaController.class);
|
||||
public List<VigenciaTarifa> getLsVigencias() {
|
||||
return lsVigencias;
|
||||
}
|
||||
|
||||
public List<VigenciaTarifa> getLsVigencias() {
|
||||
return lsVigencias;
|
||||
}
|
||||
public void setLsVigencias(List<VigenciaTarifa> lsVigencias) {
|
||||
this.lsVigencias = lsVigencias;
|
||||
}
|
||||
|
||||
public void setLsVigencias(List<VigenciaTarifa> lsVigencias) {
|
||||
this.lsVigencias = lsVigencias;
|
||||
}
|
||||
public Combobox getCmbVigenciaTarifa() {
|
||||
return cmbVigenciaTarifa;
|
||||
}
|
||||
|
||||
public Combobox getCmbVigenciaTarifa() {
|
||||
return cmbVigenciaTarifa;
|
||||
}
|
||||
public void setCmbVigenciaTarifa(Combobox cmbVigenciaTarifa) {
|
||||
this.cmbVigenciaTarifa = cmbVigenciaTarifa;
|
||||
}
|
||||
|
||||
public void setCmbVigenciaTarifa(Combobox cmbVigenciaTarifa) {
|
||||
this.cmbVigenciaTarifa = cmbVigenciaTarifa;
|
||||
}
|
||||
public Combobox getCmbClaseServicio() {
|
||||
return cmbClaseServicio;
|
||||
}
|
||||
|
||||
public Combobox getCmbClaseServicio() {
|
||||
return cmbClaseServicio;
|
||||
}
|
||||
public void setCmbClaseServicio(Combobox cmbClaseServicio) {
|
||||
this.cmbClaseServicio = cmbClaseServicio;
|
||||
}
|
||||
|
||||
public void setCmbClaseServicio(Combobox cmbClaseServicio) {
|
||||
this.cmbClaseServicio = cmbClaseServicio;
|
||||
}
|
||||
public Combobox getCmbMarca() {
|
||||
return cmbMarca;
|
||||
}
|
||||
|
||||
public Combobox getCmbMarca() {
|
||||
return cmbMarca;
|
||||
}
|
||||
public void setCmbMarca(Combobox cmbMarca) {
|
||||
this.cmbMarca = cmbMarca;
|
||||
}
|
||||
|
||||
public void setCmbMarca(Combobox cmbMarca) {
|
||||
this.cmbMarca = cmbMarca;
|
||||
}
|
||||
public Combobox getCmbMoneda() {
|
||||
return cmbMoneda;
|
||||
}
|
||||
|
||||
public Combobox getCmbMoneda() {
|
||||
return cmbMoneda;
|
||||
}
|
||||
public void setCmbMoneda(Combobox cmbMoneda) {
|
||||
this.cmbMoneda = cmbMoneda;
|
||||
}
|
||||
|
||||
public void setCmbMoneda(Combobox cmbMoneda) {
|
||||
this.cmbMoneda = cmbMoneda;
|
||||
}
|
||||
|
||||
public Combobox getCmbRuta() {
|
||||
public Combobox getCmbRuta() {
|
||||
return cmbRuta;
|
||||
}
|
||||
|
||||
|
@ -163,62 +157,62 @@ public class BusquedaTarifaController extends MyGenericForwardComposer {
|
|||
}
|
||||
|
||||
public List<ClaseServicio> getLsClaseServico() {
|
||||
return lsClaseServico;
|
||||
}
|
||||
return lsClaseServico;
|
||||
}
|
||||
|
||||
public void setLsClaseServico(List<ClaseServicio> lsClaseServico) {
|
||||
this.lsClaseServico = lsClaseServico;
|
||||
}
|
||||
public void setLsClaseServico(List<ClaseServicio> lsClaseServico) {
|
||||
this.lsClaseServico = lsClaseServico;
|
||||
}
|
||||
|
||||
public List<Marca> getLsMarcas() {
|
||||
return lsMarcas;
|
||||
}
|
||||
public List<Marca> getLsMarcas() {
|
||||
return lsMarcas;
|
||||
}
|
||||
|
||||
public void setLsMarcas(List<Marca> lsMarcas) {
|
||||
this.lsMarcas = lsMarcas;
|
||||
}
|
||||
public void setLsMarcas(List<Marca> lsMarcas) {
|
||||
this.lsMarcas = lsMarcas;
|
||||
}
|
||||
|
||||
public List<Moneda> getLsMonedas() {
|
||||
return lsMonedas;
|
||||
}
|
||||
public List<Moneda> getLsMonedas() {
|
||||
return lsMonedas;
|
||||
}
|
||||
|
||||
public void setLsMonedas(List<Moneda> lsMonedas) {
|
||||
this.lsMonedas = lsMonedas;
|
||||
}
|
||||
public void setLsMonedas(List<Moneda> lsMonedas) {
|
||||
this.lsMonedas = lsMonedas;
|
||||
}
|
||||
|
||||
public List<Tramo> getLsTramos() {
|
||||
return lsTramos;
|
||||
}
|
||||
public List<Tramo> getLsTramos() {
|
||||
return lsTramos;
|
||||
}
|
||||
|
||||
public void setLsTramos(List<Tramo> lsTramos) {
|
||||
this.lsTramos = lsTramos;
|
||||
}
|
||||
public void setLsTramos(List<Tramo> 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<Categoria> getLsCategoria() {
|
||||
return lsCategoria;
|
||||
}
|
||||
public List<Categoria> getLsCategoria() {
|
||||
return lsCategoria;
|
||||
}
|
||||
|
||||
public void setLsCategoria(List<Categoria> lsCategoria) {
|
||||
this.lsCategoria = lsCategoria;
|
||||
}
|
||||
public void setLsCategoria(List<Categoria> lsCategoria) {
|
||||
this.lsCategoria = lsCategoria;
|
||||
}
|
||||
|
||||
public List<TipoPuntoVenta> getLsTipoPontoVenta() {
|
||||
return lsTipoPontoVenta;
|
||||
}
|
||||
public List<TipoPuntoVenta> getLsTipoPontoVenta() {
|
||||
return lsTipoPontoVenta;
|
||||
}
|
||||
|
||||
public void setLsTipoPontoVenta(List<TipoPuntoVenta> lsTipoPontoVenta) {
|
||||
this.lsTipoPontoVenta = lsTipoPontoVenta;
|
||||
}
|
||||
public void setLsTipoPontoVenta(List<TipoPuntoVenta> lsTipoPontoVenta) {
|
||||
this.lsTipoPontoVenta = lsTipoPontoVenta;
|
||||
}
|
||||
|
||||
public List<Ruta> getLsRuta() {
|
||||
public List<Ruta> 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<Ruta>();
|
||||
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<ClaseServicio>();
|
||||
lsClaseServico.add(null);
|
||||
lsClaseServico.addAll(claseServicioService.obtenerTodos());
|
||||
|
||||
lsMonedas = new ArrayList<Moneda>();
|
||||
lsMonedas.add(null);
|
||||
lsMonedas.addAll(monedaService.obtenerTodos());
|
||||
|
||||
lsVigencias = new ArrayList<VigenciaTarifa>();
|
||||
lsVigencias.add(null);
|
||||
lsVigencias.addAll(vigenciaTarifaService.obtenerTodos());
|
||||
|
||||
lsCategoria = new ArrayList<Categoria>();
|
||||
lsCategoria.add(null);
|
||||
lsCategoria.addAll(categoriaService.obtenerTodos());
|
||||
|
||||
lsTipoPontoVenta = new ArrayList<TipoPuntoVenta>();
|
||||
lsTipoPontoVenta.add(null);
|
||||
lsTipoPontoVenta.addAll(tipoPuntoVentaService.obtenerTodos());
|
||||
|
||||
lsRuta = new ArrayList<Ruta>();
|
||||
lsRuta.add(null);
|
||||
lsRuta.addAll(rutaService.obtenerTodos());
|
||||
|
||||
lsVia = new ArrayList<Via>();
|
||||
lsVia.add(null);
|
||||
lsVia.addAll(viaService.obtenerTodos());
|
||||
|
||||
refreshLista();
|
||||
}
|
||||
|
||||
private void verTarifa(Tarifa t) {
|
||||
if (t == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, Object> args = new HashMap<String, Object>();
|
||||
args.put("tarifa", t);
|
||||
args.put("tarifaList", tarifaList);
|
||||
|
||||
openWindow("/gui/tarifas/editarTarifas.zul",
|
||||
Labels.getLabel("editarTarifaController.window.title"), args, MODAL);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> 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<ClaseServicio>();
|
||||
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<Moneda>();
|
||||
lsMonedas.add(null);
|
||||
lsMonedas.addAll(monedaService.obtenerTodos());
|
||||
return;
|
||||
}
|
||||
|
||||
lsVigencias = new ArrayList<VigenciaTarifa>();
|
||||
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<Categoria>();
|
||||
lsCategoria.add(null);
|
||||
lsCategoria.addAll(categoriaService.obtenerTodos());
|
||||
return;
|
||||
}
|
||||
|
||||
lsTipoPontoVenta = new ArrayList<TipoPuntoVenta>();
|
||||
lsTipoPontoVenta.add(null);
|
||||
lsTipoPontoVenta.addAll(tipoPuntoVentaService.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);
|
||||
|
||||
lsRuta = new ArrayList<Ruta>();
|
||||
lsRuta.add(null);
|
||||
lsRuta.addAll(rutaService.obtenerTodos());
|
||||
return;
|
||||
}
|
||||
|
||||
lsVia = new ArrayList<Via>();
|
||||
lsVia.add(null);
|
||||
lsVia.addAll(viaService.obtenerTodos());
|
||||
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);
|
||||
|
||||
refreshLista();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private void verTarifa(Tarifa t) {
|
||||
if (t == null) {
|
||||
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);
|
||||
|
||||
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 ((via == null) && (!cmbVia.getText().isEmpty())) {
|
||||
Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Via.",
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((moneda == null) && (!cmbMoneda.getText().isEmpty())) {
|
||||
HibernateSearchObject<Tarifa> tarifaBusqueda = new HibernateSearchObject<Tarifa>(Tarifa.class, pagingTarifa.getPageSize());
|
||||
tarifaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||
|
||||
Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Moneda.",
|
||||
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 ((marca == null) && (!cmbMarca.getText().isEmpty())) {
|
||||
Messagebox.show(Labels.getLabel("MSG.SELECCIONE.VALOR.CORRECTO") + " Marca.",
|
||||
Labels.getLabel("editarTarifaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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<Tarifa> tarifaBusqueda =
|
||||
new HibernateSearchObject<Tarifa>(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 (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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue