<?php
include("../bd/sql_variables.php");

$db_conexion= mysql_connect("$sql_host", "$sql_usuario", "$sql_pass") or die(header ("No Disponible Servidor de Base de Datos"));
mysql_select_db("$sql_db");

$ugid = $_GET['ugid'];

$sqlpersonal="select a.ug_id as coduni, a.ua_dni as dni, a.ua_password as psw, a.ua_apepat as apepat, a.ua_apemat as apemat, a.ua_nom as nom, a.ua_numplanilla as numpla, a.ua_codprog as codprog, a.ua_telef1 as telef1,"; 
$sqlpersonal=$sqlpersonal."a.ua_telf2 as telf2, a.ua_cel1 as cel1, a.ua_cel2 as cel2, a.ua_celotro as celo, a.ua_direc as direc, a.ua_mail as mail, date_format(a.ua_fechanac, '%d/%m/%Y') as fechanac, a.ua_estcivil as estcivil, a.ua_numcoleg as numcol, a.ua_numesp as numesp,";
$sqlpersonal=$sqlpersonal."a.ua_estado as estado, (select tc_abrev from tb_tipocont where tc_idcont=a.tc_idcont) as tcabrev, (select c_desc from tb_cargo where c_id=a.c_id) as cargo from tb_usuasist a where a.ug_id='$ugid'";
//$sqlpersonal=$sqlpersonal."inner join tb_cargo c on a.c_id=c.c_id where a.ua_dni='$dni1' and a.ua_password='$password'";
//echo $sqlpersonal;
$resultarea = mysql_query($sqlpersonal);
while ($row= mysql_fetch_array($resultarea)){
$coduni=$row['coduni'];
$dni=$row['dni'];
$pasw=$row['psw'];
$apepat=$row['apepat'];
$apemat=$row['apemat'];
$nom=$row['nom'];
$numpla=$row['numpla'];
$codprog=$row['codprog'];
$telef1=$row['telef1'];
$telef2=$row['telef2'];
$cel1=$row['cel1'];
$cel2=$row['cel2'];
$celo=$row['celo'];
$direc=$row['direc'];
$mail=$row['mail'];
$fechanac=$row['fechanac'];
if($fechanac=="00/00/0000"){
$fechanac="dd/mm/aaaa";
}
$estcivil=$row['estcivil'];
$numcol=$row['numcol'];
$numesp=$row['numesp'];
$estado=$row['estado'];
$tcabrev=$row['tcabrev'];
$cargo=$row['cargo'];
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles/Style.css">
<title>REGISTRO DEL NUEVO PERSONAL ASISTENCIAL</title>
<script language="JavaScript" type="text/javascript" src="ajax.js"></script>
<script type="text/javascript"> 
function ventanaClose(){ 
   //alert("hola mundo");
    window.close();
}
</script>
</head>

<body>
<form action='' >
<table align='center' class='FacetFormTABLE'>
<tr><td colspan='2'align='center' class='FacetFieldCaptionTD'><b><font color='blue'>DATOS DEL PERSONAL ASISTENCIAL</font></b></td></tr>
<?php
$error=$_GET['error'];
if($error =="1"){
echo "<tr><td colspan='2'  align='center'><font color='red'>LOS PASSWORDS NO SON IGUALES</font></td></tr>";
}
echo "<input type='hidden' id='ugid' name='ugid' value='".$ugid."'>";
?>
<br>
<tr><td colspan='2' align='center'>
<table align='center' class='FacetFormTABLE'>
<tr><td class='FacetFieldCaptionTD' width='110'>DNI</td><td width='250' ><input type='text' id='dni' class='FacetInput' maxlength='8' value='<?php echo $dni;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>PASSWORD</td><td><input type='password' id='pasw' class='FacetInput' maxlength='18' size='30' value='<?php echo $pasw;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>REP PASSWORD</td><td><input type='password' id='rpasw' class='FacetInput' maxlength='18'size='30'></td></tr>
</table>
<br>
<table align='center' class='FacetFormTABLE'>
<tr><td class='FacetFieldCaptionTD'width='110'>APE. PATERNO</td><td width='250'><input type='text' id='apep' class='FacetInput' size='30' value='<?php echo $apepat;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>APE. MATERNO</td><td><input type='text' id='apem'class='FacetInput' size='30' value='<?php echo $apemat;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>NOMBRES</td><td><input type='text' id='nom' class='FacetInput' size='40' value='<?php echo $nom;?>'></td></tr>
</table>
<br>
<table align='center' class='FacetFormTABLE'>
<tr><td class='FacetFieldCaptionTD' width='110'>DIRECCION</td><td width='250'><input type='text' id='direc' size='55' maxlength='90' class='FacetInput' value='<?php echo $direc;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>FECHA DE NAC.</td><td><input type='text' id='fnac' size='20' class='FacetInput' value='<?php echo $fechanac;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>ESTADO CIVIL</td><td><input type='text' id='ecivil' size='25' class='FacetInput' value='<?php echo $estcivil;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>CORREO</td><td><input type='text' id='mail' size='45' class='FacetInput' value='<?php echo $mail;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>TELEFONO 1</td><td><input type='text' id='telf1' size='20' class='FacetInput' value='<?php echo $telef1;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>TELEFONO 2</td><td><input type='text' id='telf2' size='20' class='FacetInput' value='<?php echo $telef2;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>CELULAR 1</td><td><input type='text' id='cel1' size='20' class='FacetInput' value='<?php echo $cel1;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>CELULAR 2</td><td><input type='text' id='cel2' size='20' class='FacetInput' value='<?php echo $cel2;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>OTRO CEL</td><td><input type='text' id='ocel' size='20' class='FacetInput' value='<?php echo $celo;?>'></td></tr>
</table><br>
<table align='center' class='FacetFormTABLE'>
<tr><td class='FacetFieldCaptionTD' width='110'>NUM PLANILLA</td><td width='250'><input type='text' id='nplan' size='20' class='FacetInput' maxlength='8' value='<?php echo $numpla;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>NUM COLEGIATURA</td><td><input type='text' id='ncol' size='20' class='FacetInput' maxlength='8' value='<?php echo $numcol;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>NUM ESPECIALIDAD</td><td><input type='text' id='nesp' size='20' class='FacetInput' maxlength='8' value='<?php echo $numesp;?>'></td></tr>
<tr><td class='FacetFieldCaptionTD'>TIPO DE CONTRATO</td><td><?php echo $tcabrev;?>'</td></tr>
</table>
</td></tr>
<tr><td align='center'><input type='button' value='Grabar'id='save' onCLick='GrabardatosNuevoPersonal()' class='FacetButton'></td><td align='center'><input type='button' value='Cancelar' onCLick='ventanaClose()' id='cancel' class='FacetButton'></td></tr>
</table>
</form>
</body>
</html>