
<?php

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

<link rel="stylesheet" type="text/css" href="styles/Style.css">
<?php
$con= mysqli_connect("$sql_host", "$sql_usuario", "$sql_pass") or die(header ("No Disponible Servidor de Base de Datos"));
mysqli_select_db($con,"$sql_db");

if(isset($_GET['esp'])){
$idesp=$_GET['esp'];
}
if(isset($_GET['tp'])){
$idtp=$_GET['tp'];
}
if(isset($_GET['idj'])){
$idj=$_GET['idj'];
}
if(isset($_GET['ids'])){
$ids=$_GET['ids'];
}
if(isset($_GET['tcont'])){
$tcont=$_GET['tcont'];
}
if(isset($_GET['tbusq'])){
$tbusq=$_GET['tbusq'];
}
if(isset($_GET['nombre'])){
$nombre=$_GET['nombre'];
}


if($tbusq==1){
if($ids==-1){
if($idesp!=0 and $idtp!=0 ){
	if($tcont==0){
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.tp_id='$idtp' and b.ua_idespec='$idesp' and (b.ua_estado= 1 or b.ua_estado= 2 or b.ua_estado= 4) and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}else{
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.tp_id='$idtp' and b.ua_idespec='$idesp' and (b.ua_estado= 1 or b.ua_estado= 2 or b.ua_estado= 4) and b.tc_idcont='$tcont' and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}
}elseif($idesp==0 and $idtp!=0){
	if($tcont==0){
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj'and b.tp_id='$idtp' and (b.ua_estado= 1  or b.ua_estado= 2 or b.ua_estado= 4) and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}else{
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.tp_id='$idtp' and (b.ua_estado= 1  or b.ua_estado= 2 or b.ua_estado= 4) and b.tc_idcont='$tcont' and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}
}elseif($idesp!=0 and $idtp==0){
	if($tcont==0){
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.ua_idespec='$idesp' and (b.ua_estado= 1  or b.ua_estado= 2 or b.ua_estado= 4) and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}else{
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.ua_idespec='$idesp' and (b.ua_estado= 1  or b.ua_estado= 2 or b.ua_estado= 4) and b.tc_idcont='$tcont' and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}
}else{
	if($tcont==0){
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and (b.ua_estado= 1  or b.ua_estado= 2 or b.ua_estado= 4) and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}else{
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and (b.ua_estado= 1  or b.ua_estado= 2 or b.ua_estado= 4) and b.tc_idcont='$tcont' and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}
	///finalizar
}}else{
if($idesp!=0 and $idtp!=0 ){
	if($tcont==0){
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.s_id='$ids'  and b.tp_id='$idtp' and b.ua_idespec='$idesp' and (b.ua_estado= 1 or b.ua_estado= 2 or b.ua_estado= 4) and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}else{
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.s_id='$ids'  and b.tp_id='$idtp' and b.ua_idespec='$idesp' and (b.ua_estado= 1 or b.ua_estado= 2 or b.ua_estado= 4) and b.tc_idcont='$tcont' and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}
}elseif($idesp==0 and $idtp!=0){
	if($tcont==0){
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.s_id='$ids'  and b.tp_id='$idtp' and (b.ua_estado= 1  or b.ua_estado= 2 or b.ua_estado= 4) and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}else{
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.s_id='$ids'  and b.tp_id='$idtp' and (b.ua_estado= 1  or b.ua_estado= 2 or b.ua_estado= 4) and b.tc_idcont='$tcont' and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}
}elseif($idesp!=0 and $idtp==0){
	if($tcont==0){
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.s_id='$ids' and b.ua_idespec='$idesp' and (b.ua_estado= 1  or b.ua_estado= 2 or b.ua_estado= 4) and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}else{
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.s_id='$ids' and b.ua_idespec='$idesp' and (b.ua_estado= 1  or b.ua_estado= 2 or b.ua_estado= 4) and b.tc_idcont='$tcont' and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}
}else{
	if($tcont==0){
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.s_id='$ids' and (b.ua_estado= 1  or b.ua_estado= 2 or b.ua_estado= 4) and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}else{
	$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and b.s_id='$ids' and (b.ua_estado= 1  or b.ua_estado= 2 or b.ua_estado= 4) and b.tc_idcont='$tcont' and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
	}
}
}}else{
$sqllistado = "select a.ug_id as cod, concat(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, (select s_abrev from tb_servicio where s_id=b.s_id and j_id=b.j_id ) as servicio, (select esp_desc from tb_especialidad ";
	$sqllistado = $sqllistado." where ua_idespec=b.ua_idespec) as especialidad, date_format(b.ud_fechaing,'%d/%m/%Y') as fingreso, (datediff(now(), b.ud_fechaing)) div 365 as tiempo, (select tc_abrev from tb_tipocont ";
	$sqllistado = $sqllistado." where tc_idcont=b.tc_idcont) as tipocontrato, (select tp_desc from tb_tipoperson where tp_id=b.tp_id) as tpersona from tb_usuasist a inner join tb_usudep b on ";
	$sqllistado = $sqllistado." a.ug_id = b.ug_id where b.j_id='$idj' and  (a.ua_apepat like '$nombre%' or  a.ua_apemat like '$nombre%' or a.ua_nom like '%$nombre%') and (b.ua_estado= 1  or b.ua_estado= 2 or b.ua_estado= 4) and b.s_id not in (SELECT s_id FROM tb_servicio where s_abrev='APOR' and j_id=b.j_id) order by nombre, especialidad";
}
//echo $sqllistado;
//echo $sqllistado;
//aumentar  a.tc_idcont='3'
$resultlistado = mysqli_query($con,$sqllistado);
$sumap=0;



$cadenalis="";
$cadenalis="<table align='center' class='FacetFormTABLE'><tr><td colspan='12'class='FacetFieldCaptionTDT' align='center'> PERSONAL ASISTENCIAL </td></tr>";
$cadenalis=$cadenalis."<tr><td class='FacetFieldCaptionTD' align='center' width='250'>APEDLLIDOS Y NOMBRES</td><td class='FacetFieldCaptionTD' align='center' width='100'>SERVICIO</td><td class='FacetFieldCaptionTD' align='center' width='130'>TIPO PERSONAL</td><td class='FacetFieldCaptionTD' align='center' width='130'>ESPECIALIDAD</td><td class='FacetFieldCaptionTD' align='center' width='130'>TIPO DE CONTRATO</td><td class='FacetFieldCaptionTD' align='center' width='100'>FECHA DE INGRESO</td><td class='FacetFieldCaptionTD' align='center' width='70'>PERIOD. LAB.</td><td class='FacetFieldCaptionTD' align='center'>DesMed</td><td class='FacetFieldCaptionTD' align='center'>VACAC</td><td class='FacetFieldCaptionTD' align='center'>DATOS</td><td class='FacetFieldCaptionTD' align='center'>PROG</td></tr>";
$a=1;
$muestra="";
while ($rowl= mysqli_fetch_array($resultlistado)){
$codigo = $rowl['cod'];
$muestra = $muestra."<input type='hidden' id='codper".$a."'  name='codper".$a."' value='".$codigo."'>";
//echo $codigo."<br>";
//$salida = (int)"4444k";
$cadenalis= $cadenalis."<tr><td align='left'>".utf8_encode($rowl['nombre'])."</td><td align='center'>".$rowl['servicio']."</td><td align='center'>".$rowl['tpersona']."</td><td align='center'>".$rowl['especialidad']."</td><td align='center'>".$rowl['tipocontrato']."</td><td align='center'>".$rowl['fingreso']."</td><td align='center'>".$rowl['tiempo']."</td><td align='center'> <a href='#' onClick='verdescansomedico($a)'><img src='img/heart_red.png' width='17' height='17' border='0'></a></td><td align='center'><a href='#' onClick=verdetallevacaprog($a); ><img src='img/eye.png' border='0'></a></td><td align='center'><a href='#' onClick=datospersonal($a);> <img src='img/book.png' width='17' height='17' id='person' border='0' ></a></td><td align='center'><a href='#' onClick=askprogramacion($a);> <img src='img/calendar.png' width='17' height='17' id='person' value='$codigo' border='0'></a></td></tr>";
//$cadenalis= $cadenalis." <a onClick='verdescansomedico($codigo)'><img src='img/heart_red.png' width='17' height='17' border='0'></a>";
$sumap = $sumap +1;
$a=$a+1;
}
$cadenalis=$cadenalis."<tr><td colspan='12' align='center'>El numero de Personal es ".$sumap."</td></tr>";
$cadenalis=$cadenalis."</table>";

echo $muestra;
echo $cadenalis;
?>
