<?php 
session_start();
?>
<head>
	<title>Visualsoft Office Manager - Αναζήτηση Πελάτη</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($_SESSION['CheckPWD']==false){ header("Location: login.php"); }

$myTopCaption_Text="ΠΕΛΑΤΕΣ";
$MyIDFieldName="IDPelati";
$MyFormName=str_replace('.php', '', basename($_SERVER['PHP_SELF']));
$MyADDFormName="pelates_add";
$tblName='pelates';
$ListExist=true;
$prefix=$MyFormName."@";
$frmOpenNew='"'.$MyIDFieldName.'","0","'.$MyADDFormName.'",0,0' ;
 
include 'include/top_vars.php';  
include 'myfunctions.php';
$RecNo=0;
?>

<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,300italic,700&subset=latin,greek,greek-ext" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Fira+Sans" rel="stylesheet">
 
<link rel="stylesheet" href="css/tab2023.css" type="text/css" /> 

<style>
body,html {background:#F8F9F9;}
.menuTop {margin:-5px 10px 25px 0px !important; padding-bottom:0px }
</style>
 
<form id="<?php echo $MyFormName;?>" name="<?php echo $MyFormName;?>">
 <body OnLoad="document.<?php echo $MyFormName.'.'.$prefix ?>FindWhat.focus();">

<?php 
	echo "<div class='search_container' style='float:left;width:96%;margin:-5px 15px -10px 16px;text-align:left;'>"."\n"; 
	echo "<form class='nosubmit' >"."\n"; 
	echo "<input class='nosubmit' type='search' name='$pFind' id='$pFind' placeholder='Αναζήτηση...' value='$FindWhat' onfocus='gotoEndOfText(this);' onclick='submitForm(\"$prefix\");'>"."\n"; 
	echo "<button type='submit' hidden >Search</button>"."\n"; 
	echo "</form>"."\n";
	echo "</div>"."\n"; 
?>
<br>

<div class="scroll" style="width:96%;height:68vh; margin:10px auto; padding-bottom:0px;" > 

 <div class="sticky">
  <table id="CustomerList" class="gridList"  > 
   <tr>
	<td class="r w50">A/A<a onclick="grdsrt('IDPelati');" /></td>
	<td class="c w90">ΑΦΜ<a onclick="grdsrt('AFM');" class="sortpic"/></td> 
    <td>ΕΠΩΝΥΜΙΑ<a onclick="grdsrt('Eponymia');" class="sortpic"/></td>
	<td class="c w100">ΚΙΝΗΤΟ</td>
  </tr> 
</table>
</div  >  

 <table class="gridListNoCaption"  > 
  
<?php

   $flds="Eponymia,Poli,Kinito,Til,TilErgasias1,AFM,Message,Sxolia";
 $filter=filter_make($flds, $FindWhat);
  $query="SELECT * FROM $tblName " . $filter ;
  if($SortValue==''){$query=$query ." ORDER BY Eponymia ";} else {$query=$query." ORDER BY " . $SortValue . " ";} 
  $num_rows=RecordsCount($conn,$query);
    $RecNo=$num_rows;
   $FromRec=($pgNo-1)*$RecsPP ;
     $pgMax=intval($num_rows/$RecsPP)+1;
    $query = $query .  ' LIMIT ' .$FromRec . ', ' . $RecsPP ;
 $result = mysqli_query($conn, $query);

#echo  $query;

$iRow=$FromRec;

 while ($rs = mysqli_fetch_array($result)) {
$iRow +=1;
 
$IDPelati= $rs['IDPelati'];
$AFM=$rs['AFM'];
$Eponymia=$rs['Eponymia'];
$Eponymia=str_replace("'", '', $Eponymia);
$Eponymia=str_replace('"', '', $Eponymia);

$Kinito= $rs['Kinito'];
$frmOpen='"'.$MyIDFieldName.'","'.$IDPelati.'","'.$MyADDFormName.'",' ;

// ========================================
//  Pelates List
// ========================================
    echo "<tr class='tablerowdata'  onclick='javascript:return_val(\"$IDPelati\",\"$Eponymia\");'> ";
    echo "<td class='r w50' >$iRow</td>";
	echo "<td class='c w90'>$AFM</td>";
    echo "<td >$Eponymia</td>";
	echo "<td class='c w100'>$Kinito</td>";
    echo "</tr>";
 } 
for ($x = $iRow+1; $x <= $pgNo*$RecsPP; $x++) {
    echo "<tr class='tablerowdata'  onclick='javascript:return_val(\"0\",\" \");'> ";
    echo "<td class='r w50'></td>";
	echo "<td class='c w90'></td>";
    echo "<td ></td>";
	echo "<td class='c w100'></td>";
    echo "</tr>";
 }	
 ?> 

</table>
 
<?php include 'include/recs_div_bottom.php'; ?>

</div> 
 
<?php include 'include/recs_no_max_div.php'; ?>
 
</body>


 <div border="0" width="100%" class="menuTop">
	<div class="row" style="padding-top:0px;">
 
	<div class="col-20"></div>
		<div class="col-80" style="float:right;text-align:right;">
		   <a style="width:120px;text-align:center;" onclick="window.close();" class="button gray close1">&nbsp;Επιστροφή&nbsp;</a>
		</div>
	</div>
 </div>
 
</form>
 
<script type="text/javascript" src="js/mycheck.js"></script>  
<script type="text/javascript" >

var m_focus="<?php echo $pFind ?>";

window.onload = function() {
  document.getElementById(m_focus).focus();
};

function return_val(ID, Perigrafi){
 // alert(" ID: " + ID + "      Perigrafi:" + Perigrafi     );
  window.opener.document.getElementById("IDPelati").value = ID;  
window.close(); 

window.opener.pel_upd();
}
 

</script>  		  

