Merge branch 'master' of /git/contractdashboard
[contractdashboard.git] / displayContract.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
 
include_once("./lib/common.inc.php");
include_header("Contract");
$query = 'SELECT *
FROM contractnotice
WHERE  "CNID" = :CNID LIMIT 1';
 
$query = $conn->prepare($query);
$query->bindParam(":CNID", $_REQUEST['CNID']);
$query->execute();
databaseError($conn->errorInfo());
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
    setlocale(LC_MONETARY, 'en_US');
    foreach (array_filter($row) as $key => $value) {
        echo "<b>$key</b>&nbsp;";
        switch ($key) {
            case "supplierName":
            case "supplierABN":
                echo '<a href="displaySupplier.php?supplier=' . $row['supplierABN'] . '-' . urlencode($row['supplierName']) . '">' . $value . "</a>";
                break;
            case "agencyName":
                echo '<a href="displayAgency.php?agency=' . urlencode($value) . '">' . $value . "</a>";
                break;
            case "value":
                echo "$" . number_format(doubleval($value), 2);
                break;
            default:
                echo str_replace("  ", "<br>", $value);
        }
        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>';
 
 
$query = 'SELECT * FROM `heuristic_results` where "CNID" = :CNID';
$query = $conn->prepare($query);
$agencyName = $input . '%';
$query->bindParam(":CNID", $_REQUEST['CNID']);
$query->execute();
databaseError($conn->errorInfo());
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>";
}
 
include_footer();
?>