--- a/displaySupplier.php +++ b/displaySupplier.php @@ -1,41 +1,58 @@ '; - echo ''; - echo ''; - /*lobbyist ties - - links to ABR/ASIC/Google News/ASX/Court records - - total value to various agencies (bar graph) - - spread procurement methods + percent consultancies + percent confidential (bar graph) - - spread of contract values - - spread of industries (textual?)*/ - $query = 'SELECT "CNID", "description", "value", "agencyName", "category", - "contractStart", "supplierName" - FROM contractnotice WHERE '. - $supplierQ.' '.$standardQ - .' ORDER BY value DESC'; - echo $query; + + $supplierS = htmlentities(strip_tags($_REQUEST['supplier'])); + include_header(str_replace("%","",$supplierName)); +echo '

'.str_replace("%","",$supplierName).'

'; + agenciesGraph(); + // MethodCountGraph($supplierS); + // CnCGraph($supplierS); + // MethodValueGraph($supplierS); + /* lobbyist ties + + links to ABR/ASIC/Google News/ASX/Court records + + total value to various agencies (bar graph) + + spread procurement methods + percent consultancies + percent confidential (bar graph) + + spread of contract values + + spread of industries (textual?) */ + // echo ''; + // echo ''; +$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); -//$query->bindParam(":supplierName", $supplierName); -$query->bindParam(":supplierABN", $supplierABN); - $query->execute(); - if (!$query) { - databaseError($conn->errorInfo()); - } -echo ''; - echo ''; - echo " + if ($supplierParts[0] > 0) { + $query->bindParam(":supplierABN", $supplierABN); + } else { + $query->bindParam(":supplierName", $supplierName); + } + $query->execute(); + databaseError($conn->errorInfo()); +echo "
+ + + + + + "; + foreach ($query->fetchAll() as $row) { + setlocale(LC_MONETARY, 'en_US'); + $value = number_format(doubleval($row['value']), 2); + echo (" + + + + "); + } + echo "
Standing OfferContracts CountTotal Contract Value
{$row['title']}{$row['count']}\$$value
@@ -45,51 +62,66 @@ "; - foreach ($query->fetchAll() as $row) { - setlocale(LC_MONETARY, 'en_US'); - $value = number_format(doubleval($row['value']) , 2); - echo (" + $query = 'SELECT "CNID", "description", "value", "agencyName", "category", + "contractStart", "supplierName" + 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); + } + $query->execute(); + databaseError($conn->errorInfo()); + foreach ($query->fetchAll() as $row) { + setlocale(LC_MONETARY, 'en_US'); + $value = number_format(doubleval($row['value']), 2); + echo (""); - } - echo "
Contract Notice Number Contract DescriptionSupplier
{$row['CNID']} {$row['description']} \$$value{$row['agencyName']} {$row['contractStart']} {$row['supplierName']}
"; + } + echo ""; } else { /* - histograph of supplier size/value - */ -include_header("Suppliers"); - $query = 'SELECT SUM("value") as val, MAX("supplierName") as supplierName, "supplierABN",( - case when "supplierABN" != 0 THEN "supplierABN"::text ELSE "supplierName" END) as supplierID + histograph of supplier size/value + */ + include_header("Suppliers"); + suppliersGraph(); + $query = 'SELECT SUM("value") as val, mode("supplierName") as supplierName, "supplierABN",( + case when "supplierABN" != 0 THEN lower("supplierABN"::text) ELSE lower("supplierName") END) as supplierID FROM contractnotice -WHERE "childCN" = 0 +WHERE ' .$yearQ . ' "childCN" is null GROUP BY supplierID,"supplierABN" ORDER BY val DESC LIMIT 100'; -$query = $conn->prepare($query); - $query->execute(); - if (!$query) { - databaseError($conn->errorInfo()); - } - echo " + $query = $conn->prepare($query); + $query->execute(); + databaseError($conn->errorInfo()); + echo "
"; -$i = 1; - foreach ($query->fetchAll() as $row) { - setlocale(LC_MONETARY, 'en_US'); - $value = number_format(doubleval($row['val']) , 2); - $supplier = stripslashes($row['supplierABN'].'-'.$row['suppliername']); - echo ("\n"); - $i++; - } - echo "
Position Supplier Total Contract Value
$i".ucsmart($row['suppliername'])."\$$value
"; + $i = 1; + foreach ($query->fetchAll() as $row) { + setlocale(LC_MONETARY, 'en_US'); + $value = number_format(doubleval($row['val']), 2); + $supplier = stripslashes($row['supplierABN'] . '-' . $row['suppliername']); + echo ("$i" . ucsmart($row['suppliername']) . "\$$value\n"); + $i++; + } + echo ""; } include_footer(); ?>