break;
    case 'sxw':
        $content_type = 'application/sxw';
        break;
    case 'dia':
        $content_type = 'application/dia';
        break;
    case "sql":
        $content_type = 'application/octet-stream';
        break;
}
if ($type == "sbk") {
    $file = PATH_BACKUPS . $file . "." . $type;
} else {
    if (isset($tabla)) {
        $xSys = new cSystemTask();
        $file = $xSys->setBackupTable($tabla);
        $content_type = 'application/octet-stream';
        $type = "sql.gz";
        $date = date("Ymd");
        $download = "{$tabla}-{$date}";
    } else {
        $file = PATH_TMP . $file . "." . $type;
    }
}
if ($type != 'html') {
    header("Content-type: {$content_type}");
    //ISO-8859-1
    header("Content-Disposition: attachment; filename=\"{$download}.{$type}\"; ");
    //header("Content-Disposition: ");
}
    $messages .= CongelarSaldos($idrecibo);
} else {
    $messages .= date("Y-m-d") . "\tNO SE CONGELAN SALDOS, NO ES FIN DE MES\r\n";
}
/**
 * Actualiza Recibos de Operaciones
 **/
$sqlS = "UPDATE operaciones_recibos SET tipo_pago = \"ninguno\" WHERE tipo_pago = \"\" OR IsNULL(tipo_pago) ";
my_query($sqlS);
/**
 * Actualiza los Periodos a Formatos Validos en el Caso que el sistema les haya asigando otro valor
 */
$sqlPeriodosCorrectos = "UPDATE operaciones_mvtos\r\n\t\t\t\t\t\t\t\tSET periodo_mensual = DATE_FORMAT(fecha_afectacion, '%c'),\r\n\t\t\t\t\t\t\t\tperiodo_anual = DATE_FORMAT(fecha_afectacion, '%Y'),\r\n\t\t\t\t\t\t\t\tperiodo_semanal = DATE_FORMAT(fecha_afectacion, '%w')\r\n\t\t\t\t\t\t\t\t";
$x1 = my_query($sqlPeriodosCorrectos);
$messages .= $x1[SYS_INFO];
$xSys = new cSystemTask();
$xDB = new cSAFEData();
//crear backup //
if ($xF->getDiaFinal() == $xF->get() or date("N", $xF->getInt()) == 5) {
    $messages .= "BACKUP\tRespaldo a la fecha " . $xF->getFechaDDMM() . "\r\n";
    $xDB->setCheckDatabase();
    $messages .= $xSys->setBackupDB_WithMail();
}
//cerrar el log
$xLog->setWrite($messages);
$xLog->setClose();
if (ENVIAR_MAIL_LOGS == true) {
    $xLog->setSendToMail("TR.Eventos del Cierre del Sistema");
}
//Stored procedures
$ql->setRawQuery("CALL `proc_listado_de_ingresos` ");
function jsaRespaldarDB($fecha)
{
    $xSys = new cSystemTask();
    $msg = $xSys->setBackupDB();
    return $msg;
}