<?php 

include("Funciones.php");
include("funcion/funciones.php");
include("clases/BDConexion.php");
include("clases/clsclinico.php");
$objclsclinico = new clsclinico;
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>EXAMEN FISICO - BARRETT RESOURCES</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stilos/Estilos.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo4 {font-size: 10px}
.Estilo9 {color: #FFFFFF}
.Estilo11 {color: #0000FF}
-->
</style>
<SCRIPT language=JavaScript src="js/calendario.js"></SCRIPT>
<SCRIPT LANGUAGE=javascript>
function fn(form,field)
{
var next=0, found=false
var f=form
if(event.keyCode!=13) return;
for(var i=0;i<f.length;i++) {
if(field.name==f.item(i).name){
next=i+1;
found=true
break;
}
}
while(found){
if( f.item(next).disabled==false && f.item(next).type!='hidden'){
f.item(next).focus();
break;
}
else{
if(next<f.length-1)
next=next+1;
else
break;
}
}
}
</SCRIPT>
<script>
function enviar_url(form,url){
	
	if (form1.fecha.value==""){
			alert("Debe Ingresar la Fecha.\n y es Obligatorio");
			return;	
	  						}
	if (form1.nombres.value==""){
			alert("Debe Ingresar el Nombre del Trabajador.\n y es Obligatorio. \n presiona Buscar o Nuevo");
			btn_ver1.focus();
			return;	
	  						}
	if(form1.grabar.value)
	{
		form1.submit();
	}
}
function volver(form){
  location.reload('fondo.php');
  }
</script>
<script language="JavaScript"> 
<!--
//sURL,x,y
function Abrir_Ventanapopup1(sURL,x,y) { 
/*var especificaciones="top=0, left=0, toolbar=no,location=no, status=yes,menubar=no,scrollbars=no, resizable=no, width=1,height=1" 
var titulo="Titulo"
window.open(el_url,titulo,especificaciones);*/ 

if (!window.focus) return;
			var par;
			par = "width=" +x + ",height="+y+","
			par = par + "dependent=no,scrollbars=yes,resizable=no"
			par = par + "menubar=no,toolbar=no,status=yes"
			var ventana = window.open(sURL,"Ver",par)
			ventana.focus();
}
//--> 
</script>
<script language="JavaScript"> 
<!--
//sURL,x,y
function Abrir_Ventanapopup2(sURL,x,y) { 
/*var especificaciones="top=0, left=0, toolbar=no,location=no, status=yes,menubar=no,scrollbars=no, resizable=no, width=1,height=1" 
var titulo="Titulo"
window.open(el_url,titulo,especificaciones);*/ 

if (!window.focus) return;
			var par;
			par = "width=" +x + ",height="+y+","
			par = par + "dependent=no,scrollbars=yes,resizable=no"
			par = par + "menubar=no,toolbar=no,status=yes"
			var ventana = window.open(sURL,"Ver",par)
			ventana.focus();
}
//--> 
</script>
<script language="JavaScript" type="text/JavaScript">
function MensajeEditar(m){
if (m==1){window.alert("Se Guardo la Condicion Clinica")}
if (m==2){window.alert("Ya! Existe Un Examen Fisico Registrado para el Trabajador")}
}
</script>
<script> 
function centrar() { 
    iz=(screen.width-document.body.clientWidth) / 2; 
    de=(screen.height-document.body.clientHeight) / 2-50; 
    moveTo(iz,de); 
}   
function Enviar(){
		if (form1.docid.value==""){
			alert("No Eligio el Trabajador");
			form1.btn_ver1.focus();
			return;		
		        }
		else{
			form1.submit();
		    }
          
		  }  
</script>
</head>

<?php

if($aler==1){
     echo "<body onLoad='MensajeEditar(1)' background='imagenes/fondo.jpg'> ";
	} 
else {
     if (empty($aler)){echo "<body background='imagenes/fondo.jpg'>";}
	 if($aler==2){echo "<body onLoad='MensajeEditar(2)'  background='imagenes/fondo.jpg'>";}

    }
?>
<?php 
if($param==1){

		$result=$objclsclinico->DevolverPersonalxDniNexa($docid);
		$fila = $objclsclinico->NextRow($result);
		$fechaExamed = $objclsclinico->DevolverFechaMed($docid);
		if ($fechaExamed <> 0) {
		                  $fechaExamed = extraerfechanormal($fechaExamed);}		
		 $fechavenciMed = suma_fechas($fechaExamed,365);
		 }

?>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0" >
  <tr class="lblCampo" >
    <td colspan="4"><div align="center">
        <table width="500" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>&nbsp;</td>
            <td valign="bottom">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td width="25"><img src="estilo_tabla/parte_sup_izq.gif" width="25" height="25"></td>
            <td width="409" background="estilo_tabla/parte_sup_cen.gif" valign="bottom">
              <div align="left" class="lblTitulo Estilo9" >Condici&oacute;n M&eacute;dica Personal Barrett </div></td>
            <td width="25"><img src="estilo_tabla/parte_sup_der.gif" width="25" height="25" border="0" usemap="#Map"></td>
          </tr>
          <tr>
            <td width="25" background="estilo_tabla/parte_med_izq.gif">&nbsp;</td>
            <td width="409" height="86" background="estilo_tabla/parte_med_cen.gif"><div align="center">
              <form action="procesos/grabar_condicionclini.php" method="post" name="form1">
                <table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="720" colspan="3"><table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                          <td height="1" colspan="3">&nbsp;</td>
                        </tr>
                        <tr bgcolor="#009900">
                          <td colspan="3" bgcolor="#D4D3CA"><div align="center" class="lblParrafo">
                          PERSONAL BARRETT 
                              
                          </div></td>
                        </tr>
                        <tr>
                          <td width="371"><table width="240" border="1" align="left" cellpadding="0" cellspacing="0">
                            <tr>
                              <td width="79" class="lblParrafo">C&oacute;digo</td>
                              <td width="155"><div align="left">
                                <input name="proyec" type="text" class="lblForm" id="proyec" value="<?=$fila['cod_per']?>" size="30" readonly>
</div></td>
                            </tr>
                          </table></td>
                          <td width="180" class="rdoBanners Estilo4">DOCUMENTO DE IDENTIDAD </td>
                          <td width="181" class="rdoBanners Estilo4"><span class="lblParrafo">
                            <input name="docid" type="text" class="lblForm" id="docid" value="<?=$docid?>" readonly>
                          </span></td>
                        </tr>
                        <tr>
                          <td colspan="3"><div align="left"><span class="lblSubTitulo">DATOS DE IDENTIFICACI&Oacute;N DEL TRABAJADOR
                                </legend>
                          </span> </div>                            </td>
                        </tr>
                        <tr>
                          <td colspan="3"><table width="720" border="3" cellpadding="2" cellspacing="0">
                            <tr>
                              <td><table width="720" border="0" align="left" cellpadding="0" cellspacing="0">
                                <tr>
                                  <td width="123" class="rdoBanners Estilo4">APELLIDO PATERNO </td>
                                  <td width="236"><div align="left">
                                      <input name="nombres" type="text" class="lblForm" id="nombres5" value="<?=$fila['appat_per']?>" size="45" readonly>
                                  </div></td>
                                  <td width="106" bordercolor="#009900"><input name="btn_ver1" type="button" class="botira" id="btn_ver15" style="<?=$stylo['st2']?>" value="Buscar" onClick="javascript:Abrir_Ventanapopup1('reg_clinico_ver5.php',465,300)" ></td>
                                  <td width="132" bordercolor="#009900"><div align="center">
                                    <input name="btn_Nuevo" type="button" class="botira" id="btn_Nuevo" style="<?=$stylo['st2']?>" value="Nuevo" onClick="javascript:Abrir_Ventanapopup2('cvp_personal5.php',800,300)" >
</div></td>
                                  <td width="123"><div align="center"><strong>FOTO</strong></div></td>
                                </tr>
                                <tr>
                                  <td class="rdoBanners Estilo4">APELLIDO MATERNO</td>
                                  <td><div align="left">
                                      <input name="fechanac" type="text" class="lblForm" id="fechanac5" onkeyup=fn(this.form,this) value="<?=$fila['apmat_per']?>" size="45" readonly >
                                    </div>
                                      <div align="center"></div></td>
                                  <td bgcolor="#D4D3CA" class="rdoBanners Estilo4"><div align="center">EDAD</div></td>
                                  <td class="rdoBanners Estilo4"><input name="expedida22" type="text" class="lblForm" id="expedida225" onKeyUp=fn(this.form,this) value="<?php if($param==1){echo exEdadMysql($fila['fnac_per']);}?>" size="15" readonly></td>
                                  <td rowspan="6" class="rdoBanners Estilo4"><table width="104" border="1" align="center" cellpadding="2" cellspacing="1">
                                      <tr>
									                                 <td width="100" height="133"><img src="<?php $ruta ="../../parametros/fotos_per/"; $foto=$fila['foto']; $fotodesc="desconocido.gif";
																     if(!file_exists($ruta.$foto)|| $foto==NULL){echo $ruta.$fotodesc;}
																	 else{ if(file_exists($ruta.$foto)){echo $ruta.$foto;}}					
										                             ?>" class="foto"></td>
                                      </tr>
                                    </table>
                                      <div align="center"></div></td>
                                </tr>
                                <tr>
                                  <td class="rdoBanners Estilo4">NOMBRES</td>
                                  <td><div align="left">
                                      <input name="edad" type="text" class="lblForm" id="edad5" onkeyup=fn(this.form,this) value="<?=$fila['nom_per']?>" size="45"  readonly>
                                  </div></td>
                                  <td bgcolor="#D4D3CA" class="rdoBanners Estilo4"><div align="center">FECHA NAC.</div></td>
                                  <td class="rdoBanners Estilo4"><input name="expedida23" type="text" class="lblForm" id="expedida235" onKeyUp=fn(this.form,this) value="<?php if($param==1){echo extraerfechanormal($fila['fnac_per']);}?>" size="15" readonly></td>
                                </tr>
                                <tr>
                                  <td class="rdoBanners">CARGO</td>
                                  <td><div align="left">
                                    <input name="doc_id3" type="text" class="lblForm" id="doc_id36" value="<?=$fila['cargo_per']?>" size="45" readonly>
                                      </div></td>
                                  <td bgcolor="#D4D3CA" class="rdoBanners Estilo4"><div align="center">FONO</div></td>
                                  <td class="rdoBanners Estilo4"><input name="expedida24" type="text" class="lblForm" id="expedida245" onKeyUp=fn(this.form,this) value="<?=$fila['fono_per']?>" size="15" readonly></td>
                                </tr>
                                <tr>
                                  <td class="rdoBanners">EMPRESA</td>
                                  <td><input name="doc_id4" type="text" class="lblForm" id="doc_id4" value="<?=$fila['razon_emp']?>" size="45" readonly></td>
                                  <td bgcolor="#D4D3CA" class="rdoBanners Estilo4"><div align="center">PESO Kg. </div></td>
                                  <td class="rdoBanners Estilo4"><input name="expedida25" type="text" class="lblForm" id="expedida255" onKeyUp=fn(this.form,this) value="<?=$fila['peso_per']?>" size="15" readonly></td>
                                </tr>
                                <tr>
                                  <td class="rdoBanners">&nbsp;</td>
                                  <td>&nbsp;</td>
                                  <td rowspan="2" bgcolor="#D4D3CA" class="rdoBanners Estilo4"><span class="rdoBanners">SEXO</span></td>
                                  <td class="rdoBanners Estilo4"><input name="sexo" type="radio" class="lblForm" value="M" <?php if (($fila['sexo']=='M')||($fila['sexo']=='m')){echo "checked";}?> disabled> 
                                    MASCULINO
</td>
                                </tr>
                                <tr>
                                  <td class="rdoBanners">&nbsp;</td>
                                  <td>&nbsp;</td>
                                  <td class="rdoBanners Estilo4"><input name="sexo" type="radio" class="lblForm" value="F" <?php if (($fila['sexo']=='F')||($fila['sexo']=='f')){echo "checked";}?> disabled>
FEMENINO<span class="rdoBanners"></span></td>
                                </tr>
                              </table></td>
                            </tr>
                          </table></td>
                        </tr>
                        <tr>
                          <td colspan="3"><div align="right">
                            </div>                            </td>
                        </tr>
                        <tr>
                          <td colspan="3"><table width="720" border="3" align="left" cellpadding="2" cellspacing="0">
                            <tr>
                              <td class="rdoBanners Estilo4"><table width="720" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td width="239"><div align="center">Fecha de Ex&aacute;men M&eacute;dico Pre Laboral </div></td>
                                  <td width="132"><div align="left">
                                    <input name="fechaExamed" type="text" class="lblForm" id="expedida256" onKeyUp=fn(this.form,this) value="<?=$fechaExamed?>" size="15" readonly>
                                    <a onMouseOver="window.status='Calendario';return true;" onMouseOut="window.status='';return true;"  href="javascript:show_calendar('form1.fechaExamed');"><img src="imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0"></a></div></td>
                                  <td colspan="2"><div align="center">Fecha de Vencimiento </div></td>
                                  <td width="164">                                    <input name="fechavenciMed" type="text" class="lblForm" id="expedida2523" onKeyUp=fn(this.form,this) value="<?=$fechavenciMed?>" size="15" readonly>                                    </td>
                                  <td width="48">&nbsp;</td>
                                </tr>
                                <tr>
                                  <td>&nbsp;</td>
                                  <td>&nbsp;</td>
                                  <td colspan="2">&nbsp;</td>
                                  <td>&nbsp;</td>
                                  <td>&nbsp;</td>
                                </tr>
                                <tr>
                                  <td><div align="right">CONDICION CLINICA </div></td>
                                  <td><span class="Estilo11">
                                    <input name="condicion" type="radio" class="lblForm" value="1" <?php if($fila['condicion_cli']=='1'){echo "checked";}?>> 
                                    APTO
                                  </span></td>
                                  <td width="110"><input name="condicion" type="radio" class="lblForm" value="0"  <?php if($fila['condicion_cli']=='0'){echo "checked";}?>>
                                    <span class="Estilo11">                                    INAPTO
                                    </span></td>
                                  <td width="27">&nbsp;</td>
                                  <td>&nbsp;</td>
                                  <td>&nbsp;</td>
                                </tr>
                              </table></td>
                              </tr>
                          </table></td>
                        </tr>
                        <tr>
                          <td colspan="3"><div align="center">                          </div>                            <div align="center">
                            <table width="730" border="1" cellspacing="2" cellpadding="1">
                              <tr>
                                <td width="363"><div align="center">
                                </div>                                  <div align="center">
                                    <input name="grabar" type="button" class="lblForm" id="grabar" value=".:   Grabar:." onClick="Enviar()">
                                  </div></td>
                                <td width="351"><div align="center">
                                  <input name="salir" type="button" class="lblForm" id="salir" value=".:   Salir  :." onClick="volver(this.form);">
                                </div></td>
                              </tr>
                            </table>
</div>                            <div align="center">                          </div></td>
                          </tr>
                    </table></td>
                  </tr>
                </table>
                <div align="center"></div>
              </form>
                </div></td>
            <td background="estilo_tabla/parte_med_der.gif">&nbsp;</td>
          </tr>
          <tr>
            <td><img src="estilo_tabla/parte_inf_izq.gif" width="25" height="25"></td>
            <td background="estilo_tabla/parte_inf_cen.gif">&nbsp;</td>
            <td><img src="estilo_tabla/parte_inf_der.gif" width="25" height="25"></td>
          </tr>
        </table>
    </div></td>
  </tr>
  <tr valign="top" class="lblCampo" >
    <td colspan="4">
      <div align="center"> </div></td>
  </tr>
</table>
<map name="Map">
  <area shape="circle" coords="10,12,9" href="fondo.php">
</map>
</body>
</html>
