日期:2014-05-17 浏览次数:21104 次
private void simpleButton1_Click(object sender, EventArgs e)
{
string reportsales = "select cast(year(a1.SaleBillMakeDate)as varchar(4))+'-'+cast(month(a1.SaleBillMakeDate)as varchar(2)) as 月份,SUM(a1.salebillqty) as 销售,SUM(a1.SaleBillPrice) 销售金额" +
" from d_sales a1,b_sku a2"+
" where a1.skucode=a2.skucode";
if (lookupmaintype.EditValue != "")
{
reportsales = reportsales + " and a2.MainTypeCode='" + lookupmaintype.EditValue + "' ";
}
else { }
reportsales=reportsales+" group by cast(year(a1.SaleBillMakeDate)as varchar(4))+'-'+cast(month(a1.SaleBillMakeDate)as varchar(2))"+
" order by cast(year(a1.SaleBillMakeDate)as varchar(4))+'-'+cast(month(a1.SaleBillMakeDate)as varchar(2))";
sql.sqloperate sales = new sql.sqloperate();
DataTable da = new DataTable();
sales.sqldataadapter(reportsales).Fill(da);
chartControl1.Series.Clear();
DevExpress.XtraCharts.Series series1 = new DevExpress.XtraCharts.Series("销售数量", DevExpress.XtraCharts.ViewType.Bar);
DevExpress.XtraCharts.Series series2 = new DevExpress.XtraCharts.Series("销售金额", DevExpress.XtraCharts.ViewType.Bar);
chartControl1.DataSource = da;
series1.ValueDataMembers.AddRange(new string[] {"销售"});
series2.ValueDataMembers.AddRange(new string[] { "销售金额" });
series1.ArgumentDataMember = "月份";
series2.ArgumentDataMember = "月份";
chartControl1.Seri