<?php
require_once("../class/class.conectar.php");
require_once("../class/class.jefaturas.php");
require_once("../class/class.tipopersonal.php");
require_once("../class/class.usudep.php");

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

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

$idj=$_GET['idj'];
$ids=$_GET['ids'];
$ugid=$_GET['ugid'];

//nombre de la jefaturas
$Objj = new Jefaturas();
$res_jef = array();$res_serv = array();
$res_jef=$Objj->buscar_jefatura($conex,$idj);
$nomjefatura=$res_jef[0]['nom'];
if($ids!=0){
$res_serv=$Objj->buscar_jefatura_servicio($conex,$idj,$ids);
$nomservicio=$res_serv[0]['nom'];
}else{
$nomservicio="";
}

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
$Objtp = new TipoPersonal();
$res_tp=array();
$res_tp=$Objtp->buscar_tipoper_dep($conex,$idj,$ids);
//print_r($res_tp);

$a=0;
$idtp="";
$cadenatp = "<select id='progtp' onchange='mostrarpersonal();'>";
for($i=0;$i<sizeof($res_tp);$i++){
$cadenatp=$cadenatp."<option value='".$res_tp[$i]['id']."'";
if($a==0){
$cadenatp=$cadenatp." selected ";
$a=1;
$idtp=$res_tp[$i]['id'];
}
$cadenatp=$cadenatp." >".$res_tp[$i]['nom']."</option>";
}
$cadenatp=$cadenatp."</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>SIPA - SISTEMA INTEGRADO DE LA PROGRAMACION ASISTENCIAL</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(id)
{
var codigo = document.getElementById("codp"+id).value;
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'>MES A PROGRAMAR</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='mostrarpersonal();'>";
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='mostrarpersonal();'>";
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><br>

<center><div id="divlistapersonal">
<?php

$idj = $idj;
$ids = $ids;
$idtp = $idtp;
$anno = $anno;
$mm = $mm;

include("listarpersonal.php");

?>
</div></center>
</body>
</html>