📄 book_q.inc
字号:
<%
'#############################################################################################
'#
'# 文件名 : book_q.inc
'#
'#
'# 创建人 : 姚晓辉
'# 日 期 : 2002-05-13
'#
'# 修改历史 : ****年**月**日 ****** 修改内容:**********************************************
'#
'# 功能描述 : 图书查询函数文件
'# 版 本 :
'#
'# Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
'#
'#############################################################################################
'***************************************************************************************************
' Name : TableHeader
' Function : Table head for Record Table
' In : No
' Out : No
' Return : Table head of table record
' Comment : No
'
'---------------------------------------------------------------------------------------------------
Function TableHeader()
sFileName = "book_q.asp"
TableHeader = _
TableTitle("图书信息查询列表", 600, "", "#0040a0") & _
"<table cellspacing=0 cellpadding=0 width=600 align=center class=tablelist>" & _
"<tr>" & _
"<td class=tdHead align=center width=150>" & TableHeaderField(sFileName, "name", "书名", sFormParams, iSort, iSorted) & "</td>" & _
"<td class=tdHead align=center width=100>" & TableHeaderField(sFileName, "author", "作者", sFormParams, iSort, iSorted) & "</td>" & _
"<td class=tdHead align=center width=100>" & TableHeaderField(sFileName, "publisher", "出版社", sFormParams, iSort, iSorted) & "</td>" & _
"<td class=tdHead align=center width=100>" & TableHeaderField(sFileName, "title", "类别", sFormParams, iSort, iSorted) & "</td>" & _
"</tr>"
End Function
'***************************************************************************************************
'***************************************************************************************************
' Name : TableRecords
' Function : Table List the Records
' In : 9 parameters
' sSQL --- sql statement
' iCols --- columns
' iRecordsPerPage --- records per page
' iTotalRecords --- total records
' iCurrentPage --- current page
' iTotalPages --- total pages
' sFileName --- file name
' sFormParams --- form parameters
' sSortParam --- sort parameters
' Out : No
' Return : Table head of table record
' Comment : No
'
'---------------------------------------------------------------------------------------------------
Function TableRecords(sSQL, iCols, iRecordsPerPage, iTotalRecords, iCurrentPage, iTotalPages, sFileName, sFormParams, sSortParams)
'-------------------------------------------------------------
' declares
'-------------------------------------------------------------
Dim sTemp : sTemp = "" ' 临时字符串变量
Dim j ' 临时循环变量
Dim iCounter : iCounter = 1
Dim iPrevPage, iNextPage
Dim crs : Set crs = New CRecordset
Dim rs : Set rs = crs.open(dbLocal,sSQL)
Dim sBookID,sName,sAuthor,sPublisher,sTitle
'--------------------------------------------------------------
' 如果未到记录尾,将记录定位到你翻到的页面的第一个记录,否则显示空行
'---------------------------------------------------------------
if Not rs.EOF then
rs.Move (iCurrentPage - 1) * iRecordsPerPage
end if
'--------------------------------------------------
' write the record list table
'--------------------------------------------------
while not rs.EOF and iCounter <= iRecordsPerPage
sBookID = crs.GetValue("no")
sName = crs.GetValue("name")
sAuthor = crs.GetValue("author")
sPublisher = crs.GetValue("publisher")
sTitle = crs.GetValue("title")
sTemp = sTemp & "<tr valign=center>" & _
"<td class=tdlist align=left width=150 title='" & sName & "' style=""cursor:hand"" onclick=""javascript:location.href='../library/book_q.asp?id=" & sBookID & "';""><img src=""../images/bg/ar-g.gif"" width=8 height=8> " & ToHtml(Bref(sName,25)) & " </td>" & _
"<td class=tdlist width=100 title='" & sAuthor & "' >" & ToHtml(Bref(sAuthor,25)) & " </td>" & _
"<td class=tdlist width=100 title='" & sPublisher & "' >" & ToHtml(Bref(sPublisher,25)) & " </td>" & _
"<td class=tdlist width=100 title='" & sTitle & "' style=""cursor:hand"">" & sTitle & "</td>" & _
"</tr>"
iCounter = iCounter + 1
rs.movenext
wend
crs.Close()
'------------------------------------------------
' 填补空白行
'------------------------------------------------
sTemp = sTemp & WhiteRows(iCols, iCounter, iRecordsPerPage)
'-----------------------------------------------
' 首页、前页、后页、尾页等分页信息
'-----------------------------------------------
sTemp = sTemp & "<tr><td class=tdlist colspan=" & iCols & " align=right>" & _
Paginate(sFileName, sFormParams, sSortParams, iCurrentPage, iTotalPages) & _
" </td></tr>"
'------------------------------------------------
' return
'------------------------------------------------
TableRecords = sTemp
End Function
'***************************************************************************************************
'***************************************************************************************************
' Name : TableDetail
' Function : Table Show the Search records detail
' In : No
' Out : No
' Return : Table of record detail
' Comment : No
'
'---------------------------------------------------------------------------------------------------
Function TableDetail()
'-----------------------------------------------------
' declares
'-----------------------------------------------------
Dim sTemp : sTemp = "" ' 临时字符串变量
Dim j ' 临时循环变量
'-----------------------------------------------------
' Get Parameters
'-----------------------------------------------------
Dim id : id = GetParam("id")
If IsEmpty(id) Then
Exit Function
End If
'-----------------------------------------------------
' Connect to Database
'-----------------------------------------------------
Dim crs : set crs = New CRecordset
Dim sql : sql = "select * from t_library, t_library_books_category, t_library_books_status where t_library.category_id=t_library_books_category.category_id and t_library.status_id=t_library_books_status.status_id and no=" & ToSQL(id,"Number")
Dim rs : set rs = crs.open(dbLocal,sql)
Dim sName, sAuthor, sPublisher, sTitle, sStatus, sKeeper, sTimeBorrow, sTimeReturn, sTimePur, sDis, sDisc, sPrice, sMemo, sIsbn
'-----------------------------------------------------
' show detail infomations
'-----------------------------------------------------
If Not rs.EOF Then
sName = crs.GetValue("name")
sAuthor = crs.GetValue("author")
sIsbn = crs.GetValue("isbn")
sPublisher = crs.GetValue("publisher")
sPrice = crs.GetValue("price")
sTimePur = crs.GetValue("pur_time")
sDisc = crs.GetValue("disc")
sTitle = crs.GetValue("title")
sDis = crs.GetValue("dis")
sStatus = crs.GetValue("status")
sKeeper = crs.GetValue("keeper")
sTimeBorrow = crs.GetValue("borrow_time")
sTimeReturn = crs.GetValue("return_time")
sMemo = crs.GetValue("memo")
sTemp = sTemp & TableTitle("图书详细信息", 600, "", "") & _
"<table cellspacing=0 cellpadding=0 width=600 align=center >" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>书名</td><td class=tdlist width=500 title='" & sName & "'> " & ToHtml(sName) & " </td>" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>作者</td><td class=tdlist width=500 title='" & sAuthor & "'> " & sAuthor & " </td>" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>出版商</td><td class=tdlist width=500 title='" & sPublisher & "'> " & sPublisher & " </td>" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>书号</td><td class=tdlist width=500 title='" & sIsbn & "' >" & sIsbn & " </td>" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>价格</td><td class=tdlist width=500 title='" & sPrice & "' >" & sPrice & " </td>" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>购买日期</td><td class=tdlist width=500 title='" & sPur_time & "' >" & sPur_time & " </td>" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>有无磁盘</td><td class=tdlist width=500 title='" & sDisc & "' >" & sDisc & " </td>" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>类别</td><td class=tdlist width=500 title='" & sTitle & "' >" & sTitle & " </td>" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>描述</td><td class=tdlist width=500 title='" & sDis & "' >" & sDis & " </td>" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>状态</td><td class=tdlist width=500 title='" & sStatus & "' >" & sStatus & " </td>" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>借阅人</td><td class=tdlist width=500 title='" & sKeeper & "' >" & sKeeper & " </td>" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>借阅日期</td><td class=tdlist width=500 title='" & sTimeBorrow & "' >" & sTimeBorrow & " </td>" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>归还日期</td><td class=tdlist width=500 title='" & sTimeReturn & "' >" & sTimeReturn & " </td>" & _
"<tr valign=center>" & _
"<td width=100 class=tdHead>备注</td><td class=tdlist width=500 title='" & sMemo & "' >" & sMemo & " </td>" & _
"</tr>"
End If
sTemp = sTemp & "</table>"
crs.Close()
'--------------------------------
' return
'--------------------------------
TableDetail = sTemp
End Function
'***************************************************************************************************
'***************************************************************************************************
' Name : TableLink
' Function : Table Show the Search records detail
' In : No
' Out : No
' Return : Table of record detail
' Comment : No
'
'---------------------------------------------------------------------------------------------------
Function TableLink()
TableLink = _
"<table width=400 cellspacing=0 cellpadding=0 border=0 align=left>" & _
"<tr height=10>" & _
" <td width=600><img src=""../images/bg/line.gif"" width=400 height=3></td>" & _
"</tr>" & _
"<tr height=20 align=left>" & _
" <td width=400 align=left> " & _
" <img src=""../images/goto.gif""> <a href=""book_in1.asp"">新书登记</a>" & _
" " & _
" <img src=""../images/goto.gif""> <a href=""categoryedit.asp"">类别管理</a>" & _
" " & _
" <img src=""../images/goto.gif""> <a href=""Ok.asp"">借阅管理</a>" & _
" </td>" & _
"</tr>" & _
"</table>"
End Function
'***************************************************************************************************
'***************************************************************************************************
' Name : TableSearch
' Function : Form Table of Search
' In : No
' Out : No
' Return : Table of Search entries
' Comment : No
'
'---------------------------------------------------------------------------------------------------
Function TableSearch()
TableSearch = _
TableTitle("图书查询", 600, "", "") & vbLF & _
"<table cellspacing=3 cellpadding=3 width=570 align=center border=0>" & _
"<form name=""frmSearch"" method=post action=""book_q.asp"">" & _
"<tr height=30>" & _
" <td width=250>书名:<input type=text name='name' value=''>" & "</td>" & _
" <td width=270>出版社:<input type=text name='publisher' value=''>" & "</td>" & _
" <td width=50 align=right><span id=btnSearch style=""cursor:hand"" title=""设置查询条件,然后点击查询按钮进行查询""><img border=0 src=""../images/search.gif"" style=""vertical-align:middle"">查询</span></td></tr>" & _
"</tr>" & _
"<tr height=30>" & _
" <td width=300>作者:<input type=text name='author' value=''>" & "</td>" & _
" <td width=270>类别:<select name=""title"" style=""width:86px"">" & _
" <option value='*'>全部</option>" & _
SelectOptions(dbLocal, "t_library_books_category", "category_id", "title","","") & _
" </select>" & _
"</tr> " & _
"<tr height=10><td colspan=3 width=600> </td>" & _
"</tr>" & _
"</form>" & _
"</table>"
End Function
'***************************************************************************************************
'***************************************************************************************************
' Name : InfoSearch
' Function : Deal with the search form post
' In : No
' Out : No
' Return : where clause of sql statement
' Comment : No
'
'---------------------------------------------------------------------------------------------------
Function InfoSearch()
'-------------------------------------------------
' Declares
'-------------------------------------------------
Dim sWh
Dim sName, sAuthor, sPublisher, sTitle
sName = GetParam("name")
sAuthor = GetParam("author")
sPublisher = GetParam("publisher")
sTitle = GetParam("title")
If Not IsEmpty(sName) Then
sWh = sWh & " and name LIKE '%"& sName &"%'"
End If
If Not IsEmpty(sAuthor) Then
sWh = sWh & " and author LIKE '%"& sAuthor &"%'"
End If
If Not IsEmpty(sPublisher) Then
sWh = sWh & " and publisher LIKE '%"& sPublisher &"%'"
End If
'--------------------------------------------------
' Search category
'--------------------------------------------------
If sTitle <> "*" Then
sWh = sWh & " and category_id = "& sTitle &""
End If
'--------------------------------------------------
' Returns
'--------------------------------------------------
InfoSearch = sWh
' Response.write sWh
' Response.end
End Function
'**************************************************************************************************
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -