20230606新增费用申请页面、项目列表按活跃度排序

This commit is contained in:
2023-06-06 17:01:34 +08:00
parent 5984687629
commit e4871bc690
105 changed files with 63242 additions and 2216 deletions
@@ -51,6 +51,7 @@ namespace FineUIPro.Web.HSSE.CostGoods
bf.DataField = "SupCostTypeName";
bf.DataFormatString = "{0}";
bf.HeaderText = "类别名称";
bf.ColumnID = "GroupB";
bf.Width = 90;
bf.HeaderTextAlign = TextAlign.Center;
Grid1.Columns.Add(bf);
@@ -73,7 +74,7 @@ namespace FineUIPro.Web.HSSE.CostGoods
bf = new FineUIPro.BoundField();
bf.DataField = item.UnitId;
bf.DataFormatString = "{0}";
bf.HeaderText = item.UnitName;
bf.HeaderText = item.UnitName+ "(元)";
bf.Width = 200;
Grid1.Columns.Add(bf);
}
@@ -86,7 +87,7 @@ namespace FineUIPro.Web.HSSE.CostGoods
bf = new FineUIPro.BoundField();
bf.DataField = item.UnitId;
bf.DataFormatString = "{0}";
bf.HeaderText = item.UnitName;
bf.HeaderText = item.UnitName+ "(元)";
bf.Width = 220;
Grid1.Columns.Add(bf);
}
@@ -94,7 +95,7 @@ namespace FineUIPro.Web.HSSE.CostGoods
bf = new FineUIPro.BoundField();
bf.DataField = "SumC";
bf.DataFormatString = "{0}";
bf.HeaderText = "合计";
bf.HeaderText = "合计(元)";
bf.Width = 90;
bf.HeaderTextAlign = TextAlign.Center;
Grid1.Columns.Add(bf);
@@ -156,126 +157,84 @@ namespace FineUIPro.Web.HSSE.CostGoods
{
table.Columns.Add(new DataColumn(item.UnitId, typeof(string)));
}
table.Columns.Add(new DataColumn("SumC", typeof(String)));
if (!string.IsNullOrEmpty(this.txtYear.Text))
{
int year = Funs.GetNewIntOrZero(this.txtYear.Text);
var getDetail = from x in Funs.DB.CostGoods_ExpenseDetail
join y in Funs.DB.CostGoods_Expense on x.ExpenseId equals y.ExpenseId
where y.ProjectId == this.ProjectId && y.Year == year
orderby y.Year, x.SupSortIndex, x.SortIndex
select new { x.ExpenseDetailId, x.ExpenseId,y.UnitId, y.Year, x.SupCostTypeId, x.SupCostTypeName, x.SupSortIndex, x.CostType, x.CostTypeName, x.SortIndex, x.CostMoney };
var getType = (from x in getDetail select new { x.SupSortIndex, x.SortIndex, x.CostType }).Distinct();
foreach (var item in getType)
{
var getD = getDetail.FirstOrDefault(x => x.CostType == item.CostType);
if (getD != null)
{
DataRow row = table.NewRow();
row[0] = getD.ExpenseDetailId + "#" + getD.ExpenseId;
row[1] = getD.SupCostTypeName;
row[2] = getD.CostTypeName;
int r = 3;
foreach (var uitem in getUnit)
{
var getD1 = getDetail.Where(x => x.UnitId == uitem.UnitId && x.CostType == item.CostType);
if (getD1.Count() > 0)
{
row[r] = getD1.Sum(X => X.CostMoney ?? 0).ToString();
}
else
{
row[r] = 0.00;
}
r++;
}
foreach (var suitem in getSUnit)
{
var getD2 = getDetail.Where(x => x.UnitId == suitem.UnitId && x.CostType == item.CostType);
if (getD2.Count() > 0)
{
row[r] = getD2.Sum(X => X.CostMoney ?? 0).ToString();
}
else
{
row[r] = 0.00;
}
r++;
}
row[r] = getDetail.Where(x => x.Year == getD.Year && x.CostType == item.CostType).Sum(x => x.CostMoney ?? 0);
table.Rows.Add(row);
}
}
SetTable(table, Funs.GetNewIntOrZero(this.txtYear.Text));
}
else
{
var getDetail = from x in Funs.DB.CostGoods_ExpenseDetail
join y in Funs.DB.CostGoods_Expense on x.ExpenseId equals y.ExpenseId
where y.ProjectId == this.ProjectId
orderby y.Year, x.SupSortIndex, x.SortIndex
select new { x.ExpenseDetailId, x.ExpenseId,y.UnitId, y.Year, x.SupCostTypeId, x.SupCostTypeName, x.SupSortIndex, x.CostType, x.CostTypeName, x.SortIndex, x.CostMoney };
var getType = (from x in getDetail select new { x.SupSortIndex, x.SortIndex, x.CostType }).Distinct();
foreach (var item in getType)
{
var getD = getDetail.FirstOrDefault(x => x.CostType == item.CostType);
if (getD != null)
{
DataRow row = table.NewRow();
row[0] = getD.ExpenseDetailId + "#" + getD.ExpenseId;
row[1] = getD.SupCostTypeName;
row[2] = getD.CostTypeName;
int r = 3;
foreach (var uitem in getUnit)
{
var getD1 = getDetail.Where(x => x.UnitId == uitem.UnitId && x.CostType == item.CostType);
if (getD1.Count() > 0)
{
row[r] = getD1.Sum(X => X.CostMoney ?? 0).ToString();
}
else
{
row[r] = 0.00;
}
r++;
}
foreach (var suitem in getSUnit)
{
var getD2 = getDetail.Where(x => x.UnitId == suitem.UnitId && x.CostType == item.CostType);
if (getD2.Count() > 0)
{
row[r] = getD2.Sum(X => X.CostMoney ?? 0).ToString();
}
else
{
row[r] = 0.00;
}
r++;
}
row[r] = getDetail.Where(x => x.CostType == item.CostType).Sum(x => x.CostMoney ?? 0);
table.Rows.Add(row);
}
}
SetTable(table, null);
}
return table;
}
#region
/// 导出按钮
/// <summary>
/// 设置table
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnOut_Click(object sender, EventArgs e)
/// <param name="table"></param>
/// <param name="year"></param>
private void SetTable(DataTable table, int? year)
{
var getDetail = from x in Funs.DB.CostGoods_ExpenseDetail
join y in Funs.DB.CostGoods_Expense on x.ExpenseId equals y.ExpenseId
where y.ProjectId == this.ProjectId && (!year.HasValue || y.Year == year)
orderby y.Year, x.SupSortIndex, x.SortIndex
select new { x.ExpenseDetailId, x.ExpenseId, y.UnitId, y.Year, x.SupCostTypeId, x.SupCostTypeName, x.SupSortIndex, x.CostType, x.CostTypeName, x.SortIndex, x.CostMoney };
var getType = (from x in getDetail select new { x.SupSortIndex, x.SortIndex, x.CostType }).Distinct();
foreach (var item in getType)
{
var getD = getDetail.FirstOrDefault(x => x.CostType == item.CostType);
if (getD != null)
{
DataRow row = table.NewRow();
row[0] = getD.ExpenseDetailId + "#" + getD.ExpenseId;
row[1] = getD.SupCostTypeName;
row[2] = getD.CostTypeName;
int r = 3;
foreach (var uitem in getUnit)
{
var getD1 = getDetail.Where(x => x.UnitId == uitem.UnitId && x.CostType == item.CostType);
if (getD1.Count() > 0)
{
row[r] = getD1.Sum(X => X.CostMoney ?? 0).ToString();
}
else
{
row[r] = 0.00;
}
r++;
}
foreach (var suitem in getSUnit)
{
var getD2 = getDetail.Where(x => x.UnitId == suitem.UnitId && x.CostType == item.CostType);
if (getD2.Count() > 0)
{
row[r] = getD2.Sum(X => X.CostMoney ?? 0).ToString();
}
else
{
row[r] = 0.00;
}
r++;
}
row[r] = getDetail.Where(x => x.Year == getD.Year && x.CostType == item.CostType).Sum(x => x.CostMoney ?? 0);
table.Rows.Add(row);
}
}
}
#region
/// 导出按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnOut_Click(object sender, EventArgs e)
{
Response.ClearContent();
string filename = Funs.GetNewFileName();