<?php
$L_Mun=json_decode($_GET['Lista']);
$Cont=0;
// Objeto PHP stdClass a matriz 
function object_array($array) { 
    if(is_object($array)) { 
        $array = (array)$array; 
     } if(is_array($array)) { 
         foreach($array as $key=>$value) { 
             $array[$key] = object_array($value); 
             } 
     } 
     return $array; 
}

$Tabla=object_array($L_Mun);
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=Tabla_Graf.xls");
header("Pragma: no-cache");
header("Expires: 0");
echo "<head><meta http-equiv=\"Content-type\" content=\"text/html;charset=utf-8\" /></head>";
$salida ="";
$salida.='<table border="1"><tbody><thead><tr><th width="14%">Municipio</th><th width="7%">Año</th><th width="6%">Ene</th><th width="6%">Feb</th><th width="7%">Mar</th><th width="6%">Abr</th><th width="7%">May</th><th width="5%">Jun</th><th width="5%">Jul</th><th width="6%">Ags</th><th width="6%">Sep</th><th width="6%">Oct</th><th width="7%">Nov</th><th width="6%">Dic</th><th width="6%">Tot</th></tr></thead>';
	foreach($Tabla as $Val=>$key) {		
		$salida.= '<tr><td>'.$key['Nombre'].'</td><td>'.$key['Anio'].'</td><td>'.$key['Ene'].'</td><td>'.$key['Feb'].'</td><td>'.$key['Mar'].'</td><td>'.$key['Abr'].'</td><td>'.$key['May'].'</td><td>'.$key['Jun'].'</td><td>'.$key['Jul'].'</td><td>'.$key['Ags'].'</td><td>'.$key['Sep'].'</td><td>'.$key['Oct'].'</td><td>'.$key['Nov'].'</td><td>'.$key['Dic'].'</td><td>'.$key['Mov'].'</td></tr>';
	}
$salida.='</tbody></table>';
echo $salida;

?>