W2i - Parametrizar Serie por Empresa (fixed bug #5522)

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@36808 d1611594-4594-4d17-8e1d-87c2c4800839
master
leonardo 2014-07-24 13:32:14 +00:00
parent f53db1ec38
commit bce531398e
9 changed files with 479 additions and 0 deletions

View File

@ -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<SeguradoraEmpresa> 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<SeguradoraEmpresa> seguradoraEmpresaBusqueda =
new HibernateSearchObject<SeguradoraEmpresa>(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());
}
}

View File

@ -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<Empresa> 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<Empresa> getLsEmpresa() {
return lsEmpresa;
}
public void setLsEmpresa(List<Empresa> 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;
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -264,6 +264,7 @@
<value>com.rjconsultores.ventaboletos.entidad.RhPagoConductor <value>com.rjconsultores.ventaboletos.entidad.RhPagoConductor
</value> </value>
<value>com.rjconsultores.ventaboletos.entidad.Secretaria</value> <value>com.rjconsultores.ventaboletos.entidad.Secretaria</value>
<value>com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa</value>
<value>com.rjconsultores.ventaboletos.entidad.SeguroKm</value> <value>com.rjconsultores.ventaboletos.entidad.SeguroKm</value>
<value>com.rjconsultores.ventaboletos.entidad.SegVKM</value> <value>com.rjconsultores.ventaboletos.entidad.SegVKM</value>
<value>com.rjconsultores.ventaboletos.entidad.SeguroTarifa</value> <value>com.rjconsultores.ventaboletos.entidad.SeguroTarifa</value>

View File

@ -4236,6 +4236,31 @@ editarSeguroKmController.MSG.borrarPergunta=Deseas elminar seguro por KM?
editarSeguroKmController.MSG.borrarOK=Seguro por KM se eliminó existosamente editarSeguroKmController.MSG.borrarOK=Seguro por KM se eliminó existosamente
editarSeguroKmController.MSG.existe= Ya existe un registro con esse Km 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 # Pesquisa SegVKM
busquedaSegVKmController.window.title = Seguro VKM busquedaSegVKmController.window.title = Seguro VKM
busquedaSegVKmController.btnRefresh.tooltiptext = Atualizar busquedaSegVKmController.btnRefresh.tooltiptext = Atualizar

View File

@ -4283,6 +4283,30 @@ editarSeguroKmController.MSG.borrarPergunta=Deseja elminar Seguro por KM?
editarSeguroKmController.MSG.borrarOK=Seguro por KM eliminado com sucesso. editarSeguroKmController.MSG.borrarOK=Seguro por KM eliminado com sucesso.
editarSeguroKmController.MSG.existe= Já existe um registro com esse Km. 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 # Pesquisa SegVKM
busquedaSegVKmController.window.title = Seguro VKM busquedaSegVKmController.window.title = Seguro VKM
busquedaSegVKmController.btnRefresh.tooltiptext = Atualizar busquedaSegVKmController.btnRefresh.tooltiptext = Atualizar

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<?page contentType="text/html;charset=UTF-8"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winBusquedaSeguradoraEmpresa"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winBusquedaSeguradoraEmpresa" title="${c:l('busquedaSeguradoraEmpresaController.window.title')}"
apply="${busquedaSeguradoraEmpresaController}" contentStyle="overflow:auto"
height="450px" width="500px" border="normal" >
<toolbar>
<button id="btnRefresh" image="/gui/img/refresh.png" width="35px"
tooltiptext="${c:l('busquedaSeguradoraEmpresaController.btnRefresh.tooltiptext')}" />
<separator orient="vertical" />
<button id="btnNovo" image="/gui/img/add.png" width="35px"
tooltiptext="${c:l('busquedaSeguradoraEmpresaController.btnNovo.tooltiptext')}" />
<separator orient="vertical" />
<button id="btnCerrar" onClick="winBusquedaSeguradoraEmpresa.detach()" image="/gui/img/exit.png" width="35px"
tooltiptext="${c:l('busquedaSeguradoraEmpresaController.btnCerrar.tooltiptext')}"/>
</toolbar>
<grid fixedLayout="true">
<columns>
<column width="30%" />
<column width="70%" />
</columns>
<rows>
<row>
<label value="${c:l('busquedaSeguradoraEmpresaController.serie.label')}"/>
<textbox id="txtSerie" width="200px" use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"/>
</row>
</rows>
</grid>
<toolbar>
<button id="btnPesquisa" image="/gui/img/find.png"
label="${c:l('tooltiptext.btnPesquisa')}"/>
</toolbar>
<paging id="pagingSeguradoraEmpresa" pageSize="15"/>
<listbox id="seguradoraEmpresaList" use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
multiple="false">
<listhead sizable="true">
<listheader image="/gui/img/builder.gif"
label="${c:l('busquedaSeguradoraEmpresaController.empresa.label')}"
sort="auto(empresa)"/>
<listheader image="/gui/img/builder.gif"
label="${c:l('busquedaSeguradoraEmpresaController.serie.label')}"
sort="auto(serie)"/>
</listhead>
</listbox>
</window>
</zk>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<?page contentType="text/html;charset=UTF-8"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winEditarSeguradoraEmpresa"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winEditarSeguradoraEmpresa" border="normal"
apply="${editarSeguradoraEmpresaController}"
width="550px" height="500px" contentStyle="overflow:auto"
title="${c:l('editarSeguradoraEmpresaController.window.title')}">
<toolbar>
<hbox spacing="5px" style="padding:1px" align="right">
<button id="btnApagar" height="20"
image="/gui/img/remove.png" width="35px"
tooltiptext="${c:l('editarSeguradoraEmpresaController.btnApagar.tooltiptext')}"/>
<button id="btnSalvar" height="20"
image="/gui/img/save.png" width="35px"
tooltiptext="${c:l('editarSeguradoraEmpresaController.btnSalvar.tooltiptext')}"/>
<button id="btnFechar" height="20"
image="/gui/img/exit.png" width="35px"
onClick="winEditarSeguradoraEmpresa.detach()"
tooltiptext="${c:l('editarSeguradoraEmpresaController.btnFechar.tooltiptext')}"/>
</hbox>
</toolbar>
<grid fixedLayout="true">
<columns>
<column width="40%" />
<column width="60%" />
</columns>
<rows>
<row>
<label value="${c:l('editarSeguradoraEmpresaController.empresa')}"/>
<combobox id="cmbEmpresa" constraint="no empty"
mold="rounded" buttonVisible="true" width="90%"
model="@{winEditarSeguradoraEmpresa$composer.lsEmpresa}"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
selectedItem="@{winEditarSeguradoraEmpresa$composer.seguradoraEmpresa.empresa}"/>
</row>
<row>
<label value="${c:l('editarSeguradoraEmpresaController.serie')}"/>
<textbox id="txtSerie"
constraint="no empty" maxlength="4"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"
value="@{winEditarSeguradoraEmpresa$composer.seguradoraEmpresa.serie}" />
</row>
</rows>
</grid>
</window>
</zk>