ok

Mini Shell

Direktori : /home2/selectio/public_html/obnovit-tracking/api/
Upload File :
Current File : /home2/selectio/public_html/obnovit-tracking/api/get-payslip-creation.php

<?php include"../config/config.php";

if($_POST['type']=="get_payslip"){
     $filter_department = $_POST['filter_department'];
     $filter_designation = $_POST['filter_designation'];
     $filter_employee = $_POST['filter_employee'];
    //  $filter_year = $_POST['filter_year'];
    //  $filter_month = $_POST['filter_month'];
     
     $where="";
     
     if(isset($_POST['filter_employee']) && $_POST['filter_employee']!='all'){
       $where.=" and id=".$_POST['filter_employee'];
    }
    if(isset($_POST['filter_designation']) && $_POST['filter_designation']!='all'){
       $where.=" and designation_id=".$_POST['filter_designation'];
    }
    if(isset($_POST['filter_department']) && $_POST['filter_department']!='all'){
       $where.=" and department_id=".$_POST['filter_department'];
    }
    
   $statement = $pdo->prepare("SELECT * FROM `tbl_user` WHERE id!=1 ".$where."");
		$statement->execute();
		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
		$totalrow = $statement->rowCount();
	$n=0;
		foreach($result as $row){
		    $statement = $pdo->prepare("SELECT * FROM `tbl_user` WHERE id=".$row['id']."");
    		$statement->execute();
    		$payslip_result = $statement->fetchAll(PDO::FETCH_ASSOC);
    		if($payslip_result){
    		    foreach($payslip_result as $rows){
    		    $result[$n]['pay_emp_name']=$rows['emp_name'];
    		    $result[$n]['pay_designation_id']=$rows['designation_id'];
    		    $result[$n]['pay_department_id']=$rows['department_id'];
    		    $result[$n]['pay_pftype']=$rows['pftype'];
    		    
    		}
    		}
    	$n++;	
		}
		
				
		if($result){
		    $response['data']=$result;
		    $response['error']=false;
		    $response['message']="Pay Slip details fetched Successfuly";
		}else{
		    $response['error']=true;
		    $response['message']='failed';
		}
		
		echo json_encode($response);
 
}

?>

Zerion Mini Shell 1.0