private Result GetResult() { Result result = new Result(); _SubheadingsInfo info1 = this.Parent as _SubheadingsInfo; _MSubheadingsInfo info2 = this.Parent as _MSubheadingsInfo; if (info1 != null) { foreach (_SubheadingsInfo item in info1.Parent.SubheadingsList) { if (item.LB == "子目") { result.CLF += (from n in item.IncreaseCostsList.Cast <_IncreaseCostsInfo>() where n.DH == this.DH select n.CLF).Sum(); result.RGF += (from n in item.IncreaseCostsList.Cast <_IncreaseCostsInfo>() where n.DH == this.DH select n.RGF).Sum(); result.JXF += (from n in item.IncreaseCostsList.Cast <_IncreaseCostsInfo>() where n.DH == this.DH select n.JXF).Sum(); } } } if (info2 != null) { foreach (_SubheadingsInfo item in info2.Parent.SubheadingsList) { if (item.LB == "子目") { result.CLF += (from n in item.IncreaseCostsList.Cast <_IncreaseCostsInfo>() where n.DH == this.DH select n.CLF).Sum(); result.RGF += (from n in item.IncreaseCostsList.Cast <_IncreaseCostsInfo>() where n.DH == this.DH select n.RGF).Sum(); result.JXF += (from n in item.IncreaseCostsList.Cast <_IncreaseCostsInfo>() where n.DH == this.DH select n.JXF).Sum(); } } } return(result); }
/// <summary> /// 清单的下面的增加费计算 /// </summary> private void PBegin() { _ObjectInfo info = GetQIncreaseCosts(); _SubheadingsInfo info1 = info as _SubheadingsInfo; _MSubheadingsInfo info2 = info as _MSubheadingsInfo; if (info1 != null) { Result result = GetResult(); info1.Statistics.ResultVarable.Set(_Statistics.FILED_RGFDJ, result.RGF); info1.Statistics.ResultVarable.Set(_Statistics.FILED_CLFDJ, result.CLF); info1.Statistics.ResultVarable.Set(_Statistics.FILED_JXFDJ, result.JXF); decimal temp = result.JXF + result.CLF + result.RGF; info1.Statistics.ResultVarable.Set(_Statistics.FILED_ZJFDJ, temp); info1.Statistics.ResultVarable.Set(_Statistics.FILED_ZHDJ, temp); info1.Begin(); } if (info2 != null) { Result result = GetResult(); info2.Statistics.ResultVarable.Set(_Statistics.FILED_RGFDJ, result.RGF); info2.Statistics.ResultVarable.Set(_Statistics.FILED_CLFDJ, result.CLF); info2.Statistics.ResultVarable.Set(_Statistics.FILED_JXFDJ, result.JXF); decimal temp = result.JXF + result.CLF + result.RGF; info2.Statistics.ResultVarable.Set(_Statistics.FILED_ZJFDJ, temp); info2.Statistics.ResultVarable.Set(_Statistics.FILED_ZHDJ, temp); info2.Begin(); } }
private _ObjectInfo GetQIncreaseCosts() { _ObjectInfo info = null; _SubheadingsInfo info1 = this.Parent as _SubheadingsInfo; _MSubheadingsInfo info2 = this.Parent as _MSubheadingsInfo; if (info1 != null) { foreach (_ObjectInfo item in info1.Parent.IncreaseCostsList) { if (item.XMBM == this.DH) { return(item); } } } if (info2 != null) { foreach (_ObjectInfo item in info2.Parent.IncreaseCostsList) { if (item.XMBM == this.DH) { return(item); } } } return(info); }
/// <summary> /// 构造函数 /// </summary> public _MSubheadings_Statistics(_MSubheadingsInfo p_Parent) { this.m_Parent = p_Parent; //准备子目变量 this.m_Variable = new _CVariable(); this.m_DEVariable = new _CVariable(); this.builder(); }
private void AddZm() { if (this.Parent == null) { return; } //if (this.Activitie == null) return; if (this.SubheadingsList.Count < 1) { _SubheadingsInfo info = new _MSubheadingsInfo(); info.XMBM = "补" + this.XMBM.Replace("补", ""); info.OLDXMBM = this.XMBM.Replace("补", ""); info.XMMC = "补充定额"; info.GCL = 1m; info.SC = true; info.LB = "子目"; info.DW = this.DW; info.TX = this.Activitie.ProType.Replace("【", "").Replace("】", "").Substring(0, 2); info.LibraryName = this.Activitie.Property.Libraries.FixedLibrary.FullName; this.Create(info); this.Activitie.Property.MeasuresProject.DataSource.ResetBindings(false); // this.Activitie.Property.SubSegments.DataSource.ResetBindings(false); } }
private void LoadTable(DataTable dt) { if (dt == null) { return; } DataRow[] crows = dt.Select("ParentID=1");//父级编号为1的为通用项目 int xh = 1; for (int i = 0; i < crows.Length; i++) { _CommonrojectInfo info = new _CommonrojectInfo(); info.JSJC = ""; info.FL = ""; info.GCL = 0m; info.XMMC = crows[i]["Name"].ToString(); info.XMBM = crows[i]["Codes"].ToString(); info.OLDXMBM = crows[i]["Codes"].ToString(); //通用项目添加到集合 this.Create(info); DataRow[] rows = dt.Select("ParentID=" + crows[i]["ID"] + "");//父级编号为为通用项目ID的项为清单 int m = 1; for (int j = 0; j < rows.Length; j++) { _MFixedListInfo minfo = new _MFixedListInfo(); minfo.XMMC = rows[j]["Name"].ToString(); minfo.LB = rows[j]["Type"].ToString(); minfo.GCL = 1m; minfo.JSJC = rows[j]["Calculation"].ToString(); minfo.FL = rows[j]["Rate"].ToString(); minfo.DW = rows[j]["Unit"].ToString(); minfo.XMBM = rows[j]["Codes"].ToString(); minfo.OLDXMBM = rows[j]["Codes"].ToString(); minfo.XH = xh++; if (rows[j]["Remark"].ToString().Contains("通用项目")) { minfo.XH2 = int.Parse(rows[j]["Remark"].ToString().Replace("通用项目", "")); } if (i == 0 && m < 5) { minfo.ISTY = true; } m++; info.Create(minfo); DataRow[] srows = dt.Select("ParentID=" + rows[j]["ID"] + "");//父级编号为为清单ID的项为子目 for (int k = 0; k < srows.Length; k++) { _MSubheadingsInfo sinfo = new _MSubheadingsInfo(); sinfo.XMMC = srows[k]["Name"].ToString(); sinfo.LB = srows[k]["Type"].ToString(); sinfo.JSJC = srows[k]["Calculation"].ToString(); sinfo.FL = srows[k]["Rate"].ToString(); sinfo.DW = srows[k]["Unit"].ToString(); sinfo.LibraryName = this.Parent.Property.DLibraries.FixedLibrary.FullName; sinfo.GCL = 1m; sinfo.XMBM = srows[k]["Codes"].ToString(); sinfo.OLDXMBM = srows[k]["Codes"].ToString(); minfo.Create(sinfo); } } } }