<?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></h1>
                <div class="box-tools pull-right">
                  <h1 class="box-title">Ventas\Notas de Descuento y Devolución - NE (Nota de Entrega)
                </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" valign="middle">Opciones</th>
                    <th style="text-align:center" valign="middle">Fecha</th>
                    <th style="text-align:center" valign="middle">Cliente</th>
                    <th style="text-align:center" valign="middle">Usuario</th>
                    <th style="text-align:center" valign="middle">Tipo</th>
                    <th style="text-align:center" valign="middle">NotaCrédito</th>
                    <th style="text-align:center" valign="middle">CxC</th>
                    <th style="text-align:center" valign="middle">Monto</th>
                    <th style="text-align:center" valign="middle">Estado</th>
                  </thead>
                  <tbody>
                  </tbody>
                  <tfoot>
                    <th></th>
                    <th></th>
                    <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="idventa" id="idventa">
                  <input class="form-control" type="hidden" name="idnotacredito" id="idnotacredito">
                  <input class="form-control" type="hidden" name="idtransportista" id="idtransportista" value="1">
                  <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="serie_comprobante" id="serie_comprobante" value="N/A">
                  <input class="form-control" type="hidden" name="num_comprobante" id="num_comprobante" value="N/A">
                  <input class="form-control" type="hidden" name="tipo_comprobante" id="tipo_comprobante" value="NotaCredito">
                  <input class="form-control" type="hidden" name="tipo_documento" id="tipo_documento">
                  <input class="form-control" type="hidden" name="num_documento" id="num_documento">
                  <input class="form-control" type="hidden" name="idvendedor" id="idvendedor">
                  <input class="form-control" type="hidden" name="impuesto" id="impuesto" maxlength="20" placeholder="IVA" value=<?php echo $_SESSION['iva_empresa'] ?> readonly>
                  <!-- <input class="form-control" type="hidden" name="idcliente" id="idcliente"> -->
                  <input class="form-control" type="hidden" name="validar" id="validar">
                  <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="impuestoart18_empresa" id="impuestoart18_empresa" value="<?php echo $_SESSION['impuestoart18_empresa'] ?>" >
                  <!-- Para el servicio -->
                  <input class="form-control" type="hidden" name="precios" id="precios">
                  <input class="form-control" type="hidden" name="preciods" id="preciods">
                  <input class="form-control" type="hidden" name="porcentajes" id="porcentajes">
                  <input class="form-control" type="hidden" name="nombres" id="nombres">
                  <input class="form-control" type="hidden" name="idservicios" id="idservicios">
                  <input class="form-control" type="hidden" name="exentos" id="exentos">
                  
                  <!-- Para pedido uso la variable $impuestoart18_empresa -->
                  <?php 
                       /* $impuestoart18_empresa=$_SESSION['impuestoart18_empresa']; */ 
                      $impuestoart18_empresa='no'; 
                  ?>
                 <!--  <div class="form-group col-lg-2 col-md-2 col-xs-12">
                    <label for="">Tipo Documento</label>
                    <select class="form-control select-picker" name="tipo_documento" id="tipo_documento" required>
                      <option value="RIF">RIF</option>
                      <option value="CEDULA">CÉDULA</option>
                    </select>
                  </div>
                  <div class="form-group col-lg-2 col-md-2 col-xs-12">
                    <label for="">Razón Social/Cédula</label>
                    <input class="form-control" type="text" name="num_documento" id="num_documento" maxlength="20" placeholder="Razón Social/Cédula" required>
                  </div> -->
                  <!-- <div class="form-group col-lg-6 col-md-6 col-xs-12">
                    <label for="">Nombre</label>
                    <input class="form-control" type="text" name="nombre_cliente" id="nombre_cliente" maxlength="100" placeholder="Nombre del cliente" readonly>
                  </div> -->
                  <div class="form-group col-lg-4 col-md-4 col-xs-12">
                    <label for="">Nombre</label>
                    <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="">Despacho</label>
                    <select name="idclientedespacho" id="idclientedespacho" 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="">Tipo Nota Crédito</label>
                    <select name="idservicio" id="idservicio" class="form-control selectpicker" data-live-search="true" required>
                    </select>
                    
                  </div>
                  <div class="form-group col-lg-6 col-md-6 col-xs-6">
                    <label for="">Observación</label>
                    <input class="form-control" type="text" name="observacion" id="observacion" maxlength="300" placeholder="Observación" >
                  </div>
                  <div class="form-group col-lg-2 col-md-2 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-12">
                    <label for="">Transporte: </label>
                    <select name="idtransportista" id="idtransportista" class="form-control selectpicker" required>
                    </select>
                  </div> 
                  <div class="form-group col-lg-2 col-md-2 col-xs-12">
                    <label for="">Vendedor: </label>
                    <select name="idvendedor" id="idvendedor" class="form-control selectpicker" required>
                    </select>
                  </div>-->
                 
                  <!--
                  <div class="form-group col-lg-2 col-md-2 col-xs-12">
                    <label for="">Tipo Comprobante: </label>
                     <select name="tipo_comprobante" id="tipo_comprobante" class="form-control selectpicker" required>
                      <option value="Factura">Factura</option>
                      <option value="NotaEntrega">NotaEntrega</option>
                      <option value="Ticket">Ticket</option>
                    </select> 
                    <input class="form-control" type="text" name="tipo_comprobante" id="tipo_comprobante" value="Pedido">
                  </div>-->
                  <!-- <div class="form-group col-lg-2 col-md-2 col-xs-6">
                    <label for="">Impuesto (IVA): </label> -->
                   
                  <!-- </div> -->
                  <div class="form-group col-lg-2 col-md-2 col-xs-6">
                    <label for="">Nro. Nota Crédito: </label>
                    <input class="form-control" type="text" name="num_notacredito" id="num_notacredito" maxlength="20" placeholder="Número pedido" readonly>
                  </div>
                  <div class="form-group col-lg-2 col-md-2 col-xs-6">
                    <label for="">Nro. Control NC: </label>
                    <input class="form-control" type="text" name="numcontrol_notacredito" id="numcontrol_notacredito" maxlength="20" placeholder="Número pedido" readonly>
                  </div>
                  <!-- <div class="form-group col-lg-2 col-md-2 col-xs-6">
                    <label for="">Nro. Factura: </label>
                    
                  </div> -->
                  <!-- table table-bordered table-hover -->
                  <!-- table table-striped table-bordered table-condensed table-hover -->
                  <div class="form-group col-lg-12 col-md-12 col-xs-12">
                    <table id="detalles" class="table table-bordered table-condensed table-hover">
                     
                      <thead style="background-color:#A9D0F5">
                        <th width=10>Opciones</th>
                        <th>Articulo</th>
                        <th>Cantidad</th>
                        <th>Monto del Documento</th>
                        <th>% Descuento</th>
                        <th>Monto</th>
                        <th>Subtotal</th>
                      </thead>
                      <tfoot>
                        <tr>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th>TOTAL</th>
                            <!-- <th align="right"><h4  align="right" id="totald"></h4></th> -->
                            <th align="right"><h4 align="right" id="totald"></h4>
                              <input type="hidden" name="total_venta1" id="total_venta1" disabled>
                              <input type="hidden" name="total_venta" id="total_venta">
                              <input type="hidden" name="total_ventad" id="total_ventad">
                            </th>
                        </tr>
                      </tfoot>
                      <tbody>
                      </tbody>
                    </table>
                  </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-4 col-md-4 col-xs-12">
                      <a data-toggle="modal" href="#myModalFactura">
                        <button type="button" class="btn bg-blue btn-app pull-left" id="btnAgregarArt"><i class="fa fa-inbox"></i>Nota Entrega</button>
                      </a>
                      <a data-toggle="modal" href="#myModalFactura">
                        <button type="button" class="btn bg-navy btn-app pull-left" id="btnAgregarFac"><i class="fa fa-inbox"></i>Nota Entrega</button>
                      </a>
                      <a data-toggle="modal" href="#myModalFacturad">
                        <button type="button" class="btn bg-blue btn-app pull-left" id="btnAgregarFacd"><i class="fa fa-inbox"></i>Nota Entrega</button>
                      </a>
                      <a data-toggle="modal" href="#myModalAb">
                        <button type="button" class="btn bg-green btn-app pull-left" id="btnAgregarArtb"><i class="fa fa-inbox"></i>Producto</button>
                      </a> 
                      <a data-toggle="modal" href="#myModalAc">
                        <button type="button" class="btn bg-orange btn-app pull-left" id="btnAgregarArtc"><i class="fa fa-inbox"></i>Producto</button>
                      </a>   
                      <a data-toggle="modal" href="#myModalS">
                        <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="">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-4 col-md-4 col-xs-12">
                      <!-- <button class="btn bg-blue btn-app pull-right" type="submit" id="btnGuardar"><i class="fa fa-save"></i>  Guardar</button> -->
                      <!-- <a data-toggle="modal" href="#myModalT"> -->
                        <button class="btn bg-blue btn-app pull-right" type="submit" id="btnFacturar"><i class="fa fa-bank"></i>  Guardar Nota Crédito</button>
                      <!-- </a> -->  
                      <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>
              
                <!--Modal-->
              <div class="modal fade" id="myModalA" 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 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>Precio Venta</th>
                          <th>Nro. Lote</th>
                          <th>Fecha Vec.</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>Precio Venta</th>
                          <th>Nro. Lote</th>
                          <th>Fecha Vec.</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="myModalAb" 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 Articulo</h4>
                    </div>
                    <div class="modal-body">
                      <table id="tblarticulosb" 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>Precio Venta</th>
                          <th>Nro. Lote</th>
                          <th>Fecha Vec.</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>Precio Venta</th>
                          <th>Nro. Lote</th>
                          <th>Fecha Vec.</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="myModalAc" 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 Articulo</h4>
                    </div>
                    <div class="modal-body">
                      <table id="tblarticulosc" 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>Precio Venta</th>
                          <th>Nro. Lote</th>
                          <th>Fecha Vec.</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>Precio Venta</th>
                          <th>Nro. Lote</th>
                          <th>Fecha Vec.</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="myModalS" 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 Servicio</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>  

              <div class="modal fade" id="myModalT" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog" style="width: 50% !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">Monto a Pagar</h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-group col-lg-12 col-md-12 col-xs-12">
                          <label for="">Bolivares</label>
                          <input class="form-control" type="text" name="montoapagarbs" id="montoapagarbs" >
                        </div>
                        <div class="form-group col-lg-6 col-md-6 col-xs-12">
                          <label for="">Dollar</label>
                          <input class="form-control" type="text" name="montoapagardollar" id="montoapagardollar">
                        </div>
                        <div class="form-group col-lg-6 col-md-6 col-xs-12">
                          <label for="">EURO</label>
                          <input class="form-control" type="text" name="montoapagareuro" id="montoapagareuro">
                        </div>
                        <div class="form-group col-lg-6 col-md-6 col-xs-12">
                          <label for="">Tasa de Cambio en Dollar</label>
                          <input class="form-control" type="text" name="tasa_dollar1" id="tasa_dollar1" disabled="disabled">
                        </div>
                        <div class="form-group col-lg-6 col-md-6 col-xs-12">
                          <label for="">Tasa de Cambio en EURO</label>
                          <input class="form-control" type="text" name="tasa_euro" id="tasa_euro" disabled="disabled">
                        </div>
                        <div class="form-group col-lg-12 col-md-12 col-xs-12">
                          <label for="">Seleccione el Metodo de Pago</label>
                        </div>  
                        <div class="form-group col-lg-4 col-md-4 col-xs-12">
                          <input type="checkbox" name="idmetodopago1" id="idmetodopago1" onchange="change_checkbox('1',this)">
                          <label for="">Tarjeta de Credito</label>
                          <input class="form-control" type="text" name="montotc" id="montotc" disabled="disabled">
                        </div>
                        <div class="form-group col-lg-4 col-md-4 col-xs-12">
                          <input type="checkbox" name="idmetodopago2" id="idmetodopago2" onchange="change_checkbox('2',this)">
                          <label for="">Tarjeta de Debito</label>
                          <input class="form-control" type="text" name="montotd" id="montotd" disabled="disabled">
                        </div>
                        <div class="form-group col-lg-4 col-md-4 col-xs-12">
                          <input type="checkbox" name="idmetodopago4" id="idmetodopago4" onchange="change_checkbox('4',this)">
                          <label for="">Efectivo Bolivares</label>
                          <input class="form-control" type="text" name="montoeb" id="montoeb" disabled="disabled">
                        </div> 
                        <div class="form-group col-lg-4 col-md-4 col-xs-12">
                          <input type="checkbox" name="idmetodopago3" id="idmetodopago3" onchange="change_checkbox('3',this)">
                          <label for="">Efectivo Dollar</label>
                          <input class="form-control" type="text" name="montoed" id="montoed" disabled="disabled">
                        </div>
                        <div class="form-group col-lg-4 col-md-4 col-xs-12">
                          <input type="checkbox" name="idmetodopago6" id="idmetodopago6" onchange="change_checkbox('6',this)">
                          <label for="">Efectivo Euro</label>
                          <input class="form-control" type="text col-xs-12" name="montoee" id="montoee" disabled="disabled">
                        </div>
                       <div class="form-group col-lg-4 col-md-4 col-xs-12">
                          <input type="checkbox" name="idmetodopago5" id="idmetodopago5" onchange="change_checkbox('5',this)">
                          <label for="">Zelle</label>
                          <input class="form-control" type="text" name="montotz" id="montotz" disabled="disabled">
                        </div>
                        <!-- <div class="form-group col-lg-6 col-md-6">
                          <input type="checkbox" name="idmetodopago[]" id="idmetodopago[]" onchange="change_checkbox('6',this)">
                          <label for="">Bofa</label>
                          <input class="form-control" type="text" name="montobf" id="montobf" disabled="disabled">
                        </div> -->
                        <div class="form-group col-lg-6 col-md-6 col-xs-12">
                          <label for="">Pendiente por Pagar Bs</label>
                          <input class="form-control" type="text" name="montopendiente" id="montopendiente">
                        </div>
                        <div class="form-group col-lg-6 col-md-6 col-xs-12">
                          <label for="">Pendiente por Pagar Dollar</label>
                          <input class="form-control" type="text" name="montopendientedollar" id="montopendientedollar">
                        </div>
                        <div class="form-group col-lg-12 col-md-12 col-xs-12">
                          <label for="">Sub-Total</label>
                          <input class="form-control" type="text" name="montosubtotal" id="montosubtotal">
                        </div>

                    </div>
                    <div class="modal-footer">
                      <button class="btn btn-primary" type="button" id="btnGuardarCompra" disabled="disabled"><i class="fa fa-save"></i>  Facturar</button>
                      <button class="btn btn-default" type="button" data-dismiss="modal">Cerrar</button>
                    </div>
                  </div>
                </div>
              </div>

              <div class="modal fade" id="myModalB" 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 Tarjeta de Cliente</h4>
                    </div>
                    <div class="modal-body">
                      <table id="tblbarras" class="table table-striped table-bordered table-condensed table-hover">
                        <thead>
                          <th>Opciones</th>
                          <th>Tarjeta</th>
                          <th>Número Pedido</th>
                          <th>Monto</th>
                          <th>Estado</th>
                        </thead>
                        <tbody>
                          
                        </tbody>
                        <tfoot>
                          <th>Opciones</th>
                          <th>Tarjeta</th>
                          <th>Número Pedido</th>
                          <th>Monto</th>
                          <th>Estado</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="myModalPermiso" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog" style="width: 25% !important;">
                  <form action="" method="post" name="formapermiso" id="formapermiso">
                    <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">Ingrese clave</h4>
                      </div>
                      <div class="modal-body">
                          <div class="form-group col-lg-12 col-md-12 col-xs-12">
                              <label for="">Usuario</label>
                              <input class="form-control" type="text" name="usuariopermiso" id="usuariopermiso" maxlength="50" placeholder="Clave de permiso" required>
                              <label for="">Clave</label>
                              <input class="form-control" type="password" name="clavepermiso" id="clavepermiso" maxlength="50" placeholder="Clave de permiso" required>
                          </div>
                      </div>
                      <div class="modal-footer">
                        <button class="btn btn-primary" type="submit">Enviar</button>
                        <button class="btn btn-default" type="button" data-dismiss="modal">Cerrar</button>
                      </div>
                    </div>
                  </form>  
                </div>
              </div>
             
              <div class="modal fade" id="myModalCliente" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog" style="width: 40% !important;">
                  <div class="modal-content">
                    <form action="" method="post" name="formaguardarcliente" id="formaguardarcliente">    
                      <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">Datos del cliente</h4>
                      </div>
                      <div class="modal-body">
                        
                          <div class="form-group col-lg-6 col-md-6 col-xs-12">
                            <label for="">Tipo Dcumento</label>
                            <select class="form-control select-picker" name="tipo_documento1" id="tipo_documento1">
                              <option value="RIF">RIF</option>
                              <option value="CEDULA">CEDULA</option>
                            </select>
                          </div>
                          <div class="form-group col-lg-6 col-md-6 col-xs-12">
                            <label for="">Razon Social/Cedula</label>
                            <input class="form-control" type="text" name="num_documento1" id="num_documento1" maxlength="20" placeholder="Razon Social/Cedula">
                            <input class="form-control" type="hidden" name="tipo_persona1" id="tipo_persona1" value="Cliente">
                          </div>
                          <div class="form-group col-lg-12 col-md-12 col-xs-12">
                            <label for="">Nombre</label>
                            <input class="form-control" type="text" name="nombre1" id="nombre1" maxlength="200" placeholder="Nombre del cliente" autofocus required>
                          </div>
                          <div class="form-group col-lg-12 col-md-12 col-xs-12">
                            <label for="">Direccion</label>
                            <input class="form-control" type="text" name="direccion1" id="direccion1" maxlength="600" placeholder="Direccion">
                          </div>
                          <div class="form-group col-lg-6 col-md-6 col-xs-12">
                            <label for="">Telefono</label>
                            <input class="form-control" type="text" name="telefono1" id="telefono1" maxlength="20" placeholder="Número de Telefono">
                          </div>
                          <div class="form-group col-lg-6 col-md-6 col-xs-12">
                            <label for="">Email</label>
                            <input class="form-control" type="email" name="email1" id="email1" maxlength="50" placeholder="Email">
                          </div>
                      </div>
                      <div class="modal-footer">
                        <button class="btn btn-default" type="button" data-dismiss="modal">Cerrar</button>
                        <button class="btn btn-success" type="submit" id="btnGuardarCliente">Guardar</button>
                    
                    
                      </div>
                    </form>
                  </div>
                </div>
              </div>

              <div class="modal fade" id="myModalFactura" 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 la Factura</h4>
                    </div>
                    <div class="modal-body">
                      <table id="tblarticulosfacturas" class="table table-striped table-bordered table-condensed table-hover">
                        <thead>
                          <th>Opciones</th>
                          <th>Nota Entrega</th>
                          <th>Factura</th>
                          <th>Fecha</th>
                          <th>Monto</th>
                          <th>Estado</th>
                        </thead>
                        <tbody>
                          
                        </tbody>
                        <tfoot>
                        <th>Opciones</th>
                        <th>Nota Entrega</th>
                          <th>Factura</th>
                          <th>Fecha</th>
                          <th>Monto</th>
                          <th>Estado</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-->

              <div class="modal fade" id="myModalFacturad" 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 la Factura</h4>
                    </div>
                    <div class="modal-body">
                      <table id="tblarticulosfacturasd" class="table table-striped table-bordered table-condensed table-hover">
                        <thead>
                          <th>Opciones</th>
                          <th>Nota Entrega</th>
                          <th>Factura</th>
                          <th>Fecha</th>
                          <th>Monto</th>
                          <th>Estado</th>
                        </thead>
                        <tbody>
                          
                        </tbody>
                        <tfoot>
                        <th>Opciones</th>
                        <th>Nota Entrega</th>
                          <th>Factura</th>
                          <th>Fecha</th>
                          <th>Monto</th>
                          <th>Estado</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-->

                <!--fin centro-->
            </div>
          </div>
        </div>
      <!-- /.box -->
      </section>
      <!-- /.content -->
    </div>
    
  <?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/notacreditonotaentrega.js"></script>
  </body>
  </html> 
<?php 
}

ob_end_flush();
  ?>

