private static void AddDateRangeColumn(DataTable tb, string StartYm, string EndYm) { try { int monthsBetween = StringRule.GetMonthsBetween(StartYm, EndYm); for (int i = 0; i < monthsBetween; i++) { string text = StringRule.YmAddMonths(StartYm, i); tb.Columns.Add("PlanMoneyYm_" + text, typeof(decimal)); } } catch (Exception exception) { throw exception; } }
public void RefreshDateRange() { try { this.ResetDateTitleHtml(); this.ResetContractDateRange(); CostBudgetPageRule.ClearFieldValue(this.tb, new string[] { "PlanDataHtml" }); int num = -1; if ((this.StartYm != "") && (this.EndYm != "")) { foreach (DataRow row in this.tb.Rows) { num++; string text = ""; string text2 = row["RecordType"].ToString(); string text3 = ConvertRule.ToString(row["ContractCode"]); string text4 = ConvertRule.ToString(row["CostCode"]); string text5 = ConvertRule.ToString(row["FullCode"]); string text6 = ConvertRule.ToString(row["ParentCode"]); string text7 = ConvertRule.ToString(row["ClassTd"]); int monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm); for (int i = 0; i < monthsBetween; i++) { string text8 = StringRule.YmAddMonths(this.StartYm, i); string text10 = DateTime.Parse(string.Format("{0}-{1}-01", text8.Substring(0, 4), text8.Substring(4, 2))).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"); string text11 = "PlanMoneyYm_" + text8; string text12 = StringRule.BuildShowNumberString(row[text11]); if (this.ReadOnly) { text = text + string.Format("<td align=right nowrap class=\"{1}\">{0}</td>", text12, text7); } } row["PlanDataHtml"] = text; } } } catch (Exception exception) { throw exception; } }
public void ResetDateTitleHtml() { try { this.m_DateTitleHtml1 = ""; this.m_DateTitleHtml2 = ""; if ((this.StartYm != "") && (this.EndYm != "")) { int monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm); for (int i = 0; i < monthsBetween; i++) { string text = StringRule.YmAddMonths(this.StartYm, i); this.m_DateTitleHtml2 = this.m_DateTitleHtml2 + string.Format("<th align=center nowrap>{0}年{1}月</th>", text.Substring(0, 4), text.Substring(4, 2)); } this.m_DateTitleHtml1 = string.Format("<th colspan=\"{0}\">预计发生</th>", monthsBetween); } } catch (Exception exception) { throw exception; } }
public void RefreshDateRange() { try { this.ResetDateTitleHtml(); CostBudgetPageRule.ClearFieldValue(this.tb, new string[] { "PlanDataHtml" }); if ((this.StartYm != "") && (this.EndYm != "")) { foreach (DataRow row in this.tb.Rows) { string costCode = ConvertRule.ToString(row["CostCode"]); string text2 = ""; int monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm); for (int i = 0; i < monthsBetween; i++) { string text3 = StringRule.YmAddMonths(this.StartYm, i); string s = string.Format("{0}-{1}-01", text3.Substring(0, 4), text3.Substring(4, 2)); string payoutDateEnd = DateTime.Parse(s).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"); string text6 = "PayoutMoneyYm_" + text3; string text8 = GetPayoutHref(StringRule.BuildShowNumberString(row[text6]), costCode, s, payoutDateEnd); if (text8 == "") { text2 = text2 + string.Format("<td>{0}</td>", text8); } else { text2 = text2 + string.Format("<td align=right nowrap>{0}</td>", text8); } } row["PlanDataHtml"] = text2; } } } catch (Exception exception) { throw exception; } }
private void ReCalcByRelation() { try { DataView view = new DataView(this.tb, "", "", DataViewRowState.CurrentRows); foreach (DataRowView view2 in view) { DataRow row = view2.Row; if (ConvertRule.ToString(row["FullCode"]) != "") { DataRow[] drs = this.tbPayout.Select("FullCode like '" + ConvertRule.ToString(row["FullCode"]) + "%'"); string[] arrColumnName = new string[] { "PayoutMoney" }; decimal[] numArray = MathRule.SumColumn(drs, arrColumnName); int index = -1; foreach (string text in arrColumnName) { index++; row[text] = numArray[index]; } if ((this.StartYm != "") && (this.EndYm != "")) { int monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm); for (int i = 0; i < monthsBetween; i++) { string text2 = StringRule.YmAddMonths(this.StartYm, i); decimal num4 = MathRule.SumColumn(this.tbPayoutYm.Select("FullCode like '" + ConvertRule.ToString(row["FullCode"]) + "%' and PayoutYm = '" + text2 + "'"), "PayoutMoney"); row["PayoutMoneyYm_" + text2] = num4; } } } } } catch (Exception exception) { throw exception; } }
private void ResetContractDateRange() { try { DropDateRangeColumn(this.tbContract); DropDateRangeColumn(this.tb); DropDateRangeColumn(this.tbApportion); if ((this.StartYm != "") && (this.EndYm != "")) { string contractCode; string costCode; string text3; string name; DataRow row3; DataRow[] rowArray2; int monthsBetween; int monthCount; AddDateRangeColumn(this.tbContract, this.StartYm, this.EndYm); AddDateRangeColumn(this.tb, this.StartYm, this.EndYm); AddDateRangeColumn(this.tbApportion, this.StartYm, this.EndYm); foreach (DataRow row in this.tbContract.Rows) { contractCode = ConvertRule.ToString(row["ContractCode"]); costCode = ConvertRule.ToString(row["CostCode"]); DataRow[] rowArray = this.tbPayout.Select("ContractCode = '" + contractCode + "' and CostCode='" + costCode + "'"); foreach (DataRow row2 in rowArray) { text3 = ConvertRule.ToString(row2["PayoutYm"]); name = "PayoutMoneyYm_" + text3; if (this.tbContract.Columns.Contains(name)) { decimal totalMoney = ConvertRule.ToDecimal(row2["PayoutMoney"]); row[name] = ConvertRule.ToDecimal(row[name]) + totalMoney; this.DoApportion(contractCode, costCode, ConvertRule.ToString(row2["CostBudgetSetCode"]), ConvertRule.ToString(row["RecordType"]), name, totalMoney); } } } foreach (DataRow row in this.tbContract.Rows) { contractCode = ConvertRule.ToString(row["ContractCode"]); costCode = ConvertRule.ToString(row["CostCode"]); row3 = null; rowArray2 = this.tb.Select("ContractCode = '" + contractCode + "' and CostCode = '" + costCode + "' and RecordType <> '' and RecordType <> 'Apportion'"); if (rowArray2.Length > 0) { row3 = rowArray2[0]; } if (row3 != null) { monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm); for (monthCount = 0; monthCount < monthsBetween; monthCount++) { text3 = StringRule.YmAddMonths(this.StartYm, monthCount); name = "PayoutMoneyYm_" + text3; row3[name] = row[name]; } } } foreach (DataRow row4 in this.tbApportion.Rows) { contractCode = ConvertRule.ToString(row4["ContractCode"]); costCode = ConvertRule.ToString(row4["CostCode"]); string text5 = ConvertRule.ToString(row4["PBSCode"]); row3 = null; rowArray2 = this.tb.Select("ContractCode = '" + contractCode + "' and CostCode = '" + costCode + "' and PBSCode = '" + text5 + "' and RecordType <> ''"); if (rowArray2.Length > 0) { row3 = rowArray2[0]; } if (row3 != null) { monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm); for (monthCount = 0; monthCount < monthsBetween; monthCount++) { text3 = StringRule.YmAddMonths(this.StartYm, monthCount); name = "PayoutMoneyYm_" + text3; row3[name] = row4[name]; } } } this.ReCalcByRelation(this.StartYm, this.EndYm); } } catch (Exception exception) { throw exception; } }