43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
|
|
$training = $_REQUEST['training_id'];
|
|
|
|
$training=explode("-", $training);
|
|
$assign_id=$training[0];
|
|
$schedule_id=$training[1];
|
|
|
|
// error_log("date after filter ." . $default_start_date . " " . $default_end_date);
|
|
|
|
$total_injury_class_name = array();
|
|
$total_injury_class = array();
|
|
|
|
|
|
$total_date=$_POST['allDates'];
|
|
error_log("total period ".print_r($total_date,true));
|
|
$status_data = array();
|
|
$date_count = array();
|
|
for ($i = 0; $i < sizeof($total_date); $i++) {
|
|
$query = "select count(emp_id) as count from training_status where date(training_date) = '" . $total_date[$i] . "' and ohc_type_id='".$_SESSION['current_ohcttype']."' and assign_training_id='".$assign_id."' ";
|
|
error_log(" injury query " . $query);
|
|
|
|
if (!$result = @mysqli_query($conn, $query)) {
|
|
error_log("error in injury chart" . mysqli_error($conn));
|
|
exit();
|
|
}
|
|
if (mysqli_num_rows($result) > 0) {
|
|
while ($row = @mysqli_fetch_array($result)) {
|
|
array_push($status_data,date('d-m-Y',strtotime($total_date[$i])));
|
|
array_push($date_count, $row["count"]);
|
|
}
|
|
} else {
|
|
array_push($injury_data, 0);
|
|
}
|
|
}
|
|
|
|
$data = array(
|
|
'date' => ($status_data),
|
|
'count' => ($date_count),
|
|
);
|
|
error_log("wellnes data " . print_r($data, true));
|
|
echo json_encode($data); |