lucas.taia 2014-02-18 23:37:09 +00:00
parent 92dc739318
commit 64ffdf8425
3 changed files with 108 additions and 2 deletions

View File

@ -19,6 +19,7 @@ import org.zkoss.zhtml.Messagebox;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zkplus.databind.BindingListModelList;
import org.zkoss.zul.Checkbox; import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Combobox; import org.zkoss.zul.Combobox;
import org.zkoss.zul.Datebox; import org.zkoss.zul.Datebox;
@ -26,9 +27,14 @@ import org.zkoss.zul.Paging;
import org.zkoss.zul.Textbox; import org.zkoss.zul.Textbox;
import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.Pricing; 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.EmpresaService;
import com.rjconsultores.ventaboletos.service.ParadaService;
import com.rjconsultores.ventaboletos.service.PricingService; import com.rjconsultores.ventaboletos.service.PricingService;
import com.rjconsultores.ventaboletos.service.RutaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox; import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
@ -51,15 +57,24 @@ public class BusquedaPricingController extends MyGenericForwardComposer {
private PricingService pricingService; private PricingService pricingService;
@Autowired @Autowired
private EmpresaService empresaService; private EmpresaService empresaService;
@Autowired
private RutaService rutaService;
private MyListbox pricingList; private MyListbox pricingList;
private Paging pagingPricing; private Paging pagingPricing;
private List<Pricing> lsPricing; private List<Pricing> lsPricing;
private List<Empresa> lsEmpresa; private List<Empresa> lsEmpresa;
private List<Ruta> lsRuta;
private Combobox cmbEmpresa; private Combobox cmbEmpresa;
private Textbox txtNome; private Textbox txtNome;
private Datebox fechaInicio; private Datebox fechaInicio;
private Datebox fechaFin; private Datebox fechaFin;
private Checkbox chkBuscarInativos; private Checkbox chkBuscarInativos;
private Combobox cmbRuta;
private Combobox cmbOrigen;
private Combobox cmbDestino;
@Autowired
private ParadaService paradaService;
private static Logger log = Logger.getLogger(BusquedaPricingController.class); private static Logger log = Logger.getLogger(BusquedaPricingController.class);
public List<Pricing> getLsPricing() { public List<Pricing> getLsPricing() {
@ -134,6 +149,30 @@ public class BusquedaPricingController extends MyGenericForwardComposer {
this.fechaFin = fechaFin; 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 @Override
public void doAfterCompose(Component comp) throws Exception { public void doAfterCompose(Component comp) throws Exception {
@ -156,6 +195,19 @@ public class BusquedaPricingController extends MyGenericForwardComposer {
refreshLista(); 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 { public void onClick$btnPesquisa(Event ev) throws InterruptedException {
refreshLista(); refreshLista();
} }
@ -169,7 +221,28 @@ public class BusquedaPricingController extends MyGenericForwardComposer {
} }
private void refreshLista() { private void refreshLista() {
Empresa empresa = (Empresa) (cmbEmpresa.getSelectedItem() != null ? cmbEmpresa.getSelectedItem().getValue() : null); 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>( HibernateSearchObject<Pricing> pricingSearch = new HibernateSearchObject<Pricing>(
Pricing.class, pagingPricing.getPageSize()); Pricing.class, pagingPricing.getPageSize());
@ -180,6 +253,18 @@ public class BusquedaPricingController extends MyGenericForwardComposer {
pricingSearch.addFilterIn("empresa", lsEmpresa); 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()) { if (!txtNome.getValue().isEmpty()) {
pricingSearch.addFilterILike("nombPricing", txtNome.getValue() + "%"); pricingSearch.addFilterILike("nombPricing", txtNome.getValue() + "%");
} }

View File

@ -21,7 +21,7 @@ public class RenderPricingRuta implements ListitemRenderer {
Listcell lc = new Listcell(); Listcell lc = new Listcell();
if (pc.getRuta() != null) { 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 { } else {
lc = new Listcell("-"); lc = new Listcell("-");
} }

View File

@ -51,6 +51,27 @@
<checkbox id="chkBuscarInativos" checked="false" <checkbox id="chkBuscarInativos" checked="false"
label="${c:l('busquedaPricingController.lhBuscarInativos.label')}" /> label="${c:l('busquedaPricingController.lhBuscarInativos.label')}" />
</row> </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> <row>
<label <label
value="${c:l('editarPricingController.vigHoraInicioViaje.value')}" /> value="${c:l('editarPricingController.vigHoraInicioViaje.value')}" />