<link href="<?php echo base_url(); ?>assets/autocomplete/jquery-ui.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>assets/autocomplete/ui.theme.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>assets/autocomplete/autocomplete.css" rel="stylesheet">
	 <script src="<?php echo base_url(); ?>assets/autocomplete/jquery.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/autocomplete/jquery-ui.min.js"></script>


 
            
        <script type="text/javascript">  
        $(this).ready( function() {  
            $("#id").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                        url: "<?php echo base_url(); ?>Systemusers/lookup",  
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });  
		
		
			
		 $(document).on("click", "#managebtndelete", function()
        {
          var transactionid = $(this).data('id');
		  $("#transactionid").val(transactionid); 
   var myid = $(this).data('myid');
		  $("#myid").val(myid); 
		   
		   
        });
		  $(function() {
<!--             $(".datepicker").datepicker(); -->
<!--             $(".uniform_on").uniform() -->;
            $(".chzn-select").chosen();
   <!--          $('.textarea').wysihtml5(); -->

        });
        </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;
					}
 
				echo $this->session->flashdata('msg'); 
   $session_data = $this->session->userdata('logged_in');

      $mydate=date("Y-m-d H:i:s");
 $date = Date('Y-m-d') ;
		 	 $year = Date('Y') ;
		  $month = Date('m') ;
 	$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);
    $showdefaultserials=$this->usermodel->populatuserpermissionsdataarray('purchases','showdefaultserials',$userid);

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

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

     echo $this->session->flashdata('productmsg');
	 
	 
	  function createRandomPassword() {

		  


	$chars = time()."956323230323205436565243523535364745744523341324158009124423232023456789453242131231425325241231235325325632521321354612142545355324535523424353454645";
					  //$chars = '2342355ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-+';

	srand((double)microtime()* time());
	$i = 0;
	$pass = '' ;
	while ($i <= 6) {

		$num = rand() % 33;

		$tmp = substr($chars, $num, 1);

		$pass = $pass . $tmp;

		$i++;

	}
	return $pass;
}
	 
	 
	 
	 
	 
	 
	 

  ?>

  
		<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-center"> Create new serials </span>
	  

				 
            	</div>
            </div>
			<div class="panel-body">
								
								
								
														<table id="register" class="table table-bordered " width="100%" >

								
			<thead>
								<tr>
	<th>#</th>
								<th>First Name</th>
									<th>Surname</th>
								

								<th> Days /	Amount worked </th>
	<th>IDNO</th>
								<th>Month</th>
								<th>Category</th>
									<th>Rate</th>
								</tr>

						</thead>
						<?php
					
					
					$i=0;

	
				echo $this->session->flashdata('msg');
				 echo $this->session->flashdata('deletemsg'); 
		if(validation_errors()):
		 endif;
 if(!is_array($readings)) 

 {




    
       echo '<div class="alert alert-warning text-center">There is no booking found by now from system..</div>';
    
    }else {

	 	$serial = createRandomPassword();

 	
					
		//$serial = $userid.time();
                 echo form_open('user/bulkpsavinglabour' , 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;?>		
	
 	<?php
 
 
 
 
 
 
	
	foreach ($readings as $c){
			

$i++;


             ?>
				                    <tbody >
									
										 
										
											<tr>
												 <td> 
												 <?php ; 
													echo $i;	

													?>
												 
												 
												 </td>
												 
										
												 <td>
												 
											 	<input type="hidden" name="myid[]" id="myid" value="<?php echo set_value('myid',$c->id); ?>" class="form-control" required placeholder="myid" >


 
     	<input type="text" required readonly name="firtname[]" id="firtname" value="<?php echo set_value('firtname',$c->firstname); ?>" class="form-control"  placeholder="Enter firtname" >

  </td>
			 <td><?php ; 
														

?>

   	<input type="text" required readonly name="lastname[]" id="lastname" value="<?php echo set_value('lastname',$c->surname); ?>" class="form-control"  placeholder="Enter last name">


  </td>
  		<td>
		<input type="text" name="qty[]" id="qty" value="<?php echo set_value('qty'); ?>" class="form-control"  placeholder="Enter qty" >
</td>		
						
													    
  
  <td>
  	<input type="text"  name="idno[]" id="idno" value="<?php echo set_value('idno',$c->idno); ?>" class="form-control"  placeholder="Enter idno" >
  </td>
												
	

<td>
		<input type="text" name="slarymonth[]" id="slarymonth" value="<?php echo set_value('slarymonth',$slarymonth); ?>" class="form-control"  placeholder="Enter slary month" >
</td>		

	<td>
		<input type="text" name="category[]" id="category" value="<?php echo set_value('category',$c->code); ?>" class="form-control"  placeholder="Enter category" >
</td>		
	
	<td>
		<input type="text" readonly name="rate[]" id="rate" value="<?php echo set_value('rate',$c->unit); ?>" class="form-control"  placeholder="Enter category" >
</td>		
	
 </tr>
 <?php 
	 }?>
										

         

								<tr>
									<th> 
	
	

				</th>	
				
				
				<th>	
				
					</th>
				
				
				
				
				
				<th colspan="3">			
<button type="submit"  value="bulkinsert" name="btn_bulklabours" class="btn btn-primary"> Update Bulk basic Salary  </button>

								
								</th>
							
							
							</tr>
				 <?php echo form_close();?>	
				 
				 <?php }?>	
									</tbody>
									
									
					</table>
				</div>	
			</div>			
					
					
					
					
					
					
					
					
					
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

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

 
</div>


















