

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

		   
        });
		
		
		
		
		
		
				         $(function () {
        $("#type").change(function () {
            if ($(this).val() == "customer") {
            
			 $("#credit").val(3010); 
			$("#debit").val(1100); 

             
          


            } else {
               			   
			 $("#credit").val(2130); 
			$("#debit").val(3010); 
			
            }
        });
    });
		
		
		
		
		


		
    </script>  

 
 <div class="row">
  
   	

   	<div class="col-md-12">
<?PHP
function formatMoney($number, $fractional=false) {
						if ($fractional) {
							$number = sprintf('%.2f', $number);
						}
						while (true) {
							$replaced = preg_replace('/(-?\d+)(\d\d\d)/', '$1,$2', $number);
							if ($replaced != $number) {
								$number = $replaced;
							} else {
								break;
							}
						}
						
						return $number;
					}





				$session_data = $this->session->userdata('logged_in');


   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];


				 $mydate=date("Y-m-d");
				
				$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
	 
				$data['branchid'] = $session_data['branchid'];
	 $branchid = $data['branchid'];
	 	 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	

  $mydates = date('Y-m-30 23:59:59');
   $fromdates=date("Y-m-01 00:00:00");

     $UpdateRenewal=$this->usermodel->populatuserpermissionsdataarray('members','UpdateRenewal',$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>
			 <a href="<?php echo base_url();?>user/viewmember" class="btn btn-info"> Go back</a>	

														<?php	
										 if( $UpdateRenewal==true){
							?>
	
	 
														<?php	

														 }
															
														 
														  ?>
			
											
											
  <span class="pull-right"> View all pending computer keys</span>		 


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

			
	<div class="widget-content nopadding table_holder table-responsive">				
				
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">
	<div class="col-md-12">
	ALL  CUSTOMERS
        <?php 
		 echo $this->session->flashdata('msg'); 
        $attr = array("class" => "form-horizontal", "role" => "form", "id" => "search", "name" => "search");
        echo form_open("user/searchallmembers", $attr);?>
            <div class="form-group">
									 <input type="hidden" id="view" name="view" class="view" placeholder="view" value="userdata/viewmember">

                <div class="col-md-5">
                    <input class="form-control" id="searchterm" name="searchterm" placeholder="Search for members.." 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-default" value="Search" />
                    <a href="<?php echo base_url(). "user/viewmember"; ?>" class="btn btn-default">Refresh</a>
                </div>
				 
            </div>
        <?php echo form_close(); ?>
        </div>
									
  <table cellpadding="0" cellspacing="0" border="0" class="table  table-striped" id="example" style="border-color:#CCCCCC; width:100%;"  >

             <thead>
         <tr>
		      <th>ID</th>
			     <th>Computer Key</th>
				    <th>Date Submitted</th>
				    <th>Details</th>
     <th>Cust. Name</th>
	      <th>Company</th>

	     <th>Cst. BL</th>
		 <th>Sup. BL</th>
<th>Phone</th>	
    <th>ID No</th>
	   <th>PIN</th>
	    <th>Card No</br> /Phon2</th>
		    <th>Points</th>
	    <th>Coins</th>
    <th>Date Joined</th>
    <th>Due Date</th>

		   <th>Description</th> 
				   <th>Location</th> 
		   <th>status</th> 


<th>Action</th>
    <th>Dob</th>
 
<!--
<th>More</th>
-->
                 </tr>
             </thead><tbody>
<?php
 
 if(!is_array($viewmember)) 

 {


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

		 

             ?>



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

?>

                  	   <td><?php echo $c->id ; ?></td>
					   <td>
				                     <a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/editcomputer?randomitemidentifier=<?php   {echo  $id;}  ?>"><?php   {echo  $c->computerno;}  ?>  </a>
	   
					   </td>
					   
		       	   <td><?php echo $c->computernouserdata ; ?></td>
		       	   <td><?php echo $c->computernodate ; ?></td>


  <td><?php echo $c->firstname." ".$c->lastname  ; ?></td>
    	   <td><?php echo $c->company ; ?></td>



	
	  <td><?php 
		  
		  	 echo formatMoney($c->balance,true);
		  
		  ?></td>
      <td><?php 
	 echo formatMoney($c->supplierbalance,true);
	  
	  
	  ?></td>
	    

 

	
	  <td><?php echo $c->phone ; ?></td>
	  	  <td><?php echo $c->idno ; ?></td>

	  <td><?php echo $c->idnumber ; ?></td>
	  	  <td><?php echo $c->address_1 ; ?></td>
  	  <td><?php echo $c->savedpoints ; ?></td>
	    	  <td><?php echo $c->savedcoins ; ?></td>
	  	  <td><?php echo $c->entrydate ; ?></td>
				  
				  
				  
			    
		    <td><?php 

if($c->zip!=""){
	echo $c->zip ;
$endate=$c->zip;
    		  $newDate = date('Y-m-d H:i:s');

	  //$newDate = date("Y-m-d");


		$mycurrentdate = strtotime(date($newDate));

	




$finaldate = strtotime(date($c->zip));
$exactdate = strtotime(date($c->zip));

									$secs = $mycurrentdate-$finaldate;// == <seconds between the two times>
									$days = $secs / 86400;
							 $finaldays=round($days,0);

if($c->status=="inactive"){
		?>
			<div class="btn-success">
			<?php 
$myfromdate = strtotime(date($c->zip));
	$secs2 = $myfromdate-$finaldate;// == <seconds between the two times>
									$days2 = $secs2 / 86400;
							 $finaldays2=round($days2,0);
							 if( $finaldays2<1){
								  $finaldays2=1;
							 }else{
							  $finaldays2= $finaldays2;
 
							 }


$mysecs = $exactdate-$finaldate;// == <seconds between the two times>
									$mydays = $mysecs / 86400;
							 $myfinaldays=round($mydays,0);

	 if( $myfinaldays<1){
								  $myfinaldays=1;
							 }else{
							  $myfinaldays= $myfinaldays;
 
							 }

			echo $c->status ."</br>(".$myfinaldays."/".$finaldays2."Days)"; 	?>
			</div>
			<?php
	
	
}else{

			 ?>
			 
			 
			<?php 
			
			if($finaldays <= 0){
			
			
						if(($finaldays == -0) ||($finaldays == -1)) {

	$hours = (($secs / 3600)* -1);
															 $finalhrs=round($hours,0);

					?>
			<div class="btn-success">
			<?php  echo $finalhrs." Hr(s) Due" ; 	?>
			</div>
			<?php
	
						}else{
							?>
			<div class="btn-success">
			<?php  echo $finaldays." Due" ; 	?>
			</div>
			<?php
						}
			
			
			
			}else if(($finaldays > 0) && ($finaldays <30)) {
		?>
			<div class="btn-warning">
			<?php  echo $finaldays." Overdue"  ; 	?>
			</div>
			<?php
			
			}else if($finaldays >=30){
			?>
			<div class="btn-danger">
			<?php  echo $finaldays." Overdue" ; 	?>
			</div>
			<?php
			}else{
				
			?>
			<div class="btn-danger">
			<?php  echo $success." Overdue" ; 	?>
			</div>
			<?php	
				
			}
}
	

}	?>	
			 
			 
			 
			 
			 
			 
			 
			 </td>
				  
				  
				  
				  
				  
				  
				  
				  
				  
				  		  	  	  <td><?php echo $c->website ; ?></td>

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



  <td><?php  

  //$mystatus="";
$mystatus=$c->status;
			  if( $mystatus =="1"){
				 echo $mystatus="active"; 
			  } else if( $mystatus =="0"){
				    echo $mystatus="inactive";
				  
			  }else{
echo $c->status ;
}

?></td>
                     <td>
                     <a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/editcomputer?randomitemidentifier=<?php   {echo  $id;}  ?>">Approve/Edit  </a>

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

 <!---
 
					<div class="btn-group">
                                    <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
									
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
	  <li> 

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

                                                <i class="glyphicon glyphicon-pencil"></i>
																Opening Balance
                                                </a>
                                                        </li>
										
										
												</br>
 <li>
											   <a  id="more" target="_blank" class="btn btn-default" href="<?php echo base_url();?>user/viewfollowups?randomitemidentifier=<?php   {echo  $id;}  ?>&currentid=<?php   {echo  $id;}  ?>&type=Customer">Follow Ups  </a>
												</li>
																								</br>




					<?php	
										 if( $UpdateRenewal==true){
							?>
		<li> 
										                              <a target="_blank" id="more" class="btn btn-info" href="<?php echo base_url();?>user/viewmycomputerno?randomitemidentifier=<?php   {echo  $id;}  ?>&computerno=<?php   {echo  $computerno;}  ?>">Activate Computer Key  </a>

                                                        </li>
	 																								</br>

														<?php	

														 }
															
														 
														  ?>
			










														
												







										
										
										
										
										  <li> 
										                              <a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/viewmygrouping?randomitemidentifier=<?php   {echo  $id;}  ?>">Group  </a>

                                                        </li>
														
														
</br>

																<li> 
										                              <a target="_blank" id="more" class="btn btn-primary" href="<?php echo base_url();?>user/viewmydocuments?randomitemidentifier=<?php   {echo  $id;}  ?>&image_id=<?php   {echo  $image_id;}  ?>">Documents  </a>

                                                        </li>
												
</br>                                
												<li>											  
 	</br>
											   <a  id="more" target="_blank" class="btn btn-default" href="<?php echo base_url();?>user/employeenote?randomitemidentifier=<?php   {echo  $id;}  ?>&currentid=<?php   {echo  $id;}  ?>&type=Customer">Employee Notes   </a>
												</li>
</br>

												  <li> 
                     <a  id="more" target="_blank" class="btn btn-primary" href="<?php echo base_url();?>user/getinvoivebysupplier?randomitemidentifier=<?php   {echo  $id;}  ?>">All Invoices  </a>

                                                        </li>
														</br>
   
										<?php
										if($usertype=="admin"){
											
											?>
											  <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
										}
										?>
									
									        

											
                                    </ul>
										
                                </div>
</td>
-->
             </tr>

	<?php endforeach;} ?>

           

       <tbody> </table>
	   
        <div class="col-md-12 text-center">    <?php echo $links; ?>
					   		<span style="color:red; font-size:20px"><?php  echo $total_rows. "   Member (s). " ;?>   </span>

        
        </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">Post Opening Balance</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/postopeningbalance' , 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="customer" value=""id="customerid1" class="form-control" required placeholder="Enter customerid1">
			  		
	
		
 <div class="form-group">
    <label for="inputbranchid" class="col-sm-2 control-label">Branch</label>
    <div class="col-sm-10">
				
				
				<select class="form-control" name="branchid"  id="branchid" required>
	
	
	<option value=""  >---Select Branch/Counter to Open--</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="inputtype" class="col-sm-2 control-label">Type?</label>
    <div class="col-sm-10">
	<select class="form-control" name="type" id="type" required>
		<option value=""  >---Select  Transaction type ---</option>

		 	<option value="customer" selected  >Customer Opening Balance</option>
					 	<option value="supplier"  >Supplier Opening Balance</option>


</select>
		

	</div>
  </div>
  
  <div class="form-group">
    <label for="inputtotal" class="col-sm-2 control-label">	Balance </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="total" value="<?php echo set_value('name',0.00); ?>" id="name" class="form-control" required placeholder="Enter opening balance amount">
		 
				
		<span class="text-danger"> <?php echo form_error('total'); ?>
		
		</span>
	</div>
  </div>
  


	
  
  	<div class="form-group">
    <label for="inputcurrenttime" class="col-sm-2 control-label">	Balance Entry date  	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="currenttime" value="<?php echo set_value('entrydate',$mydate." 00:00:00"); ?>" class="form-control"  placeholder="Enter Entry date">
		 
				
		<span class="text-danger"> <?php echo form_error('currenttime'); ?>
		
		</span>
	</div>
  </div>
	
<div class="form-group">
    <label for="inputdebit" class="col-sm-2 control-label">Debit Gl Code</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="debit" value="<?php echo set_value('debit',1100); ?>" id="debit" class="form-control" required placeholder="Enter debit Gl Account code">
		 
				
		<span class="text-danger"> <?php echo form_error('debit'); ?>
		
		</span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputcredit" class="col-sm-2 control-label">Credit Gl Code</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="credit" value="<?php echo set_value('credit',3010); ?>" id="credit" class="form-control" required placeholder="Enter credit Gl Account code">
		 
				
		<span class="text-danger"> <?php echo form_error('credit'); ?>
		
		</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'); ?>"  id="description" class="form-control"  placeholder="Enter description">(Debit-Account payable, Credit-Opening Balance Equity )</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="balance" name="btn_postopeningbalance" class="btn btn-primary"> Update Branch   </button>

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

    

				</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  Customer/ Contact</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		      $mydate=date("Y-m-d");
			  
			  		      $myyear=date("Y")+1;
						  		      $mymonth=date("m-d");

			$finalnextyeardate=$myyear."-". $mymonth;

                 echo form_open('user/addmember' , 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="status" value="1"id="status" class="form-control" required placeholder="Enter status">
<input type="hidden" name="view" value="user/viewmember"id="view" class="form-control" required placeholder="Enter status">



					<div class="form-group">
    <label for="inputcategory" class="col-sm-2 control-label">	Category	 </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="category" >
	<option value=""  selected="selected"  >---Select category---</option>
	<option value="member"  >Customer</option>
		<option value="supplier"  >Supplier</option>
				<option value="user"  >Employee</option>
				
								<option value="accomodation" >Accomodation</option>

				<option value="reseller"  >Reseller/Agents</option>

	</select>		 
				
		<span class="text-danger"> <?php echo form_error('category'); ?>
		
		</span>
	</div>
  </div>
				



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

									
								
<?php
	     $mybranch=$this->usermodel->populateall('branch','id',$branchid);


if(is_array($mybranch)) {

   foreach($mybranch as $branchrow){

   ?>
					<option selected="selected" value="<?=  $branchrow->id;   ?>"><?=  $branchrow->name; ?></option>




	<?php

}} else {
    echo 'No Branch available.';
}
	
?>
	
	
	
	
	
	
	<?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="inputfirstname" class="col-sm-2 control-label">Customer	Names<span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="firstname" value="<?php echo set_value('firstname'); ?>" class="form-control" required placeholder="Enter first and last name">
		 
				
		<span class="text-danger"> <?php echo form_error('firstname'); ?>
		
		</span>
	</div>
  </div>
 <div class="form-group">
    <label for="inputcompany" class="col-sm-2 control-label">	Company<span style="color:red;"></span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="company" value="<?php echo set_value('company'); ?>" class="form-control"  placeholder="Enter company name if any">
		 
				
		<span class="text-danger"> <?php echo form_error('company'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputphone" class="col-sm-2 control-label">	Phone <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		 			  		<input type="text" name="phone"   minlength="12"	maxlength="14"   value="<?php echo set_value('phone'); ?>" class="form-control" required placeholder="Enter phone e.g 254712345678">

				
		<span class="text-danger"> e.g 254712345678 <?php echo form_error('phone'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">	  ID Number		 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idno"   value="<?php echo set_value('idno'); ?>" class="form-control"  placeholder="Enter ID.No if any ">
		 
				
		<span class="text-danger"> <?php echo form_error('idno'); ?>
		
		</span>
	</div>
  </div>
  
  
  
     <div class="form-group">
    <label for="inputidnumber" class="col-sm-2 control-label">	PIN  Number </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idnumber" minlength="11"	maxlength="14" value="<?php echo set_value('idnumber'); ?>"   class="form-control"  placeholder="Enter Pin if any">
		 
				
		<span class="text-danger"> <?php echo form_error('idnumber'); ?>
		
		</span>
	</div>
  </div>
  
   	<div class="form-group">
    <label for="inputphoneaddress_1" class="col-sm-2 control-label">Card Number/ Phone 2 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="address_1" value="<?php echo set_value('address_1'); ?>" class="form-control"  placeholder="Enter Card Number/ Phone 2">
		 
				
		<span class="text-danger"> <?php echo form_error('address_1'); ?>
		
		</span>
	</div>
  </div>
  

 
   	<div class="form-group">
    <label for="inputphonegender" class="col-sm-2 control-label">	Gender	 </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="gender" >
	
	<option value=""  >---Select Gender---</option>
	<option value="female"  >female</option>
		<option value="male"  >male</option>
	</select>		 
				
		<span class="text-danger"> <?php echo form_error('gender'); ?>
		
		</span>
	</div>
  </div>
  
   <div class="form-group" id="groupname" >		
    <label for="inputcategoryid" class="col-sm-2 control-label">Default Group Name?</label>
    <div class="col-sm-10">
	<select class="form-control" name="categoryid" >
	
	<option value=""  >---Select Group Name---</option>

	
	<?php 
					 
			
	


if(is_array($mycategory)) {

   foreach($mycategory as $mycategoryrow){

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



	<?php

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

	</div>
  </div>
   <div class="form-group">
    <label for="inputcountry" class="col-sm-2 control-label">Country?</label>
    <div class="col-sm-10">
	<select class="form-control" name="country" >
	


	
	<?php 
					 
			$mycountry = $this->nationmodel->populatenation();
	


if(is_array($mycountry)) {

   foreach($mycountry as $mycountryrow){

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



	<?php

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

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

  
  
  
  
    
  	<div class="form-group">
    <label for="inputcity" class="col-sm-2 control-label">	Town 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="city" value="<?php echo set_value('city'); ?>" class="form-control"  placeholder="Enter City or town">
		 
				
		<span class="text-danger"> <?php echo form_error('city'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
 
  
  	
 
  
    
  	<div class="form-group">
    <label for="inputentrydate" class="col-sm-2 control-label">	Entry / Start date  	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="entrydate" value="<?php echo set_value('entrydate',$mydate); ?>" class="form-control"  placeholder="Enter Entry date">
		 
				
		<span class="text-danger"> <?php echo form_error('entrydate'); ?>
		
		</span>
	</div>
  </div>
  	<div class="form-group">
    <label for="inputzip" class="col-sm-2 control-label">Due  Date	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="zip" value="<?php echo set_value('zip',$finalnextyeardate); ?>" class="form-control"  placeholder="Enter Renewal Date">
		 
				
		<span class="text-danger"> <?php echo form_error('zip'); ?>
		
		</span>
	</div>
  </div>
  
  
  	<div class="form-group">
    <label for="inputwebsite" class="col-sm-2 control-label">Renewal	Comments	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="website" value="<?php echo set_value('website'); ?>" class="form-control"  placeholder="Enter Comments if any">
		 
				
		<span class="text-danger"> <?php echo form_error('website'); ?>
		
		</span>
	</div>
  </div>
  
    
	
	  	<div class="form-group">
    <label for="inputsalesperson" class="col-sm-2 control-label">	Sales Person 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="salesperson" value="<?php echo set_value('city'); ?>" class="form-control"  placeholder="Enter sales person">
		 
				
		<span class="text-danger"> <?php echo form_error('salesperson'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	
	
  	<div class="form-group">
    <label for="inputrenewaldetails" class="col-sm-2 control-label">	Renewal Details	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="renewaldetails" value="<?php echo set_value('renewaldetails'); ?>" class="form-control"  placeholder="Enter renewaldetails if any">
		 
				
		<span class="text-danger"> <?php echo form_error('renewaldetails'); ?>
		
		</span>
	</div>
  </div>
  
  
  
	<div class="form-group">
    <label for="inputcomments" class="col-sm-2 control-label">	Company Address details</label>
    <div class="col-sm-10">

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

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="member" name="btn_addmember" class="btn btn-default"> Add Customer   </button>

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

    

				</div>

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


									
				<div id="productModal" 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">Search customers/Supplier Report</h4>
      </div>
      <div class="modal-body">
      
	  	




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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewpeople' , 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="inputbranchid" class="col-sm-2 control-label">Branch</label>
    <div class="col-sm-10">
				
				
				<select class="form-control" name="branchid"  id="branchid" required>
	
	
	<option value=""  >---Select Branch/Counter to Open--</option>

									
		<option value="all" selected="selected" >-All Branches--</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="inputdatetype" class="col-sm-2 control-label">	Date type? </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="datetype" required>
	<option value=""  >---Select Date type---</option>
	<option value="new" selected="selected" >Date Created</option>
		<option value="due"  >Due Date</option>
	</select>		 
				
		<span class="text-danger"> <?php echo form_error('datetype'); ?>
		
		</span>
	</div>
  </div>



	
					<div class="form-group">
    <label for="inputcategory" class="col-sm-2 control-label">	Category	 </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="category" >
	<option value=""  >---Select category---</option>
		<option value="all" selected="selected"  >--All categories--</option>

	<option value="member"  >Customer</option>
		<option value="supplier"  >Supplier</option>
				<option value="user"  >Employee</option>
				
								<option value="accomodation" >Accomodation</option>

				<option value="reseller"  >Reseller/Agents</option>

	</select>		 
				
		<span class="text-danger"> <?php echo form_error('category'); ?>
		
		</span>
	</div>
  </div>
		
	





  <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">	Status	 </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="status" required>
	<option value=""  >---Select status---</option>
			<option value="all"  selected="selected" >All users</option>

	<option value="1"  >Active users</option>
		<option value="0"  >Inactive users</option>
	</select>		 
				
		<span class="text-danger"> <?php echo form_error('status'); ?>
		
		</span>
	</div>
  </div>





	
	
	
	
	
	
	
  <div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>
    <div class="col-sm-10">

		  		<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$fromdates); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">	To Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="todate" value="<?php echo set_value('todate',$mydates); ?>" class="form-control" required placeholder="Enter End date">
		 
				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</span>
	</div>
  </div>
  
    


	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="people" name="btn_viewusers" class="btn btn-primary"> Search  </button>

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

    

				</div>

		</div>
	    </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('adminlogged_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="people">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewmember">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-default" 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="uploadModal" 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">Please upload Correct Members datain CSV</h4>
												  <a href="<?php echo base_url();?>downloads/members.xlsx" class="btn btn-success"> Download members upload template </a>	

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

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/uploadmembers' , 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="inputsurname" class="col-sm-2 control-label">	CSV LIST</label>
    <div class="col-sm-10">
		
			<input type="file" name="file" width="400"  value="<?php echo set_value('file') ;?>" placeholder="Select EXCELL" class="form-control" required placeholder="Enter Surname"  >

		  		
				
		<span class="text-danger"> Upload correct format of CSV File  here..<?php echo form_error('file'); ?>
		
		</span>
	</div>
  </div>	
  
	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="member" name="btn_uploadmembers" class="btn btn-default">Upload Members  </button>

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

    

				</div>

		</div>
	    </div>
    </div>					
					</div>				
									
			
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
				<div id="addsupplierModal" 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  Supplier</h4>
      </div>
      <div class="modal-body">
      
	  	

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



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



			 	<div class="form-group">
    <label for="inputcategory" class="col-sm-2 control-label">Category	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="category" readonly     value="<?php echo set_value('category','supplier'); ?>" class="form-control"  placeholder="Enter ocategory">
		 
				
		<span class="text-danger"><?php echo form_error('category'); ?>
		
		</span>
	</div>
  </div>			
						
										
						
					<div class="form-group">
    <label for="inputcompany" class="col-sm-2 control-label">	Company Name </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="company" required value="<?php echo set_value('company'); ?>" class="form-control"  placeholder="Enter company name if any">
		 
				
		<span class="text-danger"> <?php echo form_error('company'); ?>
		
		</span>
	</div>
  </div>	
			
						
						
						
						
						
						
						
						
						
	<div class="form-group">
    <label for="inputfirstname" class="col-sm-2 control-label"> Contact	Names<span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="firstname" value="<?php echo set_value('firstname'); ?>" class="form-control" required placeholder="Enter first and last name">
		 
				
		<span class="text-danger"> <?php echo form_error('firstname'); ?>
		
		</span>
	</div>
  </div>

  
  	<div class="form-group">
    <label for="inputphone" class="col-sm-2 control-label">	Phone <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="phone" value="<?php echo set_value('phone'); ?>" class="form-control" required placeholder="Enter phone e.g 254712345678">
		 
				
		<span class="text-danger"> e.g 254712345678 <?php echo form_error('phone'); ?>
		
		</span>
	</div>
  </div>
  
   	<div class="form-group">
    <label for="inputphoneaddress_1" class="col-sm-2 control-label">Phone 2	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="address_1" value="<?php echo set_value('address_1'); ?>" class="form-control"  placeholder="Enter other line e.g 254712345678">
		 
				
		<span class="text-danger">Other Number e.g 254712345678 <?php echo form_error('address_1'); ?>
		
		</span>
	</div>
  </div>
  
   	<div class="form-group">
    <label for="inputphonegender" class="col-sm-2 control-label">Contact	Gender	 </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="gender" >
	
	<option value=""  >---Select Gender---</option>
	<option value="female"  >female</option>
		<option value="male"  >male</option>
	</select>		 
				
		<span class="text-danger"> <?php echo form_error('gender'); ?>
		
		</span>
	</div>
  </div>
   <div class="form-group">
    <label for="inputcountry" class="col-sm-2 control-label">Country?</label>
    <div class="col-sm-10">
	<select class="form-control" name="country" >
	


	
	<?php 
					 
			$mycountry = $this->nationmodel->populatenation();
	


if(is_array($mycountry)) {

   foreach($mycountry as $mycountryrow){

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



	<?php

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

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

  
  	<div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">		ID Number	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idno" value="<?php echo set_value('idno'); ?>" class="form-control"  placeholder="Enter idno if any or Company Pin">
		 
				
		<span class="text-danger"> <?php echo form_error('idno'); ?>
		
		</span>
	</div>
  </div>
  
  
  
     
  
  
  
  
    
  	<div class="form-group">
    <label for="inputcity" class="col-sm-2 control-label">	City 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="city" value="<?php echo set_value('city'); ?>" class="form-control"  placeholder="Enter City or town">
		 
				
		<span class="text-danger"> <?php echo form_error('city'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  	<div class="form-group">
    <label for="inputzip" class="col-sm-2 control-label">	Zip Code 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="zip" value="<?php echo set_value('zip'); ?>" class="form-control"  placeholder="Enter Zip Code">
		 
				
		<span class="text-danger"> <?php echo form_error('zip'); ?>
		
		</span>
	</div>
  </div>
  
  
  
 
  
  	
 
  
    	<div class="form-group">
    <label for="inputwebsite" class="col-sm-2 control-label">		Website/Link 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="website" value="<?php echo set_value('website'); ?>" class="form-control"  placeholder="Enter website if any">
		 
				
		<span class="text-danger"> <?php echo form_error('website'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputentrydate" class="col-sm-2 control-label">	Entry date  	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="entrydate" value="<?php echo set_value('entrydate'); ?>" class="form-control"  placeholder="Enter Entry date">
		 
				
		<span class="text-danger"> <?php echo form_error('entrydate'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
	<div class="form-group">
    <label for="inputcomments" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

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

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="member" name="btn_addmember" class="btn btn-default"> Add Supplier   </button>

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

    

				</div>

		</div>
	    </div>
    </div>						
									
									<div id="uploadModal" 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">Please Correct Members data(CSV)</h4>
		
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/uploadmembers' , 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="inputsurname" class="col-sm-2 control-label">	CSV LIST</label>
    <div class="col-sm-10">
		
			<input type="file" name="file" width="400"  value="<?php echo set_value('file') ;?>" placeholder="Select EXCELL" class="form-control" required placeholder="Enter Surname"  >

		  		
				
		<span class="text-danger"> Upload correct format of CSV File  here..<?php echo form_error('file'); ?>
		
		</span>
	</div>
  </div>	
  
	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="member" name="btn_uploadmembers" class="btn btn-default">Upload Members  </button>

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

    

				</div>

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

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

 
</div>


















