📄 buy2buycb.asp
字号:
<!--#include file="conn.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录!');history.go(-1);</script>"
response.End
else
if request.cookies("Buy2Buy")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录!');history.go(-1);</script>"
response.End
end if
end if
'限制添加权限管理员
if session("rank")=2 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('您的管理权限未达到此操作等级!');history.go(-1);</script>"
response.End
end if
catid=SafeRequest("catid",1)
CatList =catid
PID = catid
if catid<>"" or catid <> 0 then
set rs=server.CreateObject("adodb.recordset")
do while not PID = 0
rs.open "Select categoryid,category,ParentID From category Where categoryid="&PID,conn,1,1
if rs.eof and rs.bof then
response.Write "<script LANGUAGE='javascript'>alert('您输入的参数非法,请正确操作!');history.go(-1);</script>"
rs.close
set rs = Nothing
conn.Close
set conn=nothing
response.end
end if
lstcat = "-><a href=b2b_cplist.asp?catid="&rs("categoryid")&">"&rs("category")&"</a>"&lstcat
catstr = ""&rs("category")&"->"&catstr
CaID = PID
CatN = rs("category")
PID = rs("ParentID")
rs.close
loop
rs.open "Select category,meta From category Where categoryid="&catid,conn,1,1
strcat = rs("category")
strmeta = rs("meta")
strintro = rs("intro")
rs.close
set rs = Nothing
sorts(catid)
Set Rs1=Conn.Execute(sql)
sub sorts(selec)
sql="select categoryid from category where ParentID = "&selec&" order by categoryorder"
Set Rs1=Conn.Execute(sql)
do while not rs1.eof
IntCat = rs1("categoryid")
If Len(CatList) = 0 Then
CatList =catid
ElseIf InStr( CatList, IntCat ) <= 0 Then
CatList = CatList&", "&IntCat &""
End If
sorts rs1("categoryid")
rs1.movenext
loop
rs1.close
Set Rs1 = Nothing
end sub
end if
%>
<title>销售统计</title>
<style type="text/css">
<!--
.STYLE3 {color: #0000FF}
.style4 {color: #FF0000}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.STYLE1 {color: #000000;
font-weight: bold;
}
-->
</style>
<script language="JavaScript" src="calendar.js"></script>
<table width="99%" border="5" align="center" cellpadding="5" cellspacing="5" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
<tr>
<td background="images/topbg.gif"><span class="STYLE1"><img src="images/pic5.gif" width="28" height="22" align="absmiddle" />您现在所在的位置是: <a href="adminhelp.asp">管理首页</a> -> <span class="style4">整体销售统计</span></span></td>
</tr>
<tr>
<form action="buy2buycb.asp" method="post" name="myForm">
<td>
<table width="95%" border="0" align="center" cellpadding="1" cellspacing="1">
<tr bgcolor="#FFFFFF">
<td align="right">从
<input name="BeginDate" type="text" class="input_sr" onfocus="calendar()"/>
日 至
<input name="EndDate" type="text" class="input_sr" onfocus="calendar()"/>
日统计信息</td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right">请选择统计相关类别
<select name="catid">
<%set rs=server.CreateObject("adodb.recordset")
rs.Open "select categoryid,category from category where parentID=0 order by categoryorder",conn,1,1
if rs.eof and rs.bof then
response.Write "<option value=0>所有类别商品</option>"
else
response.Write "<option value=0>所有类别商品</option>"
do while not rs.eof
%>
<option value="<%=int(rs("categoryid"))%>"><%=trim(rs("category"))%></option>
<%rs.movenext
loop
rs.close
set rs=nothing
end if%>
</select>
<input name="Submit" type="submit" class="input_bot" value="开始统计"></td>
</tr>
</table>
</td></form>
</tr>
</table>
<br />
<table width="99%" border="5" align="center" cellpadding="5" cellspacing="5" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
<tr>
<td valign="top" bgcolor="#FFFFFF"><table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right">以下统计价格为纯销售统计,未作任务成本计算;括号内为销售量,统计单位(¥元)</td>
</tr>
</table>
<table width="96%" border="2" align="center" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
<tr align="center" bgcolor="#F7F7F7">
<td height="25" background="images/topbg.gif"><strong>商品名称</strong></td>
<td height="25" background="images/topbg.gif"><strong>成本价格(单价)</strong></td>
<td colspan="2" background="images/topbg.gif"><strong>销售数量</strong></td>
<td height="25" background="images/topbg.gif"><strong>销售合计</strong></td>
<td height="25" background="images/topbg.gif"><strong>销售毛利</strong></td>
</tr>
<%
if Trim(Request("Display")) <> "none" then
if Trim(Request("BeginDate"))<>"" then
BeginDate=Trim(Request("BeginDate"))&" 00:00:01"
else
BeginDate="1990-01-01 00:00:01"
end if
if Trim(Request("EndDate"))<>"" then
EndDate=Trim(Request("EndDate"))&" 23:59:59"
else
EndDate="2020-12-30 00:00:01"
end if
if CatList<>"" then
mSql="select a.ID,Sum(a.ProductNum*a.Paid) as SumPaid,Sum(a.ProductNum) as SumNum from Orders a,Product b where a.id=b.id and state>=3 and b.categoryid in ("& CatList&") and actionDate>=#"&BeginDate&"# and actionDate<=#"&EndDate&"# group by a.ID"
else
mSql="select a.ID,Sum(a.ProductNum*a.Paid) as SumPaid,Sum(a.ProductNum) as SumNum from Orders a,Product b where a.id=b.id and state>=3 and actionDate>=#"&BeginDate&"# and actionDate<=#"&EndDate&"# group by a.ID"
end if
'response.write mSql
'response.end
set mRs=conn.execute(mSql)
tempSumA=0
tempSumB=0
if not (mRs.eof and mRs.bof) then
while not mRs.eof
%>
<tr align="center" bgcolor="#FFFFFF">
<td height="25" bgcolor="#FFFFFF"><%
mSql="select Name,Price6 from product where ID="&mRs("ID")
tempRs=conn.execute(mSql)
if not (tempRs.eof and tempRs.bof) then
tempName=tempRs("Name")
tempPrice6=tempRs("Price6")
else
tempName="该商品已经删除"
tempPrice6=0
end if
response.write tempName
tempRs.close
set tempRs=nothing
%></td>
<td height="25" bgcolor="#EEFFDD"><%=FormatCurrency(tempPrice6)%></td>
<td height="25" colspan="2" bgcolor="#E8F8FF"><%=mRs("SumNum")%></td>
<td height="25" bgcolor="#F7F7F7"><%=FormatCurrency(mRs("SumPaid"))%></td>
<td height="25" bgcolor="#FFFFFF"><%=FormatCurrency(mRs("SumPaid")-tempPrice6*mRs("SumNum"))%></td>
</tr>
<%
tempSumA=tempSumA+mRs("SumPaid")
tempSumB=tempSumB+(mRs("SumPaid")-tempPrice6*mRs("SumNum"))
mRs.movenext
wend
end if
mRs.close
set mRs=nothing
end if
%>
<tr align="center" bgcolor="#FF0000">
<td height="25" bgcolor="#F7F7F7"><strong>销售总计</strong></td>
<td height="25" colspan="3" bgcolor="#FFFFFF"><p> </p> </td>
<td height="25" bgcolor="#FFFFFF"><%=FormatCurrency(tempSumA)%></td>
<td height="25" bgcolor="#FFFFFF"><%=FormatCurrency(tempSumB)%></td>
</tr>
</table>
</td>
</tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -