<?php
session_start();
if (!isset($_SESSION["user_id"]) || $_SESSION["user_id"]==null):
   print "<script>alert(\"Acceso Invalido!\");
   window.location='login.php';</script>";
endif;
if ($_SESSION["user_at"] < 2):
   print "<script>alert(\"Sin Acceso a Transaccion!\");
   window.location='vt000.php';</script>";
endif;
include_once ("lib/fpdf/funci.php");
date_default_timezone_set('America/La_Paz');
$miusr = $_SESSION["user_id"];
$conex = conectar();
$fehoy = date("Y-m-d");
//$fehoy = "2019-04-01";
?>
<body bgcolor="#E0FFFF">
<div class="main-wrapper">
<link href="css/tabla.css" rel="stylesheet" type="text/css" />
<link href="bootstrap/css/bootstrap.css" rel="stylesheet" />
<center><h1>Detalle de Ventas</h1></center>
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&nbsp;
<a class="btn btn-danger" href="vt000.php">Salir</a>
<center><table border="0" cellpadding="0" cellspacing="0" class="tabla">
   <thead>
	<th><center>Trans</center></th>
	<th><center>Fecha</center></th>
	<th><center>Cliente</center></th>
	<th>Producto</th>
	<th><center>Cantidad</center></th>
	<th><center>Precio Venta</center></th>
	<th><center>Importe</center></th>
   </thead>
<?php
$mysql = "select vedetntra,vecabncli,vedetcart,vedetcant,
                 vedetpven,vedettven,vecabfech
          from   vecab,vedet
          where  vecabntra = vedetntra
          and    vecabusua = '$miusr'
          and    vecabstat = 0
          and    vecabfech = '$fehoy'
          order  by 1";
$result = mysql_query($mysql);
$toven = 0;
while ($row = mysql_fetch_array($result)):
   $toven = ($toven + $row[vedettven]);
   ?>
   <tr class="modo1">
   <td><center><?php echo $row[vedetntra];?></center></td>
   <td><center><?php echo date("d-m-Y",strtotime($row[vecabfech]));?></center></td>
   <td><?php echo $row[vecabncli];?></td>
   <td><?php echo $row[vedetcart];?></td>
   <td><center><?php echo number_format($row[vedetcant],2);?></center></td>
   <td><center><?php echo number_format($row[vedetpven],2);?></center></td>
   <td><center><?php echo number_format($row[vedettven],2);?></center></td>
   </tr>
   <?php
endwhile; ?>
</table></center>
<h3><center>Total Venta : <?php echo number_format($toven,2); ?></center></h3>
</div>
</body>
