<?php 
session_start();
//error_reporting(E_ALL);
ini_set('display_errors', 1);
?>
<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.'",' ;
 
include 'include/top_vars.php';  
include 'include/header.php';

$RecNo=0;
?>
 
<head>
	<title>vs Contracts</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="">
</head>

<form id="<?php echo $MyFormName;?>" name="<?php echo $MyFormName;?>" autocomplete="off">
 <body OnLoad="document.<?php echo $MyFormName.'.'.$prefix ?>FindWhat.focus();">

 <div class="vsboxDetail hide1" >
	<h1> ΠΕΛΑΤΕΣ </h1>
 </div>
 
<?php include 'include/top_grid_list_buttons.php';  ?>

<div class="scroll" style="margin-bottom:0px;padding-bottom:0px;width:100%;" > 
 <div class="sticky">
  <table id="CustomerList" class="gridList"  > 
   <tr>
	<td class="r w50">A/A<a onclick="grdsrt('IDPelati');" class="sortpic"/></td>
	<td class="c w80 hide1">ΕΝΕΡΓΟΣ<a onclick="grdsrt('isActive');" class="sortpic"/></td>
	<td class="c w90">ΑΦΜ<a onclick="grdsrt('AFM');" class="sortpic"/></td> 
    <td>ΕΠΩΝΥΜΙΑ<a onclick="grdsrt('Eponymia');" class="sortpic"/></td>
	<td class="w100 hide1">ΠΟΛΗ<a onclick="grdsrt('Poli');" class="sortpic"/></td>
	<td class="c w100 hide1">ΤΗΛΕΦΩΝΟ 1</td>
	<td class="c w100 hide1">ΤΗΛΕΦΩΝΟ 2</td>
	<td class="c w100 hide1">ΚΙΝΗΤΟ</td>
	<td class="w140 hide1">ΜΥΝΗΜΑ</a></td>
  </tr> 
</table>
</div  >  

 <table class="gridListNoCaption"  > 
  
<?php

   $flds="Eponymia, Dnsi, DnsiErgasias, Epaggelma, 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 . " ";} 
 
//$fldsNew = str_replace(",","+",$flds);
//$formdata = $FindWhat;
//$search_string = "+".str_replace(" "," +",$formdata);
//$search_string = str_replace(" ","",$formdata);
//string will be become "+string1 +string2 +string3 +string4 +string5";

///$query = "SELECT * FROM $tblName WHERE INSTR($fldsNew,  '$FindWhat') > 0";
	 
	 
//  echo $filter . "<br><br>". $query . "<br><br>";
	 
	 $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);
 
$iRow=$FromRec;

 while ($rs = mysqli_fetch_array($result)) {
$iRow +=1;

$IDPelati= $rs['IDPelati'];
$AFM=$rs['AFM'];
$Eponymia=$rs['Eponymia'];
$Poli= $rs['Poli'];
$Til= $rs['Til'];
$TilErgasias1= $rs['TilErgasias1'];
$Kinito= $rs['Kinito'];
$Message =  $rs['Message'] ;
$Message = str_replace("\0", "", $Message);
$Message = trim($Message," ");	 
 
 
		 
$Sxolia=$rs['Sxolia'];
$isActive = $rs['isActive'];
$isActiveChk='unckecked';
if($isActive==-1){$isActiveChk='checked';} 
if($Message!==''){$BackColor="Style='background:red;color:white;'";}else{$BackColor='';} 
$frmOpen='"'.$MyIDFieldName.'","'.$IDPelati.'","'.$MyADDFormName.'",' ;

// ========================================
//  Pelates List
// ========================================
	 
    echo "<tr class='tablerowdata'  onclick='javascript:OpenFormADD($frmOpen);'> ";
    echo "<td class='r w50' >$iRow</td>";
	echo "<td class='c w80 hide1'><input size ='1' type='checkbox' $isActiveChk ></td>";
	echo "<td class='c w90'>$AFM</td>";
    echo "<td >$Eponymia</td>";
    echo "<td class='w100 hide1'>$Poli</td>";
	echo "<td class='c w100 hide1'>$Til</td>";
	echo "<td class='c w100 hide1'>$TilErgasias1</td>";
	echo "<td class='c w100 hide1'>$Kinito</td>";
	echo "<td class='w140 hide1' $BackColor>$Message</td>";
    echo "</tr>";
 } 
for ($x = $iRow+1; $x <= $pgNo*$RecsPP; $x++) {
    echo "<tr class='tablerowdata'  onclick='javascript:OpenFormADD($frmOpenNew);'> ";
    echo "<td class='w50'> </td> <td class='w80 hide1'> </td> <td class='w90'> </td> <td> </td> ";
    echo "<td class='w100 hide1'> </td><td class='w100 hide1'> </td> <td class='w100 hide1'> </td> <td class='w100 hide1'> </td> <td class='w140 hide1'> </td> ";
    echo "</tr>";
 }	
 ?> 

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

</div> 
 
<?php include 'include/recs_no_max_div.php'; ?>
 
</body>
 
</form>
 
<Script language="JavaScript" type="text/JavaScript">

</script> 
  
<?php 

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


