<!DOCTYPE html>
<html>
<?php foreach($kontak as $kontak) :   endforeach; ?>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Data Barang</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Bootstrap 4 -->

  <!-- Font Awesome -->
  <link rel="stylesheet" href="<?php echo base_url();?>assets/plugins/fontawesome-free/css/all.min.css">
   
  <!-- Theme style -->
  <link rel="stylesheet" href="<?php echo base_url();?>assets/dist/css/adminlte.min.css">

   
</head>
<body>
<div class="wrapper">
   <a href="<?php echo base_url('home');?>"><button type="button" class="btn btn-block btn-warning btn-sm"><i class="fa fa-home"></i></button></a>
  <form method="POST" action="<?php echo base_url('stok_opname/simpan_stok_opname_rak');?>">
  <!-- Main content -->
  <section class="invoice">
   <?php  
    $username = $this->session->userdata("username");  
    $this->db->where('username',$username);
    $query = $this->db->get('tb_admin');
    $row = $query->row();
    $id_admin= $row->id;
    $nama_admin= $row->nama_admin;
 
    $id_admin = $row->id;
    $id_kantor = $row->id_kantor;

      $this->db->where('id_kantor',$id_kantor);
      $query1  = $this->db->get('tb_kantor ');
      $row1    = $query1->row();
     $nama_kantor  = $row1->nama_kantor; ?>
    <h2> STOK OPNAME RAK <?php echo  strtoupper($nama_rak_tampil) ;?>   <?php echo  strtoupper($nama_kantor) ;?> </h2>
 
    
     <h2>NAMA PETUGAS :  <?php echo  strtoupper($nama_admin) ;?> </h2>
    <hr>
    <table class="table table-bordered  ">
      <thead>
        <tr style="background: #cccccc;">
          <th>No</th>
          <th>Barcode Barang</th>
          <th>Nama Barang</th>
          <th>Rak</th>
          <th>Selfing</th>
          <th>Katagori Barang</th>
          <th>Satuan Jual</th>
          <th>Stok </th>
          <th>Stok Opname</th>

        

         

        </tr>
      </thead>
      <tbody>
        <?php $no=1; foreach($barang as $rows) : ?> 
        <tr>
          <td><?php echo $no; ?></td>
            <td><?php echo $rows->barcode_ecer; ?></td>
          <td><?php echo $rows->nama_barang; ?></td>
          
          <td>  <?php 
                $id_rak = $rows->id_rak; 
                $sql_menuu = "SELECT * FROM tb_rak WHERE  id_rak = '$id_rak' ";
                $main_menuu = $this->db->query($sql_menuu)->result();
                foreach ($main_menuu as $mainkk) {
                  echo $nama_rak= $mainkk->nama_rak;


                }
                ?>
                  
          </td>
         
          
          <td>
             <?php 
                              $id_selfingx = $rows->id_selfing; 
                              if(empty($id_selfingx)){
                              ?>
                               <p>{  <small><i>0</i></small> } </p>
                              <?php  
                              }else{

                              ?> 
                              <?php 
                                  $sql_menuux = "SELECT * FROM tb_selfing WHERE  id_selfing = '$id_selfingx' ";
                                  $main_menuux = $this->db->query($sql_menuux)->result();
                                  foreach ($main_menuux as $mainkkx) {
                                    $nama_selfingx= $mainkkx->nama_selfing;


                                  }
                              ?>
                              <p>{   <small><i><?php echo $nama_selfingx; ?></i></small> } </p>
                              <?php
                              }
                              ?>


          </td>
          <td><?php 
              $id_katagori = $rows->id_katagori; 
              $sql_menu = "SELECT * FROM tb_katagori WHERE  id_katagori = '$id_katagori' ";
              $main_menu = $this->db->query($sql_menu)->result();
              foreach ($main_menu as $maink) {
                $nama_katagori= $maink->nama_katagori;
                echo $nama_katagori;
              }
              ?>
            
          </td>

          <td><?php 
              $id_satuan_jual = $rows->id_satuan_jual; 
              $sql_menu = "SELECT * FROM tb_satuan WHERE  id_satuan = '$id_satuan_jual' ";
              $main_menu = $this->db->query($sql_menu)->result();
              foreach ($main_menu as $main) {
                echo $main->nama_satuan;
               

              } ?>
          
          </td>
         
          <td> 
             <input type="hidden" name="id_barang[]" value="<?php  echo $rows->id_barang; ?>"  >
             <input type="hidden" name="id_kantor[]" value="<?php  echo $rows->id_kantor; ?>"  >
             <input type="hidden" name="id_admin[]" value="<?php  echo $id_admin; ?>"  >
             <input type="hidden" name="harga_beli[]" value="<?php  echo $rows->harga_beli_ecer; ?>"  >
             <input type="hidden" name="id_stok[]" value="<?php  echo $rows->id_stok; ?>"  >
             <input type="hidden" name="jumlah_aplikasi[]" value="<?php  echo $rows->stok_aplikasi; ?>" style="width: 70px"   ><?php  echo $rows->stok_aplikasi; ?>
           </td>


          <td> 
            <input type="hidden" name="id[]" >
            <input type="number" name="jumlah_toko[]"    style="width: 100px">

          </td>
           
         


    </tr>
    <?php $no++; endforeach; ?>

      </tbody>

    </table>
   <!--  tangkap data id_kantor dan id_admin -->
    <input type="hidden" name="id_kantorq" value="<?php  echo $rows->id_kantor; ?>"   >
    <input type="hidden" name="id_adminq" value="<?php  echo $id_admin; ?>"  >
    <span class="input-group-btn"> TEKAN TOMBOL DISAMPING JIKA MELAKUKAN SIMPAN DATA 
    <button type="submit" onclick="return confirm('Apakah Data Sudah Benar, ? Klik Oke jika Lanjut')" class="btn btn-primary">Simpan Transaksi</button>
   </span>

                 
  </section>
  </form>
   <br><br><br>
  <!-- /.content -->
</div>
<!-- ./wrapper -->

 
</body>
</html>
