<?php include ("header.php");
$sql="SELECT * FROM `venta`,pacientes WHERE `ven_pac_id`=pac_id";
$resultado = mysqli_query($mysqli, $sql);
$band=1;
?>
       <div class="content-wrapper">
           <!-- START PAGE CONTENT-->
           <div class="page-heading">
               <h1 class="page-title">Ventas</h1>
               <ol class="breadcrumb">
                  <li class="breadcrumb-item">
                    <button onclick="location.href='pacientes.php'" type="button" class="btn btn-primary">Nueva Venta</button>
                    </li>
                </ol>
           </div>

            <div class="page-content fade-in-up">
                <div class="ibox">
                    <div class="ibox-head">
                        <div class="ibox-title">Ventas actuales</div>
                    </div>
                    <div class="ibox-body">
                        <table class="table table-striped table-bordered table-hover" id="dataTableVentas" cellspacing="0" width="100%">
                            <thead>
                                <tr>
                                        <th> FOLIO </th>
                                        <th> STATUS </th>
                                        <th> PACIENTE </th>
                                        <th> FECHA DE VENTA </th>
                                        <th> TOTAL </th>
                                        <th>REVISAR</th>
                                    </tr>
                            </thead>
                                <tbody>
                                    <?php $NUM=0;while($row = mysqli_fetch_array($resultado)) { $NUM=$NUM+1?>
                                    <tr <?if ($row['ven_status']==1) echo 'class="danger"'; else echo 'class="success"';?>>
                                        <td><?php echo $row['ven_id']; ?></td>
                                        <td><?php if ($row['ven_status']==1) echo 'PENDIENTE'; else echo 'TERMINADA'; ?></td>
                                        <td><?php echo $row['pac_nombre']; ?></td>
                                        <td><?php echo $row['ven_fecha']; ?></td>
                                        <td><?php echo '$ '. $row['ven_total']; ?></td>

                                        <td>
                                            <?
                                            if ($row['ven_status']==1)
                                                echo '<a href="https://www.audiologica.com.mx/sistema/nventa.php?id=' . $row['pac_id'] . '&ven_id=' . $row['ven_id'] . '" class="btn btn-info" tabindex="-1" role="button" aria-disabled="true">CONTINUAR</a>';
                                            else
                                                echo '<a href="iiticket.php?ven_id='.$row['ven_id'].'" class="btn btn-success" target="_blank" tabindex="-1" role="button" aria-disabled="true">IMPRIMIR</a>';
                                            ?>
                                        </td>
                                    </tr>
                                    <?php } ?>
                                </tbody>
                        </table>
                </div>

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