<?php 
session_start();
?>

<html>
<head>
	<title>Visualsoft Office Manager - Users</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();}

error_reporting(E_ALL); ini_set('display_errors', 1);


$myTopCaption_Text="ΠΑΡΑΜΕΤΡΟΙ ";
$MyFormName=str_replace('.php', '', basename($_SERVER['PHP_SELF']));
$MyADDFormName="user_add";$w=850;$h=520;
$MyIDFieldName="IDUser";
$tblName='users';
$ListExist=true;
$prefix="user_list@";
$FocusField=$prefix."FindWhat";
$IDcField="";
$RequiredField="";
$PeriodosGroupName=$prefix."PeriodosName";
$Periodos="week";
$frmOpenNew='"'.$MyIDFieldName.'","0","'.$MyADDFormName.'",'.$w.','.$h ;

$RecsPP_fld=$prefix.'cboRecPP';
$SortFLD=$prefix.'srt';
$SortValue="";

 
include 'include/top_vars.php'; 
include 'include/header.php';
 

$now = new DateTime();
$now= $now->format('d/m/Y'); 

$simera2=date_olografos($now);

app_title();
 
?> 
 
 <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 id="hmnia_caption"> ΚΑΤΑΣΤΑΣΗ ΧΡΗΣΤΩΝ</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="c w40">AA</td>
	<td class="c w100"> ΧΡΗΣΤΗΣ<a onclick="grdsrt('UserName');" class="sortpic"/></td>
	<td class="c"> ΕΠΩΝΥΜΙΑ<a onclick="grdsrt('Eponymia');" class="sortpic"/></td>
	<td class="c w100">ΤΗΛΕΦΩΝΟ<a onclick="grdsrt('Phone');" class="sortpic"/></td>
	<td class="c w200">ΙΔΙΟΤΗΤΑ<a onclick="grdsrt('UserType');" class="sortpic"/></td>
	<td class="c w200">ΣΗΜΕΙΩΣΕΙΣ </td> 
	<td class="c w80">ΕΝΕΡΓΟΣ<a onclick="grdsrt('isActive');" class="sortpic"/></td> 
   </tr> 
  </table>
</div>
 
 <table class="gridListNoCaption"  > 
<?php
 
   $flds="UserName,Eponymia,Dnsi,Poli, Phone,email,isActive,Sxolia ";
 $filter = filter_make($flds, $FindWhat);
  $query = " SELECT * FROM ". $tblName . " " . $filter ; 
  if($SortValue==''){$query=$query ." ORDER BY Eponymia ";} else {$query=$query." ORDER BY " . $SortValue . " ";}

#echo $query;
 
  $num_rows=RecordsCount($conn,$query);
   $FromRec=($pgNo-1)*$RecsPP ;
   	 $RecNo=$num_rows;
     $pgMax=intval($num_rows/$RecsPP)+1;
     
	 $query=$query .  ' LIMIT ' .$FromRec . ', ' . $RecsPP ;
 
   $result = mysqli_query($conn, $query);
 
$iRow= $FromRec;

 while ($rs = mysqli_fetch_array($result)) {
 //$rs = mb_convert_encoding($rs, 'greek' );
$iRow +=1;
 
$IDUser = $rs['IDUser'];
$UserName=$rs['UserName'];
$UserPassword=$rs['UserPassword'];
$Eponymia = $rs['Eponymia'];
$Dnsi = $rs['Dnsi'];
$Poli = $rs['Poli'];
$TK = $rs['TK'];
$Phone = $rs['Phone'];
$email = $rs['email'];
$isActive = $rs['isActive'];
$UserType = $rs['UserType'];
$Sxolia = $rs['Sxolia'];

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

$frmOpen='"'.$MyIDFieldName.'","'.$IDUser.'","'.$MyADDFormName.'",'.$w.','.$h ;

// ========================================
//  notes List
// ========================================
 
    echo "<tr class='tablerowdata' onclick='javascript:OpenFormADD_onWin($frmOpen);'> ";
    echo "<td class='r w40'>$iRow</td>";
	echo "<td class='c w100'>$UserName</td>";
    echo "<td>$Eponymia</td>";
	echo "<td class='c w100'>$Phone</td>";
	echo "<td class='w200'>$UserType</td>";
	echo "<td class='w200'>$Sxolia</td>";
	echo "<td class='c w80'><input size ='1' type='checkbox' $isActiveChk ></td>";	
    echo "</tr>";   
 }
 
for ($x = $iRow+1; $x <= $pgNo*$RecsPP; $x++) {
    echo "<tr class='tablerowdata' onclick='javascript:OpenFormADD_onWin($frmOpenNew);' > ";
    echo "<td class='r w40'></td>";
	echo "<td class='c w100'></td>";
    echo "<td></td>";
	echo "<td class='c w100'></td>";
	echo "<td class='w200'></td>";
	echo "<td class='w200'></td>";
	echo "<td class='c w80'></td>";	
    echo "</tr>";
 }	
 

?>
</table>


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


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