<?php | <?php |
include_once ("./lib/common.inc.php"); | include_once ("./lib/common.inc.php"); |
if ($_REQUEST['agency']) { | if ($_REQUEST['agency']) { |
include_header("Agency"); | |
$agency = htmlentities(strip_tags($_REQUEST['agency'])); | $agency = htmlentities(strip_tags($_REQUEST['agency'])); |
//MethodCountGraph($agency); | include_header($agency); |
// CnCGraph($agency); | echo '<center><h1>'.$agency.'</h1></center>'; |
//MethodValueGraph($agency); | // MethodCountGraph($agency); |
// CnCGraph($agency); | |
// MethodValueGraph($agency); | |
/* biggest contracts | /* biggest contracts |
spending by year | spending by year |
spending by industry/category | spending by industry/category |
spending by supplier | spending by supplier |
spread procurement methods (stacked bar graph) | spread procurement methods (stacked bar graph) |
+ percent consultancies + percent confidential (bar graph) | + percent consultancies + percent confidential (bar graph) |
Average value by procurement type | Average value by procurement type |
--- info | --- info |
website, procurement plan, annual reports | website, procurement plan, annual reports |
Breakdown of divisions/branches | Breakdown of divisions/branches |
Breakdown percentage,number,value by procurement type | Breakdown percentage,number,value by procurement type |
Histograph, overlaying number value reported per week over X years | Histograph, overlaying number value reported per week over X years |
Compliance statistics: amendments, delay in reporting average and number completely late */ | Compliance statistics: amendments, delay in reporting average and number completely late */ |
$query = 'SELECT "CNID", "description", "value", "agencyName", "category", | $query = 'SELECT "CNID", "description", "value", "agencyName", "category", |
"contractStart", "supplierName" | "contractStart", "supplierName" |
FROM contractnotice | FROM contractnotice |
WHERE "agencyName" = :agency | WHERE "agencyName" = :agency |
ORDER BY "value" DESC limit 100'; | ORDER BY "value" DESC limit 100'; |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":agency", $agency); | $query->bindParam(":agency", $agency); |
$query->execute(); | $query->execute(); |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
echo "<table> <thead> | echo "<table> <thead> |
<tr> | <tr> |
<th>Contract Notice Number</th> | <th>Contract Notice Number</th> |
<th>Contract Description</th> | <th>Contract Description</th> |
<th>Total Contract Value</th> | <th>Total Contract Value</th> |
<th>Agency</th> | <th>Agency</th> |
<th>Contract Start Date</th> | <th>Contract Start Date</th> |
<th>Supplier</th> | <th>Supplier</th> |
</tr> | </tr> |
</thead>"; | </thead>"; |
foreach ($query->fetchAll() as $row) { | foreach ($query->fetchAll() as $row) { |
setlocale(LC_MONETARY, 'en_US'); | setlocale(LC_MONETARY, 'en_US'); |
$value = number_format(doubleval($row['value']), 2); | $value = number_format(doubleval($row['value']), 2); |
echo ("<tr> | echo ("<tr> |
<td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td> | <td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td> |
<td><b>{$row['description']}</b></a></td> | <td><b>{$row['description']}</b></a></td> |
<td>\$$value</td><td>{$row['agencyName']}</td> | <td>\$$value</td><td>{$row['agencyName']}</td> |
<td>{$row['contractStart']}</td> | <td>{$row['contractStart']}</td> |
<td>{$row['supplierName']}</td> | <td>{$row['supplierName']}</td> |
</tr>"); | </tr>"); |
} | } |
echo "</table>"; | echo "</table>"; |
} else { | } else { |
/* | /* |
split by portfolio | split by portfolio |
*/ | */ |
include_header("Agencies"); | include_header("Agencies"); |
agenciesGraph(); | agenciesGraph(); |
$query = 'SELECT SUM("value"), "agencyName" | $query = 'SELECT SUM("value"), "agencyName" |
FROM contractnotice | FROM contractnotice |
WHERE "childCN" is null | WHERE "childCN" is null |
GROUP BY "agencyName" '; | GROUP BY "agencyName" '; |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->execute(); | $query->execute(); |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
echo "<table> <thead> | echo "<table> <thead> |
<tr> | <tr> |
<th>Agency</th> | <th>Agency</th> |
<th>Total Contracts Value</th> | <th>Total Contracts Value</th> |
</tr> | </tr> |
</thead>"; | </thead>"; |
foreach ($query->fetchAll() as $row) { | foreach ($query->fetchAll() as $row) { |
setlocale(LC_MONETARY, 'en_US'); | setlocale(LC_MONETARY, 'en_US'); |
$value = number_format(doubleval($row[0]), 2); | $value = number_format(doubleval($row[0]), 2); |
$agency = stripslashes($row[1]); | $agency = stripslashes($row[1]); |
echo ("<tr><td><b><a href=\"displayAgency.php?agency={$agency}\">{$agency}</a></b></td><td>\$$value</td></tr>\n"); | echo ("<tr><td><b><a href=\"displayAgency.php?agency={$agency}\">{$agency}</a></b></td><td>\$$value</td></tr>\n"); |
} | } |
echo "</table>"; | echo "</table>"; |
} | } |
include_footer(); | include_footer(); |
?> | ?> |
<?php | <?php |
include_once("./lib/common.inc.php"); | include_once("./lib/common.inc.php"); |
include_header("Contract"); | |
$query = 'SELECT * | $query = 'SELECT * |
FROM contractnotice | FROM contractnotice |
WHERE "CNID" = :CNID LIMIT 1'; | WHERE "CNID" = :CNID LIMIT 1'; |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":CNID", $_REQUEST['CNID']); | $query->bindParam(":CNID", $_REQUEST['CNID']); |
$query->execute(); | $query->execute(); |
$contractResult = $query->fetch(PDO::FETCH_ASSOC); | |
if (!$contractResult) { | |
header("Status: 404 Not Found"); | |
header("HTTP/1.0 404 Not Found"); | |
include_header("Contract Not Found"); | |
echo "<center><h1>No Contract Notice with that ID found</h1></center>"; | |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) { | } else { |
$description = ucsmart($contractResult["description"]); | |
include_header($description); | |
echo '<center><h1>'.$description.'</h1></center>'; | |
databaseError($conn->errorInfo()); | |
setlocale(LC_MONETARY, 'en_US'); | setlocale(LC_MONETARY, 'en_US'); |
foreach (array_filter($row) as $key => $value) { | foreach (array_filter($contractResult) as $key => $value) { |
echo "<b>$key</b> "; | echo "<b>$key</b> "; |
switch ($key) { | switch ($key) { |
case "supplierName": | case "supplierName": |
case "supplierABN": | case "supplierABN": |
echo '<a href="displaySupplier.php?supplier=' . $row['supplierABN'] . '-' . urlencode($row['supplierName']) . '">' . $value . "</a>"; | echo '<a href="displaySupplier.php?supplier=' . $contractResult['supplierABN'] . '-' . urlencode($contractResult['supplierName']) . '">' . $value . "</a>"; |
break; | break; |
case "agencyName": | case "agencyName": |
echo '<a href="displayAgency.php?agency=' . urlencode($value) . '">' . $value . "</a>"; | echo '<a href="displayAgency.php?agency=' . urlencode($value) . '">' . $value . "</a>"; |
break; | break; |
case "value": | case "value": |
echo "$" . number_format(doubleval($value), 2); | echo "$" . number_format(doubleval($value), 2); |
break; | break; |
default: | default: |
echo str_replace(" ", "<br>", $value); | echo str_replace(" ", "<br>", ucsmart($value)); |
} | } |
echo "<br>"; | echo "<br>"; |
} | } |
} | |
echo '<br><a href="https://www.tenders.gov.au/?event=public.advancedsearch.keyword&keyword=CN' . $_REQUEST['CNID'] . '"> View original record @ tenders.gov.au</a><br>'; | echo '<br><a href="https://www.tenders.gov.au/?event=public.advancedsearch.keyword&keyword=CN' . $_REQUEST['CNID'] . '"> View original record @ tenders.gov.au</a><br>'; |
$query = 'SELECT * FROM heuristic_results where "CNID" = :CNID'; | $query = 'SELECT * FROM heuristic_results where "CNID" = :CNID'; |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$agencyName = $input . '%'; | $agencyName = $input . '%'; |
$query->bindParam(":CNID", $_REQUEST['CNID']); | $query->bindParam(":CNID", $_REQUEST['CNID']); |
$query->execute(); | $query->execute(); |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
foreach ($query->fetchAll() as $r) { | foreach ($query->fetchAll() as $r) { |
echo "<b>{$r['heuristic_name']}</b>: {$r['heuristic_value']} (raw value: {$r['raw_value']}, mean: {$r['mean']}, stddev: {$r['stddev']})<br>"; | echo "<b>{$r['heuristic_name']}</b>: {$r['heuristic_value']} (raw value: {$r['raw_value']}, mean: {$r['mean']}, stddev: {$r['stddev']})<br>"; |
} | } |
} | |
include_footer(); | include_footer(); |
?> | ?> |
<?php | <?php |
include_once ("./lib/common.inc.php"); | include_once ("./lib/common.inc.php"); |
if ($_REQUEST['supplier']) { | if ($_REQUEST['supplier']) { |
include_header("Supplier"); | |
$supplierS = htmlentities(strip_tags($_REQUEST['supplier'])); | $supplierS = htmlentities(strip_tags($_REQUEST['supplier'])); |
include_header(str_replace("%","",$supplierName)); | |
echo '<center><h1>'.str_replace("%","",$supplierName).'</h1></center>'; | |
// MethodCountGraph($supplierS); | // MethodCountGraph($supplierS); |
// CnCGraph($supplierS); | // CnCGraph($supplierS); |
// MethodValueGraph($supplierS); | // MethodValueGraph($supplierS); |
/* lobbyist ties | /* lobbyist ties |
links to ABR/ASIC/Google News/ASX/Court records | links to ABR/ASIC/Google News/ASX/Court records |
total value to various agencies (bar graph) | total value to various agencies (bar graph) |
spread procurement methods + percent consultancies + percent confidential (bar graph) | spread procurement methods + percent consultancies + percent confidential (bar graph) |
spread of contract values | spread of contract values |
spread of industries (textual?) */ | spread of industries (textual?) */ |
$query = 'SELECT "CNID", "description", "value", "agencyName", "category", | $query = 'SELECT "CNID", "description", "value", "agencyName", "category", |
"contractStart", "supplierName" | "contractStart", "supplierName" |
FROM contractnotice WHERE ' . | FROM contractnotice WHERE ' . |
$supplierQ . ' ' . $standardQ | $supplierQ . ' ' . $standardQ |
. ' ORDER BY value DESC'; | . ' ORDER BY value DESC'; |
echo $query; | echo $query; |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
if ($supplierParts[0] > 0) { | if ($supplierParts[0] > 0) { |
$query->bindParam(":supplierABN", $supplierABN); | $query->bindParam(":supplierABN", $supplierABN); |
} else { | } else { |
$query->bindParam(":supplierName", $supplierName); | $query->bindParam(":supplierName", $supplierName); |
} | } |
$query->execute(); | $query->execute(); |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
// echo '<img src="graphs/displayMethodCountGraph.php?month=' . stripslashes($supplier) . '">'; | // echo '<img src="graphs/displayMethodCountGraph.php?month=' . stripslashes($supplier) . '">'; |
// echo '<img src="graphs/displayCnCGraph.php?month=' . stripslashes($supplier) . '">'; | // echo '<img src="graphs/displayCnCGraph.php?month=' . stripslashes($supplier) . '">'; |
echo "<table> <thead> | echo "<table> <thead> |
<tr> | <tr> |
<th>Contract Notice Number</th> | <th>Contract Notice Number</th> |
<th>Contract Description</th> | <th>Contract Description</th> |
<th>Total Contract Value</th> | <th>Total Contract Value</th> |
<th>Agency</th> | <th>Agency</th> |
<th>Contract Start Date</th> | <th>Contract Start Date</th> |
<th>Supplier</th> | <th>Supplier</th> |
</tr> | </tr> |
</thead>"; | </thead>"; |
foreach ($query->fetchAll() as $row) { | foreach ($query->fetchAll() as $row) { |
setlocale(LC_MONETARY, 'en_US'); | setlocale(LC_MONETARY, 'en_US'); |
$value = number_format(doubleval($row['value']), 2); | $value = number_format(doubleval($row['value']), 2); |
echo ("<tr> | echo ("<tr> |
<td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td> | <td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td> |
<td><b>{$row['description']}</b></a></td> | <td><b>{$row['description']}</b></a></td> |
<td>\$$value</td><td>{$row['agencyName']}</td> | <td>\$$value</td><td>{$row['agencyName']}</td> |
<td>{$row['contractStart']}</td> | <td>{$row['contractStart']}</td> |
<td>{$row['supplierName']}</td> | <td>{$row['supplierName']}</td> |
</tr>"); | </tr>"); |
} | } |
echo "</table>"; | echo "</table>"; |
} else { | } else { |
/* | /* |
histograph of supplier size/value | histograph of supplier size/value |
*/ | */ |
include_header("Suppliers"); | include_header("Suppliers"); |
suppliersGraph(); | suppliersGraph(); |
$query = 'SELECT SUM("value") as val, MAX("supplierName") as supplierName, "supplierABN",( | $query = 'SELECT SUM("value") as val, MAX("supplierName") as supplierName, "supplierABN",( |
case when "supplierABN" != 0 THEN "supplierABN"::text ELSE "supplierName" END) as supplierID | case when "supplierABN" != 0 THEN "supplierABN"::text ELSE "supplierName" END) as supplierID |
FROM contractnotice | FROM contractnotice |
WHERE "childCN" is null | WHERE "childCN" is null |
GROUP BY supplierID,"supplierABN" | GROUP BY supplierID,"supplierABN" |
ORDER BY val DESC | ORDER BY val DESC |
LIMIT 100'; | LIMIT 100'; |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->execute(); | $query->execute(); |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
echo "<table> <thead> | echo "<table> <thead> |
<tr> | <tr> |
<th>Position</th> | <th>Position</th> |
<th>Supplier</th> | <th>Supplier</th> |
<th>Total Contract Value</th> | <th>Total Contract Value</th> |
</tr> | </tr> |
</thead>"; | </thead>"; |
$i = 1; | $i = 1; |
foreach ($query->fetchAll() as $row) { | foreach ($query->fetchAll() as $row) { |
setlocale(LC_MONETARY, 'en_US'); | setlocale(LC_MONETARY, 'en_US'); |
$value = number_format(doubleval($row['val']), 2); | $value = number_format(doubleval($row['val']), 2); |
$supplier = stripslashes($row['supplierABN'] . '-' . $row['suppliername']); | $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++; | $i++; |
} | } |
echo "</table>"; | echo "</table>"; |
} | } |
include_footer(); | include_footer(); |
?> | ?> |