<?
$result = mysql_query("SELECT count(*) AS num FROM invoices WHERE clientid = '$id'");
$num = mysql_result($result,0,"num");
if ($num < 1){
//printf("<td align=left><font face=Verdana size=1 color=red>There are no Records</font></td>",$num); //prints number
echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#000000 width=100%>";
echo "<tr align=top>
<td class=topHeadrow4><b>There are no Records</b></td></tr></table>";
return false;
}
else
{
$result = mysql_query("SELECT * FROM invoices WHERE clientid = '$id' ORDER BY id",$db);
}
echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#000000 width=100%>";
echo "<tr align=top>
<td class=topHeadrow5><b>Inv. #</b></td>
<td class=topHeadrow5><b>Invoice Date</b></td>
<td class=topHeadrow5><b>Due Date</b></td>
<td class=topHeadrow5><b>Total</b></td>
<td class=topHeadrow5><b>Status</b></td>
<td class=topHeadrow5> </td></tr>";
while ($irow = mysql_fetch_array($result))
{
$id = $irow["id"];
$date = $irow["date"];
$bill_date = $irow["bill_date"];
$due_date = $irow["due_date"];
$paid_date = $irow["paid_date"];
$dateshow = fixDate($date);
$dateshow1 = fixDate($bill_date);
$dateshow2 = fixDate($due_date);
$dateshow3 = fixDate($paid_date);
$total = $irow["total"];
$status = $irow["status"];
if ($alternate == "1") {
$color = "#ffffff";
$alternate = "2";
}
else {
$color = "#c0c0c0";
$alternate = "1";
}
echo "<tr valign=top bgcolor=$color>
<td>$id</td>
<td NOWRAP>$dateshow</td>
<td NOWRAP>$dateshow2</td>
<td align=right>$currency$total</td>";
if($status == "paid"){
echo "<td bgcolor=#33cc33>$status</td>";
}else{
echo "<td>$status</td>";
}
echo "<td>[ <a href='admin_invoice.php?id=$id'>view</a> ] [ <a href='admin_invoice_print.php?id=$id'>Print</a> ]</td></tr>";
}
echo "</table>";
?>