function jsGetCreditosByCriteria($convenio, $estatus, $periocidad, $oficial, $include)
{
    $ByConvenio = "";
    $ByEstatus = "";
    $ByPeriocidad = "";
    $ByOficial = "";
    $ByInclude = "";
    if ($estatus != "todas") {
        $ByEstatus = " AND\n\t\t(`creditos_solicitud`.`estatus_actual` = {$estatus}) ";
    }
    if ($oficial != "todas") {
        $ByOficial = "\tAND\n\t(`creditos_solicitud`.`oficial_credito` = {$oficial})";
    }
    if ($convenio != "todas") {
        $ByConvenio = "\t AND\n\t(`creditos_solicitud`.`tipo_convenio` ={$convenio}) ";
    }
    if ($periocidad != "todas") {
        $ByPeriocidad = " AND (`creditos_solicitud`.`periocidad_de_pago` ={$periocidad})";
    }
    if ($include == "on") {
        $ByInclude = "AND\n\t\t(`creditos_solicitud`.`causa_de_mora` = 99)";
    }
    $sqlCred = "SELECT\n\t`socios_general`.`codigo`,\n\n\tCONCAT(`socios_general`.`apellidopaterno`, ' ',\n\t`socios_general`.`apellidomaterno`, ' ',\n\t`socios_general`.`nombrecompleto`) AS 'nombre',\n\t`creditos_solicitud`.`numero_solicitud`,\n\t`creditos_periocidadpagos`.`descripcion_periocidadpagos` AS `periocidad`,\n\t`creditos_tipoconvenio`.`descripcion_tipoconvenio`       AS `convenio`,\n\t`creditos_estatus`.`descripcion_estatus`                 AS `estatus`,\n\t`creditos_solicitud`.`saldo_actual`                      AS `saldo`,\n\t`creditos_causa_de_vencimientos`.`descripcion_de_la_causa`\t\tAS `causa`\nFROM\n\t`creditos_solicitud` `creditos_solicitud`\n\t\tINNER JOIN `creditos_estatus` `creditos_estatus`\n\t\tON `creditos_solicitud`.`estatus_actual` = `creditos_estatus`.\n\t\t`idcreditos_estatus`\n\t\t\tINNER JOIN `creditos_periocidadpagos` `creditos_periocidadpagos`\n\t\t\tON `creditos_solicitud`.`periocidad_de_pago` =\n\t\t\t`creditos_periocidadpagos`.`idcreditos_periocidadpagos`\n\t\t\t\tINNER JOIN `creditos_tipoconvenio` `creditos_tipoconvenio`\n\t\t\t\tON `creditos_solicitud`.`tipo_convenio` =\n\t\t\t\t`creditos_tipoconvenio`.`idcreditos_tipoconvenio`\n\t\t\t\t\tINNER JOIN `socios_general` `socios_general`\n\t\t\t\t\tON `creditos_solicitud`.`numero_socio` = `socios_general`.\n\t\t\t\t\t`codigo`\n\t\t\t\t\t\tINNER JOIN `creditos_causa_de_vencimientos` `creditos_causa_de_vencimientos`\n\t\t\t\t\t\tON `creditos_solicitud`.`causa_de_mora` = `creditos_causa_de_vencimientos`.\n\t\t\t\t\t\t`idcreditos_causa_de_vencimientos`\nWHERE\n\t(`creditos_solicitud`.`saldo_actual` >=" . TOLERANCIA_SALDOS . ")\n\t{$ByEstatus}\n\t{$ByInclude}\n\t{$ByPeriocidad}\n\t{$ByConvenio}\n\t{$ByOficial}\n\t";
    $xTbl = new cTabla($sqlCred, 2);
    $xTbl->addEspTool("<input type=\"checkbox\"  id=\"chk" . STD_LITERAL_DIVISOR . "_REPLACE_ID_\" />");
    $xTbl->setTdClassByType();
    $xTbl->setWidth();
    return $xTbl->show();
    //return $sqlCred;
}
function jsaGetListadoDeAvisos($tipo, $fecha_inicial, $fecha_final)
{
    $tipo = $tipo == SYS_TODAS ? false : $tipo;
    $xF = new cFecha();
    $xAl = new cAml_alerts();
    $xlistas = new cSQLListas();
    $xBtn = new cHButton();
    $xImg = new cHImg();
    $fecha_inicial = $xF->getFechaISO($fecha_inicial);
    $fecha_final = $xF->getFechaISO($fecha_final);
    $sql = $xlistas->getListadoDeRiesgosConfirmados($fecha_inicial, $fecha_final, $tipo);
    // getListadoDeAlertas($tipo, $fecha_inicial, $fecha_final, false, " AND `estado_en_sistema`= " . SYS_UNO);
    $xT = new cTabla($sql);
    $xT->addEspTool($xImg->get24("check", " onclick=\"jsConfirmRiesgo(_REPLACE_ID_)\" "));
    $xT->addEspTool($xImg->get24("delete", " onclick=\"jsDescartarRiesgo(_REPLACE_ID_)\" "));
    $xT->setKeyField($xAl->getKey());
    $xT->setKeyTable($xAl->get());
    return $xT->Show();
}
function jsaGetCobranza($empresa, $idperiodo)
{
    $xL = new cSQLListas();
    $xF = new cFecha();
    $sql = $xL->getListadoDeCobranza($idperiodo, SYS_UNO);
    //setLog($sql);
    //fecha de ministracion anterior al
    $xT = new cTabla($sql);
    $xT->setKeyField("numero_solicitud");
    $xT->setKey(2);
    $xT->setWidthTool("180px");
    $xT->setKeyTable("creditos_solicitud");
    $xT->setEventKey("jsGetRecibosByCredito");
    $xT->addEspTool("<div class='coolCheck'><input type='checkbox' id='chk_REPLACE_ID_' onclick='jsSetAlimentarCobros(this, _REPLACE_ID_)' /><label for='chk_REPLACE_ID_'></label></div>");
    $xT->addEspTool("<img src='../images/order.png' class='x24' onclick='getEstadoDeCuenta(_REPLACE_ID_)' />");
    $xT->addEspTool("<img src='../images/calendar.png' class='x24' onclick='getPlanDePagos(_REPLACE_ID_)' />");
    $xT->addEspTool("<img src='../images/view.png' class='x24' onclick='setOcultar(_REPLACE_ID_)' />");
    /*$subSQL		= "SELECT CONCAT(`socios_memo`.`fecha_memo`, '|',	`socios_memo`.`texto_memo`) AS 'memo' FROM `socios_memo` WHERE (`socios_memo`.`numero_solicitud` =" . HP_REPLACE_ID . ") AND (`socios_memo`.`tipo_memo` =11) ORDER BY `socios_memo`.`fecha_memo` ";
    	$xT->addSubQuery($subSQL);*/
    $xT->setWithMetaData();
    $xT->setFootSum(array(3 => "letra", 6 => "monto"));
    return $xT->Show();
}
function jsaGetCreditos($convenio, $estatus, $periocidad, $oficial)
{
    $xLi = new cSQLListas();
    $ByOficial = CREDITO_USAR_OFICIAL_SEGUIMIENTO == true ? "\tAND\t(`creditos_solicitud`.`oficial_seguimiento` != {$oficial}) " : "\tAND\t(`creditos_solicitud`.`oficial_credito` != {$oficial}) ";
    //saveError( 22, $_SESSION["SN_b80bb7740288fda1f201890375a60c8f"], "$oficial Ingreso al Modulo de Asignacion de Oficiales");
    $sqlCred = CREDITO_USAR_OFICIAL_SEGUIMIENTO == true ? $xLi->getListadoDeCreditosConOficialSeguimiento(false, $estatus, $periocidad, $convenio, $ByOficial) : $xLi->getListadoDeCreditosConOficial(false, $estatus, $periocidad, $convenio, $ByOficial);
    $xTbl = new cTabla($sqlCred, 2);
    $xChk = new cHCheckBox();
    $xTbl->setTdClassByType();
    $xTbl->addEspTool($xChk->get("", "chk" . STD_LITERAL_DIVISOR . "_REPLACE_ID_"));
    $xTbl->setWidth();
    return $xTbl->Show();
    //return $sqlCred;
}
function mostrar_notificaciones($finicial, $ffinal, $estatus)
{
    $sql = "SELECT\n\t`seguimiento_notificaciones`.`idseguimiento_notificaciones` AS `codigo`,\n\t`seguimiento_notificaciones`.`socio_notificado` AS 'socio',\n\t`socios`.`nombre`,\n\t`seguimiento_notificaciones`.`numero_solicitud` AS 'solicitud',\n\t`seguimiento_notificaciones`.`numero_notificacion` AS 'num',\n\t`seguimiento_notificaciones`.`fecha_notificacion`,\n\t/*`oficiales`.`nombre_completo` AS \t`oficial_a_cargo`,*/\n\t/*`seguimiento_notificaciones`.`fecha_vencimiento`,*/\n\t`seguimiento_notificaciones`.`capital`,\n\t`seguimiento_notificaciones`.`interes`,\n\t`seguimiento_notificaciones`.`moratorio`,\n\t`seguimiento_notificaciones`.`otros_cargos`,\n\t`seguimiento_notificaciones`.`total` \nFROM\n\t`seguimiento_notificaciones` `seguimiento_notificaciones` \n\t\tINNER JOIN `socios` `socios` \n\t\tON `seguimiento_notificaciones`.`socio_notificado` = `socios`.`codigo` \n\t\t\tINNER JOIN `oficiales` `oficiales` \n\t\t\tON `seguimiento_notificaciones`.`oficial_de_seguimiento` = `oficiales`\n\t\t\t.`id` \nWHERE\n\t(`seguimiento_notificaciones`.`estatus_notificacion` ='{$estatus}')\n\t\tORDER BY\n\t\t\t`seguimiento_notificaciones`.`idseguimiento_notificaciones`";
    //$cmdCancel = new cCmdByOrder("common/exit.png", "Cumplir Notificacion", "jsSetCumplido(event);", "cmd@_REPLACE_ID_");
    $cmdOk = "<label for='cmd@_REPLACE_ID_'><input type='checkbox' id='cmd@_REPLACE_ID_' /></label>";
    $cTbl = new cTabla($sql);
    $cTbl->setWidth();
    $cTbl->addTool(2);
    $cTbl->addTool(1);
    //$cTbl->addEspTool($cmdCancel->show());
    $cTbl->addEspTool($cmdOk);
    //$cTbl->addTool(2);
    $cTbl->setTdClassByType();
    $cTbl->setKeyField("idseguimiento_notificaciones");
    return $cTbl->Show();
}
function jsaGetListadoCierres($fecha)
{
    $xLi = new cSQLListas();
    $xF = new cFecha();
    $fecha = $xF->getFechaISO($fecha);
    $sqlList = $xLi->getListadoDeRecibos(12, "", "", $fecha);
    $xTab = new cTabla($sqlList);
    $xTab->OButton("TR.Reporte", "var xR = new RecGen(); xR.reporte(" . HP_REPLACE_ID . ")", $xTab->ODicIcons()->REPORTE);
    $xTab->OButton("TR.Panel", "var xR = new RecGen(); xR.panel(" . HP_REPLACE_ID . ")", $xTab->ODicIcons()->CONTROL);
    $xBtn = new cHButton();
    $xSel = new cHSelect();
    $xCA = $xSel->getListaDeCajasAbiertas();
    $T2 = new cTabla($xCA->getSQL() . " AND `tesoreria_cajas`.`fecha_inicio` = '{$fecha}' ");
    $T2->addEspTool($xBtn->getBasic("", "jsToCerrarCorte('{$fecha}')", "bloquear", "idcerrar", true));
    $html = $xTab->Show("TR.LISTADO DE CIERRES");
    if (MODULO_CAJA_ACTIVADO == true) {
        $html .= $T2->Show("TR.Cajas Abiertas");
        $itemsAbier = $T2->getRowCount();
        $html .= "<input type='hidden' id='idabiertas' value='{$itemsAbier}' />";
    } else {
        $html .= "<input type='hidden' id='idabiertas' value='0' />";
    }
    return $html;
}
 }
 if ($xSoc->getEsEmpresaConConvenio(true) == true) {
     $xT2 = new cHTabs("idcomoempresa");
     $idempresa = $xSoc->getOEmpresa()->getClaveDeEmpresa();
     $oFrm->addEmpresaComandos($idempresa);
     $xTCreds = new cTabla($xql->getListadoDeCreditos(false, false, false, false, " AND (`creditos_solicitud`.`persona_asociada` = {$idempresa}) ", false), 2);
     $xTPers = new cTabla($xql->getListadoDeSocios(" (`socios_general`.`dependencia` = {$idempresa})  "));
     $xTAhorro = new cTabla($xql->getListadoDeIncidenciasAhorro($idempresa));
     $xTPeriodo = new cTabla($xql->getListadoDePeriodoPorEmpresa($idempresa));
     $xTPeriodo->setTdClassByType();
     $xTPeriodo->setEventKey("var xG = new EmpGen(); xG.getOrdenDeCobranza");
     $xTCreds->setTdClassByType();
     $xTPers->setTdClassByType();
     $xTAhorro->setTdClassByType();
     $xModAhorro = "<input type=\"number\" id=\"id" . HP_REPLACE_ID . "\" onblur=\"jsModificarAhorro(this," . HP_REPLACE_ID . ")\" />";
     $xTPers->addEspTool($xModAhorro);
     $xT2->addTab("TR.Trabajadores", $xTPers->Show());
     $xTCreds->setFootSum(array(8 => "saldo"));
     $xT2->addTab("TR.Creditos por empresa", $xTCreds->Show());
     //Ahorro por Empresa
     $xT2->addTab("TR.Ahorro por empresa", $xTAhorro->Show());
     $xT2->addTab("TR.Periodos de Empresa", $xTPeriodo->Show());
     $xHTabs->addTab("TR.empresa {$idempresa}", $xT2->get());
     //tab4
     $oFrm->OButton("TR.Cedula de Incidencias de Ahorro", "jsGetCedulaDeAhorro()", "deposito");
     $oFrm->OButton("TR.Actualizar Empresa", "jsaActualizarEmpresa()", $oFrm->ic()->EJECUTAR);
     $oFrm->OHidden("idempresa", $idempresa);
 }
 if ($xSoc->getEsSucursal() == true) {
     $oFrm->OButton("TR.Actualizar Sucursal", "jsaActualizarSucursal()", $oFrm->ic()->EJECUTAR);
     $oFrm->OHidden("idsucursal", $xSoc->getIDSucursalAsociada());
$iduser = $_SESSION["log_id"];
//=====================================================================================================
$xPage = new cHPage(HP_FORM, "Admitir Socios");
echo $xPage->getHeader();
?>
<body>
<fieldset>
	<legend>SOCIO(S) NO ADMITIDO(S)</legend>
<form name="frmAdmitir" action="frmadmitirsocios.php" method="post">


<?php 
$sqlSNA = "SELECT\n\t`socios_general`.`codigo`,\n\t`socios_general`.`nombrecompleto` AS 'nombre',\n\t`socios_general`.`apellidopaterno` AS 'apellido_paterno',\n\t`socios_general`.`apellidomaterno` AS 'apellido_materno',\n\t`socios_general`.`fechaentrevista` AS 'fecha_de_entrevista',\n\t`socios_general`.`sucursal` \nFROM\n\t`socios_general` `socios_general` \nWHERE\n\t(`socios_general`.`estatusactual` =99)\nORDER BY\n\t`socios_general`.`fechaentrevista` DESC\nLIMIT 0,20\t";
$tSoc = new cTabla($sqlSNA);
$tSoc->setWidth();
$tSoc->addEspTool("<input type=\"checkbox\"  id=\"chk" . STD_LITERAL_DIVISOR . "_REPLACE_ID_\" />");
$tSoc->setTdClassByType();
$tSoc->Show("", false);
?>
<input type="button" name="sendmme" value="GUARDAR AUTORIZACION" onClick="jsSetAdmision();" />
</form>
</fieldset>

</body>
<script language='javascript' src='../js/jsrsClient.js'></script>
<script  >

var Frm 					= document.frmAdmitir;
var jsrCommon				= "../js/general.common.js.php";
var divLiteral				= "<?php 
echo STD_LITERAL_DIVISOR;
function jsShowSocios($texto, $tipo_de_busqueda)
{
    $strTbls = "";
    $ByForm = false;
    $MostrarGars = true;
    $MostrarPartes = true;
    $sqlL = new cSQLListas();
    $WSoc = " `socios_general`.`codigo` != " . DEFAULT_SOCIO . "";
    $WPrel = "";
    $xIc = new cHImg();
    if ($tipo_de_busqueda == "nc") {
        $ByForm = true;
    }
    if (!isset($texto) or trim($texto) == "" or $texto == DEFAULT_SOCIO or $texto == "0") {
        $sqllike = $sqlL->getListadoDeSocios(" tipoingreso != " . TIPO_INGRESO_SDN);
        $table_s = new cTabla($sqllike);
        $table_s->setEventKey("setSocio");
        $table_s->setRowCSS("codigo", "center");
        $table_s->addEspTool("\$xS=new cSocio(_REPLACE_ID_,true);\$D=\$xS->getTotalColocacionActual();PHP::(\$D[SYS_NUMERO]>0) ? \"<div class='noticon'><i class='fa fa-credit-card fa-lg'></i><span class='noticount'>\" . \$D[SYS_NUMERO] . \"</span></div>\":\"\";");
        $strTbls .= $table_s->Show("TR.ULTIMOS REGISTROS");
    } else {
        $texto = trim($texto);
        $texto = strtoupper($texto);
        $completo = explode(" ", $texto);
        $str = fmt_string($completo[0]);
        $marked = false;
        switch ($tipo_de_busqueda) {
            //CURP
            case "c":
                $str = trim(substr($completo[0], 0, 7));
                $WSoc = " (curp LIKE '{$str}%') ";
                break;
                //NUMERO DE SOCIO
            //NUMERO DE SOCIO
            case "s":
                $str = trim(substr($completo[0], 0, 6));
                $WSoc = " (codigo LIKE '{$str}%') ";
                break;
                //NUMERO DEempresa
            //NUMERO DEempresa
            case "e":
                $WSoc = " (dependencia = {$texto}) ";
                break;
                //DEAFULT:
            //DEAFULT:
            default:
                //balam gon lui
                if (isset($completo[1])) {
                    $str = fmt_string($completo[1]);
                    $WSoc .= $str != "*" ? " AND (apellidomaterno LIKE '{$str}%') " : "";
                }
                if (isset($completo[2])) {
                    $str = fmt_string($completo[2]);
                    $WSoc .= $str != "*" ? " AND (nombrecompleto LIKE '{$str}%') " : "";
                }
                if (isset($completo[0])) {
                    $str = fmt_string($completo[0]);
                    $WSoc .= " AND ((apellidopaterno LIKE '{$str}%') OR (nombrecompleto LIKE '%{$str}%') )";
                }
                break;
        }
        if ($tipo_de_busqueda == "pp") {
            $sqllike = "SELECT\n\t\t\t\t\t`creditos_solicitud`.`numero_solicitud`        AS `credito`,\n\t\t\t\t\t`socios`.`codigo`,\n\t\t\t\t\t`socios`.`nombre`,\n\t\t\t\t\t`creditos_solicitud`.`pagos_autorizados`       AS `pagos`,\n\t\t\t\t\t(`creditos_solicitud`.`ultimo_periodo_afectado`+1) AS `periodo`,\n\t\t\t\t\t`creditos_solicitud`.`saldo_actual`            AS `saldo`,\n\t\t\t\t\t`creditos_solicitud`.`monto_parcialidad`       AS `parcialidad` \n\t\t\t\tFROM\n\t\t\t\t\t`creditos_solicitud` `creditos_solicitud` \n\t\t\t\t\t\tINNER JOIN `socios` `socios` \n\t\t\t\t\t\tON `creditos_solicitud`.`numero_socio` = `socios`.`codigo` \n\t\t\t\tWHERE\n\t\t\t\t\t(`creditos_solicitud`.`saldo_actual` >0.99)\n\t\t\t\t\tAND\n\t\t\t\t\t(`creditos_solicitud`.`tipo_convenio` ={$texto}) ORDER BY\t`socios`.`nombre` ";
            $table_s = new cTabla($sqllike);
            $table_s->setEventKey("jsGoRecibo");
            $table_s->setRowCSS("credito", "center");
            $table_s->setKeyField("credito");
            $table_s->setWithMetaData();
            $strTbls .= $table_s->Show("TR.CREDITOS");
        } else {
            $sqllike = $sqlL->getListadoDeSocios($WSoc . " AND tipoingreso != " . TIPO_INGRESO_SDN);
            $table_s = new cTabla($sqllike);
            $table_s->setEventKey("setSocio");
            $table_s->setRowCSS("codigo", "center");
            $table_s->addEspTool($xIc->get24("settings.png", "onclick='jsToPanel(_REPLACE_ID_)'"));
            //$table_s->addSubQuery("SELECT CONCAT(`creditos_solicitud`.`numero_solicitud`, '|', `creditos_solicitud`.`numero_pagos`, '|',`creditos_solicitud`.`periocidad_de_pago`,'|',`creditos_solicitud`.`saldo_actual` ) FROM creditos_solicitud WHERE numero_socio = _REPLACE_ID_", 1);
            $table_s->addEspTool("\$xS=new cSocio(_REPLACE_ID_,true);\$D=\$xS->getTotalColocacionActual();PHP::(\$D[SYS_NUMERO]>0) ? \"<div class='noticon'><i class='fa fa-credit-card fa-lg'></i><span class='noticount'>\" . \$D[SYS_NUMERO] . \"</span></div>\":\"\";");
            $strTbls .= $table_s->Show("TR.PERSONAS QUE COINCIDEN CON LA BUSQUEDA");
        }
    }
    return $strTbls;
}