<html>
 <head><meta http-equiv="Content-Type" content="text/html; charset=gb18030">
   <style>
      input[type="checkbox"]{
      border: 5px solid #3498db;
      width: 13px;
      height: 13px;
      margin: 0 2px 0 0;
    }
    label {
      width: 25%;
       float: left;
       font-famyli:Arial;
       font-size:12px;
       color:#3498db;
    }
   </style>

   <script type="text/javascript">
    function confirmation() {
      if(confirm("Esta seguro de eliminar el Diagnostico?"))
      {
         return true;
      }
      return false;
     }

    function confirmation1() {
      if(confirm("Esta seguro de eliminar el Procedimiento?"))
      {
         return true;
      }
      return false;
     }

    function Suma(isChecked, myValue)
    {
      tot = parseInt(document.form1.numSupPlaca.value);
      //alert (tot);
      myValue = parseInt(myValue);
       //alert (myValue);
      if (isChecked.checked) document.form1.numSupPlaca.value = tot + myValue;
      else document.form1.numSupPlaca.value = tot - myValue;

      tot1 = document.form1.numSupPlaca.value / 80;
      document.form1.indicePlaca.value = tot1*100;
    }
   </script>

   <script src="js/ajax.js"></script> 
   <script src="js/cups.js"></script>  
   <script src="js/cups1.js"></script>   

   <script>
     function check1(box) {
       if (box.checked) {
         document.getElementById("chkDgs").checked=false
       }
      }
      function check2(box) {
        if (box.checked) {
           document.getElementById("chkCups").checked=false 
         }
      }
    </script>
 </head>

<?php

 function cuantosRe($tabla, $consulta, $historia)
 { 
   //conexion a la base de datos
   include("conexionOdo.php");
   $query = " SELECT COUNT(*) as cuantos FROM $tabla WHERE numTratamiento = $consulta ";//numConsulta = $consulta AND tipoHistoria='$historia' "; 
    //echo $query;
   $result = mysql_query($query) or die('Consulta de cantidad $tabla: ' . mysql_error());
   $line = mysql_fetch_array($result, MYSQL_ASSOC);
          
   $ct = $line["cuantos"];
          
   // Liberar resultados
   mysql_free_result($result);
   // Cerrar la conexion
   //mysql_close($link);
            
   return $ct;  
 } 

 include("headerImp.php");
 include("select.php");
 include("conexionOdo.php");  

    //DEFAULT HORA EN BOGOTA;
    date_default_timezone_set("America/Bogota");
    $w_fechaImp =  date("Y/m/d H:i:s");
    

  $activeBoton = "S";
 
  session_start();    
  $s_nitEmpresa = $_SESSION['nitEmpresa']; 
  $s_codSede    = $_SESSION['codSede'];
  $s_usuario    = $_SESSION['nombreUsuario'];
  $s_empresa    = $_SESSION['empresaUsuario'];
  $s_cargo      = $_SESSION['cargoUsuario'];
  $s_idUsuario  = $_SESSION['idUsuario']; 
  
  // tipo Consulta
  $s_tipoCon    = $_SESSION['s_tipoCon']; 
  // causa de consulta
  $s_codCausa   =  $_SESSION['s_codCausa'];
  //Tipo Entidad
  $s_codEntidad = $_SESSION['s_codEntidad'];
 
  //paciente
  $e_tipoId     = $_SESSION['e_tipoId'];
  $e_idPaciente = $_SESSION['e_identifica'];
     
  $w_fecha          = date("Y-m-d",time()); 
  
  //Definicion de variables de entrada
  $par    =  $_GET['lin'];
  $par1   =  base64_decode($par);
  $partir = explode("/",$par1);   
  $s_tipoHistoria   = $partir[0];

  $viene            = $partir[1];
  //$s_yaGrabo      = $partir[2];
  $_SESSION['s_pc'] = $partir[3];
  $pc               = $_SESSION['s_pc'];


  $e_tratamiento    = $partir[4];
  
  $s_numSupPlaca =0;
  $s_indicePlaca=0;

  /*session_start();
  $pc               = $_SESSION['s_pc'];
  $e_tratamiento    = $_SESSION['s_tra'];*/
  
 ///// TRAE NUMERO DE CONSULTA Y DE TRATAMIENTO
 if ($e_tratamiento>0)
 {

    // consulta paciente
     $query = "SELECT * FROM `SIME_BAS_PACIENTE` WHERE `tipoId` = '$e_tipoId' AND `idPaciente` =  $e_idPaciente";
     $result = mysql_query($query) or die('Consulta de paciente fallida: ' . mysql_error());

     //$line = mysql_fetch_array($result, MYSQL_ASSOC);
  
     $cantRegistros=mysql_num_rows($result);
     
     $i=0;
     while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
  
       $s_apell1Paciente   = $line["apell1Paciente"]; 
       $s_apell2Paciente   = $line["apell2Paciente"]; 
       $s_nomPaciente      = $line["nomPaciente"]; 
       $s_nomPaciente2     = $line["nomPaciente2"]; 
       $s_fecNacimiento    = $line["fecNacimiento"]; 
       $s_lugarNacimiento  = $line["lugarNacimiento"]; 
       $s_edadPaciente     = $line["edadPaciente"]; 
       $s_sexoPaciente     = $line["sexoPaciente"]; 
       $s_estCivil         = $line["estCivil"]; 
       $s_escolaridad      = $line["escolaridad"]; 
       $s_tipoVinculacion  = $line["tipoVinculacion"]; 
       $s_depResidencia    = $line["depResidencia"]; 
       $s_ciuResidencia    = $line["ciuResidencia"]; 
       $s_dirResidencia    = $line["dirResidencia"]; 
       $s_telResidencia    = $line["telResidencia"]; 
       $s_email            = $line["email"]; 
       $s_famResponsable   = $line["famResponsable"]; 
       $s_parentesco       = $line["parentesco"]; 
       $s_telPariente      = $line["telPariente"]; 
       
       $i = $i+1;
     }//while    
   
     // Liberar resultados
     mysql_free_result($result);
   
     //sexo paciente
     if ($s_sexoPaciente == "M")
     {
       $s_sexoPaciente = "Masculino";
     }
    
     if ($s_sexoPaciente == "F")
     {
       $s_sexoPaciente = "Femenino";
     }
   
     //estado civil
     if ($s_estCivil== "S")
     {
       $s_estCivil="Soltero";
     }
     if ($s_estCivil== "C")
     {
       $s_estCivil="Casado";
     }
     if ($s_estCivil== "U")
     {
       $s_estCivil="Unión Libre";
     }
     if ($s_estCivil== "D")
     {
       $s_estCivil="Divorciado";
     } 
     if ($s_estCivil== "V")
     {
       $s_estCivil="Viudo";
     }
  
     //vinculacion   
     if ($s_tipoVinculacion == "C")
     {
     $s_tipoVinculacion ="Cotizante";
     }
     if ($s_tipoVinculacion == "B")
     {
      $s_tipoVinculacion ="Beneficiario";
     } 
     if ($s_tipoVinculacion == "P")
     {
      $s_tipoVinculacion ="Particular";
     }
     if ($s_tipoVinculacion == "O")
     {
      $tvO ="Otro";
     }
  
     //escolaridad 
     if ($s_escolaridad == "P")
     {
      $s_escolaridad ="Primaria";
     }
     if ($s_escolaridad == "B")
     {
      $s_escolaridad ="Bachiller";
     }
     if ($s_escolaridad == "T")
     {
      $s_escolaridad ="Técnico";
     }
     if ($s_escolaridad == "G")
     {
      $s_escolaridad ="Tecnológico";
     }
     if ($s_escolaridad == "U")
     {
      $s_escolaridad ="Universitario";
     }
     if ($s_escolaridad == "E")
     {
      $s_escolaridad ="Epecialización";
     }
     // Liberar resultados
     mysql_free_result($result);

     // consulta medico que atendio

      $qr   = "SELECT medConsulta, fechaConsulta FROM SIO_CIT_ATENDIDAS WHERE numtratamiento = $e_tratamiento AND numConsulta= $pc" ;
      $reQr = mysql_query($qr) or die('Consulta de consulta para medico fallida: ' . mysql_error());           
      $liQr  = mysql_fetch_array($reQr, MYSQL_ASSOC);
      $s_medConsulta = $liQr["medConsulta"]; 
      $fecha_consulta  = $liQr['fechaConsulta'];
   
      $queryMed = " SELECT CONCAT(nomUsuario, ' ', apell1Usuario, ' ',  apell2Usuario) AS medico " .
                       " FROM SIME_BAS_N_USUARIOS WHERE idUsuario = $s_medConsulta"; 
      $resultMed = mysql_query($queryMed) or die('Consulta de nombre de medico fallida: ' .    mysql_error());           
      $lineMed   = mysql_fetch_array($resultMed, MYSQL_ASSOC);
      $nomMedico = $lineMed["medico"]; 
            
       /*----------------------------------------------------------------- */ 
       // consulta familiar que acompaño
       $queryFam  = "SELECT * FROM `SIO_O_CITAS` WHERE preConsulta = $pc" ;
       $resultFam = mysql_query($queryFam) or die('Consulta de familiar fallida: ' . mysql_error());   
       $lineFam   = mysql_fetch_array($resultFam, MYSQL_ASSOC); 
       $s_famResponsable   = $lineFam["familiar"]; 
       $s_parentesco       = $lineFam["parentesco"]; 
       $s_telPariente      = $lineFam["telPariente"]; 
      
       
       // Liberar resultados
       mysql_free_result($resultFam);  
       /*----------------------------------------------------------------- */ 

    /*----------------------------------------------------------------- */ 

    //OBSERVACIONES DE LA CITA

    $queryCt = "SELECT observaciones FROM SIO_O_CITAS where preConsulta = $pc" ;
    $resultCt = mysql_query($queryCt) or die('Consulta de observaciones cita fallida: ' . mysql_error());           
    $lineCt   = mysql_fetch_array($resultCt, MYSQL_ASSOC);
    $obsCita  = $lineCt["observaciones"];   
   
   // Liberar resultados
        mysql_free_result($result);             
   /*----------------------------------------------------------------- */ 


   
  ///////////////////////////////////
  ///////////// datos de la historia

   $query = "SELECT *  FROM SIO_TRAT_CON WHERE tratamiento=$e_tratamiento ";
   $result = mysql_query($query) or die('Consulta de tratamiento consulta fallida: ' . mysql_error());
   $line = mysql_fetch_array($result, MYSQL_ASSOC);
   
   $t_numConsulta   = $line['numConsulta'];

   $t_numConsulta = $pc;

   $nConsulta       = $t_numConsulta;
   $e_nvoNroCon     = $t_numConsulta;
   $t_estado        = $line['estado'];
   $t_fechaCreacion = $line['fechaCreacion'];

   if ($t_numConsulta>0)
   {
      $s_yaGrabo="S";
   } 
 }//pc>0 

 //$nConsulta=999;
 //$e_nvoNroCon=999; 
 //$s_yaGrabo=="S";
  $s_tipoHistoria="TRATAMIENTO";


 // TRAE DATOS DEL PACIENTE
 $query = "SELECT * FROM SIME_BAS_PACIENTE WHERE tipoId='$e_tipoId ' AND idPaciente=$e_idPaciente ";
 $result = mysql_query($query) or die('Consulta de paciente fallida: ' . mysql_error());
 $line = mysql_fetch_array($result, MYSQL_ASSOC);
  
 $s_sexo            = $line["sexoPaciente"];
 $s_apell1Paciente  = $line["apell1Paciente"];   
 $s_apell2Paciente  = $line["apell2Paciente"]; 
 $s_nomPaciente     = $line["nomPaciente"];  
 $s_nomPaciente2    = $line["nomPaciente2"]; 
 $s_edadPaciente    = $line["edadPaciente"];
 $w_rhPac           = $line["RH"];

 $w_nomPac = $s_nomPaciente . ' ' . $s_nomPaciente2 . ' ' . $s_apell1Paciente . ' ' .  $s_apell2Paciente;
 
 /*-----ALERGIAS----*/
 $queryAlerg="SELECT alergias FROM SIO_ALERGIAS WHERE tipoId= '$e_tipoId ' AND numeroId=$e_idPaciente ";
 $resultAlerg = mysql_query($queryAlerg) or die('Consulta de existencia de alergias fallida: ' . mysql_error());   
 $lineAlerg = mysql_fetch_array($resultAlerg, MYSQL_ASSOC);
 $s_alergias = $lineAlerg['alergias'];
 // Liberar resultados
 mysql_free_result($resultAlerg);
 /*-----FIN ALERGIAS----*/   

 //CARGA VARIABLES DE  LAS TABLAS CUANDO YA S HA CREADO LA HISTORIA -- GENERAL --
 /* ============================================================================================================================
 ============================================================================================================================*/

 if ($nConsulta>0)
 { 
   
  // VARIABLES SITUACION ACTUAL
  $query = "SELECT * FROM SIO_SIT_ACTUAL WHERE numtratamiento = $e_tratamiento";//numConsulta= $nConsulta" ;

  $result = mysql_query($query) or die('Consulta  de Situacion Actual fallida: ' . mysql_error());
  $line = mysql_fetch_array($result, MYSQL_ASSOC);

  $s_motConsulta = $line['motivoConsulta'];
  $s_enfActual   = $line['enfermedadActual']; 
  $s_antFam      = $line['antFamiliares'];

  //VARIABLES ANTECEDENTES ODONTOLOGICOS
  ////////////////////////////////////////////////////////////
  $query = "SELECT * FROM SIO_ANT_ODYMED WHERE numtratamiento = $e_tratamiento";//numConsulta= $nConsulta" ;
  $result = mysql_query($query) or die('Consulta  de Antecedentes fallida: ' . mysql_error());
  $line = mysql_fetch_array($result, MYSQL_ASSOC);
   /*
    $s_alergias          = $line['alergias'];
    if ($s_alergias =="" OR $s_alergias =="N")
    {
      $s_alergias = "N";
    }
    else
    {    
      $chkAlergia = "checked";
    }
    $s_obsAlergia       = $line['obsAlergias'];*/

    //-------------------------------------------------------//
    $s_discrasiasSang    = $line['discrasiasSang'];
    if ($s_discrasiasSang =="N" OR $s_discrasiasSang =="")
    {
      $s_discrasiasSang = "N";
    }
    else
    {    
      $chkDiscrasias = "checked";
    }
    $s_obsDiscrasiasSang= $line['obsDiscrasiasSang'];
    //-------------------------------------------------------//
    $s_cardiopatias      = $line['cardiopatias'];
    if ($s_cardiopatias =="N" OR $s_cardiopatias =="")
    {
      $s_cardiopatias = "N";
    }
    else
    {    
      $chkCardio = "checked";
    }
    $s_obsCardiopatias  = $line['obsCardiopatias'];
    //-------------------------------------------------------//
    $s_embarazo          = $line['embarazo'];
    if ($s_embarazo =="N" OR $s_embarazo =="")
    {
      $s_embarazo = "N";
    }
    else
    {    
      $chkEmbarazo = "checked";
    }
    $s_obsEmbarazo = $line['obsEmbarazo'];
    //-------------------------------------------------------//
    $s_altPresArterial   = $line['altPresArterial'];
    if ($s_altPresArterial =="N" OR $s_altPresArterial =="")
    {
      $s_altPresArterial = "N";
    }
    else
    {
      $chkPresArt = "checked";
    }
    $s_obsAltPresArterial = $line['obsAltPresArterial'];
    //-------------------------------------------------------//
    $s_tomaMedicamentos  = $line['tomaMedicamentos'];
    if ($s_tomaMedicamentos =="N" OR $s_tomaMedicamentos =="")
    {
      $s_tomaMedicamentos = "N";
    }
    else
    {    
      $chkTomaMedicamentos = "checked";
    }
    $s_obsTomaMedicamentos = $line['obsTomaMedicamentos'];
    //-------------------------------------------------------//
    $s_tratMedActual     = $line['tratMedActual'];
    if ($s_tratMedActual =="N" OR $s_tratMedActual =="")
    {
      $s_tratMedActual = "N";
    }
    else
    {    
      $chkTratMedActual = "checked";
    }
    $s_obsTratMedActual= $line['obsTratMedActual'];
    //-------------------------------------------------------//
    $s_hepatitis         = $line['hepatitis'];
    if ($s_hepatitis =="N" OR $s_hepatitis =="")
    {
      $s_hepatitis = "N";
    }
    else
    {    
      $chkHepatitis = "checked";
    }
    $s_obsHepatitis = $line['obsHepatitis'];
    //-------------------------------------------------------//
    $s_diabetes          = $line['diabetes'];
    if ($s_diabetes =="N" OR $s_diabetes =="")
    {
      $s_diabetes = "N";
    }
    else
    {    
      $chkDiabetes = "checked";
    }
    $s_obsDiabetes = $line['obsDiabetes'];
    //-------------------------------------------------------//
    $s_fiebreReum        = $line['fiebreReum'];
    if ($s_fiebreReum =="N" OR $s_fiebreReum =="")
    {
      $s_fiebreReum = "N";
    }
    else
    {    
     $chkFiebreReum = "checked";
    }
    $s_obsFiebreReum = $line['obsFiebreReum'];
    //-------------------------------------------------------//
    $s_sida              = $line['sida'];
    if ($s_sida =="N" OR $s_sida =="")
    {
      $s_sida = "N";
    }
    else
    {    
      $chkSida = "checked";
    }
    $s_obsSida = $line['obsSida'];
    //-------------------------------------------------------//
    $s_inmunosupresion   = $line['inmunosupresion'];
    if ($s_inmunosupresion =="N" OR $s_inmunosupresion =="")
    {
      $s_inmunosupresion = "N";
    }
    else
    {    
      $chkInmuno = "checked";
    }
    $s_obsInmunosupresion = $line['obsInmunosupresion'];
    //-------------------------------------------------------//
    $s_patologiasRenales = $line['patologiasRenales'];
    if ($s_patologiasRenales =="N" OR $s_patologiasRenales =="")
    {
      $s_patologiasRenales = "N";
    }
    else
    {    
      $chkPatRenal = "checked";
    }
    $s_obsPatologiasRenales = $line['obsPatologiasRenales'];
    //-------------------------------------------------------//
    $s_patRespiratoria   = $line['patRespiratoria'];
    if ($s_patRespiratoria =="N" OR $s_patRespiratoria =="")
    {
      $s_patRespiratoria = "N";
    }
    else
    {    
      $chkPatResp = "checked";
    }
    $s_obsPatRespiratoria = $line['obsPatRespiratoria'];
    //-------------------------------------------------------//
    $s_trasGastricos     = $line['trasGastricos'];
    if ($s_trasGastricos =="N" OR $s_trasGastricos =="")
    {
     $s_trasGastricos = "N";
    }
    else
    {    
     $chkTrasGastricos = "checked";
    }
    $s_obsTrasGastricos = $line['obsTrasGastricos'];
    //-------------------------------------------------------//
    $s_trasEmocional     = $line['trasEmocional'];
    if ($s_trasEmocional =="N" OR $s_trasEmocional =="")
    {
      $s_trasEmocional = "N";
    }
    else
    {    
      $chktTrasEmocional = "checked";
    }
    $s_obsTrasEmocional = $line['obsTrasEmocional'];
    //-------------------------------------------------------//
    $s_sinusitis         = $line['sinusitis'];
    if ($s_sinusitis =="N" OR $s_sinusitis =="")
    {
      $s_sinusitis = "N";
    }
    else
    {    
      $chkSinusitis = "checked";
    }
    $s_obsSinusitis= $line['obsSinusitis'];
    //-------------------------------------------------------//
    $s_cirugias          = $line['cirugias'];
    if ($s_cirugias =="N" OR $s_cirugias =="")
    {
      $s_cirugias = "N";
    }
    else
    {    
      $chkCirugias = "checked";
    }
    $s_obsCirugias = $line['obsCirugias'];
    //-------------------------------------------------------//
    $s_exodoncias        = $line['exodoncias'];
    if ($s_exodoncias =="N" OR $s_exodoncias =="")
    {
      $s_exodoncias = "N";
    }
    else
    {    
      $chkExodoncias = "checked";
    }
    $s_obsExodoncias = $line['obsExodoncias'];
    //-------------------------------------------------------//
    $s_enfOrales         = $line['enfOrales'];
    if ($s_enfOrales =="N" OR $s_enfOrales =="")
    {
      $s_enfOrales = "N";
    }
    else
    {    
      $chkEnfOrales = "checked";
    }
    $s_obsEnfOrales = $line['obsenfOrales'];
    //-------------------------------------------------------//
    $s_usoProtesis       = $line['usoProtesis'];
    if ($s_usoProtesis =="N" OR $s_usoProtesis =="")
    {
      $s_usoProtesis = "N";
    }
    else
    {    
      $chkUsoProtesis = "checked";
    }
    $s_obsUsoProtesis = $line['obsUsoProtesis'];
    //-------------------------------------------------------//
    $s_habitos           = $line['habitos'];

    /////////////////////////////////////////////////////////// 
    //VARIABLES EXAMEN ESTOMATOLOGICO
    ////////////////////////////////////////////////////////////
     $query = "SELECT * FROM SIO_EXA_ESTOMATOLOGICO WHERE numtratamiento = $e_tratamiento";//numConsulta= $nConsulta" ;
     $result = mysql_query($query) or die('Consulta  de Examen estomatologico fallida: ' . mysql_error());
     $line = mysql_fetch_array($result, MYSQL_ASSOC);
  
     $s_labioInferior    = $line['labioInferior'];
     if ($s_labioInferior == "Normal")
     {
       $labioInferiorNormal ="selected";
     }
     if ($s_labioInferior == "Anormal")
     {
       $labioInferiorAnormal ="selected";
     }
     $s_obsLabioInferior = $line['obsLabioInferior'];
     //-------------------------------------------------------//
     $s_labioSuperior    = $line['labioSuperior'];
     if ($s_labioSuperior == "Normal")
     {
       $labioSuperiorNormal ="selected";
     }
     if ($s_labioSuperior == "Anormal")
     {
       $labioSuperiorAnormal ="selected";
     }
     $s_obsLabioSuperior = $line['obsLabioSuperior'];
     //-------------------------------------------------------//
     $s_comisuras= $line['comisuras'];
     if ($s_comisuras == "Normal")
     {
      $comisurasNormal ="selected";
     }
     if ($s_comisuras == "Anormal")
     {
         $comisurasAnormal ="selected";
     }
     $s_obsComisuras= $line['obsComisuras'];
     //-------------------------------------------------------//
     $s_mucosaOral= $line['mucosaOral'];
     if ($s_mucosaOral == "Normal")
     {
      $mucosaOralNormal ="selected";
     }
     if ($s_mucosaOral == "Anormal")
     {
       $mucosaOralAnormal ="selected";
     }
     $s_obsMucosaOral= $line['obsMucosaOral'];
     //-------------------------------------------------------//
     $s_surcosYugales= $line['surcosYugales'];
     if ($s_surcosYugales == "Normal")
     {
      $surcosYugalesNormal ="selected";
     }
     if ($s_surcosYugales == "Anormal")
     {
      $surcosYugalesAnormal ="selected";
     }
     $s_obsSurcosYugales = $line['obsSurcosYugales'];
     //-------------------------------------------------------//
     $s_frenillos = $line['frenillos'];
     if ($s_frenillos == "Normal")
     {
       $frenillosNormal ="selected";
     }
     if ($s_frenillos == "Anormal")
     {
       $frenillosAnormal ="selected";
     }
     $s_obsFrenillos= $line['obsFrenillos'];
     //-------------------------------------------------------//
     $s_oroFaringe= $line['oroFaringe'];
     if ($s_oroFaringe == "Normal")
     {
       $oroFaringeNormal ="selected";
     }
     if ($s_oroFaringe == "Anormal")
     {
       $oroFaringeAnormal ="selected";
     }
     $s_obsOrofaringe= $line['obsOrofaringe'];
     //-------------------------------------------------------//
     $s_paladar= $line['paladar'];
     if ($s_paladar == "Normal")
     {
       $paladarNormal ="selected";
     }
     if ($s_paladar == "Anormal")
     {
       $paladarAnormal ="selected";
     }
     $s_obsPaladar= $line['obsPaladar'];
     //-------------------------------------------------------//
     $s_glandSalivales= $line['glandSalivales'];
     if ($s_glandSalivales == "Normal")
     {
       $glandSalivalesNormal ="selected";
     }
     if ($s_glandSalivales == "Anormal")
     {
       $glandSalivalesAnormal ="selected";
     }
     $s_obsGlandSalivales = $line['obsGlandSalivales'];
     //-------------------------------------------------------//
     $s_pisoBoca    = $line['pisoBoca'];
     if ($s_pisoBoca == "Normal")
     {
       $pisoBocaNormal ="selected";
     }
     if ($s_pisoBoca == "Anormal")
     {
       $pisoBocaAnormal ="selected";
     }
     $s_obsPisoBoca  = $line['obsPisoBoca'];
     //-------------------------------------------------------//
     $s_dorsoLengua= $line['dorsoLengua'];
     if ($s_dorsoLengua == "Normal")
     {
       $dorsoLenguaNormal ="selected";
     }
     if ($s_dorsoLengua == "Anormal")
     {
      $dorsoLenguaAnormal ="selected";
     }
     $s_obsDorsoLengua= $line['obsDorsoLengua'];
     //-------------------------------------------------------//
     $s_vientreLengua= $line['vientreLengua'];
     if ($s_vientreLengua == "Normal")
     {
       $vientreLenguaNormal ="selected";
     }
     if ($s_vientreLengua == "Anormal")
     {
       $vientreLenguaAnormal ="selected";
     }
     $s_obsVientreLengua= $line['obsVientreLengua'];

     /////////////////////////////////////////////////////////// 
    //VARIABLES ARTICULACION TEMPORO MANDIBULAR
    ////////////////////////////////////////////////////////////
    $query = "SELECT * FROM SIO_ART_TEMPORO WHERE numtratamiento = $e_tratamiento";//numConsulta= $nConsulta" ;
    $result = mysql_query($query) or die('Consulta  de Examen estomatologico fallida: ' . mysql_error());
    $line = mysql_fetch_array($result, MYSQL_ASSOC);

    $s_ruidos= $line['ruidos'];
    if ($s_ruidos == "Normal")
    {
      $ruidosNormal ="selected";
    }
    if ($s_ruidos == "Anormal")
    {
      $ruidosAnormal ="selected";
    }
    $s_obsRuidos= $line['obsRuidos'];
    //-------------------------------------------------------//
    $s_desviacion= $line['desviacion'];
    if ($s_desviacion == "Normal")
    {
        $desviacionNormal ="selected";
    }
    if ($s_desviacion == "Anormal")
    {
      $desviacionAnormal ="selected";
    }
    $s_obsDesviacion= $line['obsDesviacion'];
    //-------------------------------------------------------//
    $s_cambioVolumen= $line['cambioVolumen'];
    if ($s_cambioVolumen == "Normal")
    {
      $cambioVolumenNormal ="selected";
    }
    if ($s_cambioVolumen == "Anormal")
    {
      $cambioVolumenAnormal ="selected";
    }
    $s_obsCambioVolumen= $line['obsCambioVolumen'];
    //-------------------------------------------------------//
    $s_bloqueoMand= $line['bloqueoMand'];
    if ($s_bloqueoMand == "Normal")
    {
     $bloqueoMandNormal ="selected";
    }
    if ($s_bloqueoMand == "Anormal")
    {
     $bloqueoMandAnormal ="selected";
    }
    $s_obsBloqueMand= $line['obsBloqueMand'];
    //-------------------------------------------------------//
    $s_limitApertura= $line['limitApertura'];
    if ($s_limitApertura == "Normal")
    {
      $limitAperturaNormal ="selected";
    }
    if ($s_limitApertura == "Anormal")
    {
      $limitAperturaAnormal ="selected";
    }
    $s_obsLimitApertura= $line['obsLimitApertura'];
    //-------------------------------------------------------//
    $s_dolorArticular= $line['dolorArticular'];
    if ($s_dolorArticular == "Normal")
    {
      $dolorArticularNormal ="selected";
    }
    if ($s_dolorArticular == "Anormal")
    {
      $dolorArticularAnormal ="selected";
    }
    $s_obsDolorArticular= $line['obsDolorArticular'];
    //-------------------------------------------------------//
    $s_dolorMuscular= $line['dolorMuscular'];
    if ($s_dolorMuscular == "Normal")
    {
     $dolorMuscularNormal ="selected";
    }
    if ($s_dolorMuscular == "Anormal")
    {
     $dolorMuscularAnormal ="selected";
    }
    $s_obsDolorMuscular= $line['obsDolorMuscular'];

    ///////////////////////////////////////////////////////////  
    //VARIABLES CONSENTIMIENTOS INFORMADOS
    ///////////////////////////////////////////////////////////  
    $query = "SELECT * FROM SIO_CON_INFORMADOS WHERE numtratamiento = $e_tratamiento";//numConsulta= $nConsulta" ;
    $result = mysql_query($query) or die('Consulta  de Consentimiento Informados fallida: ' . mysql_error());
    $line = mysql_fetch_array($result, MYSQL_ASSOC);
 
    $s_conInformado = $line['conInformado'];
    if ($s_conInformado =="N" OR $s_conInformado =="")
    {
      $s_conInformado = "N";
    }
    else
    {    
      $chkConInformado = "checked";
    }
    //-------------------------------------------------------//
    $s_conInfOpera = $line['conInfOpera'];
    if ($s_conInfOpera =="N" OR $s_conInfOpera =="")
    {
      $s_conInfOpera = "N";
    }
    else
    {    
      $chkConInfOpera = "checked";
    }
    //-------------------------------------------------------//
    $s_conInfAneLoc = $line['conInfAneLoc'];
    if ($s_conInfAneLoc =="N" OR $s_conInfAneLoc =="")
    {
      $s_conInfAneLoc = "N";
    }
    else
    {    
      $chkConInfAneLoc = "checked";
    }
    //-------------------------------------------------------//
    $s_conInfEndo = $line['conInfEndo'];
    if ($s_conInfEndo =="N" OR $s_conInfEndo =="")
    {
      $s_conInfEndo = "N";
    }
    else
    {    
      $chkConInfEndo = "checked";
    }
    //-------------------------------------------------------//
    $s_conInfEndSim = $line['conInfEndSim'];
    if ($s_conInfEndSim =="N" OR $s_conInfEndSim =="")
    {
      $s_conInfEndSim = "N";
    }
    else
    {    
      $chkConInfEndSim = "checked";
    }
    //-------------------------------------------------------//
    $s_conInfExoSim = $line['conInfExoSim'];
    if ($s_conInfExoSim =="N" OR $s_conInfExoSim =="")
    {
      $s_conInfExoSim = "N";
    }
    else
    {    
      $chkConInExoSim = "checked";
    }
    //-------------------------------------------------------//
    $s_conInfExoCor = $line['conInfExoCor'];
    if ($s_conInfExoCor =="N" OR $s_conInfExoCor =="")
    {
      $s_conInfExoCor = "N";
    }
    else
    {    
      $chkConInfExoCor = "checked";
    } 
    //-------------------------------------------------------//
    $s_conInfCirApi = $line['conInfCirApi'];
    if ($s_conInfCirApi =="N" OR $s_conInfCirApi =="")
    {
      $s_conInfCirApi = "N";
    }
    else
    {    
      $chkConInfCirApi = "checked";
    }
    //-------------------------------------------------------//
    $s_conInfTerNeu = $line['conInfTerNeu'];
    if ($s_conInfTerNeu =="N" OR $s_conInfTerNeu =="")
    {
      $s_conInfTerNeu = "N";
    }
    else
    {    
      $chkConInfTerNeu = "checked";
    }
    //-------------------------------------------------------//
    $s_conInfRevoc = $line['conInfRevoc'];
    if ($s_conInfRevoc =="N" OR $s_conInfRevoc =="")
    {
      $s_conInfRevoc = "N";
    }
    else
    {    
      $chkConInfRevoc = "checked";
    }
    //-------------------------------------------------------//
    $s_conInfNegacion = $line['conInfNegacion'];
    if ($s_conInfNegacion =="N" OR $s_conInfNegacion =="")
    {
      $s_conInfNegacion = "N";
    }
    else
    {    
      $chkConInfNegacion = "checked";
    }
     
    ///////////////////////////////////////////////////////////  
    //VARIABLES PROTESIS   
    ///////////////////////////////////////////////////////////  
    $query = "SELECT * FROM SIO_PRE_PROTESIS WHERE numtratamiento = $e_tratamiento";//numConsulta= $nConsulta" ;
    $result = mysql_query($query) or die('Consulta  de Protesis fallida: ' . mysql_error());
    $line = mysql_fetch_array($result, MYSQL_ASSOC);

    $s_protesis = $line['protesis'];
    if ($s_protesis =="N" OR $s_protesis =="")
    {
      $s_protesis = "N";
    }
    else
    {    
     $chkProtesis = "checked";
    }
    $s_obsProtesis = $line['obsProtesis'];

    /////////////////////////////////////////////////////////// 
    //VARIABLES HIGIENE ORAL
    ////////////////////////////////////////////////////////////
    $query = "SELECT * FROM SIO_HIG_ORAL WHERE numtratamiento = $e_tratamiento";//numConsulta= $nConsulta" ;
    $result = mysql_query($query) or die('Consulta  de HIGIENE ORAL fallida: ' . mysql_error());
    $line = mysql_fetch_array($result, MYSQL_ASSOC);

    $s_higiene= $line['higiene'];
    if ($s_higiene == "Buena")
    {
     $hBuena="selected";
    }
    if ($s_higiene == "Regular")
    {
     $hRegular="selected";
    }
    if ($s_higiene == "Mala")
    {
     $hMala="selected";
    }
    //-------------------------------------------------------//
    $s_freCepillado= $line['freCepillado'];
    if ($s_freCepillado == "Tres Veces")
    {
      $fCtres="selected";
    }
    if ($s_freCepillado == "Dos Veces")
    {
      $fCdos="selected";
    }
    if ($s_freCepillado == "Una Vez")
    {
      $fCuno="selected";
    }
    //-------------------------------------------------------//
    $s_sedaDental= $line['sedaDental'];
    if ($s_sedaDental =="N" OR $s_sedaDental =="")
    {
     $s_sedaDental = "N";
    }
    else
    {    
       $chkSedaDental = "checked";
    }
    //-------------------------------------------------------//
    $s_pigmentacion= $line['pigmentacion'];
    if ($s_pigmentacion =="")
    {
      $s_pigmentacion = "N";
    }
    else
    {    
      $chkPigmentacion = "checked";
    }
    //-------------------------------------------------------//
    $s_gradoRiesgo= $line['gradoRiesgo'];
    if ($s_gradoRiesgo == "Bajo")
    {
      $grBajo="selected";
    }
    if ($s_gradoRiesgo == "Medio")
    {
      $grMedio="selected";
    }
    if ($s_gradoRiesgo == "Alto")
    {
     $grAlto="selected";
    }
    //-------------------------------------------------------//
    $s_obsHigiene= $line['obsHigiene'];
   
    ///////////////////////////////////////////////////////////  
    //VARIABLES EXAMEN PULPAR 
    /////////////////////////////////////////////////////////// 
    $query = "SELECT * FROM SIO_EXA_PULPAR WHERE numtratamiento = $e_tratamiento";//numConsulta= $nConsulta" ;
    $result = mysql_query($query) or die('Consulta  de Examen estomatologico fallida: ' . mysql_error());
    $line = mysql_fetch_array($result, MYSQL_ASSOC);
    
    $s_cuelloSencible= $line['cuelloSencible'];
    if ($s_cuelloSencible =="N" OR $s_cuelloSencible =="")
    {
      $s_cuelloSencible = "N";
    }
    else
    {    
     $chkCuelloSencible = "checked";
    }
    $s_obsCuelloSencible= $line['obsCuelloSencible'];
    //-------------------------------------------------------//
    $s_abscesos= $line['abscesos'];
    if ($s_abscesos =="N" OR $s_abscesos =="")
    {
     $s_abscesos = "N";
    }
    else
    {    
     $chkAbscesos= "checked";
    }
    $s_obsAbscesos= $line['obsAbscesos'];
    //-------------------------------------------------------//
    $s_exposicionPulpar= $line['exposicionPulpar'];
    if ($s_exposicionPulpar =="N" OR $s_exposicionPulpar =="")
    {
      $s_exposicionPulpar = "N";
    }
    else
    {    
      $chkExposicionPulpar= "checked";
    }
    $s_obsExposicionPulpar= $line['obsExposicionPulpar'];
    //-------------------------------------------------------//
    $s_cambioColor= $line['cambioColor'];
    if ($s_cambioColor =="N" OR $s_cambioColor =="")
    {
      $s_cambioColor = "N";
    }
    else
    {    
      $chkCambioColor= "checked";
    }
    $s_obsCambioColor= $line['obsCambioColor'];    

    ///////////////////////////////////////////////////////////  
    //VARIABLES TEJIDOS DENTARIOS Y OCLUSION
    ///////////////////////////////////////////////////////////  
    $query = "SELECT * FROM SIO_TEJ_DENTARIOS WHERE numtratamiento = $e_tratamiento";//numConsulta= $nConsulta" ;
    $result = mysql_query($query) or die('Consulta  de Tabla: SIO_TEJ_DENTARIOS fallida: ' . mysql_error());
    $line = mysql_fetch_array($result, MYSQL_ASSOC);

    $s_supernumerarios= $line['supernumerarios'];
    if ($s_supernumerarios =="N" OR $s_supernumerarios =="")
    {
     $s_supernumerarios = "N";
    }
    else
    {    
      $chkSupernumerarios= "checked";
    }
    $s_obsSupernumerarios= $line['obsSupernumerarios'];
    //-------------------------------------------------------//
    $s_decoloracion= $line['decoloracion'];
    if ($s_decoloracion =="N" OR $s_decoloracion =="")
    {
     $s_decoloracion = "N";
    }
    else
    {    
     $chkDecoloracion= "checked";
    }
    $s_obsDecoloracion= $line['obsDecoloracion'];
    //-------------------------------------------------------//
    $s_descalsificacion= $line['descalsificacion'];
    if ($s_descalsificacion =="N" OR $s_descalsificacion =="")
    {
     $s_descalsificacion = "N";
    }
    else
    {    
      $chkDescalsificacion= "checked";
    }
    $s_obsDescalsificacion= $line['obsDescalsificacion'];
    //-------------------------------------------------------//
    $s_facetaDesgaste= $line['facetaDesgaste'];
    if ($s_facetaDesgaste =="N" OR $s_facetaDesgaste =="")
    {
      $s_facetaDesgaste = "N";
    }
    else
    {    
     $chkFacetaDesgaste= "checked";
    }
    $s_obsFacetaDesgaste= $line['obsFacetaDesgaste'];
    //-------------------------------------------------------//
    $s_abrasion= $line['abrasion'];
    if ($s_abrasion =="N" OR $s_abrasion =="")
    {
     $s_abrasion = "N";
    }
    else
    {    
     $chkAbrasion= "checked";
    }
    $s_obsAbrasion= $line['obsAbrasion'];
    //-------------------------------------------------------//
    $s_fluorosis= $line['fluorosis'];
    if ($s_fluorosis =="N" OR $s_fluorosis =="")
    {
      $s_fluorosis = "N";
    }
    else
    {    
     $chkFluorosis= "checked";
    }
    $s_obsFluorosis= $line['obsFluorosis'];     

    ///////////////////////////////////////////////////////////  
    //VARIABLES ALTERACIONES PERIODENTALES  
    /////////////////////////////////////////////////////////// 
    $query = "SELECT * FROM SIO_ALT_PERIODONTALES WHERE numtratamiento = $e_tratamiento";//numConsulta= $nConsulta" ;
    $result = mysql_query($query) or die('Consulta  de Antecedentes fallida: ' . mysql_error());
    $line = mysql_fetch_array($result, MYSQL_ASSOC);

    $s_sangrado= $line['sangrado'];
    if ($s_sangrado =="N" OR $s_sangrado =="")
    {
      $s_sangrado = "N";
    }
    else
    {    
      $chkSangrado = "checked";
    }
    $s_obsSangrado= $line['obsSangrado'];
    //---------------------------------------//
    $s_exudado = $line['exudado'];
    if ($s_exudado=="N" OR $s_exudado=="")
    {
      $s_exudado = "N";
    }
    else
    {    
     $chkExudado = "checked";
    }
    $s_obsExudado = $line['obsExudado'];
    //---------------------------------------//
    $s_supuracion = $line['supuracion'];
    if ($s_supuracion =="N" OR $s_supuracion =="")
    {
      $s_supuracion = "N";
    }
    else
    {    
     $chkSupuracion = "checked";
    }
    $s_obsSupuracion = $line['obsSupuracion'];
    //---------------------------------------// 
    $s_calculos= $line['calculos'];
    if ($s_calculos =="N" OR $s_calculos =="")
    {
       $s_calculos = "N";
    }
    else
    {    
       $chkCalculos = "checked";
    }
    $s_obsCalculos= $line['obsCalculos'];
    //-------------------------------------------------------//
    $s_inflamacion= $line['inflamacion'];
    if ($s_inflamacion =="N" OR $s_inflamacion =="")
    {
       $s_inflamacion = "N";
    }
    else
    {    
       $chkInflamacion = "checked";
    }
    $s_obsInflamacion= $line['obsInflamacion'];
    //-------------------------------------------------------//
    $s_retracciones= $line['retracciones'];
    if ($s_retracciones =="N" OR $s_retracciones =="")
    {
     $s_retracciones = "N";
    }
    else
    {    
     $chkRetracciones = "checked";
    }
    $s_obsRetracciones= $line['obsRetracciones'];
    //-------------------------------------------------------//
    $s_presenciaBolsas= $line['presenciaBolsas'];
    if ($s_presenciaBolsas =="N" OR $s_presenciaBolsas =="")
    {
      $s_presenciaBolsas = "N";
    }
    else
    {    
      $chkPresenciaBolsas = "checked";
    }
    $s_obsPresenciaBolsas= $line['obsPresenciaBolsas'];
    //-------------------------------------------------------//
    $s_tipOclusion= $line['tipOclusion'];
    if ($s_tipOclusion =="N" OR $s_tipOclusion =="")
    {
      $s_tipOclusion = "N";
    }
    else
    {    
      $chkTipOclusion = "checked";
    }
    $s_obsTipOclusion= $line['obsTipOclusion'];

    ///////////////////////////////////////////////////////////  
    //OBSERVACION ODONTOGRAMA
    /////////////////////////////////////////////////////////// 
    $query = "SELECT * FROM SIO_OBS_ODONTOGRAMA WHERE numtratamiento = $e_tratamiento";//numConsulta= $nConsulta" ;
    $result = mysql_query($query) or die('Consulta  de Observaciones de Odontograma fallida: ' . mysql_error());
    $line = mysql_fetch_array($result, MYSQL_ASSOC);
    $s_obsOdontograma =  $line['obsOdontograma'];

    //-------------------------------------------------------// 
    ///////////////////////////////////////////////////////////  
    //VARIABLES REGISTRO DE PLACA
    ///////////////////////////////////////////////////////////   
   
   
    //////////////////////////////////////////////////////////////////////////////////////
    /////////////////// INICIO REGISTRO DE PLACA    //////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////
    $query = "SELECT * FROM SIO_REG_PLACA WHERE numtratamiento = $e_tratamiento";//numConsulta= $nConsulta" ;
    $result = mysql_query($query) or die('Consulta  de Registro de Placa fallida: ' . mysql_error());
    $line = mysql_fetch_array($result, MYSQL_ASSOC);
    
    $s_P551 =  $line['P551'];
    if ($s_P551 ==0)
    {
      $s_P551 = 0;
    }
    else
    {
      $chkP551  = "checked";
    }

    $s_P554 =  $line['P554'];
    if ($s_P554 ==0)
    {
      $s_P554 = 0;
    }
    else
    {
      $chkP554  = "checked";
    }  
    
    $s_P552 =  $line['P552'];
    if ($s_P552 ==0)
    {
      $s_P552 = 0;
    }
    else
    {
      $chkP552  = "checked";
    }      
    
    $s_P555 =  $line['P555'];
    if ($s_P555 ==0)
    {
      $s_P555 = 0;
    }
    else
    {
      $chkP555  = "checked";
    }    
    $s_P541 =  $line['P541'];
    if ($s_P541 ==0)
    {
      $s_P541 = 0;
    }
    else
    {
      $chkP541  = "checked";
    }

    $s_P544 =  $line['P544'];
    if ($s_P544 ==0)
    {
      $s_P544 = 0;
    }
    else
    {
      $chkP544  = "checked";
    }  
    
    $s_P542 =  $line['P542'];
    if ($s_P542 ==0)
    {
      $s_P542 = 0;
    }
    else
    {
      $chkP542  = "checked";
    }      
    
    $s_P545 =  $line['P545'];
    if ($s_P545 ==0)
    {
      $s_P545 = 0;
    }
    else
    {
      $chkP545  = "checked";
    }
    $s_P531 =  $line['P531'];
    if ($s_P531 ==0)
    {
      $s_P531 = 0;
    }
    else
    {
      $chkP531  = "checked";
    }

    $s_P534 =  $line['P534'];
    if ($s_P534 ==0)
    {
      $s_P534 = 0;
    }
    else
    {
      $chkP534  = "checked";
    }  
    
    $s_P532 =  $line['P532'];
    if ($s_P532 ==0)
    {
      $s_P532 = 0;
    }
    else
    {
      $chkP532  = "checked";
    }      
    
    $s_P535 =  $line['P535'];
    if ($s_P535 ==0)
    {
      $s_P535 = 0;
    }
    else
    {
      $chkP535  = "checked";
    }
    $s_P521 =  $line['P521'];
    if ($s_P521 ==0)
    {
      $s_P521 = 0;
    }
    else
    {
      $chkP521  = "checked";
    }

    $s_P524 =  $line['P524'];
    if ($s_P524 ==0)
    {
      $s_P524 = 0;
    }
    else
    {
      $chkP524  = "checked";
    }  
    
    $s_P522 =  $line['P522'];
    if ($s_P522 ==0)
    {
      $s_P522 = 0;
    }
    else
    {
      $chkP522  = "checked";
    }      
    
    $s_P525 =  $line['P525'];
    if ($s_P525 ==0)
    {
      $s_P525 = 0;
    }
    else
    {
      $chkP525  = "checked";
    }   
    $s_P511 =  $line['P511'];
    if ($s_P511 ==0)
    {
      $s_P511 = 0;
    }
    else
    {
      $chkP511  = "checked";
    }

    $s_P514 =  $line['P514'];
    if ($s_P514 ==0)
    {
      $s_P514 = 0;
    }
    else
    {
      $chkP514  = "checked";
    }  
    
    $s_P512 =  $line['P512'];
    if ($s_P512 ==0)
    {
      $s_P512 = 0;
    }
    else
    {
      $chkP512  = "checked";
    }      
    
    $s_P515 =  $line['P515'];
    if ($s_P515 ==0)
    {
      $s_P515 = 0;
    }
    else
    {
      $chkP515  = "checked";
    }  
    $s_P611 =  $line['P611'];
    if ($s_P611 ==0)
    {
      $s_P611 = 0;
    }
    else
    {
      $chkP611  = "checked";
    }

    $s_P614 =  $line['P614'];
    if ($s_P614 ==0)
    {
      $s_P614 = 0;
    }
    else
    {
      $chkP614  = "checked";
    }  
    
    $s_P612 =  $line['P612'];
    if ($s_P612 ==0)
    {
      $s_P612 = 0;
    }
    else
    {
      $chkP612  = "checked";
    }      
    
    $s_P615 =  $line['P615'];
    if ($s_P615 ==0)
    {
      $s_P615 = 0;
    }
    else
    {
      $chkP615  = "checked";
    }  
    $s_P621 =  $line['P621'];
    if ($s_P621 ==0)
    {
      $s_P621 = 0;
    }
    else
    {
      $chkP621  = "checked";
    }

    $s_P624 =  $line['P624'];
    if ($s_P624 ==0)
    {
      $s_P624 = 0;
    }
    else
    {
      $chkP624  = "checked";
    }  
    
    $s_P622 =  $line['P622'];
    if ($s_P622 ==0)
    {
      $s_P622 = 0;
    }
    else
    {
      $chkP622  = "checked";
    }      
    
    $s_P625 =  $line['P625'];
    if ($s_P625 ==0)
    {
      $s_P625 = 0;
    }
    else
    {
      $chkP625  = "checked";
    }  
    $s_P631 =  $line['P631'];
    if ($s_P631 ==0)
    {
      $s_P631 = 0;
    }
    else
    {
      $chkP631  = "checked";
    }

    $s_P634 =  $line['P634'];
    if ($s_P634 ==0)
    {
      $s_P634 = 0;
    }
    else
    {
      $chkP634  = "checked";
    }  
    
    $s_P632 =  $line['P632'];
    if ($s_P632 ==0)
    {
      $s_P632 = 0;
    }
    else
    {
      $chkP632  = "checked";
    }      
    
    $s_P635 =  $line['P635'];
    if ($s_P635 ==0)
    {
      $s_P635 = 0;
    }
    else
    {
      $chkP635  = "checked";
    }    
        $s_P641 =  $line['P641'];
    if ($s_P641 ==0)
    {
      $s_P641 = 0;
    }
    else
    {
      $chkP641  = "checked";
    }

    $s_P644 =  $line['P644'];
    if ($s_P644 ==0)
    {
      $s_P644 = 0;
    }
    else
    {
      $chkP644  = "checked";
    }  
    
    $s_P642 =  $line['P642'];
    if ($s_P642 ==0)
    {
      $s_P642 = 0;
    }
    else
    {
      $chkP642  = "checked";
    }      
    
    $s_P645 =  $line['P645'];
    if ($s_P645 ==0)
    {
      $s_P645 = 0;
    }
    else
    {
      $chkP645  = "checked";
    }  
    $s_P651 =  $line['P651'];
    if ($s_P651 ==0)
    {
      $s_P651 = 0;
    }
    else
    {
      $chkP651  = "checked";
    }

    $s_P654 =  $line['P654'];
    if ($s_P654 ==0)
    {
      $s_P654 = 0;
    }
    else
    {
      $chkP654  = "checked";
    }  
    
    $s_P652 =  $line['P652'];
    if ($s_P652 ==0)
    {
      $s_P652 = 0;
    }
    else
    {
      $chkP652  = "checked";
    }      
    
    $s_P655 =  $line['P655'];
    if ($s_P655 ==0)
    {
      $s_P655 = 0;
    }
    else
    {
      $chkP655  = "checked";
    }  
    $s_P857 =  $line['P857'];
    if ($s_P857 ==0)
    {
      $s_P857 = 0;
    }
    else
    {
      $chkP857  = "checked";
    }

    $s_P854 =  $line['P854'];
    if ($s_P854 ==0)
    {
      $s_P854 = 0;
    }
    else
    {
      $chkP854  = "checked";
    }  
    
    $s_P852 =  $line['P852'];
    if ($s_P852 ==0)
    {
      $s_P852 = 0;
    }
    else
    {
      $chkP852  = "checked";
    }      
    
    $s_P851 =  $line['P851'];
    if ($s_P851 ==0)
    {
      $s_P851 = 0;
    }
    else
    {
      $chkP851  = "checked";
    }  
    $s_P847 =  $line['P847'];
    if ($s_P847 ==0)
    {
      $s_P847 = 0;
    }
    else
    {
      $chkP847  = "checked";
    }

    $s_P844 =  $line['P844'];
    if ($s_P844 ==0)
    {
      $s_P844 = 0;
    }
    else
    {
      $chkP844  = "checked";
    }  
    
    $s_P842 =  $line['P842'];
    if ($s_P842 ==0)
    {
      $s_P842 = 0;
    }
    else
    {
      $chkP842  = "checked";
    }      
    
    $s_P841 =  $line['P841'];
    if ($s_P841 ==0)
    {
      $s_P841 = 0;
    }
    else
    {
      $chkP841  = "checked";
    }    
    $s_P837 =  $line['P837'];
    if ($s_P837 ==0)
    {
      $s_P837 = 0;
    }
    else
    {
      $chkP837  = "checked";
    }

    $s_P834 =  $line['P834'];
    if ($s_P834 ==0)
    {
      $s_P834 = 0;
    }
    else
    {
      $chkP834  = "checked";
    }  
    
    $s_P832 =  $line['P832'];
    if ($s_P832 ==0)
    {
      $s_P832 = 0;
    }
    else
    {
      $chkP832  = "checked";
    }      
    
    $s_P831 =  $line['P831'];
    if ($s_P831 ==0)
    {
      $s_P831 = 0;
    }
    else
    {
      $chkP831  = "checked";
    }  
    $s_P827 =  $line['P827'];
    if ($s_P827 ==0)
    {
      $s_P827 = 0;
    }
    else
    {
      $chkP827  = "checked";
    }

    $s_P824 =  $line['P824'];
    if ($s_P824 ==0)
    {
      $s_P824 = 0;
    }
    else
    {
      $chkP824  = "checked";
    }  
    
    $s_P822 =  $line['P822'];
    if ($s_P822 ==0)
    {
      $s_P822 = 0;
    }
    else
    {
      $chkP822  = "checked";
    }      
    
    $s_P821 =  $line['P821'];
    if ($s_P821 ==0)
    {
      $s_P821 = 0;
    }
    else
    {
      $chkP821  = "checked";
    }  
    $s_P817 =  $line['P817'];
    if ($s_P817 ==0)
    {
      $s_P817 = 0;
    }
    else
    {
      $chkP817  = "checked";
    }

    $s_P814 =  $line['P814'];
    if ($s_P814 ==0)
    {
      $s_P814 = 0;
    }
    else
    {
      $chkP814  = "checked";
    }  
    
    $s_P812 =  $line['P812'];
    if ($s_P812 ==0)
    {
      $s_P812 = 0;
    }
    else
    {
      $chkP812  = "checked";
    }      
    
    $s_P811 =  $line['P811'];
    if ($s_P811 ==0)
    {
      $s_P811 = 0;
    }
    else
    {
      $chkP811  = "checked";
    }  
    $s_P717 =  $line['P717'];
    if ($s_P717 ==0)
    {
      $s_P717 = 0;
    }
    else
    {
      $chkP717  = "checked";
    }

    $s_P714 =  $line['P714'];
    if ($s_P714 ==0)
    {
      $s_P714 = 0;
    }
    else
    {
      $chkP714  = "checked";
    }  
    
    $s_P712 =  $line['P712'];
    if ($s_P712 ==0)
    {
      $s_P712 = 0;
    }
    else
    {
      $chkP712  = "checked";
    }      
    
    $s_P711 =  $line['P711'];
    if ($s_P711 ==0)
    {
      $s_P711 = 0;
    }
    else
    {
      $chkP711  = "checked";
    }  
    $s_P727 =  $line['P727'];
    if ($s_P727 ==0)
    {
      $s_P727 = 0;
    }
    else
    {
      $chkP727  = "checked";
    }

    $s_P724 =  $line['P724'];
    if ($s_P724 ==0)
    {
      $s_P724 = 0;
    }
    else
    {
      $chkP724  = "checked";
    }  
    
    $s_P722 =  $line['P722'];
    if ($s_P722 ==0)
    {
      $s_P722 = 0;
    }
    else
    {
      $chkP722  = "checked";
    }      
    
    $s_P721 =  $line['P721'];
    if ($s_P721 ==0)
    {
      $s_P721 = 0;
    }
    else
    {
      $chkP721  = "checked";
    }   
    $s_P737 =  $line['P737'];
    if ($s_P737 ==0)
    {
      $s_P737 = 0;
    }
    else
    {
      $chkP737  = "checked";
    }

    $s_P734 =  $line['P734'];
    if ($s_P734 ==0)
    {
      $s_P734 = 0;
    }
    else
    {
      $chkP734  = "checked";
    }  
    
    $s_P732 =  $line['P732'];
    if ($s_P732 ==0)
    {
      $s_P732 = 0;
    }
    else
    {
      $chkP732  = "checked";
    }      
    
    $s_P731 =  $line['P731'];
    if ($s_P731 ==0)
    {
      $s_P731 = 0;
    }
    else
    {
      $chkP731  = "checked";
    } 
    $s_P747 =  $line['P747'];
    if ($s_P747 ==0)
    {
      $s_P747 = 0;
    }
    else
    {
      $chkP747  = "checked";
    }

    $s_P744 =  $line['P744'];
    if ($s_P744 ==0)
    {
      $s_P744 = 0;
    }
    else
    {
      $chkP744  = "checked";
    }  
    
    $s_P742 =  $line['P742'];
    if ($s_P742 ==0)
    {
      $s_P742 = 0;
    }
    else
    {
      $chkP742  = "checked";
    }      
    
    $s_P741 =  $line['P741'];
    if ($s_P741 ==0)
    {
      $s_P741 = 0;
    }
    else
    {
      $chkP741  = "checked";
    } 
    $s_P757 =  $line['P757'];
    if ($s_P757 ==0)
    {
      $s_P757 = 0;
    }
    else
    {
      $chkP757  = "checked";
    }

    $s_P754 =  $line['P754'];
    if ($s_P754 ==0)
    {
      $s_P754 = 0;
    }
    else
    {
      $chkP754  = "checked";
    }  
    
    $s_P752 =  $line['P752'];
    if ($s_P752 ==0)
    {
      $s_P752 = 0;
    }
    else
    {
      $chkP752  = "checked";
    }      
    
    $s_P751 =  $line['P751'];
    if ($s_P751 ==0)
    {
      $s_P751 = 0;
    }
    else
    {
      $chkP751  = "checked";
    }    
    ///////////REGISTRO DE PLACA NUEVOS 
        $s_P161 =  $line['P161'];
    if ($s_P161 ==0)
    {
      $s_P161 = 0;
    }
    else
    {
      $chkP161  = "checked";
    }    
    $s_P164 =  $line['P164'];
    if ($s_P164 ==0)
    {
      $s_P164 = 0;
    }
    else
    {
      $chkP164  = "checked";
    }
    $s_P166 =  $line['P166'];
    if ($s_P166 ==0)
    {
      $s_P166 = 0;
    }
    else
    {
      $chkP166  = "checked";
    }
    $s_P162 =  $line['P162'];
    if ($s_P162 ==0)
    {
      $s_P162 = 0;
    }
    else
    {
      $chkP162  = "checked";
    }
    $s_P165 =  $line['P165'];
    if ($s_P165 ==0)
    {
      $s_P165 = 0;
    }
    else
    {
      $chkP165  = "checked";
    }

    $s_P171 =  $line['P171'];
    if ($s_P171 ==0)
    {
      $s_P171 = 0;
    }
    else
    {
      $chkP171  = "checked";
    }    
    $s_P174 =  $line['P174'];
    if ($s_P174 ==0)
    {
      $s_P174 = 0;
    }
    else
    {
      $chkP174  = "checked";
    }
    $s_P176 =  $line['P176'];
    if ($s_P176 ==0)
    {
      $s_P176 = 0;
    }
    else
    {
      $chkP176  = "checked";
    }
    $s_P172 =  $line['P172'];
    if ($s_P172 ==0)
    {
      $s_P172 = 0;
    }
    else
    {
      $chkP172  = "checked";
    }
    $s_P175 =  $line['P175'];
    if ($s_P175 ==0)
    {
      $s_P175 = 0;
    }
    else
    {
      $chkP175  = "checked";
    }
    $s_P181 =  $line['P181'];
    if ($s_P181 ==0)
    {
      $s_P181 = 0;
    }
    else
    {
      $chkP181  = "checked";
    }    
    $s_P184 =  $line['P184'];
    if ($s_P184 ==0)
    {
      $s_P184 = 0;
    }
    else
    {
      $chkP184  = "checked";
    }
    $s_P186 =  $line['P186'];
    if ($s_P186 ==0)
    {
      $s_P186 = 0;
    }
    else
    {
      $chkP186  = "checked";
    }
    $s_P182 =  $line['P182'];
    if ($s_P182 ==0)
    {
      $s_P182 = 0;
    }
    else
    {
      $chkP182  = "checked";
    }
    $s_P185 =  $line['P185'];
    if ($s_P185 ==0)
    {
      $s_P185 = 0;
    }
    else
    {
      $chkP185  = "checked";
    }

$s_P261 =  $line['P261'];
    if ($s_P261 ==0)
    {
      $s_P261 = 0;
    }
    else
    {
      $chkP261  = "checked";
    }
    $s_P262 =  $line['P262'];
    if ($s_P262 ==0)
    {
      $s_P262 = 0;
    }
    else
    {
      $chkP262  = "checked";
    }
    $s_P266 =  $line['P266'];
    if ($s_P266 ==0)
    {
      $s_P266 = 0;
    }
    else
    {
      $chkP266  = "checked";
    }
    $s_P264 =  $line['P264'];
    if ($s_P264 ==0)
    {
      $s_P264 = 0;
    }
    else
    {
      $chkP264  = "checked";
    }
    $s_P265 =  $line['P265'];
    if ($s_P265 ==0)
    {
      $s_P265 = 0;
    }
    else
    {
      $chkP265  = "checked";
    }

    $s_P271 =  $line['P271'];
    if ($s_P271 ==0)
    {
      $s_P271 = 0;
    }
    else
    {
      $chkP271  = "checked";
    }
    $s_P272 =  $line['P272'];
    if ($s_P272 ==0)
    {
      $s_P272 = 0;
    }
    else
    {
      $chkP272  = "checked";
    }
    $s_P276 =  $line['P276'];
    if ($s_P276 ==0)
    {
      $s_P276 = 0;
    }
    else
    {
      $chkP276  = "checked";
    }
    $s_P274 =  $line['P274'];
    if ($s_P274 ==0)
    {
      $s_P274 = 0;
    }
    else
    {
      $chkP274  = "checked";
    }
    $s_P275 =  $line['P275'];
    if ($s_P275 ==0)
    {
      $s_P275 = 0;
    }
    else
    {
      $chkP275  = "checked";
    }

    $s_P281 =  $line['P281'];
    if ($s_P281 ==0)
    {
      $s_P281 = 0;
    }
    else
    {
      $chkP281  = "checked";
    }
    $s_P282 =  $line['P282'];
    if ($s_P282 ==0)
    {
      $s_P282 = 0;
    }
    else
    {
      $chkP282  = "checked";
    }
    $s_P286 =  $line['P286'];
    if ($s_P286 ==0)
    {
      $s_P286 = 0;
    }
    else
    {
      $chkP286  = "checked";
    }
    $s_P284 =  $line['P284'];
    if ($s_P284 ==0)
    {
      $s_P284 = 0;
    }
    else
    {
      $chkP284  = "checked";
    }
    $s_P285 =  $line['P285'];
    if ($s_P285 ==0)
    {
      $s_P285 = 0;
    }
    else
    {
      $chkP285  = "checked";
    }

    $s_P467 =  $line['P467'];
    if ($s_P467 ==0)
    {
      $s_P467 = 0;
    }
    else
    {
      $chkP467  = "checked";
    }
    $s_P464 =  $line['P464'];
    if ($s_P464 ==0)
    {
      $s_P464 = 0;
    }
    else
    {
      $chkP464  = "checked";
    }
    $s_P466 =  $line['P466'];
    if ($s_P466 ==0)
    {
      $s_P466 = 0;
    }
    else
    {
      $chkP466  = "checked";
    }
    $s_P462 =  $line['P462'];
    if ($s_P462 ==0)
    {
      $s_P462 = 0;
    }
    else
    {
      $chkP462  = "checked";
    }
    $s_P461 =  $line['P461'];
    if ($s_P461 ==0)
    {
      $s_P461 = 0;
    }
    else
    {
      $chkP461  = "checked";
    }
   
    $s_P477 =  $line['P477'];
    if ($s_P477 ==0)
    {
      $s_P477 = 0;
    }
    else
    {
      $chkP477  = "checked";
    }
    $s_P474 =  $line['P474'];
    if ($s_P474 ==0)
    {
      $s_P474 = 0;
    }
    else
    {
      $chkP474  = "checked";
    }
    $s_P476 =  $line['P476'];
    if ($s_P476 ==0)
    {
      $s_P476 = 0;
    }
    else
    {
      $chkP476  = "checked";
    }
    $s_P472 =  $line['P472'];
    if ($s_P472 ==0)
    {
      $s_P472 = 0;
    }
    else
    {
      $chkP472  = "checked";
    }
    $s_P471 =  $line['P471'];
    if ($s_P471 ==0)
    {
      $s_P471 = 0;
    }
    else
    {
      $chkP471  = "checked";
    }

///////

    $s_P487 =  $line['P487'];
    if ($s_P487 ==0)
    {
      $s_P487 = 0;
    }
    else
    {
      $chkP487  = "checked";
    }

    $s_P484 =  $line['P484'];
    if ($s_P484 ==0)
    {
      $s_P484 = 0;
    }
    else
    {
      $chkP484  = "checked";
    }

    $s_P486 =  $line['P486'];
    if ($s_P486 ==0)
    {
      $s_P486 = 0;
    }
    else
    {
      $chkP486  = "checked";
    }

    $s_P482 =  $line['P482'];
    if ($s_P482 ==0)
    {
      $s_P482 = 0;
    }
    else
    {
      $chkP482  = "checked";
    }

    $s_P481 =  $line['P481'];
    if ($s_P481 ==0)
    {
      $s_P481 = 0;
    }
    else
    {
      $chkP481  = "checked";
    }
////////
    $s_P367 =  $line['P367'];
    if ($s_P367 ==0)
    {
      $s_P367 = 0;
    }
    else
    {
      $chkP367  = "checked";
    }
    $s_P362 =  $line['P362'];
    if ($s_P362 ==0)
    {
      $s_P362 = 0;
    }
    else
    {
      $chkP362  = "checked";
    }
    $s_P366 =  $line['P366'];
    if ($s_P366 ==0)
    {
      $s_P366 = 0;
    }
    else
    {
      $chkP366  = "checked";
    }
    $s_P364 =  $line['P364'];
    if ($s_P364 ==0)
    {
      $s_P364 = 0;
    }
    else
    {
      $chkP364  = "checked";
    }
    $s_P361 =  $line['P361'];
    if ($s_P361 ==0)
    {
      $s_P361 = 0;
    }
    else
    {
      $chkP361  = "checked";
    }

    $s_P377 =  $line['P377'];
    if ($s_P377 ==0)
    {
      $s_P377 = 0;
    }
    else
    {
      $chkP377  = "checked";
    }
    $s_P372 =  $line['P372'];
    if ($s_P372 ==0)
    {
      $s_P372 = 0;
    }
    else
    {
      $chkP372  = "checked";
    }
    $s_P376 =  $line['P376'];
    if ($s_P376 ==0)
    {
      $s_P376 = 0;
    }
    else
    {
      $chkP376  = "checked";
    }
    $s_P374 =  $line['P374'];
    if ($s_P374 ==0)
    {
      $s_P374 = 0;
    }
    else
    {
      $chkP374  = "checked";
    }
    $s_P371 =  $line['P371'];
    if ($s_P371 ==0)
    {
      $s_P371 = 0;
    }
    else
    {
      $chkP371  = "checked";
    }

    $s_P387 =  $line['P387'];
    if ($s_P387 ==0)
    {
      $s_P387 = 0;
    }
    else
    {
      $chkP387  = "checked";
    }
    $s_P382 =  $line['P382'];
    if ($s_P382 ==0)
    {
      $s_P382 = 0;
    }
    else
    {
      $chkP382  = "checked";
    }
    $s_P386 =  $line['P386'];
    if ($s_P386 ==0)
    {
      $s_P386 = 0;
    }
    else
    {
      $chkP386  = "checked";
    }
    $s_P384 =  $line['P384'];
    if ($s_P384 ==0)
    {
      $s_P384 = 0;
    }
    else
    {
      $chkP384  = "checked";
    }
    $s_P381 =  $line['P381'];
    if ($s_P381 ==0)
    {
      $s_P381 = 0;
    }
    else
    {
      $chkP381  = "checked";
    }    
    ///////////////indices de placa
    $s_numSupPlaca=$line['numSupPlaca'];
    $s_indicePlaca=$line['indicePlaca'];

    IF ($s_numSupPlaca==""){$s_numSupPlaca=0;}
 
  
    $s_regPlaNoApl = $line['noAplica'];
    if ($s_regPlaNoApl =="N" OR $s_regPlaNoApl =="")
    {
      $s_regPlaNoApl = "N";
    }
    else
    {    
      $chkRegPlaNoApl = "checked";
    }
    $s_obsRegPlaNoApl =  $line['obsNoAplica'];

  }//>0  


 /*===================================================================================
   =============================LISTAS DE DIAGNOSTICOS ===============================
   =================================================================================== */
    
  //consulta lista de odontograma de diagnosticos
  $query="SELECT * from SIO_LIS_ODONTOGRAMA WHERE tipOdo='DG' order by descripcion";
  $result = mysql_query($query) or die('Consulta de lista odontograma de diagnostico fallida: ' . mysql_error());
  //$line = mysql_fetch_array($result, MYSQL_ASSOC);  
    
  $comboLisOd="";
  while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) 
  {
   $comboLisOd .=" <option value='".$line['codigo']."'>".$line['descripcion']."</option>"; 
  }
  // Liberar resultados
  mysql_free_result($result);

  //consulta lista de odontograma de tratamiento
  $query="SELECT * from SIO_LIS_ODONTOGRAMA WHERE tipOdo='TR' order by descripcion";
  $result = mysql_query($query) or die('Consulta de lista odontograma de tratamiento fallida: ' . mysql_error());
  //$line = mysql_fetch_array($result, MYSQL_ASSOC);  
    
  $comboLisTr="";
  while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) 
  {
   $comboLisTr .=" <option value='".$line['codigo']."'>".$line['descripcion']."</option>"; 
  }
  // Liberar resultados
  mysql_free_result($result);


  //========================== ========================== 
  $query="SELECT * FROM SIO_GRUPO_CIE10";
  $result = mysql_query($query) or die('Consulta de grupos para cie10: ' . mysql_error());
  $i=0;
  while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
  {
    if ($i==0)
      {
        $comboGrCie10 .=" <option value=''>".'Grupo Diagnostico'."</option>";
      }
    //  else
    //  {  
        $comboGrCie10 .=" <option value='".$line['codGrupo']."'>".$line['nomGrupo']."</option>"; 
    //  }
    $i++; 
  }
  // Liberar resultados
  mysql_free_result($result); 
  //========================== ========================== 

 //========================== ========================== 
  $query="SELECT * FROM SIO_GRUPO_CUPS";
  $result = mysql_query($query) or die('Consulta de grupos para cups: ' . mysql_error());
  $i=0;
  while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
  {
    if ($i==0)
      {
        $comboGrCups .=" <option value=''>".'Grupo Cups'."</option>";
      }
    //  else
    //  {  
        $comboGrCups .=" <option value='".$line['codGrCups']."'>".$line['nomGrCups']."</option>"; 
    //  }
    $i++; 
  }
  // Liberar resultados
  mysql_free_result($result); 
  //========================== ========================== 

 //========================== ========================== 
  $query="SELECT * FROM SIO_GRUPO_CUPS";
  $result = mysql_query($query) or die('Consulta de grupos para cups 1: ' . mysql_error());
  $i=0;
  while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
  {
    if ($i==0)
      {
        $comboGrCups1 .=" <option value=''>".'Grupo Cups'."</option>";
      }
    //  else
    //  {  
        $comboGrCups1 .=" <option value='".$line['codGrCups']."'>".$line['nomGrCups']."</option>"; 
    //  }
    $i++; 
  }
  // Liberar resultados
  mysql_free_result($result); 
  //========================== ========================== 


  /////TRAE LOGO
  //trae el nit
  $qnit="SELECT nitEmpresa FROM SIO_O_CITAS WHERE  preConsulta = $pc ";
  $result = mysql_query($qnit) or die('Consulta de paciente fallida: ' . mysql_error());
  $line = mysql_fetch_array($result, MYSQL_ASSOC);
  $s_nitEmpresa=$line['nitEmpresa'];
  // Liberar resultados
  mysql_free_result($result);
 
  $logoEx = "imagenes/logos/logo".$s_nitEmpresa.".jpg"; 
  if (file_exists($logoEx)) {
      $logoPre=$logoEx;
  } else {
     $logoPre="imagenes/logo.jpg";
  }
  //src="imagenes/logo.jpg"
  /////FIN TRAE LOGO   

?>
 
<body onload="window.print();">
   <table width='960' align="center">
      <tr>
         <td><img src=<?=$logoPre?> alt="Logo Compania" width="300" /> </td>
         <td>
           <table>
             <tr>
               <td class="negritaTitulos" align="center"><b>HISTORIA CLINICA</b></td>
             </tr>
             <tr>
               <td class="negritaTitulos" align="center"><b>ODONTOLOGICA</b></td>
             </tr>
           </table>
         </td>
         <td class="camposTabla" >
           <table>
             
             <tr>
               <td class="camposTabla">Fecha Impresi&oacute;n:</td> 
               <td class="negrita"><?=$w_fechaImp?></td>
             </tr>
           </table>
         </td>
      </tr>
   </table>
      
       <table align="center" border="0" width="960">
         <tr>
           <td class="titulosTabla1">
               Fecha de Consulta: <?=$fecha_consulta?>
           </td>
           <td class="titulosTabla1" align="center" colspan="5">
              HISTORIA CLINICA ODONTOLOGICA: <?=$s_tipoConsulta?> No. <?=$pc?> - Atendida por: <?=$nomMedico?>                      
           </td>  
         </tr>
        
         <tr class="titulosTabla">
             <td align ="center" colspan="5">DATOS GENERALES DEL PACIENTE</td>
         </tr>
         <tr>
            <td class="camposTabla" align="left">Tipo Identificaci&oacute;n</td>
            <td class="negrita"><?=$e_tipoId?></td>
            <td class="camposTabla" align="left">No. de Identificaci&oacute;n</td>
            <td class="negrita"><?=$e_idPaciente?></td>
         </tr>     
         <tr>   
            <td class="camposTabla">Nombres</td>     
            <td class="negrita"> <?=$s_nomPaciente?> <?=$s_nomPaciente2?> <?=$s_apell1Paciente?> <?=$s_apell2Paciente?></td>
            <td class="camposTabla">Sexo</td>
            <td class="negrita"><?=$s_sexoPaciente?></td>
         </tr>
           
         <tr class="camposTabla">
            <td>Fec. Nacimiento</td>
            <td class="negrita"><?=$s_fecNacimiento?></td>
            <td>Edad</td>
            <td class="negrita"><?=$s_edadPaciente?></td>           
         </tr>   
           
         <tr class="camposTabla">
           <td align="left">Tipo de vinculaci&oacute;n</td>
           <td class="negrita"><?=$s_tipoVinculacion?> </td>
           <td align="left">Lugar de Nacimiento</td>
           <td class="negrita"><?=$s_lugarNacimiento?></td>
         </tr>
           
         <tr class="camposTabla">
             <td align="left">Estado civil</td>
             <td class="negrita"><?=$s_estCivil?></td>
             <td align="left">Escolaridad</td>
             <td class="negrita"><?=$s_escolaridad?></>
         </tr>
           
         <tr class="camposTabla"> 
           <td align="left">Ciudad Residencia</td>
           <td class="negrita"><?=$s_ciuResidencia?></td>
           <td align="left">Direcci&oacute;n</td>
           <td class="negrita"><?=$s_dirResidencia?></td> 
         </tr>
           
         <tr class="camposTabla">
           <td align="left">Tel&eacute;fonos</td>
           <td class="negrita"><?=$s_telResidencia?></td>  
           <td align="left">E Mail</td>
           <td class="negrita"><?=$s_email?></td>
         </tr>
           
         <tr class="camposTabla">
           <td align="left">Familiar</td>
           <td class="negrita"><?=$s_famResponsable?></td>
           <td align="left">Parentesco</td>
           <td class="negrita"><?=$s_parentesco?></td> 
         </tr>
           
         <tr class="camposTabla">
           <td align="left">Tel&eacute;fonos</td>
           <td class="negrita"><?=$s_telPariente?></td>
         </tr>
    
         <tr class="titulosTabla">
             <td align ="center" colspan="5">OBSERVACIONES ADICIONALES</td>
           </tr>
           <tr class="camposTabla">
             <td class="camposTabla" align="left" colspan="5"><?=$obsCita?></td>
           </tr>

      </table>


   <table align="center" border="0" width="960"> 
    <tr class="negrita">
       <td align="left"> ALERTAS:Alergias - Medicamentos </td>
     </tr>
     <tr>
       <td class="camposTabla" align="left"><?=$s_alergias?></td>
     </tr> 
    
   </table> 

   <!--- ///////////////////////////////////////////////////////////////////////////////
         /////////////////////////// MOTIVO DE CONSULTA ////////////////////////////////
         ///////////////////////////////////////////////////////////////////////////////-->

   <table width="960" border="0" align="center" cellpadding="0">
     <tr><td><br></td></tr> 
     <tr class="negrita">
       <td align="left">Motivo Consulta</td>
     </tr>
           
     <tr> 
       <td class="camposTabla" align="left">
          <?=$s_motConsulta?>
       </td>
     </tr> 
     <tr><td><br></td></tr> 

     <tr class="negrita">
         <td align="left">Enfermedad Actual</td>
     </tr> 
     <tr>
       <td  class="camposTabla" align="left">
         <?=$s_enfActual?>   
       </td>
     </tr> 
     <tr><td><br></td></tr> 
 
     <tr  class="negrita" class="negrita">
        <td align="left">
          Antecedentes Familiares                        
        </td>
     </tr> 
     <tr>
       <td  class="camposTabla" align="left">
         <?=$s_antFam?>  
       </td>
     </tr>  
         
   </table>

   <!--- ///////////////////////////////////////////////////////////////////////////////
         //////////////ANTECEDENTES ODONTOLOGICOS Y MEDICOS GENERALES//////////////////
         ///////////////////////////////////////////////////////////////////////////////-->

     <table width="960" border="0" align="center" cellpadding="0">
        <tr></td><br></td></tr> 
                <tr class="titulosTabla" align="center">
                  <td colspan="3">ANTECEDENTES ODONTOLOGICOS Y MEDICOS GENERALES</td>
                <tr>  
                <tr class="subtutulosTabla" align="center">
                  <td width="40%">Antecedente</td>
                  <td width="5%">SI</td>
                  <td width="55%">Observaciones</td>
                </tr>
                <!--<tr class="camposTabla">
                  <td>Alergias</td>
                  <td align="center"><input <?=$chkAlergia?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><textarea rows="2" cols="80" wrap="soft" name="obsAlergia" id="obsAlergia"><?=$s_obsAlergia?></textarea></td>
                </tr>-->
                <tr class="camposTabla">
                  <td>Discracias Sanguineas</td>
                  <td align="center"><input <?=$chkDiscrasias?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsDiscrasiasSang?></td>
                </tr> 
                <tr class="camposTabla">
                  <td>Cardiopatias</td>
                  <td align="center"><input <?=$chkCardio?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsCardiopatias?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Embarazo</td>
                  <td align="center"><input <?=$chkEmbarazo?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsEmbarazo?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Alteracion presion arterial</td>
                  <td align="center"><input <?=$chkPresArt?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsAltPresArterial?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Toma Medicamentos</td>
                  <td align="center"><input <?=$chkTomaMedicamentos?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsTomaMedicamentos?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Tratamiento Medico Actual</td>
                  <td align="center"><input <?=$chkTratMedActual?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsTratMedActual?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Hepatitis</td>
                  <td align="center"><input <?=$chkHepatitis?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsHepatitis?></td>
                </tr> 
                <tr class="camposTabla">
                  <td>Diabetes</td>
                  <td align="center"><input <?=$chkDiabetes?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsDiabetes?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Fiebre Reumatica</td>
                  <td align="center"><input <?=$chkFiebreReum?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsFiebreReum?></td>
                </tr>
                <tr class="camposTabla">
                  <td>HIV-Sida</td>
                  <td align="center"><input <?=$chkSida?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsSida?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Inmunosupresion</td>
                  <td align="center"><input <?=$chkInmuno?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsInmunosupresion?></td>
                </tr>
                <tr class="camposTabla">
                 <td>Patologias Renales</td>
                 <td align="center"><input <?=$chkPatRenal?> onclick="return false;" type="checkbox" value="S" /></td>
                 <td><?=$s_obsPatologiasRenales?></td>
                </tr>  
                <tr class="camposTabla">
                  <td>Patologias Respiratoria</td>
                  <td align="center"><input <?=$chkPatResp?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsPatRespiratoria?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Trastornos Gastricos</td>
                  <td align="center"><input <?=$chkTrasGastricos?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsTrasGastricos?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Trastornos Emocionales</td>
                  <td align="center"><input <?=$chktTrasEmocional?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsTrasEmocional?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Sinusitis</td>
                  <td align="center"><input <?=$chkSinusitis?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsSinusitis?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Cirugias (Incluson Orales)</td>
                  <td align="center"><input <?=$chkCirugias?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsCirugias?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Exodoncias</td>
                  <td align="center"><input <?=$chkExodoncias?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsExodoncias?></td>
                </tr>
                 <tr class="camposTabla">
                  <td>Enfermedades Orales</td>
                  <td align="center"><input <?=$chkEnfOrales?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsEnfOrales?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Uso de protesis o aparatologia oral</td>
                  <td align="center"><input <?=$chkUsoProtesis?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsUsoProtesis?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Habitos y otras patologias o antecedentes odont&oacute;logicos o m&eacute;dicos </td>
                  <td colspan="2"><?=$s_habitos?></td>
                </tr>
               
    </table>  
    
    <!--- ///////////////////////////////////////////////////////////////////////////////
         ///////////////////////////EXAMEN ESTOMATOLOGICO ///////////////////////////////
         ///////////////////////////////////////////////////////////////////////////////-->   

    <table width="960" border="0" align="center" cellpadding="0">
            <tr></td><br></td></tr> 
               <tr class="titulosTabla" align="center">
                  <td colspan="3">EXAMEN ESTOMATOLOGICO</td>
                <tr>
                <tr class="subtutulosTabla" align="center">
                  <td width="30%">Estructura</td>
                  <td width="5%">Estado</td>
                  <td width="70%">Observaciones</td>
                </tr>
                <tr class="camposTabla">
                  <td>Labio Inferior</td>
                  <td> 
                     <select disabled  name="labioInferior" id="labioInferior">
                         <option <?=$labioInferiorNormal?> value="Normal">Normal</option>
                         <option <?=$labioInferiorAnormal?> value="Anormal">Sintomatico</option>
                     </select>
                  </td>   
                  <td class="camposTabla"><?=$s_obsLabioInferior?></td>
                </tr>
                <tr class="camposTabla">
                   <td>Labio Superior</td>
                   <td align="center">
                      <select disabled name="labioSuperior" id="labioSuperior">
                           <option <?=$labioSuperiorNormal?> value="Normal">Normal</option>
                           <option <?=$labioSuperiorAnormal?> value="Anormal">Sintomatico</option>
                       </select>
                    </td>
                    <td><?=$s_obsLabioSuperior?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Comisuras</td>
                  <td align="center">
                       <select class="camposTabla" disabled name="comisuras" id="comisuras">
                           <option <?=$comisurasNormal?> value="Normal">Normal</option>
                           <option <?=$comisurasAnormal?> value="Anormal">Sintomatico</option>
                       </select>
                  </td>
                  <td class="camposTabla"><?=$s_obsComisuras?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Mucosa Oral</td>
                  <td align="center">
                       <select class="camposTabla" disabled name="mucosaOral" id="mucosaOral">
                           <option <?=$mucosaOralNormal?> value="Normal">Normal</option>
                           <option <?=$mucosaOralAnormal?> value="Anormal">Sintomatico</option>
                       </select>
                  </td>
                  <td><?=$s_obsMucosaOral?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Surcos Yugales</td>
                  <td align="center">
                       <select disabled name="surcosYugales" id="surcosYugales">
                           <option <?=$surcosYugalesNormal?> value="Normal">Normal</option>
                           <option <?=$surcosYugalesAnormal?> value="Anormal">Sintomatico</option>
                       </select>
                  </td>
                  <td class="camposTabla"><?=$s_obsSurcosYugales?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Frenillos</td>
                  <td align="center">
                       <select disabled name="frenillos" id="frenillos">
                           <option <?=$frenillosNormal?> value="Normal">Normal</option>
                           <option <?=$frenillosAnormal?> value="Anormal">Sintomatico</option>
                       </select>
                  </td>
                  <td><?=$s_obsFrenillos?></td>
                </tr>
                <tr class="camposTabla">
                  <td>OroFaringe</td>
                  <td align="center">
                       <select disabled name="oroFaringe" id="oroFaringe">
                           <option <?=$oroFaringeNormal?> value="Normal">Normal</option>
                           <option <?=$oroFaringeAnormal?> value="Anormal">Sintomatico</option>
                       </select> 
                  </td>
                  <td><?=$s_obsOrofaringe?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Paladar</td>
                  <td align="center">
                       <select disabled name="paladar" id="paladar">
                           <option <?=$paladarNormal?> value="Normal">Normal</option>
                           <option <?=$paladarAnormal?> value="Anormal">Sintomatico</option>
                       </select>
                  </td>
                  <td><?=$s_obsPaladar?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Glandulas Salivales</td>
                  <td align="center">
                        <select disabled name="glandSalivales" id="glandSalivales">
                           <option <?=$glandSalivalesNormal?> value="Normal">Normal</option>
                           <option <?=$glandSalivalesAnormal?> value="Anormal">Sintomatico</option>
                       </select>
                  </td>
                  <td><?=$s_obsGlandSalivales?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Piso de Boca</td>
                  <td align="center">
                        <select disabled name="pisoBoca" id="pisoBoca">
                           <option <?=$pisoBocaNormal?> value="Normal">Normal</option>
                           <option <?=$pisoBocaAnormal?> value="Anormal">Sintomatico</option>
                       </select>
                  </td>
                  <td><?=$s_obsPisoBoca?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Dorso de Lengua</td>
                  <td align="center">
                        <select disabled name="dorsoLengua" id="dorsoLengua">
                           <option <?=$dorsoLenguaNormal?> value="Normal">Normal</option>
                           <option <?=$dorsoLenguaAnormal?> value="Anormal">Sintomatico</option>
                       </select>
                  </td>
                  <td><?=$s_obsDorsoLengua?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Vientre de Lengua</td>
                  <td align="center">
                        <select disabled name="vientreLengua" id="vientreLengua">
                           <option <?=$vientreLenguaNormal?> value="Normal">Normal</option>
                           <option <?=$vientreLenguaAnormal?> value="Anormal">Sintomatico</option>
                       </select>
                  </td>
                  <td><?=$s_obsVientreLengua?></td>
                </tr>
                
    </table>  

   <!--- ///////////////////////////////////////////////////////////////////////////////
         /////////////////////////// ARTICULACION TEMPOROMANDIBULAR /////////////////////
         ///////////////////////////////////////////////////////////////////////////////-->  

   <table width="960" border="0" align="center" cellpadding="0">
              <tr></td><br></td></tr>  
               <tr class="titulosTabla" align="center">
                  <td colspan="3">ARTICULACION TEMPOROMANDIBULAR</td>
                <tr>
                <tr class="subtutulosTabla" align="center">
                  <td width="30%">Hallazgos Cl&iacute;nicos</td>
                  <td width="5%">Estado</td>
                  <td width="70%">Observaciones</td>
                </tr>
                <tr class="camposTabla">
                  <td>Ruidos</td>
                  <td align="center">
                       <select disabled name="ruidos" id="ruidos">
                            <option <?=$ruidosNormal?> value="Normal">No Presente</option>
                            <option <?=$ruidosAnormal?> value="Anormal">Presente</option>
                       </select>
                  </td>
                  <td><?=$s_obsRuidos?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Desviacion</td>
                  <td align="center">
                         <select disabled name="desviacion" id="desviacion">
                            <option <?=$desviacionNormal?> value="Normal">No Presente</option>
                            <option <?=$desviacionAnormal?> value="Anormal">Presente</option>
                       </select>
                  </td>
                  <td><?=$s_obsDesviacion?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Cambio de Volumen</td>
                  <td align="center">
                        <select disabled name="cambioVolumen" id="cambioVolumen">
                            <option <?=$cambioVolumenNormal?> value="Normal">No Presente</option>
                            <option <?=$cambioVolumenAnormal?> value="Anormal">Presente</option>
                       </select>
                  </td>
                  <td><?=$s_obsCambioVolumen?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Bloqueo Mandibular</td>
                  <td align="center">
                         <select disabled name="bloqueoMand" id="bloqueoMand">
                            <option <?=$bloqueoMandNormal?> value="Normal">No Presente</option>
                            <option <?=$bloqueoMandAnormal?> value="Anormal">Presente</option>
                       </select>
                  </td>
                  <td><?=$s_obsBloqueMand?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Limite de Apertura</td>
                  <td align="center">
                         <select disabled name="limitApertura" id="limitApertura">
                            <option <?=$limitAperturaNormal?> value="Normal">No Presente</option>
                            <option <?=$limitAperturaAnormal?> value="Anormal">Presente</option>
                       </select>
                  </td>
                  <td><?=$s_obsLimitApertura?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Dolor Articular</td>
                  <td align="center">
                        <select disabled name="dolorArticular" id="dolorArticular">
                            <option <?=$dolorArticularNormal?> value="Normal">No Presente</option>
                            <option <?=$dolorArticularAnormal?> value="Anormal">Presente</option>
                       </select>
                  </td>
                  <td><?=$s_obsDolorArticular?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Dolor Muscular</td>
                  <td align="center">
                        <select disabled name="dolorMuscular" id="dolorMuscular">
                            <option <?=$dolorMuscularNormal?> value="Normal">No Presente</option>
                            <option <?=$dolorMuscularAnormal?> value="Anormal">Presente</option>
                       </select>
                  </td>
                 <td><?=$s_obsDolorMuscular?></td>
                </tr>
                
    </table>  


    <!--- ///////////////////////////////////////////////////////////////////////////////
         /////////////////////////// DATOS DE ODONTOGRAMA ///////////////////////////////
         ///////////////////////////////////////////////////////////////////////////////-->  
   <table width="960" border="0" align="center" cellpadding="0">
               <tr></td><br></td></tr>  
               <tr class="titulosTabla" align="center">
                  <td colspan="3">DATOS ODONTOGRAMA</td>
                <tr>
      </table>  
     <!--//////////////////////////////////////////////////////////////////////////////////////
         ///////////////////INICIO DE  ODONTOGRAMA DE DIAGNOSTICO ////////////////////////////
         //////////////////////////////////////////////////////////////////////////////////////-->

     <!--<div id="TabbedPanels1" class="TabbedPanels">
      <ul class="TabbedPanelsTabGroup">
        <li class="TabbedPanelsTab" tabindex="0">DIAGNOSTICO</li>
        <li class="TabbedPanelsTab" tabindex="0">TRATAMIENTO</li>
        
      </ul>
      <div class="TabbedPanelsContentGroup">
        <div class="TabbedPanelsContent">-->
         <table bgcolor="#FFF" width='960' align="center">
          <tr>
            <td>  
              <?php
                //arma tabla de odontograma de diagnosticos elegidos
                $query = " SELECT B.*, A.codCie10, A.nomCie10, A.grupo " .
                         " FROM SIO_CIE10 A, SIO_DIA_ODONTOGRAMA B ".
                         " WHERE A.codCie10 = B.codDiag AND ". 
                         "       B.tipoId = '$e_tipoId' AND B.idPaciente = $e_idPaciente";
                         //"     B.numConsulta = '$nConsulta' ";
                $result = mysql_query($query) or die('Consulta de odontograma de diagnosticofallida: ' . mysql_error());
        
                $num_total_registros = mysql_num_rows($result); 
                //echo $num_total_registros;
        
                $s_icCarNoCav = 0; 
                $i=0;
                while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) 
                {
                  $diente    = $line["numDiente"];
                  $cara      = $line["caraDiente"]; 
                  $codigo    = $line["codCie10"];
                  $nombre    = $line["nomCie10"];
                  $odoObs    = $line["observaciones"];
                  $consulta  = $line["numConsulta"];
                  $fecha     = $line["fechaConsulta"];
                  $s_grDg    = $line["grupo"];

                  $matriz = explode(" ", $fecha);
                  $fecha = $matriz[0]; 

                  //$fecha = date("d-m-Y", strtotime($fecha));

                  /////// SUMA VALORES PARA INDICE COPS 
                  $s_icSignos = $s_icSignos + 1;
                  if ($s_grDg=='GD002')
                  {
                    
                    $s_icCarNoCav = $s_icCarNoCav + 1;
                    
                    /*$s_icCarCav
                    $s_icObturados
                    $s_icPerCaries
                    $s_icPerOtra
                    $s_icTotDiePre
                    $s_icCop
                    $s_icCopMod*/
                  }
                  /////// FIN SUMA VALORES PARA INDICE COPS


                  echo("<table class='camposTabla' align='center' width='960' border='1' cellpading='0'>\n");
                  //echo ("<form method='post' action='historiaClinica.php'>\n");
                  if ($i==0)
                  {// para mostrar titulos 
                     echo ("<tr>\n");
                        echo   ("<td class='subtutulosTabla' align='center' colspan='4'>ODONTOGRAMA DE DIAGNOSTICOS</td>\n");
                     echo("</tr>\n");
                     echo("<tr>\n");
                        echo("<td width='25%' class='negrita'align='center'>Dg-Diente-Cara</td>\n");
                        echo("<td width='50%' class='negrita'>Diagn&oacute;stico</td>\n");
                        echo("<td width='25%' class='negrita'>Fecha</td>\n");
                        //echo("<td width='25%' class='negrita'>No. Consulta / Fecha</td>\n");
                     echo("</tr>\n");
                  }
                  echo("<tr>\n");
                    echo("<td width='25%' align='center'>$codigo-$diente-$cara</td>\n");
                    echo("<td width='50%' align='center' class='camposTabla'>$nombre</td>\n");
                    //echo("<td width='25%' class='camposTabla' align='center'> $consulta del $fecha</td>\n");
                    echo("<td width='25%' class='camposTabla' align='center'> $fecha</td>\n"); 
                  echo("</tr>\n");
          
                  $i = $i+1;
                }//while 
        
                 $activeDg="N";
                 if ($i>0)
                 {
                  $activeDg="S";      
                 }
                 echo("</table>\n");
                 // Liberar resultados
                 mysql_free_result($result);
               ?>
              </td>
            </tr>
            
            <?php
             if($activeDg=="S")
             {
            ?>
             <tr> 
               <!--<td colspan="4"  align="CENTER"> 
                <a href=sioOdontogramaDiag.php?s_tipoHistoria=<?=$tipoHis?>&nroCta=<?=$nConsulta?>&tipoId=<?=$s_tipoId?>&idPaciente=<?=$s_idPaciente?> target='_blank' ><img src="imagenes/verOdont.jpg"></a>
              </td>-->
            </tr>
          <?php  
           }
          ?>  
         </table>    
       <!--</div>
      


      <div class="TabbedPanelsContent">-->

         <table>

 
             
             <tr> 
             <?php
             if($activeTr=="S")
             {
            ?>  
               <!--<td colspan="4"  align="right"> 
                <a href=sioOdontogramaTra.php?s_tipoHistoria=<?=$tipoHis?>&nroCta=<?=$nConsulta?>&tipoId=<?=$s_tipoId?>&idPaciente=<?=$s_idPaciente?> target='_blank' ><img src="imagenes/verOdont.jpg"></a>
              </td>-->
            </tr>
          <?php  
           }
          ?>  
          </table>  

          <table align ="center" bgcolor="#FFF" width='960'>
            <tr>
              <td align="center">
               <?php
              //////////////////////////////////////////////////////////////////////////////////////
              ///////////////////INICIO DE  ODONTOGRAMA DE TRATAMIENTO
              //////////////////////////////////////////////////////////////////////////////////////

                //arma tabla de odontograma de tratamientos elegidos
                $query = " SELECT B.*, A.codCie10, A.nomCie10, A.grupo " .
                         " FROM SIO_CIE10 A, SIO_TRA_ODONTOGRAMA B ".
                         " WHERE A.codCie10 = B.codDiag AND ". 
                         "       B.tipoId = '$e_tipoId' AND B.idPaciente = $e_idPaciente";
                         //"     B.numConsulta = '$nConsulta' ";
                $result = mysql_query($query) or die('Consulta de odontograma de tratamiento fallida: ' . mysql_error());
        
                $num_total_registros = mysql_num_rows($result); 
                //echo $num_total_registros;
        
                $i=0;
                while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) 
                {
                  $trat="GGGG";
                  $diente    = $line["numDiente"];
                  $cara      = $line["caraDiente"]; 
                  $codigo    = $line["codCie10"];
                  $nombre    = $line["nomCie10"];
                  $odoObs    = $line["observaciones"];
                  $trat      = $line["tratamiento"];
                  $real      = $line["realizado"];
                  $codTr     = $line["codTra"];
                  $consulta  = $line["numConsulta"];
                  $fecha     = $line["fechaConsulta"];

                  $matriz = explode(" ", $fecha);
                  $fecha = $matriz[0]; 


                  if ($trat=="S"){
                    $estado="EN-TRATAMIENTO";
                   }
                  else{
                    if ($real=="S"){
                       $estado="----TERMINADO----";
                     }
                     else{ 
                      $estado="EN-DIAGNOSTICO";
                     }
                   } 
                  $queryT  = "SELECT descripcion FROM SIO_PROC_POS WHERE cups='$codTr'";
                  $resultT = mysql_query($queryT) or die('Consulta de descripcion de tratamiento fallida: ' . mysql_error()); 
                  $lineT   = mysql_fetch_array($resultT, MYSQL_ASSOC);
                  $nomT    = $lineT["descripcion"];

                  echo("<table class='camposTabla' align='center' width='960' border='1' cellpading='0'>\n");
                  //echo ("<form method='post' action='historiaClinica.php'>\n");
                  if ($i==0)
                  {// para mostrar titulos 
                     echo ("<tr>\n");
                        echo   ("<td class='subtutulosTabla' align='center' colspan='7'>ODONTOGRAMA DE TRATAMIENTO</td>\n");
                     echo("</tr>\n");
                     echo("<tr>\n");
                        echo("<td  colspan='2' class='negrita'align='center'>Diagn&oacute;stico y Diente a Tratar</td>\n");
                        echo("<td  colspan='2' class='negrita' align='center'>Ultimo tratamiento realizado</td>\n");
                        echo("<td  class='negrita'>Estado</td>\n");
                        //echo("<td  class='negrita'>No. Consulta / Fecha</td>\n");
                        echo("<td  class='negrita'>Fecha</td>\n");
                        //echo("<td  class='negrita'>Ver detalles</td>\n");
                     echo("</tr>\n");
                  }

                  if ($estado!="----TERMINADO----")
                  {
                  echo("<tr>\n");
                    echo("<td width='15%' align='center'>$codigo-$diente-$cara</td>\n");
                  }                                 
                  else
                  {
                    echo("<td width='15%' align='center'><b>$codigo-$diente-$cara</b></td>\n");
                  }

                    echo("<td width='20%' align='center' class='camposTabla'>$nombre</td>\n");
                    echo("<td width='15%' align='center'>$codTr</td>\n");
                    echo("<td width='20%' align='left' class='camposTabla'>$nomT</td>\n");
                    echo("<td width='5%' align='left' class='camposTabla'>$estado</td>\n");
                    //echo("<td width='15%' class='camposTabla' align='center'> $consulta del $fecha</td>\n");
                    echo("<td width='15%' class='camposTabla' align='center'>$fecha</td>\n");
                    //echo("<td width='15%' class='camposTabla' align='center'><input onclick='abrirHijo();' type=image src='imagenes/lupa.jpg' width='35' height='22'></td>\n");
                  echo("</tr>\n");
          
                  $i = $i+1;
                }//while 
        
                 $activeTr="N";
                 if ($i>0)
                 {
                  $activeTr="S";      
                 }
                 echo("</table>\n");
                 // Liberar resultados
                 mysql_free_result($result);
               ?>
              </td>           
             </tr>
             </table>
             
             <table> 
               <tr> 
                <?php
                 if($activeTr=="S")
                 {
                ?>  
                  <!--<td colspan="4"  align="right"> 
                    <a href=sioOdontogramaTra.php?s_tipoHistoria=<?=$tipoHis?>&nroCta=<?=$nConsulta?>&tipoId=<?=$s_tipoId?>&idPaciente=<?=$s_idPaciente?> target='_blank' ><img src="imagenes/verOdont.jpg"></a>
                 </td>-->
               </tr>
             <?php  
              }
             ?>  
            </table> 
        <!--</div>


      </div>
     </div>-->


<!--- ///////////////////////////////////////////////////////////////////////////////
         ////////////////DIAGNOSTICOS PARA TODA LA BOCA////////////////////
         ///////////////////////////////////////////////////////////////////////////////-->  

          <table align='center' border="1" width="960">
             <?php
                //arma tabla de dg y tr para toda la boca elegidos
                $query = " SELECT *" .
                         " FROM SIO_DIA_ODONBOCA ".
                         " WHERE tipoId = '$e_tipoId' AND idPaciente = $e_idPaciente";

                $result = mysql_query($query) or die('Consulta de odontograma de tratamiento fallida: ' . mysql_error());

                $i=0;
                while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) 
                {
                  $s_numConsulta   = $line["numConsulta"];
                  $s_tipoHistoria  = $line["tipoHistoria"];
                  $s_codDiag       = $line["codDiag"];
                  $s_tipo          = $line["tipo"];
                  $s_observaciones = $line["observaciones"];
                  $s_medConsulta   = $line["medConsulta"];   


                  if ($s_tipo=="DG"){
                    $queryName = "SELECT nomCie10 AS NOMBRE FROM SIO_CIE10 WHERE codCie10 = '$s_codDiag' ";
                    $resultName = mysql_query($queryName) or die('Consulta de nombre cie10 123 fallida: ' . mysql_error());
                    $lineName = mysql_fetch_array($resultName, MYSQL_ASSOC);
                  }
                  if ($s_tipo=="TR"){
                    $queryName = "SELECT descripcion AS NOMBRE FROM SIO_PROC_POS WHERE cups = '$s_codDiag' "; 
                    $resultName = mysql_query($queryName) or die('Consulta de nombre procedimiento 123 fallida: ' . mysql_error());
                    $lineName = mysql_fetch_array($resultName, MYSQL_ASSOC);
                  }

                  $nombrePrDg = $lineName["NOMBRE"];

                  if ($i==0)
                  {// para mostrar titulos 
                     echo ("<tr>\n");
                        echo   ("<td class='subtutulosTabla' align='center' colspan='3'>OTROS DIAGNOSTICOS Y TRATAMIENTOS</td>\n");
                     echo("</tr>\n");
                     echo("<tr>\n");                        
                        echo("<td  class='negrita'>Dg-Diente-Cara</td>\n");
                        //echo("<td  class='negrita'>Diag. / Trata</td>\n");
                        echo("<td  class='negrita'>Nombre</td>\n");
                     echo("</tr>\n");
                  }
                  echo("<tr class='camposTabla'>\n"); 
                  echo("<td width='150' align='LEFT'>$s_codDiag-$s_tipo</td>\n");
                    //echo("<td width='150' align='left'>$s_codDiag</td>\n");
                    echo("<td width='250' align='left'>$nombrePrDg</td>\n");
                  echo("</tr>\n");

                  $i=$i+1;
                }

             ?>
          </table>

<!--- ///////////////////////////////////////////////////////////////////////////////
         /////////////////////////// OSERVACIONES DEL ODONTOGRAMA////////////////////
         ///////////////////////////////////////////////////////////////////////////////-->  

    <table align='center' border="0" width="960">      
      <tr>
        <td class="negrita" align="center">
          <HR width=100% align="right">
       </td>
      </tr>
      <tr>
        <td class="negrita" align="center">OBSERVACIONES PARA EL ODONTOGRAMA</td>
      </tr>
      <tr>
        <td class="negrita" align="center">
          <HR width=100% align="right">
       </td>
      </tr>
      <tr>
        <td class="camposTabla" align="left">
          <?=$s_obsOdontograma?>
        </td>
      </tr>   
       
    </table>  

<!--- ///////////////////////////////////////////////////////////////////////////////
         /////////////////////////// INDICE COPS ///////////////////////////////////////
         ///////////////////////////////////////////////////////////////////////////////-->  

    <table align='center' border="0" width="960">
       <tr><td><br></td></tr>
       <tr>
        <td colspan="9" class="titulosTabla" align="center" align="left">INDICE COPS</td>
       </tr>
       <tr class="negrita" align="center"> 
          <td>Signos</td> <td>Cariados No<br>Cavitacional(C1)</td> <td>Cariados <br>Cavitacional(C2)</td> <td>Obturados(O)</td>
          <td>Perdidos Por<br>Caries(P)</td><td>Perdidos Otra<br>Raz&oacute;n(K)</td><td>Total Dientes<br>Presentes</td><td>COP<br>(C2+O+P)</td>
          <td>COP Modificado<br>(C1+C2+O+P)</td>
       </tr>
       <tr class="camposTabla" align="center">
           <td align="center"><?=$s_icSignos?></td>
           <td align="center"><?=$s_icCarNoCav?></td> 
           <td align="center"><?=$s_icCarCav?></td>
           <td align="center"><?=$s_icObturados?></td> 
           <td align="center"><?=$s_icPerCaries?></td>
       
           <td align="center"><?=$s_icPerOtra?></td> 
           <td align="center"><?=$s_icTotDiePre?></td>
           <td align="center"><?=$s_icCop?></td>  
           <td align="center"><?=$s_icCopMod?></td>  
       </tr> 
    </table>

    <!--//////////////////////////////////////////////////////////////////////////////////////
         ///////////////////INICIO CONSENTIMIENTOS INFORMADOS ////////////////////////////////////////
         //////////////////////////////////////////////////////////////////////////////////////--> 

    <table width="960" border="0" align="center" cellpadding="0">
      <tr></td><br></td></tr>  
      <tr class="titulosTabla" align="center">
        <td colspan="2">CONSENTIMIENTOS INFORMADOS</td>
      <tr>
      <!--<tr class="negrita" align="center">
        <td colspan="2">Por favor seleccione los consentimientos informados de este tratamiento</td>
      <tr>-->
      <tr class="subtutulosTabla" align="center">
        <td align="left" width="50%">Consentimiento</td>
        <td align="left" width="50%">SI</td>
      </tr>
      <tr class="camposTabla">
         <td>Consentimiento Informado</td>
         <td align="left"><input <?=$chkConInformado?> onclick="return false;" type="checkbox" value="S" /></td>
      </tr>
      <tr class="camposTabla">
         <td>Formulario de Consentimiento Informado para Operatoria</td>
         <td align="left"><input <?=$chkConInfOpera?> onclick="return false;" type="checkbox" value="S" /></td>
      </tr>
      <tr class="camposTabla">
         <td>Formulario de Consentimiento Informado para Anestesia Local</td>
         <td align="left"><input <?=$chkConInfAneLoc?> onclick="return false;" type="checkbox" value="S" /></td>
      </tr>
      <tr class="camposTabla">
         <td>Formulario de Consentimiento Informado para Endodoncia</td>
         <td align="left"><input <?=$chkConInfEndo?> onclick="return false;" type="checkbox" value="S" /></td>
      </tr>
      <tr class="camposTabla">
         <td>Formulario de Consentimiento Informado para Endodoncia Simple</td>
         <td align="left"><input <?=$chkConInfEndSim?> onclick="return false;" type="checkbox" value="S" /></td>
      </tr>
      <tr class="camposTabla">
         <td>Formulario de Consentimiento Informado para Exodoncia Simple</td>
         <td align="left"><input <?=$chkConInExoSim?> onclick="return false;" type="checkbox" value="S" /></td>
      </tr>
      <tr class="camposTabla">
         <td>Formulario de Consentimiento Informado para Exodoncia de Cordales e Incluidos</td>
         <td align="left"><input <?=$chkConInfExoCor?> onclick="return false;" type="checkbox" value="S" /></td>
      </tr>
      <tr class="camposTabla">
         <td>Formulario de  Consentimiento Informado para Cirug&iacute;a Apical</td>
         <td align="left"><input <?=$chkConInfCirApi?> onclick="return false;" type="checkbox" value="S" /></td>
      </tr>
      <tr class="camposTabla">
         <td>Formulario de Consentimiento Informado para Terapia Neural</td>
         <td align="left"><input <?=$chkConInfTerNeu?> onclick="return false;" type="checkbox" value="S" /></td>
      </tr>
      <tr class="camposTabla">
         <td>Revocaci&oacute;n</td>
         <td align="left"><input <?=$chkConInfRevoc?> onclick="return false;" type="checkbox" value="S" /></td>
      </tr>
      <tr class="camposTabla">
         <td>Formulario de Negaci&oacute;n del Consentimiento Informado</td>
         <td align="left"><input <?=$chkConInfNegacion?> onclick="return false;" type="checkbox" value="S" /></td>
      </tr>
         
    </table> 

     <!--//////////////////////////////////////////////////////////////////////////////////////
         ///////////////////INICIO PLAN DE TRATAMIENTO ////////////////////////////////////////
         //////////////////////////////////////////////////////////////////////////////////////-->

     <?php
               //arma tabla de odontograma de tratamientos elegidos
                $query = " SELECT B.*, A.codCie10, A.nomCie10, A.grupo " .
                         " FROM SIO_CIE10 A, SIO_TRA_MOVODONTO B ".
                         " WHERE A.codCie10 = B.codDiag AND ". 
                         "       B.tipoId = '$e_tipoId' AND B.idPaciente = $e_idPaciente";
                         //"     B.numConsulta = '$nConsulta' ";   
                $result = mysql_query($query) or die('Consulta de odontograma de movimientos de tratamiento fallida: ' . mysql_error());
        
                $num_total_registros = mysql_num_rows($result); 
                //echo $num_total_registros;
        
                $i=0;
                echo("<table class='camposTabla' align='center' width='960' border='1' cellpading='0'>\n"); 
                while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) 
                {
                  $diente    = $line["numDiente"];
                  $cara      = $line["caraDiente"]; 
                  $codigo    = $line["codDiag"];
                  $nombre    = $line["descripcion"];
                  $codTr     = $line["codTra"];
                  $odoObs    = $line["observaciones"];                 
                  $consulta  = $line["numConsulta"];
                  $fecha     = $line["fechaConsulta"];
                  $s_estado  = $line["estado"];
                  $s_medConsulta = $line["medConsulta"];

                  //trae nombre del medico 
                  $queryMed = "select nomUsuario, apell1usuario, apell2usuario FROM SIME_BAS_N_USUARIOS WHERE idusuario=$s_medConsulta"; 
                  $resultM = mysql_query($queryMed) or die('Consulta de medico tratante fallida: ' . mysql_error()); 
                  $lineM   = mysql_fetch_array($resultM, MYSQL_ASSOC);
                  $nomM    = $lineM["nomUsuario"] . " " . $lineM["apell1usuario"] . " " . $lineM["apell2usuario"];
  
                  $matriz = explode(" ", $fecha);
                  $fecha = $matriz[0]; 

                  //$queryT  = "SELECT descripcion FROM SIO_LIS_ODONTOGRAMA WHERE codigo='$codTr'";
                  $queryT  = "SELECT descripcion FROM SIO_PROC_POS WHERE cups='$codTr'";     

                  $resultT = mysql_query($queryT) or die('Consulta de descripcion de tratamiento fallida: ' . mysql_error()); 
                  $lineT   = mysql_fetch_array($resultT, MYSQL_ASSOC);
                  $nomT    = $lineT["descripcion"];

                  if ($i==0)
                  {// para mostrar titulos      
                    echo ("<tr></td><br></td></tr>\n");                 
                     echo ("<tr>\n");
                        echo   ("<td class='titulosTabla' align='center' colspan='9'>PLAN DE TRATAMIENTO</td>\n");
                     echo("</tr>\n");
                     echo("<tr class='subtutulosTabla'>\n");
                        echo("<td class='negrita'align='left'>Diagn&oacute;sticos/Diente/Cara/Procedimiento Realizado</td>\n");
                        echo("<td class='negrita' align='center'>Observaciones</td>\n"); 
                        echo("<td class='negrita'>Estado</td>\n");
                        //echo("<td  class='negrita'>No.Cons./Fecha</td>\n");
                        echo("<td class='negrita'>Fecha</td>\n");
                        //echo("<td class='negrita'>Evolucionar</td>\n");
                     echo("</tr>\n");
                  }
                   echo("<tr>\n");
                    if ($s_estado=="EN-TRATAMIENTO")
                    {
                      echo("<td 'align='left'>$codigo-$diente-$cara-$codTr $nombre / $nomT   <br>  <b>$nomM</b></td>\n");
                   echo("</td>\n");
                    }
                    else
                    {
                      echo("<td 'align='left'><b>$codigo-$diente-$cara-$codTr</b>  $nombre / $nomT   <br>  <b>$nomM</b></td>\n");
                   echo("</td>\n");                      
                    }
 
                    echo("<td class='camposTabla1' align='left'>$odoObs</td>\n");
                    echo("<td class='camposTabla1' align='left'>$s_estado</td>\n");
                    echo("<td class='camposTabla1' align='center'>$fecha</td>\n");
                    //echo("<td class='camposTabla1' width='10%' align='center'> $consulta del $fecha</td>\n");
                    //echo("<td class='negrita'>Evolucionar</td>\n");
                  echo("</tr>\n"); 
                  $i = $i+1;
                }//while 
        
                $activeTr="N";
                if ($i>0)
                {
                  $activeTr="S";      
                }
                echo("</table>\n");
                // Liberar resultados
                mysql_free_result($result);
              ?>

     <!--//////////////////////////////////////////////////////////////////////////////////////
         ///////////////////INICIO PROTESIS E HIGIENE ORAL//////////////////////////////////////
         //////////////////////////////////////////////////////////////////////////////////////-->

     <table width="960" border="0" align="center" cellpadding="0">
        <tr></td><br></td></tr>
             <tr class="titulosTabla" align="center">
              <td colspan="3">PROTESIS</td>
             <tr>
             <tr class="subtutulosTabla" align="center">
               <td width="30%"></td>
               <td width="5%">SI</td>
               <td width="70%">Observaciones</td>
             </tr>
             <tr class="camposTabla">
               <td>Presenta alg&uacute;n Tipo de Protesis</td>
               <td align="center"><input <?=$chkProtesis?> onclick="return false;" type="checkbox" value="S" /></td>
               <td><?=$s_obsProtesis?></td>
             </tr>
     </table>
     
     <table width="960" border="0" align="center" cellpadding="0">
           <tr></td><br></td></tr>
             <tr class="titulosTabla" align="center">
              <td colspan="4">HIGIENE ORAL</td>
             </tr>
                <tr class="camposTabla">
                  <td>Higiene
                    <select disabled name="higiene" id="higiene">
                         <option <?=$hBuena?> value="Buena">Buena</option>
                         <option <?=$hRegular?> value="Regular">Regular</option>
                         <option <?=$hMala?> value="Mala">Mala</option>
                    </select>
                  </td>
                  <td>Frecuancia Cepillado
                    <select disabled name="freCepillado" id="freCepillado">
                         <option <?=$fCtres?> value="Tres Veces">Tres Veces</option>
                         <option <?=$fCdos?> value="Dos Veces">Dos Veces</option>
                         <option <?=$fCuno?> value="Una Vez">Una Vez</option>
                    </select>
                  </td>
                </tr>
                <tr class="camposTabla">
                  <td>Seda Dental <input <?=$chkSedaDental?> onclick="return false;" type="checkbox" value="S" /></td>  
                  <td>Pigmentaciones <input <?=$chkPigmentacion?> onclick="return false;" type="checkbox" value="S" /></td>
                </tr>  
                <tr class="camposTabla">
                   <td>Grado de Riesgo
                     <select disabled name="gradoRiesgo" id="gradoRiesgo">
                         <option <?=$grBajo?> value="Bajo">Bajo</option>
                         <option <?=$grMedio?> value="Medio">Medio</option>
                         <option <?=$grAlto?> value="Alto">Alto</option>
                     </select>
                   </td> 
                </tr>
                <tr class="negrita">
                   <td colspan="4">Observaciones</td> 
                </tr>
                <tr align="center">
                   <td colspan="2"><?=$s_obsHigiene?></td> 
                </tr>
                
    </table>   
    
    <!--//////////////////////////////////////////////////////////////////////////////////////
         ///////////////////INICIO REGISTRO DE PLACA    //////////////////////////////////////
         //////////////////////////////////////////////////////////////////////////////////////-->     
       
     <table width="960" border="0" align="center" cellpadding="0">
       <tr></td><br></td></tr>
       <tr class="titulosTabla" align="center">
           <td>REGISTRO DE PLACA</td>
       </tr>
     </table>

<!--  ============================= FILA 2 PARA EL REGISRO DE PLACA =================================== -->

     <table align="center">            
       <tr class="negrita">  <!--FILA 2-->
       
                  <td colspan="3" align="center">  <!--diente 18-->
           <table align='center' border="0" cellpadding="0" width="10">             
             <tr>
               <td align="center"></td>
               <td align="center"><label>.</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>18</label></td>
               <td align="center"></td>
             </tr>     
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP181?> onclick="return false;" id="P181" name="P181" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP184?> onclick="return false;" id="P184" name="P184" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input id="P186" name="P186" type="checkbox" value="0" onclick="return false;"/></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP182?> onclick="return false;" id="P182" name="P182" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP185?> onclick="return false;" id="P185" name="P185" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 18  -->            
       
         <td colspan="3" align="center">  <!--diente 17-->
           <table align='center' border="0" cellpadding="0" width="10">             
             <tr>
               <td align="center"></td>
               <td align="center"><label>.</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>17</label></td>
               <td align="center"></td>
             </tr>     
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP171?> onclick="return false;" id="P171" name="P171" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP174?> onclick="return false;" id="P174" name="P174" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input id="P176" name="P176" type="checkbox" value="0" onclick="return false;"/></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP172?> onclick="return false;" id="P172" name="P172" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP175?> onclick="return false;" id="P175" name="P175" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 17  -->            

         <td colspan="3" align="center">  <!--diente 16-->
           <table align='center' border="0" cellpadding="0" width="10">             
             <tr>
               <td align="center"></td>
               <td align="center"><label>.</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>16</label></td>
               <td align="center"></td>
             </tr>     
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP161?> onclick="return false;" id="P161" name="P161" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP164?> onclick="return false;" id="P164" name="P164" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input id="P166" name="P166" type="checkbox" value="0" onclick="return false;"/></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP162?> onclick="return false;" id="P162" name="P162" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP165?> onclick="return false;" id="P165" name="P165" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 16  --> 

         <td colspan="3" align="center">  <!--diente 55-->
           <table align='center' border="0" cellpadding="0" width="10">
             
             <tr>
               <td align="center"></td>
               <td align="center"><label>55</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>15</label></td>
               <td align="center"></td>
             </tr>     
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP551?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP554?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input id="P556" name="P556" type="checkbox" value="0" onclick="return false;"/></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP552?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP555?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 55  -->          

         <td colspan="3" align="center">  <!--diente 54-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td align="center"></td>
               <td align="center"><label>54</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>14</label></td>
               <td align="center"></td>
             </tr>      
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP541?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP544?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input id="P546" name="P546" type="checkbox" value="0" onclick="return false;" /></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP542?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP545?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 54  -->  
            
         <td colspan="3" align="center">  <!--diente 53-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td align="center"></td>
               <td align="center"><label>53</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>13</label></td>
               <td align="center"></td>
             </tr>       
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP531?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP534?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP532?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP535?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>            
            
         <td colspan="3" align="center">  <!--diente 52-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td align="center"></td>
               <td align="center"><label>52</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>12</label></td>
               <td align="center"></td>
             </tr>       
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP521?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP524?>  onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP522?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP525?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 52  -->      
     
         <td colspan="3" align="center">  <!--diente 51-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td align="center"></td>
               <td align="center"><label>51</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>11</label></td>
               <td align="center"></td>
             </tr>        
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP511?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP514?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP512?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP515?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 51  -->      
     
         <td colspan="3" align="center">  <!--diente 61-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td align="center"></td>
               <td align="center"><label>61</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>21</label></td>
               <td align="center"></td>
             </tr>      
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP611?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP612?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input id="P613" name="P613" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP614?>  onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP615?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 61  --> 
              
         <td colspan="3" align="center">  <!--diente 62-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td align="center"></td>
               <td align="center"><label>62</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>22</label></td>
               <td align="center"></td>
             </tr>       
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP621?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP622?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP624?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP625?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 62  -->      
     
         <td colspan="3" align="center">  <!--diente 63-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td align="center"></td>
               <td align="center"><label>63</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>23</label></td>
               <td align="center"></td>
             </tr>       
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP631?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP632?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP634?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP635?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 63  --> 

         <td colspan="3" align="center">  <!--diente 64-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td align="center"></td>
               <td align="center"><label>64</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>24</label></td>
               <td align="center"></td>
             </tr>       
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP641?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP642?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP644?> id="P644" name="P644" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP645?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 64  --> 
         
         <td colspan="3" align="center">  <!--diente 65-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td align="center"></td>
               <td align="center"><label>65</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>25</label></td>
               <td align="center"></td>
             </tr>       
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP651?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP652?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP654?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP655?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 65  -->      

         <td colspan="3" align="center">  <!--diente 26-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td align="center"></td>
               <td align="center"><label>.</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>26</label></td>
               <td align="center"></td>
             </tr>       
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP261?> onclick="return false;" id="P261" name="P261" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP262?> onclick="return false;" id="P262" name="P262" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input id="P266" name="P266" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP264?> onclick="return false;" id="P264" name="P264" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP265?> onclick="return false;" id="P265" name="P265" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 26  -->    

         <td colspan="3" align="center">  <!--diente 27-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td align="center"></td>
               <td align="center"><label>.</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>27</label></td>
               <td align="center"></td>
             </tr>       
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP271?> onclick="return false;" id="P271" name="P271" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP272?> onclick="return false;" id="P272" name="P272" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input id="P276" name="P276" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP274?> onclick="return false;" id="P274" name="P274" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP275?> onclick="return false;" id="P275" name="P275" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 27  -->    

         <td colspan="3" align="center">  <!--diente 28-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td align="center"></td>
               <td align="center"><label>.</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>28</label></td>
               <td align="center"></td>
             </tr>       
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP281?> onclick="return false;" id="P281" name="P281" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP282?> onclick="return false;" id="P282" name="P282" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input id="P286" name="P286" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP284?> onclick="return false;" id="P284" name="P284" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP285?> onclick="return false;" id="P285" name="P285" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Palatino-->
             </tr> 
           </table>
         <td>  <!--FIN diente 28  -->   

    
       </tr> <!--FILA 2 -->
       <tr>
         <td colspan="60"><HR width=100% align="center"></td>
       </tr>
     </table>
  
     <!--  ============================= FILA 3 PARA EL REGISRO DE PLACA=================================== -->

     <table align="center">            
       <tr class="negrita">  <!--FILA 3-->
       
         <td colspan="3" align="center">  <!--diente 48-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP487?> onclick="return false;"  id="P487" name="P487" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP484?> onclick="return false;"  id="P484" name="P484" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input id="P486" name="P486" type="checkbox" value="0" onclick="return false;" /></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP482?>  onclick="return false;"  id="P482" name="P482" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP481?> onclick="return false;"  id="P481" name="P481" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>48</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>.</label></td>
               <td align="center"></td>
             </tr>   
           </table>
         <td>  <!--FIN diente 48  --> 

         <td colspan="3" align="center">  <!--diente 47-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP477?> onclick="return false;"  id="P477" name="P477" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP474?> onclick="return false;"  id="P474" name="P474" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input id="P476" name="P476" type="checkbox" value="0" onclick="return false;" /></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP472?> onclick="return false;"  id="P472" name="P472" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP471?> onclick="return false;"  id="P471" name="P471" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>47</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>.</label></td>
               <td align="center"></td>
             </tr>   
           </table>
         <td>  <!--FIN diente 47  -->   

       
         <td colspan="3" align="center">  <!--diente 46-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP467?> onclick="return false;"  id="P467" name="P467" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP464?> onclick="return false;"  id="P464" name="P464" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input id="P466" name="P466" type="checkbox" value="0" onclick="return false;" /></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP462?> onclick="return false;"  id="P462" name="P462" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP461?> onclick="return false;"  id="P461" name="P461" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>46</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>.</label></td>
               <td align="center"></td>
             </tr>   
           </table>
         <td>  <!--FIN diente 46  --> 
                
         <td colspan="3" align="center">  <!--diente 85-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP857?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP854?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input id="P856" name="P856" type="checkbox" value="0" onclick="return false;" /></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP852?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP851?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>45</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>85</label></td>
               <td align="center"></td>
             </tr>   
           </table>
         <td>  <!--FIN diente 85  -->   
         
         <td colspan="3" align="center">  <!--diente 84-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP847?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP844?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input id="P846" name="P846" type="checkbox" value="0" onclick="return false;" /></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP842?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP841?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>44</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>84</label></td>
               <td align="center"></td>
             </tr>  
           </table>
         <td>  <!--FIN diente 84  -->          

         <td colspan="3" align="center">  <!--diente 83-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP837?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP834?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP832?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP831?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>43</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>83</label></td>
               <td align="center"></td>
             </tr>  
           </table>
         <td>  <!--FIN diente 83  --> 

         <td colspan="3" align="center">  <!--diente 82-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP827?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP824?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP822?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP821?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>42</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>82</label></td>
               <td align="center"></td>
             </tr>  
           </table>
         <td>  <!--FIN diente 82  --> 

         <td colspan="3" align="center">  <!--diente 81-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP817?> onclick="return false;"" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP814?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP812?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP811?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>41</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>81</label></td>
               <td align="center"></td>
             </tr>  
           </table>
         <td>  <!--FIN diente 81  -->          

         <td colspan="3" align="center">  <!--diente 71-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP717?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP712?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP714?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP711?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>31</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>71</label></td>
               <td align="center"></td>
             </tr>  
           </table>
         <td>  <!--FIN diente 71  --> 

         <td colspan="3" align="center">  <!--diente 72-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP727?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP722?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP724?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP721?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>32</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>72</label></td>
               <td align="center"></td>
             </tr>  
           </table>
         <td>  <!--FIN diente 72  --> 

         <td colspan="3" align="center">  <!--diente 73-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP737?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP732?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Incisal-->
               <td align="center"><input <?=$chkP734?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP734?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>33</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>73</label></td>
               <td align="center"></td>
             </tr>  
           </table>
         <td>  <!--FIN diente 73  --> 

         <td colspan="3" align="center">  <!--diente 74-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP747?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP742?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input id="P746" name="P746" type="checkbox" value="0" onclick="return false;" /></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP744?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP741?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>34</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>74</label></td>
               <td align="center"></td>
             </tr>  
           </table>
         <td>  <!--FIN diente 74  --> 

         <td colspan="3" align="center">  <!--diente 75-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP757?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP752?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input onclick="return false;" type="checkbox" value="0" onclick="return false;" /></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP754?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP751?> onclick="return false;" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>35</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>75</label></td>
               <td align="center"></td>
             </tr>  
           </table>
         <td>  <!--FIN diente 75  --> 

         <td colspan="3" align="center">  <!--diente 36-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP367?> onclick="return false; id="P367" name="P367" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP362?> onclick="return false; id="P362" name="P362" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input id="P366" name="P366" type="checkbox" value="0" onclick="return false;" /></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP364?> onclick="return false;  id="P364" name="P364" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP361?> onclick="return false; id="P361" name="P361" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>36</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>.</label></td>
               <td align="center"></td>
             </tr>  
           </table>
         <td>  <!--FIN diente 36  --> 

         <td colspan="3" align="center">  <!--diente 37-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP377?> onclick="return false; id="P377" name="P377" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP372?> onclick="return false; id="P372" name="P372" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input id="P376" name="P376" type="checkbox" value="0" onclick="return false;" /></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP374?> onclick="return false; id="P374" name="P374" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP371?> onclick="return false; id="P371" name="P371" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>37</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>.</label></td>
               <td align="center"></td>
             </tr>  
           </table>
         <td>  <!--FIN diente 37  --> 

         <td colspan="3" align="center">  <!--diente 38-->
           <table align='center' border="0" cellpadding="0" width="10">
             <tr>
               <td></td> 
               <td align="center"><input <?=$chkP387?> onclick="return false; id="P387" name="P387" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Lingual-->
             </tr> 
             <tr>
               <td align="center"><input <?=$chkP382?> onclick="return false; id="P382" name="P382" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Mesial-->
               <td align="center"><input id="P386" name="P386" type="checkbox" value="0" onclick="return false;" /></td> <!--Oclusal-->
               <td align="center"><input <?=$chkP384?> onclick="return false; id="P384" name="P384" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Distal-->
             </tr>
             <tr>
               <td></td>
               <td align="center"><input <?=$chkP381?> onclick="return false; id="P381" name="P381" type="checkbox" value="1" onclick="Suma(this,this.value)" /></td> <!--Vestibular-->
             </tr> 
             <tr>
               <td align="center"></td>
               <td align="center"><label>38</label></td>
               <td align="center"></td>
             </tr>  
             <tr>
               <td align="center"></td>
               <td align="center"><label>.</label></td>
               <td align="center"></td>
             </tr>  
           </table>
         <td>  <!--FIN diente 38  --> 


       </tr> <!--FILA 3 -->
       <tr>
         <td><br></td>
       </tr>
      </table> 
      <table width="960" border="0" align="center" cellpadding="0">
        <tr>
         <td>
           <table>  
             <tr>
               <td class="camposTabla" width="200" align="left">
                 No. de superficies con Placa
               </td>
             </tr>
             <tr>  
               <td width="100">
                 <input type="number" id="numSupPlaca" name="numSupPlaca" value=<?=$s_numSupPlaca?> readOnly="readonly"/>
               </td>  
             </tr>
             <tr>  
               <td class="camposTabla" width="200" align="left">
                 Indice de Placa
               </td>
             </tr>
             <tr>  
               <td  width="100">
                 <input readOnly="readonly" type="number" id="indicePlaca" name="indicePlaca"  value=<?=$s_indicePlaca?> > %
               </td>
             </tr> 
           </table>
         </td>
         <td>       
            <table>
              <tr class="camposTabla">
                <td align="left"><input <?=$chkRegPlaNoApl?> readOnly="readonly" type="checkbox" value="S" /> Registro de placa no aplica (por favor explicar en las observaciones)</td>
              </tr> 
              <tr class="camposTabla">
                  <td align="center">Observaciones y/o Indicaciones </td>
              </tr> 
              <tr class="camposTabla"> 
                  <td colspan="2"><textarea readOnly="readonly" rows="3" cols="90" wrap="soft" name="obsRegPlaNoApl" id="obsRegPlaNoApl"><?=$s_obsRegPlaNoApl?></textarea></td>
              </tr>
            </table>
         </td> 
        </tr>
        
      </table>

     <!--//////////////////////////////////////////////////////////////////////////////////////
         ///////////////////INICIO EXAMEN PULPAR //////////////////////////////////////
         //////////////////////////////////////////////////////////////////////////////////////--> 
 
      <table width="960" border="0" align="center" cellpadding="0">
               <tr></td><br></td></tr>
                <tr class="titulosTabla" align="center">
                  <td colspan="3" >EXAMEN PULPAR</td>
                </tr>
                <tr class="subtutulosTabla" align="center">
                  <td width="30%">Criterio</td>
                  <td width="5%">SI</td>
                  <td width="70%">Observaciones</td>
                </tr>
                <tr class="camposTabla">
                  <td>Cuello Sencible</td>
                  <td align="center"><input <?=$chkCuelloSencible?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsCuelloSencible?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Abscesos</td>
                  <td align="center"><input <?=$chkAbscesos?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsAbscesos?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Exposicion Pulpar</td>
                  <td align="center"><input <?=$chkExposicionPulpar?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsExposicionPulpar?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Cambio de Color</td>
                  <td align="center"><input <?=$chkCambioColor?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsCambioColor?></td>
                </tr>
                
    </table>  
      
    <!--//////////////////////////////////////////////////////////////////////////////////////
         ///////////////////INICIO TEJIDOS DENTARIOS Y OCLUSION    ///////////////////////////
         //////////////////////////////////////////////////////////////////////////////////////--> 

    <table width="960" border="0" align="center" cellpadding="0">
                <tr></td><br></td></tr>
                <tr class="titulosTabla" align="center">
                  <td colspan="3" >TEJIDOS DENTARIOS Y OCLUSION</td>
                </tr>
                <tr class="subtutulosTabla" align="center">
                  <td width="30%">Criterio</td>
                  <td width="5%">SI</td>
                  <td width="70%">Observaciones</td>
                </tr>
                <tr class="camposTabla">
                  <td>Supernumerarios</td>
                  <td align="center"><input <?=$chkSupernumerarios?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsSupernumerarios?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Decoloracion</td>
                  <td align="center"><input <?=$chkDecoloracion?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsDecoloracion?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Descalsificacion</td>
                  <td align="center"><input <?=$chkDescalsificacion?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsDescalsificacion?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Facetas de Desgaste</td>
                  <td align="center"><input <?=$chkFacetaDesgaste?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsFacetaDesgaste?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Abrasi&oacute;n y/o erosi&oacute;n</td>
                  <td align="center"><input <?=$chkAbrasion?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsAbrasion?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Fluorosis</td>
                  <td align="center"><input <?=$chkFluorosis?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsFluorosis?></td>
                </tr>
               
     </table>    

      <!--//////////////////////////////////////////////////////////////////////////////////////
         ///////////////////    INICIO ALTERACIONES PERIODONTALES    ///////////////////////////
         //////////////////////////////////////////////////////////////////////////////////////--> 

       <table width="960" border="0" align="center" cellpadding="0">
                <tr></td><br></td></tr>
                <tr class="titulosTabla" align="center">
                  <td colspan="3" >ALTERACIONES PERIODONTALES</td>
                </tr>
                <tr class="subtutulosTabla" align="center">
                  <td width="30%">Criterio</td>
                  <td width="5%">SI</td>
                  <td width="70%">Observaciones</td>
                </tr>
                <tr class="camposTabla">
                  <td>Sangrado </td>
                  <td align="center"><input <?=$chkSangrado?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsSangrado?></td>
                </tr>
                 <tr class="camposTabla">
                  <td>Exudado </td>
                  <td align="center"><input <?=$chkExudado?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsExudado?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Supuracion</td>
                  <td align="center"><input <?=$chkSupuracion?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsSupuracion?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Calculos</td>
                  <td align="center"><input <?=$chkCalculos?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsCalculos?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Inflamacion </td>
                  <td align="center"><input <?=$chkInflamacion?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsInflamacion?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Retracciones </td>
                  <td align="center"><input <?=$chkRetracciones?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsRetracciones?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Presencia Bolsas </td>
                  <td align="center"><input <?=$chkPresenciaBolsas?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsPresenciaBolsas?></td>
                </tr>
                <tr class="camposTabla">
                  <td>Tipo Oclusion </td>
                  <td align="center"><input <?=$chkTipOclusion?> onclick="return false;" type="checkbox" value="S" /></td>
                  <td><?=$s_obsTipOclusion?></td>
                </tr>
                          
     </table> 

     

     <!--VARIABLES PARA RECARGAR-->
     <div style=display:none;>

     <input style="visibility:hidden" name="yaGrabo" id="yaGrabo" value="<?=$s_yaGrabo?>"/>
       <input style="visibility:hidden" name="nroCta" id="nroCta" value="<?=$e_nvoNroCon?>"/>
       
      <input style="visibility:hidden" name="s_tipoHistoria" id="s_tipoHistoria" value="<?=$s_tipoHistoria?>"/>
      <!--<input style="visibility:hidden" name="nroCta" id="nroCta" value="<?=$nConsulta?>"/>-->
      <input style="visibility:hidden" name="tipoId" id="tipoId" value="<?=$e_tipoId?>"/>
      <input style="visibility:hidden" name="idPaciente" id="idPaciente" value="<?=$e_idPaciente?>"/>
      <input style="visibility:hidden" name="nom" id="nom" value="<?=$nombre?>"/>

      <input style="visibility:hidden" name="s_nitEmpresa" id="s_nitEmpresa"value="<?=$s_nitEmpresa?>"/>
      <input style="visibility:hidden" name="s_codSede" id="s_codSede"value="<?=$s_codSede?>"/>
      <input style="visibility:hidden" name="s_idUsuario" id="s_idUsuario"value="<?=$s_idUsuario?>"/>
      <input style="visibility:hidden" name="s_usuario" id="s_usuario"value="<?=$s_usuario?>"/>
      <input style="visibility:hidden" name="s_empresa" id="s_empresa"value="<?=$s_empresa?>"/>
      <input style="visibility:hidden" name="s_cargo" id="s_cargo" value="<?=$s_cargo?>"/> 
      
      <input style="visibility:hidden" name="nDiente" id="nDiente" value="<?=$nDiente?>"/> 
      <input style="visibility:hidden" name="caraDiente" id="caraDiente" value="<?=$caraDiente?>"/> 
      
      <input style="visibility:hidden" name="s_codEntidad" id="s_codEntidad" value="<?=$s_codEntidad?>"/>
      <input style="visibility:hidden" name="s_tipoCon" id="s_tipoCon" value="<?=$s_tipoCon?>"/>
      <input style="visibility:hidden" name="pc"        id="pc"        value="<?=$pc?>"/>
      <input style="visibility:hidden" name="trat"      id="trat"      value="<?=$e_tratamiento?>"/>
      <input style="visibility:hidden" name="viD"       id="viD"       value="<?=$viene?>"/>
   </div>

    <!--/////////////////////////////////////////////////////////////////////////////////
   ///////// tratamientos
   /////////////////////////////////////////////////////////////////////////////////-->

      <?php 
        //arma tabla de procedimientos elegidos
        $query = " SELECT B.cups, A.descripcion, B.observaciones " .
                 " FROM SIME_PROC_POS A, TEMPORAL_PR B ".
                 " WHERE A.cups = B.cups AND ". 
                 "       B.numTemporal = '$pc' ";     
        $result = mysql_query($query) or die('Consulta de procedimientos fallida: ' . mysql_error());
        
        $i=0;
        while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) 
        {
          $cup      = $line["cups"];
          $descr    = $line["descripcion"];
          $obsCup   = $line["observaciones"];
          
          
          echo("<table class='camposTabla' align='center' width='960' border='0' cellpading='0'>\n");
          //echo ("<form method='post' action='historiaClinica.php'>\n");
          if ($i==0)
          {// para mostrar titulos 
             echo ("<tr>\n");
                echo   ("<td class='titulosTabla' align='center' colspan='4'>LISTA DE PROCEDIMIENTOS - CUPS</td>\n");
             echo("</tr>\n");
             echo("<tr>\n");
                echo("<td width='15%'class='negrita'align='left'>C&oacutedigo Cups</td>\n");
                echo("<td width='43%' class='negrita'>Descripci&oacute;n</td>\n");
                echo("<td width='42%' class='negrita'>Observaciones</td>\n");
             echo("</tr>\n");
          }
          echo("<tr>\n");
            echo("<td width='15%' align='left'>$cup</td>\n");
            echo("<td width='43%' class='camposTabla' align='left'>$descr</td>\n");
            echo("<td width='42%' class='camposTabla' align='left'>$obsCup</td>\n");
          echo("</tr>\n");
          
          $i = $i+1;
        }//while 
        
        
        echo("</table>\n");
        // Liberar resultados
        mysql_free_result($result);
      ?>

   <!--/////////////////////////////////////////////////////////////////////////////////
   ///////// medicamentos
   /////////////////////////////////////////////////////////////////////////////////-->

      <?php 
        //arma tabla de medicamentos elegidos
         $query = " SELECT B.codMedPos, A.nombre, A.concentracion, B.observaciones" .
                  " FROM SIME_MED_POS A, SIO_MEDICAMENTOS B ".
                  " WHERE A.codigo = B.codMedPos AND ". 
                  "       B.numConsulta = '$pc' ";              
        $result = mysql_query($query) or die('Consulta de medicamentos fallida: ' . mysql_error());
        
        $i=0;
        echo("<table class='camposTabla' align='center' width='960' border='0' cellpading='0'>\n");
        while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
          $codMed    = $line["codMedPos"];
          $nomMed    = $line["nombre"];
          $nomMed    = $nomMed ." / " . $line['concentracion'];
          $observa   = $line["observaciones"];
       
          
             //echo ("<form method='post' action='historiaClinica.php'>\n");
              if ($i==0){// para mostrar titulos 
                 echo ("<tr>\n");
                   echo   ("<td class='titulosTabla' align='center' colspan='4'>LISTA DE MEDICAMENTOS</td>\n");
                 echo("</tr>\n");
                 echo("<tr>\n");
                  echo("<td width='15%' class='negrita'>Medicamento</td>\n");
                  echo("<td width='43%' class='negrita'>Nombre</td>\n");
                  echo("<td width='42%' class='negrita'>Observaciones</td>\n");
                echo("</tr>\n");
              }
          
          echo("<td width='15%' align='left'>$codMed</td>\n");
          echo("<td width='43%' class='camposTabla' align='left'>$nomMed</td>\n");
          echo("<td width='42%' class='camposTabla' align='left'>$observa</td>\n");
          echo("</tr>\n");
        
          $i = $i+1;
        }//while
      ?>

       <tr><td colspan="4"><hr width="100%"></td></tr>
        
        
      <?php 
        echo("</table>\n");
        // Liberar resultados
        mysql_free_result($result);
      ?>

    <?php
       //TRAE NOTA SI EXISTE
       $query="SELECT notas FROM SIO_NOTA_ADICIONAL WHERE numConsulta=$pc";
       $result   = mysql_query($query) or die('Consulta de notas fallida: ' . mysql_error());         
       $lineSer  = mysql_fetch_array($result, MYSQL_ASSOC); 
       $s_notas  = $lineSer['notas']; 
   
       if ($s_notas!="")
        {
        ?>
         <table class="camposTabla" align="center" border="0" width="960"> 
          <tr>
            <td class='titulosTabla' >NOTAS ADICIONALES</td>
          </tr>
          <tr>
           <td>
             <?=$s_notas?>
           </td>
          </tr>  
          <tr>
            <td colspan='3' class='camposTabla'><HR width=100% align='center'></td>
          </tr> 
         </table>
       <?php
        }
       ?>
 

   <script type="text/javascript">
      var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
    </script>

    <script type="text/javascript">
     function cambiarTr(){
        document.getElementById('realizado').checked=false;
     }
    </script>

    <script type="text/javascript">
     function abrirHijo() {
       
       var valor1 = document.getElementById("tipoId").value;  
       var valor2 = document.getElementById("idPaciente").value;
       
       alert(valor2);
       alert(valor1);
       //window.open("simeLstDg.php?v1="+valor1+"&v2="+valor2+" location=no,menubar=no,titlebar=no,resizable=no,toolbar=no, menubar=no,width=500,height=500");

        open("sioDetalleTrat.php?v1="+valor1+"&v2="+valor2+"",'','location=no,menubar=no,titlebar=no,resizable=no,toolbar=no, menubar=no, top=300,left=300,width=1200,height=300') ;
     }
    </script> 
   
  </body>
</html>    