<hr class="thick-line" style="clear:both;">
<div id="left">
	<?php
	$this->nativesession->set_flash_session('url_requested', base_url(uri_string()));
	echo form_open(base_url().'jurnal_hkk_list/search');
	$attributes = array('name' => 'search', 'id' => 'search-box', 'type' => 'text','size' => '50','placeholder'=>"  Ketik kata kunci  ");
	echo form_input($attributes);
	$data = array(
		'enc' => $enc
	);
	echo form_hidden($data);
	echo "<span>  </span>";
	$attributes = array('value' => 'Search', 'id' => 'search-btn1', 'type' => 'submit');
	echo form_submit($attributes);
	echo form_close('');
	?>
</div>

<div id="left" style="margin-left:50px;">
	<input id="cetak_jurnal_hhk_list" type="submit" value="Excel" class="btn"></input>
</div>
<?php
if($this->session->userdata('is_logged_in')){
	$canedit = FALSE;
	if($this->authorization->HasRuleAddJurnalBiaya()){
		$canedit = TRUE;
?>
		<div id="left" style="margin-left:50px;">
			<input type="submit" id="tambah_hkk" value="Tambah" class="btn"></input>
			<script type="text/javascript">
				$('#tambah_hkk').click(function(event){
					window.open('<?php echo base_url();echo "new_hkk/".$enc; ?>/','_self')
				});
			</script>
		</div>
<?php
	}
}
?>
<div id="pages">
    <div id="selector"></div>
</div>
<div class="cssTable">
	<table id="tablePerkaraAll">
		<col  width="7%" />
        <col  width="15%" />
        <col  width="25%" />
        <col  width="30%" />
        <col  width="12%" />
        <col  width="15%" />
        <?php if ($canedit){?>
        	<col  width="5%" />
        <?php } ?>
		<tbody>
			<tr height="50px">
				<td>No</td>
				<td onclick="sorting(1)">Tanggal Transaksi</td>
				<td onclick="sorting(2)">Jenis Biaya</td>
				<td onclick="sorting(3)">Uraian</td>
				<td onclick="sorting(4)">Jumlah</td>
				<td>Keterangan</td>
				<?php if ($canedit){?>
					<td>Link</td>
				<?php } ?>
			</tr>
			<input type="hidden" id='alur_perkara' value="<?php echo $idalurperkara;?>">
			<?php
				if($list_hkk!=''){
					if($list_hkk->num_rows>0){
						if($page_active<1){
							$con = 1;
						}else{
							$con = $page_active;
						}
		    			foreach ($list_hkk->result() as $row) {
		    				
		    				echo "<tr>";
			    				echo '<td align="center">'.$con.'</td>';
			    				echo '<td align="center">'.$this->tanggalhelper->convertToInputDate($row->tanggal_transaksi).'</td>';
			    				echo '<td >'.$row->jenis_biaya.'</td>';
			    				echo '<td >'.$row->uraian.'</td>';
			    				echo '<td align="right">'.number_format($row->jumlah, 0, ',', '.').'</td>';
			    				echo '<td >'.$row->keterangan.'</td>';
			    				if($canedit)
			    					echo '<td >[<a href="'.base_url('new_hkk/'.$enc.'/'.base64_encode($this->encrypt->encode('edit')).'/'.base64_encode($this->encrypt->encode($row->id))).'">edit</a>]</td>';
		    				echo "</tr>";
		    				$con++;
		    			}
			    	}else{
		    			echo "<tr><td colspan='9' align='center'>Data Tidak diTemukan</td></tr>";
		    		}
				}else{
		    		echo "<tr><td colspan='9' align='center'>Data Tidak diTemukan</td></tr>";
		    	}
			?>
		</tbody>
	</table>
</div>
<div id="pages_bottom" style="width:100%;padding-left:5px;padding-top:5px;">
    <div id="selector_bottom"></div>
</div>
<?php
$url = base_url().$page_url.'/sort/';

if($keyword!==''){
	$keyword=$keyword;
} else {
	$keyword="0";
}
?>
<script type="text/javascript">
	function sorting(col){
		window.open('<?php echo $url;?>'+col+'/<?php echo $enc; ?>','_self')
	}
	<?php $enc = (!empty($enc)) ? "/".$enc : $enc;?>
	function searchDetilShow(){
		window.open('<?php echo base_url();?>search<?php echo $enc; ?>','_self')
	}
	$('#cetak_jurnal_hhk_list').click(function(){
		window.open('<?php echo base_url(); echo "jurnal_hkk_cetak/cetak".$enc."/".$keyword; ?>','_self')
	});	
</script>
