20230606新增费用申请页面、项目列表按活跃度排序
This commit is contained in:
@@ -45,13 +45,14 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
bf.DataFormatString = "{0}";
|
||||
bf.HeaderText = "编号";
|
||||
bf.Width = 60;
|
||||
bf.Hidden = true;
|
||||
bf.Hidden = true;
|
||||
Grid1.Columns.Add(bf);
|
||||
|
||||
bf = new FineUIPro.BoundField();
|
||||
bf.DataField = "SupCostTypeName";
|
||||
bf.DataFormatString = "{0}";
|
||||
bf.HeaderText = "类别名称";
|
||||
bf.ColumnID = "GroupB";
|
||||
bf.Width = 90;
|
||||
bf.HeaderTextAlign = TextAlign.Center;
|
||||
Grid1.Columns.Add(bf);
|
||||
@@ -68,8 +69,8 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
var getProject = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == this.ProjectId);
|
||||
if (getProject != null)
|
||||
{
|
||||
sDate= getProject.StartDate.HasValue ? getProject.StartDate.Value.Year : DateTime.Now.Year;
|
||||
eDate = getProject.EndDate.HasValue ? getProject.EndDate.Value.Year: DateTime.Now.Year;
|
||||
sDate = getProject.StartDate.HasValue ? getProject.StartDate.Value.Year : DateTime.Now.Year;
|
||||
eDate = getProject.EndDate.HasValue ? getProject.EndDate.Value.Year : DateTime.Now.Year;
|
||||
var getCostEx = Funs.DB.CostGoods_Expense.Where(x => x.ProjectId == this.ProjectId);
|
||||
if (getCostEx.Count() > 0)
|
||||
{
|
||||
@@ -90,7 +91,7 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
bf = new FineUIPro.BoundField();
|
||||
bf.DataField = (sDate + i).ToString();
|
||||
bf.DataFormatString = "{0}";
|
||||
bf.HeaderText = (sDate + i).ToString() +"年";
|
||||
bf.HeaderText = (sDate + i).ToString() + "年(元)";
|
||||
bf.Width = 200;
|
||||
bf.HeaderTextAlign = TextAlign.Center;
|
||||
Grid1.Columns.Add(bf);
|
||||
@@ -100,12 +101,13 @@ 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);
|
||||
|
||||
Grid1.DataKeyNames = new string[] { "Id", "CostTypeName" };
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -162,82 +164,54 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
|
||||
if (!string.IsNullOrEmpty(this.drpUnit.SelectedValue) && this.drpUnit.SelectedValue != Const._Null)
|
||||
{
|
||||
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.UnitId == this.drpUnit.SelectedValue
|
||||
orderby y.Year, x.SupSortIndex, x.SortIndex
|
||||
select new { x.ExpenseDetailId, x.ExpenseId, 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;
|
||||
for (int i = 0; sDate + i <= eDate; i++)
|
||||
{
|
||||
var getV = getDetail.Where(x => x.Year == sDate + i && x.CostType == item.CostType);
|
||||
if (getV.Count() > 0)
|
||||
{
|
||||
row[r] = getV.Sum(x => x.CostMoney ?? 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
row[r] = 0.00;
|
||||
}
|
||||
|
||||
r = i + 4;
|
||||
}
|
||||
row[r] = getDetail.Where(x => x.CostType == item.CostType).Sum(x => x.CostMoney ?? 0);
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
}
|
||||
SetTable(table, this.drpUnit.SelectedText);
|
||||
}
|
||||
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.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;
|
||||
for (int i = 0; sDate + i <= eDate; i++)
|
||||
{
|
||||
var getV = getDetail.Where(x => x.Year == sDate + i && x.CostType == item.CostType);
|
||||
if (getV.Count() > 0)
|
||||
{
|
||||
row[r] = getV.Sum(x => x.CostMoney ?? 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
row[r] = "0.00";
|
||||
}
|
||||
|
||||
r = i + 4;
|
||||
}
|
||||
row[r] = getDetail.Where(x => x.CostType == item.CostType).Sum(x => x.CostMoney ?? 0);
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
}
|
||||
SetTable(table, null);
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
private void SetTable(DataTable table,string unitId)
|
||||
{
|
||||
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 && (unitId == null || y.UnitId == this.drpUnit.SelectedValue)
|
||||
orderby y.Year, x.SupSortIndex, x.SortIndex
|
||||
select new { x.ExpenseDetailId, x.ExpenseId, 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;
|
||||
for (int i = 0; sDate + i <= eDate; i++)
|
||||
{
|
||||
var getV = getDetail.Where(x => x.Year == sDate + i && x.CostType == item.CostType);
|
||||
if (getV.Count() > 0)
|
||||
{
|
||||
row[r] = getV.Sum(x => x.CostMoney ?? 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
row[r] = 0.00;
|
||||
}
|
||||
|
||||
r = r + 1;
|
||||
}
|
||||
row[r] = getDetail.Where(x => x.CostType == item.CostType).Sum(x => x.CostMoney ?? 0);
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
|
||||
Reference in New Issue
Block a user