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

📄 searchdxcount.asp

📁 创建和运行动态、交互的Web服务器应用程序
💻 ASP
字号:
<!--#include file="conn.asp"-->
<%
  dim action,s_year,s_month,rs_dx,ccount,scount,i,ii,page

      action = request("action")

      ccount=0:scount=0:page=1
%>
<html>
<head>
<title>销售统计</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/css2.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript">
<!--
function checksearch()
{
    if(document.searchdxcount.s_year.value==0) {
	document.searchdxcount.s_year.focus();
    alert("请选择要查询的年份!");
	return false;
  }  
  if(document.searchdxcount.s_month.value==0 && document.searchdxcount.s_day.value!=0){
	document.searchdxcount.s_month.focus();
    alert("请选择要查询的月份!");
	return false;
  }   
}

//-->   
</script>
</head>

<table width="90%" height="450" border="0"  cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#ece9d8"><br><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr><td>

            <table width=154  border="0"  cellpadding="0" cellspacing="0">
              <tr valign=bottom>
                <td background=images/lose_img.gif width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><font color=#ffffff><a href=searchsxcount.asp    target=mainFrame>网站销售</a></font></div></td>
                <td background=images/get_img.gif width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><font color=#ffffff>店面销售</font></div></td>
              </tr>
            </table>

            <table width="98%" border="1" cellspacing="0" cellpadding="0" bordercolordark="#ffffff" bordercolorlight="#666666">
               <tr><td><table width="100%" border="1" cellspacing="0" cellpadding="0"><tr><td>

                  <table width="100%"  border="0"  align="center" cellpadding="0" cellspacing="0">
                     <form name="searchdxcount" method="post" action="searchdxcount.asp?action=list_search" >
                        <tr height=25>
                          <td width="16%" bgcolor="#ece9d8" align="center"><input type="button" name="b_month"  class="bt4" value="店月销量" onClick="location.href='searchdxcount.asp?action=list_search&s_year=<%=year(now)%>&s_month=<%=month(now)%>'">
                          <td width="16%" bgcolor="#ece9d8" align="center"><input type="button" name="b_year"   class="bt4" value="店年销量" onClick="location.href='searchdxcount.asp?action=list_search&s_year=<%=year(now)%>'">
                          <td width="16%" bgcolor="#ece9d8" align="right">历史查询&nbsp;

                          <td width="10%" bgcolor="#ece9d8">

                          <select name="s_year" id="s_year">
                            <option value="0" selected>选择年</option>
                            <%for ii=2000 to 2010%>
                                 <option value=<%=ii%>><%=ii%></option>
                            <%next%>
                          </select>
           
                          <td width="10%" bgcolor="#ece9d8">

                          <select name="s_month" id="s_month">
                            <option value="0" selected>选择月</option>
                            <%for ii=1 to 12%>
                                 <option value=<%=ii%>><%=ii%></option>
                               <%next%> 
                          </select>
        
                          <td width="10%" bgcolor="#ece9d8">

                          <select name="s_day" id="s_day">
                            <option value="0" selected>选择日</option>
                            <%for ii=1 to 31%>
                                 <option value=<%=ii%>><%=ii%></option>
                            <%next%>
                          </select>

                          <td bgcolor="#ece9d8" align="center"><input type="submit" name="Submit"  class="bt3" value="查 询" onClick="return checksearch();">
                          <td bgcolor="#ece9d8" align="center"><input type="button" name="Submit4" class="bt3" value="打 印" onclick="javascript:window.print()">
                         </tr>
                      </form>
                   </table>
               
              <%select case action
                       case ""%>
           
               <tr><td height=300 valign="top">

                   <table width="100%" border="0"  align="center" cellpadding="1" cellspacing="1" bgcolor="#666666">
                      <tr> 
                         <td width="6%" bgcolor="#ece9d8"><div align="center">序号</div></td>   
                         <td bgcolor="#ece9d8">&nbsp;&nbsp;&nbsp;&nbsp;商品名称</td>
                         <td bgcolor="#ece9d8"><div align="center">定价</div></td>
                         <td bgcolor="#ece9d8"><div align="center">成交数</div></td>
                         <td bgcolor="#ece9d8"><div align="center">成交实洋</div></td>
                      </tr>
                      <tr>
                         <td width="6%" bgcolor="#ffffff" height=22></tr>
                         <td bgcolor="#ffffff"></td>
                         <td bgcolor="#ffffff"></td>
                         <td bgcolor="#ffffff"></td>
                         <td bgcolor="#ffffff"></td>
                      </tr>
                   </table>

                   <%
                       case "list_search"

                       s_year  = request("s_year")
                       s_month = request("s_month")
                       s_day   = request("s_day")
      
                       '//选月了
                       if s_month<>0 then
                          '//选日了
                          if s_day<>0 then 
                             set rs_dx=server.CreateObject("adodb.recordset")
                             rs_dx.open "SELECT shop_books.bookname,shop_books.bookid,shop_books.shichangjia,Sum(shop_dxaction.xbkcount) AS shixiaocount, Sum(shop_dxaction.dxsy) as zonger   FROM shop_dxaction INNER JOIN shop_books ON shop_dxaction.bookid = shop_books.bookid WHERE (((year(shop_dxaction.dxactiondate))="&s_year&") AND ((Month(shop_dxaction.dxactiondate))="&s_month&") AND ((day(shop_dxaction.dxactiondate))="&s_day&")) GROUP BY shop_books.bookname,shop_books.chengjiaocount,shop_books.bookid,shop_books.shichangjia order by shop_books.chengjiaocount desc",conn,1,3
                          '//没选日
                          else
                             set rs_dx=server.CreateObject("adodb.recordset")
                             rs_dx.open "SELECT shop_books.bookname,shop_books.bookid,shop_books.shichangjia,Sum(shop_dxaction.xbkcount) AS shixiaocount, Sum(shop_dxaction.dxsy) as zonger   FROM shop_dxaction INNER JOIN shop_books ON shop_dxaction.bookid = shop_books.bookid WHERE (((year(shop_dxaction.dxactiondate))="&s_year&") AND ((Month(shop_dxaction.dxactiondate))="&s_month&")) GROUP BY shop_books.bookname,shop_books.chengjiaocount,shop_books.bookid,shop_books.shichangjia order by shop_books.chengjiaocount desc",conn,1,3
                          end if
                       '//没选月
                       else
                          set rs_dx=server.CreateObject("adodb.recordset")
                          rs_dx.open "SELECT shop_books.bookname,shop_books.bookid,shop_books.shichangjia,Sum(shop_dxaction.xbkcount) AS shixiaocount, Sum(shop_dxaction.dxsy) as zonger   FROM shop_dxaction INNER JOIN shop_books ON shop_dxaction.bookid = shop_books.bookid WHERE (((year(shop_dxaction.dxactiondate))="&s_year&")) GROUP BY shop_books.bookname,shop_books.chengjiaocount,shop_books.bookid,shop_books.shichangjia order by shop_books.chengjiaocount desc",conn,1,3
                       end if
                   %>
 
                <tr><td height=300 valign="top">

                    <table width="100%" border="0"  align="center" cellpadding="1" cellspacing="1" bgcolor="#666666">
                       <tr> 
                          <td width="6%" bgcolor="#ece9d8"><div align="center">序号</div></td>   
                          <td bgcolor="#ece9d8">&nbsp;&nbsp;&nbsp;&nbsp;商品名称</td>
                          <td bgcolor="#ece9d8"><div align="center">定价</div></td>
                          <td bgcolor="#ece9d8"><div align="center">成交数</div></td>
                          <td bgcolor="#ece9d8"><div align="center">成交实洋</div></td>
                       </tr>
                       <% if rs_dx.bof and rs_dx.eof then
                             response.write "<tr><td colspan=5 align=center bgcolor=#ffffff><div align=center><font color=blue>没有你要查询的记录!</font></td></tr>"
                          else
                             '/先计算出总数量和总码洋
                             do while not rs_dx.eof 
                                ccount=ccount+rs_dx("shixiaocount")
                                scount=scount+rs_dx("zonger") 
                             rs_dx.MoveNext
                             loop

                             '/记录指针到第一条
                             rs_dx.Movefirst

                             '/分页显示上部分
                             Page = rs_dx.AbsolutePage
                             rs_dx.PageSize=15
                             if Not IsEmpty(Request("Page")) then
                                 Page = CInt(Request("Page"))
                                 if Page > rs_dx.PageCount then 
                                   rs_dx.AbsolutePage = rs_dx.PageCount 
                                elseif Page <= 0 then 
                                   Page = 1 
                                else
                                   rs_dx.AbsolutePage = Page 
                                end if
                             else
                                Page = 1
                             end if
                                                          
                              For i =0 to rs_dx.PageSize
                                  if rs_dx.EOF then Exit For
                                  
                       %>
                       <tr>
                          <td bgcolor="#ffffff"><div align="center"><%=rs_dx.bookmark%></div></td>
                          <td bgcolor="#ffffff" STYLE='PADDING-LEFT: 5px'><a href=../book.asp?id=<%=rs_dx("bookid")%> target=_blank><%=rs_dx("bookname")%></a></td>
                          <td bgcolor="#ffffff"><div align="center"><font color=blue><%=formatnumber(rs_dx("shichangjia"),2)%></font></div></td>
                          <td bgcolor="#ffffff"><div align="center"><font color=red><%=rs_dx("shixiaocount")%></font></div></td>
                          <td bgcolor="#ffffff"><div align="center"><font color=blue><%=formatnumber(rs_dx("zonger"),2)%></font></div></td>
                       </tr> 
                       <% '/分页显示下部分
                          rs_dx.MoveNext
                          next    

                           end if%>
                       <tr> 
                          <td colspan=5 bgcolor="#ece9d8" height=40><div align="center">共<font color=blue><%=rs_dx.recordcount%></font>条<font color=blue><%=rs_dx.pagecount%></font>页 
                          <%if request("page")>1 then%>
                               <a Href="searchdxcount.asp?action=list_search&s_year=<%=s_year%>&s_month=<%=s_month%>&s_day=<%=s_day%>&Page=<%=1%>">首页</a>&nbsp;&nbsp;<a Href="searchdxcount.asp?action=list_search&s_year=<%=s_year%>&s_month=<%=s_month%>&s_day=<%=s_day%>&Page=<%=page-1%>">上一页</a>
                          <%end if %>
                          <%if request("page")<>rs_dx.pagecount and page<rs_dx.pagecount then %>
                               <a Href="searchdxcount.asp?action=list_search&s_year=<%=s_year%>&s_month=<%=s_month%>&s_day=<%=s_day%>&Page=<% =page + 1%>">下一页</a>&nbsp;&nbsp;<a Href="searchdxcount.asp?action=list_search&s_year=<%=s_year%>&s_month=<%=s_month%>&s_day=<%=s_day%>&Page=<%=rs_dx.PageCount%>">尾页</a> 
                          <%end if
                          if rs_dx.pagecount>0 then %>
                             第<font color="#FF3300"><%=page%></font>页		
                          <%end if%></font></div></td>
                       </tr>
                    </table>

                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                       <tr height=30>
                       <%
                        if s_month=0 then

                           if s_day=0 then
                              response.write "<td width=40% align=center>统计日期:<b><font color=red>"&s_year&"</font></b> 年 <b><font color=red> 全年</font></b>"
                           end if

                        else

                           if s_day=0 then
                              response.write "<td width=40% align=center>统计日期:<b><font color=red>"&s_year&"</font></b> 年 <b><font color=red>"&s_month&"</font></b> 月"
                           else
                              response.write "<td width=40% align=center>统计日期:<b><font color=red>"&s_year&"</font></b> 年 <b><font color=red>"&s_month&"</font></b> 月 <b><font color=red>"&s_day&"</font></b> 日"
                           end if

                        end if

                              response.write "<td>合计数量:<b><font color=red>"&ccount&"</font></b> 册"

                        if scount=0 then
                           response.write "<td>合计实洋:<b><font color=red>0:00</font></b> 元"
                        else
                           response.write "<td>合计实洋:<b><font color=red>"&formatnumber((scount),2)&"</font></b> 元"
                        end if
                       %> 

                       </tr>
                   </table>
              <%end select%>
             
                  </tr>
                </table>

              </tr>
            </table>

        </tr>
      </table>

   </tr>
</table>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -