From 47c7a09c14ebb43abe1f227121ecf8794b747e17 Mon Sep 17 00:00:00 2001 From: "gleison.cruz" Date: Mon, 27 Nov 2023 17:41:44 -0300 Subject: [PATCH] fixes bug#AL-3308 --- pom.xml | 6 +- .../EditarTipoEventoExtraController.java | 130 +++++++++++++++++- src/java/spring-config.xml | 1 + web/WEB-INF/i3-label_en.label | 1 + web/WEB-INF/i3-label_pt_BR.label | 1 + web/gui/catalogos/editarPuntoVenta.zul | 2 +- web/gui/ingreso/editarTipoEventoExtra.zul | 37 +++++ 7 files changed, 173 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index a38136934..90c6f096a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,12 +4,12 @@ 4.0.0 br.com.rjconsultores ventaboletosadm - 1.34.11 + 1.34.12 war - 1.25.0 - 1.21.0 + 1.25.1 + 1.21.1 UTF-8 UTF-8 diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/ingreso/EditarTipoEventoExtraController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/ingreso/EditarTipoEventoExtraController.java index bc4bae7ef..d672ece98 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/ingreso/EditarTipoEventoExtraController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/ingreso/EditarTipoEventoExtraController.java @@ -5,6 +5,7 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.ingreso; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.List; @@ -21,6 +22,7 @@ import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.event.Event; 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; import org.zkoss.zul.Radio; @@ -29,14 +31,19 @@ import org.zkoss.zul.Textbox; import com.rjconsultores.ventaboletos.constantes.Constantes; import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraEmpresa; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraFormaPago; import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraPtoVta; import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.service.FormaPagoService; import com.rjconsultores.ventaboletos.service.TipoEventoExtraEmpresaService; +import com.rjconsultores.ventaboletos.service.TipoEventoExtraFormaPagoService; import com.rjconsultores.ventaboletos.service.TipoEventoExtraPtovtaService; import com.rjconsultores.ventaboletos.service.TipoEventoExtraService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -45,7 +52,6 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyListbox; import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox; - /** * * @author Rafius @@ -63,6 +69,10 @@ public class EditarTipoEventoExtraController extends MyGenericForwardComposer { private EmpresaService empresaService; @Autowired private TipoEventoExtraPtovtaService tipoEventoExtraPtovtaService; + @Autowired + private FormaPagoService formaPagoService; + @Autowired + private TipoEventoExtraFormaPagoService tipoEventoExtraFormaPagoService; private TipoEventoExtra tipoEventoExtra; private MyListbox tipoEventoExtraList; @@ -78,10 +88,22 @@ public class EditarTipoEventoExtraController extends MyGenericForwardComposer { private Radio raTipo22; private MyComboboxEstandar cmbEmpresa; private MyComboboxPuntoVenta cmbPontoVenda; + /*Forma de Pagamento*/ private List lsEmpresas; + /*Forma de Pagamento*/ + private List lsEmpresasFormapago; + private List lsFormaPago; + private List lsTipoEventoExtraFormaPago; private List lsEventoExtrasConstantes; private MyComboboxEstandar cmbCveTipoEvento; private Row rowIndEnviaExcessoDeBagagemSefaz; + /*Forma de Pagamento*/ + private Combobox cmbFormaPago; + /*Forma de Pagamento*/ + private Combobox cmbEmpresaFormaPago; + private MyListbox formaPagoList; + + private static Logger log = Logger.getLogger(EditarTipoEventoExtraController.class); @@ -138,6 +160,13 @@ public class EditarTipoEventoExtraController extends MyGenericForwardComposer { } txtNome.focus(); + + lsFormaPago = formaPagoService.obtenerTodos(); + + if (tipoEventoExtra.getTipoeventoextraId() != null) { + lsTipoEventoExtraFormaPago = tipoEventoExtraFormaPagoService.obtenerTodos(); + formaPagoList.setData(lsTipoEventoExtraFormaPago); + } } public void onClick$btnRemoverEmpresa(Event ev) throws InterruptedException { @@ -305,6 +334,69 @@ public class EditarTipoEventoExtraController extends MyGenericForwardComposer { Messagebox.OK, Messagebox.INFORMATION); } } + + + public void onClick$btnSalvarFormaPago(Event ev) throws InterruptedException { + + cmbFormaPago.getValue(); + + try { + FormaPago formaPago = new FormaPago(); + try { + formaPago = (FormaPago) cmbFormaPago.getSelectedItem().getValue(); + Boolean achou = Boolean.FALSE; + if (formaPago != null) { + for (TipoEventoExtraFormaPago fpd : lsTipoEventoExtraFormaPago) { + if (fpd.getFormapago().equals(formaPago)) { + achou = Boolean.TRUE; + } + } + if (!achou&&getTipoEventoExtra()!=null){ + TipoEventoExtraFormaPago fpd = new TipoEventoExtraFormaPago(); + fpd.setTipoEventoExtra(getTipoEventoExtra()); + fpd.setFormaPago(formaPago); + fpd.setActivo(Boolean.TRUE); + fpd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + fpd.setFecmodif(Calendar.getInstance().getTime()); + lsTipoEventoExtraFormaPago.add(fpd); + formaPagoList.setData(lsTipoEventoExtraFormaPago); + formaPagoList.updateItem(fpd); + tipoEventoExtraFormaPagoService.actualizacion(fpd); + } else { + Messagebox.show( + Labels.getLabel("editarPuntoVentaController.MSG.Achou.FormaPago"), + Labels.getLabel("editarTipoEventoExtraController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); + } + } + } catch (Exception e) { + Messagebox.show( + Labels.getLabel("editarPuntoVentaController.MSG.formaDePago"), + Labels.getLabel("editarTipoEventoExtraController.window.title"), + Messagebox.OK, Messagebox.EXCLAMATION); + } + } catch (Exception ex) { + log.error(ex); + Messagebox.show( + Labels.getLabel("MSG.Error"), + Labels.getLabel("editarTipoEventoExtraController.window.title"), + Messagebox.OK, Messagebox.ERROR); + } + } + + public void onClick$btnApagarFormaPago(Event ev) { + try { + TipoEventoExtraFormaPago fpd = (TipoEventoExtraFormaPago) formaPagoList.getSelected(); + if (fpd != null) { + formaPagoList.removeItem(fpd); + lsTipoEventoExtraFormaPago.remove(fpd); + tipoEventoExtraFormaPagoService.borrar(fpd); + } + } catch (Exception ex) { + log.error(ex); + } + } + public List getLsEmpresas() { return lsEmpresas; @@ -329,5 +421,41 @@ public class EditarTipoEventoExtraController extends MyGenericForwardComposer { public void setLsEventoExtrasConstantes(List lsEventoExtrasConstantes) { this.lsEventoExtrasConstantes = lsEventoExtrasConstantes; } + + private List obterEmpresasUsuarioLogadoComOpcaoTodas() { + List listaEmpresas = new ArrayList(); + listaEmpresas.add(empresaService.obtenerID(-1)); + listaEmpresas.addAll(UsuarioLogado.getUsuarioLogado().getEmpresa()); + return listaEmpresas; + } + + public List getLsEmpresasFormapago() { + return lsEmpresasFormapago; + } + public void setLsEmpresasFormapago(List lsEmpresasFormapago) { + this.lsEmpresasFormapago = lsEmpresasFormapago; + } + + public List getLsFormaPago() { + return lsFormaPago; + } + + public void setLsFormaPago(List lsFormaPago) { + this.lsFormaPago = lsFormaPago; + } + + public Combobox getCmbFormaPago() { + return cmbFormaPago; + } + + public void setCmbFormaPago(Combobox cmbFormaPago) { + this.cmbFormaPago = cmbFormaPago; + } + + public MyListbox getFormaPagoList() { + return formaPagoList; + } + + } diff --git a/src/java/spring-config.xml b/src/java/spring-config.xml index 62fecd656..2e9b7099c 100644 --- a/src/java/spring-config.xml +++ b/src/java/spring-config.xml @@ -258,6 +258,7 @@ com.rjconsultores.ventaboletos.entidad.TipoEmpleado com.rjconsultores.ventaboletos.entidad.TipoEventoExtraEmpresa com.rjconsultores.ventaboletos.entidad.TipoEventoExtraPtoVta + com.rjconsultores.ventaboletos.entidad.TipoEventoExtraFormaPago com.rjconsultores.ventaboletos.entidad.TipoMovimiento com.rjconsultores.ventaboletos.entidad.TipoOcupacion com.rjconsultores.ventaboletos.entidad.TipoParada diff --git a/web/WEB-INF/i3-label_en.label b/web/WEB-INF/i3-label_en.label index 4cbfd9203..6de8ae6b4 100644 --- a/web/WEB-INF/i3-label_en.label +++ b/web/WEB-INF/i3-label_en.label @@ -6632,6 +6632,7 @@ editarTipoEventoExtraController.lbCveTipoEvento = Tipo de Evento p/ comissão editarTipoEventoExtraController.tab.label.agenciasAutorizadas = Agências Autorizadas editarTipoEventoExtraController.lbAgencia.value = Ponto de Venda editarTipoEventoExtraController.indEnviaExcessoDeBagagemSefaz.label = Envia o excesso de Bagagem para SEFAZ +editarTipoEventoExtraController.tab.label.formasPagamento = Forma Pagamento #Pago Motorista indexController.mniPagoConductor.label = Pagamento Motorista diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index a38bd3393..dcbde291a 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -6674,6 +6674,7 @@ editarTipoEventoExtraController.lbCveTipoEvento = Tipo de Evento p/ comissão editarTipoEventoExtraController.tab.label.agenciasAutorizadas = Agências Autorizadas editarTipoEventoExtraController.lbAgencia.value = Ponto de Venda editarTipoEventoExtraController.indEnviaExcessoDeBagagemSefaz.label = Envia o excesso de Bagagem para SEFAZ +editarTipoEventoExtraController.tab.label.formasPagamento = Forma Pagamento #Pago Motorista indexController.mniPagoConductor.label = Pagamento Motorista diff --git a/web/gui/catalogos/editarPuntoVenta.zul b/web/gui/catalogos/editarPuntoVenta.zul index c3ecdc5ef..8576a99e8 100644 --- a/web/gui/catalogos/editarPuntoVenta.zul +++ b/web/gui/catalogos/editarPuntoVenta.zul @@ -58,7 +58,7 @@ id="tabHorario" label="${c:l('editarPuntoVentaController.tab.label.horario')}" /> + + @@ -190,6 +193,40 @@ + + + + + + + + +