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

if (!isset($_SESSION['nombre'])) {
  header("Location: login.html");
}else{
  if ($_SESSION['cxc']==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,true)" id="btnagregar"><i class="fa fa-plus-circle"></i> Agregar</button></h1>
                <div class="box-tools pull-right">
                  <h1 class="box-title">CxC\Actualizar Cobranza Vendedores
                </div>
                </br>
              </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" align="center">Opciones</th>
                  <th style="text-align:center" align="center">Fecha</th>
                  <th style="text-align:center" align="center">Vendedor</th>
                  <th style="text-align:center" align="center">Cliente</th>
                  <!--<th>Cuenta</th>-->
                  <th style="text-align:center" align="center">Forma de Pago</th>
                  <th style="text-align:center" align="center">Referencia</th>
                  <th style="text-align:center" align="center">Monto Bs</th>
                  <th style="text-align:center" align="center">Monto $</th>
                  <th style="text-align:center" align="center">Estado</th>
                  </thead>
                  <tbody>
                  </tbody>
                  <tfoot>
                    <th></th>
                    <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="idcliente1" id="idcliente1">
                  <!-- <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'] ?>" >
                  <!-- Solo Para Daniel (JVG) para el calculo del iva percibido -->
                  <input class="form-control" type="hidden" name="porcentajeprecio" id="porcentajeprecio" value="<?php echo $_SESSION['porcentajeprecio_empresa'] ?>" >
                  <input class="form-control" type="hidden" name="impuestoiva" id="impuestoiva" value="<?php echo $_SESSION['iva_empresa'] ?>" >
                  <input class="form-control" type="hidden" name="indice" id="indice">
                  <input class="form-control" type="hidden" name="impuesto" id="impuesto" value=<?php echo $_SESSION['iva_empresa'] ?>>
                  <input class="form-control" type="hidden" name="tipo_documento" id="tipo_documento">
                  <input class="form-control" type="hidden" name="num_documento1" id="num_documento1">
                  <input class="form-control" type="hidden" name="listaprecio" id="listaprecio">
                  <input class="form-control" type="hidden" name="fecha_despacho" id="fecha_despacho">
                  
                   <span id="listaprecio"></span> 

                 <!--  <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_documento1" id="num_documento1" maxlength="20" placeholder="Razón Social/Cédula">
                  </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" >
                    </select>
                    
                  </div>
                   <!-- Meraki -->
                   <div class="form-group col-lg-2 col-md-2 col-xs-12">
                      <label for="">Licencia de Licor</label>
                      <input class="form-control" type="text" name="licencia_licor" id="licencia_licor" readonly>
                    </div>
                  <!-- Meraki -->
                  <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="">Tipo Comprobante </label>
                    <select name="tipo_comprobante" id="tipo_comprobante" class="form-control selectpicker" required>
                      <option value="Factura">Factura</option>
                      <option value="NotaEntrega">Nota de Entrega</option>
                      <option value="Regalo">Regalo</option>
                      
                    </select>
                  </div>
                 
                  
                  
                  
                 
                  
                 <!--  <div class="form-group col-lg-2 col-md-2 col-xs-6">
                    <label for="" id="tipodocumentoc"></label>
                    <input class="form-control" type="text" name="serie_comprobante" id="serie_comprobante" maxlength="20" placeholder="Número de Control" readonly>
                    <input class="form-control" type="text" name="serie_comprobante1" id="serie_comprobante1" maxlength="20" placeholder="Número de Control Nota de Entrega" readonly>
                  </div>
                  <div class="form-group col-lg-2 col-md-2 col-xs-6">
                    <label for="" id="tipodocumentof"></label>
                    <input class="form-control" type="text" name="num_comprobante" id="num_comprobante" maxlength="20" placeholder="Número Factura" readonly>
                    <input class="form-control" type="text" name="num_comprobante1" id="num_comprobante1" maxlength="20" placeholder="Número de Nota Entrega" readonly>
                  </div> -->
                  <!-- Meraki -->
                    <div class="form-group col-lg-1 col-md- col-xs-6">
                      <label for="" id="tipodocumentoc"></label>
                      <input class="form-control" type="text" name="serie_comprobante" id="serie_comprobante" maxlength="20" placeholder="Número de Control" readonly>
                      <input class="form-control" type="text" name="serie_comprobante1" id="serie_comprobante1" maxlength="20" placeholder="Número de Control Nota de Entrega" readonly>
                    </div>
                    <div class="form-group col-lg-1 col-md-1 col-xs-6">
                      <label for="" id="tipodocumentof"></label>
                      <input class="form-control" type="text" name="num_comprobante" id="num_comprobante" maxlength="20" placeholder="Número Factura" readonly>
                      <input class="form-control" type="text" name="num_comprobante1" id="num_comprobante1" maxlength="20" placeholder="Número de Nota Entrega" readonly>
                    </div>
                  <!-- // Meraki   
                  <div class="form-group col-lg-2 col-md-2 col-xs-12">
                    <label for="">Orden de Compra</label>
                    <input class="form-control" type="text" name="ordendecompra" id="ordendecompra">
                  </div>-->
                  <input class="form-control" type="hidden" name="ordendecompra" id="ordendecompra">
                  <div class="form-group col-lg-2 col-md-2 col-xs-12">
                    <label for="">Almacen</label>
                    <select name="idalmacen1" id="idalmacen1" class="form-control selectpicker" required>
                    </select>
                  </div>
                 <!-- <div class="form-group col-lg-2 col-md-2 col-xs-12">
                    <label for="">Zona</label>
                    <input class="form-control" type="text" name="zona" id="zona" readonly>
                   
                  </div> -->
                  <input class="form-control" type="hidden" name="zona" id="zona" readonly> 
                   <div class="form-group col-lg-2 col-md-2 col-xs-12">
                    <label for="">Días Crédito</label>
                    <input class="form-control" type="hidden" name="diacredito" id="diacredito" readonly>
                     
                    <select name="iddiacredito" id="iddiacredito" class="form-control selectpicker" required>
                    </select>
                  </div><!-- 
                   <input class="form-control" type="hidden" name="iddiacredito" id="iddiacredito"> -->
                  <!-- <input class="form-control" type="hidden" name="zona" id="zona" >
                  <input class="form-control" type="hidden" name="diacredito" id="diacredito" >-->
                  <!-- <input class="form-control" type="hidden" name="iddiacredito" id="iddiacredito">  --> 
                  <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 readonly>
                    </select>
                  </div>
                  <div class="form-group col-lg-1 col-md-1 col-xs-12">
                    <label for="">Chofer</label>
                    <select name="idtransportista" id="idtransportista" class="form-control selectpicker" required>
                    </select>
                  </div>
                  <div class="form-group col-lg-1 col-md-1 col-xs-12">
                    <label for="">Vehículo</label>
                    <select name="idtransporte" id="idtransporte" class="form-control selectpicker" required>
                    </select>
                  </div>
                 
                  <!-- <div class="form-group col-lg-2 col-md-2 col-xs-6">
                    <label for="">Impuesto (IVA): </label>
                    <input class="form-control" type="text" name="impuesto" id="impuesto" maxlength="20" placeholder="IVA" value=<?php echo $_SESSION['iva_empresa'] ?> readonly>
                  </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">
                      <!-- 
                        Esta comentado porque para el cliente de exportacion la carga de datos es diferente
                        <thead style="background-color:#A9D0F5">
                        <th width=10>Opciones</th>
                        <th>Articulo</th>
                        <th>NúmTarj.</th>
                        <th>Lote/Fecha</th>
                        <th>Cantidad</th>
                        <th>Precio</th>
                        <th>Porcentaje</th>
                        <th>Descuento</th>
                        <th>Subtotal</th>
                      </thead>
                      <tfoot>
                        <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td>Sub-Total</td>
                            <td align="right"><p id="subtotal"></p></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td>Iva</td>
                            <td align="right"><p id="iva"></p></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td>Exento</td>
                            <td align="right"><p id="exento"></p></td>
                        </tr>
                        <tr>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th>TOTAL</th>
                            <th align="right"><h4 id="total"></h4>
                              <input type="hidden" name="total_venta1" id="total_venta1" disabled>
                              <input type="hidden" name="total_venta" id="total_venta">
                            </th>
                        </tr>
                      </tfoot> -->
                      
                    </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="#myModalA">
                        <button type="button" class="btn bg-blue btn-app pull-left" id="btnAgregarArt"><i class="fa fa-barcode"></i><span id=listaa>Productos</span></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-barcode"></i><span id=listab>Productos</span></button>
                      </a> 
                      <a data-toggle="modal" href="#myModalAc">
                        <button type="button" class="btn bg-yellow btn-app pull-left" id="btnAgregarArtc"><i class="fa fa-barcode"></i><span id=listac>Productos</span></button>
                      </a> 
                      <a data-toggle="modal" href="#myModalAd">
                        <button type="button" class="btn bg-orange btn-app pull-left"   id="btnAgregarArtd"><i class="fa fa-barcode"></i><span id=listad>Productos</span></button>
                      </a>
                      <a data-toggle="modal" href="#myModalAe">
                        <button type="button" class="btn bg-navy btn-app pull-left"   id="btnAgregarArte"><i class="fa fa-barcode"></i><span id=listae>Productos</span></button>
                      </a>
                      <a data-toggle="modal" href="#myModalB">
                        <button type="button" class="btn bg-olive btn-app pull-left" id="btnAgregarPed"><i class="fa fa-inbox"></i>Pedidos</button>
                      </a>  
                      <a data-toggle="modal" href="#myModalS">
                        <button type="button" class="btn bg-purple btn-app pull-left" id="btnAgregarSer"><i class="fa fa-edit"></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-save"></i> Procesar</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="myModalAd" 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="tblarticulosd" 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="myModalAe" 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="tblarticulose" 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: 55% !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 pedido</h4>
                    </div>
                    <div class="modal-body">
                      <table id="tblpedidos" class="table table-striped table-bordered table-condensed table-hover">
                        <thead>
                          <th>Opciones</th>
                          <th>Fecha</th>
                          <th>Vendedor</th>
                          <th>Cliente</th>
                          <th>Cuenta</th>
                          <th>FormaPago</th>
                          <th>Referencia</th>
                          <th>Monto Bs</th>
                          <th>Monto $</th>
                          <th>Estado</th>
                        </thead>
                        <tbody>
                          
                        </tbody>
                        <tfoot>
                          <th>Opciones</th>
                          <th>Fecha</th>
                          <th>Vendedor</th>
                          <th>Cliente</th>
                          <th>Cuenta</th>
                          <th>FormaPago</th>
                          <th>Referencia</th>
                          <th>Monto Bs</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="myListaprecio" 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">Seleccione Lista de Precio</h4>
                      </div>
                      <div class="modal-body">
                      
                        <div class="form-group col-lg-6 col-md-6 col-xs-12">    
                          <div class="social-auth-links text-center">
                            <button type="botton" class="btn btn-default btn-block btn-flat" id="btnListaa" onclick="buscarlistaprecio('a')">Lista A</button>
                          </div>
                        </div>
                        <div class="form-group col-lg-6 col-md-6 col-xs-12">    
                          <div class="social-auth-links text-center">
                            <button type="botton" class="btn btn-default btn-block btn-flat" id="btnListab" onclick="buscarlistaprecio('b')">Lista B</button>
                          </div>
                        </div>
                        <div class="form-group col-lg-6 col-md-6 col-xs-12">    
                          <div class="social-auth-links text-center">
                            <button type="botton" class="btn btn-default btn-block btn-flat" id="btnListac" onclick="buscarlistaprecio('c')"></i>Lista C</button>
                          </div>
                        </div>

                        <div class="form-group col-lg-6 col-md-6 col-xs-12">    
                          <div class="social-auth-links text-center">
                            <button type="botton" class="btn btn-default btn-block btn-flat" id="btnListad" onclick="buscarlistaprecio('d')"></i>Lista D</button>
                          </div>
                        </div>

                        <div class="form-group col-lg-6 col-md-6 col-xs-12">    
                          <div class="social-auth-links text-center">
                            <button type="botton" class="btn btn-default btn-block btn-flat" id="btnListae" onclick="buscarlistaprecio('e')"></i>Lista E</button>
                          </div>
                        </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="myModalstock" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog" style="width: 25% !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">Stock x Almacén</h4>
                    </div>
                    <div class="modal-body">
                      <table id="tblstock" class="table table-striped table-bordered table-condensed table-hover">
                        <thead>
                          <th>Almacén</th>
                          <th>Stock</th>
                          
                        </thead>
                        <tbody>
                          
                        </tbody>
                        <tfoot>
                          <th>Almacén</th>
                          <th>Stock</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="myModalFechadespacho" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog" style="width: 20% !important;">
                  <div class="modal-content">
                    <!-- <form action="" method="post" name="formaguardarFechadespacho" id="formaguardarFechadespacho">  -->   
                      <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">Actualizar Fecha de Despacho</h4>
                      </div>
                      <div class="modal-body">
                        
                        <div class="form-group col-lg-12 col-md-12 col-xs-12">
                          <label for="">Fecha</label>
                          <input class="form-control" type="date" name="fecha_despacho1" id="fecha_despacho1" required>
                        </div>
                      </div>
                      <div class="modal-footer">
                        <button class="btn btn-default" type="button" data-dismiss="modal">Cerrar</button>
                        <button class="btn btn-success" type="button" id="btnGuardarFechadespacho">Guardar</button>
                    
                    
                      </div>
                   <!--  </form> -->
                  </div>
                </div>
              </div>

              <div class="modal fade" id="myModalM" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog" style="width: 75% !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">Documentos</h4>
                    </div>
                    <div class="box-body table-responsive no-padding">
                      <div class="modal-body ">
                        <table id="tbdocumentos" class="table table-striped table-bordered table-condensed table-hover" style="width:100%">
                          <thead>
                            <th>Nro Doc.</th>
                            <th>Tipo</th>
                            <th>Monto $</th>
                            <th>Monto Bs.</th>
                            <th>Abono $</th>
                            <th>Abono Bs.</th>
                            <th>Pendiente $</th>
                            <th>Pendiente Bs.</th>
                            
                          </thead>
                          <tbody>
                            
                          </tbody>
                          <tfoot>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></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>

              <div class="modal fade" id="myModalC" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog" style="width: 75% !important;">
                  <div class="modal-content">
                    <form action="" name="formulariomc" id="formulariomc" method="POST">
                      <div class="modal-header">
                        
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">Documentos</h4>
                      </div>
                      <div class="box-body table-responsive no-padding">
                        <div class="modal-body ">
                          <input class="form-control" type="hidden" name="idpagocliente" id="idpagocliente">
                          <input class="form-control" type="hidden" name="idpersonap" id="idpersonap">
                          <input class="form-control" type="hidden" name="idbancocuentap" id="idbancocuentap">
                          <input class="form-control" type="hidden" name="montopagop" id="montopagop">
                          <input class="form-control" type="hidden" name="montopagobp" id="montopagobp">
                          <div class="form-group col-lg-6 col-md-6 col-xs-12">
                            <label for="">Forma de Pago</label>
                            <select name="idformapago" id="idformapago" class="form-control selectpicker" data-Live-search="true" ></select>
                          </div>
                          
                          <div class="form-group col-lg-6 col-md-6 col-xs-12">
                              <label for="">Cuenta de Banco</label>
                              <select name="idbancocuenta" id="idbancocuenta" class="form-control selectpicker" data-Live-search="true" ></select>
                          </div>
                          <div class="form-group col-lg-3 col-md-3 col-xs-12">
                              <label for="">Tipo de Pago</label>
                              <select name="idtipopagos" id="idtipopagos" class="form-control selectpicker" data-Live-search="true" ></select>
                          </div>
                          <div class="form-group col-lg-3 col-md-3 col-xs-12">
                            <label for="">Fecha</label>
                            <input class="form-control" type="date" name="fecha_horap" id="fecha_horap" required>
                          </div>
                          <div class="form-group col-lg-6 col-md-6 col-xs-12">
                            <label for="">Referencia de Pago</label>
                            <input class="form-control" type="text" name="referencia" id="referencia" maxlength="20" placeholder="Referencia de Pago">
                          </div>
                          
                          <div class="form-group col-lg-3 col-md-3 col-xs-12">
                            <label for="">Monto del Pago $</label>
                            <input class="form-control" type="text" name="montopago" id="montopago"  value="0,00" placeholder="0,00">
                          </div>
                          <div class="form-group col-lg-3 col-md-3 col-xs-12">
                            <label for="">Monto del Pago Bs</label>
                            <input class="form-control" type="text" name="montopagob" id="montopagob"  value="0,00" placeholder="0,00">
                          </div>
                          <div class="form-group col-lg-3 col-md-3 col-xs-12">
                            <label for="">Tasa de cambio</label>
                            <input class="form-control" type="text" name="tasacambioventa" id="tasacambioventa"  value="0,00" placeholder="0,00">
                          </div>
                          <!-- <div class="form-group col-lg-3 col-md-3 col-xs-12">
                            <label for="">Diferencia</label>
                            <input class="form-control" type="text" name="montopagod" id="montopagod"  value="0,00" placeholder="0,00">
                          </div> -->
                          <table id="tbdocumentos1" class="table table-striped table-bordered table-condensed table-hover" style="width:100%">
                            <thead>
                              <th>Nro Doc.</th>
                              <th>Tipo</th>
                              <th>Monto $</th>
                              <th>Monto Bs.</th>
                              <th>Abono $</th>
                              <th>Abono Bs.</th>
                              <th>Pendiente $</th>
                              <th>Pendiente Bs.</th>
                              
                            </thead>
                            <tbody>
                              
                            </tbody>
                            <tfoot>
                              <th></th>
                              <th></th>
                              <th></th>
                              <th></th>
                              <th></th>
                              <th></th>
                              <th></th>
                              <th></th>
                            </tfoot>
                          </table>
                        </div>
                        <div class="modal-footer">
                          <button class="btn btn-default" type="button" data-dismiss="modal">Cerrar</button>
                          <button class="btn btn-primary" type="submit" name="procesarmc" id="procesarmc">Guardar</button>
                        </div>
                      </div>
                    </form>  
                  </div>
                </div>
              </div>
              
             <!--  <div class="modal fade" id="myModalMM" 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">Documentos</h4>
                      </div>
                      <div class="box-body table-responsive no-padding">
                        <div class="modal-body ">
                          <div class="form-group col-lg-6 col-md-6 col-xs-12">
                            <label for="">Forma de Pago</label>
                            <select name="idformapago" id="idformapago" class="form-control selectpicker" data-Live-search="true" ></select>
                          </div>
                          <div class="form-group col-lg-6 col-md-6 col-xs-12">
                              <label for="">Tipo de Pago</label>
                              <select name="idtipopagos" id="idtipopagos" class="form-control selectpicker" data-Live-search="true" ></select>
                          </div>
                          <div class="form-group col-lg-6 col-md-6 col-xs-12">
                              <label for="">Cuenta de Banco</label>
                              <select name="idbancocuenta" id="idbancocuenta" class="form-control selectpicker" data-Live-search="true" ></select>
                          </div>
                          <div class="form-group col-lg-3 col-md-3 col-xs-12">
                            <label for="">Referencia de Pago</label>
                            <input class="form-control" type="text" name="referencia" id="referencia" maxlength="20" placeholder="Referencia de Pago">
                          </div>
                          <div class="form-group col-lg-3 col-md-3 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-3 col-md-3 col-xs-12">
                            <label for="">Monto del Pago</label>
                            <input class="form-control" type="text" name="montopago" id="montopago"  value="0,00" placeholder="0,00">
                          </div>
                          <div class="form-group col-lg-3 col-md-3 col-xs-12">
                            <label for="">Diferencia</label>
                            <input class="form-control" type="text" name="montopagod" id="montopagod"  value="0,00" placeholder="0,00">
                          </div>
                          <table id="tbdocumentos1" class="table table-striped table-bordered table-condensed table-hover" style="width:100%">
                            <thead>
                              <th>Nro Doc.</th>
                              <th>Tipo</th>
                              <th>Monto $</th>
                              <th>Monto Bs.</th>
                              <th>Abono $</th>
                              <th>Abono Bs.</th>
                              <th>Pendiente $</th>
                              <th>Pendiente Bs.</th>
                              
                            </thead>
                            <tbody>
                              
                            </tbody>
                            <tfoot>
                              <th></th>
                              <th></th>
                              <th></th>
                              <th></th>
                              <th></th>
                              <th></th>
                              <th></th>
                              <th></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>
             <!-- /.box -->
          </div>
          <!-- /.col-md-12 -->
        </div>
         <!-- /.row -->
      </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/cobranzavendedores15.js"></script>
  </body>
  </html> 
<?php 
}

ob_end_flush();
  ?>

