<?php

include ("conexion.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>UCA :.</title>

<link href="ucaestilos.css" rel="stylesheet" type="text/css" /></head>



<body>
<table width="950" border="0" align="center">
  <tr>
    <td><table width="950" border="0" align="center">
      <tr>
        <td><table width="950" border="0" align="center" cellspacing="0">
            <tr>
              <td width="22%"><hr /></td>
              <td width="57%" align="center"><span class="style7">Listado de Paquetes</span></td>
              <td width="21%"><hr /></td>
            </tr>
          </table>
            <br />
            <p>
              <?php

//CONSULTA GENERAL DE PAQUETES
$cons4="SELECT idPaquete,nompaquete FROM paquetes ORDER BY nompaquete";
$res4=mysql_query($cons4,$conex) or die ("No se obtuvo el registro de vales");
while($filax = mysql_fetch_array($res4))
{
echo "<table border=0 align='center' width='800'>";
echo "<tr >";

echo "<td class='style7' align='center'>";
echo $filax[1];
echo "</td>";

echo "</tr>";

echo "<tr>";
echo "<td>";
//CONTENIDO DEL PAQUETE
echo "<table align='center' cellpadding='2' class='tablaBordes' width='700'>";
echo "<tr class='tablaCabecera'>";

echo "<td width='60'>";
echo " ID ";
echo "</td>";

echo "<td>";
echo "Nombre";
echo "</td>";

echo "<td width='120'>";
echo "Clasificaci&oacute;n";
echo "</td>";

echo "<td width='100'>";
echo "Presentaci&oacute;n";
echo "</td>";

echo "<td width='60'>";
echo "Cantidad";
echo "</td>";

echo "</tr>";


	$cons3="SELECT clave,cantidad FROM contenido_paquete WHERE idPaquete='$filax[0]'";
	$res3=mysql_query($cons3,$conex) or die ("No se realizo el barrido en la tabla contenido_paquete");
	while($fila2 = mysql_fetch_array($res3))

	{		

			$query="SELECT clave,nombre,clasificacion FROM productos Where clave='$fila2[0]'";
			$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>";
				
				//CONSULTO NOMBRE DE LA PRESENTACION
				$cons1="SELECT idPresentacion FROM  productos WHERE clave='".$fila[0]."'";
				$res1=mysql_query($cons1,$conex) or die ("No consulto ID de presentacion");
				$idpresen=mysql_result($res1,0,'idPresentacion');
				
				$cons2="SELECT presentacion FROM presentaciones WHERE idPresentacion='$idpresen'";
				$res2=mysql_query($cons2,$conex) or die ("No consulto nombre de presentacion");
				@$presen=mysql_result($res2,0,'presentacion');
				
				//ID
				echo "<td class='style1' align='center'>";
				echo $fila[0];
				echo "</td>";
				
				//nombre
				echo "<td class='style1'>";
				echo $fila[1];
				echo "</td>";
				
				//clasficiacion
				echo "<td class='style1' >";
				echo $fila[2];
				echo "</td>";
				
				//IMPRIMO PRESENTACION
				echo "<td class='style1'>";
				echo $presen;
				echo "</td>";
				
				//CANTIDAD
				echo "<td class='titulo' bgcolor='#999999' align='center'>";
				echo $fila2[1];
				echo "</td>";
			}
			echo "</tr>";
	}

	echo "</table>";
echo "</td>";
echo "</tr>";
echo "</table>";	
echo "<hr color='#cccccc' noshade size='1' width='650px' align='center'>";
}


?>
          </p></td>
      </tr>
    </table>
      <br />
      <table width="173" border="0" align="center" cellspacing="10">
        <tr>
          <td width="55" valign="top"><div align="center">
              <p>
                <input name="Submit" type="button" class="boton2" value="Imprimir" onclick="javascript:print()" />
              </p>
          </div></td>
          <td width="84"><form id="form1" name="form1" method="post" action="main.php?a=32">
              <div align="center">
                <p>
                  <input name="Submit2" type="submit" class="boton2" value="Volver a paquetes" />
                </p>
              </div>
          </form></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>

</html>

