/**
  * Valida la Cuenta de Captacion
  * @param boolean $ForzarCorreccion
  */
 function setValidar($ForzarCorreccion = false)
 {
     $arrUp = array();
     $DC = $this->getDatosInArray();
     $socio = $this->mSocioTitular;
     $cuenta = $this->mNumeroCuenta;
     $grupo = $this->mGrupoAsociado;
     $sucursal = $DC["sucursal"];
     $user = $DC["idusuario"];
     $oficial = $DC["oficial_de_captacion"];
     $credito = $DC["numero_solicitud"];
     $FApertura = $DC["fecha_apertura"];
     $FAfecta = $DC["fecha_afectacion"];
     //Fecha Valida
     $FechaValida = true;
     $msg = "VALIDAR CUENTA {$cuenta}\r\n";
     //Datos propios de la Inversion
     $FVencInv = $DC["inversion_fecha_vcto"];
     $DiasInv = $DC["dias_invertidos"];
     $TCuenta = $DC["tipo_cuenta"];
     //Cuenta de Intereses
     $CtaInts = $DC["cuenta_de_intereses"];
     //Datos producto
     $xDT = new cInformacionProductoCaptacion($TCuenta);
     $DT = $xDT->init();
     //validar socios
     $xSoc = new cSocio($socio);
     if ($xSoc->existe($socio) == false) {
         $msg .= "CRITICO\tSOCIO\tEl Socio {$socio} no EXISTE \r\n";
         if ($ForzarCorreccion == true) {
             $xSoc->add("SOCIO_CUENTA_{$cuenta}");
             $msg .= "NUEVO\tSOCIO\tAgregado el Socio {$socio}\r\n";
         }
     }
     //validar grupo
     if ($grupo == false or $grupo == 0) {
         $arrUp["numero_grupo"] = DEFAULT_GRUPO;
         $msg .= "ERROR\tGRUPO\tEl Grupo {$grupo} No es Valido, se actualiza al default \r\n";
     } else {
         //Controlar Grupo
         $xGrp = new cGrupo($grupo);
         if ($xGrp->existe($grupo) == false) {
             $msg .= "CRITICO\tGRUPO\tEl Grupo {$grupo} no EXISTE \r\n";
             if ($ForzarCorreccion == true) {
                 $xGrp->add("GRUPO_CUENTA_{$cuenta}", "", false, false, 10, 1, $grupo, $sucursal);
                 $msg .= "NUEVO\tGRUPO\tSe Agrego el Grupo {$grupo} \r\n";
             }
         }
     }
     //Restaurar Credito
     if ($credito != DEFAULT_CREDITO) {
         $arrUp["numero_solicitud"] = DEFAULT_CREDITO;
     }
     //
     //Controlar Usuario
     $xUsr = new cSystemUser($user);
     if ($xUsr->existe($user) == false) {
         $msg .= "CRITICO\tUSUARIO\tEl Usuario {$user} no EXISTE \r\n";
         if ($ForzarCorreccion == true) {
             $xUsr->add("usr{$user}", "", 2, "USR_CTA_{$cuenta}", "", "", "", false, "baja", "", $sucursal, $user);
             $msg .= "NUEVO\tUSUARIO\tSe Agrego el Usuario {$user} \r\n";
         }
     }
     //Controlar Oficial de Captacion
     if ($xUsr->existe($oficial) == false) {
         $msg .= "ERROR\tOFICIAL\tEl Oficial de Captacion {$oficial} no EXISTE \r\n";
         if ($ForzarCorreccion == true) {
             $xUsr->add("usr{$oficial}", "", 2, "OFICIAL_CTA_{$cuenta}", "", "", "", false, "baja", "", $sucursal, $oficial);
             $msg .= "NUEVO\tOFICIAL\tSe Agrego el OFICIAL {$oficial} \r\n";
         }
     }
     if ($FApertura == '0000-00-00') {
         $msg .= "WARN\tLa fecha de Apertura {$FApertura} es INVALIDA\r\n";
         $arrUp["fecha_apertura"] = fechasys();
         $FechaValida = false;
     }
     if ($FAfecta == '0000-00-00') {
         $msg .= "WARN\tLa fecha de Afectacion {$FAfecta} es INVALIDA\r\n";
         $arrUp["fecha_afectacion"] = fechasys();
         $FechaValida = false;
     }
     //Validar las fechas
     if ($FechaValida == true) {
         if (strtotime($FApertura) > strtotime($FAfecta)) {
             $msg .= "WARN\tLa fecha de Apertura {$FApertura} es mayor a la de operaciones {$FAfecta}\r\n";
             $arrUp["fecha_apertura"] = $FAfecta;
         }
     }
     //Validar las funciones del Subproducto
     if ($ForzarCorreccion == true) {
         //Guardar Cambios
         $this->setUpdate($arrUp);
         return $msg;
     }
 }
 function addToGrupos($clave_de_presidente, $clave_de_vocal = false, $sucursal = false, $fecha = false)
 {
     $xGpo = new cGrupo(false);
     //$nombre, $direccion = "", $representante = false, $vocal_de_vigilancia = false, $estatus = 10, $nivel = 1, $numero = false, $sucursal = false, $fecha = false, $clave_de_persona = false
     $xPViv = new cPersonasVivienda($clave_de_presidente);
     $xPViv->init();
     $dom = "";
     if ($xPViv->isInit() == true) {
         $xPViv->setDuplicarDomicilio($this->mCodigo);
         //duplicar
         $dom = $xPViv->getDireccionBasica();
     } else {
         $this->mMessages .= "WARN\tError en la carga de domicilio\r\n";
     }
     $add = $xGpo->add($this->getNombreCompleto(), $dom, $clave_de_presidente, $clave_de_vocal, 10, 1, $this->getCodigo(), $sucursal, $fecha, $this->getCodigo());
     if ($add == false) {
         $this->mMessages .= "ERROR\tError No se agrego el grupo\r\n";
         if (MODO_DEBUG == true) {
             $this->mMessages .= $xGpo->getMessages();
         }
     } else {
         $xGpo->init();
         $this->mObjGrupoS = $xGpo;
     }
     return $add;
 }