<?php
session_start();
require_once ("../conexion.php");
require_once('../include/sesiones.php'); 

$est=mysqli_query($con,"SELECT * FROM modulo_permiso WHERE mod_id='24' and modp_nombre='Modificar precio de venta' and usuario='$usu_id' ") or die(mysqli_error($con));
$est=mysqli_fetch_array($est);
if($est['estado']=='Activo')
{
    $readonly='';
    $disabled='';
}
else
{
    $readonly='readonly'; 
    $disabled='disabled';
}
?>

<style type="text/css">
.cajaselect {
  background: none repeat scroll 0 0 #4cbeff;
      cursor: pointer;
  position: relative;
}
ul.listaselect {
  background: none repeat scroll 0 0 #fff;
  border: 1px solid #dedede;
  display: none;
  left: -1px;
  margin-left: 0;
  margin-top: 32px;
  padding-left: 0;
  position: absolute;
  text-indent: 15px;
  top: 0;
  width: 100%;
  z-index: 100;

}
ul.listaselect li {
  border-bottom: 1px solid #efefef;
  cursor: pointer;
  display: block;
  line-height: 15px;
  list-style: outside none none;
  margin: 0;
  padding: 0.5em 0.3em;

}
ul.listaselect li a {
  color: #333;
  text-decoration: none;
}
ul.listaselect li a:hover {
  color: #999797;
  text-decoration: none;
}
ul.SelectProductos li:last-child {
  border-bottom: medium none;
}
.seleccionado {
  color: white;
  display: block;
  font-weight: 400;
  line-height: 2.5;
  text-indent: 8px;
  z-index: 100;

}
.trianguloinf {
  border-left: 9px solid rgba(0, 0, 0, 0);
  border-right: 9px solid rgba(0, 0, 0, 0);
  border-top: 13px solid #cfecfc;
  height: 0;
  position: absolute;
  right: 10px;
  top: 10px;
  width: 0;
}
.triangulosup {
  border-bottom: 13px solid #cfecfc;
  border-left: 9px solid rgba(0, 0, 0, 0);
  border-right: 9px solid rgba(0, 0, 0, 0);
  height: 0;
  position: absolute;
  right: 10px;
  top: 10px;
  width: 0;
}
</style>

<script type="text/javascript">
$(document).ready(function() {
function clickcaja(e) {
    var lista = $(this).find("ul"),
    triangulo = $(this).find("span:last-child");
    e.preventDefault();
    //lista.is(":hidden") ? $(this).find("ul").show() : $(this).find("ul").hide();
    $(this).find("ul").toggle();
    if(lista.is(":hidden")) {
        triangulo.removeClass("triangulosup").addClass("trianguloinf");
    }
    else {
        triangulo.removeClass("trianguloinf").addClass("triangulosup");
    }
}
function clickli(e) {
    var texto = $(this).text(),
    seleccionado = $(this).parent().prev(),
    lista = $(this).closest("ul"),
    triangulo = $(this).parent().next();
    e.preventDefault();
    e.stopPropagation();  
    seleccionado.text(texto);
    lista.hide();
    triangulo.removeClass("triangulosup").addClass("trianguloinf");
}
$(".cajaselect").click(clickcaja);
$(".cajaselect").on("click", "li", clickli);
});


function presentacion(pres_id,id)
{
    $.get("./php_facturar/editar_presentacion.php?pres_id="+pres_id+'&id='+id,function(data){
    $("#tabla").html(data);
    loadtotal();
    loadTabla();  
    loadbotones();
    })
}
</script>
<div class="table-responsive">
    <table class="table table-striped table-bordered" style="font-size: 9pt;">
        <tr>
            <th width="7%">CODIGO</th>
            <th width="15%">CANTIDAD</th>
            <th><span class="pull-center">DESCRIPCION</span></th>
            <th width="15%"><span class="pull-right">PRECIO U.</span></th>
            <th width="7%"><span class="pull-right">DESC.%</span></th>
            <th width="8%"><span class="pull-right">PRECIO T</span></th>
            <th width="9%"></th>
        </tr>
<?php
$sumador_combo=0;
$sumador_total=0;

$neto=0;
$total_descuento=0;
$total_iva=0;
$total_retencion=0;
$sumador_articulos=0;
$si_global_total=0;
$no_global_total=0;


$ret=mysqli_query($con,"SELECT * FROM retencion_temp where empresa='$empresa' and usuario='$usu_id'") or die(mysqli_error($con)); 
$rets=mysqli_fetch_array($ret);
$retencion_ret_id=!empty($rets['retencion_ret_id']);
$rete=mysqli_query($con,"SELECT * FROM retencion where empresa='$empresa' and ret_id='$retencion_ret_id'") or die(mysqli_error($con));
$rete=mysqli_fetch_array($rete);
$ret_porcentaje=!empty($rete['ret_porcentaje']);
$sql=mysqli_query($con,"SELECT * from venta_detalle_temp where empresa='$empresa' and usuario='$usu_id'");


while ($row=mysqli_fetch_array($sql))
{
    include('detalle_temp.php');

    if (fmod($vent_precio, 1) != 0) 
    {
        $vent_preciof= rtrim(rtrim($vent_precio, "0"), "."); // quita ceros innecesarios al final
    } else {
        $vent_preciof= intval($vent_precio); // muestra solo el entero
    }

?>
    <tr>
        <td><?php echo $vent_referencia;?></td>
        <td>
            <div class="cajaselect">
                <span class="seleccionado"><?php echo $row['vent_unidad']; ?></span>
                <ul class="listaselect">
                <?php
                    $artpres=mysqli_query($con,"SELECT * FROM articulos_presentacion where pres_art_id='$vent_art_id' order by pres_cantidad asc") ;
                    while($artpre=mysqli_fetch_array($artpres))
                    {   
                        $pres_id=$artpre['pres_id'];
                        ?> 
                    <li onclick="presentacion(<?php echo $pres_id;?>,<?php echo $id;?>)">
                        <a href="#" ><?php echo $artpre['pres_unidad']; ?></a>
                    </li>
                <?php   }   ?>
                </ul>
                <span class="trianguloinf"></span>
            </div>

            <div class="input-group" style="padding-top:3px;">
                <span class="input-group-addon" onclick="restar(<?php echo $id;?>)" style="cursor: pointer;">
                    <strong>-</strong>
                </span> 
                <input type="text" class="form-control input-sm" style="min-width:60px;" value="<?php echo $vent_cantidad;?>" onblur="update_cantidad(<?php echo $id;?>,this.value);">
                    <span class="input-group-addon" onclick="sumar(<?php echo $id;?>)" style="cursor: pointer;">
                    <strong>+</strong>
                </span> 
            </div>
        </td>
        <td>
        <a href="#" style="text-decoration: none;color: gray" data-id="<?php echo $vent_id;?>" class="btn-mod_des"><strong> <?php echo $vent_nombre; ?></strong></a>
        <?php $can2=mysqli_query($con,"SELECT * from venta_detalle_sabores_temp where vend_id='$vent_id'") or die(mysqli_error($con)); while ($row=mysqli_fetch_array($can2))
            {
                echo $row['sab_nombre'];
                echo '-';
            }
        ?>
       
        </td>
        <td><input type="number" <?php echo $readonly; ?> class="form-control input-sm" value="<?php echo $vent_preciof;?>" onblur="update_precio(<?php echo $id;?>,this.value);"  ></td>
        <td><input type="text" class="form-control input-sm" value="<?php echo $vent_descuento;?>" onblur="update_descuento(<?php echo $id;?>,this.value);" <?php echo $readonly; ?>></td>
        <td><span class="pull-right"><?php echo number_format($precio_total_item,0);?></span></td>
        <td>
            <a href="#" id="" onclick="eliminar_art(<?php echo $id;?>)" class="btn btn-xs btn-danger"> <i class="btn-icon-only icon-remove"></i></a>

            <?php

            $si=0;
            $no=0;

            $sqls1=mysqli_query($con,"SELECT *,count(*) as contandor_seriales from seriales_articulos where articulos_art_id='$vent_art_id' AND estado='sin vender'");
            $rows1=mysqli_fetch_array($sqls1);
           
            $contador=$rows1['contandor_seriales'];
            if ($contador>0) 
            {
                $sqls2=mysqli_query($con,"SELECT *,count(*) as contandor_seriales_tem from seriales_temp where venta_detalle_temp_vent_id ='$vent_id'");
                $rows2=mysqli_fetch_array($sqls2);

                $contador_tem=$rows2['contandor_seriales_tem'];

                if ($contador_tem==$vent_cantidad) 
                {

                    $sqls3=mysqli_query($con,"SELECT * from seriales_temp where venta_detalle_temp_vent_id ='$vent_id'");
                    while( $rows3=mysqli_fetch_array($sqls3))
                    {
                        $ser_codigo=$rows3['ser_codigo'];

                        $sqls4=mysqli_query($con,"SELECT * from seriales_articulos where se_codigo='$ser_codigo' and articulos_art_id='$vent_art_id'");
                        $rows4=mysqli_fetch_array($sqls4);
                        if ($rows4>0)
                        {
                            $si+=1;
                        }
                        else
                        {
                            $no+=1;
                        }
                    }
                }
                else
                {
                    $no+=1;
                }
            }
            else
            {
                $si+=1;
            }



            if($no>0)
            {
                if($negocio_neg_id=='1')
                {
                    $can1=mysqli_query($con,"SELECT * FROM seriales_temp where venta_detalle_temp_vent_id='$vent_id'") or die(mysqli_error($con));
                    $dat=mysqli_fetch_array($can1);
                    $result=mysqli_num_rows($can1);
                    if($result==0)
                    {
                ?>
                <a data-id="<?php echo $id;?>" class="btn btn-ser btn-xs btn-danger" title="Serial"><i class="btn-icon-only icon-barcode"></i></a>
                <?php } else { ?>
                    <a data-id="<?php echo $id;?>" data-toggle="modal" class="btn btn-ser_tabla btn-xs btn-danger" title="Serial"> <i class="btn-icon-only icon-barcode"></i></a>
                <?php  }  }  
            }
            else
            {
                if($negocio_neg_id=='1')
                {
                    $can1=mysqli_query($con,"SELECT * FROM seriales_temp where venta_detalle_temp_vent_id='$vent_id'") or die(mysqli_error($con));
                    $dat=mysqli_fetch_array($can1);
                    $result=mysqli_num_rows($can1);
                    if($result==0)
                    {
                ?>
                <a data-id="<?php echo $id;?>" class="btn btn-ser btn-xs btn-info" title="Serial"><i class="btn-icon-only icon-barcode"></i></a>
                <?php } else { ?>
                    <a data-id="<?php echo $id;?>" data-toggle="modal" class="btn btn-ser_tabla btn-xs btn-info" title="Serial"> <i class="btn-icon-only icon-barcode"></i></a>
                <?php } } 
            }

            $si_global_total+=$si;
            $no_global_total+=$no;
            ?>

            <?php
            if($negocio_neg_id=='2')
            {
                $can11=mysqli_query($con,"SELECT * FROM sabores_productos where articulo_art_id='$vent_art_id'") or die(mysqli_error($con)); 
                $data=mysqli_fetch_array($can11);
                 if($data>0){
                ?>
                <a data-id="<?php echo $vent_id;?>" class="btn btn-sabores_art btn-xs btn-info" title="Sabores"> <i class="btn-icon-only fas fa-concierge-bell"></i></a>
            <?php } } ?>

            <?php if($negocio_neg_id=='3')
            {
                $can11=mysqli_query($con,"SELECT * FROM sabores_productos where articulo_art_id='$vent_art_id'") or die(mysqli_error($con)); 
                $data=mysqli_fetch_array($can11);
                ?>
                <a href="#" data-id="<?php echo $vent_art_id;?>" data-toggle="modal" class="btn btn-informacion btn-xs btn-info" title="Informacion"> <i class="btn-icon-only icon-eye-open"></i></a>
            <?php } ?>


            <?php
                $canl=mysqli_query($con,"SELECT * FROM articulos where art_id='$vent_art_id'") or die(mysqli_error($con)); 
                $datal=mysqli_fetch_array($canl);
                $art_lote=$datal['art_lote'];
                if($art_lote=='si')
                { 
             ?>
                    <a href="#" data-id="<?php echo $id;?>" data-toggle="modal" class="btn btn-form_lote btn-xs btn-primary" title="lote"> <i class="btn-icon-only fas fa-concierge-bellfas fa-boxes"></i></a>
            <?php   }   ?>



            
        </td>
    </tr>   
<?php }
$si_global_total;
$no_global_total;

 ?>



<?php
$sql2=mysqli_query($con,"SELECT * from venta_detalle_combo_temp where usuario='$usu_id'");
while ($row2=mysqli_fetch_array($sql2))
{
    $vdc_id=$row2['vdc_id'];
    $combo_id=$row2['combo_id'];
    $combo_referencia=$row2['combo_referencia'];
    $combo_desc=$row2['combo_desc'];
    $precio=($row2['combo_cantidad']*$row2['combo_precio']);
    $sumador_combo+=$precio;
?>
        <tr>
            <td><?php echo $combo_referencia;?></td>
            <td><input type="text" readonly class="form-control input-sm" value="<?php echo $row2['combo_cantidad'];?>" ></td>
            <td><?php echo $row2['combo_nombre'];  ?> 
            <?php $can2=mysqli_query($con,"SELECT * from venta_detalle_combo_sabores_temp where vdc_id='$vdc_id'") or die(mysqli_error($con));
                while ($row=mysqli_fetch_array($can2))
                {
                    echo $row['sab_nombre'];
                    echo '-';
                }
            ?>
            </td>
            <td><input type="text" readonly class="form-control input-sm" value="<?php echo $row2['combo_precio'];?>"></td>
            <td><span class="pull-right">
                <input type="text" class="form-control input-sm" value="<?php echo $combo_desc;?>" readonly>
            </td>
            <td><span class="pull-right"><?php echo number_format($precio,0);?></span></td>
            <td >
                <a href="#" id="" onclick="eliminar_combo(<?php echo $vdc_id;?>)" class="btn btn-xs btn-danger"> <i class="btn-icon-only icon-remove"></i></a>
                <?php
                    if($negocio_neg_id=='2')
                    {
                        $can1=mysqli_query($con,"SELECT * FROM sabores_combos where combo_id='$combo_id' ") or die(mysqli_error($con)); 
                        $dat=mysqli_fetch_array($can1);
                        if($dat>0){
                        ?>
                        <a data-id="<?php echo $row2['vdc_id'];?>" class="btn btn-sabores btn-xs btn-info" title="Sabores"> <i class="btn-icon-only fas fa-concierge-bell"></i></a>
                <?php } } ?>
            </td>
        </tr> 
    <?php } ?>
    </table>
</div>
<div class="widget stacked">
    <div class="widget-content">

        <div class="col-md-12" style="padding:0px;">
            <form action="" method="post" id="retencion_form" name="retencion_form" class=""> 
                <div class="col-md-4" style="padding-left:0px"> 
                    <label>Tipo</label> 
                    <select class="form-control input-sm" name="retencion_select" id="retencion_select" onchange="calcularRetencion()" required>
                        <option value=""> - </option>
                        <?php
                            $result_1 = mysqli_query($con,"SELECT * FROM retencion WHERE empresa='$empresa'");  
                            while ($row_1 = mysqli_fetch_array($result_1)) { ?>
                                <option 
                                    value="<?php echo $row_1['ret_id']; ?>" 
                                    data-porcentaje="<?php echo $row_1['ret_porcentaje']; ?>"
                                >
                                    <?php echo $row_1['ret_nombre']; ?> (<?php echo $row_1['ret_porcentaje']; ?> %)
                                </option>
                        <?php } ?>
                    </select>
                </div>

                <div class="col-md-3" style="padding-left:0px"> 
                    <label>Base Imponible</label>
                    <input type="number" name="base_imponible"  class="form-control input-sm" 
                           id="base_imponible" autocomplete="off" onkeyup="calcularRetencion()" value="<?php echo round(($neto+$sumador_combo)-$total_descuento); ?>" />
                </div>

                <div class="col-md-3" style="padding-left:0px"> 
                    <label>Importe</label>
                    <input type="number" name="importe" value="0" class="form-control input-sm" 
                           id="importe" autocomplete="off" step="0.01" readonly />
                </div>

                <div class="col-md-2" style="padding-left:0px"> 
                    <label>&nbsp;</label>
                    <span class="input-group-btn">
                        <button name="btn_ret" id="btn_ret" type="submit" class="btn btn-warning btn-sm">
                            % Aplicar Retención
                        </button>
                    </span>
                </div>   
            </form>
            <script>
            function calcularRetencion() {
                var selectRet   = document.getElementById('retencion_select');
                var baseInput   = document.getElementById('base_imponible');
                var importeInput= document.getElementById('importe');

                if (!selectRet || !baseInput || !importeInput) {
                    return;
                }

                var opcionSeleccionada = selectRet.options[selectRet.selectedIndex];
                var porcentaje = opcionSeleccionada.getAttribute('data-porcentaje');

                var base = parseFloat(baseInput.value);
                if (isNaN(base)) {
                    base = 0;
                }

                if (!porcentaje) {
                    importeInput.value = 0;
                    return;
                }

                var porcentajeNum = parseFloat(porcentaje);
                var importe = base * (porcentajeNum / 100);

                importeInput.value = importe.toFixed(2);
            }
            </script>
        </div> 
       

        <div class="col-md-12" style="padding:0px; ">
            <form action="" method="post" id="descuentotal" name="descuentotal" class="">
                <div class="col-md-7" style="padding-left:0px"> 
                   
                </div>  

                <div class="col-md-3" style="padding-left:0px"> 
                    <label>Descuento Global</label>
                    <input type="number" step="0.02" min="0" max="99" name="desc" value="0" size="3" class="form-control input-sm" id="desc" placeholder="%" accesskey="p" title="alt + p" autocomplete="off" <?php echo $readonly; ?> />
                </div>

                 <div class="col-md-2" style="padding-left:0px"> 
                    <label>&nbsp;</label>
                    <span class="input-group-btn">
                    <button name="btn_desc" id="btn_desc" type="submit" class="btn btn-warning btn-sm"  <?php echo $disabled; ?>>% Aplicar Descuento </button></span>
                </div>
            </form>
        </div>
    </div>
</div>














<script type="text/javascript">
//descuento 
$( "#descuentotal" ).submit(function( event ) {
$('#btn_desc').attr("disabled", true);
var parametros = $(this).serialize();
$.ajax({
      type: "POST",
      url: "php_facturar/registrar_descuento.php",
      data: parametros,
        beforeSend: function(objeto){
         $('#tabla').html('<center><img src="./img/ajax-loader.gif"> CARGANDO...</center>');
        },
      success: function(datos){
      $("#tabla").html(datos);
      $('#btn_desc').attr("disabled", false);
      loadTabla();
      loadtotal();
      loadbotones();
      }
  });
  event.preventDefault();
})

//retencion
$( "#retencion_form" ).submit(function( event ) {
$('#btn_ret').attr("disabled", true);
var parametros=$(this).serialize();
   $.ajax({
      type: "POST",
      url: "php_facturar/registrar_retencion.php",
      data: parametros,
        beforeSend: function(objeto){
         $('#tabla').html('<center><img src="./img/ajax-loader.gif"> CARGANDO...</center>');
        },
      success: function(datos){
      $("#tabla").html(datos);
      $('#btn_ret').attr("disabled", false);
      loadTabla();
      loadtotal();
      loadbotones();
      }
  });
  event.preventDefault();
})
</script>

<script>
function eliminar_art(campo){
var parametros = {"action":"update","campo":campo}; 
$.ajax({
type: "POST",
url: "./php_facturar/eliminar_articulo.php",
data: parametros,
    beforeSend: function(objeto){
    $("#resultados").html("Mensaje: Cargando...");
    },
    success: function(datos){
    $("#resultados").html(datos);
    }
  });
loadTabla();
loadtotal();
loadbotones();
}

function update_precio(campo,valor)
{
    var parametros = {"action":"update","campo":campo,"valor":valor}; 
    if (parseInt(valor)<=0)
    {
        alert('El precio no puede ser 0');
        loadTabla();
        loadtotal();
    }
    else
    {
        $.ajax({
        type: "POST",
        url: "./php_facturar/modificar_precio.php",
        data: parametros,
         beforeSend: function(objeto){
          $("#resultados").html("Mensaje: Cargando...");
          },
        success: function(datos){
        $("#resultados").html(datos);
        }
          });
        loadTabla();
        loadtotal();
    }
} 

function update_cantidad(campo,valor)
{
    var parametros = {"action":"update","campo":campo,"valor":valor}; 
    if (parseInt(valor)<=0)
    {
        alert('La cantidad no puede ser 0');
        loadTabla();
        loadtotal();
    }
    else
    {
        $.ajax({
        type: "POST",
        url: "./php_facturar/modificar_cantidad.php",
        data: parametros,
         beforeSend: function(objeto){
          $("#carga").html("Mensaje: Cargando...");
          },
        success: function(datos){
        $("#carga").html(datos);
        }
        });
        loadTabla();
        loadtotal();
    }
}


function update_descuento(campo,valor){
      var parametros = {"action":"update","campo":campo,"valor":valor}; 
      $.ajax({
        type: "POST",
        url: "./php_facturar/modificar_descuento.php",
        data: parametros,
         beforeSend: function(objeto){
          $("#resultados").html("Mensaje: Cargando...");
          },
        success: function(datos){
        $("#resultados").html(datos);
        }
          });
        loadTabla();
        loadtotal();
    }

function eliminar_combo(campo){
var parametros = {"action":"update","campo":campo}; 
$.ajax({
    type: "POST",
    url: "./php_facturar/eliminar_combo_temp.php",
    data: parametros,
     beforeSend: function(objeto){
      $("#resultados").html("Mensaje: Cargando...");
      },
    success: function(datos){
    $("#resultados").html(datos);
    }
      });
    loadTabla();
    loadtotal();
    loadbotones();
}

function restar(id)
{
    var campo = 'resta';
    var dataString = 'vent_id=' + id + '&campo=' + campo;
    $.ajax({
        type: "POST",
        url: "php_facturar/restar_sumar.php",
        data: dataString,
        beforeSend: function(objeto){
             $('#carga').html('<center><img src="./img/ajax-loader.gif"> CARGANDO...</center>');
        },
        success: function(datos){
        $("#carga").html(datos);
        loadTabla();
        loadtotal();
        loadbotones();
        }
    });
}
function sumar(id)
{
    var campo = 'suma';
    var dataString = 'vent_id=' + id + '&campo=' + campo;
    $.ajax({
        type: "POST",
        url: "php_facturar/restar_sumar.php",
        data: dataString,
        beforeSend: function(objeto){
             $('#carga').html('<center><img src="./img/ajax-loader.gif"> CARGANDO...</center>');
        },
        success: function(datos){
        $("#carga").html(datos);
        loadTabla();
        loadtotal();
        loadbotones();
        }
    });
}


</script>

<script>
$(".btn-ser").click(function(){
  id = $(this).data("id");
  $.get("./php_facturar/form_seriales.php","id="+id,function(data){
    $("#form-ser").html(data);
  });
  $('#serModal').modal('show');
});
</script>


<script>
$(".btn-ser_tabla").click(function(){
  id = $(this).data("id");
  $.get("./php_facturar/form_tabla_serial.php","id="+id,function(data){
    $("#form-tabla_serial").html(data);
  });
  $('#reg_ser_tabla').modal('show');
});
</script>



<script>
$(".btn-sabores").click(function(){
  id = $(this).data("id");
  $.get("./php_facturar/form_sabores.php","id="+id,function(data){
    $("#form-sabores").html(data);
  });
  $('#sabores_Modal').modal('show');
});
</script>
<div class="modal fade" id="sabores_Modal" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Agregar Sabores</h4>
            </div>
            <div class="modal-body">
                <div id="form-sabores"></div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<script>
$(".btn-sabores_art").click(function(){
  id = $(this).data("id");
  $.get("./php_facturar/form_sabores_productos.php","id="+id,function(data){
    $("#form-sabores_art").html(data);
  });
  $('#sabores_art_Modal').modal('show');
});
</script>
<div class="modal fade" id="sabores_art_Modal" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Agregar Sabores</h4>
            </div>
            <div class="modal-body">
                <div id="form-sabores_art"></div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


<script>
$(".btn-mod_des").click(function(){
  id = $(this).data("id");
  $.get("./php_facturar/form_modificar_descripcion.php","id="+id,function(data){
    $("#form-modifi_art").html(data);
  });
  $('#descripcion_art_Modal').modal('show');
});
</script>
<div class="modal fade" id="descripcion_art_Modal" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Modificar descripción</h4>
            </div>
            <div class="modal-body">
                <div id="form-modifi_art"></div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->



<script>
$(".btn-form_lote").click(function(){
  id = $(this).data("id");
  $.get("./php_facturar/form_lote.php","id="+id,function(data){
    $("#form-lote_tabla").html(data);
  });
  $('#lote_Modal').modal('show');
});
</script>
<div class="modal fade" id="lote_Modal" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Lote</h4>
            </div>
            <div class="modal-body">
                <div id="form-lote_tabla"></div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->