<?php 
//activamos almacenamiento en el buffer
//ob_start();
//session_start();
if (!isset($_SESSION['nombre'])) {
  header("Location: login.html");
}else{
  //if ($_SESSION['banco']==1) {
  if ($_SESSION['banco']==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">
                  
                    <div class="box-tools pull-right">
                      <h1 class="box-title">Cuentas por Pagar\Pagos
                    </div> 
                </div>
                <!--box-header-->
                <!--centro-->
                <div class="panel-body table-responsive" id="listadoregistros">
                  <table id="tbllistado" class="table table-striped table-bordered table-condensed table-hover">
                    <thead>
                      <th>Opciones</th>
                      <th>Fecha</th>
                      <th>Referencia</th>
                      <th>Pagado</th>
                      <th>Retencion</th>
                      <th>Proveedor</th>
                      <th>Cuenta</th>
                      <th>Estado</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="panel-body" style="height: 400px;" id="clienteestado">
                   <div class="form-group col-lg-6 col-md-6 col-xs-12">
                    <label for="">Cuenta de Banco</label>
                    <input class="form-control" type="hidden" name="idpersona" id="idpersona">
                    <input class="form-control" type="hidden" name="idmovimientobanco" id="idmovimientobanco">
                    <input class="form-control" type="hidden" name="tipo_persona" id="tipo_persona" value="Cliente">
                    <input class="form-control" type="text" name="nombre" id="nombre" maxlength="100" placeholder="Nombre del cliente" required>
                    
                  </div> 
                  <div class="form-group col-lg-12 col-md-12 col-xs-12">
                    <table id="detalles" class="table table-striped table-bordered table-condensed table-hover">
                      <thead style="background-color:#A9D0F5">
                        <th>Opcion</th>
                        <th>Banco</th>
                        <th>Cobrado</th>
                        <th>Pagado</th>
                        <th>Saldo</th>
                      </thead>
                       <tfoot>
                        <th>SALDO</th>
                        <th></th>
                        <th></th>
                        <th><h4 id="total">0.00 Bs.</h4><input type="hidden" name="total_venta" id="total_venta"></th>
                      </tfoot> 
                      <tbody>
                        
                      </tbody>
                    </table>
                  </div>           
                </div>
               
                <div class="box-footer" id="clienteestado1">
                  <button class="btn bg-red btn-app pull-right" onclick="cancelarform()" type="button"><i class="fa fa-arrow-circle-left"></i> Regresar</button>
                </div>

                 <!--Modal-->
                <div class="modal fade" id="myModalM" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                  <div class="modal-dialog" style="width: 40% !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>  
                    
                    <div class="modal-body ">
                      
                      <table id="tbdocumentos" class="table table-hover" style="width:100%">
                        <thead>
                          <th>Nro Doc.</th>
                          <th>Tipo</th>
                          <th>Monto</th>
                          <th>Abono</th>
                          <th>Pendiente</th>
                          
                        </thead>
                        <tbody>
                          
                        </tbody>
                        <tfoot>
                          <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 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="modal-body ">
                          <input class="form-control" type="hidden" name="idpagocliente" id="idpagocliente">
                          <input class="form-control" type="hidden" name="idpagoproveedor" id="idpagoproveedor">
                          <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">
                          <input class="form-control" type="hidden" name="idusuario" id="idusuario" value=<?php echo $_SESSION['idusuario'] ?>>
                          <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%"> -->
                          <table id="tbdocumentos1" class="table table-striped table-bordered table-condensed table-hover display nowrap" style="width:100%" cellspacing="0">
                            <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>
                        
                      </form>  
                    </div>
                  </div>
                </div>

               
                
              
              <!--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/pagos.js"></script>
      </body>
  </html> 
<?php  
}
  ob_end_flush();
?>
