<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Viewing Customer Order Information</TITLE>
</HEAD>
<BODY>

<?php
/***************************************************************************
 *			view_order-info.php                                *
 *                     	          				           *
 *   File Info:		 Viewing orders info.                              *
 *   Copyright:       Copyright 2003 http://www.128concepts.com            *
 *						                           *
 ***************************************************************************/
include ("./header-only.inc");
include ("./tests.php");
 if ((session_is_registered("admin")) and ($_SESSION['admin'] != "admin"))
{
	 echo "<p align=\"center\"><b><strong><font face = Verdana size = 5>Sorry you not the administrator!</strong></font></b><br>Click here to return to log in screen <a href='shop_showall.php'>here.</a><br><br><br><br><br><br></p>";
	include("./your-footer.inc");  
	exit();
}

?>

<?php
echo "<center><img src=images/searching.gif border=0><br><font face=verdana size=3 color=#000080>Viewing Records from your CUSTOMER ORDER</font></center><br>";
include("./config.php");

$orderid =  getenv("QUERY_STRING"); 
$table = "custdet";
$conn = @mysql_connect($server,$user,$password)
	or die("Unable to connect to SQL database...");
$rs = @mysql_select_db($database,$conn) 
	or die("Unable to select the database...Please press 'Create Database' to create new database.");
$sql = " SELECT * from $table where orderid = '$orderid'";

$rs = mysql_query($sql,$conn)
	or die("Could not execute SQL query!!! Possibly SQL query already been executed.");
echo"<table width=35% border=0 align=center cellspacing=0 cellpadding=0>
  <tr bgcolor=#B8C9D8>
    <td width=8 height=27><img src=images/tl.gif width=8 height=27></td>
    <td height=27 background=images/tbg.gif align=center><font face=verdana size=2><b>YOUR ORDER DETAILS</b></font></td>
    <td width=8 height=27><img src=images/tr.gif width=8 height=27></td>
  </tr></table>";

?>
<br>
<p align = "center"><font face = "Verdana" size = 3">Below are the details for your order <?php echo("'$orderid'");?></p>
<?php 
$list = "<center><table border =\"1\" cellpadding =\"2\" bgcolor = $backcolor>";
$list.="<th>Order ID</th>";
$list.="<th>PRODUCT</th>";
$list.="<th>QUANTITY</th>";
$list.="<th>PRICE</th>";
$list.="<th>TOTAL PRICE</th>";
$list.="</tr>";

while($row = mysql_fetch_array($rs))
{
	$order = $row["orderid"];
	$qty = $row["qty"];
	$product = $row["product"];
	$price = $row["price"];
	$totalprice = $row["totalprice"];
	$pcurrency = $row["currency"];
	$list.= "<tr bgcolor = #FFFFFF>";
	$list.="<td>$order</td>";
	$list.="<td>$product</td>";
	$list.="<td>$qty</td>";
	######## display information for non-world currency ########
	if ($wcurrency == "NO" && $pcurrency == "NO")
	{
		$list.="<td>$currency$price</td>";
		$list.="<td>$currency$totalprice</td>";
	}
	else if ($wcurrency != "NO" && $pcurrency == "YES")
	{	######### world currency ##########
		$list.="<td>($wcurrency)$price</td>";
		$list.="<td>($wcurrency)$totalprice</td>";
	}
	if ($wcurrency != "NO" && $pcurrency == "NO")
	{
		$list.="<td>($currency)$price</td>";
		$list.="<td>($currency)$totalprice</td>";
	}
	if ($wcurrency == "NO" && $pcurrency == "YES")
	{
		$list.="<td>($currency)$price</td>";
		$list.="<td>($currency)$totalprice</td>";
	}
	$list.="</tr>";
}
$list.= "</table></center>";
echo($list);
$get_itemtot = "SELECT SUM(totalprice) FROM $table
		WHERE orderid = '$orderid'";

$itemtot_result = mysql_query($get_itemtot) 
	or die("SQL command failed - Couldn't get total");

$itemtot = mysql_result($itemtot_result,0,"SUM(totalprice)");

$fmt_itemtot = sprintf("%0.2f",$itemtot);
if ($wcurrency == "NO" && $pcurrency == "NO")
{
echo "<br><center><strong>TOTAL ORDER $currency$fmt_itemtot</strong></center>";
}
else	############ world currency total ##################
{

if ($pcurrency == "YES")
{
if ($wcurrency != "NO")
echo "<br><center>The shopping cart is using world currency   ";
if ($wcurrency == "ARS")
	echo "<img src = ./images/argntina.gif></td>";
if ($wcurrency == "BRL")
	echo "<img src = ./images/brazil.gif></td>";
if ($wcurrency == "BND")
	echo "<img src = ./images/brunei.gif></td>";
if ($wcurrency == "CNY")
	echo "<img src = ./images/china.gif></td>";
if ($wcurrency == "EGY")
	echo "<img src = ./images/egypt.gif></td>";
if ($wcurrency == "HKD")
	echo "<img src = ./images/hngkng97.gif></td>";
if ($wcurrency == "INR")
	echo "<img src = ./images/india.gif></td>";
if ($wcurrency == "IDR")
	echo "<img src = ./images/indonsia.gif></td>";
if ($wcurrency == "KWD")
	echo "<img src = ./images/kuwait.gif></td>";
if ($wcurrency == "MYR")
	echo "<img src = ./images/malaysia.gif></td>";
if ($wcurrency == "NZD")
	echo "<img src = ./images/newzeal.gif></td>";
if ($wcurrency == "NOR")
	echo "<img src = ./images/norway.gif></td>";
if ($wcurrency == "PKR")
	echo "<img src = ./images/pakistan.gif></td>";
if ($wcurrency == "PHP")
	echo "<img src = ./images/phillipn.gif><td>";
if ($wcurrency == "PLN")
	echo "<img src = ./images/poland.gif></td>";
if ($wcurrency == "ROL")
	echo "<img src = ./images/romania.gif></td>";
if ($wcurrency == "RUR")
	echo "<img src = ./images/russia.gif></td>";
if ($wcurrency == "SAR")
	echo "<img src = ./images/saudiar.gif></td>";
if ($wcurrency == "SGD")
	echo " <img src = ./images/singapor.gif></td>";
if ($wcurrency == "ZAR")
	echo "<img src = ./images/safrica.gif></td>";
if ($wcurrency == "KRW")
	echo "<img src = ./images/skorea.gif></td>";
if ($wcurrency == "SEK")
	echo "<img src = ./images/sweden.gif></td>";
if ($wcurrency == "CHF")
	echo "<img src = ./images/switzrld.gif></td>";
if ($wcurrency == "TWD")
echo "<img src = ./images/taiwan.gif></td>";
if ($wcurrency == "THB")
	echo "<img src = ./images/thailand.gif></td>";
if ($wcurrency == "VND")
	echo "<img src = ./images/vietnam.gif></td>";	
echo "</center>";
}
if ($pcurrency == "YES")
{
if ($wcurrency != "NO")
	echo "<br><br><center><strong>TOTAL ORDER ($wcurrency)$fmt_itemtot</strong></center>";
if ($scurrency == "gbp") 
	$newtotal = $fmt_itemtot * $conv1;
if ($scurrency == "usd")
	$newtotal = $fmt_itemtot * $conv2;
if ($scurrency == "eur") 
	$newtotal = $fmt_itemtot * $conv3;
if ($scurrency == "jpy")
	$newtotal = $fmt_itemtot * $conv4;
if ($scurrency == "cad")
	$newtotal = $fmt_itemtot * $conv5;
if ($wcurrency != "NO")
	$newtotal =  sprintf("%0.2f",$newtotal);
if ($wcurrency != "NO")
	echo "<br><center><strong>TOTAL ORDER ($currency)$newtotal</strong></center>";
else
	echo "<br><center><strong>TOTAL ORDER ($currency)$fmt_itemtot</strong></center>";
}else
	echo "<br><center><strong>TOTAL ORDER $currency$fmt_itemtot</strong></center>";
}
echo("<br><center><a href = javascript:window.close('acePopup')>Close Window</a></center><br>");
echo "<center><a href=javascript:history.back()><img src=images/previous-1.gif border=0 height=18></a></center><br>";

echo "<center>Back to main store page<a href = ./store.php><img src=images/back-to.gif border=0 alt = Back></a></center><br>";
echo "<br><br><center><font face = Verdana size = 3 color = $highlight>$footer</font><br>";

?>
</BODY>
</HTML>