<?php
//activamos almacenamiento en el buffer
//ob_start();
//session_start();
if (!isset($_SESSION['nombre'])) {
  header("Location: login.html");
}else{
  if ($_SESSION['ventas']==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">Ventas\Invoice
                  </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>Fecha</th>
                    <th>Cliente</th>
                    <th>Usuario</th>
                    <th>Documento</th>
                    <th>Número</th>
                    <th>Total Venta</th>
                    <th>Estado</th>
                  </thead>
                  <tbody>
                  </tbody>
                  <tfoot>
                    <th>Opciones</th>
                    <th>Fecha</th>
                    <th>Cliente</th>
                    <th>Usuario</th>
                    <th>Documento</th>
                    <th>Número</th>
                    <th>Total Venta</th>
                    <th>Estado</th>
                  </tfoot>   
                </table>
              </div>
              <form action="" name="formulario" id="formulario" method="POST">
                <div class="panel-body" style="height: 400px;" id="formularioregistros">
                    <div class="form-group col-lg-4 col-md-4 col-xs-12">
                      <label for="">BILL TO(*):</label>
                      <input class="form-control" type="hidden" name="idventa" id="idventa">
                      <select name="idcliente" id="idcliente" 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="">Fecha(*): </label>
                      <input class="form-control" type="date" name="fecha_hora" id="fecha_hora" required>
                    </div>
                    <div class="form-group col-lg-2 col-md-2 col-xs-6">
                      <label for="">Nro. Invoice: </label>
                      <input class="form-control" type="text" name="nroinvoice" id="nroinvoice" value="<?php echo $_SESSION['idempresa_venta_empresa'] ?>" >
                      
                    </div>
                    
                    <div class="form-group col-lg-12 col-md-12 col-xs-12">
                      <table id="detalles" class="table table-striped table-bordered table-condensed table-hover">
                        <thead style="background-color:#A9D0F5">
                          <th>Opciones</th>
                          <th>Quantity</th>
                          <th>Description</th>
                          <th>Unit Price</th>
                          <th>Total</th>
                        </thead>
                        <tfoot>
                          <th>TOTAL</th>
                          <th></th>
                          <th></th>
                          <th></th>
                          <th><input type="number" name="total_invoice" id="total_invoice"></th>
                        </tfoot>
                        <tbody>
                          
                        </tbody>
                      </table>
                    </div>
                </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">
                       <button type="button" class="btn bg-yellow btn-app pull-left" id="btnAgregarSer"
                        onclick="detalle_descripcion()"><i class="fa fa-envelope"></i>Descripcion</button>
                    </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>
              </form>
              <!--fin centro-->
            </div>
          </div>
        </div>
        <!-- /.box -->
      </section>
      <!-- /.content -->
    </div>
      <!--Modal-->
     
    
      <!-- 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/invoice.js"></script>
  </body>
  </html> 
<?php 
}

ob_end_flush();
  ?>

