<!--
Author		: Herpan / 15/08/2014
Revision	: 
-->

	<?php
				//---------Untuk privellege jika dia ada tombol save----------
				if($group_user->AddPrivillage == 1){
					$cek_autority_add 		= "";
				}
				else{
					$cek_autority_add 		= "disabled";
				}
				
				if($group_user->DeletePrivillage == 1){
					$cek_autority_delete 		= "";
				}
				else{
					$cek_autority_delete 		= "disabled";
				}
				
				if($group_user->EditPrivillage == 1){
					$cek_autority_edit 		= "";
				}
				else{
					$cek_autority_edit 		= "disabled";
				}
				//-------------end----------------------------
	?>	

<div class="easyui-layout" data-options="fit:true,border:false">
    <div id="west-panel" data-options="region:'west',split:true,border:true" title="Filter" style="width:190px;background-color:#CCCCFF;padding:5px;">
        
    </div>
    
    <div data-options="region:'center',border:false,iconCls:'icon-ok'">
        
		<!-- gaya table baru di grid -->
		<table id="grid"
        	title="" iconCls="icon-edit" 
            singleSelect="true" rowNumbers="true" 
            pageSize="150" 
            fitColumns="true" remoteSort="false" 
            url="<?=base_url($menu_link.'/get_list_price/'.$ItemCode)?>/10" 
            style="width:auto;height:560px" 
            data-options = " 
            	border:false,
            	view:scrollview,
            	autoRowheight:false,
            	onDblClickRow:function(ind,row){
					parent.tab_edit('Edit Purchase Invoice','list/purchases_invoice', 'icon-edit', 'edit', $('#grid_list').datagrid('getSelected').PInvNumber);
				}
			"
        > 
            <thead>
                <tr>
                    <th data-options="field:'PInvNumber',width:150,halign:'center',align:'left'" sortable="true">PInv. No.</th>
                    <th data-options="field:'PInvDate',width:80,halign:'center',align:'center'" formatter="formatDate" sortable="true">PInv. Date</th>
                    <th data-options="field:'ItemCode',width:150,halign:'center',align:'left'" sortable="true">ItemCode</th>
                    <th data-options="field:'ItemDesc',width:190,halign:'center',align:'left'" sortable="true">ItemDesc</th>
                    <th data-options="field:'ItemUnit',width:150,halign:'center',align:'left'" sortable="true">ItemUnit</th>
                    <th data-options="field:'ItemPrice',width:110,halign:'center',align:'right'" formatter="formatRp" sortable="true">ItemPrice</th>
                    <th data-options="field:'TransStatus',width:120,halign:'center',align:'center'" sortable="true" formatter="formatTransStatus">TransStatus</th>
                </tr>
            </thead>
        </table>
        <div style="float:right;margin-right:25px">
	        <p>
	        	<label style="display:inline">Show</label> 
	    		<select name='cmb_show' id="cmb_show">
	    			<option value='10' selected>10</option>
	    			<option value='25'>25</option>
	    			<option value='50'>50</option>
	    			<option value='100'>100</option>
	    			<option value='200'>200</option>
	    		</select>
	        </p>
	    </div>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function(){

    	$('#grid').datagrid({
    		onBeforeLoad: function (param) {
	            if ((param.page == 1) && (param.rows == 150)) {
	                return false;
	            }
        	}
    	});

		$('#cmb_show').on('change',function(){
			var limit = $(this).val();
			$('#grid').datagrid({
				url:"<?=base_url($menu_link.'/get_list_price/'.$ItemCode)?>/10"+limit 
			});
		})
	});
	
</script>