--- a/displayAmendments.php +++ b/displayAmendments.php @@ -1,14 +1,19 @@ <?php include_once ("./lib/common.inc.php"); -include_header("Amendments"); -$query = 'select "CNID", description, value, pvalue, (value - pvalue) as diff from contractnotice, +if ($year == "") { + $year = 2015; + $yearQ = 'extract(year from "contractStart") = ' . $year . " AND "; +} + +include_header("Amendments - Published Year ".$year); +$query = 'select "CNID", "publishDate", description, value, pvalue, (value - pvalue) as diff from contractnotice, (SELECT "CNID" as cn, "childCN" as ccn, value as pvalue FROM contractnotice where "childCN" is not null) a' . ' where ' . $agencyQ . $yearQ . ' "CNID" = ccn AND (value - pvalue) <> 0 order by diff DESC'; $query = $conn->prepare($query); $query->execute(); databaseError($conn->errorInfo()); -echo "<table> <thead> +echo "<h1>Amendments - Published Year $year</h1><table> <thead> <tr> <th>Contract</th> <th>Original Value</th>