📄 borrowcase.asp
字号:
<!--#include file="conn.asp" -->
<!--#include file="adovbs.inc"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网上图书馆</title>
</head>
<body>
<% dim op,Barcode,PPD,ReNewTerm
dim MyComm
op=request("op") '操作类型:1-续借 2-取消预约 3-预约
Barcode=trim(request("Barcode")) '图书条码号
RenewTerm=request("RenewTerm") '续借期限
Set MyComm = Server.CreateObject("ADODB.Command")
Set MyComm.ActiveConnection = conn 'conn是数据库连接字串
if op=1 then
MyComm.CommandText = "Renew" '指定存储过程名
MyComm.CommandType = adCmdStoredProc '表明这是一个存储过程
'为MyComm添加参数
MyComm.Parameters.Append MyComm.CreateParameter("ReaderID",adChar ,adParamInput ,5)
MyComm.Parameters.Append MyComm.CreateParameter("Barcode",adChar ,adParamInput ,13)
MyComm.Parameters.Append MyComm.CreateParameter("m",adInteger ,adParamInput )
MyComm("ReaderID")=Session("ReaderID")
MyComm("Barcode")=Barcode
MyComm("m")=RenewTerm
MyComm.Execute '此处不必再取得记录集
Set MyComm = Nothing
end if
Set cmd =Server.CreateObject("ADODB.Command")
cmd.ActiveConnection=conn
if op=2 then
MyComm.CommandText = "CancelS" '指定存储过程名
MyComm.CommandType = adCmdStoredProc '表明这是一个存储过程
MyComm.Parameters.Append MyComm.CreateParameter("ReaderID",adChar ,adParamInput ,5)
MyComm.Parameters.Append MyComm.CreateParameter("Barcode",adChar ,adParamInput ,13)
MyComm("ReaderID")=Session("ReaderID")
MyComm("Barcode")=Barcode
MyComm.Execute '此处不必再取得记录集
Set MyComm = Nothing
end if
sql="select readerID,PenaltyPerDay,RenewTerm from reader a inner join readersort b on a.SortCode=b.SortCode where readerID='" & Session("ReaderID") & "'"
Set rs=conn.execute(sql)
If rs.Eof Then
Response.Write ("<Script language=> window.alert('你还没有登录,请先登录!');window.location.href='index.asp'</Script>")
else
PPD=rs("PenaltyPerDay")
ReNewTerm=rs("RenewTerm")
rs.close
if op=3 then
id=request("id")
sql="select * from bookdetail a inner join borrowedcase b on a.barcode=b.barcode "
sql=sql & " where id='" & id & "' and readerid='" & Session("ReaderID") & "' "
set rs=conn.Execute(sql)
if not rs.eof then
Response.Write ("<Script language=> window.alert('你已借阅或预约本书,不能再预约!');window.location.href='select.asp'</Script>")
else
MyComm.CommandText = "BeSpoken" '指定存储过程名
MyComm.CommandType = adCmdStoredProc '表明这是一个存储过程
MyComm.Parameters.Append MyComm.CreateParameter("ReaderID",adChar ,adParamInput ,5)
MyComm.Parameters.Append MyComm.CreateParameter("Barcode",adChar ,adParamInput ,13)
MyComm.Parameters.Append MyComm.CreateParameter("ID",adChar ,adParamInput ,12)
MyComm("ReaderID")=Session("ReaderId")
MyComm("Barcode")=""
MyComm("ID")=id
MyComm.Execute '此处不必再取得记录集
Set MyComm = Nothing
end if
end if
sql= "select Name,BN=isnull(BorrowedNum,0),BeN=isnull(BespokenNum,0),FN=isnull(FreeNum,0),Status from reader where ReaderID='" & Session("ReaderID") & "'"
set rs=conn.Execute(sql)
If not rs.Eof then
%>
<form method=post>
<table border="0" width="100%" height="25" bgcolor="#2487E1" id="table1" >
<tr><td> <p align="center">
<img border="0" src="image/top.jpg" width="725" height="59"></td>
</tr></table>
<table border="1" width="100%" height="25" bgcolor="#2487E1"
bordercolor="#C0C0C0"> <tr>
<td align="center" bgcolor="#2487E1"><b><font color="#FFFFFF" size="2">
<a href="Select.asp"><font color="#FFFFFF">图书检索</font></a></font></b></td>
<td align="center" bgcolor="#2487E1"><b><font color="#FFFFFF" size="2">
<a href="BorrowCase.asp"><font color="#FFFFFF">状态查询</font></a></font></b></td>
<td align="center" bgcolor="#2487E1"><b><font color="#FFFFFF" size="2">
<a href="PWDModify.asp"><font color="#FFFFFF">修改密码</font></a></font></b></td>
<td align="center" bgcolor="#2487E1"><b><font color="#FFFFFF" size="2">
<a href=index.asp><font color="#FFFFFF">退出登录</font></a></font></b></td></tr></table>
<div align="center">
<table border="1" width="100%" id="table3" bgcolor="#00FFFF">
<tr><td colspan="7"><p align="center"><b><font size="2">
<%
Response.Write (rs("Name") & "借阅" & rs("BN") & "本,预约" & rs("BeN") & "本,还可借" & rs("FN") & "本" )
%>
</font></b></td></tr>
<tr><td colspan="7"><p align="left"><b><font size="2"> 借阅清单
</font></b></td></tr>
<tr><td align="center" width="10%"><b><font size="2">条码号</font></b></td>
<td align="center" width="30%"><b><font size="2">书名</font></b></td>
<td align="center" width="16%"><b><font size="2">作者</font></b></td>
<td align="center" width="20%"><b><font size="2">出版社</font></b></td>
<td align="center" width="10%"><b><font size="2">到期日</font></b></td>
<td align="center" width="5%"><b><font size="2">状态</font></b></td>
<td align="center" width="10%"><b><font size="2">操作</font></b></td></tr>
<tr>
<%
if rs("BN")=0 and rs("BeN")=0 then
%>
<td width="85%" colspan=7 align=center bgcolor="#CCFFCC"><font size="1">没有借阅、预约记录!</font></td>
<% else
rs.close
sql = "select * from borrowbookview where ReaderID='" & Session("ReaderId") & "'"
Set rs=conn.execute(sql)
do until rs.eof
%>
<td width="10%" bgcolor="#CCFFCC"><font size="1"><%=rs("barcode")%></font></td>
<td width="30%" bgcolor="#CCFFCC"><font size="1"><%=rs("Title")%></font></td>
<td width="16%" bgcolor="#CCFFCC"><font size="1"><%=rs("Author")%> </font></td>
<td width="20%" bgcolor="#CCFFCC"><font size="1"><%=rs("Publisher")%></font></td>
<td width="10%" bgcolor="#CCFFCC"><font size="1"><%=rs("M")%></font></td>
<td width="5%" bgcolor="#CCFFCC" > <font size=1 ><%=rs("flag")%></font></td>
<td width="10%" bgcolor="#CCFFCC" > <font size=1 >
<%
if rs("flag")="借阅" then
response.write("<a href =borrowcase.asp?Barcode=" & trim(rs("Barcode")) & "&op=1&RenewTerm=" & RenewTerm & ">续借</a>")
elseif rs("flag")="预约" then
response.write("<a href =borrowcase.asp?barcode=" & trim(rs("barcode")) & "&op=2>取消预约</a>")
else
response.write(" ")
end if
%>
</font></td></tr>
<% if DateDiff("d", rs("M"), now)>0 then
sqlm = "update bookborrowhistory set OverDate=" & DateDiff("d", rs("M"), Now) & ","
sqlm = sqlm & " Penalty=" & Round(PPD * DateDiff("d", rs("M"), Now), 2) & ","
sqlm = sqlm & " Deliver=0 where HistoryID='" & rs("HID") & "'"
cmd.CommandText=sqlm
cmd.Execute
end if
rs.moveNext
loop
end if
%>
</table>
<table border="1" width="100%" id="table4" bgcolor="#00FFFF">
<tr><td colspan="7" align="center">
<p align="left"><b><font size="2"> 帐单</font></b></td> </tr>
<tr><td height="23" align="center" width="11%"><b>
<font size="2">条码号</font></b></td>
<td height="23" align="center" width="18%">
<font size="2"><b>历史序列</b></font></td>
<td height="23" align="center" width="17%">
<font size="2"><b>借阅日期</b></font></td>
<td height="23" align="center" width="14%">
<font size="2"><b>到期日期</b></font></td>
<td height="23" align="center" width="14%">
<font size="2"><b>过期天数</b></font></td>
<td height="23" align="center" width="11%">
<font size="2"><b>罚款金额</b></font></td>
</tr>
<%
rs.close
sql = "select d.Title,a.Barcode,a.HistoryID,"
sql = sql & "BD=convert(char(4),year(a.BorrowDate))+'-'+rtrim(convert(char(2),month(a.BorrowDate)))+'-'+rtrim(convert(char(2),day(a.BorrowDate))), "
sql = sql & "M=convert(char(4),year(a.Maturity))+'-'+rtrim(convert(char(2),month(a.Maturity)))+'-'+rtrim(convert(char(2),day(a.Maturity))),"
sql = sql & "OverDate,Penalty from bookborrowhistory a inner join bookdetail c on a.Barcode=c.Barcode "
sql = sql & " inner join bookproperties d on c.id=d.id "
sql = sql & " where a.ReaderID='" & Session("ReaderID") & "' and deliver=0 "
Set rs=conn.execute(sql)
if rs.eof then
%>
<tr><td colspan=6 align =center bgcolor="#CCFFCC">
<font size=2> 没有未付帐单记录!</font></td></tr>
<%
end if
do until rs.eof
%>
<tr> <td width="11%" align="center">
<font size=1><%=rs("barcode")%></font></td>
<td width="18%" align="center"><font size=1><%=rs("HistoryID")%></font></td>
<td width="17%" align="center"><font size=1><%=rs("BD")%></font></td>
<td width="14%" align="center"><font size=1><%=rs("M")%></font></td>
<td width="14%" align="center"><font size=1><%=rs("OverDate")%></font></td>
<td width="11%" align="center"><font size=1><%=rs("Penalty")%></font></td>
</tr>
<% rs.moveNext
loop
%>
</table>
<%
end if
End If
%>
</div>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -