--- a/displaySON.php +++ b/displaySON.php @@ -9,7 +9,11 @@ $title = reset($query->fetchAll())['title']; include_header($title); echo "<center><h1>" . $_REQUEST['SONID'] . " - " . $title . "</h1></center>"; - + 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>'; + /* + * 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 "SONID" = :SONID @@ -45,7 +49,6 @@ $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 "<h3>Suppliers</h3><table> <thead> <tr> @@ -96,11 +99,9 @@ } echo "</table>"; } else { - /* - split by main categories - */ + include_header("Standing Offers"); - $query = 'SELECT sum(value), count(*), contractnotice."SONID", min(title) AS title + $query = 'SELECT sum(value), count(*), contractnotice."SONID", min(title) AS title, text_mode(category) as category 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 '; @@ -110,6 +111,7 @@ echo "<table> <thead> <tr> <th>SONID</th> + <th>Main category</th> <th>Total Contracts Value</th> <th>Number of Contracts</th> </tr> @@ -117,7 +119,9 @@ 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>"); + $title = $row['SONID']; + if (strlen($row['title']) > 1) $title = $row['title']; + echo("<tr><td><A href=\"displaySON.php?SONID={$row['SONID']}\"><b>$title</b></a></td><td>{$row['category']}</td><td>\$$value</td><td>{$row['count']}</td></tr>"); } echo "</table>"; }