<?php
//activamos almacenamiento en el buffer
//ob_start();
//session_start();
if (!isset($_SESSION['nombre'])) {
  header("Location: login.html");
}else{
  if ($_SESSION['compras']==1) {

  ?>
        <!-- Main content -->
        <section class="content">
          <!-- Default box -->
          <div class="row">
            <div class="col-md-12">
              <div class="box">
                  <div class="box-header with-border">
                    <button class="btn bg-green btn-app" onclick="mostrarform(true)" id="btnagregar"><i class="fa fa-plus-circle"></i>Agregar</button> 
                    <div class="box-tools pull-right">
                      <h1 class="box-title">FactoryWare\Producto Formula
                    </div>
                  </div>
                  <!--box-header-->
                  <!--centro-->
                  <div class="panel-body table-responsive" id="listadoregistros">
                    <table id="tbllistado" class="table table-striped table-bordered table-condensed table-hover">
                      <thead>
                        <th style="text-align:center">Opciones</th>
                        <th style="text-align:center">Producto</th>
                        <th style="text-align:center">Maquila</th>
                        <th style="text-align:center">Almacen de Insumo</th>
                        <th style="text-align:center">Usuario</th>
                        <th style="text-align:center">Fecha</th>
                        <th style="text-align:center">Estado</th>
                      </thead>
                      <tbody>
                      </tbody>
                      <tfoot>
                        <th></th>
                        <th></th>
                        <th></th>
                        <th></th>
                        <th></th>
                        <th></th>
                        <th></th>
                      </tfoot>   
                    </table>
                  </div>
                    
                  <div class="panel-body" style="height: 400px;" id="formularioregistros">
                    <form action="" name="formulario" id="formulario" method="POST">
                      <input class="form-control" type="hidden" name="idproductocompuesto" id="idproductocompuesto">
                      <input class="form-control" type="hidden" name="idproductoc" id="idproductoc">
                     <!--  <input class="form-control" type="hidden" name="idalmacenc" id="idalmacenc" value="1"> -->
                      <input class="form-control" type="hidden" name="validado" id="validado">
                      <input class="form-control" type="hidden" name="tasa_dollar" id="tasa_dollar">
                      <input class="form-control" type="hidden" name="tasa_euro" id="tasa_euro">
                      <input class="form-control" type="hidden" name="idempresa_venta" id="idempresa_venta" value="<?php echo $_SESSION['idempresa_venta_empresa'] ?>" >
                      <input class="form-control" type="hidden" name="impuesto" id="impuesto">
                      <input class="form-control" type="hidden" name="filas" id="filas">  
                      <div class="form-group col-lg-4 col-md-4 col-xs-12">
                        <label for="">Producto</label>
                        <select name="idarticuloca" id="idarticuloca" class="form-control selectpicker" data-live-search="true" required>
                        </select>
                      </div>
                      <div class="form-group col-lg-4 col-md-4 col-xs-12">
                        <label for="">Nombre</label>
                        <input type="text" class="form-control" name="nombre" id="nombre" maxlength="250" required>
                        </input>
                      </div>
                      <div class="form-group col-lg-4 col-md-4 col-xs-12">
                        <label for="">Fecha: </label>
                        <input class="form-control" type="date" name="fecha_hora" id="fecha_hora" required>
                      </div>
                      <div class="form-group col-lg-4 col-md-4 col-xs-12">
                        <label for="">Maquila</label>
                        <select name="idmaquila" id="idmaquila" class="form-control selectpicker" data-live-search="true" required>
                        </select>
                      </div>
                      
                      
                      <div class="form-group col-lg-4 col-md-4 col-xs-12">
                        <label for="">Almacen de Insumo o Materia Prima</label>
                        <select name="idalmacenc" id="idalmacenc" class="form-control selectpicker" data-live-search="true" required>
                        </select>
                      </div>

                      <div class="form-group col-lg-4 col-md-4 col-xs-12">
                        <label for="">Almacen de Producto Terminado</label>
                        <select name="idalmacent" id="idalmacent" class="form-control selectpicker" data-live-search="true" required>
                        </select>
                      </div>
                     
                     
                       
                     <!---->
                    
                      <div class="form-group col-lg-12 col-md-12 col-xs-12">
                        <div class="box box-primary">
                          <div class="box-header with-border">
                            <h3 class="box-title">Formula</h3>
                          </div>
                        <div class="box-body">
                          <table id="detallesformula" class="table table-striped table-bordered table-condensed table-hover">
                            <thead style="background-color:#A9D0F5">
                              <th style="text-align:center">Opciones111</th>
                              <th style="text-align:center">Articulo</th>
                              <th style="text-align:center">Cantidad</th>
                              <th style="text-align:center">Unidad de Medida</th>
                              <th style="text-align:center">Refrescar</th>
                            </thead>
                            <tfoot>
                              <th></th>
                              <th></th>
                              <!-- <th style="text-align:right">
                                <h4 id="total"></h4>
                                <input type="hidden" name="total_compra" id="total_compra">
                              </th> -->
                              <th></th> 
                              <th></th>
                              <th></th> 
                            </tfoot>
                            <tbody>
                              
                            </tbody>
                          </table>
                        </div> 
                        <div class="box-footer">
                          
                        </div> 
                        
                      </div>
                    
                    
                    
                    
                    </form>
                  </div>
                  <div class="box-footer" id="formularioregistros1">
                    <div class="btn-group col-lg-12 col-md-12 col-xs-12">
                      <div class="form-group col-lg-6 col-md-6 col-xs-12">
                      <!-- <a data-toggle="modal" href="#myModalArt"> -->
                          <button type="button" class="btn bg-blue btn-app pull-left" id="btnAgregarArt"><i class="fa fa-inbox"></i>Insumos</button>
                        <!-- </a> -->  
                        <!-- <a data-toggle="modal" href="#myModalSer"> -->
                          <button type="button" class="btn bg-yellow btn-app pull-left" id="btnAgregarSer"><i class="fa fa-envelope"></i>Servicios</button>
                        <!-- </a> -->
                      </div>
                     <!--  <div class="form-group col-lg-4 col-md-4 col-xs-12">
                          <label for="" id="labelcodigobarra">Ingrese en codigo de barra </label>
                          <input class="form-control" type="text" name="cod_barra" id="cod_barra" maxlength="30" placeholder="Codigo Barra Producto" >
                          
                       
                      </div> -->
                      <div class="form-group col-lg-6 col-md-6 col-xs-12">
                        <button class="btn bg-blue btn-app pull-right" type="submit" id="btnGuardar"><i class="fa fa-save"></i>  Guardar</button>
                        <button class="btn bg-red btn-app pull-right" onclick="cancelarform()" type="button"><i class="fa fa-arrow-circle-left"></i> Cancelar</button>
                      </div>

                    </div>
                  </div>
                    
                  <!--fin centro-->
              </div>
            </div>
          </div>
          <!-- /.box -->
        </section>
      <!-- /.content -->
    </div>

      <!--Modal-->
        <div class="modal fade" id="myModalArt" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
          <div class="modal-dialog" style="width: 45% !important;">
            <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">Seleccione un Articulo</h4>
              </div>
              <div class="modal-body">
                <table id="tblarticulos" class="table table-striped table-bordered table-condensed table-hover">
                  <thead>
                    <th>Opciones</th>
                    <th>Nombre</th>
                    <th>Categoria</th>
                    <th>Código</th>
                    <th>Stock</th>
                    <th>Imagen</th>
                  </thead>
                  <tbody>
                    
                  </tbody>
                  <tfoot>
                    <th>Opciones</th>
                    <th>Nombre</th>
                    <th>Categoria</th>
                    <th>Código</th>
                    <th>Stock</th>
                    <th>Imagen</th>
                  </tfoot>
                </table>
              </div>
              <div class="modal-footer">
                <button class="btn btn-default" type="button" data-dismiss="modal">Cerrar</button>
              </div>
            </div>
          </div>
        </div>
        <div class="modal fade" id="myModalSer" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
          <div class="modal-dialog" style="width: 45% !important;">
            <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">Seleccione un Servicios</h4>
              </div>
              <div class="modal-body">
                <table id="tblservicios" class="table table-striped table-bordered table-condensed table-hover">
                    <thead>
                      <th>Opciones</th>
                      <th>Nombre</th>
                      <th>Categoria</th>
                      <th>Precio</th>
                      <th>Porcenjate</th>
                    </thead>
                    <tbody>
                      
                    </tbody>
                    <tfoot>
                      <th>Opciones</th>
                      <th>Nombre</th>
                      <th>Categoria</th>
                      <th>Precio</th>
                      <th>Porcentaje</th>
                    </tfoot>
                </table>
              </div>
              <div class="modal-footer">
                <button class="btn btn-default" type="button" data-dismiss="modal">Cerrar</button>
              </div>
            </div>
          </div>
        </div>
      <!-- fin Modal-->
  <?php 
  }else{
    require 'vistas/contenidos/noacceso-view.php'; 
  }
 ?>
           <!-- Main Footer -->
           <?php include "vistas/modulos/mainfooter.php";?>
      </div>

      <!-- ./wrapper -->
      <!-- REQUIRED JS SCRIPTS -->
      <?php include "vistas/modulos/script.php";?>
      <script src="vistas/scripts/productocompuesto10.js"></script>
  </body>
  </html>
  <?php 
}
ob_end_flush();
?>

