<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/pemesanan/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/pemesanan">
<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/pemesanan">
Tgl Pembelian
  <input type="text" name="cari_tgl" id="cari_tgl" size="15" />
Cari Kode Beli & Kode Supplier : <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 Supplier</th>
    <th>Nama Supplier</th>
    <th>Item</th>
    <th>Jumlah</th>
    <th>Jth Tempo</th>
    <th>Keterangan</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['tglpesan']);
		$nama_supp = $this->app_model->NamaSupp($db['kode_supplier']);
		$item = $this->app_model->ItemPesan($db['kodepesan']);
		$jml = $this->app_model->JmlPesan($db['kodepesan']);
		?>    
    	<tr>
			<td align="center" width="20"><?php echo $no; ?></td>
            <td align="center" width="100" ><?php echo $db['kodepesan']; ?></td>
            <td align="center" width="100" ><?php echo $tgl; ?></td>
            <td align="center" width="100" ><?php echo $db['kode_supplier']; ?></td>
            <td ><?php echo $nama_supp; ?></td>
            <td align="center" width="100" ><?php echo $item; ?></td>
            <td align="right" width="100" ><?php echo number_format($jml); ?></td>
            <td align="center" width="100" ><?php echo $this->app_model->tgl_str($db['jth_tempo']); ?></td>
            <td align="center" width="100" ><?php echo $db['ket']; ?></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/pemesanan/edit/<?php echo $db['kodepesan'];?>">
			<img src="<?php echo base_url();?>asset/images/ed.png" title='Edit'>
			</a>
            <a href="<?php echo base_url();?>index.php/pemesanan/hapus/<?php echo $db['kodepesan'];?>"
            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>