📄 yearxsfx.asp
字号:
<%
set conn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
conn.open application("dsn")
qyear=request.Form("year")
if qyear<>"" then
'查询条件判断
sql="select sum(je) as sumje,month(xsdate) as xsmonth from tab_sell_main where year(xsdate)="&cint(qyear)&" group by month(xsdate)"
rs.open sql,conn,1,3
if rs.eof then%>
<script language="JavaScript">
alert("<%=qyear%>年没有销售记录!")
window.location.href="yearxsfx.asp";
</script>
<%response.End()
else
counts=rs.recordcount
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="97%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolorlight="#9CA6C6" bordercolordark="#CCE3FF">
<tr bgcolor="#FF9933">
<td height="10" colspan="6" class="word_white">
当前位置:查询统计> 年销售额分析 >>></td>
</tr>
<form name="form2" method="post" action="">
<tr>
<td height="30" colspan="6"> 请选择要进行分析的年份:
<select name="year" id="year" >
<%
for i=2000 to 2049%>
<option value="<%=i%>" <%if i=year(date()) then response.Write("selected")%>><%=i%>年</option>
<%next%>
</select>
<input name="Submit" type="submit" class="btn_grey" value="确定分析"></td>
</tr>
</form>
<tr align="center" bgcolor="#C8E3FF">
<td height="14">
<%
if counts>0 then
%>
<object classid="clsid:3A2B370C-BA0A-11D1-B137-0000F8753F5D" name="chart" width="100%" height="300">
<%'定义对象,该对象命名为chart%>
</object>
<%
for i=1 to counts '循环从1循环到counts
%>
<script language="javascript">
charts("pillar"); //调用charts()函数
function charts(type){
if (type=="line"){
chart.chartType=3; } //chartType是对象chart的属性:表示图形类型
if (type=="pillar" ){
chart.chartType=1;
}
chart.ColumnCount=1; //ColumnCount是对象chart的属性:表示设置与图表关联的当前数据网格中的列数
chart.Title="<%=qyear%>年销售额分析表"; //图表标题
chart.rowcount=<%=counts%>; //rowcount属性:数据行个数
chart.row=<%=i%>; //row属性:当前数据行
chart.rowlabel="<%=rs("xsmonth")%>月份"; //rowlabel属性:返回/设置一个数据标签,该标签用来标识图表中当前数据点。横坐标值
chart.Data=<%=rs("sumje")%>; //Data属性:当前数据点的值。纵坐标值
chart.Footnote="注:纵坐标为销售额,单位为(元) ;空缺的月份没有销售额"
}
</script>
<%
rs.movenext '移到下一条记录
next
%>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="97%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="60" align="center">
<form name="form1" method="post" action="">
<input name="pillar" type="button" class="btn_grey" onClick="charts('pillar')" value="柱状图分析">
<input name="line" type="button" class="btn_grey" onClick="charts('line')" value="线性图分析">
</form> </td>
</tr>
</table>
<% end if %>
<div align="center">
<!-- #include file="../bottom.asp"-->
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -