
<?php

include("../../../class/class.conectar.php");
include("../../../class/class.blkpersonal2.php");
include("../../../class/class.vacaciones.php");
?>

<!--link rel="stylesheet" type="text/css" href="../../styles/Style.css"-->
<?php

		if(isset($_GET['idj'])){
			$idj=$_GET['idj'];
		}
		if(isset($_GET['ids'])){
			$ids=$_GET['ids'];
		}
		if(isset($_GET['idtp'])){
			$idtp=$_GET['idtp'];
		}
		if(isset($_GET['idtc'])){
			$tcont=$_GET['idtc'];
		}
		if(isset($_GET['per'])){
			$per=$_GET['per'];
		}

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


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

$Objcon = new Conectar();
$conex = $Objcon->con();

$Obj_b = new BlkPersonal();
$res_b = array();
$res_b = $Obj_b->buscar_detpersonal_activo($conex,$idj,$ids,$idtp,$tcont,$nom);

$cadenalis="";
$cadenalis="<table align='center' class='FacetFormTABLE'><tr><td colspan='11'class='FacetFieldCaptionTDT' align='center'> PERSONAL ASISTENCIAL </td></tr>";
$cadenalis=$cadenalis."<tr><td class='FacetFieldCaptionTD' align='center' width='250'>APELLIDOS Y NOMBRES</td>";
$cadenalis=$cadenalis."<td class='FacetFieldCaptionTD' align='center' width='130'>SERVICIO</td>";
$cadenalis=$cadenalis."<td class='FacetFieldCaptionTD' align='center' width='130'>TIPO PERSONAL</td>";
$cadenalis=$cadenalis."<td class='FacetFieldCaptionTD' align='center' width='130'>ESPECIALIDAD</td>";
$cadenalis=$cadenalis."<td class='FacetFieldCaptionTD' align='center' width='130'>TIPO DE CONTRATO</td>";
$cadenalis=$cadenalis."<td class='FacetFieldCaptionTD' align='center' width='100'>FECHA DE INGRESO</td>";
$cadenalis=$cadenalis."<td class='FacetFieldCaptionTD' align='center' width='70'>PERIODO</td>";
$cadenalis=$cadenalis."<td class='FacetFieldCaptionTD' align='center' width='50'>VAC. PROG</td>";
$cadenalis=$cadenalis."<td class='FacetFieldCaptionTD' align='center' width='50'>VAC. EJE</td>";
$cadenalis=$cadenalis."<td class='FacetFieldCaptionTD' align='center' width='50'>ESTADO</td>";
$cadenalis=$cadenalis."<td class='FacetFieldCaptionTD' align='center'>VER DET.</td></tr>";

$muestra="";

for($a=0;$a<count($res_b);$a++){
$codigo = $res_b[$a]['cod'];
$vacaprog=0;
$muestra = $muestra."<input type='hidden' id='codper".$a."'  name='codper".$a."' value='".$codigo."'>";
$cadenalis= $cadenalis."<tr><td align='left'>".utf8_encode($res_b[$a]['nombre'])."</td>";
$cadenalis= $cadenalis."<td align='center'>".$res_b[$a]['servicio']."</td>";
$cadenalis= $cadenalis."<td align='center'>".$res_b[$a]['tpersona']."</td>";
$cadenalis= $cadenalis."<td align='center'>".$res_b[$a]['especialidad']."</td>";
$cadenalis= $cadenalis."<td align='center'>".$res_b[$a]['tipocontrato']."</td>";
$cadenalis= $cadenalis."<td align='center'>".$res_b[$a]['fingreso']."</td>";
$cadenalis= $cadenalis."<td align='center'>".$per."</td>";
$cadenalis= $cadenalis."<td align='center' colspan='3'>";

$cadenalis= $cadenalis."<div id='div".$codigo."'><table border='0'></tr>";

	$Obj_vp = new Vacaciones();
	$res_vp = array();
	$res_vp=$Obj_vp->aks_vacaciones($conex,$codigo,$per,0);
	if(count($res_vp)>0){
		if($res_vp[0]['suma']==$res_vp[0]['numdias']){
			$cadenalis=$cadenalis."<td align='center' width='50'><img src='../../img/b_check.png' width='17' height='17' border='0' ></td>";
			$vacaprog=1;
		}else{
			$cadenalis=$cadenalis."<td align='center' width='50'><img src='../../img/b_drop.png' width='17' height='17' border='0' ></td>";
		}
	}else{
	$cadenalis=$cadenalis."<td align='center' width='50'><img src='../../img/b_drop.png' width='17' height='17' border='0' ></td>";
	}

	//vacaciones ejecutadas
	$Obj_ve = new Vacaciones();
	$res_ve = array();
	$res_ve=$Obj_ve->aks_vacaciones($conex,$codigo,$per,1);
	if(count($res_ve)>0){
		if($res_ve[0]['suma']==$res_ve[0]['numdias']){
				$cadenalis=$cadenalis."<td align='center' width='50'><img src='../../img/b_check.png' border='0'></td>";
				$vacaprog=1;
		}else{
			$cadenalis=$cadenalis."<td align='center' width='50'><img src='../../img/b_drop.png' border='0'></td>";
		}
	}else{
	$cadenalis=$cadenalis."<td align='center' width='50'><img src='../../img/b_drop.png' border='0'></td>";
	}

	if($vacaprog==1){
		$cadenalis=$cadenalis."<td align='center' width='50'><input type='hidden' id='vacdet".$a."' value='".$codigo."'><img src='../../img/b_green.png' width='17' height='17' border='0' ></td>";
	}else{
		$cadenalis=$cadenalis."<td align='center' width='50'><input type='hidden' id='vacdet".$a."' value='".$codigo."'><img src='../../img/b_red.png' width='17' height='17' border='0' ></td>";
	}
	$cadenalis= $cadenalis."</table></div>";
	$cadenalis= $cadenalis."</td>";
	$cadenalis=$cadenalis."<td align='center'><input type='hidden' id='vacdet".$a."' value='".$codigo."'><a href='#' onClick='ver_detallevaca($a);'><img src='../../img/b_ver.png' width='17' height='17' border='0' ><a/></td>";
}
$sumap = count($res_b);
$cadenalis=$cadenalis."<tr><td colspan='11' align='center'>El numero de Personal es ".$sumap."</td></tr>";
$cadenalis=$cadenalis."</table>";

echo $muestra;
echo $cadenalis;
?>
