市长热线演示版

acceptancereport.aspx.cs 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.HtmlControls;
  10. using System.Web.UI.WebControls;
  11. using System.Web.UI.WebControls.WebParts;
  12. using System.Xml.Linq;
  13. using System.Text;
  14. namespace HySoft.BaseCallCenter.Web.reportmanage
  15. {
  16. public partial class acceptancereport : System.Web.UI.Page
  17. {
  18. BLL.T_Report bll_T_Report = new BLL.T_Report();
  19. BLL.T_Sys_DictionaryValue bll_T_Sys_DictionaryValue = new BLL.T_Sys_DictionaryValue();
  20. BLL.T_Sys_UserAccount bll_T_Sys_UserAccount = new BLL.T_Sys_UserAccount();
  21. protected void Page_Load(object sender, EventArgs e)
  22. {
  23. if (!this.IsPostBack)
  24. {
  25. }
  26. }
  27. public StringBuilder GetReportTable(string TableTitle,string userCode, string BeginTime, string EndTime, params object[] TableHead)
  28. {
  29. StringBuilder html = new StringBuilder();
  30. string reportsql = "";
  31. DataTable dt = new DataTable();
  32. DataTable dtdgd = new DataTable();
  33. DataTable dtyhf = new DataTable();
  34. html.Append("<h1 style='font-size: 18px;font-weight: bold;color: #333333;text-align:center;width:100%;'><b>" + TableTitle + "</b></h1>");
  35. //html.Append("<div style='width:100%; text-align:right; height:25px;'>统计截止日期: " + _operations[0] + "—" + _operations[1] + " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>");
  36. html.Append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" >");
  37. try
  38. {
  39. //开始时间
  40. if (!string.IsNullOrEmpty(BeginTime))
  41. {
  42. reportsql += " and DATEDIFF(d,AddTime,'" + BeginTime + "')<=0";
  43. }
  44. //结束时间
  45. if (!string.IsNullOrEmpty(EndTime))
  46. {
  47. reportsql += " and DATEDIFF(d,AddTime,'" + EndTime + "')>=0";
  48. }
  49. if (!string.IsNullOrEmpty(userCode))
  50. {
  51. reportsql += " and UserCode=" + userCode;
  52. }
  53. dt = bll_T_Report.GetAgentBusinessReport(reportsql);
  54. //标题第一行
  55. html.Append("<tr style=\"text-align: center;\">");
  56. for (int i = 0; i < TableHead.Length; i++)
  57. {
  58. //标题第一行
  59. html.Append("<td class=\"formtabletitle1\"style=\"height: 25px;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;\">" + TableHead[i] + "</td>");
  60. }
  61. html.Append("</tr>");
  62. int allCount = 0;
  63. int dgdCount = 0;
  64. int yhfCount = 0;
  65. if (dt != null && dt.Rows.Count > 0)
  66. {
  67. for (int i = 0; i < dt.Rows.Count; i++)
  68. {
  69. html.Append("<tr align=\"center\" valign=\"middle\" onmouseover=\"this.style.backgroundColor='#F6F6F6'\" onmouseout=\"this.style.backgroundColor='#ffffff'\" bgcolor=\"#ffffff\">");
  70. //坐席员名称
  71. html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">" + dt.Rows[i]["UserName"].ToString() + "&nbsp;</td>");
  72. //数量
  73. html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">" + dt.Rows[i]["TotalCount"].ToString() + "&nbsp;</td>");
  74. //待归档数量
  75. string dgdsql = reportsql + " and State=2 and UserName='" + dt.Rows[i]["UserName"].ToString() + "'";
  76. dtdgd = bll_T_Report.GetAgentBusinessReport(dgdsql);
  77. if (dtdgd == null || dtdgd.Rows.Count == 0)
  78. {
  79. html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">0</td>");
  80. }
  81. else
  82. {
  83. html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">" + dtdgd.Rows[0]["TotalCount"].ToString() + "&nbsp;</td>");
  84. //待归档总数
  85. dgdCount += Convert.ToInt32(dtdgd.Rows[0]["TotalCount"].ToString());
  86. }
  87. //已回访数量
  88. string yhfsql = reportsql + " and ReturnVisitState=2 and UserName='" + dt.Rows[i]["UserName"].ToString() + "'";
  89. dtyhf = bll_T_Report.GetAgentBusinessReport(yhfsql);
  90. if (dtyhf == null || dtyhf.Rows.Count == 0)
  91. {
  92. html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">0</td>");
  93. }
  94. else
  95. {
  96. html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">" + dtyhf.Rows[0]["TotalCount"].ToString() + "&nbsp;</td>");
  97. //待归档总数
  98. yhfCount += Convert.ToInt32(dtyhf.Rows[0]["TotalCount"].ToString());
  99. }
  100. //html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">" + dtyhf.Rows[i]["TotalCount"].ToString() + "&nbsp;+" + i + "@@@@</td>");
  101. //总数
  102. allCount += Convert.ToInt32(dt.Rows[i]["TotalCount"].ToString());
  103. //yhfCount += Convert.ToInt32(dtyhf.Rows[i]["TotalCount"].ToString());
  104. html.Append("</tr>");
  105. }
  106. }
  107. //合计
  108. html.Append("<tr style=\"text-align: center;\"><td class=\"formtabletitle3\" style=\"height: 35px;background-color: #D5EDFE;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;padding: 3px 10px 3px 2px;text-align:center;\">总计:</td>");
  109. html.Append("<td class=\"formtabletitle2\" style=\"height: 25px;background-color: #D5EDFE;border-left: 0px solid #FFFFFF;border-right: 1px solid #CCCCCC;border-top: 0px solid #FFFFFF;border-bottom: 1px solid #CCCCCC;padding: 3px 3px 3px 3px;text-align:center;\">" + allCount + "&nbsp;</td>");
  110. html.Append("<td class=\"formtabletitle2\" style=\"height: 25px;background-color: #D5EDFE;border-left: 0px solid #FFFFFF;border-right: 1px solid #CCCCCC;border-top: 0px solid #FFFFFF;border-bottom: 1px solid #CCCCCC;padding: 3px 3px 3px 3px;text-align:center;\">" + dgdCount + "&nbsp;</td>");
  111. html.Append("<td class=\"formtabletitle2\" style=\"height: 25px;background-color: #D5EDFE;border-left: 0px solid #FFFFFF;border-right: 1px solid #CCCCCC;border-top: 0px solid #FFFFFF;border-bottom: 1px solid #CCCCCC;padding: 3px 3px 3px 3px;text-align:center;\">" + yhfCount + "&nbsp;</td>");
  112. html.Append("</tr>");
  113. }
  114. catch
  115. { }
  116. finally
  117. {
  118. dt.Clear();
  119. dt.Dispose();
  120. }
  121. html.Append("</table>");
  122. return html;
  123. }
  124. }
  125. }