

 

         <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 Journal Entry</span>
	  <a data-toggle='modal' data-target='#addModal' class="btn btn-primary">Add Journal Entry </a>
	  	  	  	  	  				 <a href="<?php echo base_url();?>user/viewbanks" class="btn btn-info"> 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/viewjournalentry" class="btn btn-info"> Journal Entry </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'); 
				
				
				
						$session_data = $this->session->userdata('logged_in');

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

				
					
					
					
					  $balance=$this->usermodel->populatuserpermissionsdataarray('sales','mpesabalance',$userid);

				$smsconfig = $this->usermodel->populateallarray('smsconfig','id',$companyid);
	  $starttime=$smsconfig[0]['starttime'];
		 $duetime=$smsconfig[0]['duetime'];
						
				
				
				
				
				
				
				
				
				
				
								?>	
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">
		<div class="col-md-12" id="non-printable">
        <?php 
		 echo $this->session->flashdata('msg'); 
        $attr = array("class" => "form-horizontal", "role" => "form", "id" => "search", "name" => "search");
        echo form_open("user/searchGL", $attr);?>
            <div class="form-group">
			
                <div class="col-md-5">
                    <input class="form-control" id="searchterm" name="searchterm" placeholder="Search for journal entries by code, name, invoice etc.." type="text" value="<?php echo set_value('searchterm'); ?>" />
                </div>
                <div class="col-md-4">
                    <input id="btn_search" name="btn_search" type="submit" class="btn btn-success" value="Search" />
                    <a href="<?php echo base_url(). "user/viewjournalentry"; ?>" class="btn btn-primary">Refresh</a>
                </div>
				 
            </div>
        <?php echo form_close(); ?>
        </div>
									
				<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

             <thead>
         <tr>
		   							<th>View  </th>
	<th> Date Created</th>
  							<th>Journal Entry no.</th>
		<th> Recorded by </th>
		
			<th> Description </th>
					<th> REF </th>

									<th> Type </th>

		<th>Action</th>
		


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

	
    }else {
?>
    
             <?php 
  
  	foreach ($viewjournalentry 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/viewmyjournalentry?randomitemidentifier=<?php   {echo  $invoice_number;}  ?>">More  </a>

  </td>


 

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


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

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

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

  ?></td>
   <td><?php echo $c->description ; ?></td>
	     <td><?php echo $c->invoice ; ?></td>
	     <td><?php echo $c->incharge ; ?></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. "   Records (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="journal">

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

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



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

    	     								<input type="hidden" name="view" value="user/viewmyjournalentry?randomitemidentifier=" 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="inputdetails" class="col-sm-2 control-label">Details/Title </label>
    <div class="col-sm-10">
		  		<input type="text" name="description" value="<?php echo set_value('description'); ?>" class="form-control" required placeholder="Enter journal entry title/details ">

			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		
	      <div class="form-group">
    <label for="inputcurrency" class="col-sm-2 control-label">Currency name?</label>
    <div class="col-sm-10">
	<select class="form-control" name="currency" required>
	
	<option value=""  >---Select Currency 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->populateall('currency','companyid',$companyid);



	
if(is_array($banking)) {

   foreach($banking as $bankingrow){

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



	<?php

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

	</div>
  </div>
  
	 
	 
    <label for="inputjournaldate" class="col-sm-2 control-label">Journal Date </label>

				<div class="col-sm-5">
					<div class="form-group">

                     		  		<input type="date" name="journaldate" value="<?php echo set_value('fromdate',date("Y-m-d", strtotime($mydate))); ?>" class="form-control" required placeholder="Enter journal date">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					

							  		<input type="time"  name="paiddatefrotime" value="<?php echo set_value('frotime',date("H:s:i")); ?>" class="form-control" required placeholder="Enter start time">

					</div>
				</div>
			

	 


  

    
    	<div class="form-group">
    <label for="inputjournaldate" class="col-sm-2 control-label">Journal REF No</label>
    <div class="col-sm-10">
	<input type="text" name="invoice" value="<?php echo set_value('invoiceno',$finalsalesid); ?>" class="form-control" required placeholder="Enter invoiceno">

		 
				
		<span class="text-danger">This default but you can put your own Ref No. <?php echo form_error('journaldate'); ?>
		
		</span>
	</div>
  </div>
  
	
	      <div class="form-group">
    <label for="inputentrytype" class="col-sm-2 control-label">Type</label>
    <div class="col-sm-10">
	<select class="form-control" name="entrytype" required>
	
	<option value=""  >---Select Type---</option>
		<option value="Double" selected >Double Entry</option>
		<option value="Single"  >Single Entry</option>




</select>
		

	</div>
  </div>
  
	 

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="journal" name="btn_journalEntry" class="btn btn-primary"> NEXT >>  </button>

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

    

				</div>

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

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

 
</div>


















