--- a/displaySupplier.php
+++ b/displaySupplier.php
@@ -14,11 +14,39 @@
}
include_header(str_replace("%", "", $title));
echo '
' . str_replace("%", "", $title) . '
';
- /*
- * Common names and uncommon names
- * Procurement method in text, seperate Open via SON from Open
- * Consultancies, Confidentialities percentage
- */
+if ($supplierABN) {
+ $query = 'SELECT distinct on (lower("supplierName")) "supplierName" from contractnotice where "supplierABN" = :supplierABN';
+ $query = $conn->prepare($query);
+ $query->bindParam(":supplierABN", $supplierABN);
+ $query->execute();
+ databaseError($conn->errorInfo());
+ echo "Also known as: ".implode(', ', $query->fetchAll(PDO::FETCH_COLUMN, 0));
+}
+
+ $query = '
+ SELECT
+sum((consultancy = \'Yes\')::int) AS consultancy,
+sum(("confidentialityContract" = \'Yes\')::int) AS "confidentialityContract",
+sum(("confidentialityOutputs" = \'Yes\')::int) AS "confidentialityOutputs",
+sum((("procurementMethod" = \'Open\' OR "procurementMethod" = \'Open tender\') AND "SONID" IS null)::int) AS open,
+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,
+COUNT(*) AS total
+FROM contractnotice
+WHERE' . $supplierQ . " " . $standardQ ;
+ $query = $conn->prepare($query);
+ if ($supplierParts[0] > 0) {
+ $query->bindParam(":supplierABN", $supplierABN);
+ } else {
+ $query->bindParam(":supplierName", $supplierName);
+ }
+ $query->execute();
+ databaseError($conn->errorInfo());
+
+ $stats = reset($query->fetchAll());
+ show_stats($stats);
+
$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);