<?
$r = "../../";
require_once($r."inc/funciones.php");
validNotSession($r);
$sql="";
foreach ($_GET as $key => $value)
{
    if($value!=""){$sql .= $key . " =". $value.' AND ';}
}
$mysqli = connectDB($r);
$row1 = $mysqli->query("SELECT * FROM z_clientes WHERE $sql eliminado=0");
?>
<!DOCTYPE html>
<html lang="en">
  <?php include $r."inc/head.php"; ?>
<body class="fixed-nav sidenav-toggled sticky-footer bg-dark" id="page-top">
  <?php include $r."inc/nav.php"; ?>
  
  <div class="content-wrapper">
    <div class="container-fluid">
      <div class="card mb-3">
        <div class="h3 card-header">
          <i class="fa fa-table"></i> RESULTADO CONSULTA <?echo $sql;?></div>
        <div class="card-body">
          <div class="table-responsive">
            <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
              <thead>
                <tr>
                  <th>Nombres</th>
                  <th>Correo</th>
                  <th>Celular</th>
                  <th>Ruta </th>
                  <th>Domiciliario </th>
                  <th>Direccion </th>
                  <th>Zona </th>
                </tr>
              </thead>
              <tfoot>
                <tr>
                  <th>Nombres</th>
                  <th>Correo</th>
                  <th>Celular</th>
                  <th>Ruta </th>
                  <th>Domiciliario </th>
                  <th>Direccion </th>
                  <th>Zona </th>
                </tr>
              </tfoot>
              <tbody>
                    <?php
                    while($row2 = $row1->fetch_assoc()) {
                    ?>
                      <tr>
                        <td><?php echo $row2['nombre'];?></td>
                        <td><?php echo $row2['correo'];?></td>
                        <td><?php echo $row2['celular1'];?></td>
                        <td><?php $ruta = sruta($row2["ruta"]); echo $ruta['nombre']; ?></td>
                        <td><?php $rutero = srute($ruta['idrutero']); echo $rutero['nombre']; ?></td>
                        <td><?php echo $row2['direccion']; ?></td>
                        <td><?php $zona = szona($row2['zona']); echo $zona['zona']; ?></td>
                      </tr>
                    <?php
                    }
                    ?>
              <tbody>
            </table>
          </div>
        </div><? echo $subtotal;?>
      </div>
      <input type="button" class="btn btn-primary float-left" value="Atras" name="Back2" onclick="history.back()" />
    </div>
  </div>
  <?php include $r."inc/foot.php"; ?>
</script> 
<script>
$('#dataTable').DataTable( {
        "order": [[ 0, "desc" ]],
        "lengthMenu": [[100, 500, 1000, -1], [100, 500, 1000, "All"]]
    } );
  </script>
</body>
</html>   