<?php 
session_start();
?>
	<head>
		<link href="logos/ofm1.ico" rel="shortcut icon" type="image/x-icon"> 
	</head>
<?php
if($_SESSION['CheckPWD']==false){ header("Location: login.php"); }
error_reporting(E_ALL); ini_set('display_errors', 1);

$myTopCaption_Text=" ΣΗΜΕΙΩΣΕΙΣ-ΕΚΚΡΕΜΟΤΗΤΕΣ ";
$MyFormName=str_replace('.php', '', basename($_SERVER['PHP_SELF']));
$MyADDFormName="notes_add";$w=950;$h=420;
$MyIDFieldName="IDNote";
$tblName='notes';
$ListExist=true;
$prefix="notes_list@";
$FocusField=$prefix."FindWhat";
$IDcField="";
$RequiredField="";
##$PeriodosGroupName=$prefix."PeriodosName";
##$Periodos="week";
$OpenNew_Func="OpenFormADD_onWin";
$frmOpenNew='"'.$MyIDFieldName.'","0","'.$MyADDFormName.'",'.$w.','.$h ;
 
include 'include/top_vars.php'; 
include 'include/header.php';

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

//$simera2=date_olografos($now); 
 
$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"  style="padding-bottom:0px;" >
 <h1 id="hmnia_caption"> <?php echo $simera2 ?> </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 w50 hide1">AA<a onclick="grdsrt('IDNote');" class="sortpic"/></td>
	<td class="c w120"> ΗΜΕΡΟΜΗΝΙΑ<a onclick="grdsrt('Hmnia');" class="sortpic"/></td>
	<td class="c"> ΑΙΤΙΟΛΟΓΙΑ<a onclick="grdsrt('Aitiologia');" class="sortpic"/></td>
	<td class="c hide1"> ΣΗΜΕΙΩΣΕΙΣ</td> 
	<td class="c w50 hide1" >ΟΚ<a onclick="grdsrt('isDone');" class="sortpic"/></td> 
   </tr> 
  </table>
</div>
 
 <table class="gridListNoCaption"  > 
<?php
 $RecNo=0;
   $flds="Aitiologia,Sxolia ";
 $filter=filter_make($flds, $FindWhat);
 $query=" SELECT * FROM ". $tblName . " " . $filter ; 
 	if($filter=='') {
      if($show_all_value=='checked') { 		
			$query.=" WHERE isDone=0 ";}
 	   }
if($SortValue==''){$query=$query ." ORDER BY Hmnia desc, IDNote desc ";} else {$query=$query." ORDER BY " . $SortValue . " desc, IDNote desc ";} 		 
#echo $query;
 
	$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;
 
$IDNote = $rs['IDNote'];
$Hmnia=formatMyDate($rs['Hmnia'],"MySqlToGr");
$Aitiologia = $rs['Aitiologia'];
$isDone=$rs['isDone'];
$Sxolia = $rs['Sxolia'];

$isDoneChk='unckecked';
if($isDone==-1){$isDoneChk='checked';} 

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

// ========================================
//  notes List
// ========================================
 
    echo "<tr class='tablerowdata' onclick='OpenFormADD_onWin($frmOpen);'> ";
    echo "<td class='r w50 hide1'>$iRow</td>";
	echo "<td class='c w120'>$Hmnia</td>";
    echo "<td>$Aitiologia</td>";
	echo "<td class='hide1'>$Sxolia</td>";
	echo "<td class='c w50 hide1'><input size ='1' type='checkbox' $isDoneChk ></td>";	
    echo "</tr>";   
 }
 
for ($x = $iRow+1; $x <= $pgNo*$RecsPP; $x++) {
    echo "<tr class='tablerowdata'  onclick='OpenFormADD_onWin($frmOpenNew);'> ";
    echo "<td class='c w50 hide1' > </td>";
	echo "<td class='c w120'></td>";
    echo "<td></td>";
	echo "<td class='hide1'> </td>";
    echo "<td class='w50 hide1'> </td>";	
    echo "</tr>";
 }	
 

?>
</table>


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

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

<script type="text/javascript" >
function opendialog(){
  Runner.displayPopup( {
  url: "products_add.php"
});

}

</script>