$xTa->addTD(" ");
 } else {
     $idclave = $xOAE->getClaveDeActividad();
     $actividad = isset($DActividades[$idclave]) ? htmlentities($DActividades[$idclave]) : "";
     $actividad = strtoupper($xT->cleanString($actividad));
     $actividad = $actividad == "DESCONOCIDO_MIGRADO" ? "" : $actividad;
     $xTa->addTD($actividad);
     //$xTa->addTD( $xOAE->getPuesto(true) );
 }
 $xViv = $xSoc->getODomicilio();
 if ($xViv == null) {
     $xTa->addTD(" ");
 } else {
     $xTa->addTD(htmlentities($xViv->getDireccionBasica()));
 }
 $tel = setNoMenorQueCero($xSoc->getTelefonoPrincipal()) <= 0 ? "" : $xSoc->getTelefonoPrincipal();
 $xTa->addTD($tel);
 //apoderado
 $xTa->addTD($xSoc->getNombreDelRepresentanteLegal());
 $esPep = $xSoc->getEsPersonaPoliticamenteExpuesta() == false ? "NO" : "SI";
 $xTa->addTD($esPep);
 $esSDN = $xSoc->getEsPersonaSDN() == false ? "NO" : "SI";
 $xTa->addTD($esSDN);
 $griesgo = isset($DRiesgo[$xSoc->getNivelDeRiesgo()]) ? $DRiesgo[$xSoc->getNivelDeRiesgo()] : "";
 $xTa->addTD($griesgo);
 if ($saldoCred > 0) {
     $xTa->addTD("CREDITO");
     $xTa->addTD($xSoc->getOEstats()->getTotalCreditosActivosAutorizado());
     $xTa->addTD($saldoCred);
 } else {
     $xTa->addTD(" ");
 } else {
     $idclave = $xOAE->getClaveDeActividad();
     $actividad = isset($DActividades[$idclave]) ? htmlentities($DActividades[$idclave]) : "";
     $actividad = strtoupper($xT->cleanString($actividad));
     $actividad = $xClean->cleanEmpleo($actividad);
     $actividad = $actividad == "" ? "EMPLEADO" : $actividad;
     $xTa->addTD($actividad);
     $xTa->addTD($xOAE->getPuesto(true, $actividad));
 }
 $xViv = $xSoc->getODomicilio();
 if ($xViv == null) {
     $xTa->addTD(" ");
 } else {
     $xTa->addTD(htmlentities($xViv->getDireccionBasica()));
 }
 $xTa->addTD($xSoc->getTelefonoPrincipal());
 /*$xTa->addTH("Perfil Transaccional");*/
 $esPep = $xSoc->getEsPersonaPoliticamenteExpuesta() == false ? "NO" : "SI";
 $xTa->addTD($esPep);
 $esSDN = $xSoc->getEsPersonaSDN() == false ? "NO" : "SI";
 $xTa->addTD($esSDN);
 $griesgo = isset($DRiesgo[$xSoc->getNivelDeRiesgo()]) ? $DRiesgo[$xSoc->getNivelDeRiesgo()] : "";
 $xTa->addTD($griesgo);
 if ($saldoCred > 0) {
     $xTa->addTD("CREDITO");
     $xTa->addTD($xSoc->getOEstats()->getTotalCreditosActivosAutorizado());
     $xTa->addTD($saldoCred);
 } else {
     $xTa->addTD(" ");
     $xTa->addTD(" ");
     $xTa->addTD(" ");
 function sendAlerts($PersonaDeOrigen, $PersonaDeDestino, $TipoDeAlerta, $mensaje = "", $documento = false, $fecha = false, $hora = false, $valorDeterminado = 0, $tipo_de_docto = false, $tercero_relacionado = DEFAULT_SOCIO)
 {
     $hora = setNoMenorQueCero($hora) <= 0 ? date("Hi") : $hora;
     $fecha = $fecha == false ? fechasys() : $fecha;
     $documento = $documento == false ? DEFAULT_RECIBO : $documento;
     $tipo_de_docto = $tipo_de_docto == false ? $this->mTipoDeDocto : $tipo_de_docto;
     $this->mTipoDeDocto = $tipo_de_docto;
     $resultado = true;
     $xRsk = new cAml_risk_catalog();
     $xSuc = new cSucursal();
     $xSuc->init();
     $idnumerico = $xSuc->getClaveNumerica();
     $xRsk->setData($xRsk->query()->initByID($TipoDeAlerta));
     $riesgo = $xRsk->valor_ponderado()->v();
     $nombreRies = $xRsk->descripcion()->v();
     $claseRies = $xRsk->tipo_de_riesgo()->v();
     $valorDeterminado = $valorDeterminado == 0 ? $xRsk->valor_ponderado()->v() : $valorDeterminado;
     $xF = new cFecha();
     $fecha = $xF->getInt($fecha);
     $xAl = new cAml_alerts();
     $xAl->estado_en_sistema(SYS_UNO);
     $xAl->fecha_de_checking(SYS_CERO);
     $xAl->fecha_de_origen($fecha);
     $xAl->fecha_de_registro($xF->getInt(fechasys()));
     $xAl->hora_de_proceso($hora);
     $xAl->documento_relacionado($documento);
     $xAl->medio_de_envio(AML_ALERT_MAIL);
     $xAl->mensaje($mensaje);
     $xAl->riesgo_calificado($valorDeterminado);
     $xAl->tipo_de_aviso($TipoDeAlerta);
     $xAl->sucursal($idnumerico);
     //Verificar
     $xAl->entidad(EACP_CLAVE_CASFIN);
     //Actualizar
     $xAl->usuario(getUsuarioActual());
     $xAl->persona_de_destino($PersonaDeDestino);
     $xAl->persona_de_origen($PersonaDeOrigen);
     $xAl->tipo_de_documento($tipo_de_docto);
     $xAl->tercero_relacionado($tercero_relacionado);
     $id_de_alerta = $xAl->query()->getLastID();
     $xAl->clave_de_control($id_de_alerta);
     $ql = $xAl->query()->insert();
     $res = $ql->save();
     if (setNoMenorQueCero($res) <= 0) {
         $this->mMessages .= "ERROR\tAl guardar registro ({$idnumerico})\r\n";
         if (MODO_DEBUG == true) {
             $this->mMessages .= $ql->getMessages(OUT_TXT);
         }
         $resultado = false;
     }
     //$xCatRiesgo				= new cAml_risk_catalog();
     //$xCatRiesgo->setData( $xCatRiesgo->query()->initByID($TipoDeAlerta) );
     //
     $xCatRiesgos = new cAml_risk_catalog();
     $xCatRiesgos->setData($xCatRiesgos->query()->initByID($TipoDeAlerta));
     $nombre_riesgo = $xCatRiesgos->descripcion()->v();
     //Enviar SMS
     $xMail = new cNotificaciones();
     //obtener los datos del usuario
     $xVUser = new cVistaUsuarios();
     $xD = $xVUser->query()->initByID($PersonaDeDestino);
     $xVUser->setData($xD);
     $userP = $xVUser->codigo_de_persona()->v();
     $mailD = false;
     $telD = false;
     $xSoc = new cSocio($userP);
     if ($xSoc->existe($userP) == true) {
         $xSoc->init();
         $mailD = $xSoc->getCorreoElectronico();
         $telD = $xSoc->getTelefonoPrincipal();
     } else {
         $this->mMessages .= "ERROR\tNo existe la persona de envio {$userP}\r\n";
     }
     //Array de valores
     $arrV = array();
     $fechacorta = $xF->getFechaCorta($xF->getFechaByInt($fecha));
     $arrV["variable_documento_codigo"] = $documento;
     $arrV["variable_docto_fecha"] = $fechacorta;
     $arrV["variable_docto_hora"] = $hora;
     $arrV["variable_nivel_de_riesgo"] = $riesgo;
     $arrV["variable_tipo_de_riesgo"] = $nombreRies;
     $arrV["variable_clasificacion_de_riesgo"] = $claseRies;
     $arrV["variable_codigo_de_alerta"] = $id_de_alerta;
     $arrV["variable_mensaje_de_alerta"] = $mensaje;
     $arrV["variable_url_del_sistema"] = SAFE_HOST_URL;
     //Enviar Mail
     $xFmt = new cFormato(800);
     $xFmt->setUsuario($PersonaDeDestino);
     $xFmt->setPersona($PersonaDeOrigen);
     $xFmt->setProcesarVars($arrV);
     $txtMail = $xFmt->get();
     if ($valorDeterminado > 51 or $this->mForceAvisos == true) {
         $xMail->setTitulo(AML_TITULO_DE_ALERTA);
         $this->mMessages .= $xMail->send($txtMail, $mailD, $telD, $PersonaDeDestino, "{$fechacorta}-{$claseRies}-{$mensaje}", "aml.{$mailD}");
         if ($this->mForceRegRiesgo == true) {
             //Agregar el riesgo
             $xAlert = new cAMLAlertas($id_de_alerta);
             $regFecha = $xF->getFechaByInt($fecha);
             $xAlert->setConfirmaAlerta($mensaje, $regFecha);
             $this->mMessages .= $xAlert->getMessages();
             //$xPAML		= new cAMLPersonas($PersonaDeOrigen);
             //$xPAML->setAgregarPerfilDeRiesgo($TipoDeAlerta, $fecha, $valorDeterminado, $documento, $tipo_de_docto, $PersonaDeDestino, $hora, $tercero_relacionado, $mensaje );
             //$this->mMessages	.= $xPAML->getMessages();
         }
     }
     return $resultado;
 }
$xFRM->addSubmit();
if ($action == MQL_ADD) {
    //Agregar
    $clave = parametro($xTabla->getKey(), null, MQL_RAW);
    if ($clave != null) {
        $xTabla->setData($xTabla->query()->initByID($clave));
        $xTabla->setData($_REQUEST);
        //modificar la parte de personas asociadas
        $xTabla->gerente_sucursal($gerente);
        $xTabla->titular_de_cumplimiento($cumplimiento);
        $xTabla->clave_de_persona($persona);
        if ($ODom != null) {
            $xTabla->calle($ODom->getCalle());
            $xTabla->codigo_postal($ODom->getCodigoPostal());
            $xTabla->colonia($ODom->getColonia());
            $xTabla->telefono($xSoc->getTelefonoPrincipal());
            $xTabla->municipio($ODom->getMunicipio());
            $xTabla->localidad($ODom->getClaveDeLocalidad());
            $xTabla->estado($ODom->getEstado());
            $xTabla->numero_exterior($ODom->getNumeroExterior());
            $xTabla->numero_interior($ODom->getNumeroInterior());
        }
        $xTabla->query()->insert()->save();
        $xFRM->addAvisoRegistroOK();
    }
} else {
    if ($action == MQL_MOD) {
        //Modificar
        //iniciar
        $clave = parametro($xTabla->getKey(), null, MQL_RAW);
        if ($clave != null) {
     $DelegacionMunicipio = $xCR->getText($xLoc->DomicilioMunicipio());
     $CP = $xCR->getText($xLoc->DomicilioCodigoPostal());
     $ColoniaPoblacion = "";
     $Estado = $xCR->getText($xLoc->DomicilioEstadoClaveSIC());
     $xSuc = new cSucursal($sucres);
     if ($xSuc->init() == true) {
         $DelegacionMunicipio = $xCR->getText($xSuc->getMunicipio());
         $Estado = $xCR->getText($xSuc->getClaveDeEstadoSIC());
         $CP = $xCR->getText($xSuc->getCodigoPostal(), 5);
     }
     $xLog->add("ERROR\t{$idpersona}-{$idcredito}\t{$sucres}\tEn datos de Domicilio {$Direccion}|{$ColoniaPoblacion}|{$DelegacionMunicipio}|{$Ciudad}|{$Estado}|{$CP}|{$FechaResidencia}|{$NumeroTelefono}|{$TipoDomicilio}|{$TipoAsentamiento}|\r\n", $xLog->DEVELOPER);
 }
 $CP = $xCR->getText($CP, 5);
 $xColonia->existe($CP, "", "", true);
 $FechaResidencia = "";
 $NumeroTelefono = $xSoc->getTelefonoPrincipal();
 $TipoDomicilio = $xCR->getETipoDomicilio($ODom->getTipoDeDomicilio());
 // (isset($arrEquivTipoDom[ $xDom["tipo_domicilio"] ])) ? $arrEquivTipoDom[ $xDom["tipo_domicilio"] ] : "";
 $TipoAsentamiento = $xCR->getETipoColonia(trim($xColonia->getTipoDeAsentamiento()));
 /*
 Direccion
 ColoniaPoblacion
 DelegacionMunicipio
 Ciudad
 Estado
 CP
 FechaResidencia
 NumeroTelefono
 TipoDomicilio
 TipoAsentamiento
 */
     //10500001
     $idlocalidad = $ODom->getClaveDeLocalidad();
     //$cont[24]	= ($orels == 0) ? strtoupper($xT->cChar($ODom->getCalleConNumero(), 59)) : "";
     //$cont[25]	= ($orels == 0) ? $xT->cChar($ODom->getColonia(), 29) : "";
     //$cont[26]	= ($orels == 0) ? $xT->cSerial(8, $idlocalidad) : "";
     $cont[24] = strtoupper($xT->cChar($ODom->getCalleConNumero(), 59));
     $cont[25] = $xT->cChar($ODom->getColonia(), 29);
     $cont[26] = $idlocalidad;
     //validar la clave de localidad, si no emitir la actual
     $xMLocal = new cDomicilioLocalidad($idlocalidad);
     //TODO: Existe?
     if ($xMLocal->existe($ODom->getClaveDeLocalidad($idlocalidad)) == false) {
         $cont[26] = $xLoc->DomicilioLocalidadClave();
     }
     //$cont[27]	= ($orels == 0) ? $xSoc->getTelefonoPrincipal() : "";
     $cont[27] = $xSoc->getTelefonoPrincipal();
 }
 if ($OAEc == null) {
     $cont[28] = "8944098";
 } else {
     $xCatAct = new cPersonaActividadEconomicaCatalogo($OAEc->getClaveDeActividad());
     $clave_uif = $xCatAct->getCodigoUIF();
     $cont[28] = $clave_uif;
 }
 $cont[29] = "";
 //cuentas y o personas relacionadas
 $cont[30] = "";
 $cont[31] = "";
 $cont[32] = "";
 $cont[33] = "";
 $cont[34] = "";
 function setActualizarPorPersona()
 {
     $idpersona = $this->mClaveDePersona;
     $res = false;
     if ($idpersona != null) {
         $xSoc = new cSocio($idpersona);
         if ($xSoc->init() == true) {
             $xRel = new cSocios_relaciones();
             if ($this->mInit == true) {
                 $xRel->setData($xRel->query()->initByID($this->mID));
                 $xRel->domicilio_completo($xSoc->getDomicilio());
                 $xRel->apellido_materno($xSoc->getApellidoMaterno());
                 $xRel->apellido_paterno($xSoc->getApellidoPaterno());
                 $xRel->curp($xSoc->getCURP());
                 $xRel->fecha_nacimiento($xSoc->getFechaDeNacimiento());
                 $xRel->nombres($xSoc->getNombre());
                 $xRel->telefono_movil($xSoc->getTelefonoPrincipal());
                 $id = $xRel->query()->update()->save($this->mID);
                 if ($id == false) {
                     $this->mMessages .= "ERROR\tId " . $this->mID . "\tAl Actualizar a la Persona {$idpersona} \r\n";
                 } else {
                     $res = true;
                 }
                 //Actualizar PEP
             }
         }
     } else {
         $this->mMessages .= "ERROR\tAl cargar a la Persona {$idpersona}\r\n";
     }
     return $res;
 }
 function init($arrData = false, $credito = false, $dataPagos = false)
 {
     $fecha = $this->mFechaDeCorte;
     $credito = $credito == false ? $this->mClaveDeCredito : $credito;
     $xCred = new cCredito($credito);
     $xCred->init($arrData);
     $xCred->initPagosEfectuados($dataPagos, $fecha);
     //setLog($dataPagos);
     $xSoc = new cSocio($xCred->getClaveDePersona());
     $xSoc->init();
     $this->mInfoLinea[1] = $this->getText($this->getClaveDeOtorgante());
     $this->mInfoLinea[2] = $this->getText($this->getNombreOtorgante());
     $this->mInfoLinea[3] = $this->getFechaDeReporte();
     $this->mInfoLinea[4] = $this->getText($xSoc->getApellidoPaterno());
     $this->mInfoLinea[5] = $this->getText($xSoc->getApellidoMaterno());
     $this->mInfoLinea[6] = "";
     $nombres = explode(" ", $xSoc->getNombre(), 2);
     $this->mInfoLinea[7] = isset($nombres[SYS_CERO]) ? $this->getText($nombres[SYS_CERO]) : "";
     $this->mInfoLinea[8] = isset($nombres[SYS_UNO]) ? $this->getText($nombres[SYS_UNO]) : "";
     $this->mInfoLinea[9] = $this->getDate($xSoc->getFechaDeNacimiento());
     $this->mInfoLinea[10] = $this->getText($xSoc->getRFC());
     $this->mInfoLinea[11] = isset($this->mTituloPersonal[$xSoc->getTipoGenero()]) ? $this->mTituloPersonal[$xSoc->getTipoGenero()] : "";
     //Hiber Tadeo
     $this->mInfoLinea[12] = $this->getEstadoCivil($xSoc->getEstadoCivil());
     $this->mInfoLinea[13] = $this->mEquivGenero[$xSoc->getTipoGenero()];
     //TODO: terminar defuncion/muerte de la persona
     $this->mInfoLinea[14] = "";
     $this->mInfoLinea[15] = "";
     $xDom = $xSoc->getODomicilio();
     if ($xDom == null) {
         for ($i = 16; $i <= 23; $i++) {
             $this->mInfoLinea[$i] = "";
         }
     } else {
         $this->mInfoLinea[16] = $this->getText($xDom->getCalleConNumero());
         $this->mInfoLinea[17] = "";
         $this->mInfoLinea[18] = $this->getText($xDom->getColonia());
         $this->mInfoLinea[19] = $this->getText($xDom->getMunicipio());
         $this->mInfoLinea[20] = $this->getText($xDom->getCiudad());
         $this->mInfoLinea[21] = $this->getText($xDom->getClaveDeEstadoEnSIC());
         $this->mInfoLinea[22] = $this->getText($xDom->getCodigoPostal());
         $xTel = $xSoc->getTelefonoPrincipal();
         //Hiber Tadeo
         $this->mInfoLinea[23] = $xTel == 0 ? "" : $xTel;
         //Hiber Tadeo
     }
     $xAE = $xSoc->getOActividadEconomica();
     if ($xAE == null) {
         $this->mInfoLinea[24] = $this->getText($xSoc->getRFC(true));
         //Para Finsureste debe de ser este RFC del cliente
         $this->mInfoLinea[33] = 0;
     } else {
         $this->mInfoLinea[24] = $this->getText($xSoc->getRFC(true));
         //Para Finsureste debe de ser este RFC del cliente//$this->getText($xAE->getNombreEmpresa());
         $this->mInfoLinea[33] = $this->getText($xDom->getCalleConNumero());
         //Para Finsureste debe de ser direccion del cliente //Hiber Tadeo Aca es direccion
     }
     //direccion 2
     $this->mInfoLinea[25] = "";
     $this->mInfoLinea[26] = $this->getText($xDom->getColonia());
     //Para Finsureste
     $this->mInfoLinea[27] = $this->getText($xDom->getMunicipio());
     //Para Finsureste
     $this->mInfoLinea[28] = $this->getText($xDom->getCiudad());
     //Para Finsureste
     $this->mInfoLinea[29] = $this->getText($xDom->getClaveDeEstadoEnSIC());
     //Para Finsureste
     $this->mInfoLinea[30] = $this->getText($xDom->getCodigoPostal());
     //Para Finsureste
     $this->mInfoLinea[31] = $xTel == 0 ? "" : $xTel;
     //Hiber Tadeo  //Para Finsureste
     $this->mInfoLinea[32] = "";
     $this->mInfoLinea[34] = $this->getClaveDeOtorgante();
     $this->mInfoLinea[35] = $this->getText($this->getNombreOtorgante());
     $this->mInfoLinea[36] = $xCred->getNumeroDeCredito();
     $this->mInfoLinea[38] = $this->getTipoDeCuenta($xCred->getTipoDePago());
     //datos del convenio
     $DConv = $xCred->getOProductoDeCredito();
     $this->mInfoLinea[37] = $this->getTipoDeResponsabilidad($DConv->getTipoDeIntegracion());
     $this->mInfoLinea[39] = $DConv->getTipoDeContratoCR();
     //"PL";//$DConv->getTipoDeContratoCR(); //Hiber Tadeo CL=LINEA DE CREDITO PL=PRESTAMO PERSONAL
     $this->mInfoLinea[40] = AML_CLAVE_MONEDA_LOCAL;
     //TODO: mejorar
     $this->mInfoLinea[41] = $xCred->getPagosAutorizados();
     if ($xCred->getTipoEnSistema() == CREDITO_PRODUCTO_NOMINA) {
         //TODO: Parchar con el de TADEO
         $this->mInfoLinea[42] = "P";
     } else {
         $this->mInfoLinea[42] = $this->mEquivFrecPagos[$xCred->getPeriocidadDePago()];
     }
     $this->mInfoLinea[43] = $this->getDate($xCred->getFechaDeMinistracion());
     $this->mInfoLinea[44] = $this->getMonto($xCred->getMontoDeParcialidad());
     $this->mInfoLinea[45] = $this->getDate($xCred->getFechaUltimoDePago());
     $this->mInfoLinea[46] = $this->getDate($xCred->getFechaDeMinistracion());
     $this->mInfoLinea[47] = "";
     //$this->getDate("2029-12-31" );
     if ($xCred->getSaldoActual($fecha) <= TOLERANCIA_SALDOS) {
         $this->mInfoLinea[47] = $this->getDate($xCred->getFechaUltimoDePago());
     }
     $this->mInfoLinea[48] = $this->getFechaDeReporte();
     $DCapacidad = $xSoc->getOCapacidadDePago();
     $this->mInfoLinea[49] = $this->getMonto($DCapacidad->getMontoDeCreditoMaximo());
     $this->mInfoLinea[50] = $this->getMonto($xCred->getSaldoIntegrado($fecha));
     //$xCred->getSaldoActual();
     $this->mInfoLinea[51] = $this->getMonto($DCapacidad->getLimiteDeCredito());
     $this->mInfoLinea[52] = $this->getMonto($xCred->getSaldoVencido());
     //53 numero de pagos vencidos
     $this->mInfoLinea[53] = 0;
     //54 forma mop
     $this->mInfoLinea[54] = $xCred->getMOP($fecha);
     // ($this->mOut == OUT_CSV) ? "01" : "'01";
     //55 clave de observacion, segun catalogo
     $this->mInfoLinea[55] = "";
     //56 clave de otorgante anterior
     //57 nombre otorgante anterior
     $this->mInfoLinea[56] = "";
     $this->mInfoLinea[57] = "";
     $this->mInfoLinea[58] = "";
     //Numero de cuenta anterior en caso de cartera tranferida
     $this->mInfoLinea[59] = $xCred->getFechaDePrimerAtraso() == null ? "" : $this->getDate($xCred->getFechaDePrimerAtraso());
     //TODO: Fecha de Primera atraso
     $this->mInfoLinea[60] = $this->getMonto($xCred->getSaldoActual($fecha));
     //Saldo Insoluto del Principal
     $this->mInfoLinea[61] = $this->getMonto($xCred->getMontoUltimoPago());
     // $xCred->getMontoDeParcialidad();//0; //TODO: Monto de Ultimo pago
     if (MODO_DEBUG == true) {
         $this->mMessages .= $xCred->getMessages(OUT_TXT);
     }
 }
 function setProcesarProgramacion($id, $arrVars = false, $data = false, $fecha = false)
 {
     $xF = new cFecha();
     $xT = new cTipos();
     $xLog = new cCoreLog();
     $arrVars = $arrVars == false ? $this->mArrVars : $arrVars;
     //idprograma, nombre_del_aviso, forma_de_creacion, programacion, destinatarios, microformato, tipo_de_medios, intent_check, intent_command
     $sql = "SELECT *\tFROM sistema_programacion_de_avisos WHERE idprograma={$id} LIMIT 0,1";
     $d = $data == false ? obten_filas($sql) : $data;
     $mOb = new cSistema_programacion_de_avisos();
     $mOb->setData($d);
     $emails = array();
     $tels = array();
     $enviar = false;
     $fecha = $fecha == false ? fechasys() : $fecha;
     $nombredia = $xF->getDayName();
     $diadelmes = date("j", $xF->getInt());
     $EnviarNota = true;
     $EnviarMail = true;
     $EnviarSMS = false;
     $xLoc = new cLocal();
     //procesar cuerpo del contenido
     $arrVars["fecha"] = !isset($arrVars["fecha"]) ? $fecha : $arrVars["fecha"];
     $arrVars["fecha_dia_siguiente"] = $xF->setSumarDias(1, $fecha);
     $arrVars["fecha_inicio_de_semana"] = $xF->getFechaDeInicioDeSemana($fecha);
     $arrVars["fecha_inicio_de_mes"] = $xF->getDiaInicial($fecha);
     //Dia de la semana inicial
     $arrVars["hora"] = date("H");
     $arrVars["usuario"] = $xLoc->getNombreUsuario();
     $arrVars["clave_de_usuario"] = !isset($arrVars["clave_de_usuario"]) ? getUsuarioActual() : $arrVars["clave_de_usuario"];
     //interpretar DIA
     if (strtoupper($mOb->forma_de_creacion()->v()) == SYS_ALERTA_POR_EVENTO) {
         $enviar = true;
     } else {
         //if($mOb->programacion())
         $programacion = strtoupper($mOb->programacion()->v());
         $periodo = explode(":", $programacion);
         //INTERPRETAR DIA
         if ($periodo[0] == "PROGRAMACION_SEMANAL") {
             if (strpos($nombredia, $programacion) !== false) {
                 $enviar = true;
             }
         } else {
             if ($periodo[0] == "PROGRAMACION_DIARIA") {
                 $enviar = true;
             } else {
                 if (isset($periodo[1])) {
                     $dias = explode(",", $periodo[1]);
                     foreach ($dias as $dias => $iddia) {
                         $mes = $xF->mes();
                         $anno = $xF->anno();
                         if (date("Y-m-d", strtotime("{$anno}-{$mes}-{$iddia}")) == $fecha) {
                             $enviar = true;
                         }
                     }
                 }
             }
         }
     }
     //1.- extraer emails
     $destinatarios = explode("|", $mOb->destinatarios()->v());
     foreach ($destinatarios as $key => $cnt) {
         if (trim($cnt) != "") {
             //1.1 Desfragmentar destinos
             $DS = explode(":", $cnt);
             $mdestino = isset($DS[0]) ? strtoupper($DS[0]) : "";
             switch ($mdestino) {
                 case "OFICIALES":
                     if (isset($DS[1])) {
                         $oficiales = explode(",", $DS[1]);
                         foreach ($oficiales as $ofc => $ofkey) {
                             $xOf = new cOficial($ofkey);
                             $xOf->init();
                             $mail = $xOf->getEmail();
                             $emails[] = $mail;
                             $xLog->add("OK\tOFICIAL\tAgregar mail {$mail}  \r\n", $xLog->DEVELOPER);
                         }
                     }
                     break;
                 case "EMPRESAS":
                     if (isset($DS[1])) {
                         $empresas = explode(",", $DS[1]);
                         foreach ($empresas as $emp => $empkey) {
                             $xEmp = new cEmpresas($empkey);
                             $xEmp->init();
                             //$mail		= $xEmp->getEmailsDeEnvio();
                             //$emails[]	= $mail;
                             $emails = array_merge($emails, $xEmp->getEmailsDeEnvio());
                             $xLog->add("OK\tEMPRESAS\tAgregar mail de la empresa {$empkey}  \r\n", $xLog->DEVELOPER);
                         }
                     }
                     break;
                 case "PERSONAS":
                     if (isset($DS[1])) {
                         $personas = explode(",", $DS[1]);
                         foreach ($personas as $ofc => $ofkey) {
                             $xSoc = new cSocio($ofkey);
                             $xSoc->init();
                             $mail = $xSoc->getCorreoElectronico();
                             $emails[] = $mail;
                             $xLog->add("OK\tPERSONA\tAgregar mail {$mail}  \r\n", $xLog->DEVELOPER);
                             if ($xT->cNumeroTelefonico($xSoc->getTelefonoPrincipal()) != false) {
                                 $EnviarSMS = true;
                                 $tels[] = $xT->cNumeroTelefonico($xSoc->getTelefonoPrincipal());
                             }
                         }
                     }
                     break;
                 case "CORREO":
                     if (isset($DS[1])) {
                         $personas = explode(",", $DS[1]);
                         foreach ($personas as $ofc => $ofkey) {
                             if (filter_var($ofkey, FILTER_VALIDATE_EMAIL)) {
                                 $emails[] = $ofkey;
                             }
                             $xLog->add("OK\tCORREO\tAgregar mail {$ofkey}  \r\n", $xLog->DEVELOPER);
                         }
                     }
                     break;
             }
             //1.1.1 Validar oficiales, empresas, personas
             //if(strpos("OFICIALES:", $needle))
         }
     }
     $this->mMessages .= $xLog->getMessages();
     $texto = $mOb->microformato()->v();
     foreach ($arrVars as $variable => $valor) {
         $texto = str_replace("{" . $variable . "}", $valor, $texto);
     }
     if ($enviar == true) {
         $url = $mOb->intent_command()->v(OUT_TXT);
         //2 procesado del comando
         if (trim($url) == "") {
             $titulo = strtoupper($mOb->nombre_del_aviso()->v());
             $xNot = new cNotificaciones();
             //enviar mail normal
             if ($EnviarSMS == true) {
                 foreach ($tels as $pitm => $ptel) {
                     $xNot->sendSMS($ptel, $texto);
                 }
             }
             if ($EnviarMail == true) {
                 foreach ($emails as $itm => $pmail) {
                     $xNot->sendMail($titulo, $texto, $pmail);
                 }
             }
         } else {
             //execute command
             //rpttesoreria/corte_de_caja.rpt.php?on=2014-5-3&off=2014-5-3&cajero=todas&dependencia=todas
             $smail = "";
             $xHO = new cHObject();
             foreach ($arrVars as $variable => $valor) {
                 $url = str_replace("{" . $variable . "}", $valor, $url);
             }
             foreach ($emails as $id => $rmail) {
                 //$smail	.= ($smail == "") ? "email$id=$rmail" : "&email$id=$rmail";
                 $smail .= "&email{$id}={$rmail}";
             }
             //Iniciar session en contexto &on=$fecha&off=$fecha
             $xSysUser = new cSystemUser();
             $xSysUser->init();
             $url = $url . $smail . "&ctx=" . $xSysUser->getCTX();
             if (MODO_DEBUG == true) {
                 setLog($url);
             }
             $xHO->navigate($url);
         }
     } else {
         $this->mMessages .= "OK\tNo e envia el reporte\r\n";
     }
     setLog($this->mMessages);
     $this->mObProgAv = $mOb;
     //return $this->mObProgAv;
 }
function jsaGetDatosDePersona($persona)
{
    $xSoc = new cSocio($persona);
    $xSoc->init();
    $sucess = true;
    $telefono = "";
    $domicilio = "";
    $telefonomovil = "";
    $nombre = "";
    $appPaterno = "";
    $appMaterno = "";
    $NDia = "";
    $NMes = "";
    $NAnno = "";
    $actividad = "";
    /**
     * Si el Numero de Socio es menor a 5 digitos
     */
    $DDom = $xSoc->getDatosDomicilio();
    $telefono = $xSoc->getTelefonoPrincipal();
    $nombre = $xSoc->getNombre();
    $appPaterno = $xSoc->getApellidoPaterno();
    $appMaterno = $xSoc->getApellidoMaterno();
    $curp = $xSoc->getCURP();
    $FNacimiento = $xSoc->getFechaDeNacimiento();
    $DOcup = $xSoc->getDatosActividadEconomica();
    $actividad = $DOcup["puesto"];
    $socio = $xSoc->getCodigo();
    $tab = new TinyAjaxBehavior();
    if ($sucess == true) {
        $tab->add(TabSetvalue::getBehavior("telefono", $telefono));
        $tab->add(TabSetvalue::getBehavior("nombre", $nombre));
        $tab->add(TabSetvalue::getBehavior("paterno", $appPaterno));
        $tab->add(TabSetvalue::getBehavior("materno", $appMaterno));
        $tab->add(TabSetvalue::getBehavior('curp', $curp));
        $tab->add(TabSetvalue::getBehavior("ocupacion", $actividad));
        $tab->add(TabSetvalue::getBehavior("ingreso", $xSoc->getIngresosMensuales()));
        //$tab->add(TabSetvalue::getBehavior("personarelacionada", $persona));
        // "idnombrecolonia" "identidadesfederativas"
        if ($xSoc->getODomicilio() == null) {
        } else {
            $tab->add(TabSetvalue::getBehavior("idnombrecolonia", $DDom["colonia"]));
            $tab->add(TabSetvalue::getBehavior("idnombreacceso", $DDom["calle"]));
            $tab->add(TabSetvalue::getBehavior("idnumeroexterior", $DDom["numero_exterior"]));
            $tab->add(TabSetvalue::getBehavior("idcodigopostal", $DDom["codigo_postal"]));
            if (PERSONAS_VIVIENDA_MANUAL == true) {
                $tab->add(TabSetvalue::getBehavior("idnombrelocalidad", $DDom["localidad"]));
                $tab->add(TabSetvalue::getBehavior("idnombremunicipio", $DDom["municipio"]));
            } else {
            }
        }
    }
    //$tab -> add(TabSetvalue::getBehavior('idObservaciones', $xSoc->getMessages() ));
    return $tab->getString();
}