<!--#include file="conn/conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
qyear=request.Form("year")
if qyear<>"" then
	'查询条件判断'
		sql="select sum(je) as sumje,sum(lr) as sumlr,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="index.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">
<title>年销售额及利润折线图分析</title>
</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">
    &nbsp;当前位置：查询统计> 年销售额及利润分析 &gt;&gt;&gt;</td>
  </tr>
      <form name="form2" method="post" action="">
  <tr> 
    <td height="30" colspan="6">&nbsp;请选择要进行分析的年份：
      <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("line");               //调用charts()函数
function charts(type){
if (type=="line"){
	chart.chartType=3; }     //chartType是对象chart的属性：表示图形类型
if (type=="pillar" ){
	chart.chartType=1; 
}
chart.ColumnCount=2;    //ColumnCount是对象chart的属性：表示设置与图表关联的当前数据网格中的列数。
chart.Title="<%=qyear%>年销售额及利润分析表";   //图表标题
chart.rowcount=<%=counts%>;             //rowcount属性：数据行个数。
chart.row=<%=i%>;                       //row属性：当前数据行
chart.rowlabel="<%=rs("xsmonth")%>月份"; //rowlabel属性：返回/设置一个数据标签，该标签用来标识图表中当前数据点。横坐标值
chart.Data=<%=rs("sumje")%>;            //Data属性：当前数据点的值。纵坐标值
chart.Data=<%=rs("sumlr")%>;            //Data属性：当前数据点的值。纵坐标值
chart.Footnote="注：纵坐标为销售额，单位为(元) ；空缺的月份没有销售额"
}
</script>
<%
  rs.movenext       '移到下一条记录
  next            
%>
&nbsp;</td>
  </tr>

</table> 
	</td>
  </tr>
</table>
<% end if  %>
</body>
</html>
