<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%server.ScriptTimeout =7200
If session("agentusername")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("cannextagn")="" Then
	ef=True
	ec="您没有此操作的权限。"
elseIf Request("username")="" or RegExpTest("[^A-Za-z0-9]",Request("username")) Then
	ef=True
	ec="会员名没有写/或会员名中有非法字符！"
elseIf RegExpTest("[^A-Za-z0-9]",Request("usernamenewprice")) Then
	ef=True
	ec="价格模板用户名中有非法字符！"
end if
if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent where username='"&Request("username")&"' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"')"
if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		ds.Open Sql,conn,1,3
if ds.eof then
	ef=True
	ec="代理会员不存在！"
end if
end If


if not ef then
If request("usernamenewprice")<>"" Then
	Set dsnewprice = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent where username='"&Request("usernamenewprice")&"' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"')"
		dsnewprice.Open Sql,conn,1,1
if dsnewprice.eof then
	ef=True
	ec="价格模板代理会员不存在！"
Else
pricename=request("usernamenewprice")
end If
Else
pricename=request("username")
end If
end If

if not ef then
  Set dsagent = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_AGENT where username='"&session("agentusername")&"'"
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		dsagent.Open Sql,conn,1,1
If dsagent.Eof Then
		ef=True
		ec="代理会员名不存在！"
end if
end if

if not ef then
if 	LCASE(trim(session("agentusername")))=LCASE(trim(ds("username"))) then
	ef=True
	ec="不能设置自己"
end if
end if

if not ef then
ds("agenttype")="子代理"
if 	ds("agenttype")="n" then
	ef=True
	ec="此代理会员尚未审批，请先在代理管理中审批。"
end if
end if

if not ef then
	Set dsagnettype = Server.CreateObject("ADODB.Recordset")	
'if 	Request.QueryString ("agenttype")<>"" then
Sql="Select * from FreeHost.FreeHost_Agent_pers where agenttype='"&ds("agenttype")&"'"
'else
'Sql="Select * from FreeHost.FreeHost_Agent_pers"
'end if
	if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if 
		dsagnettype.Open Sql,conn,1,1
if dsagnettype.eof then
	ef=True
	ec="代理类型折扣为空，请先设置它！"
end if
end if
'dsagnpriupagn
if not ef then
	Set dsagnpriupagn = Server.CreateObject("ADODB.Recordset")	
'if 	Request.QueryString ("agenttype")<>"" then
Sql="Select * from FreeHost.FreeHost_Agent_pers where agenttype='"&session("agenttype")&"'"
'else
'Sql="Select * from FreeHost.FreeHost_Agent_pers"
'end if
	if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if 
		dsagnpriupagn.Open Sql,conn,1,1
if dsagnpriupagn.eof then
	ef=True
	ec="代理类型折扣为空，请先设置它！"
end if
end if
if not ef then

'ds.close
'set ds=nothing
'conn.Close 
'set conn=nothing
%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html5")%>
　指定出售给子代理的价格
<%=htmlwrite("html6")%>
<br>
子代理用户名：<%=Request("username")%><br>
已定义的子代理价格模板一:<%If IsNull(dsagent("pricetemp1")) then%>无<%else%><%=dsagent("pricetempname1")%>(<%=dsagent("pricetemp1")%>)　<a href="admagentprice.asp?username=<%=Request("username")%>&usernamenewprice=<%=dsagent("pricetemp1")%>">应用此价格模板>>></a>
<%End if%><br>
已定义的子代理价格模板二:<%If IsNull(dsagent("pricetemp2")) then%>无<%else%><%=dsagent("pricetempname2")%>(<%=dsagent("pricetemp2")%>)　<a href="admagentprice.asp?username=<%=Request("username")%>&usernamenewprice=<%=dsagent("pricetemp2")%>">应用此价格模板>>></a>
<%End if%><br>
已定义的子代理价格模板三:<%If IsNull(dsagent("pricetemp3")) then%>无<%else%><%=dsagent("pricetempname3")%>(<%=dsagent("pricetemp3")%>)　<a href="admagentprice.asp?username=<%=Request("username")%>&usernamenewprice=<%=dsagent("pricetemp3")%>">应用此价格模板>>></a>
<%End if%><br>
已定义的子代理价格模板四:<%If IsNull(dsagent("pricetemp4")) then%>无<%else%><%=dsagent("pricetempname4")%>(<%=dsagent("pricetemp4")%>)　<a href="admagentprice.asp?username=<%=Request("username")%>&usernamenewprice=<%=dsagent("pricetemp4")%>">应用此价格模板>>></a>
<%End if%><br>
已定义的子代理价格模板五:<%If IsNull(dsagent("pricetemp5")) then%>无<%else%><%=dsagent("pricetempname5")%>(<%=dsagent("pricetemp5")%>)　<a href="admagentprice.asp?username=<%=Request("username")%>&usernamenewprice=<%=dsagent("pricetemp5")%>">应用此价格模板>>></a>
<%End if%>
<form action="" method="get" name="addperform">
  将本页面中显示的所有类型产品出售给子代理的价格自动按成本价增加百份之
    <input name="add" type="text" size="2" maxlength="10" value="20">
    <a href="#" onClick="addpercent()"> (请点击这儿，点击后请稍等一分钟)</a><br>
    <br>
  将本页面中显示的域名类型产品出售给子代理的价格自动按成本价增加百份之
  <input name="adddomain" type="text" size="2" maxlength="10" value="20">
  <a href="#" onClick="addpercentdomain()"> 请点击这儿，(点击后请稍等一分钟)</a>　<br>
</form>

<form method="post" name="form1" action="agentprice-sub.asp"  id="priceform">
<b>虚拟主机产品</b>
<table width="100%"  border="0" cellspacing="1" bgcolor="#CCCCCC">
<%
	Set dsHostlist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_HostProductlist where canbyagnenduser='y' order by id asc"
		dsHostlist.Open Sql,conn,1,1
If dsHostlist.Eof Then%>产品列表为空.
<%else
while not dsHostlist.Eof


%>

  <tr bgcolor="#FFFFFF">
    <td width="28%">
<%=dsHostlist("id")%>.<%=dsHostlist("Hosttype")%> 
    <td width="72%">成本价格：
      <input name="orihost<%=dsHostlist("id")%>" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='虚拟主机' and username='"&session("agentusername")&"' and id="&dsHostlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
response.write  dsHostlist("usermoney")*dsagnpriupagn("pers")
else
response.write  dsagnpri("usermoney")
end if
dsagnpri.close  
	  %>>
      元　　
      出售给子代理价格:
      <input name="host<%=dsHostlist("id")%>" type="text" size="4" maxlength="10" value="<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='虚拟主机' and username='"&pricename&"' and id="&dsHostlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
response.write  dsHostlist("usermoney")*dsagnettype("pers")
else
response.write  dsagnpri("usermoney")
end if
dsagnpri.close
	  
	  
	  %>">
    元</td>
  </tr>

<%


dsHostlist.movenext
wend
dsHostlist.close
set dsHostlist=nothing
end if%></table>
<br>
<b>数据库产品
</b>
<table width="100%"  border="0" cellspacing="1" bgcolor="#CCCCCC">
<%
	Set dsSqllist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_SqlProductlist where isbyhost='n' and canbyagnenduser='y' order by id asc"
		dsSqllist.Open Sql,conn,1,1
If dsSqllist.Eof Then%>
产品列表为空.
<%else
while not dsSqllist.Eof%>

  <tr bgcolor="#FFFFFF">
    <td width="28%"><%=dsSqllist("id")%>.<%=dsSqllist("Sqltype")%>
    <td width="72%">成本价格：
      <input name="oriSql<%=dsSqllist("id")%>" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='数据库产品' and username='"&session("agentusername")&"' and id="&dsSqllist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
response.write  dsSqllist("usermoney")*dsagnpriupagn("pers")
else
response.write  dsagnpri("usermoney")
end if
dsagnpri.close  
	  %>>      元　　 出售给子代理价格:
      <input name="Sql<%=dsSqllist("id")%>" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='数据库产品' and username='"&pricename&"' and id="&dsSqllist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
response.write  dsSqllist("usermoney")*dsagnettype("pers")
else
response.write  dsagnpri("usermoney")
end if
dsagnpri.close
	  
	  %>">
    元</td>
  </tr>

<%
dsSqllist.movenext
wend
dsSqllist.close
set dsSqllist=nothing
end if%></table>





<b><br>
邮箱产品</b>
<table width="100%"  border="0" cellspacing="1" bgcolor="#CCCCCC">
<%
	Set dsEmaillist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_EmailProductlist where isbyhost='n'  and isbydomain='n' and canbyagnenduser='y' order by id asc"
		dsEmaillist.Open Sql,conn,1,1
If dsEmaillist.Eof Then%>
产品列表为空.
<%else
while not dsEmaillist.Eof%>

  <tr bgcolor="#FFFFFF">
    <td width="28%"><%=dsEmaillist("id")%>.<%=dsEmaillist("Emailtype")%>
    <td width="72%">成本价格：
      <input  name="oriemail<%=dsEmaillist("id")%>" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='邮箱产品' and username='"&session("agentusername")&"' and id="&dsEmaillist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
response.write  dsEmaillist("usermoney")*dsagnpriupagn("pers")
else
response.write  dsagnpri("usermoney")
end if
dsagnpri.close  
	  %>>元　　 出售给子代理价格:
      <input name="email<%=dsEmaillist("id")%>" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='邮箱产品' and username='"&pricename&"' and id="&dsEmaillist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
response.write  dsEmaillist("usermoney")*dsagnettype("pers")
else
response.write  dsagnpri("usermoney")
end if
dsagnpri.close
	  
	  %>">
    元</td>
  </tr>

<%
dsEmaillist.movenext
wend
dsEmaillist.close
set dsEmaillist=nothing
end if%>
</table>


<br>
<b>域名产品</b>
<table width="100%"  border="0" cellspacing="1" bgcolor="#CCCCCC">
<%
	Set dsDomainlist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_DomainProductlist order by id asc"
		dsDomainlist.Open Sql,conn,1,1
If dsDomainlist.Eof Then%>
产品列表为空.
<%else
while not dsDomainlist.Eof%>

  <tr bgcolor="#FFFFFF">
    <td width="28%"><%=dsDomainlist("id")%>.<%=dsDomainlist("Domaintype")%>
    <td width="72%">
<%if Application("domaincansetM")=true Then%>
<%for regapi=1 to 7
If Application("showapi"&regapi)=True then
%>
<br>
<%if regapi=1 then%>新网互联<%end if%>
<%if regapi=2 then%>新网<%end if%>
<%if regapi=3 then%>商务中国<%end if%>
<%if regapi=4 then%>中国频道<%end if%>
<%if regapi=5 then%>万网<%end if%>
<%if regapi=6 then%>API6<%end if%>
<%if regapi=7 then%>外国接口<%end if%>：<br>	

成本价格：
      <input  name="oridomain<%=dsDomainlist("id")%>API<%=regapi%>" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&session("agentusername")&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoneyagn")
response.write  dsDomainlist("usermoneyagn"&"API"&regapi)
else
'response.write  dsagnpri("usermoney")
response.write  dsagnpri("usermoney"&"API"&regapi)
if isnull(dsagnpri("usermoney"&"API"&regapi)) then response.write  dsDomainlist("usermoneyagn"&"API"&regapi)
end if
dsagnpri.close  
	  %>>元1年　价格:
      <input name="domain<%=dsDomainlist("id")%>API<%=regapi%>" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&pricename&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoneyagn")
response.write  dsDomainlist("usermoneyagn"&"API"&regapi)
else
'response.write  dsagnpri("usermoney")
response.write  dsagnpri("usermoney"&"API"&regapi)
if isnull(dsagnpri("usermoney"&"API"&regapi)) then response.write  dsDomainlist("usermoneyagn"&"API"&regapi)
end if
dsagnpri.close
	  
	  %>">
    元1年<br>
	
<%for iqx=2 to 5%>

成本价格：
      <input  name="oridomain<%=dsDomainlist("id")%>year<%=iqx%>API<%=regapi%>" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&session("agentusername")&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("year"&iqx&"agn")
response.write  dsDomainlist("year"&iqx&"agn"&"API"&regapi)
else
'response.write  dsagnpri("year"&iqx)
response.write  dsagnpri("year"&iqx&"API"&regapi)
if isnull(dsagnpri("year"&iqx&"API"&regapi)) then response.write  dsDomainlist("year"&iqx&"agn"&"API"&regapi)
end if
dsagnpri.close  
	  %>>元<%=iqx%>年　价格:
      <input name="domain<%=dsDomainlist("id")%>year<%=iqx%>API<%=regapi%>" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&pricename&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("year"&iqx&"agn")
response.write  dsDomainlist("year"&iqx&"agn"&"API"&regapi)
else
'response.write  dsagnpri("year"&iqx)
response.write  dsagnpri("year"&iqx&"API"&regapi)
if isnull(dsagnpri("year"&iqx&"API"&regapi)) then response.write  dsDomainlist("year"&iqx&"agn"&"API"&regapi)
end if
dsagnpri.close
	  
	  %>">
    元<%=iqx%>年<br>	
<%next%>
<%
End if'当系统参数中允许设置这个价格

next%>


<%else%>

成本价格：
 <input  name="oridomain<%=dsDomainlist("id")%>" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&session("agentusername")&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnpriupagn("pers")域名价格是指定的
response.write  dsDomainlist("usermoneyagn")
else
response.write  dsagnpri("usermoney")
if isnull(dsagnpri("usermoney")) then response.write  dsDomainlist("usermoneyagn")
end if
dsagnpri.close  
	  %>>元1年　价格:
      <input name="domain<%=dsDomainlist("id")%>" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&pricename&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnettype("pers")
'读FreeHost_DomainProductlist
response.write  dsDomainlist("usermoneyagn")
else
response.write  dsagnpri("usermoney")
if isnull(dsagnpri("usermoney")) then response.write  dsDomainlist("usermoneyagn")
end if
dsagnpri.close
	  
	  %>">
    元1年<br>
	
<%for iqx=2 to 5%>

成本价格：
      <input  name="oridomain<%=dsDomainlist("id")%>year<%=iqx%>" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&session("agentusername")&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnpriupagn("pers")域名价格是指定的
response.write  dsDomainlist("year"&iqx&"agn")
else
response.write  dsagnpri("year"&iqx)
if isnull(dsagnpri("year"&iqx)) then response.write  dsDomainlist("year"&iqx&"agn")
end if
dsagnpri.close  
	  %>>元<%=iqx%>年　价格:
      <input name="domain<%=dsDomainlist("id")%>year<%=iqx%>" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&pricename&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnettype("pers")
'读FreeHost_DomainProductlist
response.write  dsDomainlist("year"&iqx&"agn")
else
response.write  dsagnpri("year"&iqx)
if isnull(dsagnpri("year"&iqx)) then response.write  dsDomainlist("year"&iqx&"agn")
end if
dsagnpri.close
	  
	  %>">
    元<%=iqx%>年<br>	
<%next%>



<%end if%>
<%If Application("showapi1")=True then%>	
    续费成本(新网互联)：
    <input name="oridomainrepay<%=dsDomainlist("id")%>" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&session("agentusername")&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnpriupagn("pers")域名价格是指定的
response.write  dsDomainlist("usermoneyagnrepay")
else
response.write  dsagnpri("usermoneyrepay")
end if
dsagnpri.close  
	  %>>元/年　续费价格:
<input name="domainrepay<%=dsDomainlist("id")%>" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&pricename&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnettype("pers")
'读FreeHost_DomainProductlist
response.write  dsDomainlist("usermoneyagnrepay")
else
response.write  dsagnpri("usermoneyrepay")
end if
dsagnpri.close
	  
	  %>">
元/年<br>
<%end if%>
<%If Application("showapi2")=True then%>
    续费成本(新网)：
    <input name="oridomainrepay<%=dsDomainlist("id")%>_2" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&session("agentusername")&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnpriupagn("pers")域名价格是指定的
response.write  dsDomainlist("usermoneyagnrepay2")
else
response.write  dsagnpri("usermoneyrepay2")
end if
dsagnpri.close  
	  %>>元/年　续费价格:
<input name="domainrepay<%=dsDomainlist("id")%>_2" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&pricename&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnettype("pers")
'读FreeHost_DomainProductlist
response.write  dsDomainlist("usermoneyagnrepay2")
else
response.write  dsagnpri("usermoneyrepay2")
end if
dsagnpri.close
	  
	  %>">
元/年<br>
<%end if%>
<%If Application("showapi3")=True then%>
    续费成本(商务中国)：
    <input name="oridomainrepay<%=dsDomainlist("id")%>_3" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&session("agentusername")&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnpriupagn("pers")域名价格是指定的
response.write  dsDomainlist("usermoneyagnrepay3")
else
response.write  dsagnpri("usermoneyrepay3")
end if
dsagnpri.close  
	  %>>元/年　续费价格:
<input name="domainrepay<%=dsDomainlist("id")%>_3" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&pricename&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnettype("pers")
'读FreeHost_DomainProductlist
response.write  dsDomainlist("usermoneyagnrepay3")
else
response.write  dsagnpri("usermoneyrepay3")
end if
dsagnpri.close
	  
	  %>">
元/年<br>
<%end if%>
<%If Application("showapi4")=True then%>
    续费成本(中国频道)：
    <input name="oridomainrepay<%=dsDomainlist("id")%>_4" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&session("agentusername")&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnpriupagn("pers")域名价格是指定的
response.write  dsDomainlist("usermoneyagnrepay4")
else
response.write  dsagnpri("usermoneyrepay4")
end if
dsagnpri.close  
	  %>>元/年　续费价格:
<input name="domainrepay<%=dsDomainlist("id")%>_4" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&pricename&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnettype("pers")
'读FreeHost_DomainProductlist
response.write  dsDomainlist("usermoneyagnrepay4")
else
response.write  dsagnpri("usermoneyrepay4")
end if
dsagnpri.close
	  
	  %>">
元/年<br>
<%end if%>
<%If Application("showapi5")=True then%>
    续费成本(万网)：
    <input name="oridomainrepay<%=dsDomainlist("id")%>_5" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&session("agentusername")&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnpriupagn("pers")域名价格是指定的
response.write  dsDomainlist("usermoneyagnrepay5")
else
response.write  dsagnpri("usermoneyrepay5")
end if
dsagnpri.close  
	  %>>元/年　续费价格:
<input name="domainrepay<%=dsDomainlist("id")%>_5" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&pricename&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnettype("pers")
'读FreeHost_DomainProductlist
response.write  dsDomainlist("usermoneyagnrepay5")
else
response.write  dsagnpri("usermoneyrepay5")
end if
dsagnpri.close
	  
	  %>">
元/年<br>
<%end if%>
<%If Application("showapi6")=True then%>
    续费成本(API6)：
    <input name="oridomainrepay<%=dsDomainlist("id")%>_6" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&session("agentusername")&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnpriupagn("pers")域名价格是指定的
response.write  dsDomainlist("usermoneyagnrepay6")
else
response.write  dsagnpri("usermoneyrepay6")
end if
dsagnpri.close  
	  %>>元/年　续费价格:
<input name="domainrepay<%=dsDomainlist("id")%>_6" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&pricename&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnettype("pers")
'读FreeHost_DomainProductlist
response.write  dsDomainlist("usermoneyagnrepay6")
else
response.write  dsagnpri("usermoneyrepay6")
end if
dsagnpri.close
	  
	  %>">
元/年<br>
<%end if%>

<%If Application("showapi7")=True then%>
    续费成本(外国接口)：
    <input name="oridomainrepay<%=dsDomainlist("id")%>_7" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&session("agentusername")&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnpriupagn("pers")域名价格是指定的
response.write  dsDomainlist("usermoneyagnrepay7")
else
response.write  dsagnpri("usermoneyrepay7")
end if
dsagnpri.close  
	  %>>元/年　续费价格:
<input name="domainrepay<%=dsDomainlist("id")%>_7" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&pricename&"' and id="&dsDomainlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
'response.write  dsDomainlist("usermoney")*dsagnettype("pers")
'读FreeHost_DomainProductlist
response.write  dsDomainlist("usermoneyagnrepay7")
else
response.write  dsagnpri("usermoneyrepay7")
end if
dsagnpri.close
	  
	  %>">
元/年
<%end if%>


</td>
  </tr>

<%
dsDomainlist.movenext
wend
dsDomainlist.close
set dsDomainlist=nothing
end if%>
</table>


<br>

<b>云服务器产品</b>
<table width="100%"  border="0" cellspacing="1" bgcolor="#CCCCCC">
<%
	Set dsVPSlist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_VPSProductlist where canbyagnenduser='y' order by id asc"
		dsVPSlist.Open Sql,conn,1,1
If dsVPSlist.Eof Then%>
产品列表为空.
<%else
while not dsVPSlist.Eof%>

  <tr bgcolor="#FFFFFF">
    <td width="28%"><%=dsVPSlist("id")%>.<%=dsVPSlist("VPStype")%>
    <td width="72%">成本价格：
      <input  name="oriVPS<%=dsVPSlist("id")%>" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='云服务器产品' and username='"&session("agentusername")&"' and id="&dsVPSlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
response.write  dsVPSlist("usermoney")*dsagnpriupagn("pers")
else
response.write  dsagnpri("usermoney")
end if
dsagnpri.close  
	  %>>元　　 价格:
      <input name="VPS<%=dsVPSlist("id")%>" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='云服务器产品' and username='"&pricename&"' and id="&dsVPSlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
response.write  dsVPSlist("usermoney")*dsagnettype("pers")
else
response.write  dsagnpri("usermoney")
end if
dsagnpri.close
	  
	  %>">
    元</td>
  </tr>

<%
dsVPSlist.movenext
wend
dsVPSlist.close
set dsVPSlist=nothing
end if%></table>


<br>

<b>CDN产品</b>
<table width="100%"  border="0" cellspacing="1" bgcolor="#CCCCCC">
<%
	Set dsCDNlist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_CDNProductlist where canbyagnenduser='y' order by id asc"
		dsCDNlist.Open Sql,conn,1,1
If dsCDNlist.Eof Then%>
产品列表为空.
<%else
while not dsCDNlist.Eof%>

  <tr bgcolor="#FFFFFF">
    <td width="28%"><%=dsCDNlist("id")%>.<%=dsCDNlist("CDNtype")%>
    <td width="72%">成本价格：
      <input  name="oriCDN<%=dsCDNlist("id")%>" type="text" size="4"  readonly="true" style="background:;text-align:right;BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px" value=<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='CDN产品' and username='"&session("agentusername")&"' and id="&dsCDNlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
response.write  dsCDNlist("usermoney")*dsagnpriupagn("pers")
else
response.write  dsagnpri("usermoney")
end if
dsagnpri.close  
	  %>>元　　 价格:
      <input name="CDN<%=dsCDNlist("id")%>" type="text" size="4" maxlength="10" value="<%

	  	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='CDN产品' and username='"&pricename&"' and id="&dsCDNlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
response.write  dsCDNlist("usermoney")*dsagnettype("pers")
else
response.write  dsagnpri("usermoney")
end if
dsagnpri.close
	  
	  %>">
    元</td>
  </tr>

<%
dsCDNlist.movenext
wend
dsCDNlist.close
set dsCDNlist=nothing
end if%></table>



<br> 
是否将此子代理的价格设置为价格模板?<br>
<input name="pricetempsave" type="radio" value="no" checked> 
否　　　
<input type="radio" name="pricetempsave" value="yes">
是(
<select name="pricetemp">
  <option value="1">编号一</option>
  <option value="2">编号二</option>  
  <option value="3">编号三</option>
  <option value="4">编号四</option>  
  <option value="5">编号五</option>    
</select>
价格模板的名称：
<input name="pricetempname" type="text" size="20" maxlength="25">
) 
<br>
<br>
<input type="submit" name="Submit" value="保存价格设置">
<br>
<input name="username" type="hidden" id="username" value="<%=ds("username")%>">
</form>
<script>


  var   all=document.getElementById("priceform")   
      var   checks=all.getElementsByTagName("input");   
	  var havenull=false;
	  	  var havelow=false;

setTimeout("checkallvalue()",1000);

//checkallvalue();

function checkallvalue()
{


//if (confirm('请注意！所有价格都必须填写，不允许有空的价格，也不允许低于成本价出售，是否现在检查所有的价格有没有错?(强烈建议检查，检查的时间可能需要两分钟或更长的时间，请耐心等候，不要关闭IE)')==true){
    
 for(var   i=0;i<checks.length;i++)   
      {     
	 // document.writeln(i);
	  //break;

		if ((checks[i].name.indexOf("ori")==-1)&& checks[i].name!="Submit"&& checks[i].name!="pricetempname"&& checks[i].name!="username"&& checks[i].name!="pricetempsave")
			{

				if (checks[i].value=="")
				{


						checks[i].value=parseInt(document.getElementsByName("ori"+checks[i].name).item(0).value*1.2);//将空白的自动加20%
						checks[i].style.borderColor = 'red';
						havenull=true;

			     
				}
				else
				{//检查有没有低于成本价
//document.writeln(checks[i].name);
//document.writeln(document.getElementsByName("ori"+checks[i].name).item(0).value);
//break;
					if(parseInt(checks[i].value)<parseInt(document.getElementsByName("ori"+checks[i].name).item(0).value))
					{
						checks[i].style.borderColor = 'black';
							checks[i].value=parseInt(document.getElementsByName("ori"+checks[i].name).item(0).value*1.2);//将低于成本的自动加20%
							havelow=true;
					}


				
				}
			}
      }   

	  	  var haveok=true;

if (havenull)
{
haveok=false;
	//		document.writeln("<font color=red>存在空的出售价格（已显示为红色边框），已自动将空的出售价按成本价增加20%，请设置好价格后点保存价格设置。</font><br>");
	alert("存在空的出售价格（已显示为红色边框），已自动将空的出售价按成本价增加20%，请设置好价格后点保存价格设置。");
}
if (havelow)
{
haveok=false;
	//		document.writeln("<font color=red>存在低于成本价的出售价格（已显示为黑色边框），已自动将错的出售价按成本价增加20%，请设置好价格后点保存价格设置。</font><br>");
	alert("存在低于成本价的出售价格（已显示为黑色边框），已自动将错的出售价按成本价增加20%，请设置好价格后点保存价格设置。");
}
if (haveok==true)
{
alert("价格自动检查完成,全部符合要求.");
}
//}

}
function addpercent()
{
 for(var   i=0;i<checks.length;i++)   
      {     


		if ((checks[i].name.indexOf("ori")==-1)&& checks[i].name!="Submit"&& checks[i].name!="pricetempname"&& checks[i].name!="username"&& checks[i].name!="pricetempsave")
			{

				checks[i].value=parseInt(document.getElementsByName("ori"+checks[i].name).item(0).value*(1+(document.addperform.add.value/100)));

			}
      }   
	  	  alert("处理完成，请点保存价格设置。");
}

function addpercentdomain()
{
 for(var   i=0;i<checks.length;i++)   
      {     

		if ((checks[i].name.indexOf("ori")==-1)&&checks[i].name.indexOf("domain")!=-1&& checks[i].name!="Submit"&& checks[i].name!="pricetempname"&& checks[i].name!="username"&& checks[i].name!="pricetempsave")
			{

				checks[i].value=parseInt(document.getElementsByName("ori"+checks[i].name).item(0).value*(1+(document.addperform.adddomain.value/100)));
			}
      }   
	  	  alert("处理完成，请点保存价格设置。");
}


</script>
<%=htmlwrite("html7")%>
<%
end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
