<!--#include file="conn.asp"-->
<!--#include file="inc/cook2.asp"-->
<!--#include file="inc/dimflag.asp"-->
<!--#include file="inc/page.asp"-->
<!--#include file="top.asp"-->
<%
month1=Request("month1")
day1=Request("day1")
year1=Request("year1")
month2=Request("month2")
day2=Request("day2")
year2=Request("year2")

d1="#"&trim(month1)&"-"&trim(day1)&"-"&trim(year1)&"#"
d2="#"&trim(month2)&"-"&trim(day2)&"-"&trim(year2)&"#"

canshu1="action="&action&""
canshu3="month1="&month1&"&day1="&day1&"&year1="&year1&"&month2="&month2&"&day2="&day2&"&year2="&year2&"&"&canshu1&""
canshu2="page="&page&"&"&canshu3&""

%>
<div id="container">
<div class="top_but">
 <li class="left">&nbsp;</li>
 <li><img src="images/but_8.gif" alt="刷新" onClick="window.location.reload(true);"></li>
 <li><img src="images/but_9.gif" alt="打印" onClick="window.print() "/></li>
</div>

<% if action="" then %>
<div class="tableAll titlebgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:700px">销售统计报表 （此报表查询的是已发货的产品）</li>
</div>
<form name="form1" id="form1" method="post" action="?action=tj">
<div class="tableAll trbgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:60px;">开始日期：</li>
 <li style="width:600px"><select name="year1">
<%for i=2014 to 2100%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>
年 
<select name="month1">
<%for i=1 to 12%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>
月 
<select name="day1">
<%for i=1 to 31%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>
日</li>
</div>

<div class="tableAll trbgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:60px;">结束日期：</li>
 <li style="width:600px"><select name="year2">
<%for i=2014 to 2100%>
<option value="<%=i%>"  <%if year(now())=i then%>selected<%end if%>><%=i%></option>
<%next%>
</select>
年 
<select name="month2">
<%for i=1 to 12%>
<option value="<%=i%>"  <%if Month(now())=i then %>selected<% end if %>><%=i%></option>
<%next%>
</select>
月 
<select name="day2">
<%for i=1 to 31%>
<option value="<%=i%>" <%if day(now())=i then %>selected<% end if %>><%=i%></option>
<%next%>
</select>
日</li>
</div>


<div class="tableAll titlebgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:700px;"><input class="button" type="submit" name="Submit" value="统 计"></li>
</div>
</form>


<%
elseif action="tj" then
%>
<%
sql= "select * from com_books where type=0 and chengjiaocount<>0 order by pid asc,id desc"
set rs=server.createobject("adodb.recordset")                     
rs.open sql,conn,1,1                                         
if rs.eof and rs.bof then                     
response.write "无销售记录"
else 
page1("18")
i=1	
%>
<div class="tableAll titlebgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:200px;">销售统计报表</li>
 <li style="width:200px"><input class="button" type="button" name="Submit" value="返回" onClick="javascript:window.location.href='user_order_tjbb.asp'"></li>
</div>
<div class="tableAll titlebgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:200px">产品名称</li>
 <li style="width:200px">销售数量</li>
 <li style="width:200px">产品单价</li>
</div>
<%
z_xs_sl=0
z_xs_je=0
while not rs.eof and i<=rs.pagesize
set rs2=server.createobject("adodb.recordset")
rs2.open "select * from shopxp_action where (datediff('d',fhsj,"&d2&")>=0)  and (datediff('d',"&d1&",fhsj)>=0)  and (shopxpptid="&rs("id")&") ",conn,1,1
xs_sl=0
xs_je=0
while not rs2.eof
xs_sl=xs_sl+rs2("productcount")
xs_je=xs_je+rs2("zonger")
rs2.movenext
wend
rs2.close
set rs2=nothing
%>
<div class="tableAll trbgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:200px"><%=rs("titlecn")%></li>
 <li style="width:200px"><%=xs_sl%></li>
 <li style="width:200px"><%=xs_je%></li>
</div>
<%
z_xs_sl=z_xs_sl+xs_sl
z_xs_je=z_xs_je+xs_je
i=i+1
rs.movenext
wend
%>
<div class="tableAll titlebgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:400px"><%call page2(5,""&canshu3&"&")%></li>
 <li style="width:300px">总销售数量：<%=z_xs_sl%>，总销售金额：<%=z_xs_je%></li>
</div>
<%
rs.close
set rs=nothing
end if
%>
</div>
<%end if%>
<!--#include file="footer.asp"-->