2023-11-11
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
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()) + ")";
|
||||
}
|
||||
}
|
||||
@@ -43,7 +46,7 @@ namespace FineUIPro.Web.DataShow
|
||||
FROM CostGoods_CostSmallDetail as cost
|
||||
left join Base_Project as p on cost.ProjectId =p.ProjectId
|
||||
left join Base_Unit as Unit on cost.UnitId =Unit.UnitId
|
||||
WHERE (p.ProjectState2 is null or p.ProjectState2 !=9) ";
|
||||
WHERE cost.CompileDate > '2023-01-01'and (p.ProjectState2 is null or p.ProjectState2 !=9) ";
|
||||
|
||||
if (this.drpProject.SelectedValue != Const._Null)
|
||||
{
|
||||
@@ -155,5 +158,32 @@ namespace FineUIPro.Web.DataShow
|
||||
{
|
||||
EditData();
|
||||
}
|
||||
|
||||
#region 合计
|
||||
private void OutputSummaryData() {
|
||||
string strSql = string.Empty;
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
strSql = @"SELECT cost.CostSmallDetailId, p.ProjectId,p.ProjectCode,p.ProjectName,cost.UnitId,Unit.UnitName,cost.Months
|
||||
,(CAST((SELECT SUM(ISNULL(CostMoney,0)) FROM CostGoods_CostSmallDetailItem
|
||||
WHERE CostSmallDetailId=cost.CostSmallDetailId) *1.0 /10000 as decimal(18, 2) ))AS SUMCost
|
||||
FROM CostGoods_CostSmallDetail as cost
|
||||
left join Base_Project as p on cost.ProjectId =p.ProjectId
|
||||
left join Base_Unit as Unit on cost.UnitId =Unit.UnitId
|
||||
WHERE (p.ProjectState2 is null or p.ProjectState2 !=9) and cost.CompileDate > '2023-01-01'";
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
float SUMCost = 0.0f;
|
||||
|
||||
foreach (DataRow row in tb.Rows)
|
||||
{
|
||||
SUMCost += float.Parse(row["SUMCost"].ToString());
|
||||
}
|
||||
JObject summary = new JObject();
|
||||
summary.Add("Months", "合计:");
|
||||
summary.Add("SUMCost", SUMCost.ToString("F2"));
|
||||
Grid1.SummaryData = summary;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user