ok
Direktori : /home2/selectio/public_html/subamangala/admin/api/waste-files/ |
Current File : /home2/selectio/public_html/subamangala/admin/api/waste-files/daily-attendance-api.php |
<?php include"../config/config.php"; if($_POST['type']=="daily_attendance"){ $emp_id = $_POST['emp_id']; $department_id = $_POST['department_id']; $date = $_POST['date']; $where=""; if(isset($_POST['emp_id']) && $_POST['emp_id']!='all'){ $where.=" and id=".$_POST['emp_id']; } if(isset($_POST['department_id']) && $_POST['department_id']!='all'){ $where.=" and department_id=".$_POST['department_id']; } $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_attendance` WHERE empid=".$row['id']." and att_date='".$date."'"); $statement->execute(); $att_result = $statement->fetchAll(PDO::FETCH_ASSOC); if($att_result){ foreach($att_result as $rows){ $result[$n]['att_id']=$rows['id']; $result[$n]['att_date']=$rows['att_date']; $result[$n]['att_check_in']=$rows['check_in']; $result[$n]['att_check_out']=$rows['check_out']; $result[$n]['att_type']=$rows['type']; } }else{ $result[$n]['att_id']=""; $result[$n]['att_date']=""; $result[$n]['att_check_in']=""; $result[$n]['att_check_out']=""; $result[$n]['att_type']=""; } $n++; } if($result){ $response['data']=$result; $response['error']=false; $response['message']="Attendance details fetched Successfuly"; }else{ $response['error']=true; $response['message']='failed'; } echo json_encode($response); } ?>