我给你一个我做的的页面代码,不懂你再问我吧!
<%
nowfilename=replace(replace(replace(now,":","")," ",""),"/","")
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "content-disposition", "inline; filename = "&nowfilename&".xls"
%>
导出入库明细至excel <%
'取得当前页码
currentpage=request("page")
'response.write currentpage
'response.end
if currentpage<1 or currentpage="" then
currentpage="1"
end if
'取得搜索关键字
nowstartdate=request("startdate")
if nowstartdate="" then
nowstartdate=date()-day(date()-1)
end if
nowenddate=request("enddate")
if nowenddate="" then
nowenddate=date()
end if
nowku=request("ku")
nowkeyword=request("keyword")
if session("shiwei_id")=1 then
sql="select * from ku order by id"
set rs_ku=conn.execute(sql)
else
sql="select * from ku where instr(login,'"&session("shiwei_id")&",')>0 order by id"
set rs_ku=conn.execute(sql)
if rs_ku.eof then
nowku="0"
elseif request("ku")="" then
nowku=rs_ku("id")
end if
end if
sql="select * from buy where type=0 and isok"
if session("shiwei_id")<>1 and lookbuysell="yes" then
sql=sql&" and id_login="&session("shiwei_id")
end if
if nowstartdate<>"" then
sql=sql&" and selldate-#"&nowstartdate&"#>=0"
end if
if nowenddate<>"" then
sql=sql&" and selldate-#"&nowenddate&"#<=0"
end if
if nowku<>"" then
sql=sql&" and bianhao in (select bianhao from buy where type=0 and id_ku="&nowku&")"
end if
if nowkeyword<>"" then
sql=sql&" and (bianhao = '"&nowkeyword&"' or id_gys in (select id from gys where company like '%"&nowkeyword&"%') or id_login in (select id from login where username like '%"&nowkeyword&"%') or bianhao in (select bianhao from buy where type=0 and (title like '%"&nowkeyword&"%' or huohao like '%"&nowkeyword&"%')))"
end if
if request("order1")<>"" then
sql=sql&" order by bianhao "&request("order1")
elseif request("order2")<>"" then
sql=sql&" order by huohao "&request("order2")
elseif request("order3")<>"" then
sql=sql&" order by title "&request("order3")
elseif request("order4")<>"" then
sql=sql&" order by selldate "&request("order4")
elseif request("order5")<>"" then
sql=sql&" order by id_login "&request("order5")
elseif request("order6")<>"" then
sql=sql&" order by id_gys "&request("order6")
elseif request("order7")<>"" then
sql=sql&" order by shulian "&request("order7")
elseif request("order10")<>"" then
sql=sql&" order by id_gys "&request("order10")
else
sql=sql&" order by id asc"
end if
set rs_buy = Server.CreateObject("ADODB.Recordset")
rs_buy.open sql,conn,1,1
%>
序号 |
物料编号 |
物料名称 |
规格 |
入库时间 |
经办人 |
供应商 |
数量 |
单位 |
库房归位 |
备注 |
|---|
<%
i=0
do while rs_buy.eof=false
i=i+1
%>
<%=i%> |
<%=rs_buy("huohao")%> |
<%=rs_buy("title")%> |
<%if rs_buy("guige")<>"" then%><%=rs_buy("guige")%><%else%>无<%end if%> |
<%=rs_buy("selldate")%> |
<% sql="select * from login where id="&rs_buy("id_login") set rs_login=conn.execute(sql) %> <%if rs_login.eof then%><%=rs_buy("login")%><%else%><%=rs_login("username")%> (<%=rs_login("bianhao")%>)<%end if%>
|
<% sql="select * from gys where id="&rs_buy("id_gys") set rs_gys=conn.execute(sql) %> <%if rs_gys.eof then%><%if rs_buy("gys")<>"" then%><%=rs_buy("gys")%><%else%>无<%end if%><%else%><%=rs_gys("company")%><%end if%>
|
<% sql="select sum(shulian) from buy where bianhao='"&rs_buy("bianhao")&"'" if nowku<>"" then sql=sql&" and id_ku="&nowku end if if nowkeyword<>"" then sql=sql&" and (bianhao = '"&nowkeyword&"' or id_gys in (select id from gys where company like '%"&nowkeyword&"%') or id_login in (select id from login where username like '%"&nowkeyword&"%') or title like '%"&nowkeyword&"%' or huohao like '%"&nowkeyword&"%')" end if set rs_sum=conn.execute(sql) %> <%=formatnumber(rs_sum(0),0)%>
|
<%=rs_buy("danwei")%> |
<%=rs_buy("ku")%> |
<%=rs_buy("beizhu")%> |
<%
rs_buy.movenext
loop
%>