📄 exporttoexcelorder.asp
字号:
<!--#include file="../config.ini" -->
<!--#include file="../commfunction.inc" -->
<%
Dim objcheck
Set objcheck=Server.CreateObject("SmartSales.CheckFunction")
objcheck.CheckUserFunction "report","read"
set objcheck=nothing
if Request("selusername")<>"" then
strwhere =strwhere&" and userid='"&Request.Form("selusername")&"'"
else
strwhere =strwhere &"and (userid='"&session("loginid")&"' or userid in(select userid from v_userreportto_all where reportto='"&session("loginid")&"'))"
end if
strwhere=strwhere&" and account like '%"&Request.Form("Contain")&"%'"
if Request.Form("accountlevel")<>"" then
strwhere=strwhere&" and accountlevel="&Request.Form("accountlevel")
end if
strwhere=strwhere&getcondition(Request.Form("selmethod1"),Request.Form("condition1"),1)
strwhere=strwhere&getcondition(Request.Form("selmethod2"),Request.Form("condition2"),2)
strwhere=strwhere&getcondition(Request.Form("selmethod3"),Request.Form("condition3"),3)
if Request.Form("startdate")<>"" then
strwhere=strwhere&" and signeddate>='"&Request.Form("startdate")&"'"
end if
if Request.Form("status")<>"" then
strwhere=strwhere&" and status='"&Request.Form("status")&"'"
end if
if Request.Form("enddate")<>"" then
strwhere=strwhere&" and signeddate<='"&Request.Form("enddate")&"'"
end if
dim conn
dim rs
set conn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
conn.Open connstring
sql="select * from v_order where 1=1 "&strwhere
rs.Open sql,conn,1,1
Set fs = server.CreateObject("scripting.filesystemobject")
filename = Request.ServerVariables("APPL_PHYSICAL_PATH") & "report\excel\"&session("loginid")&".xls"
if fs.FileExists(filename) then
fs.DeleteFile(filename)
end if
set myfile = fs.CreateTextFile(filename,true)
totalamount=0
if not rs.EOF and not rs.BOF then
dim strLine,responsestr
strLine=""
strLine= "No." & chr(9)&"合同"&chr(9)&Request.Form("selmethod1")&chr(9)&Request.Form("selmethod2")&chr(9)&Request.Form("selmethod3")&chr(9)&"签订日期"&chr(9)&"金额"&chr(9)&"所有者"
myfile.writeline strLine
i=1
Do while Not rs.EOF
strLine=""
strLine= i&chr(9)&rs("account") & chr(9)&rs(session("reportfield1")) & chr(9)&rs(session("reportfield2")) & chr(9)&rs(session("reportfield3")) & chr(9)&rs("createdate") & chr(9)&formatnumber(rs("totalamount"),2)& chr(9)&rs("owner")
myfile.writeline strLine
i=i+1
totalamount=totalamount+ccur(rs("totalamount"))
rs.MoveNext
loop
strLine=""
strLine= "合计"&chr(9)&chr(9)&chr(9)&chr(9)&chr(9)&chr(9)&formatnumber(totalamount,2)&chr(9)
myfile.writeline strLine
end if
%>
<html>
<head>
<LINK href="../global.css" rel=STYLESHEET type=text/css>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>导出为EXCEL</title>
</head>
<body leftmargin="10" rightmargin="0" topmargin="10">
<form name="form1" method="post" action="account.asp">
<table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="43%"> </td>
<td width=10%> </td>
<td width="47%"> <div align="right">
</div></td>
</tr>
<tr>
<td height="25" colspan=3><div align="center"><strong><font size="2" class=title>导出为EXCEL</font></strong></div></td>
</tr>
<tr >
<td height="16" colspan="3" background="../images/title.gif"> </td>
</tr>
<tr><td colspan="3" height=4></td></tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DECFAD">
<tr bgcolor="#EFEFEF">
<td height=25 align=center><a href="excel\<%=session("loginid")%>.xls">文件下载</a></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -