<!DOCTYPE html>
<html lang="es">
<head>
	<meta charset="UTF-8">
	<title>Lista Informes Citologicos</title>
	<link rel="stylesheet" type="text/css" href="../bootstrap/css/bootstrap.min.css">
  	<script src="../js/jquery.min.js"></script>
  	<script src="../bootstrap/js/bootstrap.min.js"></script>
  	<link href="../css/ionicons.css" rel="stylesheet" type="text/css">
</head>
<body>
	<div class="table-responsive">
	<?php
	include_once('../php_conexion.php');
	include_once('../Class/funciones.php');
	if (!$conexion) {
	    die('Could not connect: ' . mysqli_error($con));
	}
	if (!empty($_GET['bus']) && !empty($_GET['tipobus'])) {
		$bus = $_GET['bus'];
		$tipobus = $_GET['tipobus'];
		$sql="SELECT * FROM pacientes WHERE idexamen=2 AND ($tipobus LIKE '%".$bus."%')";
		$result = mysqli_query($conexion,$sql);
	}else{
		$fechahoy=date('Y-m-d');
		$sql="SELECT * FROM pacientes WHERE idexamen=2 AND fechareg='$fechahoy'";
		$result = mysqli_query($conexion,$sql);
	}

		echo "<table class='table table-hover table-sm btn-table'>
		<tr class='bg-primary'>
		<th>COD. PAC.</th>
		<th>NUM. DOC.</th>
		<th>NOMBRE Y APELLIDOS</th>
		<th>MUESTRA</th>
		<th>EMPRESA</th>
		<th>FECHA REGISTRO</th>
		<th>ACCIONES</th>
		</tr>";
		while($row = mysqli_fetch_array($result)) {
		    echo "<tr>";
		    echo "<td style='font-size: 18px; color: #FF0000; font-weight: bold;''>" . $row['codpaciente'] . "</td>";
		    echo "<td>" . $row['numdoc'] . "</td>";
		    echo "<td>" . $row['apepaterno'] ." ". $row['apematerno'] ." ". $row['nombres'] ."</td>";
		    echo "<td>" . $row['muestra'] . "</td>";
		    if ($row['idempresa']==0) {
		    	echo "<td>NA</td>";
		    }else{
				echo "<td>" . nomempresa($conexion,$row['idempresa']) . "</td>";
		    }		    
		    echo "<td>" . $row['fechareg'] . "</td>";
		    $idinfpac=buscahistologicopac($conexion,$row['id']);
		    if ($idinfpac!="") {
		    	echo "<td><a href='reportpdf/frmimphistologico.php?idinf=".$idinfpac."' class='btn btn-primary btn-sm active' role='button' aria-pressed='true' target='_blank'><span class='ion-printer'></span> Imprimir</a>
<button class='btn btn-secondary btn-sm active' type='button' aria-pressed='true' onclick='actualizarinfo(".$idinfpac.");return false;'><span class='ion-edit'></span> Modificar</button></td>";
		    }else{
		    	echo "<td></td>";
		    }
		    

		    echo "</tr>";
		}
		echo "</table>";
		mysqli_close($conexion);
	?>
	</div>
</body>
</html>