function jsaVincularAval($tipo, $AvalPersona, $monto, $consanguinidad, $vinculado, $documento, $depende = false)
{
    $xT = new cTipos();
    $xDoc = new cCredito($documento);
    $depende = $xT->cBool($depende);
    $xDoc->init();
    $xDoc->addAval($AvalPersona, $monto, $tipo, $consanguinidad, $depende);
    return $xDoc->getMessages(OUT_HTML);
}
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 setEnviarMoroso($fecha, $parcialidad, $recibo = false)
 {
     $FMora = $this->mFechaMora;
     $FVenc = $this->mFechaVencimientoLegal;
     $monto = $this->mSdoCapitalInsoluto;
     $socio = $this->mNumeroSocio;
     $solicitud = $this->mNumeroCredito;
     $estatus = CREDITO_ESTADO_MOROSO;
     $xT = new cTipos();
     $msg = "";
     if ($xT->cBool(CREDITO_GENERAR_MVTO_MORA) == true) {
         //========================================================
         $xRec = new cReciboDeOperacion(10);
         $xRec->setNumeroDeRecibo($recibo);
         //========================================================
         $nota = "Estatus [{$estatus}] Modificado en el cierre del {$fecha}, Mora: {$FMora}, Vence: {$FVenc}";
         //agregar Movimiento con Partida
         $xMvto = $xRec->setNuevoMvto($fecha, $monto, 115, $parcialidad, $nota, 1, TM_CARGO, $socio, $solicitud);
         //Agregar Contrapartida
         $xRec->addMvtoContable(OPERACION_CLAVE_MINISTRACION, $monto, TM_ABONO, $socio, $solicitud);
         $msg = "{$socio}\t{$solicitud}\tMOROSO\tEstatus[{$estatus}] Modificado en el cierre del {$fecha}, Mora: {$FMora}, Vence: {$FVenc}\r\n";
     } else {
         $this->setCambiarEstadoActual($estatus, $fecha);
     }
     $this->mMessages .= $msg;
     return $msg;
 }
 function __construct($parametros, $valor = "", $delimiter = "")
 {
     $this->mValor = $valor;
     $this->mDelimit = $delimiter;
     $xT = new cTipos();
     //$this->mMessages		.= "OK\tValor a $valor\r\n";
     $this->mNombre = isset($parametros[$this->NOMBRE]) ? $parametros[$this->NOMBRE] : "?";
     if (isset($parametros[$this->TIPO])) {
         $this->mTipo = strtolower($parametros[$this->TIPO]);
         //setLog($this->mTipo . " --- $valor");
         switch ($this->mTipo) {
             case MQL_DATE:
                 $this->mValor = setFechaValida($this->mValor);
                 break;
             case MQL_BOOL:
                 $this->mValor = $xT->cBool($this->mValor);
                 break;
             case MQL_STRING:
                 $this->mValor = $this->cleanText($this->mValor);
                 $this->mValor = setCadenaVal($this->mValor);
                 break;
             case MQL_FLOAT:
                 $this->mValor = setNoMenorQueCero($this->mValor);
                 break;
             case MQL_INT:
                 $this->mValor = setNoMenorQueCero($this->mValor);
                 $this->mValor = (int) $this->mValor;
                 break;
         }
     }
     //$this->mMessages		.= "OK\tValor queda en (" . $this->mValor . ") de ($valor)\r\n";
     $this->mObligatorio = isset($parametros[$this->OBLIGATORIO]) ? $xT->cBool($parametros[$this->OBLIGATORIO]) : false;
     $this->mFormato = isset($parametros[$this->FORMATO]) ? $parametros[$this->FORMATO] : "";
     $this->mLargo = isset($parametros[$this->LONGITUD]) ? setNoMenorQueCero($parametros[$this->LONGITUD]) : 0;
     //if($this->mObligatorio == true){
     if (isset($parametros[$this->ACEPTADOS])) {
         if ($this->aceptado($this->mValor, $parametros[$this->ACEPTADOS]) === false) {
             $this->mValor = null;
             $this->mMessages .= "ERROR\tError en la columna " . $this->mNombre . "  : Valor no aceptado " . $this->mValor . ", los valores deben ser (" . $parametros[$this->ACEPTADOS] . ")\r\n";
             $this->ERRORES++;
         }
     }
     //}
     if (is_array($parametros)) {
         $this->mDatos = $parametros;
     }
 }
 function getListadoDeCuentasContables($Cuenta = "", $Nivel = 0, $TipoCuentas = "", $afectables = "", $NivelFinal = 0, $init = false, $end = false)
 {
     //$afectables		= ($afectables == true) ? 1 : $afectables;
     $xT = new cTipos();
     $ByLimit = ($init == false and $end == false) ? "" : " LIMIT {$init}, {$end}";
     $ByTipoCta = ($TipoCuentas == "" or $TipoCuentas == SYS_TODAS) ? "" : " AND `contable_catalogo`.`tipo`='{$TipoCuentas}' ";
     $ByNivel = setNoMenorQueCero($Nivel) <= 0 ? "" : " AND `contable_catalogo`.`ctamayor`={$Nivel} ";
     //$ByAfecta		= ($afectables == "" OR $afectables == SYS_TODAS OR $afectables == false) ? "" : " AND (`contable_catalogo`.`afectable` = $afectables) ";
     $ByAfecta = $xT->cBool($afectables) == true ? " AND (`contable_catalogo`.`afectable` = {$afectables}) " : "";
     //var_dump($afectables);
     $ByCuenta = "";
     if ($Nivel >= 0 and $NivelFinal > 0) {
         $ByNivel = " AND (`contable_catalogo`.`ctamayor`>={$Nivel} AND `contable_catalogo`.`ctamayor`<={$NivelFinal} ) ";
     }
     if (setNoMenorQueCero($Cuenta) >= 1) {
         $xCta = new cCuentaContableEsquema($Cuenta);
         $pcta = $xCta->CUENTARAW;
         $ByCuenta = " AND `contable_catalogo`.`numero` LIKE '{$pcta}%' ";
     }
     $setSql = "SELECT\n\t\t`contable_catalogo`.`digitoagrupador`             AS\n\t\t`niv`,\n\t\tsetCuentaFmt(`contable_catalogo`.`numero`)\t\tAS 'clave',\n\t\t`contable_catalogo`.`nombre`,\n\t\t`contable_catalogotipos`.`nombre_del_tipo`        AS\n\t\t`tipo`\n\t\tFROM\n\t\t`contable_centrodecostos` `contable_centrodecostos`\n\t\tINNER JOIN `contable_catalogo` `contable_catalogo`\n\t\tON `contable_centrodecostos`.\n\t\t`idcontable_centrodecostos` = `contable_catalogo`.\n\t\t`centro_de_costo`\n\t\tINNER JOIN `contable_catalogotipos`\n\t\t`contable_catalogotipos`\n\t\tON `contable_catalogotipos`.\n\t\t`idcontable_catalogotipos` = `contable_catalogo`\n\t\t.`tipo`\n\t\tWHERE `contable_catalogo`.`numero` != 0\n\t\t{$ByTipoCta}\n\t\t{$ByNivel}\n\t\t{$ByCuenta}\n\t\t{$ByAfecta}\n\t\tORDER BY `contable_catalogo`.`numero`\n\t\t{$ByLimit} ";
     return $setSql;
 }
function parametro($nombre, $fallback = null, $tipo = MQL_STRING, $fuente = false)
{
    $valor = null;
    $xT = new cTipos();
    $fuente = $fuente == false ? $_REQUEST : $fuente;
    //if($fuente == false){
    //if(isset($_REQUEST)){ $fuente		= $_REQUEST; }
    switch ($tipo) {
        case MQL_INT:
            $fallback = $fallback == null ? 0 : $fallback;
            $valor = isset($fuente[$nombre]) ? $xT->cInt($fuente[$nombre]) : $fallback;
            break;
        case MQL_FLOAT:
            $fallback = $fallback == null ? 0 : $fallback;
            $valor = isset($fuente[$nombre]) ? $xT->cFloat($fuente[$nombre]) : $fallback;
            break;
        case MQL_BOOL:
            $fallback = $fallback == null ? false : $fallback;
            $valor = isset($fuente[$nombre]) ? $xT->cBool($fuente[$nombre]) : $fallback;
            //setLog(" $tipo, $fallback $nombre ... " . $fuente[$nombre] . " ----  ") . $xT->cBool( $fuente[$nombre] );
            break;
        case MQL_RAW:
            //$fallback	= ($fallback == null) ? "" : $fallback;
            $valor = isset($fuente[$nombre]) ? $fuente[$nombre] : $fallback;
            break;
        case MQL_DATE:
            $valor = isset($fuente[$nombre]) ? setFechaValida($fuente[$nombre]) : fechasys();
            //setLog(setFechaValida($fuente[$nombre]));
            break;
        default:
            $fallback = $fallback == null ? "" : $fallback;
            $valor = isset($fuente[$nombre]) ? $fuente[$nombre] : $fallback;
            if ($valor == SYS_TODAS) {
            } else {
                $xT = new cTipos();
                $arrRAW = array("action" => true, "out" => true, "c" => true, "s" => "true", "ctipo_pago" => true, "i" => true, "callback" => true);
                $valor = isset($arrRAW[$nombre]) ? $valor : strtoupper($xT->cChar($valor));
            }
            break;
    }
    //}
    return $valor;
}