header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
include_once "../core/entidad.datos.php";
include_once "../core/core.deprecated.inc.php";
include_once "../core/core.fechas.inc.php";
include_once "../libs/sql.inc.php";
include_once "../core/core.config.inc.php";
include_once "../core/core.common.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.operaciones.inc.php";
require_once "." . TINYAJAX_PATH . "/TinyAjax.php";
$jxc = new TinyAjax();
$xCaja = new cCaja();
if ($xCaja->getEstatus() == TESORERIA_CAJA_CERRADA) {
    header("location:../404.php?i=200");
}
function calcula_ica($solicitud, $form)
{
    $sql = "SELECT * FROM creditos_solicitud WHERE numero_solicitud={$solicitud}";
    $mysolicitud = obten_filas($sql);
    $socio = $mysolicitud["numero_socio"];
    // Numero de Socio
    $diasaut = $mysolicitud["dias_autorizados"];
    // Dias Autorizados
    $montoMin = $mysolicitud["monto_autorizado"];
    // Monto Autorizado
    $tasaInt = $mysolicitud["tasa_interes"];
//=====>	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("", HP_FORM);
$jxc = new TinyAjax();
//Mvtos
$poliza = parametro("n", false, MQL_INT);
$periodo = parametro("p", false, MQL_INT);
$tipo = parametro("t", false, MQL_INT);
$ejercicio = parametro("e", false, MQL_INT);
$keypoliza = "";
$str_action = "frm_poliza_movimientos.php?n={$poliza}&p={$periodo}&e={$ejercicio}&t={$tipo}";
$m_mvto = 1;
$me_mvto = 2;
$d_concepto = "";
$k_mvto = "";
$fecha = fechasys();
function save_mvto($keymvto, $cuenta, $cargo, $abono, $referencia, $concepto, $mfecha, $form)
{
    if (isset($cuenta) and ($cargo > 0 or $abono > 0)) {
//$xT->cInt($_POST["idsocio"]);
$detalles = parametro("idobservaciones", "");
$monto = parametro("idmonto", 0, MQL_FLOAT);
$cheque = parametro("cheque", DEFAULT_CHEQUE);
$comopago = parametro("ctipo_pago", DEFAULT_TIPO_PAGO, MQL_RAW);
$folio_fiscal = parametro("foliofiscal", DEFAULT_RECIBO_FISCAL);
$msg = parametro(SYS_MSG);
$action = parametro("action", SYS_NINGUNO);
$xCaja = new cCaja();
if ($xCaja->getEstatus() == TESORERIA_CAJA_CERRADA) {
    header("location:../404.php?i=200");
}
if (isset($iddocto)) {
    $actload = " onload='jsImprimirRecibo();' ";
}
$jxc = new TinyAjax();
function jsaGetIDE($socio, $monto, $tipo_de_pago)
{
    $xSoc = new cSocio($socio);
    $xSoc->init();
    $x = $xSoc->getIDExPagarByPeriodo(false, $monto, $tipo_de_pago);
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("idide", $x));
    return $tab->getString();
}
$jxc->exportFunction('jsaGetIDE', array('idsocio', "idmonto", "idtipo_pago"));
$jxc->process();
echo $xHP->getHeader();
$xFRM = new cHForm("depositoahorro", "frmdepositoinversion.php?action=next");
$xBtn = new cHButton();
$xTxt = new cHText();
$xHP = new cHPage("TR.Editor de contratos");
$oficial = elusuario($iduser);
$idcontrato = parametro("idcontrato", 0, MQL_INT);
$a = parametro("s");
$jscallback = parametro("callback");
$tiny = parametro("tiny");
$form = parametro("form");
$action = parametro("action", SYS_NINGUNO);
$xHP->addJsFile("../js/ckeditor/ckeditor.js");
$xFRM = new cHForm("frmeditor", "frmeditor_contratos.php?action=1");
$xBtn = new cHButton();
$xTxt = new cHText();
$xDate = new cHDate();
$xSel = new cHSelect();
$xFMT = new cFormato(false);
$jxc = new TinyAjax();
function jsAgregarContrato($id, $nombre)
{
    $xForma = new cFormato();
}
//$jxc ->exportFunction('jsAgregarContrato', array('idsolicitud', 'idparcialidad'), "#iddatos_pago");
$jxc->process();
//ini_set("display_errors", "on");
$xHP->init("initComponents()");
if ($action == SYS_NINGUNO) {
    $xFRM->addHElem($xFMT->getSelectDeFormatos()->get(true));
    $xFRM->addSubmit();
} elseif ($action == SYS_UNO) {
    //editar
    $xFMT->init($idcontrato);
    $titulo = $xFMT->getTitulo();
$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"];
//=====================================================================================================
require_once "." . TINYAJAX_PATH . "/TinyAjax.php";
$cuenta = isset($_POST["NumeroDeCuenta"]) ? $_POST["NumeroDeCuenta"] : false;
$xP = new cHPage("Guia Contable");
$xP->setIncludes();
echo $xP->getHeader();
$oficial = elusuario($iduser);
$jxc = new TinyAjax();
function jsaSaveOperacion($cuenta, $operacion, $descripcion)
{
}
$jxc->exportFunction('jsaSaveOperacion', array('idCuenta', 'idOperacion', 'idDescripcion'));
$jxc->process();
$xHTxt = new cHText("id");
$xHTxt->setIncludeLabel();
$jsb = new jsBasicForm("frmGuia");
$jsb->setIncludeJQuery();
$jsb->show();
$jxc->drawJavaScript(false, true);
?>
<style>

#wrapper {
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
include_once "../core/entidad.datos.php";
include_once "../core/core.deprecated.inc.php";
include_once "../core/core.fechas.inc.php";
include_once "../libs/sql.inc.php";
include_once "../core/core.config.inc.php";
require_once "." . TINYAJAX_PATH . "/TinyAjax.php";
$oficial = elusuario($iduser);
$jxc = new TinyAjax();
function jsGetCreditosByCriteria($convenio, $estatus, $periocidad, $oficial)
{
    $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}) ";
//=====>	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.Panel de Control de personas", HP_FORM);
$jxc = new TinyAjax();
$xql = new cSQLListas();
$ql = new MQL();
$xImg = new cHImg();
$xF = new cFecha();
$jsTabs = "";
$idempresa = 0;
$oficial = elusuario($iduser);
$idsocio = parametro("idsocio", false, MQL_INT);
$idsocio = parametro("persona", $idsocio, MQL_INT);
$idsocio = parametro("socio", $idsocio, MQL_INT);
$xJsB = new jsBasicForm("extrasocios");
function jsaReVivienda($idsocio)
{
    $ql = new cSQLListas();
    $sqlvv = "SELECT socios_vivienda.idsocios_vivienda AS 'num',\n\t\t\n\t\t\t\t\tCONCAT('Calle ', socios_vivienda.calle, ' Num. ',\n\t\t\t\t\tsocios_vivienda.numero_exterior, '-', socios_vivienda.numero_interior, ' Col. ',\n\t\t\t\t  \tsocios_vivienda.colonia, ', ', socios_vivienda.localidad, ', ', estado)\n\t\t\t\t\tAS 'domicilio_completo',\n\t\t\t\t\tgetBooleanMX(socios_vivienda.principal) AS 'es_principal'\n\t\t\t\t    FROM socios_vivienda WHERE socio_numero={$idsocio}  LIMIT 0,10";
//=====>	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("Generar Planes de Pagos");
$jxc = new TinyAjax();
$xF = new cFecha();
$solicitud = isset($_POST["idsolicitud"]) ? $_POST["idsolicitud"] : 0;
$altSocio = DEFAULT_SOCIO;
$altCred = DEFAULT_CREDITO;
$altOC = 0;
$altIDOC = OPERACION_CLAVE_DE_COBRANZA;
// 1005;
$creditosDiasDePago = CREDITO_DEFAULT_DIAS_DE_PAGO;
$defFechaMinistracion = fechasys();
$defFechaAbono = fechasys();
$defCuentaCorriente = CTA_GLOBAL_CORRIENTE;
$defFormaDePago = CREDITO_DEFAULT_TIPO_PAGO;
$urlsend = "";
$idrecibo = DEFAULT_RECIBO;
$urctr = "";
// Tipo de code_type
settype($v_0f743, "string");
// Tipo de description_short
settype($v_41f88, "string");
// Tipo de estructura_de_la_formula
$v_b62df = trim($_POST['c_b62df']);
// Variable de aplicado_a
$v_23088 = trim($_POST['c_23088']);
// Variable de code_type
$v_0f743 = trim($_POST['c_0f743']);
// Variable de description_short
$v_41f88 = trim($_POST['c_41f88']);
// Variable de estructura_de_la_formula
//Tiny Ajax en Accion
require_once "." . TINYAJAX_PATH . "/TinyAjax.php";
$jxc = new TinyAjax();
//Funcion que rellena los datos del Form
function jsGetRegistro($filter, $form)
{
    $n_type = gettype($filter);
    if ($n_type == "string") {
        $filter = "'{$filter}'";
    }
    $sql = "SELECT * FROM general_formulas WHERE aplicado_a = {$filter} LIMIT 0,1";
    $rs = mysql_query($sql, cnnGeneral());
    if (!$rs) {
        saveError(2, $_SESSION["SN_b80bb7740288fda1f201890375a60c8f"], "Depurar :" . mysql_error() . "|Numero: " . mysql_errno() . "|Instruccion SQL:" . $sql);
    }
    $nfields = mysql_num_fields($rs) - 1;
    $tab = new TinyAjaxBehavior();
    while ($rw = mysql_fetch_array($rs)) {
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);
$xQL = new MQL();
$xLi = new cSQLListas();
$xF = new cFecha();
$msg = "";
$jxc = new TinyAjax();
$jxc->exportFunction('datos_del_pago', array('idsolicitud', 'idparcialidad'), "#iddatos_pago");
$jxc->process();
$fecha = parametro("idfecha-0", false, MQL_DATE);
$fecha = parametro("idfechaactual", $fecha, MQL_DATE);
$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");
//=====================================================================================================
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);
$DDATA = $_REQUEST;
$jxc = new TinyAjax();
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_)\" "));
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);
$xQL = new MQL();
$xLi = new cSQLListas();
$xF = new cFecha();
$jxc = new TinyAjax();
function jsaGuardarCastigo($credito, $fecha, $razones)
{
    $xCred = new cCredito($credito);
    $xCred->init();
    $xCred->setCastigado($razones, $fecha);
    return $xCred->getMessages();
}
$jxc->exportFunction('jsaGuardarCastigo', array('idsolicitudactual', "idfecha", "idrazones"), "#idmsgs");
$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);
 */
//=====================================================================================================
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.Buscar Grupos", HP_FORM);
$jxc = new TinyAjax();
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();
}
$jxc->exportFunction('jsaGetGrupos', array('idbusqueda'), "#listabusqueda");
$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);
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.Cobro de Comisiones");
$xCaja = new cCaja();
$xF = new cFecha();
$jxc = new TinyAjax();
function jsaGetSumas($com1, $com2, $com3)
{
    $suma = $com1 + $com2 + $com3;
    $iva = round($suma * TASA_IVA, 2);
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("idsuma", $suma + $iva));
    $tab->add(TabSetValue::getBehavior("idiva", $iva));
    return $tab->getString();
}
function jsaGetComisionPorApertura($idcredito)
{
    $xCred = new cCredito($idcredito);
    $xCred->init();
    $tasa = $xCred->getOProductoDeCredito()->getTasaComisionApertura();
    return round($xCred->getMontoAutorizado() * $tasa, 2);
    $xRe->setFinalizarRecibo();
    $msg .= $xSoc->getMessages(OUT_TXT);
    $msg .= $xCred->getMessages(OUT_TXT);
    $msg .= $xRe->getMessages(OUT_TXT);
    $xF = new cFileLog();
    $xF->setWrite($msg);
    $xF->setClose();
    return $xF->getLinkDownload("Descarga de Log");
}
function jsaSetCambiarPersona($credito, $nuevapersona)
{
    $xUtil = new cUtileriasParaCreditos();
    $xUtil->setCambiarPersonaDeCredito($credito, $nuevapersona);
    return $xUtil->getMessages(OUT_HTML);
}
$jxc = new TinyAjax();
$jxc->exportFunction('jsaCambiarMontoAutorizado', array('idsolicitud', 'idmontoaut'), "#avisos");
$jxc->exportFunction('jsaCambiarMontoMinistrado', array('idsolicitud', 'idmonto'), "#avisos");
$jxc->exportFunction('jsaCambiarFechaMinistracion', array('idsolicitud', 'idfecha-1'), "#avisos");
$jxc->exportFunction('jsaCambiarEstadoActual', array('idsolicitud', 'idestadoactual', 'idfecha-3'), "#avisos");
$jxc->exportFunction('jsaVincularEmpresa', array('idsolicitud', 'idobservacionesw', 'idcodigodeempresas'), "#avisos");
$jxc->exportFunction('jsaCambiarProducto', array('idsolicitud', 'idpdto', 'idtasa', 'idtasamora'), "#avisos");
$jxc->exportFunction('jsaCambiarPeriocidad', array('idsolicitud', 'idperiocidad', 'idtipopago', 'idpagos', 'idfecha-2', 'idpagoactual'), "#avisos");
$jxc->exportFunction('jsaEliminarCredito', array('idsolicitud'), "#avisos");
$jxc->exportFunction('jsaReestructurarIntereses', array('idsolicitud'), "#avisos");
$jxc->exportFunction('jsaSetCambiarPersona', array('idsolicitud', 'idnuevapersona'), "#avisos");
//
$jxc->process();
$xHP->init();
echo "<input type='hidden' id='idsolicitud' value='{$credito}'>";
$xCred = new cCredito($credito);
 * @package
 */
//=====================================================================================================
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);
//=====================================================================================================
$xHP = new cHPage("Validacion y Verificacion de Datos del Socio", HP_FORM);
$jxc = new TinyAjax();
function jsaGuardarVerificacion($fecha, $oficial, $tipo, $id, $notas, $socio)
{
    $xF = new cFecha();
    $fecha = $xF->getFechaISO($fecha);
    $tipo = $tipo == "d" ? TPERSONAS_DIRECCIONES : TPERSONAS_ACTIVIDAD_ECONOMICA;
    $xSoc = new cSocio($socio);
    $xSoc->init();
    $xSoc->setVerificacion($tipo, $id, $fecha, $notas, $oficial);
    return $xSoc->getMessages(OUT_HTML);
}
$jxc->exportFunction('jsaGuardarVerificacion', array('idfechaverificacion', 'idoficial', 'idtipo', 'idclave', "idnotas", 'idsocio'), "#avisos");
$jxc->process();
$tipo = $_REQUEST["t"];
$id = $_REQUEST["i"];
$socio = $_REQUEST["s"];
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
$xHP = new cHPage("TR.Log reader");
$oficial = elusuario($iduser);
function jsaGetLog($txt)
{
    $xHT = new cHObject();
    $log_file = "grep error_log /etc/php.ini";
    $vars = file_get_contents(SYS_LOG_FILE);
    $vars = $xHT->Out($vars, OUT_HTML);
    return $vars;
}
$jxc = new TinyAjax();
$jxc->exportFunction('jsaGetLog', array('logtype'), "#txtlog");
$jxc->process();
$xHP->init();
?>
<body>
<form name="frmreadlog" method="post" action="leer_log.frm.php">
	<table border='0' width='100%'>
		<tr>
			<td>LOG a Leer</td>
			<td><select name='logtype' id='idlogtype'>
			<option value="php">PHP ERROR LOG FILE</option>
			<option value="mysql">MYSQL ERROR LOG FILE</option>
			<option value="apache">APACHE ERROR LOG FILE</option>
			</select></td>
		</tr>
if (!file_exists(dirname(__FILE__) . "/core/core.config.os." . strtolower(substr(PHP_OS, 0, 3)) . ".inc.php")) {
    header("location: install/install.php");
} else {
    /*session_destroy();*/
}
//------------------------- includes -------------------------
include_once "./core/core.config.inc.php";
include_once "./core/entidad.datos.php";
include_once "./core/core.db.inc.php";
include_once "./core/core.db.dic.php";
include_once "./core/core.lang.inc.php";
include_once "./core/core.html.inc.php";
require_once "./libs/TinyAjax.php";
//-------------------------------------------------------------
$jxc = new TinyAjax();
$funid = ROTTER_KEY;
function fu_76e369257240ded4b1c059cf20e8d9a4($low, $form)
{
    $funid2 = ROTTER_KEY;
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("t{$funid2}", md5($low)));
    return $tab->getString();
}
function jsaSetSucursal($sucursal)
{
    getSucursal($sucursal);
}
$jxc->exportFunction('fu_76e369257240ded4b1c059cf20e8d9a4', array("t{$funid}", "frm{$funid}"));
$jxc->exportFunction('jsaSetSucursal', array("idsucursal"), "#idavisos");
$jxc->process();
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.Listado de Recibos");
$msg = "";
$oficial = elusuario($iduser);
$jxc = new TinyAjax();
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();
}
$jxc->exportFunction('getListRecibos', array('idTipoRecibo', 'idsocio'), "#lst-resultados");
$jxc->process();
$c = parametro("c", false, MQL_RAW);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
include_once "../core/entidad.datos.php";
include_once "../core/core.deprecated.inc.php";
include_once "../core/core.fechas.inc.php";
include_once "../core/core.config.inc.php";
$pUSRNivel = $_SESSION["SN_d567c9b2d95fbc0a51e94d665abe9da3"];
$oficial = elusuario($iduser);
/* Tiny Ajax Includes */
require_once "." . TINYAJAX_PATH . "/TinyAjax.php";
$jxc = new TinyAjax();
//Valores de Control por default
$FActual = date("Y-m-d");
$retrieveKey = $_GET["x"];
$rw = explode("^", "0^");
//Genera Valores por el GET KEY recibido
if (isset($retrieveKey)) {
    if (is_string($retrieveKey)) {
        $retrieveKey = "'{$retrieveKey}'";
    }
    $sqlEXP = "SELECT idreport, descripcion_reports, aplica, idgeneral_reports, explicacion\n                FROM general_reports\n                WHERE ={$retrieveKey}";
    $rw = obten_filas($sqlEXP);
}
function xul_update_record($jx_idreport, $jx_descripcion_reports, $jx_aplica, $jx_idgeneral_reports, $jx_explicacion)
{
    $msg = "";
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.Diario Contable", HP_FORM);
$poliza = parametro("codigo", "");
$jxc = new TinyAjax();
function jsaGetCuentas($cuenta)
{
    $xCta = new cCuentaContableEsquema($cuenta);
    $sql = "SELECT numero, nombre FROM contable_catalogo WHERE numero LIKE '" . $xCta->CUENTARAW . "%' AND afectable=1  ORDER BY numero LIMIT 0,10";
    $ql = new MQL();
    $rs = $ql->getDataRecord($sql);
    $h = "";
    foreach ($rs as $rows) {
        $xCta2 = new cCuentaContableEsquema($rows["numero"]);
        $h .= "<option value=\"" . $rows["numero"] . "\">" . $xCta2->CUENTARAW . "-" . $rows["nombre"] . "</option>";
    }
    return $h;
}
function jsaGetListadoDeMovimientos($poliza)
{
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);
$pUSRNivel = $_SESSION["SN_d567c9b2d95fbc0a51e94d665abe9da3"];
$oficial = elusuario($iduser);
$jxc = new TinyAjax();
//Valores de Control por default
$FActual = date("Y-m-d");
$retrieveKey = $_GET["x"];
$rw = explode("^", "0^");
//Genera Valores por el GET KEY recibido
if (isset($retrieveKey)) {
    if (is_string($retrieveKey)) {
        $retrieveKey = "'{$retrieveKey}'";
    }
    $sqlEXP = "SELECT idcontable_centrodecostos, nombre_centrodecostos \r\n                FROM contable_centrodecostos \r\n                WHERE idcontable_centrodecostos={$retrieveKey}";
    $rw = obten_filas($sqlEXP);
}
function xul_update_record($ajax_idcontable_centrodecostos, $ajax_nombre_centrodecostos)
{
    $msg = "";
$_SESSION["current_file"] = addslashes($theFile);
//=====================================================================================================
$xHP = new cHPage("Renegociar Creditos", HP_FORM);
function jsaGuardarReestructura($credito, $monto, $pagos, $periocidad, $tasa, $observaciones, $producto, $tipopago)
{
    $tasa = $tasa / 100;
    $xCred = new cCredito($credito);
    $xCred->init();
    $xCred->setReconvenido($monto, 0, $tasa, $periocidad, $pagos, $observaciones, false, false, $tipopago, $producto);
    $xF = new cFileLog();
    $xF->setWrite($xCred->getMessages());
    $xF->setClose();
    return $xCred->getMessages(OUT_HTML) . $xF->getLinkDownload("Descarga de Log");
}
$credito = isset($_REQUEST["credito"]) ? $_REQUEST["credito"] : false;
$jxc = new TinyAjax();
$jxc->exportFunction('jsaGuardarReestructura', array('idsolicitud', 'idmonto', 'idpagos', 'idperiocidad', 'idtasa', 'idobservaciones', 'idpdto', 'idtipopago'), "#resultados");
$jxc->process();
echo $xHP->getHeader();
//$xHP->setTamannio(500,800);
$jsb = new jsBasicForm("frmrenegociar");
echo $xHP->setBodyinit();
echo "<input type='hidden' id='idsolicitud' value='{$credito}'>";
$xCred = new cCredito($credito);
$xCred->init();
$oBtn = new cHButton();
$oTxt = new cHText();
$oFech = new cHDate();
$oSel = new cSelect("");
$oUL = new cHUl();
$oTa = new cHTextArea();
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
include_once "../core/entidad.datos.php";
include_once "../core/core.deprecated.inc.php";
include_once "../core/core.fechas.inc.php";
include_once "../libs/sql.inc.php";
include_once "../core/core.config.inc.php";
include_once "../core/core.contable.inc.php";
require_once "." . TINYAJAX_PATH . "/TinyAjax.php";
$oficial = elusuario($iduser);
$jxc = new TinyAjax();
function jsaGetPolizas($tipo = false, $dia = false)
{
    $ByDia = "";
    $ByTipo = "";
    $tbl = "";
    $td = "";
    if ($tipo != false and $tipo != "todas") {
        $ByTipo = " AND\n\t\t(`contable_polizas`.`tipopoliza` = {$tipo} ) ";
    }
    if ($dia != false and $dia != "todas") {
        $dia = EJERCICIO_CONTABLE . "-" . EACP_PER_CONTABLE . "-" . $dia;
        $ByDia = " AND\n\t\t(`contable_polizas`.`fecha` = '{$dia}' ) ";
    }
    $sql = "\nSELECT\n\tCONCAT(`contable_polizas`.`ejercicio`, '" . STD_LITERAL_DIVISOR . "' ,\n\t`contable_polizas`.`periodo`, '" . STD_LITERAL_DIVISOR . "' ,\n\t`contable_polizas`.`tipopoliza`, '" . STD_LITERAL_DIVISOR . "' ,\n\t`contable_polizas`.`numeropoliza`) AS 'codigo',\n\t`contable_polizas`.`numeropoliza` AS 'numero',\n\t`contable_polizasdiarios`.`nombre_del_diario` AS 'tipo',\n\t`contable_polizas`.`fecha`,\n\t`contable_polizas`.`cargos`,\n\t`contable_polizas`.`abonos`\nFROM\n\t`contable_polizas` `contable_polizas`\n\t\tINNER JOIN `contable_polizasdiarios` `contable_polizasdiarios`\n\t\tON `contable_polizas`.`tipopoliza` = `contable_polizasdiarios`.\n\t\t`idcontable_polizadiarios`\nWHERE\n\t\t`contable_polizas`.`ejercicio` = " . EJERCICIO_CONTABLE . "\n\t\tAND\n\t\t`contable_polizas`.`periodo` = " . EACP_PER_CONTABLE . "\n\t\t{$ByDia}\n\t\t{$ByTipo}\nORDER BY\n\t\t`contable_polizas`.`ejercicio`,\n\t\t`contable_polizas`.`periodo`,\n\t\t`contable_polizas`.`fecha` DESC,\n\t\t`contable_polizas`.`tipopoliza`,\n\t\t`contable_polizas`.`numeropoliza` DESC\nLIMIT 0,100\n\t";
    $rs = mysql_query($sql, cnnGeneral());
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.Alta del Catalogo_contable");
$xQL = new MQL();
$xLi = new cSQLListas();
$xF = new cFecha();
$jxc = new TinyAjax();
function jsaHeredarDatos($idcuenta)
{
    $tab = new TinyAjaxBehavior();
    $xLog = new cCoreLog();
    $xCta = new cCuentaContable($idcuenta);
    $cuenta = "";
    $nombre = "";
    $superior = "";
    $nombresupe = "";
    $tipo = "";
    $nivel = "";
    $centro = "";
    $superiorf = "";
    $operar = 0;
    $equivale = "";
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
include_once "../core/entidad.datos.php";
include_once "../core/core.deprecated.inc.php";
include_once "../core/core.fechas.inc.php";
include_once "../libs/sql.inc.php";
include_once "../core/core.config.inc.php";
include_once "../core/core.creditos.inc.php";
include_once "../core/core.captacion.inc.php";
include_once "../core/core.common.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.operaciones.inc.php";
require_once "." . TINYAJAX_PATH . "/TinyAjax.php";
$oficial = elusuario($iduser);
$jxc = new TinyAjax();
function jsaGetCalculos($socio, $acciones, $tipo_de_pago)
{
    $xSoc = new cSocio($socio);
    $coste = COSTE_POR_ACCION * $acciones;
    $monto = $tipo_de_pago == "efectivo" ? $coste : 0;
    $ide = $tipo_de_pago == "efectivo" ? $xSoc->getIDExPagarByPeriodo(false, $monto) : 0;
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("idCoste", getFMoney($coste)));
    $tab->add(TabSetValue::getBehavior("idide", getFMoney($ide)));
    //$tab -> add( TabSetValue::getBehavior("idObservaciones", $xSoc->getMessages("txt") ) );
    return $tab->getString();
}
$jxc->exportFunction('jsaGetCalculos', array('idsocio', 'idNumeroAcciones', "idtipo_pago"));
$jxc->process();
$html = new cHTMLObject();
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("Creditos.- Solicitudes");
$oficial = elusuario($iduser);
$xHP->setTitle($xHP->lang(array("solicitud", "de", "credito")));
//-------------------------------------------------------------
$jxc = new TinyAjax();
function calcula_vencimientos($idcuenta)
{
}
function jsaGetLetrasByNumero($monto = 0)
{
    return convertirletras($monto);
}
function jsaValidarMontoDeCredito($socio, $convenio, $monto)
{
    $msg = "";
    $xT = new cTipos();
    $xSoc = new cSocio($socio);
    $xSoc->init();
    $datos = array("tipo_de_producto" => $convenio);
    $monto_maximo = $xSoc->setPrevalidarCredito($datos, true);
include_once "../core/core.config.inc.php";
include_once "../core/core.creditos.inc.php";
require_once "." . TINYAJAX_PATH . "/TinyAjax.php";
$oficial = elusuario($iduser);
function jsaGetDatosDelCredito($credito, $socio)
{
    $cred = new cCredito($credito, $socio);
    $cred->initCredito();
    $DC = $cred->getDatosDeCredito();
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior('idMonto', $DC["saldo_actual"]));
    $tab->add(TabSetValue::getBehavior('idIntereses', $DC["interes_normal_devengado"]));
    $tab->add(TabSetValue::getBehavior('idTasa', $DC["tasa_interes"]));
    return $tab->getString();
}
$jxc = new TinyAjax();
$jxc->exportFunction('jsaGetDatosDelCredito', array('idsolicitud', "idsocio"));
$jxc->process();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Reconvenios de Credito.- M&oacute;dulo</title>
</head>
<link href="<?php 
echo CSS_GENERAL_FILE;
?>
" rel="stylesheet" type="text/css">
<?php 
jsbasic("frmreconvenios", "", ".");
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.lista de Alertas", HP_FORM);
$xF = new cFecha();
$xlistas = new cSQLListas();
$jxc = new TinyAjax();
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);
//=====================================================================================================
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);
$DDATA = $_REQUEST;
$jxc = new TinyAjax();
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);
}
$jxc->exportFunction('jsaGuardarPerfil', array('idpersona', 'idtipotransaccion', 'idpais', 'idmonto', 'idnumero', 'idobservaciones'), "#idperfil");
$jxc->process();
$persona = isset($DDATA["persona"]) ? $DDATA["persona"] : DEFAULT_SOCIO;
$persona = isset($DDATA["socio"]) ? $DDATA["socio"] : $persona;
$credito = isset($DDATA["credito"]) ? $DDATA["credito"] : DEFAULT_CREDITO;