<?php
 
session_cache_limiter('private');
session_start();
include("DMMYSQLG.php");
$name="Catalogo_De_Proveedores.xls"; 
if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE'))
	header('Content-Type: application/force-download');
else
	header('Content-Type: application/octet-stream');
header('Content-disposition: attachment; filename="'.$name.'"');
?>
  <table width="748" border='1'>
         <tr>
        <th width="60"  nowrap><div align="center">CLAVE</div></th>
		<th width="300"  nowrap><div align="center">DESCRIPCION</div></th>
		<th width="200"  nowrap><div align="center">PROVEEDOR DE:</div></th>
		<th width="120"  nowrap><div align="center"># DE PROVEEDOR</div></th>
		<th width="80"  nowrap><div align="center">STATUS</div></th>
      </tr>
      <?php

if(isset($_POST['t1'])&&$_POST['t1']=="clave") $sql ="SELECT * FROM fproveedores WHERE fproveedores.modulo='".$_SESSION['mod_sis']."' AND   nparte1 = '".$_POST['b1']."' order by np_desc1 ";
elseif(isset($_POST['t1'])&&$_POST['t1']=="nombre") $sql="SELECT * FROM fproveedores WHERE fproveedores.modulo='".$_SESSION['mod_sis']."' AND   np_desc1 like '%".$_POST['b1']."%' order by np_desc1";
else $sql = "SELECT * FROM fproveedores order by np_desc1 ";
	echo mysqli_error($con);
	$sq=mysqli_query($con ,$sql);
	while($reg = mysqli_fetch_array($sq)){
	  	echo "<tr>";
		echo "<td> <div align='center'>" . $reg["nparte1"] . "</div></td>";
		echo "<td> <div align='left'>" . $reg["np_desc1"] . "</div></td>";
		echo "<td> <div align='center'>" . $reg["proveedor"] . "</div></td>";
		echo "<td> <div align='center'>" . $reg["numero"] . "</div></td>";
		echo "<td> <div align='center'>" .$reg["t1"] . "</div></td>";
		echo "</tr>";
	}
	mysqli_close($con);   
	?>
    </table>