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

$criterio = getParam($_GET["criterio"], "");
$total = 0;
if ($criterio != "") {
	$query = "SELECT * FROM citaciones WHERE rut 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=UTF-8" />
<title>SISTAP | HISTORIAL CIUDADANO</title>
<link href="styles2.css" rel="stylesheet" type="text/css" />
 <script type="text/javascript">
imprime_reclamo = function()

{
	window.alert('Gracias!!');
	setTimeout("location.href='select-demo3.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 Ciudadano | SISTAP I.MUNICIPALIDAD DE ALHUÉ</h3>
<form id="frbuscar" name="frbuscar" method="get" action="">
    <p>
      <label>Rut ciudadano<br />
        (Ej: 69073200-9):</label>
      <br>
      <input name="criterio" type="text" id="criterio" size="25" value="<?php echo $criterio; ?>" /> &nbsp;</p>
    <p> 
      <input type="submit" id="btbuscar" value="Buscar" />
    </p>
</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">Codigo</th>
	<th width="90">Rut</th>
    <th width="90">Fecha</th>
    <th width="90">Hora</th>
	<th width="200">Tipo Consulta</th>
	<th width="200">Departamento</th>
	<th width="250">Atendido Por</th>
	<th  width="500">Detalle</th>
  </tr>
  <?php while ($rsEmp = mysql_fetch_assoc($queEmp)) { ?>
  <tr>
    <td><?php echo $rsEmp['id']; ?></td>
	<td><?php echo $rsEmp['rut']; ?></td>
    <td><?php echo $rsEmp['fecha']; ?></td>
    <td><?php echo $rsEmp['hora']; ?></td>
	<td><?php echo $rsEmp['tipoconsulta']; ?></td>
	<td><?php echo $rsEmp['departamento']; ?></td>
	<td><?php echo $rsEmp['atencionpor']; ?></td>
	<td><?php echo $rsEmp['observaciones']; ?></td>
  </tr>
  
  <?php } ?>
</table>
<?php } ?>
<p>&nbsp;</p></div>
</div>
</body>
</html>