<div id="verdetalle<?php echo $reg['not_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">Detalles</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%">REFERENCIA</th>
                                    <th width="5%">CANTIDAD</th>
                                    <th width="45%"><span class="pull-center">DESCRIPCIÓN</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="25%"><span class="pull-right">PRECIO T</span></th>
                                </tr>
                            </thead>
                            <tbody  class="buscar">
                            <?php
                                $sumador_total=0;
                                $neto=0;
                                $descuento_global=0;
                                $iva_global=0;
                                $retencion_global=0;

                                $not_id=$reg['not_id'];
                                $sql=mysqli_query($con, "SELECT * from dian_nota_credito_detalle where dian_not_id='$not_id'");
                                while ($row=mysqli_fetch_array($sql))
                                {
                                    $vend_referencia=$row['not_art_referencia'];
                                    $vend_nombre=$row['not_art_nombre'];
                                    $vend_cantidad=$row['not_art_cantidad'];
                                    //$vend_precio=$row['vend_precio']; //1.000.000
                                    $vend_precio=$row['not_precio']; //1.000.000
                                    $vend_iva=$row['not_iva']; //19%
                                    $vend_descuento=$row['not_descuento']; //10%

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

                                    $precio_unitario_sin_iva=$vend_precio/$iva1;  //840.336
                                    $precio_total_sin_iva=$precio_unitario_sin_iva*$vend_cantidad;
                                    $descuento_unitario=($vend_descuento/100)*$precio_unitario_sin_iva;  //84033
                                    $descuento_item=$descuento_unitario*$vend_cantidad;  //84033
                                    $neto_item=$precio_total_sin_iva;
                                    $iva_item=($vend_precio-$precio_unitario_sin_iva)*$vend_cantidad;
                                    $neto+=$precio_total_sin_iva;
                                    $descuento_global+=$descuento_item;
                                    $iva_global+=$iva_item;

                                ?>
                            <tr>
                                <td ><?php echo $vend_referencia;?></td>
                                <td ><?php echo $vend_cantidad;?></td>
                                <td ><?php echo $vend_nombre;?></td>
                                <td ><span class="pull-right"><?php echo number_format($precio_unitario_sin_iva,0);?></span></td>
                                <td ><span class="pull-right"><?php echo number_format($vend_descuento,0);?></span></td>
                                <td style="text-align: right; "><span class="pull-right"><?php echo number_format($precio_total_sin_iva,0);?></span></td>
                            </tr>
                            <?php } 
                                $sumador_total=($neto+$iva_global)-$descuento_global;
                            ?>
                             <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;">SUBTOTAL  </td>
                                <td style="width: 25%; text-align: right;">&#36; <?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: 25%; text-align: right;">&#36; <?php echo number_format($descuento_global,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: 25%; text-align: right;">&#36; <?php echo number_format($iva_global,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: 25%; text-align: right;">&#36; <?php echo number_format($sumador_total,0);?></td>
                            </tr>
                            </tbody> 
                        </table>
                    </div> <!-- /.form-group -->
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div> 
    </div>
</div>