<!--#include file="setup.asp"-->
<!--#include file="plus/Ex_Stock/Exsm_Plus_Conn.asp"-->
<!--#include file="plus/Ex_Stock/Exsm_Plus_Const.asp"-->
<!--#include file="plus/Ex_Stock/Exsm_Plus_Ai.asp"-->
<%
	Dim page
	Dim Indication,IndicationEx,HighLow,DataSort,DescDataSort
	Dim SortClosingPrice,SortTradePrice,SortHeaveChangeA,SortHeaveChangeB,SortTodayBuyNumber,SortTodaySellNumber,SortTodayPermitTradeSum,SortTodayTradeNum,SortLockStock
	Response.Write "<script language=""JavaScript"" src =""plus/Ex_Stock/Exsm_Plus_Function.js""></script><script language=""JavaScript"" src =""plus/Ex_Stock/Exsm_Plus_StockDiv.js""></script>"
	Response.Write "<script language=""JavaScript"">if(top==self)top.location='Exsm_Plus_Gupiao.asp'</script>"
	SortClosingPrice="''":SortTradePrice="''":SortHeaveChangeA="''":SortHeaveChangeB="''":SortTodayBuyNumber="''":SortTodaySellNumber="''":SortTodayPermitTradeSum="''":SortTodayTradeNum="''":SortLockStock="''"
	page=request("page")
	If page="" Or Not isnumeric(page) Then page=1
	IndicationEx=request("action")
	HighLow=request("HighLow")
	If HighLow="" Or Not isnumeric(HighLow) Then HighLow=0
	If HighLow=0 Then
		DescDataSort=""
		Indication="'<a href=""Exsm_Plus_StockDiv.asp?page="&page&"&HighLow=1&action="&IndicationEx&""" target=""hiddendialogue""><Font color=""#008800"">¡ý</Font></a>'"
	Else
		DescDataSort=" desc"
		Indication="'<a href=""Exsm_Plus_StockDiv.asp?page="&page&"&HighLow=0&action="&IndicationEx&""" target=""hiddendialogue""><Font color=""#FF0000"">¡ü</Font></a>'"
	End if
	If request("StockUserDiv")=1 And Exsm.Members Then StockUserDiv
	Select case request("action")
		case "ClosingPrice"
			DataSort="ClosingPrice"
			SortClosingPrice=Indication
			StockDiv
		case "TradePrice"
			DataSort="TradePrice"
			SortTradePrice=Indication
			StockDiv
		case "HeaveChangeA"
			DataSort="TradePrice-ClosingPrice"
			SortHeaveChangeA=Indication
			StockDiv
		case "HeaveChangeB"
			DataSort="TradePrice-ClosingPrice"
			SortHeaveChangeB=Indication
			StockDiv
		case "TodayBuyNumber"
			DataSort="TodayBuyNumber"
			SortTodayBuyNumber=Indication
			StockDiv
		case "TodaySellNumber"
			DataSort="TodaySellNumber"
			SortTodaySellNumber=Indication
			StockDiv
		case "TodayPermitTradeSum"
			DataSort="TodayPermitTradeSum"
			SortTodayPermitTradeSum=Indication
			StockDiv
		case "TodayTradeNum"
			DataSort="TodayAdTradeSum"
			SortTodayTradeNum=Indication
			StockDiv
		case "LockStock"
			DataSort="LockStock"
			SortLockStock=Indication
			StockDiv
		case "Sid"
			DataSort="Sid"
			StockDiv
	End Select
	Sub StockDiv()
		Dim Trade_Info,ExRs
		Response.Write "<script language=""javascript"">var assignwidth='"&Exsm.AssignWidth&"';ex_stock_show();</script>"
		Trade_Info=Split(Exsm.Stock_Setting(2),",")
		Response.Write "<Script Language=JavaScript>"
		Response.Write "var assignwidth='"&Exsm.AssignWidth&"';"
		Response.Write "var highlow="&HighLow&";"
		Response.Write "var SortClosingPrice="&SortClosingPrice&";"
		Response.Write "var SortTradePrice="&SortTradePrice&";"
		Response.Write "var SortHeaveChangeA="&SortHeaveChangeA&";"
		Response.Write "var SortHeaveChangeB="&SortHeaveChangeB&";"
		Response.Write "var SortTodayBuyNumber="&SortTodayBuyNumber&";"
		Response.Write "var SortTodaySellNumber="&SortTodaySellNumber&";"
		Response.Write "var SortTodayPermitTradeSum="&SortTodayPermitTradeSum&";"
		Response.Write "var SortTodayTradeNum="&SortTodayTradeNum&";"
		Response.Write "var SortLockStock="&SortLockStock&";"
		If IndicationEx="" Then IndicationEx="''"
		Response.Write "var IndicationEx="""&IndicationEx&""";"
		Response.Write "var trade_stop="&Round(Trade_Info(5),2)&";"
		Response.Write "var trade_upstop="&Round(Trade_Info(3)/100,2)&";"
		Response.Write "var trade_dostop="&-Round(Trade_Info(4)/100,2)&";"
		sql="select * from EX_Stock order by "&DataSort&DescDataSort&""
		Set Rs=server.createobject("adodb.recordset")
		rs.open sql,stock_conn,1,1
		If not Rs.eof Then
			Response.Write "var stockdivon=true;"
			Rs.PageSize=CInt(Exsm.Setting_Info(14))
			If page+0>Rs.PageCount Then page=Rs.PageCount
			Response.Write "var page="&page&";"
			Rs.AbsolutePage=page
			ExRs=Rs.GetRows(Rs.PageSize)
			For i=0 To Ubound(ExRs,2)
				Response.Write "StockList["&i&"]='"
				Response.Write ExRs(0,i)
				Response.Write ","
				Response.Write Exsm.htmlencode(ExRs(1,i))
				Response.Write ","
				Response.Write ExRs(2,i)
				Response.Write ","
				Response.Write Exsm.htmlencode(ExRs(4,i))
				Response.Write ","
				Response.Write ExRs(5,i)
				Response.Write ","
				Response.Write ExRs(6,i)
				Response.Write ","
				Response.Write ExRs(7,i)
				Response.Write ","
				Response.Write ExRs(18,i)
				Response.Write ","
				Response.Write ExRs(19,i)
				Response.Write ","
				Response.Write ExRs(16,i)
				Response.Write ","
				Response.Write ExRs(17,i)
				Response.Write ","
				Response.Write ExRs(21,i)
				Response.Write "';"
			Next
			Response.Write "var recordcount="&Rs.RecordCount&";"
			Response.Write "var pagesize="&Rs.PageSize&";"
			Response.Write "var pagecount="&Rs.PageCount&";"
		Else
			Response.Write "var stockdivon=false;"
		End if
		Response.Write "ex_stock_div();"
		Response.Write "</Script>"
		Rs.Close
		Set Rs=Nothing
		StockQuotations
	End Sub
	Sub StockUserDiv()
		Dim ExRs
		Response.Write "<script language=""javascript"">var assignwidth='"&Exsm.AssignWidth&"';ex_user_stock_show();</script>"
		Response.Write "<Script Language=JavaScript>"
		Response.Write "var assignwidth='"&Exsm.AssignWidth&"';"
		Response.Write "var username='"&Exsm.htmlencode(Exsm.StockHolder)&"';"
		Response.Write "var usercutamelon="""&Split(Exsm.Stock_Setting(2),",")(1)&""";"
		Response.Write "var userid="&Exsm.UserID&";"
		sql="select d.Code,d.Company,d.Sid,d.PossessStockSum,d.BuyPrice,d.AveragePrice,g.TradePrice,g.ManageMent,g.ManageMentID from EX_Customer d inner join EX_Stock g on d.Code=g.Code Where d.UserId="&Exsm.UserID&" order by d.PossessStockSum desc"
		Set Rs=server.createobject("adodb.recordset")
		rs.open sql,stock_conn,1,1
		If not Rs.eof Then
			Response.Write "var stockuserdivon=true;"
			Rs.PageSize=CInt(Exsm.Setting_Info(15))
			If page+0>Rs.PageCount Then page=Rs.PageCount
			Response.Write "var page="&page&";"
			Rs.AbsolutePage=page
			ExRs=Rs.GetRows(Rs.PageSize)
			For i=0 To Ubound(ExRs,2)
				Response.Write "StockUserList["&i&"]='"
				Response.Write ExRs(0,i)
				Response.Write ","
				Response.Write Exsm.htmlencode(ExRs(1,i))
				Response.Write ","
				Response.Write ExRs(2,i)
				Response.Write ","
				Response.Write ExRs(3,i)
				Response.Write ","
				Response.Write ExRs(4,i)
				Response.Write ","
				Response.Write ExRs(5,i)
				Response.Write ","
				Response.Write ExRs(6,i)
				Response.Write ","
				Response.Write ExRs(7,i)
				Response.Write ","
				Response.Write ExRs(8,i)
				Response.Write "';"
			Next
			Response.Write "var recordcount="&Rs.RecordCount&";"
			Response.Write "var pagesize="&Rs.PageSize&";"
			Response.Write "var pagecount="&Rs.PageCount&";"
		Else
			Response.Write "var stockuserdivon=false;"
		End if
		Response.Write "ex_user_stock_div();"
		Response.Write "</Script>"
		Rs.Close
		Set Rs=Nothing
	End Sub
	Sub StockQuotations()
		Dim Quotations,TodayTradeNum,TodayTradeMoney,ColExp
		Exsm.Name="Exsm_Imitate_Quotations"
		Quotations=Exsm.Value
		TodayTradeNum=Clng(Quotations(0))+Clng(Quotations(1))
		TodayTradeMoney=Quotations(2)
		ColExp=Quotations(3)
		Response.Write "<Script Language=JavaScript>"
		Response.Write "ExReload='"&Exsm.Setting_Info(6)&"';"
		Response.Write "CzStatus();"
		Response.Write "</Script>"
		Response.Write "<Script Language=JavaScript>"
		Response.Write "var BargainMoney='"&TodayTradeMoney&"';"
		Response.Write "var BargainNum='"&TodayTradeNum&"';"
		Response.Write "var cziedxp='"&ColExp&"';"
		Response.Write "ColExp();"
		Response.Write "</Script>"
	End Sub
%>