<?php
session_start();
require_once "../init.php";
require_once "../authority.inc.php";
if($_GET['OrderID'])
{
	$OrderID = $_GET['OrderID'];
}
else
{
	$OrderID = $_POST['OrderID'];
}
if($_GET['key'])
{
	$key = $_GET['key'];
}
else
{
	$key = $_POST['key'];
}
if($_GET['backUrl'])
{
	$backUrl = $_GET['backUrl'];
}
else
{
	$backUrl = $_POST['backUrl'];
}
$Amount = $_POST['Amount'];
$About = $_POST['About'];
$Period = $_POST['Period'];
$UserName =  $_POST['UserName'];
$iStatus = $_POST['iStatus'];
$iDoing = $_POST['iDoing'];
$dtCreate = $_POST['dtCreate'];
$dtExpiry = $_POST['dtExpiry'];
$Edit = $_POST['Edit'];
$wuliu = $_POST['wuliu'];

if(!CheckHashKey('order'.$OrderID,$key)){
   $DB->close();
   die("非法入侵");
}
/****** 订单信息 ******/
if(!$Edit){
	$sql="select * from `order` where OrderID='$OrderID'";
	$result=$DB->query($sql);
	$row=$DB->fetch_array($result);
	$dkey = GetHashKey('order'.$row[OrderID]);
	$ukey = GetHashKey('users'.$row[UserName]);
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改订单</title>
<LINK href="../share/style.css" rel=stylesheet>
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/admin/lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/admin/lib/icheck/icheck.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/style.css" />

<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<script src='../share/global.js'></script>
</head>
<body>
<div class="page-container">
<table width="100%" border="0" cellpadding="1" cellspacing="1">
  <tr>
    <td><? include "order_nav.inc.php"?></td>
  </tr>
  <tr>
    <td height="3" bgcolor="#55555"></td>
  </tr>
  <tr>
    <td height="128" valign="top" align="center">
	  <?
	  if($Edit==1){
		  $sql="update `order` set UserName='$UserName',About='$About',Amount='$Amount',Period='$Period',".
			  "iStatus='$iStatus',dtCreate='$dtCreate',dtExpiry='$dtExpiry',iDoing='$iDoing',wuliu='$wuliu' where OrderID=$OrderID";
		  $DB->query($sql);
		  echo "<br><br><br>订单  <font color='blue'> $OrderID $Domain </font>修改成功";
		  echo "<br><br><br><a href='order_edit.php?OrderID=".$OrderID."&key=".$key."&backUrl=".urlencode($backUrl)."'>返回订单详细信息</a>  <a href='order_list.php'>返回</a>";
	  }else{ 
	  ?>
        <table width="100%"  border="0" cellspacing="1" cellpadding="3"  class="table table-border table-bordered table-hover table-bg table-sort">
          <form action="order_edit.php" method="post">
              <tr bgcolor="#FFFFFF">
				<td height="29" colspan="2">
					<a href="order_op.php?OrderID=<?=$row[OrderID]?>&key=<?=$dkey?>&op=delete&backUrl=<?=urlencode($backUrl)?>" onclick="return confirm('确定删除吗?')">删除</a> |
					<a href='../users/user_edit.php?UserName=<?=$row[UserName]?>&backUrl=<?=$backUrl?>&key=<?=$ukey?>'>用户资料</a>
				</td>
			  </tr>
			  <tr align="center" bgcolor="#FFFFFF">
				<td height="29" colspan="2" class='eng'>订单详细信息</td>
			  </tr>
			  <tr bgcolor='#FFFFFF'>
				<td width="120">编号</td>
				<td><input name="OrderID" type="text" class="inputline" value="<?=$row[OrderID]?>" readonly>
				(此项不可修改)</td>
			  </tr>
			  <tr bgcolor='#FFFFFF'>
				<td>订单金额</td>
				<td><input name="Amount" type="text" class="inputline" value="<?=$row[Amount]?>"></td>
			  </tr>
			  <tr bgcolor='#FFFFFF'>
				<td>订单说明</td>
				<td><input name="About" type="text" class="inputline" size='50' value="<?=$row[About]?>"></td>
			  </tr>
			  <tr bgcolor='#FFFFFF'>
				<td>订购数量</td>
				<td><input name="Period" type="text" class="inputline" value="<?=$row[Period]?>"></td>
			  </tr>
			  <tr bgcolor='#FFFFFF'>
				<td>用户</td>
				<td><input name="UserName" type="text" class="inputline" value="<?=$row[UserName]?>"></td>
			  </tr>
			  <tr bgcolor='#FFFFFF'>
				<td>状态</td>
				<td>
					<select name="iStatus">
					  <option value="<?=ProductStatus_NotActived?>"<?=$row[iStatus]==ProductStatus_NotActived?" selected":""?>>未生效</option>
					  <option value="<?=ProductStatus_Doing?>"<?=$row[iStatus]==ProductStatus_Doing?" selected":""?>>已付款</option>
					  <option value="<?=ProductStatus_Actived?>"<?=$row[iStatus]==ProductStatus_Actived?" selected":""?>>已发货</option>
					  <option value="<?=ProductStatus_Stoped?>"<?=$row[iStatus]==ProductStatus_Stoped?" selected":""?>>已完成</option>
					  <option value="<?=ProductStatus_Deleted?>"<?=$row[iStatus]==ProductStatus_Deleted?" selected":""?>>被删除</option>
					</select>
				</td>
			  </tr>
			
			
			  <tr bgcolor='#FFFFFF'>
				<td>建立时间</td>
				<td><input type='text' class="inputline" name="dtCreate" size="30" value="<?=$row[dtCreate]?>"></td>
			  </tr>  
			   <tr bgcolor='#FFFFFF'>
				<td>物流编号</td>
				<td><input type='text' class="inputline" name="wuliu" size="30" value="<?=$row[wuliu]?>"></td>
			  </tr>  
              <tr>
              <td bgcolor="#FFFFFF" colspan='2' align='center'>
			      <input name="submit" type="submit" class="btnGreen" value="提  交">
				  <input name="reset" type="button" class="btnBlue" value="返  回" onclick="location='<?=$backUrl?>'">
			      <input name="Edit" type="hidden" value="1">
				  <input name="backUrl" type="hidden" value="<?=$backUrl?>">
				  <input name="key" type="hidden" value="<?=$key?>">
			  </td>
            </tr>
          </form>
        </table>
	<?}?>
   </td>
  </tr>
</table></div>
<? 
$DB->close();
include "../share/bottom.php"?>
</body>
</html>
