<?php include("../secure.php"); ?>
<!DOCTYPE html>
<html lang="en" data-layout="vertical" data-topbar="light" data-sidebar="dark" data-sidebar-size="lg" data-sidebar-image="none">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
        <meta name="description" content="Smarthr - Bootstrap Admin Template">
		<meta name="keywords" content="admin, estimates, bootstrap, business, corporate, creative, management, minimal, modern, accounts, invoice, html5, responsive, CRM, Projects">
        <meta name="author" content="Dreamguys - Bootstrap Admin Template">
        <meta name="robots" content="noindex, nofollow">
        <title>Attendance and departure report - HR Marsa System </title>
                <style>
@font-face {
    font-family: 'DroidSansArabic';
    src: url('../../font/DroidSansArabic.ttf');
}
body * {
    font-family: "DroidSansArabic", sans-serif ;
}
    </style>
		<?php 
	$lang=$_GET['lang'];  
    $link_lang='lang='.$lang;
    $company_id=$_GET['company_id']; 
    $main_system_id='2222';
	?> 
	
	 <?php include("../languege_filee_hr.php");?>
	 
	 <?php include("../hr_permission.php");?>
	
		<!-- Favicon -->
        <link rel="shortcut icon" type="image/x-icon" href="../../assets/img/favicon.png">
        
        <link rel="stylesheet" href="../../assets/plugins/alertify/alertify.min.css">
        
		<?php
	if($lang=='ar'){
	?>


         <link rel="stylesheet" href="../../assets/css/bootstrap.rtl.min.css">
   
		<!-- Fontawesome CSS -->
        <link rel="stylesheet" href="../../assets/plugins/fontawesome/css/fontawesome.min.css">
    	<link rel="stylesheet" href="../../assets/plugins/fontawesome/css/all.min.css">

		<!-- Lineawesome CSS -->
        <link rel="stylesheet" href="../../assets/css/line-awesome.min.css">
		<link rel="stylesheet" href="../../assets/css/material.css">
		
		<!-- Fontawesome CSS -->
        <link rel="stylesheet" href="../../assets/css/font-awesome.min.css">
		
		<!-- Datatable CSS -->
		<link rel="stylesheet" href="../../assets/css/dataTables.bootstrap4.min.css">
		
		 <!-- Select2 CSS -->
         <link rel="stylesheet" href="../../assets/css/select2.min.css">
         
         <!-- Datetimepicker CSS -->
         <link rel="stylesheet" href="../../assets/css/bootstrap-datetimepicker.min.css">
		
		
		<!-- Main CSS -->
        <link rel="stylesheet" href="../../assets/css/style.css">
             
             
             
             
        <?php }else{ ?>
            <link rel="stylesheet" href="../../assets_en/css/bootstrap.min.css">
   
		<!-- Fontawesome CSS -->
        <link rel="stylesheet" href="../../assets_en/plugins/fontawesome/css/fontawesome.min.css">
    	<link rel="stylesheet" href="../../assets_en/plugins/fontawesome/css/all.min.css">

		<!-- Lineawesome CSS -->
        <link rel="stylesheet" href="../../assets_en/css/line-awesome.min.css">
		<link rel="stylesheet" href="../../assets_en/css/material.css">
		
		<!-- Fontawesome CSS -->
        <link rel="stylesheet" href="../../assets_en/css/font-awesome.min.css">
		
		<!-- Datatable CSS -->
		<link rel="stylesheet" href="../../assets_en/css/dataTables.bootstrap4.min.css">
		
		<!-- Main CSS -->
        <link rel="stylesheet" href="../../assets_en/css/style.css">
        

            <?php } ?>
		
		 
    </head>
    <body>
		<!-- Main Wrapper -->
        <div class="main-wrapper">
		
			<!-- Toper -->
            <?php include("../toper.php"); ?>
			<!-- /Toper -->
			
			<!-- header -->
            <?php include("../header.php");?>
			
			<!-- /header -->
			
			
				<!-- permission View -->
	<?php //if(($urow['user_type']=='Top_Manager' or $urow['user_type']=='System_Manager')or($hr_add_dept==1)){ ?>			
					<!-- /permission View -->
		
		
			
			<!-- Page Wrapper -->
            <div class="page-wrapper">
			
				<!-- Page Content -->
                <div class="content container-fluid">
				
					<!-- Page Header -->
					<div class="page-header">
					    
						<div class="row align-items-center">
							<div class="col">
								<h3 class="page-title"><?php echo $Attendance_and_departure_report; ?> </h3>
								<ul class="breadcrumb">
									<li class="breadcrumb-item"><a href="../main/index.php?<?php echo $link_lang; ?>&company_id=<?php echo $company_id; ?>"><?php echo $Dashboard; ?></a></li>
									<li class="breadcrumb-item active"><?php echo $view.$space.$Attendance_and_departure_report; ?> </li>
								</ul>
							</div>
						
							
							<div class="col-auto float-end ms-auto">
							</div>	
							
							
						</div>
					</div>
					<!-- /Page Header -->
					
			
					
					
					
		<?php 
			if(($urow['user_type']=='Top_Manager' or $urow['user_type']=='System_Manager')or($recording_employee_absences_per==1)){
		     echo'Yes Permation';
			}else{
          // echo 'No Permation'; 
             //header("Refresh:0; url=../main/error_permation.php?$link_lang&company_id=$company_id"); 
			}
			?>
			
			<?php
         if(($urow['user_type']=='Top_Manager' or $urow['user_type']=='System_Manager')or($recording_employee_absences_per==1)){
         }else{
       ?>
             <script>window.location="https://www.marsalogistics.com/new/hr_marsa_system/ar/main/error_permation.php?<?php echo $link_lang; ?>&company_id=<?php echo $company_id;?>"</script>;
          </script>
        <?php } ?> 
			
			
			
					
					<div class="row">
					    
		<div class="alert1" id="messages" style="font-family:'Tajawal',sans-serif;">
		    
         	   <?php if(isset($_SESSION['message'])): ?>
            <div class="alert3 alert3-success">
            <?php echo $_SESSION['message']; ?>
            <script>
    setTimeout(function() {
        let alert = document.querySelector(".alert3");
            alert.remove();
    }, 3000);
    </script>
           </div>
            <?php endif; ?>
           <?php unset($_SESSION['message']); ?></div>
			
			
			<?php
			   $modal_table_name='hr_waseet_employ_shift_tbl';
              
                $id_name='waseet_id';
                  $proccess_details_delete='حذف شفت الموظف رقم  '.$modal_id;
                   $proccess_details_en_delete='Delete Shift Employee Number'.$modal_id;
                  $proccess_details_delete_disable='الغاء تنشيط فت الموظف رقم '.$modal_id;
                $proccess_details_en_delete_disable='Disable Shift Employee Number'.$modal_id;
               
                $proccess_details_enable=' تنشيط شفت الموظف رقم '.$modal_id;
                 $proccess_details_en_enable='Enable Shift Employee Number'.$modal_id;        
			
			?>		    
			<input type="hidden" name="modal_table_name" id="modal_table_name" readonly value="<?php echo $modal_table_name; ?>"> 
            <input type="hidden" name="id_name" id="id_name" readonly value="<?php echo $id_name; ?>"> 
           <input type="hidden" name="proccess_details_delete" id="proccess_details_delete" readonly value="<?php echo $proccess_details_delete; ?>"> 
           <input type="hidden" name="proccess_details_en_delete" id="proccess_details_en_delete" readonly value="<?php echo $proccess_details_en_delete; ?>">
           
           
              <input type="hidden" name="$proccess_details_delete_disable" id="proccess_details_delete_disable" readonly value="<?php echo $proccess_details_delete_disable; ?>"> 
           <input type="hidden" name="proccess_details_en_delete_disable" id="proccess_details_en_delete_disable" readonly value="<?php echo $proccess_details_en_delete_disable; ?>">
           
           
           <input type="hidden" name="proccess_details_enable" id="proccess_details_enable" readonly value="<?php echo $proccess_details_enable; ?>"> 
           <input type="hidden" name="proccess_details_en_enable" id="proccess_details_en_enable" readonly value="<?php echo $proccess_details_en_enable; ?>">
           

           
            <?php  $info_type=$_GET['info_type'];  
                //echo $info_type;
                if($info_type=='takeed' or($info_type=='')){$classb='nav-link b active';}else{$classb='nav-link b ';}
                if($info_type=='pr'){$classc='nav-link b active';}else{$classc='nav-link b ';}
                if($info_type=='gh'){$classd='nav-link b active';}else{$classd='nav-link b ';}
                
                ?>
           		
				<div class="card">
				<div class="card-body">
				<ul class="nav nav-tabs nav-tabs-solid nav-justified">
				<li class="nav-item"><a class="<?php echo $classc; ?>"href="hr_recording_employee_absences.php?<?php echo $link_lang; ?>&company_id=<?php echo $company_id; ?>&info_type=<?php echo 'pr'; ?>" id="inactive_employ"><?php echo $Attendance_and_departure_report; ?> / <?php echo $Detailed; ?> </a></li>
				<li class="nav-item"><a class="<?php echo $classd; ?>"href="hr_recording_employee_absences_view.php?<?php echo $link_lang; ?>&company_id=<?php echo $company_id; ?>&info_type=<?php echo 'gh'; ?>" id="inactive_employ">  <?php echo $Attendance_and_departure_report; ?> / <?php echo $Summary; ?> </a></li>
				</ul> 
						</div>
					</div> 
           
           
           
           		 <form  action="" method="post" >
           		     
           		   <?php 
           		   if(ISSET($_POST['sav_btn'])){
           		    $date_from=$_POST['date_from']; // echo $date_from; 
	                $date_to=$_POST['date_to'];     //echo $date_to;
           		   }else{
           		    $date_from=0; 
           		    $date_to=0;
           		   }
           		   ?>  
           		     
				<div class="row filter-row">
						<div class="col-lg-4 col-sm-6 col-12" clas="col-sm-6 col-md-3"> 
					<div class="form-group form-focus select-focus focused">
						<input type="date" value="<?php echo $date_from; ?>" name="date_from" id="date_from" required="" class="form-control" style="font-size:14px; font-weight:bold;">
					<label class="focus-label"><?php echo $select.$space.$the_date; ?></label>
				   	</div>
				</div>
						
						<div class="col-lg-4 col-sm-6 col-12" clas="col-sm-6 col-md-3"> 
						<div class="form-group form-focus select-focus focused">
						<label class="focus-label"><?php echo $date_too; ?></label>
							<input type="date" value="<?php echo $date_to; ?>" name="date_to" id="date_to" required="" class="form-control" style="font-size:14px; font-weight:bold;" >
							</div>
						</div>
						
						
						
						
						
						
	<?php 
	$ar = array();
    $add = array();
     $holiday_dates = array();
	
	 
	 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($date_from, $date_to);

//print_r($dates);
	 
	if(ISSET($_POST['sav_btn'])){
	    
     date_default_timezone_set("Asia/Riyadh");
     $dd1=strtotime($date_from);
     $dd2=strtotime($date_to);
   $datediff = $dd2 - $dd1;
   $add_ayam=round($datediff / (60 * 60 * 24)+1);
   //echo $add_ayam ;
   


$from_date = new DateTime($date_from);
$to_date = new DateTime($date_to);
$i = 0;
for ($date = $from_date; $date <= $to_date; $date->modify('+1 day')) {
    $d = $date->format('l');
  if($d=="Friday"){
      $i++;
  }
}

 
 // صافي عدد الأيام
 
   $safy_ayam=$add_ayam-$i; 
     
	}     
     
	?>					
						
						<div class="col-lg-4 col-sm-6 col-12" clas="col-sm-6 col-md-3">  
							<div class="d-grid">
								<input type="submit" name="sav_btn" id="sav_btn" class="btn btn-success" value="<?php echo $search; ?>"> 
							</div></form>
						</div>     
                    </div>
                    
                    
          <!-- =============================rrrr4=========================================== -->          
      		 
					<!-- =====================$requests_permission_s=====$issues========================================================================= -->
					
					<div class="row">	
					
						<div class="col-md-4 d-flex" clas="col-md-12 col-lg-6 col-xl-4 d-flex">
							<div class="card flex-fill">
								<div class="card-body">
	    
						
		<?php 
   $count_pending=0;						   
    $count_done=0;
    $approval_req_per=0;
    $reject_req_per=0;
    
    
      if(($urow['user_type']=='Top_Manager' or $urow['user_type']=='System_Manager')or($view_hr_issues_list==1)){ 
    if($company_id=='all_company'){ 
    
     $sql_c4="SELECT * FROM hr_request_permission_tbl where request_per_date between'$date_from' AND'$date_to' AND company_id IN ('$ids') AND  company_id!=''  AND deleted='0' ORDER BY `hr_request_permission_tbl`.`createdDate_Timee` DESC ";
    }else{
  $sql_c4="SELECT * FROM hr_request_permission_tbl where request_per_date between'$date_from' AND'$date_to' AND company_id='$company_id' AND company_id!='' AND deleted='0' ORDER BY `hr_request_permission_tbl`.`createdDate_Timee` DESC ";
    }
      }else{
      $sql_c4="SELECT * FROM hr_request_permission_tbl where request_per_date between'$date_from' AND'$date_to' AND employ_id='". $_SESSION['user_id']."' AND company_id!='' AND deleted='0' ORDER BY `hr_request_permission_tbl`.`createdDate_Timee` DESC ";
      }
   
    $result_c4 = $conn->query($sql_c4);
    if ($result_c4->num_rows > 0) {
     while($row_c4 = $result_c4->fetch_assoc()) {
         
     if($row_c4['request_per_stat']=='0'){$count_pending++;
   
     }elseif($row_c4['request_per_stat']=='approval_req_per'){
         $approval_req_per++;
     }elseif($row_c4['request_per_stat']=='reject_req_per'){
         $reject_req_per++;
      }else{}
     }}  
     
      $count_done=$approval_req_per+$reject_req_per;
      
      $request_per_all=$count_done+$count_pending;
     ?> 		    
	
		<h4 class="card-title"><i class="fa fa-folder-open" aria-hidden="true"></i>  <?php echo $requests_permission_s; ?><span class="badge bg-inverse-warning ms-2"><?php echo $request_per_all; ?></span></h4>
	
	
									<div class="statistics">
									      <?php include("../modals/hr_add_business_trip_modal.php");?>
										<div class="row">
										   

											<div class="col-md-6 col-6 text-center">
												<div class="stats-box mb-4">
											<p><?php echo $pending; ?></p>
		
													<h3><?php echo $count_pending; ?></h3>
												</div>
											</div>
											<div class="col-md-6 col-6 text-center">
												<div class="stats-box mb-4">
													<p><?php echo $Processing_Done; ?></p>
													<h3><?php echo $count_done; ?></h3>
												</div>
											</div>
											
										
									</div>
									<div class="progress mb-4">
									    <?php
									   if($request_per_all>0){ 
									    $p1=round($approval_req_per/$request_per_all*100,2);  
									    $p2=round($count_pending/$request_per_all*100,2);  
									    $p3=round($reject_req_per/$request_per_all*100,2);
									   }
									    ?>
									   
										<div class="progress-bar bg-success" role="progressbar" style="width:<?php echo $p1; ?>%" aria-valuenow="<?php echo $p1; ?>" aria-valuemin="0" aria-valuemax="100"><?php echo $p1; ?>%</div>
										<div class="progress-bar bg-warning" role="progressbar" style="width:<?php echo $p2; ?>%" aria-valuenow="<?php echo $p2; ?>" aria-valuemin="0" aria-valuemax="100"><?php echo $p2; ?>%</div>
										<div class="progress-bar bg-danger" role="progressbar" style="width:<?php echo $p3; ?>%" aria-valuenow="<?php echo $p3; ?>" aria-valuemin="0" aria-valuemax="100"><?php echo $p3; ?>%</div>
									</div>
									<div>
								   <p><i class="fa fa-dot-circle-o text-success me-2"></i><?php echo $Has_been_approved; ?>  <span class="float-end"><?php echo $approval_req_per; ?></span></p>
								   <p><i class="fa fa-dot-circle-o text-warning me-2"></i><?php echo $Under_the_procedure; ?> <span class="float-end"><?php echo $count_pending; ?></span></p>
								   <p><i class="fa fa-dot-circle-o text-danger me-2"></i><?php echo $access_denied; ?>  <span class="float-end"><?php echo $reject_req_per; ?></span></p>
								  
									</div>
							<!--/div>
							
							</div-->
							
							
							<!--div class="tab-pane" id="pending_tasks">mmmmmmmmmmmmmmm999</div-->
							
							</div>
							
								<!--div class="load-more text-center">
							   <a href="#" class="btn btn-sm btn-warning download-offer" data-bs-toggle="modal" data-bs-target="#add_department"><span><i class="fa fa-plus"></i><?php echo $request_permission; ?></span></a>
									</div-->
							
								</div>
							</div>
						</div>
						
						
						
				<div class="col-md-4 d-flex" clas="col-md-12 col-lg-6 col-xl-4 d-flex">
							<div class="card flex-fill">
								<div class="card-body">
						
		<?php 
    $count_pending_q=0;						   
    $count_done_q=0;
    $approval_req_per_q=0;
    $reject_req_per_q=0;
   
    if(($urow['user_type']=='Top_Manager' or $urow['user_type']=='System_Manager')or($view_hr_issues_list==1)){ 
    if($company_id=='all_company'){ 
     $sql_c5="SELECT * FROM hr_question_tbl where hr_question_date between'$date_from' AND'$date_to' AND company_id IN ('$ids') AND  company_id!='' AND deleted='0'";
    }else{
   $sql_c5="SELECT * FROM hr_question_tbl where hr_question_date between'$date_from' AND'$date_to' AND company_id='$company_id' AND company_id!='' AND deleted='0'";
    }
    }else{
     $sql_c5="SELECT * FROM hr_question_tbl where hr_question_date between'$date_from' AND'$date_to' AND employ_id='". $_SESSION['user_id']."' AND  company_id='$company_id' AND company_id!='' AND deleted='0'";   
        
    }

    $result_c5 = $conn->query($sql_c5);
    if ($result_c5->num_rows > 0) {
     while($row_c5 = $result_c5->fetch_assoc()) {
         
     if($row_c5['hr_question_stat']=='waiting_employee_response' or $row_c5['hr_question_stat']=='Answered_by_the_employee'){$count_pending_q++;
   
     }elseif($row_c5['hr_question_stat']=='Absence_was_approved'){
         $approval_req_per_q++;
     }elseif($row_c5['hr_question_stat']=='Absence_was_rejected'){
         $reject_req_per_q++;
      }else{}
     }}  
     
      $count_done_q=$approval_req_per_q+$reject_req_per_q;
      
      $request_per_all_q=$count_done_q+$count_pending_q;
     ?> 		    
									<h4 class="card-title"><i class="fa fa-gavel" aria-hidden="true"></i>  <?php echo $issues; ?><span class="badge bg-inverse-danger ms-2"><?php echo $request_per_all_q; ?></span></h4>
									<div class="statistics">
										<div class="row">
										     <?php //include("../modals/hr_add_business_trip_modal.php");?>

											<div class="col-md-6 col-6 text-center">
												<div class="stats-box mb-4">
											<p><?php echo $pending; ?></p>
		
													<h3><?php echo $count_pending_q; ?></h3>
												</div>
											</div>
											<div class="col-md-6 col-6 text-center">
												<div class="stats-box mb-4">
													<p><?php echo $Processing_Done; ?></p>
													<h3><?php echo $count_done_q; ?></h3>
												</div>
											</div>
											
										</div>
									</div>
									<div class="progress mb-4">
									    <?php
									   if($request_per_all_q>0){ 
									    $q_p1=round($approval_req_per_q/$request_per_all_q*100,2);  
									    $q_p2=round($count_pending_q/$request_per_all_q*100,2);  
									    $q_p3=round($reject_req_per_q/$request_per_all_q*100,2);
									   }
									    ?>
									   
										<div class="progress-bar bg-success" role="progressbar" style="width:<?php echo $q_p1; ?>%" aria-valuenow="<?php echo $q_p1; ?>" aria-valuemin="0" aria-valuemax="100"><?php echo $q_p1; ?>%</div>
										<div class="progress-bar bg-warning" role="progressbar" style="width:<?php echo $q_p2; ?>%" aria-valuenow="<?php echo $q_p2; ?>" aria-valuemin="0" aria-valuemax="100"><?php echo $q_p2; ?>%</div>
										<div class="progress-bar bg-danger" role="progressbar" style="width:<?php echo $q_p3; ?>%" aria-valuenow="<?php echo $q_p3; ?>" aria-valuemin="0" aria-valuemax="100"><?php echo $q_p3; ?>%</div>
									</div>
									<div>
								   <p><i class="fa fa-dot-circle-o text-success me-2"></i><?php echo $Has_been_approved; ?>  <span class="float-end"><?php echo $approval_req_per_q; ?></span></p>
								   <p><i class="fa fa-dot-circle-o text-warning me-2"></i><?php echo $Under_the_procedure; ?> <span class="float-end"><?php echo $count_pending_q; ?></span></p>
								   <p><i class="fa fa-dot-circle-o text-danger me-2"></i><?php echo $access_denied; ?>  <span class="float-end"><?php echo $reject_req_per_q; ?></span></p>
								  
									</div>
							
								<!--div class="load-more text-center">
									    <a href="#" class="btn btn-sm btn-warning download-offer" data-bs-toggle="modal" data-bs-target="#add_department"><span><i class="fa fa-plus"></i><?php echo $request_permission; ?></span></a>
									</div-->
							
								</div>
							</div>
						</div>

					
			
			<!-- ========================تسجيل حضور بدون إنصراف والعكس ========================================================= -->
							<div class="col-md-4 d-flex" clas="col-md-12 col-lg-6 col-xl-4 d-flex">
							<div class="card flex-fill">
								<div class="card-body">
								    
	
	
			  <?php 
			  
			  
   $count_all_whithout=0;
   $count_pending4=0;
   $count_done4=0; 
    $count_exption4=0; 
    $count_warning4=0;
    $count_cut4=0;

                 if(($urow['user_type']=='Top_Manager' or $urow['user_type']=='System_Manager')or($recording_employee_absences_per==1)){
					if($company_id=='all_company'){
                  $sql_cw="SELECT * FROM hr_employ_tbl where system_id='2222' and company_id IN ('$ids') AND company_id!='' AND deleted='0' ORDER BY `hr_employ_tbl`.`employ_name_ar` DESC ";
                    }else{
                  $sql_cw="SELECT * FROM hr_employ_tbl where system_id='2222' and company_id='$company_id'AND company_id!='' AND deleted='0' ORDER BY `hr_employ_tbl`.`employ_name_ar` DESC ";
                    }
                    
                  }else{
                      $sql_cw="SELECT * FROM hr_employ_tbl where system_id='2222' and employ_id='".$urow['user_id']."'AND company_id!='' AND deleted='0' ORDER BY `hr_employ_tbl`.`employ_name_ar` DESC";  
                  }
                    
                   $result_cw = $conn->query($sql_cw);
                   if ($result_cw->num_rows > 0) {
                    while($row_cw = $result_cw->fetch_assoc()) {
                      
                    //  echo $row_cw['user_id'];
                  
                  
                     $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()) { 
                             $modal_id=$row_ws['waseet_id'];
                             
                              $sql_sh="SELECT * FROM hr_shift_tbl where shift_id='".$row_ws['shift_id']."' AND hodoor_ghyab='0' AND stop='0' AND deleted='0'  ";
                                 $result_sh = $conn->query($sql_sh);
                                 if ($result_sh->num_rows > 0) {
                                while($row_sh = $result_sh->fetch_assoc()) {
                             
                             
                             
                                
                    $sql_emp="SELECT * FROM hr_employ_tbl where  employ_id='".$row_ws['employ_id']."' and  employ_stat='active_employ' and employ_id='".$row_cw['employ_id']."' AND stop='0' AND deleted='0' group by employ_id 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()) {       
                          if($lang=='ar'){$employ_name=$row_emp['employ_name_ar'];}else{$employ_name=$row_emp['employ_name_en'];}
                         // echo $row_ws['employ_id'].'<br>';
                          
                          
                         //$sql_add="SELECT * FROM hr_add_hodor_ensraf_tbl where  hodor_ensraf_date between'$date_from' AND'$date_to' AND user_id_top_manager='$user_id_top_manager' AND deleted='0'  ";   

                       
                //                 if($without_type=='pending'){
                //           $sql_add="SELECT * FROM hr_add_hodor_ensraf_tbl where hodor_ensraf_date BETWEEN '$date_from' AND'$date_to' AND (hodor_time=ensraf_time)AND employee_number_fingerprint='".$row_emp['employee_number_fingerprint']."' and  hodor_ensraf_stat='0'  ";
                //           }elseif($without_type=='done'){
                //   $sql_add="SELECT * FROM hr_add_hodor_ensraf_tbl where hodor_ensraf_date BETWEEN '$date_from' AND'$date_to' AND (hodor_time=ensraf_time)AND employee_number_fingerprint='".$row_emp['employee_number_fingerprint']."'  and hodor_ensraf_stat!='0'  AND (hodor_ensraf_stat='exception_cut_presence_without_l_or_o' OR hodor_ensraf_stat='cut_presence_without_l_or_o'OR hodor_ensraf_stat='warning') ";
                //           }else{}
                //           $result_add = $conn->query($sql_add);
                //           if ($result_add->num_rows > 0) {
                //             while($row_add = $result_add->fetch_assoc()) {
                //             }}
                                
                       
                          $sql_add="SELECT * FROM hr_add_hodor_ensraf_tbl where hodor_ensraf_date BETWEEN '$date_from' AND'$date_to' AND employee_number_fingerprint='".$row_emp['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['employee_number_fingerprint'].'<br>';
     
      if(($row_add['hodor_ensraf_stat']=='0' or $row_add['hodor_ensraf_stat']=='exception_cut_presence_without_l_or_o' or $row_add['hodor_ensraf_stat']=='cut_presence_without_l_or_o' or $row_add['hodor_ensraf_stat']=='warning') && ($row_add['hodor_time']==$row_add['ensraf_time'])&& $row_add['hodor_time']!='00:00:00'){ 
   $count_all_whithout++; 
   }      
  
 
  if(($row_add['hodor_ensraf_stat']=='0') && ($row_add['hodor_time']==$row_add['ensraf_time'])&& $row_add['hodor_time']!='00:00:00' ){ 
   $count_pending4++; 
   }  
   
   
        if(($row_add['hodor_ensraf_stat']!='0' && ($row_add['hodor_ensraf_stat']=='exception_cut_presence_without_l_or_o' or $row_add['hodor_ensraf_stat']=='cut_presence_without_l_or_o' or $row_add['hodor_ensraf_stat']=='warning') && ($row_add['hodor_time']==$row_add['ensraf_time'])&& $row_add['hodor_time']!='00:00:00' )){ 
   $count_done4++; 
   }  
   


   
     if($row_add['hodor_ensraf_stat']!='0' && $row_add['hodor_ensraf_stat']=='exception_cut_presence_without_l_or_o' ){ 
   $count_exption4++; 
   }  


    if($row_add['hodor_ensraf_stat']=='warning'){ 
   $count_warning4++; 
   }  
   
   
    if($row_add['hodor_ensraf_stat']=='cut_presence_without_l_or_o'){ 
   $count_cut4++; 
   } 

    }} }}  }} }} }}

	?>
	
					    
 		    
	
		<h4 class="card-title"><i class="fa fa-hand-o-up" aria-hidden="true"></i>  <?php echo $Recording_attendance_without_leaving_and_vice_versa; ?><span class="badge bg-inverse-danger ms-2"><?php echo $count_all_whithout; ?></span></h4>
								
		
									<div class="statistics">
									      <?php //include("../requests/Add_Dept_Request.php");?>
										<div class="row">
										   
 
											<div class="col-md-6 col-6 text-center">
												<div class="stats-box mb-4">
											<p><?php echo $pending; ?></p>
													<h3><?php echo $count_pending4; ?></h3>
												</div>
											</div>
											<div class="col-md-6 col-6 text-center">
												<div class="stats-box mb-4">
													<p><?php echo $Processing_Done; ?></p>
													<h3><?php echo $count_done4; ?></h3>
												</div>
											</div>
											
										
									</div>
									<div class="progress mb-4">
									    <?php
									   if($count_all_whithout>0){ 
									    $p1=round($count_exption4/$count_all_whithout*100,2);  
									    $p2=round($count_warning4/$count_all_whithout*100,2);  
									    $p3=round($count_cut4/$count_all_whithout*100,2);
									   }
									    ?>
									   
										<div class="progress-bar bg-success" role="progressbar" style="width:<?php echo $p1; ?>%" aria-valuenow="<?php echo $p1; ?>" aria-valuemin="0" aria-valuemax="100"><?php echo $p1; ?>%</div>
										<div class="progress-bar bg-warning" role="progressbar" style="width:<?php echo $p2; ?>%" aria-valuenow="<?php echo $p2; ?>" aria-valuemin="0" aria-valuemax="100"><?php echo $p2; ?>%</div>
										<div class="progress-bar bg-danger" role="progressbar" style="width:<?php echo $p3; ?>%" aria-valuenow="<?php echo $p3; ?>" aria-valuemin="0" aria-valuemax="100"><?php echo $p3; ?>%</div>
									</div>
									<div>
								   <p><i class="fa fa-dot-circle-o text-success me-2"></i><?php echo $Exception_made; ?>  <span class="float-end"><?php echo $count_exption4; ?></span></p>
								   <p><i class="fa fa-dot-circle-o text-warning me-2"></i><?php echo $warn; ?> <span class="float-end"><?php echo $count_warning4; ?></span></p>
								   <p><i class="fa fa-dot-circle-o text-danger me-2"></i><?php echo $Discounted; ?>  <span class="float-end"><?php echo $count_cut4; ?></span></p>
								  
									</div>

							</div>
							
								<!--div class="load-more text-center">
							   <a href="#" class="btn btn-sm btn-warning download-offer" data-bs-toggle="modal" data-bs-target="#add_requestt"><span><i class="fa fa-plus"></i><?php echo $add_request; ?></span></a>
									</div-->
							
								</div>
							</div>
						</div>
					</div> 
			<!-- =====================/===تسجيل حضور بدون إنصراف والعكس ========================================================= -->
			
       
       
          <!-- ==============================/r========================================== -->                        
                    
            
             <!--div class="card">
		  <div class="card-body"> 
		  <div class="row"> 
		  	<div class="col-lg-4 col-sm-6 col-12"> 
		  	<label><?php echo $count_the_days; ?>/ </label>
		  <?php echo $add_ayam; ?>
		  	 </div> 

		  	 	<div class="col-lg-4 col-sm-6 col-12">
		  	 	<label><?php echo $The_number_of_Fridays; ?>/ </label>	
		  <?php echo $i; ?>
		  	 </div> 
		  	 	<div class="col-lg-4 col-sm-6 col-12"> 
		  	 	<label><?php echo $net_number_of_days; ?>/ </label>
		  	<?php echo $safy_ayam; ?>
		  	 </div>	 
		  	 
		  
		  </div>
		  </div>
		 </div-->  
		 
		 
           
            <!-- ==========dropdown action========================================== -->
           	<!--div class="card">
		  <div class="card-body">
           <?php if($lang=='ar'){ ?><div class="btn-group" style="float:left;"><?php }else{ ?>
           <div class="btn-group" style="float:right;"><?php } ?>
			<button type="button" class="btn btn-success dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><?php echo $Options; ?></button>
			<div class="dropdown-menu" style="">
			<a class="dropdown-item" id="btn_mosala" href="javascript:void(0);">إرسال مسائله</a>
			<div class="dropdown-divider"></div>
			<a class="dropdown-item" id="absence" href="javascript:void(0);"><?php echo $absence; ?></a>
			</div>
			</div>
           	</div>
			</div-->
			<!-- ==========/dropdown action========================================== -->


						<div class="col-md-12">
							<div>
							    <div class="table-responsive">
							    <table class="table  datanew table-striped mb-0">
								<!--table class="table table-striped custom-table mb-0 datatable" -->
                                <thead>
										<tr>
											<th>
												<label class="checkboxs">
													<input type="checkbox"style="width:20px;height:20px;" class="all_ch_att" name="all_ch_att" id="all_ch_att">
													<span class="checkmarks"></span>
												</label>
											</th>
											<th><?php echo $id; ?></th>
											<th><?php echo $Employee_data; ?></th>
											<th><?php echo $Shift_Details; ?></th>
										     <th><?php echo $the_date; ?></th>
									     	<th><?php echo $type; ?></th>
									     	<th><?php echo $Employee_Justification; ?></th>
									     	<th style="font-size:12px;"><?php echo $attachments; ?></th>
											<th><?php echo $status; ?></th>
											<!--th>Action</th-->
										</tr>
									</thead>
									<tbody>
                   			  <?php 
                   			 $num=0; 
                   //	 if(isset($_POST["sav_btn"])){
                    if(($urow['user_type']=='Top_Manager' or $urow['user_type']=='System_Manager')or($recording_employee_absences_per==1)){
					if($company_id=='all_company'){
                  $sql_cw="SELECT * FROM hr_employ_tbl where (employ_stat='active_employ' or employ_stat='employ_action') AND system_id='2222' and company_id IN ('$ids') AND company_id!='' AND deleted='0' ORDER BY `hr_employ_tbl`.`employ_name_ar` DESC ";
                    }else{
                  $sql_cw="SELECT * FROM hr_employ_tbl where (employ_stat='active_employ' or employ_stat='employ_action') AND system_id='2222' and company_id='$company_id'AND company_id!='' AND deleted='0' ORDER BY `hr_employ_tbl`.`employ_name_ar` DESC ";
                    }
                    
                  }else{
                      $sql_cw="SELECT * FROM hr_employ_tbl where system_id='2222' and employ_id='".$urow['user_id']."'AND company_id!='' AND deleted='0' ORDER BY `hr_employ_tbl`.`employ_name_ar` DESC";  
                  }

                   $result_cw = $conn->query($sql_cw);
                   
                   //}
                   
                   if ($result_cw->num_rows > 0) {
                    while($row_cw = $result_cw->fetch_assoc()) {
                   // echo $row_cw['employ_id'].'<br>'; 		  
                   	if($lang=='ar'){$employ_name=$row_cw['employ_name_ar'];}else{$employ_name=$row_cw['employ_name_en'];}
                  
                   	
                   	            
                   	            
                   $sql_m="SELECT * FROM hr_add_hodor_ensraf_tbl where employee_number_fingerprint='".$row_cw['employee_number_fingerprint']."' AND employee_number_fingerprint!='' AND hodor_ensraf_stat!='1'AND hodor_ensraf_date between'$date_from' AND'$date_to' AND stop='0' AND deleted='0'  ";
                 $result_m = $conn->query($sql_m);
                 if ($result_m->num_rows > 0) {
                 while($row_m = $result_m->fetch_assoc()) {
                 $hodor_ensraf_stat=$row_m['hodor_ensraf_stat'];    
                
                 $employee_number_fingerprint=$row_m['employee_number_fingerprint'];    
              
              	$num++;
                          ?>
                          
                          
                    <tr class="D<?php echo $row_add['hodor_ensraf_id']; ?>">
					<td>  <?php echo $num; ?> <?php //echo  $employee_number_fingerprint; ?> </td>
					
					
						 <td> 
						    <?php echo  $row_m['hodor_ensraf_id']; ?><br>
						 
							<h2 class="table-avatar">
							
							<a class="avatar" clas="avatar avatar-xs" href="profile.html">
							<?php
							$attach_link=0;
                          $sql_ico="SELECT * FROM hr_employ_attachments_tbl where employ_id='".$row_cw['employ_id']."' AND att_name='employ_photo' AND  stop='0' AND deleted='0' ";
                          $result_ico = $conn->query($sql_ico);
                           if ($result_ico->num_rows > 0) {
                            while($row_ico = $result_ico->fetch_assoc()) {
                              $attach_link=$row_ico['attach_link'];  
                            }}
                             ?>  
                               <?php if($attach_link==''){ ?>  
								<img alt="" src="../../assets/img/profiles/avatar-09.jpg">
								<?php }elseif($attach_link!=''){ ?>
								<img alt="" src="../../../Shipping_Clearance_System/jquery/pages/system_maintenance/user_img/<?php echo $attach_link; ?>">
							<?php }else{ ?>
							<img alt="" src="../../assets/img/profiles/avatar-09.jpg">
							<?php } ?>
								
								</a>
							
						  
							  </h2>
								</td>
								
						
								
								<td>
								<a href="profile.html"><?php echo $employ_name; ?></a><br>
							    <input  type="hidden" readonly="readonly" name="mobile_number" id="mobile_number<?php echo $row_add["hodor_ensraf_id"]; ?>" value="<?php echo $row_cw['mobile_number']; ?>">
							    
							    <?php $mosala_type='ghyab';  ?>
								 <small class="text-muted" style="font-size:12px;">
									 <?php
                                             $sql_cy="SELECT * FROM main_company_tbl where company_id='".$row_cw['company_id']."' ";
                                             $result_cy = $conn->query($sql_cy);
                                             if ($result_cy->num_rows > 0) {
                                             while($row_cy = $result_cy->fetch_assoc()) {
                                                if($lang=='ar'){$company_name=$row_cy['company_name_ar'];}else{$company_name=$row_cy['company_name_en'];} 
                                            echo $company_name;     
                                             }}
                                            // echo $row_emp['company_id'];
                                               ?> 
								<br>	
								   <?php 
					             $sql_c="SELECT * FROM dept_tb where dept_id='".$row_cw['dept_id']."' AND dept_id!='0' ";
                                  $result_c = $conn->query($sql_c);
                                  if ($result_c->num_rows > 0) {
                                   while($row_c = $result_c->fetch_assoc()) {
                                  if($lang=='ar'){$dept_name=$row_c['dept_name'];}else{$city_name2=$row_c['dept_name_en'];} 
                                        echo $dept_name;     
                                    }}
					            ?>-
					         	<?php if($row_cw['user_type']=='Top_Manager' or $row_cw['user_type']=='System_Manager'){ echo $row_cw['user_type'];
					         	}else{ ?>
									      <?php 
									     $sql_jo="SELECT * FROM job_tb where job_id='".$row_cw['job_id']."' AND job_id!='0' ";
                                         $result_jo = $conn->query($sql_jo);
                                         if ($result_jo->num_rows > 0) {
                                         while($row_jo = $result_jo->fetch_assoc()) {
                                          if($lang=='ar'){$job_name=$row_jo['job_name'];}else{$job_name=$row_jo['jop_name_en'];} 
                                          echo $job_name;
                                         //echo $row_jo['job_id'];
                                         
                                         }}else{ echo $no_jop;}
									     ?><?php } ?>
									</small><br>
									<small class="m3"><?php echo $row_cw['id_num']; ?></small>
								</td>		
								
								
								
											
							<td>
									  <?php 
									  
									  $sql_ws="SELECT * FROM hr_waseet_employ_shift_tbl where employ_id='".$row_cw['employ_id']."' AND deleted='0' and stop='0' and waseet_stat='0'  ";
                          $result_ws = $conn->query($sql_ws);
                           if ($result_ws->num_rows > 0) {
                            while($row_ws = $result_ws->fetch_assoc()) { 
                             $modal_id=$row_ws['waseet_id']; //echo $modal_id;
                                //shift
									   $sql_sh="SELECT * FROM hr_shift_tbl where shift_id='".$row_ws['shift_id']."' AND stop='0' AND deleted='0'  ";
                                        $result_sh = $conn->query($sql_sh);
                                        if ($result_sh->num_rows > 0) {
                                       while($row_sh = $result_sh->fetch_assoc()) {
                                        if($lang=='ar'){$shift_name=$row_sh['shift_name_ar'];}else{$shift_name=$row_sh['shift_name_en'];}
                                       $min_start_time=$row_sh['min_start_time'];
                                        $start_time=$row_sh['start_time'];
                                         $max_start_time=$row_sh['max_start_time'];
                                         
                                          $min_end_time=$row_sh['min_end_time'];
                                        $end_time=$row_sh['end_time'];
                                         $max_end_time=$row_sh['max_end_time'];
                                         
                                         $number_hours=$row_sh['number_hours'];
                                         
                                       }}  }}   
                                           
									  ?>
									  <small style="font-size:12px;"><?php echo $shift_name;  ?></small><br>
									  <small style="font-size:12px;"><?php echo $min_start_time; ?>-<?php echo $start_time; ?>-<?php echo $max_start_time; ?></small><br>
									   <small style="font-size:12px;"><?php echo $min_end_time; ?>-<?php echo $end_time; ?>-<?php echo $max_end_time; ?></small>
									</td>
								
									<td>
									<small style="font-size:14px;" dir="ltr"><?php  echo $row_m['hodor_ensraf_date']; ?>
									
									</small>
								
									<input  type="hidden" readonly="readonly" name="hodor_ensraf_date" id="hodor_ensraf_date<?php echo $row_cw["employ_id"].$val; ?>" value="<?php echo $date_from; ?>">
									</td>			
					     
                         
                         	<td>
                         	   <?php echo $row_m['hodor_time']; ?>/ <?php echo $row_m['ensraf_time']; ?>
                         	    <br>
                         	    
                             <?php if($row_m['ensraf_time']==$row_m['ensraf_time'] && $row_m['hodor_time']=='00:00:00'){ ?>
                             
                             <span class="task-priority badge bg-inverse-danger">
                                 <?php echo $absence; ?></span>  <br> 
                                 <?php } ?>
                                 
                                 
                                 <?php echo $row_m['hodor_ensraf_stat']; ?>
                                  
                                 
                                   <?php if(($row_m['hodor_ensraf_stat']=='0' or $row_m['hodor_ensraf_stat']=='exception_cut_presence_without_l_or_o' or $row_m['hodor_ensraf_stat']=='cut_presence_without_l_or_o' or $row_m['hodor_ensraf_stat']=='warning') && ($row_m['hodor_time']==$row_m['ensraf_time'] && $row_m['hodor_time']<=12)&& $row_m['hodor_time']!='00:00:00'){ ?> 
                                 <br>  <span class="task-priority badge bg-inverse-danger">
                               تسجيل حضور بدون إنصراف
                               <input  type="hidden" readonly="readonly" name="mosala_type" id="mosala_type<?php echo $row_add["hodor_ensraf_id"]; ?>" value="<?php echo $mosala_type; ?>">
                                 </span>  
                                 <?php } ?>
                                 
                                   <?php if(($row_m['hodor_ensraf_stat']=='0' or $row_m['hodor_ensraf_stat']=='exception_cut_presence_without_l_or_o' or $row_m['hodor_ensraf_stat']=='cut_presence_without_l_or_o'or $row_m['hodor_ensraf_stat']=='warning') &&  ($row_m['hodor_time']==$row_m['ensraf_time'] && $row_m['hodor_time']>12)&& $row_m['hodor_time']!='00:00:00'){ ?>
                                   <br><span class="task-priority badge bg-inverse-danger">
                                    <input  type="hidden" readonly="readonly" name="mosala_type" id="mosala_type<?php echo $row_add["hodor_ensraf_id"]; ?>" value="<?php echo $mosala_type; ?>">
                               تسجيل إنصراف بدون حضور
                                 </span>  
                                 <?php }else{} ?>
                                 
                                 
                                <?php  if($row_m['hodor_ensraf_stat']=='approval_req_per'){  ?> 
                                  <br><span class="task-priority badge bg-inverse-warning"><?php echo $request_permission; ?></span>
                                	<br><small style="font-size:14px;" dir="ltr"><?php echo $row_m['hodor_time']; ?>/ <?php echo $row_m['ensraf_time']; ?>	</small>
                                 <?php } ?>
                              </td>
                              
                               
											    
					       <td>
					           <?php //echo $row_cw['employ_id']; ?>
                      
							<?php 
							 $sql_q="SELECT * FROM hr_question_tbl where employ_id='".$row_cw['employ_id']."' AND hr_question_date='".$row_m['hodor_ensraf_date']."' AND stop='0' AND deleted='0'  ";
                             $result_q = $conn->query($sql_q);
                              if ($result_q->num_rows > 0) {
                                  $check_question=1;
                              while($row_q = $result_q->fetch_assoc()) {
                              $hr_question_stat=$row_q['hr_question_stat'];  
                               $employee_reply=$row_q['employee_reply'];  
                              $the_reasonn=$row_q['the_reason']; //echo $employee_reply; 
                              $hr_question_id=$row_q['hr_question_id'];
                              }}else{$check_question=0;}
                              
                             // echo $check_question; 
							?> 
							
							
								<?php 
							 $sql_req="SELECT * FROM hr_request_permission_tbl where employ_id='".$row_cw['employ_id']."' AND request_per_date='".$row_m['hodor_ensraf_date']."' AND stop='0' AND deleted='0'  ";
                             $result_req = $conn->query($sql_req);
                              if ($result_req->num_rows > 0) {
                                  $check_permation=1;
                                  
                              while($row_req = $result_req->fetch_assoc()) {
                             $request_per_details=$row_req['request_per_details'];    
                             
                             $request_per_stat=$row_req['request_per_stat'];   
                             $the_reason=$row_req['the_reason'];   
                                  
                            //   $hr_question_stat=$row_q['hr_question_stat'];  
                            //   $employee_reply=$row_q['employee_reply'];  
                            //   $the_reasonn=$row_q['the_reason']; //echo $employee_reply; 
                            //   $hr_question_id=$row_q['hr_question_id'];
                              
                              
                              }}else{$check_permation=0;}
                              
                           //   echo $check_permation; 
							?>
							
							
							
							
							
						<!--small style="width:100px;overflow: scroll; font-size:12px;"><?php   echo $employee_reply;   ?></small-->
						<!--small style="width:70px;" clas="small doj text-muted"> 
					 <textarea readonly="" name="notes" id="notes" class="form-control" style="width: 200px;overflow: scroll; font-size:12px;">							
					   <?php   echo $employee_reply;   ?>
					   </textarea>	
					</small-->
						 
					<?php  if($check_question=='1'){ ?>	
					<div style="width: 200px;overflow: scroll; font-size:12px;">  <?php echo $employee_reply; ?></div>	
					<?php }elseif($check_permation=='1'){ ?>
					<div style="width: 200px;overflow: scroll; font-size:12px;">  <?php echo $request_per_details; ?></div>	
					<?php } ?>
					
					
                         </td>
                         
                         
				<td clas="text-end">
							<?php
							$attach_link=0;
                          $sql_ico="SELECT * FROM hr_employ_attachments_tbl where employ_id='".$row_cw['employ_id']."' AND attach_type='219231' AND connect_id='$hr_question_id' AND  stop='0' AND deleted='0' ";
                          $result_ico = $conn->query($sql_ico);
                           if ($result_ico->num_rows > 0) {
                            while($row_ico = $result_ico->fetch_assoc()) {
                              $attach_link=$row_ico['attach_link']; 
                              $attach_id=$row_ico['attach_id']; 
                              $att_name=$row_ico['att_name'];
                              //echo  $attach_id.'<br>';
                             ?>

                             <ul class="team-members">
									<li styl="width:50px;">
									<?php if($row_ico['file_type']=='image/png' or $row_fil['file_type']=='image/jpeg'){ ?><a href="../hr_files/<?php echo $row_ico['attach_link']; ?>" target="_new" data-bs-toggle="tooltip" title="" data-bs-original-title="<?php echo $att_name; ?>" aria-label="John Doe"><img alt="" src="../hr_files/<?php echo $row_ico['attach_link']; ?>">
									 <?php echo $att_name; ?>
									</a>
									<?php }else{ ?>
									<a href="../hr_files/<?php echo $row_ico['attach_link']; ?>" target="_new" data-bs-toggle="tooltip" title="" data-bs-original-title="<?php echo $att_name; ?>" aria-label="John Doe"><img alt="" src="../../assets/img/profiles/avatar-02.jpg">
									 <?php echo $att_name; ?>
									</a>
									<?php } ?>
								</li>	

										</ul>	<?php }}  ?>
                             
						
							</td> 			
											
					<td>  
					<div class="action-label">
				
					<?php if($hodor_ensraf_stat=='waiting_employee_response'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-success"></i> <?php echo $waiting_employee_response; ?>
						</a>
					
				<?php }elseif($hodor_ensraf_stat=='Absence_was_rejected'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-success"></i> <?php echo $The_employee_was_rejected_and_registered_absent; ?>
						</a>
					
					
						
					<br>	<small  style="color:red;"><?php echo $the_reasonn ?></small>
					
						<?php }elseif($hodor_ensraf_stat=='Answered_by_the_employee'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-success"></i> <?php echo $Answered_by_the_employee; ?>
						</a>	</span> 
					
						<?php }elseif($hodor_ensraf_stat=='Absence_was_approved'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-success"></i> <?php echo $Has_been_approved; ?>
						</a>	</span>
					
						<?php }elseif($hodor_ensraf_stat=='ghyab'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-danger"></i> <?php echo $The_employee_has_been_registered_absent; ?>
						</a></span>
						
						
							<?php }elseif($hodor_ensraf_stat=='ghyab'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-danger"></i> <?php echo $The_employee_has_been_registered_absent; ?>
					
							<?php }elseif($hodor_ensraf_stat=='exception_ghyab'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-danger"></i> <?php echo $An_exception_was_made_for_absence; ?>
						</a></span>
					
								<?php }elseif($hodor_ensraf_stat=='warning'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-warning"></i> <?php echo $warn; ?>
						</a></span>
						
								<?php }elseif($hodor_ensraf_stat=='0'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-danger"></i> إستثناء معالجة <?php //echo $warn; ?>
						</a></span>
									<?php }elseif($hodor_ensraf_stat=='exception_cut_presence_without_l_or_o'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-success"></i> إستثناء من الخصم <?php //echo $warn; ?>
						</a></span>
					
										<?php }elseif($hodor_ensraf_stat=='cut_presence_without_l_or_o'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-success"></i>  تم الخصم <?php //echo $warn; ?>
						</a></span>
					
					
			    	<?php }elseif($hodor_ensraf_stat=='approval_req_per'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-success"></i> <?php echo  $Has_been_approved;  ?>
						</a></span>
					
					  	<?php }elseif($hodor_ensraf_stat=='reject_req_per'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-danger"></i> <?php echo  $access_denied;  ?>
					 <br><small class="small doj text-muted" style="color:red;"><?php echo $the_reason; ?></small>
					
					
					
					</a></span><?php }else{} ?>
					
					</div>
					
					
					
					<!--div class="action-label">
				<?php if($check_question!='1'){ ?>	    
				 <span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-success"></i> <?php echo $pending; ?>
					</a></span>
					<?php }elseif($hr_question_stat=='waiting_employee_response'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-success"></i> <?php echo $waiting_employee_response; ?>
					
					
				<?php }elseif($hr_question_stat=='Absence_was_rejected'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-success"></i> <?php echo $The_employee_was_rejected_and_registered_absent; ?>
					
					
						<?php }elseif($hr_question_stat=='Answered_by_the_employee'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-success"></i> <?php echo $Answered_by_the_employee; ?>
					
					
						<?php }elseif($hr_question_stat=='Absence_was_approved'){ ?>
					<span>	<a style="font-size:12px;" class="btn btn-white bt/n-sm btn-rounded" href="javascript:void(0);">
					<i class="fa fa-dot-circle-o text-success"></i> <?php echo $Has_been_approved; ?>
					
					
					</a></span><?php } ?>
					
					</div-->
					
					</td>
				
                        
											<?php  }}   }}    ?>
										</tr>
								

									</tbody>
								</table>
							</div>
						</div>
					</div>
                </div>
                	</div>
				<!-- /Page Content -->

				
            </div>
			<!-- /Page Wrapper -->

        </div>
		<!-- /Main Wrapper -->
		
	 
		<!-- sitting -->
		<?php include("../setting.php"); ?>
	    <!-- /sitting -->

	<!-- Footer -->
		<?php include("../footer.php"); ?>
		<!-- /Footer -->

	 <!-- jQuery -->
        <script src="../../assets/js/jquery-3.6.0.min.js"></script>

        <!-- Feather Icon JS -->
        <script src="../../assets/js/feather.min.js"></script>

        <!-- Slimscroll JS -->
        <script src="../../assets/js/jquery.slimscroll.min.js"></script>
        
          <!-- Select2 JS -->
    <script src="../../assets/js/select2.min.js"></script>
    
    <!-- Datetimepicker JS -->
    <script src="../../assets/js/moment.min.js"></script>
    <script src="../../assets/js/bootstrap-datetimepicker.min.js"></script>

        <!-- Datatable JS -->
        <script src="../../assets/js/jquery.dataTables.min.js"></script>
        <script src="../../assets/js/dataTables.bootstrap4.min.js"></script>
        
        <!-- Bootstrap Core JS -->
        <script src="../../assets/js/bootstrap.bundle.min.js"></script>

        <!-- Custom JS -->
        <script src="../../assets/js/script.js"></script>
      
<!-- Multiselect JS -->
		<script src="../../assets/js/multiselect.min.js"></script>

		 <!-- Theme Settings JS -->
		<script src="../../assets/js/layout.js"></script>
		<script src="../../assets/js/theme-settings.js"></script>
		<script src="../../assets/js/greedynav.js"></script>
		
	 <script src="../../assets/js/app_tow.js"></script>

		<!-- Custom JS -->
		<!--script src="../../assets/js/app.js"></script-->
		
		<script src="../script_lang.js"></script> 
		
		  <!-- Alertify JS -->
		<script src="../../assets/plugins/alertify/alertify.min.js"></script>
		<!--script src="../../assets/plugins/alertify/custom-alertify.min.js"></script-->
        <!-- /Alertify JS -->
		
		
		
	    <script>
  $(document).ready(function(e) {
   $(".up_add").click(function(){
   alertify.error(message_per);
      });
      });
       </script>	
    
    
    <script>
  $(document).ready(function(e) {
   $(".up_addh").click(function(){
   alertify.error(message_per);
      });
      });
       </script>
       
  
    <script>
$('.all_ch_att').click(function(event) { 
   var id = [];
            if(this.checked) { 
                $('.ch_att').each(function(i) { 
                  if(i<30){
                    this.checked = true;
                    id[i] = $(this).val(); 
                  }    
                });
            }else{
                $('.ch_att').each(function() {
                    this.checked = false; 
                });        
            }
        });
        </script>
        
        
        
         <script>
//تسجيل غياب
$("#absence").click(function(){
      if(confirm("هل انت متاكد انك تريد تسجيل غياب ؟")){
        var id = [];
         var employ_id = [];
          var hodor_ensraf_date = [];
          var mosala_type = [];
            var add_user_id=$('#add_user_id').val();
            var employee_number_fingerprint = [];
             var company_id_sel = [];
             
             
       //alert(add_user_id);
          //var att_abs_date = $("#att_abs_date").val();

         // var att_or_abs_or_late = $('#att_or_abs_or_late').find(":selected").val();
        $(":checkbox:checked").each(function(i){
          id[i] = $(this).val();
             
               
          employ_id1=$('#employ_id'+id[i]).val();
          employ_id.push(employ_id1);
         
          hodor_ensraf_date1=$('#hodor_ensraf_date'+id[i]).val();
          hodor_ensraf_date.push(hodor_ensraf_date1);
          
          mosala_type1=$('#mosala_type'+id[i]).val();
          mosala_type.push(mosala_type1);

          company_id_sel1=$('#company_id_sel'+id[i]).val();
          company_id_sel.push(company_id_sel1);
          
          
          employee_number_fingerprint1=$('#employee_number_fingerprint'+id[i]).val();
          employee_number_fingerprint.push(employee_number_fingerprint1);

        });
//alert(employ_id);
//alert(hodor_ensraf_date);
//alert(mosala_type);
        if(id.length == 0){
          alert("اختر على الاقل احد الموظفين لإرسال المسائله !");

        }else{

      $.post('hr_ghyab_Codeee.php', {'id':id,'employ_id':employ_id,'hodor_ensraf_date':hodor_ensraf_date,'mosala_type':mosala_type,'employee_number_fingerprint':employee_number_fingerprint,'add_user_id':add_user_id,'company_id_sel':company_id_sel}, function(r) {
              // alert("تمت عملية التسجيل بنجاح");
              alertify.success(message_success);
               if(r==1){
                for( var i=0; i<id.length; i++){
         $(".D"+id[i]+'').css("background-color", "#ccc");
         $(".D"+id[i]+'').fadeOut("slow");

         }
               }
               window.location.reload();
              }); 
              
        }

      }else{
        return false;

      }

    });

     </script>
     
     
     
             
         <script>
//تسجيل إستثناء
$("#btn_exception").click(function(){
      if(confirm("هل انت متاكد انك تريد إستثناء الموظف من الغياب ؟")){
        var id = [];
         var employ_id = [];
          var hodor_ensraf_date = [];
          var mosala_type = [];
            var add_user_id=$('#add_user_id').val();
            var employee_number_fingerprint = [];
       //alert(add_user_id);
          //var att_abs_date = $("#att_abs_date").val();

         // var att_or_abs_or_late = $('#att_or_abs_or_late').find(":selected").val();
        $(":checkbox:checked").each(function(i){
          id[i] = $(this).val();
             
               
          employ_id1=$('#employ_id'+id[i]).val();
          employ_id.push(employ_id1);
         
          hodor_ensraf_date1=$('#hodor_ensraf_date'+id[i]).val();
          hodor_ensraf_date.push(hodor_ensraf_date1);
          
          mosala_type1=$('#mosala_type'+id[i]).val();
          mosala_type.push(mosala_type1);

          employee_number_fingerprint1=$('#employee_number_fingerprint'+id[i]).val();
          employee_number_fingerprint.push(employee_number_fingerprint1);

        });
//alert(employ_id);
//alert(hodor_ensraf_date);
//alert(mosala_type);
        if(id.length == 0){
          alert("اختر على الاقل احد الموظفين  !");

        }else{

      $.post('hr_exception_ghyab_Codeee.php', {'id':id,'employ_id':employ_id,'hodor_ensraf_date':hodor_ensraf_date,'mosala_type':mosala_type,'employee_number_fingerprint':employee_number_fingerprint,'add_user_id':add_user_id}, function(r) {
              // alert("تمت عملية التسجيل بنجاح");
              alertify.success(message_success);
               if(r==1){
                for( var i=0; i<id.length; i++){
         $(".D"+id[i]+'').css("background-color", "#ccc");
         $(".D"+id[i]+'').fadeOut("slow");

         }
               }
               window.location.reload();
              }); 
              
        }

      }else{
        return false;

      }

    });

     </script>
     
     
     
                  
         <script>
//تسجيل المسائله
$("#btn_mosala").click(function(){
      if(confirm("هل انت متاكد انك تريد إرسال المسائله ؟")){
        var id = [];
         var employ_id = [];
          var hodor_ensraf_date = [];
          var mosala_type = [];
            var add_user_id=$('#add_user_id').val();
            var employee_number_fingerprint = [];
       //alert(add_user_id);
          //var att_abs_date = $("#att_abs_date").val();

         // var att_or_abs_or_late = $('#att_or_abs_or_late').find(":selected").val();
        $(":checkbox:checked").each(function(i){
          id[i] = $(this).val();
             
               
          employ_id1=$('#employ_id'+id[i]).val();
          employ_id.push(employ_id1);
         
          hodor_ensraf_date1=$('#hodor_ensraf_date'+id[i]).val();
          hodor_ensraf_date.push(hodor_ensraf_date1);
          
          mosala_type1=$('#mosala_type'+id[i]).val();
          mosala_type.push(mosala_type1);

          employee_number_fingerprint1=$('#employee_number_fingerprint'+id[i]).val();
          employee_number_fingerprint.push(employee_number_fingerprint1);

        });
//alert(employ_id);
//alert(hodor_ensraf_date);
//alert(mosala_type);
        if(id.length == 0){
          alert("اختر على الاقل احد الموظفين  !");

        }else{

    $.post('hr_mosala_ghyab_Codeee.php', {'id':id,'employ_id':employ_id,'hodor_ensraf_date':hodor_ensraf_date,'mosala_type':mosala_type,'employee_number_fingerprint':employee_number_fingerprint,'add_user_id':add_user_id}, function(r) {
              // alert("تمت عملية التسجيل بنجاح");
              alertify.success(message_success);
              //alert(r);
               if(r==1){
                for( var i=0; i<id.length; i++){
         $(".D"+id[i]+'').css("background-color", "#ccc");
         $(".D"+id[i]+'').fadeOut("slow");

         }
               }
               window.location.reload();
              }); 
              
        }

      }else{
        return false;

      }

    });

     </script>
     
     
        
        
 <!--script>
//إرسال مسائله لعدد من الموظفين
$("#btn_mosala").click(function(){
      if(confirm("هل انت متاكد انك تريد إرسال المسائله ؟")){
        var id = [];
         var employ_id = [];
          var hodor_ensraf_date = [];
          var mosala_type = [];
            var add_user_id=$('#add_user_id').val();
      // alert(add_user_id);
          //var att_abs_date = $("#att_abs_date").val();

         // var att_or_abs_or_late = $('#att_or_abs_or_late').find(":selected").val();
        $(":checkbox:checked").each(function(i){
          id[i] = $(this).val();
             
               
          employ_id1=$('#employ_id'+id[i]).val();
          employ_id.push(employ_id1);
         
          hodor_ensraf_date1=$('#hodor_ensraf_date'+id[i]).val();
          hodor_ensraf_date.push(hodor_ensraf_date1);
          
          mosala_type1=$('#mosala_type'+id[i]).val();
          mosala_type.push(mosala_type1);

        });

        if(id.length == 0){
          alert("اختر على الاقل احد الموظفين  !");

        }else{

      $.post('hr_mosala_ghyab_Codeee.php', {'id':id,'employ_id':employ_id,'hodor_ensraf_date':hodor_ensraf_date,'mosala_type':mosala_type,'add_user_id':add_user_id}, function(r) {
              // alert("تمت عملية التسجيل بنجاح");
              alertify.error(message_success);
               if(r==1){
                for( var i=0; i<id.length; i++){
         $(".D"+id[i]+'').css("background-color", "#ccc");
         $(".D"+id[i]+'').fadeOut("slow");

         }
               }
               window.location.reload();
              }); 
              
        }

      }else{
        return false;

      }

    });

     </script-->
     
     
     
     
     
     <!--script>
//تعديل الحضور والإنصراف

$("#btn_takeed").click(function(){
      if(confirm("هل انت متاكد انك تريد إرسال التعديل ؟")){
        var id = [];
         var employ_id = [];
          var hodor_ensraf_date = [];
          var mosala_type = [];
             var hodor_time = [];
              var ensraf_time = [];
      var j = 0;
      
          //var att_abs_date = $("#att_abs_date").val();

         // var att_or_abs_or_late = $('#att_or_abs_or_late').find(":selected").val();
        $(":checkbox:checked").each(function(i){
          id[i] = $(this).val();
            // alert(id);
              
          employ_id1=$('#employ_id'+id[i]).val();
          employ_id.push(employ_id1);
         
          hodor_ensraf_date1=$('#hodor_ensraf_date'+id[i]).val();
          hodor_ensraf_date.push(hodor_ensraf_date1);
          
          mosala_type1=$('#mosala_type'+id[i]).val();
          mosala_type.push(mosala_type1);
         
           
          hodor_time1=$('#hodor_time'+id[i]).val();
          hodor_time.push(hodor_time1);
          
           
            ensraf_time1=$('#ensraf_time'+id[i]).val();
          ensraf_time.push(ensraf_time1);
          
           //alert(hodor_time1);
           //alert(ensraf_time1);
           if((hodor_time1==ensraf_time1) || (hodor_time1>ensraf_time1)){
               j++;
           }else{}

        });
        if(id.length == 0){
          alert("اختر  الاقل احد الموظفين لتأكيد التعديل !");

        }else{
if(j>0){
   alert("لا يمكن ان يكون وقت الحضور اكبر او يساوي وقت الانصراف"); 
}else{
    
      $.post('hr_takeed_edit_att_Code.php', {'id':id,'employ_id':employ_id,'hodor_ensraf_date':hodor_ensraf_date,'mosala_type':mosala_type,'hodor_time':hodor_time,'ensraf_time':ensraf_time}, function(r) {
          //     alert("تمت عملية التسجيل بنجاح");
              alertify.success(message_success);
               if(r==1){
                for( var i=0; i<id.length; i++){
         $(".D"+id[i]+'').css("background-color", "#ccc");
         $(".D"+id[i]+'').fadeOut("slow");

         }
               }
               window.location.reload();
              }); 
              
        }}

      }else{
        return false;

      }

    });

     </script-->
        
        
        
        
      
       
       	<!--script>
        $('.b').click(function() {
		   $('.nav-link').removeClass('active');
		   $(this).addClass('active');
		});
      </script-->
       
       
       
       	<script>
       	 var modal_table_name=$('#modal_table_name').val();
       	 var id_name=$('#id_name').val();
       	 var proccess_details_delete_disable=$('#proccess_details_delete_disable').val();
       	 var proccess_details_en_delete_disable=$('#proccess_details_en_delete_disable').val();
       	 
       	 var proccess_details_enable=$('#proccess_details_enable').val();
       	 var proccess_details_en_enable=$('#proccess_details_en_enable').val();
       	  
    $(".checktoggle").click(function(e){
        var id = $(this).attr('data-id');
        //alert(id);
        
           var id_check=$('#id_check').val(); 
        if(id_check==''){
      alertify.error(message_per);
        }else{
        
        if($('#user'+id).is(':checked') ){
      if(confirm(message_disabled)){
         //alert("Checkbox Is checked");
    $('#user'+id).prop('checked', true);
    
   //======================
      var add_user_id=$('#add_user_id').val();
      var company_id=$('#company_id').val();
      var g = $(this).attr('data-id');
      var date_did = $("#date_did"+g).val();
   //alert(g);
          $.post('../modals/hr_disabeld_code.php', {'g':g,'add_user_id':add_user_id,'company_id':company_id,'modal_table_name':modal_table_name,'id_name':id_name,'proccess_details_delete_disable':proccess_details_delete_disable,'proccess_details_en_delete_disable':proccess_details_en_delete_disable}, function(r) {
              //alert(r);
        if (r == 1) {
     //  alert("تمت العمليه بنجاح");
      alertify.error(message_success);
         // window.location.reload();
         $(".D"+i).css("background-color", "#ccc");
         $(".D"+i).fadeOut("slow");
       

               }
             });
             
      }else{
        return false;
      }
   
   //======================
}
else{
   // alert("Checkbox Is not checked");
    $('#user'+id).prop('checked', false);
     if(confirm(message_enabled)){
    
      //======================
      var add_user_id=$('#add_user_id').val();  
      var company_id=$('#company_id').val();
      var g = $(this).attr('data-id');
      var date_did = $("#date_did"+g).val();
  // alert(g);
          $.post('../modals/hr_enable_code.php', {'g':g,'add_user_id':add_user_id,'company_id':company_id,'modal_table_name':modal_table_name,'id_name':id_name,'proccess_details_enable':proccess_details_enable,'proccess_details_en_enable':proccess_details_en_enable}, function(r) {
             // alert(r);
        if (r == 1) {
     //  alert("تمت العمليه بنجاح");
   alertify.success(message_success);
         $(".D"+i).css("background-color", "#ccc");
         $(".D"+i).fadeOut("slow");
          window.location.reload();

               }
             });
             
      }else{
        return false;
      }
   
 }  //====================== 
    
}
    });
</script>
       
       
		
		
   <style>
.alert {
  text-align: center;
  padding: 10px;
  background: rgb(168, 240, 177);
  color: green;
  margin-bottom: 10px;
  display: none;
}
.alert3 {
  text-align: center;
  padding: 10px;
  background: rgb(168, 240, 177);
  color: green;
  margin-bottom: 10px;
  
}
.alert4 {
  text-align: center;
  padding: 10px;
  margin-bottom: 10px;
  border-color: #ebad30;
  font-size:18px;
}

</style>	
		
    </body>
</html>




