<?php
if (isset($_SESSION['usuario'])){
$user=$_SESSION['usuario'];
}
else{
?>
<script>
location.href="index.php?errorusuario=3";
</script>
<?php }
?>
<!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=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<link href="ucaestilos.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.Estilo1 {font-size: 14px}
-->
</style>
</head>
<body>
<div>
  <table width="950" border="0" align="center">
    <tr>
      <td><p class="style10">LISTADO DE PRODUCTOS</p>
      </td>
    </tr>
  </table>

  <table width="1000" border="0" align="center">
    <tr>
      <td>

	   <?php	
	   include ("conexion.php");
			//=========IMPRESION DE TABLA
		echo "<table align='center' cellpadding='2' class='tablaBordes'>";
		echo "<tr class='tablaCabecera' align='center'>";
		echo "<td align='center' width='40'>ID</td>";
		echo "<td>Nombre</td>";
		echo "<td width='120'>Clasificaci&oacute;n</td>";
		echo "<td>M&iacute;nimo</td>";
		echo "<td>Unidades<br/>Paquete</td>";
		echo "<td>Presentaci&oacute;n Entrega</td>";
		echo "<td>Presentaci&oacute;n Incontable</td>";
		echo "<td>Costo unidad</td>";
		echo "<td width='20'>Validado</td>";		
		echo "</tr>";

    	$query="SELECT clave,nombre,descripcion,minimo,costounidad,clasificacion,idPresentacion,idPresentacion2,unidadespaquete FROM productos ORDER BY nombre ASC";
		$result=mysql_query($query,$conex) or die ("No se consultaron los productos");
		$numero_filas=mysql_num_rows($result);
		$numero_campos= mysql_num_fields($result);
		while($fila = mysql_fetch_array($result))
		{
			echo "<tr class='tablaBordes'>";
			//clave
			echo "<td align='center' class='style1'>$fila[0]</td>";
			//nombre
			echo "<td class='style1'>".utf8_encode($fila[1])."</td>";
			//clasificacion
			echo "<td class='style1'>";
			echo $fila[5];
			echo "</td>";
			//minimo
    		echo "<td class='style1' align='center'>";
			echo $fila[3];
			echo "</td>";
			//unidadespaquete
    		echo "<td class='style1' align='center'>";
			echo $fila[8];
			echo "</td>";
			//presentacion venta
			$query2="SELECT presentacion FROM presentaciones WHERE idPresentacion='$fila[6]'";
    		$resul2=mysql_query($query2,$conex) or die ("No se realizo query2");
			@$presen=mysql_result($resul2,0,'presentacion');
			echo "<td class='style1' align='center'>";
			echo $presen;
			echo "</td>";
			//presentacion compra
			$query22="SELECT presentacion FROM presentaciones WHERE idPresentacion='$fila[7]'";
    		$resul22=mysql_query($query22,$conex) or die ("No se realizo query22");
			@$presen2=mysql_result($resul22,0,'presentacion');
			echo "<td class='style1' align='center'>";
			echo $presen2;
			echo "</td>";
			//precio
			echo "<td class='style1' align='center'>";
			echo "$ ".$fila[4];
			echo "</td>";
			echo "<td class='style1' align='center'>&nbsp;</td>";
			echo "</tr>";
			}
echo "</table>";
?>
   </td>
  </tr>
</table>
  <p align="center">
    <input name="Submit" type="button" class="boton2" onClick="javascript:print()" value="Imprimir">
  </p>
</div>
</body>
</html>

