<?php
 
session_cache_limiter('private');
session_start();
include("DMMYSQLG.php");
$name="Inventario.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="70"  nowrap><div align="center">CLAVE</div></th>
		<th width="250"  nowrap><div align="center">DESCRIPCION</div></th>
		<th width="250"  nowrap><div align="center">ALMACEN</div></th>
		<th width="60"  nowrap><div align="center">SECCION</div></th>
		<th width="80"  nowrap><div align="center">STATUS</div></th>
      </tr>
      <?php


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