市长热线演示版

ZuoXiWorkTotalNew.ashx.cs 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  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. /// ZuoXiWorkTotalNew 的摘要说明
  11. /// </summary>
  12. public class ZuoXiWorkTotalNew : 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. string strsqlcall = "";
  59. if (txtStartTime != null && txtStartTime.Trim() != "")
  60. {
  61. sqltimeCallRecords += " and CONVERT(varchar , TimeAlerting, 120)>=CONVERT(varchar , '" + txtStartTime.Trim() + " 00:00:01', 120) ";
  62. strsqlcall += " and CONVERT(varchar , BeginTime, 120)>=CONVERT(varchar , '" + txtStartTime.Trim() + " 00:00:01', 120) ";
  63. }
  64. if (txtEndTime != null && txtEndTime.Trim() != "")
  65. {
  66. sqltimeCallRecords += " and CONVERT(varchar , TimeAlerting, 120)<=CONVERT(varchar , '" + txtEndTime.Trim() + " 23:59:59', 120) ";
  67. strsqlcall += " and CONVERT(varchar , BeginTime, 120)<=CONVERT(varchar , '" + txtEndTime.Trim() + " 23:59:59', 120) ";
  68. }
  69. int ijtcs = 0;//接听通话次数
  70. int ithms = 0;//通话秒数
  71. int izlms = 0;//振铃秒数
  72. int ipjjtms = 0;//平均接听秒数
  73. int ipjzlms = 0;//平均振铃秒数
  74. double ihrzyl = 0.00;//呼入占有率
  75. int izxdlcs = 0;//坐席登录次数
  76. int idlsc = 0;//登录时长
  77. int iWorktime = 0;//工作时长
  78. int izmcs = 0;//置忙次数
  79. int ixxsc = 0;//休息时长
  80. int ipjczsc = 0;//平均操作时长
  81. int ipjzmxxsc = 0;//平均置忙休息时长
  82. int itrunkct = 0;//总数
  83. int itrunkjj = 0;//总接听
  84. int itrunkhs = 0;//呼损量
  85. int itrunkpjsc = 0;//平均排队时间
  86. double itrunkjtl = 0.00;//接通率
  87. double itrunkhsl = 0.00;//互损率
  88. double itrunkpjpd = 0.00;//平均排队
  89. DataTable dtdpt = null;
  90. if (context.Request.QueryString["dpt"] != null && context.Request.QueryString["dpt"].ToString() != "")
  91. {
  92. 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];
  93. }
  94. else
  95. {
  96. dtdpt = DBUtility.DbHelperSQL.Query("select F_DeptId,F_DeptName,F_Remark from T_Sys_Department where F_ParentId!=0").Tables[0];
  97. }
  98. if (dtdpt != null && dtdpt.Rows.Count > 0)
  99. {
  100. foreach (DataRow dr in dtdpt.Rows)
  101. {
  102. DataTable dt = new DataTable();
  103. 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";
  104. dt = DBUtility.DbHelperSQL.Query(sql).Tables[0];
  105. for (int i = 0; i < dt.Rows.Count; i++)
  106. {
  107. if (!string.IsNullOrEmpty(dt.Rows[i]["F_WorkNumber"].ToString()))
  108. {
  109. htmlReport.AppendFormat("<tr>");
  110. if (i == 0)
  111. {
  112. 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;' ");
  113. if (dt.Rows.Count > 1)
  114. {
  115. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  116. }
  117. htmlReport.Append(">" + dr["F_DeptName"].ToString() + "</td>");
  118. }
  119. 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());
  120. 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());
  121. if (i == 0)
  122. {//呼入电话
  123. string strsql = "";
  124. if (txtStartTime != null && txtStartTime.Trim() != "")
  125. {
  126. strsql += " and CONVERT(varchar , TimeCallIn, 120)>=CONVERT(varchar , '" + txtStartTime.Trim() + " 00:00:01', 120) ";
  127. }
  128. if (txtEndTime != null && txtEndTime.Trim() != "")
  129. {
  130. strsql += " and CONVERT(varchar , TimeCallIn, 120)<=CONVERT(varchar , '" + txtEndTime.Trim() + " 23:59:59', 120) ";
  131. }
  132. DataTable dtTrunk = DBUtility.DbHelperSQL.Query("select COUNT(*) as ct,SUM(DATEDIFF(Second,timewantagent,timeconnected)) as dd from rep_trunk_call_in where CalleeNum='" + dr["F_Remark"] + "' " + strsql).Tables[0];
  133. DataTable dtcall = DBUtility.DbHelperSQL.Query("select COUNT(*) as ct,(select COUNT(*) from T_Call_CallRecords where CallState=1 and CallType=0 and Remark='" + dr["F_Remark"] + "' " + strsqlcall + ") as jt from T_Call_CallRecords where CallType=0 and Remark='" + dr["F_Remark"] + "' " + strsqlcall).Tables[0];
  134. if (dtcall != null && dtcall.Rows.Count > 0)
  135. {
  136. if (dtcall.Rows[0]["ct"].ToString() != "")
  137. {
  138. itrunkct = int.Parse(dtcall.Rows[0]["ct"].ToString());
  139. }
  140. else
  141. {
  142. itrunkct = 0;
  143. }
  144. if (dtcall.Rows[0]["jt"].ToString() != "")
  145. {
  146. itrunkjj = int.Parse(dtcall.Rows[0]["jt"].ToString());
  147. }
  148. else
  149. {
  150. itrunkjj = 0;
  151. }
  152. if (dtTrunk.Rows.Count>0 && dtTrunk.Rows[0]["dd"].ToString() != "")
  153. {
  154. itrunkpjsc = int.Parse(dtTrunk.Rows[0]["dd"].ToString());
  155. }
  156. else
  157. {
  158. itrunkpjsc = 0;
  159. }
  160. }
  161. itrunkhs = itrunkct - itrunkjj;
  162. if (itrunkct != 0)
  163. {
  164. itrunkjtl = itrunkjj / double.Parse(itrunkct.ToString());
  165. itrunkhsl = itrunkhs / double.Parse(itrunkct.ToString());
  166. itrunkpjpd = itrunkpjsc / double.Parse(itrunkct.ToString());
  167. }
  168. else
  169. {
  170. itrunkjtl = 0.00;
  171. itrunkhsl = 0.00;
  172. itrunkpjpd = 0.00;
  173. }
  174. 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;' ");
  175. if (dt.Rows.Count > 1)
  176. {
  177. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  178. }
  179. htmlReport.Append(">" + itrunkct + "</td>");
  180. 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;' ");
  181. if (dt.Rows.Count > 1)
  182. {
  183. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  184. }
  185. htmlReport.Append(">" + itrunkjj + "</td>");
  186. 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;' ");
  187. if (dt.Rows.Count > 1)
  188. {
  189. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  190. }
  191. htmlReport.Append(">" + itrunkhs + "</td>");
  192. 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;' ");
  193. if (dt.Rows.Count > 1)
  194. {
  195. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  196. }
  197. htmlReport.Append(">" + (itrunkjtl * 100).ToString("0.00") + "%</td>");
  198. 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;' ");
  199. if (dt.Rows.Count > 1)
  200. {
  201. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  202. }
  203. htmlReport.Append(">" + (itrunkhsl * 100).ToString("0.00") + "%</td>");
  204. 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;' ");
  205. if (dt.Rows.Count > 1)
  206. {
  207. htmlReport.Append(" rowspan='" + dt.Rows.Count + "'");
  208. }
  209. htmlReport.Append(">" + itrunkpjpd.ToString("0.00") + "</td>");
  210. }
  211. 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];
  212. DataTable dtCallEvey = DBUtility.DbHelperSQL.Query("select COUNT(*) as ct,SUM(TalkLongTime) as sc from T_Call_CallRecords where CallState=1 and userid=" + dt.Rows[i]["F_UserId"] + " " + strsqlcall).Tables[0];
  213. if (dtCallEvey != null && dtCallEvey.Rows.Count > 0)
  214. {
  215. if (dtCallEvey.Rows[0]["ct"].ToString() != "")
  216. {
  217. ijtcs = int.Parse(dtCallEvey.Rows[0]["ct"].ToString());//接听次数
  218. }
  219. else
  220. {
  221. ijtcs = 0;
  222. }
  223. if (dtCallEvey.Rows[0]["sc"].ToString() != "")
  224. {
  225. ithms = int.Parse(dtCallEvey.Rows[0]["sc"].ToString());//通话秒数
  226. }
  227. else
  228. {
  229. ithms = 0;
  230. }
  231. if (dtext.Rows[0]["pa"].ToString() != "")
  232. {
  233. izlms = int.Parse(dtext.Rows[0]["pa"].ToString());//振铃秒数
  234. }
  235. else
  236. {
  237. izlms = 0;
  238. }
  239. }
  240. 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());
  241. 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());
  242. 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());
  243. if (ijtcs != 0)
  244. {
  245. ipjjtms = ithms / ijtcs;//平均接通秒数
  246. ipjzlms = izlms / ijtcs;//平均振铃秒数
  247. }
  248. else
  249. {
  250. ipjjtms = 0;//平均接通秒数
  251. ipjzlms = 0;//平均振铃秒数
  252. }
  253. 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());
  254. 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());
  255. //坐席登录次数
  256. 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];
  257. if (dtAgent != null && dtAgent.Rows.Count > 0)
  258. {
  259. if (dtAgent.Rows[0]["dl"] != null && dtAgent.Rows[0]["dl"].ToString() != "")
  260. {
  261. izxdlcs = int.Parse(dtAgent.Rows[0]["dl"].ToString());//登录次数
  262. }
  263. else
  264. {
  265. izxdlcs = 0;
  266. }
  267. if (dtAgent.Rows[0]["dlsc"] != null && dtAgent.Rows[0]["dlsc"].ToString() != "")
  268. {
  269. idlsc = int.Parse(dtAgent.Rows[0]["dlsc"].ToString());//登录时长
  270. }
  271. else
  272. {
  273. idlsc = 0;
  274. }
  275. if (dtAgent.Rows[0]["zm"] != null && dtAgent.Rows[0]["zm"].ToString() != "")
  276. {
  277. izmcs = int.Parse(dtAgent.Rows[0]["zm"].ToString());//置忙次数
  278. }
  279. else
  280. {
  281. izmcs = 0;
  282. }
  283. if (dtAgent.Rows[0]["xx"] != null && dtAgent.Rows[0]["xx"].ToString() != "")
  284. {
  285. ixxsc = int.Parse(dtAgent.Rows[0]["xx"].ToString());//休息时长
  286. }
  287. else
  288. {
  289. ixxsc = 0;
  290. }
  291. }
  292. iWorktime = idlsc - ixxsc;//工作时长
  293. if (izxdlcs != 0)
  294. {
  295. ipjczsc = iWorktime / izxdlcs;//平均操作秒数
  296. }
  297. else
  298. {
  299. ipjczsc = 0;
  300. }
  301. if (izmcs != 0)
  302. {
  303. ipjzmxxsc = ixxsc / izmcs;//置忙平均操作时长
  304. }
  305. else
  306. {
  307. ipjzmxxsc = 0;
  308. }
  309. //呼入占有率
  310. if (iWorktime != 0)
  311. {
  312. ihrzyl = ithms / Convert.ToDouble(iWorktime);
  313. }
  314. else
  315. {
  316. ihrzyl = 0.00;
  317. }
  318. 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") + "%");
  319. //用户评价
  320. object obj = DBUtility.DbHelperSQL.GetSingle("select count(*) from T_Call_CallRecords where MYD is not null and CallState=1 and userid=" + dt.Rows[i]["F_UserId"] + strsqlcall);
  321. string myd = "";
  322. if (obj != null)
  323. {
  324. myd = obj.ToString();
  325. }
  326. 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);
  327. 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());
  328. 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());
  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>", (ipjczsc / 60).ToString());
  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>", izmcs.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>", (ixxsc / 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>", (ipjzmxxsc / 60).ToString());
  333. 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"] + strsqlcall);
  334. int zfs = 0;
  335. if (dszj != null && dszj.Tables.Count > 0)
  336. {
  337. DataTable dtzj = dszj.Tables[0];
  338. if (dtzj.Rows.Count > 0 && dtzj.Rows[0]["fs"].ToString() != "" && dtzj.Rows[0]["fsct"].ToString() != "")
  339. {
  340. zfs = Convert.ToInt32(dtzj.Rows[0]["fs"].ToString()) / int.Parse(dtzj.Rows[0]["fsct"].ToString());
  341. }
  342. }
  343. 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());
  344. htmlReport.Append("</tr>");
  345. }
  346. }
  347. }
  348. }
  349. htmlReport.Append("</table>");
  350. }
  351. catch { }
  352. return htmlReport.ToString();
  353. }
  354. public bool IsReusable
  355. {
  356. get
  357. {
  358. return false;
  359. }
  360. }
  361. }
  362. }