<div id="inventario" 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"> VALOR DE INVENTARIO</h4>
            </div>
            <div class="modal-body">
                 <form name="form" method="get" action="" target=”_blank”>
                    <label>INVENTARIO</label>
                    <label>Ordenar Por</label>
                    <select name="ordenar" class="form-control name_list" required >
                        <option value="art_referencia">Codigo</option>
                        <option value="art_nombre">Nombre</option>
                        <option value="art_iva">Impuesto</option>
                    </select>

                    <label>Proveedor</label>
                    <section id="intro" >
                        <select name="art_proveedor" id="art_proveedor" class="form-control name_list" >
                            <option value="">Todo</option>
                            <?php
                                $datos = mysqli_query($con,"SELECT * FROM proveedor WHERE empresa='$empresa'") ;
                                while( $fila = mysqli_fetch_array( $datos ) )
                                {
                                echo' <option value="'.$fila['pro_id'].'">'.$fila['pro_nombre'].'</option>';
                                }
                            ?>
                        </select>
                    </section> 
                   
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                        <button type="submit"  class="btn btn-danger" name="reporte_invent_valor" value="reporte_invent_valor" id="reporte_invent_valor" dir="libraries/pdf/pdf_reportes/inventario_valor.php">PDF</button>

                        <button type="submit" class="btn btn-success" name="reporte_invent_valor2" value="reporte_invent_valor2" id="reporte_invent_valor2" dir="libraries/php_excel/excel_inventario_valor.php">EXCEL</button>
                        <button type="submit" class="btn btn-success" name="reporte_invent_valor2" value="reporte_invent_valor2" id="reporte_invent_valor2" dir="libraries/php_excel/excel_toma.php">EXCEL</button>
                    </div>
                </form>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div> 
</div>


<div id="tomainventario" 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">Reporte de Inventario</h4>
            </div>
            <div class="modal-body">
                <form name="form1" method="post" action="libraries/pdf/pdf_reportes/inventario.php" target="_blank">
                    <label>Categoria</label>
                    <select name="familia" class="form-control name_list" required >
                         <option value="0">Todo</option>
                        <?php
                            $datos = mysqli_query($con,"SELECT * FROM familias WHERE empresa='$empresa' order by fam_nombre asc ") ;
                            while( $fila = mysqli_fetch_array( $datos ) )
                            {
                                echo' <option value="'.$fila['fam_id'].'">'.$fila['fam_nombre'].'</option>';
                            }
                        ?>
                    </select>

                    <label>Marca</label>
                    <select name="marca" class="form-control name_list" required >
                        <option value="0">Todo</option>
                        <?php
                            $datosm = mysqli_query($con,"SELECT * FROM marca WHERE empresa='$empresa' order by mar_nombre asc ") ;
                            while( $filam = mysqli_fetch_array( $datosm ) )
                            {
                                echo' <option value="'.$filam['mar_id'].'">'.$filam['mar_nombre'].'</option>';
                            }
                        ?>
                    </select>

                    <label>Ordenar Por</label>
                    <select name="ordenar" class="form-control name_list" required >
                         <option value="art_referencia">Codigo</option>
                         <option value="art_referencia2">Referencia</option>
                         <option value="art_nombre">Nombre</option>
                         <option value="familias_fam_id">Categoria</option>
                    </select>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                        <button name="registrar" value="registrar" type="submit" class="btn btn-danger"><i class="icon-ok"></i> <strong>Descargar</strong></button>
                    </div>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div> 

<div id="escaso" 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"> Inventario Escaso</h4>
            </div>
            <div class="modal-body">
                <form name="form3" method="get" action="" target=”_blank”>
                    <label>Categoria</label>
                    <section id="intro" >
                        <select name="art_familia" id="art_familia" class="form-control name_list" >
                            <option value="">Todo</option>
                            <?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> 
                    <label>Proveedor</label>
                    <section id="intro" >
                        <select name="art_proveedor" id="art_proveedor" class="form-control name_list" >
                            <option value="">Todo</option>
                            <?php
                                $datos = mysqli_query($con,"SELECT * FROM proveedor WHERE empresa='$empresa'") ;
                                while( $fila = mysqli_fetch_array( $datos ) )
                                {
                                echo' <option value="'.$fila['pro_id'].'">'.$fila['pro_nombre'].'</option>';
                                }
                            ?>
                        </select>
                    </section> 
                    <label>Stock Minimo</label>
                    <input type="number" class="form-control" name="stock" autocomplete="off" value="0">
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                       <button type="submit"  class="btn btn-danger" name="reporte_invent_escaso" value="reporte_invent_escaso" id="reporte_invent_escaso" dir="libraries/pdf/pdf_reportes/inventario_escaso.php">PDF</button>

                        <button type="submit" class="btn btn-success" name="reporte_invent_escaso2" value="reporte_invent_escaso2" id="reporte_invent_escaso2"  dir="libraries/php_excel/excel_inventario_escaso.php">EXCEL</button>
                    </div>
                 </form>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div> 
</div>



<div id="sinuso" 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">ARTICULO SIN USO</h4>
            </div>
            <div class="modal-body">
                <form name="form1" method="post" action="" target="_blank">
                                        
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                        
                        <button type="submit"  class="btn btn-danger" name="reporte_invent_sinuso" value="reporte_invent_sinuso" id="reporte_invent_sinuso" dir="libraries/pdf/pdf_reportes/inventario_sin_uso.php">PDF</button>

                        <button type="submit" class="btn btn-success" name="reporte_invent_sinuso2" value="reporte_invent_sinuso2" id="reporte_invent_sinuso2"  dir="libraries/php_excel/excel_inventario_sinuso.php">EXCEL</button>
                    </div>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div> 



<div id="historial_art" 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"> Historial por Artículo</h4>
            </div>
            <div class="modal-body">
                <form method="get" action="" >
                    <div class="col-md-12">
                        <div class="form-group">
                            <label class="pull-left">Desde</label>
                            <input type="date" class="form-control date-picker" data-date-format="yyyy-mm-dd" name="desde" autocomplete="off" value="<?php echo  date('Y-m-d');?>" >
                            <label class="pull-left">Codigo o Nombre</label>
                            <section id="intro" >
                                <select name="articulo" id="articulo"  class="form-control name_list" required>
                                    <option value="0">'Seleccione'</option>
                                    <?php
                                        $datos=mysqli_query($con,"SELECT *, a.art_id as art_id ,b.art_id as art_art_id FROM articulos a, articulos_has_bodegas b
                                        where a.art_id=b.articulos_art_id and a.empresa='$empresa'  and b.sucursal='$sucursal' and a.art_estado='activo'  and a.art_tipo='articulo' order by b.art_cantidad DESC, a.art_referencia ASC ");

                                        while( $fila = mysqli_fetch_array( $datos ) )
                                        {

                                            $art_art_id=$fila['art_art_id'];
                                            $art_id=$fila['art_id'];
                                            $atributo1=$fila['atributo1'];

                                            $atri1=mysqli_query($con,"SELECT * FROM atributos1 where atri_art_id='$art_id' and atri_id='$atributo1'");
                                            $atri1 = mysqli_fetch_array($atri1);
                                            if (isset($atri1['atri_nombre'])) { $atri1=$atri1['atri_nombre']; } else {  $atri1='';}

                                            $atributo2=$fila['atributo2'];
                                            $atri2=mysqli_query($con,"SELECT * FROM atributos2 where atri_art_id2='$art_id' and atri_id2='$atributo2'");
                                            $atri2 = mysqli_fetch_array($atri2);
                                            if (isset($atri2['atri_nombre2'])) {  $atri2=$atri2['atri_nombre2']; } else { $atri2='';}


                                         echo' <option value="'.$fila['art_art_id'].'">'.mb_strtoupper($fila['art_referencia']).'  '.mb_strtoupper($fila['art_nombre']).' '.$atri1.' - '.$atri2.'</option>';
                                        }
                                    ?>
                                </select>
                            </section>
                        </div>
                    </div> <!-- /.form-group -->
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                        <button type="submit"  class="btn btn-info" name="reporte_invent_histo" value="reporte_invent_histo" id="reporte_invent_histo" dir="R_reportes_inventario_historial.php">Buscar</button>

                    </div>
                </form>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div> 
</div> 

<div id="historial_serial" 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"> Historial por Serial</h4>
            </div>
            <div class="modal-body">
                <form method="get" action="" >
                    <div class="col-md-12">
                        <div class="form-group">
                            <label class="pull-left">Serial</label>
                           <input type="text" name="serial" id="serial" value="" class="form-control">
                        </div>
                    </div> <!-- /.form-group -->
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                        <button type="submit"  class="btn btn-info" name="reporte_invent_histo_ser" value="reporte_invent_histo_ser" id="reporte_invent_histo_ser" dir="R_reportes_serial_historial.php">Buscar</button>

                    </div>
                </form>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div> 
</div> 


<div id="precios_articulos" 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"> Precios Articulos</h4>
            </div>
            <div class="modal-body">
                <form name="form3" method="get"action="" target=”_blank”>
                    <label>Tarifas</label>
                    <section id="intro" >
                        <select name="tar_id" id="tar_id" class="form-control name_list" required>
                            <?php
                                $datos=mysqli_query($con,"SELECT * FROM tarifas WHERE empresa='$empresa'") ;
                                while($fila=mysqli_fetch_array( $datos ) )
                                {
                                echo' <option value="'.$fila['tar_id'].'">'.$fila['tar_nombre'].'</option>';
                                }
                            ?>
                        </select>
                    </section> 
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                         <button type="submit"  class="btn btn-danger" name="reporte_invent_precio" value="reporte_invent_precio" id="reporte_invent_precio" dir="libraries/pdf/pdf_reportes/inventario_precios.php">PDF</button>

                        <button type="submit" class="btn btn-success" name="reporte_invent_precio2" value="reporte_invent_precio2" id="reporte_invent_precio2"  dir="libraries/php_excel/excel_inventario_precio.php">EXCEL</button>
                    </div>
                </form>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div> 
</div>

<div id="precombos" 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">PRECIO COMBOS</h4>
            </div>
            <div class="modal-body">
                <form name="form1" method="post" action="" target="_blank">
                                        
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                        
                        <button type="submit"  class="btn btn-danger" name="reporte_invent_precombos" value="reporte_invent_precombos" id="reporte_invent_precombos" dir="libraries/pdf/pdf_reportes/inventario_precios_combos.php">PDF</button>

                        <button type="submit" class="btn btn-success" name="reporte_invent_precombos2" value="reporte_invent_precombos2" id="reporte_invent_precombos2"  dir="libraries/php_excel/excel_inventario_precombo.php">EXCEL</button>
                    </div>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div> 

<!-- script para formulario con dos botones y redireccionamiento a paginas desde boton-->
<script type="text/javascript">
$(document).ready(function()
{
  $("button[type=submit]").click(function()
   {
    var accion = $(this).attr('dir');

    $('form').attr('action', accion);
  
   });
  
});
</script> 
