<?
require("conecta.php");
$tipo=$_POST['cmbtipo'];
if ($tipo==1){
 $cond='1=1';
}
if ($tipo==2){
 $cond='stock > 0';
}
if ($tipo==3){
 $cond='stock = 0';
}
$sql="select m07001.cod_interno,m07001.glosa,m07005.stock from m07001 inner join m07005 on m07001.cod_interno=m07005.cod_interno where " . $cond . " order by m07001.glosa ;";
$res=mysql_query($sql,$con) or die(mysql_error());
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Impresión de items</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript">
 function imprime(){
  //window.print();
  //document.form1.submit();
 }//fin imprime
</script>
<style type="text/css">
<!--
.Estilo1 {
	font-size: 16px;
	font-weight: bold;
}
.Estilo2 {
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
</head>

<body onLoad="imprime()">
<table width="664" border="1" cellspacing="0">
  <tr>
    <td colspan="3"><div align="center" class="Estilo1">LISTADO GENERAL DE ITEMS <br>
      <br>
    </div></td>
  </tr>
  <tr>
    <td width="167"><div align="center" class="Estilo2">CODIGO</div></td>
    <td width="550"><div align="center" class="Estilo2">GLOSA</div></td>
    <td width="80"><div align="center" class="Estilo2">STOCK</div></td>
  </tr>
  <?php
   while ($fila=mysql_fetch_row($res)){
    $cod=$fila[0];
	$gl=strtolower($fila[1]);
	$st=$fila[2];
    echo "<tr><td>$cod</td><td>$gl</td><td align='right'>$st</td></tr>";
  }
  ?>
</table>
<?php 
mysql_close($con);
?>
<form name="form1" method="post" action="M0703003.php">
</form>
</body>
</html>
