


<script> 

$(function() {
	

    //Initialize Select2 Elements
    $(".select2").select2();
//$('#content').html('<img id="loader-img" alt="" src="<?php echo base_url();?>assets/dist/loader.gif"  align="center" />');
    $('#All').click(function(){
		//alert('clicked');
		if ($('#All').prop('checked'))		 
		 {
			$('#Employee').attr('disabled', 'true');			
	  
		 }
		 else
		 {
			$('#Employee').removeAttr('disabled');
			
		 }
	  
    });

	 $('#PayOn').change(function() {
    
 var id = $('#PayOn').val();
		if(id != '-1')
		{
			$('#content').loader('show');

		 $.ajax({
			data:{id:id},
			
			type:"POST",
			url:"<?php echo base_url();?>payslip/getEmployee",
			success:function(result) {
				if(result)
				{
$("#Employee").empty();	
				$('#content').loader('hide'); 
				$("#Employee").append(result);
				 
				}
					
		      }
			});	
		}
		else
		{
			alert('Please select the PayOn');
			return false;
		}
  
});

 
	 }); 
	 <!-- Editable table-->
	 $(function () { 
	$("td").dblclick(function () {
	 var OriginalContent = $(this).text();
	  $(this).addClass("cellEditing");
	   $(this).html("<input type='text' value='" + OriginalContent + "' />");
	    $(this).children().first().focus(); 
	    $(this).children().first().keypress(function (e) { 
	    	if (e.which == 13) {
	    	 var newContent = $(this).val();
	    	  $(this).parent().text(newContent); 
	    	  $(this).parent().removeClass("cellEditing");
	    	   } });
	    	    $(this).children().first().blur(function(){
	    	     $(this).parent().text(OriginalContent);
	    	      $(this).parent().removeClass("cellEditing");
	    	       });
	    	        });
	    	         });
</script>
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
       <center>Siddharth Industries - PaySlip Create and Update</center>
        
      </h1>
    </section>
    <section class="content">
	<div class="row" style="border:2px dotted; padding:5%">
	 <form id="PayslipGenerator" action="<?php echo base_url() ?>PrintPdf" method="post" role="form" > 
        <div class="row"  >
		<div class="col-md-4">
	
				<span for="selectmonth">Select Month</span>
					<select id="PayOn" name="PayOn"   class="form-control select2" style="width: 100%;">
							<option  value="-1">Select Payon Month</option>
								<?php	
                                            if(!empty($Payon))
                                            {
                                                foreach ($Payon as $rl)
                                                {
													 $Pay =$rl->PayOn;
                                                  													
													if ($_POST['PayOn'] == $Pay) 
													{

												echo "<option value=\"".$Pay."\" selected=\"selected\">".$Pay."</option>"; 
													}
													else 
													{
													echo "<option value=\"".$Pay."\">".$Pay."</option>";       
													}		
                                                    
                                                }
                                            }
                                            ?>
						</select>
			</div>
				<div id="content"></div>
			<div class="col-md-4  ">
				
					
						<span>Employee ID</span>
						<select id="Employee" name="Employee"  class="form-control select2" type="text"  class="form-control">
							<option value="-1">Select Employee ID</option> 
							
								</select>
								<br/>
								<input  class="my-check" type="checkbox" name="All" id="All"   > Select All<br>
					</div>
					<div class="col-md-4 my-box">
				
					
						<span>Employee Name</span>
						<div class="form-group">
												<?php
										 $data = array('name' => 'emp_name','value' => set_value('emp_name'),'id'=>'emp_name',  'class' => 'form-control' ,'required' => 'true' , 'readonly' => 'true');
										echo form_input($data);
										?>   
								<br/>
								 
					</div>
					
					
			</div>
			
			
			 
			</div>
			 

 
<script>
<!-- To hide the Employee name if select all employee id-->	
$(".my-check").change(function() {
    if ( $(this).is(':checked') ) {
        $(".my-box").hide();
    } else {
        $(".my-box").show();
    }
});
</script>
			<div class="row"  >
			
			 <table id="mytable" class="table table-bordred table-striped editableTable"> 
                   <thead style="background-color: #CFCFCF;">
					<th>Employee ID</th>                   
                   <th>OT in Hours</th>
                    <th>Incentive</th>
                     <th>Loan recoveries</th>
                     <th>Mode Of Payment</th>
					 <th>Remarks</th>
					 <th>Action</th>
                   </thead>
					<tbody>
					
					<tr>
					<td>Emp001</td>
					<td>40</td>
					<td>2000</td>
					<td>5000</td>
					<td>Cheque</td>
					<td>Pending Loan amount 25000 </td>
					<td>  
						<i><button class="btn btn-danger btn-xs" Onclick="ConfirmDelete()"><span class="fa fa-eye"></span></button></i>
						 </td> 

					</tr>
				 <tr>
					<td>Emp002</td> 
					<td>20</td>
					<td>1500</td>
					<td>0.00</td>
					<td>Account</td>
					<td>Good</td>
					<td>  
						  <i><button class="btn btn-danger btn-xs" Onclick="ConfirmDelete()"><span class="fa fa-eye"></span></button></i>
						 </td> 
						 
				 </tr>
				 <tr>
					<td>Emp003</td>				 
					<td>0</td>
					<td>1900</td>
					<td>0.00</td>
					<td>Account</td>
					<td>Good</td>
					<td>  
						 <i><button class="btn btn-danger btn-xs" Onclick="ConfirmDelete()"><span class="fa fa-eye"></span></button></i>
					</td> 
						  
				</tr> 
				 <tr>
					<td>Emp004</td> 
					<td>25</td>
					<td>1549</td>
					<td>0.00</td>
					<td>On Hold</td>
					<td>Good</td>
					<td>  
						<i><button class="btn btn-danger btn-xs" Onclick="ConfirmDelete()"><span class="fa fa-eye"></span></button></i>
						 </td> 
				 
					</tr>
					</tbody>
			</table>
		
			</div>
			<div  class="col-md-4 col-md-offset-6" align = "right">
			<input type="submit" class="btn btn-info" value="Generate" />
			 
				</div>
			 <div class="row"  >
			  
			
				
				 <?php
                    $this->load->helper('form');
                    $error = $this->session->flashdata('error');
                    if($error)
                    {
                ?>
                <div class="alert alert-danger alert-dismissable">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    <?php echo $this->session->flashdata('error'); ?>                    
                </div>
                <?php } ?>
                <?php  
                    $success = $this->session->flashdata('success');
                    if($success)
                    {
                ?>
                <div class="alert alert-success alert-dismissable">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    <?php echo $this->session->flashdata('success'); ?>
                </div>
                <?php } ?>
                
                <div class="row">
                    <div class="col-md-4">
                        <?php echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?>
                    </div>
                </div>
            </div>
        </div>
		
         
    </section>
</div>
 
