<?php
//ini_set('display_errors',1);
require_once ("../../config/Cado.php");
require_once ("cCaja.php");
$oCaja = new cCaja();
$dts=$oCaja->filtrar('',$_POST['cmb_fil_mon_id'],$_POST['cmb_fil_puntoventa_id']);
$num_rows= mysqli_num_rows($dts);

// echo $_POST['cmb_fil_puntoventa_id'];

?>
<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_caja" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>PUNTO V. | EMPRESA</th>
                  <th>MONEDA</th>
                  <th>BANCO</th>
                  <th>CUENTA</th>
                  <th>CCI</th>
                  <th>TIPO</th>
                  <th>ID</th>
                  <th>&nbsp;</th>
                </tr>
            </thead>
        
            <tbody>
            <?php
            if($num_rows>=1){
            while($dt = mysqli_fetch_array($dts)){
            ?>
               <tr>
        <td><?php echo $dt['tb_puntoventa_alias'].' | '.$dt['tb_empresa_nomcom']?></td>
        <td><?php echo $dt['tb_moneda_nom']?></td>
        <td><?php echo $dt['tb_banco_abr']?></td>
        <td><?php echo $dt['tb_caja_nom']?></td>
        <td><?php echo $dt['tb_caja_cci']?></td>
    
        <td>
            <?php 
                $tipo=$dt['tb_caja_tip'];
                if($tipo==1){
                    echo "CAJA";
                }else if($tipo==2){
                    echo "BANCO";
                }else if($tipo==3){
                    echo "BILLETERA DIGITAL";
                }
            ?>
        </td>
        <td><?php echo $dt['tb_caja_id']?></td>
                <td nowrap align="center">					
<button class="btn btn-sm btn-primary" onClick="caja_form('editar','<?php echo $dt['tb_caja_id']?>')" ><i class="fas fa-edit"></i></button>
<button class="btn btn-sm btn-danger" onClick="eliminar_caja('<?php echo $dt['tb_caja_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_caja').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> 