<script type="text/javascript">
$(document).ready(function(){
	$("#cari_tgl").datepicker({
			dateFormat:"dd-mm-yy"
    });
});
</script>
<div id="view">
<div style="float:left; padding-bottom:5px;">
<a href="<?php echo base_url();?>index.php/stok_opname/tambah">
<button type="button" name="tambah" id="tambah" class="easyui-linkbutton" data-options="iconCls:'icon-add'">Tambah Data</button>
</a>
<a href="<?php echo base_url();?>index.php/stok_opname">
<button type="button" name="refresh" id="refresh" class="easyui-linkbutton" data-options="iconCls:'icon-reload'">Refresh</button>
</a>

</div>
<div style="float:right; padding-bottom:5px;">
<form name="form" method="post" action="<?php echo base_url();?>index.php/stok_opname">
Tgl Stok Opname
  <input type="text" name="cari_tgl" id="cari_tgl" size="15" value="<?php echo $tgl ?>"/>
  Cari Kode & Nama Barang: 
  <input type="text" name="txt_cari" id="txt_cari" size="50" />
<button type="submit" name="cari" id="cari" class="easyui-linkbutton" data-options="iconCls:'icon-search'">Cari</button>
</form>
</div>
<div id="gird" style="float:left; width:100%;">
<table id="dataTable" width="100%">
<tr>
	<th>No</th>
    <th>Kode</th>
    <th>Tanggal</th>
    <th>Kode Barang</th>
    <th>Nama Barang</th>
    <th>Jml Sebelumnya</th>
    <th>Jumlah</th>
    <th>Satuan</th>
    <th>Aksi</th>
</tr>
<?php
	if($data->num_rows()>0){
		$no =1+$hal;
		foreach($data->result_array() as $db){  
		$tgl = $this->app_model->tgl_str($db['tgl_penyesuaian']);
		?>    
    	<tr>
			<td align="center" width="20"><?php echo $no; ?></td>
            <td align="center" width="100" ><?php echo $db['kode_penyesuaian']; ?></td>
            <td align="center" width="100" ><?php echo $tgl; ?></td>
            <td align="center" width="100" ><?php echo $db['kode_barang']; ?></td>
            <td ><?php echo $db['nama_barang'];; ?></td>
            <td align="center" width="100" ><?php echo number_format($db['jml_sebelum']); ?></td>
            <td align="center" width="100" ><?php echo number_format($db['jml']); ?></td>
            <td align="center" width="100" ><?php echo $db['satuan']; ?></td>
            <td align="center" width="80">
            <?php
			if(($this->session->userdata('level')=='01') or ($this->session->userdata('level')=='02')){
			?>
            <a href="<?php echo base_url();?>index.php/stok_opname/edit/<?php echo $db['kode_penyesuaian'];?>">
			<img src="<?php echo base_url();?>asset/images/ed.png" title='Edit Data'>
			</a>
            <a href="<?php echo base_url();?>index.php/stok_opname/hapus/<?php echo $db['kode_penyesuaian'];?>"
            onClick="return confirm('Anda yakin ingin menghapus data ini?')">
			<img src="<?php echo base_url();?>asset/images/del.png" title='Hapus'>
			</a>
            <?php } ?>
            </td>
    </tr>
    <?php
		$no++;
		}
	}else{
	?>
    	<tr>
        	<td colspan="8" align="center" >Tidak Ada Data</td>
        </tr>
    <?php	
	}
?>
</table>
<?php echo "<table align='center'><tr><td>".$paginator."</td></tr></table>"; ?>
</div>
</div>