<?php
if (!empty($_POST['idpre'])) {
    require '../../conexion.php';
    $det = consultas::get_datos("SELECT * from v_servicios_presupuesto_detalle where id_presu = ".$_POST['idpre']);
    if(!empty($det)){ ?>
    <div class="col-col-12 col-sm-12 col-md-12">
        <table class="table">
            <tr>
                <th colspan="3" class="text-center">DETALLES DE PRESUPUESTO</th>
            </tr>
            <tr>
                <th class="text-left">Descripción</th>
                <th class="text-center">Cantidad</th>
                <th class="text-center">Precio</th>
                <th class="text-center">Subtotal</th>

            </tr>
            <?php
            $total = 0;
            foreach ($det as $d) {
                $total = $total + $d['subtotal'];
                ?>
                <tr>
                    <td class="text-left"><?= $d['art_descri']; ?></td>
                    <td class="text-center"><?= $d['cantidad']; ?></td>
                    <td class="text-center"><?= $d['precio_unit']; ?></td>
                    <td class="text-center"><?= $d['subtotal']; ?></td>

                </tr>
    <?php } ?>
            <tr>
                <th class="text-center"colspan="3">TOTAL</th>
                <th class="text-center"><?= $total; ?></th>
            </tr>
        </table>
    </div>
<?php }  
        }?>