<?php
require "./Cart.php";

adminHeader("$Company","Administrative Functions");

$sql =    "SELECT o.OrderNumber, o.Date, o.OrderTotal, o.OrderStatus, b.Name, o.PaymentCycle, o.bPayMethod, o.PaymentStatus " .
     "FROM Orders o, Buyers b " .
     "WHERE o.BuyerID = b.BuyerID AND o.OrderStatus = 'processing' " .
     "ORDER BY OrderNumber";
$result=mysql_query($sql);

echo "<FORM method=\"post\" action=\"$PHP_SELF?topic=searchReceiptsResponse.php\">";
echo '<INPUT type="submit" name="search" value="Show all orders">';
echo '</FORM>';

blueFont("Arial","<B>Orders which have not been processed yet:</B><BR>");
echo "<TABLE border=1>";
echo "<TR><TD>Ord#</td><td>Date</td><td>Buyer</td><td>Value</td><td>Payment Method</td><td>Payment Status</td><td>Status</td></tr>";
$i = 0;
while (list($onumber, $odate, $ototal, $ostatus, $bname, $opaymentcycle, $opaymentmethod, $opaymentstatus) = mysql_fetch_row($result)) {
     list($null,$null,$odate) = split(':',$odate);

     switch ($opaymentcycle) {
     case 'O': $PC = 'one time'; break;
     case 'W': $PC = 'weekly subscription'; break;
     case 'M': $PC = 'monthly subscription'; break;
     case 'Y': $PC = 'yearly subscription'; break;
     }

     $opaymentstatus = $opaymentstatus == 0 ? 'Not Paid' : 'Paid';

     fontFace("Arial","<TR><td>$onumber</td><td>$odate</td><td>$bname</td><td>$ototal ($PC)</td><td>$opaymentmethod</td><td>$opaymentstatus</td><td>$ostatus</td>");
     fontFace("Arial","<td><A href=$PHP_SELF?topic=receipt.php&ON=$onumber>View</a></td");
     fontFace("Arial","</TR>");
     $i++;
}
echo "</TABLE>";

if ($i == 0)
     blueFont("Arial","<B>No new orders today</B><BR><BR>");

adminFooter($Relative);
?>

