File manager - Edit - /home/autoph/public_html/api/aha/SA_checkReminder.php
Back
<?php include '../../../cfg/ahaconn.php'; $mykey = $_GET['keyID']; if($mykey == "TOKEN6e59e008b5348b452X615a3033729daae383Reminder"){ $employeeID = $_GET['employeeID']; //get HR user Record ID //include '../../../cfg/connhr.php'; //$getUserID = "SELECT * FROM `users` WHERE `asa_app_user_id`='$userID'"; //$quser = mysqli_query($connhr,$getUserID); //while($usr = mysqli_fetch_array($quser)){ // $saID = $usr['id']; // } // SQL query $sql = "SELECT t1.*, t1.id as ServiceID, t2.*,t3.aha_user_id,t3.lastname, t3.firstname FROM service_bookings t1 LEFT JOIN aha_crm_configuration t2 ON t1.service_type_id = t2.service_type_id LEFT JOIN customers t3 ON t1.customer_id = t3.id WHERE service_status_id > 2 AND service_status_id < 15 AND assigned_service_advisor = '$employeeID' GROUP BY t1.car_plate"; $result = $conn->query($sql); $count = $result->num_rows; if($count > 0) { // Array to hold the results $count = 0; $rows = array(); while($row = $result->fetch_assoc()) { if($row['setup_name'] == "QS"){ $count = $count + 1; $updatedAt=$row['updated_at']; $setupValue=$row['setup_value']; $date1 = new DateTime(); $date2 = new DateTime($updatedAt); // Calculate the difference $interval = $date1->diff($date2); // Output the difference in days, hours, minutes, and seconds $daysD= $interval->days; $hrsD= $interval->h; $minD= $interval->i; $secD= $interval->s; // Output: "Difference: 11 days, 4 hours, 15 minutes, 30 seconds." if($hrsD > 1){ $isMany="s"; }else{ $isMany=""; } if($hrsD >= $setupValue){ $alertVisible = "visible"; $diffDateTime =$hrsD . " hr".$isMany; }else{ $alertVisible = ""; $diffDateTime =$daysD . " hr".$isMany; } $rows[] = [$row,"days"=>"$daysD","hours" => "$hrsD","mins"=>"$daysD","alertVisible"=>"$alertVisible", "diffDateTime" => "$diffDateTime"]; }else{ $count = $count + 1; $updatedAt=$row['updated_at']; $setupValue=$row['setup_value']; $date1 = new DateTime(); $date2 = new DateTime($updatedAt); // Calculate the difference $interval = $date1->diff($date2); // Output the difference in days, hours, minutes, and seconds $daysD= $interval->days; $hrsD= $interval->h; $minD= $interval->i; $secD= $interval->s; // Output: "Difference: 11 days, 4 hours, 15 minutes, 30 seconds." if($daysD > 1){ $isMany="s"; }else{ $isMany=""; } if($daysD >= $setupValue){ $alertVisible = "visible"; $diffDateTime =$daysD . " day".$isMany; }else{ $alertVisible = ""; $diffDateTime =$daysD . " day".$isMany; } $rows[] = [$row,"days"=>"$daysD","hours" => "$hrsD","mins"=>"$daysD","alertVisible"=>"$alertVisible", "diffDateTime" => "$diffDateTime"]; } } if($count > 0){ $isVisible = "Visible"; }else{ $isVisible = ""; } // Output the result in JSON format header('Content-Type: application/json'); } } echo json_encode([$rows,"Count" => "$count","isVisible" => "$isVisible"]); // Close connection $conn->close(); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings