category breakdown
[contractdashboard.git] / index.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
<?php
include_once ("./lib/common.inc.php");
include_header("Home");
?>
        <div class="hero-unit">
          <h1>Contract Dashboard</h1>
        </div>
<table>
<?php
$query = 'SELECT DATE("importDate") d FROM contractnotice ORDER BY "importDate" DESC limit 1';
$query = $conn->prepare($query);
$query->execute();
databaseError($conn->errorInfo());
$date = $query->fetch();
$query = 'SELECT * FROM contractnotice where DATE("importDate") = ? 
OFFSET random()*(select count(*) from contractnotice where DATE("importDate") = ?) LIMIT 10';
$query = $conn->prepare($query);
$query->execute(Array($date[0],$date[0]));
databaseError($conn->errorInfo());
$res = $query->fetchAll(PDO::FETCH_ASSOC);
 
foreach ($res as $row) {
setlocale(LC_MONETARY, 'en_US');
        $value = number_format(doubleval($row['value']), 2);
        echo ("<tr>
    <td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td>
    <td><b>{$row['description']}</b></a></td>
    <td>\$$value</td><td>{$row['agencyName']}</td>
    <td>{$row['contractStart']}</td>
    <td>{$row['supplierName']}</td>
    </tr>");
}
echo "</table>";
include_footer();
?>