📄 down_report_sell.asp
字号:
<!--#include file="../conn.asp"-->
<!--#include file="../isuser.asp"-->
<!--#include file="../pub_fun.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>销售信息查询结果下载</title>
</head>
<body >
<%
''获取查询语句
textSql=decrypt(trim(request("sql")))
'组成查询语句
sql="SELECT SellID, MAX(SellTopic) AS selltopic, MAX(SellClientID) AS sellclientid, MAX(SellOrderNum) AS SellOrderNum, SellDate, MAX(SellProduct) AS sellproduct, MAX(SellProductprice) AS sellproductprice, MAX(SellProductnum) AS SellProductnum, MAX(Sellmoney) AS sellmoney"
sql=sql&" from sell"
sql=sql&" where (sellCreatorID="&session("Session_User")&"or sellopenflag='1' ) "&textsql
sql=sql&"GROUP BY SellTopic, SellClientID, SellDate, SellID"
sql=sql&" ORDER BY SellClientID "
'创建文件名
strFileName = "r_sell_" & GetAutoID() & ".csv"
strFullFileName = server.mappath("../data/" & strFileName) '带路径
''创建文件对象
SET objMyFile = Server.Createobject("scripting.filesystemobject")
SET objNewsFile = objMyFile.createtextfile(strFullFileName)
''从数据库中读出相应的记录
SET Rs = Server.CreateObject("Adodb.RecordSet")
Rs.Open Sql,conn,3
intRC = Rs.RecordCount
strTitle = "相关客户,,主题,,订单/合同号,,销售日期"
'写入表头
objNewsFile.writeline(strTitle)
''获取上一条记录的相关客户编号和销售主题
rs.moveprevious
if not rs.bof then
last_id=(rs("sellclientid"))
last_topic=(rs("selltopic"))
end if
rs.movenext
'写入标题
if not rs.eof then
''利用for循环显示详细信息
for i=1 to intRC
if rs.eof then exit for
''判断该信息和上一条信息是否为一个销售单元,如果是则写入销售的公共信息
if rs("sellclientid")<>last_id or (rs("selltopic"))<> last_topic then
strLineString=showclientname(rs("sellclientid"))&",,"
strLineString= strLineString&rs("selltopic")&",,"
strLineString= strLineString&rs("sellordernum")&",,"
strLineString= strLineString&rs("selldate")
objNewsFile.writeline(strLineString)
''然后写入产品的标题
strLineString= ",产品名称,单价,数量,金额"
objNewsFile.writeline(strLineString)
''最后是该条记录的产品信息
strLineString=","&rs("SellProduct")&","
strLineString= strLineString&rs("SellProductprice")&","
strLineString= strLineString&rs("SellProductnum")&","
strLineString= strLineString&rs("Sellmoney")
objNewsFile.writeline(strLineString)
else
''如果是同一个单元,则直接写入产品的信息
strLineString=","&rs("SellProduct")&","
strLineString= strLineString&rs("SellProductprice")&","
strLineString= strLineString&rs("SellProductnum")&","
strLineString= strLineString&rs("Sellmoney")
objNewsFile.writeline(strLineString)
end if
''判断下一条记录是否和本记录是一销售单元
if rs.eof then exit for
last_id=rs("sellclientid")
last_topic=(rs("selltopic"))
rs.movenext
if rs.eof then
lastflag=1
else
if rs("sellclientid")<>last_id or (rs("selltopic"))<>last_topic then
lastflag=1
else
lastflag=0
end if
end if
''根据lastflag判断是否写入小计
if (lastflag=1) then
strLineString= ",,,小计:,"& showsellsum_x(last_id,trim(last_topic))
objNewsFile.writeline(strLineString)
end if
next
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>下载销售查询结果数据</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('请用鼠标右键点击链接\n选择目标另存为!')"><font color=blue><strong>下 载</strong></font></a></td>
</tr>
<tr align="center" CLASS=cROW>
<td nowrap><br><br><br><font color = red>说明:用鼠标右键点击“下载”,选择“目标另存为...”功能</font></td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</center>
</div>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -