<html>
<head>
<link rel="stylesheet" type="text/css" href="../styles/Style.css">
<script language="JavaScript" type="text/javascript" src="ajax.js"></script>
</head>
<body>
<?php

include("../bd/sql_variables.php");
$db_conexion= mysql_connect("$sql_host", "$sql_usuario", "$sql_pass") or die(header ("No Disponible Servidor de Base de Datos"));
mysql_select_db("$sql_db");

//$anno= 2011;
//$mes=9;
$idj=1;
$ids=1;
//$idtp=1;
$ugid="JEF1";


//echo $ugid;
//nombre de la jefatura
$sqljefatura = "select j_desc as nom from tb_jefatura where j_id='$idj'";
$resultjefatura = mysql_query($sqljefatura);
while ($rowj= mysql_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 = mysql_query($sqlserv);
while ($rows= mysql_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='anno' name='anno' value='".$anno."'>";
//echo "<input type='hidden' id='mes' name='mes' value='".$mes."'>";
//echo "<input type='hidden' id='idtp' name='idtp' value='".$idtp."'>";
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 = mysql_query($sqltpersonal);
//$cadenatp="<select id='tipopersonal' name='tipopersonal'>";
$a=0;
$idtp="";
$cadenatp = "<select id='progtp' onchange='listarpersonalrepro();'>";
while ($rowtp= mysql_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>";

$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');

?>
<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'>Anno</td>
<td class ='FacetDataTextC'>
<?php
echo "<select name='anno' id='anno' onchange='listarpersonalrepro();'>";
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='listarpersonalrepro();'>";
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>

<div id='divrepropersonal'>
<?php
//echo "<meta http-equiv='refresh' content='60'>";
$anno= date("Y",time());
$mes= date("n",time());
$idj=$idj;
$ids=$ids;
$idtp=$idtp;
$ugid=$ugid;
include("reprogramacionper.php");
?>
</div>
</body>
</html>