<?php
  $ruta="../../../";
  include_once($ruta."class/dominio.php");
  $dominio=new dominio;
  include_once($ruta."class/cobro.php");
  $cobro=new cobro;
  include_once($ruta."class/chofer.php");
  $chofer=new chofer;
  include_once($ruta."class/recogido.php");
  $recogido=new recogido;
   include_once($ruta."class/vusuario2.php");
  $vusuario2=new vusuario2;
  include_once($ruta."class/vadmejecutivo.php");
  $vadmejecutivo=new vadmejecutivo;
  include_once($ruta."funciones/funciones.php");
  session_start();  
  extract($_GET);

  $idus=$_SESSION["codusuario"];
  //$lblcode=ecUrl($idus);
$vuss=$vusuario2->muestra($idus);
//$valor=dcUrl($lblcode);
//$cho=$chofer->muestra($valor);
$deje=$vadmejecutivo->mostrarUltimo("idpersona=".$vuss['idpersona']);
$cho=$chofer->mostrarUltimo("idadmejecutivo=".$deje['idvadmejecutivo']);
$idchofer=$cho["idchofer"];
?>
<!DOCTYPE html>
<html lang="es">
<head>
    <?php
      $hd_titulo="Registrar pago a Socios";
      include_once($ruta."includes/head_basico.php");
    ?>
</head>
<body>
    <?php
      include_once($ruta."head.php");
    ?>
    <div id="main">
      <div class="wrapper">
        <?php
          $idmenu=1117;
          include_once($ruta."aside.php");
          include_once($ruta."includes/head_tabla.php");
          include_once($ruta."includes/head_tablax.php");
        ?>
        <section id="content">
          <!--breadcrumbs start-->
          <div id="breadcrumbs-wrapper">
            <div class="container">
              <div class="row">
                <div class="col s12 m12 l12" style="background: white; text-align: center; color:#021e65; font-size: 25px; border-radius: 5px; border: #CBCBCB 1px solid; font-weight: bold;">
                <?php echo $hd_titulo; ?>
                <div class="col s12 m12 l12">
                      <div class="col s12 m12 l12">Nombre: <b><?php echo $deje['nombre'].' '.$deje['paterno'].' '.$deje['materno'] ?></b></div>
                      <div class="col s12 m12 l12">Carnet: <b><?php echo $deje['carnet'].' '.$deje['expedido'] ?></b></div>
                     </div>
              </div>
              </div>
              
            </div>
          </div>
           
           <div class="row section">
        <div class="col s12 m6 l6">

          <div class="col s12 m12 l12" style="border-radius: 5px; border: 1px solid #E8E8E8; background: white;"> 
                  <div class="row" >
                      <div class="col s12 m12 l12">
                      <div class="col s12 m12 l12"> <b>Mis pendientes de retiro</b></div>
                     </div>
                      <div class="divider">   </div>
                      <table id="example2" class="display" cellspacing="0" width="100%">             
                        <thead>
                          <tr>
                            <th>Fecha movimiento</th>
                            <th>Hora</th> 
                            <th style="text-align: center;">Tarifa cobrado Bs.</th>
                          </tr>
                        </thead>                        
                        <tbody>
                          <?php
                          $sumar=0;
                          foreach($cobro->mostrarTodo("idchofer=".$idchofer." and estado=1") as $f)//2=RECOGIDO EFECTIVO
                          {
                          ?>
                          <tr>
                            <td><?php echo $f['fechacreacion'] ?></td>
                            <td><?php echo $f['horacreacion'] ?></td>
                            <td style="text-align: center;"><?php echo number_format($f['monto'], 2, '.', '') ?></td>
                          </tr>
                          <?php
                           $sumar=$sumar+number_format($f['monto'], 2, '.', '');
                            }
                          ?>
                        </tbody>
                        <tfoot>
                          <tr>
                            <th></th>
                            <th></th> 
                            <th style="text-align: center;"><?php echo 'TOTAL:Bs.'.number_format($sumar, 2, '.', '') ?></th>
                          </tr>
                        </tfoot>
                      </table>
                                          
                  </div>
                <div class="divider">   </div>  
                      </div>
        </div>
       
        <div class="col s12 m6 l6">
               
           <div class="col s12 m12 l12">
            <div class="col s12 m12 l12  "><!-- blue lighten-4 -->
                 <form class="col s12" id="idform" action="return false" onsubmit="return false" method="POST">
                <div class="col s12 m12 l12" style="border-radius: 5px; border: 1px solid #E8E8E8; background: white;"> 
                  <div class="row" >
                      <div class="col s12 m12 l12" style="background: white; text-align: center; color:#021e65; font-size: 25px;  font-weight: bold;">
                        Mis Movimientos de retiros realizados en efectivo
                      </div>
                      <div class="divider">   </div>
                      <table id="example3" class="display" cellspacing="0" width="100%">             
                        <thead>
                          <tr>
                            <th>Fecha movimiento</th>
                            <th>Hora</th> 
                            <th style="text-align: right;">Total recogido Bs.</th>
                            <th>Opciones</th> 
                          </tr>
                        </thead>
                        <tfoot>
                          <tr>
                            <th></th>
                            <th></th> 
                            <th></th> 
                            <th></th>
                          </tr>
                        </tfoot>
                        <tbody>
                          <?php
                          foreach($recogido->mostrarTodo("idchofer=".$idchofer." and estado=1") as $f)
                          {
                            $lblcode=ecUrl($f['idrecogido']);
                          ?>
                          <tr>
                            <td><?php echo $f['fechacreacion'] ?></td>
                            <td><?php echo $f['horacreacion'] ?></td>
                            <td style="text-align: right;"><?php echo number_format($f['montototal'], 2, '.', '') ?></td>
                            <td><a href="../caja/imprimir/?lblcode=<?php echo $lblcode ?>" class="btn-jh waves-effect waves-light darken-4 green" target="_blank"><i class="fa fa-file-pdf-o"></i> Ver</a></td>
                          </tr>
                          <?php
                            }
                          ?>
                        </tbody>
                      </table>
                                          
                  </div>
                      </div>
                      
              </form>
            </div>           
          </div>


        </div>


            </div> 
          <?php
           // include_once("../footer.php");
          ?>
        </section>
      </div>
    </div>
    <div id="idresultado"></div>
    <?php
      include_once($ruta."includes/script_basico.php");
      include_once($ruta."includes/script_tabla.php");
      include_once($ruta."includes/script_tablax.php");
    ?>
    <script type="text/javascript">
        $(document).ready(function() {
      $('#example').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ]
      });
        $('#example1').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ]
      });
          $('#example2').DataTable( {
        dom: 'Bfrtip',
        "order": [[ 0, "asc" ]],
        buttons: [
            //'copy', 'csv', 'excel', 'pdf', 'print'
        ]
      });
          $('#example3').DataTable( {
        dom: 'Bfrtip',
        "order": [[ 0, "asc" ]],
        buttons: [
            //'copy', 'csv', 'excel', 'pdf', 'print'
        ]
      });
         
    });
        function retirar(idcho)
        {
           swal({
                  title: "¿Esta seguro?",
                  text: "Se registrar retiro",
                  type: "warning",
                  showCancelButton: true,
                  confirmButtonColor: "#2c2a6c",
                  confirmButtonText: "Registrar",
                  closeOnConfirm: false,
                  showLoaderOnConfirm: true
                }, function () {
                  var str = $( "#idform" ).serialize();
                  $.ajax({
                    url: "guardarretiro.php",
                    type: "POST",
                    data: "idchofer="+idcho,
                    success: function(resp){
                      setTimeout(function(){     
                        console.log(resp);
                        $('#idresultado').html(resp);   
                      }, 1000);
                    }
                  }); 
                });
        }


    </script>
</body>

</html>