<?php 
session_start();

if($_SESSION['CheckPWD']==false){ header("Location: login.php"); }

$myTopCaption_Text=" ΣΥΜΒΟΛΑΙΑ - ΕΠΕΞΕΡΓΑΣΙΑ ΕΓΓΡΑΦΗΣ ";
$MyFormName=str_replace('.php', '', basename($_SERVER['PHP_SELF']));
$prefix="notes_add@";
$tblName='symvolaia';
$IDcField='IDSymvolaiou';
$FocusField="Eponymia";
$RequiredField="Eponymia";
$CloseType="GoBack";
$closeCap=" Επιστροφή ";
$ReturnTo='notes_list.php';
$Tab =!isset($_COOKIE[$MyFormName.'@tab']) ? 'tab1': $_COOKIE[$MyFormName.'@tab'];  
#include 'myfunctions.php';
#app_title();
 
$MyADDFormName="pelates_find";$w=950;$h=500;
$frmOpen='"","0","'.$MyADDFormName.'",'.$w.','.$h ;

 include 'include/header.php';
 
//========================================
//        Patients Record Read
//========================================

# echo "<br><br>======>>>>>>> Session IdSymvolaiou: " .$_SESSION['IDSymvolaiou'] ;
# print_r($_SESSION); 

$IDSymvolaiou = 0;$IDc = 0;$IDPelati = 0;$IDApp= 0;
$Eponymia='';$AFM='';$Tilefono='';$Kinito='';$email='';$ApplicationName='';$ApplicationCustomerVer='';
$SerialNo='';$License='';;$ActivateEndDate="";
$ActivateStartDateNum=0;$ActivateEndDateNum=0;$ActivateUses=0;$isActive=0;$Message='';$Sxolia='' ;
$isActiveChk='unckecked';

// $ActivateStartDate=formatMyDate(date(),"MySqlToGr")

if($conn == false){
	 echo 'Δεν υπαρχει συνδεση...<br>';
	// dbConnect();
}
#   $IDc = trim(filter_input(INPUT_GET, 'IDc', FILTER_SANITIZE_SPECIAL_CHARS));
   $IDc = gConvertField($_COOKIE['IDSymvolaiou'], '0');
 $query = "SELECT * FROM symvolaia WHERE IDSymvolaiou=" . $IDc ;
$result = mysqli_query($conn, $query);
    $rs = mysqli_fetch_assoc($result);

$IDSymvolaiou = gConvertField($rs['IDSymvolaiou'],0);
$IDc =$IDSymvolaiou ;
$IDPelati=gConvertField($rs['IDPelati'],0);
$IDApp=gConvertField($rs['IDApp'],0);
$Eponymia=$rs['Eponymia'];
$AFM=$rs['AFM'];$DOY=$rs['DOY'];
$Tilefono=$rs['Tilefono']; $Kinito=$rs['Kinito']; $email=$rs['email'];
$ApplicationName=$rs['ApplicationName'];$ApplicationCustomerVer=$rs['ApplicationCustomerVer'];
$SerialNo=$rs['SerialNo']; $License=$rs['LicenseNo'];
$ActivateStartDate=formatMyDate($rs['ActivateStartDate'],"MySqlToGr");
$ActivateEndDate=formatMyDate( $rs['ActivateEndDate'],"MySqlToGr");
$ActivateStartDateNum = $rs['ActivateStartDateNum'];
$ActivateEndDateNum = $rs['ActivateEndDateNum'];
$ActivateUses=$rs['ActivateUses'];
$isActive=$rs['isActive'];
$Terminal=$rs['Terminal'];
$Sxolia=$rs['Sxolia']  ;

$isActiveChk='unckecked';

if($isActive==-1){$isActiveChk='checked';} 
 
 
?>

<html > 
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
	</head>
	<link rel="shortcut icon" href="icons/Asthenis_24x24.ico" />
	<link rel="stylesheet" href="css/font-awesome.min.css" />
	<link rel="stylesheet" href="css/tab2023.css" />
 
		<div class="page" style=" margin-top:20px;">
	 
			<div class="pcss3t pcss3t-theme-1 ">
				<input type="radio" name="pcss3t" checked  id="tab1" class="tab-content-first" >
				<label for="tab1"><i class="icon-edit "></i>Πελάτης</label>
				
				<input type="radio" name="pcss3t" id="tab2" class="tab-content-2" >
				<label for="tab2"><i class="icon-paper-clip"></i>Εφαρμογή</label>
				
				<ul>
					<li class="tab-content tab-content-first typography">
						<?php include 'symvolaia_add1.php'; ?>
					</li>
					<li class="tab-content tab-content-2 typography">
						<?php #include 'symvolaia_add2.php'; ?>
					</li>					
				</ul>
			</div>	
		</div>	
 
 
<?php
  include 'include/del_yes_no.php';
  include 'include/buttons_bar_down.php';
?>

</html>

<?php 
  include_once 'include/footer2020.php';
?> 
 
<script type="text/javascript" src="js/mycheck.js"></script>   
<script type="text/javascript" src="js/datepicker.js"></script>   

 
<script>
	var Tab='<?php echo $Tab ?>';
	if(Tab==""){Tab='tab1';}
	document.getElementById(Tab).checked=true;
	
window.addEventListener("unload", (event) => {
	deleteCookie($MyFormName.'@tab');
}
</script>