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;
|
||||
@@ -25,6 +26,9 @@ namespace FineUIPro.Web.DataShow
|
||||
BLL.ProjectService.InitProjectDropDownList(this.drpProject, true);
|
||||
// 绑定表格t
|
||||
BindGrid();
|
||||
|
||||
// 合计
|
||||
OutputSummaryData();
|
||||
this.Panel1.Title = "质量培训数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")";
|
||||
}
|
||||
}
|
||||
@@ -77,6 +81,7 @@ namespace FineUIPro.Web.DataShow
|
||||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.BindGrid();
|
||||
this.OutputSummaryData();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -177,7 +182,7 @@ namespace FineUIPro.Web.DataShow
|
||||
var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
if (this.rbCom.SelectedValue == "1")
|
||||
{
|
||||
var getT = Funs.DB.Comprehensive_InspectionPerson.Where(x => x.ProjectId == projectId.ToString() && x.IsTrain == true);
|
||||
var getT = Funs.DB.Comprehensive_InspectionPerson.Where(x => x.ProjectId == projectId.ToString() && x.IsTrain == true && x.CompileDate >Funs.minSysDate);
|
||||
if (datetime1.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.CompileDate >= datetime1);
|
||||
@@ -190,7 +195,7 @@ namespace FineUIPro.Web.DataShow
|
||||
}
|
||||
else
|
||||
{
|
||||
var getT = Funs.DB.Comprehensive_DesignDetails.Where(x => x.ProjectId == projectId.ToString());
|
||||
var getT = Funs.DB.Comprehensive_DesignDetails.Where(x => x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate);
|
||||
if (datetime1.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.CompileDate >= datetime1);
|
||||
@@ -207,5 +212,37 @@ namespace FineUIPro.Web.DataShow
|
||||
}
|
||||
return cout1;
|
||||
}
|
||||
|
||||
#region 合计
|
||||
private void OutputSummaryData() {
|
||||
string strSql = "";
|
||||
if (this.rbCom.SelectedValue == "1")
|
||||
{
|
||||
strSql= @"select ProjectId,ProjectCode, ProjectName,
|
||||
isnull((select count(*) from Comprehensive_InspectionPerson as a
|
||||
where a.ProjectId=P.ProjectId and a.IsTrain=1 and a.CompileDate > '2023-01-01' ),0) as Count1
|
||||
from Base_Project as P where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9) ";
|
||||
}
|
||||
else {
|
||||
strSql = @"select ProjectId,ProjectCode, ProjectName,
|
||||
isnull((select sum(JoinPersonNum) from Comprehensive_DesignDetails as a
|
||||
where a.ProjectId=P.ProjectId and a.CompileDate > '2023-01-01' ),0) as Count1
|
||||
from Base_Project as P where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9) ";
|
||||
}
|
||||
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
int Count1 = 0;
|
||||
foreach (DataRow row in tb.Rows)
|
||||
{
|
||||
Count1 += Convert.ToInt32(row["Count1"]);
|
||||
}
|
||||
JObject summary = new JObject();
|
||||
summary.Add("ProjectName", "合计:");
|
||||
summary.Add("Count1", Count1.ToString());
|
||||
Grid1.SummaryData = summary;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user