<?php include_once 'init.php';
$SQlStr="SELECT top 1 case when OrderDate is null then RequiredDate else OrderDate end as OrderDate,ShipType,PaymentType,Remark,Status FROM Orders  where OrderID='".$_GET['oid']."' ";
//echo $SQlStr.'<br>';
	
 
			 $values = $orders->query($SQlStr);
if (is_iterable($values)){
  foreach ($values as $pSQlStr1)
			{ 
				$OrderDateFin=$pSQlStr1['OrderDate']; 
				$ShipTypeFin=$pSQlStr1['ShipType']; 
				$PaymentTypeFin=$pSQlStr1['PaymentType']; 
				$RemarkFin=$pSQlStr1['Remark']; 
				$StatusFin=$pSQlStr1['Status']; 
switch ( $ShipTypeFin) {
    case "takeaway":
        $ShipTypeFin='外卖';
        break;
    case "inside":
        $ShipTypeFin='店内';
        break;
    case "takemyself":
        $ShipTypeFin='自提';
        break;
    default:
       $ShipTypeFin='外卖';
}
switch ($PaymentTypeFin) {
    case "cash":
        $PaymentTypeFin='现金';
        break;
    case "vor":
        $PaymentTypeFin='饭票';
        break;
    case "other":
        $PaymentTypeFin='其他';
        break;
    default:
       $PaymentTypeFin='现金';
}
}
			//return $theValue;
		} 
?>
<p>下单时间：<?php echo $OrderDateFin;?> </p>
<p>单号：<?php echo $_GET['oid'];?> </p>
<p>状态：<?php echo $StatusFin;?> </p>
                                        
<table width="100%"   class="ui-responsive ui-shadow"  id="myTable" data-role="table"  data-filter="true" data-input="#myFilter" data-autodividers="true"  data-mode="columntoggle:none">	 <tbody> 	
 <?php 
 	$SQlStr="select  UserCode,ProductName,Quantity from [Order Details] where OrderID= ".$_GET['oid']." Order by OrderID";
	//echo $SQlStr;
		 
			 $values = $orders->query($SQlStr);
if (is_iterable($values)){
  foreach ($values as $pOrdersDetails)
			{  $Line1++;  ?>

                                   <tr>
                                   <td align="left" valign="top"><?php echo $pOrdersDetails['Quantity']. " x ".$pOrdersDetails['ProductName'] ;?></td>
                                 </tr>
                       	<?php }
} 
			$SQlStr="SELECT top 1 sum(UnitPrice*Quantity)  FROM [Order Details]  where OrderID='".$_GET['oid']."'  group by   OrderID ";
		 
		 	$values = $orders->query($SQlStr);
if (is_iterable($values)){
  foreach ($values as $pSQlStr)
			{ 
				$theTotalValue=$pSQlStr[0]; 
				//echo $theTotalValue;
			}
			//return $theValue;
		} 


?>  </tbody>
</table> <br />
<b>总价：</b><span style="  font-size:14px ; width:90%; height:16px; line-height:16px " id="myDivTotal"><?php echo number_format($theTotalValue,2);?></span>                                     <p>订单类型：
                                       <?php echo $ShipTypeFin;?> </p>
                                     <p>支付方式：                                       <?php echo $PaymentTypeFin;?> </p>
                                     <hr />留言：<?php echo $RemarkFin; ?>
 
