<?php
require("conexion5.php");
require("funciones1.php");


$criterio = getParam($_GET["criterio"], "");
$total = 0;
if ($criterio != "") {
    $query = "SELECT * FROM citaciones WHERE atencionpor like ".sqlValue($criterio."%", "text")." ORDER BY fecha ASC";
	$queEmp = mysql_query($query, $conexion);
	$total = mysql_num_rows($queEmp);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=gb18030">

<title>SISTAP | HISTORIAL FUNCIONARIOS</title>
<link href="styles2.css" rel="stylesheet" type="text/css" />
 <script type="text/javascript">
imprime_reclamo = function()

{
	window.alert('Gracias!!');
	setTimeout("location.href='select-demo4.php'", 10000);
    window.print();
    document.getElementById('area_opcion_imprimir').style.display='none'; 
}
</script>
</head>
<body>
<h3><img src="images/print.png" id="print" height="50" width="50" border="0" title="Imprimir Reclamo" alt="Imprimir Reclamo" style="cursor:pointer" onclick="imprime_reclamo();"/> 
</h3>
<div id="reporte">
<div id="area_opcion_imprimir" style="margin-bottom:2px;">
<h3>Historial de Atenciones Funcionarios | SISTAP I.MUNICIPALIDAD DE ALHUÉ</h3>
<form id="frbuscar" name="frbuscar" method="get" action="">
   <select name='criterio' id="criterio"  required title="Seleccione"  value="<?php echo $criterio; ?>">
                  <?php
$con = mysql_connect("localhost","educaci6_alhue","chile2020") or die
       ("Error al conectar con MySQL".mysql_error());
	   
	   mysql_select_db("educaci6_sistemas",$con) or die 
	   ("Error al seleccionar BD".mysql_error());
/* obtenemos los productos para mostrarlos en un combo-box */	   
 $sql = "SELECT * FROM user";
 $result = mysql_query($sql) or die ("ERROR AL CARGAR Tipos".mysql_error());
 while ($campo = mysql_fetch_array($result))
	echo "<option value='$campo[login_usuario]'>$campo[nombres]</option>";
?>
                </select>
    &nbsp; 
    <br>
    <input type="submit" id="btbuscar" value="Buscar" />
</form>
<?php if ($total > 0) { ?>
<p><em>Total de Atenciones: <?php echo $total; ?></em></p>
<table width="1200" border="0" cellspacing="0" cellpadding="0">
  <tr>
	<th width="90">Rut</th>
    <th width="95">Nombres</th>
    <th width="95">Apellidos</th>
	<th width="90">Fecha</th>
	<th width="90">Hora</th>
	<th width="95">Tipo Consulta</th>
	<th width="205">Atención Por</th>
	<th  width="500">Detalle</th>
  </tr>
  <?php while ($rsEmp = mysql_fetch_assoc($queEmp)) { ?>
  <tr>
	<td><?php echo $rsEmp['rut']; ?></td>
    <td><?php echo $rsEmp['nombres']; ?></td>
    <td><?php echo $rsEmp['apellidos']; ?></td>
	<td><?php echo $rsEmp['fecha']; ?></td>
	<td><?php echo $rsEmp['hora']; ?></td>
	<td><?php echo $rsEmp['tipoconsulta']; ?></td>
	<td><?php echo $rsEmp['atencionpor']; ?></td>
	<td><?php echo $rsEmp['observaciones']; ?></td>
  </tr>
  
  <?php } ?>
</table>
<?php } ?>
<p>&nbsp;</p></div>
</div>
</body>
</html>