?? analyse_client_area.asp
字號(hào):
<!--#include file="../conn.asp"-->
<!--#include file="../pub_fun.asp"-->
<!--#include file="Private_fun.asp"-->
<!--#include file="../scripts/openwindow.js"-->
<HTML>
<HEAD>
<TITLE>客戶地域分布分析</TITLE>
<LINK href="../css.css" rel=stylesheet>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></HEAD>
<body bgcolor="#ffffff" text="#000000" leftmargin="8">
<table width="751" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="85%" valign="top" align="center">
<form method="post" action="" name="fm">
<div align="right">
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#F2F2F2">
<tr bgcolor="#FFFFFF">
<td height="5" colspan="2" ></td>
</tr>
<tr>
<td width="180" bgcolor="#566CDB"><font color="#FFFFFF"><img src="../images/DispStation.gif">客戶地域信息
- 列表</font></td>
<td>
<div align="right">
<table border="0" cellpadding="0" cellspacing="0" class=tablebutton>
<tr>
<td align="right">
<input type="button" name="Button" value="查詢" class="button_all" onClick="cmd_search()">
<input type="button" name="Button" value="圖示" class="button_all" onClick="showchart()">
<input type="button" name="Button" value="返回" class="button_all" onClick="gomenu()">
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
<table width="80%" border="0" cellpadding="1" cellspacing="1" class=tableselect>
<tr>
<td class=TD_hr width="50">分析對(duì)象</td>
<td class="tablelist_td1" onclick="cmd_search()">
<INPUT TYPE=RADIO NAME="S_City" VALUE="0" <%if request("S_City")= 0 then response.Write("checked")%>>國(guó)家名稱
<INPUT TYPE=RADIO NAME="S_City" VALUE="1" <%if request("S_City")= 1 or request("S_City")="" then response.Write("checked")%>>省份
<INPUT TYPE=RADIO NAME="S_City" VALUE="2" <%if request("S_City")= 2 then response.Write("checked")%>>城市
</td>
<td class="tablelist_td1" colspan="2">
</td>
</tr>
<tr>
<td class=TD_hr width="50">開(kāi)始時(shí)間</td>
<td class="tablelist_td1">
<input class=text100 type="text" name="start_time" maxlength=10 value="<%if request("start_time")<>"" then response.Write(request("start_time"))%>"><input name="Button2" type="button" class="button_dic" id="Button2" onClick="show_calendar('fm.start_time')" value="…">
</td>
<td class=TD_hr width="50">結(jié)束時(shí)間</td>
<td class="tablelist_td1">
<input class=text100 type="text" name="end_time" maxlength=10 value="<%if request("end_time")<>"" then response.Write(request("end_time"))%>"><input name="Button3" type="button" class="button_dic" id="Button3" onClick="show_calendar('fm.end_time')" value="…">
</td>
</tr>
</table>
<!-- 顯示內(nèi)容-->
<%
''判斷是否進(jìn)行了查詢操作
if request("opstatus")="query" then
''判斷是否進(jìn)行了數(shù)據(jù)范圍的選擇
if request("start_time")<>"" and request("end_time")<>"" then
sqlwhere=" where ClientCreateDate between '"&request("start_time")&"' and '"&request("end_time")&"'"
end if
''根據(jù)統(tǒng)對(duì)象來(lái)分別生成查詢語(yǔ)句。
sql="select "
select case trim(request("S_City"))
case "0"
sql=sql&" ClientNation, COUNT(ClientID) AS totalnum FROM Client "
sql=sql& sqlwhere
sql=sql&" GROUP BY Clientnation"
case "1"
sql=sql&" ClientProvince, COUNT(ClientID) AS totalnum FROM Client "
sql=sql& sqlwhere
sql=sql&" GROUP BY ClientProvince"
case "2"
sql=sql&" ClientCity, COUNT(ClientID) AS totalnum FROM Client "
sql=sql& sqlwhere
sql=sql&" GROUP BY ClientCity"
end select
''如果沒(méi)有進(jìn)行查詢操作,則默認(rèn)的查詢函數(shù)如下,即統(tǒng)計(jì)對(duì)象為省份
else
sql="select "
sql=sql&" ClientProvince, COUNT(ClientID) AS totalnum FROM Client "
sql=sql&" GROUP BY ClientProvince"
end if
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,3
''獲得記錄的總記錄數(shù)
total=rs.recordcount
''設(shè)置頁(yè)面的記錄數(shù)
rs.pagesize=20
''獲得總頁(yè)面數(shù)
pcount = rs.pagecount
'獲取到達(dá)的頁(yè)面
if request("move")<>"" and request("page")<>"" then
select case request("move")
case "0"
page=1
case "1"
page=cint(request("page")) -1
if page<1 then page=1
case "2"
page=cint(request("page")) +1
if page>pcount then page=cint(pcount)
case "3"
page=cint(pcount)
end select
else
page=1
end if
%>
<input type="Hidden" name="page" value=<%=page%>>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="right">
<td >
<%if page<>1 and pcount>1 then%>
<a href="JavaScript:cmd_firstpage()">首頁(yè)</a>
<%end if%>
<%if page<>1 and pcount>1 then%>
<a href="JavaScript:cmd_prevpage()">上一頁(yè)</a>
<%end if%>
<%if page< pcount and pcount<>1 then%>
<a href="JavaScript:cmd_nextpage()">下一頁(yè)</a>
<%end if%>
<%if pcount>1 and pcount<>page then%>
<a href="JavaScript:cmd_endpage()">末頁(yè)</a>
<%end if%>
當(dāng)前頁(yè)數(shù):<%=page%> ,總共頁(yè)數(shù): <%=pcount%>,記錄總數(shù): <%=total%>
</td>
</tr>
</table>
<table class=tablelist border="0" cellspacing="1" cellpadding="1">
<tr class=tablelist_tr>
<td height="20" class="list_white">
<% if request("S_City")<>"" then
select case trim(request("S_City"))
case "0" response.Write("國(guó)家")
case "1" response.Write("省份")
case "2" response.Write("城市")
end select
else
response.Write("省份")
end if
%>
</td>
<td height="20" class="list_white"><div align="right">客戶數(shù)量</div></td>
<td height="20" class="list_white"><div align="right">客戶總銷售額</div></td>
</tr>
<%
'判斷記錄是否為空,如果為空則結(jié)束顯示
if not rs.eof then
'將記錄集定位在要顯示的頁(yè)面
rs.AbsolutePage=page
'利用for循環(huán)顯示記錄信息
for i=1 to rs.pagesize
if rs.eof then exit for
%>
<tr>
<td height="20" class="tablelist_td1">
<%
'根據(jù)傳遞過(guò)來(lái)的統(tǒng)計(jì)對(duì)象分別顯示其相應(yīng)的字段
'并且將統(tǒng)計(jì)對(duì)象的值和對(duì)象名稱保存在變量values中,以便在后面的客戶總銷售額中使用
select case trim(request("S_City"))
case "0"
response.Write rs("Clientnation")
values=trim(rs("Clientnation"))&"0"
case "1"
response.Write rs("ClientProvince")
values=trim(rs("ClientProvince"))&"1"
case "2"
response.Write rs("ClientCity")
values=trim(rs("ClientCity"))&"2"
case else
response.Write rs("ClientProvince")
values=trim(rs("ClientProvince"))&"1"
end select
%>
</td>
<td height="20" class="tablelist_td1"><div align="right"><%=rs("totalnum")%></div></td>
<!-- 利用子定義函數(shù)顯示該統(tǒng)計(jì)對(duì)象的銷售總額 -->
<td height="20" class="tablelist_td1"><div align="right"><%=showareaclientmoney(values)%></div></td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
end if
%>
</table>
<input type="hidden" name="opstatus" value="ok">
<input type="hidden" name="type_kind" value="">
</form>
</td>
</table>
</body>
<script language="JavaScript">
function showchart()
{
fm.type_kind.value="area"
fm.opstatus.value="query";
fm.action="show_client.asp";
fm.target="_blank"
fm.submit();
}
function cmd_search()
{
window.document.fm.target="_self"
window.document.fm.opstatus.value="query";
window.document.fm.action="analyse_client_area.asp";
window.document.fm.submit();
}
function gomenu()
{
window.location="../menu.asp";
}
function cmd_firstpage()
{
window.document.fm.opstatus.value="query";
window.document.fm.action="analyse_client_area.asp?move=0";
window.document.fm.target="_self"
window.document.fm.submit();
}
function cmd_prevpage()
{
window.document.fm.opstatus.value="query";
window.document.fm.action="analyse_client_area.asp?move=1";
window.document.fm.target="_self"
window.document.fm.submit();
}
function cmd_nextpage()
{
window.document.fm.opstatus.value="query";
window.document.fm.action="analyse_client_area.asp?move=2";
window.document.fm.target="_self"
window.document.fm.submit();
}
function cmd_endpage()
{
window.document.fm.opstatus.value="query";
window.document.fm.action="analyse_client_area.asp?move=3";
window.document.fm.target="_self"
window.document.fm.submit();
}
</script>
</html>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -