

 

         <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		
		
		
    </script>  
 <div class="row">
  
   	

   	<div class="col-md-12">

  <?php
   echo $this->session->flashdata('deletemsg'); 
 
				echo $this->session->flashdata('msg'); 
   $session_data = $this->session->userdata('logged_in');

      $mydate=date("Y-m-d H:i:s");

 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
    $deleteglaccount=$this->usermodel->populatuserpermissionsdataarray('accounting','deleteglaccount',$userid);

  
  ?>
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
				 <span class="pull-right"> View Gl Sub-groups   </span>
	  <a data-toggle='modal' data-target='#addModal' class="btn btn-primary">Add GL Sub Groups   </a>
	  	  				 <a href="<?php echo base_url();?>user/allaccounting" class="btn btn-info"> Charts of Account </a>

	  				 <a href="<?php echo base_url();?>user/accounting" class="btn btn-info"> Back </a>

				 
            	</div>
            </div>
			<div class="panel-body">

			
	<div class="widget-content nopadding table_holder table-responsive" >				
				<?PHP

								?>	
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">
	
									
  <table cellpadding="0" cellspacing="0" border="0" class="table  table-striped" id="example" style="border-color:#CCCCCC; width:100%;"  >

             <thead>
         <tr>
		   					  <th>No#</th>

  					  <th>Sub-Gl Account Name</th>
				    				


					<th>Type</th>
		 
		 
    
	     
   <th>Sub Group Name</th>
        
				
		<th>More</th>
		


                 </tr>
             </thead>
<?php

			
 if(!is_array($glgroups)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='5'>";
    
       echo '<div class="alert alert-warning text-center">There no bank found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  
  	foreach ($glgroups as $c): 

		 

           
                
            
$id=$c->id;


?>
  <tr>
   <td><?php echo $c->id; ?></td> 				   

 <td><?php echo $c->accountname; ?></td> 				   
				   



 <td>
												 
	<?php 
					// $branch="";
					 $accounttype=$c->accounttype;

					 $myaccounttype= $this->usermodel->populateall('accounttype','id',$accounttype);



if(is_array($myaccounttype)) {

   foreach($myaccounttype as $myaccounttyperow){

   echo $myaccounttyperow->name;
 
 
}} else {
    echo 'General.';
}
	
?>
												 
	 </td>											 
			



			   



 <td>
												 
	<?php 
					// $branch="";
					 $groupname=$c->groupname;

					 $branch= $this->usermodel->populateall('glgroups','id',$groupname);



if(is_array($branch)) {

   foreach($branch as $branchrow){

   echo $branchrow->accountname;
 
 
}} else {
    echo 'No sub Acc.';
}
	
?>
												 
	 </td>											 
			  

  <td>

 
 
					<div class="btn-group">
                                    <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
									<?php
									 if( $deleteglaccount==true){
											
											?>
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
                                      
										
											  <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $c->id;?>'    data-toggle='modal' data-target='#deleteModal<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Delete
                                                </a>
                                                        </li>
									
									
                                        <li class="divider"></li>
                                        
                                        <!-- teacher DELETION LINK -->
                                        
                                    </ul>
											<?php
										}
										?>
                                </div>
</td>
     	
                  
             </tr>

	<?php endforeach;} ?>

            

        </table>
		<div class="col-md-12 text-center">    <?php  if(isset($links)) {echo   $links; } ?>
					   		<span style="color:red; font-size:20px"><?php  if(isset($total_rows)) {echo   $total_rows; } "   Bank (s) in the system. " ;?>    </span>

        
        </div>
	</div>

		<div id="deleteModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Delete</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to delete this item? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('logged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 echo form_open('user/deletebyid' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
 <input type="hidden" id="table"name="table" class="table" placeholder="view" value="glgroups">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/glgroups">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Delete  </button>

	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>		
	<div id="addModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Add new Sub-GL Account  </h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');



		
                 echo form_open('user/addglgroups' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
	
 
		
		    <div class="form-group">
    <label for="inputaccountname" class="col-sm-3 control-label">Sub GL Account Name:   </label>
    <div class="col-sm-9">
		
				<input type="text" name="accountname" value="<?php echo set_value('accountname') ;?>" id="dob" class="form-control" required  placeholder="Please provide your Account name ">

				
		</span>
	</div>
  </div>
	
	      <div class="form-group">
    <label for="inputaccounttype" class="col-sm-3 control-label"> Account type?</label>
    <div class="col-sm-9">
	<select class="form-control" name="accounttype" required>
	
	<option value=""  selected="selected">---Select Sub Account type---</option>

	<?php 
	
					 
										$Account= $this->usermodel->populateall('accounttype','companyid',$companyid);


	
if(is_array($Account)) {

   foreach($Account as $Accountrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $Accountrow->id;   ?>"><?=  $Accountrow->name; ?></option>



	<?php

}} else {
    echo 'No Account type available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('accounttype'); ?>

	</div>
  </div>
  
	 
	 
		
		
		
		
		
		
		
		
		
		
	
	

	      <div class="form-group">
    <label for="inputgroupname" class="col-sm-3 control-label">Sub group name?</label>
    <div class="col-sm-9">
	<select class="form-control" name="groupname" >
			<option value="" selected="selected" >---No sub group---</option>

	<option value=""  >---Select Sub group name---</option>

	<?php 
	
					 
										$banking= $this->usermodel->populateall('glgroups','companyid',$companyid);


	
if(is_array($banking)) {

   foreach($banking as $bankingrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $bankingrow->id;   ?>"><?=  $bankingrow->accountname ."(Acc type:". $bankingrow->accounttype .")"; ?></option>



	<?php

}} else {
    echo 'No groupname available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('groupname'); ?>

	</div>
  </div>
  
	 
	 
  
  
  

  
					
		
					
  

  

  
  
  


  
  	
		
  
  
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  name="btn_posglaccount"  value="account"  class="btn btn-primary"> Add Sub-groups  </button>

    </div>
  </div>
	
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>			
									
									
									
									
							</div>
						</div>
				

			
			</div>
		</div>
  
  </div>
			
			
			
		
		
  

 
</div>


















