<?php 
session_start();
 
if($_SESSION['CheckPWD']==false){ header("Location: login.php"); }
$myTopCaption_Text="ΤΑΜΕΙΟ ΤΥΠΟΙ ΕΓΓΡΑΦΩΝ";
$MyFormName=str_replace('.php', '', basename($_SERVER['PHP_SELF']));
$MyADDFormName="TameioRecTypesAdd";$w=850;$h=400;
$MyIDFieldName="IDRecType";
$tblName='tameio_rectypes';
$FocusField='btnClose'; 
$ListExist=true;
$prefix="TameioRecTypes_";

$RecsPP_fld=$prefix.'RecsPP';
$HmApoCookieName=$prefix.'HmApo';
$HmEosCookieName=$prefix.'HmEos'; 

if(!isset($_COOKIE[$RecsPP_fld])) {$RecsPP=10;} else { $RecsPP=$_COOKIE[$RecsPP_fld];}
if(!isset($_COOKIE[$HmApoCookieName])) {$HmApo= date_create('now')->format('d/m/Y');} else { $HmApo=$_COOKIE[$HmApoCookieName];} 
if(!isset($_COOKIE[$HmEosCookieName])) {$HmEos=date_create('now')->format('d/m/Y'); } else { $HmEos=$_COOKIE[$HmEosCookieName];}

$FindWhat1 = trim(filter_input(INPUT_GET, $prefix.'FindWhat', FILTER_SANITIZE_SPECIAL_CHARS));
     $pgNo = trim(filter_input(INPUT_GET, $prefix.'pgNo', FILTER_SANITIZE_SPECIAL_CHARS));
 	  if(is_numeric($pgNo)){	 } else { $pgNo=1;} 
 
include 'include\Header.php';
include 'myFunctions.php';
include '_RecsNoMax_Div.php';
?>

<link href="logos/ApplicationLogo.png" rel="shortcut icon" type="image/x-icon"> 
<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 rel="stylesheet" href="css/search2020.css" />

 

<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;?>">
 <body OnLoad="document.<?php echo $MyFormName.'.'.$prefix ?>FindWhat.focus();">

 <div class="vsboxDetail"  >
 <h1> ΤΥΠΟΙ ΕΓΓΡΑΦΩΝ ΤΑΜΕΙΟΥ </h1>
	<table border="0" class="MenuBarForGridList hideOnPrint" > 
		<tr height="34px" style="valign:center;" >
			<td width="40%" >	
			  <a href="javascript:OpenFormADD_onWin(0);" class="button new">Νέα Εγγραφή</a>
			  <a href="javascript:refresh('<?php echo $prefix ?>');" class="button refresh">Ανανέωση</a>
			  <a href="javascript:window.print();" title=" Εκτύπωση Κατάστασης " class="button print">Εκτύπωση</a> 
			</td> 
 
			  <td style="float:right;width:250px;padding-right:5px;">
				  <div class="search">
					  <input type="text" name="<?php echo $prefix ?>FindWhat" id="<?php echo $prefix ?>FindWhat" class="searchTerm"   placeholder="Αναζήτηση..." value="<?php echo $FindWhat1;?>"  onfocus="gotoEndOfText(this);"  >
					  <button class="searchButton"  onclick="submitForm('<?php echo $prefix ?>');" ></button >
				  </div>
			  </td>
		</tr>	  
	</table>	

 <div class="sticky">
  <table id="CustomerList" class="gridList"  > 
   <tr >
	<td align="right" width="40">A/A</td>
	<td class="center w100">ID</td>
    <td>ΤΥΠΟΣ ΕΓΓΡΑΦΗΣ</td>
    <td class="w120"> ΑΠΟΘΕΜΑΤΙΚΟ ? </td>
	<td>ΠΑΡΑΤΗΡΗΣΕΙΣ </td>
  </tr> 
  </table >
</div  >  

  <table class="gridListNoCaption"  > 
 
<?php
 
 
 $query=" SELECT * FROM ". $tblName .
		" WHERE Concat(IDRecType, ' ', RecType, ' ', IFNULL(Sxolia,'')) LIKE '%" . $FindWhat1 ."%'" . 
		" ORDER BY IDRecType, RecType ";
// echo $query;
 
  $num_rows=RecordsCount($conn,$query);
   $FromRec=($pgNo-1)*$RecsPP ;
     $pgMax=intval($num_rows/$RecsPP)+1;
// ====================================  
 
// ====================================
    $query = $query .  ' LIMIT ' .$FromRec . ', ' . $RecsPP ;
   $result = mysqli_query($conn, $query);
 
 echo ('<script> document.getElementById("'.$RecNo_fld.'").value='.$num_rows.'</script>') ;
 echo ('<script> document.getElementById("'.$pgNo_fld.'").value='.$pgNo.'</script>') ;
 echo ('<script> document.getElementById("'.$pgMax_fld.'").value='.$pgMax.'</script>') ;
  
$iRow=($pgNo-1)*$RecsPP;

 while ($rs = mysqli_fetch_array($result)) {
$iRow +=1;
 
$IDRecType = gconvertfield($rs['IDRecType'],0);
$RecType = $rs['RecType'];
$isReserve = gconvertfield($rs['isReserve'],0);
$Sxolia = $rs['Sxolia']; 
$isReserveChk='';
if ($isReserve=='-1'){$isReserveChk='checked';}
//$RecTypeStyle="Style='background:white;color:black;'";
  
// ============ 
//  Rec List
// ============ 
    echo "<tr class='tablerowdata'  onclick='javascript:OpenFormADD_onWin($IDRecType);'> ";
    echo "<td width='40' class='r1' >$iRow</td>";
	echo "<td width='100' class='c1'>$IDRecType</td>";
    echo "<td>$RecType</td>";
	echo "<td class='c1 w120'><input size ='1' type='checkbox' $isReserveChk > </td>";
	echo "<td>$Sxolia</td>";
    echo "</tr>";
 }
  for ($x = $iRow+1; $x <= $pgNo*$RecsPP; $x++) {
    echo "<tr class='tablerowdata'  onclick='javascript:OpenFormADD_onWin(0);'> ";
    echo "<td></td> <td></td> <td></td> <td class='c1 w120'></td>";
    echo " <td></td>";
    echo "</tr>";
 }
 
 ?> 

</table>
 
	<table class="gridListFooter" border="0"  cellspacing="0" cellpadding="0" align="center" valign="bottom">

		<tr>
			<td align="left" width="100px" class="styleRecs">&nbsp; Εγγραφές/Σελ:</td>
			<td align="left" width="60px"><?php  cboRecsPerPage($RecsPP,  $prefix);?> </td>
			<td align="center" class="styleRecs">Βρέθηκαν <?php echo $num_rows;?> Eγγραφές</td>
			<td align='right' width="220px"><?php ButtonsNavigation($MyFormName, $pgNo, $pgMax,$prefix);?></td>
		</tr>
	</table>
</div>	
  
</body> 
</form> 
 
<?php 
  include 'js\vsFunctions.js';
  if ($ListExist==true){ include 'js\RecsNextPrv.js'; }
  include 'include\Footer2020.php';
?>
 
 


