<!--#include file="../inc/Bll.asp"-->
<!--#include file="../inc/Constant.asp"-->
<!--#include file="../inc/Md5.asp"-->

<%
function GetChildRoomClass(e)
	dim tRS,tRe,j
	Set tRS=DB_CONN.EXECUTE("select * from [i_Sys_Room_Class] where [i_Sys_Room_CLass_ParentID]="&e&" order by [i_Sys_Room_Class_Sort] desc")
	tRe=""
	while (not tRS.eof )
		if j>0 then tRe=tRe&","
		tRe=tRe&"{cid:'"&tRS("i_Sys_Room_Class_ID")&"',cname:'"&tRS("i_Sys_Room_Class_Name")&"'}"
		j=j+1
		tRS.MoveNext
	Wend
	GetChildRoomClass=tRe
end function

dim SumPay,SumIncome,CurrentPage,k,Re,t,p,inum,maxin
if Request.QueryString("ac")="GetRoomClass" then 
	RS_End
	if Request.QueryString("top")="" then RW "var RClassRe='参数错误！';":REND
	if not IsNumeric(Request.QueryString("top")) then RW "var RClassRe='参数错误！';":REND
	t = Cint(Request.QueryString("top"))
	if Request.QueryString("ps")="" then RW "var RClassRe='参数错误！';":REND
	if not IsNumeric(Request.QueryString("ps")) then RW "var RClassRe='参数错误！';":REND
	p = Cint(Request.QueryString("ps"))
	
	Re="var RClassRe=""{data:["
	Set RS=DB_CONN.EXECUTE("select top "&t&" * from [i_Sys_Room_Class] where [i_Sys_Room_CLass_ParentID]=0 order by [i_Sys_Room_Class_Sort] desc")
	RS.pagesize=p
	if isempty(Request.QueryString("page")) or Request.QueryString("page")="" then CurrentPage=1 else CurrentPage=Cint(Request.QueryString("page")) end if
	if not RS.eof then RS.absolutepage = CurrentPage
	while (not RS.eof and k<RS.pagesize )
		if k>0 then Re=Re&","
		Re=Re&"{cid:'"&RS("i_Sys_Room_Class_ID")&"',cname:'"&RS("i_Sys_Room_Class_Name")&"',child:["&GetChildRoomClass(RS("i_Sys_Room_Class_ID"))&"]}"
		k=k+1
		RS.MoveNext
	Wend
	Re=Re&"],recordcount:"&RS.recordcount&",pagenum:"&RS.pagecount&",currentpage:"&CurrentPage&"}"";"
	RS_End
	RW Re
	Rend
end if

%>