<?php
if($_GET)
{
    $bank_id     =   $_GET['bank_id'];
}
else
{
    $ledger_id     =   '';
}
?>
<div style="color:green;text-align:center" class="success"><strong><?php if($this->session->flashdata('msg')){ echo $this->session->flashdata('msg');} ?></strong></div>
<div class="box-body">
	<form role="form" id="bank_search" name="bank_search" action="<?php echo base_url();?>General_masters/bank" method="get">
    <div class="row"> 
        <div class="col-md-5">
            <div class="form-group">
                <label>Bank Name</label>
                <select class="form-control select2" id="bank_id" name="bank_id">
                	<option value="">Select Ledger Group</option>
                  	<?php foreach($bank_drpdwn as $row)
                  	{?>
                  		<option value="<?php echo $row['bank_id'];?>" <?php if($row['bank_id']==$ledger_id)echo "selected";?>><?php echo $row['bank_name'];?></option>
                  	<?php }?>
                </select>
            </div>
        </div>
        <div class="col-md-5">
            <div class="form-group">
            </div>
        </div>
        <div class="col-md-2">
            <div class="form-group">
              	<button class="btn btn-block btn-warning"><b>Search</b></button>
              	<a href="<?php echo base_url();?>General_masters/add_bank" class="btn btn-block btn-info"><b>New Bank</b></a>
            </div>
        </div>
    </div>
    </form>
</div>
<!-- /.box-header -->
<div class="box-body"> 
     <table id="example2" class="table table-bordered table-hover">
        <thead>
            <tr>
                <th style="width: 10px">#</th>
                <th>Bank Name</th>
                <th>Branch of Bank</th>
				 <th>Acount No.</th>
				 <th>IFSC Code</th>
                 <th>Edit</th>
            </tr>
        </thead>
        <tbody>
        <?php $page_num=0;if(count($table_rows)!=0)
        {
        	$count	=	1;
        	foreach($table_rows as $row)
        	{?>
	    		<tr>
	    			<td><?php echo $count++;?></td>
	    			<td><?php echo $row['bank_name'];?></td>
 	    			<td><?php  echo $row['bank_branch'];?></td>
					<td><?php  echo $row['bank_acount_number'];?></td>
					<td><?php  echo $row['ifsc_code'];?></td>
	    		
	    			<td><a href="<?php echo base_url();?>General_masters/edit_bank/<?php echo $row['bank_id'];?>"><i class="fa fa-edit"></i></a></td>
	    		</tr>
        	<?php }
        }?>
        </tbody>
    </table>
</div>
<!-- /.box-body -->
<script type="text/javascript">
    $(function()
    {
        setTimeout(ledger_select);
    });
    function ledger_select()
    {
        $("#ledger_id").select2({
            ajax: { 
                dataType: 'json', 
                url: '<?php echo base_url();?>General_masters/get_ledgergroupsearch',
                cache: true,
                data: function (params) 
                    {
                        return {
                            q: params.term
                        }
                    }
            }
        });
    }
</script>