<div id="nuevoservicio" class="modal fade" tabindex="-1" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">Registrar </h4>
            </div>
            <div class="modal-body ">
                <div id="resultado_ser"></div>
                <form id="form_servicio" name="form_servicio" method="post" >
                        <label>Codigo</label>
                        <div class="input-group">
                            <input type="text"  name="art_referencia" id="art_referencia" class="form-control" autocomplete="off"  value=""  required>
                            <span class="input-group-addon"><div id="Info"></div> </span>
                        </div>
                         <label>Nombre</label>
                        <input type="text" name="art_nombre" id="art_nombre" class="form-control input-sm" autocomplete="off" value="">

                    <label>Categorias</label>
                        <section id="intro" >
                            <select name="art_familia" id="art_familia" class="form-control input-sm" required>
                            <?php
                                $datos = mysqli_query($con,"SELECT * FROM familias  WHERE   empresa='$empresa'   ") ;
                                while( $fila = mysqli_fetch_array( $datos ) )
                                {
                                    echo' <option value="'.$fila['fam_id'].'">'.$fila['fam_nombre'].'</option>';
                                }
                                ?>
                            </select>
                        </section>
                    <?php if ($negocio_neg_id=='3' or $negocio_neg_id=='2'){?> 

                        <label>Ubicación</label>
                        <section id="intro">
                            <select name="art_ubicacion" id="art_ubicacion" class="form-control input-sm" required>
                            <?php
                                $result_1 = mysqli_query($con,"SELECT * FROM ubicacion WHERE empresa='$empresa' and sucursal='$sucursal' order by ubi_nombre desc");  
                                while ($row_1=mysqli_fetch_array($result_1)) 
                                {   
                                  echo "<option value='".$row_1['ubi_id']."' >".$row_1['ubi_nombre']."</option>"; 
                                }  
                                ?>
                            </select>
                        </section>
                        <?php } else {  
                            $ubi=mysqli_query($con,"SELECT * FROM ubicacion where ubi_nombre='SIN UBICACION' and empresa='$empresa' ") ;
                            $ubi= mysqli_fetch_array($ubi);
                            $ubi_id=$ubi['ubi_id'];
                        ?>
                        <input type="hidden" name="art_ubicacion" id="art_ubicacion" class="form-control input-sm" value="<?php echo $ubi_id; ?>">
                        <?php } ?>
                    <div class="">
                        <label>Precio Costo</label>
                        <input type="number" name="art_costo" id="art_costo" class="form-control input-sm" autocomplete="off" value="0" >
                    </div> <!-- /.form-group -->
                        <label>Impuesto</label>
                        <select name="art_iva" id="art_iva" class="form-control input-sm" required>
                            <?php
                                $datos=mysqli_query($con,"SELECT * FROM iva where empresa='$empresa' ") ;
                                while( $fila = mysqli_fetch_array( $datos ))
                                {
                                    echo '<option value="'.$fila['iva_id'].'" select>'.$fila['iva_nombre'].'</option>';
                                }
                            ?>
                            </select> 
                    <div class="">
                        <label>Precio Venta </label>
                        <input type="number"  name="art_pvp" id="art_pvp" class="form-control input-sm" autocomplete="off"  value="0" >
                    </div> <!-- /.form-group -->
                    <label>Comision de venta % </label>
                    <input type="number" step="0.02" name="art_comision" id="art_comision" class="form-control input-sm" value="0">
                    </br>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                        <button type="submit" id="btn_registrar" class="btn btn-success"><i class="icon-ok"></i> Registrar</button>
                    </div>
                </form>
            </div>
        </div>
    </div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
<script type="text/javascript">
$(document).ready(function() 
{  
    $('#art_referencia').blur(function(){
    $('#Info').html('<img src="img/ajax-loader.gif" alt="" height="20px"  />').fadeOut(1000);
    var art_referencia = $(this).val();    
    var dataString = 'art_referencia='+art_referencia;
    $.ajax({
            type: "POST",
            url: "php_articulo/verificar_articulo_referencia.php",
            data: dataString,
            success: function(data) {
            $('#Info').fadeIn(1000).html(data);
            }
        });
    });              
});   
</script>