diff --git a/pom.xml b/pom.xml
index 976215843..889efca42 100644
--- a/pom.xml
+++ b/pom.xml
@@ -255,6 +255,12 @@
jxl
2.6.12
+
+
+ br.com.rjconsultores
+ colorbox
+ 1.0.0
+
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/PricingColorVO.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/PricingColorVO.java
new file mode 100644
index 000000000..7bd829138
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/PricingColorVO.java
@@ -0,0 +1,42 @@
+package com.rjconsultores.ventaboletos.relatorios.utilitarios;
+
+public class PricingColorVO {
+
+ private String id;
+ private String idBanco;
+ private String color;
+ private String backgroundColor;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public void setColor(String color) {
+ this.color = color;
+ }
+
+ public String getBackgroundColor() {
+ return backgroundColor;
+ }
+
+ public void setBackgroundColor(String backgroundColor) {
+ this.backgroundColor = backgroundColor;
+ }
+
+ public String getIdBanco() {
+ return idBanco;
+ }
+
+ public void setIdBanco(String idBanco) {
+ this.idBanco = idBanco;
+ }
+
+}
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/PricingGestaoAlteradoVO.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/PricingGestaoAlteradoVO.java
new file mode 100644
index 000000000..79104ec99
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/PricingGestaoAlteradoVO.java
@@ -0,0 +1,44 @@
+package com.rjconsultores.ventaboletos.relatorios.utilitarios;
+
+import java.util.Date;
+
+public class PricingGestaoAlteradoVO {
+
+ private String pricing;
+ private String servico;
+ private String id;
+ private Date data;
+
+ public String getPricing() {
+ return pricing;
+ }
+
+ public void setPricing(String pricing) {
+ this.pricing = pricing;
+ }
+
+ public Date getData() {
+ return data;
+ }
+
+ public void setData(Date data) {
+ this.data = data;
+ }
+
+ public String getServico() {
+ return servico;
+ }
+
+ public void setServico(String servico) {
+ this.servico = servico;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+}
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/PricingGestaoVO.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/PricingGestaoVO.java
new file mode 100644
index 000000000..1ffb043d5
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/PricingGestaoVO.java
@@ -0,0 +1,78 @@
+package com.rjconsultores.ventaboletos.relatorios.utilitarios;
+
+public class PricingGestaoVO {
+
+ private String servico;
+ private String domingo;
+ private String segunda;
+ private String terca;
+ private String quarta;
+ private String quinta;
+ private String sexta;
+ private String sabado;
+
+ public String getServico() {
+ return servico;
+ }
+
+ public void setServico(String servico) {
+ this.servico = servico;
+ }
+
+ public String getDomingo() {
+ return domingo;
+ }
+
+ public void setDomingo(String domingo) {
+ this.domingo = domingo;
+ }
+
+ public String getSegunda() {
+ return segunda;
+ }
+
+ public void setSegunda(String segunda) {
+ this.segunda = segunda;
+ }
+
+ public String getTerca() {
+ return terca;
+ }
+
+ public void setTerca(String terca) {
+ this.terca = terca;
+ }
+
+ public String getQuarta() {
+ return quarta;
+ }
+
+ public void setQuarta(String quarta) {
+ this.quarta = quarta;
+ }
+
+ public String getQuinta() {
+ return quinta;
+ }
+
+ public void setQuinta(String quinta) {
+ this.quinta = quinta;
+ }
+
+ public String getSexta() {
+ return sexta;
+ }
+
+ public void setSexta(String sexta) {
+ this.sexta = sexta;
+ }
+
+ public String getSabado() {
+ return sabado;
+ }
+
+ public void setSabado(String sabado) {
+ this.sabado = sabado;
+ }
+
+}
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/BusquedaGP_PricingController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/BusquedaGP_PricingController.java
new file mode 100644
index 000000000..86b61c611
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/BusquedaGP_PricingController.java
@@ -0,0 +1,371 @@
+package com.rjconsultores.ventaboletos.web.gui.controladores.gestaopricing;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+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.zkplus.databind.BindingListModelList;
+import org.zkoss.zul.Checkbox;
+import org.zkoss.zul.Combobox;
+import org.zkoss.zul.Datebox;
+import org.zkoss.zul.Paging;
+import org.zkoss.zul.Textbox;
+
+import com.rjconsultores.ventaboletos.entidad.Empresa;
+import com.rjconsultores.ventaboletos.entidad.GP_Pricing;
+import com.rjconsultores.ventaboletos.entidad.Parada;
+import com.rjconsultores.ventaboletos.entidad.Ruta;
+import com.rjconsultores.ventaboletos.service.EmpresaService;
+import com.rjconsultores.ventaboletos.service.GP_PricingService;
+import com.rjconsultores.ventaboletos.service.ParadaService;
+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;
+import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
+import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricing;
+
+@Controller("busquedaGP_PricingController")
+@Scope("prototype")
+public class BusquedaGP_PricingController extends MyGenericForwardComposer {
+
+ private static final long serialVersionUID = 1L;
+ @Autowired
+ private transient PagedListWrapper plwPricingPunto;
+ @Autowired
+ private GP_PricingService pricingService;
+ @Autowired
+ private EmpresaService empresaService;
+ @Autowired
+ private RutaService rutaService;
+ private MyListbox pricingList;
+ private Paging pagingPricing;
+ private List lsPricing;
+ private List lsEmpresa;
+ private List 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(BusquedaGP_PricingController.class);
+
+ public List getLsPricing() {
+ return lsPricing;
+ }
+
+ public void setLsPricing(List lsPricing) {
+ this.lsPricing = lsPricing;
+ }
+
+ public Paging getPagingPricing() {
+ return pagingPricing;
+ }
+
+ public void setPagingPricing(Paging pagingPricing) {
+ this.pagingPricing = pagingPricing;
+ }
+
+ public MyListbox getPricingList() {
+ return pricingList;
+ }
+
+ public void setPricingList(MyListbox pricingList) {
+ this.pricingList = pricingList;
+ }
+
+ public GP_PricingService getPricingService() {
+ return pricingService;
+ }
+
+ public void setPricingService(GP_PricingService pricingService) {
+ this.pricingService = pricingService;
+ }
+
+ public EmpresaService getEmpresaService() {
+ return empresaService;
+ }
+
+ public void setEmpresaService(EmpresaService empresaService) {
+ this.empresaService = empresaService;
+ }
+
+ public List getLsEmpresa() {
+ return lsEmpresa;
+ }
+
+ public void setLsEmpresa(List lsEmpresa) {
+ this.lsEmpresa = lsEmpresa;
+ }
+
+ public Textbox getTxtNome() {
+ return txtNome;
+ }
+
+ public void setTxtNome(Textbox txtNome) {
+ this.txtNome = txtNome;
+ }
+
+ public Datebox getFechaInicio() {
+ return fechaInicio;
+ }
+
+ public void setFechaInicio(Datebox fechaInicio) {
+ this.fechaInicio = fechaInicio;
+ }
+
+ public Datebox getFechaFin() {
+ return fechaFin;
+ }
+
+ public void setFechaFin(Datebox fechaFin) {
+ this.fechaFin = fechaFin;
+ }
+
+ public RutaService getRutaService() {
+ return rutaService;
+ }
+
+ public void setRutaService(RutaService rutaService) {
+ this.rutaService = rutaService;
+ }
+
+ public List getLsRuta() {
+ return lsRuta;
+ }
+
+ public void setLsRuta(List 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());
+ pricingList.addEventListener("onDoubleClick", new EventListener() {
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ GP_Pricing pricing = (GP_Pricing) pricingList.getSelected();
+ verPricing(pricing);
+ }
+ });
+
+ lsPricing = new ArrayList();
+
+ 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();
+ }
+
+ public void onClick$btnRefresh(Event ev) {
+ refreshLista();
+ }
+
+ public void onClick$btnNovo(Event ev) {
+ verPricing(new GP_Pricing());
+ }
+
+ 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 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 lsParadaOri = paradaService.buscar(cmbDestino.getText().toUpperCase());
+ if (!lsParadaOri.isEmpty()) {
+ destino = lsParadaOri.get(0);
+ }
+ } else {
+ destino = (Parada) cmbDestino.getSelectedItem().getValue();
+ }
+
+ HibernateSearchObject pricingSearch = new HibernateSearchObject(
+ GP_Pricing.class, pagingPricing.getPageSize());
+
+ if (empresa != null) {
+ pricingSearch.addFilterEqual("empresa", empresa);
+ } else {
+ pricingSearch.addFilterIn("empresa", lsEmpresa);
+ }
+
+ if (ruta != null && ruta.getRutaId() != -1) {
+ 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() + "%");
+ }
+
+ Calendar calendar = Calendar.getInstance();
+ Calendar calendar1 = Calendar.getInstance();
+ if ((fechaInicio.getValue() != null) && (fechaFin.getValue() != null)) {
+ calendar.setTime(fechaInicio.getValue());
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+
+ calendar1.setTime(fechaFin.getValue());
+ calendar1.set(Calendar.HOUR_OF_DAY, 23);
+ calendar1.set(Calendar.MINUTE, 59);
+ calendar1.set(Calendar.SECOND, 59);
+ calendar1.set(Calendar.MILLISECOND, 999);
+
+ pricingSearch.addFilterGreaterOrEqual("pricingVigenciaList.fecinicioviaje", calendar.getTime());
+ pricingSearch.addFilterLessOrEqual("pricingVigenciaList.fecfinviaje", calendar1.getTime());
+ } else {
+ if (fechaInicio.getValue() != null) {
+ calendar.setTime(fechaInicio.getValue());
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 0);
+
+ calendar1.setTime(fechaInicio.getValue());
+ calendar1.set(Calendar.HOUR_OF_DAY, 23);
+ calendar1.set(Calendar.MINUTE, 59);
+ calendar1.set(Calendar.SECOND, 59);
+
+ pricingSearch.addFilterGreaterThan("pricingVigenciaList.fecinicioviaje", calendar.getTime()).addFilterLessThan("pricingVigenciaList.fecinicioviaje", calendar1.getTime());
+ } else if (fechaFin.getValue() != null) {
+ calendar.setTime(fechaFin.getValue());
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 0);
+
+ calendar1.setTime(fechaFin.getValue());
+ calendar1.set(Calendar.HOUR_OF_DAY, 23);
+ calendar1.set(Calendar.MINUTE, 59);
+ calendar1.set(Calendar.SECOND, 59);
+ pricingSearch.addFilterGreaterThan("pricingVigenciaList.fecfinviaje", calendar.getTime()).addFilterLessThan("pricingVigenciaList.fecfinviaje", calendar1.getTime());
+ }
+ }
+
+ Boolean buscarInativos = chkBuscarInativos.isChecked();
+ if (buscarInativos) {
+ pricingSearch.addFilterEqual("activo", GP_Pricing.INATIVO);
+ } else {
+ pricingSearch.addFilterEqual("activo", GP_Pricing.ATIVO);
+ }
+
+ pricingSearch.addSortAsc("nombPricing");
+
+ pricingSearch.addFetch("pricingVigenciaList");
+
+ plwPricingPunto.init(pricingSearch, pricingList, pagingPricing);
+
+ if (pricingList.getData().length == 0) {
+ try {
+ Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), Labels
+ .getLabel("busquedaPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ } catch (InterruptedException ex) {
+ }
+ }
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private void verPricing(GP_Pricing pricing) {
+ if (pricing == null) {
+ return;
+ }
+
+ Map args = new HashMap();
+ args.put("pricing", pricing);
+ args.put("gravarNovo", pricing.getPricingId() == null);
+ args.put("pricingList", pricingList);
+ args.put("buscarPricingInativosAtivos", chkBuscarInativos.isChecked() ? GP_Pricing.INATIVO : GP_Pricing.ATIVO);
+
+ openWindow("/gui/gestao_pricing/editarGP_Pricing.zul",
+ Labels.getLabel("busquedaGPPricingController.window.title"), args, MODAL);
+ }
+
+ public void onClick$btnApagar(Event ev) {
+ try {
+ GP_Pricing p = (GP_Pricing) pricingList.getSelected();
+ if (p != null) {
+ int resp = Messagebox.show(Labels.getLabel("editarPricingController.MSG.borrarPergunta"),
+ Labels.getLabel("busquedaPricingController.window.title"),
+ Messagebox.YES | Messagebox.NO,
+ Messagebox.QUESTION);
+
+ if (resp == Messagebox.YES) {
+ pricingService.borrar(p);
+ Messagebox.show(Labels.getLabel("editarPricingController.MSG.borrarOK"),
+ Labels.getLabel("busquedaPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ pricingList.removeItem(p);
+ }
+ } else {
+ Messagebox.show(Labels.getLabel("editarPricingController.MSG.selectItem"),
+ Labels.getLabel("busquedaPricingController.window.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ }
+ } catch (Exception ex) {
+ log.error("Erro ao eliminar Pricing: " + ex);
+ }
+ }
+}
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/BusquedaGP_PricingEspecificoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/BusquedaGP_PricingEspecificoController.java
new file mode 100644
index 000000000..5c280a6f2
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/BusquedaGP_PricingEspecificoController.java
@@ -0,0 +1,548 @@
+package com.rjconsultores.ventaboletos.web.gui.controladores.gestaopricing;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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.Datebox;
+import org.zkoss.zul.Paging;
+import org.zkoss.zul.Textbox;
+
+import com.rjconsultores.ventaboletos.entidad.Categoria;
+import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingEspecifico;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingEspecificoAgencia;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingEspecificoCanalVendas;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingEspecificoOcupacion;
+import com.rjconsultores.ventaboletos.entidad.Marca;
+import com.rjconsultores.ventaboletos.entidad.Moneda;
+import com.rjconsultores.ventaboletos.entidad.Parada;
+import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta;
+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.TipoPuntoVentaService;
+import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
+import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
+import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
+import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
+import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingEspecifico;
+
+@Controller("busquedaGP_PricingEspecificoController")
+@Scope("prototype")
+public class BusquedaGP_PricingEspecificoController extends MyGenericForwardComposer {
+
+ private static final long serialVersionUID = 1L;
+ @Autowired
+ private MarcaService marcaService;
+ @Autowired
+ private MonedaService monedaService;
+ @Autowired
+ private CategoriaService categoriaService;
+ @Autowired
+ private ClaseServicioService claseServicioService;
+ @Autowired
+ private ParadaService paradaService;
+ @Autowired
+ private TipoPuntoVentaService puntoVentaService;
+ private List lsMarca;
+ private List lsMoneda;
+ private List lsCategoria;
+ private List lsClaseServicio;
+ private List lsPtovata;
+ private MyListbox pricingList;
+ private Paging pagingPricing;
+ @Autowired
+ private transient PagedListWrapper plwPricingEspecifico;
+ private Combobox cmbMarca;
+ private Combobox cmbMoneda;
+ private Combobox cmbTipoPassageiro;
+ private Combobox cmbTipoServicio;
+ private Combobox cmbPtovta;
+ private Combobox cmbOrigem;
+ private Combobox cmbDestino;
+ private Datebox fechaInicio;
+ private Datebox fechaFin;
+ private Textbox txtNombrePricing;
+
+ @Override
+ public void doAfterCompose(Component comp) throws Exception {
+ lsMarca = marcaService.buscarMarcaPorEmpresa(UsuarioLogado.getUsuarioLogado().getEmpresa());
+ lsMoneda = monedaService.obtenerTodos();
+ lsCategoria = categoriaService.obtenerTodos();
+ lsClaseServicio = claseServicioService.obtenerTodos();
+ lsPtovata = puntoVentaService.obtenerTodos();
+
+ super.doAfterCompose(comp);
+
+ pricingList.setItemRenderer(new RenderPricingEspecifico());
+ pricingList.addEventListener("onDoubleClick", new EventListener() {
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ GP_PricingEspecifico pricingEspecifico = (GP_PricingEspecifico) pricingList.getSelected();
+ verPricing(pricingEspecifico);
+ }
+ });
+
+ txtNombrePricing.focus();
+ refreshLista();
+ }
+
+ public void onClick$btnPesquisa(Event ev) throws InterruptedException {
+ refreshLista();
+ }
+
+ public void onClick$btnRefresh(Event ev) {
+ refreshLista();
+ }
+
+ public void onClick$btnNovo(Event ev) {
+
+ GP_PricingEspecifico pricingEspecifico = new GP_PricingEspecifico();
+ pricingEspecifico.setPricingEspecificoAgenciasList(new ArrayList());
+ pricingEspecifico.setPricingEspecificoCanalVendasList(new ArrayList());
+ pricingEspecifico.setPricingEspecificoOcupacionsList(new ArrayList());
+
+ verPricing(pricingEspecifico);
+ }
+
+ private void refreshLista() {
+ HibernateSearchObject pricingSearch =
+ new HibernateSearchObject(GP_PricingEspecifico.class, pagingPricing.getPageSize());
+ pricingSearch.addFilterEqual("activo", Boolean.TRUE);
+
+ Marca marca = (Marca) (cmbMarca.getSelectedItem() != null ? cmbMarca.getSelectedItem().getValue() : null);
+ Moneda moneda = (Moneda) (cmbMoneda.getSelectedItem() != null ? cmbMoneda.getSelectedItem().getValue() : null);
+ Categoria categoria = (Categoria) (cmbTipoPassageiro.getSelectedItem() != null ? cmbTipoPassageiro.getSelectedItem().getValue() : null);
+ ClaseServicio claseServicio = (ClaseServicio) (cmbTipoServicio.getSelectedItem() != null ? cmbTipoServicio.getSelectedItem().getValue() : null);
+ TipoPuntoVenta tipoPuntoVenta = (TipoPuntoVenta) (cmbPtovta.getSelectedItem() != null ? cmbPtovta.getSelectedItem().getValue() : null);
+ Parada parada = (Parada) (cmbOrigem.getSelectedItem() != null ? cmbOrigem.getSelectedItem().getValue() : null);
+ Parada parada1 = (Parada) (cmbDestino.getSelectedItem() != null ? cmbDestino.getSelectedItem().getValue() : null);
+
+ if (fechaInicio.getValue() != null) {
+ pricingSearch.addFilterGreaterOrEqual("fechorinicio", fechaInicio.getValue());
+ }
+
+ if (fechaFin.getValue() != null) {
+ pricingSearch.addFilterLessOrEqual("fechorfin", fechaFin.getValue());
+ }
+
+ if (parada != null) {
+ pricingSearch.addFilterEqual("parada", parada);
+ }
+
+ if (parada1 != null) {
+ pricingSearch.addFilterEqual("parada1", parada1);
+ }
+
+ if (tipoPuntoVenta != null) {
+ pricingSearch.addFilterEqual("tipoPtovta", tipoPuntoVenta);
+ }
+
+ if (marca != null) {
+ pricingSearch.addFilterEqual("marca", marca);
+ } else {
+ pricingSearch.addFilterIn("marca", lsMarca);
+ }
+ if (moneda != null) {
+ pricingSearch.addFilterEqual("moneda", moneda);
+ }
+ if (categoria != null) {
+ pricingSearch.addFilterEqual("categoria", categoria);
+ }
+ if (claseServicio != null) {
+ pricingSearch.addFilterEqual("claseServicio", claseServicio);
+ }
+
+ String nomePricing = txtNombrePricing.getText().trim();
+ if (!nomePricing.isEmpty()) {
+ pricingSearch.addFilterILike("nombPricing", "%" + nomePricing + "%");
+ }
+
+ pricingSearch.addSortAsc("nombPricing");
+
+ plwPricingEspecifico.init(pricingSearch, pricingList, pagingPricing);
+
+ if (pricingList.getData().length == 0) {
+ try {
+ Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
+ Labels.getLabel("busquedaPricingEspecificoController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ } catch (InterruptedException ex) {
+ }
+ }
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private void verPricing(GP_PricingEspecifico pricingEspecifico) {
+ if (pricingEspecifico == null) {
+ return;
+ }
+
+ Map args = new HashMap();
+ args.put("pricingEspecifico", pricingEspecifico);
+ args.put("pricingList", pricingList);
+
+ openWindow("/gui/gestao_pricing/editarGP_PricingEspecifico.zul",
+ Labels.getLabel("busqueDaGPPricingEspecifico.window.title"), args, MODAL);
+ }
+
+ /**
+ * @return the lsMarca
+ */
+ public List getLsMarca() {
+ return lsMarca;
+ }
+
+ /**
+ * @param lsMarca
+ * the lsMarca to set
+ */
+ public void setLsMarca(List lsMarca) {
+ this.lsMarca = lsMarca;
+ }
+
+ /**
+ * @return the lsMoneda
+ */
+ public List getLsMoneda() {
+ return lsMoneda;
+ }
+
+ /**
+ * @param lsMoneda
+ * the lsMoneda to set
+ */
+ public void setLsMoneda(List lsMoneda) {
+ this.lsMoneda = lsMoneda;
+ }
+
+ /**
+ * @return the pricingList
+ */
+ public MyListbox getPricingList() {
+ return pricingList;
+ }
+
+ /**
+ * @param pricingList
+ * the pricingList to set
+ */
+ public void setPricingList(MyListbox pricingList) {
+ this.pricingList = pricingList;
+ }
+
+ /**
+ * @return the pagingPricing
+ */
+ public Paging getPagingPricing() {
+ return pagingPricing;
+ }
+
+ /**
+ * @param pagingPricing
+ * the pagingPricing to set
+ */
+ public void setPagingPricing(Paging pagingPricing) {
+ this.pagingPricing = pagingPricing;
+ }
+
+ /**
+ * @return the marcaService
+ */
+ public MarcaService getMarcaService() {
+ return marcaService;
+ }
+
+ /**
+ * @param marcaService
+ * the marcaService to set
+ */
+ public void setMarcaService(MarcaService marcaService) {
+ this.marcaService = marcaService;
+ }
+
+ /**
+ * @return the monedaService
+ */
+ public MonedaService getMonedaService() {
+ return monedaService;
+ }
+
+ /**
+ * @param monedaService
+ * the monedaService to set
+ */
+ public void setMonedaService(MonedaService monedaService) {
+ this.monedaService = monedaService;
+ }
+
+ /**
+ * @return the plwPricingEspecifico
+ */
+ public PagedListWrapper getPlwPricingEspecifico() {
+ return plwPricingEspecifico;
+ }
+
+ /**
+ * @param plwPricingEspecifico
+ * the plwPricingEspecifico to set
+ */
+ public void setPlwPricingEspecifico(PagedListWrapper plwPricingEspecifico) {
+ this.plwPricingEspecifico = plwPricingEspecifico;
+ }
+
+ /**
+ * @return the lsCategoria
+ */
+ public List getLsCategoria() {
+ return lsCategoria;
+ }
+
+ /**
+ * @param lsCategoria
+ * the lsCategoria to set
+ */
+ public void setLsCategoria(List lsCategoria) {
+ this.lsCategoria = lsCategoria;
+ }
+
+ /**
+ * @return the lsClaseServicio
+ */
+ public List getLsClaseServicio() {
+ return lsClaseServicio;
+ }
+
+ /**
+ * @param lsClaseServicio
+ * the lsClaseServicio to set
+ */
+ public void setLsClaseServicio(List lsClaseServicio) {
+ this.lsClaseServicio = lsClaseServicio;
+ }
+
+ /**
+ * @return the categoriaService
+ */
+ public CategoriaService getCategoriaService() {
+ return categoriaService;
+ }
+
+ /**
+ * @param categoriaService
+ * the categoriaService to set
+ */
+ public void setCategoriaService(CategoriaService categoriaService) {
+ this.categoriaService = categoriaService;
+ }
+
+ /**
+ * @return the claseServicioService
+ */
+ public ClaseServicioService getClaseServicioService() {
+ return claseServicioService;
+ }
+
+ /**
+ * @param claseServicioService
+ * the claseServicioService to set
+ */
+ public void setClaseServicioService(ClaseServicioService claseServicioService) {
+ this.claseServicioService = claseServicioService;
+ }
+
+ /**
+ * @return the cmbMarca
+ */
+ public Combobox getCmbMarca() {
+ return cmbMarca;
+ }
+
+ /**
+ * @param cmbMarca
+ * the cmbMarca to set
+ */
+ public void setCmbMarca(Combobox cmbMarca) {
+ this.cmbMarca = cmbMarca;
+ }
+
+ /**
+ * @return the cmbMoneda
+ */
+ public Combobox getCmbMoneda() {
+ return cmbMoneda;
+ }
+
+ /**
+ * @param cmbMoneda
+ * the cmbMoneda to set
+ */
+ public void setCmbMoneda(Combobox cmbMoneda) {
+ this.cmbMoneda = cmbMoneda;
+ }
+
+ /**
+ * @return the cmbTipoPassageiro
+ */
+ public Combobox getCmbTipoPassageiro() {
+ return cmbTipoPassageiro;
+ }
+
+ /**
+ * @param cmbTipoPassageiro
+ * the cmbTipoPassageiro to set
+ */
+ public void setCmbTipoPassageiro(Combobox cmbTipoPassageiro) {
+ this.cmbTipoPassageiro = cmbTipoPassageiro;
+ }
+
+ /**
+ * @return the cmbTipoServicio
+ */
+ public Combobox getCmbTipoServicio() {
+ return cmbTipoServicio;
+ }
+
+ /**
+ * @param cmbTipoServicio
+ * the cmbTipoServicio to set
+ */
+ public void setCmbTipoServicio(Combobox cmbTipoServicio) {
+ this.cmbTipoServicio = cmbTipoServicio;
+ }
+
+ /**
+ * @return the paradaService
+ */
+ public ParadaService getParadaService() {
+ return paradaService;
+ }
+
+ /**
+ * @param paradaService
+ * the paradaService to set
+ */
+ public void setParadaService(ParadaService paradaService) {
+ this.paradaService = paradaService;
+ }
+
+ /**
+ * @return the lsPtovata
+ */
+ public List getLsPtovata() {
+ return lsPtovata;
+ }
+
+ /**
+ * @param lsPtovata
+ * the lsPtovata to set
+ */
+ public void setLsPtovata(List lsPtovata) {
+ this.lsPtovata = lsPtovata;
+ }
+
+ /**
+ * @return the puntoVentaService
+ */
+ public TipoPuntoVentaService getPuntoVentaService() {
+ return puntoVentaService;
+ }
+
+ /**
+ * @param puntoVentaService
+ * the puntoVentaService to set
+ */
+ public void setPuntoVentaService(TipoPuntoVentaService puntoVentaService) {
+ this.puntoVentaService = puntoVentaService;
+ }
+
+ /**
+ * @return the cmbPtovta
+ */
+ public Combobox getCmbPtovta() {
+ return cmbPtovta;
+ }
+
+ /**
+ * @param cmbPtovta
+ * the cmbPtovta to set
+ */
+ public void setCmbPtovta(Combobox cmbPtovta) {
+ this.cmbPtovta = cmbPtovta;
+ }
+
+ /**
+ * @return the cmbOrigem
+ */
+ public Combobox getCmbOrigem() {
+ return cmbOrigem;
+ }
+
+ /**
+ * @param cmbOrigem
+ * the cmbOrigem to set
+ */
+ public void setCmbOrigem(Combobox cmbOrigem) {
+ this.cmbOrigem = cmbOrigem;
+ }
+
+ /**
+ * @return the cmbDestino
+ */
+ public Combobox getCmbDestino() {
+ return cmbDestino;
+ }
+
+ /**
+ * @param cmbDestino
+ * the cmbDestino to set
+ */
+ public void setCmbDestino(Combobox cmbDestino) {
+ this.cmbDestino = cmbDestino;
+ }
+
+ /**
+ * @return the fechaInicio
+ */
+ public Datebox getFechaInicio() {
+ return fechaInicio;
+ }
+
+ /**
+ * @param fechaInicio
+ * the fechaInicio to set
+ */
+ public void setFechaInicio(Datebox fechaInicio) {
+ this.fechaInicio = fechaInicio;
+ }
+
+ /**
+ * @return the fechaFin
+ */
+ public Datebox getFechaFin() {
+ return fechaFin;
+ }
+
+ /**
+ * @param fechaFin
+ * the fechaFin to set
+ */
+ public void setFechaFin(Datebox fechaFin) {
+ this.fechaFin = fechaFin;
+ }
+}
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/CopiarGP_PricingController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/CopiarGP_PricingController.java
new file mode 100644
index 000000000..cfcb53731
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/CopiarGP_PricingController.java
@@ -0,0 +1,80 @@
+package com.rjconsultores.ventaboletos.web.gui.controladores.gestaopricing;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import org.zkoss.zk.ui.Component;
+import org.zkoss.zk.ui.Executions;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zul.Textbox;
+
+import com.rjconsultores.ventaboletos.entidad.GP_Pricing;
+import com.rjconsultores.ventaboletos.service.GP_PricingService;
+import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
+import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
+import com.rjconsultores.ventaboletos.web.utilerias.MensagensUtils;
+import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
+import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
+
+@Controller("copiarGP_PricingController")
+@Scope("prototype")
+public class CopiarGP_PricingController extends MyGenericForwardComposer {
+
+ private static final String CONTROLLER_WINDOW_TITLE = "copiarPricingController.window.title";
+
+ private static final long serialVersionUID = 1L;
+
+ @Autowired
+ private GP_PricingService pricingService;
+
+ private Textbox nombrePricing;
+ private GP_Pricing pricing;
+ private MyListbox pricingList;
+
+ @Override
+ public void doAfterCompose(Component comp) throws Exception {
+ pricing = (GP_Pricing) Executions.getCurrent().getArg().get("pricing");
+
+ super.doAfterCompose(comp);
+ }
+
+ public void onClick$btnSalvarCopia(Event ev) throws InterruptedException {
+ if (StringUtils.isBlank(nombrePricing.getText())) {
+ MensagensUtils.showMessageExclamation("copiarPricingController.MSG.sem.nome",CONTROLLER_WINDOW_TITLE);
+ return;
+ }
+
+ if (existePricingComMesmoNome()) {
+ MensagensUtils.showMessageExclamation("copiarPricingController.MSG.Registro.Existe", CONTROLLER_WINDOW_TITLE);
+ return;
+ }
+
+ Boolean clonou = pricingService.clonarPricing(pricing.getPricingId(), nombrePricing.getText(),
+ ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.USA_PADRAO_PRICING_TIPO_PASSAGEM_PET.getDescricao()));
+
+ if (clonou) {
+ closeWindow();
+ MensagensUtils.showMessageInformation("copiarPricingController.MSG.suscribirOK", CONTROLLER_WINDOW_TITLE);
+ } else {
+ MensagensUtils.showMessageInformation("copiarPricingController.MSG.ERRO", CONTROLLER_WINDOW_TITLE);
+ }
+
+ }
+
+ protected boolean existePricingComMesmoNome() {
+ return pricingService.buscarPorNombre(nombrePricing.getText()).size() > 0;
+ }
+
+ public void onClose$winCopiarPricing(Event ev) {
+ closeWindow();
+ }
+
+ public MyListbox getPricingList() {
+ return pricingList;
+ }
+
+ public void setPricingList(MyListbox pricingList) {
+ this.pricingList = pricingList;
+ }
+}
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/CopiarGP_PricingEspecificoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/CopiarGP_PricingEspecificoController.java
new file mode 100644
index 000000000..e52806da3
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/CopiarGP_PricingEspecificoController.java
@@ -0,0 +1,97 @@
+package com.rjconsultores.ventaboletos.web.gui.controladores.gestaopricing;
+
+import java.util.List;
+
+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.Executions;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zul.Textbox;
+
+import com.rjconsultores.ventaboletos.entidad.GP_PricingEspecifico;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingEspecificoCategoria;
+import com.rjconsultores.ventaboletos.service.GP_PricingEspecificoService;
+import com.rjconsultores.ventaboletos.service.GP_PricingHistoricoService;
+import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
+import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
+
+@Controller("copiarGP_PricingEspecificoController")
+@Scope("prototype")
+public class CopiarGP_PricingEspecificoController extends MyGenericForwardComposer {
+
+ private static final long serialVersionUID = 1L;
+
+ @Autowired
+ private GP_PricingEspecificoService pricingEspecificoService;
+ @Autowired
+ private GP_PricingHistoricoService pricingHistoricoService;
+
+ private Textbox nombrePricing;
+ private GP_PricingEspecifico pricingEspecifico;
+ private List pricingCategoriaList;
+ private MyListbox pricingList;
+
+ @Override
+ public void doAfterCompose(Component comp) throws Exception {
+ pricingEspecifico = (GP_PricingEspecifico) Executions.getCurrent().getArg().get("pricingEspecifico");
+ pricingCategoriaList = (List) Executions.getCurrent().getArg().get("pricingCategoriaList");
+ super.doAfterCompose(comp);
+ }
+
+ public void onClick$btnSalvarCopia(Event ev) throws InterruptedException {
+ if (!nombrePricing.getText().equals("") && nombrePricing.getText() != null) {
+
+ List lsPricing = pricingEspecificoService.buscarPorNome(nombrePricing.getValue());
+
+ if (lsPricing == null ||
+ lsPricing.isEmpty()) {
+
+ GP_PricingEspecifico clone = pricingEspecificoService.clonarPricing(pricingEspecifico.getPricingespecificoId(), nombrePricing.getText(), pricingCategoriaList);
+
+ if (clone != null) {
+
+ pricingHistoricoService.compararESalvar(null, clone);
+
+ closeWindow();
+ Messagebox.show(
+ Labels.getLabel("copiarPricingController.MSG.suscribirOK"),
+ Labels.getLabel("copiarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+
+ } else {
+ Messagebox.show(
+ Labels.getLabel("copiarPricingController.MSG.ERRO"),
+ Labels.getLabel("copiarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ }
+
+ } else {
+ Messagebox.show(
+ Labels.getLabel("copiarPricingController.MSG.Registro.Existe"),
+ Labels.getLabel("copiarPricingController.window.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ }
+ } else {
+ Messagebox.show(
+ Labels.getLabel("copiarPricingController.MSG.sem.nome"),
+ Labels.getLabel("copiarPricingController.window.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ }
+ }
+
+ public void onClose$winCopiarPricing(Event ev) {
+ closeWindow();
+ }
+
+ public MyListbox getPricingList() {
+ return pricingList;
+ }
+
+ public void setPricingList(MyListbox pricingList) {
+ this.pricingList = pricingList;
+ }
+}
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/EditarGP_PricingAsientoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/EditarGP_PricingAsientoController.java
new file mode 100644
index 000000000..85f075a83
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/EditarGP_PricingAsientoController.java
@@ -0,0 +1,157 @@
+package com.rjconsultores.ventaboletos.web.gui.controladores.gestaopricing;
+
+import java.util.Calendar;
+import java.util.List;
+
+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.Executions;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zul.Intbox;
+
+import com.rjconsultores.ventaboletos.entidad.GP_Pricing;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingAsiento;
+import com.rjconsultores.ventaboletos.service.GP_PricingAsientoService;
+import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
+import com.rjconsultores.ventaboletos.web.utilerias.ConstraintPorcentagem;
+import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
+import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
+import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
+
+@Controller("editarGP_PricingAsientoController")
+@Scope("prototype")
+public class EditarGP_PricingAsientoController extends MyGenericForwardComposer {
+
+ private static final long serialVersionUID = 1L;
+ @Autowired
+ private GP_PricingAsientoService pricingAsientoService;
+ private GP_PricingAsiento pricingAsiento;
+ private MyListbox pricingAsientoList;
+ private MyTextboxDecimal porcentaje;
+ private Intbox numeasiento;
+ private ConstraintPorcentagem ct;
+ private static Logger log = Logger.getLogger(EditarGP_PricingAsientoController.class);
+
+ @Override
+ public void doAfterCompose(Component comp) throws Exception {
+
+ ct = new ConstraintPorcentagem();
+ pricingAsiento = (GP_PricingAsiento) Executions.getCurrent().getArg().get("pricingAsiento");
+ pricingAsientoList = (MyListbox) Executions.getCurrent().getArg().get("pricingAsientoList");
+
+ super.doAfterCompose(comp);
+ }
+
+ public void onClick$btnAdicionarAsiento(Event ev) throws Exception {
+ numeasiento.getValue();
+ porcentaje.getValue();
+
+ List lsAsientos = pricingAsientoService.obtenerPricingCategoria(pricingAsiento.getPricing(), numeasiento.getValue());
+
+ try {
+ boolean exite = true;
+
+ if (lsAsientos.isEmpty()) {
+ exite = false;
+ } else {
+ for (GP_PricingAsiento a : lsAsientos) {
+ if (a.getPricingasientoId().equals(pricingAsiento.getPricingasientoId())) {
+ exite = false;
+ }
+ }
+ }
+
+ if (!exite) {
+ if (pricingAsiento.getPricingasientoId() != null) {
+ pricingAsientoService.actualizacion(pricingAsiento);
+ pricingAsientoList.updateItem(pricingAsiento);
+ } else {
+ pricingAsientoService.suscribir(pricingAsiento);
+ pricingAsientoList.addItemNovo(pricingAsiento);
+ }
+ closeWindow();
+ } else {
+ Messagebox.show(
+ Labels.getLabel("MSG.Registro.Existe"),
+ Labels.getLabel("editarPricingController.windowCategoria.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ }
+ } catch (Exception ex) {
+ log.error(ex);
+ }
+ }
+
+ public void onClick$btnRemoverAsiento(Event ev) {
+ try {
+ GP_PricingAsiento pAsiento = (GP_PricingAsiento) pricingAsientoList.getSelected();
+ if (pAsiento != null) {
+ int resp = Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.borrarPerguntaAsiento"),
+ Labels.getLabel("editarPricingController.windowAsiento.title"),
+ Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
+
+ if (resp == Messagebox.YES) {
+ pricingAsiento.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ pricingAsiento.setFecmodif(Calendar.getInstance().getTime());
+ pricingAsiento.setActivo(GP_Pricing.INATIVO);
+
+ pricingAsientoList.removeItem(pricingAsiento);
+ pricingAsientoService.borrar(pricingAsiento);
+ closeWindow();
+ }
+ } else {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.selectItem"),
+ Labels.getLabel("editarPricingController.windowAsiento.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ }
+ } catch (Exception ex) {
+ log.error(ex);
+ }
+
+ }
+
+ public GP_PricingAsiento getPricingAsiento() {
+ return pricingAsiento;
+ }
+
+ public void setPricingAsiento(GP_PricingAsiento pricingAsiento) {
+ this.pricingAsiento = pricingAsiento;
+ }
+
+ public MyListbox getPricingAsientoList() {
+ return pricingAsientoList;
+ }
+
+ public void setPricingAsientoList(MyListbox pricingAsientoList) {
+ this.pricingAsientoList = pricingAsientoList;
+ }
+
+ public GP_PricingAsientoService getPricingAsientoService() {
+ return pricingAsientoService;
+ }
+
+ public void setPricingAsientoService(GP_PricingAsientoService pricingAsientoService) {
+ this.pricingAsientoService = pricingAsientoService;
+ }
+
+ /**
+ * @return the ct
+ */
+ public ConstraintPorcentagem getCt() {
+ return ct;
+ }
+
+ /**
+ * @param ct
+ * the ct to set
+ */
+ public void setCt(ConstraintPorcentagem ct) {
+ this.ct = ct;
+ }
+}
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/EditarGP_PricingCategoriaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/EditarGP_PricingCategoriaController.java
new file mode 100644
index 000000000..82afd1e97
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/EditarGP_PricingCategoriaController.java
@@ -0,0 +1,156 @@
+package com.rjconsultores.ventaboletos.web.gui.controladores.gestaopricing;
+
+import java.util.Calendar;
+import java.util.List;
+
+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.Executions;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zul.Combobox;
+
+import com.rjconsultores.ventaboletos.entidad.Categoria;
+import com.rjconsultores.ventaboletos.entidad.GP_Pricing;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingCategoria;
+import com.rjconsultores.ventaboletos.service.CategoriaService;
+import com.rjconsultores.ventaboletos.service.GP_PricingCategoriaService;
+import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
+import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
+import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
+
+@Controller("editarGP_PricingCategoriaController")
+@Scope("prototype")
+public class EditarGP_PricingCategoriaController extends MyGenericForwardComposer {
+
+ private static final long serialVersionUID = 1L;
+ @Autowired
+ private GP_PricingCategoriaService pricingCategoriaService;
+ @Autowired
+ private CategoriaService categoriaService;
+ private List lsCategoria;
+ private GP_PricingCategoria pricingCategoria;
+ private MyListbox pricingCategoriaList;
+ private Combobox cmbCategoria;
+ private static Logger log = Logger.getLogger(EditarGP_PricingCategoriaController.class);
+
+ @Override
+ public void doAfterCompose(Component comp) throws Exception {
+
+ lsCategoria = categoriaService.obtenerTodos();
+
+ pricingCategoria = (GP_PricingCategoria) Executions.getCurrent().getArg().get("pricingCategoria");
+ pricingCategoriaList = (MyListbox) Executions.getCurrent().getArg().get("pricingCategoriaList");
+
+ super.doAfterCompose(comp);
+
+ cmbCategoria.focus();
+
+ }
+
+ public void onClick$btnAdicionarCategoria(Event ev) throws Exception {
+ cmbCategoria.getValue();
+ try {
+ if (pricingCategoria.getCategoria() == null) {
+ Messagebox.show(
+ Labels.getLabel("MSG.Error.combobox"),
+ Labels.getLabel("editarPricingController.windowCategoria.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ } else {
+ Boolean existe = pricingCategoriaService.obtenerPricingCategoria(pricingCategoria.getPricing(), (Categoria) cmbCategoria.getSelectedItem().getValue());
+
+ if (existe) {
+ Messagebox.show(
+ Labels.getLabel("MSG.Registro.Existe"),
+ Labels.getLabel("editarPricingController.windowCategoria.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ } else {
+ if (pricingCategoria.getPricingcategoriaId() != null) {
+ pricingCategoriaService.actualizacion(pricingCategoria);
+ pricingCategoriaList.updateItem(pricingCategoria);
+ } else {
+ pricingCategoriaService.suscribir(pricingCategoria);
+ pricingCategoriaList.addItem(pricingCategoria);
+ }
+ closeWindow();
+ }
+ }
+ } catch (Exception ex) {
+ log.error("Erro ao adicionar categoria: " + ex);
+ }
+ }
+
+ public void onClick$btnRemoverCategoria(Event ev) {
+ try {
+ GP_PricingCategoria pCategoria = (GP_PricingCategoria) pricingCategoriaList.getSelected();
+ if (pCategoria != null) {
+ int resp = Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.borrarPerguntaCategoria"),
+ Labels.getLabel("editarPricingController.windowCategoria.title"),
+ Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
+
+ if (resp == Messagebox.YES) {
+ pricingCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ pricingCategoria.setFecmodif(Calendar.getInstance().getTime());
+ pricingCategoria.setActivo(GP_Pricing.INATIVO);
+
+ pricingCategoriaList.removeItem(pricingCategoria);
+ pricingCategoriaService.borrar(pricingCategoria);
+ closeWindow();
+ }
+ } else {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.selectItem"),
+ Labels.getLabel("editarPricingController.windowCategoria.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ }
+ } catch (Exception ex) {
+ log.error("Erro ao remover categoria: " + ex);
+ }
+
+ }
+
+ public GP_PricingCategoria getPricingCategoria() {
+ return pricingCategoria;
+ }
+
+ public void setPricingCategoria(GP_PricingCategoria pricingCategoria) {
+ this.pricingCategoria = pricingCategoria;
+ }
+
+ public MyListbox getPricingCategoriaList() {
+ return pricingCategoriaList;
+ }
+
+ public void setPricingCategoriaList(MyListbox pricingCategoriaList) {
+ this.pricingCategoriaList = pricingCategoriaList;
+ }
+
+ public GP_PricingCategoriaService getPricingCategoriaService() {
+ return pricingCategoriaService;
+ }
+
+ public void setPricingCategoriaService(GP_PricingCategoriaService pricingCategoriaService) {
+ this.pricingCategoriaService = pricingCategoriaService;
+ }
+
+ public List getLsCategoria() {
+ return lsCategoria;
+ }
+
+ public void setLsCategoria(List lsCategoria) {
+ this.lsCategoria = lsCategoria;
+ }
+
+ public CategoriaService getCategoriaService() {
+ return categoriaService;
+ }
+
+ public void setCategoriaService(CategoriaService categoriaService) {
+ this.categoriaService = categoriaService;
+ }
+}
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/EditarGP_PricingClaseController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/EditarGP_PricingClaseController.java
new file mode 100644
index 000000000..b8a4b6406
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/EditarGP_PricingClaseController.java
@@ -0,0 +1,156 @@
+package com.rjconsultores.ventaboletos.web.gui.controladores.gestaopricing;
+
+import java.util.Calendar;
+import java.util.List;
+
+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.Executions;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zul.Combobox;
+
+import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
+import com.rjconsultores.ventaboletos.entidad.GP_Pricing;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingClase;
+import com.rjconsultores.ventaboletos.service.ClaseServicioService;
+import com.rjconsultores.ventaboletos.service.GP_PricingClaseService;
+import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
+import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
+import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
+
+@Controller("editarGP_PricingClaseController")
+@Scope("prototype")
+public class EditarGP_PricingClaseController extends MyGenericForwardComposer {
+
+ private static final long serialVersionUID = 1L;
+
+ @Autowired
+ private GP_PricingClaseService pricingClaseService;
+ @Autowired
+ private ClaseServicioService claseServicioService;
+ private List lsClase;
+ private GP_PricingClase pricingClase;
+ private MyListbox pricingClaseList;
+ private Combobox cmbClase;
+ private static Logger log = Logger.getLogger(EditarGP_PricingClaseController.class);
+
+ @Override
+ public void doAfterCompose(Component comp) throws Exception {
+
+ lsClase = claseServicioService.obtenerTodos();
+
+ pricingClase = (GP_PricingClase) Executions.getCurrent().getArg().get("pricingClase");
+ pricingClaseList = (MyListbox) Executions.getCurrent().getArg().get("pricingClaseList");
+
+ super.doAfterCompose(comp);
+
+ cmbClase.focus();
+ }
+
+ public void onClick$btnAdicionarClase(Event ev) throws Exception {
+ cmbClase.getValue();
+
+ if (pricingClase.getClaseServicio() == null) {
+ Messagebox.show(
+ Labels.getLabel("MSG.Error.combobox"),
+ Labels.getLabel("editarPricingController.windowClase.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ } else {
+
+ Boolean existe = pricingClaseService.obtenerPricingClase(pricingClase.getPricing(), (ClaseServicio) cmbClase.getSelectedItem().getValue());
+ if (existe) {
+ Messagebox.show(
+ Labels.getLabel("MSG.Registro.Existe"),
+ Labels.getLabel("editarPricingController.windowClase.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ } else {
+ if (pricingClase.getPricingclaseId() != null) {
+ pricingClaseService.actualizacion(pricingClase);
+ pricingClaseList.updateItem(pricingClase);
+ } else {
+ pricingClaseService.suscribir(pricingClase);
+ pricingClaseList.addItem(pricingClase);
+ }
+ closeWindow();
+ }
+ }
+ }
+
+ public void onClick$btnRemoverClase(Event ev) throws InterruptedException {
+ GP_PricingClase pClase = (GP_PricingClase) pricingClaseList.getSelected();
+ if (pClase != null) {
+ int resp = Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.borrarPerguntaClase"),
+ Labels.getLabel("editarPricingController.windowClase.title"),
+ Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
+
+ if (resp == Messagebox.YES) {
+ pricingClase.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ pricingClase.setFecmodif(Calendar.getInstance().getTime());
+ pricingClase.setActivo(GP_Pricing.INATIVO);
+
+ pricingClaseList.removeItem(pricingClase);
+ pricingClaseService.borrar(pricingClase);
+ closeWindow();
+ }
+ } else {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.selectItem"),
+ Labels.getLabel("editarPricingController.windowClase.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ }
+ }
+
+ public GP_PricingClase getPricingClase() {
+ return pricingClase;
+ }
+
+ public void setPricingClase(GP_PricingClase pricingClase) {
+ this.pricingClase = pricingClase;
+ }
+
+ public MyListbox getPricingClaseList() {
+ return pricingClaseList;
+ }
+
+ public void setPricingClaseList(MyListbox pricingClaseList) {
+ this.pricingClaseList = pricingClaseList;
+ }
+
+ public GP_PricingClaseService getPricingClaseService() {
+ return pricingClaseService;
+ }
+
+ public void setPricingClaseService(GP_PricingClaseService pricingClaseService) {
+ this.pricingClaseService = pricingClaseService;
+ }
+
+ public ClaseServicioService getClaseServicioService() {
+ return claseServicioService;
+ }
+
+ public void setClaseServicioService(ClaseServicioService claseServicioService) {
+ this.claseServicioService = claseServicioService;
+ }
+
+ public static Logger getLog() {
+ return log;
+ }
+
+ public static void setLog(Logger log) {
+ EditarGP_PricingClaseController.log = log;
+ }
+
+ public List getLsClase() {
+ return lsClase;
+ }
+
+ public void setLsClase(List lsClase) {
+ this.lsClase = lsClase;
+ }
+}
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/EditarGP_PricingController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/EditarGP_PricingController.java
new file mode 100644
index 000000000..1bf57f19f
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/gestaopricing/EditarGP_PricingController.java
@@ -0,0 +1,2845 @@
+package com.rjconsultores.ventaboletos.web.gui.controladores.gestaopricing;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+
+import org.apache.commons.lang.BooleanUtils;
+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.Executions;
+import org.zkoss.zk.ui.WrongValueException;
+import org.zkoss.zk.ui.event.CheckEvent;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zk.ui.event.EventListener;
+import org.zkoss.zk.ui.event.ForwardEvent;
+import org.zkoss.zul.Button;
+import org.zkoss.zul.Checkbox;
+import org.zkoss.zul.Combobox;
+import org.zkoss.zul.Comboitem;
+import org.zkoss.zul.Intbox;
+import org.zkoss.zul.Radio;
+import org.zkoss.zul.Tab;
+import org.zkoss.zul.Tabbox;
+import org.zkoss.zul.Tabpanel;
+import org.zkoss.zul.Textbox;
+import org.zkoss.zul.Window;
+
+import com.rjconsultores.ventaboletos.entidad.Categoria;
+import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
+import com.rjconsultores.ventaboletos.entidad.Empresa;
+import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida;
+import com.rjconsultores.ventaboletos.entidad.GP_Pricing;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingAsiento;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingCategoria;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingClase;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingCorrida;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingDia;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingFormapago;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingImporte;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingMarca;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingMercado;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingOcupaAntecipa;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingPuntoVenta;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingRuta;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingTipoPtoVta;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingTipoServicio;
+import com.rjconsultores.ventaboletos.entidad.GP_PricingVigencia;
+import com.rjconsultores.ventaboletos.entidad.Marca;
+import com.rjconsultores.ventaboletos.entidad.Parada;
+import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
+import com.rjconsultores.ventaboletos.entidad.Ruta;
+import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta;
+import com.rjconsultores.ventaboletos.service.CategoriaService;
+import com.rjconsultores.ventaboletos.service.ClaseServicioService;
+import com.rjconsultores.ventaboletos.service.GP_PricingAsientoService;
+import com.rjconsultores.ventaboletos.service.GP_PricingCategoriaService;
+import com.rjconsultores.ventaboletos.service.GP_PricingClaseService;
+import com.rjconsultores.ventaboletos.service.GP_PricingCorridaService;
+import com.rjconsultores.ventaboletos.service.GP_PricingDiaService;
+import com.rjconsultores.ventaboletos.service.GP_PricingFormapagoService;
+import com.rjconsultores.ventaboletos.service.GP_PricingHistoricoService;
+import com.rjconsultores.ventaboletos.service.GP_PricingImporteService;
+import com.rjconsultores.ventaboletos.service.GP_PricingMarcaService;
+import com.rjconsultores.ventaboletos.service.GP_PricingMercadoService;
+import com.rjconsultores.ventaboletos.service.GP_PricingOcupaAntecipaService;
+import com.rjconsultores.ventaboletos.service.GP_PricingPuntoVentaService;
+import com.rjconsultores.ventaboletos.service.GP_PricingRevisaoValoresService;
+import com.rjconsultores.ventaboletos.service.GP_PricingRutaService;
+import com.rjconsultores.ventaboletos.service.GP_PricingService;
+import com.rjconsultores.ventaboletos.service.GP_PricingTipoPtoVtaService;
+import com.rjconsultores.ventaboletos.service.GP_PricingTipoServicioService;
+import com.rjconsultores.ventaboletos.service.GP_PricingVigenciaService;
+import com.rjconsultores.ventaboletos.service.MarcaService;
+import com.rjconsultores.ventaboletos.service.ParadaService;
+import com.rjconsultores.ventaboletos.service.PuntoVentaService;
+import com.rjconsultores.ventaboletos.service.RutaService;
+import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService;
+import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
+import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
+import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
+import com.rjconsultores.ventaboletos.vo.pricing.GP_PricingOcupaAntecipaLegendaVO;
+import com.rjconsultores.ventaboletos.vo.pricing.GP_PricingOcupaAntecipaPoltronasVO;
+import com.rjconsultores.ventaboletos.vo.pricing.GP_PricingOcupaAntecipaVO;
+import com.rjconsultores.ventaboletos.vo.pricing.GP_PricingRevisaoValoresVO;
+import com.rjconsultores.ventaboletos.web.gui.controladores.pricing.PricingController;
+import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
+import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingAsiento;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingCategoria;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingClase;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingCorrida;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingDia;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingFormaPago;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingImporte;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingMarca;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingMercado;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingOcupaAntecipaLegenda;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingOcupacao;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingPuntoVenta;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingRevisaoValores;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingRuta;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingTipoPtoVta;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingTipoServicio;
+import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingVigencia;
+
+import ch.stfo.zk.component.Colorbox;
+
+@Controller("editarGP_PricingController")
+@Scope("prototype")
+@SuppressWarnings("unused")
+public class EditarGP_PricingController extends PricingController {
+
+ private static final long serialVersionUID = 1L;
+ private static Logger log = Logger.getLogger(EditarGP_PricingController.class);
+ @Autowired
+ private GP_PricingService pricingService;
+ @Autowired
+ private GP_PricingMarcaService pricingMarcaService;
+ @Autowired
+ private GP_PricingClaseService pricingClaseService;
+ @Autowired
+ private GP_PricingCorridaService pricingCorridaService;
+ @Autowired
+ private GP_PricingDiaService pricingDiaService;
+ @Autowired
+ private GP_PricingPuntoVentaService pricingPuntoVentaService;
+ @Autowired
+ private GP_PricingTipoPtoVtaService pricingTipoPtoVtaService;
+ @Autowired
+ private GP_PricingTipoServicioService pricingTipoServicioService;
+ @Autowired
+ private GP_PricingVigenciaService pricingVigenciaService;
+ @Autowired
+ private GP_PricingRutaService pricingRutaService;
+ @Autowired
+ private GP_PricingCategoriaService pricingCategoriaService;
+ @Autowired
+ private GP_PricingMercadoService pricingMercadoService;
+ @Autowired
+ private GP_PricingImporteService pricingImporteService;
+ @Autowired
+ private GP_PricingFormapagoService pricingFormapagoService;
+ @Autowired
+ private GP_PricingOcupaAntecipaService pricingOcupaAntecipaService;
+ @Autowired
+ private GP_PricingRevisaoValoresService pricingRevisaoValoresService;
+ @Autowired
+ private MarcaService marcaService;
+ @Autowired
+ private ClaseServicioService claseServicioService;
+ @Autowired
+ private PuntoVentaService puntoVentaService;
+ @Autowired
+ private TipoPuntoVentaService tipoPuntoVentaService;
+ @Autowired
+ private RutaService rutaService;
+ @Autowired
+ private CategoriaService categoriaService;
+ @Autowired
+ private ParadaService paradaService;
+ @Autowired
+ private GP_PricingAsientoService pricingAsientoService;
+
+ @Autowired
+ private GP_PricingHistoricoService pricingHistoricoService;
+
+ private GP_Pricing pricing;
+ private GP_Pricing pricingOriginal;
+ private MyListbox pricingList;
+ private MyListbox pricingVigenciaList;
+ private MyListbox pricingImporteList;
+ private MyListbox pricingMarcaList;
+ private MyListbox pricingClaseList;
+ private MyListbox pricingPuntoVentaList;
+ private MyListbox pricingTipoPtoVtaList;
+ private MyListbox pricingRutaList;
+ private MyListbox pricingMercadoList;
+ private MyListbox pricingCategoriaList;
+ private MyListbox pricingDiaList;
+ private MyListbox pricingCorridaList;
+ private MyListbox pricingAsientoList;
+ private MyListbox pricingTipoServicioList;
+ private MyListbox pricingFormapagoList;
+ private MyListbox pricingRevisaoValores;
+ private List lsEmpresa;
+ private List lsPricingVigencia;
+ private List lsPricingImporte;
+ private List lsPricingClase;
+ private List lsPricingTipoPtoVta;
+ private List lsPricingPuntoVenta;
+ private List lsPricingMarca;
+ private List lsPricingMercado;
+ private List lsPricingDia;
+ private List lsPricingCorrida;
+ private List lsPricingCategoria;
+ private List lsPricingAsiento;
+ private List lsPricingOcupaAntecipa;
+ private List lsPricingRuta;
+ private List lsPricingTipoServicio;
+ private List lsPricingFormapago;
+ private Combobox cmbEmpresa;
+ private Radio rdTransSi;
+ private Radio rdTransNo;
+ private Radio rdExibirVendaSi;
+ private Radio rdExibirVendaNo;
+ private Radio rdCanceSi;
+ private Radio rdCanceNo;
+ private Radio rdReserSi;
+ private Radio rdReserNo;
+ private Radio radioImp;
+ private Radio radioPor;
+ private MyTextboxDecimal descuentoporcredondo;
+ private MyTextboxDecimal descuentoporcsen;
+ private Button btnSalvar;
+ private Button btnCopiar;
+ private Button btnNovoImporte;
+ private Button btnApagarImporte;
+ private Button btnModificarImporte;
+ private Button btnApagar;
+ private Button btnInativar;
+ private Button btnAtivar;
+ private Button btnNovoVigencia;
+ private Button btnApagarVigencia;
+ private Button btnModificarVigencia;
+ private Button btnNovoMarca;
+ private Button btnApagarMarca;
+ private Button btnModificarMarca;
+ private Button btnNovoClase;
+ private Button btnApagarClase;
+ private Button btnModificarClase;
+ private Button btnNovoPuntoVenta;
+ private Button btnApagarPuntoVenta;
+ private Button btnModificarPuntoVenta;
+ private Button btnNovoRuta;
+ private Button btnApagarRuta;
+ private Button btnModificarRuta;
+ private Button btnNovoTipoPtoVta;
+ private Button btnApagarTipoPtoVta;
+ private Button btnModificarTipoPtoVta;
+ private Button btnNovoMercado;
+ private Button btnApagarMercado;
+ private Button btnModificarMercado;
+ private Button btnNovoDia;
+ private Button btnApagarDia;
+ private Button btnNovoCorrida;
+ private Button btnApagarCorrida;
+ private Button btnNovoAsiento;
+ private Button btnApagarAsiento;
+ private Button btnModificarAsiento;
+ private Button btnNovoOcupaAntecipa;
+ private Button btnApagarOcupaAntecipa;
+ private Button btnModificarOcupaAntecipa;
+ private Button btnNovoTipoServicio;
+ private Button btnApagarTipoServicio;
+ private Button btnModificarTipoServicio;
+ private Button btnNovoFormaPago;
+ private Button btnApagarFormaPago;
+ private Button btnNovoCategoria;
+ private Button btnApagarCategoria;
+ private Button btnModificarCategoria;
+ private Button btnModificarFormaPago;
+ private boolean salvo = false;
+ private Boolean gravarNovo = Boolean.TRUE;
+ private Textbox nombrePricing;
+ private Intbox itxCantboleto;
+ private Intbox cantdiasanticipacion;
+ private Combobox cmbIndGeneraFeriadoFechaVenta;
+ private Combobox cmbIndGeneraFeriadoFechaViaje;
+ private Integer buscarPricingInativosAtivos;
+ private Colorbox colorChoose;
+ private MyListbox pricingOcupaAntecipaList;
+ private MyListbox pricingOcupaAntecipaLegendaList;
+ private Tabbox tb;
+ private Tabpanel tabPanelOcupaAntecipa;
+ private Window winEditarGP_Pricing;
+ private Tab tabOcupaAntecipa;
+ private Checkbox chkAgruparDia;
+ private Checkbox chkAgruparServico;
+
+ private List columns;
+ private List lsPricingOcupacaoAntecipas;
+ private List lsPricingOcupaAntecipaLegendas;
+ private List lsPricingRevisaoValores;
+
+ private Intbox cantdiasEstadiaminima;
+ private Radio rdEstadiaMinimaSi;
+ private Radio rdEstadiaMinimaNo;
+ private Checkbox chkIndLunEstadiaminima;
+ private Checkbox chkIndMarEstadiaminima;
+ private Checkbox chkIndMieEstadiaminima;
+ private Checkbox chkIndJueEstadiaminima;
+ private Checkbox chkIndVieEstadiaminima;
+ private Checkbox chkIndSabEstadiaminima;
+ private Checkbox chkIndDomEstadiaminima;
+
+ private void clearCombobox(Combobox combobox) {
+ int size = combobox.getItemCount();
+
+ for (int i = size - 1; i >= 0; i--) {
+ combobox.removeItemAt(i);
+ }
+ }
+
+ private void popularCombobox(Combobox cmb) throws Exception {
+ clearCombobox(cmb);
+ for (EsquemaCorrida.GerarFeriado p : EsquemaCorrida.GerarFeriado.values()) {
+ Comboitem comboItem = new Comboitem(p.descricao());
+ comboItem.setValue(p.valor());
+ comboItem.setParent(cmb);
+ }
+
+ cmb.setSelectedIndex(0);
+ }
+
+ @Override
+ public void doAfterCompose(Component comp) throws Exception {
+ lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
+
+ pricing = (GP_Pricing) Executions.getCurrent().getArg().get("pricing");
+ pricingList = (MyListbox) Executions.getCurrent().getArg().get("pricingList");
+ buscarPricingInativosAtivos = (Integer) Executions.getCurrent().getArg().get("buscarPricingInativosAtivos");
+ gravarNovo = (Boolean) Executions.getCurrent().getArg().get("gravarNovo");
+ Boolean isSelecionarTabOcupaAntecipa = (Boolean) Executions.getCurrent().getArg().get("isSelecionarTabOcupaAntecipa");
+
+ super.doAfterCompose(comp);
+
+ if(BooleanUtils.toBoolean(isSelecionarTabOcupaAntecipa)) {
+ winEditarGP_Pricing.focus();
+ tb.setSelectedPanel(tabPanelOcupaAntecipa);
+ }
+
+ pricingCategoriaList.setDisabled(Boolean.TRUE);
+ btnNovoCategoria.setDisabled(Boolean.TRUE);
+ btnApagarCategoria.setDisabled(Boolean.TRUE);
+ btnModificarCategoria.setDisabled(Boolean.TRUE);
+
+ popularCombobox(cmbIndGeneraFeriadoFechaVenta);
+ popularCombobox(cmbIndGeneraFeriadoFechaViaje);
+
+ carregarTabOcupaAntecipa();
+
+ if (pricing.getIndAgrupadoDia() != null && pricing.getIndAgrupadoDia()) {
+ chkAgruparDia.setChecked(Boolean.TRUE);
+ } else {
+ chkAgruparDia.setChecked(Boolean.FALSE);
+ }
+
+ if (pricing.getIndAgrupadoServico() != null && pricing.getIndAgrupadoServico()) {
+ chkAgruparServico.setChecked(Boolean.TRUE);
+ } else {
+ chkAgruparServico.setChecked(Boolean.FALSE);
+ }
+
+ if (pricing.getColor() != null) {
+ colorChoose.setStyle(" background: #FFFFFF; font-style: oblique;");
+ colorChoose.setValue(pricing.getColor());
+ }
+
+
+ if (pricing.getIndGeneraFeriadoVenta() != null) {
+ if (pricing.getIndGeneraFeriadoVenta().equals("S")) {
+ cmbIndGeneraFeriadoFechaVenta.setSelectedIndex(0);
+ } else if (pricing.getIndGeneraFeriadoVenta().equals("F")) {
+ cmbIndGeneraFeriadoFechaVenta.setSelectedIndex(1);
+ } else if (pricing.getIndGeneraFeriadoVenta().equals("N")) {
+ cmbIndGeneraFeriadoFechaVenta.setSelectedIndex(2);
+ }
+ }
+
+ if (pricing.getIndGeneraFeriadoViaje() != null) {
+ if (pricing.getIndGeneraFeriadoViaje().equals("S")) {
+ cmbIndGeneraFeriadoFechaViaje.setSelectedIndex(0);
+ } else if (pricing.getIndGeneraFeriadoViaje().equals("F")) {
+ cmbIndGeneraFeriadoFechaViaje.setSelectedIndex(1);
+ } else if (pricing.getIndGeneraFeriadoViaje().equals("N")) {
+ cmbIndGeneraFeriadoFechaViaje.setSelectedIndex(2);
+ }
+ }
+
+ // Vigencia
+ pricingVigenciaList.setItemRenderer(new RenderPricingVigencia());
+ lsPricingVigencia = new ArrayList();
+ pricingVigenciaList.setData(lsPricingVigencia);
+
+ // Importe
+ pricingImporteList.setItemRenderer(new RenderPricingImporte());
+ lsPricingImporte = new ArrayList();
+ pricingImporteList.setData(lsPricingImporte);
+
+ // Marca
+ pricingMarcaList.setItemRenderer(new RenderPricingMarca());
+ lsPricingMarca = new ArrayList();
+ pricingMarcaList.addEventListener("onDoubleClick", new EventListener() {
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ GP_PricingMarca pMarca = (GP_PricingMarca) pricingMarcaList.getSelected();
+ verPricingMarca(pMarca);
+ }
+ });
+
+ // Clase
+ pricingClaseList.setItemRenderer(new RenderPricingClase());
+ lsPricingClase = new ArrayList();
+ pricingClaseList.addEventListener("onDoubleClick", new EventListener() {
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ GP_PricingClase pClase = (GP_PricingClase) pricingClaseList.getSelected();
+ verPricingClase(pClase);
+ }
+ });
+
+ // Punto Venta
+ pricingPuntoVentaList.setItemRenderer(new RenderPricingPuntoVenta());
+ lsPricingPuntoVenta = new ArrayList();
+ pricingPuntoVentaList.addEventListener("onDoubleClick", new EventListener() {
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ GP_PricingPuntoVenta pPuntoVenta = (GP_PricingPuntoVenta) pricingPuntoVentaList.getSelected();
+ verPricingPuntoVenta(pPuntoVenta);
+ }
+ });
+
+ // Canal Venta
+ pricingTipoPtoVtaList.setItemRenderer(new RenderPricingTipoPtoVta());
+ lsPricingTipoPtoVta = new ArrayList();
+ pricingTipoPtoVtaList.addEventListener("onDoubleClick", new EventListener() {
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ GP_PricingTipoPtoVta pTipoPtoVta = (GP_PricingTipoPtoVta) pricingTipoPtoVtaList.getSelected();
+ verPricingTipoPtoVta(pTipoPtoVta);
+ }
+ });
+
+ // Rutas
+ pricingRutaList.setItemRenderer(new RenderPricingRuta());
+ lsPricingRuta = new ArrayList();
+ pricingRutaList.addEventListener("onDoubleClick", new EventListener() {
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ GP_PricingRuta pRuta = (GP_PricingRuta) pricingRutaList.getSelected();
+ verPricingRuta(pRuta);
+ }
+ });
+
+ // Categoria
+ pricingCategoriaList.setItemRenderer(new RenderPricingCategoria());
+ lsPricingCategoria = new ArrayList();
+
+ // Mercado
+ pricingMercadoList.setItemRenderer(new RenderPricingMercado());
+ lsPricingMercado = new ArrayList();
+ pricingMercadoList.addEventListener("onDoubleClick", new EventListener() {
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ GP_PricingMercado pMercado = (GP_PricingMercado) pricingMercadoList.getSelected();
+ verPricingMercado(pMercado);
+ }
+ });
+
+ // Dia
+ pricingDiaList.setItemRenderer(new RenderPricingDia());
+ lsPricingDia = new ArrayList();
+ pricingDiaList.addEventListener("onDoubleClick", new EventListener() {
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ GP_PricingDia pDia = (GP_PricingDia) pricingDiaList.getSelected();
+ verPricingDia(pDia);
+ }
+ });
+
+ // Corrida
+ pricingCorridaList.setItemRenderer(new RenderPricingCorrida());
+ lsPricingCorrida = new ArrayList();
+
+ // Asiento
+ pricingAsientoList.setItemRenderer(new RenderPricingAsiento());
+ lsPricingAsiento = new ArrayList();
+ pricingAsientoList.addEventListener("onDoubleClick", new EventListener() {
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ GP_PricingAsiento pAsiento = (GP_PricingAsiento) pricingAsientoList.getSelected();
+ verPricingAsiento(pAsiento);
+ }
+ });
+
+ // TipoServicio
+ pricingTipoServicioList.setItemRenderer(new RenderPricingTipoServicio());
+ lsPricingTipoServicio = new ArrayList();
+ pricingTipoServicioList.addEventListener("onDoubleClick", new EventListener() {
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ GP_PricingTipoServicio pTipoServicio = (GP_PricingTipoServicio) pricingTipoServicioList.getSelected();
+ verPricingTipoServicio(pTipoServicio);
+ }
+ });
+
+ // FormaPago
+ pricingFormapagoList.setItemRenderer(new RenderPricingFormaPago());
+ lsPricingFormapago = new ArrayList();
+ pricingFormapagoList.addEventListener("onDoubleClick", new EventListener() {
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ GP_PricingFormapago pFormapago = (GP_PricingFormapago) pricingFormapagoList.getSelected();
+ verPricingFormapago(pFormapago);
+ }
+ });
+
+ // Tipo Pasajero - Categoria
+ if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.HABILITAR_PRICING_CATEGORIA.getDescricao())) {
+ pricingCategoriaList.setDisabled(Boolean.FALSE);
+ btnNovoCategoria.setDisabled(Boolean.FALSE);
+ btnApagarCategoria.setDisabled(Boolean.FALSE);
+ btnModificarCategoria.setDisabled(Boolean.FALSE);
+ }
+
+ if (pricing.getPricingId() != null) {
+ pricing = pricingService.obtenerID(pricing.getPricingId());
+
+ lsPricingVigencia = pricing.getPricingVigenciaList();
+ pricingVigenciaList.setData(lsPricingVigencia);
+ if (lsPricingVigencia.size() > 0) {
+ pricingVigenciaList.setSelectedIndex(0);
+ }
+
+ lsPricingImporte = pricing.getPricingImporteList();
+ pricingImporteList.setData(lsPricingImporte);
+ if (lsPricingImporte.size() > 0) {
+ pricingImporteList.setSelectedIndex(0);
+ }
+
+ lsPricingMarca = pricing.getPricingMarcaList();
+ pricingMarcaList.setData(lsPricingMarca);
+ if (lsPricingMarca.size() > 0) {
+ pricingMarcaList.setSelectedIndex(0);
+ }
+
+ lsPricingClase = pricing.getPricingClaseList();
+ pricingClaseList.setData(lsPricingClase);
+ if (lsPricingClase.size() > 0) {
+ pricingClaseList.setSelectedIndex(0);
+ }
+
+ lsPricingTipoServicio = pricing.getPricingTipoServicioList();
+ pricingTipoServicioList.setData(lsPricingTipoServicio);
+ if (lsPricingTipoServicio.size() > 0) {
+ pricingTipoServicioList.setSelectedIndex(0);
+ }
+
+ lsPricingFormapago = pricing.getPricingFormapagoList();
+ pricingFormapagoList.setData(lsPricingFormapago);
+ if (lsPricingFormapago.size() > 0) {
+ pricingFormapagoList.setSelectedIndex(0);
+ }
+
+ lsPricingPuntoVenta = pricing.getPricingPuntoventaList();
+ pricingPuntoVentaList.setData(lsPricingPuntoVenta);
+ if (lsPricingPuntoVenta.size() > 0) {
+ pricingPuntoVentaList.setSelectedIndex(0);
+ }
+
+ lsPricingCategoria = pricing.getPricingCategoriaList();
+ pricingCategoriaList.setData(lsPricingCategoria);
+ if (lsPricingCategoria.size() > 0) {
+ pricingCategoriaList.setSelectedIndex(0);
+ }
+
+ lsPricingRuta = pricing.getPricingRutaList();
+ pricingRutaList.setData(lsPricingRuta);
+ if (lsPricingRuta.size() > 0) {
+ pricingRutaList.setSelectedIndex(0);
+ }
+
+ lsPricingMercado = pricing.getPricingMercadoList();
+ pricingMercadoList.setData(lsPricingMercado);
+
+ lsPricingTipoPtoVta = pricing.getPricingTipoptovtaList();
+ pricingTipoPtoVtaList.setData(lsPricingTipoPtoVta);
+ if (lsPricingTipoPtoVta.size() > 0) {
+ pricingTipoPtoVtaList.setSelectedIndex(0);
+ }
+
+ lsPricingCorrida = pricing.getPricingCorridaList();
+ pricingCorridaList.setData(lsPricingCorrida);
+
+ lsPricingDia = pricing.getPricingDiaList();
+ pricingDiaList.setData(lsPricingDia);
+
+ lsPricingAsiento = pricing.getPricingAsientoList();
+ pricingAsientoList.setData(lsPricingAsiento);
+
+ lsPricingTipoServicio = pricing.getPricingTipoServicioList();
+ pricingTipoServicioList.setData(lsPricingTipoServicio);
+
+ lsPricingFormapago = pricing.getPricingFormapagoList();
+ pricingFormapagoList.setData(lsPricingFormapago);
+
+ if (pricing.getIndtransferible() == Boolean.FALSE) {
+ rdTransNo.setChecked(true);
+ }
+ if (pricing.getIndcancelable() == Boolean.FALSE) {
+ rdCanceNo.setChecked(true);
+ }
+ if (pricing.getIndreservable() == Boolean.FALSE) {
+ rdReserNo.setChecked(true);
+ }
+ if (pricing.getDescuentoporcentaje() != null) {
+ radioPor.setChecked(true);
+ }
+ if (!lsPricingImporte.isEmpty()) {
+ radioImp.setChecked(true);
+ onClick$radioImp(null);
+ } else {
+
+ btnNovoImporte.setVisible(false);
+ btnApagarImporte.setVisible(false);
+ btnModificarImporte.setVisible(false);
+ }
+
+ // BUG-1202 Não permitir alterar a empresa.
+ cmbEmpresa.setDisabled(true);
+
+ rdEstadiaMinimaSi.setChecked(pricing.getIndestadiaminima() != null ? pricing.getIndestadiaminima() : false);
+ rdEstadiaMinimaNo.setChecked(!rdEstadiaMinimaSi.isChecked());
+
+ chkIndLunEstadiaminima.setChecked(pricing.getIndLunEstadiaminima() != null ? pricing.getIndLunEstadiaminima() : false);
+ chkIndMarEstadiaminima.setChecked(pricing.getIndMarEstadiaminima() != null ? pricing.getIndMarEstadiaminima() : false);
+ chkIndMieEstadiaminima.setChecked(pricing.getIndMieEstadiaminima() != null ? pricing.getIndMieEstadiaminima() : false);
+ chkIndJueEstadiaminima.setChecked(pricing.getIndJueEstadiaminima() != null ? pricing.getIndJueEstadiaminima() : false);
+ chkIndVieEstadiaminima.setChecked(pricing.getIndVieEstadiaminima() != null ? pricing.getIndVieEstadiaminima() : false);
+ chkIndSabEstadiaminima.setChecked(pricing.getIndSabEstadiaminima() != null ? pricing.getIndSabEstadiaminima() : false);
+ chkIndDomEstadiaminima.setChecked(pricing.getIndDomEstadiaminima() != null ? pricing.getIndDomEstadiaminima() : false);
+
+ salvo = true;
+
+ ativarDesativarCamposEstadiaMinima(pricing.getDescuentoporcredondo() == null);
+
+ pricingOriginal = pricing.clonar();
+
+ } else {
+
+ btnNovoImporte.setVisible(false);
+ btnApagarImporte.setVisible(false);
+ btnModificarImporte.setVisible(false);
+ descuentoporcredondo.setDisabled(false);
+
+ pricingService.suscribir(pricing);
+ // Marca - Preenchendo com o Objeto TODOS caso exista.
+ Short id = -1;
+ GP_PricingMarca pm = new GP_PricingMarca();
+ Marca m = marcaService.obtenerID(id);
+ if (m != null) {
+ pm.setMarca(m);
+ pm.setPricing(pricing);
+ pm.setActivo(GP_Pricing.ATIVO);
+ pm.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ pm.setFecmodif(Calendar.getInstance().getTime());
+ lsPricingMarca.add(pm);
+ pricingMarcaList.setData(lsPricingMarca);
+ pricingMarcaService.suscribir(pm);
+ }
+
+ // Tipo de Servicio
+ GP_PricingClase pts = new GP_PricingClase();
+ ClaseServicio cs = claseServicioService.obtenerID((int)id);
+ if (cs != null) {
+ pts.setClaseServicio(cs);
+ pts.setPricing(pricing);
+ pts.setActivo(GP_Pricing.ATIVO);
+ pts.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ pts.setFecmodif(Calendar.getInstance().getTime());
+ lsPricingClase.add(pts);
+ pricingClaseList.setData(lsPricingClase);
+ pricingClaseService.suscribir(pts);
+ }
+
+ // Punto de Venta
+ GP_PricingPuntoVenta ppv = new GP_PricingPuntoVenta();
+ PuntoVenta pv = puntoVentaService.obtenerID(-1);
+ if (pv != null) {
+ ppv.setPuntoVenta(pv);
+ ppv.setPricing(pricing);
+ ppv.setActivo(GP_Pricing.ATIVO);
+ ppv.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ ppv.setFecmodif(Calendar.getInstance().getTime());
+ lsPricingPuntoVenta.add(ppv);
+ pricingPuntoVentaList.setData(lsPricingPuntoVenta);
+ pricingPuntoVentaService.suscribir(ppv);
+ }
+ // Punto de Venta
+ GP_PricingTipoPtoVta ptpv = new GP_PricingTipoPtoVta();
+ TipoPuntoVenta tpv = tipoPuntoVentaService.obtenerID((short) -1);
+ if (tpv != null) {
+ ptpv.setTipoPtovta(tpv);
+ ptpv.setPricing(pricing);
+ ptpv.setActivo(GP_Pricing.ATIVO);
+ ptpv.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ ptpv.setFecmodif(Calendar.getInstance().getTime());
+ lsPricingTipoPtoVta.add(ptpv);
+ pricingTipoPtoVtaList.setData(lsPricingTipoPtoVta);
+ pricingTipoPtoVtaService.suscribir(ptpv);
+ }
+
+ // Ruta
+ GP_PricingRuta pr = new GP_PricingRuta();
+ Ruta r = rutaService.obtenerID(-1);
+ if (r != null) {
+ pr.setRuta(r);
+ pr.setPricing(pricing);
+ pr.setActivo(GP_Pricing.ATIVO);
+ pr.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ pr.setFecmodif(Calendar.getInstance().getTime());
+ lsPricingRuta.add(pr);
+ pricingRutaList.setData(lsPricingRuta);
+ pricingRutaService.suscribir(pr);
+ }
+
+ // Mercado
+ GP_PricingMercado pme = new GP_PricingMercado();
+ Parada p1 = paradaService.obtenerID(-1);
+ if (p1 != null) {
+ pme.setActivo(GP_Pricing.ATIVO);
+ pme.setPricing(pricing);
+ pme.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ pme.setFecmodif(Calendar.getInstance().getTime());
+ pme.setOrigen(p1);
+ pme.setDestino(p1);
+
+ lsPricingMercado.add(pme);
+ pricingMercadoList.setData(lsPricingMercado);
+ pricingMercadoService.suscribir(pme);
+ }
+
+ incluirCategoria(categoriaService.obtenerID(1));
+
+ incluirCategoriasPadroes();
+
+ btnApagar.setVisible(Boolean.FALSE);
+ btnInativar.setVisible(Boolean.FALSE);
+ btnAtivar.setVisible(Boolean.FALSE);
+ }
+ }
+
+ private void carregarTabOcupaAntecipa() {
+ lsPricingOcupaAntecipa = pricingOcupaAntecipaService.carregarPricingOcupaAntecipa(pricing.getPricingId());
+ lsPricingOcupacaoAntecipas = pricingOcupaAntecipaService.carregarPricingOcupaAntecipaVO(pricing.getPricingId());
+
+ pricingOcupaAntecipaList.setItemRenderer(new RenderPricingOcupacao());
+ pricingOcupaAntecipaList.setData(lsPricingOcupacaoAntecipas);
+ pricingOcupaAntecipaList.addEventListener("onDoubleClick", new EventListener() {
+ @Override
+ public void onEvent(Event event) throws Exception {
+ if(event instanceof ForwardEvent) {
+ ForwardEvent forwardEvent = (ForwardEvent) event;
+ String vet[] = forwardEvent.getOrigin().getTarget().getId().split("-");
+ Integer pricingocupaantecipaId = Integer.valueOf(vet[0]);
+ verPricingOcupaAntecipa(pricingocupaantecipaId);
+ }
+ }
+ });
+
+ lsPricingOcupaAntecipaLegendas = pricingOcupaAntecipaService.carregarPricingOcupaAntecipaLegenda(pricing.getPricingId());
+ pricingOcupaAntecipaLegendaList.setItemRenderer(new RenderPricingOcupaAntecipaLegenda());
+ pricingOcupaAntecipaLegendaList.setData(lsPricingOcupaAntecipaLegendas);
+ }
+
+ private void incluirCategoria(Categoria categoria) {
+ if (categoria != null && verificarCategoriaNaoAdicionada(categoria)) {
+ GP_PricingCategoria pc = new GP_PricingCategoria();
+ pc.setCategoria(categoria);
+ pc.setPricing(pricing);
+ pc.setActivo(GP_Pricing.ATIVO);
+ pc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ pc.setFecmodif(Calendar.getInstance().getTime());
+
+ if(lsPricingCategoria == null) {
+ lsPricingCategoria = new ArrayList();
+ }
+ lsPricingCategoria.add(pc);
+ pricingCategoriaList.setData(lsPricingCategoria);
+ pricingCategoriaService.suscribir(pc);
+ }
+ }
+
+ /** Valida se a categoria não foi adicionada */
+ private boolean verificarCategoriaNaoAdicionada(Categoria categoria) {
+ if(lsPricingCategoria == null || lsPricingCategoria.isEmpty()) {
+ return true;
+ }
+ for (GP_PricingCategoria pricingCategoria : lsPricingCategoria) {
+ if(pricingCategoria.getCategoria() != null && pricingCategoria.getCategoria().equals(categoria)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ protected void incluirCategoriaNormal(Categoria categoriaNormal) {
+ incluirCategoria(categoriaNormal);
+ }
+
+ @Override
+ protected void incluirCategoriaPet(Categoria categoriaPET) {
+ incluirCategoria(categoriaPET);
+ }
+
+ public void onClick$radioImp(Event ev) {
+ btnNovoImporte.setVisible(true);
+ btnApagarImporte.setVisible(true);
+ btnModificarImporte.setVisible(true);
+
+ descuentoporcsen.setConstraint("");
+ descuentoporcsen.setDisabled(true);
+ descuentoporcsen.setValue(null);
+ pricing.setDescuentoporcentaje(null);
+
+ descuentoporcredondo.setConstraint("");
+ descuentoporcredondo.setValue(null);
+ descuentoporcredondo.setDisabled(true);
+ pricing.setDescuentoporcredondo(null);
+ }
+
+ public void onClick$radioPor(Event ev) {
+ btnNovoImporte.setVisible(false);
+ btnApagarImporte.setVisible(false);
+ btnModificarImporte.setVisible(false);
+
+ descuentoporcsen.setDisabled(false);
+ descuentoporcredondo.setDisabled(false);
+
+ Object[] listPImporte = pricingImporteList.getData();
+ if (listPImporte != null) {
+ for (Object o : listPImporte) {
+ GP_PricingImporte pImporte = (GP_PricingImporte) o;
+ lsPricingImporte.remove(pImporte);
+
+ pImporte.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ pImporte.setFecmodif(Calendar.getInstance().getTime());
+ pImporte.setActivo(GP_Pricing.INATIVO);
+
+ lsPricingImporte.add(pImporte);
+ pricingImporteList.removeItem(pImporte);
+ }
+
+ pricingImporteList.clearSelection();
+ pricing.setPricingImporteList(lsPricingImporte);
+ }
+ }
+
+ private boolean validarNome() throws InterruptedException {
+ try {
+ nombrePricing.getValue();
+ } catch (WrongValueException e) {
+
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.nomPricingVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+
+ return false;
+ }
+
+ return true;
+ }
+
+ private boolean validarObligatorios() throws InterruptedException {
+ try {
+ nombrePricing.getValue();
+ } catch (WrongValueException e) {
+
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.nomPricingVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+
+ return false;
+ }
+
+ try {
+ if (pricing.getEmpresa() == null) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.empresaVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+
+ return false;
+ }
+ cmbEmpresa.getValue();
+ } catch (WrongValueException e) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.empresaVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+
+ return false;
+ }
+
+ try {
+ itxCantboleto.getValue();
+ } catch (WrongValueException e) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.cantAsientosCorridasVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return false;
+ }
+
+ if (pricingVigenciaList.getModel().getSize() == 0) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.vigenciasVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return false;
+ }
+
+ try {
+ cantdiasanticipacion.getValue();
+ } catch (WrongValueException e) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.cantDiasAntecipacionVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return false;
+ }
+
+ if (pricingMarcaList.getModel().getSize() == 0) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.marcaVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return false;
+ }
+ if (pricingClaseList.getModel().getSize() == 0) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.claseVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return false;
+ }
+ if (pricingPuntoVentaList.getModel().getSize() == 0) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.puntoVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return false;
+ }
+
+ if (pricingRutaList.getModel().getSize() == 0) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.rutaVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return false;
+ }
+
+ if (verificarContemTodasRuta() && verificarContemTodas()) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.noRutaTodasYTrechosTodos"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return false;
+ }
+ if (pricingTipoPtoVtaList.getModel().getSize() == 0) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.tipoPtoVtaVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return false;
+ }
+
+ if (pricingCategoriaList.getModel().getSize() == 0) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.categoriaVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return false;
+ }
+
+ if (pricingMercadoList.getModel().getSize() == 0 && verificarContemTodasRuta()) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.mercadoVazio"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return false;
+ }
+
+ if(!rdEstadiaMinimaSi.isDisabled() && rdEstadiaMinimaSi.isChecked() && cantdiasEstadiaminima.getValue() == null) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.cantestadiaminima"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ return false;
+ }
+
+ return true;
+ }
+
+ private boolean verificarContemTodasRuta() {
+ Integer rutaIdTodas = -1;
+ for(int i = 0; i < pricingRutaList.getModel().getSize(); i++ ){
+ GP_PricingRuta princingRuta = (GP_PricingRuta) pricingRutaList.getModel().getElementAt(i);
+ if(princingRuta.getRuta().getRutaId() == rutaIdTodas){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private Boolean verificarContemTodas() {
+ String TODAS = "TODAS";
+ for(int i = 0; i < pricingMercadoList.getModel().getSize(); i++ ){
+ GP_PricingMercado princingMercado = (GP_PricingMercado) pricingMercadoList.getModel().getElementAt(i);
+ if(princingMercado.getOrigen().getDescparada().equals(TODAS) || princingMercado.getDestino().getDescparada().equals(TODAS)){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void onClick$btnSalvar(Event ev) throws InterruptedException {
+ if (!validarObligatorios()) {
+ return;
+ }
+
+ if(!pricingCorridaList.getListData().isEmpty()){
+ pricing.setPricingCorridaList((List)pricingCorridaList.getListData());
+ }
+
+ BigDecimal vlrdescuentoporcsen = descuentoporcsen.getValueDecimal();
+ BigDecimal vlrdescuentoporcredondo = descuentoporcredondo.getValueDecimal();
+
+ if (cmbIndGeneraFeriadoFechaVenta.getSelectedItem() != null) {
+ pricing.setIndGeneraFeriadoVenta((String) cmbIndGeneraFeriadoFechaVenta.getSelectedItem().getValue());
+ }
+
+ if (cmbIndGeneraFeriadoFechaViaje.getSelectedItem() != null) {
+ pricing.setIndGeneraFeriadoViaje((String) cmbIndGeneraFeriadoFechaViaje.getSelectedItem().getValue());
+ }
+
+ if (chkAgruparDia.isChecked()) {
+ pricing.setIndAgrupadoDia(Boolean.TRUE);
+ } else {
+ pricing.setIndAgrupadoDia(Boolean.FALSE);
+ }
+
+ if (chkAgruparServico.isChecked()) {
+ pricing.setIndAgrupadoServico(Boolean.TRUE);
+ } else {
+ pricing.setIndAgrupadoServico(Boolean.FALSE);
+ }
+
+ try {
+ try {
+ if (radioPor.isChecked()) {
+
+ if ((vlrdescuentoporcsen != null) && (vlrdescuentoporcsen.intValue() < -100 || vlrdescuentoporcsen.intValue() >= 1000)) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.msgSencillo.title"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return;
+ }
+
+ if ((vlrdescuentoporcredondo != null) && (vlrdescuentoporcredondo.intValue() < -100 || vlrdescuentoporcredondo.intValue() >= 1000)) {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.msgRedondo.title"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+ return;
+
+ }
+ }
+ } catch (Exception ex) {
+ log.error("PrincigController - descuentoporcsen.getValue() // descuentoporcredondo.getValue() : " + ex);
+ Messagebox.show(
+ Labels.getLabel("MSG.Error"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+
+ }
+
+ pricing.setEmpresa((Empresa) cmbEmpresa.getSelectedItem().getValue());
+
+ if (colorChoose.getValue() != null) {
+ pricing.setColor(colorChoose.getValue());
+ }
+
+ if (rdTransSi.isChecked()) {
+ pricing.setIndtransferible(Boolean.TRUE);
+ } else {
+ pricing.setIndtransferible(Boolean.FALSE);
+ }
+ if (rdCanceSi.isChecked()) {
+ pricing.setIndcancelable(Boolean.TRUE);
+ } else {
+ pricing.setIndcancelable(Boolean.FALSE);
+ }
+ if (rdReserSi.isChecked()) {
+ pricing.setIndreservable(Boolean.TRUE);
+ } else {
+ pricing.setIndreservable(Boolean.FALSE);
+ }
+ if (rdExibirVendaSi.isChecked()) {
+ pricing.setExibeVenda(Boolean.TRUE);
+ } else {
+ pricing.setExibeVenda(Boolean.FALSE);
+ }
+
+ definirCamposEstadiaMinima();
+
+ if (gravarNovo) {
+ List lsPricing =
+ pricingService.buscarPorNombre(pricing.getNombPricing());
+
+ if (lsPricing.size() == 0) {
+ pricing = pricingService.actualizacion(pricing);
+ pricingList.addItemNovo(pricing);
+
+ compararAlteracoesESalvarHistorico();
+
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.suscribirOK"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+
+ salvo = true;
+
+ } else {
+ Messagebox.show(
+ Labels.getLabel("MSG.Registro.Existe"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ }
+ } else {
+
+ if(!lsPricingOcupaAntecipa.isEmpty()){
+ pricing.setPricingOcupaAntecipaList(lsPricingOcupaAntecipa);
+ }
+
+ pricing = pricingService.actualizacion(pricing);
+ pricingList.updateItem(pricing);
+
+ if (buscarPricingInativosAtivos.equals(GP_Pricing.INATIVO)) {
+ pricingService.inativar(pricing);
+ }
+
+ compararAlteracoesESalvarHistorico();
+
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.suscribirOK"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+
+ salvo = true;
+
+ }
+
+ // Se for por porcentage eu desativo todos os importes
+ if (radioPor.isChecked()) {
+ pricing = pricingService.obtenerID(pricing.getPricingId());
+ for (GP_PricingImporte pi : pricing.getPricingImporteList()) {
+ pricingImporteService.borrar(pi);
+ }
+ }
+ } catch (Exception ex) {
+ log.error("Error salvar pricing : " + ex);
+ Messagebox.show(
+ Labels.getLabel("MSG.Error"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ }
+ }
+
+ private void compararAlteracoesESalvarHistorico() {
+ try {
+ // Busca todas as listas novamente pq nao encontrava novos registros
+ pricing.setPricingAsientoList(pricingAsientoService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingOcupaAntecipaList(pricingOcupaAntecipaService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingCategoriaList(pricingCategoriaService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingClaseList(pricingClaseService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingCorridaList(pricingCorridaService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingDiaList(pricingDiaService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingFormapagoList(pricingFormapagoService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingImporteList(pricingImporteService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingMarcaList(pricingMarcaService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingMercadoList(pricingMercadoService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingPuntoventaList(pricingPuntoVentaService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingRutaList(pricingRutaService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingTipoptovtaList(pricingTipoPtoVtaService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingTipoServicioList(pricingTipoServicioService.obtenerTodoPorPricing(pricing));
+ pricing.setPricingVigenciaList(pricingVigenciaService.obtenerTodoPorPricing(pricing));
+
+ pricingHistoricoService.compararESalvar(pricingOriginal, pricing);
+ pricingOriginal = new GP_Pricing();
+ pricingOriginal = pricing.clonar();
+ } catch (Exception e) {
+ log.error("Erro ao salvar historico do Pricing Rapido: ", e);
+ }
+ }
+
+ private void definirCamposEstadiaMinima() {
+ chkIndLunEstadiaminima.getValue();
+ chkIndMarEstadiaminima.getValue();
+ chkIndMieEstadiaminima.getValue();
+ chkIndJueEstadiaminima.getValue();
+ chkIndVieEstadiaminima.getValue();
+ chkIndSabEstadiaminima.getValue();
+ chkIndDomEstadiaminima.getValue();
+ cantdiasEstadiaminima.getValue();
+
+ /*
+ * Caso não exista percentual de desconto informado, limpar as configurações de estadia mínima
+ * Mantis #14990
+ */
+ if(pricing.getDescuentoporcredondo() != null && rdEstadiaMinimaSi.isChecked()) {
+ pricing.setIndestadiaminima(Boolean.TRUE);
+ pricing.setCantdiasEstadiaminima(cantdiasEstadiaminima.getValue());
+ pricing.setIndLunEstadiaminima(chkIndLunEstadiaminima.isChecked());
+ pricing.setIndMarEstadiaminima(chkIndMarEstadiaminima.isChecked());
+ pricing.setIndMieEstadiaminima(chkIndMieEstadiaminima.isChecked());
+ pricing.setIndJueEstadiaminima(chkIndJueEstadiaminima.isChecked());
+ pricing.setIndVieEstadiaminima(chkIndVieEstadiaminima.isChecked());
+ pricing.setIndSabEstadiaminima(chkIndSabEstadiaminima.isChecked());
+ pricing.setIndDomEstadiaminima(chkIndDomEstadiaminima.isChecked());
+ } else {
+ cantdiasEstadiaminima.setValue(null);
+ rdEstadiaMinimaSi.setChecked(false);
+ rdEstadiaMinimaNo.setChecked(true);
+ chkIndLunEstadiaminima.setChecked(false);
+ chkIndMarEstadiaminima.setChecked(false);
+ chkIndMieEstadiaminima.setChecked(false);
+ chkIndJueEstadiaminima.setChecked(false);
+ chkIndVieEstadiaminima.setChecked(false);
+ chkIndSabEstadiaminima.setChecked(false);
+ chkIndDomEstadiaminima.setChecked(false);
+ }
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public void onClick$btnCopiar(Event ev) throws InterruptedException {
+
+ Map args = new HashMap();
+ args.put("pricing", pricing);
+
+ openWindow("/gui/gestao_pricing/copiarGP_Pricing.zul",
+ Labels.getLabel("copiarPricingController.window.title"), args, MODAL);
+
+ }
+
+
+ @SuppressWarnings({ "unchecked" })
+ public void onCheck$chkAgruparDia(CheckEvent ev) throws InterruptedException {
+
+ if (ev.isChecked()) {
+ List list = pricingDiaList.getListData();
+ Checkbox chk = (Checkbox) ev.getTarget();
+
+ if (list.isEmpty()) {
+ Messagebox.show(
+ "Adicione os registros para habilitar agrupação. ",
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+
+ chk.setChecked(false);
+ ev.stopPropagation();
+ }
+
+ for (GP_PricingDia gp_PricingDia : list) {
+
+ if (gp_PricingDia.getIndfecviaje() != null && !gp_PricingDia.getIndfecviaje()) {
+
+ Messagebox.show(
+ "Para agrupar é necessário escolher somente Data da Viagem. ",
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+
+ chk.setChecked(false);
+ ev.stopPropagation();
+ }
+ }
+ }
+ }
+
+ // O tratamento para deletar o Pricing (made by Monteiro) quando sair sem
+ // salvar foi mudado para o evento onClose da janela.
+ public void onClick$btnFechar(Event ev) {
+ onClose$winEditarPricing(null);
+ }
+
+ public void onClose$winEditarPricing(Event ev) {
+ if (!salvo) {
+ if (pricing.getPricingId() != null) {
+ pricingService.borrarFisico(pricing);
+ }
+ }
+
+ closeWindow();
+ }
+
+ public void onClick$btnApagar(Event ev) throws InterruptedException {
+ try {
+ int resp = Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.borrarPergunta"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
+
+ if (resp == Messagebox.YES) {
+ pricingService.borrar(pricing);
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.borrarOK"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.INFORMATION);
+
+ pricingList.removeItem(pricing);
+
+ closeWindow();
+ }
+ } catch (Exception ex) {
+ log.error("Erro apagar pricing : " + ex);
+ Messagebox.show(
+ Labels.getLabel("MSG.Error"),
+ Labels.getLabel("editarPricingController.window.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ }
+ }
+
+ public void onClick$btnModificarVigencia(Event ev) {
+ GP_PricingVigencia pVigencia = (GP_PricingVigencia) pricingVigenciaList.getSelected();
+
+ if (pVigencia != null) {
+ verPricingVigencia(pVigencia);
+ } else {
+ try {
+ Messagebox.show(Labels.getLabel("editarPricingController.MSG.selectItem"), Labels.getLabel("editarPricingController.windowVigencia.title"), Messagebox.OK, Messagebox.EXCLAMATION);
+ } catch (InterruptedException ex) {
+ java.util.logging.Logger.getLogger(EditarGP_PricingController.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+ }
+
+ public void onClick$btnApagarVigencia(Event ev) throws Exception {
+ List