<!DOCTYPE html>
<html lang="es-ES">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Parametros Reporte Historial</title>
<link href="../../maincss.css" rel="stylesheet" type="text/css" />
<link href="../../chosen/chosen.css" rel="stylesheet" />
<link href="../../tcal.css" rel="stylesheet" type="text/css" />
<!--
<script language="javascript" src="js/jquery-1.3.min.js"></script>
-->
<script language="javascript" src="../../js/tcal.js" type="text/javascript"></script>
<script language="javascript" src="../../js/jquery-3.4.1.js"></script>
<script type="text/javascript" src="../../chosen/chosen.jquery.js"></script>
<script language="javascript" src="../../js/validar.js"></script>

<script language="javascript">
	$(document).ready(function(){
		$("#cbx_moduloelegido1").change(function () {
			$("#cbx_moduloelegido1 option:selected").each(function () {
				moduloelegido1 = $(this).val();
				$.post("moduloelegido1.php", { moduloelegido1: moduloelegido1 }, function(data){
					$("#cbx_moduloelegido2").html(data);
				});            
			});
		})
	});
</script>


</head>
<?php

include "../../conn.php";
include "../../general.php";
include "../../token.php";

//$usuario = $_GET["user"];
?>
<body>

	<?php
	
//Inicio reporte historial


//obtener el nivel del usuario
$resultnivel = mysqli_query($link, "select codType as nivel 
from accUser
where 
fldLogin = '$usuario' and
sysEnabled = 1 and sysAuthorized = 1;");
while ($row = mysqli_fetch_array($resultnivel)) {
	$nivel_usuario = $row['nivel'];
}
mysqli_free_result($resultnivel);

//listado de usuarios
$result = mysqli_query($link, "select a.pkyUser as cod_user, a.codType as cod_nivel, b.fldName as nivel, a.fldLogin as usuario
from
accUser a, accUserType b
where
a.codType >= '$nivel_usuario' and 
a.codType = b.pkyUserType and 
a.sysEnabled = 1 and a.sysAuthorized = 1 
order by usuario;");
/*
//listado de modulos
$result2 = mysqli_query($link, "select distinct txtModuleDescription as modulo
from
srvComponent
order by modulo;");
*/
?>
<table border="0" align="left" width="100%" cellpadding="5">
<tr><td><b>Empresa: <?php echo $nombre_empresa; ?><br/>NIT: <?php echo $mi_nit; ?></b>
</td><td align="right"><b>Fecha: <?php echo date("Y-m-d"); ?><br/>Hora: <?php echo date("H:i:s"); ?><br/>Usuario: <?php echo $usuario; ?><br/>F</b>
</td></tr></table><br/>
<table border="0" align="center" cellpadding="5"><tr><td colspan="2" align="center">
<b>Par&aacute;metros Reporte Historial</b></td></tr><tr><td>
<form id="miform" name="miform" method="post" action="report.php?rep=6&tipo=1" onsubmit="return Validar()">
<br/><b>Usuario: </b></td><td> <br/><input type="text" name="usuario" value="<?php echo $usuario; ?>" size="20" readonly="readonly" class="formulario" style="color:#999;">
<input type="hidden" name="token" value="<?php echo $token; ?>">
</td></tr><tr><td>

<br/><b>Usuario: </b></td><td> <br/><!--<SELECT NAME="usuario_lista" class="formulario">-->
	<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="usuario_lista">
    <option value="0">Todos</option>
	<?php 
	while ($row = mysqli_fetch_array($result)) {   
	?> 
	<option value="<?php echo $row['cod_user']?>"><?php echo $row['usuario']?></option> 
	<?php 
	}  
	mysqli_free_result($result);
	?> 
    </SELECT>
</td></tr><tr><td>

<br/><b>De Fecha: </b></td><td> <br/><div><input type="text" id="fechaini" name="fechaini" value="<?php echo $fechaini_gest; ?>" length="10" maxlength="10" class="tcal" title="aaaa-mm-dd"> </div>aaaa-mm-dd
</td></tr><tr><td>
<br/><b>A Fecha: </b></td><td> <br/><div><input type="text" id="fechafin" name="fechafin" value="<?php echo $fecha_hoy; ?>" length="10" maxlength="10" class="tcal" title="aaaa-mm-dd"> </div>aaaa-mm-dd
</td></tr><tr><td>

<br/><b>M&oacute;dulo: </b></td><td> <br/><!--<SELECT NAME="modulo" id="combo1" class="formulario">-->
<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="modulo" id="cbx_moduloelegido1">
<?php
$query = "select distinct txtModuleDescription as modulo
from
srvComponent
order by modulo";
$resultado=$mysqli->query($query);
?>
<option value="0">Todos</option>
<?php while($row = $resultado->fetch_assoc()) { ?>
	<option value="<?php echo $row['modulo']; ?>"><?php echo $row['modulo']; ?></option>
<?php } 
$resultado->close(); ?> 
</select>

</td></tr><tr><td>
<br/><b>Componente: </b></td><td> <br/><SELECT NAME="componente" id="cbx_moduloelegido2" style="width:300px;" class="select-css">
<option value="0">Todos</option>
</select>

</td></tr>
<tr><td colspan="2" align="center">
<br/><br/><INPUT TYPE="submit" VALUE="Generar Reporte" class="boton_generar"></td></tr>

<script type="text/javascript"> $(".chzn-select").chosen({no_results_text: "No se encontraron resultados con "}); $(".chzn-select-deselect").chosen({allow_single_deselect:true}); </script>
</form>
</table>

</body>
</html>
