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

*{
font-size:14px;
font-family:"Arial";

}
h3{
	font-size:14px;
	font-weight:bolder;
}
h5{
	font-size:12px
}
th{
	background: green;
	color:white;
	text-align: center;

}

</style>
<?php
$folio = $_GET['folio'];
include_once("../php/config.php");
$sql_venta = mysql_query("select * from compras where folio='$folio'") or die (mysql_error());
$sql_detalle = mysql_query("select * from detalle_compra where folio='$folio'") or die (mysql_error());

$proveedor = @mysql_result($sql_venta,0,"proveedor");

$sql_proveedor = mysql_query("select * from proveedores where nombre='$proveedor'") or die (mysql_error());



$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");	
	?>

<span class="datos_empres2" style="font-size: 30px;font-weight: bolder;font-family: 'Arial black'"><?php echo $enombre;?></span><b><br>
<span class="datos_empres"><?php echo $etelefono;?> </span><br>
<span class="datos_empres"><?php echo $edireccion;?> </span><br>
<span class="datos_empres"><?php echo $ernc;?></span><br>
<center>
<?php 
	if(@mysql_result($sql_venta,0,"termino")=="Conduce"){
?>
	<h2>CONDUCE</h2>
<?php }else{?>
	<h2>FACTURA</h2>
<?php }?>
</center>
<br>
<br>
Orden #: <?php echo $_GET["folio"]?><br>
Fecha : <?php echo  @mysql_result($sql_venta,0,"hora");?><br>
Termino: <?php echo @mysql_result($sql_venta,0,"termino");?><br>
<br>

Cliente: <?php echo $cliente?><br>
RNC/ Cedula: <?php echo @mysql_result($sql_cliente,0,"cedula");?><br>
<?php echo @mysql_result($sql_cliente,0,"telefono");?><br>
<?php echo @mysql_result($sql_cliente,0,"direccion");?><br>
<?php echo @mysql_result($sql_venta,0,"nota");?><br>
<div style="float: right;">
<?php echo @mysql_result($sql_venta,0,"tipo_ncf");?><br>
NCF:  <?php echo @mysql_result($sql_venta,0,"ncf");?><br>
</div>


<table class="" data-page-length='8' style="width: 100%">
	<thead>
		
		<th>Codigo</th>
		<th>Descripcion</th>
		             
		<th>Cantidad</th>
		<th>Precio compra</th>
		<th>Total</th>
		
	</thead>
<tbody>
<?php while($r=mysql_fetch_array($sql_detalle)){?>
			<tr>
			<td><?php echo $r["codigo"]?></td>
                <td><span class="text-primary"><?php echo $r["descripcion"]?></span></td>
				<td><?php echo decimal($r["cantidad"])?></td>
                <td><?php echo $r["costo"]?></td>
                <td><?php echo $r["total_costo"]?></td>
             
               
			</tr>
         <?php }?>
	</tbody>
</table>
<hr>
<br>
<br>
<div style="float: right; width: 200px;">
<span style="float: left">Impuestos: </span> <span style="float: right;"><?php echo @decimal(mysql_result($sql_venta,0,"impuesto"))?></span><br>

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


	<span style="float: left">Efectivo: </span> <span style="float: right;"><?php echo @decimal(mysql_result($sql_venta,0,"pago_con"))?></span><br>
	<span style="float: left">Balance pendiente: </span> <span style="float: right;"><?php echo @decimal(mysql_result($sql_venta,0,"balance"))?></span><br>
	
	
</div>

<br><br><br>
<br><br><br>
<div style="float:left">
<center>
______________________________<br>
Entegado por
</center>
</div>

<div style="float:right">
<center>
______________________________<br>
Recibido por
</center>
</div>
<script>
	window.print()
	setTimeout(function(){
		window.close()
	},2000)
</script>