<?php

header("Content-type: application/vnd-ms-excel; charset=iso-8859-1");
header("Content-Disposition: attachment; filename=Reporte_inventario_con_cabys-".date('d-m-Y').".xls");


 include ("../conexion.php");	

       $parametros = "SELECT * FROM web_0000 ";
       $result_parametros = $mysqli->query($parametros);
       $row_para = $result_parametros->fetch_array();
     
	   $NombreComercial =  $row_para["NOMCOM"];
	   $Razon          =  $row_para["RAZSOC"];
	   $Direccion       =  $row_para["DIREMP"];
	   $Cedula          =  $row_para["CEDJUR"];
	   $Telefono        =  $row_para["NUMTEL"];


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LISTA DE INVENTARIO CON CODIGO CABYS</title>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>   </tr>
  <tr>
     <td></td>
 <td colspan="7"  bgcolor="skyblue"><div align="center"><strong> LISTA DE INVENTARIO CON CODIGO CABYS</strong></div></td>
  </tr>
     <tr>   </tr>
  <tr>
       <td width="10%"></td>
        <td  bgcolor="skyblue" width="37%" ><div align="center"><strong>BARRAS</strong></div></td>
        <td  bgcolor="skyblue" width="37%"></td>
        <td  bgcolor="skyblue" width="30%"><div align="center"><strong>DESCRIPCION</strong></div></td>
        <td  bgcolor="skyblue" width="37%" ><div align="center"><strong>COD CAByS</strong></div></td>
        <td  bgcolor="skyblue" width="300%"><div align=""><strong>DESCRIPCION CAByS</strong></div></td>
        <td  bgcolor="skyblue" width="10%"><div align="center"><strong>IMPUESTO CAByS</strong></div></td>
  </tr>
  
  
  

<?php
	

 $consulta= "SELECT CDGBAR,DSCART,cdghac FROM web_1001 WHERE cdghac !='' ORDER BY DSCART ASC";
	if ($resultado = $mysqli->query($consulta)) 

  	while ($res = $resultado->fetch_assoc()) {

	$cdgbar  = $res["CDGBAR"];
	$cdgbar2 = "Cod. ".$cdgbar;
	$dscart  = $res["DSCART"];
	$cdghac  = $res["cdghac"];
	
	$consulta1 = "SELECT * FROM codigoshacienda  WHERE codigoHacienda='$cdghac' ";
		$result = $mysqli->query($consulta1);
		$row = $result->fetch_array();
		
		$codigoHacienda  = "Cod. ".$row["codigoHacienda"];	
		$producto_servicio  = $row["producto_servicio"];
		$producto_servicio  =  substr($producto_servicio." ", 0, 50);
		$impuesto  = $row["impuesto"]." %";	



?>  



 <tr>
    <td></td>
    <td><div align="left"><?php echo $cdgbar2; ?></div></td>
    <td></td>
    <td><?php echo $dscart; ?></td>
    <td width="37%"><?php echo $codigoHacienda; ?></td>  
    <td  width="40%"><div><?php echo $producto_servicio ; ?></div></td>
    <td><div align="center"><?php echo $impuesto; ?></div></td>    
                
 </tr> 
  <?php

}
  ?>
</table>
</body>
</html>