2023-11-11
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using BLL;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -23,6 +24,8 @@ namespace FineUIPro.Web.DataShow
|
||||
BLL.ProjectService.InitProjectDropDownList(this.drpProject, true);
|
||||
// 绑定表格t
|
||||
BindGrid();
|
||||
//加载合计
|
||||
OutputSummaryData();
|
||||
this.Panel1.Title = "安全教育(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")";
|
||||
}
|
||||
}
|
||||
@@ -41,7 +44,7 @@ namespace FineUIPro.Web.DataShow
|
||||
from EduTrain_TrainRecord AS TrainRecord
|
||||
LEFT JOIN Base_TrainType AS TrainType ON TrainRecord.TrainTypeId=TrainType.TrainTypeId
|
||||
LEFT JOIN Base_Project AS Project ON TrainRecord.ProjectId=Project.ProjectId
|
||||
WHERE (Project.ProjectState2 is null or Project.ProjectState2 !=9) ";
|
||||
WHERE (Project.ProjectState2 is null or Project.ProjectState2 !=9) and TrainRecord.TrainStartDate >'2023-01-01' ";
|
||||
|
||||
strSql += " AND TrainType.TrainType =@TrainType";
|
||||
listStr.Add(new SqlParameter("@TrainType", this.rbType.SelectedValue));
|
||||
@@ -67,6 +70,9 @@ namespace FineUIPro.Web.DataShow
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -79,6 +85,7 @@ namespace FineUIPro.Web.DataShow
|
||||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.BindGrid();
|
||||
this.OutputSummaryData();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -156,5 +163,39 @@ namespace FineUIPro.Web.DataShow
|
||||
{
|
||||
EditData();
|
||||
}
|
||||
|
||||
#region 合计
|
||||
private void OutputSummaryData()
|
||||
{
|
||||
string strSql = string.Empty;
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
strSql = @"select TrainRecord.TrainingId,TrainRecord.TrainTitle,TrainType.TrainTypeName,Project.ProjectId,Project.ProjectCode,Project.ProjectName
|
||||
,TrainRecord.TrainStartDate,TrainRecord.TrainEndDate,TrainRecord.TrainPersonNum,TrainRecord.UnitIds
|
||||
,UnitName= STUFF((SELECT ',' + UnitName FROM dbo.Base_Unit where PATINDEX('%,' + RTRIM(UnitId) + ',%',',' +TrainRecord.UnitIds + ',')>0 FOR XML PATH('')), 1, 1,'')
|
||||
from EduTrain_TrainRecord AS TrainRecord
|
||||
LEFT JOIN Base_TrainType AS TrainType ON TrainRecord.TrainTypeId=TrainType.TrainTypeId
|
||||
LEFT JOIN Base_Project AS Project ON TrainRecord.ProjectId=Project.ProjectId
|
||||
WHERE (Project.ProjectState2 is null or Project.ProjectState2 !=9) ";
|
||||
|
||||
strSql += " AND TrainType.TrainType =@TrainType";
|
||||
listStr.Add(new SqlParameter("@TrainType", this.rbType.SelectedValue));
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
int renshu = 0;
|
||||
foreach (DataRow row in tb.Rows)
|
||||
{
|
||||
renshu += Convert.ToInt32(row["TrainPersonNum"]);
|
||||
}
|
||||
|
||||
|
||||
JObject summary = new JObject();
|
||||
summary.Add("UnitName", "合计:");
|
||||
summary.Add("TrainPersonNum", renshu.ToString());
|
||||
|
||||
Grid1.SummaryData = summary;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user