	<!-- Add Department Modal -->
    <div id="add_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">
                <?php 
                 if($lang=='ar'){$employy_connectsolf="ربط الموظفين بحسابات السلف";}else{$employy_connectsolf="Eonnect Employy with Advance Account";}
                ?>
								<h5 class="modal-title"><?php echo $employy_connectsolf; ?></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 clas="cmxform" id="signupForm" method="post" action="hr_connect_employ_Solfacocount.php" enctype="multipart/form-data" > 
					   <div class="form-group">
			<input type="hidden" name="add_user_id" id="add_user_id" readonly value="<?php echo $urow['user_id']; ?>">
           	<input type="hidden" name="user_id_top_manager" id="user_id_top_manager" readonly value="<?php echo $user_id_top_manager; ?>">
           	 <input type="hidden" name="company_id" id="company_id" readonly value="<?php echo $company_id; ?>">
           	  <input type="hidden" name="system_id" id="system_id" readonly value="<?php echo $main_system_id; ?>"> 

           <input type="hidden" name="link_lang" id="link_lang" readonly value="<?php echo $link_lang; ?>">  
        <input type="hidden" name="lang" id="lang" readonly value="<?php echo $lang; ?>"> 
		   	<input type="hidden" name="messag_add" id="messag_add" readonly value="<?php echo $messag_add; ?>"> 
		   	
		   	 
		   

		   	 </div>

	   <?php
      function GetSeriaotherr() {	
		$strings = '123456789';	
		$stringLength = strlen($strings);
		$newStrings = '';
		for ($i = 0; $i < 6; $i++) {
			$newStrings .= $strings[rand(0, $stringLength - 1)];
		}
		return $newStrings;
	}
  ?> 		
			<input type="hidden" name="salf_id" id="salf_id" readonly value="<?php echo GetSeriaotherr(); ?>">						    
								    
				
                <div class="form-group"style="font-size:14px; font-weight:;">
                 <label style="float:;">
            
                </label>
          
                       </div>
                       
                  <div class="form-group">
				<lable><?php echo $the_companyr; ?></lable>
				<select clas="select" name="company_id_sel" id="company_id_sel" class="form-select"required="">
                 <!--option value=""><?php echo $select.$space.$the_companyr; ?> </option-->
                 
                 <option value="all_company"><?php echo $company_title; ?> </option>

                    <?php
                         if($urow['user_type']=="System_Manager"){
                       $sql_com="SELECT * FROM waseet_company_user_tbl GROUP BY company_id ";
                         }else{
                     if($company_id=='all_company'){   
                        $sql_com="SELECT * FROM waseet_company_user_tbl where deleted='0'AND stop='0'AND company_id IN ('$ids')GROUP BY company_id ";
                     }else{
                      $sql_com="SELECT * FROM waseet_company_user_tbl where deleted='0'AND stop='0'AND company_id='$company_id' GROUP BY company_id ";
                     } 
                         }
                        $result_com = $conn->query($sql_com);
                        if ($result_com->num_rows > 0) {
                        while($row_com = $result_com->fetch_assoc()) {
                            
                        $sql_com1="SELECT * FROM main_company_tbl where deleted='0'AND  company_id='".$row_com['company_id']."' ";
                        $result_com1 = $conn->query($sql_com1);
                        if ($result_com1->num_rows > 0) {
                        while($row_com1 = $result_com1->fetch_assoc()) {
                          //  echo $row_com1['company_name_ar'];
                            if($lang=='ar'){$name_ar2=$row_com1['company_name_ar'];}else{$name_ar2=$row_com1['company_name_en'];}        
                            //  echo $name_ar2;
                          ?>
                   <option value="<?php echo $row_com1['company_id']; ?>"><?php echo $name_ar2; ?> </option>
					<?php  }} }}  ?>	
					</select>
					</div>
          <?php  
					if($lang=='ar'){$employ_name="اسم الموظف";}else{$employ_name="employ_name";}
          if($lang=='ar'){$account="الحساب";}else{$account="account";}
          if($lang=='ar'){$accounttype="نوع الحساب";}else{$accounttype="account type";}
          if($lang=='ar'){$salff="سلف";}else{$salff="Advance";}
          if($lang=='ar'){$auhd="عهد";}else{$auhd="Covenant";}
          ?>
				<div class="form-group"style="font-size:14px; font-weight:;">
                <label style="float:;">
                <?php echo $employ_name; ?>
                </label>                                          
                 
                <select name="employ_id" id="employ_id" class="form-control"style="font-size:14px; font-weight:bold;" required="">
                <option>....</option>
                </select>
                </div>

                <div class="form-group"style="font-size:14px; font-weight:;">
                <label style="float:;">
                <?php echo $accounttype; ?>
                </label>                                          
                 
                <select name="account_type" id="account_type" class="form-control"style="font-size:14px; font-weight:bold;" required="">
                <option value="">....</option>
                <option value="salf"><?php echo $salff;?></option>
                <option value="salf"><?php echo $auhd;?></option>
                </select>
                </div>

                <div class="form-group"style="font-size:14px; font-weight:;">
                <label style="float:;">
                <?php echo $account; ?>
                </label>                                          
                 
                <select name="account_number" id="account_number" class="form-control"style="font-size:14px; font-weight:bold;" required="">
                <option>....</option>
                </select>
                </div>
                		
						<div class="modal-footer ">
					    <input type="submit" name="sav_btn" id="sav_btn" style="display:non;" class="btn btn-primary me-2" value="<?php echo $save; ?>">
						<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php echo $cancel; ?></button>
					</div>		
								
								
								</form>
							</div>
						</div>
					</div>
				</div>
				<!-- /Add Department Modal -->
                <script src="../../assets/js/jquery-3.6.0.min.js"></script>
				<script>
    $("#company_id_sel").change(function(){
       
var company_id_sel = $("#company_id_sel").val(); 
var lang = $("#lang").val();
//عرض الموظفين
$.ajax({
    type: "POST",
    url: "hr_employ_for_company_v.php",
    data: {
      company_id_sel:company_id_sel,lang:lang				
    },
    success: function(data) {
       $("#employ_id").html(data);
    },
    error:function(data){
        
       alert(data); //===Show Error Message====
    }
    }); 
// عرض الحسابات
/*$.ajax({
    type: "POST",
    url: "hr_account_for_company_v.php",
    data: {
      company_id_sel:company_id_sel,lang:lang				
    },
    success: function(data) {
       $("#account_number").html(data);
    },
    error:function(data){
        
       alert(data); //===Show Error Message====
    }
    });*/
  });
    </script>
<script>
    $("#account_type").change(function(){
  
// عرض الحسابات
var company_id_sel = $("#company_id_sel").val(); 
var lang = $("#lang").val();
var account_type = $("#account_type").val(); 
alert(account_type);

$.ajax({
    type: "POST",
    url: "hr_account_for_company_v.php",
    data: {
      company_id_sel:company_id_sel,lang:lang,account_type:account_type			
    },
    success: function(data) {
       $("#account_number").html(data);
    },
    error:function(data){
        
       alert(data); //===Show Error Message====
    }
    });
  });
    </script>				
				
				
				