<?php
session_start();
// ============
include("../../asset/theme/css/myfunc.php");
include("../../php_crud/my_class.php");
$obj=new my_class();
// ============
$branchid = $_SESSION['LOGIN_BRANCH'];

?>


<div class="row-fluid">
        <table id="sample-table-22" class="table table-striped table-bordered table-hover">
		      
			  <thead>
			  <th>SL</th>
			  <th>Code</th>
			  <th>Name</th>
			  <th>Parent</th>
			  <th>Account Type</th>
			  <th>Type</th>
			  <th>Status</th>
			  <th>Action</th>
			  </thead>
			  
			  
			  <tbody>
			  	<?php
			  	$i=0;
			  	foreach($obj->View_GL_HEAD("acc_account_type_._br_id='$branchid' AND (acc_gl_head_._status='1' OR acc_gl_head_._status='2')") as $v1){
			  	extract($v1); 
			  	$i++;
		  		?>
			  	<tr>
			  		<td><?php echo $i; ?></td>
			  		<td><?php echo $gl_head_code; ?></td>
			  		<td><?php echo $gl_head_name;?></td>
			  		<td><?php 
                    $parent=$obj->View_column_details_By_Cond("acc_gl_head_","gl_head_parent_id,_id,gl_head_name","_id='$gl_head_parent_id'");

                    if($parent['gl_head_name']==null){
                    	$parent='null';
                    }
                    else{
                    	$parent=$parent['gl_head_name'];
                    }

			  		echo $parent; ?>


			  		</td>
			  		<td><?php echo $account_type_name; ?></td>
			  		<td><?php    
			  	     
			  	     if($_transaction_type==1){
			  	     	$tType='Normal';
			  	     }
			  	     else if($_transaction_type==2){
			  	     	$tType='Default-Bank';
			  	     }
			  	      else if($_transaction_type==3){
			  	     	$tType='Default-Cash';
			  	     }
			  	     echo $tType;

			  		?>
			  		</td>
			  		<td><?php if($_status==1)
                              $status='Active';
                              else if($_status==2)
                              	$status='Inactive';
                              echo $status;

			  		 ?>



			  		</td>
			  		<?php
			  		 echo '<td>';
										if($_SESSION['view']=='Y'){
										echo '<i class="icon-edit bigger-170" style="hover:cursor;" href="" onclick="show_edit_view('.$v1['_id'].')"></i></i>&nbsp;&nbsp;';	
										}
									
										if($_SESSION['delete']=='Y'){
										echo '<i class="icon-trash bigger-170" onclick="delete_data('.$v1['_id'].')" ></i>';
										}
									echo '</td>';
									?>
			  	</tr>
			  	<?php } ?>
				
			  </tbody>
			  
		</table>
</div>
<script type="text/javascript">
	
				
				var oTable2 = $('#sample-table-22').dataTable( {
				"aoColumns": [
			      { "bSortable": true },
			      null, null,null,null,null,null,
				  { "bSortable": true }
				] } );
				
				
	</script>			
		