<?php
	
	session_start();
	if (!isset($_SESSION['user_login_status']) AND $_SESSION['user_login_status'] != 1) {
        header("location: login.php");
		exit;
        }
	
	/* Connect To Database*/
	require_once ("config/db.php");//Contiene las variables de configuracion para conectar a la base de datos
	require_once ("config/conexion.php");//Contiene funcion que conecta a la base de datos
	
	$active_facturas="";
	$active_reportes="active";
	$active_productos="";
	$active_clientes="";
	$active_usuarios="";	
	$title="Reportes | CEDIL";
?>
<!DOCTYPE html>
<html lang="en">
<script language="JavaScript">
  function redireccionar() {
    setTimeout("location.href='login.php?logout'", 300000);
  }
  </script>

  <head>
    <?php include("head.php");?>
  </head>
  <body onLoad="redireccionar()">
	<?php
	include("navbar.php");
	?>
	
    <div class="container">
	<div class="panel panel-info">
		<div class="panel-heading">
        <div class="btn-group pull-right">
				<a href="imp_compras.php"><button type='button' class="btn btn-info"><span class="glyphicon glyphicon-print" ></span> Imprimir</button></a>
			</div>
			<h4><i class='glyphicon glyphicon-list'></i>  Compras</h4>
		</div>
		<div class="panel-body">
		
<div class="table-responsive" align="center">
			  <table class="table">
				<tr  class="info">
    <td>#</strong></td> 
    <td><strong>CLIENTE</strong></td>
    <td><strong>PRODUCTO</strong></td>
    <td><strong>UNIDADES</strong></td>
    <td><strong>PRECIO POR UNIDAD</strong></td>
	<td><strong>MONTO</strong></td>
    <td><strong>FECHA DE VENTA</strong></td>
	</tr>
  <?php
  $item=0;
 
  $consulta=mysqli_query($con,"SELECT * FROM facturas ORDER BY proveedor ASC");
  while($dato=mysqli_fetch_array($consulta) or die(mysqli_error($con))){
	$item++;
	$pro=$dato['proveedor'];
	$consulta2=mysqli_query($con,"select * from proveedores where id_pro='$pro'");
	$dato2=mysqli_fetch_array($consulta2);
		
?>
<tr>
<td><?php echo $item; ?></td>
    <td><?php echo $dato2['nombre_proveedor']; ?></td>
    <td><?php echo $dato['producto']; ?></td>
    <td><?php echo $dato['cantidad']; ?></td>
    <td><?php echo "Bsf. ".$dato['costo_uni']; ?></td>
	<td><?php echo "Bsf. ".$dato['total']; ?></td>
    <td><?php echo $dato['fecha']; ?></td>
	
</tr>
<?php 
}
?>
</table>

</div>
  <div align="center">			
  <img src="barra.php" alt="" border="0">
  <img src="linear.php" alt="" border="0">
  <img src="torta.php" alt="" border="0">
  </div>
  </div>
  </div>
  </div>
	<hr>
	<?php
	include("footer.php");
	?>
	 </body>
</html>
