<?php
include("dbconnect.php");
include("admin/globalfunctions.php");

if($_GET['id']!="")
	$studentID=$_GET['id'];

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Lunch Pails - Lunch Program for Schools, hot lunches for kids at school <?php if(trim($ttit)!="") echo "-".$ttit;?></title>
	<style>
	.fs12{font-size: 13px;font-family:verdana;}
	</style>
</head>
<body>
<table width="550" cellpadding="1" cellspacing="3" border="0" class='fs12'>
		<tr bgcolor="#C6E7F9" align='center'>
			<td>&nbsp;<b>Date Ordered</b></td>
			<td><b>Lunch Ordered</b></td>
			<td><b>Description</b></td>
		</tr>
		
		<?php
		$ddate=date('Y-m-d');
		$sdate=$ddate." 00:00:00";

		$strSql2 =@mysql_query("SELECT a.detail_id,a.service_date,a.item_snack,a.item_drink,c.menu_name,d.item_type FROM tr_orderdetails a left join tr_orders b on b.order_id=a.order_id left join tr_menu c on c.menu_id=a.item_ordered left join ma_itemtype d on d.itemtype_id=a.item_type where b.student_id='".$studentID."' and a.service_date>'".$sdate."' order by service_date");
	
		$cntr2=@mysql_num_rows($strSql2);
		if($cntr2>0)
		{
			while($rs1=@mysql_fetch_array($strSql2))
			{

				 if($sw=='1')
					{
					  $col="#F2FAFD";
					   $sw=0;
					}
					else
					{
					  $col="#EBF5FC";
					  $sw=1;
					}
															
				$sDate=	date('F',strtotime($rs1["service_date"]))." ".date('d',strtotime($rs1["service_date"]))." ".date('Y',strtotime($rs1["service_date"]));

			?>
				<tr valign="top" bgcolor="<?=$col?>">
					<td nowrap>&nbsp;<?=$sDate?></td>
					<td>&nbsp;&nbsp;<?=$rs1["menu_name"]?><br/>&nbsp;&nbsp;<i><u>Snack:</u> <?=getSD($rs1["item_snack"])?></i><br/>&nbsp;&nbsp;<i><u>Drink:</u> <?=getSD($rs1["item_drink"])?></i></td>
					<td>&nbsp;&nbsp;<?=$rs1["item_type"]?></td>
				</tr>
					
				<?php
			}
		}
		else
		{
			echo "<tr><td colspan='3' align='center'>There's no Order for this Student!</td></tr>";
			echo "<tr><td colspan='3'><hr /></td></tr>"; 
		}
		?>
	</table>