<?php
session_start();

$cliente = $_SESSION['cliente'];
$perfil = $_SESSION['perfil'];
$rut = $_SESSION['rut'];


include 'conexion/conn.php';


?>

<!doctype html>
<html lang="es">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">
  

  <title>Inspector</title>

  <!-- Bootstrap core CSS -->
  <?php
  include 'rutas/encabezado1.php';
  ?>

  </head>

  <body>
    <?php
    include 'rutas/menu_insp.php';
    ?>


    <?php
    //echo "USUARIO: ".$rut." - PERFIL: ".$perfil." - CLIENTE: ".$cliente;

    ?>
    <div class="row">

      <?php
      echo '<div class="col-sm">
               Resumen <select class="form-control" id="resumen" name="resumen" onchange="cargar();">';
      echo '<option value="LOTE">LOTE</option>';
      echo '<option value="TESTIGO">TESTIGO</option>';
      echo '<option value="PALLET">PALLET</option>';
      echo '</select>
              </div>';
      ?>
    </div>

    <div id="ingreso" style="width: 100%; height: 100%; overflow: scroll;">


    </div>

    <!-- Bootstrap core JavaScript
    ================================================== -->


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <script type="text/javascript">
      var events;
      var table;
      var rowData;
      var arreglo = "";
      $(document).ready(function() {
        $("#ingreso").load("Inspeccion/Ingreso_Lote/resumen_lote.php");
        //$('#planilla').DataTable();
        //events = $('#events');
        table = $('#planilla').DataTable({
          select: true
        });

        table
          .on('select', function(e, dt, type, indexes) {
            var rowData = table.rows(indexes).data().toArray();
            //events.prepend( '<div><b>'+type+' selection</b> - '+JSON.stringify( rowData )+'</div>' ); listar fila
            arreglo = rowData;
          })
          .on('deselect', function(e, dt, type, indexes) {
            var rowData = table.rows(indexes).data().toArray();
            //events.prepend( '<div><b>'+type+' <i>de</i>selection</b> - '+JSON.stringify( rowData )+'</div>' ); listar fila
            arreglo = "";
          });
      });

      function cargar() {



        var resumen = $("#resumen").val();
        if (resumen == "LOTE") {

          $("#ingreso").load("Inspeccion/Ingreso_Lote/resumen_lote.php");
        } else if (resumen == "TESTIGO") {

          $("#ingreso").load("Inspeccion/Ingreso_Cajas_Testigo/resumen_testigo.php");
        } else {
          $("#ingreso").load("Inspeccion/Ingreso_Pallet/resumen_pallet.php");
        }

      }
    </script>


    <?php
    include 'rutas/scriptfinales1.php';
    ?>
  </body>

</html>