diff --git a/.classpath b/.classpath
index 42fd8df20..56fe1eb18 100644
--- a/.classpath
+++ b/.classpath
@@ -87,7 +87,6 @@
-
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/BusquedaPricingController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/BusquedaPricingController.java
index 68736fbc4..38025d897 100644
--- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/BusquedaPricingController.java
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/BusquedaPricingController.java
@@ -19,6 +19,7 @@ import org.zkoss.zhtml.Messagebox;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
+import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Paging;
@@ -28,7 +29,6 @@ import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Pricing;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.PricingService;
-import com.rjconsultores.ventaboletos.service.UsuarioEmpresaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
@@ -44,14 +44,13 @@ import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricing;
@Scope("prototype")
public class BusquedaPricingController extends MyGenericForwardComposer {
+ private static final long serialVersionUID = 1L;
@Autowired
private transient PagedListWrapper plwPricingPunto;
@Autowired
private PricingService pricingService;
@Autowired
private EmpresaService empresaService;
- @Autowired
- private UsuarioEmpresaService usuarioEmpresaService;
private MyListbox pricingList;
private Paging pagingPricing;
private List lsPricing;
@@ -60,178 +59,9 @@ public class BusquedaPricingController extends MyGenericForwardComposer {
private Textbox txtNome;
private Datebox fechaInicio;
private Datebox fechaFin;
+ private Checkbox chkBuscarInativos;
private static Logger log = Logger.getLogger(BusquedaPricingController.class);
- @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 {
- Pricing pricing = (Pricing) pricingList.getSelected();
- verPricing(pricing);
- }
- });
-
- lsPricing = new ArrayList();
-
- refreshLista();
- }
-
- public void onClick$btnPesquisa(Event ev) throws InterruptedException {
- refreshLista();
- }
-
- public void onClick$btnRefresh(Event ev) {
- refreshLista();
- }
-
- public void onClick$btnNovo(Event ev) {
- verPricing(new Pricing());
- }
-
- private void refreshLista() {
- Empresa empresa = (Empresa) (cmbEmpresa.getSelectedItem() != null ? cmbEmpresa
- .getSelectedItem().getValue() : null);
-
- HibernateSearchObject pricingSearch = new HibernateSearchObject(
- Pricing.class, pagingPricing.getPageSize());
-
- if (empresa != null) {
- pricingSearch.addFilterEqual("empresa", empresa);
- }else{
- pricingSearch.addFilterIn("empresa", lsEmpresa);
- }
-
- 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());
- }
- }
-
-
-
-
-
-
- pricingSearch.addFilterEqual("activo", Boolean.TRUE);
-
- 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) {
- }
- }
- }
-
- private void verPricing(Pricing pricing) {
- if (pricing == null) {
- return;
- }
-
- Map args = new HashMap();
- args.put("pricing", pricing);
- args.put("gravarNovo", pricing.getPricingId() == null);
- args.put("pricingList", pricingList);
-
- openWindow("/gui/pricing/editarPricing.zul",
- Labels.getLabel("editarPricingController.window.title"), args,
- MODAL);
- }
-
- public void onClick$btnApagar(Event ev) {
- try {
- Pricing p = (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);
- }
- }
-
public List getLsPricing() {
return lsPricing;
}
@@ -248,14 +78,6 @@ public class BusquedaPricingController extends MyGenericForwardComposer {
this.pagingPricing = pagingPricing;
}
- public PagedListWrapper getPlwPricingPunto() {
- return plwPricingPunto;
- }
-
- public void setPlwPricingPunto(PagedListWrapper plwPricingPunto) {
- this.plwPricingPunto = plwPricingPunto;
- }
-
public MyListbox getPricingList() {
return pricingList;
}
@@ -311,6 +133,163 @@ public class BusquedaPricingController extends MyGenericForwardComposer {
public void setFechaFin(Datebox fechaFin) {
this.fechaFin = fechaFin;
}
-
-
+
+ @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 {
+ Pricing pricing = (Pricing) pricingList.getSelected();
+ verPricing(pricing);
+ }
+ });
+
+ lsPricing = new ArrayList();
+
+ refreshLista();
+ }
+
+ public void onClick$btnPesquisa(Event ev) throws InterruptedException {
+ refreshLista();
+ }
+
+ public void onClick$btnRefresh(Event ev) {
+ refreshLista();
+ }
+
+ public void onClick$btnNovo(Event ev) {
+ verPricing(new Pricing());
+ }
+
+ private void refreshLista() {
+ Empresa empresa = (Empresa) (cmbEmpresa.getSelectedItem() != null ? cmbEmpresa.getSelectedItem().getValue() : null);
+
+ HibernateSearchObject pricingSearch = new HibernateSearchObject(
+ Pricing.class, pagingPricing.getPageSize());
+
+ if (empresa != null) {
+ pricingSearch.addFilterEqual("empresa", empresa);
+ } else {
+ pricingSearch.addFilterIn("empresa", lsEmpresa);
+ }
+
+ 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", Pricing.INATIVO);
+ } else {
+ pricingSearch.addFilterEqual("activo", 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(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() ? Pricing.INATIVO : Pricing.ATIVO);
+
+ openWindow("/gui/pricing/editarPricing.zul",
+ Labels.getLabel("editarPricingController.window.title"), args, MODAL);
+ }
+
+ public void onClick$btnApagar(Event ev) {
+ try {
+ Pricing p = (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/pricing/EditarPricingAnticipacionController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingAnticipacionController.java
index cdc903eb8..fa5ab8b17 100644
--- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingAnticipacionController.java
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingAnticipacionController.java
@@ -29,161 +29,162 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
/**
- *
+ *
* @author Rafius
*/
@Controller("editarPricingAnticipacionController")
@Scope("prototype")
public class EditarPricingAnticipacionController extends MyGenericForwardComposer {
- @Autowired
- private PricingAnticipacionService pricingAnticipacionService;
- private PricingAnticipacion pricingAnticipacion;
- private MyListbox pricingAnticipacionList;
- private Intbox anticipacioninicial;
- private Intbox anticipacionfinal;
- private MyTextboxDecimal porcentaje;
- private Pricing pricing;
- private ConstraintPorcentagem ct;
- private static Logger log = Logger.getLogger(EditarPricingAnticipacionController.class);
+ private static final long serialVersionUID = 1L;
+ @Autowired
+ private PricingAnticipacionService pricingAnticipacionService;
+ private PricingAnticipacion pricingAnticipacion;
+ private MyListbox pricingAnticipacionList;
+ private Intbox anticipacioninicial;
+ private Intbox anticipacionfinal;
+ private MyTextboxDecimal porcentaje;
+ private Pricing pricing;
+ private ConstraintPorcentagem ct;
+ private static Logger log = Logger.getLogger(EditarPricingAnticipacionController.class);
- @Override
- public void doAfterCompose(Component comp) throws Exception {
- ct = new ConstraintPorcentagem();
- pricing = (Pricing) Executions.getCurrent().getArg().get("pricing");
- pricingAnticipacion = (PricingAnticipacion) Executions.getCurrent().getArg().get("pricingAnticipacion");
- pricingAnticipacionList = (MyListbox) Executions.getCurrent().getArg().get("pricingAnticipacionList");
+ @Override
+ public void doAfterCompose(Component comp) throws Exception {
+ ct = new ConstraintPorcentagem();
+ pricing = (Pricing) Executions.getCurrent().getArg().get("pricing");
+ pricingAnticipacion = (PricingAnticipacion) Executions.getCurrent().getArg().get("pricingAnticipacion");
+ pricingAnticipacionList = (MyListbox) Executions.getCurrent().getArg().get("pricingAnticipacionList");
- super.doAfterCompose(comp);
- }
+ super.doAfterCompose(comp);
+ }
- public void onClick$btnAdicionarAnticipacion(Event ev) throws Exception {
- anticipacioninicial.getValue();
- anticipacionfinal.getValue();
- porcentaje.getValue();
+ public void onClick$btnAdicionarAnticipacion(Event ev) throws Exception {
+ anticipacioninicial.getValue();
+ anticipacionfinal.getValue();
+ porcentaje.getValue();
- if (anticipacioninicial.getValue() > 100) {
- Messagebox.show(Labels.getLabel("editarPricingController.anticipacionPorcentaje.value"),
- Labels.getLabel("editarPricingController.windowAnticipacion.title"),
- Messagebox.OK, Messagebox.EXCLAMATION);
- } else if (anticipacionfinal.getValue() > 100) {
- Messagebox.show(Labels.getLabel("editarPricingController.anticipacionPorcentaje.value"),
- Labels.getLabel("editarPricingController.windowAnticipacion.title"),
- Messagebox.OK, Messagebox.EXCLAMATION);
- } else if (anticipacionfinal.getValue() < anticipacioninicial.getValue()) {
- Messagebox.show(Labels.getLabel("editarPricingController.anticipacionErrada.value"),
- Labels.getLabel("editarPricingController.windowAnticipacion.title"),
- Messagebox.OK, Messagebox.EXCLAMATION);
+ if (anticipacioninicial.getValue() > 100) {
+ Messagebox.show(Labels.getLabel("editarPricingController.anticipacionPorcentaje.value"),
+ Labels.getLabel("editarPricingController.windowAnticipacion.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ } else if (anticipacionfinal.getValue() > 100) {
+ Messagebox.show(Labels.getLabel("editarPricingController.anticipacionPorcentaje.value"),
+ Labels.getLabel("editarPricingController.windowAnticipacion.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ } else if (anticipacionfinal.getValue() < anticipacioninicial.getValue()) {
+ Messagebox.show(Labels.getLabel("editarPricingController.anticipacionErrada.value"),
+ Labels.getLabel("editarPricingController.windowAnticipacion.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
- } else {
+ } else {
- Integer min = pricingAnticipacion.getCantdiasmin();
- Integer max = pricingAnticipacion.getCantdiasmax();
- // Boolean podeSalvar = pricingAnticipacionService.podeSalvar(pricing,
- // min, max);
+ Integer min = pricingAnticipacion.getCantdiasmin();
+ Integer max = pricingAnticipacion.getCantdiasmax();
+ // Boolean podeSalvar = pricingAnticipacionService.podeSalvar(pricing,
+ // min, max);
- boolean existe = true;
+ boolean existe = true;
- List lsPricingAnticipacion = pricingAnticipacionService.obtenerPorPricing(pricingAnticipacion.getPricing());
+ List lsPricingAnticipacion = pricingAnticipacionService.obtenerPorPricing(pricingAnticipacion.getPricing());
- if (pricingAnticipacion != null) {
- lsPricingAnticipacion.remove(pricingAnticipacion);
- }
- for (PricingAnticipacion po : lsPricingAnticipacion) {
- if (po.getActivo()) {
- boolean traslapa = TraslaparUtil.intersectNum(
- po.getCantdiasmin().longValue(), po.getCantdiasmax().longValue(),
- min.longValue(), max.longValue());
- if (traslapa) {
- existe = false;
- }
- }
- }
+ if (pricingAnticipacion != null) {
+ lsPricingAnticipacion.remove(pricingAnticipacion);
+ }
+ for (PricingAnticipacion po : lsPricingAnticipacion) {
+ if (po.getActivo().equals(Pricing.ATIVO)) {
+ boolean traslapa = TraslaparUtil.intersectNum(
+ po.getCantdiasmin().longValue(), po.getCantdiasmax().longValue(),
+ min.longValue(), max.longValue());
+ if (traslapa) {
+ existe = false;
+ }
+ }
+ }
- if (existe) {
- if (pricingAnticipacion.getPricinganticipacionId() != null) {
- pricingAnticipacionService.actualizacion(pricingAnticipacion);
- pricingAnticipacionList.updateItem(pricingAnticipacion);
- } else {
- pricingAnticipacionService.suscribir(pricingAnticipacion);
- pricingAnticipacionList.addItem(pricingAnticipacion);
- }
- closeWindow();
- } else {
- Messagebox.show(Labels.getLabel("editarPricingController.anticipacionErrada"),
- Labels.getLabel("editarPricingController.windowAnticipacion.title"),
- Messagebox.OK, Messagebox.EXCLAMATION);
- }
+ if (existe) {
+ if (pricingAnticipacion.getPricinganticipacionId() != null) {
+ pricingAnticipacionService.actualizacion(pricingAnticipacion);
+ pricingAnticipacionList.updateItem(pricingAnticipacion);
+ } else {
+ pricingAnticipacionService.suscribir(pricingAnticipacion);
+ pricingAnticipacionList.addItemNovo(pricingAnticipacion);
+ }
+ closeWindow();
+ } else {
+ Messagebox.show(Labels.getLabel("editarPricingController.anticipacionErrada"),
+ Labels.getLabel("editarPricingController.windowAnticipacion.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ }
- }
- }
+ }
+ }
- public void onClick$btnRemoverAnticipacion(Event ev) {
- try {
- PricingAnticipacion pAnticipacion = (PricingAnticipacion) pricingAnticipacionList.getSelected();
- if (pAnticipacion != null) {
- int resp = Messagebox.show(Labels.getLabel("editarPricingController.MSG.borrarPerguntaAnticipacion"),
- Labels.getLabel("editarPricingController.windowAnticipacion.title"),
- Messagebox.YES | Messagebox.NO,
- Messagebox.QUESTION);
+ public void onClick$btnRemoverAnticipacion(Event ev) {
+ try {
+ PricingAnticipacion pAnticipacion = (PricingAnticipacion) pricingAnticipacionList.getSelected();
+ if (pAnticipacion != null) {
+ int resp = Messagebox.show(Labels.getLabel("editarPricingController.MSG.borrarPerguntaAnticipacion"),
+ Labels.getLabel("editarPricingController.windowAnticipacion.title"),
+ Messagebox.YES | Messagebox.NO,
+ Messagebox.QUESTION);
- if (resp == Messagebox.YES) {
- pricingAnticipacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
- pricingAnticipacion.setFecmodif(Calendar.getInstance().getTime());
- pricingAnticipacion.setActivo(Boolean.FALSE);
+ if (resp == Messagebox.YES) {
+ pricingAnticipacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ pricingAnticipacion.setFecmodif(Calendar.getInstance().getTime());
+ pricingAnticipacion.setActivo(Pricing.EXCLUIDO);
- pricingAnticipacionList.removeItem(pricingAnticipacion);
- pricingAnticipacionService.borrar(pricingAnticipacion);
- closeWindow();
- }
- } else {
- Messagebox.show(Labels.getLabel("editarPricingController.MSG.selectItem"),
- Labels.getLabel("editarPricingController.windowAnticipacion.title"),
- Messagebox.OK, Messagebox.EXCLAMATION);
- }
- } catch (Exception ex) {
- log.error(ex);
- }
+ pricingAnticipacionList.removeItem(pricingAnticipacion);
+ pricingAnticipacionService.borrar(pricingAnticipacion);
+ closeWindow();
+ }
+ } else {
+ Messagebox.show(Labels.getLabel("editarPricingController.MSG.selectItem"),
+ Labels.getLabel("editarPricingController.windowAnticipacion.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ }
+ } catch (Exception ex) {
+ log.error(ex);
+ }
- }
+ }
- public PricingAnticipacion getPricingAnticipacion() {
- return pricingAnticipacion;
- }
+ public PricingAnticipacion getPricingAnticipacion() {
+ return pricingAnticipacion;
+ }
- public void setPricingAnticipacion(PricingAnticipacion pricingAnticipacion) {
- this.pricingAnticipacion = pricingAnticipacion;
- }
+ public void setPricingAnticipacion(PricingAnticipacion pricingAnticipacion) {
+ this.pricingAnticipacion = pricingAnticipacion;
+ }
- public MyListbox getPricingAnticipacionList() {
- return pricingAnticipacionList;
- }
+ public MyListbox getPricingAnticipacionList() {
+ return pricingAnticipacionList;
+ }
- public void setPricingAnticipacionList(MyListbox pricingAnticipacionList) {
- this.pricingAnticipacionList = pricingAnticipacionList;
- }
+ public void setPricingAnticipacionList(MyListbox pricingAnticipacionList) {
+ this.pricingAnticipacionList = pricingAnticipacionList;
+ }
- public PricingAnticipacionService getPricingAnticipacionService() {
- return pricingAnticipacionService;
- }
+ public PricingAnticipacionService getPricingAnticipacionService() {
+ return pricingAnticipacionService;
+ }
- public void setPricingAnticipacionService(
- PricingAnticipacionService pricingAnticipacionService) {
- this.pricingAnticipacionService = pricingAnticipacionService;
- }
+ public void setPricingAnticipacionService(
+ PricingAnticipacionService pricingAnticipacionService) {
+ this.pricingAnticipacionService = pricingAnticipacionService;
+ }
- /**
- * @return the ct
- */
- public ConstraintPorcentagem getCt() {
- return ct;
- }
+ /**
+ * @return the ct
+ */
+ public ConstraintPorcentagem getCt() {
+ return ct;
+ }
- /**
- * @param ct
- * the ct to set
- */
- public void setCt(ConstraintPorcentagem ct) {
- this.ct = 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/pricing/EditarPricingAsientoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingAsientoController.java
index 5f404586b..28c651119 100644
--- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingAsientoController.java
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingAsientoController.java
@@ -16,9 +16,9 @@ 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.Decimalbox;
import org.zkoss.zul.Intbox;
+import com.rjconsultores.ventaboletos.entidad.Pricing;
import com.rjconsultores.ventaboletos.entidad.PricingAsiento;
import com.rjconsultores.ventaboletos.service.PricingAsientoService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@@ -28,137 +28,138 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
/**
- *
+ *
* @author Rafius
*/
@Controller("editarPricingAsientoController")
@Scope("prototype")
public class EditarPricingAsientoController extends MyGenericForwardComposer {
- @Autowired
- private PricingAsientoService pricingAsientoService;
- private PricingAsiento pricingAsiento;
- private MyListbox pricingAsientoList;
- private MyTextboxDecimal porcentaje;
- private Intbox numeasiento;
- private ConstraintPorcentagem ct;
- private static Logger log = Logger.getLogger(EditarPricingAsientoController.class);
+ private static final long serialVersionUID = 1L;
+ @Autowired
+ private PricingAsientoService pricingAsientoService;
+ private PricingAsiento pricingAsiento;
+ private MyListbox pricingAsientoList;
+ private MyTextboxDecimal porcentaje;
+ private Intbox numeasiento;
+ private ConstraintPorcentagem ct;
+ private static Logger log = Logger.getLogger(EditarPricingAsientoController.class);
- @Override
- public void doAfterCompose(Component comp) throws Exception {
+ @Override
+ public void doAfterCompose(Component comp) throws Exception {
- ct = new ConstraintPorcentagem();
- pricingAsiento = (PricingAsiento) Executions.getCurrent().getArg().get("pricingAsiento");
- pricingAsientoList = (MyListbox) Executions.getCurrent().getArg().get("pricingAsientoList");
+ ct = new ConstraintPorcentagem();
+ pricingAsiento = (PricingAsiento) Executions.getCurrent().getArg().get("pricingAsiento");
+ pricingAsientoList = (MyListbox) Executions.getCurrent().getArg().get("pricingAsientoList");
- super.doAfterCompose(comp);
- }
+ super.doAfterCompose(comp);
+ }
- public void onClick$btnAdicionarAsiento(Event ev) throws Exception {
- numeasiento.getValue();
- porcentaje.getValue();
+ public void onClick$btnAdicionarAsiento(Event ev) throws Exception {
+ numeasiento.getValue();
+ porcentaje.getValue();
- List lsAsientos = pricingAsientoService.obtenerPricingCategoria(pricingAsiento.getPricing(), numeasiento.getValue());
+ List lsAsientos = pricingAsientoService.obtenerPricingCategoria(pricingAsiento.getPricing(), numeasiento.getValue());
- try {
- boolean exite = true;
+ try {
+ boolean exite = true;
- if (lsAsientos.isEmpty()) {
- exite = false;
- } else {
- for (PricingAsiento a : lsAsientos) {
- if (a.getPricingasientoId().equals(pricingAsiento.getPricingasientoId())) {
- exite = false;
- }
- }
- }
+ if (lsAsientos.isEmpty()) {
+ exite = false;
+ } else {
+ for (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.addItem(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);
- }
- }
+ 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 {
+ PricingAsiento pAsiento = (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);
- public void onClick$btnRemoverAsiento(Event ev) {
- try {
- PricingAsiento pAsiento = (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(Pricing.INATIVO);
- if (resp == Messagebox.YES) {
- pricingAsiento.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
- pricingAsiento.setFecmodif(Calendar.getInstance().getTime());
- pricingAsiento.setActivo(Boolean.FALSE);
+ 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);
+ }
- 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 PricingAsiento getPricingAsiento() {
+ return pricingAsiento;
+ }
- public PricingAsiento getPricingAsiento() {
- return pricingAsiento;
- }
+ public void setPricingAsiento(PricingAsiento pricingAsiento) {
+ this.pricingAsiento = pricingAsiento;
+ }
- public void setPricingAsiento(PricingAsiento pricingAsiento) {
- this.pricingAsiento = pricingAsiento;
- }
+ public MyListbox getPricingAsientoList() {
+ return pricingAsientoList;
+ }
- public MyListbox getPricingAsientoList() {
- return pricingAsientoList;
- }
+ public void setPricingAsientoList(MyListbox pricingAsientoList) {
+ this.pricingAsientoList = pricingAsientoList;
+ }
- public void setPricingAsientoList(MyListbox pricingAsientoList) {
- this.pricingAsientoList = pricingAsientoList;
- }
+ public PricingAsientoService getPricingAsientoService() {
+ return pricingAsientoService;
+ }
- public PricingAsientoService getPricingAsientoService() {
- return pricingAsientoService;
- }
+ public void setPricingAsientoService(PricingAsientoService pricingAsientoService) {
+ this.pricingAsientoService = pricingAsientoService;
+ }
- public void setPricingAsientoService(PricingAsientoService pricingAsientoService) {
- this.pricingAsientoService = pricingAsientoService;
- }
+ /**
+ * @return the ct
+ */
+ public ConstraintPorcentagem getCt() {
+ return ct;
+ }
- /**
- * @return the ct
- */
- public ConstraintPorcentagem getCt() {
- return ct;
- }
-
- /**
- * @param ct the ct to set
- */
- public void setCt(ConstraintPorcentagem ct) {
- this.ct = 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/pricing/EditarPricingCategoriaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingCategoriaController.java
index 4b6e0deeb..f6c5c0a07 100644
--- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingCategoriaController.java
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingCategoriaController.java
@@ -5,6 +5,7 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.pricing;
import com.rjconsultores.ventaboletos.entidad.Categoria;
+import com.rjconsultores.ventaboletos.entidad.Pricing;
import com.rjconsultores.ventaboletos.entidad.PricingCategoria;
import com.rjconsultores.ventaboletos.service.CategoriaService;
import com.rjconsultores.ventaboletos.service.PricingCategoriaService;
@@ -100,7 +101,7 @@ public class EditarPricingCategoriaController extends MyGenericForwardComposer {
if (resp == Messagebox.YES) {
pricingCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
pricingCategoria.setFecmodif(Calendar.getInstance().getTime());
- pricingCategoria.setActivo(Boolean.FALSE);
+ pricingCategoria.setActivo(Pricing.INATIVO);
pricingCategoriaList.removeItem(pricingCategoria);
pricingCategoriaService.borrar(pricingCategoria);
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingClaseController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingClaseController.java
index b7d5e527d..70fb8ef72 100644
--- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingClaseController.java
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingClaseController.java
@@ -5,6 +5,7 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.pricing;
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
+import com.rjconsultores.ventaboletos.entidad.Pricing;
import com.rjconsultores.ventaboletos.entidad.PricingClase;
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
import com.rjconsultores.ventaboletos.service.PricingClaseService;
@@ -25,146 +26,145 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Combobox;
/**
- *
+ *
* @author Rafius
*/
@Controller("editarPricingClaseController")
@Scope("prototype")
public class EditarPricingClaseController extends MyGenericForwardComposer {
- @Autowired
- private PricingClaseService pricingClaseService;
- @Autowired
- private ClaseServicioService claseServicioService;
- private List lsClase;
- private PricingClase pricingClase;
- private MyListbox pricingClaseList;
- private Combobox cmbClase;
- private static Logger log = Logger.getLogger(EditarPricingClaseController.class);
+ @Autowired
+ private PricingClaseService pricingClaseService;
+ @Autowired
+ private ClaseServicioService claseServicioService;
+ private List lsClase;
+ private PricingClase pricingClase;
+ private MyListbox pricingClaseList;
+ private Combobox cmbClase;
+ private static Logger log = Logger.getLogger(EditarPricingClaseController.class);
- @Override
- public void doAfterCompose(Component comp) throws Exception {
+ @Override
+ public void doAfterCompose(Component comp) throws Exception {
- lsClase = claseServicioService.obtenerTodos();
+ lsClase = claseServicioService.obtenerTodos();
- pricingClase = (PricingClase) Executions.getCurrent().getArg().get("pricingClase");
- pricingClaseList = (MyListbox) Executions.getCurrent().getArg().get("pricingClaseList");
+ pricingClase = (PricingClase) Executions.getCurrent().getArg().get("pricingClase");
+ pricingClaseList = (MyListbox) Executions.getCurrent().getArg().get("pricingClaseList");
- super.doAfterCompose(comp);
+ super.doAfterCompose(comp);
+ cmbClase.focus();
+ }
- cmbClase.focus();
- }
+ public void onClick$btnAdicionarClase(Event ev) throws Exception {
+ cmbClase.getValue();
- public void onClick$btnAdicionarClase(Event ev) throws Exception {
- cmbClase.getValue();
+ try {
- try {
+ if (pricingClase.getClaseServicio() == null) {
+ Messagebox.show(
+ Labels.getLabel("MSG.Error.combobox"),
+ Labels.getLabel("editarPricingController.windowClase.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ } else {
- 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();
+ }
+ }
+ } catch (Exception ex) {
+ log.error(ex);
+ }
+ }
- 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();
- }
- }
- } catch (Exception ex) {
- log.error(ex);
- }
- }
+ public void onClick$btnRemoverClase(Event ev) {
+ try {
+ PricingClase pClase = (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);
- public void onClick$btnRemoverClase(Event ev) {
- try {
- PricingClase pClase = (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(Pricing.INATIVO);
- if (resp == Messagebox.YES) {
- pricingClase.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
- pricingClase.setFecmodif(Calendar.getInstance().getTime());
- pricingClase.setActivo(Boolean.FALSE);
+ pricingClaseList.removeItem(pricingClase);
+ pricingClaseService.borrar(pricingClase);
+ closeWindow();
+ }
+ } else {
+ Messagebox.show(
+ Labels.getLabel("editarPricingController.MSG.selectItem"),
+ Labels.getLabel("editarPricingController.windowClase.title"),
+ Messagebox.OK, Messagebox.EXCLAMATION);
+ }
+ } catch (Exception ex) {
+ log.error(ex);
+ }
- pricingClaseList.removeItem(pricingClase);
- pricingClaseService.borrar(pricingClase);
- closeWindow();
- }
- } else {
- Messagebox.show(
- Labels.getLabel("editarPricingController.MSG.selectItem"),
- Labels.getLabel("editarPricingController.windowClase.title"),
- Messagebox.OK, Messagebox.EXCLAMATION);
- }
- } catch (Exception ex) {
- log.error(ex);
- }
+ }
- }
+ public PricingClase getPricingClase() {
+ return pricingClase;
+ }
- public PricingClase getPricingClase() {
- return pricingClase;
- }
+ public void setPricingClase(PricingClase pricingClase) {
+ this.pricingClase = pricingClase;
+ }
- public void setPricingClase(PricingClase pricingClase) {
- this.pricingClase = pricingClase;
- }
+ public MyListbox getPricingClaseList() {
+ return pricingClaseList;
+ }
- public MyListbox getPricingClaseList() {
- return pricingClaseList;
- }
+ public void setPricingClaseList(MyListbox pricingClaseList) {
+ this.pricingClaseList = pricingClaseList;
+ }
- public void setPricingClaseList(MyListbox pricingClaseList) {
- this.pricingClaseList = pricingClaseList;
- }
+ public PricingClaseService getPricingClaseService() {
+ return pricingClaseService;
+ }
- public PricingClaseService getPricingClaseService() {
- return pricingClaseService;
- }
+ public void setPricingClaseService(PricingClaseService pricingClaseService) {
+ this.pricingClaseService = pricingClaseService;
+ }
- public void setPricingClaseService(PricingClaseService pricingClaseService) {
- this.pricingClaseService = pricingClaseService;
- }
+ public ClaseServicioService getClaseServicioService() {
+ return claseServicioService;
+ }
- public ClaseServicioService getClaseServicioService() {
- return claseServicioService;
- }
+ public void setClaseServicioService(ClaseServicioService claseServicioService) {
+ this.claseServicioService = claseServicioService;
+ }
- public void setClaseServicioService(ClaseServicioService claseServicioService) {
- this.claseServicioService = claseServicioService;
- }
+ public static Logger getLog() {
+ return log;
+ }
- public static Logger getLog() {
- return log;
- }
+ public static void setLog(Logger log) {
+ EditarPricingClaseController.log = log;
+ }
- public static void setLog(Logger log) {
- EditarPricingClaseController.log = log;
- }
+ public List getLsClase() {
+ return lsClase;
+ }
- public List getLsClase() {
- return lsClase;
- }
-
- public void setLsClase(List lsClase) {
- this.lsClase = lsClase;
- }
+ public void setLsClase(List lsClase) {
+ this.lsClase = lsClase;
+ }
}
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingController.java
index e0eed385f..46abf6c77 100644
--- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingController.java
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/pricing/EditarPricingController.java
@@ -60,7 +60,6 @@ import com.rjconsultores.ventaboletos.service.ClaseServicioService;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.MarcaService;
import com.rjconsultores.ventaboletos.service.ParadaService;
-import com.rjconsultores.ventaboletos.service.PricingAnticipacionService;
import com.rjconsultores.ventaboletos.service.PricingCategoriaService;
import com.rjconsultores.ventaboletos.service.PricingClaseService;
import com.rjconsultores.ventaboletos.service.PricingImporteService;
@@ -70,11 +69,9 @@ import com.rjconsultores.ventaboletos.service.PricingPuntoVentaService;
import com.rjconsultores.ventaboletos.service.PricingRutaService;
import com.rjconsultores.ventaboletos.service.PricingService;
import com.rjconsultores.ventaboletos.service.PricingTipoPtoVtaService;
-import com.rjconsultores.ventaboletos.service.PricingTipoServicioService;
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
import com.rjconsultores.ventaboletos.service.RutaService;
import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService;
-import com.rjconsultores.ventaboletos.service.UsuarioEmpresaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
@@ -123,14 +120,8 @@ public class EditarPricingController extends MyGenericForwardComposer {
@Autowired
private PricingImporteService pricingImporteService;
@Autowired
- private PricingAnticipacionService pricingAnticipacionService;
- @Autowired
- private PricingTipoServicioService pricingTipoServicioService;
- @Autowired
private EmpresaService empresaService;
@Autowired
- private UsuarioEmpresaService usuarioEmpresaService;
- @Autowired
private MarcaService marcaService;
@Autowired
private ClaseServicioService claseServicioService;
@@ -189,1829 +180,58 @@ public class EditarPricingController extends MyGenericForwardComposer {
private Radio radioPor;
private MyTextboxDecimal descuentoporcredondo;
private MyTextboxDecimal descuentoporcsen;
+ private Button btnSalvar;
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 btnNovoOcupacion;
+ private Button btnApagarOcupacion;
+ private Button btnModificarOcupacion;
+ private Button btnNovoAnticipacion;
+ private Button btnApagarAnticipacion;
+ private Button btnModificarAnticipacion;
+ private Button btnNovoTipoServicio;
+ private Button btnApagarTipoServicio;
+ private Button btnModificarTipoServicio;
private boolean salvo = false;
private Boolean gravarNovo = Boolean.TRUE;
- private Button btnApagar;
private Textbox nombrePricing;
private Intbox itxCantboleto;
private Intbox cantdiasanticipacion;
private Combobox cmbIndGeneraFeriadoFechaVenta;
private Combobox cmbIndGeneraFeriadoFechaViaje;
-
- 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();
- lsEmpresa.add(empresaService.obtenerID(-1));
-
- pricing = (Pricing) Executions.getCurrent().getArg().get("pricing");
- pricingList = (MyListbox) Executions.getCurrent().getArg().get("pricingList");
- gravarNovo = (Boolean) Executions.getCurrent().getArg().get("gravarNovo");
-
- super.doAfterCompose(comp);
-
- popularCombobox(cmbIndGeneraFeriadoFechaVenta);
- popularCombobox(cmbIndGeneraFeriadoFechaViaje);
-
- 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 {
- PricingMarca pMarca = (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 {
- PricingClase pClase = (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 {
- PricingPuntoVenta pPuntoVenta = (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 {
- PricingTipoPtoVta pTipoPtoVta = (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 {
- PricingRuta pRuta = (PricingRuta) pricingRutaList.getSelected();
- verPricingRuta(pRuta);
- }
- });
-
- // Categoria
- pricingCategoriaList.setItemRenderer(new RenderPricingCategoria());
- lsPricingCategoria = new ArrayList();
- // pricingCategoriaList.addEventListener("onDoubleClick", new
- // EventListener() {
- //
- // @Override
- // public void onEvent(Event event) throws Exception {
- // PricingCategoria pCategoria = (PricingCategoria)
- // pricingCategoriaList.getSelected();
- // verPricingCategoria(pCategoria);
- // }
- // });
-
- // Mercado
- pricingMercadoList.setItemRenderer(new RenderPricingMercado());
- lsPricingMercado = new ArrayList();
- pricingMercadoList.addEventListener("onDoubleClick", new EventListener() {
-
- @Override
- public void onEvent(Event event) throws Exception {
- PricingMercado pMercado = (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 {
- PricingDia pDia = (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 {
- PricingAsiento pAsiento = (PricingAsiento) pricingAsientoList.getSelected();
- verPricingAsiento(pAsiento);
- }
- });
-
- // Anticipacion
- pricingAnticipacionList.setItemRenderer(new RenderPricingAnticipacion());
- lsPricingAnticipacion = new ArrayList();
- pricingAnticipacionList.addEventListener("onDoubleClick", new EventListener() {
-
- @Override
- public void onEvent(Event event) throws Exception {
- PricingAnticipacion pAnticipacion = (PricingAnticipacion) pricingAnticipacionList.getSelected();
- verPricingAnticipacion(pAnticipacion);
- }
- });
-
- // TipoServicio
- pricingTipoServicioList.setItemRenderer(new RenderPricingTipoServicio());
- lsPricingTipoServicio = new ArrayList();
- pricingTipoServicioList.addEventListener("onDoubleClick", new EventListener() {
-
- @Override
- public void onEvent(Event event) throws Exception {
- PricingTipoServicio pTipoServicio = (PricingTipoServicio) pricingTipoServicioList.getSelected();
- verPricingTipoServicio(pTipoServicio);
- }
- });
-
- // Ocupacion
- pricingOcupacionList.setItemRenderer(new RenderPricingOcupacion());
- lsPricingOcupacion = new ArrayList();
- pricingOcupacionList.addEventListener("onDoubleClick", new EventListener() {
-
- @Override
- public void onEvent(Event event) throws Exception {
- PricingOcupacion pOcupacion = (PricingOcupacion) pricingOcupacionList.getSelected();
- verPricingOcupacion(pOcupacion);
- }
- });
-
- 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);
- }
- lsPricingAnticipacion = pricing.getPricingAnticipacionList();
- pricingAnticipacionList.setData(lsPricingAnticipacion);
- if (lsPricingAnticipacion.size() > 0) {
- pricingAnticipacionList.setSelectedIndex(0);
- }
- lsPricingTipoServicio = pricing.getPricingTipoServicioList();
- pricingTipoServicioList.setData(lsPricingTipoServicio);
- if (lsPricingTipoServicio.size() > 0) {
- pricingTipoServicioList.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);
-
- lsPricingOcupacion = pricing.getPricingOcupacionList();
- pricingOcupacionList.setData(lsPricingOcupacion);
-
- lsPricingAnticipacion = pricing.getPricingAnticipacionList();
- pricingAnticipacionList.setData(lsPricingAnticipacion);
-
- lsPricingTipoServicio = pricing.getPricingTipoServicioList();
- pricingTipoServicioList.setData(lsPricingTipoServicio);
-
- 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.size() > 0) {
- radioImp.setChecked(true);
- onClick$radioImp(null);
- } else {
- radioPor.setChecked(true);
- btnNovoImporte.setVisible(false);
- btnApagarImporte.setVisible(false);
- btnModificarImporte.setVisible(false);
- }
-
- // BUG-1202 Não permitir alterar a empresa.
- cmbEmpresa.setDisabled(true);
-
- salvo = true;
- } else {
- radioPor.setChecked(true);
-
- 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;
- PricingMarca pm = new PricingMarca();
- Marca m = marcaService.obtenerID(id);
- if (m != null) {
- pm.setMarca(m);
- pm.setPricing(pricing);
- pm.setActivo(Boolean.TRUE);
- pm.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
- pm.setFecmodif(Calendar.getInstance().getTime());
- lsPricingMarca.add(pm);
- pricingMarcaList.setData(lsPricingMarca);
- pricingMarcaService.suscribir(pm);
- }
-
- // Tipo de Servicio
- PricingClase pts = new PricingClase();
- ClaseServicio cs = claseServicioService.obtenerID(id);
- if (cs != null) {
- pts.setClaseServicio(cs);
- pts.setPricing(pricing);
- pts.setActivo(Boolean.TRUE);
- pts.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
- pts.setFecmodif(Calendar.getInstance().getTime());
- lsPricingClase.add(pts);
- pricingClaseList.setData(lsPricingClase);
- pricingClaseService.suscribir(pts);
- }
-
- // Punto de Venta
- PricingPuntoVenta ppv = new PricingPuntoVenta();
- PuntoVenta pv = puntoVentaService.obtenerID(-1);
- if (pv != null) {
- ppv.setPuntoVenta(pv);
- ppv.setPricing(pricing);
- ppv.setActivo(Boolean.TRUE);
- ppv.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
- ppv.setFecmodif(Calendar.getInstance().getTime());
- lsPricingPuntoVenta.add(ppv);
- pricingPuntoVentaList.setData(lsPricingPuntoVenta);
- pricingPuntoVentaService.suscribir(ppv);
- }
- // Punto de Venta
- PricingTipoPtoVta ptpv = new PricingTipoPtoVta();
- TipoPuntoVenta tpv = tipoPuntoVentaService.obtenerID((short) -1);
- if (tpv != null) {
- ptpv.setTipoPtovta(tpv);
- ptpv.setPricing(pricing);
- ptpv.setActivo(Boolean.TRUE);
- ptpv.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
- ptpv.setFecmodif(Calendar.getInstance().getTime());
- lsPricingTipoPtoVta.add(ptpv);
- pricingTipoPtoVtaList.setData(lsPricingTipoPtoVta);
- pricingTipoPtoVtaService.suscribir(ptpv);
- }
-
- // Ruta
- PricingRuta pr = new PricingRuta();
- Ruta r = rutaService.obtenerID(-1);
- if (r != null) {
- pr.setRuta(r);
- pr.setPricing(pricing);
- pr.setActivo(Boolean.TRUE);
- pr.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
- pr.setFecmodif(Calendar.getInstance().getTime());
- lsPricingRuta.add(pr);
- pricingRutaList.setData(lsPricingRuta);
- pricingRutaService.suscribir(pr);
- }
- // Tipo Pasajero - Categoria
- PricingCategoria pc = new PricingCategoria();
- Categoria categoria = categoriaService.obtenerID(1);
- pricingCategoriaList.setDisabled(Boolean.TRUE);
- if (categoria != null) {
- pc.setCategoria(categoria);
- pc.setPricing(pricing);
- pc.setActivo(Boolean.TRUE);
- pc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
- pc.setFecmodif(Calendar.getInstance().getTime());
- lsPricingCategoria.add(pc);
- pricingCategoriaList.setData(lsPricingCategoria);
- pricingCategoriaService.suscribir(pc);
- }
-
- // Mercado
- PricingMercado pme = new PricingMercado();
- Parada p1 = paradaService.obtenerID(-1);
- if (p1 != null) {
- pme.setActivo(Boolean.TRUE);
- 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);
- }
-
- // Empresa
- Empresa emp = empresaService.obtenerID(-1);
- if (emp != null) {
- pricing.setEmpresa(emp);
- cmbEmpresa.setText(emp.getNombempresa());
- }
- }
-
- if (pricing.getPricingId() == null) {
- btnApagar.setVisible(Boolean.FALSE);
- }
-
- }
-
- 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);
-
- // this.descuentoporcredondo.setConstraint("no empty");
- // this.descuentoporcsen.setConstraint("no empty");
-
- descuentoporcsen.setDisabled(false);
- descuentoporcredondo.setDisabled(false);
-
- Object[] listPImporte = pricingImporteList.getData();
- if (listPImporte != null) {
- for (Object o : listPImporte) {
- PricingImporte pImporte = (PricingImporte) o;
- lsPricingImporte.remove(pImporte);
-
- pImporte.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
- pImporte.setFecmodif(Calendar.getInstance().getTime());
- pImporte.setActivo(Boolean.FALSE);
-
- lsPricingImporte.add(pImporte);
- pricingImporteList.removeItem(pImporte);
- }
-
- pricingImporteList.clearSelection();
- pricing.setPricingImporteList(lsPricingImporte);
- // pricingService.actualizacion(pricing);
-
- }
- }
-
- 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 (radioImp.isChecked()) {
- if (pricingImporteList.getModel().getSize() == 0) {
- Messagebox.show(
- Labels.getLabel("editarPricingController.MSG.cantImportePricingVazio"),
- Labels.getLabel("editarPricingController.window.title"),
- Messagebox.OK, Messagebox.INFORMATION);
- return false;
- }
- } else {
- if ((descuentoporcsen.getValue() == null) || (descuentoporcsen.getValue().equals("")) || (descuentoporcsen.getValueDecimal().compareTo(BigDecimal.ZERO) == 0)) {
- if ((pricingAsientoList.getData().length == 0) && (pricingOcupacionList.getData().length == 0)) {
- Messagebox.show(
- Labels.getLabel("editarPricingController.MSG.porcentajeSencilloVazio"),
- 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 (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) {
- Messagebox.show(
- Labels.getLabel("editarPricingController.MSG.mercadoVazio"),
- Labels.getLabel("editarPricingController.window.title"),
- Messagebox.OK, Messagebox.INFORMATION);
- return false;
- }
-
- return true;
- }
-
- public void onClick$btnSalvar(Event ev) throws InterruptedException {
- if (!validarObligatorios()) {
- return;
- }
-
- 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());
- }
-
- 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 (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 (gravarNovo) {
-
- pricingService.actualizacion(pricing);// eu guardo antes para
- // gantir que os dados
- // que eu tenho na tela
- // estão no banco
- List lsPricing =
- pricingService.buscarPorNombre(pricing.getNombPricing());
-
- if (lsPricing.size() <= 1) {
- pricingService.actualizacion(pricing);
- pricingList.addItem(pricing);
-
- Messagebox.show(
- Labels.getLabel("editarPricingController.MSG.suscribirOK"),
- Labels.getLabel("editarPricingController.window.title"),
- Messagebox.OK, Messagebox.INFORMATION);
-
- salvo = true;
- // Bugzilla 1191: Não fechar janela.
- // closeWindow();
- } else {
- Messagebox.show(
- Labels.getLabel("MSG.Registro.Existe"),
- Labels.getLabel("editarPricingController.window.title"),
- Messagebox.OK, Messagebox.EXCLAMATION);
- }
- } else {
-
- pricingService.actualizacion(pricing);
- pricingList.updateItem(pricing);
-
- Messagebox.show(
- Labels.getLabel("editarPricingController.MSG.suscribirOK"),
- Labels.getLabel("editarPricingController.window.title"),
- Messagebox.OK, Messagebox.INFORMATION);
-
- salvo = true;
- // Bugzilla 1191: Não fechar janela.
- // closeWindow();
- }
-
- // Se for por porcentage eu desativo todos os importes
- if (radioPor.isChecked()) {
- pricing = pricingService.obtenerID(pricing.getPricingId());
- for (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);
- }
-
- }
-
- // 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) {
- PricingVigencia pVigencia = (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(EditarPricingController.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
-
- public void onClick$btnApagarVigencia(Event ev) throws Exception {
- List