new sitemap.xml
[contractdashboard.git] / displayAgency.php
blob:a/displayAgency.php -> blob:b/displayAgency.php
--- a/displayAgency.php
+++ b/displayAgency.php
@@ -16,6 +16,7 @@
 sum((("procurementMethod" = \'Open\' OR "procurementMethod" = \'Open tender\') AND "SONID" IS NOT null)::int) AS "openSON",
 sum(("procurementMethod" = \'Prequalified tender\' OR "procurementMethod" = \'Select\')::INT) AS prequalified,
 sum(("procurementMethod" = \'Direct\' OR "procurementMethod" = \'Limited tender\')::int) AS limited,
+sum("value") as total_value,
 COUNT(*) AS total
 FROM contractnotice 
  WHERE "agencyName" LIKE :agency AND ' . " $yearQ $standardQ "   ;
@@ -112,12 +113,16 @@
     "contractStart", "supplierName"
     FROM contractnotice
     WHERE ' . $yearQ . ' "agencyName" LIKE :agency AND "childCN" IS NULL
-    ORDER BY "value" DESC LIMIT 100';
+    ORDER BY "value" DESC';
+if ($yearQ == '') $query .=' LIMIT 1000';
     $query = $conn->prepare($query);
     $query->bindParam(":agency", $agency);
     $query->execute();
     databaseError($conn->errorInfo());
-
+if ($query->rowCount() > 999 && $yearQ == '') {
+// if 1000 records warn too many results
+print "<b> More than 1000 results found so only first 1000 shown. Please filter by year to see all results </b>";
+}
     echo "<h3>Contracts</h3><table>  <thead>
     <tr>
       <th>Contract Notice Number</th>