if ($StockID != '') {
// Stock Notes
$SQL = "SELECT
noteid,
stockid,
href,
note,
date,
priority
FROM stocknotes
WHERE stockid='" . $StockID . "'
ORDER BY date DESC";
$result = DB_query($SQL);
if(DB_num_rows($result) <> 0) {
echo '<br /><div class="centre"><img src="' . $RootPath . '/css/' . $Theme . '/images/note_add.png" title="' . _('Stock Notes') . '" alt="" />' . ' ' . _('Stock Notes') . '</div><br />';
echo '<table style="width: 45%;">';
echo '<tr>
<th class="ascending">' . _('Date') . '</th>
<th>' . _('Note') . '</th>
<th>' . _('Hyperlink') . '</th>
<th class="ascending">' . _('Priority') . '</th>
<th>' . _('Edit') . '</th>
<th>' . _('Delete') . '</th>
<th> <a href="AddStockNotes.php?StockID=', urlencode($StockID), '">' . ' ' . _('Add New Note') . '</a> </th>
</tr>';
$k = 0;// row colour counter
while ($myrow = DB_fetch_array($result)) {
if($k == 1) {
echo '<tr class="OddTableRows">';
$k = 0;
}// $k == 1
else {
echo '<tr class="EvenTableRows">';
$k = 1;
}
echo '<td>' . ConvertSQLDate($myrow['date']) . '</td>
<td>' . $myrow['note'] . '</td>
<td><a href="' . $myrow['href'] . '">' . $myrow['href'] . '</a></td>
<td>' . $myrow['priority'] . '</td>
<td><a href="AddStockNotes.php?Id=' . $myrow['noteid'] . '&StockID=' . $myrow['stockid'] . '">' . _('Edit') . '</a></td>
<td><a href="AddStockNotes.php?Id=' . $myrow['noteid'] . '&StockID=' . $myrow['stockid'] . '&delete=1">' . _('Delete') . '</a></td>
</tr>';
}// END WHILE LIST LOOP
echo '</table>';
}// end if there are stock notes to display
else {
if($StockID != '') {
echo '<br /><div class="centre"><img src="' . $RootPath . '/css/' . $Theme . '/images/note_add.png" title="' . _('Stock Notes') . '" alt="" /><a href="AddStockNotes.php?StockID=', urlencode($StockID), '">' . ' ' . _('Add New Note for this Stock') . '</a></div>';
}
}
}