<script src="../src/jquery.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />

<head>
  <meta charset="utf-8">
  <title>Receipt</title>

  <!-- Normalize or reset CSS with your favorite library -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css">

  <!-- Load paper.css for happy printing -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/paper-css/0.4.1/paper.css">


<link href="https://fonts.cdnfonts.com/css/receiptional-receipt" rel="stylesheet">

<style>
url('https://fonts.cdnfonts.com/css/receiptional-receipt');
</style>



  <style>
   *{
       font-family: "Lucida Console", monospace;
       font-size:23px;
   }
   
   img{
       width:200px;
   }
   
   th{
	   text-align:left;
   }
  
  </style>
</head>



<?php
$id = $_GET['id'];
include_once("../php/config.php");
$sql_venta = mysql_query("select * from ventas where id_venta='$id'") or die (mysql_error());


$cliente = @mysql_result($sql_venta,0,"cliente");
$producto = @mysql_result($sql_venta,0,"producto");
$fecha = @fecha(mysql_result($sql_venta,0,"fecha"));
$hora = @mysql_result($sql_venta,0,"hora");
$total = @mysql_result($sql_venta,0,"total");
$costo = @mysql_result($sql_venta,0,"costo");
$moneda_origen = @mysql_result($sql_venta,0,"moneda_origen");
$tasa_moneda_origen = @mysql_result($sql_venta,0,"tasa_moneda_origen");
$usuario = @mysql_result($sql_venta,0,"usuario");
$termino = @mysql_result($sql_venta,0,"termino");

$sql_cliente = mysql_query("select * from clientes where nombre='$cliente'") or die (mysql_error());
$telefono = @mysql_result($sql_cliente,0,"telefono");
$sql_balance = mysql_query("select sum(balance) as balance from ventas where cliente='$cliente'") or die (mysql_error());
$balance = @mysql_result($sql_balance,0,"balance");
?>
<div style="margin-left: 5px; margin-right: 20px;">
<center>

<?php
$parametros = mysql_query("select * from parametros") 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");	
$nota= @mysql_result($sql_venta,0,"nota");	

	
?>

<span class="datos_empres2" style="font-size: 20px;">
<?php if($logo!=""){?>
<?php echo "<img src = '../LOGOS/$logo'>";?>
<?php }?>
<br>
<b>
<?php echo $enombre;?></span></b><br>
<b><span class="datos_empres1"><?php echo $etelefono;?> |  <?php echo $eemail;?> </span></b><br>
<span class="datos_empres1"><?php echo $edireccion;?> </span><br>
<span class="datos_empres1"><?php echo $ernc;?></span><br>

	<h2>RECIBO DE VENTA</h2>

</center>
<hr>

venta #: <?php echo $id?><br>
Fecha : <?php echo  $fecha." |".$hora;?><br>



cliente: <?php echo $cliente?><br>
Informacion: <?php echo $nota?><br>
Termino: <?php echo $termino?><br>




<hr>
<table class="" style="width:100%">
	<thead>             
		<u>DETALLE</u>
		
		
	</thead>
<tbody>

<th>Producto</th>
<th>Monto</th>
<th>TOTAL</th>
<tr>
<td><?php echo $producto?></td>		
<td><?php echo $costo?></td>	
<td><?php echo $total?></td>	
</tr>   
               
			</tr>
         
	</tbody>
</table>
<hr>

<div>




<span style="float: left">Moneda venta: </span> <span style="float: right;"><?php echo $moneda_origen?></span><br>
<span style="float: left">Tasa: </span> <span style="float: right;"><?php echo $tasa_moneda_origen?></span><br>
<hr>
<span style="float: left">Balance cliente: </span> <span style="float: right;"><?php echo decimal($balance)?></span><br>

</div>
<br>

<br>

<center>
	________________________<br>
	Firma cliente
</center>





Realizada por: <b><?php echo @mysql_result($sql_venta,0,"usuario")?></b>
<br><br>




<br><br>
<center>
<?php echo $_COOKIE["pie"]?>
</center>
</div>



<script>


	window.print()

	
	

	
	setTimeout(function(){
		////var termino = "<?php echo $termino;?>";
		////var id_venta = "<?php echo $folio;?>";
		self.close()
				
	},3000)


	window.addEventListener("keydown",tecla,false);
	$("#rv").focus()
	function tecla(e){
		if(e.keyCode=="13"){
				self.close()
		}
	}
</script>