<!DOCTYPE html>
<html>
<?php foreach($kontak as $kontak) :   endforeach; ?>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title> Print</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">
  <!-- Main content -->
  <section class="invoice">
  	<h2>DATA STOK BARANG   <?php echo  strtoupper($nama_kantor) ;?> </h2>

  	<hr>
  	<table  class="table table-bordered  ">
  		<thead>
  			<tr style="background: #cccccc;">
  				<th>No</th>
  				<th>Kode Barang</th>
  				<th>Nama Barang</th>
  				<th>HB Dos</th>
  				<th>HB Ecer</th>
  			    <th>Stok </th>
  			    <th>HJ Ecer</th>
  				<th>HJ Level 1</th>
  				<th>HJ Level 2</th>
  				<th>HJ Level 3</th>
  				<th>HJ Level 4</th>
  			    <th>Modal </th>
  				<th>Rak </th>




  			</tr>
  		</thead>
  		<tbody>
  			<?php $no=1; foreach($barang as $rows) :   

  			$id_barang= $rows->id_barang;
  			$this->db->where('id',$id_barang);
  			$query = $this->db->get('tb_barang');
  			$row = $query->row();
  			$barcode_ecer = $row->barcode_ecer;
  			$nama_barang = $row->nama_barang;
  			$id_rak = $row->id_rak;
  				$harga_beli_dos = $row->harga_beli_dos;
  					$harga_beli_ecer = $row->harga_beli_ecer;
  			$harga_jual_ecer = $row->harga_jual_ecer;
  				$harga_grosir_lv1 = $row->harga_grosir_lv1;
  					$harga_grosir_lv2 = $row->harga_grosir_lv2;
  						$harga_grosir_lv3 = $row->harga_grosir_lv3;
  							$harga_grosir_lv4 = $row->harga_grosir_lv4;

              				//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) {
  				$nama_rak= $mainkk->nama_rak;
  			}

  			?>


  			<tr>
  				<td><?php echo $no; ?></td>
  				<td><?php echo $barcode_ecer; ?></td>
  				<td><?php echo $nama_barang; ?></td>
  				<td align="right"><?php echo nominal($harga_beli_dos); ?></td>
  				<td align="right"><?php echo nominal($harga_beli_ecer); ?></td>
  				<td align="right"><?php echo nominal($stok=$rows->stok_aplikasi); ?></td>
  				<td align="right"><?php echo nominal($harga_jual_ecer); ?></td>
  				<td align="right"><?php echo nominal($harga_grosir_lv1); ?></td>
  				<td align="right"><?php echo nominal($harga_grosir_lv2); ?></td>
  				<td align="right"><?php echo nominal($harga_grosir_lv3); ?></td>
  				<td align="right"><?php echo nominal($harga_grosir_lv4); ?></td>
  				<td align="right"><?php echo nominal($stok*$harga_jual_ecer); ?></td>
  			

  				<td><?php echo $nama_rak; ?></td>



  			</tr>
  			
  			<?php $no++; endforeach; ?>
            <tr>
  			    <td colspan="10"></td>
  			    
  			    <td><?php 
                         date_default_timezone_get('Asia/Jakarta');
                        $sql_menu = "SELECT SUM(tb_stok.stok_aplikasi * tb_barang.harga_beli_ecer) AS total FROM tb_barang, tb_stok WHERE tb_barang.id = tb_stok.id_barang   ";
                            $main_menu = $this->db->query($sql_menu)->result();
                            foreach ($main_menu as $data) {
                           echo nominal($data->total);
                            }
                        
                        ?>    </td>
  			    <td></td>
  			</tr>
  		</tbody>

  	</table>
  	 



                 
  </section>
  <div class="row">
              	<div class="col-lg-12">
              		<table width="100%" border="0">
              			<tr>

              				<td >Mangetahui,</td>
              				<td width="400px;"  ></td>
              				<td ><?php echo $kontak->kab_kota ; ?>, <?php echo tgl_indo(date('Y-m-d'));  ?></td>
              			</tr>
              			<tr>
              				<td>Manager </td>
              				<td width="400px;"></td>
              				<td>Admin</td>
              			</tr>
              			<tr height="70px;">
              				<td></td>
              				<td></td>
              				<td></td>
              			</tr>
              			<tr>
              				<td> _____________________________ </td>
              				<td width="400px;"></td>
              				<td><strong>_____________________________</strong></td>
              			</tr>
              		</table>

              	</div><!-- /.row -->
              </div>
  <!-- /.content -->
</div>
<!-- ./wrapper -->

<script type="text/javascript"> 
  window.addEventListener("load", window.print());
</script>
</body>
</html>
