function save_mvto($keymvto, $cuenta, $cargo, $abono, $referencia, $concepto, $mfecha, $form)
{
    if (isset($cuenta) and ($cargo > 0 or $abono > 0)) {
        $dkeys = explode("@", $keymvto);
        $nejercicio = $dkeys[1];
        $nperiodo = $dkeys[2];
        $npoliza = $dkeys[3];
        $ntipo = $dkeys[4];
        $nmvto = $dkeys[5];
        //Valores de los proximos Movimientos
        $ProxMCargo = 0;
        $ProxMAbono = 0;
        $tmvto = 1;
        $monto = 0;
        $fecha = getFechaUS($mfecha);
        //Conservar
        $diario = 999;
        $cuenta = getCuentaCompleta($cuenta);
        /**
         * verificar la Fecha
         */
        $valFecha = validarFechaUS($fecha);
        if ($valFecha = false) {
            $fecha = $mfecha;
            $valFecha = validarFechaUS($mfecha);
        }
        if ($valFecha = false) {
            $fecha = fechasys();
        }
        /**
         * Agrega el Movimiento
         *
         */
        if ($cargo > 0) {
            $tmvto = TM_CARGO;
            $monto = $cargo;
        } else {
            $tmvto = TM_ABONO;
            $monto = $abono;
        }
        $ProxMAbono = $cargo;
        $ProxMCargo = $abono;
        //-------------------------------------------------------------------------------------------------------
        $sqldcta = "SELECT\n\t\t`contable_catalogo`.`numero`,\n\t\t(`contable_catalogotipos`.`naturaleza` * `contable_catalogotipos`.`naturaleza_del_sector`) AS 'factor'\n\tFROM\n\t\t`contable_catalogotipos` `contable_catalogotipos`\n\t\t\tINNER JOIN `contable_catalogo` `contable_catalogo`\n\t\t\tON `contable_catalogotipos`.\n\t\t\t`idcontable_catalogotipos` = `contable_catalogo`.\n\t\t\t`tipo`\n\tWHERE `contable_catalogo`.`numero`= {$cuenta} LIMIT 0,1";
        $dcuenta = getFilas($sqldcta);
        //var_dump($dcuenta);
        $naturaleza = $dcuenta["factor"];
        //variables de mensajes
        $afect1 = "";
        $afect2 = "";
        //1=CARGO
        //2=ABONO
        //3=SALDO
        setAfectarSaldo($cuenta, $nperiodo, $nejercicio, $naturaleza, $tmvto, $monto);
        $referencia = trim($referencia);
        $concepto = trim($concepto);
        //-------------------------------------------------------------------------------------------------------
        $sqli_mvto = "INSERT INTO contable_movimientos(ejercicio, periodo, tipopoliza, numeropoliza, numeromovimiento,\n\tnumerocuenta, tipomovimiento, referencia, importe, diario, moneda, concepto, fecha, cargo, abono)\n\t    VALUES({$nejercicio}, {$nperiodo},\n\t    {$ntipo}, {$npoliza},\n\t    {$nmvto}, {$cuenta},\n\t    '{$tmvto}', '{$referencia}',\n\t    {$monto}, {$diario}, 1,\n\t    '{$concepto}', '{$fecha}',\n\t    {$cargo}, {$abono})";
        my_query($sqli_mvto);
        $notes = "";
        $nmvto = $nmvto + 1;
        $nk_mvto = "i@{$nejercicio}@{$nperiodo}@{$npoliza}@{$ntipo}@{$nmvto}";
        $tab = new TinyAjaxBehavior();
        $tab->add(TabSetValue::getBehavior('idkeymvto', $nk_mvto));
        $tab->add(TabSetValue::getBehavior('idfecha', $fecha));
        $tab->add(TabSetValue::getBehavior('idd_concepto', $concepto));
        $tab->add(TabSetValue::getBehavior('idcuenta', $cuenta));
        if (PREDICT_MOVIMIENTO == true) {
            $tab->add(TabSetValue::getBehavior('idcargo', $ProxMCargo));
            $tab->add(TabSetValue::getBehavior('idabono', $ProxMAbono));
        }
        if ($referencia != "") {
            $tab->add(TabSetValue::getBehavior('idreferencia', $referencia));
        }
        if ($concepto != "") {
            $tab->add(TabSetValue::getBehavior('idconcepto', $concepto));
        }
        $tab->add(TabSetValue::getBehavior('icontarrows', $nmvto));
        return $tab->getString();
    }
    // en if
}
function jsaSetPago($Recibo, $cheque1, $Cuenta1, $monto1, $cheque2, $Cuenta2, $monto2)
{
    $sucess = true;
    $tab = new TinyAjaxBehavior();
    $xCtaBanc = new cCuentaBancaria($Cuenta1);
    $xCaja = new cCaja();
    //$recibo, $MontoRecibido, $banco, $cheque
    if (floatval($monto1) > 0) {
        $s1 = $xCtaBanc->getVerificarCheque($cheque1, $monto1);
        $sucess = $s1;
        if ($s1 == false) {
            $tab->add(TabSetValue::getBehavior("iNumeroCheque1", "0"));
        }
    }
    if (floatval($monto2) > 0) {
        $xCtaBanc->set($Cuenta2);
        $s2 = $xCtaBanc->getVerificarCheque($cheque2, $monto2);
        $sucess = $s2;
        if ($s1 == false) {
            $tab->add(TabSetValue::getBehavior("iNumeroCheque2", "0"));
        }
    }
    if ($sucess == true) {
        if (floatval($monto1) > 0) {
            $xCaja->setCobroChequeInterno($Recibo, $monto1, $Cuenta1, $cheque1);
        }
        if (floatval($monto2) > 0) {
            $xCaja->setCobroChequeInterno($Recibo, $monto2, $Cuenta2, $cheque2);
        }
    }
    if ($sucess == false) {
        $tab->add(TabSetValue::getBehavior("avisos", $xCtaBanc->getMessages("txt")));
    }
    return $tab->getString();
}
function fu_76e369257240ded4b1c059cf20e8d9a4($low, $form)
{
    $funid2 = ROTTER_KEY;
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("t{$funid2}", md5($low)));
    return $tab->getString();
}
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 calcula_tasa($monto = 0, $tipo = 10, $form)
{
    /** @deprecated */
    $tasa = obtentasa($monto, $tipo);
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("itasa", $tasa));
    return $tab->getString();
}
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 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();
}
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"];
    // Monto Autorizado
    $tipoConv = $mysolicitud["tipo_convenio"];
    // Interes Diario */
    $ICA_pagado = $mysolicitud["sdo_int_ant"];
    // saldo ICA */
    $infoConv = get_convenio($tipoConv);
    $tasaICA = $infoConv["porcentaje_ica"];
    $intneto = 0;
    $inttotal = 0;
    $intpagado = 0;
    $intdiario = $montoMin * $tasaInt / EACP_DIAS_INTERES;
    /**
     * Consulta todos los creditos que aplican Interes Anticipado
     */
    $totaliva = 0;
    $nota = "";
    $intneto = $intdiario * $diasaut * $tasaICA;
    //Resta el Interes pagado
    $intneto -= $ICA_pagado;
    /**
     * @see Parche: Solo se Incluye la afectacion del Credito
     */
    $nota .= "Tasa ICA {$tasaICA}; Dias {$diasaut}, Int. Diario" . getFMoney($intdiario) . ", ICA Pag. {$ICA_pagado}";
    //Valor IVA, obtenido del tipo de solicitud
    $tasaiva = $infoConv["tasa_iva"];
    $iva_inc = $infoConv["iva_incluido"];
    if ($iva_inc == 1) {
        $intneto = $intneto * (1 / (1 + $tasaiva));
        $totaliva = $intneto * $tasaiva;
    } else {
        $totaliva = $intneto * $tasaiva;
    }
    $intneto = number_format($intneto, 2, '.', '');
    //getFMoney($intneto);
    $totaliva = number_format($totaliva, 2, '.', '');
    //getFMoney($totaliva);
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("valorinteres", $intneto));
    $tab->add(TabSetValue::getBehavior("valoriva", $totaliva));
    $tab->add(TabSetValue::getBehavior("idobservaciones", $nota));
    $tab->add(TabSetValue::getBehavior("idTasaIva", $tasaiva));
    return $tab->getString();
}
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();
}
function jsGetSaldoCuenta($cuenta, $socio)
{
    $xCta = new cCuentaDeCaptacion($cuenta, $socio);
    $DC = $xCta->getDatosInArray();
    $montoRet = $DC["saldo_cuenta"];
    //$xCta->getMaximoRetirable();
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("idMonto", $montoRet));
    $tab->add(TabSetValue::getBehavior("idLetras", convertirletras($montoRet)));
    return $tab->getString();
}
function jsaGetDatosCuenta($cuenta, $socio, $dias)
{
    $xInv = new cCuentaInversionPlazoFijo($cuenta, $socio);
    $tasa = $xInv->getTasaAplicable($dias) * 100;
    $xSoc = new cSocio($socio);
    $xSoc->init();
    $cuentainteres = $xSoc->getCuentaDeCaptacionPrimaria(CAPTACION_TIPO_VISTA, CAPTACION_PRODUCTO_INTERESES);
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("idtasa", $tasa));
    $tab->add(TabSetValue::getBehavior("idcuentainteres", $cuentainteres));
    return $tab->getString();
}
function getReciboDesc($numero)
{
    if (isset($numero) and $numero != 0) {
        $cRec = new cReciboDeOperacion(false, false, $numero);
        $cRec->setNumeroDeRecibo($numero, true);
        $d = $cRec->getDatosInArray();
        $desRec = $cRec->getDescripcion();
        $tab = new TinyAjaxBehavior();
        $tab->add(TabSetValue::getBehavior("txtDescRecibo", $desRec));
        return $tab->getString();
    }
}
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();
}
function jsaSetUltimoCheque($persona, $credito, $cuenta_bancaria)
{
    $xBanc = new cCuentaBancaria($cuenta_bancaria);
    $cheque = $xBanc->getUltimoCheque();
    $xCred = new cCredito($credito);
    $xCred->init();
    $montocheque = $xCred->getMontoAutorizado();
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("idnumerocheque", $cheque));
    $tab->add(TabSetValue::getBehavior("idmontocheque", $montocheque));
    $tab->add(TabSetValue::getBehavior("idmontooriginal", $montocheque));
    return $tab->getString();
}
function JSsetDomicilioMismo($socio, $HDomicilio, $form)
{
    if ($HDomicilio == "mismo") {
        $domicilio = domicilio($socio);
        $DDom = getDatosDomicilio($socio);
        $telefono = $DDom["telefono_residencial"];
        $telefonomovil = $DDom["telefono_movil"];
        $tab = new TinyAjaxBehavior();
        $tab->add(TabSetValue::getBehavior('idTFijo', $telefono));
        $tab->add(TabSetValue::getBehavior('idTMovil', $telefonomovil));
        $tab->add(TabSetValue::getBehavior('idDomicilio', $domicilio));
        return $tab->getString();
    }
}
function jsaGetDatosCuenta($cuenta, $socio)
{
    $xCta = new cCuentaALaVista($cuenta, $socio);
    $xCta->init();
    $DC = $xCta->getDatosInArray();
    $MaxRet = $xCta->getMaximoRetirable();
    $sdo = $DC["saldo_cuenta"];
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("idMaxRet", $MaxRet));
    $tab->add(TabSetValue::getBehavior("idSaldoAnterior", $sdo));
    //$tab -> add(TabSetValue::getBehavior("idmonto", $sdo ));
    //$tab -> add(TabSetValue::getBehavior("imsg", $xCta->getMessages("txt") ));
    return $tab->getString();
}
function jsinfo_util($id, $frm)
{
    $sqlInfo = "SELECT * FROM general_utilerias WHERE idgeneral_utilerias ={$id}";
    $rw = obten_filas($sqlInfo);
    $tab = new TinyAjaxBehavior();
    //$tab -> add(TabSetValue::getBehavior("i_3193c", $rw["nombre_utilerias"]));
    $tab->add(TabSetValue::getBehavior("imsg", $rw["descripcion_utileria"]));
    $tab->add(TabSetValue::getBehavior("iID1", $rw["describe_param_1"]));
    $tab->add(TabSetValue::getBehavior("iID2", $rw["describe_param_2"]));
    $tab->add(TabSetValue::getBehavior("iID3", $rw["describe_param_3"]));
    $tab->add(TabSetValue::getBehavior("id_de", $rw["describe_init"]));
    $tab->add(TabSetValue::getBehavior("id_a", $rw["describe_end"]));
    return $tab->getString();
}
function getPermisosByID($iMenu)
{
    $sql = "SELECT menu_rules\tFROM `general_menu`\n\t\t\tWHERE idgeneral_menu='{$iMenu}' LIMIT 0,1";
    $Itbl = obten_filas($sql);
    $sPerms = $Itbl["menu_rules"];
    $aPerms = explode(",", $sPerms);
    $tab = new TinyAjaxBehavior();
    foreach ($aPerms as $key => $value) {
        $DItem = explode(STD_LITERAL_DIVISOR, $value);
        $nivel = $DItem[0];
        $perm = $DItem[1];
        if ($nivel != 99) {
            $tab->add(TabSetValue::getBehavior($nivel . "@false", "false"));
            $tab->add(TabSetValue::getBehavior($nivel . "@" . $perm, "on"));
            $tab->add(TabSetValue::getBehavior("idNiv" . $nivel, $value));
        }
    }
    return $tab->getString();
}
function jsSetCuotas($socio, $form)
{
    //selecciona el tipo de ingreso
    $SQLSP = "SELECT\n\t`socios_general`.`codigo`,\n\t`socios_tipoingreso`.`parte_social`,\n\t`socios_tipoingreso`.`parte_permanente`\nFROM\n\t`socios_general` `socios_general`\n\t\tINNER JOIN `socios_tipoingreso` `socios_tipoingreso`\n\t\tON `socios_general`.`tipoingreso` =\n\t\t`socios_tipoingreso`.`idsocios_tipoingreso`\nWHERE\n\t(`socios_general`.`codigo` ={$socio})";
    $dSocio = obten_filas($SQLSP);
    $social = $dSocio["parte_social"];
    if (!$social) {
        $social = 0;
    }
    $permanente = $dSocio["parte_permanente"];
    if (!$permanente) {
        $permanente = 0;
    }
    $total = $social + $permanente;
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("idpartesocial", $social));
    $tab->add(TabSetValue::getBehavior("idpartepermanente", $permanente));
    $tab->add(TabSetValue::getBehavior("idtotalcuotas", $total));
    return $tab->getString();
}
function jsaGetPerfilDeProducto($producto, $persona)
{
    $OConv = new cProductoDeCredito($producto);
    $OConv->init();
    $tab = new TinyAjaxBehavior();
    $xSoc = new cSocio($persona);
    $pagos = $OConv->getNumeroPagosPreferente();
    $periocidad = $OConv->getPeriocidadPrefente();
    if ($xSoc->init() == true) {
        if ($xSoc->getClaveDeEmpresa() != FALLBACK_CLAVE_EMPRESA) {
            $xEmp = new cEmpresas($xSoc->getClaveDeEmpresa());
            $xEmp->init();
            $tab->add(TabSetValue::getBehavior('idproducto', $xEmp->getProductoPref()));
            $periocidad = $xEmp->getPeriocidadPref();
        }
    }
    $tab->add(TabSetValue::getBehavior('idnumerodepagos', $pagos));
    $tab->add(TabSetValue::getBehavior('idperiocidad', $periocidad));
    return $tab->getString();
}
function jsaGetUInfo($user)
{
    $xUsr = new cSystemUser($user, false);
    $xUsr->init();
    $VD = $xUsr->getDatosInArray();
    //getSAFEUserInfoByName($user);
    $tab = new TinyAjaxBehavior();
    if (isset($VD["idusuarios"])) {
        //$tab -> add(TabSetValue::getBehavior('idNombreCompleto', $VD["nombres"] ));
        //$tab -> add(TabSetValue::getBehavior('idApellidoPaterno', $VD["apellidopaterno"] ));
        //$tab -> add(TabSetValue::getBehavior('idApellidoMaterno', $VD["apellidomaterno"] ));
        $tab->add(TabSetValue::getBehavior('idNivelAcceso', $VD["niveldeacceso"]));
        $tab->add(TabSetValue::getBehavior('idSucursal', $VD["sucursal"]));
        $tab->add(TabSetValue::getBehavior('idUsuario', $VD["idusuarios"]));
        $tab->add(TabSetValue::getBehavior('idPuesto', $VD["puesto"]));
        $tab->add(TabSetValue::getBehavior('idsocio', $xUsr->getClaveDePersona()));
    } else {
        $tab->add(TabSetValue::getBehavior('idUsuario', 0));
    }
    return $tab->getString();
}
function xul_back_record($mark)
{
    if ($mark < 0) {
        $mark = 0;
    }
    $strSQL_Select = "SELECT * FROM contable_centrodecostos\r\n                          LIMIT {$mark}, 1";
    $tab = new TinyAjaxBehavior();
    $rw = obten_filas($strSQL_Select);
    $mark--;
    $tab->add(TabSetValue::getBehavior("id-idcontable_centrodecostos", $rw["idcontable_centrodecostos"]));
    $tab->add(TabSetValue::getBehavior("id-nombre_centrodecostos", $rw["nombre_centrodecostos"]));
    $tab->add(TabSetValue::getBehavior("id-markRecord", $mark));
    return $tab->getString();
}
function xul_back_record($mark)
{
    if ($mark < 0) {
        $mark = 0;
    }
    $strSQL_Select = "SELECT * FROM general_reports\n                          LIMIT {$mark}, 1";
    $tab = new TinyAjaxBehavior();
    $rw = obten_filas($strSQL_Select);
    $mark--;
    $tab->add(TabSetValue::getBehavior("id-idreport", $rw["idreport"]));
    $tab->add(TabSetValue::getBehavior("id-descripcion_reports", $rw["descripcion_reports"]));
    $tab->add(TabSetValue::getBehavior("id-aplica", $rw["aplica"]));
    $tab->add(TabSetValue::getBehavior("id-idgeneral_reports", $rw["idgeneral_reports"]));
    $tab->add(TabSetValue::getBehavior("id-explicacion", $rw["explicacion"]));
    $tab->add(TabSetValue::getBehavior("id-markRecord", $mark));
    return $tab->getString();
}
function xul_back_record($mark)
{
    if ($mark < 0) {
        $mark = 0;
    }
    $strSQL_Select = "SELECT * FROM captacion_subproductos\n                          LIMIT {$mark}, 1";
    $tab = new TinyAjaxBehavior();
    $rw = obten_filas($strSQL_Select);
    $mark--;
    $tab->add(TabSetValue::getBehavior("id-idcaptacion_subproductos", $rw["idcaptacion_subproductos"]));
    $tab->add(TabSetValue::getBehavior("id-tipo_de_cuenta", $rw["tipo_de_cuenta"]));
    $tab->add(TabSetValue::getBehavior("id-descripcion_subproductos", $rw["descripcion_subproductos"]));
    $tab->add(TabSetValue::getBehavior("id-descripcion_completa", $rw["descripcion_completa"]));
    $tab->add(TabSetValue::getBehavior("id-fecha_alta", $rw["fecha_alta"]));
    $tab->add(TabSetValue::getBehavior("id-fecha_baja", $rw["fecha_baja"]));
    $tab->add(TabSetValue::getBehavior("id-metodo_de_abono_de_interes", $rw["metodo_de_abono_de_interes"]));
    $tab->add(TabSetValue::getBehavior("id-destino_del_interes", $rw["destino_del_interes"]));
    $tab->add(TabSetValue::getBehavior("id-algoritmo_de_premio", $rw["algoritmo_de_premio"]));
    $tab->add(TabSetValue::getBehavior("id-algoritmo_de_tasa_incremental", $rw["algoritmo_de_tasa_incremental"]));
    $tab->add(TabSetValue::getBehavior("id-algoritmo_modificador_del_interes", $rw["algoritmo_modificador_del_interes"]));
    $tab->add(TabSetValue::getBehavior("id-contable_movimientos", $rw["contable_movimientos"]));
    $tab->add(TabSetValue::getBehavior("id-contable_gastos_por_intereses", $rw["contable_gastos_por_intereses"]));
    $tab->add(TabSetValue::getBehavior("id-contable_intereses_por_pagar", $rw["contable_intereses_por_pagar"]));
    $tab->add(TabSetValue::getBehavior("id-contable_cuentas_castigadas", $rw["contable_cuentas_castigadas"]));
    $tab->add(TabSetValue::getBehavior("id-nombre_del_contrato", $rw["nombre_del_contrato"]));
    $tab->add(TabSetValue::getBehavior("id-markRecord", $mark));
    return $tab->getString();
}
function jsaGetDatosEmpresa($dependencia)
{
    //verificar si existe en la BD
    $Emp = new cEmpresas($dependencia);
    $idpersona = $Emp->getClaveDePersona();
    $Emp->init();
    $telefono = $Emp->getTelefono();
    $domicilio = $Emp->getDomicilio();
    $razon = $Emp->getNombre();
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior('idtelefono', $telefono));
    //$tab->add(TabSetValue::getBehavior('iddomiciliodeactividad', $domicilio));
    $tab->add(TabSetValue::getBehavior('idrazonsocialtrabajo', $razon));
    $xSoc = $Emp->getOPersona();
    //$xSoc		= new cSocio();
    if ($xSoc == null) {
    } else {
        $xOBA = $xSoc->getOActividadEconomica();
        if ($xOBA != null) {
            $idactividad = $xOBA->getClaveDeActividad();
            $idsector = $xOBA->getClaveDeSector();
            $idlocalidad = $xOBA->getClaveDeLocalidad();
            $idmunicipio = $xOBA->getClaveDeMunicipio();
            $identidadfederativa = $xOBA->getClaveDeEstado();
            // idlocalidad  idmunicipio identidadfederativa
            $tab->add(TabSetValue::getBehavior('idactividad', $idactividad));
            //$tab->add(TabSetValue::getBehavior('idsectoreconomico', $idsector));
            $tab->add(TabSetValue::getBehavior('idlocalidad', $idlocalidad));
            $tab->add(TabSetValue::getBehavior('identidadfederativa', $identidadfederativa));
            $tab->add(TabSetValue::getBehavior('idmunicipio', $idmunicipio));
            $tab->add(TabSetValue::getBehavior('idnombreacceso', $xOBA->getCalle()));
            $tab->add(TabSetValue::getBehavior('idcodigopostal', $xOBA->getCodigoPostal()));
        }
    }
    //TODO: cargar estado y municiopios
    return $tab->getString();
}
function xul_back_record($mark)
{
    if ($mark < 0) {
        $mark = 0;
    }
    $strSQL_Select = "SELECT * FROM general_colonias\n                          LIMIT {$mark}, 1";
    $tab = new TinyAjaxBehavior();
    $rw = obten_filas($strSQL_Select);
    $mark--;
    $tab->add(TabSetValue::getBehavior("id-idgeneral_colonia", $rw["idgeneral_colonia"]));
    $tab->add(TabSetValue::getBehavior("id-codigo_postal", $rw["codigo_postal"]));
    $tab->add(TabSetValue::getBehavior("id-nombre_colonia", $rw["nombre_colonia"]));
    $tab->add(TabSetValue::getBehavior("id-tipo_colonia", $rw["tipo_colonia"]));
    $tab->add(TabSetValue::getBehavior("id-ciudad_colonia", $rw["ciudad_colonia"]));
    $tab->add(TabSetValue::getBehavior("id-municipio_colonia", $rw["municipio_colonia"]));
    $tab->add(TabSetValue::getBehavior("id-estado_colonia", $rw["estado_colonia"]));
    $tab->add(TabSetValue::getBehavior("id-fecha_de_revision", $rw["fecha_de_revision"]));
    $tab->add(TabSetValue::getBehavior("id-codigo_de_estado", $rw["codigo_de_estado"]));
    $tab->add(TabSetValue::getBehavior("id-codigo_de_municipio", $rw["codigo_de_municipio"]));
    $tab->add(TabSetValue::getBehavior("id-sucursal", $rw["sucursal"]));
    $tab->add(TabSetValue::getBehavior("id-markRecord", $mark));
    return $tab->getString();
}
function BackRecord($init, $form)
{
    //$init = $init + 1;
    $ifin = $init - 1;
    if ($ifin >= 0) {
        $sql = "SELECT * FROM operaciones_recibostipo LIMIT {$ifin},{$init}";
        $rs = mysql_query($sql, cnnGeneral());
        $nfields = mysql_num_fields($rs) - 1;
        $tab = new TinyAjaxBehavior();
        while ($rw = mysql_fetch_array($rs)) {
            $tab->add(TabSetValue::getBehavior("i_3193c", $rw["idoperaciones_recibostipo"]));
            $tab->add(TabSetValue::getBehavior("i_97f45", $rw["descripcion_recibostipo"]));
            $tab->add(TabSetValue::getBehavior("i_56429", $rw["detalles_del_concepto"]));
            $tab->add(TabSetValue::getBehavior("i_a4db7", $rw["subclasificacion"]));
            $tab->add(TabSetValue::getBehavior("i_9c6e0", $rw["nombre_sublasificacion"]));
            $tab->add(TabSetValue::getBehavior("i_867a4", $rw["tipo_docto"]));
            $tab->add(TabSetValue::getBehavior("i_5f5d9", $rw["mostrar_en_corte"]));
            $tab->add(TabSetValue::getBehavior("i_5dd1e", $rw["tipo_poliza_generada"]));
            $tab->add(TabSetValue::getBehavior("ifproperties", $ifin));
        }
        return $tab->getString();
    } else {
    }
}
function jsaCargarDatosDeConvenio($convenio)
{
    $OConv = new cProductoDeCredito($convenio);
    $OConv->init();
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior('idnumpagos', $OConv->getNumeroPagosPreferente()));
    if ($OConv->getEsProductoDeNomina() == false) {
        //false por	que lo determina la empresa
        $tab->add(TabSetValue::getBehavior('idperiocidadpagos', $OConv->getPeriocidadPrefente()));
    }
    //$tab -> add(TabSetValue::getBehavior('idnumpagos', $OConv->obj()->pagos_maximo()->v()));
    return $tab->getString();
}
function update_sumas_pol($idejercicio, $idperiodo, $idtipopol, $idpoliza, $form)
{
    $abonos = 0;
    $cargos = 0;
    $sql_c = "SELECT * FROM suma_mvtos_poliza\n\t\tWHERE ejercicio={$idejercicio}\n\t\tAND periodo={$idperiodo}\n\t\tAND numeropoliza={$idpoliza}\n\t\tAND tipopoliza={$idtipopol}\n\t\t/*AND tipomovimiento=1 */";
    $rs = mysql_query($sql_c, cnnGeneral());
    while ($rw = mysql_fetch_array($rs)) {
        if ($rw["tipomovimiento"] == 1) {
            $cargos = $rw["saldos"];
        } else {
            $abonos = $rw["saldos"];
        }
    }
    //-------------------------------------------------------------------------------------------------------------
    //-------------------------------------------------------------------------------------------------------------
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior('idcargos', $cargos));
    $tab->add(TabSetValue::getBehavior('idabonos', $abonos));
    return $tab->getString();
}
function BackRecord($init, $form)
{
    //$init = $init + 1;
    $ifin = $init - 1;
    if ($ifin >= 0) {
        $sql = "SELECT * FROM general_formulas LIMIT {$ifin},{$init}";
        $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)) {
            $tab->add(TabSetValue::getBehavior("i_b62df", $rw["aplicado_a"]));
            $tab->add(TabSetValue::getBehavior("i_23088", $rw["code_type"]));
            $tab->add(TabSetValue::getBehavior("i_0f743", $rw["description_short"]));
            $tab->add(TabSetValue::getBehavior("i_41f88", $rw["estructura_de_la_formula"]));
            $tab->add(TabSetValue::getBehavior("ifproperties", $ifin));
        }
        return $tab->getString();
    } else {
    }
}