

<script>
	function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;

    // document.body.innerHTML = printContents.fontsize(12);
     window.print();

	 if( window.print()) {
         window.location.href = "../user/allinvoices";
		alert(" printing...........");
    }else {

	
		      return      window.location.href = "../user/allinvoices";

		    // document.body.innerHTML = originalContents;

	}
}
	</script>

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

 
 
		
    </script>  
   <style type="text/css">
  
  

    #myprint { display: none; }
#print{  	


    background-repeat: no-repeat;
	font-size;20px;
  
    width:100%; 


}

#sale{  	


    background-repeat: no-repeat;
  
    width:100px; height:50px;


}
    @media print
    {
    	#non-printable { display: none; }
    	#printableArea { display: block; font-size:16; width:100%; }
		    	#myprint { display: block; font-size:16; width:100%; }

    }
    </style>
 <div class="row">
  
   	  <?php
   $session_data = $this->session->userdata('logged_in');

   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
	 
	 $data['branchid'] = $session_data['branchid'];
	 $branchid = $data['branchid'];
	 
	 
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
     $allrolesaction=$this->usermodel->populatuserpermissionsdataarray('users','deleteallroles',$userid);
	      $addaction=$this->usermodel->populatuserpermissionsdataarray('humanresource','add',$userid);
	      $deleteaction=$this->usermodel->populatuserpermissionsdataarray('humanresource','delete',$userid);
			    $viewallpayroll=$this->usermodel->populatuserpermissionsdataarray('humanresource','viewallpayroll',$userid);
	      $viewusers=$this->usermodel->populatuserpermissionsdataarray('users','view',$userid);

   $STARTDATE=date("Y-m-01 00:00:00");
					  $ENDDATE=date("Y-m-30 23:59:59");
  ?>
   	

   	<div class="col-md-12">

  
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading" id="non-printable">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
  
 <span>

<h3> View salary history</h3>

										<?php
										if($viewallpayroll==true){
											
											?>
 
 <a class="btn btn-default" href="<?php echo base_url(); ?>user/viewemployee">View Employees?</a>
 
 
 
										<?php
										}
											
											?>
	 <a class="btn btn-default" href="<?php echo base_url(); ?>user/viewemployee">View Categories?</a>

	<a class="btn btn-default" href="<?php echo base_url(); ?>user/payrollsetup"> Pay/Deduction Setup</a>
	<a class="btn btn-default" href="<?php echo base_url(); ?>user/salaryhistory"> Salary History</a>
 <a data-toggle='modal' data-target='#purchaseModal' class="btn btn-default">Search for Payroll</a>
    <a data-toggle='modal' data-target='#labourModal' class="btn btn-default">Sync  Labour</a>

   <a data-toggle='modal' data-target='#paymentModal' class="btn btn-default">Process bulk Payroll</a>

  <a data-toggle='modal' data-target='#p9Modal' class="btn btn-default">Generate P9 Report</a>

  <a data-toggle='modal' data-target='#accountsModal' class="btn btn-default">Search for Deductions/Pay</a>

	<a class="btn btn-default" href="<?php echo base_url(); ?>user/viewrequest"> Human Resource</a>
 <a data-toggle='modal' data-target='#payeModal' class="btn btn-default">PAYE Calculator</a>
						 <a data-toggle='modal' data-target='#payenowModal' class="btn btn-primary">Process Statutory deductions </a>
						 <a data-toggle='modal' data-target='#bulklabourModal' class="btn btn-success">Post Salary Bulk Update</a>

			 <a data-toggle='modal' data-target='#uploadModal' class="btn btn-primary">Upload direct salary  </a>






 </span>		
 <div class="pull-right"  id="non-printable">
<form name="print" method="post" action="">
 <input type="submit" id="print"  accesskey="p" class="btn btn-primary"  name="print"onclick="printDiv('sortable')" value="print receipt!" />
</form></div>
				
            	</div>
            </div>
			<div class="panel-body">
		
			
	<div class="widget-content nopadding table_holder table-responsive">				
				<?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;
					}

								?>	
					<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('deletemsg'); 

		 echo $this->session->flashdata('msg'); 
        $attr = array("class" => "form-horizontal", "role" => "form", "id" => "search", "name" => "search");
        echo form_open("user/searchallmembersslary", $attr);?>
            <div class="form-group">
			
                <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-success" value="Search" />
                    <a href="<?php echo base_url(). "user/salaryhistory"; ?>" class="btn btn-primary">Refresh</a>
                </div>
				 
            </div>
        <?php echo form_close(); ?>
        </div>
									
  <table cellpadding="0" cellspacing="0" border="1"id="sortable" style="width:100%;"  >

             <thead>
			  <?php
			 
			 if(isset($configuration[0]['businessname'])) {
				 ?>
			 	 <tr>
								
								<td colspan="21" ><center  >
								
						
									

										<?php $bussinessname=$configuration[0]['businessname']; if(isset($bussinessname)) {echo   $bussinessname; }
										
									
										
										?>
												<span id="mytitle"></br><b> Payroll  Report for the month of  <?PHP echo $slarymonth ?>  <?PHP echo $salaryyear ?></b>		
								
								<br>Name----------------------Date--------------------Signature----------------</span>
<BR><BR>
								</center></td>
								
								
							</tr>
							<?php
			 }
							?>
			 
			 
         <tr>
		        <th>S.NO </th>

       <th>Emp No </th>

     <th>Employee Name</th>
	      <th>Idno</th>

  

    <th>Basic <br>Salary</th>
			   <th>Other <br>payments</th> 

		 <th>Gross <br>Salary</th> 
		 
		 				   <th>PAYE</th> 
		 				   <th>NSSF</th> 
						   <th>SHIF</th> 
						   	   <th>H.Levy</th> 
						   <th>Advance</th> 
						   <th>Loan</th> 
						   <th>Helb<br>
						   /sacco</th> 
						   <th>Damages</th> 



				   <th>TT Ded</th> 
				   				   <th>Net Salary</th> 


				   <th>Method</th> 
				   <th>Bank Name</th> 
				   <th>Bank Acc</th> 

				   <th>Payment</th> 




<th>Payroll</th>

<th id="non-printable">More</th>
                 </tr>
             </thead><tbody>
<?php

 if(!is_array($viewemployee)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='18'>";
    
       echo '<div class="alert alert-warning text-center">There no records found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php
$i=0;			 
  $ttpay=0;
  $tthouselevy=0;

$ttsalary=0;
$ttdeductions=0;
$ttgrosssalary=0;
$ttbonus=0;
 $ttnetsalry=0;
 $PAYE=0; 
		 				   $NSSF=0; 
						   $NHF=0; 
						   $Advance=0; 
						   $Loan=0; 
						   $sacco=0; 
						   $Damages=0; 
  	foreach ($viewemployee as $c): 

		 

             ?>



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

?>
       <td><?php echo $i ; ?></td>         

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

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

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

	  

	  
	  
	  
	  
	  <td><?php 
 echo formatMoney($c->mysalary, true);

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

	  						  		  	  <td><?php
 echo formatMoney($c->gross, true);

										  ?></td>
 <th>
 <?php 
 		$payeconfig = $this->usermodel->populatealldatanorraythree('employeepayments','salaryid', $c->salaryid ,'code',"8",'companyid', $companyid);
	echo$mypaye=$payeconfig[0]['amount'];
	$PAYE=$PAYE+$mypaye;
	
	
 ?>
 
 </th> 
		 				   <th>
						    <?php 
 		$nssfconfig = $this->usermodel->populatealldatanorraythree('employeepayments','salaryid', $c->salaryid ,'code',"9",'companyid', $companyid);
	echo$myNSSF=$nssfconfig[0]['amount'];
	$NSSF=$NSSF+$myNSSF;
	
	
 ?>
 
						   
						   </th> 
						   <th>
						   
						     <?php 
 		$nhifconfig = $this->usermodel->populatealldatanorraythree('employeepayments','salaryid', $c->salaryid ,'code',"10",'companyid', $companyid);
	echo$myNHF=$nhifconfig[0]['amount'];
	$NHF=$NHF+$myNHF;
	
 ?>
						   </th> 
						   
						   
					   <th>
						   
						     <?php 
 		$hlevyconfig = $this->usermodel->populatealldatanorraythree('employeepayments','salaryid', $c->salaryid ,'code',"2005",'companyid', $companyid);
	echo$mylevy=$hlevyconfig[0]['amount'];
	$tthouselevy=$tthouselevy+$mylevy;
	
	
 ?>
						   </th> 	   
						   
						   <th>
						    <?php 
 		$advanceconfig = $this->usermodel->populatealldatanorraythree('employeepayments','salaryid', $c->salaryid ,'code',"11",'companyid', $companyid);
	echo$myAdvance=$advanceconfig[0]['amount'];
	$Advance=$Advance+$myAdvance;
	
 ?>
						   </th> 
						   <th>
						    <?php 
 		$loanconfig = $this->usermodel->populatealldatanorraythree('employeepayments','salaryid', $c->salaryid ,'code',"12",'companyid', $companyid);
	echo$myLoan=$loanconfig[0]['amount'];
	
	$Loan=$Loan+$myLoan;
	
 ?>
						   
						   </th> 
						   <th>
						    <?php 
 		$saccosconfig = $this->usermodel->populatealldatanorraythree('employeepayments','salaryid', $c->salaryid ,'code',"16",'companyid', $companyid);
	echo$mysacco=$saccosconfig[0]['amount'];
	
	$sacco=$sacco+$mysacco;
 ?>
						   
						   
						   </th> 
						   <th>
						   <?php 
 		$damegesconfig = $this->usermodel->populatealldatanorraythree('employeepayments','salaryid', $c->salaryid ,'code',"14",'companyid', $companyid);
	echo$myDamages=$damegesconfig[0]['amount'];
	$Damages=$Damages+$myDamages; 

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

			$c->bonus ; 
			  
$ttsalary=$ttsalary+$c->mysalary;
$ttdeductions=$ttdeductions+$c->deductions;
$ttpay=$ttpay+$c->pay;
$ttgrosssalary=$ttgrosssalary+$c->gross;
$ttbonus=$ttbonus+$c->bonus;
		$ttnetsalry=$ttnetsalry+$c->netsalry;	  
			  
			  ?></td>
		
			  
			  		  	  <td><b><?php 
						  echo formatMoney($c->netsalry, true);  
						  
						  ?></b></td>

						  

 <td><?php 
 	$methodename = $this->usermodel->populateallarray('paymentmethodes','id',$c->method);
		echo $methodename[0]["name"];
 
 ?></td>
  <td><?php  
  $banks = $this->usermodel->populateallarray('glaccounts','number',$c->bankname);
	
		if($banks !=false){
				echo $banks[0]["accountname"];
		}else{
			echo $c->bankname;
		}
  
  
  ?></td>
   <td><?php echo $c->bankaccount ; ?></td>
     	  <td><?php echo $c->slarymonth ; ?></td>
   <td>
                                               <a  id="more" class="btn primary" href="<?php echo base_url();?>user/mypayrollsetup?randomitemidentifier=<?php   {echo  $c->memberid ;}  ?>">Payroll  </a>

   </td>


     		  <td id="non-printable">  

 
 
					<div class="btn-group">
                                    <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
							
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
										
										    <li>
											
											                                               <a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/mypayslip?randomitemidentifier=<?php   {echo  $c->memberid ;}  ?>&slipid=<?php   {echo  $c->salaryid ;}  ?>  ">Pay Slip  </a>

											</li>
											                                       <li class="divider"></li>

												<?php
										if($deleteaction==true){
											
											?>
										<!--
											 <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-salaryid='<?php echo  $c->salaryid;?>'	 data-id='<?php echo  $c->id;?>'    data-toggle='modal' data-target='#deleteModal<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Cancel Payroll
                                                </a>
                                                        </li>
													-->
									
											<?php
										}
										?>
									
                                    
                                        
                                        <!-- teacher DELETION LINK -->
                                        
                                 
										   
										   </ul>
                                </div>
</td>
             </tr>

	<?php endforeach;} ?>

            		<tr border="1" background="green">
									<td colspan="4"><center><b>Expected  Amount:
		<?php if(isset($total)) {echo formatMoney($total, true);  }?><b></center></td>

		<td>  <b><?php if(isset($ttsalary)) {echo formatMoney($ttsalary, true);  }?><b></td>
						
			<td>  <b><?php if(isset($ttpay)) {echo formatMoney($ttpay, true);  }?><b></td>

						<td>  <b><?php if(isset($ttgrosssalary)) {echo formatMoney($ttgrosssalary, true);  }?><b></td>
<td>  <b><?php if(isset($PAYE)) {echo formatMoney($PAYE, true);  }?><b></td>
						<td>  <b><?php if(isset($NSSF)) {echo formatMoney($NSSF, true);  }?><b></td>
						<td>  <b><?php if(isset($NHF)) {echo formatMoney($NHF, true);  }?><b></td>
												<td>  <b><?php if(isset($tthouselevy)) {echo formatMoney($tthouselevy, true);  }?><b></td>

						<td>  <b><?php if(isset($Advance)) {echo formatMoney($Advance, true);  }?><b></td>
						<td>  <b><?php if(isset($Loan)) {echo formatMoney($Loan, true);  }?><b></td>
						<td>  <b><?php if(isset($sacco)) {echo formatMoney($sacco, true);  }?><b></td>
						<td>  <b><?php if(isset($Damages)) {echo formatMoney($Damages, true);  }?><b></td>

			

			
			
			
			<td>  <b><?php if(isset($ttdeductions)) {echo formatMoney($ttdeductions, true);  }?><b></td>

	<td>  <b><?php if(isset($ttnetsalry)) {echo formatMoney($ttnetsalry, true);  }?><b></td>

	
	<td id="non-printable"  colspan="6"></td>
</tr>

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

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

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/uploadpayrollist' , 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="type" value="product"id="type" class="form-control" required placeholder="Enter type">
	
	
	<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="uploadpayroll" name="btn_uploadpayrollraw" class="btn btn-default">Upload raw payroll </button>

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

    

				</div>

		</div>
	    </div>
    </div>
	
	
	
	
	
	
  
<div id="paymentModal" 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">Process bulk payment</h4>
      </div>
      <div class="modal-body">
      
	  	

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

         $YEAR = date('Y');


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/processbulkpayroll' , 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="inputsalaryyear" class="col-sm-2 control-label">	Year </label>
    <div class="col-sm-10">
		<input type="hidden" name="view" value="user/salaryhistory"id="view" class="form-control" required placeholder="Enter status">

	<input type="hidden" name="payment" value=""id="view" class="form-control" required placeholder="Enter status">
	<input type="hidden" name="action" value="insert"id="action" class="form-control" required placeholder="Enter action">

		  		<input type="number" name="salaryyear" value="<?php echo set_value('salaryyear',$YEAR); ?>" class="form-control" required placeholder="Enter salary year">
		 
							  		<input type="hidden" readonly name="myid" value="<?php echo set_value('myid'); ?>"id="myid" class="form-control" required placeholder="Enter itemid">

		<span class="text-danger"> <?php echo form_error('salaryyear'); ?>
		
		</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="inputcategory" class="col-sm-2 control-label">Category</label>
    <div class="col-sm-10">
				
				
				<select class="form-control" name="category"  id="category" required>
	
	
	<option value=""  >---Select Category to Open--</option>

		<option value="all" selected="" >---All Categories--</option>

	
	
	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('category','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="inputslarymonth" class="col-sm-2 control-label">	Month </label>
    <div class="col-sm-10">
	
     <select name='slarymonth' class="form-control" required>
    <option value=''>--Select Month for payment--</option>
    <option  value='Janaury'>Janaury</option>
    <option value='February'>February</option>
    <option value='March'>March</option>
    <option value='April'>April</option>
    <option value='May'>May</option>
    <option value='June'>June</option>
    <option value='July'>July</option>
    <option value='August'>August</option>
    <option value='September'>September</option>
    <option value='October'>October</option>
    <option value='November'>November</option>
    <option value='December'>December</option>
    </select> 		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>

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

		<option value="all" selected="" >---All--</option>

<option value="">---Select Bank----</option>

	<?php 			

		$mybankcodes= $this->usermodel->populatealldatanoarray('glaccounts','companyid',$companyid,'accounttype','1');


if(is_array($mybankcodes)) {

   foreach($mybankcodes as $mybankcodesrow){
$mybak="";
  // echo $leavegrouprow->name;
   
    ?>
					<option value="<?=  $mybankcodesrow->number;   ?>"><?=  $mybankcodesrow->accountname ."(Acc No:". $mybankcodesrow->number .")"; ?></option>



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

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="bulkpayment" name="btn_processbulkpayroll" class="btn btn-primary"> Process Payment  </button>

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

    

				</div>

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


	
	
  
<div id="labourModal" 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">Process bulk labour sheet</h4>
      </div>
      <div class="modal-body">
      
	  	

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

         $YEAR = date('Y');


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

 <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="inputslarymonth" class="col-sm-2 control-label">	Month </label>
    <div class="col-sm-10">
	
     <select name='slarymonth' class="form-control" required>
    <option value=''>--Select Month for payment--</option>
    <option  value='Janaury'>Janaury</option>
    <option value='February'>February</option>
    <option value='March'>March</option>
    <option value='April'>April</option>
    <option value='May'>May</option>
    <option value='June'>June</option>
    <option value='July'>July</option>
    <option value='August'>August</option>
    <option value='September'>September</option>
    <option value='October'>October</option>
    <option value='November'>November</option>
    <option value='December'>December</option>
    </select> 		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</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',$STARTDATE); ?>" 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',$ENDDATE); ?>" 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="labour" name="btn_processbulkLoabour" class="btn btn-primary"> Process Loabour  </button>

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

    

				</div>

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


	
	
	<div id="purchaseModal" 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">Salary Report by date</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');
					  $mydate=date("Y-m-d H:i:s");
					  $frommydate=date("Y-m-d 00:00:00");

         $YEAR = date('Y');
				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewsalary' , 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="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>

									
					<option value="all"  >All branches/Counters</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="inputcategory" class="col-sm-2 control-label">Category</label>
    <div class="col-sm-10">
				
				
				<select class="form-control" name="category"  id="category" required>
	
	
	<option value=""  >---Select Category to Open--</option>

		<option value="all" selected="" >---All Categories--</option>

	
	
	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('category','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="inputsalaryyear" class="col-sm-2 control-label">	Year </label>
    <div class="col-sm-10">


		  		<input type="number" name="salaryyear" value="<?php echo set_value('salaryyear',$YEAR); ?>" class="form-control" required placeholder="Enter salary year">
		 

		<span class="text-danger"> <?php echo form_error('salaryyear'); ?>
		
		</span>
	</div>
  </div>	
	<div class="form-group">
    <label for="inputslarymonth" class="col-sm-2 control-label">	Month </label>
    <div class="col-sm-10">
	
     <select name='slarymonth' class="form-control" required>
    <option value=''>--Select Month for payment--</option>
	    <option  value='all'>The whole year</option>

    <option  value='Janaury'>Janaury</option>
    <option value='February'>February</option>
    <option value='March'>March</option>
    <option value='April'>April</option>
    <option value='May'>May</option>
    <option value='June'>June</option>
    <option value='July'>July</option>
    <option value='August'>August</option>
    <option value='September'>September</option>
    <option value='October'>October</option>
    <option value='November'>November</option>
    <option value='December'>December</option>
    </select> 		 
				
		<span class="text-danger"> <?php echo form_error('slarymonth'); ?>
		
		</span>
	</div>
  </div>

  
	 
  
	 <div class="form-group">
    <label for="inputdownload" class="col-sm-2 control-label">Download?</label>
    <div class="col-sm-10">
	<select class="form-control" name="download" required>
	
	<option value=""  >---Select your option---</option>

		<option value="no" selected="selected" >--I want to view the Payroll---</option>
			<option value="yes"  >--I want to download the Payroll---</option>

</select>
		

	</div>
  </diV>
	
	
	
	<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" >

		<option value="all" selected="" >---All--</option>

<option value="">---Select Bank----</option>

	<?php 			

			//$mybankcodes = $this->usermodel->populatealldata('bankcodes','name','ASC');

$mybankcodes= $this->usermodel->populatealldatanoarray('glaccounts','companyid',$companyid,'accounttype','1');


if(is_array($mybankcodes)) {

   foreach($mybankcodes as $mybankcodesrow){
$mybak="";
  // echo $leavegrouprow->name;
   
    ?>
					<option value="<?=  $mybankcodesrow->number;   ?>"><?=  $mybankcodesrow->accountname ."(Acc No:". $mybankcodesrow->number .")"; ?></option>



	<?php
 
 
}} else {
	
   }
 ?>
		
				</select>
		
    <span class="text-danger"><?php echo form_error('bankname'); ?>
	</span>
   </div>
  </div>
	
	
	
	
	
	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_invoice" class="btn btn-primary"> View Payroll  </button>

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

    

				</div>

		</div>
	    </div>
    </div>	
	
	
	
	<div id="p9Modal" 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">Salary P9 Report by year</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');
					  $mydate=date("Y-m-d H:i:s");
					  $frommydate=date("Y-m-d 00:00:00");

         $YEAR = date('Y');
				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/getp9salary' , 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="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="inputuser" class="col-sm-2 control-label">User?</label>
    <div class="col-sm-10">
	<select class="form-control" name="user" required>
	
	<option value=""  >---Select user---</option>

						<?php
		
		
			 					//$allusers = $this->usermodel->populatealldatanoarraythree('productlist','expdate <>', '0000-00-00','expdate <', $currentdate,'companyid', $companyid);			   

			$allusers = $this->usermodel->populatealldatanoarraythree('people', 'companyid',$companyid,'status',1,'category','user');
			
	 

	 
	
if(is_array($allusers)) {

   foreach($allusers as $userrow){

   //echo $courserow->coursename;
    ?>
						<option value="<?=  $userrow->id;   ?>"><?=  $userrow->firstname ."- ".$userrow->surname ."(". $userrow->email.")"; ?></option>




	<?php

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

	</div>
  </div>
  

	
	
	
	
	

  	
<div class="form-group">
    <label for="inputsalaryyear" class="col-sm-2 control-label">	Year </label>
    <div class="col-sm-10">


		  		<input type="number" name="salaryyear" value="<?php echo set_value('salaryyear',$YEAR); ?>" class="form-control" required placeholder="Enter salary year">
		 

		<span class="text-danger"> <?php echo form_error('salaryyear'); ?>
		
		</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" required>
	
	<option value=""  >---Select Category---</option>
	<option value="P9"  selected="selected">P9</option>
	<option value="Statement"  >Statement</option>

</select>
		

	</div>
  </div>
  

  
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_invoice" class="btn btn-primary"> View Payroll  </button>

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

    

				</div>

		</div>
	    </div>
    </div>	
	
	
	
	<div id="payeModal" 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">Calculate paye</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');
					  $mydate=date("Y-m-d H:i:s");
					  $frommydate=date("Y-m-d 00:00:00");

         $YEAR = date('Y');
				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/calculatepayee' , 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="inputamount" class="col-sm-2 control-label">	Gross  </label>

    <div class="col-sm-10">


		  		<input type="text" name="amount" value="<?php echo set_value('amount'); ?>" class="form-control" required placeholder="Enter gross salary ">
		 

		<span class="text-danger"> <?php echo form_error('amount'); ?>
		
		</span>
	</div>
  </div>	
  
    	
<div class="form-group">
    <label for="inputamount" class="col-sm-2 control-label"> Other	deduction  </label>

    <div class="col-sm-10">


		  		<input type="text" name="deduction" value="0.00" class="form-control" required placeholder="Enter other amount ">
		 

		<span class="text-danger"> <?php echo form_error('deduction'); ?>
		
		</span>
	</div>
  </div>
	<div class="form-group">
    <label for="inputnssf" class="col-sm-2 control-label">	NSSF </label>
    <div class="col-sm-10">
	
     <select name='nssf' class="form-control" required>
    <option value=''>--Select NSSF Rates to use--</option>
	    <option  value='Old'>Old rates</option>

    <option  value='Tire1'>New Rates(TIER I)</option>
        <option  value='Tire1Tire2' selected >New Rates(TIER I and II)</option>

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

  
	 

	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="paye" name="btn_paye" class="btn btn-primary"> Calculate Paye  </button>

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

    

				</div>

		</div>
	    </div>
    </div>	
	
	
	
	
	
	
	<div id="payenowModal" 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">Process bulk paye</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');
					  $mydate=date("Y-m-d H:i:s");
					  $frommydate=date("Y-m-d 00:00:00");

         $YEAR = date('Y');
				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/bulkcalculatemypaye' , 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="inputsalaryyear" class="col-sm-2 control-label">	Year </label>
    <div class="col-sm-10">
		<input type="hidden" name="view" value="user/salaryhistory"id="view" class="form-control" required placeholder="Enter status">
		  		<input type="hidden" name="amount" value="<?php echo set_value('amount'); ?>" class="form-control" required placeholder="Enter gross salary ">
		<input type="hidden" name="view1" value="user/salaryhistory"id="view" class="form-control" required placeholder="Enter status">

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

		  		<input type="number" name="salaryyear" value="<?php echo set_value('salaryyear',$YEAR); ?>" class="form-control" required placeholder="Enter salary year">
		 

		<span class="text-danger"> <?php echo form_error('salaryyear'); ?>
		
		</span>
	</div>
  </div>	
	<div class="form-group">
    <label for="inputslarymonth" class="col-sm-2 control-label">	Month </label>
    <div class="col-sm-10">
	
     <select name='slarymonth' class="form-control" required>
    <option value=''>--Select Month for payment--</option>
    <option  value='Janaury'>Janaury</option>
    <option value='February'>February</option>
    <option value='March'>March</option>
    <option value='April'>April</option>
    <option value='May'>May</option>
    <option value='June'>June</option>
    <option value='July'>July</option>
    <option value='August'>August</option>
    <option value='September'>September</option>
    <option value='October'>October</option>
    <option value='November'>November</option>
    <option value='December'>December</option>
    </select> 		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>

  
  


	<div class="form-group">
    <label for="inputnssf" class="col-sm-2 control-label">	NSSF </label>
    <div class="col-sm-10">
	
     <select name='nssf' class="form-control" required>
    <option value=''>--Select NSSF Rates to use--</option>
	    <option  value='Old'>Old rates</option>

    <option  value='Tire1'>New Rates(TIER I)</option>
        <option  value='Tire1Tire2' selected >New Rates(TIER I and II)</option>

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

  
	 

	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="bulk" name="btn_mypaye" class="btn btn-primary"> Process Statutories in Bulk  </button>

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

    

				</div>

		</div>
	    </div>
    </div>	
	
					
					
		
	
	
	
	
	<div id="bulklabourModal" 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">Process monthly bulk labour</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');
					  $mydate=date("Y-m-d H:i:s");
					  $frommydate=date("Y-m-d 00:00:00");
         $postedtimes = date('Y-m-d');
 $month = date('M');
         $YEAR = date('Y');
				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/startbulklabour' , 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="inputsalarydate" class="col-sm-2 control-label">	Date </label>
    <div class="col-sm-10">

		  		<input type="text" name="salarydate" value="<?php echo $postedtimes; ?>" class="form-control" required placeholder="Enter salary year">
		 

		<span class="text-danger"> <?php echo form_error('salarydate'); ?>
		
		</span>
	</div>
  </div>	
	
	
		
<div class="form-group">
    <label for="inputsalaryyear" class="col-sm-2 control-label">	Year </label>
    <div class="col-sm-10">
		<input type="hidden" name="view" value="user/salaryhistory"id="view" class="form-control" required placeholder="Enter status">
		  		<input type="hidden" name="amount" value="<?php echo set_value('amount'); ?>" class="form-control" required placeholder="Enter gross salary ">
		<input type="hidden" name="view1" value="user/salaryhistory"id="view" class="form-control" required placeholder="Enter status">

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

		  		<input type="number" name="salaryyear" value="<?php echo set_value('salaryyear',$YEAR); ?>" class="form-control" required placeholder="Enter salary year">
		 

		<span class="text-danger"> <?php echo form_error('salaryyear'); ?>
		
		</span>
	</div>
  </div>	
	<div class="form-group">
    <label for="inputslarymonth" class="col-sm-2 control-label">	Month </label>
    <div class="col-sm-10">
	
     <select name='slarymonth' class="form-control" required>
    <option value=''>--Select Month for payment--</option>
    <option  value='Janaury'>Janaury</option>
    <option value='February'>February</option>
    <option value='March'>March</option>
    <option value='April'>April</option>
    <option value='May'>May</option>
    <option value='June'>June</option>
    <option value='July'>July</option>
    <option value='August'>August</option>
    <option value='September'>September</option>
    <option value='October'>October</option>
    <option value='November'>November</option>
    <option value='December'>December</option>
    </select> 		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>

  
  
   <div class="form-group">
    <label for="inputdcode" class="col-sm-2 control-label">Payment type?</label>
    <div class="col-sm-10">
	<select class="form-control" name="code" required>
	
	<option value=""  >---Select One Payment type---</option>


	
	<?php 

										$payrollsetup= $this->usermodel->populateall('salarycharges','category',"Pay");

	

	
if(is_array($payrollsetup)) {

   foreach($payrollsetup as $setup){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  number_format($setup->code);   ?>"><?=  $setup->name; ?></option>



	<?php

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

	</div>
  </div>
  
  

  
	 

	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="bulk" name="btn_bulklabour" class="btn btn-primary"> Process Statutories in Bulk  </button>

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

    

				</div>

		</div>
	    </div>
    </div>	
	
					
					
					
					
					
					
					
	
	
	
	
	
	
	
	
	
	
	
	<div id="accountsModal" 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">Statutory payments Report</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');
					  $mydate=date("Y-m-d H:i:s");
					  $frommydate=date("Y-m-d 00:00:00");

         $YEAR = date('Y');
				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewdeductions' , 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="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="inputdcode" class="col-sm-2 control-label">Accounts?</label>
    <div class="col-sm-10">
	<select class="form-control" name="code" required>
	
	<option value=""  >---Select Accounts---</option>
	<option value="all"  >-All pay/deductions-</option>
	<option value="Pay"  >-All Pays only-</option>
	<option value="Deduction"  >-All Deductions only-</option>

	
	<?php 

										$payrollsetup= $this->usermodel->populateall('salarycharges','companyid',$companyid);

	

	
if(is_array($payrollsetup)) {

   foreach($payrollsetup as $setup){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  number_format($setup->code);   ?>"><?=  $setup->name; ?></option>



	<?php

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

	</div>
  </div>
  
  
  
  
  
  
	
	
	
	

  	
<div class="form-group">
    <label for="inputsalaryyear" class="col-sm-2 control-label">	Year </label>
    <div class="col-sm-10">


		  		<input type="number" name="salaryyear" value="<?php echo set_value('salaryyear',$YEAR); ?>" class="form-control" required placeholder="Enter salary year">
		 

		<span class="text-danger"> <?php echo form_error('salaryyear'); ?>
		
		</span>
	</div>
  </div>	
  
  
	<div class="form-group">
    <label for="inputslarymonth" class="col-sm-2 control-label">	Month </label>
    <div class="col-sm-10">
	
     <select name='slarymonth' class="form-control" required>
    <option value=''>--Select Month for payment--</option>
	    <option  value='all'>The whole year</option>

    <option  value='Janaury'>Janaury</option>
    <option value='February'>February</option>
    <option value='March'>March</option>
    <option value='April'>April</option>
    <option value='May'>May</option>
    <option value='June'>June</option>
    <option value='July'>July</option>
    <option value='August'>August</option>
    <option value='September'>September</option>
    <option value='October'>October</option>
    <option value='November'>November</option>
    <option value='December'>December</option>
    </select> 		 
				
		<span class="text-danger"> <?php echo form_error('slarymonth'); ?>
		
		</span>
	</div>
  </div>


	
  <div class="form-group">
    <label for="inputdownload" class="col-sm-2 control-label">	Download? </label>
    <div class="col-sm-10">
	
     <select name='download' class="form-control" required>
    <option value=''>--Do you want to download--</option>
	    <option  value='yes'>Yes (Download)</option>

    <option  value='no' selected="selected">No(View Only)</option>

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

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

		<option value="all" selected="" >---All--</option>

<option value="">---Select Bank----</option>

	<?php 			
$mybankcodes= $this->usermodel->populatealldatanoarray('glaccounts','companyid',$companyid,'accounttype','1');


if(is_array($mybankcodes)) {

   foreach($mybankcodes as $mybankcodesrow){
$mybak="";
  // echo $leavegrouprow->name;
   
    ?>
					<option value="<?=  $mybankcodesrow->number;   ?>"><?=  $mybankcodesrow->accountname ."(Acc No:". $mybankcodesrow->number .")"; ?></option>



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

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="deductions" name="btn_viewdeductions" class="btn btn-primary"> View   </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="salary">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/salaryhistory">
 <input type="text" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
  <input type="hidden" id="salaryid"name="salaryid" class="salaryid" placeholder="salaryid" 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="deleteroleModal" 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">Clear all Roles</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to remove all roles from the system? </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" value="permissions">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewemployee">
 <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/Clear Role  </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  User/ Contact</h4>
      </div>
  
    <div class="modal-body">
      
	  	

		
		
	<?PHP
	



 echo $this->session->flashdata('msg'); 
                  echo form_open('user/addmyuser' , array('class' => 'form-horizontal form-groups-bordered validate',  'id' => 'signup','enctype' => 'multipart/form-data'));

		 if(validation_errors()):?>

<?php endif;?>

<input type="hidden" name="myid" value="0"  id="myid" class="form-control" required placeholder="Enter status">



  <div class="form-group">

    <label for="inputsurname" class="col-sm-2 control-label">Last Name</label>
    <div class="col-sm-10">
		  		<input type="text" name="surname" value="<?php echo set_value('surname'); ?>"id="surname" class="form-control" required placeholder="Enter your surname">
     <span class="text-danger"><?php echo form_error('surname'); ?></span>
   </div>
  </div>
    <div class="form-group">
    <label for="inputfirstname" class="col-sm-2 control-label">First Name</label>
    <div class="col-sm-10">
		<input type="text" name="firstname" value="<?php echo set_value('firstname') ;?>" id="firstname" class="form-control" required placeholder="Enter your Other Names">
       <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 Number</label>
    <div class="col-sm-10">
		<input type="text" name="phone" value="<?php echo set_value('phone') ;?>" id="firstname" class="form-control" required placeholder="Enter your phone Number e.g 25716567890">
       <span class="text-danger"><?php echo form_error('phone'); ?></span>
   </div>
  </div>
  
  
  
     
   	<div class="form-group">
    <label for="inputgender" 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">
    <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 Campany Pin">
		 
				
		<span class="text-danger"> <?php echo form_error('idno'); ?>
		
		</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="1"  >active</option>
		<option value="0"  >inactive</option>
	</select>		 
				
		<span class="text-danger"> <?php echo form_error('gender'); ?>
		
		</span>
	</div>
  </div>
  
  
    <div class="form-group">
    <label for="inputemail" class="col-sm-2 control-label">Email</label>
    <div class="col-sm-10">
				<input type="text"  name="email" value="<?php echo set_value('email') ;?>" id="email" class="form-control" required placeholder="Enter Your email">
    <span class="text-danger"><?php echo form_error('email'); ?></span>
	</div>
  </div>


  
 
   <div class="form-group">
    <label for="inputpassword" class="col-sm-2 control-label"> Password </label>
    <div class="col-sm-10">
				<input type="password" name="password" value="<?php echo set_value('password'); ?>"id="password" class="form-control"  placeholder="Create your own password">
    <span class="text-danger"><?php echo form_error('password'); ?></span>
   </div>
  </div>
  
    <div class="form-group">
    <label for="inputcpassword" class="col-sm-2 control-label"> Confirm Password </label>
    <div class="col-sm-10">
				<input type="password" name="cpassword" value="<?php echo set_value('cpassword'); ?>"id="cpassword" class="form-control"  placeholder=" Confirm the same password">
    <span class="text-danger"><?php echo form_error('cpassword'); ?></span>
   </div>
  </div>
  
  
   
  
  
	 <div class="form-group">

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

    </div>
  </div>
   

 

			<?PHP
		echo form_close();
		
		?>
		
		
			
		
		
		
		
		
		
		
		
		
		
		
			</div>	
    </div>						
							
									
									
									
							</div>
						</div>
				

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

 
</div>


















