From d7810bfbf2b98311e37e7c8b43f8187e4169bcc5 Mon Sep 17 00:00:00 2001 From: rodrigo Date: Mon, 20 Aug 2012 19:49:48 +0000 Subject: [PATCH] git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@20594 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../catalogos/BusquedaEmpresaController.java | 13 - .../BusquedaFormaPagoController.java | 186 ++++------- .../BusquedaTipoVentaController.java | 146 ++++----- .../catalogos/EditarEmpresaController.java | 14 - .../catalogos/EditarFormaPagoController.java | 295 ++++++++--------- .../catalogos/EditarTipoVentaController.java | 258 +++++++-------- ...quedaConfiguracionFormaPagoController.java | 138 ++++---- ...usquedaRestriccionFormaPagoController.java | 150 ++++----- .../EditarRestriccionFormaPagoController.java | 306 ++++++++---------- .../web/utilerias/render/RenderEmpresa.java | 13 +- src/java/spring-config.xml | 22 +- web/WEB-INF/i3-label_pt_BR.label | 2 +- web/gui/catalogos/busquedaEmpresa.zul | 173 +++++----- web/gui/catalogos/busquedaFormaPago.zul | 109 ++++--- web/gui/catalogos/busquedaTipoVenta.zul | 3 - web/gui/catalogos/editarEmpresa.zul | 5 - web/gui/catalogos/editarFormaPago.zul | 109 ++++--- .../busquedaRestriccionFormaPago.zul | 9 +- .../editarRestriccionFormaPago.zul | 80 +++-- 19 files changed, 888 insertions(+), 1143 deletions(-) diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/BusquedaEmpresaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/BusquedaEmpresaController.java index 08917ad10..b213acb7e 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/BusquedaEmpresaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/BusquedaEmpresaController.java @@ -44,7 +44,6 @@ public class BusquedaEmpresaController extends MyGenericForwardComposer { private Textbox txtNombre; private Textbox txtEquivalencia; private Textbox txtRFC; - private Combobox cmbExterna; private Combobox cmbIndTipo; private Row rowEquivalencia; private Listheader headerEquivalencia; @@ -91,18 +90,6 @@ public class BusquedaEmpresaController extends MyGenericForwardComposer { HibernateSearchObject empresaBusqueda = new HibernateSearchObject(Empresa.class, pagingEmpresa.getPageSize()); - Comboitem ci = cmbExterna.getSelectedItem(); - String value; - if (ci != null) { - value = (String) ci.getValue(); - - if (value.equals("1")) { - empresaBusqueda.addFilterEqual("indExterna", Boolean.TRUE); - } else { - empresaBusqueda.addFilterEqual("indExterna", Boolean.FALSE); - } - } - Comboitem cbiTipo = cmbIndTipo.getSelectedItem(); Short tipo = null; if (cbiTipo != null) { diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/BusquedaFormaPagoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/BusquedaFormaPagoController.java index 8a82f2e1b..c38fc4c57 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/BusquedaFormaPagoController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/BusquedaFormaPagoController.java @@ -27,144 +27,98 @@ import org.zkoss.zul.Row; import org.zkoss.zul.Textbox; /** - * + * * @author Administrador */ @Controller("busquedaFormaPagoController") @Scope("prototype") public class BusquedaFormaPagoController extends MyGenericForwardComposer { - @Autowired - private transient PagedListWrapper plwFormaPago; - private MyListbox formaPagoList; - private Paging pagingFormaPago; - private Textbox txtNome; - private Textbox txtEquivalencia; - private Row rowEquivalencia; - private Listheader headerEquivalencia; + private static final long serialVersionUID = 1L; + @Autowired + private transient PagedListWrapper plwFormaPago; + private MyListbox formaPagoList; + private Paging pagingFormaPago; + private Textbox txtNome; + private Textbox txtEquivalencia; + private Row rowEquivalencia; + private Listheader headerEquivalencia; - public MyListbox getFormaPagoList() { - return formaPagoList; - } + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); - public void setFormaPagoList(MyListbox formaPagoList) { - this.formaPagoList = formaPagoList; - } + formaPagoList.setItemRenderer(new RenderFormaPago()); + formaPagoList.addEventListener("onDoubleClick", new EventListener() { - public Paging getPagingFormaPago() { - return pagingFormaPago; - } + @Override + public void onEvent(Event event) throws Exception { + FormaPago c = (FormaPago) formaPagoList.getSelected(); + verFormaPago(c); + } + }); - public void setPagingFormaPago(Paging pagingFormaPago) { - this.pagingFormaPago = pagingFormaPago; - } + refreshLista(); - public Textbox getTxtNome() { - return txtNome; - } + if (!ApplicationProperties.getInstance().mostrarEquivalencia()) { + rowEquivalencia.setVisible(Boolean.FALSE); + headerEquivalencia.setVisible(Boolean.FALSE); + } - public void setTxtNome(Textbox txtNome) { - this.txtNome = txtNome; - } + txtNome.focus(); + } - public Textbox getTxtEquivalencia() { - return txtEquivalencia; - } + @SuppressWarnings({ "rawtypes", "unchecked" }) + private void verFormaPago(FormaPago f) { + if (f == null) { + return; + } - public void setTxtEquivalencia(Textbox txtEquivalencia) { - this.txtEquivalencia = txtEquivalencia; - } + Map args = new HashMap(); + args.put("formaPago", f); + args.put("busquedaFormaPagoController", this); + args.put("formaPagoList", formaPagoList); - public Listheader getHeaderEquivalencia() { - return headerEquivalencia; - } + openWindow("/gui/catalogos/editarFormaPago.zul", + Labels.getLabel("editarFormaPagoController.window.title"), args, MODAL); + } - public void setHeaderEquivalencia(Listheader headerEquivalencia) { - this.headerEquivalencia = headerEquivalencia; - } + public void refreshLista() { + HibernateSearchObject formaPagoBusqueda = + new HibernateSearchObject(FormaPago.class, + pagingFormaPago.getPageSize()); - public Row getRowEquivalencia() { - return rowEquivalencia; - } + formaPagoBusqueda.addFilterLike("descpago", "%" + txtNome.getText().trim().concat("%")); - public void setRowEquivalencia(Row rowEquivalencia) { - this.rowEquivalencia = rowEquivalencia; - } + if (!txtEquivalencia.getText().isEmpty()) { + formaPagoBusqueda.addFilterLike("equivalenciaId", txtEquivalencia.getText().trim().concat("%")); + } - @Override - public void doAfterCompose(Component comp) throws Exception { - super.doAfterCompose(comp); + formaPagoBusqueda.addFilterNotEqual("formapagoId", -1); + formaPagoBusqueda.addSortAsc("descpago"); + formaPagoBusqueda.addFilterEqual("activo", Boolean.TRUE); - formaPagoList.setItemRenderer(new RenderFormaPago()); - formaPagoList.addEventListener("onDoubleClick", new EventListener() { + plwFormaPago.init(formaPagoBusqueda, formaPagoList, pagingFormaPago); - @Override - public void onEvent(Event event) throws Exception { - FormaPago c = (FormaPago) formaPagoList.getSelected(); - verFormaPago(c); - } - }); + if (formaPagoList.getData().length == 0) { + try { + Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), + Labels.getLabel("busquedaFormaPagoController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException ex) { + } + } + } - refreshLista(); + public void onClick$btnPesquisa(Event ev) { + refreshLista(); + } - if (!ApplicationProperties.getInstance().mostrarEquivalencia()) { - rowEquivalencia.setVisible(Boolean.FALSE); - headerEquivalencia.setVisible(Boolean.FALSE); - } + public void onClick$btnRefresh(Event ev) { + refreshLista(); + } - txtNome.focus(); - } - - private void verFormaPago(FormaPago f) { - if (f == null) { - return; - } - - Map args = new HashMap(); - args.put("formaPago", f); - args.put("busquedaFormaPagoController", this); - args.put("formaPagoList", formaPagoList); - - openWindow("/gui/catalogos/editarFormaPago.zul", - Labels.getLabel("editarFormaPagoController.window.title"), args, MODAL); - } - - public void refreshLista() { - HibernateSearchObject formaPagoBusqueda = - new HibernateSearchObject(FormaPago.class, - pagingFormaPago.getPageSize()); - - formaPagoBusqueda.addFilterLike("descpago", "%" + txtNome.getText().trim().concat("%")); - - if (!txtEquivalencia.getText().isEmpty()) { - formaPagoBusqueda.addFilterLike("equivalenciaId", txtEquivalencia.getText().trim().concat("%")); - } - - formaPagoBusqueda.addFilterNotEqual("formapagoId", -1); - formaPagoBusqueda.addSortAsc("descpago"); - formaPagoBusqueda.addFilterEqual("activo", Boolean.TRUE); - - plwFormaPago.init(formaPagoBusqueda, formaPagoList, pagingFormaPago); - - if (formaPagoList.getData().length == 0) { - try { - Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), - Labels.getLabel("busquedaFormaPagoController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - } catch (InterruptedException ex) { - } - } - } - - public void onClick$btnPesquisa(Event ev) { - refreshLista(); - } - - public void onClick$btnRefresh(Event ev) { - refreshLista(); - } - - public void onClick$btnNovo(Event ev) { - verFormaPago(new FormaPago()); - } + public void onClick$btnNovo(Event ev) { + verFormaPago(new FormaPago()); + } } diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/BusquedaTipoVentaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/BusquedaTipoVentaController.java index bf66d8901..d5cd391c3 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/BusquedaTipoVentaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/BusquedaTipoVentaController.java @@ -24,113 +24,83 @@ import org.zkoss.zul.Paging; import org.zkoss.zul.Textbox; /** - * + * * @author Rafius */ @Controller("busquedaTipoVentaController") @Scope("prototype") public class BusquedaTipoVentaController extends MyGenericForwardComposer { - @Autowired - private transient PagedListWrapper plwTipoVenta; - private MyListbox tipoVentaList; - private Paging pagingTipoVenta; - private Textbox txtNombre; + private static final long serialVersionUID = 1L; + @Autowired + private transient PagedListWrapper plwTipoVenta; + private MyListbox tipoVentaList; + private Paging pagingTipoVenta; + private Textbox txtNombre; - public Textbox getTxtNombre() { - return txtNombre; - } + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); - public void setTxtNombre(Textbox txtNombre) { - this.txtNombre = txtNombre; - } + tipoVentaList.setItemRenderer(new RenderTipoVenta()); + tipoVentaList.addEventListener("onDoubleClick", new EventListener() { - public Paging getPagingTipoVenta() { - return pagingTipoVenta; - } + @Override + public void onEvent(Event event) throws Exception { + TipoVenta ts = (TipoVenta) tipoVentaList.getSelected(); + verPeriodo(ts); + } + }); - public void setPagingTipoVenta(Paging pagingTipoVenta) { - this.pagingTipoVenta = pagingTipoVenta; - } + refreshLista(); - public MyListbox getTipoVentaList() { - return tipoVentaList; - } + txtNombre.focus(); + } - public void setTipoVentaList(MyListbox tipoVentaList) { - this.tipoVentaList = tipoVentaList; - } + @SuppressWarnings({ "rawtypes", "unchecked" }) + private void verPeriodo(TipoVenta ts) { + if (ts == null) { + return; + } - public PagedListWrapper getPlwTipoVenta() { - return plwTipoVenta; - } + Map args = new HashMap(); + args.put("tipoVenta", ts); + args.put("tipoVentaList", tipoVentaList); - public void setPlwTipoVenta(PagedListWrapper plwTipoVenta) { - this.plwTipoVenta = plwTipoVenta; - } + openWindow("/gui/catalogos/editarTipoVenta.zul", + Labels.getLabel("editarTipoVentaController.window.title"), args, MODAL); + } - public void onClick$btnPesquisa(Event ev) throws InterruptedException { - refreshLista(); - } + private void refreshLista() { + HibernateSearchObject claseVentaBusqueda = + new HibernateSearchObject(TipoVenta.class, pagingTipoVenta.getPageSize()); - public void onClick$btnRefresh(Event ev) { - refreshLista(); - } + claseVentaBusqueda.addFilterLike("desctipoventa", "%" + txtNombre.getText().trim().concat("%")); + claseVentaBusqueda.addFilterEqual("activo", Boolean.TRUE); + claseVentaBusqueda.addSortAsc("desctipoventa"); + claseVentaBusqueda.addFilterNotEqual("tipoventaId", -1); - public void onClick$btnNovo(Event ev) { - verPeriodo(new TipoVenta()); - } + plwTipoVenta.init(claseVentaBusqueda, tipoVentaList, pagingTipoVenta); - @Override - public void doAfterCompose(Component comp) throws Exception { - super.doAfterCompose(comp); + if (tipoVentaList.getData().length == 0) { + try { + Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), + Labels.getLabel("busquedaTipoVentaController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException ex) { + } + } + } - tipoVentaList.setItemRenderer(new RenderTipoVenta()); - tipoVentaList.addEventListener("onDoubleClick", new EventListener() { + public void onClick$btnPesquisa(Event ev) throws InterruptedException { + refreshLista(); + } - @Override - public void onEvent(Event event) throws Exception { - TipoVenta ts = (TipoVenta) tipoVentaList.getSelected(); - verPeriodo(ts); - } - }); + public void onClick$btnRefresh(Event ev) { + refreshLista(); + } - refreshLista(); - - txtNombre.focus(); - } - - private void verPeriodo(TipoVenta ts) { - if (ts == null) { - return; - } - - Map args = new HashMap(); - args.put("tipoVenta", ts); - args.put("tipoVentaList", tipoVentaList); - - openWindow("/gui/catalogos/editarTipoVenta.zul", - Labels.getLabel("editarTipoVentaController.window.title"), args, MODAL); - } - - private void refreshLista() { - HibernateSearchObject claseVentaBusqueda = - new HibernateSearchObject(TipoVenta.class, pagingTipoVenta.getPageSize()); - - claseVentaBusqueda.addFilterLike("desctipoventa", "%" + txtNombre.getText().trim().concat("%")); - claseVentaBusqueda.addFilterEqual("activo", Boolean.TRUE); - claseVentaBusqueda.addSortAsc("desctipoventa"); - claseVentaBusqueda.addFilterNotEqual("tipoventaId", -1); - - plwTipoVenta.init(claseVentaBusqueda, tipoVentaList, pagingTipoVenta); - - if (tipoVentaList.getData().length == 0) { - try { - Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), - Labels.getLabel("busquedaTipoVentaController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - } catch (InterruptedException ex) { - } - } - } + public void onClick$btnNovo(Event ev) { + verPeriodo(new TipoVenta()); + } } diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarEmpresaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarEmpresaController.java index 6ece88129..49ceb0030 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarEmpresaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarEmpresaController.java @@ -19,7 +19,6 @@ import org.zkoss.zk.ui.event.Event; import org.zkoss.zkplus.databind.BindingListModel; import org.zkoss.zkplus.databind.BindingListModelList; import org.zkoss.zul.Button; -import org.zkoss.zul.Checkbox; import org.zkoss.zul.Combobox; import org.zkoss.zul.Comboitem; import org.zkoss.zul.Messagebox; @@ -59,7 +58,6 @@ public class EditarEmpresaController extends MyGenericForwardComposer { private MyTextbox txtCNPJ; private Button btnApagar; private Combobox cmbIndTipo; - private Checkbox chkExterna; private Combobox cmbEstado; private Combobox cmbCidade; private Row rowEquivalencia; @@ -104,10 +102,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer { if (empresa.getEmpresaId() == null) { btnApagar.setVisible(Boolean.FALSE); - chkExterna.setChecked(true); } else { - chkExterna.setChecked(empresa.getIndExterna() == null ? false : empresa.getIndExterna()); - Ciudad cidade = empresa.getCidade(); if (cidade != null) { cmbCidade.setText(cidade.getNombciudad()); @@ -144,7 +139,6 @@ public class EditarEmpresaController extends MyGenericForwardComposer { empresa.setActivo(Boolean.TRUE); empresa.setFecmodif(Calendar.getInstance().getTime()); empresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - empresa.setIndExterna(chkExterna.isChecked()); if (empresa.getEmpresaId() == null) { List lsEmpresa = @@ -183,14 +177,6 @@ public class EditarEmpresaController extends MyGenericForwardComposer { } } - public void onClick$chkExterna(Event ev) { - if (!chkExterna.isChecked()) { - chkExterna.setChecked(false); - } else { - chkExterna.setChecked(true); - } - } - public void onClick$btnApagar(Event ev) { try { int resp = Messagebox.show( diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarFormaPagoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarFormaPagoController.java index 67c2fbe66..e57ffc12c 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarFormaPagoController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarFormaPagoController.java @@ -4,15 +4,9 @@ */ package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos; -import com.rjconsultores.ventaboletos.entidad.FormaPago; -import com.rjconsultores.ventaboletos.service.FormaPagoService; -import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; -import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; -import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; -import com.rjconsultores.ventaboletos.web.utilerias.MyListbox; -import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox; 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; @@ -23,191 +17,166 @@ import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.event.Event; import org.zkoss.zul.Button; -import org.zkoss.zul.Comboitem; import org.zkoss.zul.Radio; import org.zkoss.zul.Row; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.service.FormaPagoService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +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.MyTextbox; + /** - * + * * @author Administrador */ @Controller("editarFormaPagoController") @Scope("prototype") public class EditarFormaPagoController extends MyGenericForwardComposer { - @Autowired - private FormaPagoService formaPagoService; - private FormaPago formaPago; - private MyListbox formaPagoList; - private MyTextbox txtNome; - private Button btnApagar; - private BusquedaFormaPagoController busquedaFormaPagoController; - private Button btnSalvar; - private Radio rd1; - private Radio rd2; - private Radio rd3; - private Radio rd4; - private static Logger log = Logger.getLogger(EditarFormaPagoController.class); - private Row rowEquivalencia; + private static final long serialVersionUID = 1L; + @Autowired + private FormaPagoService formaPagoService; + private FormaPago formaPago; + private MyListbox formaPagoList; + private MyTextbox txtNome; + private Button btnApagar; + private BusquedaFormaPagoController busquedaFormaPagoController; + private Button btnSalvar; + private Radio rd1; + private Radio rd2; + private Radio rd3; + private Radio rd4; + private static Logger log = Logger.getLogger(EditarFormaPagoController.class); + private Row rowEquivalencia; - public FormaPago getFormaPago() { - return formaPago; - } + public FormaPago getFormaPago() { + return formaPago; + } - public void setFormaPago(FormaPago formaPago) { - this.formaPago = formaPago; - } + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } - public MyTextbox getTxtNome() { - return txtNome; - } + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); + busquedaFormaPagoController = (BusquedaFormaPagoController) Executions.getCurrent().getArg().get("busquedaFormaPagoController"); + formaPago = (FormaPago) Executions.getCurrent().getArg().get("formaPago"); + formaPagoList = (MyListbox) Executions.getCurrent().getArg().get("formaPagoList"); - public void setTxtNome(MyTextbox txtNome) { - this.txtNome = txtNome; - } + if (formaPago.getFormapagoId() == null) { + btnApagar.setVisible(Boolean.FALSE); + } else { - public Button getBtnApagar() { - return btnApagar; - } + if (formaPago.getIndoperacion() == null) { + rd4.setChecked(true); + } else if (formaPago.getIndoperacion() == 1) { + rd1.setChecked(true); + } else if (formaPago.getIndoperacion() == 2) { + rd2.setChecked(true); + } else if (formaPago.getIndoperacion() == 3) { + rd3.setChecked(true); + } - public void setBtnApagar(Button btnApagar) { - this.btnApagar = btnApagar; - } + if (formaPago.getFormapagoId() <= 11 || (formaPago.getFormapagoId() >= 96 && formaPago.getFormapagoId() <= 99)) { + btnApagar.setVisible(Boolean.FALSE); + btnSalvar.setVisible(Boolean.FALSE); + txtNome.setDisabled(Boolean.TRUE); - public Button getBtnSalvar() { - return btnSalvar; - } + Messagebox.show( + Labels.getLabel("MSG.noEditabled"), + Labels.getLabel("editarFormaPagoController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } + } - public void setBtnSalvar(Button btnSalvar) { - this.btnSalvar = btnSalvar; - } + if (!ApplicationProperties.getInstance().mostrarEquivalencia()) { + rowEquivalencia.setVisible(Boolean.FALSE); + } - public Row getRowEquivalencia() { - return rowEquivalencia; - } + txtNome.focus(); + } - public void setRowEquivalencia(Row rowEquivalencia) { - this.rowEquivalencia = rowEquivalencia; - } + public void onClick$btnSalvar(Event ev) throws InterruptedException { + txtNome.getText(); - @Override - public void doAfterCompose(Component comp) throws Exception { - super.doAfterCompose(comp); - busquedaFormaPagoController = (BusquedaFormaPagoController) Executions.getCurrent().getArg().get("busquedaFormaPagoController"); - formaPago = (FormaPago) Executions.getCurrent().getArg().get("formaPago"); - formaPagoList = (MyListbox) Executions.getCurrent().getArg().get("formaPagoList"); + try { + formaPago.setActivo(Boolean.TRUE); + formaPago.setFecmodif(Calendar.getInstance().getTime()); + formaPago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - if (formaPago.getFormapagoId() == null) { - btnApagar.setVisible(Boolean.FALSE); - } else { + if (rd4.isChecked()) { + formaPago.setIndoperacion(null); + } else if (rd1.isChecked()) { + formaPago.setIndoperacion(new Short("1")); + } else if (rd2.isChecked()) { + formaPago.setIndoperacion(new Short("2")); + } else if (rd3.isChecked()) { + formaPago.setIndoperacion(new Short("3")); + } - if (formaPago.getIndoperacion() == null) { - rd4.setChecked(true); - } else if (formaPago.getIndoperacion() == 1) { - rd1.setChecked(true); - } else if (formaPago.getIndoperacion() == 2) { - rd2.setChecked(true); - } else if (formaPago.getIndoperacion() == 3) { - rd3.setChecked(true); - } + if (formaPago.getFormapagoId() == null) { + List lsFP = + formaPagoService.buscarPorDescricao(formaPago.getDescpago()); + if (lsFP.isEmpty()) { + formaPagoService.suscribir(formaPago); + formaPagoList.addItem(formaPago); - if (formaPago.getFormapagoId() <= 11 || (formaPago.getFormapagoId() >= 96 && formaPago.getFormapagoId() <= 99)) { - btnApagar.setVisible(Boolean.FALSE); - btnSalvar.setVisible(Boolean.FALSE); - txtNome.setDisabled(Boolean.TRUE); + Messagebox.show( + Labels.getLabel("editarFormaPagoController.MSG.suscribirOK"), + Labels.getLabel("editarFormaPagoController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } else { + Messagebox.show( + Labels.getLabel("MSG.Registro.Existe"), + Labels.getLabel("editarFormaPagoController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); + } + } else { + formaPagoService.actualizacion(formaPago); + formaPagoList.updateItem(formaPago); - Messagebox.show( - Labels.getLabel("MSG.noEditabled"), - Labels.getLabel("editarFormaPagoController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - } - } + Messagebox.show( + Labels.getLabel("editarFormaPagoController.MSG.suscribirOK"), + Labels.getLabel("editarFormaPagoController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } + busquedaFormaPagoController.refreshLista(); + closeWindow(); + } catch (Exception ex) { + log.error("editarFormaPagoController: " + ex); + Messagebox.show( + Labels.getLabel("MSG.Error"), + Labels.getLabel("editarFormaPagoController.window.title"), + Messagebox.OK, Messagebox.ERROR); + } + } - if (!ApplicationProperties.getInstance().mostrarEquivalencia()) { - rowEquivalencia.setVisible(Boolean.FALSE); - } + public void onClick$btnApagar(Event ev) { + try { + int resp = Messagebox.show( + Labels.getLabel("editarFormaPagoController.MSG.borrarPergunta"), + Labels.getLabel("editarFormaPagoController.window.title"), + Messagebox.YES | Messagebox.NO, Messagebox.QUESTION); - txtNome.focus(); - } + if (resp == Messagebox.YES) { + formaPagoService.borrar(formaPago); - public void onClick$btnSalvar(Event ev) throws InterruptedException { - txtNome.getText(); + Messagebox.show( + Labels.getLabel("editarFormaPagoController.MSG.borrarOK"), + Labels.getLabel("editarFormaPagoController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); - try { - formaPago.setActivo(Boolean.TRUE); - formaPago.setFecmodif(Calendar.getInstance().getTime()); - formaPago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + formaPagoList.removeItem(formaPago); - if (rd4.isChecked()) { - formaPago.setIndoperacion(null); - } else if (rd1.isChecked()) { - formaPago.setIndoperacion(new Short("1")); - } else if (rd2.isChecked()) { - formaPago.setIndoperacion(new Short("2")); - } else if (rd3.isChecked()) { - formaPago.setIndoperacion(new Short("3")); - } - - if (formaPago.getFormapagoId() == null) { - List lsFP = - formaPagoService.buscarPorDescricao(formaPago.getDescpago()); - - if (lsFP.isEmpty()) { - formaPagoService.suscribir(formaPago); - formaPagoList.addItem(formaPago); - - Messagebox.show( - Labels.getLabel("editarFormaPagoController.MSG.suscribirOK"), - Labels.getLabel("editarFormaPagoController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - } else { - Messagebox.show( - Labels.getLabel("MSG.Registro.Existe"), - Labels.getLabel("editarFormaPagoController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); - } - } else { - formaPagoService.actualizacion(formaPago); - formaPagoList.updateItem(formaPago); - - Messagebox.show( - Labels.getLabel("editarFormaPagoController.MSG.suscribirOK"), - Labels.getLabel("editarFormaPagoController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - } - busquedaFormaPagoController.refreshLista(); - closeWindow(); - } catch (Exception ex) { - log.error("editarFormaPagoController: " + ex); - Messagebox.show( - Labels.getLabel("MSG.Error"), - Labels.getLabel("editarFormaPagoController.window.title"), - Messagebox.OK, Messagebox.ERROR); - } - } - - public void onClick$btnApagar(Event ev) { - try { - int resp = Messagebox.show( - Labels.getLabel("editarFormaPagoController.MSG.borrarPergunta"), - Labels.getLabel("editarFormaPagoController.window.title"), - Messagebox.YES | Messagebox.NO, Messagebox.QUESTION); - - if (resp == Messagebox.YES) { - formaPagoService.borrar(formaPago); - - Messagebox.show( - Labels.getLabel("editarFormaPagoController.MSG.borrarOK"), - Labels.getLabel("editarFormaPagoController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - - formaPagoList.removeItem(formaPago); - - closeWindow(); - } - } catch (Exception ex) { - log.error(ex); - } - } + closeWindow(); + } + } catch (Exception ex) { + log.error(ex); + } + } } diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarTipoVentaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarTipoVentaController.java index 180e7246e..c8f7e343a 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarTipoVentaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarTipoVentaController.java @@ -4,186 +4,150 @@ */ package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos; +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.zk.ui.Component; +import org.zkoss.zk.ui.Executions; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zul.Messagebox; + import com.rjconsultores.ventaboletos.entidad.TipoVenta; import com.rjconsultores.ventaboletos.service.TipoVentaService; 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.MyTextbox; -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Controller; -import java.util.Calendar; -import java.util.List; -import org.zkoss.util.resource.Labels; -import org.zkoss.zk.ui.Component; -import org.zkoss.zk.ui.Executions; -import org.zkoss.zk.ui.event.Event; -import org.zkoss.zul.Button; -import org.zkoss.zul.Messagebox; -import org.zkoss.zul.Textbox; /** - * + * * @author Rafius */ @Controller("editarTipoVentaController") @Scope("prototype") public class EditarTipoVentaController extends MyGenericForwardComposer { - @Autowired - private TipoVentaService tipoVentaService; - private TipoVenta tipoVenta; - private MyListbox tipoVentaList; - private static Logger log = Logger.getLogger(EditarTipoVentaController.class); - private MyTextbox txtNome; - private Button btnApagar; - private Button btnSalvar; + private static final long serialVersionUID = 1L; + @Autowired + private TipoVentaService tipoVentaService; + private TipoVenta tipoVenta; + private MyListbox tipoVentaList; + private static Logger log = Logger.getLogger(EditarTipoVentaController.class); + private MyTextbox txtNome; - public Button getBtnApagar() { - return btnApagar; - } + public TipoVenta getTipoVenta() { + return tipoVenta; + } - public void setBtnApagar(Button btnApagar) { - this.btnApagar = btnApagar; - } + public void setTipoVenta(TipoVenta tipoVenta) { + this.tipoVenta = tipoVenta; + } - public Textbox getTxtNome() { - return txtNome; - } + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); - public void setTxtNome(MyTextbox txtNome) { - this.txtNome = txtNome; - } + TipoVenta tp = (TipoVenta) Executions.getCurrent().getArg().get("tipoVenta"); + tipoVenta = (tp.getTipoventaId() == null) ? tp : tipoVentaService.obtenerID(tp.getTipoventaId()); + tipoVentaList = (MyListbox) Executions.getCurrent().getArg().get("tipoVentaList"); - @Override - public void doAfterCompose(Component comp) throws Exception { - super.doAfterCompose(comp); + if (tipoVenta.getDesctipoventa() != null) { + txtNome.setValue(tipoVenta.getDesctipoventa()); + } - TipoVenta tp = (TipoVenta) Executions.getCurrent().getArg().get("tipoVenta"); - tipoVenta = (tp.getTipoventaId() == null) ? tp : tipoVentaService.obtenerID(tp.getTipoventaId()); - tipoVentaList = (MyListbox) Executions.getCurrent().getArg().get("tipoVentaList"); + if (tipoVenta.getTipoventaId() != null) { + if (tipoVenta.getTipoventaId() <= 12) { + txtNome.setDisabled(Boolean.TRUE); - if (tipoVenta.getDesctipoventa() != null) { - txtNome.setValue(tipoVenta.getDesctipoventa()); - } - if (tipoVenta.getTipoventaId() == null) { - btnApagar.setVisible(Boolean.FALSE); - } else { - if (tipoVenta.getTipoventaId() <= 12) { - btnApagar.setVisible(Boolean.FALSE); - btnSalvar.setVisible(Boolean.FALSE); - txtNome.setDisabled(Boolean.TRUE); + Messagebox.show( + Labels.getLabel("MSG.noEditabled"), + Labels.getLabel("editarTipoVentaController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } + } - Messagebox.show( - Labels.getLabel("MSG.noEditabled"), - Labels.getLabel("editarTipoVentaController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - } - } + txtNome.focus(); + } - txtNome.focus(); - } + public void onClick$btnSalvar(Event ev) throws InterruptedException { + txtNome.getValue(); + try { + tipoVenta.setDesctipoventa(txtNome.getValue()); + tipoVenta.setActivo(Boolean.TRUE); + tipoVenta.setFecmodif(Calendar.getInstance().getTime()); + tipoVenta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - public void onClick$btnSalvar(Event ev) throws InterruptedException { - txtNome.getValue(); - try { - tipoVenta.setDesctipoventa(txtNome.getValue()); - tipoVenta.setActivo(Boolean.TRUE); - tipoVenta.setFecmodif(Calendar.getInstance().getTime()); - tipoVenta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + List lsTipoVenta = tipoVentaService.buscar(tipoVenta.getDesctipoventa()); - List lsTipoVenta = tipoVentaService.buscar(tipoVenta.getDesctipoventa()); + boolean podeSalvar = false; + if (lsTipoVenta.isEmpty()) { + podeSalvar = true; + } else { + for (TipoVenta m : lsTipoVenta) { + if (m.getTipoventaId().equals(tipoVenta.getTipoventaId())) { + podeSalvar = true; + } + } + } - boolean podeSalvar = false; - if (lsTipoVenta.isEmpty()) { - podeSalvar = true; - } else { - for (TipoVenta m : lsTipoVenta) { - if (m.getTipoventaId().equals(tipoVenta.getTipoventaId())) { - podeSalvar = true; - } - } - } + if (!podeSalvar) { + Messagebox.show( + Labels.getLabel("MSG.Registro.Existe"), + Labels.getLabel("editarTipoVentaController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); + } else { - if (!podeSalvar) { - Messagebox.show( - Labels.getLabel("MSG.Registro.Existe"), - Labels.getLabel("editarTipoVentaController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); - } else { + if (tipoVenta.getTipoventaId() == null) { + tipoVentaService.suscribir(tipoVenta); + tipoVentaList.addItem(tipoVenta); + } else { + tipoVentaService.actualizacion(tipoVenta); + tipoVentaList.updateItem(tipoVenta); + } - if (tipoVenta.getTipoventaId() == null) { - tipoVentaService.suscribir(tipoVenta); - tipoVentaList.addItem(tipoVenta); - } else { - tipoVentaService.actualizacion(tipoVenta); - tipoVentaList.updateItem(tipoVenta); - } + Messagebox.show( + Labels.getLabel("editarTipoVentaController.MSG.suscribirOK"), + Labels.getLabel("editarTipoVentaController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); - Messagebox.show( - Labels.getLabel("editarTipoVentaController.MSG.suscribirOK"), - Labels.getLabel("editarTipoVentaController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); + closeWindow(); + } + } catch (Exception ex) { + log.error("Suscribir TipoVenta: " + ex); + Messagebox.show( + Labels.getLabel("MSG.Error"), + Labels.getLabel("editarTipoVentaController.window.title"), + Messagebox.OK, Messagebox.ERROR); + } + } - closeWindow(); - } - } catch (Exception ex) { - log.error("Suscribir TipoVenta: " + ex); - Messagebox.show( - Labels.getLabel("MSG.Error"), - Labels.getLabel("editarTipoVentaController.window.title"), - Messagebox.OK, Messagebox.ERROR); - } - } + public void onClick$btnApagar(Event ev) { + try { + int resp = Messagebox.show( + Labels.getLabel("editarTipoVentaController.MSG.borrarPergunta"), + Labels.getLabel("editarTipoVentaController.window.title"), + Messagebox.YES | Messagebox.NO, Messagebox.QUESTION); - public void onClick$btnApagar(Event ev) { - try { - int resp = Messagebox.show( - Labels.getLabel("editarTipoVentaController.MSG.borrarPergunta"), - Labels.getLabel("editarTipoVentaController.window.title"), - Messagebox.YES | Messagebox.NO, Messagebox.QUESTION); + if (resp == Messagebox.YES) { - if (resp == Messagebox.YES) { + tipoVentaService.borrar(tipoVenta); - tipoVentaService.borrar(tipoVenta); + Messagebox.show( + Labels.getLabel("editarTipoVentaController.MSG.borrarOK"), + Labels.getLabel("editarTipoVentaController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); - Messagebox.show( - Labels.getLabel("editarTipoVentaController.MSG.borrarOK"), - Labels.getLabel("editarTipoVentaController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); + tipoVentaList.removeItem(tipoVenta); - tipoVentaList.removeItem(tipoVenta); - - closeWindow(); - } - } catch (Exception ex) { - log.error(ex); - } - } - - public TipoVenta getTipoVenta() { - return tipoVenta; - } - - public void setTipoVenta(TipoVenta tipoVenta) { - this.tipoVenta = tipoVenta; - } - - public MyListbox getTipoVentaList() { - return tipoVentaList; - } - - public void setTipoVentaList(MyListbox tipoVentaList) { - this.tipoVentaList = tipoVentaList; - } - - public TipoVentaService getTipoVentaService() { - return tipoVentaService; - } - - public void setTipoVentaService(TipoVentaService tipoVentaService) { - this.tipoVentaService = tipoVentaService; - } + closeWindow(); + } + } catch (Exception ex) { + log.error(ex); + } + } } diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/BusquedaConfiguracionFormaPagoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/BusquedaConfiguracionFormaPagoController.java index 0068d0550..7887d2f4d 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/BusquedaConfiguracionFormaPagoController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/BusquedaConfiguracionFormaPagoController.java @@ -24,107 +24,83 @@ import org.zkoss.zul.Paging; import org.zkoss.zul.Textbox; /** - * + * * @author Administrador */ @Controller("busquedaConfiguracionFormaPagoController") @Scope("prototype") public class BusquedaConfiguracionFormaPagoController extends MyGenericForwardComposer { - @Autowired - private transient PagedListWrapper plwConfigFormaPago; - private MyListbox configFormaPagoList; - private Paging pagingConfigFormaPago; - private Textbox txtNome; + private static final long serialVersionUID = 1L; + @Autowired + private transient PagedListWrapper plwConfigFormaPago; + private MyListbox configFormaPagoList; + private Paging pagingConfigFormaPago; + private Textbox txtNome; - public MyListbox getConfigFormaPagoList() { - return configFormaPagoList; - } + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); - public void setConfigFormaPagoList(MyListbox configFormaPagoList) { - this.configFormaPagoList = configFormaPagoList; - } + configFormaPagoList.setItemRenderer(new RenderConfiguracionFormasPago()); + configFormaPagoList.addEventListener("onDoubleClick", new EventListener() { - public Paging getPagingConfigFormaPago() { - return pagingConfigFormaPago; - } + @Override + public void onEvent(Event event) throws Exception { + FormaPagoDet fpd = (FormaPagoDet) configFormaPagoList.getSelected(); + verConfigFormaPago(fpd); + } + }); - public void setPagingConfigFormaPago(Paging pagingConfigFormaPago) { - this.pagingConfigFormaPago = pagingConfigFormaPago; - } + refreshLista(); - public Textbox getTxtNome() { - return txtNome; - } + txtNome.focus(); + } - public void setTxtNome(Textbox txtNome) { - this.txtNome = txtNome; - } + @SuppressWarnings({ "rawtypes", "unchecked" }) + private void verConfigFormaPago(FormaPagoDet fpd) { + if (fpd == null) { + return; + } - @Override - public void doAfterCompose(Component comp) throws Exception { - super.doAfterCompose(comp); + Map args = new HashMap(); + args.put("formaPagoDet", fpd); + args.put("configFormaPagoList", configFormaPagoList); - configFormaPagoList.setItemRenderer(new RenderConfiguracionFormasPago()); - configFormaPagoList.addEventListener("onDoubleClick", new EventListener() { + openWindow("/gui/configuraciones_comerciales/editarConfiguracionFormaPago.zul", + Labels.getLabel("editarConfiguracionFormaPagoController.window.title"), args, MODAL); + } - @Override - public void onEvent(Event event) throws Exception { - FormaPagoDet fpd = (FormaPagoDet) configFormaPagoList.getSelected(); - verConfigFormaPago(fpd); - } - }); + private void refreshLista() { + HibernateSearchObject configFormaPagoBusqueda = + new HibernateSearchObject(FormaPagoDet.class, pagingConfigFormaPago.getPageSize()); - refreshLista(); + configFormaPagoBusqueda.addFilterLike("formaPago.descpago", "%" + txtNome.getText().trim().concat("%")); - txtNome.focus(); - } + configFormaPagoBusqueda.addSortAsc("formaPago.descpago"); + configFormaPagoBusqueda.addFilterEqual("activo", Boolean.TRUE); - private void verConfigFormaPago(FormaPagoDet fpd) { - if (fpd == null) { - return; - } + plwConfigFormaPago.init(configFormaPagoBusqueda, configFormaPagoList, pagingConfigFormaPago); - Map args = new HashMap(); - args.put("formaPagoDet", fpd); - args.put("configFormaPagoList", configFormaPagoList); + if (configFormaPagoList.getData().length == 0) { + try { + Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), + Labels.getLabel("busquedaConfiguracionFormaPagoController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException ex) { + } + } + } - openWindow("/gui/configuraciones_comerciales/editarConfiguracionFormaPago.zul", - Labels.getLabel("editarConfiguracionFormaPagoController.window.title"), args, MODAL); - } + public void onClick$btnPesquisa(Event ev) { + refreshLista(); + } - private void refreshLista() { - HibernateSearchObject configFormaPagoBusqueda = - new HibernateSearchObject(FormaPagoDet.class, - pagingConfigFormaPago.getPageSize()); + public void onClick$btnRefresh(Event ev) { + refreshLista(); + } - configFormaPagoBusqueda.addFilterLike("formaPago.descpago", - "%" + txtNome.getText().trim().concat("%")); - - configFormaPagoBusqueda.addSortAsc("formaPago.descpago"); - configFormaPagoBusqueda.addFilterEqual("activo", Boolean.TRUE); - - plwConfigFormaPago.init(configFormaPagoBusqueda, configFormaPagoList, pagingConfigFormaPago); - - if (configFormaPagoList.getData().length == 0) { - try { - Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), - Labels.getLabel("busquedaConfiguracionFormaPagoController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - } catch (InterruptedException ex) { - } - } - } - - public void onClick$btnPesquisa(Event ev) { - refreshLista(); - } - - public void onClick$btnRefresh(Event ev) { - refreshLista(); - } - - public void onClick$btnNovo(Event ev) { - verConfigFormaPago(new FormaPagoDet()); - } + public void onClick$btnNovo(Event ev) { + verConfigFormaPago(new FormaPagoDet()); + } } diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/BusquedaRestriccionFormaPagoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/BusquedaRestriccionFormaPagoController.java index e21e3d142..6e9f2c6ea 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/BusquedaRestriccionFormaPagoController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/BusquedaRestriccionFormaPagoController.java @@ -24,112 +24,90 @@ import org.zkoss.zul.Paging; import org.zkoss.zul.Textbox; /** - * + * * @author Administrador */ @Controller("busquedaRestriccionFormaPagoController") @Scope("prototype") public class BusquedaRestriccionFormaPagoController extends MyGenericForwardComposer { - @Autowired - private transient PagedListWrapper plwRestriccionFormaPago; - private MyListbox restriccionFormaPagoList; - private Paging pagingrestriccionFormaPago; - private Textbox txtNome; + private static final long serialVersionUID = 1L; + @Autowired + private transient PagedListWrapper plwRestriccionFormaPago; + private MyListbox restriccionFormaPagoList; + private Paging pagingrestriccionFormaPago; + private Textbox txtNome; - public Paging getPagingrestriccionFormaPago() { - return pagingrestriccionFormaPago; - } + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); - public void setPagingrestriccionFormaPago(Paging pagingrestriccionFormaPago) { - this.pagingrestriccionFormaPago = pagingrestriccionFormaPago; - } + restriccionFormaPagoList.setItemRenderer(new RenderRestriccionFormaPago()); + restriccionFormaPagoList.addEventListener("onDoubleClick", + new EventListener() { - public MyListbox getRestriccionFormaPagoList() { - return restriccionFormaPagoList; - } + @Override + public void onEvent(Event event) throws Exception { + ConfigRestriccionPago c = + (ConfigRestriccionPago) restriccionFormaPagoList.getSelected(); + verConfigRestriccionPago(c); + } + }); - public void setRestriccionFormaPagoList(MyListbox restriccionFormaPagoList) { - this.restriccionFormaPagoList = restriccionFormaPagoList; - } + refreshLista(); - public Textbox getTxtNome() { - return txtNome; - } + txtNome.focus(); + } - public void setTxtNome(Textbox txtNome) { - this.txtNome = txtNome; - } + @SuppressWarnings({ "rawtypes", "unchecked" }) + private void verConfigRestriccionPago(ConfigRestriccionPago c) { + if (c == null) { + return; + } - @Override - public void doAfterCompose(Component comp) throws Exception { - super.doAfterCompose(comp); + Map args = new HashMap(); + args.put("configRestriccionPago", c); + args.put("configRestriccionFormaPagoList", restriccionFormaPagoList); - restriccionFormaPagoList.setItemRenderer(new RenderRestriccionFormaPago()); - restriccionFormaPagoList.addEventListener("onDoubleClick", - new EventListener() { + openWindow("/gui/configuraciones_comerciales/editarRestriccionFormaPago.zul", + Labels.getLabel("editarRestriccionFormaPagoController.window.title"), + args, MODAL); + } - @Override - public void onEvent(Event event) throws Exception { - ConfigRestriccionPago c = - (ConfigRestriccionPago) restriccionFormaPagoList.getSelected(); - verConfigRestriccionPago(c); - } - }); + private void refreshLista() { + HibernateSearchObject configRestriccionPagoBusqueda = + new HibernateSearchObject( + ConfigRestriccionPago.class, + pagingrestriccionFormaPago.getPageSize()); - refreshLista(); + configRestriccionPagoBusqueda.addFilterLike("formaPago.descpago", + "%" + txtNome.getText().trim().concat("%")); - txtNome.focus(); - } + configRestriccionPagoBusqueda.addSortAsc("formaPago.descpago"); + configRestriccionPagoBusqueda.addFilterEqual("activo", Boolean.TRUE); - private void verConfigRestriccionPago(ConfigRestriccionPago c) { - if (c == null) { - return; - } + plwRestriccionFormaPago.init(configRestriccionPagoBusqueda, + restriccionFormaPagoList, pagingrestriccionFormaPago); - Map args = new HashMap(); - args.put("configRestriccionPago", c); - args.put("configRestriccionFormaPagoList", restriccionFormaPagoList); + if (restriccionFormaPagoList.getData().length == 0) { + try { + Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), + Labels.getLabel("busquedaRestriccionFormaPagoController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException ex) { + } + } + } - openWindow("/gui/configuraciones_comerciales/editarRestriccionFormaPago.zul", - Labels.getLabel("editarRestriccionFormaPagoController.window.title"), - args, MODAL); - } + public void onClick$btnPesquisa(Event ev) { + refreshLista(); + } - private void refreshLista() { - HibernateSearchObject configRestriccionPagoBusqueda = - new HibernateSearchObject( - ConfigRestriccionPago.class, - pagingrestriccionFormaPago.getPageSize()); + public void onClick$btnRefresh(Event ev) { + refreshLista(); + } - configRestriccionPagoBusqueda.addFilterLike("formaPago.descpago", - "%" + txtNome.getText().trim().concat("%")); - - configRestriccionPagoBusqueda.addSortAsc("formaPago.descpago"); - configRestriccionPagoBusqueda.addFilterEqual("activo", Boolean.TRUE); - - plwRestriccionFormaPago.init(configRestriccionPagoBusqueda, - restriccionFormaPagoList, pagingrestriccionFormaPago); - - if (restriccionFormaPagoList.getData().length == 0) { - try { - Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), - Labels.getLabel("busquedaRestriccionFormaPagoController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - } catch (InterruptedException ex) { - } - } - } - - public void onClick$btnPesquisa(Event ev) { - refreshLista(); - } - - public void onClick$btnRefresh(Event ev) { - refreshLista(); - } - - public void onClick$btnNovo(Event ev) { - verConfigRestriccionPago(new ConfigRestriccionPago()); - } + public void onClick$btnNovo(Event ev) { + verConfigRestriccionPago(new ConfigRestriccionPago()); + } } diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/EditarRestriccionFormaPagoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/EditarRestriccionFormaPagoController.java index 2e045e96b..049cf3a20 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/EditarRestriccionFormaPagoController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/EditarRestriccionFormaPagoController.java @@ -4,6 +4,20 @@ */ package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales; +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.ConfigRestriccionPago; import com.rjconsultores.ventaboletos.entidad.FormaPago; import com.rjconsultores.ventaboletos.entidad.RestriccionPago; @@ -13,209 +27,159 @@ import com.rjconsultores.ventaboletos.service.RestriccionPagoService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyListbox; -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.Button; -import org.zkoss.zul.Combobox; /** - * + * * @author Administrador */ @Controller("editarRestriccionFormaPagoController") @Scope("prototype") public class EditarRestriccionFormaPagoController extends MyGenericForwardComposer { - @Autowired - private FormaPagoService formaPagoService; - @Autowired - private RestriccionPagoService restriccionPagoService; - @Autowired - private ConfigRestriccionPagoService configRestriccionPagoService; - private ConfigRestriccionPago configRestriccionPago; - private MyListbox restriccionFormaPagoList; - private List lsFormaPago; - private List lsRestriccionPago; - private Combobox cmbFormaPago; - private Combobox cmbRestriccionFormaPago; - private Button btnApagar; - private static Logger log = Logger.getLogger(EditarRestriccionFormaPagoController.class); + private static final long serialVersionUID = 1L; + @Autowired + private FormaPagoService formaPagoService; + @Autowired + private RestriccionPagoService restriccionPagoService; + @Autowired + private ConfigRestriccionPagoService configRestriccionPagoService; + private ConfigRestriccionPago configRestriccionPago; + private MyListbox restriccionFormaPagoList; + private List lsFormaPago; + private List lsRestriccionPago; + private Combobox cmbFormaPago; + private Combobox cmbRestriccionFormaPago; + private static Logger log = Logger.getLogger(EditarRestriccionFormaPagoController.class); - public Button getBtnApagar() { - return btnApagar; - } + public List getLsFormaPago() { + return lsFormaPago; + } - public void setBtnApagar(Button btnApagar) { - this.btnApagar = btnApagar; - } + public void setLsFormaPago(List lsFormaPago) { + this.lsFormaPago = lsFormaPago; + } - public FormaPagoService getFormaPagoService() { - return formaPagoService; - } + public List getLsRestriccionPago() { + return lsRestriccionPago; + } - public void setFormaPagoService(FormaPagoService formaPagoService) { - this.formaPagoService = formaPagoService; - } + public void setLsRestriccionPago(List lsRestriccionPago) { + this.lsRestriccionPago = lsRestriccionPago; + } - public List getLsFormaPago() { - return lsFormaPago; - } + public ConfigRestriccionPago getConfigRestriccionPago() { + return configRestriccionPago; + } - public void setLsFormaPago(List lsFormaPago) { - this.lsFormaPago = lsFormaPago; - } + public void setConfigRestriccionPago(ConfigRestriccionPago configRestriccionPago) { + this.configRestriccionPago = configRestriccionPago; + } - public List getLsRestriccionPago() { - return lsRestriccionPago; - } + @Override + public void doAfterCompose(Component comp) throws Exception { + lsFormaPago = formaPagoService.obtenerTodos(); + lsRestriccionPago = restriccionPagoService.obtenerTodos(); - public void setLsRestriccionPago(List lsRestriccionPago) { - this.lsRestriccionPago = lsRestriccionPago; - } + super.doAfterCompose(comp); - public ConfigRestriccionPago getConfigRestriccionPago() { - return configRestriccionPago; - } + configRestriccionPago = (ConfigRestriccionPago) Executions.getCurrent().getArg().get("configRestriccionPago"); + restriccionFormaPagoList = (MyListbox) Executions.getCurrent().getArg().get("configRestriccionFormaPagoList"); - public void setConfigRestriccionPago(ConfigRestriccionPago configRestriccionPago) { - this.configRestriccionPago = configRestriccionPago; - } + cmbFormaPago.focus(); + } - public Combobox getCmbFormaPago() { - return cmbFormaPago; - } + public void onClick$btnSalvar(Event ev) { + cmbFormaPago.getValue(); + cmbRestriccionFormaPago.getValue(); - public void setCmbFormaPago(Combobox cmbFormaPago) { - this.cmbFormaPago = cmbFormaPago; - } + try { + boolean puedoDarDeAlta = configRestriccionPagoService.puedoDarDeAlta(configRestriccionPago); - public Combobox getCmbRestriccionFormaPago() { - return cmbRestriccionFormaPago; - } + List lsConfig = configRestriccionPagoService.buscar(configRestriccionPago.getFormaPago(), configRestriccionPago.getRestriccion()); - public void setCmbRestriccionFormaPago(Combobox cmbRestriccionFormaPago) { - this.cmbRestriccionFormaPago = cmbRestriccionFormaPago; - } + boolean podeSalvar = false; + if (lsConfig.isEmpty()) { + podeSalvar = true; + } else { + for (ConfigRestriccionPago m : lsConfig) { + if (m.getConfigrestriccionId().equals(configRestriccionPago.getConfigrestriccionId())) { + podeSalvar = true; + } + } + } - @Override - public void doAfterCompose(Component comp) throws Exception { - lsFormaPago = formaPagoService.obtenerTodos(); - lsRestriccionPago = restriccionPagoService.obtenerTodos(); + if (!puedoDarDeAlta) { - super.doAfterCompose(comp); + Integer idRestricion = (configRestriccionPago.getRestriccion().getRestriccionId() == 1) + ? 4 + : (configRestriccionPago.getRestriccion().getRestriccionId() == 2) + ? 5 + : (configRestriccionPago.getRestriccion().getRestriccionId() == 3) + ? 6 : 0; + RestriccionPago restriContraria = restriccionPagoService.obtenerID(idRestricion.shortValue()); + String msg = ""; + if (restriContraria != null) { + msg = restriContraria.getDescrestriccion(); + } - configRestriccionPago = (ConfigRestriccionPago) Executions.getCurrent().getArg().get("configRestriccionPago"); - restriccionFormaPagoList = (MyListbox) Executions.getCurrent().getArg().get("configRestriccionFormaPagoList"); + Messagebox.show( + Labels.getLabel("editarRestriccionFormaPagoController.MSG.puedoDarDeAlta", new Object[] { msg }), + Labels.getLabel("editarRestriccionFormaPagoController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); + return; + } - if (configRestriccionPago.getConfigrestriccionId() == null) { - btnApagar.setVisible(Boolean.FALSE); - } + if (podeSalvar) { + configRestriccionPago.setActivo(Boolean.TRUE); + configRestriccionPago.setFecmodif(Calendar.getInstance().getTime()); + configRestriccionPago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - cmbFormaPago.focus(); - } + if (configRestriccionPago.getConfigrestriccionId() == null) { + configRestriccionPagoService.suscribir(configRestriccionPago); + restriccionFormaPagoList.addItem(configRestriccionPago); + } else { + configRestriccionPagoService.actualizacion(configRestriccionPago); + restriccionFormaPagoList.updateItem(configRestriccionPago); + } - public void onClick$btnSalvar(Event ev) { - cmbFormaPago.getValue(); - cmbRestriccionFormaPago.getValue(); + Messagebox.show( + Labels.getLabel("editarRestriccionFormaPagoController.MSG.suscribirOK"), + Labels.getLabel("editarRestriccionFormaPagoController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + closeWindow(); + } else { + Messagebox.show( + Labels.getLabel("MSG.Registro.Existe"), + Labels.getLabel("editarRestriccionFormaPagoController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); + } + } catch (Exception ex) { + log.error(ex); + } + } - try { - boolean puedoDarDeAlta = configRestriccionPagoService.puedoDarDeAlta(configRestriccionPago); + public void onClick$btnApagar(Event ev) { + try { + int resp = Messagebox.show( + Labels.getLabel("editarRestriccionFormaPagoController.MSG.borrarPergunta"), + Labels.getLabel("editarRestriccionFormaPagoController.window.title"), + Messagebox.YES | Messagebox.NO, Messagebox.QUESTION); - List lsConfig = configRestriccionPagoService.buscar(configRestriccionPago.getFormaPago(), configRestriccionPago.getRestriccion()); + if (resp == Messagebox.YES) { + configRestriccionPagoService.borrar(configRestriccionPago); - boolean podeSalvar = false; - if (lsConfig.isEmpty()) { - podeSalvar = true; - } else { - for (ConfigRestriccionPago m : lsConfig) { - if (m.getConfigrestriccionId().equals(configRestriccionPago.getConfigrestriccionId())) { - podeSalvar = true; - } - } - } + Messagebox.show( + Labels.getLabel("editarRestriccionFormaPagoController.MSG.borrarOK"), + Labels.getLabel("editarRestriccionFormaPagoController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); - if (!puedoDarDeAlta) { + restriccionFormaPagoList.removeItem(configRestriccionPago); - Integer idRestricion = (configRestriccionPago.getRestriccion().getRestriccionId() == 1) - ? 4 - : (configRestriccionPago.getRestriccion().getRestriccionId() == 2) - ? 5 - : (configRestriccionPago.getRestriccion().getRestriccionId() == 3) - ? 6 : 0; - RestriccionPago restriContraria = restriccionPagoService.obtenerID(idRestricion.shortValue()); - String msg = ""; - if (restriContraria != null) { - msg = restriContraria.getDescrestriccion(); - } - - Messagebox.show( - Labels.getLabel("editarRestriccionFormaPagoController.MSG.puedoDarDeAlta", new Object[]{msg}), - Labels.getLabel("editarRestriccionFormaPagoController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); - return; - } - - if (podeSalvar) { - configRestriccionPago.setActivo(Boolean.TRUE); - configRestriccionPago.setFecmodif(Calendar.getInstance().getTime()); - configRestriccionPago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - - if (configRestriccionPago.getConfigrestriccionId() == null) { - configRestriccionPagoService.suscribir(configRestriccionPago); - restriccionFormaPagoList.addItem(configRestriccionPago); - } else { - configRestriccionPagoService.actualizacion(configRestriccionPago); - restriccionFormaPagoList.updateItem(configRestriccionPago); - } - - Messagebox.show( - Labels.getLabel("editarRestriccionFormaPagoController.MSG.suscribirOK"), - Labels.getLabel("editarRestriccionFormaPagoController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - - closeWindow(); - } else { - Messagebox.show( - Labels.getLabel("MSG.Registro.Existe"), - Labels.getLabel("editarRestriccionFormaPagoController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); - } - } catch (Exception ex) { - log.error(ex); - } - } - - public void onClick$btnApagar(Event ev) { - try { - int resp = Messagebox.show( - Labels.getLabel("editarRestriccionFormaPagoController.MSG.borrarPergunta"), - Labels.getLabel("editarRestriccionFormaPagoController.window.title"), - Messagebox.YES | Messagebox.NO, Messagebox.QUESTION); - - if (resp == Messagebox.YES) { - configRestriccionPagoService.borrar(configRestriccionPago); - - Messagebox.show( - Labels.getLabel("editarRestriccionFormaPagoController.MSG.borrarOK"), - Labels.getLabel("editarRestriccionFormaPagoController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - - restriccionFormaPagoList.removeItem(configRestriccionPago); - - closeWindow(); - } - } catch (Exception ex) { - log.error(ex); - } - } + closeWindow(); + } + } catch (Exception ex) { + log.error(ex); + } + } } diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderEmpresa.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderEmpresa.java index a7fab5061..0709bfe1c 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderEmpresa.java +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderEmpresa.java @@ -26,17 +26,6 @@ public class RenderEmpresa implements ListitemRenderer { lc = new Listcell(empresa.getNombempresa()); lc.setParent(lstm); - Boolean externa = empresa.getIndExterna(); - if (externa != null) { - if (externa) { - lc = new Listcell(Labels.getLabel("MSG.SI")); - lc.setParent(lstm); - } else { - lc = new Listcell(Labels.getLabel("MSG.NO")); - lc.setParent(lstm); - } - } - Short tipo = empresa.getIndTipo(); Short short1 = 1; Short short2 = 2; @@ -59,7 +48,7 @@ public class RenderEmpresa implements ListitemRenderer { lc = new Listcell(empresa.getCnpj()); lc.setParent(lstm); - + if (!ApplicationProperties.getInstance().mostrarEquivalencia()) { lc = new Listcell(empresa.getEquivalenciaId()); lc.setParent(lstm); diff --git a/src/java/spring-config.xml b/src/java/spring-config.xml index f57ce015d..271d7b112 100644 --- a/src/java/spring-config.xml +++ b/src/java/spring-config.xml @@ -286,19 +286,19 @@ class="com.rjconsultores.ventaboletos.web.utilerias.spring.ApplicationContextProvider"> - - - - - - - - - - + + + + + + + + + + + diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 62a10f4ed..9e2140d47 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -7,7 +7,7 @@ # . . = XXX #Versao do VentaBoleto: -versao = ADM_20120817_1RC47 +versao = ADM_20120820_1RC48 # MSG Defaut: MSG.CONSTRAINT.PORCENTAGEM = Os valores devem estar entre 0 e 100 diff --git a/web/gui/catalogos/busquedaEmpresa.zul b/web/gui/catalogos/busquedaEmpresa.zul index 4d4d281d4..505962d15 100644 --- a/web/gui/catalogos/busquedaEmpresa.zul +++ b/web/gui/catalogos/busquedaEmpresa.zul @@ -5,89 +5,94 @@ - - -