<style type="text/css" media="print">
@page{
   @margin: 2px;
}

@import url('https://fonts.googleapis.com/css?family=Open+Sans');

* {
  font-family:"Arial";
  @font-weight: 100;
  font-size:12px;
}
h3{
	font-size:14px;
	font-weight:100;
}
h5{
	font-size:12px
}
th{
	background: green;
	color:white;
	text-align: center;

}
td{
	font-size:12px;
}
.datos_empres2{
	font-size: 20px;
	font-weight: 100;
	font-family: "Lucida console";
}

img{
	width:300px;
	height:300px;
}
</style>

<style>
	img{
	width:150px;
	height:150px;
	}
</style>
<?php
$mesa = $_GET['mesa'];
include_once("../php/config.php");
$sql_venta = mysql_query("select * from mesas where nombre='$mesa'") or die (mysql_error());
$sql_detalle = mysql_query("select * from detalle_comanda where mesa='$mesa' and anulado!=1") or die (mysql_error());
mysql_query("update mesas set precuenta='1' where nombre='$mesa'") or die (mysql_error());
$cliente = @mysql_result($sql_venta,0,"ticket");
$totalPrecuenta = mysql_query("select sum(total_precio) as total from detalle_comanda where mesa='$mesa' and anulado!=1") or die (mysql_error());


?>
<div style="margin-left: 5px; margin-right: 20px;">
<center>

<?php

$sql_empresa = mysql_query("SELECT * FROM empresa") or die(mysql_error());
$enombre= @mysql_result($sql_empresa,0,"nombre");
$etelefono= @mysql_result($sql_empresa,0,"telefono");	
$edireccion= @mysql_result($sql_empresa,0,"direccion");	
$ernc= @mysql_result($sql_empresa,0,"rnc");	
$eemail= @mysql_result($sql_empresa,0,"email");	
$logo= @mysql_result($sql_empresa,0,"logo");	
	
?>

<span class="datos_empres2">
<?php if($logo!=""){?>
<?php echo "<img src = '../LOGOS/$logo'>";?>
<?php }?>

<b><?php echo $enombre;?></b></span><br>
<span class="datos_empres1"><?php echo $etelefono;?> | <?php echo $eemail;?> </span><br>
<span class="datos_empres1"><?php echo $edireccion;?> </span><br>
<span class="datos_empres1"><?php echo $ernc;?></span><br>
<?php 
	if(@mysql_result($sql_venta,0,"termino")=="Conduce"){
?>
	<h2>CONDUCE</h2>
<?php }else{?>
	
<?php }?>
</center>


<h2>Mesa #: <?php echo @mysql_result($sql_venta,0,"nombre")?><h2>
Fecha : <?php echo   @fecha(mysql_result($sql_venta,0,"fecha")).", ".@mysql_result($sql_venta,0,"hora");?><br>


A nombre de: <?php echo @mysql_result($sql_venta,0,"ticket");?><br>



<table class="" style="width:100%">
	<thead>             
		<th>ITEMS | CANTIDAD | IMPORTE</th>
		<th></th>
		
		
	</thead>
<tbody>
<?php while($r=mysql_fetch_array($sql_detalle)){?>
			<tr>
			
                
				<td><?php echo $r["descripcion"]?> 
				<br><?php echo decimal($r["cantidad"])." X ".decimal($r["precio"])." = ".decimal($r["total_precio"])?></td>
                
                
             
               
			</tr>
         <?php }?>
	</tbody>
</table>


<div style="float: right; width: auto;">

<span style="float: left">TOTAL VENTA: </span> <span style="float: right;"><?php echo @decimal(mysql_result($totalPrecuenta,0,"total"))?></span><br>

	<hr>

	
</div>
<br>

<br>
<br>
<br>



<div style="float:left">

Le atendio: <b><?php echo @mysql_result($sql_venta,0,"camarero")?></b>

</div>
</div>

<script>

	window.print()

	
	setTimeout(function(){
		window.close()
		////window.location.href="_nueva_venta.php";
	},3000)
</script>