public static DataTable GenerateEmptyCostTargetDtl(string StartY, string EndY, EntityData entityTargetHis) { DataTable table2; try { EntityData costBudgetDtlByCode = CostBudgetDAO.GetCostBudgetDtlByCode(""); DataTable tbDtl = costBudgetDtlByCode.CurrentTable.Clone(); AddColumnTargetHis(tbDtl, entityTargetHis); tbDtl.Columns.Add("BudgetMoneyHisHtml"); tbDtl.Columns.Add("BudgetMoneyHtml"); tbDtl.Columns.Add("BudgetValidMoney", typeof(decimal)); tbDtl.Columns.Add("DescriptionHtml"); tbDtl.Columns.Add("CostName"); tbDtl.Columns.Add("SortID"); tbDtl.Columns.Add("Deep", typeof(int)); tbDtl.Columns.Add("ParentCode"); tbDtl.Columns.Add("FullCode"); tbDtl.Columns.Add("ChildCount", typeof(int)); tbDtl.Columns.Add("IsLeafCBS", typeof(bool)); tbDtl.Columns.Add("MeasurementUnit"); AddMonthField(tbDtl, StartY, EndY, "BudgetMoney_"); tbDtl.Columns.Add("PlanDataHtml"); costBudgetDtlByCode.Dispose(); table2 = tbDtl; } catch (Exception exception) { throw exception; } return(table2); }
public static DataTable CreateGroupAreaTable(string GroupCode, string ProjectCode, string CostBudgetBackupCode) { DataTable table2; try { EntityData data; string[] arrColumnName = new string[] { "BuildingArea", "HouseCount", "HouseArea" }; DataTable table = new DataTable("GroupArea"); table.Columns.Add("GroupCode"); foreach (string text in arrColumnName) { table.Columns.Add(text, typeof(decimal)); } DataRow row = table.NewRow(); row["GroupCode"] = GroupCode; table.Rows.Add(row); if (CostBudgetBackupCode != "") { data = CostBudgetDAO.GetCostBudgetBackupSetByGroupCode(CostBudgetBackupCode, GroupCode, true); } else { data = CostBudgetDAO.GetV_CostBudgetSetByGroupCode(GroupCode, ProjectCode, CostBudgetRule.m_BaseSetType); } if (data.HasRecord()) { DataRow[] drs = data.CurrentTable.Select("PBSType = 'P'"); if (drs.Length > 0) { foreach (string text in arrColumnName) { row[text] = drs[0][text]; } } else { drs = data.CurrentTable.Select("PBSType = 'B'"); if (drs.Length > 0) { decimal[] numArray = MathRule.SumColumn(drs, arrColumnName); int index = -1; foreach (string text in arrColumnName) { index++; row[text] = numArray[index]; } } } } data.Dispose(); table2 = table; } catch (Exception exception) { throw exception; } return(table2); }
private void InitSetArray() { try { EntityData data = CostBudgetDAO.GetCostBudgetSetByGroupCode(this.GroupCode, this.ProjectCode, CostBudgetRule.m_BaseSetType); this.m_arrCostBudgetSetCode = new string[data.CurrentTable.Rows.Count]; this.m_arrDyn = new CostBudgetDynamic[this.m_arrCostBudgetSetCode.Length]; int index = -1; foreach (DataRow row in data.CurrentTable.Rows) { index++; this.m_arrCostBudgetSetCode[index] = row["CostBudgetSetCode"].ToString(); } data.Dispose(); } catch (Exception exception) { throw exception; } }
private void InitCostBudgetSet() { try { this.tbCostBudgetSet.Rows.Clear(); this.tbCostBudgetSet.AcceptChanges(); EntityData costBudgetSetByProjectCode = CostBudgetDAO.GetCostBudgetSetByProjectCode(this.ProjectCode); foreach (DataRow row2 in costBudgetSetByProjectCode.CurrentTable.Rows) { DataRow row = this.tbCostBudgetSet.NewRow(); row["CostBudgetSetCode"] = row2["CostBudgetSetCode"]; row["CostBudgetSetName"] = row2["CostBudgetSetName"]; this.tbCostBudgetSet.Rows.Add(row); } costBudgetSetByProjectCode.Dispose(); } catch (Exception exception) { throw exception; } }
public DataTable GenerateCurrent() { DataTable table2; try { if (this.entityTargetHis != null) { this.entityTargetHis.Dispose(); } if (this.IsShowTargetMoneyHis) { this.entityTargetHis = CostBudgetRule.GetRelationCostBudget(this.ProjectCode, this.FirstCostBudgetCode, "1,2", this.CostBudgetCode); } DataTable table = CostBudgetPageRule.GenerateEmptyCostTargetDtl(this.StartY, this.EndY, this.entityTargetHis); EntityData allCBSBySet = CostBudgetRule.GetAllCBSBySet(this.ProjectCode, this.CostBudgetSetCode); if (allCBSBySet == null) { return(table); } if (this.ShowCostCode != "") { string cBSFullCode = CBSRule.GetCBSFullCode(this.ShowCostCode); DataRow[] rowArray = allCBSBySet.CurrentTable.Select(string.Format("FullCode not like '{0}%'", cBSFullCode)); foreach (DataRow row in rowArray) { allCBSBySet.CurrentTable.Rows.Remove(row); } CostBudgetRule.ResetCBSDeep(allCBSBySet.CurrentTable); } DataRow row2 = null; if (this.ShowCostCode == "") { row2 = table.NewRow(); row2["CostBudgetDtlCode"] = "R_0"; row2["CostCode"] = row2["CostBudgetDtlCode"]; row2["CostName"] = "合计"; row2["Deep"] = 1; row2["ParentCode"] = ""; row2["ChildCount"] = 1; row2["IsExpand"] = 1; table.Rows.Add(row2); } int num = 0; foreach (DataRow row3 in allCBSBySet.CurrentTable.Rows) { num--; DataRow drDtl = table.NewRow(); drDtl["CostBudgetDtlCode"] = num; CostBudgetPageRule.FillCostBudgetDtlCBSData(drDtl, row3); if (row2 != null) { if (ConvertRule.ToInt(drDtl["Deep"]) == 1) { drDtl["ParentCode"] = row2["CostBudgetDtlCode"]; } drDtl["Deep"] = ConvertRule.ToInt(drDtl["Deep"]) + 1; } else if (ConvertRule.ToInt(drDtl["Deep"]) == 1) { drDtl["ParentCode"] = ""; } table.Rows.Add(drDtl); } EntityData validCostBudget = CostBudgetRule.GetValidCostBudget(this.CostBudgetSetCode, 1); EntityData costBudgetDtlByCostBudgetCode = null; if (validCostBudget.HasRecord()) { costBudgetDtlByCostBudgetCode = CostBudgetDAO.GetCostBudgetDtlByCostBudgetCode(validCostBudget.GetString("CostBudgetCode")); } EntityData data4 = CostBudgetDAO.GetCostBudgetDtlByCostBudgetCode(this.CostBudgetCode); EntityData costBudgetMonthByCostBudgetCode = CostBudgetDAO.GetCostBudgetMonthByCostBudgetCode(this.CostBudgetCode); foreach (DataRow row5 in table.Rows) { DataRow[] rowArray2 = data4.CurrentTable.Select("CostCode='" + ConvertRule.ToString(row5["CostCode"]) + "'"); if (rowArray2.Length > 0) { row5["CostBudgetDtlCode"] = rowArray2[0]["CostBudgetDtlCode"]; row5["Price"] = rowArray2[0]["Price"]; row5["Qty"] = rowArray2[0]["Qty"]; row5["BudgetMoney"] = rowArray2[0]["BudgetMoney"]; row5["IsExpand"] = rowArray2[0]["IsExpand"]; row5["Description"] = rowArray2[0]["Description"]; row5["DescriptionHtml"] = rowArray2[0]["Description"]; } if (costBudgetDtlByCostBudgetCode != null) { DataRow[] rowArray3 = costBudgetDtlByCostBudgetCode.CurrentTable.Select("CostCode='" + ConvertRule.ToString(row5["CostCode"]) + "'"); if (rowArray3.Length > 0) { row5["BudgetValidMoney"] = rowArray3[0]["BudgetMoney"]; } } foreach (DataColumn column in table.Columns) { if (column.ColumnName.StartsWith("BudgetMoney_")) { string text2 = column.ColumnName.Replace("BudgetMoney_", ""); string val = text2.Substring(0, 4); string text4 = text2.Substring(4, 2); int num2 = ConvertRule.ToInt(val); int num3 = ConvertRule.ToInt(text4); DataRow[] rowArray4 = costBudgetMonthByCostBudgetCode.CurrentTable.Select("CostBudgetDtlCode = '" + ConvertRule.ToString(row5["CostBudgetDtlCode"]) + "' and IYear = " + num2.ToString() + " and IMonth = " + num3.ToString()); if (rowArray4.Length > 0) { row5[column.ColumnName] = rowArray4[0]["BudgetMoney"]; } } } if (!this.IsModify) { row5["PlanDataHtml"] = CostBudgetPageRule.GenerateCostBudgetPlanDataHtml(row5, this.iStartY, this.iEndY, "BudgetMoney_"); } } allCBSBySet.Dispose(); data4.Dispose(); costBudgetMonthByCostBudgetCode.Dispose(); validCostBudget.Dispose(); if (costBudgetDtlByCostBudgetCode != null) { costBudgetDtlByCostBudgetCode.Dispose(); } if (row2 != null) { DataRow[] drs = table.Select("ParentCode = '" + row2["CostBudgetDtlCode"].ToString() + "'"); string[] textArray = new string[] { "BudgetMoney", "BudgetValidMoney" }; string[] textArray2 = CostBudgetPageRule.BuildArrayFieldByMonth(this.StartY, this.EndY, "BudgetMoney_"); string[] arrColumnName = ConvertRule.ArrayConcat(textArray, textArray2); decimal[] numArray = MathRule.SumColumn(drs, arrColumnName); int index = -1; foreach (string text5 in arrColumnName) { index++; row2[text5] = numArray[index]; } if (!this.IsModify) { row2["PlanDataHtml"] = CostBudgetPageRule.GenerateCostBudgetPlanDataHtml(row2, this.iStartY, this.iEndY, "BudgetMoney_"); } } table2 = table; } catch (Exception exception) { throw exception; } return(table2); }
public static DataSet GenerateEmptyCostBudgetDtl(string StartY, string EndY, EntityData entityTargetHis) { DataSet set2; try { DataSet set = new DataSet(); EntityData costBudgetDtlByCode = CostBudgetDAO.GetCostBudgetDtlByCode(""); DataTable tbDtl = costBudgetDtlByCode.CurrentTable.Clone(); AddColumnTargetHis(tbDtl, entityTargetHis); tbDtl.Columns.Add("BudgetMoneyHisHtml"); tbDtl.Columns.Add("BudgetMoneyHtml"); tbDtl.Columns.Add("BudgetValidMoney", typeof(decimal)); tbDtl.Columns.Add("DescriptionHtml"); tbDtl.Columns.Add("CostName"); tbDtl.Columns.Add("SortID"); tbDtl.Columns.Add("Deep", typeof(int)); tbDtl.Columns.Add("ParentCode"); tbDtl.Columns.Add("FullCode"); tbDtl.Columns.Add("ChildCount", typeof(int)); tbDtl.Columns.Add("IsLeafCBS", typeof(bool)); tbDtl.Columns.Add("MeasurementUnit"); costBudgetDtlByCode.Dispose(); set.Tables.Add(tbDtl); tbDtl.Columns.Add("BudgetChangeMoney", typeof(decimal)); tbDtl.Columns.Add("BudgetChangeDescription"); tbDtl.Columns.Add("BalanceContractMoney", typeof(decimal)); tbDtl.Columns.Add("ContractCode"); tbDtl.Columns.Add("ContractID"); tbDtl.Columns.Add("ContractName"); tbDtl.Columns.Add("SupplierCode"); tbDtl.Columns.Add("SupplierName"); tbDtl.Columns.Add("ContractTotalMoney", typeof(decimal)); tbDtl.Columns.Add("ContractMoney", typeof(decimal)); tbDtl.Columns.Add("ContractChangeMoney", typeof(decimal)); tbDtl.Columns.Add("ContractApplyMoney", typeof(decimal)); tbDtl.Columns.Add("ContractAccountMoney", typeof(decimal)); tbDtl.Columns.Add("ContractBudgetBalance", typeof(decimal)); tbDtl.Columns.Add("ContractPay", typeof(decimal)); tbDtl.Columns.Add("ContractPayReal", typeof(decimal)); tbDtl.Columns.Add("ContractPayBalance", typeof(decimal)); tbDtl.Columns.Add("ContractPayRealBalance", typeof(decimal)); tbDtl.Columns.Add("ContractPayPercent", typeof(decimal)); tbDtl.Columns.Add("BuildingPrice", typeof(decimal)); tbDtl.Columns.Add("HousePrice", typeof(decimal)); tbDtl.Columns.Add("BudgetPrice", typeof(decimal)); tbDtl.Columns.Add("ContractOriginalPrice", typeof(decimal)); DataTable table = new DataTable("Month"); set.Tables.Add(table); table.Columns.Add("CostCode"); table.Columns.Add("FullCode"); table.Columns.Add("RecordType"); table.Columns.Add("IYear", typeof(int)); table.Columns.Add("IMonth", typeof(int)); table.Columns.Add("Money", typeof(decimal)); DataTable table3 = new DataTable("Contract"); set.Tables.Add(table3); table3.Columns.Add("ContractCode"); table3.Columns.Add("AllContractCode"); table3.Columns.Add("RecordType"); table3.Columns.Add("ContractID"); table3.Columns.Add("ContractName"); table3.Columns.Add("SupplierCode"); table3.Columns.Add("SupplierName"); table3.Columns.Add("Description"); table3.Columns.Add("DescriptionHtml"); table3.Columns.Add("CostCode"); table3.Columns.Add("FullCode"); table3.Columns.Add("BudgetMoney", typeof(decimal)); table3.Columns.Add("ContractTotalMoney", typeof(decimal)); table3.Columns.Add("ContractMoney", typeof(decimal)); table3.Columns.Add("ContractChangeMoney", typeof(decimal)); table3.Columns.Add("ContractApplyMoney", typeof(decimal)); table3.Columns.Add("ContractAccountMoney", typeof(decimal)); table3.Columns.Add("ContractBudgetBalance", typeof(decimal)); table3.Columns.Add("ContractPay", typeof(decimal)); table3.Columns.Add("ContractPayReal", typeof(decimal)); table3.Columns.Add("ContractPayBalance", typeof(decimal)); table3.Columns.Add("ContractPayRealBalance", typeof(decimal)); table3.Columns.Add("ContractPayPercent", typeof(decimal)); table3.Columns.Add("BuildingPrice", typeof(decimal)); table3.Columns.Add("HousePrice", typeof(decimal)); table3.Columns.Add("BudgetPrice", typeof(decimal)); table3.Columns.Add("ContractOriginalPrice", typeof(decimal)); DataTable table4 = table3.Clone(); table4.TableName = "NoContract"; set.Tables.Add(table4); DataTable table5 = table3.Clone(); table5.TableName = "Balance"; set.Tables.Add(table5); DataTable table6 = new DataTable("ContractMonth"); set.Tables.Add(table6); table6.Columns.Add("ContractCode"); table6.Columns.Add("CostCode"); table6.Columns.Add("FullCode"); table6.Columns.Add("RecordType"); table6.Columns.Add("IYear", typeof(int)); table6.Columns.Add("IMonth", typeof(int)); table6.Columns.Add("Money", typeof(decimal)); DataTable table7 = CostBudgetDAO.GetCostBudgetContractByCode("").CurrentTable.Clone(); set.Tables.Add(table7); set2 = set; } catch (Exception exception) { throw exception; } return(set2); }
private void FillCostTargetHisHtml() { try { if (this.entityTargetHis != null) { string text2; ArrayList list = new ArrayList(); foreach (DataRowView view in this.dvTargetHis) { DataRow row = view.Row; string text = ConvertRule.ToString(row["VerID"]); if (text != "") { list.Add(text); text2 = "BudgetMoneyHis_" + text; EntityData costBudgetDtlByCostBudgetCode = CostBudgetDAO.GetCostBudgetDtlByCostBudgetCode(row["CostBudgetCode"].ToString()); if (costBudgetDtlByCostBudgetCode.HasRecord()) { foreach (DataRow row2 in this.tb.Rows) { DataRow[] rowArray = costBudgetDtlByCostBudgetCode.CurrentTable.Select("CostCode='" + ConvertRule.ToString(row2["CostCode"]) + "'"); if (rowArray.Length > 0) { row2[text2] = rowArray[0]["BudgetMoney"]; } } } costBudgetDtlByCostBudgetCode.Dispose(); } } if (this.tb.Rows.Count > 0) { DataRow row3 = this.tb.Rows[0]; DataRow[] drs = this.tb.Select("ParentCode = '" + row3["CostBudgetDtlCode"].ToString() + "'"); string[] arrColumnName = new string[list.Count]; int index = -1; foreach (string text in list) { index++; arrColumnName[index] = "BudgetMoneyHis_" + text; } decimal[] numArray = MathRule.SumColumn(drs, arrColumnName); int num2 = -1; foreach (string text3 in arrColumnName) { num2++; row3[text3] = numArray[num2]; } } foreach (DataRow row2 in this.tb.Rows) { string text4 = ""; foreach (string text in list) { text2 = "BudgetMoneyHis_" + text; text4 = text4 + string.Format("<td align=right nowrap title='{1}'>{0}</td>", CostBudgetPageRule.GetMoneyShowString(row2[text2], this.m_MoneyUnit), CostBudgetPageRule.GetWanDecimalShowHint(row2[text2])); } row2["BudgetMoneyHisHtml"] = text4; } } else { foreach (DataRow row2 in this.tb.Rows) { row2["BudgetMoneyHisHtml"] = ""; } } } catch (Exception exception) { throw exception; } }
public DataTable Generate() { DataTable tb; try { if (this.ShowTargetHis) { this.LoadTargetHis(); } this.tb = CostBudgetPageRule.GenerateEmptyCostTargetDtl(this.StartY, this.EndY, this.entityTargetHis); EntityData costBudgetDtlByCostBudgetCode = CostBudgetDAO.GetCostBudgetDtlByCostBudgetCode(this.CostBudgetCode); EntityData costBudgetMonthByCostBudgetCode = CostBudgetDAO.GetCostBudgetMonthByCostBudgetCode(this.CostBudgetCode); EntityData allCBSBySet = CostBudgetRule.GetAllCBSBySet(this.ProjectCode, this.CostBudgetSetCode); DataRow row = this.tb.NewRow(); row["CostBudgetDtlCode"] = "R_0"; row["CostCode"] = row["CostBudgetDtlCode"]; row["CostName"] = "合计"; row["Deep"] = 1; row["ParentCode"] = ""; row["ChildCount"] = 1; row["IsExpand"] = 1; this.tb.Rows.Add(row); foreach (DataRow row2 in costBudgetDtlByCostBudgetCode.CurrentTable.Rows) { string text = ConvertRule.ToString(row2["CostBudgetDtlCode"]); DataRow drDst = this.tb.NewRow(); ConvertRule.DataRowCopy(row2, drDst, costBudgetDtlByCostBudgetCode.CurrentTable, this.tb); DataRow[] rowArray = allCBSBySet.CurrentTable.Select("CostCode='" + ConvertRule.ToString(drDst["CostCode"]) + "'"); if (rowArray.Length > 0) { CostBudgetPageRule.FillCostBudgetDtlCBSData(drDst, rowArray[0]); } drDst["Deep"] = ConvertRule.ToInt(drDst["Deep"]) + 1; if (ConvertRule.ToInt(drDst["Deep"]) == (ConvertRule.ToInt(row["Deep"]) + 1)) { drDst["ParentCode"] = row["CostBudgetDtlCode"]; } foreach (DataColumn column in this.tb.Columns) { if (column.ColumnName.StartsWith("BudgetMoney_")) { string text2 = column.ColumnName.Replace("BudgetMoney_", ""); string val = text2.Substring(0, 4); string text4 = text2.Substring(4, 2); int num = ConvertRule.ToInt(val); int num2 = ConvertRule.ToInt(text4); DataRow[] rowArray2 = costBudgetMonthByCostBudgetCode.CurrentTable.Select("CostBudgetDtlCode = '" + text + "' and IYear = " + num.ToString() + " and IMonth = " + num2.ToString()); if (rowArray2.Length > 0) { drDst[column.ColumnName] = rowArray2[0]["BudgetMoney"]; } } } drDst["PlanDataHtml"] = CostBudgetPageRule.GenerateCostBudgetPlanDataHtml(drDst, this.iStartY, this.iEndY, "BudgetMoney_"); this.tb.Rows.Add(drDst); } costBudgetDtlByCostBudgetCode.Dispose(); costBudgetMonthByCostBudgetCode.Dispose(); allCBSBySet.Dispose(); DataRow[] drs = this.tb.Select("ParentCode = '" + row["CostBudgetDtlCode"].ToString() + "'"); string[] textArray = new string[] { "BudgetMoney" }; string[] textArray2 = CostBudgetPageRule.BuildArrayFieldByMonth(this.StartY, this.EndY, "BudgetMoney_"); string[] arrColumnName = ConvertRule.ArrayConcat(textArray, textArray2); decimal[] numArray = MathRule.SumColumn(drs, arrColumnName); int index = -1; foreach (string text5 in arrColumnName) { index++; row[text5] = numArray[index]; } row["PlanDataHtml"] = CostBudgetPageRule.GenerateCostBudgetPlanDataHtml(row, this.iStartY, this.iEndY, "BudgetMoney_"); CostBudgetPageRule.SetColumnTargetHis(this.tb, this.entityTargetHis); this.FillCostTargetHisHtml(); this.GenerateTargetHisHead(); tb = this.tb; } catch (Exception exception) { throw exception; } return(tb); }