<!--#include file="setup.asp"-->
<!--#include file="plus/Ex_Stock/Exsm_Plus_Conn.asp"-->
<!--#include file="plus/Ex_Stock/Exsm_Plus_Const.asp"-->
<%'cnxk qq:29510683
	Dim Sid,TongJiF,TotalNum,UserNum,CurrentPrice,Code,TongJi,UserId,UserName,RankSecret
	Dim GPScale(),Tnum
	Sid=request("Sid")
	const VHeight=200
	const VWidth=200
	If Sid="" Or not isnumeric(Sid) Then
		Exsm.Errmess="<li>错误的参数，请指定正确的股票。"
		Call Exsm.Endinfo(1)
	Else
		set Rs=stock_conn.execute("select * from EX_Stock where sid="&Sid&"")
		If Rs.eof and Rs.bof Then
			Exsm.Errmess="<li>没有找到指定的上市公司，可能该上市公司已经倒闭。"
			Call Exsm.Endinfo(1)
		Else
			If Rs("TradePrice")<Split(Exsm.Stock_Setting(2),",")(5)+0 Then
				Exsm.Errmess="<li>停牌的股票不能进行买卖操作请等待复盘。"
				Call Exsm.Endinfo(1)
			Else
				Exsm.Title 1,""&Rs("Company")&"-资讯"
				Dim page,j,ExStDaTa,ExStockDaTa,AiOn,UserOn,ExAiSql,ExUserSql
				AiOn=false:UserOn=false
				page=request("page")
				If page="" Or Not isnumeric(page) Then page=1
				Response.Write "<script language=""JavaScript"" src =""plus/Ex_Stock/Exsm_Plus_Dispcompare.js""></script>"
				set Rs=stock_conn.execute("select Code,Company,Sid,ManageMent,ManageMentID,TradePrice,ClosingPrice,OqPrice,LowestPrice,HighestPrice,TodayWave,TotalWave,StockSum,SurplusShare,TodayPermitTradeSum,TodayAdTradeSum,TodayBuyNumber,TodaySellNumber,LockStock,Statement,ListedDate,ltdimg,Explain from EX_Stock where sid="&Sid&"")
				Code=Rs(0)
				CurrentPrice=Round(Rs(5),2)
				TongJi=Rs(19)
				If TongJi="" or isnull(TongJi) Then TongJi="0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0"
				TongJiF=TongJi
				TongJi=split(TongJi,"|")
				TongJiF=split(TongJiF,"|")
				TotalNum=stock_conn.execute("select sum(PossessStockSum) from EX_Customer Where Sid="&Sid&"")(0)
				UserNum=stock_conn.execute("select count(*) from EX_Customer Where UserId>0 And Sid="&Sid&"")(0)
				If TotalNum=0 Or isnull(TotalNum) Then TotalNum=1
				Call FormatValue(VHeight)
				Tnum=StockScale(VWidth,UserNum,TotalNum)
				For j=0 To Rs.Fields.count-1
					ExStDaTa=Rs(j)
					If j=1 Or j=21 Or j=22 Then ExStDaTa=Exsm.htmlencode(Rs(j))
					ExStockDaTa=ExStockDaTa&ExStDaTa&","
				Next
				Response.Write "<Script Language=JavaScript>"
				Response.Write "var assignwidth='"&Exsm.AssignWidth&"';"
				Response.Write "show_dispcompare_info('"&ExStockDaTa&"');"
				Response.Write "</Script>"
				Response.Write "<Script Language=JavaScript>"
				Response.Write "var assignwidth='"&Exsm.AssignWidth&"';"
				Response.Write "var vheight="&VHeight+20&";"
				For i=0 To ubound(tongji)
					Response.Write "tongji["&i&"]='<img src=""plus/Ex_Stock/Ex_img/bar.gif"" width=""4"" height="""&TongJiF(i)+5&""" title=""当日收盘价："&TongJi(i)&" 元"">&nbsp;';"
				Next
				If UserNum<=0 Then
					Response.Write "var userno=false;"
				Else
					Response.Write "var userno=true;"
					For i=0 To Tnum
						Response.Write "tnum["&i&"]='<tr><td width=""90"">"&GPScale(i,5)&"</td><td><img src=""plus/Ex_Stock/Ex_img/baru.gif"" height=""10"" width="""&GPScale(i,4)+5&""" title=""持股手数："&GPScale(i,2)&"手 持股手数百分比："&Formatnumber(GPScale(i,3)*100,2,-1)&"%""></td></tr>';"
						Response.Write vbNewLine
					Next
				End if
				Response.Write "show_graph_info();"
				Response.Write "</Script>"
				Response.Write "<Script Language=JavaScript>"
				Response.Write "var assignwidth='"&Exsm.AssignWidth&"';"
				Response.Write "var userid="&Exsm.UserID&";"
				Response.Write "var currentprice="&CurrentPrice&";"
				Response.Write "var totalnum="&TotalNum&";"
				Set Rs=stock_conn.execute("select * from EX_Customer Where Sid="&Sid&" And UserId=-1")
				If not Rs.eof Then
					AiOn=true
					ExAiSql=Rs.GetRows(1)
					Response.Write "var aion=true;"
					Response.Write "aispllist='"&Exsm.htmlencode(ExAiSql(0,0))&","&ExAiSql(1,0)&","&ExAiSql(2,0)&","&ExAiSql(5,0)&","&ExAiSql(7,0)&"';"
					Response.Write vbNewLine
				Else
					Response.Write "var aion=false;"
				End if
				Sql="select d.*,u.RankSecret from EX_Customer d inner join EX_User u on d.UserId=u.ID Where d.UserId>0 And d.Sid="&Sid&" order by d.PossessStockSum desc"
				Set Rs=server.createobject("adodb.recordset")
				Rs.open Sql,stock_conn,1,1
				If not Rs.eof Then
					UserOn=true
					Response.Write "var useron=true;"
					Response.Write "var stocksid="&Sid&";"
					Rs.PageSize=CInt(Exsm.Setting_Info(15))
					If page+0>Rs.PageCount Then page=Rs.PageCount
					Response.Write "var page="&page&";"
					Rs.AbsolutePage=page
					ExUserSql=Rs.GetRows(Rs.PageSize)
					For i=0 To Ubound(ExUserSql,2)
						If ExUserSql(10,i)=1 Or Exsm.StockAdmin Or ExUserSql(1,i)=Exsm.UserID Then
							UserId=ExUserSql(1,i)
							UserName=Exsm.htmlencode(ExUserSql(0,i))
							RankSecret=1
						Else
							UserId=-1
							UserName="***"
							RankSecret=0
						End if
						Response.Write "userstocklist["&i&"]='"&UserName&","&UserId&","&ExUserSql(2,i)&","&ExUserSql(5,i)&","&ExUserSql(7,i)&","&RankSecret&"';"
						Response.Write vbNewLine
					Next
				Else
					Response.Write "var useron=false;"
				End if
				If UserOn Then
					Response.Write "var recordcount="&Rs.RecordCount&";"
					Response.Write "var pagesize="&Rs.PageSize&";"
					Response.Write "var pagecount="&Rs.PageCount&";"
				End if
				If AiOn Or UserOn Then
					Response.Write "show_jobber_info();"
				End if
				Response.Write "</Script>"
			End if
		End if
	End if
	Function FormatValue(StdValue)
		Dim Max,ii
		Max=TongJi(0)
		for ii=1 to ubound(TongJi)
			if csng(Max)<csng(TongJi(ii)) Then Max=TongJi(ii)
		next
		if max=0 Then max=1
		for ii=0 to ubound(TongJi)
		 	TongJiF(ii)=int(TongJi(ii)*StdValue/Max)
		Next
	End Function
	Function StockScale(StdWidth,TopNum,TotalN)
		Dim other,Num
		other=false
		StockScale=0
		Num=TopNum 
		if Num<=0 Then
			Exit Function
		Elseif Num>10 Then
			Num=9
			other=true
		End if	
		ReDim GPScale(num,5)
		Dim Rst,ii
		Set Rst=stock_conn.execute("select top "&Num&" d.UserId,d.UserName,d.PossessStockSum,u.RankSecret from EX_Customer d inner join EX_User u on d.UserId=u.ID Where d.UserId>0 And d.Sid="&Sid&" order by d.PossessStockSum desc")
		For ii=0 To Num-1
			GPScale(ii,0)=Rst(0)
			GPScale(ii,1)=Exsm.htmlencode(Rst(1))
			GPScale(ii,2)=Rst(2)
			GPScale(ii,3)=Rst(2)/TotalN
			GPScale(ii,4)=int(GPScale(ii,3)*StdWidth)
			StockScale=StockScale+GPScale(ii,2)
			If Rst(3)=1 Or Rst(0)=Exsm.UserID Or Exsm.StockAdmin Then
				GPScale(ii,5)="<a href=Exsm_Plus_Dispu.asp?uid="&GPScale(ii,0)&">"&GPScale(ii,1)&"</a>"
			Else
				GPScale(ii,5)="<a title=""使用了用户名保护模式"">***</a>"
			End if
			Rst.movenext 
		next 
		Rst.close
		set Rst=nothing
		If other Then   
			GPScale(9,5)="<font color=gray>其他股东</font>"
			GPScale(9,2)=TotalN-StockScale
			GPScale(9,3)=GPScale(9,2)/TotalN
			GPScale(9,4)=int(GPScale(9,3)*StdWidth)
		End if
		If Topnum>10 Then
			StockScale=9
		Else
			StockScale=Topnum-1
		End if
	End Function
	Exsm.RootShow
%>