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

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

//echo $_pagi_sql;
?>
<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'>AGREGAR</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>"; 
?>

	
	