bug#14127

dev:thiago
qua:

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@92607 d1611594-4594-4d17-8e1d-87c2c4800839
master
wilian 2019-04-30 18:08:01 +00:00
parent dfd5373c0c
commit 88350989f9
6 changed files with 46 additions and 2 deletions

View File

@ -4,6 +4,7 @@
*/ */
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales; package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
@ -19,9 +20,11 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Combobox; import org.zkoss.zul.Combobox;
import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago; import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.FormaPago; import com.rjconsultores.ventaboletos.entidad.FormaPago;
import com.rjconsultores.ventaboletos.entidad.RestriccionPago; import com.rjconsultores.ventaboletos.entidad.RestriccionPago;
import com.rjconsultores.ventaboletos.service.ConfigRestriccionPagoService; import com.rjconsultores.ventaboletos.service.ConfigRestriccionPagoService;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.FormaPagoService; import com.rjconsultores.ventaboletos.service.FormaPagoService;
import com.rjconsultores.ventaboletos.service.RestriccionPagoService; import com.rjconsultores.ventaboletos.service.RestriccionPagoService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@ -49,8 +52,13 @@ public class EditarRestriccionFormaPagoController extends MyGenericForwardCompos
private List<RestriccionPago> lsRestriccionPago; private List<RestriccionPago> lsRestriccionPago;
private Combobox cmbFormaPago; private Combobox cmbFormaPago;
private Combobox cmbRestriccionFormaPago; private Combobox cmbRestriccionFormaPago;
private Combobox cmbEmpresa;
private List<Empresa> lsEmpresas;
private static Logger log = Logger.getLogger(EditarRestriccionFormaPagoController.class); private static Logger log = Logger.getLogger(EditarRestriccionFormaPagoController.class);
@Autowired
EmpresaService empresaService;
public List<FormaPago> getLsFormaPago() { public List<FormaPago> getLsFormaPago() {
return lsFormaPago; return lsFormaPago;
} }
@ -81,8 +89,18 @@ public class EditarRestriccionFormaPagoController extends MyGenericForwardCompos
lsRestriccionPago = restriccionPagoService.obtenerTodos(); lsRestriccionPago = restriccionPagoService.obtenerTodos();
super.doAfterCompose(comp); super.doAfterCompose(comp);
lsEmpresas = new ArrayList<Empresa>(0);
Empresa empresa = empresaService.obtenerID(-1);
if(empresa == null) {
empresa = new Empresa(-1, Labels.getLabel("lb.todas"));
}
lsEmpresas.add(empresa);
lsEmpresas.addAll(UsuarioLogado.getUsuarioLogado().getEmpresa());
configRestriccionPago = (ConfigRestriccionPago) Executions.getCurrent().getArg().get("configRestriccionPago"); configRestriccionPago = (ConfigRestriccionPago) Executions.getCurrent().getArg().get("configRestriccionPago");
restriccionFormaPagoList = (MyListbox) Executions.getCurrent().getArg().get("configRestriccionFormaPagoList"); restriccionFormaPagoList = (MyListbox) Executions.getCurrent().getArg().get("configRestriccionFormaPagoList");
cmbFormaPago.focus(); cmbFormaPago.focus();
@ -91,11 +109,12 @@ public class EditarRestriccionFormaPagoController extends MyGenericForwardCompos
public void onClick$btnSalvar(Event ev) { public void onClick$btnSalvar(Event ev) {
cmbFormaPago.getValue(); cmbFormaPago.getValue();
cmbRestriccionFormaPago.getValue(); cmbRestriccionFormaPago.getValue();
cmbEmpresa.getValue();
try { try {
boolean puedoDarDeAlta = configRestriccionPagoService.puedoDarDeAlta(configRestriccionPago); boolean puedoDarDeAlta = configRestriccionPagoService.puedoDarDeAlta(configRestriccionPago);
List<ConfigRestriccionPago> lsConfig = configRestriccionPagoService.buscar(configRestriccionPago.getFormaPago(), configRestriccionPago.getRestriccion()); List<ConfigRestriccionPago> lsConfig = configRestriccionPagoService.buscar(configRestriccionPago.getFormaPago(), configRestriccionPago.getRestriccion(), configRestriccionPago.getEmpresa());
boolean podeSalvar = false; boolean podeSalvar = false;
if (lsConfig.isEmpty()) { if (lsConfig.isEmpty()) {
@ -133,6 +152,7 @@ public class EditarRestriccionFormaPagoController extends MyGenericForwardCompos
configRestriccionPago.setActivo(Boolean.TRUE); configRestriccionPago.setActivo(Boolean.TRUE);
configRestriccionPago.setFecmodif(Calendar.getInstance().getTime()); configRestriccionPago.setFecmodif(Calendar.getInstance().getTime());
configRestriccionPago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); configRestriccionPago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
configRestriccionPago.setEmpresa((Empresa) cmbEmpresa.getSelectedItem().getValue());
if (configRestriccionPago.getConfigrestriccionId() == null) { if (configRestriccionPago.getConfigrestriccionId() == null) {
configRestriccionPagoService.suscribir(configRestriccionPago); configRestriccionPagoService.suscribir(configRestriccionPago);
@ -182,4 +202,9 @@ public class EditarRestriccionFormaPagoController extends MyGenericForwardCompos
log.error(ex); log.error(ex);
} }
} }
public List<Empresa> getLsEmpresas() {
return lsEmpresas;
}
} }

View File

@ -5,6 +5,8 @@
package com.rjconsultores.ventaboletos.web.utilerias.render; package com.rjconsultores.ventaboletos.web.utilerias.render;
import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago; import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago;
import org.zkoss.util.resource.Labels;
import org.zkoss.zul.Listcell; import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem; import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer; import org.zkoss.zul.ListitemRenderer;
@ -20,6 +22,9 @@ public class RenderRestriccionFormaPago implements ListitemRenderer {
Listcell lc = new Listcell(configFormaPago.getConfigrestriccionId().toString()); Listcell lc = new Listcell(configFormaPago.getConfigrestriccionId().toString());
lc.setParent(lstm); lc.setParent(lstm);
lc = new Listcell(configFormaPago.getEmpresa() == null ? Labels.getLabel("lb.todas") : configFormaPago.getEmpresa().getNombempresa());
lc.setParent(lstm);
lc = new Listcell(configFormaPago.getFormaPago().getDescpago()); lc = new Listcell(configFormaPago.getFormaPago().getDescpago());
lc.setParent(lstm); lc.setParent(lstm);

View File

@ -70,6 +70,7 @@ lb.ate = Hasta
lb.dataIni.value = Fecha Ini lb.dataIni.value = Fecha Ini
lb.dataFin.value = Fecha fin lb.dataFin.value = Fecha fin
lb.empresa = Empresa lb.empresa = Empresa
lb.todas = TODAS
lb.puntoventa = Punto Venta lb.puntoventa = Punto Venta
# Reporte # Reporte

View File

@ -72,6 +72,7 @@ lb.ate = até
lb.dataIni.value = Data Inicial lb.dataIni.value = Data Inicial
lb.dataFin.value = Data Final lb.dataFin.value = Data Final
lb.empresa = Empresa lb.empresa = Empresa
lb.todas = TODAS
lb.puntoventa = Ponto de Venda (Agência) lb.puntoventa = Ponto de Venda (Agência)
# Relatório # Relatório

View File

@ -52,6 +52,9 @@
image="/gui/img/builder.gif" image="/gui/img/builder.gif"
label="${c:l('busquedaRestriccionFormaPagoController.lhId.label')}" label="${c:l('busquedaRestriccionFormaPagoController.lhId.label')}"
sort="auto(configrestriccionId)" /> sort="auto(configrestriccionId)" />
<listheader id="lhEmpresa" image="/gui/img/builder.gif"
label="${c:l('lb.empresa')}"
sort="auto(empresa.nombempresa)" />
<listheader id="lhForma" image="/gui/img/builder.gif" <listheader id="lhForma" image="/gui/img/builder.gif"
label="${c:l('busquedaRestriccionFormaPagoController.lhForma.label')}" label="${c:l('busquedaRestriccionFormaPagoController.lhForma.label')}"
sort="auto(formaPago.descpago)" /> sort="auto(formaPago.descpago)" />

View File

@ -27,6 +27,15 @@
<column width="50%" /> <column width="50%" />
</columns> </columns>
<rows> <rows>
<row>
<label value="${c:l('lb.empresa')}" />
<combobox id="cmbEmpresa" constraint="no empty"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
width="100%" mold="rounded" buttonVisible="true"
model="@{winEditarRestriccionFormaPago$composer.lsEmpresas}"
selectedItem="@{winEditarRestriccionFormaPago$composer.configRestriccionPago.empresa}" />
</row>
<row> <row>
<label id="lblFormaPago" <label id="lblFormaPago"
value="${c:l('busquedaRestriccionFormaPagoController.FormaPago')}" /> value="${c:l('busquedaRestriccionFormaPagoController.FormaPago')}" />