<%@ Page CodeFileBaseClass="IlgharCMS.Lib.AdminPageBase" %>
<%@ Register TagPrefix="IlgharUC" TagName="Ime" Src="../../ime.dwt.ascx"%>
<%@ Register TagPrefix="IlgharUC" 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" -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>代申请发票</title>
<ilghar:Comment><link rel="stylesheet" type="text/css" href="../../S01/CHS/css/common.css" /></ilghar:Comment>
<link rel="stylesheet" href="<%=CssPath%>common.css" />
<script type="text/javascript" src="<%=CommonPath%>ajax.js"></script>
<script type="text/javascript" src="<%=JsPath%>common.js"></script>
<ilgharUC:Ime Ime="true" Eot="true" runat="server" />
<script type="text/javascript">
function XmlHttpCallBack(xmlHttp)
{
	if (xmlHttp.status == 200)
		alert("申请成功！");
	else
		alert("申请失败！请查看日志！");

	document.getElementById("Submit").disabled = false;
}

function OnSubmit(form)
{
	if (document.getElementById("Member").memberID == "")
	{
		alert("请选择会员！");
		return false;
	}
	
	if (!form.Amount.value.match(/^\d+(\.\d+)?$/))
	{
		alert("金额格式不正确！");
		form.Amount.select();
		return false;
	}
	
	if (form.InvoiceRise.value == "")
	{
		alert("请输入发票抬头！");
		form.InvoiceRise.select();
		return false;
	}
	
	if (form.Address.value == "")
	{
		alert("请输入邮寄地址！");
		form.Address.select();
		return false;
	}
	
	if (form.Zip.value == "")
	{
		alert("请输入邮政编码！");
		form.Zip.select();
		return false;
	}
	
	if (form.Phone.value == "")
	{
		alert("请输入联系电话！");
		form.Phone.select();
		return false;
	}
	
	if (form.Memo.value.length > 255)
	{
		alert("备注不能超过255个字符！");
		form.Memo.select();
		return false;
	}
	
	var data = "Member=" + encodeURIComponent(document.getElementById("Member").member);
	data += "&MemberID=" + document.getElementById("Member").memberID;
	data += "&Amount=" + form.Amount.value;
	data += "&InvoiceRise=" + encodeURIComponent(form.InvoiceRise.value);
	data += "&Address=" + encodeURIComponent(form.Address.value);
	data += "&Zip=" + form.Zip.value;
	data += "&Phone=" + encodeURIComponent(form.Phone.value);
	data += "&QQ=" + encodeURIComponent(form.QQ.value);
	data += "&Email=" + encodeURIComponent(form.Email.value);
	data += "&Memo=" + encodeURIComponent(form.Memo.value);
	
	document.getElementById("Submit").disabled = true;
	_ajax.Post("<%=WebPath%>ilghar.aspx?Lang=<%=ContentLang%>&Object=Invoice&Operation=Add", data, XmlHttpCallBack);
	return false;
}

function ShowSelectDialog(type)
{
	var path;
	if (type == "Member")
		path = "select_member.aspx?Lang=<%=ContentLang%>";

	path = HandleFake404(path);
	if (g_browser == "IE")
		window.showModalDialog(path, window, "status=0;dialogWidth=500px;dialogHeight=500px;center=1;help=0;resizable=1;scroll=1");
	else
		window.open(path,null,"width=500,height=500,menubar=no,toolbar=no,location=no,scrollbars=yes,status=no,modal=yes");
}

function SelectMember(id, name)
{
	var member = document.getElementById("Member");
	member.innerHTML = name;
	member.memberID = id;
	member.member = name;
}
</script>
</head>
<body>
<div class="WhiteHeader">
	<div class="Left"><img src="<%=ImagePath%>close_frame.gif" onclick="OpenCloseLeftFrame()" /></div>
	<div class="Title">代申请发票</div>
	<div class="Right">
		<ilgharUC:LanguageMenu runat="server" />
		<img height="15" src="<%=ImagePath%>dropdown.gif" onmouseover="this.src='<%=ImagePath%>dropdown_over.gif';ShowLanguageMenu(this);" onmouseout="this.src='<%=ImagePath%>dropdown.gif'" />
		语言：<%=CurrentLanguage%>
	</div>
</div>
<div class="Block">
	<ul class="TabMenu">
		<li class="Left"></li>
		<li class="Middle"><a href="list.aspx?Lang=<%=ContentLang%>">发票列表</a></li>
		<li class="Right"></li>
		<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 method="post" onsubmit="return OnSubmit(this)">
		<table border="0" cellpadding="4" cellspacing="1">
			<tbody>
				<tr>
					<th width="120">会员：</th>
					<td><span id="Member" member="" memberID=""></span><input type="button" value="选择" onclick="ShowSelectDialog('Member')" /></td>
				</tr>
				<tr>
					<th>金额：</th>
					<td><input type="text" name="Amount" maxlength="20" class="Text" /></td>
				</tr>
				<tr>
					<th>发票抬头：</th>
					<td><input type="text" name="InvoiceRise" size="50" maxlength="255" class="Text" /></td>
				</tr>
				<tr>
					<th>邮寄地址：</th>
					<td><input type="text" name="Address" size="50" maxlength="255" class="Text" /></td>
				</tr>
				<tr>
					<th>邮政编码：</th>
					<td><input type="text" name="Zip" maxlength="20" class="Text" /></td>
				</tr>
				<tr>
					<th>联系电话：</th>
					<td><input type="text" name="Phone" maxlength="20" class="Text" /></td>
				</tr>
				<tr>
					<th>QQ：</th>
					<td><input type="text" name="QQ" maxlength="20" class="Text" /></td>
				</tr>
				<tr>
					<th>Email：</th>
					<td><input type="text" name="Email" maxlength="50" class="Text" /></td>
				</tr>
				<tr>
					<th>备注：</th>
					<td>
						<textarea name="Memo" cols="70" rows="6" wrap="off" class="Text <%=ContentLang%>Font"></textarea>
					</td>
				</tr>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="2"><input type="submit" id="Submit" class="Button" value="申请" /></td>
				</tr>
			</tfoot>
		</table>
	</form>
	<div class="Footer"></div>
</div>
<script type="text/javascript">
HandleFake404();
</script>
</body>
</html>