<?php

require_once("../../includes/bootstrap2.php");
$sesion = new sesion();
$academia = bootstrap::initBd($sesion->get('anio'));
/** Error reporting */
error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
date_default_timezone_set('America/Bogota');
//echo ini_get("memory_limit");
ini_set('memory_limit', '1024M');
ini_set('max_execution_time', 60 * 10);
$iduser = $sesion->get('ac_userid');
if (PHP_SAPI == 'cli')
    die('This example should only be run from a Web Browser');

$anio = 2013;

$nomdoc = "Anexo 6A $anio.xlsx";
// Redirect output to a client’s web browser (Excel5)
header("Content-type: application/vnd.ms-excel; name='excel'");
header("Content-Disposition: filename=ficheroExcel.xls");
header("Pragma: no-cache");
header("Expires: 0");

$sql = "CALL SP_ANEXO_6A(0,$anio,'$iduser')";
$academia->instruccion($sql, 0, 1);

$reg = $academia->extraer_registro();
$fil = 6;
$filOrg = $fil;
$col = 0;
$colOrg = $col;
$titulos = array_keys($reg);
echo '<table> <tr>';
foreach ($titulos as $key) {
    echo '<td style="mso-number-format:"@";">'.$key.'</td>';   
}
echo '</tr>';

$fil++;

do {
    $col = 0;
    echo '<tr>';
    foreach ($reg as $cmp) {
        echo '<td style="mso-number-format:"@";">'.$cmp.'</td>';   
    }
    echo '</tr>';
    $fil++;
} while ($reg = $academia->extraer_registro());



exit;


