<?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>Dept - 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">
        
        <!-- Select2 CSS -->
		<link rel="stylesheet" href="../../assets/css/select2.min.css">
			<!-- Datetimepicker CSS -->
		<link rel="stylesheet" href="../../assets/css/bootstrap-datetimepicker.min.css">
		
		<!-- Datatable CSS -->
		<link rel="stylesheet" href="../../assets/css/dataTables.bootstrap4.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_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 $Attendance_Report; ?></li>
								</ul>
							</div>
							<!--div class="col-auto float-end ms-auto">
							 <?php // include("hr_add_holidays_modal.php");?>
							 <?php 
							 if(($urow['user_type']=='Top_Manager' or $urow['user_type']=='System_Manager')or($hr_add_dept==1)){ ?>
								<a href="#" class="btn add-btn" data-bs-toggle="modal" data-bs-target="#add_department"><i class="fa fa-plus"></i><?php  echo $Add_a_public_holiday; ?></a>
							<?php }else{ ?>
							<a href="#" class="btn add-btn up_add" ><i class="fa fa-plus"></i><?php echo $add_dept; ?><?php  echo $hr_add_dept; ?></a>
							<?php }  ?>
							</div-->
						</div>
					</div>
					<!-- /Page Header -->
					
			
					
					<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='holidays_waseet_tbl';
              
                $id_name='holidays_waseet';
                  $proccess_details_delete='حذف العطله رقم '.$modal_id;
                   $proccess_details_en_delete='Delete Holiday Number'.$modal_id;
                  $proccess_details_delete_enable='تنشيط العطله رقم '.$modal_id;
                   $proccess_details_en_delete_enable='Enable Holiday Number'.$modal_id;
                  $proccess_details_delete_disable='الغاء تنشيط العطله رقم '.$modal_id;
                $proccess_details_en_delete_disable='Disable Holiday Number'.$modal_id;
               
                $proccess_details_enable=' تنشيط القسم رقم '.$modal_id;
                 $proccess_details_en_enable='Enable Holiday 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; ?>">
           
					    
				
					
					
              
				 <form  action="" method="post" >
				<div class="row filter-row">
			
			     
						<!--div class="col-sm-6 col-md-3">  
							<div class="form-group form-focus">
								<input type="text" class="form-control floating">
								<label class="focus-label">Employee Name</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">
								<!--select class="form-select form-select-lg mb-3" clas="form-select"> 
									<option data-select2-id="select2-data-3-8zq7">-</option>
									<option data-select2-id="select2-data-13-n8gh"><?php echo $Jan; ?>1</option>
									<option data-select2-id="select2-data-14-vun9"><?php echo $Feb; ?>2</option>
									<option data-select2-id="select2-data-15-djxi"><?php echo $Mar; ?>3</option>
									<option data-select2-id="select2-data-16-11zw"><?php echo $Apr; ?>4</option>
									<option data-select2-id="select2-data-17-8rd8"><?php echo $May; ?>5</option>
									<option data-select2-id="select2-data-18-arzt"><?php echo $Jun; ?>6</option>
									<option data-select2-id="select2-data-19-70p6"><?php echo $Jul; ?>7</option>
									<option data-select2-id="select2-data-20-tudi"><?php echo $Aug; ?>8</option>
									<option data-select2-id="select2-data-21-lh8a"><?php echo $Sep; ?>9</option>
									<option data-select2-id="select2-data-22-8nmi"><?php echo $Oct; ?>10</option>
									<option data-select2-id="select2-data-23-jczn"><?php echo $Nov; ?>11</option>
									<option data-select2-id="select2-data-24-ua83"><?php echo $Dec; ?>12</option>
								</select-->
						<input type="date" value="" name="date_from" id="date_from" class="form-control" style="font-size:14px; font-weight:bold;" >
								
									<label class="focus-label"><?php echo $Select_Month; ?></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">
								<!--select class="form-select form-select-lg mb-3" clas="form-select"  clas="select floating select2-hidden-accessible" data-select2-id="select2-data-4-gtdo" tabindex="-1" aria-hidden="true"> 
									<option value="" data-select2-id="select2-data-26-hyng">-</option>
									<option value="2023" data-select2-id="select2-data-6-yzwj">2023</option>
									<option value="2024" data-select2-id="select2-data-27-m25i">2024</option>
									<option value="2025" data-select2-id="select2-data-28-bswq">2025</option>
									<option value="2026" data-select2-id="select2-data-29-6avq">2026</option>
									<option value="2027" data-select2-id="select2-data-30-rp22">2027</option>
								</select-->
								<label class="focus-label"><?php echo $Select_Year; ?></label>
							
							<input type="date" value="" name="date_to" id="date_to" class="form-control" style="font-size:14px; font-weight:bold;" >

							</div>
						</div>
						
						
						
	<?php 
	 $date_from=$_POST['date_from']; // echo $date_from; 
	 $date_to=$_POST['date_to'];     //echo $date_to;
	 
	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>
                    <?php 
                   
                    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);
                    ?>
            
             <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>        
                    
                    
          <div class="btn-toolbar">
			  	<div class="btn-group btn-group-lg">
			  	                 <a class="pdf-link" style="margin-left: 1rem!important;" data-bs-toggle="tooltip" data-bs-placement="top" title="" data-bs-original-title="pdf" aria-label="pdf"><img src="../../assets/img/icons/pdf.svg" alt="img"></a>
                            
                              <a class="export-link" style="margin-left: 1rem!important;" href="export_hr_employees.php?lang=ar&amp;company_id=all_company&amp;employ_stat=active_employ" target="_new" data-bs-toggle="tooltip" data-bs-placement="top" title="" data-bs-original-title="excel" aria-label="excel"><img src="../../assets/img/icons/excel.svg" alt="img" id="export"></a>
             	              	 
             	             	<a class="print-link" style="margin-left: 1rem!important;" href="print_hr_employees.php?lang=ar&amp;company_id=all_company&amp;employ_stat=active_employ" target="_new" data-bs-toggle="tooltip" data-bs-placement="top" title="" data-bs-original-title="print" aria-label="print"><img src="../../assets/img/icons/printer.svg" alt="img"></a>
                                </div>
                </div>          
                    
                    <?php $num_dayss = count($dates);?>
				<div class="row">
			    <div class="col-md-12">
				<div class="table-responsive">
								<table clas="table table-striped custom-table table-nowrap mb-0" class="table  datanew table-striped mb-0">
									<thead>
										<tr>
											<th><?php echo $employee_name; ?></th>
											<th><?php echo $Employee_data; ?></th>
											<th><?php echo $Shift_Details; ?></th>
                                            <?php foreach ($dates as $dates_value) {
                                                $day_num = date('d', strtotime($dates_value));
                                                ?>
                                                <th><?php echo $day_num;?></th>
                                           <?php  }?>
											<th>عدد ساعات الحضور</th>
                                            <th>اجمالي عدد ساعات الشفت</th>
                                            <th>عدد ساعات الخصم</th>
                                            <th>الراتب</th>
                                            <th>الخصم من الراتب</th>
                                            <th>المتبقي</th>
										</tr>
									</thead>
									<tbody>
                                   <?php //echo count($dates);
                                   //print_r($dates);
                                   ?>
                                   <?php if(count($dates)==1 & $dates[0]=="1970-01-01"){

                                   }else{ ?>
									  <?php 
				 if(($urow['user_type']=='Top_Manager' or $urow['user_type']=='System_Manager')or($view_employees_ul==1)){
					if($company_id=='all_company'){
                   $sql_cw="SELECT * FROM waseet_company_user_tbl where system_id='2222' and company_id IN ('$ids') AND company_id!='' AND deleted='0' ORDER BY `waseet_company_user_tbl`.`crateddate_time` DESC";
                    }else{
                   $sql_cw="SELECT * FROM waseet_company_user_tbl where system_id='2222' and company_id='$company_id'AND company_id!='' AND deleted='0' ORDER BY `waseet_company_user_tbl`.`crateddate_time` DESC";
                    }
                    
                   }else{
                      $sql_cw="SELECT * FROM waseet_company_user_tbl where system_id='2222' and user_id='".$urow['user_id']."'AND company_id!='' AND deleted='0' 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()) {
                  
                  
                     $sql_ws="SELECT * FROM hr_waseet_employ_shift_tbl where company_id='".$row_cw['company_id']."' AND stop='0' 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 employ_id='".$row_cw['user_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'];}
                          $employee_number_fingerprint = $row_emp["employee_number_fingerprint"];
									    ?>
										<tr>
											<td>
							<h2 class="table-avatar">
							
							<a class="avatar" clas="avatar avatar-xs" href="profile.html">
							<?php
                          $sql_ico="SELECT * FROM hr_employ_attachments_tbl where employ_id='".$row_emp['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>
							<a href="profile.html"><?php echo $employ_name; ?></a>
						  
							  </h2>
											</td>
											
								<td>
								 <small class="text-muted" style="font-size:12px;">
									 <?php
                                             $sql_cy="SELECT * FROM main_company_tbl where company_id='".$row_emp['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_emp['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_emp['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_emp['id_num']; ?></small>
								</td>
								
								
									<td>
									  <?php 
									   $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'];

                                          $sat = $row_sh['sat'];
                                          $sun = $row_sh['sun'];
                                          $mon = $row_sh['mon'];
                                          $tue = $row_sh['tue'];
                                          $we = $row_sh['we'];
                                          $thu = $row_sh['thu'];
                                          $fr = $row_sh['fr'];

                                          $flexible_working = $row_sh['flexible_working'];
                                          $hodoor_ghyab = $row_sh['hodoor_ghyab'];
                                         
                                       }}   
                                           
									  ?>
									  <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><br>
                                       <small style="font-size:12px;"><?php echo $number_hours;  ?></small><br>
									</td>
                                  <?php $sum_all_attend_min = 0;?>
                                    <?php foreach ($dates as $dates_value) {
                                                $day_num = date('N', strtotime($dates_value));
                                                $day_name = date('l', strtotime($dates_value));
                                                if($flexible_working==1){  ?>
                                                       
                                                    <td>
                                                       <?php //echo "وقت الحضور".":".$row_add["hodor_time"]."</br>";?>
                                                        <?php //echo "وقت الانصراف".":".$row_add["ensraf_time"]."</br>";?>
                                                        <?php 
                                                    
                                                    $Number_of_attendance_minuts = $number_hours * 60;
                                                    $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                    ?>
                                                   <?php echo "----";?>
                                                    </td>
                                               <?php }elseif($hodoor_ghyab==1){ ?>
                                                <td>
                                                       <?php //echo "وقت الحضور".":".$row_add["hodor_time"]."</br>";?>
                                                        <?php //echo "وقت الانصراف".":".$row_add["ensraf_time"]."</br>";?>
                                                        <?php 
                                                    
                                                    $Number_of_attendance_minuts = $number_hours * 60;
                                                    $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                    ?>
                                                   <?php echo "----";?>
                                                    </td>
                                               <?php }else{
                                               if($day_name=="Saturday" & $sat==0){ ?>
                                               <td>
                                               <?php  
                                               $Number_of_attendance_minuts = $number_hours * 60;
                                                             $takher = 0;
                                                             $inseraf_befor = 0;
                                                             echo "off"; 
                                                             $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                              ?>
                                            </td>
                                              <?php }elseif($day_name=="Sunday" & $sun==0){ ?>
                                                <td><?php  
                                               $Number_of_attendance_minuts = $number_hours * 60;
                                                             $takher = 0;
                                                             $inseraf_befor = 0;
                                                             echo "off"; 
                                                             $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                              ?></td>
                                              <?php }elseif($day_name=="Monday" & $mon==0){ ?>
                                                <td><?php  
                                               $Number_of_attendance_minuts = $number_hours * 60;
                                                             $takher = 0;
                                                             $inseraf_befor = 0;
                                                             echo "off"; 
                                                             $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                              ?></td>
                                             <?php  }elseif($day_name=="Tuesday" & $tue==0){ ?>
                                                <td><?php  
                                               $Number_of_attendance_minuts = $number_hours * 60;
                                                             $takher = 0;
                                                             $inseraf_befor = 0;
                                                             echo "off"; 
                                                             $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                              ?></td>
                                             <?php  }elseif($day_name=="Wednesday" & $we==0){ ?>
                                                <td><?php  
                                               $Number_of_attendance_minuts = $number_hours * 60;
                                                             $takher = 0;
                                                             $inseraf_befor = 0;
                                                             echo "off"; 
                                                             $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                              ?></td>
                                             <?php  }elseif($day_name=="Thursday" & $thu==0){ ?>
                                                <td><?php  
                                               $Number_of_attendance_minuts = $number_hours * 60;
                                                             $takher = 0;
                                                             $inseraf_befor = 0;
                                                             echo "off"; 
                                                             $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                              ?></td>
                                             <?php }elseif($day_name=="Friday" & $fr==0){ ?>
                                                <td><?php  
                                               $Number_of_attendance_minuts = $number_hours * 60;
                                                             $takher = 0;
                                                             $inseraf_befor = 0;
                                                             echo "off"; 
                                                             $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                              ?></td>
                                             <?php }else{
                                                ?>
                                                <?php 
                                                $sql_add="SELECT * FROM hr_add_hodor_ensraf_tbl where hodor_ensraf_date='$dates_value' 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()) { ?>
                                                      <td>
                                                        <?php //echo $row_add["hodor_ensraf_stat"];?>
                                                      <?php //echo $row_add["hodor_ensraf_id"]."</br>";?>
                                                        <?php echo "وقت الحضور".":".$row_add["hodor_time"]."</br>";?>
                                                        <?php echo "وقت الانصراف".":".$row_add["ensraf_time"]."</br>";?>
                                                        <?php 
                                                        $start = strtotime($row_add["hodor_time"]);
                                                        $end = strtotime($row_add["ensraf_time"]);
                                                         
                                                        $Number_of_attendance_minuts = floor(($end - $start) / 60);
                                                        $Number_of_attendance_hours = floor((($end - $start) / 60)/60);
                                                        //echo $Number_of_attendance_minuts."</br>";
                                                        //echo $Number_of_attendance_hours."</br>";

                                                        $datetimee = new DateTime($row_add["hodor_time"]);
                                                        $datetime2e = new DateTime($row_add["ensraf_time"]);
                                                        $intervale = $datetimee->diff($datetime2e);
                                                        echo $intervale->format('%h')." ساعات ".$intervale->format('%i')." دقائق"."</br>";
                                                        ?>
                                                       

                                                        <?php 
                                                        // الغياب
                                                        if($row_add["hodor_ensraf_stat"]=="ghyab"){
                                                            $Number_of_attendance_minuts = 0;
                                                            $takher = 0;
                                                            $inseraf_befor = 0;
                                                            //echo $Number_of_attendance_minuts; 
                                                            // نهاية الغياب
                                                            echo "غياب";
                                                            $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                            ?>
                                                        <span class="first-off"><i class="fa fa-close text-danger"></i></span>
                                                        <?php }elseif($row_add["hodor_ensraf_stat"]=="exception_ghyab"){
                                                             $Number_of_attendance_minuts = $number_hours * 60;
                                                             $takher = 0;
                                                             $inseraf_befor = 0;
                                                             echo "إستثناء غياب"; 
                                                             $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                        }elseif($row_add["hodor_ensraf_stat"]=="waiting_employee_response"){
                                                        // مسائلة الغياب
                                                        $Number_of_attendance_minuts = 0;
                                                        $takher = 0;
                                                        $inseraf_befor = 0;
                                                       // echo $Number_of_attendance_minuts; 
                                                       echo "انتظار موافقة الموظف";
                                                        $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                    }elseif($row_add["hodor_ensraf_stat"]=="Answered_by_the_employee"){
                                                        $Number_of_attendance_minuts = 0;
                                                        $takher = 0;
                                                        $inseraf_befor = 0;
                                                        //echo $Number_of_attendance_minuts; 
                                                        echo "تم الرد من قبل الموظف";
                                                        $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                    }elseif($row_add["hodor_ensraf_stat"]=="Absence_was_approved"){
                                                        $Number_of_attendance_minuts = $number_hours * 60;
                                                        $takher = 0;
                                                        $inseraf_befor = 0;
                                                        $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                        echo "تاكيد استثناء الغياب";
                                                    }elseif($row_add["hodor_ensraf_stat"]=="Absence_was_rejected"){
                                                        $Number_of_attendance_minuts = 0;
                                                        $takher = 0;
                                                        $inseraf_befor = 0;
                                                        //echo $Number_of_attendance_minuts; 
                                                        echo "رفض الاستثناء من الغياب";
                                                        $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                    }elseif($row_add["hodor_ensraf_stat"]=="warning"){
                                                        // تمذار اول مره حضور بدون انصراف او العكس
                                                        $Number_of_attendance_minuts = $number_hours * 60;
                                                        $takher = 0;
                                                        $inseraf_befor = 0;
                                                        echo "انذار اول مره ";
                                                        $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                       }elseif($row_add["hodor_ensraf_stat"]=="cut_second_time"){
                                                        $Number_of_attendance_minuts = ($number_hours * 60)/2;
                                                        $takher = 0;
                                                        $inseraf_befor = 0;
                                                        $khasemIH = ($number_hours * 60)/2;
                                                        echo "ثاني مره خصم نص يوم ".$Number_of_attendance_minuts;
                                                        $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                       }elseif($row_add["hodor_ensraf_stat"]=="cut_third_time"){
                                                        $Number_of_attendance_minuts = ($number_hours * 60)/2;
                                                        $takher = 0;
                                                        $inseraf_befor = 0;
                                                        $khasemIH = ($number_hours * 60)/2;
                                                        echo "ثالث مره خصم نص يوم ".$Number_of_attendance_minuts;
                                                        $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                       }elseif($row_add["hodor_ensraf_stat"]=="referral"){
                                                        $Number_of_attendance_minuts = ($number_hours * 60)/2;
                                                        $takher = 0;
                                                        $inseraf_befor = 0;
                                                        $khasemIH = ($number_hours * 60)/2;
                                                       
                                                        echo "رابع مره احالة للتحقيق و خصم نص يوم ".$Number_of_attendance_minuts;
                                                        $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                       }elseif($row_add["hodor_ensraf_stat"]=="exception_cut_presence_without_l_or_o"){
                                                            $Number_of_attendance_minuts = $number_hours * 60;
                                                            $takher = 0;
                                                            $inseraf_befor = 0;
                                                            echo "إستثناء";
                                                            $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                        }elseif($row_add["hodor_ensraf_stat"]=="cut_presence_without_l_or_o"){
                                                            $Number_of_attendance_minuts = ($number_hours * 60)/2;
                                                        $takher = 0;
                                                        $inseraf_befor = 0;
                                                        $khasemIH = ($number_hours * 60)/2;
                                                       
                                                        $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                    }elseif($row_add["hodor_ensraf_stat"]=="approval_req_per"){
                                                           $sql_hr_rq="SELECT * FROM hr_request_permission_tbl where employ_id='".$row_emp['employ_id']."' and request_per_date='$dates_value' and request_per_stat='approval_req_per' ";
                                                              $result_hr_rq = $conn->query($sql_hr_rq);
                                                              if ($result_hr_rq->num_rows > 0) {
                                                                 while($row_hr_rq = $result_hr_rq->fetch_assoc()) {
                                                                    if($row_hr_rq["request_type"]=="Late"){
                                                                        $start1 = strtotime($start_time);
                                                                        $end1 = strtotime($row_add["ensraf_time"]);
                                                                        $Number_of_attendance_minuts = floor(($end1 - $start1) / 60);
                                                                        if($Number_of_attendance_minuts>($number_hours * 60)){
                                                                            $Number_of_attendance_minuts = ($number_hours * 60);
                                                                        }else{
                                                                            $Number_of_attendance_minuts = floor(($end - $start) / 60); 
                                                                        }
                                                                        $inseraf_befor = (strtotime($min_end_time) - strtotime($row_add["ensraf_time"])) / 60;
                                                                        $takher = 0;
                                                                        echo "موافقة اذن طلب تاخير";
                                                                        $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                                    }elseif($row_hr_rq["request_type"]=="leave_before"){
                                                                        $start = strtotime($row_add["hodor_time"]);
                                                                        $end = strtotime($end_time);
                                                                        $Number_of_attendance_minuts = floor(($end - $start) / 60);
                                                                        if($Number_of_attendance_minuts>($number_hours * 60)){
                                                                            $Number_of_attendance_minuts = ($number_hours * 60);
                                                                        }else{
                                                                            $Number_of_attendance_minuts = floor(($end - $start) / 60); 
                                                                        }
                                                                        $takher = (strtotime($row_add["hodor_time"]) - strtotime($max_start_time)) / 60;
                                                                        $inseraf_befor = 0;
                                                                        echo "موافقة اذن طلب انصراف";
                                                                        $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                                    }else{

                                                                    }
                                                                 }
                                                              }
                                                    }elseif($row_add["hodor_ensraf_stat"]=="1"){
                                                        if($row_add["hodor_time"]>$max_start_time && $row_add["ensraf_time"]<$min_end_time){
                                                            //تأخير وانصراف قبل انتهاء الدوام
                                                            $start_s = strtotime($row_add["hodor_time"]);
                                                            $end_s = strtotime($row_add["ensraf_time"]);
                                                            $Number_of_attendance_minuts = floor(($end_s - $start_s) / 60);
                                                            if($Number_of_attendance_minuts>($number_hours * 60)){
                                                                $Number_of_attendance_minuts = ($number_hours * 60);
                                                            }else{
                                                                $Number_of_attendance_minuts = floor(($end - $start) / 60); 
                                                            }
                                                            $takher = (strtotime($row_add["hodor_time"]) - strtotime($max_start_time)) / 60;
                                                            $inseraf_befor = (strtotime($end_time) - strtotime($row_add["ensraf_time"])) / 60;
                                                            //echo "تأخير وانصراف قبل انتهاء الدوام";
                                                            //echo "/  $Number_of_attendance_minuts"."</br>";
                                                            //echo "/  $takher"."</br>";
                                                            //echo "/  $inseraf_befor"."</br>";
                                                            $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                            ?>
                                                            <?php 
                                                            if($Number_of_attendance_minuts>($number_hours * 60)){
                                                              ?>
                                                              <i class="fa fa-check text-success"></i>
                                                              <?php 
                                                            }elseif($Number_of_attendance_minuts<($number_hours * 60)){
                                                                ?>
                                                                 <i class="fa fa-window-minimize text-warning" aria-hidden="true"></i>
                                                                <?php
                                                            }else{
                                                                ?>
                                                                <i class="fa fa-check text-success"></i>
                                                                <?php
                                                            }
                                                            ?>
                                                           
                                                          <?php 
                                                        }elseif($row_add["hodor_time"]>$max_start_time ){
                                                            //تاخير
                                                            $start_s = strtotime($row_add["hodor_time"]);
                                                            $end_s = strtotime($row_add["ensraf_time"]);
                                                            $Number_of_attendance_minuts = floor(($end_s - $start_s) / 60);
                                                            if($Number_of_attendance_minuts>($number_hours * 60)){
                                                                $Number_of_attendance_minuts = ($number_hours * 60);
                                                            }else{
                                                                $Number_of_attendance_minuts = floor(($end - $start) / 60); 
                                                            }
                                                            $takher = (strtotime($row_add["hodor_time"]) - strtotime($max_start_time)) / 60;
                                                            $inseraf_befor = 0;
                                                            //echo "تاخير";
                                                            //echo "/  $Number_of_attendance_minuts"."</br>";
                                                            //echo "/  $takher"."</br>";
                                                            //echo "/  $inseraf_befor"."</br>";
                                                            $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                            ?>
                                                            <?php 
                                                            if($Number_of_attendance_minuts>($number_hours * 60)){
                                                              ?>
                                                              <i class="fa fa-check text-success"></i>
                                                              <?php 
                                                            }elseif($Number_of_attendance_minuts<($number_hours * 60)){
                                                                ?>
                                                                 <i class="fa fa-window-minimize text-warning" aria-hidden="true"></i>
                                                                <?php
                                                            }else{
                                                                ?>
                                                                <i class="fa fa-check text-success"></i>
                                                                <?php
                                                            }
                                                            ?>
                                                            <?php 
                                                        }elseif($row_add["ensraf_time"]<$min_end_time ){
                                                            //انصراف قبل انتهاء الدوام
                                                            $start_s = strtotime($row_add["hodor_time"]);
                                                            $end_s = strtotime($row_add["ensraf_time"]);
                                                            $Number_of_attendance_minuts = floor(($end_s - $start_s) / 60);
                                                            if($Number_of_attendance_minuts>($number_hours * 60)){
                                                                $Number_of_attendance_minuts = ($number_hours * 60);
                                                            }else{
                                                                $Number_of_attendance_minuts = floor(($end - $start) / 60); 
                                                            }
                                                            $takher = 0;
                                                            $inseraf_befor = (strtotime($end_time) - strtotime($row_add["ensraf_time"])) / 60;
                                                            //echo "انصراف قبل انتهاء الدوام";
                                                            //echo "/  $Number_of_attendance_minuts"."</br>";
                                                            //echo "/  $takher"."</br>";
                                                            //echo "/  $inseraf_befor"."</br>";
                                                            $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                            ?>
                                                           <?php 
                                                            if($Number_of_attendance_minuts>($number_hours * 60)){
                                                              ?>
                                                              <i class="fa fa-check text-success"></i>
                                                              <?php 
                                                            }elseif($Number_of_attendance_minuts<($number_hours * 60)){
                                                                ?>
                                                                 <i class="fa fa-window-minimize text-warning" aria-hidden="true"></i>
                                                                <?php
                                                            }else{
                                                                ?>
                                                                <i class="fa fa-check text-success"></i>
                                                                <?php
                                                            }
                                                            ?>
                                                            <?php
                                                        }else{
                                                            //echo "1 لا يوجد اجراء";
                                                            $start_s = strtotime($row_add["hodor_time"]);
                                                            $end_s = strtotime($row_add["ensraf_time"]);
                                                            $Number_of_attendance_minuts = floor(($end_s - $start_s) / 60);
                                                            if($Number_of_attendance_minuts>($number_hours * 60)){
                                                                $Number_of_attendance_minuts = ($number_hours * 60);
                                                            }else{
                                                                $Number_of_attendance_minuts = floor(($end - $start) / 60); 
                                                            }
                                                            $takher = 0;
                                                            $inseraf_befor = 0;
                                                            //echo "/  $Number_of_attendance_minuts"."</br>";
                                                            //echo "/  $takher"."</br>";
                                                            //echo "/  $inseraf_befor"."</br>";
                                                            $sum_all_attend_min =  $sum_all_attend_min +  $Number_of_attendance_minuts;
                                                            ?>
                                                            <?php 
                                                            if($Number_of_attendance_minuts>($number_hours * 60)){
                                                              ?>
                                                              <i class="fa fa-check text-success"></i>
                                                              <?php 
                                                            }elseif($Number_of_attendance_minuts<($number_hours * 60)){
                                                                ?>
                                                                 <i class="fa fa-window-minimize text-warning" aria-hidden="true"></i>
                                                                <?php
                                                            }else{
                                                                ?>
                                                                <i class="fa fa-check text-success"></i>
                                                                <?php
                                                            }
                                                            ?>
                                                       <?php }

                                                       }else{
                                                        //echo "الحاله".$row_add["hodor_ensraf_stat"]."لا يوجد اجراء";
                                                       } ?>
                                                    </td>
                                               <?php }}else{ ?>
                                                <?php ?>
                                                <td> <span class="first-off"><i class="fa fa-close text-danger"></i></span>
                                                <?php 
                                                $Number_of_attendance_minuts = 0;
                                                //echo $Number_of_attendance_minuts;
                                                ?>
                                                </td>
                                              <?php  } ?>
                                              <?php  } ?>
                                           <?php  }?>
                                           <?php  }?>
                                           <td><?php 
                                           echo $sum_all_attend_min;
                                           ?></td>
                                           <td><?php $all_shift_hours = ($num_dayss * $number_hours)*60;
                                           echo $all_shift_hours."</br>";
                                           //echo $num_dayss."/".$number_hours;
                                           ?></td>
                                           <td><?php $cal_diff_min = $all_shift_hours - $sum_all_attend_min;
                                           echo $cal_diff_min;
                                           ?></td>
                                           <td>
                                            <?php 
                                            $salary = $row_emp["basic_salary"]+$row_emp["housing_allowance"]+$row_emp["transportation_allowance"]+$row_emp["other_allowances"]+$row_emp["other_allowances_tow"];
                                            echo $salary;
                                            ?>
                                           </td>
                                           <td>
                                            <?php 
                                            if($number_hours==0){
                                                $khasem_from_salary = 0;
                                                echo $khasem_from_salary;
                                            }else{
                                            $salary_minut = (($salary/30)/$number_hours)/60;
                                            //echo $salary_minut;
                                            $khasem_from_salary = $cal_diff_min * $salary_minut;
                                            echo round($khasem_from_salary);
                                            }
                                            ?>
                                           </td>
                                           <td>
                                            <?php 
                                            $rest_sallary = $salary -$khasem_from_salary;
                                            echo round($rest_sallary); 
                                            ?>
                                           </td>
                                        </tr>
								<?php }} }}  }}?>
									<?php } ?>

									</tbody>
								</table>
							</div>
							</div>
							</div>
				
				
				  </div>
                	</div>
				<!-- /Page Content -->
				
				<!-- Attendance Modal -->
				<!-- Attendance Modal -->
				<div class="modal custom-modal fade" id="attendance_info" role="dialog">
					<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
						<div class="modal-content">
							<div class="modal-header">
								<h5 class="modal-title">Attendance Info</h5>
								<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
									<span aria-hidden="true">&times;</span>
								</button>
							</div>
							<div class="modal-body">
								<div class="row">
									<div class="col-md-6">
										<div class="card punch-status">
											<div class="card-body">
												<h5 class="card-title">Timesheet <small class="text-muted">11 Mar 2019</small></h5>
												<div class="punch-det">
													<h6>Punch In at</h6>
													<p>Wed, 11th Mar 2019 10.00 AM</p>
												</div>
												<div class="punch-info">
													<div class="punch-hours">
														<span>3.45 hrs</span>
													</div>
												</div>
												<div class="punch-det">
													<h6>Punch Out at</h6>
													<p>Wed, 20th Feb 2019 9.00 PM</p>
												</div>
												<div class="statistics">
													<div class="row">
														<div class="col-md-6 col-6 text-center">
															<div class="stats-box">
																<p>Break</p>
																<h6>1.21 hrs</h6>
															</div>
														</div>
														<div class="col-md-6 col-6 text-center">
															<div class="stats-box">
																<p>Overtime</p>
																<h6>3 hrs</h6>
															</div>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>
									<div class="col-md-6">
										<div class="card recent-activity">
											<div class="card-body">
												<h5 class="card-title">Activity</h5>
												<ul class="res-activity-list">
													<li>
														<p class="mb-0">Punch In at</p>
														<p class="res-activity-time">
															<i class="fa fa-clock-o"></i>
															10.00 AM.
														</p>
													</li>
													<li>
														<p class="mb-0">Punch Out at</p>
														<p class="res-activity-time">
															<i class="fa fa-clock-o"></i>
															11.00 AM.
														</p>
													</li>
													<li>
														<p class="mb-0">Punch In at</p>
														<p class="res-activity-time">
															<i class="fa fa-clock-o"></i>
															11.15 AM.
														</p>
													</li>
													<li>
														<p class="mb-0">Punch Out at</p>
														<p class="res-activity-time">
															<i class="fa fa-clock-o"></i>
															1.30 PM.
														</p>
													</li>
													<li>
														<p class="mb-0">Punch In at</p>
														<p class="res-activity-time">
															<i class="fa fa-clock-o"></i>
															2.00 PM.
														</p>
													</li>
													<li>
														<p class="mb-0">Punch Out at</p>
														<p class="res-activity-time">
															<i class="fa fa-clock-o"></i>
															7.30 PM.
														</p>
													</li>
												</ul>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!-- /Attendance Modal -->
				
				
				
				
				<!-- Edit Department Modal -->
				<div id="edit_department" class="modal custom-modal fade" role="dialog">
					<div class="modal-dialog modal-dialog-centered" role="document">
						<div class="modal-content">
							<div class="modal-header">
								<h5 class="modal-title">Edit Department</h5>
								<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
									<span aria-hidden="true">&times;</span>
								</button>
							</div>
							<div class="modal-body">
								<form>
									<div class="form-group">
										<label>Department Name <span class="text-danger">*</span></label>
										<input class="form-control" value="IT Management" type="text">
									</div>
									<div class="submit-section">
										<button class="btn btn-primary submit-btn">Save</button>
									</div>
								</form>
							</div>
						</div>
					</div>
				</div>
				<!-- /Edit Department Modal -->

				<!-- Delete Department Modal -->
				<!--div class="modal custom-modal fade" id="delete_department" role="dialog">
					<div class="modal-dialog modal-dialog-centered">
						<div class="modal-content">
							<div class="modal-body">
								<div class="form-header">
									<h3>Delete Department</h3>
									<p>Are you sure want to delete?</p>
								</div>
								<div class="modal-btn delete-action">
									<div class="row">
										<div class="col-6">
											<a href="javascript:void(0);" class="btn btn-primary continue-btn">Delete</a>
										</div>
										<div class="col-6">
											<a href="javascript:void(0);" data-bs-dismiss="modal" class="btn btn-primary cancel-btn">Cancel</a>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div-->
				<!-- /Delete Department Modal -->
				
				
				
				
            </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>

        <!-- 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>
      

		 <!-- Theme Settings JS -->
		<script src="../../assets/js/layout.js"></script>
		<script src="../../assets/js/theme-settings.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>
		
		
			 <!-- Theme Settings JS -->
	

		<script src="../../assets/js/greedynav.js"></script>
		<!-- Custom JS -->
		<!--script src="../../assets/js/app.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>
       	 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>




