2023-11-11

This commit is contained in:
2023-11-11 16:02:42 +08:00
parent b2ffd4b8d0
commit 48dd589a7f
66 changed files with 2334 additions and 1232 deletions
@@ -1,4 +1,5 @@
using BLL;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
@@ -25,6 +26,8 @@ namespace FineUIPro.Web.DataShow
BLL.ProjectService.InitProjectDropDownList(this.drpProject, true);
// 绑定表格t
BindGrid();
// 合计
OutputSummaryData();
this.Panel1.Title = "工时数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + "";
}
}
@@ -171,7 +174,7 @@ namespace FineUIPro.Web.DataShow
var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text);
var getD1 = from x in Funs.DB.SitePerson_DayReport
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
where y.ProjectState == Const.ProjectState_1
where y.ProjectState == Const.ProjectState_1 && x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate
select x;
if (datetime1.HasValue)
{
@@ -207,11 +210,11 @@ namespace FineUIPro.Web.DataShow
var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text);
var getD1 = from x in Funs.DB.Accident_AccidentHandle
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
where y.ProjectState == Const.ProjectState_1
where y.ProjectState == Const.ProjectState_1 && x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate
select x;
var getD2 = from x in Funs.DB.Accident_AccidentReport
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
where y.ProjectState == Const.ProjectState_1
where y.ProjectState == Const.ProjectState_1 && x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate
select x;
if (datetime1.HasValue)
{
@@ -249,16 +252,16 @@ namespace FineUIPro.Web.DataShow
var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text);
var getC1 = from x in Funs.DB.SitePerson_DayReport
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
where y.ProjectState == Const.ProjectState_1
where y.ProjectState == Const.ProjectState_1 && x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate
select x;
var getD1 = from x in Funs.DB.Accident_AccidentHandle
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
where y.ProjectState == Const.ProjectState_1
where y.ProjectState == Const.ProjectState_1 && x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate
select x;
var getD2 = from x in Funs.DB.Accident_AccidentReport
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
where y.ProjectState == Const.ProjectState_1
where y.ProjectState == Const.ProjectState_1 && x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate
select x;
if (datetime1.HasValue)
@@ -294,5 +297,38 @@ namespace FineUIPro.Web.DataShow
return cout1;
}
#region
private void OutputSummaryData()
{
string strSql = @" select ProjectId,ProjectCode, ProjectName,
isnull((select sum(PersonWorkTime)
from SitePerson_DayReport x
left join(select PersonWorkTime,DayReportId from SitePerson_DayReportDetail) y on x.DayReportId=y.DayReportId
where x.ProjectId=p.ProjectId and x.CompileDate >'2023-01-01'),0) as count1,
isnull((select sum(WorkHoursLoss) from Accident_AccidentHandle a where a.ProjectId=p.ProjectId and a.AccidentDate >'2023-01-01'),0) as count2,
isnull((select sum(WorkingHoursLoss) from Accident_AccidentReport a where a.ProjectId=p.ProjectId and a.AccidentDate >'2023-01-01'),0) as count3
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);
double Count1 = 0.0f, Count2 = 0.0f, Count3 = 0.0f;
foreach (DataRow row in tb.Rows)
{
Count1 += Convert.ToDouble(row["Count1"]);
Count2 += Convert.ToDouble(row["Count2"]);
Count3 += Convert.ToDouble(row["Count3"]);
}
JObject summary = new JObject();
summary.Add("ProjectName", "合计:");
summary.Add("Count1", Count1.ToString("f2"));
summary.Add("Count2", (Count2+Count3).ToString("f2"));
summary.Add("Count3", (Count1- Count2- Count3).ToString("f2"));
Grid1.SummaryData = summary;
}
#endregion
}
}