<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

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

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

if(isset($_GET['idj']) && isset($_GET['ids']) && isset($_GET['idtp']) && isset($_GET['anno'])  && isset($_GET['mes'])){
$idj = $_GET['idj'];
$ids = $_GET['ids'];
$per = $_GET['idtp'];
$anno = $_GET['anno'];
$mm = $_GET['mes'];


//validar el boton de grabar
$sqlrepro="SELECT * FROM tb_usuaprueba  where uap_anno='$anno' and uap_mes='$mm' and s_id='$ids' and j_id='$idj' and uap_tipoproc='1'";
$sqleje="SELECT * FROM tb_usuaprueba  where uap_anno='$anno' and uap_mes='$mm' and s_id='$ids' and j_id='$idj' and uap_tipoproc='3'";
$sqlconval="select * from tb_usutrab where j_id='$idj' and s_id='$ids' and uap_anno='$anno' and uap_mes ='$mm' and tp_id='$per'";
//echo $sqlconval;
$resultconval = mysqli_query($conex,$sqlconval);
$resulteje = mysqli_query($conex,$sqleje);
$resultrepro = mysqli_query($conex,$sqlrepro);
$validarboton ="<table align='center'><tr><td colspan='2' align='center'><input type='button' class='llenarboton' value='Reprogramar' id='reprogramar' name='reprogramar' onClick='reprogramarpersonal()' ";
if(mysqli_num_rows($resultconval)==0 || mysqli_num_rows($resulteje)!=0  || mysqli_num_rows($resultrepro)==0 ){
$validarboton =$validarboton." class='llenarnoboton' disabled ";
}
}

/*
.llenarnoboton
{
	border: 1px solid; 
	background-color: #CCC; 
	font-size: 10px; 
	font-family: Verdana;
}
*/

if(isset($_GET['fecha'])){

$fecha = $_GET['fecha'];
//echo $fecha;
$idj = $_GET['idj'];
$ids = $_GET['ids'];

$dia=substr($fecha, 0, 2);
$mm=substr($fecha, 3, 2);
$anno=substr($fecha, 6, 4);

//validar el boton de grabar
$sqlrepro="SELECT * FROM tb_usuaprueba  where uap_anno='$anno' and uap_mes='$mm' and s_id='$ids' and j_id='$idj' and uap_tipoproc='1'";
$sqleje="SELECT * FROM tb_usuaprueba  where uap_anno='$anno' and uap_mes='$mm' and s_id='$ids' and j_id='$idj' and uap_tipoproc='3'";
$sqlconval="select * from tb_usutrab where j_id='$idj' and s_id='$ids' and uap_anno='$anno' and uap_mes ='$mm'";
//echo $sqlconval;
$resultconval = mysqli_query($conex,$sqlconval);
$resulteje = mysqli_query($conex,$sqleje);
$resultrepro = mysqli_query($conex,$sqlrepro);
$validarboton ="<table align='center'><tr><td colspan='2' align='center'><input type='button' value='Reprogramar' id='reprogramar' name='reprogramar' class='llenarboton' onClick='reprogramarpersonal()' ";
if(mysqli_num_rows($resultconval)==0 || mysqli_num_rows($resulteje)!=0 || mysqli_num_rows($resultrepro)==0 ){
$validarboton =$validarboton." class='llenarnoboton' disabled ";
}
}

$validarboton =$validarboton."></td></tr><tr><td align='center'><img src='../img/home.png' width='70' height='60' onClick='regresarMP()'></td></tr><tr><td align='center'><input type='button' class='llenarboton' value='Validar Reprogramaciones Realizadas' name='savereprog' id='savereprog' onClick='savereprog()'><br><br><input type='button' value='Consulta Faltas del Personal' name='consultafaltas' id='consultafaltas' class='llenarboton' onClick='consultafaltas()'></td></tr></table><br><br>";
echo $validarboton;
?>
</body>
</html>
