

 

         <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">

  
		<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 viewbanks Deposits </span>
	  <a data-toggle='modal' data-target='#addModal' class="btn btn-primary">Add/Receive Payments </a>
				 	  	  	  				 <a href="<?php echo base_url();?>user/viewbanks" class="btn btn-info"> 	View Bank Deposits </a>
	  	  	  	  				 <a href="<?php echo base_url();?>user/viewbanktransfer" class="btn btn-info"> Bank transfer </a>
				 				 				 	  	  	  	  				 <a href="<?php echo base_url();?>user/allaccounting" class="btn btn-info"> Charts of Accounts </a>

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

			
	<div class="widget-content nopadding table_holder table-responsive" >				
				<?PHP
      $mydate=date("Y-m-d H:i:s");

 echo $this->session->flashdata('deletemsg'); 

				echo $this->session->flashdata('msg'); 
								?>	
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">
	
									
				<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

             <thead>
         <tr>
		   							<th>View  </th>

  							<th>Bank Name  </th>
		<th> Recorded by </th>
		<th>Responsible Person  </th>
			<th> Description </th>
			<th> Amount </th>
			<th> Date Deposited</th>
				
		<th>More</th>
		


                 </tr>
             </thead>
<?php
 if(!is_array($viewbanks)) {
				    echo '<div class="alert alert-danger text-center">There was no record found in the system</div>';

	
    }else {
?>
    
             <?php 
  
  	foreach ($viewbanks as $c): 

		 

             ?>



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


?>



<td><?php 
 $invoice_number=$c->invoice;
	
	  ?>
	  	  	  	 <a  id="more" class="btn btn-warning"  href="<?php echo base_url();?>user/viewnewbanking?randomitemidentifier=<?php   {echo  $invoice_number;}  ?>">More  </a>

  </td>






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

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



if(is_array($branch)) {

   foreach($branch as $branchrow){

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

	 <td><?php  $userids= $c->userid ;

$myuser=$this->usermodel->geteuser($userids);
   echo $myname=$myuser[0]['firstname'];

  ?></td>
    <td><?php echo $c->incharge ; ?></td>
   <td><?php echo $c->description ; ?></td>
	  <td><?php echo $c->amount ; ?></td>
	  <td><?php echo $c->paiddate ; ?></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($usertype=="admin"){
											
											?>
                                    <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 echo $links; ?>
					   		<span style="color:red; font-size:20px"><?php  echo $total_rows. "   Bank deposits (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="banks">

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

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addbanks' , 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="view" value="user/viewbanks" class="form-control" required placeholder="Enter view">

    
     								<input type="hidden" name="action" value="insert" class="form-control" required placeholder="Enter invoiceno">

	      <div class="form-group">
    <label for="inputbankname" class="col-sm-2 control-label">Bank name?</label>
    <div class="col-sm-10">
	<select class="form-control" name="bankname" required>
	
	<option value=""  >---Select bank name---</option>
	
	<?php 
	$session_data = $this->session->userdata('logged_in');

  
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
		 $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
					 
										$banking= $this->usermodel->populatealldatanoarray('glaccounts','companyid',$companyid,'accounttype','1');


	
if(is_array($banking)) {

   foreach($banking as $bankingrow){

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



	<?php

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

	</div>
  </div>
  
	 
	 
	 

	<div class="form-group">
    <label for="inputincharge" class="col-sm-2 control-label">Person incharge </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="incharge" value="<?php echo set_value('incharge'); ?>" class="form-control" required placeholder="Enter Person incharge ">
		 
				
		<span class="text-danger"> <?php echo form_error('incharge'); ?>
		
		</span>
	</div>
  </div>
<div class="form-group">
    <label for="inputamount" class="col-sm-2 control-label">Amount :  </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="amount" value="<?php echo set_value('amount'); ?>" class="form-control" required placeholder="Enter  amount used">
		 										<input type="hidden" name="invoice" value="<?php echo set_value('invoiceno',$finalsalesid); ?>" class="form-control" required placeholder="Enter invoiceno">

				
		<span class="text-danger"> <?php echo form_error('amount'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputpaiddate" class="col-sm-2 control-label">Banking Date</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="paiddate" value="<?php echo set_value('paiddate',$mydate); ?>" class="form-control" required placeholder="Enter Banking Date">
		 
				
		<span class="text-danger"> <?php echo form_error('paiddate'); ?>
		
		</span>
	</div>
  </div>
  
    
  
	<div class="form-group">
    <label for="inputdetails" class="col-sm-2 control-label">	Remarks </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">

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

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

    

				</div>

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

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

 
</div>


















