Procházet zdrojové kódy

报表读取调整

zhengbingbing %!s(int64=6) %!d(string=před) roky
rodič
revize
feb4858e1c
1 změnil soubory, kde provedl 118 přidání a 11 odebrání
  1. 118 11
      Web/Report/TZSJFX_Report.aspx.cs

+ 118 - 11
Web/Report/TZSJFX_Report.aspx.cs

@@ -92,6 +92,10 @@ public partial class Report_TZSJFX_Report : System.Web.UI.Page
92 92
                 reportsql += " and UserId=" + _operations[2];
93 93
             }
94 94
             dt = bll_T_Report.GetAgentBusinessReport(reportsql);
95
+            //待归档数量
96
+            dtdgd = bll_T_Report.GetAgentBusinessReport(reportsql + " and State=2 ");
97
+            //已回访数量
98
+            dtyhf = bll_T_Report.GetAgentBusinessReport(reportsql+ " and ReturnVisitState=2 ");
95 99
 
96 100
             //标题第一行
97 101
             html.Append("<tr style=\"text-align: center;\"><td class=\"formtabletitle\" style=\"height: 35px;background-color: #D5EDFE;border:1px solid #CCCCCC;padding: 3px 3px 3px 3px;text-align:center;width:150px\">坐席姓名</td>");
@@ -106,36 +110,37 @@ public partial class Report_TZSJFX_Report : System.Web.UI.Page
106 110
             {
107 111
                 for (int i = 0; i < dt.Rows.Count; i++)
108 112
                 {
113
+                    string username = dt.Rows[i]["UserName"].ToString();
109 114
                     html.Append("<tr align=\"center\" valign=\"middle\" onmouseover=\"this.style.backgroundColor='#F6F6F6'\" onmouseout=\"this.style.backgroundColor='#ffffff'\" bgcolor=\"#ffffff\">");
110 115
                     //坐席员名称
111
-                    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>"); 
116
+                    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;\">" + username + "&nbsp;</td>"); 
112 117
                     //数量
113 118
                     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>");
114 119
                     //待归档数量
115
-                    string dgdsql = reportsql + " and State=2 and UserName='" + dt.Rows[i]["UserName"].ToString() + "'";
116
-                    dtdgd = bll_T_Report.GetAgentBusinessReport(dgdsql);
117
-                    if (dtdgd == null || dtdgd.Rows.Count == 0)
120
+                    var drdgd = dtdgd.Select("UserName='" + username + "'");
121
+                    var dgdcount = (from DataRow dr in drdgd select dr.Field<int>("TotalCount")).FirstOrDefault();
122
+                    if (drdgd.Count() == 0)
118 123
                     {
119 124
                         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>");
120 125
                     }
121 126
                     else
122 127
                     {
123
-                        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>");
128
+                        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;\">" + dgdcount + "&nbsp;</td>");
124 129
                         //待归档总数
125
-                        dgdCount += Convert.ToInt32(dtdgd.Rows[0]["TotalCount"].ToString());
130
+                        dgdCount += dgdcount;
126 131
                     }
127 132
                     //已回访数量
128
-                    string yhfsql = reportsql + " and ReturnVisitState=2 and UserName='" + dt.Rows[i]["UserName"].ToString() + "'";
129
-                    dtyhf = bll_T_Report.GetAgentBusinessReport(yhfsql);
130
-                    if (dtyhf == null || dtyhf.Rows.Count == 0)
133
+                    var dryhf = dtyhf.Select("UserName='" + username + "'");
134
+                    var yhfcount = (from DataRow dr in dryhf select dr.Field<int>("TotalCount")).FirstOrDefault();
135
+                    if (dryhf.Count()==0)
131 136
                     {
132 137
                         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>");
133 138
                     }
134 139
                     else
135 140
                     {
136
-                        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>");
141
+                        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;\">" + yhfcount + "&nbsp;</td>");
137 142
                         //待归档总数
138
-                        yhfCount += Convert.ToInt32(dtyhf.Rows[0]["TotalCount"].ToString());
143
+                        yhfCount += yhfcount;
139 144
                     }
140 145
                     //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>");
141 146
                     //总数
@@ -164,6 +169,108 @@ public partial class Report_TZSJFX_Report : System.Web.UI.Page
164 169
         return html.ToString();
165 170
 
166 171
     }
172
+    #region 20190821 zhengbingbing 优化前
173
+    //public string GetReportTable(AjaxPro.JavaScriptArray searchItems)
174
+    //{
175
+    //    StringBuilder html = new StringBuilder();
176
+    //    string reportsql = "";
177
+    //    DataTable dt = new DataTable();
178
+    //    DataTable dtdgd = new DataTable();
179
+    //    DataTable dtyhf = new DataTable();
180
+    //    string[] _operations = GetSearchItems(searchItems);
181
+    //    html.Append("<h1 style='font-size: 18px;font-weight: bold;color: #333333;text-align:center;width:100%;'><b>坐席业务量统计表</b></h1>");
182
+    //    html.Append("<div style='width:100%; text-align:right; height:25px;'>统计截止日期: " + _operations[0] + "—" + _operations[1] + " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>");
183
+    //    html.Append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" >");
184
+    //    try
185
+    //    {
186
+    //        //开始时间
187
+    //        if (!string.IsNullOrEmpty(_operations[0]))
188
+    //        {
189
+    //            reportsql += " and DATEDIFF(d,AddTime,'" + _operations[0] + "')<=0";
190
+    //        }
191
+    //        //结束时间
192
+    //        if (!string.IsNullOrEmpty(_operations[1]))
193
+    //        {
194
+    //            reportsql += " and DATEDIFF(d,AddTime,'" + _operations[1] + "')>=0";
195
+    //        }
196
+    //        if (!string.IsNullOrEmpty(_operations[2]))
197
+    //        {
198
+    //            reportsql += " and UserId=" + _operations[2];
199
+    //        }
200
+    //        dt = bll_T_Report.GetAgentBusinessReport(reportsql);
201
+
202
+    //        //标题第一行
203
+    //        html.Append("<tr style=\"text-align: center;\"><td class=\"formtabletitle\" style=\"height: 35px;background-color: #D5EDFE;border:1px solid #CCCCCC;padding: 3px 3px 3px 3px;text-align:center;width:150px\">坐席姓名</td>");
204
+    //        html.Append("<td class=\"formtabletitle1\"style=\"height: 25px;background-color: #D5EDFE;border-left: 0px solid #FFFFFF;border-right: 1px solid #CCCCCC;border-top: 1px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;padding: 3px 3px 3px 3px;text-align:center;\">数量</td>");
205
+    //        html.Append("<td class=\"formtabletitle1\"style=\"height: 25px;background-color: #D5EDFE;border-left: 0px solid #FFFFFF;border-right: 1px solid #CCCCCC;border-top: 1px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;padding: 3px 3px 3px 3px;text-align:center;\">待归档数</td>");
206
+    //        html.Append("<td class=\"formtabletitle1\"style=\"height: 25px;background-color: #D5EDFE;border-left: 0px solid #FFFFFF;border-right: 1px solid #CCCCCC;border-top: 1px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;padding: 3px 3px 3px 3px;text-align:center;\">已回访数</td>");
207
+    //        html.Append("</tr>");
208
+    //        int allCount = 0;
209
+    //        int dgdCount = 0;
210
+    //        int yhfCount = 0;
211
+    //        if (dt != null && dt.Rows.Count > 0)
212
+    //        {
213
+    //            for (int i = 0; i < dt.Rows.Count; i++)
214
+    //            {
215
+    //                html.Append("<tr align=\"center\" valign=\"middle\" onmouseover=\"this.style.backgroundColor='#F6F6F6'\" onmouseout=\"this.style.backgroundColor='#ffffff'\" bgcolor=\"#ffffff\">");
216
+    //                //坐席员名称
217
+    //                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>");
218
+    //                //数量
219
+    //                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>");
220
+    //                //待归档数量
221
+    //                string dgdsql = reportsql + " and State=2 and UserName='" + dt.Rows[i]["UserName"].ToString() + "'";
222
+    //                dtdgd = bll_T_Report.GetAgentBusinessReport(dgdsql);
223
+    //                if (dtdgd == null || dtdgd.Rows.Count == 0)
224
+    //                {
225
+    //                    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>");
226
+    //                }
227
+    //                else
228
+    //                {
229
+    //                    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>");
230
+    //                    //待归档总数
231
+    //                    dgdCount += Convert.ToInt32(dtdgd.Rows[0]["TotalCount"].ToString());
232
+    //                }
233
+    //                //已回访数量
234
+    //                string yhfsql = reportsql + " and ReturnVisitState=2 and UserName='" + dt.Rows[i]["UserName"].ToString() + "'";
235
+    //                dtyhf = bll_T_Report.GetAgentBusinessReport(yhfsql);
236
+    //                if (dtyhf == null || dtyhf.Rows.Count == 0)
237
+    //                {
238
+    //                    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>");
239
+    //                }
240
+    //                else
241
+    //                {
242
+    //                    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>");
243
+    //                    //待归档总数
244
+    //                    yhfCount += Convert.ToInt32(dtyhf.Rows[0]["TotalCount"].ToString());
245
+    //                }
246
+    //                //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>");
247
+    //                //总数
248
+    //                allCount += Convert.ToInt32(dt.Rows[i]["TotalCount"].ToString());
249
+
250
+    //                //yhfCount += Convert.ToInt32(dtyhf.Rows[i]["TotalCount"].ToString());
251
+    //                html.Append("</tr>");
252
+    //            }
253
+    //        }
254
+    //        //合计
255
+    //        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>");
256
+    //        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>");
257
+    //        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>");
258
+    //        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>");
259
+    //        html.Append("</tr>");
260
+    //    }
261
+    //    catch
262
+    //    { }
263
+    //    finally
264
+    //    {
265
+    //        dt.Clear();
266
+    //        dt.Dispose();
267
+
268
+    //    }
269
+    //    html.Append("</table>");
270
+    //    return html.ToString();
271
+
272
+    //}
273
+    #endregion
167 274
 
168 275
     private string[] GetSearchItems(AjaxPro.JavaScriptArray searchItems)
169 276
     {