function jsaGetGrupos($txt)
{
    $nombre = $txt;
    $xLi = new cSQLListas();
    $ByNombre = $nombre != "" ? " AND (`nombre_gruposolidario` LIKE '%{$nombre}%' OR `representante_nombrecompleto` LIKE '%{$nombre}%' OR `vocalvigilancia_nombrecompleto` LIKE '%{$nombre}%') " : "";
    $sql = $xLi->getListadoDeGrupos() . "\n\t{$ByNombre}\n\tORDER BY\n\t`nombre_gruposolidario`\n\tLIMIT 0,10 ";
    $xT = new cTabla($sql);
    return $xT->Show();
}
function jsaGuardarPerfil($persona, $tipo, $pais, $monto, $numero, $observaciones)
{
    $xAP = new cAMLPersonas($persona);
    $xAP->init();
    $xAP->setGuardarPerfilTransaccional($tipo, $pais, $monto, $numero, $observaciones);
    $QL = new cSQLListas();
    $xT = new cTabla($QL->getListadoDePerfil($persona));
    $xT->addTool(SYS_DOS);
    return $xT->Show() . $xAP->getMessages(OUT_HTML);
}
function getListRecibos($tipo, $socio)
{
    $sql = new cSQLListas();
    $cTbl = new cTabla($sql->getListadoDeRecibos($tipo, $socio));
    $xImg = new cHImg();
    $cTbl->setKeyField("idoperaciones_recibos");
    $cTbl->setTdClassByType();
    $cTbl->OButton("TR.Reporte", "jsGetReporteRecibo(" . HP_REPLACE_ID . ")", $cTbl->ODicIcons()->REPORTE);
    $cTbl->OButton("TR.Panel", "var xRec = new RecGen(); xRec.panel(" . HP_REPLACE_ID . ")", $cTbl->ODicIcons()->EJECUTAR);
    $cTbl->setEventKey("setRecibo");
    return $cTbl->Show();
}
function jsaGetPolizas($fecha, $tipo)
{
    $xF = new cFecha();
    $fecha = $xF->getFechaISO($fecha);
    $xQL = new cSQLListas();
    $xT = new cTabla($xQL->getListadoDePolizasContables($fecha, $tipo), 7);
    $xBtn = new cHImg();
    $xT->setKeyField("codigo");
    $xT->OButton("TR.Modificar", "jsAgregarMovimientos('" . HP_REPLACE_ID . "')\"", $xT->ODicIcons()->AGREGAR);
    $xT->OButton("TR.Imprimir", "jsImprimirPoliza('" . HP_REPLACE_ID . "')\"", $xT->ODicIcons()->IMPRIMIR);
    $xT->OButton("TR.Eliminar", "jsEliminarPoliza('" . HP_REPLACE_ID . "')\"", $xT->ODicIcons()->ELIMINAR);
    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 jsaGetDatosEmpresa($idEmpresa)
{
    $xEmp = new cEmpresas($idEmpresa);
    $xF = new cFecha();
    $ql = new MQL();
    $xl = new cSQLListas();
    $observaciones = "";
    $xEmp->init();
    $persona = $xEmp->getClaveDePersona();
    $xF = new cFecha(0);
    $opts = "";
    $exT = "";
    $periocidad = $xEmp->getPeriocidadPref();
    $periodo = $periocidad == CREDITO_TIPO_PERIOCIDAD_SEMANAL ? $xF->semana() : $xF->quincena();
    $periodo = intval($xEmp->getPeriodo()) < 1 ? $periodo : intval($xEmp->getPeriodo());
    $data = $ql->getDataRecord($xl->getListadoDePeriodoPorEmpresa($idEmpresa));
    $variacion = "0";
    $fecha_inicial = $xF->getFechaMX();
    $fecha_final = $xF->getFechaMX();
    $control = 0;
    $ctrl = "<label for=\"idperiodo\">Periodo {$periodo}</label><input type=\"number\" id=\"idperiodo\" onchange=\"jsGetCobranza()\" onblur=\"jsGetCobranza()\" />";
    $contar = 1;
    $max = 5;
    foreach ($data as $rw) {
        $idsel = "";
        $idclave = $rw["codigo"];
        $xPer = $xEmp->getOPeriodo(false, false, $idclave);
        if ($periodo == $xPer->periodo_marcado()->v() and $periocidad == $xPer->periocidad()->v()) {
            $control = $idclave;
            $periodo = $xPer->periodo_marcado()->v();
            $periocidad = $xPer->periocidad()->v();
            $fecha_final = $xPer->fecha_final()->v();
            $fecha_inicial = $xPer->fecha_inicial()->v();
            $idsel = " selected=\"true\" ";
        }
        if ($contar <= $max) {
            $opts .= "<option value=\"" . $idclave . " \"{$idsel}>" . $rw["nombre_periocidad"] . "[" . $xPer->periodo_marcado()->v() . "]";
            $opts .= "  - DEL: " . $xF->getFechaDDMM($rw["fecha_inicial"]) . " - " . $xF->getFechaDDMM($rw["fecha_final"]) . " SALDO " . getFMoney($rw["saldo"]) . "</option>";
        }
        $contar++;
    }
    if ($opts != "") {
        $ctrl = "<label for='idperiodo'>Periodo</label><select id=\"idperiodo\" name=\"idperiodo\" onblur=\"jsGetCobranza()\" onchange=\"jsGetCobranza()\">{$opts}</select>";
    }
    $ctrl .= "<input type=\"hidden\" id=\"idvariacion\" value=\"{$variacion}\" />";
    $ctrl .= "<input type=\"hidden\" id=\"idperiodo\" value=\"{$periodo}\" />";
    $ctrl .= "<input type=\"hidden\" id=\"idperiocidad\" value=\"{$periocidad}\" />";
    $ctrl .= "<input type=\"hidden\" id=\"idclavedepersona\" value=\"{$periocidad}\" />";
    return $ctrl;
}
function jsaCargaDeCreditos($persona)
{
    $xL = new cSQLListas();
    $ql = new MQL();
    $xs = new cHSelect();
    $xs->setDivClass("");
    $sql = $xL->getListadoDeCreditos($persona);
    $rs = $ql->getDataRecord($sql);
    $aOpts = array();
    //setLog($sql);
    foreach ($rs as $row) {
        $aOpts[$row["credito"]] = $row["credito"] . "-" . $row["producto"] . "-" . $row["periocidad"] . "-" . $row["saldo"];
    }
    $xs->addOptions($aOpts);
    return $xs->get("idcreditodescontado", "TR.CLAVE_de_credito");
}
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 jsaGetListadoDeAvisos($tipo, $fecha_inicial, $fecha_final)
{
    $tipo = $tipo == SYS_TODAS ? false : $tipo;
    $xF = new cFecha();
    $xAl = new cAml_risk_register();
    $xlistas = new cSQLListas();
    $xBtn = new cHButton();
    $xImg = new cHImg();
    $fecha_inicial = $xF->getFechaISO($fecha_inicial);
    $fecha_final = $xF->getFechaISO($fecha_final);
    $sql = $xlistas->getListadoDeRiesgosConfirmados(false, false, false, $tipo, false, " AND (`aml_risk_register`.`estado_de_envio` =0) AND (`aml_risk_register`.`fecha_de_checking` =0) ");
    $xT = new cTabla($sql);
    //setLog($sql);
    $xT->OButton("TR.Dictaminar", "jsModificarEstatus(_REPLACE_ID_)", $xT->ODicIcons()->REPORTE);
    $xT->OButton("TR.Modificar", "jsEditarRiesgo(_REPLACE_ID_)", $xT->ODicIcons()->EDITAR);
    //$xT->addTool(1);
    $xT->setKeyField($xAl->getKey());
    $xT->setKeyTable($xAl->get());
    return $xT->Show();
}
function jsaGetListadoDeAvisos($tipo, $fecha_inicial, $fecha_final, $todas)
{
    $tipo = $tipo == SYS_TODAS ? false : $tipo;
    $xT = new cTipos();
    $xF = new cFecha();
    $xAl = new cAml_alerts();
    $xlistas = new cSQLListas();
    $xBtn = new cHButton();
    $xImg = new cHImg();
    //
    $ByEstado = $xT->cBool($todas) == true ? "" : " AND `estado_en_sistema`= " . SYS_UNO;
    $ByEstado .= setNoMenorQueCero($tipo) <= 0 ? "" : "  AND (`aml_risk_catalog`.`tipo_de_riesgo` ={$tipo}) ";
    $fecha_inicial = $xF->getFechaISO($fecha_inicial);
    $fecha_final = $xF->getFechaISO($fecha_final);
    $sql = $xlistas->getListadoDeAlertas(false, false, false, false, $ByEstado);
    $xT = new cTabla($sql);
    $xT->setWithMetaData();
    $xT->OButton("TR.Dictaminar", "jsModificarEstatus(_REPLACE_ID_)", $xT->ODicIcons()->REPORTE);
    $xT->OButton("TR.Panel", "jsToPanel(_REPLACE_ID_)", $xT->ODicIcons()->EJECUTAR);
    $xT->setKeyField($xAl->getKey());
    $xT->setKeyTable($xAl->get());
    return $xT->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;
}
 /**
  * Funcion que inicializa el Recibo
  * @param array $arrInicial
  * @return unknown_type
  */
 function init($arrInicial = false)
 {
     $DR = array();
     $recibo = $this->mCodigoDeRecibo;
     if ($arrInicial != false and is_array($arrInicial)) {
         $DR = $arrInicial;
     } else {
         $xLi = new cSQLListas();
         $DR = obten_filas($xLi->getInicialDeRecibos($this->mCodigoDeRecibo, $this->mSocio));
     }
     $ORec = new cOperaciones_recibos();
     $ORec->setData($DR);
     if (isset($DR["tipo_docto"])) {
         $this->mTipoDeRecibo = $DR["tipo_docto"];
         $this->mTipoDePago = $DR["tipo_pago"];
         $this->mGrupoAsociado = $DR["grupo_asociado"];
         $this->mSocio = $DR["numero_socio"];
         $this->mDocto = $DR["docto_afectado"];
         $this->mNumeroCheque = $DR["cheque_afectador"];
         $this->mFechaDeOperacion = $DR["fecha_operacion"];
         $this->mObservaciones = $DR["observacion_recibo"];
         $this->mPathToFormato = $DR["path_formato"];
         $this->mTipoDescripcion = $DR["descripcion_recibostipo"];
         $this->mAplicadoA = $DR["origen"];
         $this->mReciboFiscal = $DR["recibo_fiscal"];
         $this->mTotalRecibo = $DR["total_operacion"];
         $this->mPathToFormato = $DR["path_formato"];
         $this->mOrigen = $DR["origen"];
         $this->mIndiceOrigen = $DR["indice_origen"];
         $this->mDatosByArray = $DR;
         $this->mFechaDeVcto = $this->mFechaDeOperacion;
         $this->mUsuario = $ORec->idusuario()->v();
         $this->mMoneda = strtoupper($ORec->clave_de_moneda()->v());
         $this->mUnidadesOriginales = strtoupper($ORec->unidades_en_moneda()->v());
         $this->mTipoOrigenAML = $ORec->origen_aml()->v();
         $this->mClavePersonAsoc = $ORec->persona_asociada()->v();
         unset($DR);
         $this->mReciboIniciado = true;
     } else {
         $this->mMessages .= "ERROR\tRecibo no encontrado # {$recibo}\r\n";
     }
     return $this->mReciboIniciado;
 }
 /** @deprecated 2014.04.01 */
 function getAvales_InHTML($style = "ficha")
 {
     $Slistas = new cSQLListas();
     $sql = $Slistas->getListadoDeAvales($this->getNumeroDeCredito());
     $rs = getRecordset($sql);
     $tbl = "";
     $tds = "";
     $cnt = 0;
     while ($rw = mysql_fetch_array($rs)) {
         $tds .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th id=\"id-relacion-" . $rw["num"] . "\" colspan='4'>" . $rw["relacion"] . "</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Socio Num.</td>\n\t\t\t\t\t\t<th>" . $rw["numero_socio"] . "</th>\n\t\t\t\t\t\t<td>Consanguinidad</td>\n\t\t\t\t\t\t<th>" . $rw["consanguinidad"] . "</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Nombre</td>\n\t\t\t\t\t\t<td colspan='3'>" . $rw["nombre"] . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Telefono(s)</td>\n\t\t\t\t\t\t<td>" . $rw["telefonos"] . "</td>\n\t\t\t\t\t\t<td>C.U.R.P.</td>\n\t\t\t\t\t\t<td>" . $rw["curp"] . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Domicilio</td>\n\t\t\t\t\t\t<td colspan='3'>" . $rw["domicilio"] . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t";
         $cnt++;
     }
     $tbl = "\n\t\t\t<fieldset>\n\t\t\t<legend>|&nbsp;&nbsp;&nbsp;INFORMACI&Oacute;N DE LOS AVALES&nbsp;&nbsp;&nbsp;|</legend>\n\t\t\t<table >\n\t\t\t\t{$tds}\n\t\t\t</table>\n\t\t\t</fieldset>";
     return $cnt == 0 ? "" : $tbl;
 }
//=====>	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.Lista de Cuentas");
$xL = new cSQLListas();
$oficial = elusuario($iduser);
//$i 			= $_GET["i"];
$f = parametro("f", false, MQL_RAW);
$tipo = parametro("a", false, MQL_INT);
$c = parametro("c", "idcuenta");
$subtipo = parametro("s", SYS_TODAS, MQL_INT);
$OtherEvent = parametro("ev");
//Otro Evento Desatado
$slimit = "";
$mrkSubproducto = setNoMenorQueCero($subtipo) <= 0 ? "" : " AND (`captacion_cuentas`.`tipo_subproducto` = {$subtipo}) ";
$xEquiv = new cSistemaEquivalencias();
if ($tipo == iDE_CAPTACION) {
    $tipo = false;
}
if ($tipo == iDE_CVISTA) {
$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;
    $sipatrimonio = isset($_GET["patrimonio"]) ? $_GET["patrimonio"] : SYS_NINGUNO;
    $siflujo = isset($_GET["flujo"]) ? $_GET["flujo"] : SYS_NINGUNO;
    $sihistorial = isset($_GET["historial"]) ? $_GET["historial"] : SYS_NINGUNO;
    $nowdate = fechasys();
    $rwc = $xCred->getDatosDeCredito();
    $fecha_de_solicitud = $rwc["fecha_solicitud"];
 */
//=====================================================================================================
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.PERFIL TRANSACCIONAL", HP_REPORT);
$xL = new cSQLListas();
$xF = new cFecha();
$query = new MQL();
$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);
$persona = parametro("persona", DEFAULT_SOCIO, MQL_INT);
$persona = parametro("socio", $persona, MQL_INT);
$persona = parametro("idsocio", $persona, MQL_INT);
$FechaInicial = parametro("on", false);
$FechaInicial = parametro("fecha-0", $FechaInicial);
$FechaInicial = $FechaInicial == false ? FECHA_INICIO_OPERACIONES_SISTEMA : $xF->getFechaISO($FechaInicial);
$FechaFinal = parametro("off", false);
$periodo = isset($_GET["periodo"]) ? $_GET["periodo"] : SYS_TODAS;
$empresa = isset($_GET["empresa"]) ? $_GET["empresa"] : SYS_TODAS;
$periocidad = isset($_GET["periocidad"]) ? $_GET["periocidad"] : SYS_TODAS;
//$estado		= (isset($_GET["estado"])) ? $_GET["estado"]: "todas";
$fecha_inicial = parametro("idfecha-0", false);
$fecha_inicial = parametro("on", $fecha_inicial);
$fecha_final = parametro("idfecha-1", false);
$fecha_final = parametro("off", $fecha_final);
echo $xHP->getHeader();
echo $xHP->setBodyinit("initComponents();");
$ByFecha = ($fecha_final == false or $fecha_inicial == false) ? "" : " AND\t(`empresas_operaciones`.`fecha_de_operacion` >='" . $xF->getFechaISO($fecha_inicial) . "') AND\t(`empresas_operaciones`.`fecha_de_operacion` <='" . $xF->getFechaISO($fecha_final) . "') ";
$ByPeriodo = $periodo == SYS_TODAS ? "" : "AND ( `periodo_marcado` = {$periodo}) ";
$xRPT = new cReportes();
echo $xRPT->getHInicial("TR.Estado de cuenta de Empresas", $fecha_inicial, $fecha_final);
//TODO: Acabar
$lt = new cSQLListas();
$sql = $lt->getListadoDeOperacionesDeEmpresas($empresa, $periocidad, $ByFecha . $ByPeriodo);
$xT = new cTabla($sql);
$xEmp = new cEmpresas($empresa);
echo $xEmp->getFicha();
$xT->getFieldsSum("monto");
$xT->setTdClassByType();
$xT->setFootSum(array(6 => "envios", 7 => "cobros"));
echo $xT->Show();
echo getRawFooter();
echo $xHP->setBodyEnd();
?>
<script>
<?php 
?>
function initComponents(){
//=====>	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
//=====================================================================================================
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();
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.Alertas Descartadas", HP_REPORT);
$xL = new cSQLListas();
$xF = new cFecha();
$query = new MQL();
$xAl = new cAml_alerts();
$xlistas = new cSQLListas();
$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);
$persona = parametro("persona", DEFAULT_SOCIO, MQL_INT);
$persona = parametro("socio", $persona, MQL_INT);
$persona = parametro("idsocio", $persona, MQL_INT);
$FechaInicial = parametro("on", false);
$FechaInicial = parametro("fecha-0", $FechaInicial);
$FechaInicial = $FechaInicial == false ? FECHA_INICIO_OPERACIONES_SISTEMA : $xF->getFechaISO($FechaInicial);
$FechaFinal = parametro("off", false);
$FechaFinal = parametro("fecha-1", $FechaFinal);
$FechaFinal = $FechaFinal == false ? fechasys() : $xF->getFechaISO($FechaFinal);
 */
//=====================================================================================================
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.CEDULA DE SOLICITUD DE RETENCION POR AHORRO", HP_REPORT);
$xL = new cSQLListas();
$xF = new cFecha();
$query = new MQL();
$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-0", $FechaInicial);
$FechaInicial = $FechaInicial == false ? FECHA_INICIO_OPERACIONES_SISTEMA : $xF->getFechaISO($FechaInicial);
$FechaFinal = parametro("off", false);
$FechaFinal = parametro("fecha-1", $FechaFinal);
$FechaFinal = $FechaFinal == false ? fechasys() : $xF->getFechaISO($FechaFinal);
$jsEvent = $out != OUT_EXCEL ? "initComponents()" : "";
 /**
  * Genera las polizas del dia por Cajero
  * @param date $fecha
  */
 function setGenerarPolizasAlCierre($fecha = false)
 {
     $xLi = new cSQLListas();
     $ql = new MQL();
     $msg = "";
     $otros = " AND (`operaciones_recibostipo`.`tipo_poliza_generada` != 999) AND `operaciones_recibos`.`total_operacion` > 0 ";
     $sql = $xLi->getListadoDeRecibos("", "", "", $fecha, $fecha, $otros);
     $rs = $ql->getDataRecord($sql);
     foreach ($rs as $rw) {
         $recibo = $rw["numero"];
         $xPol = new cPoliza(false);
         if ($xPol->setPorRecibo($recibo) == true) {
             $msg .= "WARN\tLa Poliza del recibo {$recibo} Existe con el ID " . $xPol->getCodigoUnico() . "\r\n";
         } else {
             $msg .= $this->setRegenerarPrepolizaContable($fecha, $recibo);
             $msg .= $this->setPolizaPorRecibo($recibo, true);
             if ($xPol->setPorRecibo($recibo) == false) {
                 $msg .= "ERROR\tAl generar la Poliza del recibo {$recibo}\r\n";
             }
         }
         $msg .= $xPol->getMessages();
     }
     $this->mMessages .= $msg;
     return $msg;
 }
$archivo = "";
$xRPT = new cReportes($titulo);
$xRPT->setFile($archivo);
$xRPT->setOut($out);
//$xRPT->setSQL($sql);
$xRPT->setTitle($xHP->getTitle());
//============ Reporte
$xSoc = new cSocio($persona);
$xSoc->init();
$body = $xRPT->getEncabezado($xHP->getTitle(), $FechaInicial, $FechaFinal);
$xRPT->setBodyMail($body);
$xRPT->addContent($body);
$xRPT->addContent($xSoc->getFicha(true));
//Bajo revision
$xAl = new cAml_alerts();
$xlistas = new cSQLListas();
$sql = $xlistas->getListadoDeAlertas(false, false, false, $persona, " AND `estado_en_sistema` =" . SYS_UNO);
$xT = new cTabla($sql);
$xRPT->addContent($xT->Show("TR.Alertas pendientes de verificar"));
//Descartados
$sql = $xlistas->getListadoDeAlertas(false, false, false, $persona, " AND `estado_en_sistema` =" . SYS_CERO);
$xT = new cTabla($sql);
$xRPT->addContent($xT->Show("TR.Alertas ignoradas"));
//Riesgos para reportar
$sql = $xlistas->getListadoDeRiesgosConfirmados(false, false, false, false, $persona, " AND `estado_de_envio`= " . SYS_CERO);
$xT = new cTabla($sql);
$xRPT->addContent($xT->Show("TR.Alertas pendientes de reportar"));
$sql = $xlistas->getListadoDeRiesgosConfirmados(false, false, false, false, $persona, " AND `estado_de_envio`= " . SYS_UNO);
$xT = new cTabla($sql);
$xRPT->addContent($xT->Show("TR.Alertas reportadas"));
$xRPT->setResponse();
 */
//=====================================================================================================
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("", HP_FORM);
$mSQL = new cSQLListas();
$DDATA = $_REQUEST;
$jxc = new TinyAjax();
//$jxc ->exportFunction('datos_del_pago', array('idsolicitud', 'idparcialidad'), "#iddatos_pago");
//$jxc ->process();
$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", 0, MQL_INT);
$cuenta = parametro("idcuenta", $cuenta, MQL_INT);
$jscallback = parametro("callback");
$tiny = parametro("tiny");
$form = parametro("form");
 function getResumenDeCaja()
 {
     $xF = new cFecha();
     $xSQL = new cSQLListas();
     $xTxt = new cHText();
     $xLn = new cLang();
     $xTbl = new cHTabla();
     $this->mSumaRecibos = 0;
     $this->mSumaCobros = 0;
     $resumen = "";
     $fecha_inicial = $this->mFecha;
     $fecha_final = $this->mFecha;
     $cajero = $this->mCajero;
     //==================================================================== TOTAL CORTE
     $resumen .= "<h3>" . $xLn->getT("TR.Resumen de caja") . "</h3>";
     $sqlTi = $xSQL->getListadoResumenTesoreria($cajero, $fecha_inicial, $fecha_final);
     $xT = new cTabla($sqlTi);
     $xT->setTdClassByType();
     $xT->setFootSum(array(2 => "operacion", 3 => "recibido", 4 => "cambio"));
     $resumen .= $xT->Show("TR.Resumen");
     $resumen .= "<input type='hidden' id='idsumacaja' value='" . $xT->getFieldsSum("recibido") . "' />";
     $resumen .= "<h3>" . $xLn->getT("TR.Efectivo") . "</h3>";
     //==================================================================== EFECTIVO
     $sqlTE = $xSQL->getListadoResumenOperaciones($fecha_inicial, $fecha_final, $cajero, TESORERIA_COBRO_EFECTIVO);
     $xTE = new cTabla($sqlTE);
     $xTE->setTdClassByType();
     $xTE->setFootSum(array(5 => "total"));
     $resumen .= $xTE->Show("TR.Cobros por Efectivo");
     $this->mSumaRecibos += $xTE->getFieldsSum("total");
     $resumen .= "<h3>" . $xLn->getT("TR.Documentos") . "</h3>";
     $sqlArq = "SELECT\r\n\t\t\t\t`tesoreria_caja_arqueos`.`fecha_de_arqueo`,\r\n\t\t\t\t`tesoreria_caja_arqueos`.`documento`,\r\n\t\t\t\t`tesoreria_caja_arqueos`.`monto_total_arqueado`,\r\n\t\t\t\t`tesoreria_caja_arqueos`.`observaciones` \r\n\t\t\tFROM\r\n\t\t\t\t`tesoreria_caja_arqueos` `tesoreria_caja_arqueos` \r\n\t\t\tWHERE\r\n\t\t\t\t(`tesoreria_caja_arqueos`.`codigo_de_caja` ='" . $this->getKey() . "')";
     $xTArq = new cTabla($sqlArq);
     $xTArq->setTdClassByType();
     $xTArq->setFootSum(array(2 => "monto_total_arqueado"));
     $resumen .= $xTArq->Show("TR.Arqueo");
     $this->mSumaCobros += $xTArq->getFieldsSum("monto_total_arqueado");
     //==================================================================== CHEQUES Y DOCUMENTOS
     $sqlLC = $xSQL->getListadoDeTesoreria($cajero, $fecha_inicial, $fecha_final, TESORERIA_COBRO_CHEQUE);
     $xT2 = new cTabla($sqlLC);
     $xT2->setTdClassByType();
     $xT2->setFootSum(array(5 => "operacion"));
     $resumen .= $xT2->Show("TR.Operaciones en Cheque");
     $this->mSumaCobros += $xT2->getFieldsSum("operacion");
     $sqlTD = $xSQL->getListadoResumenOperaciones($fecha_inicial, $fecha_final, $cajero, TESORERIA_COBRO_CHEQUE);
     $xTD = new cTabla($sqlTD);
     $xTD->setTdClassByType();
     $xTD->setFootSum(array(5 => "total"));
     $resumen .= $xTD->Show("TR.Cobros por Cheque");
     $this->mSumaRecibos += $xTD->getFieldsSum("total");
     $resumen .= "<h3>" . $xLn->getT("TR.Bancos") . "</h3>";
     //==================================================================== TRANFERENCIAS
     $sqlTO = $xSQL->getListadoDeCajaEnBanco(BANCOS_OPERACION_DEPOSITO, "", $cajero, $fecha_inicial, $fecha_final);
     $xT = new cTabla($sqlTO);
     $xT->setTdClassByType();
     $xT->setFootSum(array(4 => "monto"));
     $resumen .= $xT->Show("TR.Operaciones Bancarias");
     $this->mSumaCobros += $xT->getFieldsSum("monto");
     //-------------------------------------------
     $sqlT = $xSQL->getListadoResumenOperaciones($fecha_inicial, $fecha_final, $cajero, TESORERIA_COBRO_TRANSFERENCIA);
     $xT = new cTabla($sqlT);
     $xT->setTdClassByType();
     $xT->setFootSum(array(5 => "total"));
     $resumen .= $xT->Show("TR.Cobros por Transferencia");
     $this->mSumaRecibos += $xT->getFieldsSum("total");
     //====================================================================
     $xTbl->initRow();
     $xTbl->addTH("TR.Suma de Recibos");
     $xTbl->addTD(getFMoney($this->mSumaRecibos));
     $xTbl->endRow();
     $xTbl->initRow();
     $xTbl->addTH("TR.Suma de Cobranza");
     $xTbl->addTD(getFMoney($this->mSumaCobros));
     $xTbl->endRow();
     $resumen .= $xTbl->get();
     $resumen .= "<input type='hidden' id='idsumaoperaciones' value='" . $this->mSumaRecibos . "' />";
     $resumen .= "<input type='hidden' id='idsumacobros' value='" . $this->mSumaCobros . "' />";
     $this->mArqueoInit = true;
     return $resumen;
 }
//=====================================================================================================
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("REPORTE DE CREDITOS POR RANGO DE MORA", HP_REPORT);
$xF = new cFecha();
$xLi = new cSQLListas();
//=====================================================================================================
/**
 * Filtrar si Existe Caja Local
 */
$estatus = isset($_GET["f2"]) ? $_GET["f2"] : SYS_TODAS;
$frecuencia = isset($_GET["f1"]) ? $_GET["f1"] : SYS_TODAS;
$convenio = isset($_GET["f3"]) ? $_GET["f3"] : SYS_TODAS;
$estatus = isset($_GET["estado"]) ? $_GET["estado"] : $estatus;
$frecuencia = isset($_GET["periocidad"]) ? $_GET["periocidad"] : $frecuencia;
$frecuencia = isset($_GET["frecuencia"]) ? $_GET["frecuencia"] : $frecuencia;
$convenio = isset($_GET["convenio"]) ? $_GET["convenio"] : $convenio;
$empresa = isset($_GET["empresa"]) ? $_GET["empresa"] : SYS_TODAS;
$out = isset($_GET["out"]) ? $_GET["out"] : SYS_DEFAULT;
$es_por_estatus = "";
$BySaldo = " AND (creditos_solicitud.saldo_actual>=0.99) ";
		padding-left:1in;
		padding-right:1in;
		
	}
</style>
<!-- -->
<?php 
$xFecha = new cFecha();
$xCred = new cCredito($idsolicitud);
$xCred->initCredito();
$acreditante = $xCred->getClaveDePersona();
$xFMT = new cFormato($formato);
$xFMT->setCredito($idsolicitud);
$xFMT->setProcesarVars();
echo $xFMT->get();
$mSQL = new cSQLListas();
$mql = new MQL();
$sql = $mSQL->getListadoDeAvales($idsolicitud, $acreditante);
$rs = $mql->getDataRecord($sql);
//setLog($sql);
$forma = 5002;
//$xAval		= new cSocios_relaciones();
foreach ($rs as $rows) {
    echo "<br class='nuevapagina' />";
    $persona = $rows["numero_socio"];
    $idrelacion = $rows["num"];
    $xSoc = new cSocio($persona);
    //$xRel		= new cPersonasRelaciones($idrelacion); $xRel->init();
    if ($xSoc->init() == true) {
        $xFMT2 = new cFormato($forma);
        $xFMT2->setCredito($idsolicitud);
 function setActualizarNivelDeRiesgo($actualizar = false)
 {
     $xQL = new MQL();
     $xLi = new cSQLListas();
     $xLog = new cCoreLog();
     //$xLi->getInicialDeCuentas()
     $rs = $xQL->getDataRecord($xLi->getInicialDePersonas());
     foreach ($rs as $rows) {
         $persona = $rows["codigo"];
         $xAml = new cAMLPersonas($persona);
         $xAml->init($persona, $rows);
         $riesgo = $xAml->setAnalizarNivelDeRiesgo();
         $NivelActual = $xAml->getOPersona()->getNivelDeRiesgo();
         if ($riesgo != $NivelActual) {
             if ($riesgo >= SYS_RIESGO_MEDIO) {
                 $xLog->add($xAml->getMessages(), $xLog->DEVELOPER);
             }
             if ($actualizar == true) {
                 $xAml->getOPersona()->setActualizarNivelDeRiesgo($riesgo, $xAml->getMessages());
             }
             $xLog->add($xAml->getOPersona()->getMessages(), $xLog->DEVELOPER);
         }
     }
     return $xLog->getMessages();
 }
function jsaCumplimiento($idsocio)
{
    $xAl = new cAml_alerts();
    $xlistas = new cSQLListas();
    $sql = $xlistas->getListadoDeAlertas(false, false, false, $idsocio);
    $xT = new cTabla($sql);
    $xT->setKeyField($xAl->getKey());
    $xT->setKeyTable($xAl->get());
    return $xT->Show();
}
 */
//=====================================================================================================
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.REPORTE DE ", HP_REPORT);
$xL = new cSQLListas();
$xF = new cFecha();
$query = new MQL();
$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-0", $FechaInicial);
$FechaInicial = $FechaInicial == false ? FECHA_INICIO_OPERACIONES_SISTEMA : $xF->getFechaISO($FechaInicial);
$FechaFinal = parametro("off", false);
$FechaFinal = parametro("fecha-1", $FechaFinal);
$FechaFinal = $FechaFinal == false ? fechasys() : $xF->getFechaISO($FechaFinal);
$jsEvent = $out != OUT_EXCEL ? "initComponents()" : "";
//=====>	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.Recibos de Cobranza", HP_REPORT);
$xL = new cSQLListas();
$xF = new cFecha();
$empresa = isset($_GET["r"]) ? $_GET["r"] : 0;
$periocidad = isset($_GET["p"]) ? $_GET["p"] : "todos";
$variacion = isset($_GET["v"]) ? $_GET["v"] : 0;
$ByPeriodo = $periocidad == "todos" ? "" : " AND creditos_solicitud.periocidad_de_pago = {$periocidad} ";
$periodo = isset($_GET["periodo"]) ? $_GET["periodo"] : 0;
$out = parametro("out", OUT_HTML);
$xRPT = new cReportes($xHP->getTitle());
$fecha_filtro = fechasys();
$ByMinistracion = "";
//$periodo		= $periodo + $variacion;
$fechaInicial = parametro("on", false);
$fechaFinal = parametro("off", false);
$fechaFinal = $xF->getFechaISO($fechaFinal);
$fechaInicial = $xF->getFechaISO($fechaInicial);