<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<%if WS_S.MemberPriv("WS_PublicAffairsBookManage")<>1 then HX_GoBack "对不起,您的权限不够!",""
ColumnName="":Tablename="HX_BookMain":Orderby=""
keywords=request("keywords"):action=request("action"):WS_BOID=request("WS_BOID")
select case action
  case "search" Orderby=Orderby&"  where WS_Booknum like '%"&keywords&"%' or WS_Bookname like '%"&keywords&"%' or WS_Bookconcern like '%"&keywords&"%' or WS_Bookdetail like '%"&keywords&"%' or WS_Bookauthor like '%"&keywords&"%'"
  case "del"
     if WS_BOID<>"" and isnumeric(WS_BOID) then
        conn.execute("delete from HX_BookMain where WS_BOID="&WS_BOID)
	    WS_S.HX_Redirect "booksmanage.asp"
	 else
	    HX_GoBack "删除失败！","" 
	 end if  
  case "return"
    if WS_BOID<>"" and isnumeric(WS_BOID) then
	    conn.execute("update HX_BookMain set WS_BookSign=1,WS_BookBorrow=0 where WS_BOID="&WS_BOID)'图书
        conn.execute("delete from HX_BookBorrow where WS_BOID="&WS_BOID)
	    HX_GoBack "归还成功！","booksmanage.asp"
	 else
	    HX_GoBack "还书失败！","" 
	 end if 
end select
set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
response.Write "<head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title></title><link rel=stylesheet type=text/css href='../HXinclude/HX_Style.css'><script src='../HXinclude/HX_Function.js'></script></head><body topmargin='20' leftmargin='0' bottommargin='0'><table width='750'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#613c25'><tr><td colspan='2' bgcolor=FFFBE8 background='../hximages/titlelinebg.gif'><table width='550'  border='0' cellspacing='0' cellpadding='0'><tr><td height='25' background='../hximages/titleline.gif'><font class='fontmenu'>查看图书</font></td></tr></table><table width='100%'  border='0' cellspacing='1' cellpadding='3' bgcolor=FFFBE8><tr bgcolor='#BF9B73'><td width='8%'><div align='center'><font color='#000000'>编号</font></div></td><td width='28%'><div align='center'>书名</div></td><td width='20%'><div align='center'>出版社</div></td><td width='11%'><div align='center'><font color='#000000'>借者</font></div></td><td width='12%'><div align='center'><font color='#000000'>申请批准</font></div></td><td width='9%'><div align='center'>还书</div></td><td><div align='center'>操 作</div></td></tr>"
    if rs.recordcount<=0 then
		response.Write "<tr><td colspan=7 bgcolor=FFFBE8 height=25 align=center>暂无记录！</td></tr>"							
	else
    rs.PageSize =15 '每页记录条数
	iCount=rs.RecordCount '记录总数
	iPageSize=rs.PageSize
    	maxpage=rs.PageCount 
    	page=request("page")
    
    if Not IsNumeric(page) or page="" then
        page=1
    else
        page=cint(page)
    end if
    
    if page<1 then
        page=1
    elseif  page>maxpage then
        page=maxpage
    end if
    
    rs.AbsolutePage=Page

	if page=maxpage then
		x=iCount-(maxpage-1)*iPageSize
	else
		x=iPageSize
	end if
	ii=0
	do while not rs.EOF 
	response.Write "<tr bgcolor=FFFBE8  onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td width='6%'><div align='center'>"
	if rs("WS_BookNUM")<>"" then response.Write rs("WS_BookNUM")
     response.Write "</div></td><td><div align='left'>"
	 if rs("WS_BookName")<>"" then response.write "<a href='javascript:' onClick=""openwin(520,230,'Bookdetail.asp?WS_BOID="&rs("WS_BOID")&"')"" title='点击查看"&rs("WS_BookName")&"'>"
	 response.Write rs("WS_BookName")&"</a></div></td><td><div align='center'>"
	 if rs("WS_BookConcern")<>"" then response.Write rs("WS_BookConcern")
     response.Write "</div></div></td><td><div align='center'>"
	 set brs=WS_S.HX_SetRSD(ColumnName,"HX_BookBorrow"," where WS_BOID="&rs("WS_BOID")&" and WS_BookSign=1")
	 if brs.recordcount>0 then
	   Call WS_S.HX_OutUserInfo(brs("WS_BookBorrowMan"))
	   response.write "<a title='"&Outdepartment&OutAppointment&"    电话:"&OutPhone&"'>"&OutName&"</a>"
	 end if
     response.Write "</div></td><td><div align='center'>"
     set brs=WS_S.HX_SetRSD(ColumnName,"HX_BookBorrow"," where WS_BOID="&rs("WS_BOID")&" and WS_BookSign=0")
	  if brs.recordcount>0 then
	  Call WS_S.HX_OutUserInfo(brs("WS_BookBorrowMan"))
      response.write "<a href='bookdoapply.asp?WS_BOID="&rs("WS_BOID")&"'><font color=green title='申请者"&OutName&",请批准！！！！'>已有申请</font></a>"
      end if
	  response.Write "</div></td><td><div align='center'>"
	  if rs("WS_BookBorrow")=1 then response.write "<a href='booksmanage.asp?action=return&WS_BOID="&rs("WS_BOID")&"'>还书</a>"
	  response.Write "</div></td><td><div align='center'><a href='booksEdit.asp?WS_BOID="&rs("WS_BOID")&"'>修改</a>"
	  if rs("WS_BookBorrow")=0 then 
	   response.Write " <a href='booksmanage.asp?action=del&WS_BOID="&rs("WS_BOID")&"'>"
	  else 
	    response.write " <a href='javascript:' onclick=""alert('此书已借出不能删除！\n请在归还后删除！');"">"
	  end if
	  response.Write "删除</a></div></td></tr>"
	  ii=ii+1
	  if ii>=rs.PageSize then Exit Do
	  rs.movenext
      loop
      call WS_S.PageControl(iCount,maxpage,page,"border=0 align=right","<p align=right>",7)
	   end if
	  call WS_S.HX_RSClose(rs) 
      response.Write "</table></td></tr><form name='form1' method='post' action='?action=search'><tr><td height='25' bgcolor=7a553e class=td4>　关键字：<input type='text' name='keywords' title='请输入要查询的编号或书名或出版社或作者或内容简介'> <input type='submit' name='Submit' value=' 查 询 '><font color=FFFBE8>注：此查询可以按编号、书名、出版社、作者、内容简介进行搜索</font></td></tr></form></table>"%>