From 2541194067aad287c4e88ee42f9c3cb523082fd6 Mon Sep 17 00:00:00 2001 From: gleimar Date: Thu, 30 Jul 2015 14:25:12 +0000 Subject: [PATCH] fixes bug#6522 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@46452 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../EditarFormapagoEmpresaController.java | 25 ++++++ .../EditarTotnaofiscalEmpresaController.java | 76 ++++++++++++------- .../busquedaFormapagoEmpresa.zul | 4 +- .../busquedaRelgerencialEmpresa.zul | 2 +- .../busquedaTotnaofiscalEmpresa.zul | 4 +- .../editarFormapagoEmpresa.zul | 2 +- 6 files changed, 79 insertions(+), 34 deletions(-) diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/EditarFormapagoEmpresaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/EditarFormapagoEmpresaController.java index 7b7f06f93..10b41fc2f 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/EditarFormapagoEmpresaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/EditarFormapagoEmpresaController.java @@ -22,6 +22,7 @@ import org.zkoss.zul.Textbox; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.FiscalFormapagoEmpresa; import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.Ruta; import com.rjconsultores.ventaboletos.service.FiscalImpressoraService; import com.rjconsultores.ventaboletos.service.FormaPagoService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -305,4 +306,28 @@ public class EditarFormapagoEmpresaController extends MyGenericForwardComposer this.btnApagar = btnApagar; } + public boolean desabilitaComboFormaPago(){ + if ( (formapagoEmpresa.getTipoformapago() != null) && (formapagoEmpresa.getTipoformapago().equals(TipoFormaPagamento.CUSTOM.toString())) ){ + return false; + } + return true; + } + + public void onChange$cmbTipoformapago(Event ev) { + + Comboitem ciTipoformapago = cmbTipoformapago.getSelectedItem(); + + if (ciTipoformapago != null) { + String tipoFormaPago = (String) ciTipoformapago.getValue(); + + formapagoEmpresa.setFormaPago(null); + + if (tipoFormaPago.equals(TipoFormaPagamento.CUSTOM.toString())){ + cmbTipoformapagoTotalBus.setDisabled(false); + }else{ + cmbTipoformapagoTotalBus.setDisabled(true); + } + } + + } } diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/EditarTotnaofiscalEmpresaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/EditarTotnaofiscalEmpresaController.java index ab86f313b..74dc18aa6 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/EditarTotnaofiscalEmpresaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/EditarTotnaofiscalEmpresaController.java @@ -1,7 +1,6 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.impressaofiscal; import java.util.ArrayList; -import java.util.Calendar; import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -14,6 +13,7 @@ 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.WrongValueException; import org.zkoss.zk.ui.event.Event; import org.zkoss.zul.Button; import org.zkoss.zul.Checkbox; @@ -36,17 +36,24 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose public enum TipoTotalizadorNaoFiscal { - CancImpPost, - CartaoCredDeb, - CanPassagem, - VendaManual, - ImpressaoPost, - SeguroOpcional, - CancSeguroOpcional, - Multa, - DiferencaMaior, - DiferencaMenor, - CUSTOM; + CancImpPost(false), + CartaoCredDeb(false), + CanPassagem(false), + VendaManual(false), + ImpressaoPost(false), + SeguroOpcional(true), + CancSeguroOpcional(true), + Multa(true), + DiferencaMaior(true), + DiferencaMenor(true), + CUSTOM(true); + + private final boolean temEE; + private TipoTotalizadorNaoFiscal(boolean pTemEE) { temEE = pTemEE; } + public boolean isTemEE() { + return temEE; + } + } /** @@ -110,9 +117,14 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose totnaofiscalEmpresa = (FiscalTotnaofiscalEmpresa) Executions.getCurrent().getArg().get("totnaofiscalEmpresa"); totnaofiscalEmpresaList = (MyListbox) Executions.getCurrent().getArg().get("totnaofiscalEmpresaList"); - if (totnaofiscalEmpresa.getFiscaltotnaofiscalId() == null) + if (totnaofiscalEmpresa.getFiscaltotnaofiscalId() == null){ btnApagar.setVisible(Boolean.FALSE); - + }else{ + + TipoTotalizadorNaoFiscal tipoTotalizadorNaoFiscal = TipoTotalizadorNaoFiscal.valueOf(totnaofiscalEmpresa.getTipototalizador()); + cmbTipoEventoExtra.setDisabled(!tipoTotalizadorNaoFiscal.isTemEE()); + + } } public void onClick$btnSalvar(Event ev) throws InterruptedException { @@ -137,9 +149,7 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose totnaofiscalEmpresa.setDescricao(txtDescricao.getText()); - totnaofiscalEmpresa.setActivo(true); - totnaofiscalEmpresa.setFecmodif(Calendar.getInstance().getTime()); - totnaofiscalEmpresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + for (Object totalizador : totnaofiscalEmpresaList.getListData()) { if(!((FiscalTotnaofiscalEmpresa)totalizador).getFiscaltotnaofiscalId().equals(totnaofiscalEmpresa.getFiscaltotnaofiscalId()) && totnaofiscalEmpresa.getEmpresa().equals(((FiscalTotnaofiscalEmpresa)totalizador).getEmpresa()) @@ -169,13 +179,9 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose } } - if(totnaofiscalEmpresa.getFiscaltotnaofiscalId() == null){ - fiscalImpressoraService.suscribirTotnaofiscalEmpresa(totnaofiscalEmpresa); - totnaofiscalEmpresaList.addItemNovo(totnaofiscalEmpresa); - } else { - fiscalImpressoraService.actualizacionTotnaofiscalEmpresa(totnaofiscalEmpresa); - totnaofiscalEmpresaList.updateItem(totnaofiscalEmpresa); - } + fiscalImpressoraService.suscribirActualizarTotnaofiscalEmpresa(totnaofiscalEmpresa); + totnaofiscalEmpresaList.updateItem(totnaofiscalEmpresa); + Messagebox.show( Labels.getLabel("editarTotnaofiscalEmpresaController.MSG.suscribirOK"), @@ -185,6 +191,10 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose closeWindow(); }catch (Exception ex) { + if (ex instanceof WrongValueException){ + throw ((WrongValueException)ex); + } + log.error("editarTotnaofiscalEmpresaController: " + ex); Messagebox.show( Labels.getLabel("MSG.Error"), @@ -203,10 +213,8 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose if (resp == Messagebox.YES) { - totnaofiscalEmpresa.setActivo(false); - totnaofiscalEmpresa.setFecmodif(Calendar.getInstance().getTime()); - totnaofiscalEmpresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - fiscalImpressoraService.actualizacionTotnaofiscalEmpresa(totnaofiscalEmpresa); + + fiscalImpressoraService.borrarTotnaofiscalEmpresa(totnaofiscalEmpresa); Messagebox.show( Labels.getLabel("editarTotnaofiscalEmpresaController.MSG.borrarOK"), @@ -310,4 +318,16 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose this.chkImportarImp = chkImportarImp; } + public void onChange$cmbTipototalizador(Event ev) { + Comboitem selectedItem = cmbTipototalizador.getSelectedItem(); + if (selectedItem != null){ + String tipoTotalizador = (String) selectedItem.getValue(); + + TipoTotalizadorNaoFiscal tipoTotalizadorNaoFiscal = TipoTotalizadorNaoFiscal.valueOf(tipoTotalizador); + + totnaofiscalEmpresa.setTipoeventoextra(null); + cmbTipoEventoExtra.setDisabled(!tipoTotalizadorNaoFiscal.isTemEE()); + + } + } } diff --git a/web/gui/impressaofiscal/busquedaFormapagoEmpresa.zul b/web/gui/impressaofiscal/busquedaFormapagoEmpresa.zul index 0c08f0081..5014feee5 100644 --- a/web/gui/impressaofiscal/busquedaFormapagoEmpresa.zul +++ b/web/gui/impressaofiscal/busquedaFormapagoEmpresa.zul @@ -51,7 +51,7 @@ label="${c:l('lb.id')}" sort="auto(fiscalFormapagoId)"/> + label="${c:l('busquedaFormapagoEmpresaController.empresa.label')}" sort="auto(empresa.nombempresa)"/> @@ -60,7 +60,7 @@ label="${c:l('busquedaFormapagoEmpresaController.descricao.label')}" sort="auto(descricao)"/> + label="${c:l('busquedaFormapagoEmpresaController.formapagototalbus.label')}" sort="auto(formaPago.descpago)"/> diff --git a/web/gui/impressaofiscal/busquedaRelgerencialEmpresa.zul b/web/gui/impressaofiscal/busquedaRelgerencialEmpresa.zul index f2777f87f..c7e01b71e 100644 --- a/web/gui/impressaofiscal/busquedaRelgerencialEmpresa.zul +++ b/web/gui/impressaofiscal/busquedaRelgerencialEmpresa.zul @@ -52,7 +52,7 @@ label="${c:l('lb.id')}" sort="auto(fiscalrelgerencialId)"/> + label="${c:l('busquedaRelgerencialEmpresaController.empresa.label')}" sort="auto(empresa.nombempresa)"/> diff --git a/web/gui/impressaofiscal/busquedaTotnaofiscalEmpresa.zul b/web/gui/impressaofiscal/busquedaTotnaofiscalEmpresa.zul index 7b9a9c4c7..f9dbea844 100644 --- a/web/gui/impressaofiscal/busquedaTotnaofiscalEmpresa.zul +++ b/web/gui/impressaofiscal/busquedaTotnaofiscalEmpresa.zul @@ -52,7 +52,7 @@ label="${c:l('lb.id')}" sort="auto(fiscaltotnaofiscalId)"/> + label="${c:l('busquedaTotnaofiscalEmpresaController.empresa.label')}" sort="auto(empresa.nombempresa)"/> @@ -61,7 +61,7 @@ label="${c:l('busquedaTotnaofiscalEmpresaController.descricao.label')}" sort="auto(descricao)"/> + label="${c:l('busquedaTotnaofiscalEmpresaController.tipoeventoextra.label')}" sort="auto(tipoeventoextra.descTipoEvento)"/> diff --git a/web/gui/impressaofiscal/editarFormapagoEmpresa.zul b/web/gui/impressaofiscal/editarFormapagoEmpresa.zul index 7b9bf49bf..90fe729c5 100644 --- a/web/gui/impressaofiscal/editarFormapagoEmpresa.zul +++ b/web/gui/impressaofiscal/editarFormapagoEmpresa.zul @@ -60,7 +60,7 @@