Mantis 4916
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@33748 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
92dc739318
commit
64ffdf8425
|
@ -19,6 +19,7 @@ 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.zkplus.databind.BindingListModelList;
|
||||
import org.zkoss.zul.Checkbox;
|
||||
import org.zkoss.zul.Combobox;
|
||||
import org.zkoss.zul.Datebox;
|
||||
|
@ -26,9 +27,14 @@ import org.zkoss.zul.Paging;
|
|||
import org.zkoss.zul.Textbox;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.Pricing;
|
||||
import com.rjconsultores.ventaboletos.entidad.PricingRuta;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.ParadaService;
|
||||
import com.rjconsultores.ventaboletos.service.PricingService;
|
||||
import com.rjconsultores.ventaboletos.service.RutaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
|
@ -51,15 +57,24 @@ public class BusquedaPricingController extends MyGenericForwardComposer {
|
|||
private PricingService pricingService;
|
||||
@Autowired
|
||||
private EmpresaService empresaService;
|
||||
@Autowired
|
||||
private RutaService rutaService;
|
||||
private MyListbox pricingList;
|
||||
private Paging pagingPricing;
|
||||
private List<Pricing> lsPricing;
|
||||
private List<Empresa> lsEmpresa;
|
||||
private List<Ruta> lsRuta;
|
||||
private Combobox cmbEmpresa;
|
||||
private Textbox txtNome;
|
||||
private Datebox fechaInicio;
|
||||
private Datebox fechaFin;
|
||||
private Checkbox chkBuscarInativos;
|
||||
private Combobox cmbRuta;
|
||||
private Combobox cmbOrigen;
|
||||
private Combobox cmbDestino;
|
||||
@Autowired
|
||||
private ParadaService paradaService;
|
||||
|
||||
private static Logger log = Logger.getLogger(BusquedaPricingController.class);
|
||||
|
||||
public List<Pricing> getLsPricing() {
|
||||
|
@ -134,11 +149,35 @@ public class BusquedaPricingController extends MyGenericForwardComposer {
|
|||
this.fechaFin = fechaFin;
|
||||
}
|
||||
|
||||
public RutaService getRutaService() {
|
||||
return rutaService;
|
||||
}
|
||||
|
||||
public void setRutaService(RutaService rutaService) {
|
||||
this.rutaService = rutaService;
|
||||
}
|
||||
|
||||
public List<Ruta> getLsRuta() {
|
||||
return lsRuta;
|
||||
}
|
||||
|
||||
public void setLsRuta(List<Ruta> lsRuta) {
|
||||
this.lsRuta = lsRuta;
|
||||
}
|
||||
|
||||
public Combobox getCmbRuta() {
|
||||
return cmbRuta;
|
||||
}
|
||||
|
||||
public void setCmbRuta(Combobox cmbRuta) {
|
||||
this.cmbRuta = cmbRuta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
|
||||
lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
|
||||
|
||||
|
||||
super.doAfterCompose(comp);
|
||||
|
||||
pricingList.setItemRenderer(new RenderPricing());
|
||||
|
@ -156,6 +195,19 @@ public class BusquedaPricingController extends MyGenericForwardComposer {
|
|||
refreshLista();
|
||||
}
|
||||
|
||||
public void onChange$cmbEmpresa(Event ev) throws InterruptedException {
|
||||
|
||||
Empresa empresa = (Empresa) (cmbEmpresa.getSelectedItem() != null ? cmbEmpresa.getSelectedItem().getValue() : null);
|
||||
|
||||
if (empresa != null) {
|
||||
lsRuta = rutaService.obtenerPorEmpresa(empresa);
|
||||
lsRuta.add(rutaService.obtenerID(-1));
|
||||
BindingListModelList l = new BindingListModelList(lsRuta, true);
|
||||
cmbRuta.setModel(l);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||
refreshLista();
|
||||
}
|
||||
|
@ -169,7 +221,28 @@ public class BusquedaPricingController extends MyGenericForwardComposer {
|
|||
}
|
||||
|
||||
private void refreshLista() {
|
||||
|
||||
Empresa empresa = (Empresa) (cmbEmpresa.getSelectedItem() != null ? cmbEmpresa.getSelectedItem().getValue() : null);
|
||||
Ruta ruta = (Ruta) (cmbRuta.getSelectedItem() != null ? cmbRuta.getSelectedItem().getValue() : null);
|
||||
Parada origen = null;
|
||||
|
||||
if (cmbOrigen.getSelectedItem() == null) {
|
||||
List<Parada> lsParadaOri = paradaService.buscar(cmbOrigen.getText().toUpperCase());
|
||||
if (!lsParadaOri.isEmpty()) {
|
||||
origen = lsParadaOri.get(0);
|
||||
}
|
||||
} else {
|
||||
origen = (Parada) cmbOrigen.getSelectedItem().getValue();
|
||||
}
|
||||
Parada destino = null;
|
||||
if (cmbDestino.getSelectedItem() == null) {
|
||||
List<Parada> lsParadaOri = paradaService.buscar(cmbDestino.getText().toUpperCase());
|
||||
if (!lsParadaOri.isEmpty()) {
|
||||
destino = lsParadaOri.get(0);
|
||||
}
|
||||
} else {
|
||||
destino = (Parada) cmbDestino.getSelectedItem().getValue();
|
||||
}
|
||||
|
||||
HibernateSearchObject<Pricing> pricingSearch = new HibernateSearchObject<Pricing>(
|
||||
Pricing.class, pagingPricing.getPageSize());
|
||||
|
@ -179,6 +252,18 @@ public class BusquedaPricingController extends MyGenericForwardComposer {
|
|||
} else {
|
||||
pricingSearch.addFilterIn("empresa", lsEmpresa);
|
||||
}
|
||||
|
||||
if (ruta != null) {
|
||||
pricingSearch.addFilterIn("pricingRutaList.ruta", ruta);
|
||||
}
|
||||
|
||||
if (origen != null) {
|
||||
pricingSearch.addFilterIn("pricingMercadoList.origen", origen);
|
||||
}
|
||||
|
||||
if (destino != null) {
|
||||
pricingSearch.addFilterIn("pricingMercadoList.destino", destino);
|
||||
}
|
||||
|
||||
if (!txtNome.getValue().isEmpty()) {
|
||||
pricingSearch.addFilterILike("nombPricing", txtNome.getValue() + "%");
|
||||
|
|
|
@ -21,7 +21,7 @@ public class RenderPricingRuta implements ListitemRenderer {
|
|||
Listcell lc = new Listcell();
|
||||
|
||||
if (pc.getRuta() != null) {
|
||||
lc = new Listcell(pc.getRuta().getRutaId().toString() + " - " + pc.getRuta().getDescruta());
|
||||
lc = new Listcell(pc.getRuta().getRutaId().toString() + " - " + pc.getRuta().getDescruta() + " - " + pc.getRuta().getPrefixo() );
|
||||
} else {
|
||||
lc = new Listcell("-");
|
||||
}
|
||||
|
|
|
@ -51,6 +51,27 @@
|
|||
<checkbox id="chkBuscarInativos" checked="false"
|
||||
label="${c:l('busquedaPricingController.lhBuscarInativos.label')}" />
|
||||
</row>
|
||||
<row spans="1,3">
|
||||
<label
|
||||
value="${c:l('editarPricingController.ruta.value')}" />
|
||||
<combobox id="cmbRuta" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
|
||||
mold="rounded" buttonVisible="true" width="90%"
|
||||
model="@{winBusquedaPricing$composer.lsRuta}"
|
||||
>
|
||||
</combobox>
|
||||
</row>
|
||||
<row spans="1,3">
|
||||
<label value="${c:l('editarPricingController.mercadoOrigen.value')}"/>
|
||||
<combobox id="cmbOrigen" autodrop="false" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada"
|
||||
mold="rounded" buttonVisible="true" width="90%"
|
||||
/>
|
||||
</row>
|
||||
<row spans="1,3">
|
||||
<label value="${c:l('editarPricingController.mercadoDestino.value')}"/>
|
||||
<combobox id="cmbDestino" autodrop="false" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada"
|
||||
mold="rounded" buttonVisible="true" width="90%"
|
||||
/>
|
||||
</row>
|
||||
<row>
|
||||
<label
|
||||
value="${c:l('editarPricingController.vigHoraInicioViaje.value')}" />
|
||||
|
|
Loading…
Reference in New Issue