<!--#include virtual="/show/userhead.asp"-->

<script>document.getElementById('o_7').setAttribute("class", "ed"); document.getElementById("t_7").style.display="";document.getElementById('s_7_7').setAttribute("class", "ed4");</script>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />


<br>
<DIV id=main2> 

<DIV style="PADDING-LEFT:0px">
<DIV id=main_right_content>

<H2><SPAN>账务统计</SPAN></H2>
<DIV class=main3>
<script language=javascript>
function tongjiall()
{
buquan1.style.display='none';
buquan2.style.display='';

var xmlhttp;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch (e){try{xmlhttp=new XMLHttpRequest();}catch (e){}}}
xmlhttp.open("get","/user/aoto.asp?act=all");
  		xmlhttp.onreadystatechange=function()
   		{
   		if(4==xmlhttp.readyState)
	 	{
	  		if(200==xmlhttp.status)
	  		{	
				if (xmlhttp.responseText=="ok")
				{ 
				alert('近30天数据已补齐');
				window.top.location.href='tongji';
				}
	   		}
		}
   		}
  		xmlhttp.send(null); 
		

}
</script> 

<%
link="tongji?cact="

'收款 入款金额
sql="select aycaiwuuser,aycaiwudate,aycaiwuleibie,aycaiwuzt,aycaiwujine,aycaiwubody from "&request.Cookies("cwku")&" where aycaiwuuser="&clng(request.Cookies("aynameid"))&" and datediff(day,aycaiwudate,'"&now()&"')=0 and aycaiwuzt=1 and (aycaiwuleibie=0 or aycaiwuleibie=8 or aycaiwuleibie=17 or aycaiwuleibie=18)" 
rs.open sql,conn,1,1
	ddin=0  '订单入款
	shouin=0  '收款金额
	zongshoujin=0  '总收款金额
	shoubi=0 '收款笔数
	dailib=0 '代理入款笔数
	dailij=0 '代理入款金额
	fandian=0
	fandianj=0
	if not(rs.bof and rs.eof) then
	do while not rs.eof
    if cint(rs("aycaiwuleibie"))=0 then  '订单入款
	ddin=ddin+ccur(rs("aycaiwujine"))
	elseif cint(rs("aycaiwuleibie"))=8 then
	fandian=fandian+1
	fandianj=fandianj+ccur(rs("aycaiwujine"))
	elseif cint(rs("aycaiwuleibie"))=17 then '收款金额
	shoubi=shoubi+1
	shouin=shouin+ccur(rs("aycaiwujine"))  '收款入款金额
	jin=replace(trim(rs("aycaiwubody")),"收款"," ")   '总收款金额
	jin=replace(trim(jin),"元"," ")
	jin=trim(jin)
	zongshoujin=ccur(zongshoujin)+ccur(jin)
	elseif cint(rs("aycaiwuleibie"))=18 then '代理入款
	dailib=dailib+1
	dailij=dailij+ccur(rs("aycaiwujine"))
	end if
	
	rs.movenext  
	loop
	end if
rs.close


'订单金额
set rsj=server.CreateObject("adodb.recordset")

sqlj="select aydingdanin,aydingdansj,aydingdanuser,aydingdanzt,aydingdanzj,aydingdancb,ayddquantity,ayddzffangshi from "&request.Cookies("ddku")&" where datediff(day,aydingdansj,'"&now()&"')=0 and aydingdanuser="&clng(request.Cookies("aynameid"))&" and aydingdanzt=1" 
rsj.open sqlj,conn,1,1

	minje=0    '订单总价
	'minjelast=0
	num=0     '成交笔数
	paybank=0  '网银成交
	payalipay=0 '支付宝成交
	paytenpay=0 '财付通成交
	paycard=0  '充值卡成交
	paybankj=0
	payalipayj=0
	paytenpayj=0
	paycardj=0
	ddlirun=0
	ayptsaoj=0          '微信金额
	ayptsaob=0          '微信笔数
	ayptsaol=0          '微信利润
	qqsaob=0
	qqsaoj=0
	
	if not(rsj.bof and rsj.eof) then
	do while not rsj.eof
	
		num=num+1   '成交笔数
		minje=ccur(minje)+ccur(rsj("aydingdanzj"))   '订单总价
		'minjelast=ccur(minjelast)+ccur(rsj("aycwinjin"))

			chengben=0
			chengben=ccur(rsj("aydingdancb"))*ccur(rsj("ayddquantity"))
			jfei=ccur(jfei)+ccur(rsj("aydingdanzj"))-ccur(rsj("aydingdanin"))	 '今日手续费
			
			fei=ccur(rsj("aydingdanzj"))-ccur(rsj("aydingdanin"))
			ddlirun=ccur(ddlirun)+ccur(rsj("aydingdanzj"))-ccur(chengben)-ccur(fei)
			
			if rsj("ayddzffangshi")=0 then '0网银 1充值卡 2支付宝 3财付通
			paybank=paybank+1
			paybankj=paybankj+ccur(rsj("aydingdanzj"))
			elseif rsj("ayddzffangshi")=1 then
			paycard=paycard+1
			paycardj=paycardj+ccur(rsj("aydingdanzj"))
			elseif rsj("ayddzffangshi")=2 or rsj("ayddzffangshi")=10 then
			payalipay=payalipay+1
			payalipayj=payalipayj+ccur(rsj("aydingdanzj"))
			elseif rsj("ayddzffangshi")=3 or rsj("ayddzffangshi")=12 then
			paytenpay=paytenpay+1
			paytenpayj=paytenpayj+ccur(rsj("aydingdanzj"))
			elseif rsj("ayddzffangshi")=4 or rsj("ayddzffangshi")=13 then
			ayptsaob=ayptsaob+1
			ayptsaoj=ayptsaoj+ccur(rsj("aydingdanzj"))
			elseif rsj("ayddzffangshi")=5 or rsj("ayddzffangshi")=14 then
			qqsaob=qqsaob+1
			qqsaoj=qqsaoj+ccur(rsj("aydingdanzj"))
			end if
			
	rsj.movenext  
	loop
	end if
	rsj.close
	
	
'当月流量
	dyll=0
	ayptcjbs2=0
	ayptbankj2=0
	ayptbank2=0
	ayptalipayj2=0
	ayptalipay2=0
	aypttenpayj2=0
	aypttenpay2=0
	ayptcardj2=0
	ayptcard2=0
	fandian2=0
	fandianj2=0
	shoukuanj=0 '收款金额
	dailiin=0  '代理入款
	ayptcjlr=0  '利润
	ayptsaoj2=0          '微信金额
	ayptsaob2=0          '微信笔数
	ayptsaol2=0          '微信利润
	qqsaob2=0
	qqsaoj2=0
	sql="select * from aypttj where aypttjuid="&request.Cookies("aynameid")&" and aypttjzq=3 and datediff(mm,ayptdate,'"&now()&"')=0" 
	rs.open sql,conn,1,1
	if not(rs.bof and rs.eof) then
	do while not rs.eof
	dyll=ccur(dyll)+ccur(rs("ayptcjje"))
	ayptcjbs2=ccur(ayptcjbs2)+ccur(rs("ayptcjbs"))
	
	ayptbankj2=ccur(ayptbankj2)+ccur(rs("ayptbankj"))  '***
	ayptbank2=ccur(ayptbank2)+ccur(rs("ayptbank"))    '**
	
	ayptalipayj2=ccur(ayptalipayj2)+ccur(rs("ayptalipayj"))+ccur(rs("wapalij")) '**
	ayptalipay2=ccur(ayptalipay2)+ccur(rs("ayptalipay"))+ccur(rs("wapalib"))   '**
	
	aypttenpayj2=ccur(aypttenpayj2)+ccur(rs("aypttenpayj"))+ccur(rs("waptenj"))  '**
	aypttenpay2=ccur(aypttenpay2)+ccur(rs("aypttenpay"))+ccur(rs("waptenb"))  '**
	
	ayptcardj2=ccur(ayptcardj2)+ccur(rs("ayptcardj"))
	ayptcard2=ccur(ayptcard2)+ccur(rs("ayptcard"))
	fandian2=ccur(fandian2)+ccur(rs("ayfandian"))
	fandianj2=ccur(fandianj2)+ccur(rs("ayfandianj"))
	shoukuanj=ccur(shoukuanj)+ccur(rs("shoukuanj"))
	dailiin=ccur(dailiin)+ccur(rs("dailiin"))
	ayptcjlr2=ccur(ayptcjlr2)+ccur(rs("ayptcjlr"))
	ayptsaoj2=ccur(ayptsaoj2)+ccur(rs("ayptsaoj"))
	ayptsaob2=ccur(ayptsaob2)+ccur(rs("ayptsaob"))
	
	qqsaob2=ccur(qqsaob2)+ccur(rs("qqsaob"))
	qqsaoj2=ccur(qqsaoj2)+ccur(rs("qqsaoj"))
		
	rs.movenext  
	loop
	end if
	rs.close
		
	
%>
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="table_style_a1">
  <tr>
    <td colspan="4" class="border_bottom"><span class="f14" style="font-weight: bold">&nbsp;&nbsp;今日账务统计 <%=date%></span></td>
    </tr>
  <tr>
    <td width="200" align="center" class="border_right border_bottom" style="font-weight: bold">订单金额</td>
    <td align="center" class="border_right border_bottom" style="font-weight: bold"><%=Formatnumber(minje,3,true,-1,0)%>元 | <%=Formatnumber(dyll+minje,3,true,-1,0)%>元/月</td>
    <td width="200" align="center" class="border_right border_bottom" style="font-weight: bold">成交笔数</td>
    <td align="center" class="border_bottom" style="font-weight: bold"><%=num%>笔 | <%=ayptcjbs2+num%>笔/月</td>
    </tr>
  <tr>
    <td align="center" class="border_right border_bottom" style="font-weight: bold">收款金额</td>
    <td align="center" class="border_right border_bottom" style="font-weight: bold"><%=Formatnumber(zongshoujin,3,true,-1,0)%>元|<%=Formatnumber(shoukuanj,3,true,-1,0)%>元/月</td>
    <td width="200" align="center" class="border_right border_bottom" style="font-weight: bold">利润</td>
    <td align="center" class="border_bottom" style="font-weight: bold"><%=Formatnumber(ddlirun,3,true,-1,0)%>元|<%=Formatnumber(ayptcjlr2,3,true,-1,0)%>元/月</td>
  </tr>
  <tr>
    <td align="center" class="border_right border_bottom" style="font-weight: bold">代理入款</td>
    <td align="center" class="border_right border_bottom" style="font-weight: bold"><%=Formatnumber(dailij,3,true,-1,0)%>元|<%=Formatnumber(dailiin,3,true,-1,0)%>元/月</td>
    <td width="200" align="center" class="border_right border_bottom" style="font-weight: bold">手续费</td>
    <td align="center" class="border_bottom" style="font-weight: bold"><%=Formatnumber(jfei,3,true,-1,0)%>元</td>
  </tr>
  
  <tr>
    <td align="center" class="border_right border_bottom">网银支付</td>
    <td align="center" class="border_right border_bottom"><%=Formatnumber(paybankj,3,true,-1,0)%>元 | <%=Formatnumber(ayptbankj2+paybankj,3,true,-1,0)%>元/月</td>
    <td align="center" class="border_right border_bottom">网银成交笔数</td>
    <td align="center" class="border_bottom"><%=paybank%>笔 | <%=ayptbank2+paybank%>笔/月</td>
    </tr>
  <tr>
    <td align="center" class="border_right border_bottom">支付宝支付</td>
    <td align="center" class="border_right border_bottom"><%=Formatnumber(payalipayj,3,true,-1,0)%>元 | <%=Formatnumber(ayptalipayj2+payalipayj,3,true,-1,0)%>元/月</td>
    <td align="center" class="border_right border_bottom">支付宝成交笔数</td>
    <td align="center" class="border_bottom"><%=payalipay%>笔 | <%=ayptalipay2+payalipay%>笔/月</td>
    </tr>
  <tr>
    <td align="center" class="border_right border_bottom">财付通支付</td>
    <td align="center" class="border_right border_bottom"><%=Formatnumber(paytenpayj,3,true,-1,0)%>元 | <%=Formatnumber(aypttenpayj2+paytenpayj,3,true,-1,0)%>元/月</td>
    <td align="center" class="border_right border_bottom">财付通成交笔数</td>
    <td align="center" class="border_bottom"><%=paytenpay%>笔 | <%=aypttenpay2+paytenpay%>笔/月</td>
    </tr>
  <tr>
    <td align="center" class="border_right border_bottom">微信扫码支付</td>
    <td align="center" class="border_right border_bottom"><%=Formatnumber(ayptsaoj,3,true,-1,0)%>元 | <%=Formatnumber(ayptsaoj2+ayptsaoj,3,true,-1,0)%>元/月</td>
    <td align="center" class="border_right border_bottom">微信扫码支付笔数</td>
    <td align="center" class="border_bottom"><%=ayptsaob%>笔 | <%=ayptsaob2+ayptsaob%>笔/月</td>
  </tr>
  <tr>
    <td align="center" class="border_right border_bottom">手Q扫码支付</td>
    <td align="center" class="border_right border_bottom"><%=Formatnumber(qqsaoj,3,true,-1,0)%>元 | <%=Formatnumber(qqsaoj2+qqsaoj,3,true,-1,0)%>元/月</td>
    <td align="center" class="border_right border_bottom">手Q扫码支付笔数</td>
    <td align="center" class="border_bottom"><%=qqsaob%>笔 | <%=qqsaob2+qqsaob%>笔/月</td>
  </tr>
  <tr>
    <td align="center" class="border_right border_bottom">充值卡支付</td>
    <td align="center" class="border_right border_bottom"><%=Formatnumber(paycardj,3,true,-1,0)%>元 | <%=Formatnumber(ayptcardj2+paycardj,3,true,-1,0)%>元/月</td>
    <td align="center" class="border_right border_bottom">充值卡成交笔数</td>
    <td align="center" class="border_bottom"><%=paycard%>笔 | <%=ayptcard2+paycard%>笔/月</td>
  </tr>
  </table>
<br>
<span style="font-weight: bold; color: #FF3300; font-size:15px">日统计 </span>
  <span id="buquan1" onClick="tongjiall()" style="cursor:pointer">[补全往日统计]</span>
  <span id="buquan2" style="display:none"> <img src="<%=ossurl%>Template/Template4/images/load.gif">请稍等···</span>
<%
gao=660
rs.open "select top 13 aypttjuid,aypttjzq from aypttj where aypttjuid="&clng(request.Cookies("aynameid"))&" and aypttjzq=3",conn,1,1
if rs.RecordCount=0 then gao=200
if rs.RecordCount=1 then gao=200
if rs.RecordCount=2 then gao=230
if rs.RecordCount=3 then gao=270
if rs.RecordCount=4 then gao=300
if rs.RecordCount=5 then gao=340
if rs.RecordCount=6 then gao=370
if rs.RecordCount=7 then gao=410
if rs.RecordCount=8 then gao=440
if rs.RecordCount=9 then gao=480
if rs.RecordCount=10 then gao=510
if rs.RecordCount=11 then gao=550
if rs.RecordCount=12 then gao=580
if rs.RecordCount=13 then gao=620
rs.close
%>
<br>
  <iframe src="tongjiri.asp" frameborder="0" scrolling="yes" width="1200" height="<%=gao%>" ></iframe>

<br><br>
<span style="font-weight: bold; color: #FF3300; font-size:15px">月统计</span>
<%
gao=580
rs.open "select top 12 aypttjuid,aypttjzq from aypttj where aypttjuid="&clng(request.Cookies("aynameid"))&" and aypttjzq=2",conn,1,1
if rs.RecordCount=0 then gao=200
if rs.RecordCount=1 then gao=200
if rs.RecordCount=2 then gao=230
if rs.RecordCount=3 then gao=270
if rs.RecordCount=4 then gao=300
if rs.RecordCount=5 then gao=340
if rs.RecordCount=6 then gao=370
if rs.RecordCount=7 then gao=410
if rs.RecordCount=8 then gao=440
if rs.RecordCount=9 then gao=480
if rs.RecordCount=10 then gao=510
if rs.RecordCount=11 then gao=550
if rs.RecordCount=12 then gao=580
rs.close
%>
<br>
<iframe src="tongjiyue.asp" frameborder="0" scrolling="yes" width="1200" height="<%=gao%>" ></iframe>

<br>
<span style="font-weight: bold; color: #FF3300; font-size:15px">年统计</span>
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="table_style_a1">
       <tr>
         <th align="center" class="border_right border_bottom" >时间
           <th align="center" class="border_right border_bottom" ><span title="只统计成功订单金额">金额</span>         
            <th align="center" class="border_right border_bottom" ><span title="包括充值，收款，返点，代理商品入款">其他入款</span>          
            <th align="center" class="border_right border_bottom" ><span title="平台手续费">佣金</span>            
            <th align="center" class="border_right border_bottom" ><span title="成功订单金额-订单成本金额">利润</span>          
            <th align="center" class="border_right border_bottom" >成交                         
            <th align="center" class="border_right border_bottom"><span title="订单-网银支付">网银</span>                         
            <th align="center" class="border_right border_bottom"><span title="订单-支付宝支付">支付宝</span>
            <th align="center" class="border_right border_bottom"><span title="订单-财付通支付">财付通</span>                         
            <th align="center" class="border_right border_bottom"><span title="订单-微信扫码支付">微信</span>         
            <th align="center" class="border_right border_bottom">手Q            
          <th align="center" class="border_bottom"><span title="订单-充值卡支付">充值卡</span>         </tr>
<%
sql="select top 3 * from aypttj where aypttjuid="&clng(request.Cookies("aynameid"))&" and aypttjzq=1 order by ayptdate desc"  
rs.open sql,conn,1,1
rs.pagesize=15 
pagecount=rs.pagecount 
if request("npage")="" then 
npage=1
else
npage=int(request("npage")) 
end if
if npage<=0 then npage=1 
if request("npage")="" then npage=1
if not(rs.bof and rs.eof) then
rs.absolutepage=npage
do while not rs.eof%>

	  <tr onmouseover=this.bgColor='#D2FFFF' onmouseout=this.bgColor='#ffffff'>
        <td align="center" class="border_right border_bottom"><%=rs("aypttjjl")%></td>
        <td align="center" class="border_right border_bottom"><%=Formatnumber(rs("ayptcjje"),1,true,-1,0)%>元</td>
        <td align="center" class="border_right border_bottom"><span title="代理商品入款<%=rs("dailiin")%>元
其他入款<%=rs("dailiin")%>元"><%=Formatnumber(ccur(rs("qitain"))+ccur(rs("dailiin")),1,true,-1,0)%>元</span></td>
        <td align="center" class="border_right border_bottom"><%=Formatnumber(rs("shoufei"),1,true,-1,0)%>元</td>
        <td align="center" class="border_right border_bottom"><%=Formatnumber(rs("ayptcjlr"),1,true,-1,0)%>元</td>
        <td align="center" class="border_right border_bottom"><%=rs("ayptcjbs")%>笔</td>
        <td align="center" class="border_right border_bottom"><%=Formatnumber(rs("ayptbankj"),3,true,-1,0)%>元(<%=rs("ayptbank")%>笔)</td>
        <td align="center" class="border_right border_bottom"><%=Formatnumber(ccur(rs("ayptalipayj"))+ccur(rs("wapalij")),3,true,-1,0)%>元(<%=ccur(rs("ayptalipay"))+ccur(rs("wapalib"))%>笔)</td>
        <td align="center" class="border_right border_bottom"><%=Formatnumber(ccur(rs("aypttenpayj"))+ccur(rs("waptenj")),3,true,-1,0)%>元(<%=ccur(rs("aypttenpay"))+ccur(rs("waptenb"))%>笔)</td>
        <td align="center" class="border_right border_bottom"><%=Formatnumber(rs("ayptsaoj"),3,true,-1,0)%>元(<%=rs("ayptsaob")%>笔)</td>
        <td align="center" class="border_right border_bottom"><%=Formatnumber(rs("qqsaoj"),1,true,-1,0)%>元(<%=rs("qqsaob")%>笔)</td>
        <td align="center" class="border_bottom"><%=Formatnumber(rs("ayptcardj"),3,true,-1,0)%>元(<%=rs("ayptcard")%>笔)</td>
	    </tr>
<%
nn=nn+1
rs.movenext
if nn>=rs.pagesize then exit do  
loop
end if
nzongshu=rs.RecordCount
rs.close%>
	  

      <tr>
        <td colspan="12">&nbsp;
          <%if pagecount=0 then   
response.write("首页 ")
elseif npage=1 then       
response.write("首页 ")
else%>                   
<a href="<%=link%>&npage=1">首页</a>
<%end if

if pagecount=0 then   
response.write("上页&nbsp;")
elseif npage=1 then       
response.write("上页&nbsp;")
else%>                   
<a href="<%=link%>&npage=<%=npage-1%>">上页</a>&nbsp;
<%end if

if pagecount>20 then
if npage<=10 then 
naa=1
nbb=20
naabu=""
nbbbu=" … "
elseif npage>=11 then 
naa=npage-9
nbb=npage+10
naabu=" …"
nbbbu=" … "
	if nbb>=pagecount then 
	naa=pagecount-20
	nbb=pagecount
	naabu=" … "
	nbbbu=""
	end if
end if
response.Write naabu
for naa=naa to nbb
if npage=naa then
response.Write("<a href="&link&"&npage="&naa&"><strong>"&naa&"</strong></a>&nbsp;")
else
response.Write("<a href="&link&"&npage="&naa&">"&naa&"</a>&nbsp;")
end if
next
response.Write nbbbu

else

for ni=1 to pagecount
if npage=ni then
response.Write("<a href="&link&"&npage="&ni&"><strong>"&ni&"</a></strong>&nbsp;")
else
response.Write("<a href="&link&"&npage="&ni&">"&ni&"</a>&nbsp;")
end if
next

end if

if pagecount=0 then 
response.write("下页&nbsp;")
elseif npage=pagecount then 
response.write("下页&nbsp;")
else%>                    
<a href="<%=link%>&npage=<%=npage+1%>">下页</a>
<%end if%>
<%if pagecount=0 then  '总页数为0 显示空
response.write("尾页 ") 
elseif npage=pagecount then 
response.write("尾页 ")
else%>                    
<a href="<%=link%>&npage=<%=pagecount %>">尾页</a>
<%end if

if pagecount<>0 then 
response.Write npage&"/"&pagecount
end if
response.Write "&nbsp;共"&nzongshu&"条"
%>		</td>
      </tr>
    </table>




</DIV>
</DIV>
<DIV class=clear></DIV></DIV>
</DIV>

<br>

	<!--#include virtual="/show/foot.asp"-->


