public ActionResult ServiceSlipAnalysis( DateTime?beginTime, DateTime?endTime, bool export = false) { var orgId = string.Empty; switch (GetHighLV) { case UserLV_ENUM.省级: case UserLV_ENUM.市级: case UserLV_ENUM.区级: break; case UserLV_ENUM.务厅级: var listOrgs = SYS_HALL_DAL.GetListByUserId(UserState.UserID); if (listOrgs.Count == 1) { orgId = listOrgs[0].HALL_NO; } return(RedirectToAction("ServiceSlipAnalysis_Person", new { orgId = orgId })); } base.DateTimeInit(ref beginTime, ref endTime); var mainTielt = GetOrgName(null, 2); ViewBag.MainTitle = GetTitleName(mainTielt, "业务差错分析", beginTime.GetValueOrDefault(), endTime.GetValueOrDefault()); var subtitle = GetTitleName(mainTielt, "", beginTime.GetValueOrDefault(), endTime.GetValueOrDefault(), false); if (export) { return(ExportData(subtitle, "服务厅", beginTime.GetValueOrDefault(), endTime.GetValueOrDefault(), null)); } var data = new Statistics_DAL().GetStatistics_ServiceSlipAnalysis(beginTime, endTime, UserState.UserID); //var exceltitle = GetTitleName(mainTielt, "业务办理分析", beginTime.GetValueOrDefault(), endTime.GetValueOrDefault(), false); // 所有质量类型 var typeList = CHK_QUALITY_CON_Dao.FindList(); ViewData["typeList"] = typeList; // 所有事项大类 var itemTypeList = SYS_DLSERIAL_Dao.FindList(); ViewData["itemTypeList"] = itemTypeList; var list = data.GroupBy(m => m.HALL_NAM); SetChart(list, typeList, "服务厅业务差错分析", beginTime.GetValueOrDefault(), endTime.GetValueOrDefault(), subtitle); return(View(list)); }
public ActionResult ServiceSlipAnalysis_Person( string orgId, DateTime?beginTime, DateTime?endTime, bool export = false ) { ViewBag.HallNo = orgId; base.DateTimeInit(ref beginTime, ref endTime); var mainTielt = GetOrgName(orgId, null); ViewBag.MainTitle = GetTitleName(mainTielt, "业务差错分析", beginTime.GetValueOrDefault(), endTime.GetValueOrDefault()); var subtitle = GetTitleName(mainTielt, "", beginTime.GetValueOrDefault(), endTime.GetValueOrDefault(), false); if (export) { return(ExportData(subtitle, "员工名称", beginTime.GetValueOrDefault(), endTime.GetValueOrDefault(), orgId)); } var listStatistics = new Statistics_DAL().GetStatistics_ServiceSlipAnalysisList(beginTime, endTime, UserState.UserID, orgId, null); //var exceltitle = GetTitleName(mainTielt, "业务办理分析", beginTime.GetValueOrDefault(), endTime.GetValueOrDefault(), false); var dic = listStatistics.GroupBy(m => m.STAFF_NAM); // 所有质量类型 var typeList = CHK_QUALITY_CON_Dao.FindList(); ViewData["typeList"] = typeList; // 所有事项大类 var itemTypeList = SYS_DLSERIAL_Dao.FindList(); ViewData["itemTypeList"] = itemTypeList; SetStaffChart(listStatistics, typeList, "员工业务差错分析", beginTime.GetValueOrDefault(), endTime.GetValueOrDefault(), subtitle); return(View(dic)); }
/// <summary> /// 导出数据 /// </summary> /// <param name="title"></param> /// <param name="fileName"></param> /// <param name="beginTime"></param> /// <param name="endTime"></param> /// <returns></returns> public ActionResult ExportData(string title, string Listname, DateTime beginTime, DateTime endTime, string orgId) { var typeList = CHK_QUALITY_CON_Dao.FindList(); var itemTypeList = SYS_DLSERIAL_Dao.FindList(); var lineTable = new DataTable(); lineTable.Columns.Add("序号", typeof(string)); lineTable.Columns.Add(Listname, typeof(string)); lineTable.Columns.Add("事项大类", typeof(string)); foreach (var item in typeList) { lineTable.Columns.Add(item.QUALITY_NAM, typeof(int)); } if (Listname == "服务厅") { var data = new Statistics_DAL().GetStatistics_ServiceSlipAnalysis(beginTime, endTime, UserState.UserID); var dics = data.GroupBy(m => m.HALL_NAM); var i = 1; foreach (var dic in dics) { var items = dic.ToList(); var statistics = items.FirstOrDefault(); for (var j = 1; j < itemTypeList.Count(); j++) { var r = lineTable.NewRow(); r["序号"] = i; r[Listname] = statistics.HALL_NAM; r["事项大类"] = itemTypeList[j].DLS_SERIALNAME; foreach (var item in typeList) { var def = items.FirstOrDefault( m => m.QUALITY_CD == item.QUALITY_CD && m.SSDLSERIALID == itemTypeList[j].DLS_SERIALID); r[item.QUALITY_NAM] = def == null ? 0 : def.AMOUNT; } lineTable.Rows.Add(r); i++; } } } else { var listStatistics = new Statistics_DAL().GetStatistics_ServiceSlipAnalysisList(beginTime, endTime, UserState.UserID, orgId, null); var dics = listStatistics.GroupBy(m => m.STAFF_NAM); var i = 1; foreach (var dic in dics) { var items = dic.ToList(); var statistics = items.FirstOrDefault(); for (var j = 1; j < itemTypeList.Count(); j++) { var r = lineTable.NewRow(); r["序号"] = i; r[Listname] = statistics.STAFF_NAM; r["事项大类"] = itemTypeList[j].DLS_SERIALNAME; foreach (var item in typeList) { var def = items.FirstOrDefault( m => m.QUALITY_CD == item.QUALITY_CD && m.DLS_SERIALID == itemTypeList[j].DLS_SERIALID); r[item.QUALITY_NAM] = def == null ? 0 : def.AMOUNT; } lineTable.Rows.Add(r); i++; } } } return(AsposeExcelHelper.OutFileToRespone(lineTable, title)); }