<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 compra_factoria where folio='$folio'") or die (mysql_error());
$sql_detalle = mysql_query("select * from detalle_compra_factoria where folio='$folio'") or die (mysql_error());

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

$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>

	<h2>FACTURA DE COMPRA</h2>

</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>

Productor: <?php echo $proveedor?><br>
RNC/ Cedula: <?php echo @mysql_result($sql_proveedor,0,"cedula");?><br>
<?php echo @mysql_result($sql_proveedor,0,"telefono");?><br>
<?php echo @mysql_result($sql_proveedor,0,"direccion");?><br>
<?php echo @mysql_result($sql_venta,0,"nota");?><br>
<div style="float: right;">

NCF:  <?php echo @mysql_result($sql_venta,0,"ncf");?><br>
</div>
<hr>
<table>
	<th>Variedad</th>
	<th>Chofer</th>
	<th>---</th>

	<tr>
	<td><?php echo @mysql_result($sql_venta,0,"variedad");?></td>
	<td><?php echo @mysql_result($sql_venta,0,"chofer");?></td>
	<td><?php echo @mysql_result($sql_venta,0,"tipo_chofer");?></td>
	

</table>

<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: 300px;">
<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 FANEGA: </span> <span style="float: right;"><?php echo @decimal(mysql_result($sql_venta,0,"fanega"))?></span><br>

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

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

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

<span style="float: left">TOTAL PRODUCCION: </span> <span style="float: right;"><?php echo @decimal(mysql_result($sql_venta,0,"produccion"))?></span><br>
	<span style="float: left">BALANCE PENDIENTE: </span> <span style="float: right;"><?php echo @decimal(mysql_result($sql_venta,0,"balance"))?></span><br>
	<br><br><br>
	<br><br><br>

	
</div>
<br><br><br>
<br><br><br>

<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>