<?php include("../secure.php"); ?>
<?php 
if(isset($_GET["btn_ard"])){
$date_from = $_GET["date_from"];
$date_to = $_GET["date_to"];
$date_from1 = date("Y-m-d", strtotime($date_from));
$date_to1 = date("Y-m-d", strtotime($date_to));
$company_id = $_GET["company_id"];
$lang=$_GET["lang"];
}
?>
<!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">
		
		<!-- 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">
                                <?php 
                                if($lang=='ar'){$employy_solf="سلف الموظفين";}else{$employy_solf="Employee Advance";}
                                if($lang=='ar'){$employy_connectsolf="ربط الموظفين بحسابات السلف";}else{$employy_connectsolf="Connect Employy with Advance Account";}
                                ?>
								<h3 class="page-title"><?php echo $employy_solf; ?></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 $employy_solf; ?></li>
								</ul>
							</div>
							
						</div>
					</div>
					
					<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="col-md-12">
							<div>
							    <div class="table-responsive">
                                <div class="card-header" style="background-color:hsla(250,100%,75%,0.1);">
					<h3 class="card-title">الحوالات البنكيه</h3>
					</div>
                                <div class="row">
                                <?php 
 include("dbConfig.php");
 $doc_number = $_GET["doc_number"];
 $series_number = $_GET["series_number"];
 $document_date = $_GET["document_date"];
 $sql_c1 = "SELECT * FROM connect_bank_process_to_account_tb WHERE constraint_num='$doc_number' and proccess='$series_number' and doc_date='$document_date'";
 $result_c1 = $conn->query($sql_c1);
 if ($result_c1->num_rows > 0) {
    while($row_ci = $result_c1->fetch_assoc()) {
        $sql_c2 = "SELECT * FROM bank_operation_tb WHERE id='".$row_ci["p_id"]."'";
 $result_c2 = $conn->query($sql_c2);
 
 if ($result_c2->num_rows > 0) {
    while($row_c2 = $result_c2->fetch_assoc()) {
 ?>
            <div class="col-md-4 d-flex">
                <div class="card flex-fill bg-white">
                   
                    <div class="card-body">
                                                                         
                        <iframe width="100%" height="400" style="border:1px solid black;" src="../hr_files/<?php echo $row_c2["attachement"];?>"></iframe>
                     
                    </div>
                </div>
            </div>   
		<?php }}}}?>
							</div>
						</div>
                        <?php 
$sql_connect_form = "SELECT * FROM connect_forms_to_account_tb WHERE constraint_num='$doc_number' and proccess='$series_number'";
$result_connect_form = $conn->query($sql_connect_form);
if ($result_connect_form->num_rows > 0) {
   $row_connect_form = $result_connect_form->fetch_assoc();
    $attach_id = $row_connect_form["attach_id"];
    //echo $attach_id."</br>";
   }
   $sql_form = "SELECT * FROM hr_forms_attachments_tbl WHERE attach_id='$attach_id'";
   $result_form = $conn->query($sql_form);
   if ($result_form->num_rows > 0) {
      $row_form = $result_form->fetch_assoc();
       $attach_link = $row_form["attach_link"];
       $s_n = $row_form["s_n"];
       //echo $attach_link;
       $array_attach_link = explode(",", $attach_link);
      }
?>
                        <div class="table-responsive">
                                <div class="card-header" style="background-color:hsla(250,100%,75%,0.1);">
					<h3 class="card-title">النموذج المرتبط بالقيد <?php echo $s_n;?></h3>
					</div>
                                <div class="row">
                                
<?php foreach ($array_attach_link as $value) { ?>
            <div class="col-md-4 d-flex">
                <div class="card flex-fill bg-white">
                   
                    <div class="card-body">
                                                                         
                        <iframe width="100%" height="400" style="border:1px solid black;" src="../hr_files/<?php echo $value;?>"></iframe>
                     
                    </div>
                </div>
            </div>   
		<?php } ?>
        <?php 
        $c = 0;
$sql_connect_masrof= "SELECT * FROM connect_car_to_masrof_tb WHERE constraint_num='$doc_number' and proccess='$series_number' and doc_date='$document_date'";
$result_connect_masrof = $conn->query($sql_connect_masrof);
if ($result_connect_masrof->num_rows > 0) {
   $row_connect_masrof = $result_connect_masrof->fetch_assoc();
   $c++;
   $copy_invoice = $row_form["copy_invoice"];
   $s_n = $row_form["s_n"];
   //echo $attach_link;
   $array_copy_invoice = explode(",", $copy_invoice);
   }
   ?>
   <?php if($c>0){?>
        <div class="table-responsive">
                                <div class="card-header" style="background-color:hsla(250,100%,75%,0.1);">
					<h3 class="card-title">صورة المصروف </h3>
					</div>
                                <div class="row">
                                
<?php foreach ($array_copy_invoice as $valuee) { ?>
            <div class="col-md-4 d-flex">
                <div class="card flex-fill bg-white">
                   
                    <div class="card-body">
                                                                         
                        <iframe width="100%" height="400" style="border:1px solid black;" src="../hr_files/<?php echo $valuee;?>"></iframe>
                     
                    </div>
                </div>
            </div>   
		<?php } ?>
							</div>
						</div>
<?php } ?>
					</div>
                </div>
            </div>
            </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>

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




