public static string[] BuildArrayFieldByMonth(string StartY, string EndY, int StartM, int EndM, string FieldPre) { string[] textArray2; try { string[] textArray = new string[0]; int num = ConvertRule.ToInt(StartY); int num2 = ConvertRule.ToInt(EndY); int num3 = (EndM - StartM) + 1; if (num > 0) { int num4 = ((num2 - num) + 1) * num3; if (num4 > 0) { textArray = new string[num4]; int index = -1; for (int i = num; i <= num2; i++) { for (int j = StartM; j <= EndM; j++) { index++; string text = ConvertRule.FormatYYYYMM(i, j); textArray[index] = FieldPre + text; } } } } textArray2 = textArray; } catch (Exception exception) { throw exception; } return(textArray2); }
public static void AddMonthField(DataTable tb, string aStartY, string aEndY, string FieldName) { try { string val = aStartY; string text2 = aEndY; if ((val != "") && (text2 == "")) { text2 = val; } if ((text2 != "") && (val == "")) { val = text2; } if ((val != "") && (text2 != "")) { int num = ConvertRule.ToInt(val); int num2 = ConvertRule.ToInt(text2); for (int i = num; i <= num2; i++) { for (int j = 0; j <= 12; j++) { string text3 = ConvertRule.FormatYYYYMM(i, j); tb.Columns.Add(FieldName + text3, typeof(decimal)); } } } } catch (Exception exception) { throw exception; } }
public static void GenerateCostBudgetPlanTitleHtml(DataTable tbDtl, int iStartY, int iEndY, ref string html_title1, ref string html_title2) { try { html_title1 = ""; html_title2 = ""; if ((iStartY != 0) || (iEndY != 0)) { for (int i = iStartY; i <= iEndY; i++) { for (int j = 0; j <= 12; j++) { string text2; int num4; string text = ConvertRule.FormatYYYYMM(i, j); int expand = GetExpandByYear(i.ToString(), iStartY.ToString()); if (expand == 0) { text2 = "展开到月度"; num4 = 1; } else { text2 = "折叠到年度"; num4 = 13; } if (j == 0) { html_title1 = html_title1 + string.Format("<th colspan={3} align=center nowrap id='YearTitle_{0}'><a href='#' onclick='javascript:YearExpand(this);return false;' expand={1} title='{2}' key='{0}'>{0}</a></th>", new object[] { i, expand, text2, num4 }); html_title2 = html_title2 + string.Format("<th align=center nowrap id='YearTitle_{0}'>年度</th>", text); } else { html_title2 = html_title2 + string.Format("<th align=center nowrap id='YearTitle_{0}' style='display:{2}'>{1}</th>", text, j, GetStyleDisplayByExpand(expand)); } } } } } catch (Exception exception) { throw exception; } }
public static string GenerateCostBudgetPlanDataHtml(DataRow drDtl, int iStartY, int iEndY, string FieldName, string ClassTd) { string text6; try { string text = ""; if ((iStartY == 0) && (iEndY == 0)) { return(""); } for (int i = iStartY; i <= iEndY; i++) { for (int j = 0; j <= 12; j++) { string text2 = ConvertRule.FormatYYYYMM(i, j); string text3 = FieldName + text2; string moneyShowString = GetMoneyShowString(drDtl[text3]); string wanDecimalShowHint = GetWanDecimalShowHint(drDtl[text3]); int expand = GetExpandByYear(i.ToString(), iStartY.ToString()); text = text + string.Format("<td align=right nowrap id='YearData_{0}' title='{1}'", text2, wanDecimalShowHint); if (ClassTd != "") { text = text + string.Format(" class='{0}'", ClassTd); } if (j != 0) { text = text + string.Format(" style='display:{0}'", GetStyleDisplayByExpand(expand)); } text = text + ">" + moneyShowString + "</td>"; } } text6 = text; } catch (Exception exception) { throw exception; } return(text6); }
public void RefreshHtml() { try { DataRow drDst; if (!this.ds.Tables.Contains("Html")) { this.ds.Tables.Add(CostBudgetPageRule.CreateDynamicHtmlTable(this.StartY, this.EndY, this.tb)); } this.tbHtml.Clear(); foreach (DataRow row in this.tb.Rows) { drDst = this.tbHtml.NewRow(); ConvertRule.DataRowCopy(row, drDst, this.tb, this.tbHtml); this.tbHtml.Rows.Add(drDst); } if ((this.StartY != "") && (this.EndY != "")) { DataRow[] drsChild; DataView view = new DataView(this.tbHtml, "Deep = 3", "", DataViewRowState.CurrentRows); foreach (DataRowView view2 in view) { int objYear; int objMonth; string text4; string name; drDst = view2.Row; string text = ConvertRule.ToString(drDst["CostCode"]); string text2 = ConvertRule.ToString(drDst["FullCode"]); string text3 = ConvertRule.ToString(drDst["CostBudgetSetCode"]); DataRow[] rowArray = this.tbMonth.Select(string.Format("CostCode = '{0}' and CostBudgetSetCode = '{1}'", text, text3)); foreach (DataRow row3 in rowArray) { objYear = ConvertRule.ToInt(row3["IYear"]); objMonth = ConvertRule.ToInt(row3["IMonth"]); text4 = ConvertRule.FormatYYYYMM(objYear, objMonth); name = "BudgetMoney_" + text4; if (this.tbHtml.Columns.Contains(name)) { drDst[name] = ConvertRule.ToDecimal(drDst[name]) + ConvertRule.ToDecimal(row3["Money"]); } } rowArray = this.tbContractMonth.Select(string.Format("FullCode like '{0}%' and CostBudgetSetCode = '{1}'", text2, text3)); foreach (DataRow row3 in rowArray) { objYear = ConvertRule.ToInt(row3["IYear"]); objMonth = ConvertRule.ToInt(row3["IMonth"]); text4 = ConvertRule.FormatYYYYMM(objYear, objMonth); name = "ContractMoney_" + text4; if (this.tbHtml.Columns.Contains(name)) { drDst[name] = ConvertRule.ToDecimal(drDst[name]) + ConvertRule.ToDecimal(row3["Money"]); } text4 = ConvertRule.FormatYYYYMM(objYear, 0); name = "ContractMoney_" + text4; if (this.tbHtml.Columns.Contains(name)) { drDst[name] = ConvertRule.ToDecimal(drDst[name]) + ConvertRule.ToDecimal(row3["Money"]); } } } view = new DataView(this.tbHtml, "Deep = 2", "", DataViewRowState.CurrentRows); foreach (DataRowView view2 in view) { drDst = view2.Row; drsChild = this.tbHtml.Select("ParentCode = '" + ConvertRule.ToString(drDst["CostBudgetDtlCode"]) + "'"); this.CalcByChilds(drDst, drsChild); } view = new DataView(this.tbHtml, "Deep = 1", "", DataViewRowState.CurrentRows); foreach (DataRowView view2 in view) { drDst = view2.Row; drsChild = this.tbHtml.Select("ParentCode = '" + ConvertRule.ToString(drDst["CostBudgetDtlCode"]) + "'"); this.CalcByChilds(drDst, drsChild); } } foreach (DataRow row2 in this.tbHtml.Rows) { string text6 = ConvertRule.ToString(row2["RecordType"]); string classTd = ConvertRule.ToString(row2["ClassTd"]); if (text6 == "") { row2["PlanDataHtml"] = CostBudgetPageRule.GenerateCostBudgetPlanDataHtml(row2, this.iStartY, this.iEndY, new string[] { "BudgetMoney_", "ContractMoney_" }, new string[] { classTd, CostBudgetPageRule.m_ClassTdContract }, new string[] { "预算", "合同" }); } else { row2["PlanDataHtml"] = CostBudgetPageRule.GenerateCostBudgetPlanDataHtml(row2, this.iStartY, this.iEndY, "ContractMoney_", classTd); } } } catch (Exception exception) { throw exception; } }
public static string GenerateCostBudgetPlanDataHtml(DataRow drDtl, int iStartY, int iEndY, string[] arrFieldName, string[] arrClassTd, string[] arrFieldDesc) { string text8; try { int objYear; int objMonth; string text3; string text4; string text = ""; if ((iStartY == 0) && (iEndY == 0)) { return(""); } bool[] flagArray = new bool[arrFieldName.Length]; int index = -1; foreach (string text2 in arrFieldName) { index++; flagArray[index] = false; for (objYear = iStartY; objYear <= iEndY; objYear++) { for (objMonth = 0; objMonth <= 12; objMonth++) { text3 = ConvertRule.FormatYYYYMM(objYear, objMonth); text4 = text2 + text3; if (GetMoneyShowString(drDtl[text4]) != "") { flagArray[index] = true; } } } } for (objYear = iStartY; objYear <= iEndY; objYear++) { int expand = GetExpandByYear(objYear.ToString(), iStartY.ToString()); for (objMonth = 0; objMonth <= 12; objMonth++) { text3 = ConvertRule.FormatYYYYMM(objYear, objMonth); text = text + string.Format("<td align=right nowrap id='YearData_{0}'", text3); if (objMonth != 0) { text = text + string.Format(" style='display:{0}'", GetStyleDisplayByExpand(expand)); } text = text + ">"; int num5 = -1; foreach (string text2 in arrFieldName) { num5++; string text6 = arrClassTd[num5]; text4 = text2 + text3; if ((num5 > 0) && flagArray[num5 - 1]) { text = text + "<br>"; } string moneyShowString = GetMoneyShowString(drDtl[text4]); string wanDecimalShowHint = GetWanDecimalShowHint(drDtl[text4]); if (wanDecimalShowHint != "") { wanDecimalShowHint = arrFieldDesc[num5] + " " + wanDecimalShowHint; } if ((moneyShowString != "") && (wanDecimalShowHint != "")) { text = text + "<span"; if (text6 != "") { text = text + string.Format(" class='{0}'", text6); } if (wanDecimalShowHint != "") { text = text + string.Format(" title='{0}'", wanDecimalShowHint); } text = text + ">" + moneyShowString + "</span>"; } else if (flagArray[num5]) { text = text + " "; } } text = text + "</td>"; } } text8 = text; } catch (Exception exception) { throw exception; } return(text8); }