<!--#include file="../include/hf_conn.asp"-->
<!--#include file="checkadmin.asp"-->
<script language=javascript src=../include/mouse_on_title.js></script>
<%call checkmanage("05")%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
</head>
<BODY background="../images/admin/back.gif">

<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px"  bordercolor="#333333" cellspacing="0" cellpadding="2">
<tr><td colspan=7 class=td height=30>销售统计</td></tr>
<tr>
<td height=30 width="10%">订单编号</td>
<td width="20%" align=center>销售日期</td>
<td width="10%" align=center>商品编号</td>
<td width="30%" align=center>商品名称</td>
<td width="10%" align=center>销售数量</td>
<td width="10%" align=center>结算单价</td>
<td width="10%" align=center>销售金额</td>
</td></tr>
<%
sql="select A.ordertime,b.ordersum,A.Userid,A.OrderNum,A.PEI,A.FEI,A.ProdId,A.BuyPrice,A.ProdUnit,B.thiskou,B.Memo,B.Status,B.Recname,B.RecPhone,B.Recmail,B.RecAddress,B.Zipcode,B.Paytype,B.Notes,B.Compphone,B.gettime,C.ProdName from hfvip_Order A,hfvip_OrderList B,hfvip_produc C where A.OrderNum<>'' and A.OrderNum = B.OrderNum and A.ProdId=C.Prodid and b.status='99' and b.del<>true order by a.ordertime asc"
set rs=Server.Createobject("ADODB.RecordSet")
rs.open sql,conn,1,3
if rs.eof and rs.bof  then
response.write "<tr><td height=50 colspan=7>暂时没有订单</td></tr>"
else
pages=50
totalrs=rs.RecordCount
rs.pageSize = pages
allPages = rs.pageCount
page = Request("page")
If not isNumeric(page) then page=1
if isEmpty(page) or int(page) <= 1 then
page = 1
elseif int(page) > allPages then
page = allPages 
end if
rs.AbsolutePage = page
	Total = 0
	Do While Not rs.eof and pages>0
	Sum = rs("ProdUnit")* csng(rs("BuyPrice")) * csng(rs("thiskou"))/10
	Sum = FormatNumber(Sum,2) 
	Total = Sum + Total
	response.write "<tr><td height=30>"&rs("ordernum")&"</td><td align=center>"&rs("ordertime")&"</td><td>"&rs("ProdId")&"</td><td><a alt='查看此商品的前台页面' href=../gotourl.asp?list.asp?ProdId="&rs("ProdId")&" target='blank_'>"&rs("ProdName")&"</a></td><td align=center>"&rs("ProdUnit")&"</td><td align=right>"&FormatNumber(csng(rs("BuyPrice")) * csng(rs("thiskou"))/10,2)&" &nbsp; </td><td align=right>"&Sum&" &nbsp; </td></tr>"
	pages = pages - 1
	rs.movenext
if rs.eof then exit do
loop
response.write "<tr><td height=30 colspan=7 align=right>本页总计金额："&formatnumber(total,2)&" &nbsp; </td></tr>"
%>
<tr><td colspan=7 height=30><input type='button' name='pnt' value='打印报表' onClick="javascript:window.print();"></td></tr>
</table>

<%
call listpage()
end if
rs.close
set rs=nothing

sub listpage()
response.write "<br>总记录数<font color=red>"&totalrs&"</font> &nbsp; 每页<font color=red>50</font>&nbsp; "
if page = 1 then
response.write "<font color=darkgray>首页 前页</font>"
else
response.write "<a href=order5.asp?keywords="&keywords&"&page=1>首页</a> <a href=order5.asp?keywords="&keywords&"&page="&page-1&">前页</a>"
end if
if page = allpages then
response.write "<font color=darkgray> 下页 末页</font>"
else
response.write " <a href=order5.asp?keywords="&keywords&"&page="&page+1&">下页</a> <a href=order5.asp?keywords="&keywords&"&page="&allpages&">末页</a>"
end if
end sub
%>


</body>
</html>
