function jsaGetDatosHeredados($codigopostal, $idcolonia)
{
    $tab = new TinyAjaxBehavior();
    $xCol = new cDomiciliosColonias();
    if (setNoMenorQueCero($codigopostal) > 0) {
        $xCol->getClavePorCodigoPostal($codigopostal);
    } else {
        if (setNoMenorQueCero($idcolonia) <= 0) {
            $xLoc = new cLocal();
            $xCol->getClavePorCodigoPostal($xLoc->DomicilioCodigoPostal());
        } else {
            $xCol->set($idcolonia);
        }
    }
    $tab->add(TabSetValue::getBehavior("idnombrecolonia", $xCol->getNombre()));
    $tab->add(TabSetValue::getBehavior("idcolonia", $xCol->get()));
    if (PERSONAS_VIVIENDA_MANUAL == true) {
        $tab->add(TabSetValue::getBehavior("idnombrelocalidad", $xCol->getNombreLocalidad()));
        $tab->add(TabSetValue::getBehavior("idnombremunicipio", $xCol->getNombreMunicipio()));
        //$tab->add(TabSetValue::getBehavior("idnombreestado", $xCol->getNombreEstado() ));
    } else {
        //$tab->add(TabSetValue::getBehavior("idlocalidad", $xCol->getNombreLocalidad() ));
        $tab->add(TabSetValue::getBehavior("identidadfederativa", $xCol->getClaveDeEstadoABC()));
    }
    //$tab->add(TabSetValue::getBehavior("idestado", $xCol->getClaveDeEstado() ));
    return $tab->getString();
}
function jsaBuscarCoincidencias($nombre, $primerapellido, $segundoapellido)
{
    $xLoc = new cLocal();
    $arrBusq = array("AP" => $primerapellido, "AM" => $segundoapellido, "N" => $nombre);
    $model = array("completo" => "nombrecompleto");
    $rs = $xLoc->getListadoDePersonasBuscadas($arrBusq, $model);
    $xUL = new cHUl();
    foreach ($rs as $rows) {
        //var_dump($rows);
        $xUL->li($rows["nombrecompleto"]);
    }
    return $xUL->get();
}
    function setReceptor($nombre, $rfc, $calle, $numeroExt, $numeroInt, $codigoPostal, $colonia = "", $municipio = "", $estado = "", $pais = "")
    {
        if (setNoMenorQueCero($codigoPostal) > 0 and $colonia == "") {
            $xCol = new cDomiciliosColonias();
            $xLoc = new cLocal();
            $idcol = $xCol->getClavePorCodigoPostal($codigoPostal);
            $colonia = $xCol->getNombre();
            $estado = $xCol->getNombreEstado();
            $municipio = $xCol->getNombreMunicipio();
            $pais = $pais == "" ? $xLoc->getNombreDePais() : $pais;
        }
        $sInterior = $numeroInt == "" ? "" : ' noInterior="' . strtoupper($numeroInt) . '" ';
        $this->mReceptor .= '<cfdi:Receptor 
		nombre="' . strtoupper($nombre) . '" 
		rfc="' . strtoupper($rfc) . '">
		<cfdi:Domicilio calle="' . strtoupper($calle) . '" 
		noExterior="' . strtoupper($numeroExt) . '" 
		' . $sInterior . '
		colonia="' . strtoupper($colonia) . '" 
		municipio="' . strtoupper($municipio) . '" 
		estado="' . strtoupper($estado) . '" pais="' . strtoupper($pais) . '" 
		codigoPostal="' . $codigoPostal . '" /></cfdi:Receptor>';
    }
//=====>	INICIO_H
include_once "../core/go.login.inc.php";
include_once "../core/core.error.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
$xHP = new cHPage("TR.Solicitud de de Credito", HP_REPORT);
$xLoc = new cLocal();
$xList = new cSQLListas();
$oficial = elusuario($iduser);
echo $xHP->getHeader(true);
echo $xHP->setBodyinit("javascript:window.print()");
echo getRawHeader();
$sqlDic = new cSQLListas();
$idsolicitud = isset($_GET["solicitud"]) ? $_GET["solicitud"] : DEFAULT_CREDITO;
$entidad = EACP_NAME;
if ($idsolicitud == DEFAULT_CREDITO) {
    echo JS_CLOSE;
} else {
    $xCred = new cCredito($idsolicitud);
    $xCred->init();
    $siavales = isset($_GET["avales"]) ? $_GET["avales"] : SYS_NINGUNO;
    $sigarantias = isset($_GET["garantias"]) ? $_GET["garantias"] : SYS_NINGUNO;
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
//=====================================================================================================
ini_set("max_execution_time", 600);
$xHP = new cHPage("", HP_REPORT);
$mql = new cSQLListas();
$xF = new cFecha();
$query = new MQL();
$xLoc = new cLocal();
$xLog = new cCoreLog();
$xCR = new cReporteCirculoDeCredito_tipo();
$ClaveOtorgante = $xCR->getClaveDeOtorgante();
$NombreOtorgante = $xCR->getNombreOtorgante();
$ByPersona1 = "";
$ByPersona2 = "";
$ByPersona3 = "";
$FechaInicial = isset($_GET["on"]) ? $_GET["on"] : FECHA_INICIO_OPERACIONES_SISTEMA;
$FechaFinal = isset($_GET["off"]) ? $_GET["off"] : fechasys();
$toJson = false;
//parametro("beauty", false, MQL_BOOL);
$lineaJson = array();
$itemJson = array();
$FechaExtraccion = date("Ymd", strtotime($FechaFinal));
$estatus_actual = parametro("f2", false, MQL_INT);
include_once "../core/go.login.inc.php";
include_once "../core/core.error.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
$xHP = new cHPage("TR.Registro de Personas");
$xT = new cTipos();
$xLoc = new cLocal();
$xFRM = new cHForm("frmnuevapersona");
$ready = true;
$msg = "";
$persona = false;
//persona sin inicializar
$agregardom = false;
$xHP->init();
$idfecharegistro = parametro("idfecharegistro", false, MQL_DATE);
$idtipodeingreso = parametro("idtipodeingreso", DEFAULT_TIPO_INGRESO, MQL_INT);
$idfigurajuridica = parametro("idfigurajuridica", PERSONAS_FIGURA_FISICA, MQL_INT);
$idnombrecompleto = parametro("idnombrecompleto");
$idapellidopaterno = parametro("idapellidopaterno");
$idapellidomaterno = parametro("idapellidomaterno");
$idregimenfiscal = parametro("idregimenfiscal", DEFAULT_REGIMEN_FISCAL, MQL_INT);
$idgenero = parametro("idgenero", DEFAULT_GENERO, MQL_INT);
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
include_once "../core/core.db.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//=====================================================================================================
$xHP = new cHPage("TR.VISTA_PREVIA DEL REPORTE_X_HORAS", HP_REPORT);
$mql = new cSQLListas();
$xF = new cFecha();
$query = new MQL();
$xT = new cTipos();
$xLoc = new cLocal();
$xLayout = new cReportes_Layout();
$xHTable = new cHTabla();
$xHNot = new cHNotif();
$estatus = parametro("estado", SYS_TODAS);
$frecuencia = parametro("periocidad", SYS_TODAS);
$producto = parametro("convenio", SYS_TODAS);
$producto = parametro("producto", $producto);
$empresa = parametro("empresa", SYS_TODAS);
$out = parametro("out", SYS_DEFAULT);
$FechaInicial = parametro("on", false);
$FechaInicial = parametro("fecha-1", $FechaInicial);
$FechaInicial = $FechaInicial == false ? FECHA_INICIO_OPERACIONES_SISTEMA : $xF->getFechaISO($FechaInicial);
$FechaFinal = parametro("off", false);
$FechaFinal = parametro("off", $FechaFinal);
$FechaFinal = $FechaFinal == false ? fechasys() : $xF->getFechaISO($FechaFinal);
//=====>	INICIO_H
include_once "../core/go.login.inc.php";
include_once "../core/core.error.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
$xHP = new cHPage("TR.Actividad economica");
$xLoc = new cLocal();
$persona = parametro("persona", DEFAULT_SOCIO, MQL_INT);
$persona = parametro("socio", $persona, MQL_INT);
$persona = parametro("idsocio", $persona, MQL_INT);
$credito = parametro("credito", DEFAULT_CREDITO, MQL_INT);
$credito = parametro("idsolicitud", $credito, MQL_INT);
$credito = parametro("solicitud", $credito, MQL_INT);
$cuenta = parametro("cuenta", DEFAULT_CUENTA_CORRIENTE, MQL_INT);
$cuenta = parametro("idcuenta", $cuenta, MQL_INT);
$jscallback = parametro("callback");
$tiny = parametro("tiny");
$form = parametro("form");
$action = parametro("action", SYS_NINGUNO);
$empresa = parametro("empresa", SYS_TODAS, MQL_INT);
$empresa = parametro("iddependencia", $empresa, MQL_INT);
$empresa = parametro("idempresa", $empresa, MQL_INT);
include_once "../core/go.login.inc.php";
include_once "../core/core.error.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
$xHP = new cHPage("TR.Registro de Personas");
$jxc = new TinyAjax();
$xLoc = new cLocal();
$jscallback = parametro("callback");
$tiny = parametro("tiny");
$form = parametro("form");
$action = parametro("action", SYS_NINGUNO);
$xHP->init();
$xFRM = new cHForm("frmsolingreso", "registro-personas.frm.php");
$xBtn = new cHButton();
$xTxt = new cHText();
$xTxt2 = new cHText();
$xDate = new cHDate();
$xDate2 = new cHDate(2, false, FECHA_TIPO_NACIMIENTO);
$xSel = new cHSelect();
if ($action == SYS_NINGUNO) {
    $xFRM->addGuardar("jsCheck()");
}
echo "var DEFAULT_CUENTA_BANCARIA\t= " . DEFAULT_CUENTA_BANCARIA . ";\n";
echo "var FALLBACK_CUENTA_BANCARIA\t= " . FALLBACK_CUENTA_BANCARIA . ";\n";
echo "var FALLBACK_CLAVE_EMPRESA\t= " . FALLBACK_CLAVE_EMPRESA . ";\n";
echo "var SYS_AUTOMATICO\t\t= '" . SYS_AUTOMATICO . "';\n";
echo "var TESORERIA_COBRO_TRANSFERENCIA\t\t= '" . TESORERIA_COBRO_TRANSFERENCIA . "';\n";
echo "var TESORERIA_COBRO_EFECTIVO\t\t= '" . TESORERIA_COBRO_EFECTIVO . "';\n";
echo "var SVC_REMOTE_HOST\t\t= '" . SVC_REMOTE_HOST . "';\n";
echo "var CREDITO_TIPO_DIAS_DE_PAGO_PERSONALIZADOS\t\t= '" . CREDITO_TIPO_DIAS_DE_PAGO_PERSONALIZADOS . "';\n";
echo "var CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO\t\t= " . CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO . ";\n";
echo "var CREDITO_TIPO_PERIOCIDAD_DIARIO\t= " . CREDITO_TIPO_PERIOCIDAD_DIARIO . ";\n";
echo "var TESORERIA_MONTO_MAXIMO_OPERADO\t\t= " . TESORERIA_MONTO_MAXIMO_OPERADO . ";\n";
echo "var CREDITO_TIPO_PAGO_UNICO\t\t= " . CREDITO_TIPO_PAGO_UNICO . ";\n";
echo "var CREDITO_TIPO_PAGO_PERIODICO\t\t= " . CREDITO_TIPO_PAGO_PERIODICO . ";\n";
echo "var DIGITOS_DE_CODIGO_POSTAL\t= " . DIGITOS_DE_CODIGO_POSTAL . ";\n";
echo "var EACP_CLAVE_DE_PAIS\t= \"" . EACP_CLAVE_DE_PAIS . "\";\n";
echo "var CAPTACION_TIPO_PLAZO\t= " . CAPTACION_TIPO_PLAZO . ";\n";
echo "var CAPTACION_ORIGEN_CONDICIONADO\t= " . CAPTACION_ORIGEN_CONDICIONADO . ";\n";
echo "var iDE_CREDITO\t= " . iDE_CREDITO . ";\n";
echo "var iDE_CAPTACION\t= " . iDE_CAPTACION . ";\n";
echo "var iDE_SOCIO\t= " . iDE_SOCIO . ";\n";
echo "var STD_LITERAL_DIVISOR\t= '" . STD_LITERAL_DIVISOR . "';\n";
$xLoc = new cLocal();
echo "var LOCAL_DOMICILIO_CLAVE_ENTIDAD\t= '" . $xLoc->DomicilioEstadoClaveNum() . "';\n";
if (PERSONAS_VIVIENDA_MANUAL == true) {
    echo "var PERSONAS_VIVIENDA_MANUAL\t\t= true;\n";
} else {
    echo "var PERSONAS_VIVIENDA_MANUAL\t\t= false;\n";
}
$xB = new cBases();
$strA = $xB->getMembers_InString(false, BASE_ES_PERSONA_MORAL);
echo "var ARR_FIGURA_MORAL\t\t= new Array({$strA});\n";
 function setRepresentante($clave_de_persona)
 {
     $xLoc = new cLocal();
     if (setNoMenorQueCero($clave_de_persona) > DEFAULT_SOCIO) {
         $xPer = new cSocio($clave_de_persona);
         if ($xPer->init() == true) {
             $codigo = $xPer->getCodigo();
             $nombre = $xPer->getNombreCompleto();
             $dom = "";
             $cp = $xLoc->DomicilioCodigoPostal();
             if ($xPer->getODomicilio() != null) {
                 $dom = $xPer->getODomicilio()->getDireccionBasica();
                 $cp = $xPer->getODomicilio()->getCodigoPostal();
             }
             $this->setUpdate(array("colonia_gruposolidario" => $cp, "direccion_gruposolidario" => $dom, "representante_numerosocio" => $codigo, "representante_nombrecompleto" => $nombre));
             $this->addIntegrante($clave_de_persona);
         }
     }
 }
 function __construct($clave = false)
 {
     $xF = new cFecha();
     $xUsr = new cOficial(getUsuarioActual());
     $this->init($clave);
     $xLoc = new cLocal();
     $this->mArr["variable_fecha_larga_actual"] = $xF->getFechaLarga();
     $this->mArr["variable_horario_de_trabajo_de_la_entidad"] = EACP_HORARIO_DE_TRABAJO;
     $this->mArr["variable_nombre_de_presidente_de_vigilancia_de_la_entidad"] = EACP_PDTE_VIGILANCIA;
     $this->mArr["variable_nombre_de_la_sociedad"] = EACP_NAME;
     $this->mArr["variable_nombre_de_la_entidad"] = EACP_NAME;
     $this->mArr["variable_ciudad_de_la_entidad"] = DEFAULT_NOMBRE_LOCALIDAD;
     $this->mArr["variable_domicilio_de_la_entidad"] = EACP_DOMICILIO_CORTO;
     $this->mArr["variable_acta_notarial_de_poder_al_representante"] = EACP_DOCTO_REP_LEGAL;
     $this->mArr["variable_domicilio_de_la_entidad"] = EACP_DOMICILIO_CORTO;
     $this->mArr["variable_entidad_telefono_general"] = EACP_TELEFONO_PRINCIPAL;
     $this->mArr["variable_entidad_telefono_principal"] = EACP_TELEFONO_PRINCIPAL;
     $this->mArr["variable_documento_de_constitucion_de_la_sociedad"] = EACP_DOCTO_CONSTITUCION;
     $this->mArr["variable_rfc_de_la_entidad"] = EACP_RFC;
     $this->mArr["variable_nombre_del_representante_legal_de_la_sociedad"] = EACP_REP_LEGAL;
     $this->mArr["variable_nombre_de_presidente_de_vigilancia_de_la_entidad"] = EACP_PDTE_VIGILANCIA;
     $this->mArr["variable_encabezado_de_reporte"] = getRawHeader();
     $this->mArr["variable_pie_de_reporte"] = getRawFooter();
     $this->mArr["variable_pie_de_reporte"] = getRawFooter();
     $this->mArr["variable_hora_actual"] = date("H:i");
     $this->mArr["variable_marca_de_tiempo"] = date("Ymd:His");
     $this->mArr["variable_url_publica"] = SAFE_HOST_URL;
     $this->mArr["variable_lugar_actual"] = $xLoc->DomicilioLocalidad() . "," . $xLoc->DomicilioEstado();
     $this->mBasicVars = $this->mArr;
 }
include_once "../core/core.init.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
$xHP = new cHPage("TR.Calendario de Tareas", HP_FORM);
$oficial = elusuario($iduser);
$jxc = new TinyAjax();
$xF = new cFecha();
$xBtn = new cHButton("");
$xLoc = new cLocal();
$xLi = new cSQLListas();
function jsaRespaldarDB($fecha)
{
    $xSys = new cSystemTask();
    $msg = $xSys->setBackupDB();
    return $msg;
}
function jsaSetCumplido($Key)
{
    $sql = "UPDATE usuarios_web_notas SET estado=40 WHERE idusuarios_web_notas={$Key}";
    my_query($sql);
}
function jsaEliminarLog($fecha)
{
    my_query("DELETE FROM general_log");
//=====================================================================================================
include_once "../core/go.login.inc.php";
include_once "../core/core.error.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
include_once "../core/core.db.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//=====================================================================================================
$xHP = new cHPage("TR.Datos de Vivienda", HP_FORM);
$jxc = new TinyAjax();
$xLoc = new cLocal();
function jsaGetMunicipios($estado, $pais, $cp)
{
    $txt = "";
    $text = new cHText();
    $xSel = new cHSelect();
    $text->setDivClass("");
    $mun = false;
    if (setNoMenorQueCero($cp) > 0) {
        if ($pais == EACP_CLAVE_DE_PAIS) {
            $xCol = new cDomiciliosColonias();
            $xCol->existe($cp);
            $mun = $xCol->getClaveDeMunicipio();
        }
    }
    return ($pais != EACP_CLAVE_DE_PAIS or PERSONAS_VIVIENDA_MANUAL == true) ? $text->getDeNombreDeMunicipio("idnombremunicipio", "", "TR.Municipio") : $xSel->getListaDeMunicipios("", $estado, $mun)->get(false);
 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;
 }