<?php
header('Content-Type: application/json');
  $employ_id = $_GET['employ_id'];
  $date_from = $_GET['date_from'];
  $date_to = $_GET['date_to'];
  include("dbConfig.php");
  // get shift
  $sql_employ="SELECT * FROM hr_employ_tbl where employ_id='$employ_id'";
      $result_employ = $conn->query($sql_employ);

      if ($result_employ->num_rows > 0) {
        $row_employ = $result_employ->fetch_assoc();
        $employee_number_fingerprint = $row_employ["employee_number_fingerprint"];
        }
       
  //
      $sql_hoder_inseraf="SELECT * FROM hr_add_hodor_ensraf_tbl where add_from='app' and employee_number_fingerprint='$employee_number_fingerprint' and (hodor_ensraf_date between '$date_from' and '$date_to') order by hodor_ensraf_date desc";
      $result_hoder_inseraf = $conn->query($sql_hoder_inseraf);

      if ($result_hoder_inseraf->num_rows > 0) {
        while ($row_hoder_inseraf = $result_hoder_inseraf->fetch_assoc()) {
         $a[] = array(
            'success' => true,
            'hodor_time' => $row_hoder_inseraf["hodor_time"],
            'ensraf_time' => $row_hoder_inseraf["ensraf_time"],
            'hodor_ensraf_date' => $row_hoder_inseraf["hodor_ensraf_date"],
        );
        }
        $response = [
            'success' => true,
            'data' => $a,
        ];
      } else {
        $a = array();
    $response = [
        'success' => true,
        'msg' => "not found",
        'data' => $a,
    ];
      }

  echo json_encode($response);

?>