📄 salesanalyse.asp
字号:
<tr>
<td height="25"><strong><font class=title>客户销售分析</font></strong></td>
</tr>
<tr >
<td height="16" colspan="3" background="../images/title.gif"> </td>
</tr>
<tr>
<td height=4></td>
</tr>
<tr>
<td><div align="center" style="cursor:hand"></DIV></td>
</tr>
</table></td>
</tr>
<tr>
<td> <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#EFEFEF">
<tr>
<td width="10%" align="right">销售日期 从 </td>
<td width="24%"> <select name="selYear" size=1 class="year">
</select> <select name="selMonth" size="1" class="month">
<option value=0>1 月</option>
<option value=1>2 月</option>
<option value=2>3 月</option>
<option value=3>4 月</option>
<option value=4>5 月</option>
<option value=5>6 月</option>
<option value=6>7 月</option>
<option value=7>8 月</option>
<option value=8>9 月</option>
<option value=9>10 月</option>
<option value=10>11 月</option>
<option value=11>12 月</option>
</select>
到
<select name="selMonth2" size="1" class="month">
<option value=0>1 月</option>
<option value=1>2 月</option>
<option value=2>3 月</option>
<option value=3>4 月</option>
<option value=4>5 月</option>
<option value=5>6 月</option>
<option value=6>7 月</option>
<option value=7>8 月</option>
<option value=8>9 月</option>
<option value=9>10 月</option>
<option value=10>11 月</option>
<option value=11>12 月</option>
</select> </td>
<td width="15%"><select name="strfield" class="thisselect">
<option value=10 <%if request("strfield")="10" then Response.Write "selected"%>>累计前10位</option>
<option value=20 <%if request("strfield")="20" or request("strfield")="" then Response.Write "selected"%>>累计前20位</option>
<option value=50 <%if request("strfield")="50" then Response.Write "selected"%>>累计前50位</option>
<option value=80 <%if request("strfield")="80" then Response.Write "selected"%>>累计前80位</option>
<option value=100 <%if request("strfield")="100" then Response.Write "selected"%>>累计前100位</option>
</select></td>
<td width="15%"><select name="strfield2" class="thisselect">
<option value="" <%if request("strfield2")="" then Response.Write "selected"%>>==所有类型==</option>
<option value=B50 <%if request("strfield2")="B50" then Response.Write "selected"%>>===OEM型===</option>
<option value=200 <%if request("strfield2")="200" then Response.Write "selected"%>>==Project型==</option>
<option value=100 <%if request("strfield")="100" then Response.Write "selected"%>>=Distributor型=</option>
</select></td>
<td><select name=nameSearch size=1 id=Select1 class="thisselect">
<option value="">==选择销售员==</option>
<%'getgrouptype selecttablename,"ownername",Request("namesearch")%>
<%getsubordinate Request.Form("namesearch")%>
</select></td>
<td align="right"><a onClick="submit1();"><img src="../images/button_analyse.gif" style="cursor:hand" border=0></a></td>
</tr>
</TABLE></td>
</tr>
</table>
<%
function GetMonthlySAmount(straccount,strownername,strmonth)
sql2="SELECT [month] as salesmonth,sum(amount) as subamount FROM Salesanalyse where 1=1 "& strwhere &" and owner='"&strownername&"' and account='"&straccount&"' group by [month] order by [month]"
'response.write sql2
set rs2=connsalequery.execute(sql2)
dim strtemp(12,2)
if not rs2.eof then
do while not rs2.eof
strtemp(rs2("salesmonth"),1)=rs2("salesmonth")
strtemp(rs2("salesmonth"),2)=CCUR(rs2("subamount"))/10000
rs2.movenext
loop
rs2.close
end if
for k=cint(theselMonth)+1 to cint(theselMonth2)+1
if strtemp(k,1)=k then
response.write "<td bgcolor='#FFFFFF' CLASS='TITLEEN' align='right'>"&formatnumber(strtemp(k,2),2)&"</td>"
else
response.write "<td bgcolor='#FFCCCC'> </td>"
end if
next
end function
if request("strfield")="" then
thefield=20
else
thefield=cint(request("strfield"))
end if
sql="SELECT TOP "&thefield&" owner as ownername,account as orderaccount,sum(amount) as subtotalamount FROM salesanalyse where 1=1 "&strwhere &" group by owner,account order by subtotalamount desc"
'response.write sql&"<br>"
set rs=connsalequery.execute(sql)
if not rs.eof then
%>
<div id="analyseresult" style="display:none; position:; overflow: auto; z-index:1; layer-background-color: EFEFEF; background-color: #FFFFFF; font-size:12; font-weight:; width:100%; height:400;">
<table>
<tr bgcolor="#FFFFFF"><td width=20% height="22" nowrap valign="middle" colspan="12"><div class="divdsp2" style="width:80;text-align:center;cursor:hand" onclick="javascript:document.all.analyseresult2.style.display='';document.all.analyseresult.style.display='none'">分析结果</div></td></tr>
<tr><td height=22 class="titleen"><strong>明细</strong></td></tr>
</table>
<table width="100%" cellpadding="0" cellspacing="1" bgcolor="#DECFAD" border="0">
<tr bgcolor="#FFFFFF">
<td width="4%" class="titleen" align="center" nowrap>排名</td>
<td width="6%" class="titleen" align="center" nowrap>所有者</td>
<td width="20%" class="titleen" align="center" nowrap>客户</td>
<%for k=cint(theselMonth)+1 to cint(theselMonth2)+1%>
<td width="<%=cint((60/((cint(theselMonth2)-cint(theselMonth))+1)))%>%" align="center" class='titleen'><%=k%>月</td>
<%next%>
<td width="10%" class="titleen" align="center">合计</td>
</tr>
<%
accountqty_1=0
accountqty_2=0
accountqty_3=0
accountqty_4=0
accountqty_5=0
accountqty_6=0
accountqty_7=0
accountqty_8=0
accountqty_9=0
accountamount_1=0
accountamount_2=0
accountamount_3=0
accountamount_4=0
accountamount_5=0
accountamount_6=0
accountamount_7=0
accountamount_8=0
accountamount_9=0
totalamount=0:i=1:do while not rs.EOF and i<=50
totalamount=totalamount+Ccur(rs("subtotalamount"))
if Ccur(rs("subtotalamount"))/10000>=200 then accountqty_1=accountqty_1+1:accountamount_1=accountamount_1+Ccur(rs("subtotalamount"))
if Ccur(rs("subtotalamount"))/10000>=100 then accountqty_2=accountqty_2+1:accountamount_2=accountamount_2+Ccur(rs("subtotalamount"))
if Ccur(rs("subtotalamount"))/10000>=50 then accountqty_3=accountqty_3+1:accountamount_3=accountamount_3+Ccur(rs("subtotalamount"))
if Ccur(rs("subtotalamount"))/10000>=20 then accountqty_4=accountqty_4+1:accountamount_4=accountamount_4+Ccur(rs("subtotalamount"))
if Ccur(rs("subtotalamount"))/10000>=10 then accountqty_5=accountqty_5+1:accountamount_5=accountamount_5+Ccur(rs("subtotalamount"))
if Ccur(rs("subtotalamount"))/10000>=5 then accountqty_6=accountqty_6+1:accountamount_6=accountamount_6+Ccur(rs("subtotalamount"))
%>
<tr bgcolor="#FFFFFF">
<td class="titleen" align="center"><%=i%></td>
<td class="titleen" align="center"><%=rs("ownername")%></td>
<td class="titleen"><%=rs("orderaccount")%></td>
<%=GetMonthlySAmount(rs("orderaccount"),rs("ownername"),k)%>
<td class="titleen" align="right"><%=formatnumber(ccur(rs("subtotalamount"))/10000,2)%></td>
</tr>
<%
i=i+1
rs.MoveNext
loop
%>
</table>
</div>
<%
sqltotal="SELECT sum(amount) as total FROM salesanalyse where 1=1 "& strwhere
set rstotal=connsalequery.execute(sqltotal)
if rstotal("total")<>"" then Total=ccur(rstotal("total"))
rstotal.close
%>
<div id="analyseresult2" style="display:; position:; overflow: auto; z-index:1; layer-background-color: EFEFEF; background-color: #FFFFFF; font-size:12; font-weight:; width:100%; height:400;">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr><td height="22" nowrap valign="middle" colspan="4"><div class="divdsp2" style="width:80;text-align:center;cursor:hand" onclick="javascript:document.all.analyseresult.style.display='';document.all.analyseresult2.style.display='none'">查看明细</div></td></tr>
<tr><td height=22 class="titleen" colspan="4"><strong>结果</strong></td></tr>
<tr>
<td width=20% height="22" nowrap><div class="divdsp3" style="width:180"> 金额合计:<%=formatnumber(Total/10000,2)%>万</div></td>
<td width=20% height="22" nowrap ><div class="divdsp3" style="width:180"> 前<%=thefield%>位合计:<%=formatnumber(totalamount/10000,2)%>万</div></td>
<td width=30% height="22" nowrap ><div class="divdsp3" style="width:180"> 前<%=thefield%>位占比率:<%if Total<>0 then response.write formatnumber(totalamount/Total*100,2) else response.write "--"%>%</div></td>
<td></td>
</tr>
<tr><td height="1" colspan=4 background="../images/bg_line_03.gif"></td></tr>
<tr>
<td width=20% class="titleen" align="center" height="22" ><strong>类别</strong></td>
<td width=20% class="titleen" align="center"><strong>数量</strong></td>
<td width=30% class="titleen" align="center"><strong>金额(万)</strong></td>
<td width=20% class="titleen" align="center"><strong>比率</strong></td>
</tr>
<tr>
<td width=20% class="titleen" align="center" height="22" >>=200万</td>
<td width=20% class="titleen" align="center"><%=accountqty_1%></td>
<td width=30% class="titleen" align="center"><%=formatnumber(accountamount_1/10000,2)%></td>
<td width=20% class="titleen" align="center"><%if Total<>0 then response.write formatnumber(accountamount_1/Total*100,2) else response.write "--"%>%</td>
</tr>
<tr><td height="1" colspan=4 background="../images/bg_line_03.gif"></td></tr>
<tr>
<td width=20% class="titleen" align="center" height="22" >>=100万</td>
<td width=20% class="titleen" align="center"><%=accountqty_2%></td>
<td width=30% class="titleen" align="center"><%=formatnumber(accountamount_2/10000,2)%></td>
<td width=20% class="titleen" align="center"><%if Total<>0 then response.write formatnumber(accountamount_2/Total*100,2) else response.write "--"%>%</td>
</tr>
<tr><td height="1" colspan=4 background="../images/bg_line_03.gif"></td></tr>
<tr>
<td width=20% class="titleen" align="center" height="22" >>=50万</td>
<td width=20% class="titleen" align="center"><%=accountqty_3%></td>
<td width=30% class="titleen" align="center"><%=formatnumber(accountamount_3/10000,2)%></td>
<td width=20% class="titleen" align="center"><%if Total<>0 then response.write formatnumber(accountamount_3/Total*100,2) else response.write "--"%>%</td>
</tr>
<tr><td height="1" colspan=4 background="../images/bg_line_03.gif"></td></tr>
<tr>
<td width=20% class="titleen" align="center" height="22" >>=20万</td>
<td width=20% class="titleen" align="center"><%=accountqty_4%></td>
<td width=30% class="titleen" align="center"><%=formatnumber(accountamount_4/10000,2)%></td>
<td width=20% class="titleen" align="center"><%if Total<>0 then response.write formatnumber(accountamount_4/Total*100,2) else response.write "--"%>%</td>
</tr>
<tr><td height="1" colspan=4 background="../images/bg_line_03.gif"></td></tr>
<tr>
<td width=20% class="titleen" align="center" height="22" >>=10万</td>
<td width=20% class="titleen" align="center"><%=accountqty_5%></td>
<td width=30% class="titleen" align="center"><%=formatnumber(accountamount_5/10000,2)%></td>
<td width=20% class="titleen" align="center"><%if Total<>0 then response.write formatnumber(accountamount_5/Total*100,2) else response.write "--"%>%</td>
</tr>
<tr><td height="1" colspan=4 background="../images/bg_line_03.gif"></td></tr>
<tr>
<td width=20% class="titleen" align="center" height="22" >>=5万</td>
<td width=20% class="titleen" align="center"><%=accountqty_6%></td>
<td width=30% class="titleen" align="center"><%=formatnumber(accountamount_6/10000,2)%></td>
<td width=20% class="titleen" align="center"><%if Total<>0 then response.write formatnumber(accountamount_6/Total*100,2) else response.write "--"%>%</td>
</tr>
<tr><td height="1" colspan=4 background="../images/bg_line_03.gif"></td></tr>
<tr bgcolor="EFEFEF">
<td width=20% height="22" align="center" class="titleen" >OEM</td>
<td width=20% align="center" class="titleen"><%=accountqty_7%></td>
<td width=30% align="center" class="titleen"><%=formatnumber(accountamount_7/10000,2)%></td>
<td width=20% align="center" class="titleen">
<%if Total<>0 then response.write formatnumber(accountamount_7/Total*100,2) else response.write "--"%>
%</td>
</tr>
<tr><td height="1" colspan=4 background="../images/bg_line_03.gif"></td></tr>
<tr bgcolor="EFEFEF">
<td width=20% height="22" align="center" class="titleen" >Project</td>
<td width=20% align="center" class="titleen"><%=accountqty_8%></td>
<td width=30% align="center" class="titleen"><%=formatnumber(accountamount_8/10000,2)%></td>
<td width=20% align="center" class="titleen">
<%if Total<>0 then response.write formatnumber(accountamount_8/Total*100,2) else response.write "--"%>
%</td>
</tr>
<tr><td height="1" colspan=4 background="../images/bg_line_03.gif"></td></tr>
<tr bgcolor="EFEFEF">
<td width=20% height="22" align="center" class="titleen" >Distributor</td>
<td width=20% align="center" class="titleen"><%=accountqty_9%></td>
<td width=30% align="center" class="titleen"><%=formatnumber(accountamount_9/10000,2)%></td>
<td width=20% align="center" class="titleen">
<%if Total<>0 then response.write formatnumber(accountamount_9/Total*100,2) else response.write "--"%>
%</td>
</tr>
<tr><td height="1" colspan=4 background="../images/bg_line_03.gif"></td></tr>
</table>
</div>
<%
end if
rs.close
connsalequery.close
set objcheck=nothing
%>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -