⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 show_report_sell01.asp

📁 Activity——活动管理模块 Analyse——分析模块 Client——客户管理系统模块 Email——E-mail管理模块 Fee——费用管理模块 Report——报表模块 Sel
💻 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 + -