diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/BusquedaSeguradoraEmpresaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/BusquedaSeguradoraEmpresaController.java new file mode 100644 index 000000000..ebecc053c --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/BusquedaSeguradoraEmpresaController.java @@ -0,0 +1,106 @@ +package com.rjconsultores.ventaboletos.web.gui.controladores.tarifas; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Controller; +import org.zkoss.util.resource.Labels; +import org.zkoss.zhtml.Messagebox; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zul.Paging; + +import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa; +import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; +import com.rjconsultores.ventaboletos.web.utilerias.MyListbox; +import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject; +import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper; +import com.rjconsultores.ventaboletos.web.utilerias.render.RenderSeguradoraEmpresa; + +@Controller("busquedaSeguradoraEmpresaController") +@Scope("prototype") +public class BusquedaSeguradoraEmpresaController extends MyGenericForwardComposer { + + private static final long serialVersionUID = 1L; + + @Autowired + private transient PagedListWrapper plwSeguradoraEmpresa; + + private MyListbox seguradoraEmpresaList; + private Paging pagingSeguradoraEmpresa; + + + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); + + seguradoraEmpresaList.setItemRenderer(new RenderSeguradoraEmpresa()); + seguradoraEmpresaList.addEventListener("onDoubleClick", new EventListener() { + + @Override + public void onEvent(Event event) throws Exception { + SeguradoraEmpresa c = (SeguradoraEmpresa) seguradoraEmpresaList.getSelected(); + verSeguradoraEmpresa(c); + } + }); + + refreshLista(); + } + + private void verSeguradoraEmpresa(SeguradoraEmpresa o) { + if (o == null) { + return; + } + + Map args = new HashMap(); + args.put("SeguradoraEmpresa", o); + // args.put("seguroKm", null); + args.put("seguradoraEmpresaList", seguradoraEmpresaList); + + openWindow("/gui/tarifas/editarSeguradoraEmpresa.zul", + Labels.getLabel("busquedaSeguradoraEmpresaController.window.title"), + args, MODAL); + } + + private void refreshLista() { + + HibernateSearchObject seguradoraEmpresaBusqueda = + new HibernateSearchObject(SeguradoraEmpresa.class, + pagingSeguradoraEmpresa.getPageSize()); + + + + seguradoraEmpresaBusqueda.addFilterEqual("activo", Boolean.TRUE); + + + seguradoraEmpresaBusqueda.addSortAsc("empresa"); + + + plwSeguradoraEmpresa.init(seguradoraEmpresaBusqueda, seguradoraEmpresaList, pagingSeguradoraEmpresa); + + if (seguradoraEmpresaList.getData().length == 0) { + try { + Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), + Labels.getLabel("busquedaSeguradoraEmpresaController.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) { + verSeguradoraEmpresa(new SeguradoraEmpresa()); + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/EditarSeguradoraEmpresaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/EditarSeguradoraEmpresaController.java new file mode 100644 index 000000000..473b14949 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/EditarSeguradoraEmpresaController.java @@ -0,0 +1,172 @@ +package com.rjconsultores.ventaboletos.web.gui.controladores.tarifas; + +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 com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa; +import com.rjconsultores.ventaboletos.entidad.SeguroKm; +import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.service.SeguradoraEmpresaService; +import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar; +import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; +import com.rjconsultores.ventaboletos.web.utilerias.MyListbox; +import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox; + +@Controller("editarSeguradoraEmpresaController") +@Scope("prototype") +public class EditarSeguradoraEmpresaController extends MyGenericForwardComposer { + + + private static final long serialVersionUID = 1L; + + @Autowired + private SeguradoraEmpresaService seguradoraEmpresaService; + @Autowired + private EmpresaService empresaService; + + private List lsEmpresa; + private MyListbox seguradoraEmpresaList; + private MyComboboxEstandar cmbEmpresa; + private Button btnApagar; + private Button btnSalvar; + private MyTextbox txtSerie; + private static Logger log = Logger.getLogger(EditarSeguradoraEmpresaController.class); + + private SeguradoraEmpresa seguradoraEmpresa; + + @Override + public void doAfterCompose(Component comp) throws Exception { + + lsEmpresa = empresaService.obtenerTodos(); + + super.doAfterCompose(comp); + + seguradoraEmpresa = (SeguradoraEmpresa) Executions.getCurrent().getArg().get("SeguradoraEmpresa"); + seguradoraEmpresaList = (MyListbox) Executions.getCurrent().getArg().get("seguradoraEmpresaList"); + } + + public void onClick$btnSalvar(Event ev) throws InterruptedException { + + try { + Empresa empresa = (Empresa)cmbEmpresa.getSelectedItem().getValue(); + if (seguradoraEmpresaService.existe(empresa, txtSerie.getValue())) { + Messagebox.show( + Labels.getLabel("editarSeguradoraEmpresaController.MSG.existe"), + Labels.getLabel("editarSeguradoraEmpresaController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + return; + } + + seguradoraEmpresa.setEmpresa(empresa); + seguradoraEmpresa.setSerie(txtSerie.getValue()); + + if (seguradoraEmpresa.getSeguradoraEmpresaId() == null){ + seguradoraEmpresaService.suscribir(seguradoraEmpresa); + } else { + seguradoraEmpresaService.actualizacion(seguradoraEmpresa); + } + + seguradoraEmpresaList.addItemNovo(seguradoraEmpresa); + + Messagebox.show( + Labels.getLabel("editarSeguradoraEmpresaController.MSG.suscribirOK"), + Labels.getLabel("editarSeguradoraEmpresaController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + + closeWindow(); + + + } catch (Exception ex) { + log.error(ex); + Messagebox.show( + Labels.getLabel("MSG.Error"), + Labels.getLabel("editarSeguradoraEmpresaController.window.title"), + Messagebox.OK, Messagebox.ERROR); + + } + } + + public void onClick$btnApagar(Event ev) { + try { + int resp = Messagebox.show( + Labels.getLabel("editarSeguradoraEmpresaController.MSG.borrarPergunta"), + Labels.getLabel("editarSeguradoraEmpresaController.window.title"), + Messagebox.YES | Messagebox.NO, Messagebox.QUESTION); + + if (resp == Messagebox.YES) { + seguradoraEmpresaService.borrar(seguradoraEmpresa); + + Messagebox.show( + Labels.getLabel("editarSeguradoraEmpresaController.MSG.borrarOK"), + Labels.getLabel("editarSeguradoraEmpresaController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + + seguradoraEmpresaList.removeItem(seguradoraEmpresa); + + closeWindow(); + } + } catch (Exception ex) { + log.error(ex); + } + } + + public List getLsEmpresa() { + return lsEmpresa; + } + + public void setLsEmpresa(List lsEmpresa) { + this.lsEmpresa = lsEmpresa; + } + + public MyComboboxEstandar getCmbEmpresa() { + return cmbEmpresa; + } + + public void setCmbEmpresa(MyComboboxEstandar cmbEmpresa) { + this.cmbEmpresa = cmbEmpresa; + } + + public Button getBtnApagar() { + return btnApagar; + } + + public void setBtnApagar(Button btnApagar) { + this.btnApagar = btnApagar; + } + + public Button getBtnSalvar() { + return btnSalvar; + } + + public void setBtnSalvar(Button btnSalvar) { + this.btnSalvar = btnSalvar; + } + + public MyTextbox getTxtSerie() { + return txtSerie; + } + + public void setTxtSerie(MyTextbox txtSerie) { + this.txtSerie = txtSerie; + } + + public SeguradoraEmpresa getSeguradoraEmpresa() { + return seguradoraEmpresa; + } + + public void setSeguradoraEmpresa(SeguradoraEmpresa seguradoraEmpresa) { + this.seguradoraEmpresa = seguradoraEmpresa; + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/tarifasOficial/ItemMenuSeguradoraEmpresa.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/tarifasOficial/ItemMenuSeguradoraEmpresa.java new file mode 100644 index 000000000..9dcc57915 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/tarifasOficial/ItemMenuSeguradoraEmpresa.java @@ -0,0 +1,25 @@ +package com.rjconsultores.ventaboletos.web.utilerias.menu.item.tarifasOficial; + +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria; +import com.rjconsultores.ventaboletos.web.utilerias.menu.DefaultItemMenuSistema; + +public class ItemMenuSeguradoraEmpresa extends DefaultItemMenuSistema { + + public ItemMenuSeguradoraEmpresa() { + super("busquedaSeguradoraEmpresaController.window.title"); + } + + @Override + public String getClaveMenu() { + return "COM.RJCONSULTORES.ADMINISTRACION.GUI.TARIFAS.MENU.SEGURADORAEMPRESA"; + } + + @Override + public void ejecutar() { + PantallaUtileria.openWindow("/gui/tarifas/busquedaSeguradoraEmpresa.zul", + Labels.getLabel("busquedaSeguradoraEmpresaController.window.title"), null, desktop); + + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderSeguradoraEmpresa.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderSeguradoraEmpresa.java new file mode 100644 index 000000000..6cee95846 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderSeguradoraEmpresa.java @@ -0,0 +1,23 @@ +package com.rjconsultores.ventaboletos.web.utilerias.render; + +import org.zkoss.zul.Listcell; +import org.zkoss.zul.Listitem; +import org.zkoss.zul.ListitemRenderer; + +import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa; + +public class RenderSeguradoraEmpresa implements ListitemRenderer { + + public void render(Listitem lstm, Object o) throws Exception { + SeguradoraEmpresa segEmp = (SeguradoraEmpresa) o; + + Listcell lc = new Listcell(segEmp.getEmpresa().getNombempresa()); + lc.setParent(lstm); + + lc = new Listcell(segEmp.getSerie()); + lc.setParent(lstm); + + lstm.setAttribute("data", segEmp); + } + +} diff --git a/src/java/spring-config.xml b/src/java/spring-config.xml index 59059c2e2..784382bec 100644 --- a/src/java/spring-config.xml +++ b/src/java/spring-config.xml @@ -264,6 +264,7 @@ com.rjconsultores.ventaboletos.entidad.RhPagoConductor com.rjconsultores.ventaboletos.entidad.Secretaria + com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa com.rjconsultores.ventaboletos.entidad.SeguroKm com.rjconsultores.ventaboletos.entidad.SegVKM com.rjconsultores.ventaboletos.entidad.SeguroTarifa diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index d0c1bafbc..1adde78eb 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -4236,6 +4236,31 @@ editarSeguroKmController.MSG.borrarPergunta=Deseas elminar seguro por KM? editarSeguroKmController.MSG.borrarOK=Seguro por KM se eliminó existosamente editarSeguroKmController.MSG.existe= Ya existe un registro con esse Km +# Búsqueda SeguradoraEmpresa +busquedaSeguradoraEmpresaController.window.title = Seguradora Empresa +busquedaSeguradoraEmpresaController.btnRefresh.tooltiptext = Actualizar +busquedaSeguradoraEmpresaController.btnNovo.tooltiptext = Incluir +busquedaSeguradoraEmpresaController.btnCerrar.tooltiptext = Cerrar +busquedaSeguradoraEmpresaController.DescSeguroKm.label = Descripción +busquedaSeguradoraEmpresaController.orgao = Instituición +busquedaSeguradoraEmpresaController.empresa.label=Empresa +busquedaSeguradoraEmpresaController.serie.label=Série + +# Editar SeguradoraEmpresa +editarSeguradoraEmpresaController.window.title = Seguradora Empresa +editarSeguradoraEmpresaController.btnApagar.tooltiptext = Eliminar +editarSeguradoraEmpresaController.btnSalvar.tooltiptext = Guardar +editarSeguradoraEmpresaController.btnFechar.tooltiptext = Cerrar + +editarSeguradoraEmpresaController.MSG.necessaitaInfromar.value = Necesitas informar una configuración de seguro +editarSeguradoraEmpresaController.MSG.suscribirOK = Seguradora Empresa registrada existosamente +editarSeguradoraEmpresaController.MSG.borrarPergunta=Deseas elminar seguradora empresa? +editarSeguradoraEmpresaController.MSG.borrarOK=Seguradora Empresa eliminó existosamente +editarSeguradoraEmpresaController.MSG.existe= Ya existe un registro con essa empresa e serie + +editarSeguradoraEmpresaController.empresa=Empresa +editarSeguradoraEmpresaController.serie=Serie + # Pesquisa SegVKM busquedaSegVKmController.window.title = Seguro VKM busquedaSegVKmController.btnRefresh.tooltiptext = Atualizar diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 5b5fc69fb..54354a46c 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -4283,6 +4283,30 @@ editarSeguroKmController.MSG.borrarPergunta=Deseja elminar Seguro por KM? editarSeguroKmController.MSG.borrarOK=Seguro por KM eliminado com sucesso. editarSeguroKmController.MSG.existe= Já existe um registro com esse Km. +# Búsqueda SeguradoraEmpresa +busquedaSeguradoraEmpresaController.window.title = Seguradora Empresa +busquedaSeguradoraEmpresaController.btnRefresh.tooltiptext = Actualizar +busquedaSeguradoraEmpresaController.btnNovo.tooltiptext = Incluir +busquedaSeguradoraEmpresaController.btnCerrar.tooltiptext = Cerrar +busquedaSeguradoraEmpresaController.DescSeguroKm.label = Descripción +busquedaSeguradoraEmpresaController.orgao = Instituición +busquedaSeguradoraEmpresaController.empresa.label=Empresa +busquedaSeguradoraEmpresaController.serie.label=Série + +# Editar SeguradoraEmpresa +editarSeguradoraEmpresaController.window.title = Seguradora Empresa +editarSeguradoraEmpresaController.btnApagar.tooltiptext = Eliminar +editarSeguradoraEmpresaController.btnSalvar.tooltiptext = Guardar +editarSeguradoraEmpresaController.btnFechar.tooltiptext = Cerrar + +editarSeguradoraEmpresaController.MSG.suscribirOK = Seguradora Empresa registrada com sucesso +editarSeguradoraEmpresaController.MSG.borrarPergunta=Deseja excluir Seguradora Empresa? +editarSeguradoraEmpresaController.MSG.borrarOK=Seguradora Empresa excluída com sucesso. +editarSeguradoraEmpresaController.MSG.existe= Já existe um registro com essa Empresa e série + +editarSeguradoraEmpresaController.empresa=Empresa +editarSeguradoraEmpresaController.serie=Série + # Pesquisa SegVKM busquedaSegVKmController.window.title = Seguro VKM busquedaSegVKmController.btnRefresh.tooltiptext = Atualizar diff --git a/web/gui/tarifas/busquedaSeguradoraEmpresa.zul b/web/gui/tarifas/busquedaSeguradoraEmpresa.zul new file mode 100644 index 000000000..eac3b7116 --- /dev/null +++ b/web/gui/tarifas/busquedaSeguradoraEmpresa.zul @@ -0,0 +1,53 @@ + + + + + + + + + +