<?php 
	include_once("config/init.php");

   
     $mes = date('m');
     $ano = date('Y');   
       

$table = '
        <table>
        <tr>
    <th>Descricao</th>
    <th>Entradas</th>
    <th>Saidas</th>
    <th>Conta</th>
    <th>Data</th>
    <th>Hora</th>
    <th>Usuario</th>
             </tr>
        ';
        
       $result_transacoes = $database->query("SELECT * FROM transacoes");
	    while($row_transacoes = $database->fetch_assoc($result_transacoes)){
          $table.='
           <tr>
             <td>'.$row_transacoes['descricao'].'</td>
             <td>'.$row_transacoes['entrada'].'</td>
             <td>'.$row_transacoes['saida'] .'</td>
              <td>'.$row_transacoes['caixa'] .'</td>
             <td>'.$row_transacoes['data'].'</td>
             <td>'.$row_transacoes['hora'].'</td>
             <td>'.$row_transacoes['user'].'</td>
             </tr>     
        ';
    }

    
    $table.='</table>';
    
   
    
    header("Content-Type:application/xls");
    header("Content-Disposition:attachment;filename=data.xls");
   
    echo "<h1>Relatorio de transacoes gerais</h1>";
    echo $table;
    
   


?>