2023-10-25
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
@@ -47,51 +49,38 @@ namespace FineUIPro.Web.PHTGL.ContractCompile
|
||||
table.ContractId = this.ContractId;
|
||||
table.ProjectCode = this.txtProjectCode.Text.Trim();
|
||||
table.ProjectName = this.txtProjectName.Text.Trim();
|
||||
var tb = BLL.PhtglContractTrackService.GetListData(table, Grid1);
|
||||
Grid1.RecordCount = PhtglContractTrackService.Count;
|
||||
var tb = BLL.PhtglContractTrackService.GetPHTGL_ContractTrackByModle(table);
|
||||
Grid1.RecordCount = tb.Count;
|
||||
//tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||||
Grid1.DataSource = tb;
|
||||
Grid1.DataBind();
|
||||
|
||||
|
||||
}
|
||||
private void BindGrid2()
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var q = from x in db.PHTGL_ContractTrackMatchWBS
|
||||
join y in db.WBS_ControlItemAndCycle on x.ControlItemAndCycleId equals y.ControlItemAndCycleId
|
||||
where x.ContractTrackId == Grid1.SelectedRowID
|
||||
select new
|
||||
{
|
||||
x.Id,
|
||||
x.ContractTrackId,
|
||||
x.ControlItemAndCycleId,
|
||||
y.ControlItemAndCycleCode,
|
||||
y.ControlItemContent,
|
||||
y.Weights,
|
||||
x.WorkPackageEstimate
|
||||
};
|
||||
;
|
||||
|
||||
|
||||
}
|
||||
private string GetDeleteScript()
|
||||
protected void DropMainContractCode_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
return Confirm.GetShowReference("确定删除当前数据吗?", String.Empty, MessageBoxIcon.Question, Grid1.GetDeleteSelectedRowsReference(), String.Empty);
|
||||
if (!string.IsNullOrEmpty(DropContractCode.SelectedValue))
|
||||
{
|
||||
var model = ContractService.GetContractByContractNum(DropContractCode.SelectedValue);
|
||||
if (model != null)
|
||||
{
|
||||
ContractId = model.ContractId;
|
||||
this.txtContractName.Text = model.ContractName;
|
||||
}
|
||||
else
|
||||
{
|
||||
ContractId = "";
|
||||
this.txtContractName.Text = string.Empty;
|
||||
|
||||
}
|
||||
}
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GV 数据操作
|
||||
/// <summary>
|
||||
/// 过滤表头
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
//protected void Grid1_FilterChange(object sender, EventArgs e)
|
||||
//{
|
||||
// this.BindGrid();
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 分页
|
||||
@@ -104,6 +93,36 @@ namespace FineUIPro.Web.PHTGL.ContractCompile
|
||||
this.BindGrid();
|
||||
}
|
||||
|
||||
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = (Model.PHTGL_ContractTrack)e.DataItem;
|
||||
// 工程量偏差
|
||||
decimal QuantityOffset = Funs.GetNewDecimalOrZero(model.EstimatedQuantity) -
|
||||
Funs.GetNewDecimalOrZero(model.SettledQuantity);
|
||||
TemplateField bfQuantityOffset = Grid1.FindColumn("QuantityOffset") as TemplateField;
|
||||
if (QuantityOffset < 0)
|
||||
{
|
||||
e.CellCssClasses[bfQuantityOffset.ColumnIndex] = "color1";
|
||||
}
|
||||
|
||||
// 费用偏差
|
||||
decimal AmountOffset = (model.EstimatedAmount ?? 0) - (model.SettledAmount ?? 0);
|
||||
TemplateField bfAmountOffset = Grid1.FindColumn("AmountOffset") as TemplateField;
|
||||
if (AmountOffset < 0)
|
||||
{
|
||||
e.CellCssClasses[bfAmountOffset.ColumnIndex] = "color1";
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
@@ -150,16 +169,6 @@ namespace FineUIPro.Web.PHTGL.ContractCompile
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Grid行单击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_OnRowClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
BindGrid2();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Grid行双击事件
|
||||
/// </summary>
|
||||
@@ -194,41 +203,6 @@ namespace FineUIPro.Web.PHTGL.ContractCompile
|
||||
}
|
||||
}
|
||||
|
||||
#region 更新上级WBS内容每月实际费用
|
||||
/// <summary>
|
||||
/// 更新上级WBS内容每月实际费用
|
||||
/// </summary>
|
||||
/// <param name="years"></param>
|
||||
/// <param name="months"></param>
|
||||
/// <param name="PlanNum"></param>
|
||||
/// <param name="parentId"></param>
|
||||
private void UpdateWorkPackageParentThisValue(Model.SGGLDB db, string SuperWorkPackageId, DateTime months, decimal thisValue)
|
||||
{
|
||||
Model.WBS_WorkPackage workPackage = db.WBS_WorkPackage.FirstOrDefault(x => x.WorkPackageId == SuperWorkPackageId);
|
||||
if (workPackage != null)
|
||||
{
|
||||
Model.WBS_WorkPackageParentDetail parentDetail = BLL.WorkPackageParentDetailService.GetWorkPackageParentDetailByParentIdAndMonths(SuperWorkPackageId, months);
|
||||
if (parentDetail != null)
|
||||
{
|
||||
parentDetail.ThisValue += thisValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
parentDetail = new Model.WBS_WorkPackageParentDetail();
|
||||
parentDetail.WorkPackageParentDetailId = SQLHelper.GetNewID();
|
||||
parentDetail.ParentId = SuperWorkPackageId;
|
||||
parentDetail.Months = months;
|
||||
parentDetail.ThisValue = thisValue;
|
||||
db.WBS_WorkPackageParentDetail.InsertOnSubmit(parentDetail);
|
||||
}
|
||||
if (workPackage.SuperWorkPackageId != null) //还存在上级节点,需要继续循环
|
||||
{
|
||||
UpdateWorkPackageParentThisValue(db, workPackage.SuperWorkPackageId, months, thisValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnSave_OnClick(object sender, EventArgs e)
|
||||
{
|
||||
JArray EditorArr = Grid1.GetMergedData();
|
||||
@@ -285,7 +259,7 @@ namespace FineUIPro.Web.PHTGL.ContractCompile
|
||||
model.EstimatedQuantity = EstimatedQuantity;
|
||||
model.EstimatedAmount = Funs.GetNewDecimal(EstimatedAmount);
|
||||
model.SettledQuantity = SettledQuantity;
|
||||
model.SettledAmount = Funs.GetNewDecimal(SettledAmount);
|
||||
model.SettledAmount = Funs.GetNewDecimalOrZero(SettledQuantity)* Funs.GetNewDecimalOrZero(TotalCostFixedComprehensiveUnitPrice);
|
||||
|
||||
PhtglContractTrackService.UpdatePHTGL_ContractTrack(model);
|
||||
}
|
||||
@@ -302,6 +276,41 @@ namespace FineUIPro.Web.PHTGL.ContractCompile
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
#region 更新上级WBS内容每月实际费用
|
||||
/// <summary>
|
||||
/// 更新上级WBS内容每月实际费用
|
||||
/// </summary>
|
||||
/// <param name="years"></param>
|
||||
/// <param name="months"></param>
|
||||
/// <param name="PlanNum"></param>
|
||||
/// <param name="parentId"></param>
|
||||
private void UpdateWorkPackageParentThisValue(Model.SGGLDB db, string SuperWorkPackageId, DateTime months, decimal thisValue)
|
||||
{
|
||||
Model.WBS_WorkPackage workPackage = db.WBS_WorkPackage.FirstOrDefault(x => x.WorkPackageId == SuperWorkPackageId);
|
||||
if (workPackage != null)
|
||||
{
|
||||
Model.WBS_WorkPackageParentDetail parentDetail = BLL.WorkPackageParentDetailService.GetWorkPackageParentDetailByParentIdAndMonths(SuperWorkPackageId, months);
|
||||
if (parentDetail != null)
|
||||
{
|
||||
parentDetail.ThisValue += thisValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
parentDetail = new Model.WBS_WorkPackageParentDetail();
|
||||
parentDetail.WorkPackageParentDetailId = SQLHelper.GetNewID();
|
||||
parentDetail.ParentId = SuperWorkPackageId;
|
||||
parentDetail.Months = months;
|
||||
parentDetail.ThisValue = thisValue;
|
||||
db.WBS_WorkPackageParentDetail.InsertOnSubmit(parentDetail);
|
||||
}
|
||||
if (workPackage.SuperWorkPackageId != null) //还存在上级节点,需要继续循环
|
||||
{
|
||||
UpdateWorkPackageParentThisValue(db, workPackage.SuperWorkPackageId, months, thisValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnQuery_OnClick(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
@@ -400,33 +409,5 @@ namespace FineUIPro.Web.PHTGL.ContractCompile
|
||||
return sb.ToString();
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void DropMainContractCode_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(DropContractCode.SelectedValue))
|
||||
{
|
||||
var model = ContractService.GetContractByContractNum(DropContractCode.SelectedValue);
|
||||
if (model != null)
|
||||
{
|
||||
ContractId = model.ContractId;
|
||||
this.txtContractName.Text = model.ContractName;
|
||||
}
|
||||
else
|
||||
{
|
||||
ContractId = "";
|
||||
this.txtContractName.Text = string.Empty;
|
||||
|
||||
}
|
||||
}
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
|
||||
protected void Window3_OnClose(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
BindGrid2();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user