<?php
//session_start();
include("../../bd/sql_variables.php");
$con= mysqli_connect("$sql_host", "$sql_usuario", "$sql_pass","$sql_db") or die(header ("No Disponible Servidor de Base de Datos"));
//mysql_select_db("$sql_db");

date_default_timezone_set("America/Lima"); setlocale(LC_TIME,"es_PE.UTF-8");

$idj=$_GET['idj'];
$ids=$_GET['ids'];
//$ugid=$_GET['ugid'];
if(isset($_GET['tusu'])){
echo "<input type='hidden' id='tusu' name='tusu' value='1'>";
}else{
echo "<input type='hidden' id='tusu' name='tusu' value='0'>";
}
//echo $ugid;
//nombre de la jefatura
$sqljefatura = "select j_desc as nom from tb_jefatura where j_id='$idj'";
$resultjefatura = mysqli_query($con,$sqljefatura);
while ($rowj= mysqli_fetch_array($resultjefatura)){
$nomjefatura = $rowj['nom']; 
}
//nombre de servicio
$sqlserv = "select s_desc as nom from tb_servicio where j_id='$idj' and s_id='$ids'";
$resultserv = mysqli_query($con,$sqlserv);
while ($rows= mysqli_fetch_array($resultserv)){
$nomservicio = $rows['nom']; 
}
echo "<input type='hidden' id='idj' name='idj' value='".$idj."'>";
echo "<input type='hidden' id='ids' name='ids' value='".$ids."'>";
echo "<input type='hidden' id='ugid' name='ugid' value='".$ugid."'>";
//combo tipo de personal
$sqltpersonal = "select a.tp_id as cod, (select tp_desc from tb_tipoperson where tp_id=a.tp_id) as descripcion from tb_areatipopersona a where a.j_id='$idj' and a.s_id='$ids'";
//echo $sqltpersonal;
$resulttpersonal = mysqli_query($con,$sqltpersonal);
//$cadenatp="<select id='tipopersonal' name='tipopersonal'>";
$a=0;
$idtp="";
$cadenatp = "<select id='progtp' onchange='listarpersonalvaca();'>";
$cadenatp=$cadenatp."<option value='0' selected>TODOS</option>";
while ($rowtp= mysqli_fetch_array($resulttpersonal)){
$cadenatp=$cadenatp."<option value='".$rowtp['cod']."'";
if($a==0){
//$cadenatp=$cadenatp." selected ";
//$a=1;
//$idtp=$rowtp['cod'];
}
$cadenatp=$cadenatp." >".$rowtp['descripcion']."</option>";
}
$cadenatp=$cadenatp."</select>";

//combo tipo de vacaciones
$cbtipodrad="<select id='cbtpvaca' name='cbtpvaca' onchange='listarpersonalvaca();'>";
$cbtipodrad=$cbtipodrad."<option value='0' selected>PROGRAMADAS</option>";
$cbtipodrad=$cbtipodrad."<option value='1'>EJECUTADAS</option>";
$cbtipodrad=$cbtipodrad."<option value='2'>SUSPENDIDAS</option></select>";

$arraymes = array();
$arraymes[] = array('idmes'=>'1','mes'=>'ENERO');
$arraymes[] = array('idmes'=>'2','mes'=>'FEBRERO');
$arraymes[] = array('idmes'=>'3','mes'=>'MARZO');
$arraymes[] = array('idmes'=>'4','mes'=>'ABRIL');
$arraymes[] = array('idmes'=>'5','mes'=>'MAYO');
$arraymes[] = array('idmes'=>'6','mes'=>'JUNIO');
$arraymes[] = array('idmes'=>'7','mes'=>'JULIO');
$arraymes[] = array('idmes'=>'8','mes'=>'AGOSTO');
$arraymes[] = array('idmes'=>'9','mes'=>'SETIEMBRE');
$arraymes[] = array('idmes'=>'10','mes'=>'OCTUBRE');
$arraymes[] = array('idmes'=>'11','mes'=>'NOVIEMBRE');
$arraymes[] = array('idmes'=>'12','mes'=>'DICIEMBRE');

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>LISTADO DE DESCANSO POR RADIACION DEL PERSONAL </title>
<link rel="stylesheet" type="text/css" href="../../styles/Style.css">
<link rel="shortcut icon" href="logo.ico" type="image/x-icon">
<script language="JavaScript" type="text/javascript" src="ajax.js"></script>
<script language="JavaScript">
function vervacaciones(codigo)
{
window.open("../personal/vervacaciones.php?ugid="+codigo,"","height=300,width=600,scrollbars=NO");
}
function verdescandomedico(codigo)
{
//alert(codigo);
window.open("../personal/verdmedico.php?ugid="+codigo,"","height=300,width=600,scrollbars=NO");
}
function cerrarVentana(){
window.close();
}
</script>
</head>
<body>
<br>
<br>
<table align='center'>
<form action="menuprogramacion.php" method="GET">
<tr><td align='center' class='LlenarJefatura' width='400'><?php echo $nomjefatura;?></td></tr>
<tr><td align='center' class='LlenarServicio' width='400'><?php echo $nomservicio;?></td></tr>
</table>
<br>
<table align='center'>
<tr><td align='center' colspan='2' class='LlenarTablaGarea'>LISTADO DE DESCANSOS POR RADIACION</td></tr>
<tr><td width='100' class ='FacetDataTextC'>Tipo </td><td class ='FacetDataTextC' width='300'>
<?php echo $cbtipodrad;?>
</td></tr>
<tr><td width='100' class ='FacetDataTextC'>Personal</td><td class ='FacetDataTextC' width='300'>
<?php echo $cadenatp;?>
</td></tr>
<tr><td class ='FacetDataTextC'>A&ntilde;o</td>
<td class ='FacetDataTextC'>
<?php
echo "<select name='anno' id='anno' onchange='listarpersonalvaca();'>";
for ($i=2000;$i<2100;$i++){
echo "<option value='".$i."'";
if(date("Y",time())==$i){?> selected
<?php 
$anno=$i;
} echo ">".$i."</option>";
}
echo "</select>";
?>
</td></tr>
<tr><td class ='FacetDataTextC'>Mes</td><td class ='FacetDataTextC'>
<?php
echo "<select name='mes' id='mes' onchange='listarpersonalvaca();'>";
for ($i=0;$i<count($arraymes);$i++){
echo "<option value='".$arraymes[$i]['idmes']."'";
if(date("n",time())==$arraymes[$i]['idmes']){?> selected
<?php 
$mm=$i+1;
} echo ">".$arraymes[$i]['mes']."</option>";
}
echo "</select>";
?>
</td></tr>

</form>
</table>
<table></table>
<br>
<table align='center'><tr><td><img src='../img/reporte.png' width='40' height='40' onClick='reportarlistavaca()'></td><td><img src='../img/doorout.jpg' width='40' height='40' onClick='cerrarVentana()'></td></tr></table>
<center><div id="divlistapersonal">
<?php
$idj = $idj;
$ids = $ids;
$anno = $anno;
$mes = $mm;
$idtp = 0;
$tpvaca=0;
include("personaldescrad.php");
?>
</div></center>
</body>
</html>