<html>
<body>
<h2> List of tested PMTs </h2>
<h3>(go to <a href=pipmt.php> all PMTs</a> instead)</h3>
<center>
<?php


include("pipmtinc.php");

mysql_select_db("megpi",$db);

$result = mysql_query("select serial, test_date, count(*) from all_tested_pmts where test_date is not NULL group by serial order by test_date DESC;",$db);

echo "<table border=0 bgcolor=000000 cellpadding=2>\n";
echo "<tr>
      <td bgcolor=FFFFFF align=center> </td>
      <td bgcolor=FFFFFF align=center>Serial</td>
      <td bgcolor=FFFFFF align=center>Test date</td>
      <td bgcolor=FFFFFF align=center>N. of tests</td>
      </tr>\n";
$i=0;

while ($myrow = mysql_fetch_array($result)) {
  if ($i%2)
    {
      $color1=0xCCCCFF;
      $color2=0xAAAAFF;
      $color3=0xFFCCCC;
      $color4=0xAAFFAA;
    }
  else 
    {
      $color1=0xAAFFAA;
      $color2=0x88FF88;
      $color3=0xFFAAAA;
      $color4=0xCCFFCC;
    }
  
  $i++;
  
  if ($myrow["test_date"]!=NULL)
  {
    printf("<tr>
           <td bgcolor=%x> %d </td>
           <td bgcolor=%x> %s </td>
           <td bgcolor=%x> %s </td>
           <td bgcolor=%x align=center> %d </td>
   </tr>\n",
 	   $color2, $i,
	   $color1, $myrow["serial"],
 	   $color2, $myrow["test_date"],
	   $color1, $myrow["count(*)"]
	 );
  }
}
   
   echo "</table>\n";
?>
</center>
<br>
A total of
<?php
$result = mysql_query("select count(*) from all_tested_pmts where test_date is not NULL;",$db);
while ($myrow = mysql_fetch_array($result)) 
     printf(" %d PMTs have been tested in %d tests." ,$i,$myrow["count(*)"]);
$result = mysql_query("select count(distinct serial) from all_tested_pmts where mask is not NULL;",$db);
while ($myrow = mysql_fetch_array($result)) 
     printf(" Furthermore %d PMTs were rejected." ,$myrow["count(distinct serial)"]);


?>

</body>
</html>
   