<?php 
session_start();
date_default_timezone_set('Europe/Athens');
?>
<head>
	<Title>Visualsoft Office Manager - Service</Title>
	<link href="logos/ofm1.ico" rel="shortcut icon" type="image/x-icon"> 
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="">
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<?php
 
if(!isset($_SESSION['CheckPWD']) || $_SESSION['CheckPWD'] == '' ){header("Location: login.php");die();}
 
$tblName='service';
$FocusField='btnClose'; 
// $PageName= basename($_SERVER['PHP_SELF']);
$MyFormName=str_replace('.php', '', basename($_SERVER['PHP_SELF']));
$RequiredField="HmniaParalavis";
$myTopCaption_Text=" ΕΠΙΣΚΕΥΕΣ - SERVICE ";
$CloseType="Return";
$closeCap=" Επιστροφή ";
$btnSaveStatus="Enabled";
$btnDeleteSaveStatus="Disabled";
$IDcField="IDService";
$ReturnTo='service_list.php';

// echo "========" . gethostbyaddr($_SERVER['REMOTE_ADDR'])
# print_r(service_fields());
## print_r(service_fields('IDPelati'));

include 'include/header.php';
 
# echo "<br><br>======>>>>>>> Session IDService: " .$_SESSION['IDService'] ;
# print_r($_SESSION); 

$Sxolia='' ;
$ParalaviApoComputer='';
$Bag=0;
$PowerSupply=0;
$EidosSyskeyis='';
$Model='';
$SerialNo='';
$Metritis='';
$PerigrafiSyskeyis=''; 
$PerigrafiVlavis='';

$HmniaParalavis=date_create('now')->format('d/m/Y');
$OraParalavis=date_create('now')->format('H:i:s');

$HmniaEpiskeyis='';$OraEpiskeyis='';$ParadosiApoComputer='';
$HmniaParadosis='';$OraParadosis="";
$OresErgasias='';$Xreosi='';$ParadosiApoComputer='';$PerigrafiErgasion='';
$EponymiaPelati="";$Battery=0;$Tilefono= "" ;$Kinito="";
$IDPelati=0;	 
$IDService=0;	if(isset($_COOKIE['IDService'])){ $IDService=$_COOKIE['IDService'];}
$IDc = $IDService;
 
if($conn == false){
	 echo 'Δεν υπαρχει συνδεση...<br>';
	// dbConnect();
}
 $query = service_query();
 $query = $query." WHERE service.IDService=" . $IDc ;


//  $query = "SELECT * FROM " . $tblName ." WHERE IDService=" . $IDc ;
// echo  $query;

  $result = mysqli_query($conn, $query);
      $rs = mysqli_fetch_assoc($result);
if ($rs){
 
$IDService = gConvertField($rs['IDService'],0);
$IDc =$IDService ;
$IDPelati=gConvertField($rs['IDPelati'],0);
$EponymiaPelati= $rs['Eponymia'] ;
$Tilefono= $rs['Til'] ;
$Kinito= $rs['Kinito'] ;

$HmniaParalavis=formatMyDate($rs['HmniaParalavis'],"MySqlToGr");
$OraParalavis = safe_time_get($rs['OraParalavis']) ; // date_format($rs['OraParalavis'], 'H:i:s');
$HmniaEpiskeyis=formatMyDate($rs['HmniaEpiskeyis'],"MySqlToGr");
$OraEpiskeyis= $rs['OraEpiskeyis'] ;
$HmniaParadosis= formatMyDate($rs['HmniaParadosis'],"MySqlToGr");
$OraParadosis= $rs['OraParadosis'] ;

$EidosSyskeyis=$rs['EidosSyskeyis']; 
$Model=$rs['Model'];
$SerialNo=$rs['SerialNo'];
$Metritis=$rs['Metritis']; 
$PerigrafiSyskeyis=$rs['PerigrafiSyskeyis']; 
$PerigrafiVlavis=$rs['PerigrafiVlavis'];

$ServiceType=$rs['ServiceType'];
$ServiceArSymvasis=$rs['ServiceArSymvasis'];
$PerigrafiErgasion=$rs['PerigrafiErgasion']; 
$EkdosiTimologiouALP=$rs['EkdosiTimologiouALP'];
$ParalaviApoComputer=$rs['ParalaviApoComputer'];
$ParalaviApoXristi= $rs['ParalaviApoXristi'] ;
$OresErgasias = $rs['OresErgasias'];

$ParadosiApoComputer="";
$Xreosi = gConvertField($rs['Xreosi'],0);
$EnimerosiKiniseon=gConvertField($rs['EnimerosiKiniseon'],0);
$Bag=$rs['Bag'];
$PowerSupply=$rs['PowerSupply'];
$Battery=$rs['Battery'];

$Sxolia=$rs['Sxolia']  ;
//$energos1 = $rs['isActive'];
}

$chkBag='unckecked';		if($Bag==-1){$chkBag='checked';} 
$chkPowerSupply='unckecked';if($PowerSupply==-1){$chkPowerSupply='checked';} 
$chkBattery='unckecked';	if($Battery==-1){$chkBattery='checked';} 
 
?> 

<form name="<?php echo $MyFormName;?>" id="<?php echo $MyFormName;?>" method="post" action="_rs.php"> 
 <body  OnLoad="javascript:onLoadFocus();"  >
  
<?php
  include 'include/buttons_bar_top.php';
?>
 
 <div id="block_container" > 
 <div id="bloc1" class="fieldset2 "  > 
	<h1>ΠΑΡΑΛΑΒΗ</h1> 

	<div class="row"  >
		<div class="col-20"><label class="b" for="EponymiaPelati">Επωνυμία</label></div>
		<div class="col-10 hide1"><input type="text" id="IDPelati" name="IDPelati"  value="<?=$IDPelati;?>"></div>
		<div class="col-70" style="position: relative; display: inline;">
		<input type="text" id="EponymiaPelati" name="EponymiaPelati" required placeholder='Πελάτης...'  onKeyUp="eponymia_upd();" value="<?= $EponymiaPelati;?>"  > 
		<a class="btnKartela" style="position:absolute;top:8;right:78;" onclick="javascript:pelatis_show();"> </a> </input>
		<a class="btnFind" style="position:absolute;top:8;right:44;" onclick="javascript:pelatis_select('');"> </a> </input>
		<a class="btnCancel" style="position:absolute;top:8;right:12;" onclick="javascript:pelatis_remove('');"> </a> </input>
		</input>
		</div>	
	</div>
	
		<div class="row">
					<?php input_field_2080('20','35','Τηλέφωνο', 'Tilefono', $Tilefono, false); ?>
					<?php input_field_2080('10','35','Κινητό', 'Kinito', $Kinito, false); ?>
		</div>

		<div class="row"><hr></hr></div>
	
		<div class="row">
		<div class="col-20"><label for="HmniaParalavis">Ημ.Παραλαβής</label></div>
		<div class="col-30">
			<div class="vscombo-div">
				<input class="datepicker" type="text" id="HmniaParalavis" name="HmniaParalavis" value="<?php echo $HmniaParalavis;?>" >
				<a class="vscombo_date_button" name="Hmnia_Button" id="Hmnia_Button" ></a>
			</div>  
		</div>
			<?php input_field_2080('10','10','Ωρα', 'OraParalavis', $OraParalavis, false); ?>
			<div class="col-30">
			    <input type="text" id="ParalaviApoComputer" name="ParalaviApoComputer" value="<?php echo $ParalaviApoComputer;?>" >
			</div> 
		</div>
		
		<div class="row">
			<?php input_field_2080('20','30','Είδος Συσκευής', 'EidosSyskeyis', $EidosSyskeyis, false); ?>
			<?php input_field_2080('10','40','Model', 'Model', $Model, false); ?>
		</div>		
 		<div class="row">
			<?php input_field_2080('20','80','Περιγραφή', 'PerigrafiSyskeyis', $PerigrafiSyskeyis, false); ?>
		</div>  
 		<div class="row">
			<?php input_field_2080('20','40','Serial No', 'SerialNo', $SerialNo, false); ?>
			<?php input_field_2080('15','25','Μετρητής', 'Metritis', $Metritis, false); ?>
		</div> 
		
		<div class="row">
		<div class="col-20"><label for="Sxolia">Περιγραφή Βλάβης</label></div>
		<div class="col-80">	
			 <textarea name="PerigrafiVlavis" id="PerigrafiVlavis" style="min-height:60px;max-height: 100%;padding:5px;"  value="<?php echo $PerigrafiVlavis;?>" ><?php echo $PerigrafiVlavis;?></textarea>
		</div>
		</div>		
<hr style="border:0px solid lightgray;">		
 		<div class="row" style="padding-top:5px ">
			<div class="col-20"><label for="isDoneChk">Τροφοδοτικό</label></div>
			<div class="col-15" style="padding:0px;"><?php  input_yesno_only("Τροφοδοτικό", "chkPowerSupply", "PowerSupply", $PowerSupply,"." )?></div> 
			<div class="col-15"><label for="isDoneChk">Τσάντα</label></div>
			<div class="col-20" ><?php  input_yesno_only("Τσάντα", "chkBag", "Bag", $Bag, "." )?></div> 
			<div class="col-15"><label for="isDoneChk">Μπαταρία</label></div>
			<div class="col-15" ><?php  input_yesno_only("Μπαταρία", "chkBattery", "Battery", $Battery,"." )?></div> 
		</div>
 </div>

	<div id="bloc2" class="fieldset2"  > 
		<h1>ΕΠΙΣΚΕΥΗ - ΠΑΡΑΔΟΣΗ</h1> 
		<div class="row">
		<div class="col-20"><label for="HmniaEpiskeyis">Ημ. Επισκευής </label></div>
		<div class="col-30">
			<div class="vscombo-div">
				<input class="datepicker" type="text" id="HmniaEpiskeyis" name="HmniaEpiskeyis" value="<?php echo $HmniaEpiskeyis;?>" >
				<a class="vscombo_date_button" name="Hmnia_Button" id="Hmnia_Button" ></a></input>
			</div>  
		</div>
				<?php input_field_2080('10','20','Ωρα', 'OraEpiskeyis', $OraEpiskeyis, false); ?>
		</div>
		
		<div class="row">
			<div class="col-20"><label for="HmniaParadosis">Ημ. Παράδοσης </label></div>
			<div class="col-30">
				<div class="vscombo-div">
					<input class="datepicker" type="text" id="HmniaParadosis" name="HmniaParadosis" value="<?php echo $HmniaParadosis;?>" >
					<a class="vscombo_date_button" name="Hmnia_Button" id="Hmnia_Button" ></a></input>
				</div>  
			</div>
				<?php input_field_2080('10','20','Ωρα', 'OraParadosis', $OraParadosis, false); ?>
		</div>
		
		<div class="row">
			<?php input_field_2080('20','30','Ώρες εργασίας', 'OresErgasias', $OresErgasias, false); ?>
		</div>	
		<div class="row">	
			<?php input_field_2080('20','30','Χρέωση €', 'Xreosi', $Xreosi, false); ?>
		</div>	
		
		<div class="row">
		<div class="col-20"><label for="PerigrafiErgasion">Περιγραφή επισκευής</label></div>
		<div class="col-80">	
			 <textarea name="PerigrafiErgasion" id="PerigrafiErgasion" style="min-height:90px;max-height: 100%;padding:5px;"  value="<?php echo $PerigrafiErgasion;?>" ><?php echo $PerigrafiErgasion;?></textarea>
		</div>
		</div>
		
		<div class="row">
		<div class="col-20"><label for="Sxolia">Σημειώσεις</label></div>
		<div class="col-80">	
			 <textarea name="Sxolia" id="Sxolia" style="min-height:90px;max-height: 100%;padding:5px;"  value="<?php echo $Sxolia;?>" ><?php echo $Sxolia;?></textarea>
		</div>
		</div>
		
	</div>
	
  </div>
 
  </body>
 
	 <Div style="display: none; position:absolute; margin-left:-150px; margin-top:-500; top:50; width:15%; float:inline;" >
		  <input type="text" name="Bag" id="Bag" value="<?php echo $Bag;?>">
		  <input type="text" name="Battery" id="Battery" value="<?php echo $Battery;?>">
		  <input type="text" name="PowerSupply" id="PowerSupply" value="<?php echo $PowerSupply;?>">
		  <input type="text" name="IDService" id="IDService"   value="<?php echo $IDService;?>"> 
		  <input type="text" name="PageName" id="PageName" value="<?php echo $MyFormName.'.php';?>">
		  <input type="text" name="tblName" id="tblName" value="<?php echo $tblName;?>">
		  <input type="text" name="IDcField" id="IDcField" value="<?php echo $IDcField;?>">
		  <input type="text" name="IDc" id="IDc" value="<?php echo $IDc;?>">
		  <input type="text" name="CloseType" id="CloseType" value="<?php echo $CloseType;?>">
	 </div>	
</form>
 
<?php
 # include 'include/buttons_bar_down.php';
?> 
 
 <?php
  include 'include/del_yes_no.php';
  include 'include/footer2020.php';
?>
<script type="text/javascript" src="js/mycheck.js"></script>   
<script type="text/javascript" src="js/datepicker.js"></script>  
<script language="JavaScript" type="text/JavaScript">
function pel_upd(){ pelatis_update(document.getElementById("IDPelati").value) ;}
</script>
 
 
