<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/ex_stock/ex_sm_conn.asp"-->
<!--#include file="inc/ex_stock/ex_sm_const.asp"-->
<%
	dim trade_info,person_info,page
	trade_info=split(exsm.stockdata(10,0),",")
	person_info=split(exsm.stockdata(8,0),"|")
	select case request("action")
		case "newstock"
			call newstock()
		case "saveusst"
			call saveusst()
		case "userstat"
			call userstat()
		case "edit"
			call edit()
		case "saveedit"
			call saveedit()
		case "deleachstock"
			call deleachstock()
		case else
			call main()
	end select
	sub main()
		exsm.title 1,"个股上市列表"
		session("ex_sm")=0
%>
		<table class="tableborder1" cellspacing="1" cellpadding="3" align="center" border="0">
			<tr>
			<th colspan="11" height="25">-=> 个 人 股 票 上 市 申 请 一 览 表 <=-</th>
			</tr>
			<tr align="center">
			<td class="tablebody2"><b>id</b></td>
			<td class="tablebody2"><b>代码</b></td>
			<td class="tablebody2"><b>股票名称</b></td>
			<td class="tablebody2"><b>申请人</b></td>
			<td class="tablebody2"><b>股票数量</b></td>
			<td class="tablebody2"><b>上市价格</b></td>
			<td class="tablebody2"><b>每日交易量</b></td>
			<td class="tablebody2"><b>图片</b></td>
			<td class="tablebody2"><b>申请日期</b></td>
			<td class="tablebody2"><b>审批</b></td>
			<td class="tablebody2"><b>操作</b></td>
			</tr>
<%
		dim currentpage,page_count,pcount
		dim bgcolor,totalrec,endpage,ltdimg
		currentpage=request("page")
		if currentpage="" or not isnumeric(currentpage) then
			currentpage=1
		end if
		set rs= server.createobject("adodb.recordset")
		sql= "select * from ex_oneselfstock"
		rs.open sql,stock_conn,1,1
		if rs.eof and rs.bof then
			response.write "<tr><td colspan=""11"" class=""tablebody1"">没有人申请个股上市股票</td></tr><tr><td class=""tablebody2"" align=""center"" colspan=""11""><a href=""?action=newstock"">申请上市</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=""ex_sm_index.asp""><< 返回股市大厅</a></td></tr></table>"
		else
			rs.pagesize=cint(exsm.setting_info(15))
			totalrec=rs.recordcount
			if cdbl(currentpage)>=totalrec\cdbl(rs.pagesize)+1 then
				currentpage=totalrec\cdbl(rs.pagesize)+1
			else
				currentpage=cdbl(currentpage)
			end if
			if clng(currentpage)<1 then currentpage=1
			rs.absolutepage=currentpage
			page_count=0
			do while (not rs.eof) and (not page_count=rs.pagesize)
				if bgcolor="tablebody1" then
					bgcolor="tablebody2"
				else
					bgcolor="tablebody1"
				end if
				ltdimg=replace(replace(replace(rs("ltdimg"),"\",""),"""",""),"'","")
				response.write "<tr align=""center"">"
				response.write "<td class="""&bgcolor&""" rowspan=""2"">"&Rs.PageSize*(currentpage-1)+page_count+1&"</td>"
				response.write "<td class="""&bgcolor&"""><font color=""olive"">"&rs("code")&"</font></td>"
				response.write "<td class="""&bgcolor&""">"
				if rs("userid")=exsm.userid or exsm.stockadmin then
					response.write "<a href=""?action=edit&sid="&rs("sid")&""" title=""进入个股编辑页"" onmouseover=""cziemenu(event,'<div><a href=\'?action=edit&sid="&rs("sid")&"\' title=\'进入个股编辑页\'>编辑该股</a></div>"
					if rs("decideid")>0 then
						response.write "<div><a href=\'ex_sm_dispcompare.asp?sid="&rs("decideid")&"\'>上市资讯</a></div><div><a href=\'ex_sm_exchange.asp?sid="&rs("decideid")&"\'>进行交易</a></div>"
					end if
					response.write "','',15)"">"&rs("company")&"</a>"
				else
					if rs("decideid")>0 then
						response.write "<a href=""ex_sm_dispcompare.asp?sid="&rs("decideid")&""" onmouseover=""cziemenu(event,'<div><a href=\'ex_sm_dispcompare.asp?sid="&rs("decideid")&"\'>上市资讯</a></div><div><a href=\'ex_sm_exchange.asp?sid="&rs("decideid")&"\'>进行交易</a></div>','',15)"">"&rs("company")&"</a>"
					else
						response.write ""&rs("company")&""
					end if
				end if
				response.write "</td>"
				response.write "<td class="""&bgcolor&"""><a href=""ex_sm_dispu.asp?uid="&rs("userid")&"&username="&rs("username")&""">"&rs("username")&"</a></td>"
				response.write "<td class="""&bgcolor&""">"&replace(formatnumber(rs("stocknum"),0,-1),",","")&"</td>"
				response.write "<td class="""&bgcolor&""">"&formatcurrency(rs("price"),2,-1)&"</td>"
				response.write "<td class="""&bgcolor&""">"&replace(formatnumber(rs("todaytradesum"),0,-1),",","")&"</td>"
				response.write "<td class="""&bgcolor&"""><a href="""&ltdimg&""" target=""_blank"" onmouseover=""cziemenu(event,'<div><a href=\'"&ltdimg&"\' target=\'_blank\'><img border=\'0\' src=\'"&ltdimg&"\' width=\'130\' height=\'190\'></a></div>','',0)"">图片</a></td>"
				response.write "<td class="""&bgcolor&""">"&formatdatetime(rs("applydate"),1)&"</td>"
				response.write "<td class="""&bgcolor&""">"
				if rs("lockstock")=0 then
					if rs("states")=0 then
						response.write "<font color=""olive"">未审核</font>"
					elseif rs("states")=1 then
						response.write "已批准"
					elseif rs("states")=2 then
						response.write "<font color=""fuchsia"">待批准</font>"
					else
						response.write "<font color=""maroon"">不批准</font>"
					end if
				else
					response.write "<font color=""red"">封盘</font>"
				end if
				response.write "</td>"
				response.write "<td class="""&bgcolor&""">"
				if exsm.stockadmin then
					response.write "<a style=""cursor:hand"" onmouseover=""cziemenu(event,'"
					if rs("states")=0 then
						response.write "<div><a href=\'ex_sm_admin_gupiao.asp?action=userstat&stat=yes&sid="&rs("sid")&"\'>批准</a></div><div><a href=\'ex_sm_admin_gupiao.asp?action=userstat&stat=no&sid="&rs("sid")&"\'>不准</a></div>"
					elseif rs("states")=1 then
						if rs("lockstock")=0 then
							response.write "<div><a href=\'ex_sm_admin_gupiao.asp?action=changstat&stat=closethis&sid="&rs("decideid")&"\'>封盘</a></div>"
						else
							response.write "<div><a href=\'ex_sm_admin_gupiao.asp?action=changstat&stat=openthis&sid="&rs("decideid")&"\'>开市</a></div>"
						end if
					else
						if rs("decideid")=0 then
							response.write "<div><a href=\'ex_sm_admin_gupiao.asp?action=userstat&stat=yes&sid="&rs("sid")&"\'>批准</a></div>"
						else
							if rs("lockstock")=0 then
								response.write "<div><a href=\'ex_sm_admin_gupiao.asp?action=userstat&stat=onceagainyes&sid="&rs("sid")&"\'>批准</a></div><div><a href=\'ex_sm_admin_gupiao.asp?action=userstat&stat=no&sid="&rs("sid")&"\'>不准</a></div><div><a href=\'ex_sm_admin_gupiao.asp?action=changstat&stat=closethis&sid="&rs("decideid")&"\'>封盘</a></div>"
							else
								response.write "<div><a href=\'ex_sm_admin_gupiao.asp?action=changstat&stat=openthis&sid="&rs("decideid")&"\'>开市</a></div>"
							end if
						end if
					end if
					response.write "<div><a href=\'?action=edit&sid="&rs("sid")&"\'>编辑</a></div><div>"
					if rs("states")=0 or rs("decideid")=0 then
						response.write "<a href=\'?action=deleachstock&gpsid="&rs("sid")&"\'>撤销</a>"
					else
						response.write "<a href=\'ex_sm_admin_gupiao.asp?action=delstock&sid="&rs("decideid")&"\'>删除</a>"
					end if
					response.write "</div>','',0)"">操作</a>"
				elseif rs("userid")=exsm.userid then
					response.write "<a style=""cursor:hand"" onmouseover=""cziemenu(event,'<div><a href=\'?action=edit&sid="&rs("sid")&"\'>编辑</a></div>"
					if rs("states")=0 or rs("decideid")=0 then
						response.write "<div><a href=\'?action=deleachstock&gpsid="&rs("sid")&"\'>注销</a></div>"
					end if
					response.write "','',0)"">操作</a>"
				else
					response.write "-"
				end if
				response.write "</td>"
				response.write "</tr>"
				response.write "<tr>"
				response.write "<td colspan=""11"" class="""&bgcolor&""">公司简介："&server.htmlencode(rs("explain"))&"</td>"
				response.write "</tr>"
			page_count=page_count+1
			rs.movenext
			loop
			pcount=rs.pagecount
			if bgcolor="tablebody1" then
				bgcolor="tablebody2"
			else
				bgcolor="tablebody1"
			end if
			response.write "<tr>"
			response.write "<td class="""&bgcolor&""" align=""center"" colspan=""11"">"
			if not exsm.stockadmin then
				response.write "<a href=""?action=newstock"">申请上市</a>&nbsp;&nbsp;&nbsp;&nbsp;"
			end if
			response.write "<a href=""ex_sm_index.asp""><< 返回股市大厅</a></td>"
			response.write "</tr>"
			response.write "</table>"
			call exsm.disppagenum(totalrec,page_count,currentpage,pcount,"?page=","?")
		end if
		rs.close
		set rs=nothing
		exsm.rootshow
	end sub
	sub newstock()
		dim minprice,maxprice
		if not exsm.members then
			exsm.errmess="您还没有股票帐户，不能申请个股上市，请先开户。"
			call exsm.endinfo("no")
			exit sub
		end if
		if person_info(0)=0 then
			exsm.errmess="个股上市申请暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if exsm.stockadmin then
			exsm.errmess="管理员["&exsm.stockholder&"]您好，请到后台进行股票添加。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(exsm.usercash,2)<round(person_info(1),2) then
			exsm.errmess="您现在的股票帐户资金不足["&formatnumber(person_info(1),2,-1)&"]元，不能申请个股上市。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(exsm.usercash,2)>round(9999999999999.99,2) then
			exsm.rurl="ex_sm_mymanage.asp"
			exsm.errmess="您帐户中资金大于["&formatnumber(9999999999999.99,2,-1)&"]元，不能申请个股上市。"
			call exsm.endinfo("no")
		end if
		set rs=stock_conn.execute("select top 1 closingprice from ex_stock order by closingprice")
		if rs.eof then
			minprice=round(trade_info(5),2)
		else
			if rs(0)<round(trade_info(5),2) then
				minprice=round(trade_info(5),2)
			else
				minprice=round(rs(0),2)
			end if
		end if
		set rs=stock_conn.execute("select top 1 closingprice from ex_stock order by closingprice desc")
		if rs.eof then
			maxprice=100.00
		else
			if rs(0)<round(trade_info(5),2) then
				maxprice=100.00
			else
				maxprice=round(rs(0),2)
			end if
		end if
		exsm.title 1,"申请个股上市"
		session("ex_sm")=0
		exsm.reloadon=0
%>
		<script language="javascript" src="inc/ex_stock/ex_sm_mydispose.js"></script>
		<script language="javascript">var filter="$,<%=person_info(6)%>";</script>
		<table class="tableborder1" cellspacing="1" cellpadding="3" align="center" border="0">
			<tr>
				<th colspan="2" height="25">-=> 个 股 上 市 申 请 表 <=-</th>
			</tr>
			<form method="post" action="?action=saveusst" name="form1">
			<tr>
				<td class="tablebody1" width="50%"><u>申请人</u></td>
				<td class="tablebody1" width="50%">&nbsp;<%=exsm.stockholder%></td>
			</tr>
			<tr>
				<td class="tablebody2"><u>股票代码</u><br>必须填写股市代码方便以后查询</td>
				<td class="tablebody2">&nbsp;<input type="text" name="gpcode" value=""></td>
			</tr>
			<tr>
				<td class="tablebody1"><u>上市公司名称</u><br>即股票名，最短[<%=person_info(3)%>]byte，最长[<%=person_info(4)%>]byte</td>
				<td class="tablebody1" width="50%">&nbsp;<input type="text" name="gpname" value="">&nbsp;<input type="button" name="button" value="检测股票代码和名称　" onclick=excheckdata(1)></td>
			</tr>
			<tr>
				<td class="tablebody2"><u>上市股票单价</u><br>单价范围：[￥<%=minprice%>]～[￥<%=maxprice%>]！您的资金[<%=formatnumber(exsm.usercash,2,-1)%>]元</td>
				<td class="tablebody2">&nbsp;<input type="text" name="price" value="">&nbsp;<input type="button" name="button" value="计算最大上市股票数量" onclick=checknum(<%=replace(formatnumber(exsm.usercash,2,-1),",","")%>,<%=replace(formatnumber(person_info(2),0,-1),",","")%>,<%=replace(minprice,",","")%>,<%=replace(maxprice,",","")%>)></td>
			</tr>
			<tr>
				<td class="tablebody1"><u>上市股票数量</u><br>每股单价乘以您打算发行的股票数不能大于您现在的账户资金总额，发行的股票数量必需大于[<font color=red><%=replace(formatnumber(person_info(2),0,-1),",","")%></font>]股，您将控股[50%]</td>
				<td class="tablebody1">&nbsp;<input type="text" name="gpnum" value="">&nbsp;股&nbsp;<span id="maxnum"><font color="#ff0000">注意：</font>提交后所需的资金将被冻结</span></td>
			</tr>
			<tr>
				<td class="tablebody2"><u>初始每日交易量</u><br>即股票每日允许的最大交易量，请不要大于上市股票数量</td>
				<td class="tablebody2">&nbsp;<input type="text" name="inigpnum" value="">&nbsp;股</td>
			</tr>
			<tr>
				<td class="tablebody1"><u>上市公司图片</u><br>个股公司图片，大小：130*190。图片可以是网上的图片连接（请妥善使用该功能）</td>
				<td class="tablebody1">&nbsp;<input type=text name="ltdimg" size="39" value="inc/ex_stock/ex_img/inc_img/1.jpg"></td>
			</tr>
			<tr>
				<td class="tablebody2" valign="top"><u>上市公司简介</u><br><br>请对对上市公司作简要的介绍，对您的申请的成功率会有影响<br>公司简介不能超过[<%=person_info(5)%>]byte</td>
				<td class="tablebody2">&nbsp;<textarea cols="39" name="explain" rows="5">这个家伙很懒，什么都没有留下！</textarea></td> 
			</tr>
			<input type="hidden" name="minprice" value="<%=minprice%>">
			<input type="hidden" name="maxprice" value="<%=maxprice%>">
			<tr>
				<td class="tablebody1" colspan="2" align="center"><input type="submit" name="submit" value="申请">&nbsp;&nbsp;<input type="reset" name="submit" value="重填"></td>
			</tr>
			</form>
		</table>
<%
		exsm.rootshow
	end sub
	sub saveusst()
		dim gpcode,gpname,gpprice,gpnum,inigpnum,ltdimg,gpexplain,l_content
		gpcode=request.form("gpcode")
		gpname=trim(replace(request.form("gpname"),"'",""))
		gpname=exsm.siftname(gpname)
		gpprice=request.form("price")
		gpnum=request.form("gpnum")
		inigpnum=request.form("inigpnum")
		ltdimg=trim(replace(request.form("ltdimg"),"'",""))
		gpexplain=trim(replace(request.form("explain"),"'",""))
		if not exsm.members then
			exsm.errmess="您还没有登录不能进入，请先登录。"
			call exsm.endinfo("no")
			exit sub
		end if
		if exsm.outsiderefer() then
			exsm.errmess="请不要从外部提交数据。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if exsm.repeatrefer() then
			exsm.errmess="您提交的数据已经保存，请不要重复提交。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if person_info(3)=0 then
			exsm.errmess="个股上市申请暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if exsm.stockadmin then
			exsm.errmess="管理员["&exsm.stockholder&"]您好，请到后台进行股票添加。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(exsm.usercash,2)>round(9999999999999.99,2) then
			exsm.rurl="ex_sm_mymanage.asp"
			exsm.errmess="您帐户中资金大于["&formatnumber(9999999999999.99,2,-1)&"]元，不能申请个股上市。"
			call exsm.endinfo("no")
		end if
		if cdbl(exsm.usercash)<cdbl(person_info(1)) then
			exsm.errmess="个股申请要求最低拥有["&cdbl(person_info(1))&"]元资金，您未能达到要求！"
			call exsm.endinfo("no")
			exit sub
		end if
		if gpcode="" or not isnumeric(gpcode) or not len(gpcode)=6 then
			exsm.errmess="请正确输入股票代码[六位数字]！"
			call exsm.endinfo("no")
			exit sub
		end if
		if gpname="" or exsm.syllable(gpname)<cint(person_info(3)) or exsm.syllable(gpname)>cint(person_info(4)) then
			exsm.errmess="请正确输入上市公司的名称。名称长度不能小于["&person_info(3)&"]byte或者超过["&person_info(4)&"]byte，或您输入的名称含有仅用字符。"
			call exsm.endinfo("no")
			exit sub
		end if
		if gpprice="" or not isnumeric(gpprice) then
			exsm.errmess="请正确输入股票价格！"
			call exsm.endinfo("no")
			exit sub
		end if
		gpprice=round(gpprice,2)
		if cdbl(gpprice)<cdbl(request.form("minprice")) or cdbl(gpprice)>cdbl(request.form("maxprice")) then
			exsm.errmess="请正确输入股票单价，单价范围：["&request.form("minprice")&"]～["&request.form("maxprice")&"]！"
			call exsm.endinfo("no")
			exit sub
		end if
		if gpnum="" or not isnumeric(gpnum) or not instr(gpnum,".")=0 then
			exsm.errmess="请正确输入股票数量！"
			call exsm.endinfo("no")
			exit sub
		end if
		if gpnum+0<round(person_info(2)) then
			exsm.errmess="股票数量必须大于["&formatnumber(person_info(2),0,-1)&"]股。"
			call exsm.endinfo("no")
			exit sub
		end if
		if inigpnum="" or not isnumeric(inigpnum) or not instr(inigpnum,".")=0 then
			exsm.errmess="请正确输入初始每日交易量。"
			call exsm.endinfo("no")
			exit sub
		end if
		gpnum=replace(formatnumber(gpnum,0,-1),",","")
		if cdbl(exsm.usercash)/cdbl(gpprice)<round(person_info(2)) then
			exsm.errmess="您输入的单价只能上市["&formatnumber(cdbl(exsm.usercash)/cdbl(gpprice),0,-1)&"]股，请降低输入的单价。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(inigpnum)>round(gpnum) or round(inigpnum)<100 then
			exsm.errmess="请正确输入初始每日交易量。"
			call exsm.endinfo("no")
			exit sub
		end if
		if ltdimg="" then
			exsm.errmess="公司图片不能为空，请认真指定路径。"
			call exsm.endinfo("no")
			exit sub
		end if
		if gpexplain="" or exsm.syllable(gpexplain)>cint(person_info(5)) then
			exsm.errmess="公司简介不能为空或超过["&person_info(5)&"]byte。"
			call exsm.endinfo("no")
			exit sub
		end if
		set rs=stock_conn.execute("select code from ex_stock where code='"&gpcode&"'")
		if not rs.eof then
			exsm.errmess="您输入的股市代码已经使用了，请重新填写上市公司代码。"
			call exsm.endinfo("no")
			exit sub
		end if
		set rs=stock_conn.execute("select company from ex_oneselfstock where code='"&gpcode&"'")
		if not rs.eof then
			exsm.errmess="您输入的股市代码已经使用了，请重新填写上市公司代码。"
			call exsm.endinfo("no")
			exit sub
		end if
		set rs=stock_conn.execute("select sid from ex_stock where company='"&gpname&"'")
		if not rs.eof then
			exsm.errmess="您输入的上市公司已经存在。或您输入的名称含有仅用字符，请重新填写上市公司名称。"
			call exsm.endinfo("no")
			exit sub
		end if
		set rs=stock_conn.execute("select company from ex_oneselfstock where company='"&gpname&"'")
		if not rs.eof then
			exsm.errmess="您输入的上市公司已经存在。或您输入的名称含有仅用字符，请重新填写上市公司名称。"
			call exsm.endinfo("no")
			exit sub
		end if
		on error resume next
		stock_conn.execute("insert into ex_oneselfstock (code,username,userid,company,price,stocknum,explain,applydate,states,ltdimg,todaytradesum) values('"&gpcode&"','"&exsm.stockholder&"',"&exsm.userid&",'"&gpname&"',"&round(gpprice,2)&","&gpnum&",'"&gpexplain&"',"&sqlsmnowstring&",0,'"&ltdimg&"',"&inigpnum&")")
		stock_conn.execute("update ex_user set userwealth=userwealth-"&round(gpprice*gpnum,2)&",userassets=userassets-"&round(gpprice*gpnum,2)&" where id="&exsm.userid&"")
		if err.number=0 then
			l_content=replace("用户操作：申请个股["&gpname&"]单格["&gpprice&"]数量["&gpnum&"] ","'","")
			call exsm.savelog(exsm.stockholder,l_content,5)
			session("ex_sm")=1
			exsm.rurl="ex_sm_eachstock.asp"
			exsm.sucmess="新上市公司["&gpname&"]成功申请！请等待证监会的审批，通过审批之后就会正式上市。"
			call exsm.endinfo("ok")
		else
			exsm.errmess="出现错误，具体如下："&err.description&""
			call exsm.endinfo("no")
		end if
	end sub
	sub edit()
		dim sid,rsedit
		sid=request("sid")
		if not exsm.members then
			exsm.errmess="您还没有登录不能进入，请先登录。"
			call exsm.endinfo("no")
			exit sub
		end if
		if sid="" or not isnumeric(sid) then
			exsm.errmess="请正确输入股票ｉｄ！"
			call exsm.endinfo("no")
			exit sub
		end if
		set rsedit=stock_conn.execute("select * from ex_oneselfstock where sid="&sid)
		if rsedit.eof and rsedit.bof then
			exsm.errmess="没有找到指定的上市公司！"
			call exsm.endinfo("no")
			exit sub
		elseif rsedit("userid")<>exsm.userid and not exsm.stockadmin then
			exsm.errmess="您不是该上市公司的大股东，没有执行本操作的权限！"
			call exsm.endinfo("no")
			exit sub
		end if
		if person_info(7)=0 and not exsm.stockadmin then
			exsm.errmess="个股上市编辑功能暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		exsm.title 1,"编辑个股["&rsedit("company")&"]资料"
		session("ex_sm")=0
		exsm.reloadon=0
%>
		<script language="javascript" src ="inc/ex_stock/ex_sm_mydispose.js"></script>
		<script language="javascript">var filter="$,<%=person_info(6)%>";</script>
		<table class="tableborder1" cellspacing="1" cellpadding="3" align="center" border="0">
			<tr>
				<th colspan="2" height="25">-=> 编 辑 个 人 上 市 公 司 <%=rsedit("company")%> 资 料 <=-</th>
			</tr>
			<form method="post" name="form1" action="?action=saveedit">
			<tr>
				<td class="tablebody1" width="50%"><u>股票代码</u><br>必须填写股市代码方便以后查询</td>
				<td class="tablebody1" width="50%">&nbsp;<input type="text" name="gpcode" value="<%=rsedit("code")%>"><input type="hidden" name="gpoldcode" value="<%=rsedit("code")%>"></td>
			</tr>
			<tr>
				<td class="tablebody2"><u>上市公司名称</u><br>即股票名，最短[<%=person_info(3)%>]，byte最长[<%=person_info(4)%>]byte</td>
				<td class="tablebody2">&nbsp;<input type="text" name="gpname" value="<%=rsedit("company")%>"><input type="hidden" name="gpoldname" value="<%=rsedit("company")%>">&nbsp;<input type="button" name="button" value="检测股票代码和名称" onclick="excheckdata(0)"></td>
			</tr>
			<tr>
				<td class="tablebody1"><u>上市股票单价</u></td>
				<td class="tablebody1">&nbsp;<%=formatcurrency(rsedit("price"),2,-1)%><input type="hidden" name="sid" value="<%=rsedit("sid")%>"></td>
			</tr>	
			<tr>
				<td class="tablebody2"><u>上市股票数量</u></td>
				<td class="tablebody2">&nbsp;<%=replace(formatnumber(rsedit("stocknum"),0,-1),",","")%><input type="hidden" name="stocknum" value="<%=rsedit("stocknum")%>"> 股</td>
			</tr>
			<tr>
				<td class="tablebody1"><u>初始每日交易量：</u><br>即股票每日允许的最大交易量，请不要大于上市股票数量</td>
				<td class="tablebody1">&nbsp;<input type="text" name="inigpnum" value="<%=rsedit("todaytradesum")%>">&nbsp;股</td>
			</tr>
			<tr>
				<td class="tablebody2"><u>上市公司图片</u><br>个股公司图片，大小：130*190。图片可以是网上的图片连接（请妥善使用该功能）</td>
				<td class="tablebody2">&nbsp;<input type="text" name="ltdimg" size="39" value="<%=rsedit("ltdimg")%>"></td>
			</tr>
			<tr>
				<td class="tablebody1" valign="top"><u>上市公司简介</u><br>请对对上市公司作简要的介绍，对您的申请的成功率会有影响<br>公司简介不能超过[<%=person_info(5)%>]byte</td>
				<td class="tablebody1">&nbsp;<textarea name="explain" cols="39" rows="5"><%=rsedit("explain")%></textarea></td>
			</tr>
			<tr>
				<td colspan="2" class="tablebody2" align="center"><input type="submit" name="submit" value="提交">&nbsp;&nbsp;<input type="reset" name="submit" value="重填"></td>
			</tr>
			</form>
		</table>
<%
		exsm.rootshow
	end sub
	sub saveedit()
		dim gpsid,rsedit,gpcode,gpname,gpcoden,gpnamen,ltdimg,gpexplain,inigpnum,messagee,l_content
		gpsid=request.form("sid")
		gpcode=request.form("gpcode")
		gpname=trim(replace(request.form("gpname"),"'",""))
		gpcoden=request.form("gpoldcode")
		gpnamen=trim(replace(request.form("gpoldname"),"'",""))
		gpname=exsm.siftname(gpname)
		inigpnum=request.form("inigpnum")
		ltdimg=trim(replace(request.form("ltdimg"),"'",""))
		gpexplain=trim(replace(request.form("explain"),"'",""))
		if not exsm.members then
			exsm.errmess="您还没有登录不能进入，请先登录。"
			call exsm.endinfo("no")
			exit sub
		end if
		if exsm.outsiderefer() then
			exsm.errmess="请不要从外部提交数据。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if exsm.repeatrefer() then
			exsm.errmess="您提交的数据已经保存，请不要重复提交。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if gpsid="" or not isnumeric(gpsid) then
			exsm.errmess="请正确输入股票ｉｄ！"
			call exsm.endinfo("no")
			exit sub
		end if
		set rsedit=stock_conn.execute("select * from ex_oneselfstock where sid="&gpsid&"")
		if rsedit.eof and rsedit.bof then
			exsm.errmess="没有找到指定的上市公司！"
			call exsm.endinfo("no")
			exit sub
		elseif rsedit("userid")<>exsm.userid and not exsm.stockadmin then
			exsm.errmess="您不是该上市公司的大股东，没有执行本操作的权限！"
			call exsm.endinfo("no")
			exit sub
		end if
		if person_info(7)=0 and not exsm.stockadmin then
			exsm.errmess="个股上市编辑功能暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if gpcode="" or not isnumeric(gpcode) or not len(gpcode)=6 then
			exsm.errmess="请正确输入股票代码[六位数字]！"
			call exsm.endinfo("no")
			exit sub
		end if
		if gpname="" or exsm.syllable(gpname)<cint(person_info(3)) or exsm.syllable(gpname)>cint(person_info(4)) then
			exsm.errmess="请正确输入上市公司的名称。名称长度不能小于["&person_info(3)&"]byte或者超过["&person_info(4)&"]byte，或您输入的名称含有仅用字符。"
			call exsm.endinfo("no")
			exit sub
		end if
		if inigpnum="" or not isnumeric(inigpnum) or not instr(inigpnum,".")=0 then
			exsm.errmess="请正确输入初始每日交易量。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(inigpnum)>round(request.form("stocknum")) or round(inigpnum)<100 then
			exsm.errmess="请正确输入初始每日交易量。"
			call exsm.endinfo("no")
			exit sub
		end if
		if ltdimg="" then
			exsm.errmess="公司图片不能为空，请认真指定路径。"
			call exsm.endinfo("no")
			exit sub
		end if
		if gpexplain="" or exsm.syllable(gpexplain)>cint(person_info(5)) then
			exsm.errmess="公司简介不能为空或超过["&person_info(5)&"]byte。"
			call exsm.endinfo("no")
			exit sub
		end if
		if gpcoden<>gpcode then
			set rs=stock_conn.execute("select code from ex_stock where code='"&gpcode&"'")
			if not rs.eof then
				exsm.errmess="您输入的股市代码已经使用了，请重新填写上市公司代码。"
				call exsm.endinfo("no")
				exit sub
			end if
			set rs=stock_conn.execute("select company from ex_oneselfstock where code='"&gpcode&"'")
			if not rs.eof then
				exsm.errmess="您输入的股市代码已经使用了，请重新填写上市公司代码。"
				call exsm.endinfo("no")
				exit sub
			end if
		end if
		if gpnamen<>gpname then
			set rs=stock_conn.execute("select sid from ex_stock where company='"&gpname&"'")
			if not rs.eof then
				exsm.errmess="您输入的上市公司已经存在。或您输入的名称含有仅用字符，请重新填写上市公司名称。"
				call exsm.endinfo("no")
				exit sub
			end if
			set rs=stock_conn.execute("select company from ex_oneselfstock where company='"&gpname&"'")
			if not rs.eof then
				exsm.errmess="您输入的上市公司已经存在。或您输入的名称含有仅用字符，请重新填写上市公司名称。"
				call exsm.endinfo("no")
				exit sub
			end if
		end if
		on error resume next
		if rsedit("states")=0 then
			stock_conn.execute("update ex_oneselfstock set code='"&gpcode&"',company='"&gpname&"',ltdimg='"&ltdimg&"',explain='"&gpexplain&"' where sid="&gpsid&"")
			messagee="编辑上市公司["&gpname&"]成功！请等待证监会的审批。"
		else
			stock_conn.execute("update ex_oneselfstock set code='"&gpcode&"',company='"&gpname&"',ltdimg='"&ltdimg&"',explain='"&gpexplain&"',states=2 where sid="&gpsid&"")
			messagee="编辑上市公司["&gpname&"]成功！请等待证监会的批准，通过批准后上市股票将会被更新。"
		end if
		if err.number=0 then
			l_content=replace("用户操作：个股["&gpnamen&"]改为["&gpname&"]代码["&gpcoden&"]改为["&gpcode&"] ","'","")
			call exsm.savelog(exsm.stockholder,l_content,5)
			session("ex_sm")=1
			exsm.rurl="ex_sm_eachstock.asp"
			exsm.sucmess=""&messagee&""
			call exsm.endinfo("ok")
		else
			exsm.errmess="出现错误，具体如下："&err.description&""
			call exsm.endinfo("no")
		end if
	end sub
	sub deleachstock()
		dim gpsid,rsdel
		dim eachuserid,eachstname,eachprice,eachstocknum,l_content
		gpsid=request("gpsid")
		if not exsm.members then
			exsm.errmess="您还没有登录不能进入，请先登录。"
			call exsm.endinfo("no")
			exit sub
		end if
		if exsm.outsiderefer() then
			exsm.errmess="请不要从外部提交数据。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if exsm.repeatrefer() then
			exsm.errmess="您提交的数据已经保存，请不要重复提交。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if gpsid="" or not isnumeric(gpsid) then
			exsm.errmess="请正确输入股票ｉｄ！"
			call exsm.endinfo("no")
			exit sub
		end if
		if person_info(8)=0 and not exsm.stockadmin then
			exsm.errmess="个股上市注销功能暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		set rsdel=stock_conn.execute("select * from ex_oneselfstock where states=0 and sid="&gpsid&"")
		if rsdel.eof and rsdel.bof then
			exsm.errmess="没有找到指定的上市公司！可能已经正式上市。"
			call exsm.endinfo("no")
			exit sub
		elseif rsdel("userid")<>exsm.userid and not exsm.stockadmin then
			exsm.errmess="您不是该上市公司的大股东，没有执行本操作的权限！"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(exsm.usercash,2)>round(9999999999999.99,2) then
			exsm.rurl="ex_sm_mymanage.asp"
			exsm.errmess="您帐户中资金大于["&formatnumber(9999999999999.99,2,-1)&"]元，不能进行个股注销。"
			call exsm.endinfo("no")
		end if
		eachuserid=rsdel("userid")
		eachstname=rsdel("company")
		eachprice=rsdel("price")
		eachstocknum=rsdel("stocknum")
		stock_conn.execute("update ex_user set userwealth=userwealth+"&round(eachprice*eachstocknum,2)&",userassets=userassets+"&round(eachprice*eachstocknum,2)&" where id="&eachuserid&"")
		stock_conn.execute("delete from ex_oneselfstock where sid="&gpsid&"")
		l_content=replace("用户操作：股民["&exsm.stockholder&"]撤销个股["&eachstname&"]申请 ","'","")
		call exsm.savelog(exsm.stockholder,l_content,5)
		session("ex_sm")=1
		exsm.sucmess="上市公司["&eachstname&"]个股注销成功。"
		call exsm.endinfo("ok")
	end sub
%>