function getSimilaresPorNombre($nombre = "", $apellido1 = "", $apellido2 = "", $soloBusqueda = false)
 {
     if ($nombre == "") {
         $xSoc = $this->getOPersona();
         // new cSocio($this->mClaveDePersona);
         $nombre = $xSoc->getNombre();
         $apellido1 = $xSoc->getApellidoPaterno();
         $apellido2 = $xSoc->getApellidoMaterno();
     }
     $nombre = strtoupper($nombre);
     $apellido1 = strtoupper($apellido1);
     $PersonaDeOrigen = $this->getCodigoDePersona();
     $xPO = $this->getOPersona();
     $NombreDeOrigen = $xPO->getNombreCompleto();
     $snom = substr($nombre, 0, 3);
     $sapp1 = substr($apellido1, 0, 3);
     $apellido2 = strtoupper($apellido2);
     $sapp2 = substr($apellido2, 0, 3);
     $sql = "SELECT * FROM socios_general WHERE (`socios_general`.`nombrecompleto` LIKE '%{$snom}%') ";
     if ($apellido1 != "") {
         $sql = "  AND (`socios_general`.`apellidopaterno` LIKE '%{$sapp1}%') ";
     }
     if ($apellido2 != "") {
         $sql .= " AND (`socios_general`.`apellidomaterno` LIKE '%{$sapp2}%') ";
     }
     $this->mMessages .= "WARN\tBuscando similitudes para {$nombre} {$apellido1} {$apellido2} \r\n";
     $xPer = new cSocios_general();
     $xMql = new MQL();
     $data = $xMql->getDataRecord($sql);
     foreach ($data as $rows) {
         $xPer->setData($rows);
         $PersonaCoincide = $xPer->codigo()->v();
         $PersonaDeDestino = AML_OFICIAL_DE_CUMPLIMIENTO;
         $TipoDeAlerta = 901002;
         $minimo = 90;
         $parecido = 0;
         $mNombre = strtoupper($xPer->nombrecompleto()->v());
         $mApp1 = strtoupper($xPer->apellidopaterno()->v());
         $mApp2 = strtoupper($xPer->apellidomaterno()->v());
         $divisor = 1;
         $parecido_a2 = 0;
         $parecido_a1 = 0;
         similar_text($mNombre, $nombre, $parecido_n);
         similar_text($mApp1, $apellido1, $parecido_a1);
         if ($apellido1 != "") {
             similar_text($mApp1, $apellido1, $parecido_a1);
             $divisor = 2;
             $minimo = 80;
         }
         if ($apellido2 != "") {
             similar_text($mApp2, $apellido2, $parecido_a2);
             $divisor = 3;
             $minimo = 70;
         }
         $parecido = ($parecido_n + $parecido_a1 + $parecido_a2) / $divisor;
         if ($parecido > 51) {
             if ($parecido >= $minimo) {
                 $xAML = new cAML();
                 $xSocP = new cSocio($PersonaCoincide);
                 $xSocP->init();
                 $origenN = $xSocP->getNombreCompleto();
                 $mensaje = "{$NombreDeOrigen} .- Concidencia({$mNombre}|{$mApp1}|{$mApp2}) del {$parecido} con la persona {$origenN} ";
                 if ($xSocP->getEsPersonaSDN() == true) {
                     //aviso inminente
                     $xAML->setForceRegistroRiesgo();
                     $xAML->setForceAlerts();
                     $xAML->sendAlerts($PersonaDeOrigen, $PersonaDeDestino, 901002, $mensaje);
                 } elseif ($xSocP->getEsPersonaPoliticamenteExpuesta() == true) {
                     //enviar a oficial de cumplimiento
                     $xAML->setForceAlerts();
                     $xAML->sendAlerts($PersonaDeOrigen, $PersonaDeDestino, 901010, $mensaje);
                     //registro pep
                 } else {
                     //enviar a oficial de cumplimiento
                     $xAML->setForceAlerts();
                     $xAML->sendAlerts($PersonaDeOrigen, $PersonaDeDestino, 901010, $mensaje);
                     //registro pep
                 }
                 $this->mMessages .= $xSocP->getMessages();
                 $this->mMessages .= $xAML->getMessages();
             } else {
                 $this->mMessages .= "WARN\tEl parecido con {$mNombre} {$mApp1} {$mApp2} es {$parecido} %\r\n";
             }
         }
     }
 }
//$xT		= new cTabla($sql, 2);
//$xT->setTipoSalida($out);
$body = $xRPT->getEncabezado($xHP->getTitle(), $FechaInicial, $FechaFinal);
$xRPT->setBodyMail($body);
$xRPT->addContent($body);
$xCats = new cCatalogoDeDatos("");
$DActividades = $xCats->get("clave_interna", "nombre_de_la_actividad", "personas_actividad_economica_tipos");
$DGenero = $xCats->get("idsocios_genero", "descripcion_genero", "socios_genero");
$DPaises = $xCats->initPorTabla(TCATALOGOS_PAISES);
$DRiesgo = $xCats->initPorTabla(TCATALOGOS_GRADO_RIESGO);
//$xT->setEventKey("jsGoPanel");
//$xT->setKeyField("creditos_solicitud");
$sql = $xL->getInicialDePersonas() . " WHERE (`personalidad_juridica` = 2 OR `personalidad_juridica` = 5)";
$rs = $query->getDataRecord($sql);
$xTa = new cHTabla();
$xDSoc = new cSocios_general();
$xF = new cFecha();
$xTa->initRow();
$xTa->addTH("Sucursal");
$xTa->addTH("Nombre");
$xTa->addTH("Fecha de Constitucion");
$xTa->addTH("Nacionalidad");
$xTa->addTH("RFC");
$xTa->addTH("Actividad economica");
//$xTa->addTH("Puesto o Ocupacion");
$xTa->addTH("Direccion");
$xTa->addTH("Telefono Principal");
$xTa->addTH("Apoderado");
$xTa->addTH("Es PEP");
$xTa->addTH("Lista Negra");
$xTa->addTH("Grado de Riesgo");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
//=====================================================================================================
$xInit = new cHPage("", HP_SERVICE);
$txt = "";
$svc = new MQLService("", "");
$ql = new MQL();
$data = isset($_REQUEST["data"]) ? $svc->getDecryptData($_REQUEST["data"]) : null;
$command = isset($_REQUEST["cmd"]) ? $svc->getDecryptData($_REQUEST["cmd"]) : null;
//$context	= (isset($_REQUEST["ctx"])) ? $svc->getDecryptData($_REQUEST["ctx"]) : null;
$cnt = "";
//setLog("$data $command");
switch ($command) {
    case TPERSONAS_GENERALES:
        $xSoc = new cSocios_general();
        $xSoc->setData($xSoc->query()->initByID($data));
        $cnt = $svc->getEncryptData(json_encode($xSoc->query()->getCampos()));
        //setLog(json_encode($xSoc->query()->getCampos()));
        break;
    case TPERSONAS_DIRECCIONES:
        $xDom = new cSocios_vivienda();
        $D = obten_filas("SELECT * FROM socios_vivienda WHERE socio_numero = {$data} ORDER BY fecha_alta DESC LIMIT 0,1");
        $xDom->setData($D);
        //setLog("SELECT * FROM socios_vivienda WHERE socio_numero = $data ORDER BY fecha_alta DESC LIMIT 0,1");
        //$value = mb_check_encoding($value, 'UTF-8') ? $value : utf8_encode($value);
        //$comment = iconv('UTF-8', 'UTF-8//IGNORE', $comment);
        //SELECT column1, CONVERT(column2 USING utf8)
        $query = $xDom->query();
        $query->setToUTF8();
        //setLog(json_encode($query->getCampos()) );
$messages .= "=========================\t\t" . EACP_NAME . " \r\n";
$messages .= "=========================\t\t" . getSucursal() . " \r\n";
$messages .= "=======================================================================================\r\n";
$messages .= "=========================\t\tINICIANDO EL CIERRE DE RIESGOS ===================\r\n";
$messages .= "=========================\t\tRECIBO: {$idrecibo}\t\t\t\t   ====================\r\n";
$messages .= "=======================================================================================\r\n";
if (MODULO_AML_ACTIVADO == true) {
    $mql = new MQL();
    //crear arbol de relaciones
    $xUtils = new cPersonas_utils();
    $xUtils->setCrearArbolRelaciones();
    //Validar perfiles transaccionales
    //Validar Documentos
    //TODO: Agregar cierre de riesgos
    //checar documentos de todos los socios
    $OSoc = new cSocios_general();
    $rs = $OSoc->query()->select()->exec();
    foreach ($rs as $data) {
        $OSoc->setData($data);
        $xAml = new cAMLPersonas($OSoc->codigo()->v());
        $xAml->init();
        //$xAml->setForceAlerts();
        $xAml->setVerificarDocumentosCompletos($fechaop);
        $xAml->setVerificarDocumentosVencidos($fechaop);
        $messages .= $xAml->getMessages(OUT_TXT);
        /*$xAml	= new cAML();
        		$xAml->setForceAlerts(true);
        		$xAml->sendAlerts(getUsuarioActual(), $PersonaDeDestino, $TipoDeAlerta);*/
        //envio de informes
        //TODO: Agregar envio de informes
        //checar perfil transaccional mensual
 function getImportarDesdeAsociada($tipo)
 {
     $result = true;
     $svc = new MQLService("", "");
     $cmd = $svc->getEncryptData($tipo);
     $xTu = new cSystemUser(TASK_USR, false);
     $xTu->init();
     $ctx = $xTu->getCTX();
     $data = $svc->getEncryptData($this->mCodigo);
     $host = SVC_ASOCIADA_HOST;
     switch ($tipo) {
         case TPERSONAS_GENERALES:
             $dpersona = $svc->getService($host . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
             if (is_array($dpersona)) {
                 $xSoc = new cSocios_general($dpersona);
                 if (setNoMenorQueCero($xSoc->codigo()->v()) > 0) {
                     $xSoc->query()->insert()->save();
                     $result = true;
                 }
             }
             break;
         case TPERSONAS_DIRECCIONES:
             $ddomicilio = $svc->getService($host . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
             if (is_array($ddomicilio)) {
                 $xDom = new cSocios_vivienda($ddomicilio);
                 if (setNoMenorQueCero($xDom->idsocios_vivienda()->v())) {
                     $xDom->query()->insert()->save();
                     $result = true;
                 }
             }
             break;
         case TPERSONAS_ACTIVIDAD_ECONOMICA:
             $dtrabajo = $svc->getService($host . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
             if (is_array($dtrabajo)) {
                 $xTrab = new cSocios_aeconomica($dtrabajo);
                 if (setNoMenorQueCero($xTrab->idsocios_aeconomica()->v())) {
                     $xTrab->query()->insert()->save();
                     $result = true;
                 }
             }
             break;
         case TCATALOGOS_EMPRESAS:
             $dempresa = $svc->getService($host . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
             if (is_array($dempresa)) {
                 $xEmp = new cSocios_aeconomica_dependencias($dempresa);
                 if (setNoMenorQueCero($xEmp->idsocios_aeconomica_dependencias()->v())) {
                     $xEmp->query()->insert()->save();
                     $result = true;
                 }
             }
             break;
     }
     return $result;
 }
//<=====	FIN_H
//=====================================================================================================
$xP = new cHPage("Pruebas de Fechas", HP_FORM);
echo $xP->getHeader();
echo $xP->setBodyinit();
//Crear formularios
$xFRM = new cHForm("frmTest", "./test.php");
$xHTxt = new cHText("");
$xHChk = new cHCheckBox();
$xFRM->setTitle("TR.Pruebas HTML");
//$xFRM->addHTML("<p>Esto es un parrafo de prueba</p>");
$xFRM->addHElem($xHChk->get("id1"));
$xFRM->addHElem($xHChk->get("id2"));
$xFRM->addHElem($xHChk->get("id3"));
$xFRM->addHElem($xHChk->get("id4"));
$xSoc = new cSocios_general();
$xSoc->setData($xSoc->query()->initByID(DEFAULT_SOCIO));
var_dump($xSoc->query()->getCampos());
//$xFRM->addAviso( $xSoc->query()->getListaDeCampos() );
$xFRM->OMoneda("ix", 4500, convertirletras("4,455.05"));
$xFRM->OMoneda("ix", 4500, convertirletras("4454.455.05"));
$xFRM->OMoneda("ix", 4500, convertirletras(45000));
//echo $xFRM->get();
$xTabla = new cCreditos_tipoconvenio();
$xFRM = new cHForm("frmcreditos_tipoconvenio", "creditos_tipoconvenio");
$xFRM->addSubmit();
$xEmp = new cEmpresas(100);
$xEmp->init();
if ($xEmp->getOPersona() == null) {
    $xFRM->OText("idper", "SIN PERSONA", "TR.Persona");
} else {
$xInit = new cHPage("", HP_SERVICE);
$txt = "";
$svc = new MQLService("", "");
$ql = new MQL();
$data = isset($_REQUEST["data"]) ? $_REQUEST["data"] : null;
$command = isset($_REQUEST["cmd"]) ? $svc->getDecryptData($_REQUEST["cmd"]) : null;
//$context	= (isset($_REQUEST["ctx"])) ? $svc->getDecryptData($_REQUEST["ctx"]) : null;
$xTu = new cSystemUser(TASK_USR, false);
$xTu->init();
$ctx = $xTu->getCTX();
$cmd = $svc->getEncryptData($command);
switch ($command) {
    case TPERSONAS_GENERALES:
        $dpersona = $svc->getService(SVC_ASOCIADA_HOST . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
        if (is_array($dpersona)) {
            $xSoc = new cSocios_general($dpersona);
            $xSoc->query()->insert()->save();
            //Iniciar Cuenta de Captacion
        }
        break;
    case TPERSONAS_DIRECCIONES:
        $ddomicilio = $svc->getService(SVC_ASOCIADA_HOST . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
        if (is_array($ddomicilio)) {
            $xDom = new cSocios_vivienda($ddomicilio);
            $xDom->query()->insert()->save();
        }
        break;
    case TPERSONAS_ACTIVIDAD_ECONOMICA:
        $dtrabajo = $svc->getService(SVC_ASOCIADA_HOST . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
        if (is_array($dtrabajo)) {
            $xAe = new cSocios_aeconomica($dtrabajo);