<?php
if ($_POST['idfactura'] <> 'null') {
    $idfactura = $_POST['idfactura'];
    require '../../conexion.php';
    $det = consultas::get_datos("SELECT * from v_cobros_detalles where id_cobro = $idfactura;");
    ?>
    <div class="col-md-10" style="left: 60px;">
        <br>
        <br>
        <table class="table table-bordered">
            <tr>
                <th colspan="3" class="text-center">DETALLES DE FACTURA</th>
            </tr>
            <tr>
                <th class="text-center">Producto</th>
                <th class="text-center">Sub total</th>
            </tr>
    <?php $total = 0;
    foreach ($det as $d) {
        $total = $total + $d['cta_monto']; ?>
                <tr>
                    <td class="text-center"><?= $d['cta_descrip']; ?></td>
                    <td class="text-center"><?= $d['cta_monto']; ?></td>
                </tr>
    <?php } ?>
            <tr>
                <th colspan="3">TOTAL</th>
                <th><?= $total; ?></th>
            </tr>
        </table>
    </div>
<?php } ?>