<?php

if (isset($_SESSION['usuario'])){

$user=$_SESSION['usuario'];

}

else{

?>

<script>

location.href="index.php?errorusuario=3";

</script>

<?php }



include ("conexion.php");



$id=$_GET['tratamiento'];



$cons1="SELECT * FROM tratamientocompleto WHERE idTratamiento='$id'";

$res1=mysql_query($cons1,$conex) or die ("No se ejecuto cons1$");

$nom=mysql_result($res1,0,'tratamientoCompleto');

$precio=mysql_result($res1,0,'precio');



?>

<!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>

  <table width="950" border="0" align="center">

    <tr>

      <td><p class="style10">TRATAMIENTOS COMPLETOS</p>      </td>

    </tr>

    <tr>

      <td><HR /></td>

    </tr>

    <tr>

      <td>

      <div align="center">

                        <?php if (isset($_GET['error']))

      $error=$_GET['error'];

 {



	if (isset ($error))

	 {

				  $error=$_GET['error'];

				  

				  if($error==1)

				  {

				  echo "<p class='style3'>ĦRequiere seleccionar paquetes!</p>";

				  }

	}



}

  ?>



      </div>

      <table width="100%" height="0" border="0" cellpadding="0" cellspacing="10">

        <tr>

          <td width="46%" valign="top"><div align="right" class="style4">

              <div align="left" class="style10">DATOS DEL PAQUETE COMPLETO:</div>

          </div>

              <p><span class="style4">Nombre: </span><span class="style9"><?php echo $nom; ?></span><br />

                  <span class="style4">Precio: </span><span class="style9"><?php echo $precio; ?></span></p>

            <div align="left" class="style10">PAQUETES ASIGNADOS ACTUALMENTE:</div>

            <p>

              <?php
echo "<table cellpadding='2' class='tablaBordes'>";
echo "<tr class='tablaCabecera' align='center'>";

echo "<td>";
echo " ID ";
echo "</td>";

echo "<td>";
echo "Paquete";
echo "</td>";

echo "<td>";
echo "Eliminar";
echo "</td>";

echo "</tr>";



			$query="SELECT idTratamiento,idPaquete FROM contenido_tratamientocompleto WHERE idTratamiento='$id'";

			$result=mysql_query($query,$conex) or die ("No se consulto tratamiento completo");

			$numero_filas=mysql_num_rows($result);

			$numero_campos= mysql_num_fields($result);

			while($fila = mysql_fetch_array($result))

			{

				echo "<tr class='tablaBordes'>";

				

				//ID

				echo "<td class='style1' align='center'>";

				echo $fila[1];

				echo "</td>";

				

				//paquete

				$cons2="SELECT nompaquete FROM paquetes WHERE idPaquete ='$fila[1]'";

				$res2=mysql_query($cons2,$conex) or die ("No se consulto nombre de paquete");

				$nompaquete=mysql_result($res2,0,'nompaquete');

				

				echo "<td class='style1'>";

				echo $nompaquete;

				echo "</td>";

				

				//Eliminar

				echo "<td class='style4' align='center'>";

				echo "<a href='deletepaquetetratamiento.php?paquete=".$fila[1]."&tratamiento=".$id."'> <img src='img/icon_delete.jpg' border='0' ALT='Quitar paquete'></a>";

				echo "</td>";



				

				echo "</tr>";

			}

echo "</table>";

mysql_free_result($res);



?>

            </p></td>

          <td width="54%" valign="top" bgcolor="#E9E9E9" ><form id="form1" name="form1" method="post" action="svcontenidotratamientocompleto.php">

              <p class="style10">Selecciona paquetes por asignar:</p>

              <p>

                <?php

	  
echo "<table align='center' cellpadding='4' class='tablaBordes'>";
echo "<tr class='tablaCabecera' align='center'>";

echo "<td>";
echo "Seleccionar";
echo "</td>";

echo "<td>";
echo " ID ";
echo "</td>";

echo "<td>";
echo "Paquete";
echo "</td>";


/*
echo "<td class='style4'>";

echo "Precio";

echo "</td>";
*/

echo "</tr>";


			$query="SELECT idPaquete,nompaquete FROM paquetes ORDER BY nompaquete";

			$result=mysql_query($query,$conex) or die ("No se consultaron las materias");

			$numero_filas=mysql_num_rows($result);

			$numero_campos= mysql_num_fields($result);

			while($fila = mysql_fetch_array($result))

			{

				echo "<tr class='tablaBordes'>";

				

				//IMPRIMO CHECKBOX

				echo "<td class='style1' align='center'>";

				echo "<input name='paquetes[]' type='checkbox' value='".$fila[0]."' >";

				echo "</td>";

				

				//ID

				echo "<td class='style1' align='center'>";

				echo $fila[0];

				echo "</td>";

				

				//paquete

				echo "<td class='style1'>";

				echo $fila[1];

				echo "</td>";

				

				/*
				//precio

				echo "<td class='style1' align='right'>";

				printf ("$ %.2f", $fila[2]);

				echo "</td>";
				*/
				

				echo "</tr>";

			}

echo "</table>";



?>

                            </p>

              <input name="tratamiento" type="hidden" id="tratamiento" value="<?php echo $id; ?>" />

              <table width="100" border="0" align="center" cellpadding="0" cellspacing="10">

                <tr>

                  <td><input name="button" type="button" class="boton2" id="button" onClick="javascript:history.back()" value="Cancelar y regresar" /></td>

                  <td><input name="button2" type="submit" class="boton2" id="button2" value="Asignar seleccionados" /></td>

                </tr>

              </table>

          </form></td>

        </tr>

      </table></td>

    </tr>

  </table>

</body>

</html>

