<?php 
include("dbConfig.php");
$ar = array();
$add = array();
$date_from = '2023-06-01';
$date_to = '2023-06-12';
function getBetweenDates($startDate, $endDate) {
    $rangArray = [];
 
    $startDate = strtotime($startDate);
    $endDate = strtotime($endDate);
 
    for ($currentDate = $startDate; $currentDate <= $endDate; $currentDate += (86400)) {
        $date = date('Y-m-d', $currentDate);
        $rangArray[] = $date;
    }
 
    return $rangArray;
}
$dates = getBetweenDates('2023-06-01', '2023-06-12');
//print_r($dates);

$sql_cw="SELECT * FROM waseet_company_user_tbl where system_id='2222' and company_id='119369' AND company_id!='' AND deleted='0'  group by company_id ORDER BY `waseet_company_user_tbl`.`crateddate_time` DESC";
$result_cw = $conn->query($sql_cw);
                   if ($result_cw->num_rows > 0) {
                    while($row_cw = $result_cw->fetch_assoc()) {
//echo $row_cw['company_id']."</br>";
                        $sql_ws="SELECT * FROM hr_waseet_employ_shift_tbl where company_id='".$row_cw['company_id']."' AND deleted='0' and waseet_stat='0'";
                          $result_ws = $conn->query($sql_ws);
                           if ($result_ws->num_rows > 0) {
                            while($row_ws = $result_ws->fetch_assoc()) { 

$sql_emp="SELECT * FROM hr_employ_tbl where employ_id='".$row_ws["employ_id"]."' and employ_stat='active_employ' and stop='0' AND deleted='0' ORDER BY `hr_employ_tbl`.`employ_name_ar` DESC ";
                          $result_emp = $conn->query($sql_emp);
                           if ($result_emp->num_rows > 0) {
                            while($row_emp = $result_emp->fetch_assoc()) { 
                               
                          $employee_number_fingerprint = $row_emp['employee_number_fingerprint'];
                          $employ_name_en = $row_emp['employ_name_en'];
                          echo $employee_number_fingerprint."(".$employ_name_en.")".":".$row_emp["employ_id"]."</br>";
                          array_push($ar,$employee_number_fingerprint);
                          foreach ($dates as $val) {
                          $sql_add="SELECT * FROM hr_add_hodor_ensraf_tbl where hodor_ensraf_date='$val' and employee_number_fingerprint='$employee_number_fingerprint'";
                          $result_add = $conn->query($sql_add);
                          if ($result_add->num_rows > 0) {
                          while($row_add = $result_add->fetch_assoc()) { 
                           // echo $row_add["hodor_ensraf_date"]." : "."att"."</br>";
                          }}else{
                            echo $val." : "."abs"."</br>";
                          }
                        }
                        }}
                         
							}}
                        
                  
                    }}
                    
                   // $ids_ci = join("','",$add); 
                    //echo $ids_ci;
                    /*foreach ($ar as $value) {

                        echo "(".$value.")"."<br>";

                        foreach ($dates as $val) {
                            $sql_add="SELECT * FROM hr_add_hodor_ensraf_tbl where hodor_ensraf_date='$val' and employee_number_fingerprint='$value'";
                        $result_add = $conn->query($sql_add);
                        if ($result_add->num_rows > 0) {
                        while($row_add = $result_add->fetch_assoc()) { 
                          
                            echo $row_add["hodor_ensraf_date"]." : "."att"."</br>";
                       
                               
                            }
                               
                        }else{
                            echo $val." : "."abs"."</br>";
                        }
                    }
                    }*/
                    
                   
?>