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;
|
||||
@@ -67,7 +68,7 @@ namespace FineUIPro.Web.DataShow
|
||||
FROM Emergency_EmergencyList_Unit AS Em
|
||||
LEFT JOIN Base_Unit AS Unit ON Em.UnitId=Unit.UnitId
|
||||
LEFT JOIN Base_EmergencyType AS EmergencyType ON Em.EmergencyTypeId=EmergencyType.EmergencyTypeId
|
||||
LEFT JOIN Sys_User AS Users ON Em.CompileMan=Users.UserId WHERE 1=1 ";
|
||||
LEFT JOIN Sys_User AS Users ON Em.CompileMan=Users.UserId WHERE Em.CompileDate >'2023-01-01' ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
if (!string.IsNullOrEmpty(this.txtStartTime.Text))
|
||||
{
|
||||
@@ -98,7 +99,7 @@ namespace FineUIPro.Web.DataShow
|
||||
LEFT JOIN Base_Unit AS Unit ON Em.UnitId=Unit.UnitId
|
||||
LEFT JOIN Base_Project AS Project ON Em.ProjectId=Project.ProjectId
|
||||
LEFT JOIN Base_EmergencyType AS EmergencyType ON Em.EmergencyTypeId=EmergencyType.EmergencyTypeId
|
||||
LEFT JOIN Sys_User AS Users ON Em.CompileMan=Users.UserId WHERE 1=1 ";
|
||||
LEFT JOIN Sys_User AS Users ON Em.CompileMan=Users.UserId WHERE Em.CompileDate >'2023-01-01' ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
if (this.drpProject.SelectedValue != Const._Null)
|
||||
{
|
||||
@@ -246,6 +247,9 @@ namespace FineUIPro.Web.DataShow
|
||||
Grid2.DataSource = table;
|
||||
Grid2.DataBind();
|
||||
this.Grid2.Columns[1].Hidden = true;
|
||||
|
||||
//加载合计
|
||||
OutputSummaryData("A");
|
||||
}
|
||||
else if (this.rbCom.SelectedValue == "1")
|
||||
{
|
||||
@@ -283,6 +287,9 @@ namespace FineUIPro.Web.DataShow
|
||||
Grid2.DataSource = table;
|
||||
Grid2.DataBind();
|
||||
this.Grid2.Columns[1].Hidden = true;
|
||||
|
||||
//加载合计
|
||||
OutputSummaryData("B");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,5 +361,58 @@ namespace FineUIPro.Web.DataShow
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 合计
|
||||
private void OutputSummaryData(string type)
|
||||
{
|
||||
DataTable tb = new DataTable();
|
||||
if (type == "A")
|
||||
{
|
||||
string strSql = @"SELECT List.DrillRecordListId
|
||||
,DrillRecordType.ConstText AS DrillRecordTypeName,List.JointPersonNum,List.DrillCost
|
||||
,List.DrillRecordName,List.DrillRecordDate
|
||||
,List.UnitIds,List.UnitNames
|
||||
,List.States
|
||||
FROM Emergency_DrillRecordList_Unit AS List
|
||||
LEFT JOIN Sys_Const AS DrillRecordType ON DrillRecordType.ConstValue = List.DrillRecordType
|
||||
and DrillRecordType.GroupId='DrillRecordType'
|
||||
WHERE 1=1 ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
}
|
||||
else {
|
||||
string strSql = @"SELECT List.DrillRecordListId,List.ProjectId,Project.PostCode,Project.ProjectName
|
||||
,DrillRecordType.ConstText AS DrillRecordTypeName,List.JointPersonNum,List.DrillCost
|
||||
,List.DrillRecordName,List.DrillRecordDate
|
||||
,List.UnitIds,List.UnitNames
|
||||
,List.States
|
||||
FROM Emergency_DrillRecordList AS List
|
||||
LEFT JOIN Base_Project AS Project ON List.Projectid = Project.ProjectId
|
||||
LEFT JOIN Sys_Const AS DrillRecordType ON DrillRecordType.ConstValue = List.DrillRecordType
|
||||
and DrillRecordType.GroupId='DrillRecordType'
|
||||
WHERE 1=1 ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
}
|
||||
int JointPersonNum = 0;
|
||||
double DrillCost = 0.0f;
|
||||
|
||||
foreach (DataRow row in tb.Rows)
|
||||
{
|
||||
JointPersonNum += Convert.ToInt32(row["JointPersonNum"]);
|
||||
DrillCost += Convert.ToDouble(row["DrillCost"]);
|
||||
}
|
||||
|
||||
JObject summary = new JObject();
|
||||
summary.Add("UnitNames", "合计:");
|
||||
summary.Add("JointPersonNum", JointPersonNum.ToString());
|
||||
summary.Add("DrillCost", DrillCost.ToString("F2"));
|
||||
Grid2.SummaryData = summary;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user