20230531 脚本、版本日志整理
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace FineUIPro.Web.HSSE.CostGoods
|
||||
{
|
||||
@@ -31,8 +33,8 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
InitYearGrid();
|
||||
}
|
||||
|
||||
protected static DateTime sDate = new DateTime();
|
||||
protected static DateTime eDate = new DateTime();
|
||||
protected static int sDate = 0;
|
||||
protected static int eDate = 0;
|
||||
#region 按年份
|
||||
private void InitYearGrid()
|
||||
{
|
||||
@@ -66,14 +68,29 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
var getProject = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == this.ProjectId);
|
||||
if (getProject != null)
|
||||
{
|
||||
sDate= getProject.StartDate ?? DateTime.Now;
|
||||
eDate = getProject.EndDate ?? DateTime.Now;
|
||||
for (int i = 0; sDate.Year + i <= eDate.Year; i++)
|
||||
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)
|
||||
{
|
||||
var getMaxYear = getCostEx.Max(x => x.Year);
|
||||
if (getMaxYear.HasValue && getMaxYear > eDate)
|
||||
{
|
||||
eDate = getMaxYear.Value;
|
||||
}
|
||||
var getMinYear = getCostEx.Min(x => x.Year);
|
||||
if (getMinYear.HasValue && getMinYear < sDate)
|
||||
{
|
||||
sDate = getMinYear.Value;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; sDate + i <= eDate; i++)
|
||||
{
|
||||
bf = new FineUIPro.BoundField();
|
||||
bf.DataField = (sDate.Year + i).ToString();
|
||||
bf.DataField = (sDate + i).ToString();
|
||||
bf.DataFormatString = "{0}";
|
||||
bf.HeaderText = (sDate.Year + i).ToString() +"年";
|
||||
bf.HeaderText = (sDate + i).ToString() +"年";
|
||||
bf.Width = 200;
|
||||
bf.HeaderTextAlign = TextAlign.Center;
|
||||
Grid1.Columns.Add(bf);
|
||||
@@ -136,9 +153,9 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
table.Columns.Add(new DataColumn("Id", typeof(string)));
|
||||
table.Columns.Add(new DataColumn("SupCostTypeName", typeof(string)));
|
||||
table.Columns.Add(new DataColumn("CostTypeName", typeof(string)));
|
||||
for (int i = 0; sDate.Year + i <= eDate.Year; i++)
|
||||
for (int i = 0; sDate + i <= eDate; i++)
|
||||
{
|
||||
table.Columns.Add(new DataColumn((sDate.Year + i).ToString(), typeof(string)));
|
||||
table.Columns.Add(new DataColumn((sDate + i).ToString(), typeof(string)));
|
||||
}
|
||||
|
||||
table.Columns.Add(new DataColumn("SumC", typeof(String)));
|
||||
@@ -150,30 +167,34 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
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 };
|
||||
|
||||
foreach (var item in getDetail)
|
||||
var getType = (from x in getDetail select new { x.SupSortIndex, x.SortIndex, x.CostType }).Distinct();
|
||||
foreach (var item in getType)
|
||||
{
|
||||
DataRow row = table.NewRow();
|
||||
row[0] = item.ExpenseDetailId +"#" +item.ExpenseId;
|
||||
row[1] = item.SupCostTypeName;
|
||||
row[2] = item.CostTypeName;
|
||||
int r = 3;
|
||||
for (int i = 0; sDate.Year + i <= eDate.Year; i++)
|
||||
var getD = getDetail.FirstOrDefault(x => x.CostType == item.CostType);
|
||||
if (getD != null)
|
||||
{
|
||||
var getV = getDetail.Where(x => x.Year == sDate.Year + i && x.CostType == item.CostType);
|
||||
if (getV.Count() > 0)
|
||||
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++)
|
||||
{
|
||||
row[r] = getV.Sum(x => x.CostMoney ?? 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
row[r] = 0.00;
|
||||
}
|
||||
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;
|
||||
r = i + 4;
|
||||
}
|
||||
row[r] = getDetail.Where(x => x.CostType == item.CostType).Sum(x => x.CostMoney ?? 0);
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
row[r] = getDetail.Where(x => x.CostType == item.CostType).Sum(x => x.CostMoney ?? 0);
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -183,30 +204,34 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
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 };
|
||||
|
||||
foreach (var item in getDetail)
|
||||
var getType = (from x in getDetail select new { x.SupSortIndex, x.SortIndex, x.CostType }).Distinct();
|
||||
foreach (var item in getType)
|
||||
{
|
||||
DataRow row = table.NewRow();
|
||||
row[0] = item.ExpenseDetailId + "#" + item.ExpenseId;
|
||||
row[1] = item.SupCostTypeName;
|
||||
row[2] = item.CostTypeName;
|
||||
int r = 3;
|
||||
for (int i = 0; sDate.Year + i <= eDate.Year; i++)
|
||||
var getD = getDetail.FirstOrDefault(x => x.CostType == item.CostType);
|
||||
if (getD != null)
|
||||
{
|
||||
var getV = getDetail.Where(x => x.Year == sDate.Year + i && x.CostType == item.CostType);
|
||||
if (getV.Count() > 0)
|
||||
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++)
|
||||
{
|
||||
row[r] = getV.Sum(x => x.CostMoney ?? 0);
|
||||
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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
row[r] = getDetail.Where(x => x.CostType == item.CostType).Sum(x => x.CostMoney ?? 0);
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,9 +253,9 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||
this.Grid1.PageSize = this.Grid1.RecordCount;
|
||||
|
||||
Response.Write(GetTableHtml(GetDataTable()));
|
||||
Response.Write(GetGridTableHtml(this.Grid1));
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 分页 排序
|
||||
@@ -316,11 +341,11 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
{
|
||||
if (this.btnMenuEdit.Hidden || type == "view") ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ExpenseView.aspx?ExpenseId={0}", id, "查看 - ")));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ExpenseView.aspx?ExpenseId={0}", getEx.ExpenseId, "查看 - ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ExpenseEdit.aspx?ExpenseId={0}", id, "编辑 - ")));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ExpenseEdit.aspx?ExpenseId={0}", getEx.ExpenseId, "编辑 - ")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -393,5 +418,10 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user