<?php
//Activamos el almacenamiento en el buffer
ob_start();
session_start();

if (!isset($_SESSION["nombre"]))
{
  header("Location: login.html");
}
else
{
require 'header.php';

if ($_SESSION['ventas']==1)
{
?>
<!--Contenido-->
      <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">        
        <!-- Main content -->
        <section class="content">
            <div class="row">
              <div class="col-md-12">
                  <div class="box">
                    <div class="box-header with-border">
                          <h1 class="box-title">Registro de Asignaciones     <button class="btn btn-success" id="btnagregar" onclick="mostrarform(true)"><i class="fa fa-plus-circle"></i> Agregar</button> <a href="../reportes/rptasignaciones.php" target="_blank"><button class="btn btn-info"><i class="fa fa-clipboard"></i> Reporte</button></a></h1>
                        <div class="box-tools pull-right">
                        </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>OPCIONES</th>
                            <th>ACTA</th>
                            <th>FECHA</th>
                            <th>RESPONSABLE</th>
                            <th>SEDE</th>
                            <th>UBICACIÓN</th>
                            <th>AREA</th>
                            <th>VERIFICADOR</th>
                            <th>REGISTRADOR</th>
                            <th>PERIODO</th>
                            <th>ESTADO</th>
                          </thead>
                          <tbody>                            
                          </tbody>
                          <tfoot>
                            <th>OPCIONES</th>
                            <th>ACTA</th>
                            <th>FECHA</th>
                            <th>RESPONSABLE</th>
                            <th>SEDE</th>
                            <th>UBICACIÓN</th>
                            <th>AREA</th>
                            <th>VERIFICADOR</th>
                            <th>REGISTRADOR</th>
                            <th>PERIODO</th>
                            <th>ESTADO</th>
                          </thead>
                          </tfoot>
                        </table>
                    </div>
                    <div class="panel-body" style="height: 100%;" id="formularioregistros">
                        <form name="formulario" id="formulario" method="POST">
                        <div class="form-group col-lg-2 col-md-2 col-sm-2 col-xs-12">
                            <label>Procedimiento(*):</label>
                            <input type="hidden" name="idventa" id="idventa">
                            <select name="procedimiento" id="procedimiento" class="form-control selectpicker" required="">
                               <option value="1">Inventario</option>
                               <option value="2">Pre-Inventario</option>
                               
                            </select>
                          </div>
                        <div class="form-group col-lg-2 col-md-2 col-sm-2 col-xs-12">
                            <label>Responsable(*):</label>
                            <input type="hidden" name="idventa" id="idventa">
                            <select id="idcliente" name="idcliente" class="form-control selectpicker" data-live-search="true" required>
                            </select>
                          </div>
                          <div class="form-group col-lg-2 col-md-2 col-sm-2 col-xs-12">
                            <label>Sede:</label>
                            <select name="idsede" id="idsede" class="form-control selectpicker" required="">
                               <option value="1">Cusco</option>
                               <option value="2">Machupicchu</option>
                            </select>
                          </div>
                          <div class="form-group col-lg-2 col-md-2 col-sm-2 col-xs-12">
                            <label>Ubicación:</label>
                            <select name="ubicacion" id="ubicacion" class="form-control selectpicker" required="">
                               <option value="PA">Pardo</option>
                               <option value="IN">Infancia</option>
                               <option value="B1">Base 01</option>
                               <option value="MA">Maestranza</option>
                               <option value="B3">Base 03</option>
                               <option value="VE">Ventas</option>
                               <option value="AU">Auditorio</option>
                               <option value="AL">Almacen</option>
                               <option value="SS">Seguridad y Salud</option>
                               <option value="AL">Almacen</option>
                            </select>
                          </div>
                          <div class="form-group col-lg-2 col-md-2 col-sm-2 col-xs-12">
                            <label>Area:</label>
                            <select name="idarea" id="idarea" class="form-control selectpicker" required="">
                            <option value="1">Gerencia General</option>
                               <option value="24">Directorio</option>
                               <option value="3">Asesoria Legal</option>
                               <option value="4">Contabilidad</option>
                               <option value="14">Tesoreria</option>
                               <option value="7">Recursos Humanos</option>
                               <option value="9">Logistica</option>
                               <option value="6">Ventas</option>
                               <option value="19">Operaciones</option>
                               <option value="12">Informatica</option>
                               <option value="25">Mecanica</option>
                               <option value="27">Mantenimiento</option>
                               <option value="26">Carreteras</option>
                               <option value="10">Almacen</option>
                               <option value="13">Seguridad</option>
                               <option value="15">Control Patrimonial</option>
                               <option value="21">Lavanderia</option>
                               <option value="20">Carpinteria</option>
                               <option value="18">Archivo</option>
                               <option value="17">PAMA</option>
                               <option value="16">Seguridad y Salud</option>
                               <option value="28">Call Center</option>
                               <option value="29">Archivo Contabilidad</option>
                               <option value="33">Auditorio</option>
                            </select>
                          </div>
                          <div class="form-group col-lg-2 col-md-2 col-sm-2 col-xs-12">
                            <label>Cargo:</label>
                            <select name="idcargo" id="idcargo" class="form-control selectpicker" required="">
                            <option value="4">Gerente</option>
                               <option value="5">Secretaria</option>
                               <option value="20">Asesor Legal</option>
                               <option value="1">Jefe</option>
                               <option value="2">Encargado</option>
                               <option value="21">Responsable</option>
                               <option value="3">Asistente</option>
                               <option value="6">Asistente Contable</option>
                               <option value="7">Auxiliar</option>
                               <option value="9">Agente Call Center</option>
                               <option value="19">Agente Seguridad</option>
                               <option value="15">Carpintero</option>
                               <option value="17">Conductor</option>
                               <option value="12">Director</option>
                               <option value="14">Lavandero</option>
                               <option value="16">Mecanico</option>
                               <option value="13">Obrero</option>
                               <option value="18">Supervisor</option>
                               <option value="10">Tecnico</option>
                               <option value="8">Vendedor</option>
                               <option value="22">Asesor Comercial</option>
                               <option value="23">Enfermera</option>
                               <option value="24">Presidente</option>
                               <option value="25">Asistenta Social</option>

                            </select>
                          </div>
                          
                          
                          <div class="form-group col-lg-2 col-md-2 col-sm-2 col-xs-12">
                            <label>Fecha(*):</label>
                            <input type="date" class="form-control" name="fecha_hora" id="fecha_hora" required="">
                          </div>
                          <div class="form-group col-lg-3 col-md-3 col-sm-3 col-xs-12">
                            <label>Entregable(*):</label>
                            <select name="tipo_comprobante" id="tipo_comprobante" class="form-control selectpicker" required="">
                               <option value="PreInventario">Acta de Pre-Inventario</option>
                               <option value="MC">Acta de Menor Cuantia</option>
                               <option value="Inventario">Acta de Inventario</option>
                            </select>
                          </div>
                          <!--<div class="form-group col-lg-1 col-md-1 col-sm-1 col-xs-12">
                            <label>Número:</label>
                            <input type="text" class="form-control" name="serie_comprobante" id="serie_comprobante" maxlength="7">
                          </div>-->
                          <div class="form-group col-lg-3 col-md-3 col-sm-3 col-xs-12">
                            <label>Verificador:</label>
                            <select name="verificador" id="verificador" class="form-control selectpicker" required="">
                            <option value="Leidy Pino">Leidy Pino</option>   
                            <option value="Milagros Romero">Milagros Romero</option>
                            </select>
                          </div>
                          <div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12">
                            <label>Observaciones:</label>
                            <input type="text" class="form-control" name="observaciones" id="observaciones" required="">
                          </div>
                          <div class="form-group col-lg-3 col-md-3 col-sm-6 col-xs-12">
                            <a data-toggle="modal" href="#myModal">           
                              <button id="btnAgregarArt" type="button" class="btn btn-primary"> <span class="fa fa-plus"></span> Agregar Artículos</button>
                            </a>
                          </div>

                          <div class="col-lg-12 col-sm-12 col-md-12 col-xs-12 table-responsive">
                            <table id="detalles" class="table table-striped table-bordered table-condensed table-hover">
                              <thead style="background-color:#A9D0F5">
                                    <th>Opciones</th>
                                    <th>Codigo</th>
                                    <th>Artículo</th>
                                    <th>Cod. Patri.</th>
                                    <th>Marca</th>
									                  <th>Modelo</th>
									                  <th>Serie</th>
									                  <th>Color</th>
                  									<th>Condición</th>
									                  <th>Estado</th>
                                    <th>Obsevaciones</th>
                                    <th>Cantidad</th>
                                    <th>Valor</th>
                                    <th>Devaluación</th>
                                    <th>Subtotal</th>
                                </thead>
                                <tfoot>
                                    
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                    <th><h4><strong>TOTAL</strong></h4></th>
                                    <th><h4 id="total">S/. 0.00</h4><input type="hidden" name="total_venta" id="total_venta"></th> 
                                    <th></th>
                                </tfoot>
                                <tbody>
                                  
                                </tbody>
                            </table>
                          </div>

                          <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12">
                            <button class="btn btn-primary" type="submit" id="btnGuardar"><i class="fa fa-save"></i> Guardar</button>

                            <button id="btnCancelar" class="btn btn-danger" onclick="cancelarform()" type="button"><i class="fa fa-arrow-circle-left"></i> Cancelar</button>
                          </div>
                        </form>
                    </div>
                    <!--Fin centro -->
                  </div><!-- /.box -->
              </div><!-- /.col -->
          </div><!-- /.row -->
      </section><!-- /.content -->

    </div><!-- /.content-wrapper -->
  <!--Fin-Contenido-->

  <!-- Modal -->
  <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
    <div class="modal-dialog" style="width: 65% !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 Artículo</h4>
        </div>
        <div class="modal-body table-responsive">
          <table id="tblarticulos" class="table table-striped table-bordered table-condensed table-hover">
            <thead>
                <th>Opciones</th>
                <th>Codigo</th>
                <th>Articulo</th>
                <th>Cod_Patri</th>
                <th>Responsable</th>
                <th>Area</th>
                <th>Sede</th>
                <!--<th>Imagen</th>-->
            </thead>
            <tbody>
              
            </tbody>
            <tfoot>
              <th>Opciones</th>
               <th>Codigo</th>
                <th>Articulo</th>
                <th>Cod_Patri</th>
                <th>Responsable</th>
                <th>Area</th>
                <th>Sede</th>
                <!--<th>Imagen</th>-->
            </tfoot>
          </table>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
        </div>        
      </div>
    </div>
  </div>  
  <!-- Fin modal -->
<?php
}
else
{
  require 'noacceso.php';
}

require 'footer.php';
?>
<script type="text/javascript" src="scripts/venta.js"></script>
<?php 
}
ob_end_flush();
?>