?? show_report_sell01.asp
字號:
<!--#include file="../conn.asp"-->
<!--#include file="../isuser.asp"-->
<!--#include file="../pub_fun.asp"-->
<META NAME="Keywords" CONTENT="FastReport"/>
<META NAME="Description" CONTENT="The FastReport report"/>
<LINK href="../css.css" rel="stylesheet" type="text/css" media="all">
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<body>
<form name="form1" method="post">
</form>
<%
'獲取查詢條件
textsql=decrypt(request("textsql"))
'獲取要顯示的頁數,如果為空則默認第一頁
if request("movepage")<>"" then
page=cint(request("movepage"))
else
page=1
end if
''根據查詢條件組成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 "
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td colspan="4" height="25" valign="top"><div align="left"><strong><font color="#3399FF" size="3">銷售報表</font></strong></div></td>
</tr>
<tr>
<td width="40%"><strong>相關客戶</strong></td>
<td width="25%"><strong>主題</strong></td>
<td width="15%"><strong>訂單/合同號</strong></td>
<td width="20%"><strong>銷售日期</strong></td>
</tr>
<tr>
<td colspan="4" align="center" height="2">
<hr align="left" size="2" color="#000000" width="99%" >
</td>
</tr>
<%
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,3
''判斷記錄集是否為空,如果不為空則進行下面的操作,否則結束顯示
if not rs.eof then
''設置頁面大小
rs.pagesize=15
''定位要顯示的頁面
rs.AbsolutePage=page
''獲取總的頁面數
pcount = rs.pagecount
'獲取上一頁的最后一個記錄的sellclientid和selltopic
''記錄前移一條
rs.moveprevious
if not rs.bof then
last_id=(rs("sellclientid"))
last_topic=(rs("selltopic"))
end if
''記錄返回
rs.movenext
for i=1 to rs.pagesize
if rs.eof then exit for
if rs("sellclientid")<>last_id or (rs("selltopic"))<> last_topic then
%>
<!-- 如果是新單元顯示客戶信息-->
<tr bgcolor="#E8E8E8">
<td width="30%" height="25" valign="bottom"><strong><%=showclientname(rs("sellclientid"))%></strong></td>
<td width="30%" valign="bottom"><%=rs("selltopic")%></td>
<td width="20%" valign="bottom"><%=rs("sellordernum")%></td>
<td width="20%" valign="bottom"><%=rs("selldate")%></td>
</tr>
<!-- 顯示客產品標題-->
<tr >
<td align="center" colspan="4">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="4" height="5"></td>
</tr>
<tr>
<td width="30%"><em>產品名稱</em></td>
<td width="20%"><div align="right"><em>單價</em></div></td>
<td width="25%"><div align="right"><em>數量</em></div></td>
<td><div align="right"><em>金額</em></div></td>
</tr>
<!-- 顯示銷售產品具體信息-->
<tr>
<td colspan="4" ><img src="../images/hr.gif" width="100%"height="1"></td>
</tr>
<tr>
<td height="25" width="30%"><%=rs("SellProduct")%></td>
<td width="20%"><div align="right"><%=rs("SellProductprice")%></div></td>
<td width="25%"><div align="right"><%=rs("SellProductnum")%></div></td>
<td><div align="right"><%=rs("Sellmoney")%></div></td>
</tr>
</table>
</td>
</tr>
<%else%>
<!-- 如果不是新單元,則繼續顯示銷售產品具體信息-->
<tr>
<td align="center" colspan="4">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25" width="30%"><%=rs("SellProduct")%></td>
<td width="20%"><div align="right"><%=rs("SellProductprice")%></div></td>
<td width="25%"><div align="right"><%=rs("SellProductnum")%></div></td>
<td><div align="right"><%=rs("Sellmoney")%></div></td>
</tr>
</table>
</td>
</tr>
<%end if%>
<%
''判斷記錄是否結束,如果結束則退出for循環
if rs.eof then exit for
''將當前記錄中的客戶遍號和銷售主題存放在變量中
last_id=rs("sellclientid")
last_topic=(rs("selltopic"))
''記錄 下移一條
rs.movenext
''判斷記錄是否結束,如果結束則將本單元結束標示lastflag設置為1
if rs.eof then
lastflag=1
''如果沒有結束則判斷該記錄和上一條記錄是否屬于同一單元的銷售
else
if rs("sellclientid")<>last_id or (rs("selltopic"))<>last_topic then
''如果是則設置lastflag為1,否則設置為0
lastflag=1
else
lastflag=0
end if
end if
''根據班單元是否結束的標記lastflag決定是否顯示小計部分
if (lastflag=1) then
%>
<tr>
<td align="center" colspan="4">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="4" align="left" ><img src="../images/hr.gif" width="100%" height="1"></td>
</tr>
<tr>
<td height="25" colspan="2" width="50%"></td>
<td width="25%"><div align="right"><strong>小計:</strong></div></td>
<td><div align="right"><strong><%= showsellsum_x(last_id,trim(last_topic))%></strong></div></td>
</tr>
</table>
</td>
</tr>
<%
end if
''重復for循環
next
'補足后面的空格
if i<rs.pagesize then
for j=i to rs.pagesize-1
response.Write("<tr><td height=40></td></tr>")
next
end if
''如果記錄集為空,則提示用戶沒有記錄
else
response.Write("<tr><td height=30>沒有紀錄!</td></tr>")
end if
%>
<tr>
<td colspan="4" height="5"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">
<hr align="left" size="2" color="#000000" width="99%" >
</td>
</tr>
<tr>
<td width="95%"><div align="left"><%=date()%></div></td>
<td><div align="left"><%=page%>/<%=pcount%></div></td>
</tr>
</table></td>
</tr>
</table>
</BODY></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -