<?php

session_start();

require_once ("../../config/Cado.php");

require_once ("cTalonario.php");

$oTalonario = new cTalonario();

//echo $_POST['cmb_fil_punven_id'];



$dts=$oTalonario->filtrar($_POST['cmb_fil_punven_id'],$_POST['cmb_fil_mod_id'],$_POST['cmb_fil_doc_id']);

$num_rows= mysqli_num_rows($dts);



?>



<section class="content">

	<div class="container-fluid">

	<div class="row">

	    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">

		    <div class="card">

				<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding:5px;">

	

					<div class="table-responsive">

		

          <table id="tabla_talonario" class="table table-bordered table-striped">

           <thead>

            <tr>

              <th>MÓDULO</th>

              <th>DOCUMENTO</th>

              <th>SERIE</th>

              <th>INICIO-FIN</th>

              <th>CORRELATIVO</th>

             <!-- <th>ESTADO</th> -->

              <th>&nbsp;</th>

            </tr>

          </thead>

          <tbody>

           <?php  



           while($dt = mysqli_fetch_array($dts)){

				$class = "";			  			   		

				$title = "";			  			   		

				if($dt['tb_talonario_est']=='1'){		

				$class = "";	

				$title = "ACTIVO";					

			   }else{

				$class='bg-red'; 

				$title = "INACTIVO";	

			   } 

            ?>

            <tr class="<?php echo $class;?>" title="<?php echo $title;?>">

              <td><?php echo $dt['tb_modulo_nom']?></td>

              <td><?php echo $dt['tb_documento_nom']?></td>

              <td><?php echo $dt['tb_talonario_ser']?></td>

              <td><?php echo $dt['tb_talonario_ini'].' - '.$dt['tb_talonario_fin']?></td>

              <td><?php echo $dt['tb_talonario_num']?></td>

             <!-- <td><?php echo $dt['tb_talonario_est']==='1'?'ACTIVO':'INACTIVO'?></td>-->

              <td>



	<button class="btn btn-sm btn-primary" onClick="talonario_form('editar','<?php echo $dt['tb_talonario_id']?>')" ><i class="fas fa-edit"></i></button>

	<button class="btn btn-sm btn-primary" onClick="eliminar_talonario('<?php echo $dt['tb_talonario_id']?>')" ><i class="fas fa-trash"></i></button>

	

			  </td>

            </tr>

            <?php

          }

          mysqli_free_result($dts);

          ?>

        </tbody>

      </table>

	  

	  

	  

    </div>

    </div>

    </div>

  </div>

</div>

</div>

</section>



<script type="text/javascript">

  $(function(){ 

    	

	  $('#tabla_talonario').DataTable({

 

        "language": {

                "lengthMenu": "Mostrar _MENU_ registros",

                "zeroRecords": "No se encontraron resultados",

                "info": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",

                "infoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",

                "infoFiltered": "(filtrado de un total de _MAX_ registros)",

                "sSearch": "Buscar:",

                "oPaginate": {

                    "sFirst": "Primero",

                    "sLast":"Último",

                    "sNext":"Siguiente",

                    "sPrevious": "Anterior"

			     },

			     "sProcessing":"Procesando...",

            }

    });  

	

  });



</script>