<?php
 
session_cache_limiter('private');
session_start();
include("DMMYSQLG.php");
$name="Punto de Ventas.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="57"  nowrap><div align="center">Clave</div></th>
		<th width="91"  nowrap><div align="center">Descripcion</div></th>
		<th width="59"  nowrap><div align="center">Iniciales</div></th>
		<th width="53"  nowrap><div align="center">Cheque</div></th>
      </tr>
      <?php


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