

 

         <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		
		
	$(document).on("click", "#editbtn", function()
        {
          var mycategoryid = $(this).data('id');
		  $("#mycategoryid").val(mycategoryid); 
		   
		   		      var type = $(this).data('type');
		   $("#type").val(type);
   var branchid = $(this).data('branchid');
		   $("#branchid").val(branchid);
 
		    var name = $(this).data('name');
		   $("#name").val(name); 
		   
		     var description = $(this).data('description');
		   $("#description").val(description); 
		   var dateposted = $(this).data('dateposted');
		   $("#dateposted").val(dateposted); 
		  
		 
		   
        });
		
		
		
		
    </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'];	
    $deletebank=$this->usermodel->populatuserpermissionsdataarray('accounting','deletebank',$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 Payment Methods  </span>

	  <a data-toggle='modal' data-target='#addModal' class="btn btn-primary">Add Payment Methods </a>
	  							 	  				 <a href="<?php echo base_url();?>user/allaccounting" class="btn btn-info"> Charts of Account </a>

				<a href="<?php echo base_url();?>user/glgroups" class="btn btn-info">  GL Sub Groups</a>

	  				 <a href="<?php echo base_url();?>user/viewassets" class="btn btn-info">  Assets</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>#</th>

		<th>Payment Method </th>
			<th>Bank Name </th>
			<th> Description </th>
			<th> Branch</th>

			<th> Date created</th>
		<th>More</th>
		


                 </tr>
             </thead>
<?php

			
 if(!is_array($paymentmethodes)) 

 {


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

		 

             ?>



             <tr>
                
            <?php 
$id=$c->id;


?>

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

    <td><?php echo $c->name ; ?></td>
		<td>
												 
	<?php 
					// $branch="";
					 $methods=$c->type;

					 $method= $this->usermodel->populateall('glaccounts','number',$methods);



if(is_array($method)) {

   foreach($method as $methodrow){

   echo $methodrow->accountname;
 
 
}} else {
    echo 'No Bank Assigned.';
}
	
?>
												 
	 </td>		

	  <td><?php echo $c->description ; ?></td>
		  
		  
		      <td>
												 
	<?php 
					// $branch="";
					 $branch=$c->branchid;

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



if(is_array($branch)) {

   foreach($branch as $branchrow){

   echo $branchrow->name;
 
 
}} else {
    echo 'No branch assigned.';
}
	
?>
												 
	 </td>

	  <td><?php echo $c->dateposted	 ; ?></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>
								
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
                                      
                                        
                                     	  <li> 


	 <a class="btn btn-primary editbtn" id="editbtn"  data-type='<?php echo  $c->type;?>'   data-dateposted='<?php echo  $c->dateposted;?>' data-name='<?php echo  $c->name;?>' data-branchid='<?php echo  $c->branchid;?>'   data-description='<?php echo  $c->description;?>'  data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#editProductModel'> 	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Update
                                                </a>
                                                        </li>
																							          <li class="divider"></li>
		<?php
									 if( $deletebank==true){
											
											?>
											  <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>
										<?php
										}
										?>
									
                                        
                                        <!-- teacher DELETION LINK -->
                                        
                                    </ul>
										
                                </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="paymentmethodes">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/accounting">
 <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 Payment Methods</h4>
      </div>
      <div class="modal-body">
	

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



		
                 echo form_open('user/addbank' , 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;?>
	<input type="hidden" name="action" value="insert" class="form-control" required placeholder="Enter action">
	<input type="hidden" name="categoryid"  class="form-control" required placeholder="Enter mycategoryid">

	  	
	 <div class="form-group">
    <label for="inputbranchname" class="col-sm-2 control-label">Counter</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchid"  required>
	
	
	<option value=""  >---Select Branch/Counter Name--</option>

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


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

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



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</div>
  </div>
     
	 	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	 name  :  </label>
    <div class="col-sm-10">
	
		  		<input type="text" required name="name" value="<?php echo set_value('name'); ?>" class="form-control"  placeholder="Enter Method name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>

	 

	

  
  	<div class="form-group">
    <label for="inputdateposted" class="col-sm-2 control-label">Date Opened:</label>
    <div class="col-sm-10">
	
		  		<input type="text" required name="dateposted" value="<?php echo set_value('dateposted', $mydate); ?>" class="form-control" required placeholder="Enter dateposted ">
		 
				
		<span class="text-danger"> <?php echo form_error('dateposted'); ?>
		
		</span>
	</div>
  </div>
  

  
	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Description </label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description'); ?>"  class="form-control"  placeholder="Enter remarks"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		

	      <div class="form-group">
    <label for="inputtype" class="col-sm-2 control-label">Bank Account?</label>
    <div class="col-sm-10">
	<select class="form-control" name="type" required>
	
	<option value=""  selected="selected">---Select Bank Account to assign---</option>
	<option value="na"  >N/A</option>

	<?php 
	
					 
										$banking= $this->usermodel->populatealldatanoarray('glaccounts','companyid',$companyid,'accounttype','1');


	
if(is_array($banking)) {

   foreach($banking as $bankingrow){

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




	<?php

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

	</div>
  </div>
  
	 
	 	 	<div class="form-group">
    <label for="inputcode" class="col-sm-2 control-label">	Alternative  Bank code  :  </label>
    <div class="col-sm-10">
	
		  		<input type="text"  name="code" value="<?php echo set_value('code'); ?>" class="form-control"  placeholder="Enter alternative bank code">
		 
				
		<span class="text-danger"> Only use this if the account to assign is not among the bank accounts above<?php echo form_error('code'); ?>
		
		</span>
	</div>
  </div>
	


	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="bank" name="btn_newbank" class="btn btn-primary"> Add Payment Methods    </button>

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

    

				</div>

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




	<div id="editProductModel" 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">Update Payment Methods</h4>
      </div>
      <div class="modal-body">
      
	  	

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



		
                 echo form_open('user/addbank' , 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;?>
	<input type="hidden" name="action" value="update"id="view" class="form-control" required placeholder="Enter action">
	<input type="hidden" name="categoryid" value=""id="mycategoryid" class="form-control" required placeholder="Enter mycategoryid">

	 <div class="form-group">
    <label for="inputbranchname" class="col-sm-2 control-label">Branch</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchid"  id="branchid" required>
	
			<option value=""  selected="selected"></option>

	<option value=""  >---Select Branch/Counter Name--</option>

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


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

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



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</div>
  </div>
     
	 	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	Method name  :  </label>
    <div class="col-sm-10">
	
		  		<input type="text" required id="name" name="name" value="<?php echo set_value('name'); ?>" class="form-control"  placeholder="Enter payment method name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>

	 

	

  
  	<div class="form-group">
    <label for="inputdateposted" class="col-sm-2 control-label">Date Opened:</label>
    <div class="col-sm-10">
	
		  		<input type="text" id="dateposted" required name="dateposted" value="<?php echo set_value('dateposted', $mydate); ?>" class="form-control" required placeholder="Enter dateposted ">
		 
				
		<span class="text-danger"> <?php echo form_error('dateposted'); ?>
		
		</span>
	</div>
  </div>
  

  
	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Description </label>
    <div class="col-sm-10">

				<textarea id="description" name="description" value="<?php echo set_value('description'); ?>"  class="form-control"  placeholder="Enter remarks"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		

	      <div class="form-group">
    <label for="inputtype" class="col-sm-2 control-label">Bank Account?</label>
    <div class="col-sm-10">
	<select class="form-control" name="type"  id="type" required>
		<option value=""  selected="selected"></option>

	<option value="" >---Select Bank Account to assign---</option>
	<option value="na"  >N/A</option>

	<?php 
	
					 
										$banking= $this->usermodel->populatealldatanoarray('glaccounts','companyid',$companyid,'accounttype','1');


	
if(is_array($banking)) {

   foreach($banking as $bankingrow){

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




	<?php

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

	</div>
  </div>
  
	 
	 
	
 	<div class="form-group">
    <label for="inputcode" class="col-sm-2 control-label">	Alternative  Bank code  :  </label>
    <div class="col-sm-10">
	
		  		<input type="text"  name="code" value="<?php echo set_value('code'); ?>" class="form-control"  placeholder="Enter alternative bank code">
		 
				
		<span class="text-danger"> Only use this if the account to assign is not among the bank accounts above<?php echo form_error('code'); ?>
		
		</span>
	</div>
  </div>

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="bank" name="btn_newbank" class="btn btn-primary"> Update Payment Methods    </button>

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

    

				</div>

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











				
									
									
							</div>
						</div>
				

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

 
</div>


















