<?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 "كشف الحضور والانصراف المؤكد" ; ?></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 "كشف الحضور والانصراف المؤكد"; ?></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; ?>">
           
					    
	<div class="card">
             <div class="card-body"> 
             <div class="row"> 			    
			 <ul class="nav nav-tabs nav-tabs-solid nav-justified">
			<li class="nav-item"><a class="nav-link a" href="hr_attendance_reportttgz.php?lang=<?php echo $lang; ?>&company_id=<?php echo $company_id; ?>" id="active_employ">الكشوفات قبل الإعتماد</a></li>
			<li class="nav-item"><a class="nav-link a active" href="approved_statements.php?lang=<?php echo $lang; ?>&company_id=<?php echo $company_id; ?>" id="inactive_employ">الكشوفات المعتمده</a></li>
		    </ul> </div> </div> </div>		
					
					
              
				 <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);
                   $ids_dates = join("','",$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>
                                            <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_hr_attendance_report==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'   group by user_id 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'   group by user_id 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'  group by user_id ORDER BY `waseet_company_user_tbl`.`crateddate_time` DESC";  
                   }
                    
                   $result_cw = $conn->query($sql_cw);
                   if ($result_cw->num_rows > 0) {
                    while($row_cw = $result_cw->fetch_assoc()) {
                       

                        $sql_taked="SELECT * FROM hr_takeed_hodor_ensraf_tbl where (date_from in ('$ids_dates') or date_to in ('$ids_dates') ) and employ_id='".$row_cw['user_id']."' group by employ_id ";
                        $result_taked = $conn->query($sql_taked);
                         if ($result_taked->num_rows > 0) {
                          while($row_taked = $result_taked->fetch_assoc()) { 
                            $employ_id_taked = $row_taked["employ_id"];
                           //echo $employ_id_taked;
                         
                  
                    $sql_emp="SELECT * FROM hr_employ_tbl where  employ_id='$employ_id_taked' and  employ_stat='active_employ' 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"]; 
                          $em_id = $row_emp['employ_id'];
                          $em_company = $row_emp['company_id'];
                          $em_dept = $row_emp['dept_id'];
                          $em_job = $row_emp['job_id'];
                          $em_id_num = $row_emp['id_num'];
                          $salary = $row_emp["basic_salary"]+$row_emp["housing_allowance"]+$row_emp["transportation_allowance"]+$row_emp["other_allowances"]+$row_emp["other_allowances_tow"];
                          ?>
                          <?php  }}?>
									  
										<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='".$em_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='".$em_company."' ";
                                             $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='".$em_dept."' 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='".$em_job."' 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 $em_id_num; ?></small>
								</td>
								
								
									<td><?php 
                                    $sql_takedd="SELECT * FROM hr_takeed_hodor_ensraf_tbl where (date_from in ('$ids_dates') or date_to in ('$ids_dates') ) and employ_id='".$row_cw['user_id']."' group by shift_id ";
                                    $result_takedd = $conn->query($sql_takedd);
                                     if ($result_takedd->num_rows > 0) {
                                      while($row_takedd = $result_takedd->fetch_assoc()) {

                                        $sql_shift="SELECT * FROM hr_shift_tbl where shift_id='".$row_takedd["shift_id"]."' ";
                                        $result_shift = $conn->query($sql_shift);
                                         if ($result_shift->num_rows > 0) {
                                          while($row_shift = $result_shift->fetch_assoc()) {
                                             
                                        $min_start_time=$row_shift['min_start_time'];
                                        $start_time=$row_shift['start_time'];
                                         $max_start_time=$row_shift['max_start_time'];
                                         
                                          $min_end_time=$row_shift['min_end_time'];
                                          $end_time=$row_shift['end_time'];
                                          $max_end_time=$row_shift['max_end_time'];

                                          $number_hours = $row_shift['number_hours']; 
                                            if($lang=='ar'){$shift_name=$row_shift["shift_name_ar"];}else{$shift_name=$row_shift["shift_name_en"];}
                                            ?>
                                        <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>
                                            <?php
                                          }}
                                      }}
                                    ?></td> 
                                 
                                    <!--td>
                                    <?php 
                                    $sum_add_hours_hodoor = 0;
                                    $sum_add_hours_shift = 0;
                                    $sum_add_hours_khasm = 0;
                                    $sum_khasem_from_salary = 0;
                                    $sql_clac="SELECT * FROM hr_takeed_hodor_ensraf_tbl where (date_from in ('$ids_dates') or date_to in ('$ids_dates') ) and employ_id='".$row_cw['user_id']."'";
                                    $result_calc = $conn->query($sql_clac);
                                     if ($result_calc->num_rows > 0) {
                                      while($row_clac = $result_calc->fetch_assoc()) {
                                        
                                        $sum_add_hours_hodoor+= $row_clac["add_hours_hodoor"];
                                        $sum_add_hours_shift+= $row_clac["add_hours_shift"];
                                        $sum_add_hours_khasm+= $row_clac["add_hours_khasm"];
                                        $sum_khasem_from_salary+= $row_clac["khasem_from_salary"];
                                      }}
                                    ?>  
                                    <?php echo "عدد ساعات الحضور : ".round($sum_add_hours_hodoor,2)."</br>";?>
                                    <?php echo "عدد ساعات الشفت : ".round($sum_add_hours_shift,2)."</br>";?>
                                    <?php echo "ساعات الخصم".round($sum_add_hours_khasm,2)."</br>";?>
                                    <?php echo "الخصم من الراتب : ".round($sum_khasem_from_salary,2)."</br>";?>
                                    </td-->
                                    
                                    <td><small style="font-size:12px;"><?php echo $Total_attendance_hours; ?>/<?php 
                                           echo round($sum_add_hours_hodoor,2);
                                           ?></small><br>
                                           
                                           <small style="font-size:12px;"><?php echo $Total_shift_hours; ?>/<?php
                                           echo $sum_add_hours_shift."</br>";
                                           //echo $num_dayss."/".$number_hours;
                                           ?></small>
                                          
                                           <small style="font-size:12px;" class="text-danger"><?php echo $Total_discount_hours; ?>/<?php
                                           ?>
                                           <?php 
                                           echo round($sum_add_hours_khasm,2);
                                           ?>
                                           </small>

                                           </td>
                                    
                                    
                                     <td>
                                     <small style="font-size:12px;"><?php echo $Total_salary; ?>/
                                    <?php echo round($row_taked["sum_salary"],2); ?>
                                    </small> <br> 
                                    
                                     <small style="font-size:12px;" class="text-danger"><?php echo $Cut_from_salary; ?>
                                     <?php echo round($sum_khasem_from_salary,2); ?>
                                     </small>
                                     
                                     
                                      <br>
                                       <small style="font-size:12px;"><?php echo $remainder_of_the_salary; ?>/
                                           <?php //echo round($row_taked["rest_sallary"],2); ?>
                                           <?php
                                            $rest_sallary = $salary - $sum_khasem_from_salary;
                                            echo round($rest_sallary,2);
                                            ?>
                                            </small>
                                            
                                          </td>
                                    
                                   <td>
                                    <?php
                                   $sql_date="SELECT * FROM hr_takeed_hodor_ensraf_tbl where (date_from in ('$ids_dates') or date_to in ('$ids_dates') ) and employ_id='".$row_cw['user_id']."'";
                                    $result_date = $conn->query($sql_date);
                                     if ($result_date->num_rows > 0) {
                                      while($row_date = $result_date->fetch_assoc()) {
                                       ?>
                          <small style="font-size:12px;" clas="text-danger" dir="ltr">  <?php echo $row_date["date_from"]." - ".$row_date["date_to"]."</br>"; ?>   </small>
                                        
                                    <?php  }}
                                     // print_r($taked_dates);
                                      ?>
                                   </td>
                                        </tr>
                                       
                                        <?php }} ?>
								<?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>




