<?php include("../secure.php"); ?>

<?php //include("../secure.php"); ?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
        <meta name="description" content="POS - Bootstrap Admin Template">
		<meta name="keywords" content="admin, estimates, bootstrap, business, corporate, creative, invoice, html5, responsive, Projects">
        <meta name="author" content="Dreamguys - Bootstrap Admin Template">
        <meta name="robots" content="noindex, nofollow">
        <title>إضافة تعريف التقارير</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 -->
		
	


			<div class="page-wrapper">
				<div class="content">
					<div class="page-header">
						<div class="page-title">
							<h4>إضافة تعريف التقارير</h4>
							<h4><a href="HrShowDifinition_Report.php?<?php echo $link_lang; ?>&company_id=<?php echo $company_id; ?>">عرض التعريفات</a></h4>
						</div>
					</div>
					<!-- /add -->
					<div class="card">
						<div class="card-body">
            <form clas="form-horizontal well" action="Add_report_Definitions_HR_code.php" method="post" name="upload_excel" enctype="multipart/form-data">
							<div class="row">
              <?php 
              function GetSeriaotherhr() {	
                $strings = '123456789';	
                $stringLength = strlen($strings);
                $newStrings = '';
                for ($i = 0; $i < 6; $i++) {
                    $newStrings .= $strings[rand(0, $stringLength - 1)];
                }
                return $newStrings;
            }
              ?>
              <input type="hidden" name="def_id" value="<?php echo GetSeriaotherhr();?>">
              <input type="hidden" name="company_idd" id="company_idd" readonly value="<?php echo $company_id; ?>">
              <input type="hidden" name="lang" id="lang" readonly value="<?php echo $link_lang; ?>">
                            <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']; ?>
           </div>
            <?php endif; ?>
           <?php unset($_SESSION['message']); ?></div>
           <div class="col-md-6 mb-3">
									<div class="form-group">
                  <label clas="col-form-label col-md-2" style="margin-bottom: 0px;">الشركه</label>
                  <select clas="select" name="company_id" id="company_id" class="form-control form-small select2" required="">
                                            <option value="">اختر شركه</option>
                    <?php 
                     if($company_id=='all_company'){
                        $sql_com1="SELECT * FROM main_company_tbl where deleted='0' AND company_id IN ('$ids')";
                    }else{
                        $sql_com1="SELECT * FROM main_company_tbl where deleted='0' AND company_id='$company_id' ";
                    }
                      
                        $result_com1 = $conn->query($sql_com1);
                        if ($result_com1->num_rows > 0) {
                        while($row_com1 = $result_com1->fetch_assoc()) {
                            $company_name = $row_com1["company_name_ar"];
                      
                              ?>
                                    <option value="<?php echo $row_com1["company_id"];?>"><?php echo $row_com1["company_name_ar"];?></option>
                                            <?php }}?>
                                            </select>
									</div>	
									</div> 
									<div class="col-md-6 mb-3" id="definition_c">
									<div class="form-group">
											<label clas="col-form-label col-md-2" style="margin-bottom: 0px;">التعريف</label>
											<input class="form-control" type="text" name="definition" id="definition" required="">
									</div>	
									</div>
                  
                  <div class="row" sty="background-color:hsla(250,100%,75%,0.1); border:1px solid #CCC;box-shadow:2px 2px 7px #F5F5F5;margin-bottom:40px;">                
                        	
                                    <table style="border-bottom:1px solid; width:%;margin-bottom:40px;">
                                    <thead>
                                <tr class="tr_style">
                                  <td> <button type="button" name="add" id="add<?php echo $row_cu['request_id'];?>" class="add" data-id='<?php echo $row_cu['request_id'];?>' clas="btn btn-success">+</button></td>
                                  <td></td>
                                  <td></td>
                                  <td></td>
                                </tr>
                                
                               
                            </thead>
                             <tbody id="dynamic_fieldfff<?php echo $row_cu['request_id'];?>" class="dynamic_fieldfff" style="border-bottom:1px solid;">
                            <tr id="row">
                            <td style="width:40%">
                            <div class="col-md-6 mb-3">
									                   <div class="form-group">
                                     <input type="hidden" name="hidden[]" value="0">
											<label clas="col-form-label col-md-2">رقم الحساب</label>
											
                                            <select clas="select" name="account_number0" id="account_number0" class="form-control form-small select2" required="">
                                            <option value="">اختر حساب </option>
                                           
                    <?php 
                    if($company_id=='all_company'){
                        $sql_cu="SELECT * FROM accounts_tbl where company_id IN ('$ids')";
                    }else{
                        $sql_cu="SELECT * FROM accounts_tbl where company_id='$company_id'";
                    }   
                    
                        $result_cu = $conn->query($sql_cu);
                        if ($result_cu->num_rows > 0) {
                          while($row_cu = $result_cu->fetch_assoc()) {
                            $sql_com1="SELECT * FROM main_company_tbl where deleted='0'AND  company_id='".$row_cu['company_id']."' ";
                        $result_com1 = $conn->query($sql_com1);
                        if ($result_com1->num_rows > 0) {
                        while($row_com1 = $result_com1->fetch_assoc()) {
                            $company_name = $row_com1["company_name_ar"];
                        }}
                              ?>
                                    <option value="<?php echo $row_cu["account_number"];?>"><?php echo $row_cu["account_name"]."/".$company_name."/".$row_cu["account_number"];?></option>
                                            <?php }}?>
                                            </select>
									</div>	
									</div>
                             </td>
                             <td>
                             <div class="col-md-6 mb-3" id="request_c">
									<div class="form-group">
											<label clas="col-form-label col-md-2">المطلوب</label>
											<select id="request0" name="request0" class="form-control" required="">
                                            <option value="">اختر </option>
                                                <option value="sum_maden">اجمالي المدين</option>
                                                <option value="sum_daen">اجمالي الدائن</option>
                                                <option value="raseed">الرصيد</option>
                                            </select>
									</div>	
									</div>
                             </td>
                             <td>
                             <div class="form-group">
											<label clas="col-form-label col-md-2">العمليه</label>
											<select id="operate0" name="operate0" class="form-control">
                                            <option value="">اختر </option>
                                                <option value="sum">جمع</option>
                                                <option value="sub">طرح</option>
                                                <option value="multi">ضرب</option>
                                                <option value="divid">قسمه</option>
                                            </select>
									</div>	
									</div>
                             </td>
                             <td></td>
                            </tr>                                    
                            </tbody>
                        </table>
                                </div>

                 
								  <input type="hidden" id="company_idd" name="company_idd" value="<?php echo $company_id;?>">
								  <div class="col-lg-12">
									<input type="submit" id="submit" name="btn_save" class="btn btn-primary me-2" clas="btn btn-submit me-2" value="حفـــــظ">
									<input type="reset" class="btn btn-secondary"  clas="btn btn-cancel" value="الغـــاء"></a>
								</div>
                             </form>
							</div>
						</div>
					</div>
					<!-- /add -->
				</div>
			</div>
        </div>
		<!-- /Main Wrapper -->
		 <!-- /Main Wrapper -->
         	<!-- sitting -->
		<?php include("../setting.php"); ?>
	    <!-- /sitting -->

	<!-- Footer -->
		<?php include("../footer.php"); ?>
		<!-- /Footer -->
		<!-- jQuery -->
		
		 <!-- 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>
    setTimeout(function() {
        let alert = document.querySelector(".alert3");
            alert.remove();
    }, 3000);
    </script>
<script>
  $(document).ready(function(e) {
   var ss = '<?php echo $row_cu["request_id"];?>';
   var i=0;
	$('#add'+ss).click(function(){
    i++;
	 var button_add = $(this).attr('data-id');   
	
      var date_did = $("#date_did"+i).val();

  $('#dynamic_fieldfff'+button_add).append('<tr id="row'+i+'"><td><div class="col-md-6 mb-3"><div class="form-group"><input type="hidden" name="hidden[]" value="'+i+'"><label clas="col-form-label col-md-2">رقم الحساب</label><select clas="select" name="account_number'+i+'" id="account_number'+i+'" class="form-control form-small select2" required=""><option value="">اختر حساب </option><?php if($company_id=='all_company'){$sql_com="SELECT * FROM waseet_company_user_tbl where company_id IN ('$ids') AND deleted='0' GROUP BY company_id";}else{$sql_com="SELECT * FROM waseet_company_user_tbl where company_id='$company_id' AND deleted='0' GROUP BY company_id";
}$result_com = $conn->query($sql_com);if ($result_com->num_rows > 0) {while($row_com = $result_com->fetch_assoc()) {?><?php $sql_cu="SELECT * FROM accounts_tbl where company_id='".$row_com["company_id"]."'";$result_cu = $conn->query($sql_cu);if ($result_cu->num_rows > 0) {while($row_cu = $result_cu->fetch_assoc()) {$sql_com1="SELECT * FROM main_company_tbl where deleted='0'AND  company_id='".$row_cu['company_id']."' ";
$result_com1 = $conn->query($sql_com1);if ($result_com1->num_rows > 0) {while($row_com1 = $result_com1->fetch_assoc()) {$company_name = $row_com1["company_name_ar"];}}?><option value="<?php echo $row_cu["account_number"];?>"><?php echo $row_cu["account_name"]."/".$company_name."/".$row_cu["account_number"];?></option><?php }}}}?></select></div></div></td><td><div class="col-md-6 mb-3" id="request_c"><div class="form-group"><label clas="col-form-label col-md-2">المطلوب</label><select id="request'+i+'" name="request'+i+'" class="form-control" required=""><option value="">اختر </option><option value="sum_maden">اجمالي المدين</option><option value="sum_daen">اجمالي الدائن</option><option value="raseed">الرصيد</option></select></div></div></td><td><div class="form-group"><label clas="col-form-label col-md-2">العمليه</label><select id="operate'+i+'" name="operate'+i+'" class="form-control" ><option value="">اختر </option><option value="sum">جمع</option><option value="sub">طرح</option><option value="multi">ضرب</option><option value="divid">قسمه</option></select></div></div></td><td><div class="col-lg-12" style="max-width: 100%;"><button type="button" name="remove" id="btn_remove'+ss+'" data-id="'+i+'" class="btn btn-danger btn_remove">X</button></div></td></tr>');
  });
 $(document).on('click', '#btn_remove'+ss, function(){
    var button_id = $(this).attr("data-id"); 
    //alert(button_id);
		$('#row'+button_id+'').remove();
	});
  
});
  </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>




