<?php

require_once("../class/class.conectar.php");

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

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

$ugid=$_GET['ugid'];

//nombre del  personal
$sqlp = "select concat(ua_apepat,' ',ua_apemat,' ',ua_nom) as nombre from tb_usuasist where ug_id='$ugid'";
//echo $sqltc;
$resultp = mysqli_query($conex,$sqlp);
while ($rowp= mysqli_fetch_array($resultp)){
$nombre = $rowp['nombre'];
}

$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><title>CONSULTA DE TURNOS PROGRAMADOS</title>
<link rel="stylesheet" type="text/css" href="../styles/Style.css">
<script type="text/javascript"> 
function agregarpersonal(){
	//var idj = document.getElementById("depa").value;
	//var ids = document.getElementById("serv").value;
	var ugid = document.getElementById("ugid").value;
	var anno = document.getElementById("anno").value;
	var mes = document.getElementById("mes").value;
	var tipo = document.getElementById("tipo").value;
	if(tipo==1){
	var cadena = "../reporte/programacionindividual.php?anno="+anno+"&mes="+mes+"&ugid="+ugid;
	}
	if(tipo==2){
	var cadena = "../reporte/reprogramacionindividual.php?anno="+anno+"&mes="+mes+"&ugid="+ugid;
	}
	if(tipo==3){
	var cadena = "../reporte/ejeprogramacionindividual.php?anno="+anno+"&mes="+mes+"&ugid="+ugid;
	}
	//alert(cadena);
    window.open(cadena,"","height=700,width=1200,scrollbars=YES");
}
</script>
</head>
<body>
<br>
<?php
echo "<input type='hidden' id='ugid' name='ugid' value='".$ugid."'>";
?>
<table align='center'>
<tr><td align='center' colspan='2' class='LlenarTablaGarea'>BUSCAR TURNOS PROGRAMADOS</td></tr>
<tr><td width='80' class ='FacetDataTextC'>Personal</td><td class ='FacetDataTextC' width='200'><b>
<?php echo $nombre;?></b>
</td></tr>
<tr><td class ='FacetDataTextC'>Anno</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>
<tr><td class ='FacetDataTextC'>Tipo</td><td class ='FacetDataTextC'>
<select name='tipo' id='tipo'>
<option value='1'>PROGRAMADO</option>
<option value='2'>REPROGRAMADO</option>
<option value='3'>EJECUTADO</option>
</select>
</td></tr>
<tr><td ></td><td >
<input type='button' value='Consultar' onClick='agregarpersonal()'>
</td></tr>
</table>
</body>
</html>