<?php
include "../session.php"; 

if($role!="ADMIN"){
  header("Location:index.php");
  die();
}

include "conect.php";
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=Reporte de excel.xls");

date_default_timezone_set('America/Guatemala');
$today="2022-06-01";
$lastday="2022-06-30";



$consulta = mysqli_query($con, "SELECT * FROM ventas WHERE DATE_ING BETWEEN '$today' AND '$lastday'");
$conteo   = mysqli_num_rows($consulta);

if ($conteo>0) {

?>

<table>
	<tr>
		<th>Dato1</th>
		<th>Dato2</th>
		<th>Dato3</th>	
	</tr>


<?php 


while ($row3 = mysqli_fetch_array($consulta)) {

                   $dat1    = $row3['CODIGO_AS'];
                   $dat2 = $row3['COD_PROD_V'];
                   $dat3      = $row3['TOTAL'];




                   ?>


                   <tr>
                   	<td><?php echo $dat1; ?></td>
                   	<td><?php echo $dat2; ?></td>
                   	<td><?php echo $dat3; ?></td>
                   </tr>

                   <?php 
                    

                }

  
};

 ?>

 </table>