<?php
if ($_POST['orden_cod']<>'null') {
    $orden_cod = $_POST['orden_cod'];
    require '../../conexion.php';

    $det = consultas::get_datos("SELECT * from v_compras_orden_detalle where orden_cod = $orden_cod;");
    ?>
    <div class="col-md-10" style="left: 60px;">
        <br>
        <br>
        <table class="table table-bordered">
            <tr>
                <th colspan="3" class="text-center">DETALLES DE ORDEN</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><?= $d['precio_unit']; ?></td>
                    <td><?= $d['subtotal']; ?></td>
                </tr>
            <?php } ?>
            <tr>
                <th colspan="3">TOTAL</th>
                <th><?= $total; ?></th>
            </tr>
        </table>
    </div>

<?php } ?>
