<?
$r = "../";
$code=$_GET['code'];
require_once($r."inc/funciones.php");
validNotSession($r);
$mysqli = connectDB($r);
$spe=$_SESSION['perfil'];


?>
<!DOCTYPE html>
<html lang="en">
  <?php include $r."inc/head.php"; ?>
<body>
  <?php include "nav.php";
  $row1 = $mysqli->query("SELECT * FROM z_pedidos WHERE print=1 ORDER BY id DESC LIMIT 500"); ?>
    <div class="container-fluid">
      <div class="card mb-3">
        <div class="card-header h3">
          <i class="fa fa-table"></i> MIS FACTURAS</div>
        <div class="card-body">
          <div class="table-responsive">
            <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
              <thead>
                <tr>
                  <th>Cliente</th>
                  <th>Codigo de Pedido</th>
                  <th>fecha de entrega</th>
                  <th>acciones</th>
                </tr>
              </thead>
              <tfoot>
                <tr>
                  <th>Cliente</th>
                  <th>Codigo de Pedido</th>
                  <th>fecha de entrega</th>
                  <th>acciones</th>
                </tr>
              </tfoot>
              <tbody><?php
                    while($row2 = $row1->fetch_assoc()) {
                    ?>
                      <tr <? if($code==$row2['codigopedido']){echo 'class="text-danger"';} ?>>
                    <td><? $clien=sclien($row2['idcliente']); echo $clien['nombre']; ?></td>
                    <td><? echo $row2['codigopedido']; ?></td>
                    <td><? echo $row2['fechaentrega']; ?></td>
                    <td width="60px">
                        <!--<a class="btn_default text-warning h5"  href="editar.php?id=<?php echo $row2["codigopedido"] ?>" target="_blank"><i class="fa fa-pencil"></i></a>-->
                        <a class="btn_default text-primary h2"  href="../caja/imprimir-1.php?code=<?php echo $row2["codigopedido"] ?>" target="_blank"><i class="fa fa-print"></i></a>
                        <a class="ml-2 btn_default text-success h2"  href="my.bluetoothprint.scheme://https://quimiforen.com/admin/movil/a.php?code=<?php echo $row2["codigopedido"] ?>" target="_blank"><img src="https://static.thenounproject.com/png/734450-200.png" width="35px"></a></td>
                    </tr>
                    <?php
                    }
                    ?>
              <tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
<script>
    function popitup(url){
	    newwindow=window.open(url,'name','height=600,width=320'); 
	    if (window.focus) {newwindow.print();}
	    return false; 
    }
</script>
  <?php include "foot.php"; ?>
  
    
<script>
      $('#dataTable').DataTable( {
        "lengthMenu": [[50, 100, -1], [50, 100, "All"]],
         "order": [[ 2, "desc" ]]
    } );
  </script>
</body>
</html>