219 lines
10 KiB
C#
219 lines
10 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Net.Configuration;
|
|
using BLL;
|
|
using FineUIPro.Web.PHTGL.BiddingManagement;
|
|
using Model;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace FineUIPro.Web.PHTGL.ContractCompile
|
|
{
|
|
public partial class ContractTrackEdit: PageBase
|
|
{
|
|
#region
|
|
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string Id
|
|
{
|
|
get => (string)ViewState["Id"];
|
|
set => ViewState["Id"] = value;
|
|
}
|
|
|
|
#endregion
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
////权限按钮方法
|
|
GetButtonPower();
|
|
//主合同编号
|
|
this.DropContractCode.DataTextField = "ContractNum";
|
|
this.DropContractCode.DataValueField = "ContractNum";
|
|
this.DropContractCode.DataSource = BLL.PHTGL_ContractReviewService.GetContractReview_CompleteData(this.CurrUser.LoginProjectId);
|
|
this.DropContractCode.DataBind();
|
|
//Funs.FineUIPleaseSelect(this.DropContractCode);
|
|
Id = Request.Params["Id"];
|
|
if (!string.IsNullOrEmpty(Id))
|
|
{
|
|
var model = PhtglContractTrackService.GetPHTGL_ContractTrackById(Id);
|
|
if (model != null)
|
|
{
|
|
|
|
DropContractCode.SelectedValue = ContractService.GetContractById(model.ContractId).ContractNum;
|
|
txtSerialNumber.Text = model.SerialNumber;
|
|
txtMainItemCode.Text = model.MainItemCode;
|
|
txtMainItemName.Text = model.MainItemName;
|
|
txtMajorName.Text = model.MajorName;
|
|
txtMajorCode.Text = model.MajorCode;
|
|
txtSubProject.Text = model.SubProject;
|
|
txtSubItemProject.Text = model.SubItemProject;
|
|
txtProjectCode.Text = model.ProjectCode;
|
|
txtProjectName.Text = model.ProjectName;
|
|
txtProjectDescription.Text = model.ProjectDescription;
|
|
txtUnitOfMeasurement.Text = model.UnitOfMeasurement;
|
|
txtQuantity.Text = model.Quantity;
|
|
txtTotalCostFixedComprehensiveUnitPrice.Text = model.TotalCostFixedComprehensiveUnitPrice.HasValue?model.TotalCostFixedComprehensiveUnitPrice.ToString():"";
|
|
txtMainMaterialCost.Text = model.MainMaterialCost.HasValue ? model.MainMaterialCost.ToString() : "";
|
|
txtTotalPrice.Text = model.TotalPrice.HasValue ? model.TotalPrice.ToString() : "";
|
|
txtCalculationRule.Text = model.CalculationRule;
|
|
txtWorkContent.Text = model.WorkContent;
|
|
txtRemarks.Text = model.Remarks;
|
|
txtConstructionSubcontractor.Text = model.ConstructionSubcontractor;
|
|
txtContractWeight.Text = model.ContractWeight;
|
|
txtMaterialSupplier.Text = model.MaterialSupplier;
|
|
cbIsWithinGeneralContractScope.Checked = model.IsWithinGeneralContractScope ??false;
|
|
txtEstimatedQuantity.Text = model.EstimatedQuantity;
|
|
txtEstimatedAmount.Text =
|
|
model.EstimatedAmount.HasValue ? model.EstimatedAmount.ToString() : "";
|
|
txtSettledQuantity.Text = model.SettledQuantity;
|
|
txtSettledAmount.Text = model.SettledAmount.HasValue ? model.SettledAmount.ToString() : "";
|
|
txtContractId.Text = model.ContractId;
|
|
txtProjectId.Text = model.ProjectId;
|
|
}
|
|
|
|
}
|
|
BindGrid1();
|
|
|
|
}
|
|
}
|
|
|
|
private void BindGrid1()
|
|
{
|
|
Model.PHTGL_ContractTrackProgress queryProgress = new PHTGL_ContractTrackProgress();
|
|
queryProgress.ContractTrackProgressId = ID;
|
|
var tb= PhtglContracttrackprogressService.GetListData(queryProgress, Grid1);
|
|
Grid1.RecordCount = PhtglContracttrackprogressService.Count;
|
|
Grid1.DataSource = tb;
|
|
Grid1.DataBind();
|
|
#region Grid1
|
|
// 删除选中单元格的客户端脚本
|
|
string deleteScript = GetDeleteScript();
|
|
|
|
JObject defaultObj = new JObject();
|
|
defaultObj.Add("BCWS_Quantity", "");
|
|
defaultObj.Add("BCWS_OutputValue", "");
|
|
defaultObj.Add("BCWS_Percentage", "");
|
|
defaultObj.Add("ACWP_Quantity", "");
|
|
defaultObj.Add("ACWP_OutputValue", "");
|
|
defaultObj.Add("ACWP_Percentage", "");
|
|
defaultObj.Add("Date", "");
|
|
|
|
// 在第一行新增一条数据
|
|
btnNew.OnClientClick = Grid1.GetAddNewRecordReference(defaultObj, true);
|
|
// 删除选中行按钮
|
|
btnDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请选择一条记录!") + deleteScript;
|
|
#endregion
|
|
|
|
}
|
|
|
|
private void SaveGrid1()
|
|
{
|
|
/*PhtglContracttrackprogressService.DeleteModleByContractTrackId(ID);
|
|
JArray EditorArr = Grid1.GetMergedData();
|
|
if (EditorArr.Count > 0)
|
|
{
|
|
Model.PHTGL_ContractTrackProgress model = null;
|
|
for (int i = 0; i < EditorArr.Count; i++)
|
|
{
|
|
JObject objects = (JObject)EditorArr[i];
|
|
model = new Model.PHTGL_ContractTrackProgress();
|
|
model.ContractTrackProgressId = SQLHelper.GetNewID(typeof(Model.PHTGL_ContractTrackProgress));
|
|
model.ContractTrackId = ID;
|
|
model.BCWS_Quantity = objects["values"]["BCWS_Quantity"].ToString();
|
|
model.BCWS_OutputValue = objects["values"]["BCWS_OutputValue"].ToString();
|
|
model.BCWS_Percentage = objects["values"]["BCWS_Percentage"].ToString();
|
|
model.ACWP_Quantity = objects["values"]["ACWP_Quantity"].ToString();
|
|
model.ACWP_OutputValue = objects["values"]["ACWP_OutputValue"].ToString();
|
|
model.ACWP_Percentage = objects["values"]["ACWP_Percentage"].ToString();
|
|
model.Date = objects["values"]["Date"].ToString();
|
|
BLL.PhtglContracttrackprogressService.AddPHTGL_ContractTrackProgress(model);
|
|
}
|
|
}*/
|
|
}
|
|
|
|
private string GetDeleteScript()
|
|
{
|
|
return Confirm.GetShowReference("确定删除当前数据吗?", String.Empty, MessageBoxIcon.Question, Grid1.GetDeleteSelectedRowsReference(), String.Empty);
|
|
}
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
var table = new PHTGL_ContractTrack();
|
|
if (string.IsNullOrEmpty(DropContractCode.SelectedValue))
|
|
{
|
|
ShowNotify("请选择施工分包合同",MessageBoxIcon.Question);
|
|
return;
|
|
}
|
|
table.ContractId =ContractService.GetContractByContractNum(DropContractCode.SelectedValue).ContractId;
|
|
table.SerialNumber = txtSerialNumber.Text;
|
|
table.MainItemCode = txtMainItemCode.Text;
|
|
table.MainItemName = txtMainItemName.Text;
|
|
table.MajorName = txtMajorName.Text;
|
|
table.MajorCode = txtMajorCode.Text;
|
|
table.SubProject = txtSubProject.Text;
|
|
table.SubItemProject = txtSubItemProject.Text;
|
|
table.ProjectCode = txtProjectCode.Text;
|
|
table.ProjectName = txtProjectName.Text;
|
|
table.ProjectDescription = txtProjectDescription.Text;
|
|
table.UnitOfMeasurement = txtUnitOfMeasurement.Text;
|
|
table.Quantity = txtQuantity.Text;
|
|
table.TotalCostFixedComprehensiveUnitPrice = Funs.GetNewDecimalOrZero(txtTotalCostFixedComprehensiveUnitPrice.Text);
|
|
table.MainMaterialCost = Funs.GetNewDecimalOrZero(txtMainMaterialCost.Text);
|
|
table.TotalPrice = Funs.GetNewDecimalOrZero(txtTotalPrice.Text);
|
|
table.CalculationRule = txtCalculationRule.Text;
|
|
table.WorkContent = txtWorkContent.Text;
|
|
table.Remarks = txtRemarks.Text;
|
|
table.ConstructionSubcontractor = txtConstructionSubcontractor.Text;
|
|
table.ContractWeight = txtContractWeight.Text;
|
|
table.MaterialSupplier = txtMaterialSupplier.Text;
|
|
table.IsWithinGeneralContractScope = cbIsWithinGeneralContractScope.Checked;
|
|
table.EstimatedQuantity = txtEstimatedQuantity.Text;
|
|
table.EstimatedAmount = Funs.GetNewDecimalOrZero(txtEstimatedAmount.Text);
|
|
table.SettledQuantity = txtSettledQuantity.Text;
|
|
table.SettledAmount = Funs.GetNewDecimalOrZero(txtSettledAmount.Text);
|
|
table.ContractNum = DropContractCode.SelectedValue;
|
|
table.ProjectId = this.CurrUser.LoginProjectId;
|
|
if (string.IsNullOrEmpty(Id))
|
|
{
|
|
table.Id = SQLHelper.GetNewID(typeof(PHTGL_ContractTrack));
|
|
PhtglContractTrackService.AddPHTGL_ContractTrack(table);
|
|
}
|
|
else
|
|
{
|
|
table.Id = Id;
|
|
PhtglContractTrackService.UpdatePHTGL_ContractTrack(table);
|
|
}
|
|
|
|
//SaveGrid1();
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
|
|
#region 获取按钮权限
|
|
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private void GetButtonPower()
|
|
{
|
|
var buttonList = CommonService.GetAllButtonList(CurrUser.LoginProjectId, CurrUser.PersonId,
|
|
Const.PHTGL_ContractTrackMenuId);
|
|
if (buttonList.Count() > 0)
|
|
if (buttonList.Contains(Const.BtnSave))
|
|
btnSave.Hidden = false;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |