<head>
  <!-- Manda a traer el javascript para validar el formulario -->
  <script type="text/javascript" src="<?php echo base_url()?>assets/dist/js/site.js"></script>
  <link rel="stylesheet" href="<?php echo base_url().'assets/dist/css/validacion.css'?>">
  <script type="text/javascript" src="<?php echo base_url()?>assets/dist/js/HClientes.js"></script>
  <link rel="stylesheet" href="<?php echo base_url().'assets/dist/css/styles.css'?>">
   <link rel="stylesheet" type="text/css" href='<?php echo base_url()?>assets/dist/css/table.css' />
   <style>
   @media (max-width:400px)
   {
     .div-buscador{
       width: 110% !important;
       float: left;
     }
   }
   </style>
   <link rel="stylesheet" href="<?php echo base_url().'assets/plugins/select/bootstrap-select.min.css'?>">
		<!-- Latest compiled and minified JavaScript -->
		<script src="<?php echo base_url().'assets/plugins/select/bootstrap-select.min.js'?>"></script>

</head>
 <div class="col-md-12 col-xs-12">
 <a href="javascript:window.history.back()" ><button type="button" class="btn btn-danger pull-left col-md-2 col-sm-4 col-xs-12 "><span class="glyphicon glyphicon-circle-arrow-left"> </span> Regresar</button></a>
</div>
<div class="titulo">
<h1>Histórico de compras</h1>
<h3 id="cliente"><?php foreach ($ReNombre as $i => $Nombre)    
    echo  $Nombre; ?> </h3>
</div>


  <div class="col-md-7 col-xs-8 navbar-form navbar div-buscador">
    <label class="label-buscar">Buscar:</label>
    <input type="text" id="buscador" class="form-control search"/>
  </div>

<div id="tabla" style='width: 100%;'>
<table class="table table-striped " id="conceptos">
      <tr>
        <th>Folio</th>
        <th>Concepto</th>
        <th>Fecha</th>
        <th>Cantidad</th>
        <th>Total Venta</th>
        <th>Exhibiciones</th>
        <th>Abono</th>
        <th>Adeudo</th>
        <th colspan="2">Acciones</th>
      </tr>

      <?php 
          if ($consulta1 != FALSE){
            foreach ($consulta1 as $fila){
              echo "<tr>";
                echo "<td class='idventa'  style='display:none'>".$fila->IdVentasProductos."</td>";
                echo "<td class='tipo'  style='display:none'>producto</td>";
                echo "<td class='folio'>".$fila->folio."</td>";
                echo "<td>".$fila->NombreProducto."</td>";
                echo "<td>".date("d-m-Y H:i:s", strtotime($fila->FechaVenta))."</td>";                
                echo "<td>".$fila->PiezasP."</td>";
                echo "<td>".$fila->TotalPagar."</td>";
                echo "<td>".$fila->ExhibicionesProducto."</th>";
                echo "<td>".$fila->Abono."</td>";
                echo "<td class='adeudo'>".$fila->Adeudo."</td>";
                echo "<td class='accion' style='visibility:hidden'>";
                echo "<a href='".base_url()."pagos/franquiciatario/pagosF/editar/".$fila->IdVentasProductos."/".$fila->ventas_IdVentas."' class='label label-primary'>";
                echo "<span class='glyphicon glyphicon-pencil'></a></span>";
                echo "</td>";
                echo "<td class='imprimirDetalle' data-toggle='tooltip' data-placement='bottom' title='Imprimir histórico de pagos'>";
                echo "<a class='label label-warning' >";
                echo "<span class='glyphicon glyphicon-print'></a></span>";
                echo "</td>";
                echo "</tr>";

            } 
          } 
                    if ($consulta2 != FALSE){
            foreach ($consulta2 as $fila){
              echo "<tr>";
                echo "<td class='idventa'  style='display:none'>".$fila->IdVentasServicios."</td>";
                echo "<td class='tipo'  style='display:none'>servicioA</td>";
                echo "<td class='folio'>".$fila->folio."</td>";
                echo "<td>".$fila->NombreServicio."</td>";
                echo "<td>".date("d-m-Y H:i:s", strtotime($fila->FechaVenta))."</td>";     
                echo "<td>".$fila->SesionesS."</td>";
                echo "<td>".$fila->TotalPagar."</th>";
                echo "<td>".$fila->exhibiciones_IdExhibiciones."</th>";
                echo "<td>".$fila->Abono."</td>";
                echo "<td class='adeudo'>".$fila->Adeudo."</td>";
                echo "<td class='accion' style='visibility:hidden'>";
                echo "<a href='".base_url()."pagos/franquiciatario/pagosF/editar2/".$fila->IdVentasServicios."/".$fila->ventas_IdVentas."' class='label label-primary' id='BotonServA'>";
                echo "<span class='glyphicon glyphicon-pencil'></a></span>";
                echo "</td>";
                echo "<td class='imprimirDetalle' data-toggle='tooltip' data-placement='bottom' title='Imprimir histórico de pagos'>";
                echo "<a class='label label-warning'>";
                echo "<span class='glyphicon glyphicon-print'></a></span>";
                echo "</td>";
               echo "</tr>";
            } 
          }  

          if ($consulta3 != FALSE){
            foreach ($consulta3 as $fila){
              echo "<tr>";
                echo "<td class='idventa'  style='display:none'>".$fila->IdVentasServicios."</td>";
                echo "<td class='tipo'  style='display:none'>servicioG</td>";
                echo "<td class='folio'>".$fila->folio."</td>";
                echo "<td>".$fila->NombreServicio."</td>";
                echo "<td>".date("d-m-Y H:i:s", strtotime($fila->FechaVenta))."</td>";  
                echo "<td>".$fila->SesionesS."</td>";
                echo "<td>".$fila->TotalPagar."</th>";
                echo "<td>".$fila->exhibiciones_IdExhibiciones."</th>";
                echo "<td>".$fila->Abono."</td>";
                echo "<td class='adeudo'>".$fila->Adeudo."</td>";
                echo "<td class='accion' style='visibility:hidden'>";
                echo "<a href='".base_url()."pagos/franquiciatario/pagosF/editar3/".$fila->IdVentasServicios."/".$fila->ventas_IdVentas."' class='label label-primary' id='BotonServG'>";
                echo "<span class='glyphicon glyphicon-pencil'></a></span>";
                echo "</td>";
                echo "<td class='imprimirDetalle' data-toggle='tooltip' data-placement='bottom' title='Imprimir histórico de pagos'>";
                echo "<a class='label label-warning'>";
                echo "<span class='glyphicon glyphicon-print'></a></span>";
                echo "</td>";
              echo "</tr>";
            } 
          } 
          if ($consulta4 != FALSE){
            $cont=0;
            foreach ($consulta4 as $fila){
              $cont = $cont+ 1;
              echo "<tr>";
                echo "<td class='idventa'  style='display:none'>".$fila->IdVentasPromociones."</td>";
                echo "<td class='tipo'  style='display:none'>promociones</td>";
                echo "<td class='folio'>".$fila->folio."</td>";
                echo "<td>".$fila->NombrePromocion."</td>";
                echo "<td>".date("d-m-Y H:i:s", strtotime($fila->FechaVenta))."</td>";  
                echo "<td>".$fila->SesionesPr."</td>";
                echo "<td>".$fila->TotalPagar."</td>";
                echo "<td>".$fila->exhibiciones_IdExhibiciones."</td>";
                echo "<td>".$fila->Abono."</td>";
                echo "<td class='adeudo'>".$fila->Adeudo."</td>";
                echo "<td class='accion' style='visibility:hidden'>";
                echo "<a href='".base_url()."pagos/franquiciatario/pagosF/editarPro/".$fila->IdVentasPromociones."/".$fila->ventas_IdVentas."' class='label label-primary' id='BotonPromo'>";
                echo "<span class='glyphicon glyphicon-pencil'></a></span></button>";
                echo "</td>";
                echo "<td class='imprimirDetalle' data-toggle='tooltip' data-placement='bottom' title='Imprimir histórico de pagos'>";
                echo "<a class='label label-warning'>";
                echo "<span class='glyphicon glyphicon-print'></a></span>";
                echo "</td>";
                echo "</tr>";
            
            }

          } 
   ?>

  </table>
</div>

<script>
  var datos1 = <?php echo json_encode($consulta1, JSON_PRETTY_PRINT);?>;
  var datos2 = <?php echo json_encode($consulta2, JSON_PRETTY_PRINT);?>;
  var datos3 = <?php echo json_encode($consulta3, JSON_PRETTY_PRINT);?>;
  var datos4 = <?php echo json_encode($consulta4, JSON_PRETTY_PRINT);?>;
  var datosTicket = <?php echo json_encode($datosFranquiciaTicket, JSON_PRETTY_PRINT);?>;
  var base_url='<?php echo base_url()?>';
</script>