$_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()) );
        $cnt = $svc->getEncryptData(json_encode($query->getCampos()));
$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
    }
//=====================================================================================================
$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 {
    $xPer = $xEmp->getOPersona()->init();
 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;
 }
$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);
            $xAe->query()->insert()->save();