<script type="text/javascript">
function marcar(source) 
{
    checkboxes=document.getElementsByTagName('input'); //obtenemos todos los controles del tipo Input
    for(i=0;i<checkboxes.length;i++) //recoremos todos los controles
    {
        if(checkboxes[i].type == "checkbox") //solo si es un checkbox entramos
        {
            checkboxes[i].checked=source.checked; //si es un checkbox le damos el valor del checkbox que lo llamó (Marcar/Desmarcar Todos)
        }
    }
}
</script>
<form action="libraries/tcpdf/documentos/recibos_de_cxc_multiple.php" target="_blank" method="get">
<button title="Imprimir Recibo" type="submit" name="pdf" class="btn btn-sm btn-success"> <i class="btn-icon-only icon-print"> </i> IMPRIMIR </button>
<!--   <button title="Enviar correo" type="submit" name="msm" class="btn btn-sm btn-warning"> <i class="btn-icon-only icon-envelope"> EMAIL </i></button> -->
          
<div class="table-responsive">
    <table class="table table-striped table-bordered">
        <thead>
            <tr>
                <th width="5%">
                <input type="checkbox" id="to" onclick="marcar(this);" /> <label  for="to"> </label></th>
                <th width="10%">FACT Nº</th>
                <th>FECHA</th>
                <th>VENDEDOR</th>
                <th>VALOR</th>
                <th width="2%"></th>
            </tr>
        </thead>
        <?php 
        $clie_id=$_GET['clie_id'];
        $registros=mysqli_query($con,"SELECT * FROM ventas v, venta_abonos d where ven_id=ventas_ven_id and Cliente_clie_id='$clie_id' and veab_abono<>'0' and  (ven_forma_de_pago='Credito' or ven_forma_de_pago='Combinado')  order by mov_id desc ") or die(mysqli_error($con));
        while ($reg=mysqli_fetch_array($registros))
            {  
                $ven_id=$reg['ven_id'];
                $ven_n_venta=$reg['ven_n_venta'];
                $veab_fecha=$reg['veab_fecha'];
                $mov_id=$reg['mov_id'];
                $usuario=$reg['usuario'];
            ?>
            <tr>
                <td>
                    <input type="checkbox" id="<?php echo $mov_id; ?>" name="mov_id[]" value="<?php echo $mov_id; ?>" >
                    <label  for="<?php echo $mov_id; ?>"> </label>
                 </td>
                <td><?php echo $ven_n_venta; ?></td>
                <td><?php echo $veab_fecha; ?></td>
                <td>
                <?php  
                    $sql_tar=mysqli_query($con,"SELECT * from usuario where usu_id='$usuario'");
                    $bo=mysqli_fetch_array($sql_tar);
                    echo $usu_n=$bo['usu_nombre'];?>
                </td>
                <td><p class="pull-right"><?php echo number_format($reg['veab_abono'],0); ?></p></td>
                <td>
                    <?php
                        if($fac_tamano=='Carta'){ 
                    ?>
                        <a href="libraries/tcpdf/documentos/recibos_de_pago.php?mov_id=<?php echo $reg['mov_id']; ?>" title="Imprimir Recibo" class="btn btn-xs btn-success"  target="_blank" > <i class="btn-icon-only icon-print"></i></a>
                             
                    <?php } else {?>
                        <a href="tirillas/tirilla_movimientos.php?mov_id=<?php echo $reg['mov_id']; ?>" class="btn btn-success btn-xs" target="_blank" title="Imprimir"><i class="btn-icon-only icon-print"></i></a>
                    <?php } ?>
                </td>
            </tr>
            <?php }?>
            <input type="hidden" value="<?php  echo $clie_id; ?>" name="cliente">
        </table>
    </div> <!-- /widget-content -->
</form>
