<?php
session_start();
require_once ("../conexion.php");
require_once('../include/sesiones.php');
?>
<table class="table table-bordered table-hover table-striped" style="font-size: 9pt;">
    <thead>
        <tr>
            <th>FACTURA</th>
            <th>CLIENTE</th>
            <th>EFECTIVO</th>
        </tr>
    </thead>
    <?php
        $ven1=mysqli_query($con,"SELECT * from ventas where ven_forma_de_pago='Contado' and ven_estado<>'anulada' and apertura='$apertura' and usuario='$usu_id'");
        while ($vent1=mysqli_fetch_array($ven1))
        {
            $ven_id=$vent1['ven_id'];
            $sql1=mysqli_query($con, "SELECT sum(veab_abono) as abono_adicional from venta_abonos va 
            where ventas_ven_id='$ven_id' and apertura='$apertura' and usuario='$usu_id'");
            $sql1=mysqli_fetch_array($sql1);
            $ventas_contado=$sql1['abono_adicional']+0; 
    ?>
        <tr>
            <td><?php echo $vent1['ven_prefijo']; ?><?php echo $vent1['ven_n_venta']; ?></td>
            <td><?php echo $vent1['ven_nombre']; ?></td>
            <td align="right"><?php echo number_format($ventas_contado,0); ?></td>
        <tr>
        <?php } ?>
</table>