<?php
if($_POST['cod_pres']<> 'null'){
    $cod_pres = $_POST['cod_pres'];
    require '../../conexion.php';
    $det = consultas::get_datos("SELECT * from v_compras_presupuesto_detalle where cod_pres = $cod_pres;"); ?>
    <div class="col-md-10" style="left: 60px;">
        <br>
        <br>
        <table class="table table-bordered">
             <tr>
                <th colspan="3" class="text-center">DETALLES DE PRESUPUESTO</th>
            </tr>
            <tr>
                <th>Producto</th>
                <th>Cantidad</th>
                <th>Precio</th>
                <th>Sub-Total</th>
            </tr>
            <?php $total = 0; foreach($det as $d){ $total = $total + $d['subtotal']; ?>
                <tr>
                    <td><?= $d['articulo'];?></td>
                    <td><?= $d['cantidad'];?></td>
                    <td><?= number_format($d['precio'], 0, ",", ".");?></td>
                    <td><?= number_format($d['subtotal'], 0, ",", ".");?></td>
                </tr>
            <?php } ?>
                <tr>
                    <th colspan="3">TOTAL</th>
                    <th><?= number_format($total, 0, ",", ".");?></th>
                </tr>
        </table>
    </div>
<?php } ?>