  <div class="content-wrapper" style="margin-bottom: 20px">
    <div class="container">
      <div class="row pad-botm">
          <div class="col-md-12">
               <?php 
				    $akses = $this->session->userdata('akses');
				    if($akses=='spv') { ?>
				        <form class="header-line" class="form-inline" action="<?php echo base_url('kasir/rekapd1/') ?>" method="post">
					    <tr>
						    <td>Kedai</td>
						    <td>:</td>
						    <td>
							    <select  name="kedai" id="kedai" required>
								    <option height='45px' value="">Pilih Kedai</option>
								    <option <?php {echo 'selected';}?> value="KDR01">Ngronggo</option>
								    <option <?php {echo 'selected';}?> value="KDR02">Polim</option>
								    <option <?php {echo 'selected';}?> value="KDR03">Veteran</option>
								    <option <?php {echo 'selected';}?> value="KDR04">Gumul</option>
								    <option <?php {echo 'selected';}?> value="KDR05">Pare</option>
								    <option <?php {echo 'selected';}?> value="BLT01">Blitar</option>
								    <option <?php {echo 'selected';}?> value="NJK01">Nganjuk</option>
								    <option <?php {echo 'selected';}?> value="NJK02">Kertosono</option>
								    <option <?php {echo 'selected';}?> value="NJK03">Warujayeng</option>
								    <option <?php {echo 'selected';}?> value="JBG01">Jombang</option>
								    <option <?php {echo 'selected';}?> value="JBG03">Djoetek</option>
							    </select>
						    </td>
					        <td>Cuff Of Jam</td>
					        <td>:</td>			
					        <<input name='ujam' id='ujam' type='time' VALUE='<?php echo date("H:m") ?>' ></input>
					        <button  class="btn" type="submit" ><font color='blue' ><b>GO</b></font></button>
					    </tr>
				        </form>	
		        <?php } else { ?>
		            <form class="header-line" class="form-inline" action="<?php echo base_url('kasir/rekapd/') ?>" method="post">
					<tr>
					<label>Cut Off Jam :</label>
				
                    
					<input name='ujam' id='ujam' type='time' VALUE='<?php echo date("H:m") ?>' ></input>
					<button  class="btn" type="submit" ><font color='blue' ><b>GO</b></font></button>
					</tr>
				</form>	
		  <?php } ?>
              
				
			<!-- <h5 >REKAP <?php echo date_indo($tanggal) ?> <span class="pull-right"><a id="btnRekap" class="btn btn-danger" href="<?php echo base_url('kasir/cetak-rekap') ?>">Cetak Rekap</a></span></h5>	-->
          </div>
      </div>
	 
       <div class="row">
        <div class="col-md-12">
            <h4><strong>Penjualan </strong><span class="pull-right"><a id="btnRekap" class="btn btn-danger" href="<?php echo base_url('kasir/cetak-rekapd') ?>">Cetak Rekap</a></span></h4> 
            <table id="tbPenjualan" class="table table-bordered table-striped table-responsive">
              <thead>
                <tr>
                  <th>No</th>
				  <th>Tanggal</th>
                  <th>Waktu</th>
				  <th>Keterangan</th>
                  <th>Netto</th>
                  <th>Dine In</th>
				  <th>Take Away</th>
				  <th>Total</th>
				  <th>Stok</th>
                </tr>
              </thead>
              <tbody>
                <?php foreach ($penjualan->result() as $key): ?>
                <tr>
                  <td align="center"><?php echo $no++ ?></td>
				  <td><?php echo $key->tgl ?></td>
                  <td><?php echo $key->jam ?></td>
				  <td><?php echo $key->nmjenis ?></td>
                  <td align="right"><?php echo number_format($key->omset, 0, ',', '.') ?></td>
                  <td align="right"><?php echo number_format($key->qty1, 0, ',', '.') ?></td>
                  <td align="right"><?php echo number_format($key->qty2, 0, ',', '.') ?></td>
				  <td align="right"><?php echo number_format($key->total, 0, ',', '.') ?></td>
				  <td align="right"><?php echo number_format($key->stokakhir, 0, ',', '.') ?></td>
                </tr>
<?php
$grandtot += $key->omset;
$rg += $key->qty1;
$rgdo += $key->qty2;
$rgta += $key->total;
$gofood += $key->stokakhir;
?>
                <?php endforeach?>
              </tbody>
                  <thead>
                    <tr>
						<td colspan="4" align="center">Total Penjualan</td>
						<td align="right"><?php echo number_format($grandtot, 0, ',', '.') ?></td>
						<td align="right"><?php echo number_format($rg, 0, ',', '.') ?></td>
						<td align="right"><?php echo number_format($rgdo, 0, ',', '.') ?></td>
						<td align="right"><?php echo number_format($rgta, 0, ',', '.') ?></td>
						<td align="right"><?php echo number_format($gofood, 0, ',', '.') ?></td>
                    </tr>
                  </thead>
            </table>
        </div>
      </div>
    </div>
  </div>
     <!-- CONTENT-WRAPPER SECTION END-->
    <section class="footer-section">
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                   &copy; Copyright <?php echo date('Y') ?>, <a href="enambelasapp.my.id" target="_blank">Mandiri</a>
                </div>
            </div>
        </div>
    </section>
    <!-- FOOTER SECTION END-->
    <!-- JAVASCRIPT FILES PLACED AT THE BOTTOM TO REDUCE THE LOADING TIME  -->
    <script src="<?php echo base_url() ?>/assets/js/jquery-3.3.1.js"></script>
    <script src="<?php echo base_url() ?>/assets/js/jquery.dataTables.min.js"></script>
    <script src="<?php echo base_url() ?>/assets/js/bootstrap.js"></script>
    <script src="<?php echo base_url() ?>/assets/js/custom.js"></script>
    <script src="<?php echo base_url() ?>/assets/js/sweetalert.min.js"></script>
    <script src="<?php echo base_url() ?>/assets/js/toastr.min.js"></script>
    <script src="<?php echo base_url() ?>/assets/js/dataTables.buttons.min.js"></script>
    <script src="<?php echo base_url() ?>/assets/js/buttons.flash.min.js"></script>
    <script src="<?php echo base_url() ?>/assets/js/jszip.min.js"></script>
    <script src="<?php echo base_url() ?>/assets/js/pdfmake.min.js"></script>
    <script src="<?php echo base_url() ?>/assets/js/vfs_fonts.js"></script>
    <script src="<?php echo base_url() ?>/assets/js/buttons.html5.min.js"></script>
    <script src="<?php echo base_url() ?>/assets/js/buttons.print.min.js"></script>
    <script>
     $('#tbPenjualan').DataTable({
          "paging":   true,
          "ordering": false,
          "info":     false,
          "searching":     false,
          "dom": 'Bfrtip',
          "buttons": [
            'copy', 'csv', 'pdf', 'print'
        ]
      });
    
      $('form').attr('autocomplete', 'off');
      $("ul.nav li.dropdown").hover(function(){$(this).find(".dropdown-menu").stop(!0,!0).delay(100).fadeIn(500)},function(){$(this).find(".dropdown-menu").stop(!0,!0).delay(100).fadeOut(500)});
      var pesan="<?php echo $this->session->flashdata('msg'); ?>",error="<?php echo $this->session->flashdata('error'); ?>";pesan?(toastr.options={positionClass:"toast-top-right"},toastr.success(pesan)):error&&swal(error);
      
      $('#btnCetakStruk').on('click',function(e){
            var belanja = $('#sum_belanja').val();
            var cash = $('#cash_print').val();
            var debet = $('#debet_print').val();
            var kembali = (Number(cash)+Number(debet))-Number(belanja);
           
              $('#formCetakStruk').submit(function() {
                    window.open('about:blank','printstruk','width=500,height=400');
                    this.target = 'printstruk';
                   ;
                    
              });
        });
 
      
    $('#tbPenjualan').on('click','.lihat_record',function(){
        var faktur = $(this).data('faktur');
        var url = "<?php echo base_url('kasir/cetak_struk/') ?>"+faktur;
        window.open(url, '_blank', 'location=yes,height=400,width=500,scrollbars=yes,status=yes');
    });
    $("#btnRekap").on('click', function(e){
      e.preventDefault();
      var url = $(this).attr('href');
      window.open(url, '_blank', 'location=yes,height=600,width=500,scrollbars=yes,status=yes');
    });

    </script>

</body>
</html>