<div id="verdetalle<?php echo $reg['vena_id']; ?>" class="modal fade" tabindex="-1" role="dialog">
    <div class="modal-dialog  modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">Detalle de Apartado</h4>
            </div>
            <div class="modal-body">
                <div class="col-md-12">
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover table-striped">
                            <thead>
                                <tr>
                                    <th width="10%">CODIGO</th>
                                    <th width="5%">CANTIDAD</th>
                                    <th width="45%"><span class="pull-center">DESCRIPCION</span></th>
                                    <th width="15%"><span class="pull-right">PRECIO U</span></th>
                                    <th width="5%"><span class="pull-right">DESCUENTO</span></th>
                                    <th width="20%"><span class="pull-right">PRECIO T</span></th>
                                </tr>
                            </thead>
                            <?php
                               
                                $sqls=mysqli_query($con, "SELECT * from venta_apartadas_detalle where ventas_apartadas_vena_id='$vena_id'");
                                while ($rows=mysqli_fetch_array($sqls))
                                {
                                    $svenad_referencia=$rows['venad_referencia'];
                                    $svenad_nombre=$rows['venad_nombre'];
                                
                                    
                                    $vend_precio=$rows['venad_precio'];
                                    $vend_cantidad=$rows['venad_cantidad'];
                                    $vend_descuento=$rows['venad_desc'];
                                    $vend_iva=$rows['venad_iva'];

                                    $iva0=$vend_iva/100; //0.19
                                    $iva1=1+$iva0; //1.19

                                    $precio_total_item=$vend_precio*$vend_cantidad;//precio normal 1.000.000
                                    $precio_total_sin_iva_item=($vend_precio/$iva1)*$vend_cantidad; //precio sin iva  840.336
                                    $descuento_item=($vend_descuento/100)*$precio_total_sin_iva_item; //descuento_item 84.033
                                    $total_iva_item=$precio_total_sin_iva_item*$iva0; // total iva  159.336

                            ?>
                                <tr>
                                    <td ><?php echo $svenad_referencia;?></td>
                                    <td ><?php echo $vend_cantidad;?></td>
                                    <td ><?php echo $svenad_nombre;?></td>
                                    <td ><span class="pull-right"><?php echo number_format($vend_precio,0);?></span></td>
                                    <td ><span class="pull-right"><?php echo $vend_descuento;?></span></td>
                                    <td style="text-align: right; "><span class="pull-right"><?php echo number_format($precio_total_item,0);?></span></td>
                                </tr>
                        <?php  }     ?>
                                <tr>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td style="width: 15%; text-align: right;">Neto  </td>
                                    <td style="width: 15%; text-align: right;"><?php echo number_format($neto,0);?></td>
                                </tr>
                                <tr>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td style="width: 15%; text-align: right;">Descuento  </td>
                                    <td style="width: 15%; text-align: right;"><?php echo number_format($total_descuento,0);?></td>
                                </tr>
                                <tr>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td style="width: 15%; text-align: right;">Iva  </td>
                                    <td style="width: 15%; text-align: right;"><?php echo number_format($total_iva,0);?></td>
                                </tr>
                                <tr style=" border: solid 01px black;  text-align: center; font-size: 10pt;padding:0mm;">
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td border="1" style=" text-align: right;">  </td>
                                    <td style="width: 15%; text-align: right;">TOTAL  </td>
                                    <td style="width: 15%; text-align: right;"><?php echo number_format($sumador_articulos,0);?></td>
                                </tr>
                            </tbody> 
                        </table>
                    </div> <!-- /.form-group -->
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div> 
    </div>  
</div>  