市长热线演示版

ZuoXiWorkTotal.ashx.cs 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Text;
  6. using System.Data;
  7. namespace HySoft.BaseCallCenter.Web.reportmanage.operationdata.controls
  8. {
  9. /// <summary>
  10. /// ZuoXiWorkTotal 的摘要说明
  11. /// </summary>
  12. public class ZuoXiWorkTotal : IHttpHandler
  13. {
  14. public void ProcessRequest(HttpContext context)
  15. {
  16. context.Response.ContentType = "text/plain";
  17. string action = context.Request.QueryString["action"];
  18. switch (action)
  19. {
  20. case "getlist":
  21. context.Response.Write(GetDataListHtml(context));//读取数据
  22. break;
  23. }
  24. }
  25. public string GetDataListHtml(HttpContext context)
  26. {
  27. StringBuilder htmlReport = new StringBuilder();//存储生成的HTML
  28. htmlReport.Append("<table cellspacing='0' cellpadding='0' border='1' width='100%'><tr height='35'>");
  29. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>部门</td>");
  30. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>坐席</td>");
  31. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>坐席工号</td>");
  32. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>呼入电话数</td>");
  33. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>坐席接通量</td>");
  34. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>呼损量</td>");
  35. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>接通率</td>");
  36. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>呼损率</td>");
  37. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>平均排队时间</td>");
  38. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>接听通话次数</td>");
  39. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>通话分钟数</td>");
  40. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>通话秒数</td>");
  41. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>平均接听通话秒数</td>");
  42. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>平均振铃秒数</td>");
  43. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>呼入占有率</td>");
  44. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>用户评价</td>");
  45. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>坐席登录次数</td>");
  46. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>工作时长分钟数</td>");
  47. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>平均操作分钟数</td>");
  48. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>置忙次数</td>");
  49. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>休息时长分钟数</td>");
  50. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>置忙平均休息分钟数</td>");
  51. htmlReport.Append("<td style='height: 18px; background-color: #D5EDFE; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 3px 3px 3px 3px; text-align: center;'>质检平均成绩</td>");
  52. htmlReport.Append("</tr>");
  53. try
  54. {
  55. string txtStartTime = context.Request.QueryString["txtStartTime"];
  56. string txtEndTime = context.Request.QueryString["txtEndTime"];
  57. string sqltimeCallRecords = "";
  58. if (txtStartTime != null && txtStartTime.Trim() != "")
  59. {
  60. sqltimeCallRecords += " and CONVERT(varchar , TimeAlerting, 120)>=CONVERT(varchar , '" + txtStartTime.Trim() + " 00:00:01', 120) ";
  61. }
  62. if (txtEndTime != null && txtEndTime.Trim() != "")
  63. {
  64. sqltimeCallRecords += " and CONVERT(varchar , TimeAlerting, 120)<=CONVERT(varchar , '" + txtEndTime.Trim() + " 23:59:59', 120) ";
  65. }
  66. int ijtcs=0;//接听通话次数
  67. int ithms=0;//通话秒数
  68. int izlms=0;//振铃秒数
  69. int ipjjtms = 0;//平均接听秒数
  70. int ipjzlms = 0;//平均振铃秒数
  71. double ihrzyl = 0.00;//呼入占有率
  72. int izxdlcs = 0;//坐席登录次数
  73. int idlsc = 0;//登录时长
  74. int iWorktime = 0;//工作时长
  75. int izmcs = 0;//置忙次数
  76. int ixxsc = 0;//休息时长
  77. int ipjczsc = 0;//平均操作时长
  78. int ipjzmxxsc = 0;//平均置忙休息时长
  79. int itrunkct = 0;//总数
  80. int itrunkjj = 0;//总接听
  81. int itrunkhs = 0;//呼损量
  82. int itrunkpjsc=0;//平均排队时间
  83. double itrunkjtl = 0.00;//接通率
  84. double itrunkhsl = 0.00;//互损率
  85. double itrunkpjpd = 0.00;//平均排队
  86. DataTable dtdpt = null;
  87. if (context.Request.QueryString["dpt"] != null && context.Request.QueryString["dpt"].ToString() != "")
  88. {
  89. dtdpt = DBUtility.DbHelperSQL.Query("select F_DeptId,F_DeptName,F_Remark from T_Sys_Department where F_ParentId!=0 and F_DeptId=" + context.Request.QueryString["dpt"].ToString()).Tables[0];
  90. }
  91. else
  92. {
  93. dtdpt = DBUtility.DbHelperSQL.Query("select F_DeptId,F_DeptName,F_Remark from T_Sys_Department where F_ParentId!=0").Tables[0];
  94. }
  95. if (dtdpt != null && dtdpt.Rows.Count > 0)
  96. {
  97. foreach (DataRow dr in dtdpt.Rows)
  98. {
  99. DataTable dt = new DataTable();
  100. string sql = "SELECT F_UserCode,F_UserName,F_WorkNumber,F_UserId FROM T_Sys_UserAccount where f_seatFlag=1 and F_DeptId=" + dr["F_DeptId"] + " and F_WorkNumber!='' order by F_WorkNumber asc";
  101. dt = DBUtility.DbHelperSQL.Query(sql).Tables[0];
  102. for (int i = 0; i < dt.Rows.Count; i++)
  103. {
  104. if (!string.IsNullOrEmpty(dt.Rows[i]["F_WorkNumber"].ToString()))
  105. {
  106. htmlReport.AppendFormat("<tr>");
  107. if (i == 0)
  108. {
  109. htmlReport.Append("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;' ");
  110. if (dt.Rows.Count > 1)
  111. {
  112. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  113. }
  114. htmlReport.Append(">" + dr["F_DeptName"].ToString() + "</td>");
  115. }
  116. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", dt.Rows[i]["F_UserName"].ToString());
  117. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", dt.Rows[i]["F_WorkNumber"].ToString());
  118. if (i == 0)
  119. {//呼入电话
  120. string strsql = "";
  121. if (txtStartTime != null && txtStartTime.Trim() != "")
  122. {
  123. strsql += " and CONVERT(varchar , TimeCallIn, 120)>=CONVERT(varchar , '" + txtStartTime.Trim() + " 00:00:01', 120) ";
  124. }
  125. if (txtEndTime != null && txtEndTime.Trim() != "")
  126. {
  127. strsql += " and CONVERT(varchar , TimeCallIn, 120)<=CONVERT(varchar , '" + txtEndTime.Trim() + " 23:59:59', 120) ";
  128. }
  129. DataTable dtTrunk = DBUtility.DbHelperSQL.Query("select COUNT(*) as ct,(select COUNT(*) from rep_trunk_call_in where PeriodTalking>0 and CalleeNum='" + dr["F_Remark"] + "' "+strsql+") as jt,SUM(DATEDIFF(Second,timewantagent,timeconnected)) as dd from rep_trunk_call_in where CalleeNum='" + dr["F_Remark"] + "' "+strsql).Tables[0];
  130. if (dtTrunk != null && dtTrunk.Rows.Count > 0)
  131. {
  132. if (dtTrunk.Rows[0]["ct"].ToString() != "")
  133. {
  134. itrunkct = int.Parse(dtTrunk.Rows[0]["ct"].ToString());
  135. }
  136. else
  137. {
  138. itrunkct = 0;
  139. }
  140. if (dtTrunk.Rows[0]["jt"].ToString() != "")
  141. {
  142. itrunkjj = int.Parse(dtTrunk.Rows[0]["jt"].ToString());
  143. }
  144. else
  145. {
  146. itrunkjj = 0;
  147. }
  148. if (dtTrunk.Rows[0]["dd"].ToString() != "")
  149. {
  150. itrunkpjsc = int.Parse(dtTrunk.Rows[0]["dd"].ToString());
  151. }
  152. else
  153. {
  154. itrunkpjsc = 0;
  155. }
  156. }
  157. itrunkhs = itrunkct - itrunkjj;
  158. if (itrunkct != 0)
  159. {
  160. itrunkjtl = itrunkjj / double.Parse(itrunkct.ToString());
  161. itrunkhsl = itrunkhs / double.Parse(itrunkct.ToString());
  162. itrunkpjpd = itrunkpjsc / double.Parse(itrunkct.ToString());
  163. }
  164. else
  165. {
  166. itrunkjtl = 0.00;
  167. itrunkhsl = 0.00;
  168. itrunkpjpd = 0.00;
  169. }
  170. htmlReport.Append("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;' ");
  171. if (dt.Rows.Count > 1)
  172. {
  173. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  174. }
  175. htmlReport.Append(">" + itrunkct + "</td>");
  176. htmlReport.Append("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;' ");
  177. if (dt.Rows.Count > 1)
  178. {
  179. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  180. }
  181. htmlReport.Append(">" + itrunkjj + "</td>");
  182. htmlReport.Append("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;' ");
  183. if (dt.Rows.Count > 1)
  184. {
  185. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  186. }
  187. htmlReport.Append(">" + itrunkhs + "</td>");
  188. htmlReport.Append("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;' ");
  189. if (dt.Rows.Count > 1)
  190. {
  191. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  192. }
  193. htmlReport.Append(">" +(itrunkjtl*100).ToString("0.00") + "%</td>");
  194. htmlReport.Append("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;' ");
  195. if (dt.Rows.Count > 1)
  196. {
  197. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  198. }
  199. htmlReport.Append(">" + (itrunkhsl*100).ToString("0.00") + "%</td>");
  200. htmlReport.Append("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;' ");
  201. if (dt.Rows.Count > 1)
  202. {
  203. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  204. }
  205. htmlReport.Append(">" + itrunkpjpd.ToString("0.00") + "</td>");
  206. }
  207. DataTable dtext = DBUtility.DbHelperSQL.Query("select COUNT(*) as ct,SUM(PeriodTalking) as sc,SUM(PeriodAlerting) as pa from rep_ext_call_in where CalleeAgentID=" + dt.Rows[i]["F_WorkNumber"] + " " + sqltimeCallRecords).Tables[0];
  208. if (dtext != null && dtext.Rows.Count > 0)
  209. {
  210. if (dtext.Rows[0]["ct"].ToString() != "")
  211. {
  212. ijtcs = int.Parse(dtext.Rows[0]["ct"].ToString());//接听次数
  213. }
  214. else
  215. {
  216. ijtcs = 0;
  217. }
  218. if (dtext.Rows[0]["sc"].ToString() != "")
  219. {
  220. ithms = int.Parse(dtext.Rows[0]["sc"].ToString());//通话秒数
  221. }
  222. else
  223. {
  224. ithms = 0;
  225. }
  226. if (dtext.Rows[0]["pa"].ToString() != "")
  227. {
  228. izlms = int.Parse(dtext.Rows[0]["pa"].ToString());//振铃秒数
  229. }
  230. else
  231. {
  232. izlms = 0;
  233. }
  234. }
  235. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", ijtcs.ToString());
  236. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", (ithms / 60).ToString());
  237. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", ithms.ToString());
  238. if (ijtcs != 0)
  239. {
  240. ipjjtms = ithms / ijtcs;//平均接通秒数
  241. ipjzlms = izlms / ijtcs;//平均振铃秒数
  242. }
  243. else
  244. {
  245. ipjjtms = 0;//平均接通秒数
  246. ipjzlms = 0;//平均振铃秒数
  247. }
  248. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", ipjjtms.ToString());
  249. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", ipjzlms.ToString());
  250. //坐席登录次数
  251. DataTable dtAgent = DBUtility.DbHelperSQL.Query("select COUNT(*) as dl,SUM(LoginTimes) as dlsc,SUM(reposenum) as zm,SUM(ReposeTimes) as xx from rep_agent_detail where AgentId=" + dt.Rows[i]["F_WorkNumber"] + " " + sqltimeCallRecords.Replace("TimeAlerting", "TimeLogin")).Tables[0];
  252. if (dtAgent != null && dtAgent.Rows.Count > 0)
  253. {
  254. if (dtAgent.Rows[0]["dl"] != null && dtAgent.Rows[0]["dl"].ToString() != "")
  255. {
  256. izxdlcs = int.Parse(dtAgent.Rows[0]["dl"].ToString());//登录次数
  257. }
  258. else
  259. {
  260. izxdlcs = 0;
  261. }
  262. if (dtAgent.Rows[0]["dlsc"] != null && dtAgent.Rows[0]["dlsc"].ToString() != "")
  263. {
  264. idlsc = int.Parse(dtAgent.Rows[0]["dlsc"].ToString());//登录时长
  265. }
  266. else {
  267. idlsc = 0;
  268. }
  269. if (dtAgent.Rows[0]["zm"] != null && dtAgent.Rows[0]["zm"].ToString() != "")
  270. {
  271. izmcs = int.Parse(dtAgent.Rows[0]["zm"].ToString());//置忙次数
  272. }
  273. else
  274. {
  275. izmcs = 0;
  276. }
  277. if (dtAgent.Rows[0]["xx"] != null && dtAgent.Rows[0]["xx"].ToString() != "")
  278. {
  279. ixxsc = int.Parse(dtAgent.Rows[0]["xx"].ToString());//休息时长
  280. }
  281. else
  282. {
  283. ixxsc = 0;
  284. }
  285. }
  286. iWorktime = idlsc - ixxsc;//工作时长
  287. if (izxdlcs != 0)
  288. {
  289. ipjczsc = iWorktime / izxdlcs;//平均操作秒数
  290. }
  291. else
  292. {
  293. ipjczsc = 0;
  294. }
  295. if (izmcs != 0)
  296. {
  297. ipjzmxxsc = ixxsc / izmcs;//置忙平均操作时长
  298. }
  299. else
  300. {
  301. ipjzmxxsc = 0;
  302. }
  303. //呼入占有率
  304. if (iWorktime != 0)
  305. {
  306. ihrzyl = ithms / Convert.ToDouble(iWorktime);
  307. }
  308. else
  309. {
  310. ihrzyl = 0.00;
  311. }
  312. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", (ihrzyl * 100).ToString("0.00") + "%");
  313. //用户评价
  314. string sqlpj = "";
  315. if (txtStartTime != null && txtStartTime.Trim() != "")
  316. {
  317. sqlpj += " and CONVERT(varchar , BeginTime, 120)>=CONVERT(varchar , '" + txtStartTime.Trim() + " 00:00:01', 120) ";
  318. }
  319. if (txtEndTime != null && txtEndTime.Trim() != "")
  320. {
  321. sqlpj += " and CONVERT(varchar , BeginTime, 120)<=CONVERT(varchar , '" + txtEndTime.Trim() + " 23:59:59', 120) ";
  322. }
  323. object obj = DBUtility.DbHelperSQL.GetSingle("select count(*) from T_Call_CallRecords where MYD is not null and userid in(select f_userid from T_Sys_UserAccount where f_worknumber='" + dt.Rows[i]["F_WorkNumber"] + "') " + sqlpj);
  324. string myd = "";
  325. if (obj != null)
  326. {
  327. myd = obj.ToString();
  328. }
  329. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", myd);
  330. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", izxdlcs.ToString());
  331. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", (iWorktime / 60).ToString());
  332. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", (ipjczsc / 60).ToString());
  333. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", izmcs.ToString());
  334. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", (ixxsc / 60).ToString());
  335. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", (ipjzmxxsc / 60).ToString());
  336. DataSet dszj = DBUtility.DbHelperSQL.Query("select convert(int,SUM(f_qcscore)) as fs,COUNT(*) as fsct from T_Call_CallRecords where F_QCState=1 and UserId=" + dt.Rows[i]["F_UserId"] + sqlpj);
  337. int zfs = 0;
  338. if (dszj != null && dszj.Tables.Count > 0)
  339. {
  340. DataTable dtzj = dszj.Tables[0];
  341. if (dtzj.Rows.Count > 0 && dtzj.Rows[0]["fs"].ToString() != "" && dtzj.Rows[0]["fsct"].ToString() != "")
  342. {
  343. zfs = Convert.ToInt32(dtzj.Rows[0]["fs"].ToString()) / int.Parse(dtzj.Rows[0]["fsct"].ToString());
  344. }
  345. }
  346. htmlReport.AppendFormat("<td align='center'style='border-top: 0px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; padding-left: 2px; height: 18px; padding-top: 3px; padding-bottom: 3px;'>{0}</td>", zfs.ToString());
  347. htmlReport.Append("</tr>");
  348. }
  349. }
  350. }
  351. }
  352. htmlReport.Append("</table>");
  353. }
  354. catch { }
  355. return htmlReport.ToString();
  356. }
  357. public bool IsReusable
  358. {
  359. get
  360. {
  361. return false;
  362. }
  363. }
  364. }
  365. }