?? down_report_sellsumproduct.asp
字號(hào):
<!--#INCLUDE file="../pub_fun.asp"-->
<!--#INCLUDE FILE="../conn.asp"-->
<html>
<HEAD>
<META NAME="Keywords" CONTENT="FastReport"/>
<META NAME="Description" CONTENT="The FastReport report"/>
<LINK href="../css.css" rel="stylesheet" type="text/css" media="all">
<title>銷售信息查詢結(jié)果下載(產(chǎn)品統(tǒng)計(jì))</title>
</head>
<body >
<%
''獲取查詢語句
textSql=decrypt(trim(request("sql")))
'組成查詢語句
sql="SELECT SellProduct,MAX(SellProductprice) AS sellproductprice, sum(SellProductnum) AS SellProductnum, sum(Sellmoney) AS sellmoney"
sql=sql&" from sell"
sql=sql&" where (sellCreatorID="&session("Session_User")&"or sellopenflag='1' ) "&textsql
sql=sql&"GROUP BY SellProduct"
'創(chuàng)建文件名
strFileName = "r_sellsumproduct_" & GetAutoID() & ".csv"
strFullFileName = server.mappath("../data/" & strFileName) '帶路徑
SET objMyFile = Server.Createobject("scripting.filesystemobject")
SET objNewsFile = objMyFile.createtextfile(strFullFileName)
SET Rs = Server.CreateObject("Adodb.RecordSet")
'從數(shù)據(jù)庫中讀出數(shù)據(jù)
Rs.Open Sql,conn,3
intRC = Rs.RecordCount
'寫入標(biāo)題
strLineString= "產(chǎn)品名稱,單價(jià),數(shù)量,金額"
objNewsFile.writeline(strLineString)
if not rs.eof then
''利用for循環(huán)將數(shù)據(jù)寫入文件
for i=1 to intRC
if rs.eof then exit for
strLineString=rs("SellProduct")&","
strLineString= strLineString&rs("SellProductprice")&","
strLineString= strLineString&rs("SellProductnum")&","
strLineString= strLineString&rs("Sellmoney")
objNewsFile.writeline(strLineString)
if rs.eof then exit for
rs.movenext
next
''記錄的最后些總計(jì)
strLineString= ",總計(jì):,"& showselltotalsum&","&showselltotalmoney
objNewsFile.writeline(strLineString)
end if
Rs.Close
SET Rs = NOTHING
objNewsFile.close
SET objNewsFile = NOTHING
SET objMyFile = NOTHING
%>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="380" height="207">
<tr class="CListTTL" >
<td height="29" ><font color = yellow ><b>下載銷售查詢結(jié)果數(shù)據(jù)</b></FONT></td>
</tr>
<tr CLASS=cROW>
<td width="100%" height="177">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="72%" id="AutoNumber2">
<tr align="center" CLASS=cROW>
<td nowrap><a href="../data/<%=strFileName%>" onMouseDown="javascript:if (event.button==1) alert('請(qǐng)用鼠標(biāo)右鍵點(diǎn)擊鏈接\n選擇目標(biāo)另存為!')"><font color=blue><strong>下 載</strong></font></a></td>
</tr>
<tr align="center" CLASS=cROW>
<td nowrap><br><br><br><font color = red>說明:用鼠標(biāo)右鍵點(diǎn)擊“下載”,選擇“目標(biāo)另存為...”功能</font></td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</center>
</div>
</BODY>
</HTML>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -