<%@ Page CodeFileBaseClass="AliCMS.Lib.SystemPageBase" %>
<%@ Register TagPrefix="alicmsUC" TagName="Ime" Src="../../ime.dwt.ascx"%>
<%@ Register TagPrefix="alicmsUC" TagName="LanguageMenu" Src="../../language_menu.dwt.ascx"%>
<!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>
<!-- TemplateInfo codeOutsideHTMLIsLocked="true" -->
<ali:Get ID="Order" Object="Order" InnerID="Request.QueryString['ID']" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>编辑</title>
<link rel="stylesheet" type="text/css" href="<%=CommonPath%>jquery/themes/lightness/all.css" />
<ali:Comment><link rel="stylesheet" type="text/css" href="../../S01/CHS/css/common.css" /></ali:Comment>
<link rel="stylesheet" href="<%=CssPath%>common.css" />
<alicmsUC:Ime Ime="true" Eot="true" runat="server" />
<style type="text/css">
TD TABLE{background:#FFF}
TD TABLE TH{width:100px}
#ProductTable THEAD TH,#ProductTable TBODY TD{width:auto;text-align:center}
</style>
<script language="c#" runat="server">
protected string GetUnit(object unit)
{
	switch (unit.ToString())
	{
		case "Minute":
			return "分钟";
		case "Hour":
			return "小时";
		case "Day":
			return "天";
		case "Week":
			return "星期";
		case "Month":
			return "月";
		case "Season":
			return "季";
		case "HafeYear":
			return "半年";
		case "Year":
			return "年";
		default:
			return "永久";
	}
}
</script>
<script type="text/javascript">
var _page = 'order_edit';
var _lang = '<%=ContentLang%>';
var _webPath = '<%=WebPath%>';
var _imagePath = "<%=ImagePath%>";
var _id = "<%=Request.QueryString["ID"]%>";
var _guid = "<%=Order[ID]%>";
var _timeUnit = "<%=Order[TimeUnit]%>";
var _comboID = "<%=Order[ComboID]%>";
var _productIndex = 0;
var _products = [];
var _lang_working = "正在操作...";
var _lang_operation_fail = "操作失败！";
var _lang_operation_success = "操作成功！";
var _lang_price_adjustment_incorrect = "折扣或涨价格式不正确！";
var _lang_title_empty = "请添加标题！";
var _lang_product_empty = "请选择产品！";
var _lang_combo_empty = "请选择套餐！";
var _lang_delete = "删除";
var _lang_agent_empty = "请选择代理！";
var _lang_user_not_exist = "该用户不存在！";
var _lang_modifying_product = "正在修改产品...";
</script>
</head>
<body>
<div class="WhiteHeader">
	<div class="Left"><img src="<%=ImagePath%>close_frame.gif" /></div>
	<div class="Title"><a href="../order/list.aspx?Lang=<%=ContentLang%>">订单列表</a> → <span class="<%=ContentLang%>Font"><%=Order[Title]%></span></div>
	<div class="Right"></div>
</div>
<div class="Block">
	<ul class="TabMenu">
		<li class="Left Selected"></li>
		<li class="Middle Selected">编辑</li>
		<li class="Right Selected"></li>
	</ul>
	<ul class="Title">
		<li class="Left"></li>
		<li class="Middle"></li>
		<li class="Right"></li>
	</ul>
	<form>
		<table border="0" cellpadding="4" cellspacing="1">
			<tfoot>
				<tr><td colspan="2"><input type="submit" value="编辑" /></td></tr>
			</tfoot>
			<tbody>
				<tr>
					<th width="120">标题：</th>
					<td><input type="text" name="Title" size="50" value="<%=Order[Title]%>" maxlength="150" class="Text <%=ContentLang%>Font" /></td>
				</tr>
				<tr>
					<th>订单号：</th>
					<td><%=Order[No]%></td>
				</tr>
				<tr>
					<th>用户：</th>
					<td><input type="text" name="User" value="<%=Order[UserName]%>" id="<%=Order[UserID]%>" size="20" class="Text" readonly="readonly" /> 查找：<input type="text" size="20" class="Text" /><button type="button" id="CheckUser">检查</button></td>
				</tr>
				<tr>
					<th>代理：</th>
					<td><input type="text" name="Agent" size="20" class="Text" readonly="readonly" /> 查找：<input type="text" value="<%=Order[AgentName]%>" size="20" class="Text" /><button type="button" id="CheckAgent">检查</button></td>
				</tr>
				<tr>
					<th>是否代理支付：</th>
					<td>
						<%If Convert.ToBoolean(Order[IsAgentPay])%>
							<input type="radio"  name="IsAgentPay" id="IsAgentPayYes" checked="checked" /><label for="IsAgentPayYes">是</label>
							<input type="radio" name="IsAgentPay" id="IsAgentPayNo" /><label for="IsAgentPayNo">否</label>
						<%Else%>
							<input type="radio"  name="IsAgentPay" id="IsAgentPayYes" /><label for="IsAgentPayYes">是</label>
							<input type="radio" name="IsAgentPay" id="IsAgentPayNo" checked="checked" /><label for="IsAgentPayNo">否</label>
						<%EndIf%>
					</td>
				</tr>
				<tr>
					<th>单位：</th>
					<td>
						<select name="TimeUnit">
							<option value="Minute">分钟</option>
							<option value="Hour">小时</option>
							<option value="Day">天</option>
							<option value="Week">星期</option>
							<option value="Month">月</option>
							<option value="Season">季</option>
							<option value="HafeYear">半年</option>
							<option value="Year">年</option>
							<option value="Infinite">永久</option>
						</select>
					</td>
				</tr>
				<tr>
					<th>数量：</th>
					<td><input type="text" name="TimeAmount" value="<%=Order[TimeAmount]%>" size="4" maxlength="4" class="Text" /></td>
				</tr>
				<tr>
					<th>折扣或涨价：</th>
					<td><input type="text" name="PriceAdjustment" value="<%=Convert.ToDecimal(Order[PriceAdjustment]).ToString("F")%>" size="10" maxlength="10" class="Text" /></td>
				</tr>
				<tr>
					<th>管理员备注：</th>
					<td><textarea name="AdminMemo" cols="70" rows="6" wrap="off" class="Text <%=ContentLang%>Font"><%=Order[AdminMemo]%></textarea></td>
				</tr>
				<tr>
					<th>用户备注：</th>
					<td><%=Order[UserMemo]%></td>
				</tr>
				<tr>
					<th>套餐：</th>
					<td>
						<select name="Combo" class="<%=ContentLang%>Font">
							<option value="">--未指定--</option>
						</select>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<input type="button" id="SelectProduct" value="选择产品" />
						<table id="ProductTable" border="0" cellpadding="4" cellspacing="1">
							<thead>
								<tr>
									<th>产品名称</th>
									<th>产品编号</th>
									<th>市场价格</th>
									<th>代理价格</th>
									<th>数量</th>
									<th>内部应用</th>
									<th>子应用ID</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<ali:List Object="Order.Detail" Condition="OrderID=Order[ID]" Sort="InnerID ASC">
									<ali:Record>
										<tr id="<%=ProductID%>" data-price="<%=Price%>" data-agent-price="<%=AgentPrice%>">
											<td class="<%=ContentLang%>Font"><%=Name%></td>
											<td><%=ProductNo%></td>
											<td><%=Convert.ToDecimal(Price).ToString("N")%>元/<%=GetUnit(Order[TimeUnit])%></td>
											<td><%=AgentPrice%>元/</td>
											<td><%=Convert.ToDecimal(AgentPrice).ToString("N")%>元/<%=GetUnit(Order[TimeUnit])%></td>
											<td>
												<%If !Guid.Equals(InstanceID, Guid.Empty)%>
													<ali:Get Mark="System" Object="Instance" Guid="InstanceID">
														<%=Name%>
													</ali:Get>
												<%EndIf%>
											</td>
											<td>
												<%If !Guid.Equals(SubInstanceID, Guid.Empty)%>
													<%=SubInstanceID%>
												<%EndIf%>
											</td>
											<td>
												<%If Guid.Equals(Order[ComboID], Guid.Empty)%>
													<button>删除</button>
												<%EndIf%>
											</td>
										</tr>
									</ali:Record>
								</ali:List>
							</tbody>
						</table>
					</td>
				</tr>
				<tr>
					<th>产品总价：</th>
					<td id="Price"><%=Order[Price]%></td>
				</tr>
				<tr>
					<th>代理总价：</th>
					<td id="AgentPrice"><%=Order[AgentPrice]%></td>
				</tr>
				<tr>
					<th>订单总价：</th>
					<td id="Sum"><%=Order[Sum]%></td>
				</tr>
			</tbody>
		</table>
	</form>
</div>
<script type="text/javascript" src="<%=CommonPath%>jquery/core.js"></script>
<script type="text/javascript" src="<%=CommonPath%>jquery/ui.js"></script>
<script type="text/javascript" src="<%=CommonPath%>utility.js"></script>
<script type="text/javascript" src="<%=JsPath%>global.js"></script>
<script type="text/javascript" src="<%=ModuleJsPath%>module.js"></script>
</body>
</html>