@Listen("onClick=#saveBtn")
  public void addCodeDb() {
    try {
      Map<String, String> map = new HashMap<String, String>();
      map = ZkUtils.getExecutionArgs();
      ErmCodeDb ermCodeDb = new ErmCodeDb();
      List<ErmCodeDb> codeDbList =
          ((ErmCodeDbService) SpringUtil.getBean("ermCodeDbService")).findAllCodeDb(webEmployee);
      String tempId = "OB";
      Long number = (long) codeDbList.size();
      number = number + 1;
      String dbId = tempId + RandomIDGenerator.fmtLong(number, 9);
      ermCodeDb.setDbId(dbId);
      aDbId = dbId;
      dbIdTxt.setValue(dbId);
      if (dbNameTxt.getValue() != null && !"".equals(dbNameTxt.getValue())) {
        ermCodeDb.setName(dbNameTxt.getValue());
      } else {
        ZkUtils.showExclamation(
            Labels.getLabel("webErwSource.nameZhTw") + " " + Labels.getLabel("cannottNull"),
            Labels.getLabel("warn"));
        dbNameTxt.focus();
        return;
      }
      if (resourcesIdTxt.getValue() != null) {
        ermCodeDb.setResourcesId(resourcesIdTxt.getValue());
      }
      ermCodeDb.setHistory("N");
      if (ezproxyRdo.getSelectedItem().getValue() != null) {
        ermCodeDb.setEzproxy(ezproxyRdo.getSelectedItem().getValue().toString());
      }
      if (urlTxt.getValue() != null && !"".equals(urlTxt.getValue())) {
        ermCodeDb.setUrl(urlTxt.getValue());
      }
      if (orderNoIbx.getValue() != null) {
        ermCodeDb.setOrderNo(orderNoIbx.getValue());
      }
      ermCodeDb.setIsDataEffid(1);
      ermCodeDb.setWebEmployee(webEmployee);
      ermCodeDb.setCreateDate(new Date());
      ((ErmCodeDbService) SpringUtil.getBean("ermCodeDbService")).saveCodeDb(ermCodeDb);

      ((WebSysLogService) SpringUtil.getBean("webSysLogService"))
          .insertLog(
              ZkUtils.getRemoteAddr(),
              ermCodeDb.getWebEmployee().getEmployeesn(),
              "codeDb_" + ermCodeDb.getDbId());
      ZkUtils.showInformation(Labels.getLabel("saveOK"), Labels.getLabel("info"));
      dbIdTxt.setValue(ermCodeDb.getDbId());
      addSuunitBtn.setDisabled(false);
      delSuunitBtn.setDisabled(false);
      String url = "ermCodeDb/ermCodeDb.zul";
      ZkUtils.refurbishMethod(url);

    } catch (WrongValueException e) {
      log.error("新增資料庫異常" + e);
    }
  }
 public void doActualizar() {
   // usuarioSelected.setStatus(checkEstadoUsuario.isChecked());
   usuarioSelected.setCodigoempleado(txtNumerocarne.getValue());
   usuarioSelected.setContrasena(txtClaveUsuario2.getValue());
   usuarioSelected.setNombreCompleto(txtNombreUsuario.getValue());
   usuarioSelected.setNombreusuario(txtUsuarioSistema.getValue());
   usuarioSelected.setRegistroslista(txtRegistrosLista.getValue());
   //        try {
   //            responseOperacion = usuarioBean.guardarUsuario(usuarioSelected, Boolean.FALSE);
   if (responseOperacion.getCodigoRespuesta() == Constants.CODE_OPERACION_SATISFACTORIA) {
     //                MensajeMultilinea.show("Usuario actualizado Satisfactoriamente",
     // Constants.MENSAJE_TIPO_INFO);
     //                usuarioSelected = responseOperacion.getUsuario();
     loadDataFromEntity();
     doReadOnly(Boolean.TRUE);
     doEditButton();
     listaUsuarioCtrl.refresTotalRegistros();
     listaUsuarioCtrl.refreshModel(0);
   } else {
     MensajeMultilinea.show(responseOperacion.getMensajeRespuesta(), Constants.MENSAJE_TIPO_ERROR);
   }
   //        } catch (DiservWebException bex) {
   //            bex.printStackTrace();
   //            MensajeMultilinea.show(bex.toString(), Constants.MENSAJE_TIPO_ERROR);
   //        }
   doReadOnly(Boolean.TRUE);
   doEditButton();
 }
  private void doWriteComponentsToBean(TPermohonan tPermohonan, Mttr mttr) {

    //        tPermohonan.setT_idoss_permohonan_id(textbox_TIdossPermohonanId.getValue());
    tPermohonan.setNama_pemohon(textbox_NamaPemohon.getValue());
    tPermohonan.setBagian_pemohon(textbox_BagianPemohon.getValue());
    Timestamp ts = new Timestamp(java.util.Calendar.getInstance().getTimeInMillis());
    tPermohonan.setTgl_permohonan(ts);
    tPermohonan.setNik_pemohon(textbox_NikPemohon.getValue());
    tPermohonan.setNama_manager(textbox_NamaManager.getValue());
    tPermohonan.setNik_manager(textbox_NikManager.getValue());
    tPermohonan.setNama_gm(textbox_NamaGm.getValue());
    tPermohonan.setNik_gm(textbox_NikGm.getValue());
    tPermohonan.setDetail_permohonan(textbox_DetailPermohonan.getValue());
    if (getUploadMedia() != null) {
      tPermohonan.setUploadStream(getUploadMedia().getStreamData());
    }
    tPermohonan.setTarget_mulai_digunakan(ts);
    String lain = textbox_Lainlain.getValue();
    tPermohonan.setLain_lain_desc(lain);
    //        radio_lainlain.setValue(lain);
    Radio type = radiogroupType_permohonan.getSelectedItem();
    tPermohonan.setType_permohonan(type.getValue());
    tPermohonan.setLain_lain_desc(textbox_Lainlain.getValue());
    tPermohonan.setUpdated_divisi(ts);
    tPermohonan.setUpdated_gm(ts);
    tPermohonan.setUpdated_manager(ts);
    tPermohonan.setUpdated_pemohon(ts);
    Radio dampak = radiogroup_Dampak.getSelectedItem();
    tPermohonan.setDampak(dampak.getValue());
    Radio prioritas = radiogroup_Prioritas.getSelectedItem();
    tPermohonan.setUrgensi(prioritas.getValue());
    tPermohonan.setCreated_user(getUserWorkspace().getUserSession().getUserName());
    tPermohonan.setUpdated_user(getUserWorkspace().getUserSession().getUserName());
    if (intbox_target.getValue() != null) {
      int target = intbox_target.getValue();
      long too = setTarget(target);
      Timestamp tanggalnya = new Timestamp(too);
      mttr.setTarget(too);
      mttr.setTarget2(Integer.toString(target));
    }
  }
  private void loadDataFromTextboxs() {
    try {
      usuarioSelected = new Usuarios();
      // validamos los campos
      if (StringUtils.isEmpty(txtClaveUsuario.getValue())) {
        throw new DiservWebException(
            Constants.CODE_OPERATION_FALLIDA, "Debe ingresar password valido para usuario");
      }
      if (StringUtils.isEmpty(txtClaveUsuario2.getValue())) {
        throw new DiservWebException(
            Constants.CODE_OPERATION_FALLIDA, "Debe ingresar password para usuario");
      }

      if (!txtClaveUsuario.getValue().equals(txtClaveUsuario2.getValue())) {
        throw new DiservWebException(Constants.CODE_OPERATION_FALLIDA, "Password no coincide   ");
      }
      if (StringUtils.isEmpty(txtNombreUsuario.getValue())) {
        throw new DiservWebException(
            Constants.CODE_OPERATION_FALLIDA, "Debe ingresar nombre usuarios");
      }
      if (StringUtils.isEmpty(txtUsuarioSistema.getValue())) {
        throw new DiservWebException(
            Constants.CODE_OPERATION_FALLIDA,
            "Debe ingresar  usuario con el que se conectara a sistema");
      }
      if (txtRegistrosLista.getValue() == null) {
        throw new DiservWebException(
            Constants.CODE_OPERATION_FALLIDA, "Debe ingresar cantida de registros por pagina");
      }
      // if (checkEstadoUsuario.isChecked()) {
      //  usuarioSelected.setStatus(checkEstadoUsuario.isChecked());
      usuarioSelected.setCodigoempleado(txtNumerocarne.getValue());
      usuarioSelected.setContrasena(txtClaveUsuario2.getValue());
      usuarioSelected.setNombreCompleto(txtNombreUsuario.getValue());
      usuarioSelected.setNombreusuario(txtUsuarioSistema.getValue());
      usuarioSelected.setRegistroslista(txtRegistrosLista.getValue());

    } catch (DiservWebException ex) {
      MensajeMultilinea.show(ex.getMensaje(), Constants.MENSAJE_TIPO_ERROR);
    }
  }
 public void onClick$btnSavePermissionType() {
   try {
     PermitionType permitionType =
         new PermitionType(code.getValue(), description.getValue(), days.getValue(), true);
     HRMBusinessLogic.getInstance(ConnectionUtil.getInstance().getConn())
         .createPermitionType(0, IDBConstants.MODUL_MASTER_DATA, permitionType);
     parent.prepareList();
     closeWindow();
   } catch (Exception ex) {
     ex.printStackTrace();
   }
 }
  public void onClick$adicionarFrequencias(Event e) throws InterruptedException {

    int id;
    for (Aluno a : Facade.getInstance().listarAlunoTurma(turmav.getId())) {
      for (Intbox i : intbox) {
        id = Integer.parseInt(i.getId());
        if (a.getId() == id) {
          Frequencia fr = new Frequencia();
          fr.setQtdAula(i.getValue());
          fr.setRegistroDeDisciplina(di);
          fr.setAluno(a);
          fr.setPeriodo("");
          Facade.getInstance().salvarFrequencia(fr);
        }
      }
    }

    Messagebox.show(
        "Frequências adicionadas com Sucesso!",
        "Sucesso!",
        Messagebox.OK,
        Messagebox.EXCLAMATION,
        new org.zkoss.zk.ui.event.EventListener() {
          public void onEvent(Event arg1) throws Exception {}
        });

    for (Intbox i : intbox) {
      i.setId(null);
      i.setVisible(false);
    }

    for (Row r : rowss) {
      r.setId(null);
      r.setVisible(false);
    }

    rowss.clear();
    rowss = new ArrayList<Row>();

    intbox.clear();
    intbox = new ArrayList<Intbox>();
    binder.loadComponent(indexFrequencia);
  }
 public void onClick$btnGuardarIngresoCantidadPreparaciones(Event event) {
   logger.log(
       Level.INFO,
       "[PreparacionesEmpleadoMttoCtrl][onClick$btnGuardarIngresoCantidadPreparaciones]");
   GenericResponse resp;
   try {
     if (planillaDetalleSelected == null) {
       throw new FmWebException(
           Constants.CODE_OPERATION_EXCEPTION, "Debe de seleccionar un empleado!!");
     }
     if (intCantidadPrepNormales.getValue() == null) {
       throw new FmWebException(
           Constants.CODE_OPERATION_EXCEPTION, "Ingrese la cantidad de preparaciones normales!!");
     }
     if (intCantidadPrepEmbalsamado.getValue() == null) {
       throw new FmWebException(
           Constants.CODE_OPERATION_EXCEPTION,
           "Ingrese la cantidad de preparaciones embalsamadas!!");
     }
     if (intCantidadPrepEnjabado.getValue() == null) {
       throw new FmWebException(
           Constants.CODE_OPERATION_EXCEPTION, "Ingrese la cantidad de preparaciones enjabadas!!");
     }
     planillaDetalleSelected.setCantPreparacionNormal(intCantidadPrepNormales.getValue());
     planillaDetalleSelected.setCantPreparacionEmbalsam(intCantidadPrepEmbalsamado.getValue());
     planillaDetalleSelected.setCantPreparacionEnjabado(intCantidadPrepEnjabado.getValue());
     planillaDetalleSelected.setEstadoRegistro(Boolean.TRUE);
     planillaDetalleSelected.setFechaEvento(new Date());
     planillaDetalleSelected.setCodigoEmpleadoUsuario(getUserLogin().getUsuario());
     resp =
         usuarioBean.saveOrModifyEntity(
             planillaDetalleSelected,
             planillaDetalleSelected.getCodigoDetallePlanilla() == null); // Boolean.TRUE
     if (resp.getCodigoRespuesta().intValue() == Constants.CODE_OPERATION_OK.intValue()) {
       //                if (resp.getObjeto() != null) {
       //                    planillaDetalleSelected = (PlanillaDetalle) resp.getObjeto();
       //                }
       MensajeMultilinea.show("Registro almacenado exitosamente!!", Constants.MENSAJE_TIPO_INFO);
       listaPlanillaDetalles = null;
       renderizarDatosPlanillaDetalle();
     } else {
       MensajeMultilinea.show(resp.getMensajeRespuesta(), Constants.MENSAJE_TIPO_ERROR);
     }
   } catch (FmWebException fwe) {
     MensajeMultilinea.show(fwe.getMensaje(), Constants.MENSAJE_TIPO_ALERTA);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
 private boolean isValidatedFlow() throws InterruptedException {
   if (textbox_DetailPermohonan.getValue().length() < 1) {
     Messagebox.show("Silakan isi deskripsi");
     return false;
   }
   //        String role = getUserWorkspace().getUserSession().getEmployeeRole();
   if (getUserWorkspace().getUserSession().getEmployeeRole().contains(1532)) {
     if (listbox_NamaPelaksana.getSelectedItem() == null) {
       Messagebox.show("Silakan pilih nama pelaksana");
       return false;
     }
     if (listbox_NamaPelaksana.getSelectedItem().getLabel().equalsIgnoreCase("Silakan pilih")) {
       Messagebox.show("Silakan pilih nama pelaksana");
       return false;
     }
     if (intbox_target.getValue() == null) {
       Messagebox.show("Silakan isikan target selesai");
       return false;
     }
   }
   if (radio_readonly.isSelected()) {
     if (getUploadMedia() == null) {
       Messagebox.show("Type permohonan Read Only -> silakan lampirkan file");
       return false;
     }
   } else if (radio_readwrite.isSelected()) {
     if (getUploadMedia() == null) {
       Messagebox.show("Type permohonan Read Write -> silakan lampirkan file");
       return false;
     }
   } else if (radio_aplikasi.isSelected()) {
     return true;
   } else if (radio_lainlain.isSelected()) {
     return true;
   }
   return true;
 }
  @Listen("onClick=#editBtn")
  public void editCodeDb() {
    try {
      List<ErmCodeDb> codeDbList =
          ((ErmCodeDbService) SpringUtil.getBean("ermCodeDbService")).findAllCodeDb(webEmployee);
      String tempId = "OB";
      Long number = (long) codeDbList.size();
      number = number + 1;
      String dbId = tempId + RandomIDGenerator.fmtLong(number, 9);
      if (!aDbId.equals("") && aDbId != null) {
        codeDb.setDbId(aDbId);
      } else {
        codeDb.setDbId(dbId);
      }
      aDbId = dbId;
      dbIdTxt.setValue(dbId);
      if (dbNameTxt.getValue() != null && !"".equals(dbNameTxt.getValue())) {
        codeDb.setName(dbNameTxt.getValue());
      } else {
        ZkUtils.showExclamation(
            Labels.getLabel("webErwSource.nameZhTw") + " " + Labels.getLabel("cannottNull"),
            Labels.getLabel("warn"));
        dbNameTxt.focus();
        return;
      }
      if (resourcesIdTxt.getValue() != null) {
        codeDb.setResourcesId(resourcesIdTxt.getValue());
      }
      codeDb.setHistory("N");
      if (ezproxyRdo.getSelectedItem().getValue() != null) {
        codeDb.setEzproxy(ezproxyRdo.getSelectedItem().getValue().toString());
      }
      if (urlTxt.getValue() != null && !"".equals(urlTxt.getValue())) {
        codeDb.setUrl(urlTxt.getValue());
      }
      if (orderNoIbx.getValue() != null) {
        codeDb.setOrderNo(orderNoIbx.getValue());
      }
      codeDb.setIsDataEffid(1);
      codeDb.setLatelyChangedDate(new Date());
      codeDb.setLatelyChangedUser(webEmployee.getEmployeesn());
      ((ErmCodeDbService) SpringUtil.getBean("ermCodeDbService")).saveCodeDb(codeDb);
      ((WebSysLogService) SpringUtil.getBean("webSysLogService"))
          .editLog(
              ZkUtils.getRemoteAddr(),
              codeDb.getWebEmployee().getEmployeesn(),
              "codeDb_" + codeDb.getDbId());

      ZkUtils.showInformation(Labels.getLabel("saveOK"), Labels.getLabel("info"));
      Listbox resCodeDbLix =
          (Listbox) editErmResDataBaseWin.getParent().getFellowIfAny("resCodeDbLix");
      Textbox name = (Textbox) editErmResDataBaseWin.getParent().getFellowIfAny("nameTxt");
      Textbox dbIdParent = (Textbox) editErmResDataBaseWin.getParent().getFellowIfAny("dbIdTxt");
      List<ErmCodeDb> codeDbList1 =
          ((ErmCodeDbService) SpringUtil.getBean("ermCodeDbService"))
              .findPublisherList("", "", name.getValue(), dbIdParent.getValue(), webEmployee);
      ListModelList<ErmCodeDb> model = new ListModelList<ErmCodeDb>(codeDbList1);
      model.setMultiple(true);
      resCodeDbLix.setModel(model);
      resCodeDbLix.setActivePage(Integer.valueOf(currentPage));
      dbIdTxt.setValue(codeDb.getDbId());
      addSuunitBtn.setDisabled(false);
      delSuunitBtn.setDisabled(false);
      /*
       * String url = "ermCodeDb/ermCodeDb.zul";
       * ZkUtils.refurbishMethod(url);
       */

    } catch (WrongValueException e) {
      log.error("新增資料庫異常" + e);
    }
  }
 @Command
 @NotifyChange({
   "strCuentaCheques",
   "ctaCheqReadOnly",
   "strNombreCliente",
   "strCodigoBicRecepcion",
   "strCodigoBicEnvio",
   "strCdContratoSicoco",
   "boolOnce",
   "boolDieciseis",
   "strMonedaCbxId",
   "strMonedaCbxValue",
   "boolClienteAAA",
   "boolCuentaActiva",
   "boolMensualidad",
   "boolAnualidad",
   "dateFechaAlta",
   "dateFechaBaja",
   "lblFechaBaja",
   "dateBoxFecha",
   "boolGeneraReporteServicoBtn",
   "clientes",
   "strCdContrato"
 })
 public void showModal(Event evt) {
   Map<String, Object> mapDatos;
   mapDatos = new HashMap<String, Object>();
   logger.debug("this.strCuentaCheques:" + this.cuentaCheques.getValue());
   if (!this.cuentaCheques.getValue().isEmpty()) {
     tgm138Mt101ctrato = new Tgm138Mt101ctrato();
     tgm138Mt101ctrato.setCdCuentaCheques(cuentaCheques.getValue().toUpperCase().trim());
     tgm138Mt101ctrato.setCdMoneda(new Integer(moneda.getValue()));
     tgm138Mt101ctrato.setNbMoneda(monedaCbx.getValue());
     tgm138Mt101ctrato.setCdCodSwRec(codigoBicRecepcion.getValue().toUpperCase().trim());
     tgm138Mt101ctrato.setCdCodSwEnv(codigoBicEnvio.getValue().toUpperCase().trim());
     tgm138Mt101ctrato.setNbEmpresa(nombreCliente.getValue().toUpperCase().trim());
     tgm138Mt101ctrato.setCdTpClienteAaa(
         ((Boolean) clienteAAA.isChecked()).toString().trim().equals("true") ? "1" : "0");
     tgm138Mt101ctrato.setCdContratoSicoco(cdContratoSicoco.getValue());
     tgm138Mt101ctrato.setCdContrato(new Long(cdContrato.getValue().toUpperCase().trim()));
     tgm138Mt101ctrato.setCdMensualidad(
         ((Boolean) mensualidad.isChecked()).toString().trim().equals("true") ? "1" : "0");
     tgm138Mt101ctrato.setCdAnualidad(
         ((Boolean) anualidad.isChecked()).toString().trim().equals("true") ? "1" : "0");
     tgm138Mt101ctrato.setCdIva(new Integer((String) iva.getSelectedItem().getValue()));
     Timestamp timestampFechaAlta = new Timestamp(fechaAlta.getValue().getTime());
     tgm138Mt101ctrato.setFhAlta(timestampFechaAlta);
     tgm138Mt101ctrato.setFhBaja(fechaBaja.getValue() != null ? fechaBaja.getValue() : null);
     mapDatos.put("numeroCuenta", this.cuentaCheques.getValue());
     mapDatos.put("tgm138Mt101ctrato", tgm138Mt101ctrato);
     Window window =
         (Window)
             Executions.createComponents(
                 "/WEB-INF/flows/reporteServicio/reporteServicio.zul", this.getSelf(), mapDatos);
     window.doModal();
   } else {
     Messagebox.show(
         "¡Primero debe de seleccionar el cliente a consultar!",
         "Error",
         Messagebox.OK,
         Messagebox.ERROR);
   }
 }
  @Command
  @NotifyChange({"clientes"})
  public void setCliente(Event evt) {
    clientesBean = new ClientesBean();

    cuentaCheques.clearErrorMessage();
    nombreCliente.clearErrorMessage();
    codigoBicEnvio.clearErrorMessage();
    codigoBicRecepcion.clearErrorMessage();
    cdContratoSicoco.clearErrorMessage();
    errorIva.clearErrorMessage();
    moneda.clearErrorMessage();

    logger.debug("Entrando");
    logger.debug(cuentaCheques.getValue());
    logger.debug(nombreCliente.getValue());
    logger.debug(codigoBicRecepcion.getValue());
    logger.debug(codigoBicEnvio.getValue());
    logger.debug(iva.getSelectedItem() != null ? iva.getSelectedItem().getValue() : "");
    logger.debug(moneda.getValue());
    logger.debug(clienteAAA.isChecked());
    logger.debug(cuentaActiva.isChecked());
    logger.debug(mensualidad.isChecked());
    logger.debug(anualidad.isChecked());
    logger.debug(fechaAlta.getValue());
    logger.debug(cdContratoSicoco.getValue());

    boolean errorGuardar = false;
    if (cuentaCheques.getValue().isEmpty()) {
      cuentaCheques.setErrorMessage("Favor de introducir el Número de Cuenta de Cheques");
      errorGuardar = true;
    } else if (cuentaCheques.getValue().length() < 10) {
      cuentaCheques.setErrorMessage("El Número de Cuenta de Cheques dede ser de 10 digitos");
      errorGuardar = true;
    } else if (!cuentaCheques.getValue().matches(".[0-9]+")) {
      cuentaCheques.setErrorMessage("El Número de Cuenta de Cheques solo debe contener números");
      errorGuardar = true;
    }

    if (codigoBicRecepcion.getValue().isEmpty()) {
      codigoBicRecepcion.setErrorMessage("Favor de introducir el Código BIC de Recepción");
      errorGuardar = true;
    } else if (codigoBicRecepcion.getValue().length() < 11) {
      codigoBicRecepcion.setErrorMessage("El Código BIC de Recepción dede ser de 11 digitos");
      errorGuardar = true;
    } else if (!codigoBicRecepcion.getValue().matches(".[a-zA-Z0-9]+")) {
      codigoBicRecepcion.setErrorMessage(
          "El Código BIC de Recepción solo debe contener números o letras");
      errorGuardar = true;
    }

    if (!codigoBicEnvio.getValue().isEmpty()) {
      if (codigoBicEnvio.getValue().length() < 11) {
        codigoBicEnvio.setErrorMessage("El Código BIC de Envío dede ser de 11 digitos");
        errorGuardar = true;
      } else if (!codigoBicEnvio.getValue().matches(".[a-zA-Z0-9]+")) {
        codigoBicEnvio.setErrorMessage(
            "El Código BIC de Envío solo debe contener números o letras");
        errorGuardar = true;
      }
    }

    if (cdContratoSicoco.getValue().isEmpty()) {
      cdContratoSicoco.setErrorMessage("Favor de introducir el Número de Contrato");
      errorGuardar = true;
    } else if (cdContratoSicoco.getValue().length() < 12) {
      cdContratoSicoco.setErrorMessage("El Número de Contado dede ser de 12 digitos");
      errorGuardar = true;
    } else if (!cdContratoSicoco.getValue().matches(".[0-9]+")) {
      cdContratoSicoco.setErrorMessage("El Número de Contrato solo debe contener números");
      errorGuardar = true;
    }

    if (iva.getSelectedItem() == null
        || iva.getSelectedItem().getValue() == null
        || iva.getSelectedItem().getValue().toString().isEmpty()) {
      errorIva.setErrorMessage("No se ha seleccionado el valor del IVA.");
      errorGuardar = true;
    }

    if (nombreCliente.getValue().isEmpty()) {
      nombreCliente.setErrorMessage("Favor de introducir el nombre del cliente.");
      errorGuardar = true;
    }

    if (monedaCbx.getValue() != null && monedaCbx.getValue().isEmpty()) {
      monedaCbx.setErrorMessage("Favor de seleccionar la moneda");
      errorGuardar = true;
    }

    if (!cuentaActiva.isChecked()) {
      cuentaActiva.setChecked(true);
    }

    if (!errorGuardar) {
      // if(false){
      logger.info("ContratoController: - Metodo: setCliente -- **inicio**");
      tgm138Mt101ctrato = new Tgm138Mt101ctrato();
      tgm138Mt101ctrato.setCdCuentaCheques(cuentaCheques.getValue().toUpperCase().trim());
      tgm138Mt101ctrato.setCdMoneda(new Integer(moneda.getValue()));
      tgm138Mt101ctrato.setCdCodSwRec(codigoBicRecepcion.getValue().toUpperCase().trim());
      tgm138Mt101ctrato.setCdCodSwEnv(codigoBicEnvio.getValue().toUpperCase().trim());
      tgm138Mt101ctrato.setNbEmpresa(nombreCliente.getValue().toUpperCase().trim());
      tgm138Mt101ctrato.setCdTpClienteAaa(
          ((Boolean) clienteAAA.isChecked()).toString().trim().equals("true") ? "1" : "0");
      // tgm138Mt101ctrato.setCdContrato(null);
      tgm138Mt101ctrato.setCdContratoSicoco(cdContratoSicoco.getValue().toUpperCase().trim());
      tgm138Mt101ctrato.setCdMensualidad(
          ((Boolean) mensualidad.isChecked()).toString().trim().equals("true") ? "1" : "0");
      tgm138Mt101ctrato.setCdAnualidad(
          ((Boolean) anualidad.isChecked()).toString().trim().equals("true") ? "1" : "0");
      tgm138Mt101ctrato.setCdIva(new Integer((String) iva.getSelectedItem().getValue()));
      Timestamp timestampFechaAlta = new Timestamp(fechaAlta.getValue().getTime());
      tgm138Mt101ctrato.setFhAlta(timestampFechaAlta);
      // ((Boolean)this.cuentaActiva.isChecked()).toString().trim()
      if (cuentaCheques.isReadonly()) {
        if (clientesBean.existeCodigoBicRecepcion(tgm138Mt101ctrato) == null) {
          codigoBicRecepcion.setErrorMessage("No existe el código BIC de recepción capturado.");
          errorGuardar = true;
        }
        if (!tgm138Mt101ctrato.getCdCodSwEnv().isEmpty()) {
          if (clientesBean.existeCodigoBicEnvio(tgm138Mt101ctrato) == null) {
            codigoBicEnvio.setErrorMessage("No existe el código BIC de envío capturado.");
            errorGuardar = true;
          }
        }
        if (!errorGuardar) {
          logger.debug("Actualizando cliente");
          clientesBean.actualizarCliente(tgm138Mt101ctrato);
          registraEvento("editó la cuenta " + tgm138Mt101ctrato.getCdCuentaCheques());
          cdContratoSicoco.setValue(null);
          cdContrato.setValue(null);
          cuentaCheques.setValue(null);
          moneda.setValue(null);
          monedaCbx.setValue(null);
          codigoBicRecepcion.setValue(null);
          codigoBicEnvio.setValue(null);
          nombreCliente.setValue(null);
          clienteAAA.setChecked(false);
          mensualidad.setChecked(false);
          anualidad.setChecked(false);
          cuentaActiva.setChecked(false);
          iva.setSelectedItem(null);
          cuentaCheques.setReadonly(false);
          establecerFiltroClientes();

          Messagebox.show(
              "Registro actualizado con exito!!",
              "Confirmación",
              Messagebox.OK,
              Messagebox.INFORMATION);
          this.clientes = this.getAllClientes();
          this.clientesGrid.invalidate();
        }
      } else {
        if (clientesBean.obtieneCuentaCheques(tgm138Mt101ctrato) != null) {
          cuentaCheques.setErrorMessage("El número de cuenta ya tiene servicio.");
          errorGuardar = true;
        }
        if (clientesBean.existeCodigoBicRecepcion(tgm138Mt101ctrato) == null) {
          codigoBicRecepcion.setErrorMessage("No existe el código BIC de recepción capturado.");
          errorGuardar = true;
        }
        if (!tgm138Mt101ctrato.getCdCodSwEnv().isEmpty()) {
          if (clientesBean.existeCodigoBicEnvio(tgm138Mt101ctrato) == null) {
            codigoBicEnvio.setErrorMessage("No existe el código BIC de envío capturado.");
            errorGuardar = true;
          }
        }
        if (!errorGuardar) {

          logger.debug("Registrando nuevo cliente");
          clientesBean.salvarCliente(tgm138Mt101ctrato);
          registraEvento("regsitró la cuenta " + tgm138Mt101ctrato.getCdCuentaCheques());
          cdContratoSicoco.setValue(null);
          cdContrato.setValue(null);
          cuentaCheques.setValue(null);
          moneda.setValue(null);
          monedaCbx.setValue(null);
          codigoBicRecepcion.setValue(null);
          codigoBicEnvio.setValue(null);
          nombreCliente.setValue(null);
          clienteAAA.setChecked(false);
          mensualidad.setChecked(false);
          anualidad.setChecked(false);
          cuentaActiva.setChecked(false);
          iva.setSelectedItem(null);
          cuentaCheques.setReadonly(false);
          Messagebox.show(
              "Registro guardado con exito!!",
              "Confirmación",
              Messagebox.OK,
              Messagebox.INFORMATION);
          this.clientes = this.getAllClientes();
          this.clientesGrid.invalidate();
        }
      }
    }
  }