<div id="verdetalle<?php echo $reg['cot_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 Cotización</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%">CANT</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">DESC.%</span></th>
                                    <th width="20%"><span class="pull-right">PRECIO T</span></th>
                                </tr>
                            </thead>
                            <tbody  class="buscar">
                            <?php
        $descuento=0;
        $sumador_total=0;
        $neto=0;
        $descuentof=0;
        $iva_total=0;
        $tt=0;
        $to=0;
        $sql=mysqli_query($con, "SELECT * from  dis_cotizacion_detalle where dis_cotizacion_cot_id='$cot_id'");
        while ($row=mysqli_fetch_array($sql))
          {
            $vend_referencia=$row['cotd_referencia'];
            $vend_nombre=$row['cotd_nombre'];
            $vend_cantidad=$row['cotd_cantidad'];
            $vend_precio=$row['cotd_precio'];
            $vend_iva=$row['cotd_iva'];
            $vend_descuento=$row['cotd_desc'];

            $ivaf=$vend_iva/100;
            $precio_total=$vend_precio*$vend_cantidad;
            $descuento=($vend_descuento/100)*$precio_total;
            $pt=$precio_total-$descuento;
            $iva=$vend_precio*$ivaf;
            $sin_iva=$vend_precio-$iva;
            $sumador_total+=$precio_total;//Sumador
            $tt=$sin_iva*$vend_cantidad;

            $descuentof+=$descuento;
            $ivat=($vend_precio*$ivaf)*$vend_cantidad;
            $sin_ivat=($vend_precio-$iva)*$vend_cantidad;
            $iva_total+=$ivat;
            $neto+=$sin_ivat;
    
        ?>
   
                            <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($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($tt,0);?></span></td>
                            </tr>
                        <?php   } 
                         $to+=$sumador_total;?>
                            <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: 15%; 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: 15%; text-align: right;">&#36; <?php echo number_format($descuentof,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;">&#36; <?php echo number_format($iva_total,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;">&#36; <?php echo number_format($to-$descuentof,0);?></td>
                            </tr>
                            </tbody> 
                        </table>
                    </div> <!-- /.form-group -->
                    
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div> 
    </div>
</div>