<?include "./auth.inc.php";
if ($date)
$wsql="SELECT week('$date')";
else
$wsql="SELECT week(now())";
$wres=mysql_query($wsql);
if ($wres && !mysql_error())
$weeknew=mysql_result($wres,0);
#print $weeknew;
if (!$week)
$week=$weeknew;
$sql="SELECT Notes.CustomerID,
DATE_FORMAT(NoteDate,'%b %D %k:%i')as nd, NoteText,
NoteTypeName,
NoteAuthor, FirstName, LastName
FROM Notes, NoteTypes, MasterAccounts
WHERE week(nd) = '$week'
ORDER by $NoteText;
$res=mysql_query($sql);
print "report for week $week<BR>";
print "<FORM>See Week <INPUT TYPE=text name=week> <input type=submit></FORM>";
?>
<?
if (!$n)
$n=20;
if ($recent){
$sql="SELECT Notes.CustomerID,
DATE_FORMAT(NoteDate,'%b %D %k:%i')as nd, NoteText,
NoteTypeName,
NoteAuthor, FirstName, LastName
FROM Notes, NoteTypes, MasterAccounts
WHERE NoteType=NoteTypeID
AND Notes.CustomerID=MasterAccounts.CustomerID
ORDER BY NoteDate DESC LIMIT $n";
}else{
if ($CustomerID)
$sql="SELECT NoteDate as nd, NoteText, NoteTypeName,
NoteAuthor
FROM Notes,NoteTypes WHERE NoteType=NoteTypeID
AND CustomerID=$CustomerID
ORDER BY NoteDate DESC";
else{
header("Location: frmain.php");
exit;
}
}
include "mysql.inc.php";
$result=mysql_query($sql);
?>
<HTML>
<HEAD>
<TITLE>Notes</TITLE>
</HEAD>
<BODY MYSTERYTAG="Bruce make this look better">
<CENTER><A HREF="addnote.php">Add another Note Now</A></CENTER>
<BR><BR>
Notes for User:
<BR>
<TABLE>
<?
while ($row=mysql_fetch_array($result)){
$i++;
if ($i%2)
$bg= "#EEEEEE";
else
$bg= "#DDDDDD";
print "<TR bgcolor=$bg><TD colspan=2><A HREF=\"user.php?ID=$row[CustomerID]\">$row[FirstName] $row[LastName]</A> $row[nd]</TD>";
print "<TD rowspan=2>$row[NoteText]</TD></TR>";
print "<TR bgcolor=$bg><TD>$row[NoteTypeName]</TD><TD>$row[NoteAuthor]</TD></TR>";
}
?>
</TABLE>
</BODY>
</HTML>