提交代码

This commit is contained in:
2025-05-12 10:20:13 +08:00
parent 3b18178e30
commit a75ba9f44a
12 changed files with 185 additions and 41 deletions
@@ -1,4 +1,5 @@
using BLL;
using Newtonsoft.Json.Linq;
using NPOI.SS.Util;
using System;
using System.Collections.Generic;
@@ -32,7 +33,7 @@ namespace FineUIPro.Web.CQMS.QuantityManagement
this.drpProject.Hidden = true;
projectId = this.drpProject.SelectedValue;
}
BLL.CNProfessionalService.InitCNProfessionalDownList(drpMajor, true);
BLL.CNProfessionalService.InitDistinctCNProfessionalDownList(drpMajor, projectId, true);
BLL.BaseService.InitAllProjectContentDropDownList(this.drpProjectContent, projectId, true);
GetButtonPower();
BindGrid();
@@ -124,6 +125,27 @@ namespace FineUIPro.Web.CQMS.QuantityManagement
this.Grid1.Rows[i].Values[8] = decimal.Round(completedAmount / totalAmount, 4) * 100;
}
}
OutputSummaryData();
}
/// <summary>
/// 全部行合计
/// </summary>
private void OutputSummaryData()
{
if (this.Grid1.Rows.Count > 0)
{
decimal d = 0;
for (int i = 0; i < this.Grid1.Rows.Count; i++)
{
d += Funs.GetNewDecimalOrZero(this.Grid1.Rows[i].Values[8].ToString());
}
JObject summary = new JObject();
summary.Add("MonthComplete", "合计");
summary.Add("CompleteRate", decimal.Round(d / this.Grid1.Rows.Count, 2).ToString());
Grid1.SummaryData = summary;
}
}
#endregion
@@ -333,6 +355,34 @@ namespace FineUIPro.Web.CQMS.QuantityManagement
cell.CellStyle = cellStyle;
cell.SetCellValue(Grid1.Rows[i].Values[8].ToString());
}
row = sheet.CreateRow(r + Grid1.Rows.Count);
cell = row.CreateCell(0);
cell.CellStyle = cellStyle;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(1);
cell.CellStyle = cellStyle;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(2);
cell.CellStyle = cellStyle;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(3);
cell.CellStyle = cellStyle;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(4);
cell.CellStyle = cellStyle;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(5);
cell.CellStyle = cellStyle;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(6);
cell.CellStyle = cellStyle;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(7);
cell.CellStyle = cellStyle;
cell.SetCellValue("合计");
cell = row.CreateCell(8);
cell.CellStyle = cellStyle;
cell.SetCellValue(Grid1.SummaryData["CompleteRate"].ToString());
// 第三步:写入文件流
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
{