<?php
include ("header.php");

if (!empty($_POST))
{

    $fi = $mysqli->real_escape_string($_POST['fi']);
    $ff = $mysqli->real_escape_string($_POST['ff']);
    $ti = $mysqli->real_escape_string($_POST['ti']);

//INFORME MEDICOS REFERIDOS
if ($ti == 1)
{
    echo '<div class="content-wrapper">
    <div class="alert alert-success " role="alert">
        Informe generado con exito...
    </div>
    <a href="iinfref.php?ti='.$ti.'&fi='.$fi.'&ff='.$ff.'" target="_blank" class="btn btn-primary" role="button" data-bs-toggle="button">Imprimir</a>
    <a href="iinformes.php" target="_blank" class="btn btn-primary" role="button" data-bs-toggle="button">Regresar</a>';

}

if ($ti == 2)
{
    echo '<div class="content-wrapper">
    <div class="alert alert-success " role="alert">
        Informe generado con exito...
    </div>
    <a href="iinfcon.php?ti='.$ti.'&fi='.$fi.'&ff='.$ff.'" target="_blank" class="btn btn-primary" role="button" data-bs-toggle="button">Imprimir</a>
    <a href="iinformes.php" target="_blank" class="btn btn-primary" role="button" data-bs-toggle="button">Regresar</a>';
}

if ($ti == 3)
{
    echo '<div class="content-wrapper">
    <div class="alert alert-success " role="alert">
        Informe generado con exito...
    </div>
    <a href="iinfcie.php?ti='.$ti.'&fi='.$fi.'&ff='.$ff.'" target="_blank" class="btn btn-primary" role="button" data-bs-toggle="button">Imprimir</a>
    <a href="iinformes.php" target="_blank" class="btn btn-primary" role="button" data-bs-toggle="button">Regresar</a>';
}

if ($ti == 4)
{
    echo '<div class="content-wrapper">
    <div class="alert alert-success " role="alert">
        Informe generado con exito...
    </div>
    <a href="iigestion.php?ti='.$ti.'&fi='.$fi.'&ff='.$ff.'" target="_blank" class="btn btn-primary" role="button" data-bs-toggle="button">Ver</a>
    <a href="iinformes.php" target="_blank" class="btn btn-primary" role="button" data-bs-toggle="button">Regresar</a>';
}

if ($ti == 5)
{
    echo '<div class="content-wrapper">
    <div class="alert alert-success " role="alert">
        Informe generado con exito...
    </div>
    <a href="iipanual.php?ti='.$ti.'&fi='.$fi.'&ff='.$ff.'" target="_blank" class="btn btn-primary" role="button" data-bs-toggle="button">Ver</a>
    <a href="iinformes.php" target="_blank" class="btn btn-primary" role="button" data-bs-toggle="button">Regresar</a>';
}

if ($ti == 6)
{
    echo '<div class="content-wrapper">
    <div class="alert alert-success " role="alert">
        Informe generado con exito...
    </div>
    <a href="iibalance.php?ti='.$ti.'&fi='.$fi.'&ff='.$ff.'" target="_blank" class="btn btn-primary" role="button" data-bs-toggle="button">Ver</a>
    <a href="iinformes.php" target="_blank" class="btn btn-primary" role="button" data-bs-toggle="button">Regresar</a>';
}

include ("footer.php");
exit;     
}

 

?>

        <div class="content-wrapper">
            <!-- START PAGE CONTENT-->
            <div class="page-heading">
                <h1 class="page-title">Informes</h1>

                
<form id="signupform" class="form-horizontal" role="form" action="iinformes.php" method="POST" autocomplete="off">
                
<div class="card w-50">
  <div class="card-body">
    <h5 class="card-title">Seleccione el período:</h5>
    <p class="card-text">
    <div class="col-sm-6 form-group">
        <label>Fecha inicial:</label><br>
        <input type="date" name="fi" step="1" min="2020-01-01" max="2025-12-31">
    </div>        
    <div class="col-sm-6 form-group">
        <label>Fecha   final:</label><br>
        <input type="date" name="ff" step="1" min="2020-01-01" max="2025-12-31">
    </div>           
 <label>Seleccione tipo de informe:</label><br>
 <select name="ti" class="form-select" aria-label="Default select example">

  <option value="1" selected>Medicos Referidos</option>
  <option value="2">Forma de Contactos</option>
  <option value="3">Diagnosticos CIE10</option>
  <option value="4">Gestion</option>
  <option value="5">Pacientes sin atenciones en 1 año</option>
  <option value="6">Balance</option>

</select>
 <br> <br>
<button class="btn btn-primary" type="submit">Enviar</button>       
    </p>
  </div>
</div>                
            </div>

           
<?php 
    include ('footer.php');
?>