more tables for categories
more tables for categories

--- a/displayAgency.php
+++ b/displayAgency.php
@@ -6,9 +6,62 @@
     $agency = htmlentities(strip_tags($_REQUEST['agency']));
     include_header($agency);
 echo '<center><h1>'.$agency.'</h1></center>';
-    agencySuppliersGraph($agency);
+    $query = 'SELECT category, min("categoryUNSPSC")  AS "categoryUNSPSC", count(*) AS count, sum(value) AS value  FROM contractnotice 
+  WHERE "agencyName" like :agency AND '. " " . $standardQ . ' GROUP BY category order by count(*) desc limit 10';
+    $query = $conn->prepare($query);
+    $query->bindParam(":agency", $agency);
+    $query->execute();
+    databaseError($conn->errorInfo());
+
+
+    echo "<h3>Categories</h3><table>  <thead>
+    <tr>
+      <th>Category</th>
+      <th>Contracts Count</th>
+      <th>Total Contract Value</th>
+    </tr>
+  </thead>";
+    foreach ($query->fetchAll() as $row) {
+        setlocale(LC_MONETARY, 'en_US');
+        $value = number_format(doubleval($row['value']), 2);
+        $category = urlencode($row['category']);
+        echo("<tr>
+    <td><B><a href='displayCategory.php?category=$category'>{$row['category']}</a></b></td>
+    <td>{$row['count']}</td>
+    <td>\$$value</td>
+    </tr>");
+    }
+    echo "</table><br/>";
+    $query = 'SELECT SUM(value) as value, count(*), text_mode("supplierName") "supplierName", min("supplierABN") as "supplierABN", (
+ case when "supplierABN" != 0 THEN "supplierABN"::text ELSE lower("supplierName") END) as "supplierID"  FROM contractnotice 
+WHERE ' .$yearQ . " " . $standardQ . ' AND "agencyName" like :agency
+GROUP BY "supplierID" ORDER BY "value" DESC';
+    $query = $conn->prepare($query);
+    $query->bindParam(":agency", $agency);
+    $query->execute();
+    databaseError($conn->errorInfo());
+    echo "<h3>Suppliers</h3><table>  <thead>
+    <tr>
+      <th>Supplier</th>
+      <th>Contracts Count</th>
+      <th>Total Contract Value</th>
+    </tr>
+  </thead>";
+    foreach ($query->fetchAll() as $row) {
+        setlocale(LC_MONETARY, 'en_US');
+        $value = number_format(doubleval($row['value']), 2);
+$supplierID = $row['supplierABN'].'-'. urlencode($row['supplierName']);
+        echo("<tr>
+    <td><B><a href=\"displaySupplier.php?supplier=$supplierID\" >{$row['supplierName']}</a></b></td>
+    <td>{$row['count']}</td>
+    <td>\$$value</td>
+    </tr>");
+    }
+    echo "</table><br/>";
 /*
- *     * Common categories and uncommon categories
+ *     Categories table
+ *  SONs/Panels used table
+    * Replace pie chart with percent count/count/percent value/value table
     * Procurement method in text, seperate Open via SON from Open
     * Consultancies, Confidentialities percentage
       Compliance statistics: amendments, delay in reporting average and number completely late */
@@ -23,7 +76,7 @@
     $query->execute();
     databaseError($conn->errorInfo());
 
-    echo "<table>  <thead>
+    echo "<h3>Contracts</h3><table>  <thead>
     <tr>
       <th>Contract Notice Number</th>
       <th>Contract Description</th>

--- a/displayConsultancies.php
+++ b/displayConsultancies.php
@@ -11,7 +11,7 @@
 
 include_header("Consultancies");
 $query = '
-SELECT SUM(value) as value, count(*), min("supplierName"), unnest(string_to_array("consultancyReason",\';\')) reason
+SELECT SUM(value) as value, count(*), text_mode("supplierName"), unnest(string_to_array("consultancyReason",\';\')) reason
 FROM contractnotice where ' .$yearQ . ' "consultancy" = \'Yes\' and "childCN" is null
 GROUP BY "supplierABN",reason order by value desc
  ';

--- a/displayContract.php
+++ b/displayContract.php
@@ -39,8 +39,6 @@
                 break;
             case "CNID":
                 echo '<span property="pc:referenceNumber" lang="">'.$value.'</span>';
-                break;
-            case "categoryUNSPSC":
                 break;
             case "category":
                 echo '<span rel="pc:mainObject" resource="[unspsc:'.$contractResult["categoryUNSPSC"].']">'.$value.'</span>';

--- a/displaySON.gexf.php
+++ b/displaySON.gexf.php
@@ -51,7 +51,7 @@
         <nodes>' . PHP_EOL;
 
 $query = '
-SELECT "supplierABN", min("supplierName") AS "supplierName", contractnotice."SONID", count(*), sum(value) AS value 
+SELECT "supplierABN", text_mode("supplierName") AS "supplierName", contractnotice."SONID", count(*), sum(value) AS value 
 FROM contractnotice 
 WHERE "childCN" IS NULL 
 AND extract(year from "publishDate") = \'2016\'

--- a/displaySON.php
+++ b/displaySON.php
@@ -1,52 +1,70 @@
 <?php
-include_once ("./lib/common.inc.php");
+include_once("./lib/common.inc.php");
 if ($_REQUEST['SONID']) {
-  $query = 'SELECT title from standingoffers where "SONID" = :SONID';
-$query = $conn->prepare($query);
-$query->bindParam(":SONID", $_REQUEST['SONID']);
-	$query->execute();
-		databaseError($conn->errorInfo());
-	$title = reset($query->fetchAll())['title'];
+    $query = 'SELECT title FROM standingoffers WHERE "SONID" = :SONID';
+    $query = $conn->prepare($query);
+    $query->bindParam(":SONID", $_REQUEST['SONID']);
+    $query->execute();
+    databaseError($conn->errorInfo());
+    $title = reset($query->fetchAll())['title'];
     include_header($title);
-    echo "<center><h1>".$_REQUEST['SONID']." - ".$title."</h1></center>";
-  $query = 'select category, min("categoryUNSPSC") as "categoryUNSPSC" from contractnotice where "SONID" = :SONID group by category';
-$query = $conn->prepare($query);
-$query->bindParam(":SONID", $_REQUEST['SONID']);
-	$query->execute();
-		databaseError($conn->errorInfo());
-echo "Categories: ";
-foreach ($query->fetchAll() as $row) {
-echo "<span class='label label-warning'><a href='displayCategory.php?category={$row['category']}'>{$row['category']}</a></span>&nbsp; ";
-}
-echo "<br/>";
-  $query = 'select "supplierABN", min("supplierName") as "supplierName", count(*), sum(value) as value from contractnotice
- WHERE '.$yearQ.' "childCN" is null AND "SONID" = :SONID group by "supplierABN"
- union select abn as "supplierABN",name as "supplierName",0 as sum,0 as value from standingoffer_suppliers 
- where "SONID" = :SONID and abn not in (select distinct "supplierABN" as abn from contractnotice where "SONID" = :SONID)';
-$query = $conn->prepare($query);
-$query->bindParam(":SONID", $_REQUEST['SONID']);
-	$query->execute();
-		databaseError($conn->errorInfo());
+    echo "<center><h1>" . $_REQUEST['SONID'] . " - " . $title . "</h1></center>";
+
+    $query = 'SELECT category, min("categoryUNSPSC")  AS "categoryUNSPSC", count(*) AS count, sum(value) AS value 
+FROM contractnotice 
+WHERE "SONID" = :SONID 
+GROUP BY category';
+    $query = $conn->prepare($query);
+    $query->bindParam(":SONID", $_REQUEST['SONID']);
+    $query->execute();
+    databaseError($conn->errorInfo());
+    echo "<h3>Categories</h3><table>  <thead>
+    <tr>
+      <th>Category</th>
+      <th>Contracts Count</th>
+      <th>Total Contract Value</th>
+    </tr>
+  </thead>";
+    foreach ($query->fetchAll() as $row) {
+        setlocale(LC_MONETARY, 'en_US');
+        $value = number_format(doubleval($row['value']), 2);
+        $category = urlencode($row['category']);
+        echo("<tr>
+    <td><B><a href='displayCategory.php?category=$category'>{$row['category']}</a></b></td>
+    <td>{$row['count']}</td>
+    <td>\$$value</td>
+    </tr>");
+    }
+    echo "</table><br/>";
+
+    $query = 'SELECT "supplierABN", text_mode("supplierName") AS "supplierName", count(*), sum(value) AS value FROM contractnotice
+ WHERE ' . $yearQ . ' "childCN" IS NULL AND "SONID" = :SONID GROUP BY "supplierABN"
+ UNION SELECT abn AS "supplierABN",name AS "supplierName",0 AS sum,0 AS value FROM standingoffer_suppliers 
+ WHERE "SONID" = :SONID AND abn NOT IN (SELECT DISTINCT "supplierABN" AS abn FROM contractnotice WHERE "SONID" = :SONID)';
+    $query = $conn->prepare($query);
+    $query->bindParam(":SONID", $_REQUEST['SONID']);
+    $query->execute();
+    databaseError($conn->errorInfo());
     echo '<br><a href="https://www.tenders.gov.au/?event=public.advancedsearch.CNSONRedirect&type=sonSearchEvent&SONID=' . $_REQUEST['SONID'] . '"> View original record @ tenders.gov.au</a><br>';
 
-    echo "<table>  <thead>
+    echo "<h3>Suppliers</h3><table>  <thead>
     <tr>
       <th>Supplier</th>
       <th>Contracts Count</th>
       <th>Total Contract Value</th>
     </tr>
   </thead>";
-foreach ($query->fetchAll() as $row) {
-    setlocale(LC_MONETARY, 'en_US');
-    $value = number_format(doubleval($row['value']) , 2);
-    $supplier = stripslashes($row['supplierABN'] . '-' . $row['supplierName']);
-    echo ("<tr>
+    foreach ($query->fetchAll() as $row) {
+        setlocale(LC_MONETARY, 'en_US');
+        $value = number_format(doubleval($row['value']), 2);
+        $supplier = stripslashes($row['supplierABN'] . '-' . $row['supplierName']);
+        echo("<tr>
     <td><b><a href=\"displaySupplier.php?supplier={$supplier}\">{$row['supplierName']}</a></b></td>
     <td>{$row['count']}</td>
     <td>\$$value</td>
     </tr>");
-  }
-    echo "</table><table>  <thead>
+    }
+    echo "</table><br/><h3>Contracts</h3><table>  <thead>
     <tr>
       <th>Contract Notice Number</th>
       <th>Contract Description</th>
@@ -56,52 +74,52 @@
       <th>Supplier</th>
     </tr>
   </thead>";
-  $query = 'SELECT "CNID", description, value, "agencyName", contractnotice."SONID", "contractStart", "supplierName"
-    FROM contractnotice 
-    WHERE '.$yearQ.' "childCN" is null 
+    $query = 'SELECT "CNID", title, description, value, "agencyName", contractnotice."SONID", "contractStart", "supplierName"
+    FROM contractnotice INNER JOIN standingoffers ON contractnotice."SONID" = standingoffers."SONID"
+    WHERE ' . $yearQ . ' "childCN" IS NULL 
     AND contractnotice."SONID" = :SONID
-    ORDER BY value DESC';
-$query = $conn->prepare($query);
-$query->bindParam(":SONID", $_REQUEST['SONID']);
-	$query->execute();
-		databaseError($conn->errorInfo());
-  foreach ($query->fetchAll() as $row) {
-    setlocale(LC_MONETARY, 'en_US');
-    $value = number_format(doubleval($row['value']) , 2);
-    echo ("<tr>
+    ORDER BY VALUE DESC';
+    $query = $conn->prepare($query);
+    $query->bindParam(":SONID", $_REQUEST['SONID']);
+    $query->execute();
+    databaseError($conn->errorInfo());
+    foreach ($query->fetchAll() as $row) {
+        setlocale(LC_MONETARY, 'en_US');
+        $value = number_format(doubleval($row['value']), 2);
+        echo("<tr>
     <td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td>
     <td><b>{$row['description']}</b></a></td>
     <td>\$$value</td><td>{$row['agencyName']}</td>
     <td>{$row['contractStart']}</td>
     <td>{$row['supplierName']}</td>
     </tr>");
-  }
-  echo "</table>";
+    }
+    echo "</table>";
 } else {
     /*
      split by main categories
     */
     include_header("Standing Offers");
-$query = 'SELECT sum(value), count(*), contractnotice."SONID", min(title) as title
-FROM contractnotice inner join standingoffers on contractnotice."SONID" = standingoffers."SONID"
-WHERE '.$yearQ.' "childCN" is null and contractnotice."SONID" != \'\'
-GROUP BY contractnotice."SONID" ORDER BY sum(value) DESC ';
-$query = $conn->prepare($query);
-	$query->execute();
-		databaseError($conn->errorInfo());
-  echo "<table>  <thead>
+    $query = 'SELECT sum(value), count(*), contractnotice."SONID", min(title) AS title
+FROM contractnotice INNER JOIN standingoffers ON contractnotice."SONID" = standingoffers."SONID"
+WHERE ' . $yearQ . ' "childCN" IS NULL AND contractnotice."SONID" != \'\'
+GROUP BY contractnotice."SONID" ORDER BY sum(VALUE) DESC ';
+    $query = $conn->prepare($query);
+    $query->execute();
+    databaseError($conn->errorInfo());
+    echo "<table>  <thead>
     <tr>
       <th>SONID</th>
       <th>Total Contracts Value</th>
       <th>Number of Contracts</th>
     </tr>
   </thead>";
-  foreach ($query->fetchAll() as $row) {
-  setlocale(LC_MONETARY, 'en_US');
-  $value = number_format(doubleval($row['sum']) , 2);
-  echo ("<tr><td><A href=\"displaySON.php?SONID={$row['SONID']}\"><b>{$row['title']}</b></a></td><td>\$$value</td><td>{$row['count']}</td></tr>");
-}
-echo "</table>";
+    foreach ($query->fetchAll() as $row) {
+        setlocale(LC_MONETARY, 'en_US');
+        $value = number_format(doubleval($row['sum']), 2);
+        echo("<tr><td><A href=\"displaySON.php?SONID={$row['SONID']}\"><b>{$row['title']}</b></a></td><td>\$$value</td><td>{$row['count']}</td></tr>");
+    }
+    echo "</table>";
 }
 include_footer();
 

--- a/displaySupplier.php
+++ b/displaySupplier.php
@@ -1,57 +1,122 @@
 <?php
 
-include_once ("./lib/common.inc.php");
+include_once("./lib/common.inc.php");
 if ($_REQUEST['supplier']) {
     $supplierS = htmlentities(strip_tags($_REQUEST['supplier']));
-$title = $supplierName;
-if ($supplierABN) {
-  $query = 'SELECT text_mode("supplierName") as "supplierName" from contractnotice where "supplierABN" = :supplierABN group by "supplierABN"';
-$query = $conn->prepare($query);
-$query->bindParam(":supplierABN", $supplierABN);
+    $title = $supplierName;
+    if ($supplierABN) {
+        $query = 'SELECT text_mode("supplierName") AS "supplierName" FROM contractnotice WHERE "supplierABN" = :supplierABN GROUP BY "supplierABN"';
+        $query = $conn->prepare($query);
+        $query->bindParam(":supplierABN", $supplierABN);
         $query->execute();
-                databaseError($conn->errorInfo());
+        databaseError($conn->errorInfo());
         $title = reset($query->fetchAll())['supplierName'];
-}
-    include_header(str_replace("%","",$title));
-echo '<center><h1>'.str_replace("%","",$title).'</h1></center>';
-    agenciesGraph();
-   /*
-    * Make supplier name the most common name for this ABN
-    * Common names and uncommon names
-    * Common categories and uncommon categories
-    * Procurement method in text, seperate Open via SON from Open
-    * Consultancies, Confidentialities percentage
-    */
-$query = 'select contractnotice."SONID", min(title) as title, count(*), sum(value) as value from contractnotice inner join standingoffers on contractnotice."SONID" = standingoffers."SONID" WHERE ' .$yearQ . ' ' .
-            $supplierQ . ' ' . $standardQ
-            . ' and contractnotice."SONID" != \'\' group by contractnotice."SONID"';
-$query = $conn->prepare($query);
+    }
+    include_header(str_replace("%", "", $title));
+    echo '<center><h1>' . str_replace("%", "", $title) . '</h1></center>';
+    /*
+     * Common names and uncommon names
+     * Procurement method in text, seperate Open via SON from Open
+     * Consultancies, Confidentialities percentage
+     */
+    $query = 'SELECT category, min("categoryUNSPSC") AS "categoryUNSPSC", count(*) AS count, sum(value) AS value FROM contractnotice 
+  WHERE ' . $supplierQ . " " . $standardQ . ' GROUP BY category ORDER BY count(*) DESC LIMIT 10';
+    $query = $conn->prepare($query);
+    if ($supplierParts[0] > 0) {
+        $query->bindParam(":supplierABN", $supplierABN);
+    } else {
+        $query->bindParam(":supplierName", $supplierName);
+    }
+    $query->execute();
+    databaseError($conn->errorInfo());
 
 
-  if ($supplierParts[0] > 0) {
-    $query->bindParam(":supplierABN", $supplierABN);
-  } else {
-      $query->bindParam(":supplierName", $supplierName);
-  }
+    echo "<h3>Categories</h3><table>  <thead>
+    <tr>
+      <th>Category</th>
+      <th>Contracts Count</th>
+      <th>Total Contract Value</th>
+    </tr>
+  </thead>";
+    foreach ($query->fetchAll() as $row) {
+        setlocale(LC_MONETARY, 'en_US');
+        $value = number_format(doubleval($row['value']), 2);
+        $category = urlencode($row['category']);
+        echo("<tr>
+    <td><B><a href='displayCategory.php?category=$category'>{$row['category']}</a></b></td>
+    <td>{$row['count']}</td>
+    <td>\$$value</td>
+    </tr>");
+    }
+    echo "</table><br/>";
+
+
+    $query = 'SELECT SUM("value") AS "value", count(*), MAX(contractnotice."agencyName") AS agencyname FROM contractnotice JOIN agency_nametoabn ON contractnotice."agencyName"=agency_nametoabn."agencyName"  
+WHERE ' . $yearQ . ' ' . $supplierQ . ' "childCN" IS NULL 
+GROUP BY abn ORDER BY SUM("value") DESC';
+    $query = $conn->prepare($query);
+    if (count($supplierParts) > 0) {
+        if ($supplierParts[0] > 0) {
+            $query->bindParam(":supplierABN", $supplierABN);
+        } else {
+            $query->bindParam(":supplierName", $supplierName);
+        }
+    }
     $query->execute();
     databaseError($conn->errorInfo());
-echo "<h3>Standing Offers/Panels</h3><table>  <thead>
+
+    echo "<h3>Agencies</h3><table>  <thead>
+    <tr>
+      <th>Agency</th>
+      <th>Contracts Count</th>
+      <th>Total Contract Value</th>
+    </tr>
+  </thead>";
+    foreach ($query->fetchAll() as $row) {
+        setlocale(LC_MONETARY, 'en_US');
+        $value = number_format(doubleval($row['value']), 2);
+        $agency =urlencode($row['agencyname']);
+        echo("<tr>
+    <td><B><a href=\"displayAgency.php?agency=$agency\">{$row['agencyname']}</a></b></td>
+    <td>{$row['count']}</td>
+    <td>\$$value</td>
+    </tr>");
+    }
+    echo "</table><br/>";
+
+    $query = 'SELECT contractnotice."SONID", min(title) AS title, count(*), sum(value) AS value FROM contractnotice INNER JOIN standingoffers ON contractnotice."SONID" = standingoffers."SONID" WHERE ' . $yearQ . ' ' .
+        $supplierQ . ' ' . $standardQ
+        . ' AND contractnotice."SONID" != \'\' GROUP BY contractnotice."SONID"';
+    $query = $conn->prepare($query);
+
+
+    if ($supplierParts[0] > 0) {
+        $query->bindParam(":supplierABN", $supplierABN);
+    } else {
+        $query->bindParam(":supplierName", $supplierName);
+    }
+    $query->execute();
+    databaseError($conn->errorInfo());
+$sonrows = "";
+    foreach ($query->fetchAll() as $row) {
+        setlocale(LC_MONETARY, 'en_US');
+        $value = number_format(doubleval($row['value']), 2);
+        $sonrows .= "<tr>
+    <td><B><a href=\"displaySON.php?SONID={$row['SONID']}\">{$row['title']}</a></b></td>
+    <td>{$row['count']}</td>
+    <td>\$$value</td>
+    </tr>";
+    }
+    if (strlen($sonrows) > 1) {
+        echo "<h3>Standing Offers/Panels</h3><table>  <thead>
     <tr>
       <th>Standing Offer</th>
       <th>Contracts Count</th>
       <th>Total Contract Value</th>
     </tr>
-  </thead>";
-    foreach ($query->fetchAll() as $row) {
-     setlocale(LC_MONETARY, 'en_US');
-        $value = number_format(doubleval($row['value']), 2);
-        echo ("<tr>
-    <td><B><a href=\"displaySON.php?SONID={$row['SONID']}\">{$row['title']}</a></b></td>
-    <td>{$row['count']}</td>
-    <td>\$$value</td>
-    </tr>");
+  </thead>$sonrows</table><br/>";
     }
-    echo "</table><table><h3>Contracts</h3>  <thead>
+    echo "<table><h3>Contracts</h3>  <thead>
     <tr>
       <th>Contract Notice Number</th>
       <th>Contract Description</th>
@@ -63,24 +128,24 @@
   </thead>";
     $query = 'SELECT "CNID", "description", "value", "agencyName", "category",
     "contractStart", "supplierName"
-    FROM contractnotice WHERE ' .$yearQ . ' ' .
-            $supplierQ . ' ' . $standardQ
-            . ' ORDER BY value DESC';
-    
+    FROM contractnotice WHERE ' . $yearQ . ' ' .
+        $supplierQ . ' ' . $standardQ
+        . ' ORDER BY VALUE DESC';
+
     $query = $conn->prepare($query);
 
 
-  if ($supplierParts[0] > 0) {
-    $query->bindParam(":supplierABN", $supplierABN);
-  } else {
-      $query->bindParam(":supplierName", $supplierName);
-  }
+    if ($supplierParts[0] > 0) {
+        $query->bindParam(":supplierABN", $supplierABN);
+    } else {
+        $query->bindParam(":supplierName", $supplierName);
+    }
     $query->execute();
     databaseError($conn->errorInfo());
     foreach ($query->fetchAll() as $row) {
         setlocale(LC_MONETARY, 'en_US');
         $value = number_format(doubleval($row['value']), 2);
-        echo ("<tr>
+        echo("<tr>
     <td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td>
     <td><b>{$row['description']}</b></a></td>
     <td>\$$value</td><td>{$row['agencyName']}</td>
@@ -95,16 +160,16 @@
      */
     include_header("Suppliers");
     suppliersGraph();
-    $query = 'SELECT SUM("value") as val, text_mode("supplierName") as supplierName, "supplierABN",(
- case when "supplierABN" != 0 THEN lower("supplierABN"::text) ELSE lower("supplierName") END) as supplierID 
+    $query = 'SELECT SUM("value") AS val, text_mode("supplierName") AS supplierName, "supplierABN",(
+ CASE WHEN "supplierABN" != 0 THEN lower("supplierABN"::TEXT) ELSE lower("supplierName") END) AS supplierID 
 FROM contractnotice
-WHERE ' .$yearQ . ' "childCN" is null
+WHERE ' . $yearQ . ' "childCN" IS NULL
 GROUP BY supplierID,"supplierABN"
 ORDER BY val DESC
 LIMIT 100';
     $query = $conn->prepare($query);
     $query->execute();
-        databaseError($conn->errorInfo());
+    databaseError($conn->errorInfo());
     echo "<table>  <thead>
     <tr>
        <th>Position</th>
@@ -117,7 +182,7 @@
         setlocale(LC_MONETARY, 'en_US');
         $value = number_format(doubleval($row['val']), 2);
         $supplier = stripslashes($row['supplierABN'] . '-' . $row['suppliername']);
-        echo ("<tr><td>$i</td><td><b><a href=\"displaySupplier.php?supplier={$supplier}\">" . ucsmart($row['suppliername']) . "</a></b></td><td>\$$value</td></tr>\n");
+        echo("<tr><td>$i</td><td><b><a href=\"displaySupplier.php?supplier={$supplier}\">" . ucsmart($row['suppliername']) . "</a></b></td><td>\$$value</td></tr>\n");
         $i++;
     }
     echo "</table>";

--- a/lib/common.inc.php
+++ b/lib/common.inc.php
@@ -4,7 +4,7 @@
 error_reporting(E_ALL ^ E_NOTICE);
 
 
-$conn = new PDO("pgsql:dbname=contractdashboard;user=postgres;password=snmc;host=localhost");
+$conn = new PDO("pgsql:dbname=contractdashboard;user=alex;host=localhost");
 
 if (!$conn) {
     die("A database error occurred.\n");
@@ -14,7 +14,7 @@
 if (strstr($_SERVER['PHP_SELF'], "labs/") || strstr($_SERVER['PHP_SELF'], "admin/") || strstr($_SERVER['PHP_SELF'], "heuristics/")) {
     $basePath = "../";
 }
-require ROOT . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'openid.php';
+/*require ROOT . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'openid.php';
 require(ROOT.'/solarium/vendor/autoload.php');
 require(ROOT.'/solarium/library/Solarium/Autoloader.php');
 Solarium\Autoloader::register();
@@ -61,7 +61,7 @@
     } else {
         login();
     }
-}
+}*/
 
 //   $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 function databaseError($errMsg) {
@@ -96,6 +96,7 @@
 function array_sum_all($a) {
     if (!is_array($a))
         return $a;
+    $totale = 0;
     foreach ($a as $key => $value)
         $totale += array_sum_all($value);
     return $totale;
@@ -273,12 +274,12 @@
         </div><!-- /topbar-wrapper -->
         <script type="text/javascript">
                         	
-/*            var options_xml = {
+            var options_xml = {
                 script: function (input) { return "search_autosuggest.php?input="+input; },
                 varname:"input",
                 callback: function (obj) { document.getElementById('searchID').value = obj.id; }
             };
-            var as_xml = new bsn.AutoSuggest('searchKeyword', options_xml);*/
+            var as_xml = new bsn.AutoSuggest('searchKeyword', options_xml);
         </script>
         <div class="container-fluid">
             <div class="row-fluid">
@@ -309,7 +310,7 @@
                 global $start;
                 $end = (float) array_sum(explode(' ', microtime()));
 
-                echo '</div>  <footer> <small>        Incorporates AusTender materials under a Creative Commons Attribution 3.0 Australia licence (CC BY 3.0 AU) https://creativecommons.org/licenses/by/3.0/au/ <br/> AusTender materials are released by the Department of Finance. <br/> AusTender materials are subject to change and should be verified on the AusTender website to ensure the information is up to date and correct: www.tenders.gov.au. <br/>' . "Processing time: " . sprintf("%.4f", ($end - $start)) . " seconds" . '</small>  </footer>';
+                echo '</div>  <footer>' . "Processing time: " . sprintf("%.4f", ($end - $start)) . " seconds" . '  <footer>';
 
                     if (strpos($_SERVER['SERVER_NAME'], ".gs")) {
                     ?>

--- a/media/css/demo_table.css
+++ b/media/css/demo_table.css
@@ -32,9 +32,9 @@
 
 .dataTables_wrapper {
 	position: relative;
-	min-height: 302px;
+	/*min-height: 302px;*/
 	clear: both;
-	_height: 302px;
+	/*_height: 302px;*/
 	zoom: 1; /* Feeling sorry for IE */
 }
 

--- a/media/css/demo_table_jui.css
+++ b/media/css/demo_table_jui.css
@@ -105,8 +105,8 @@
 
 .dataTables_wrapper {
 	position: relative;
-	min-height: 302px;
-	_height: 302px;
+	/*min-height: 302px;
+	_height: 302px;*/
 	clear: both;
 }