<?php |
<?php |
|
|
include_once ("./lib/common.inc.php"); |
include_once ("./lib/common.inc.php"); |
include_header("Amendments"); |
if ($year == "") { |
$query = 'select "CNID", description, value, pvalue, (value - pvalue) as diff from contractnotice, |
$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' . |
(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'; |
' where ' . $agencyQ . $yearQ . ' "CNID" = ccn AND (value - pvalue) <> 0 order by diff DESC'; |
$query = $conn->prepare($query); |
$query = $conn->prepare($query); |
$query->execute(); |
$query->execute(); |
databaseError($conn->errorInfo()); |
databaseError($conn->errorInfo()); |
echo "<table> <thead> |
echo "<h1>Amendments - Published Year $year</h1><table> <thead> |
<tr> |
<tr> |
<th>Contract</th> |
<th>Contract</th> |
<th>Original Value</th> |
<th>Original Value</th> |
<th>Amended Value</th> |
<th>Amended Value</th> |
<th>Difference</th> |
<th>Difference</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); |
$pvalue = number_format(doubleval($row['pvalue']), 2); |
$pvalue = number_format(doubleval($row['pvalue']), 2); |
$diff = number_format(doubleval($row['diff']), 2); |
$diff = number_format(doubleval($row['diff']), 2); |
echo ("<tr>"); |
echo ("<tr>"); |
echo "<td><A href=\"displayContract.php?CNID={$row['CNID']}\"><b>{$row['description']}</b></a></td>"; |
echo "<td><A href=\"displayContract.php?CNID={$row['CNID']}\"><b>{$row['description']}</b></a></td>"; |
echo "<td>\$$pvalue</td><td>\$$value</td><td>\$$diff</td></tr>"; |
echo "<td>\$$pvalue</td><td>\$$value</td><td>\$$diff</td></tr>"; |
} |
} |
|
|
echo "</table>"; |
echo "</table>"; |
include_footer(); |
include_footer(); |
?> |
?> |
|
|