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



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

</head>



<body>

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

  <tr>

    <td><form action="svpacienteodontopediatria.php" method="post" name="form1">

		  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">

            <tr>

              <td><table width="100%" border="0">
                <tr>
                  <td><span class="style4">Nuevo paciente de odontopediatr&iacute;a:</span></td>
                  <td><div align="right" class="style7"> <span class="style4">&Uacute;ltimo Expediente Ingresado:</span>
                        <?php
		include ("conexion.php");
			$consul="SELECT max(CvePaciente) as maximo FROM pacientes_odontopediatria";
			$resul=mysql_query($consul,$conex) or die ("No se realizo maximo");
			$maximo=mysql_result($resul,0,'maximo');
			echo $maximo;
        ?>
                  </div></td>
                </tr>
              </table>
                <hr align="left" width="100%" size="1" color="#999999" />

                <div align="center">

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

      $error=$_GET['error'];

 {



if (isset ($error))

 {

			  $error=$_GET['error'];

			  

			  if($error==1)

			  {

			  echo "<p class='style3'>ĦEl expediente ya existe... intenta con otro!</p>";

			  }

}

else

{



}



}

  ?>

                </div>

                <?php 

					include ("conexion.php");

					$cons1="SELECT MAX(CvePaciente) as maximo FROM pacientes_odontopediatria";

					$res1=mysql_query($cons1,$conex) or die ("No se realizo cons 1");

					$max=mysql_result($res1,0,'maximo');

					

					$next=$max+1;

				?>

                <table width="551" border="0" align="center" cellspacing="5">

                <tr>

                    <td width="130" class="style1"><div align="right" class="style4">Fecha Alta:</div></td>

                    <td width="402"><input name="fecha" type="text" class="cuadrotexto" id="fecha" value="<?php echo date("Y-m-d");?>" size="10" maxlength="40" /></td>

                  </tr>

                  <tr>

                    <td width="130" class="style1"><div align="right" class="style4">Expediente:</div></td>

                    <td width="402"><input name="expediente" type="text" class="cuadrotexto" id="expediente" size="10" maxlength="40" value="<?php echo $maximo+1;?>"/></td>

                  </tr>

                  <tr>

                    <td class="style4"><div align="right">Nombre completo:</div></td>

                    <td><input name="nombre" type="text" class="cuadrotexto" id="nombre" size="50" maxlength="100" /></td>

                  </tr>

                  <tr>

                    <td class="style4"><div align="right">Tipo de paciente:</div></td>

                    <td><span class="style9">

                      <?php

					

					include ("conexion.php");

					$cons="SELECT * FROM tipo_pacientes ORDER BY tipo";

					$res=mysql_query($cons,$conex) or die ("No se pudo consultar");

					  echo "<select name='tipo' class='cuadrotexto'>";

                      While ($campo=mysql_fetch_assoc($res)) 

	    				{

						  echo "<option value=".$campo['idTipo']." >".$campo['tipo']."</option>"; 

 						}

                      echo "</select>";

					  

                    ?>

                    </span></td>

                  </tr>

                  <tr>

                    <td class="style4"><div align="right">Estado:</div></td>

                    <td><select name="estado" class="cuadrotexto" id="estado">

                      <option value="Activo" selected="selected">Activo</option>

                      <option value="Inactivo">Inactivo</option>

                      <option value="Cancelado">Cancelado</option>

                      <option value="No se encuentra">No se encuentra</option>

                      <option value="Repetido">Repetido</option>

                    </select></td>

                  </tr>

                </table>

                <p class="style4"></p>

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

                  <tr>

                    <td width="52"><div align="right">

                        <input name="Reset" type="reset" class="boton2" value="Limpiar" />

                    </div></td>

                    <td width="54"><input name="Submit2" type="submit" class="boton2" value="Guardar" /></td>

                  </tr>

                </table>

              </td>

            </tr>

          </table>

		  </form></td>

  </tr>

</table>



</body>

</html>

