Change references to numeric child/parent IDs which can now be text
[contractdashboard.git] / displayCategory.php
blob:a/displayCategory.php -> blob:b/displayCategory.php
<?php <?php
include_once ("./lib/common.inc.php"); include_once ("./lib/common.inc.php");
if ($_REQUEST['category']) { if ($_REQUEST['category']) {
include_header("Category"); include_header($_REQUEST['category']." goods and services");
echo "<center><h1>".$_REQUEST['category']."</h1></center>"; echo "<center><h1>".$_REQUEST['category']."</h1></center>";
$query = "SELECT CNID, description, value, agencyName, category, contractStart, supplierName $query = 'SELECT "CNID", description, value, "agencyName", category, "contractStart", "supplierName"
FROM `contractnotice` FROM contractnotice
WHERE childCN is null WHERE "childCN" is null
AND category = '" . $_REQUEST['category'] . "' AND category = :category
ORDER BY value DESC"; ORDER BY value DESC';
$result = mysql_query($query); $query = $conn->prepare($query);
echo "<table> <thead> $query->bindParam(":category", $_REQUEST['category']);
<tr> $query->execute();
<th>Contract Notice Number</th> databaseError($conn->errorInfo());
<th>Contract Description</th>  
<th>Total Contract Value</th> echo "<table> <thead>
<th>Agency</th> <tr>
<th>Contract Start Date</th> <th>Contract Notice Number</th>
<th>Supplier</th> <th>Contract Description</th>
</tr> <th>Total Contract Value</th>
</thead>"; <th>Agency</th>
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { <th>Contract Start Date</th>
setlocale(LC_MONETARY, 'en_US'); <th>Supplier</th>
$value = number_format(doubleval($row['value']) , 2); </tr>
echo ("<tr> </thead>";
<td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td> foreach ($query->fetchAll() as $row) {
<td><b>{$row['description']}</b></a></td> setlocale(LC_MONETARY, 'en_US');
<td>\$$value</td><td>{$row['agencyName']}</td> $value = number_format(doubleval($row['value']) , 2);
<td>{$row['contractStart']}</td> echo ("<tr>
<td>{$row['supplierName']}</td> <td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td>
</tr>"); <td><b>{$row['description']}</b></a></td>
} <td>\$$value</td><td>{$row['agencyName']}</td>
echo "</table>"; <td>{$row['contractStart']}</td>
mysql_free_result($result); <td>{$row['supplierName']}</td>
} else { </tr>");
/* }
split by main categories echo "</table>";
*/ } else {
include_header("Categories"); /*
$query = "SELECT sum(value), category split by main categories
FROM `contractnotice` */
WHERE childCN is null include_header("Categories");
GROUP BY category ORDER BY sum(value) DESC "; $query = 'SELECT sum(value), category
$result = mysql_query($query); FROM contractnotice
echo "<table> <thead> WHERE "childCN" is null
<tr> GROUP BY category ORDER BY sum(value) DESC ';
<th>Category</th> $query = $conn->prepare($query);
<th>Total Contracts Value</th> $query->execute();
</tr> databaseError($conn->errorInfo());
</thead>"; echo "<table> <thead>
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { <tr>
setlocale(LC_MONETARY, 'en_US'); <th>Category</th>
$value = number_format(doubleval($row[0]) , 2); <th>Total Contracts Value</th>
echo ("<tr><td><A href=\"displayCategory.php?category={$row[1]}\"><b>{$row[1]}</b></a></td><td>\$$value</td></tr>"); </tr>
} </thead>";
echo "</table>"; foreach ($query->fetchAll() as $row) {
mysql_free_result($result); setlocale(LC_MONETARY, 'en_US');
} $value = number_format(doubleval($row[0]) , 2);
include_footer(); echo ("<tr><td><A href=\"displayCategory.php?category={$row[1]}\"><b>{$row[1]}</b></a></td><td>\$$value</td></tr>");
  }
  echo "</table>";
  }
  include_footer();
?> ?>