zoukankan      html  css  js  c++  java
  • 图形报表的(做法c#)

     
    注意:要引用 dll:FusionCharts.dll  
         要添加chart文件夹 :里面包含chart图标需要用的 js
    
    页面代码: <div class="tabsContent" layouth="100"> <div id="Charts_show" style=" float:left; 100%; top:5px; overflow: auto;"> <%=ViewData["ChatsXML"] %> </div> </div> /// <summary> /// 客服数据统计 /// </summary> /// <returns></returns> public ActionResult CountInfo(string beginTime, string endTime) { string Sql = "select br.USER_ID,bb.ROLE_NAME,bu.USER_NAME";//0,1,2; string Sql1 = " from dbo.BASE_USER_ROLE br left join dbo.BASE_USERS bu on br.USER_ID=bu.USER_ID left join dbo.BASE_ROLES bb on bb.ROLE_ID=br.ROLE_ID"; string sql2 = " where bb.ROLE_NAME='客服专员' group by bu.USER_NAME,br.USER_ID,bb.ROLE_NAME "; string ss = ""; string aa = ""; string bb = ""; string cc = ""; Session["CountInfo"] = null; if (!String.IsNullOrEmpty(beginTime)) { ss += " and DateDiff(dd,'" + beginTime + "', ss.CREATE_TIME)>=0 "; aa += " and DateDiff(dd,'" + beginTime + "', aa.CREATE_TIME)>=0 "; bb += " and DateDiff(dd,'" + beginTime + "', bb.CREATE_TIME)>=0"; cc += " and DateDiff(dd,'" + beginTime + "', cc.CREATE_TIME)>=0"; } if (!String.IsNullOrEmpty(endTime)) { ss += " and DateDiff(dd,ss.CREATE_TIME,'" + endTime + "')>=0"; aa += " and DateDiff(dd,aa.CREATE_TIME,'" + endTime + "')>=0 "; bb += " and DateDiff(dd,bb.CREATE_TIME,'" + endTime + "')>=0 "; cc += " and DateDiff(dd,cc.CREATE_TIME,'" + endTime + "')>=0 "; } Sql += " ,(select count(*)from dbo.CUSTOMER ss where ss.CREATE_USER=bu.USER_NAME and ss.GCFLAG=0 " + ss + ") as '录入客户数', ";//3; Sql += " (select count(*)from dbo.CUS_CON aa where aa.CREATE_USER=bu.USER_NAME and aa.GCFLAG=0 " + aa + ") as '客户咨询数', ";//4; Sql += " (select count(*)from dbo.CUS_APPOINT bb where bb.CREATE_USER=bu.USER_NAME and bb.GCFLAG=0 " + bb + ") as '客户预约数', ";//5 Sql += " (select count(*)from dbo.CUS_FOLLOW cc where cc.CREATE_USER=bu.USER_NAME and cc.GCFLAG=0 " + cc + ") as '客户回访数' ";//6 List<cusCountInfo> CEntity = new List<cusCountInfo>(); IList list = BaseService.ExecuteQuery(Sql + Sql1 + sql2); PagedResult pagedResult = new PagedResult(); if (list.Count > 0) { int index = 0; for (int i = 0; i < list.Count; i++) { object[] ob = list[i] as object[]; cusCountInfo cci = new cusCountInfo(); cci.RowId = index++; cci.Name = ob[2].ToString(); cci.cusCount = ob[3].ToString();//录入客户 cci.cusConCount = ob[4].ToString();//客户咨询 cci.cusAppointCount = ob[5].ToString();//客户预约 cci.cusFollwCount = ob[6].ToString();//客户跟进 CEntity.Add(cci); } }; pagedResult.Result = CEntity; ViewData["pager"] = pagedResult; TempData["CustomerKFReport"] = pagedResult.Result; Session["CountInfo"] = pagedResult.Result; ViewData["beginTime"] = beginTime == null ? "" : beginTime; ViewData["endTime"] = endTime == null ? "" : endTime; return View(); } /// <summary> /// 获取客服工作量图形展示 /// </summary> /// <returns></returns> public ActionResult CountImageInfo() { // Fzh.Crm.HtmlHelper.DBHelp.Util util = new Fzh.Crm.HtmlHelper.DBHelp.Util(); StringBuilder strXML = new StringBuilder(); strXML.Append("<chart caption='客服工作量统计' xAxisName='客服姓名' yAxisName='次数' rotateYAxisName='0' bgSWF='../../../../Charts/index-logo.png' canvasBgAlpha='60' canvasBorderColor='333333' canvasBorderThickness='0' divLineColor='333333'>"); string categories = ""; string vistCount = ""; string groupCount = ""; string intentCount = ""; string favorCount = ""; categories = "<categories>"; vistCount = "<dataset seriesName='录入客户'>"; groupCount = "<dataset seriesName='客户预约'>"; intentCount = "<dataset seriesName='客户咨询'>"; favorCount = "<dataset seriesName='客户回访'>"; List<cusCountInfo> list = null; if (Session["CountInfo"] != null) { list = Session["CountInfo"] as List<cusCountInfo>; foreach (cusCountInfo item in list) { #region[charts 参数] categories += " <category label='" + item.Name + "' />"; vistCount += " <set value='" + item.cusCount + "'/>"; groupCount += " <set value='" + item.cusAppointCount + "'/>"; intentCount += " <set value='" + item.cusConCount + "'/>"; favorCount += " <set value='" + item.cusFollwCount + "'/>"; #endregion } } else { #region[charts 参数] categories += " <category label='' />"; vistCount += " <set value=''/>"; groupCount += " <set value=''/>"; intentCount += " <set value=''/>"; favorCount += " <set value=''/>"; #endregion } categories += "</categories>"; vistCount += "</dataset>"; groupCount += "</dataset>"; intentCount += "</dataset>"; favorCount += "</dataset>"; strXML.Append(categories); strXML.Append(vistCount); strXML.Append(groupCount); strXML.Append(intentCount); strXML.Append(favorCount); strXML.Append("<styles>"); strXML.Append("<definition>"); strXML.Append("<style name='myCaptionAnim' type='animation' param='_y' easing='Bounce' start='0' duration='1'/>"); strXML.Append("</definition>"); strXML.Append("<application>"); strXML.Append("<apply toObject='Caption' styles='myCaptionAnim' />"); strXML.Append("</application>"); strXML.Append("</styles>"); // Finally, close <chart> element strXML.Append("</chart>"); int Hcount = 0; if (list == null) { Hcount = 80 * 5 + 200; } else { Hcount = 80 * list.Count + 200; } //Create the chart - Pie 3D Chart with data from strXML ViewData["ChatsXML"] = FusionCharts.RenderChart("../../../../Charts/MSColumn3D.swf?ChartNoDataText=无任何客服工作量统计", "", strXML.ToString(), "BlockClickSum", Hcount.ToString(), "500", false, true, false); return View(); }
  • 相关阅读:
    ThinkPHP如果表名有下划线需要用Model应该怎么做?
    JS三级联动实例
    Sublime的使用!emmet常用快捷键梳理
    MUI极简的JS函数
    Atitit 自然语言处理原理与实现 attilax总结
    Atitit 自然语言处理原理与实现 attilax总结
    Atitit  自动化gui 与 发帖机 技术
    Atitit  自动化gui 与 发帖机 技术
    Atitit 衡量项目的规模
    Atitit 衡量项目的规模
  • 原文地址:https://www.cnblogs.com/gs21Joan/p/3990713.html
Copyright © 2011-2022 走看看