
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles/Style.css">
<script language="JavaScript" type="text/javascript" src="ajax.js"></script>

<script type="text/javascript"> 

function capturacodigo(codigo){

//document.location= "personal/editarnuevopersonal.php?ugid="+codigo;
window.open("personal/editarnuevopersonal.php?ugid="+codigo,"","height=550,width=480,scrollbars=YES")
}
function ventanaClose(){ 
   //alert("hola mundo");
    window.close();
}
</script> 
<title>BUSCANDO AL PERSONAL ASISTENCIAL</title>
</head>
<body id="lista" name="lista" onload='abrirpagina()'>
<?php

include("bd/sql_variables.php");

include("paginacion/config_newpag.php");
include("paginacion/my_pagina_class.php");
define("NUM_ROWS",'10');
define("NUM_LINKS",'10');

$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");

//construytento listado

if(isset($_GET['nombre'])){
$nombre=$_GET['nombre'];

$_pagi_sql = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select j_abrev from tb_jefatura where j_id=b.j_id) as jefatura, (select s_abrev from tb_servicio where j_id=b.j_id and s_id=b.s_id) as servicio from tb_usuasist a inner join tb_usudep b on ";
//$_pagi_sql = $_pagi_sql."  a.ug_id = b.ug_id where a.ua_estado= 2 and concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) like '$nombre%' order by nombre";
$_pagi_sql = $_pagi_sql."  a.ug_id = b.ug_id where a.ua_estado= 2 and  (a.ua_apepat like '$nombre%' or  a.ua_apemat like '$nombre%' or a.ua_nom like '$nombre%') order by nombre";
}else{

$_pagi_sql = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select j_abrev from tb_jefatura where j_id=b.j_id) as jefatura, (select s_abrev from tb_servicio where j_id=b.j_id and s_id=b.s_id) as servicio from tb_usuasist a inner join tb_usudep b on ";
$_pagi_sql = $_pagi_sql."  a.ug_id = b.ug_id where a.ua_estado= 2 order by nombre";
}
//echo $_pagi_sql."<br>";
//$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.s_id='$ids' and b.tp_id=1 and a.ua_idespec='2'";
//echo $sqllistado;
//$resultlistado = mysql_query($sqllistado);
//$sumap=0;
//////

//////
?>
<div id='divbuscapersonal' onload='abrirpagina()'>
<br><br>
<table align='center'>
<tr><td colspan='4'class='FacetFieldCaptionTDT' align='center'><b><font size='4'>REGISTRO DEL NUEVO PERSONAL ASISTENCIAL</font></b></td></tr>
<tr><td colspan='4'>
<table><tr><td>
BUSCAR X APELLIDOS <input type='text' size='60' id='txtnombre' name='txtnombre' onkeyPress='buscarpersonalnuevo()' value='<?php if(isset($_GET['nombre'])){ echo $_GET['nombre'];}?>'></td><td align='center'><a href='login.php'> Regresar </a></td></tr></table></td></tr>
<tr><td colspan='4'>
<fieldset>
	<legend align='left'><font color='blue'>Listado del Personal Asistencial</font></legend>
	<br>
	
	<table align='center' class='FacetFormTABLE'>
	<tr><td colspan='4'class='FacetFieldCaptionTDT' align='center'> PERSONAL ASISTENCIAL </td></tr>
	<tr><td class='FacetFieldCaptionTD' align='center' width='250'>APELLIDOS Y NOMBRES</td><td class='FacetFieldCaptionTD' align='center' width='130'>AREA / DEPARTAMENTO </td><td class='FacetFieldCaptionTD' align='center' width='130'>SERVICIO</td><td class='FacetFieldCaptionTD' align='center' width='130'>EDITAR</td></tr>
	<?php
	$test = new MyPagina;
       $test->sql = $_pagi_sql;
       $result = $test->get_page_result(); 
       $num_rows = $test->get_page_num_rows();  
       $nav_links = $test->navigation(" | ", "currentStyle"); 
	   $nav_info = $test->page_info("al"); 
       $simple_nav_links = $test->back_forward_link(); 
       $total_recs = $test->get_total_rows(); 


		if ($total_recs>=1)
	   {
		 $i = 0;
		 do
   		 {
		 $cod = mysql_result($result, $i, "cod");
		 $nombre = mysql_result($result, $i, "nombre");
   		 $jefatura = mysql_result($result, $i, "jefatura");
         $servicio = mysql_result($result, $i, "servicio");
		 

		echo "<tr><td>".$nombre."</td><td align='center'>".$jefatura."</td><td align='center'>".$servicio."</td><td align='center'><img src='personal/img/b_edit.png' value='$cod' onClick='capturacodigo(this.value)'></td></tr>";

		$i++;
  		}while($i < $num_rows);}
  
echo "</table><br>";

echo "<table align='center' class='FacetFormTABLE'><tr><td colspan='4' class='FacetFieldCaptionTD' align='center'><center>";
 if ((isset($total_recs))&&($total_recs>=1)){ echo ' Registros(s) del '.$nav_info.' de '.$total_recs.' encontrado(s).' ;}else{ echo '0 Registros(s) encontrado(s).';} 
 echo "</center></td></tr><tr><td colspan='4' class='FacetFieldCaptionTD' align='center'><center>";
 if (isset($total_recs)){ echo $nav_links; }
echo "</center></td></tr></table>"; 
	?>
	
	</div>
	</fieldset>
</td></tr>
</table>
</body>
</html>