?? disp.asp
字號:
<%response.expires=0%>
<!-- #include file="../conn_lr.asp"-->
<%
oabusyname=session("oabusyname")
oabusyusername=session("oabusyusername")
oabusyuserdept=session("oabusyuserdept")
oabusyuserlevel=session("oabusyuserlevel")
if oabusyusername="" then
response.write("<script language=""javascript"">")
response.write("window.top.location.href='../../default.asp';")
response.write("</script>")
response.end
end if
%>
<%
href="disp.asp"
Dim mTable,mBack
Dim Item
Dim mRecordCount, mFieldCount
Dim mCond, mSortBy, mQueryString
Dim mExcludeFieldTypes
Dim mFieldType, mFieldContent
Dim mPageSize, mPageCount, mPageNo
Dim i, j , FieldsInfo()
Dim LinkFlag,LinkItem(),LinkItemLink()
Dim ReCount '是否重新計算查詢語句
IF Request("LinkFlag").count<>0 and Request("mTable").count<>0 THEN
LinkFlag=Request("LinkFlag") ' 權限標志 "000000":"","","","詳情","修改","刪除"
mTable =Request("mTable") ' 數據表名稱
addnew=Request("EnabledAddNew") ' 是否允許增加記錄
mFiledsCount=CINT(Request("mFiledsCount")) ' 要顯示的字段數目
mFileds=Request("mFileds") ' 要顯示的字段列表
mFiledsCaptions=Request("mFiledsCaptions") ' 要顯示的標題列表
mFiledsWidths=Request("mFiledsWidths") ' 要顯示的字段寬度列表
DispFile=Request("DispFile") ' 詳細信息顯示文件
EditFile=Request("EditFile") ' 編輯信息的文件
DelFile=Request("DelFile") ' 編輯信息的文件
mCond2 = Request("mCond2") ' 基本查詢條件
mSortBy2=Request("mSortBy2") ' 排序的字段
mTitle = Request("mTitle") ' 頁面標題
mImage=Request("mImage") ' 標題圖標
EnableDelAll=Request("EnabledDelAll") ' 清空標志"yes"允許 "no" 不允許
mBack=Request("mBack")
mBackImage=Request("mBackImage")
ReCount=1
Session("LinkFlag")=LinkFlag
Session("mTable")=mTable
Session("addnew")=addnew
Session("mFiledsCount")=mFiledsCount
Session("mFileds")=mFileds
Session("mFiledsCaptions")=mFiledsCaptions
Session("mFiledsWidths")=mFiledsWidths
Session("DispFile")=DispFile
Session("EditFile")=EditFile
Session("DelFile")=DelFile
Session("mCond")=""
Session("mSortBy")=""
Session("mCond2")=mCond2
Session("mSortBy2")=mSortBy2
Session("EnableDelAll")=EnableDelAll
Session("mTitle")=mTitle
Session("mImage")=mImage
Session("mBack")=mBack
Session("mBackImage")=mBackImage
ELSE
ReCount=0
mImage=Session("mImage")
mBackImage=Session("mBackImage")
mTitle=Session("mTitle")
LinkFlag=Session("LinkFlag")
mTable=Session("mTable")
addnew=Session("addnew")
mFiledsCount=Session("mFiledsCount")
mFileds=Session("mFileds")
mFiledsCaptions=Session("mFiledsCaptions")
mFiledsWidths=Session("mFiledsWidths")
EditFile=Session("EditFile")
DispFile=Session("DispFile")
DelFile=Session("DelFile")
EnableDelAll=Session("EnableDelAll")
mCond2=Session("mCond2")
mSortBy2=Session("mSortBy2")
mBack=Session("mBack")
END IF
title=mTitle
image=mImage
Redim LinkItem(len(LinkFlag)),LinkItemLink(len(LinkFlag))
Redim FieldsInfo(3,mFiledsCount)
t2=1
t4=1
t6=1
For i=1 to mFiledsCount
t1=instr(t2,mFiledsWidths,",")
t3=instr(t4,mFileds,",")
t5=instr(t6,mFiledsCaptions,",")
temp1=mid(mFiledsWidths,t2,t1-t2)
temp2=mid(mFileds,t4,t3-t4)
temp3=mid(mFiledsCaptions,t6,t5-t6)
t2=t1+1
t4=t3+1
t6=t5+1
FieldsInfo(1,i)=temp1
FieldsInfo(2,i)=replace(temp2,"^",",")
FieldsInfo(3,i)=temp3
Next
mCond = replace(Request("key"),"'","’") & " LIKE '%" & replace(trim(Request("keyword")),"'","’") & "%'"
if Request("key") <>"" then
Session("mCond")=mCond
ELSE
mCond=Session("mCond")
END IF
mSortBy =Request("mSortBy")
if Request("mSortBy") <>"" then
if Session("Forward")="ASC" then Session("Forward")="DESC" else Session("Forward")="ASC"
Session("mSortBy")=mSortBy
ELSE
mSortBy=Session("mSortBy")
END IF
'/////////////////////處理連接標志////////////////////////////////////////
dim LinkImage(7)
LinkImage(4)="file"
LinkImage(5)="edit"
LinkImage(6)="dele"
LinkImage(7)="back"
LinkItem(4)="詳細"
LinkItemLink(4)= DispFile & "?opFlag=cmdSee"
LinkItem(5)="修改"
LinkItemLink(5)= EditFile & "?opFlag=cmdEdit"
LinkItem(6)="刪除"
if DelFile="" then DelFile=href
LinkItemLink(6)= DelFile & "?opFlag=cmdDel"
if len(linkflag)>6 then
LinkItem(7)="歸還"
LinkItemLink(7)= DispFile & "?opFlag=cmdBack"
end if
IF ReCount THEN
'/////////////////////開始計算SQL查詢字符串////////////////////////////////////////
dim t
t=split(mTable,",")
temp=replace(mFileds & t(0) & ".ID as tempID","^",",")
temp=replace(temp,"~","""")
mQueryString = "SELECT " & temp & " from " & mTable
Session("mQueryString")=mQueryString
ELSE
mQueryString=Session("mQueryString")
END IF
'/////////////////////計算SQL查詢字符串結束/////////////////////////////////////////
'/////////////////////處理查詢條件/////////////////////////////
if mCond<>"" and mCond2<>"" then
Cond=" where "+mCond+ " and " +mCond2
elseif mCond+mCond2="" then
Cond=""
else
Cond=" where "+mCond+mCond2
end if
'///////////////////////處理排序條件///////////////////////////////
if mSortBy<>"" and mSortBy2<>"" then
SortBy=" ORDER BY "+mSortBy+","+mSortBy2
elseif mSortBy+mSortBy2="" then
SortBy=""
else
SortBy=" ORDER BY "+mSortBy+mSortBy2
end if
if mSortBy<>"" then SortBy=" ORDER BY " + mSortBy + " " + Session("Forward")
mQueryString= mQueryString & Cond & SortBy
Session("SQLFULL")=mQueryString
Session("SQL")="select * from " & mTable & Cond & SortBy
mPageSize = 15
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.PageSize=mPageSize
Rs.Open mQueryString,oconn,1,3
mPageCount=Rs.PageCount
mFieldCount=Rs.Fields.count-1
Select case Request("opFlag")
'//////////////////////執行刪除操作////////////////////////////////////////
case "cmdDel"
Rs.close
Rs.open Session("SQL"),oconn,1,3
Rs.move CINT(Request("Number"))
Rs.delete
Rs.update
Rs.Close
Rs.Open mQueryString,oconn,1,3
mPageCount=Rs.PageCount
'mFieldCount=Rs.Fields.count-1
'//////////////////////執行清空操作////////////////////////////////////////
case "cmdDelAll"
oconn.execute "delete from " & mTable & Cond
Rs.Close
Rs.Open mQueryString,oconn,1,3
mPageCount=Rs.PageCount
case "cmdExportExcel"
Response.AddHeader "content-disposition","inline; filename=" & mtitle & ".csv"
Response.ContentType = "*/*.csv"
For i=1 to mFiledsCount
if FieldsInfo(1,i)<>"0" then
Response.write(FieldsInfo(3,i))
Response.write(",")
end if
Next
Response.write(chr(13)+chr(10))
Do While Not Rs.EOF
For i = 0 to mFieldCount-1
if FieldsInfo(1,i+1)<>"0" then
Response.write(Rs.Fields(i))
Response.write(",")
end if
Next
Response.write(chr(13)+chr(10))
Rs.MoveNext
Loop
Rs.Close
Set Rs = Nothing
Response.end
'//////////////////////執行打印操作////////////////////////////////////////
case "cmdPrint"
rs.PageSize=25
For pn=1 to rs.PageCount
Response.Write("<TITLE>" & mTitle & "</TITLE><style>table{border:solid windowtext .5pt;border-right:none;border-bottom:none;}td{border:solid windowtext .5pt;border-left:none;border-top:none;mso-border-left-alt:solid windowtext .5pt;padding:0mm 5.4pt 0mm 5.4pt }</style><body style='font-size:10pt'><p align=center style='font-size:14pt;font-family:黑體;background:none'>" & mTitle & "</p><TABLE CELLPADDING=0 CELLSPACING=0 BORDER=1 WIDTH=100% bgcolor='#000000' align=center style='font-size:10pt' >")
Response.Write("<TR bgcolor='#ffffff' height=30 align=center >")
'輸出列標題
For i=1 to mFiledsCount
if FieldsInfo(1,i)<>"0" then
Response.write("<TD ")
if FieldsInfo(1,i)<>"" then Response.write("width=" & FieldsInfo(1,i))
Response.Write("><b>" & FieldsInfo(3,i) & "</b></TD>")
END IF
Next
Response.write("</TR>")
'Response.end
'///////////////////遍歷數據記錄集,輸出數據表/////////////////////////
j= rs.PageSize
Do While Not Rs.EOF and j>0
'///////////////////////行開輸出始///////////////////////////
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -