public void Generate() { try { string costCode; this.tb.Rows.Clear(); this.SetPBS(); this.SetPayment(); DataView view = new DataView(CBSDAO.GetCBSByProject(this.ProjectCode).CurrentTable, "", "SortID, Deep", DataViewRowState.CurrentRows); foreach (DataRowView view2 in view) { DataRow row = view2.Row; DataRow row2 = this.tb.NewRow(); costCode = row["CostCode"].ToString(); row2["DtlCode"] = row["CostCode"]; row2["RecordType"] = ""; row2["CostCode"] = row["CostCode"]; row2["CostName"] = row["CostName"]; row2["SortID"] = row["SortID"]; row2["ParentCode"] = row["ParentCode"]; row2["Deep"] = row["Deep"]; row2["FullCode"] = row["FullCode"]; row2["ChildCount"] = row["ChildCount"]; row2["IsLeafCBS"] = ConvertRule.ToInt(row2["ChildCount"]) <= 0; this.tb.Rows.Add(row2); } foreach (DataRow row3 in this.tb.Rows) { costCode = ConvertRule.ToString(row3["CostCode"]); string text2 = ConvertRule.ToString(row3["FullCode"]); decimal num = 0M; string text3 = ""; foreach (DataRow row4 in this.tbPBS.Rows) { string text4 = ConvertRule.ToString(row4["PBSType"]); string text5 = ConvertRule.ToString(row4["PBSCode"]); decimal money = 0M; if (text2 != "") { string filterExpression = string.Format("FullCode like '{0}%' and isnull(PBSType, '') = '{1}' and isnull(PBSCode, '') = '{2}'", text2, text4, text5); money = MathRule.SumColumn(this.tbPayment.Select(filterExpression), "PaymentMoney"); } num += money; text3 = text3 + string.Format("<td align=right nowrap title='{1}'>{0}</td>", CostBudgetPageRule.GetContractPayHref(CostBudgetPageRule.GetMoneyShowString(money, CostBudgetPageRule.m_MoneyUnit.yuan), costCode, "", "", text4, text5), CostBudgetPageRule.GetWanDecimalShowHint(money)); } row3["Money"] = num; row3["MoneyHtml"] = text3; } this.ResetTitleHtml(); } catch (Exception exception) { throw exception; } }
public static DataTable BuildingCostApportionAllPayout(string projectCode, string DateBegin, string DateEnd, string AreaField) { DataTable table2; try { EntityData buildings = ProductDAO.GetBuildingNotAreaByProjectCode(projectCode); EntityData pBSUnits = PBSDAO.GetPBSUnitByProject(projectCode); EntityData cBS = CBSDAO.GetCBSByProject(projectCode); DataTable dtApportion = BuildBuildingCostApportionTable(); PayoutStrategyBuilder builder = new PayoutStrategyBuilder("Payout"); builder.AddStrategy(new Strategy(PayoutStrategyName.ProjectCode, projectCode)); if ((DateBegin != "") || (DateEnd != "")) { ArrayList pas = new ArrayList(); pas.Add(DateBegin); pas.Add(DateEnd); builder.AddStrategy(new Strategy(PayoutStrategyName.PayoutDateRange, pas)); } string queryString = builder.BuildMainQueryString(); QueryAgent agent = new QueryAgent(); EntityData data4 = agent.FillEntityData("Payout", queryString); agent.Dispose(); foreach (DataRow row in data4.CurrentTable.Rows) { string payoutCode = ConvertRule.ToString(row["PayoutCode"]); BuildingCostApportionOnePayout(projectCode, payoutCode, pBSUnits, buildings, cBS, dtApportion, AreaField); } data4.Dispose(); pBSUnits.Dispose(); buildings.Dispose(); cBS.Dispose(); table2 = dtApportion; } catch (Exception exception) { throw exception; } return(table2); }
public void Generate() { try { this.InitCostBudgetSet(); this.SetRelationContract(); this.SetRelationNoContract(); DataView view = new DataView(CBSDAO.GetCBSByProject(this.ProjectCode).CurrentTable, "", "SortID, Deep", DataViewRowState.CurrentRows); foreach (DataRowView view2 in view) { DataRow row = view2.Row; DataRow row2 = this.tb.NewRow(); string text = row["CostCode"].ToString(); row2["DtlCode"] = row["CostCode"]; row2["RecordType"] = ""; row2["CostCode"] = row["CostCode"]; row2["CostName"] = row["CostName"]; row2["SortID"] = row["SortID"]; row2["ParentCode"] = row["ParentCode"]; row2["Deep"] = row["Deep"]; row2["FullCode"] = row["FullCode"]; row2["ChildCount"] = row["ChildCount"]; row2["IsLeafCBS"] = ConvertRule.ToInt(row2["ChildCount"]) <= 0; this.tb.Rows.Add(row2); DataRow[] rowArray = this.tbContract.Select("CostCode = '" + text + "'"); foreach (DataRow row3 in rowArray) { string text2 = row3["ContractCode"].ToString(); DataRow drDst = this.tb.NewRow(); ConvertRule.DataRowCopy(row3, drDst, this.tbContract, this.tb); drDst["DtlCode"] = "C_" + text + ":" + text2; drDst["RecordType"] = row3["RecordType"]; drDst["Deep"] = row2["Deep"]; drDst["ParentCode"] = row2["ParentCode"]; drDst["ChildCount"] = 0; drDst["ClassTd"] = CostBudgetPageRule.m_ClassTdContract; this.tb.Rows.Add(drDst); DataRow[] rowArray2 = this.tbApportion.Select("ContractCode = '" + text2 + "' and CostCode = '" + text + "'"); foreach (DataRow row5 in rowArray2) { string costBudgetSetCode = ConvertRule.ToString(row5["PBSCode"]); drDst = this.tb.NewRow(); ConvertRule.DataRowCopy(row5, drDst, this.tbApportion, this.tb); drDst["DtlCode"] = "A_" + text + ":" + text2 + "@" + costBudgetSetCode; drDst["RecordType"] = "Apportion"; drDst["PBSCode"] = costBudgetSetCode; drDst["Deep"] = row2["Deep"]; drDst["ParentCode"] = row2["ParentCode"]; drDst["ChildCount"] = 0; drDst["ClassTd"] = CostBudgetPageRule.m_ClassTdApportion; drDst["ContractName"] = " " + this.GetCostBudgetSetName(costBudgetSetCode); this.tb.Rows.Add(drDst); } } } this.ReCalcByRelation("", ""); this.RefreshDateRange(); } catch (Exception exception) { throw exception; } }
protected void Page_Load(object sender, System.EventArgs e) { try { m_TreeType = Request["TreeType"] + ""; m_CheckBalance = Request["CheckBalance"] + ""; m_CostBudgetSetCode = Request.QueryString["CostBudgetSetCode"] + ""; //预算设置表编号 string m_strGetType = Request.QueryString["GetType"] + ""; //数据分类 string m_strLayer = Request.QueryString["Layer"] + ""; //需要取的层数 string m_strNodeId = Request.QueryString["NodeId"] + ""; //父节点编号 string[] m_Layers = (Request.QueryString["Layers"] + "").Split('.'); //定点展开的序列 string m_strSelectedLayer = Request.QueryString["SelectedLayer"] + ""; //定层展开的深度 string fromNodeCode = Request["FromNodeCode"] + ""; DataTable m_Table = new DataTable("CBS"); m_Table.Columns.Add("CostCode"); // 费用编号 m_Table.Columns.Add("ParentCode"); // 父Code m_Table.Columns.Add("CostName"); // 费用项名称 m_Table.Columns.Add("Description"); // 说明 m_Table.Columns.Add("Layer"); // 层数---对应deep深度 m_Table.Columns.Add("ChildNodesCount"); // 子节点数目 m_Table.Columns.Add("ShowChildNodes"); // 是否显示子节点 m_Table.Columns.Add("SortID"); // 费用项编号 m_Table.Columns.Add("DisplayHref"); // 是否显示费用项链接 m_Table.Columns.Add("DisplaySpan"); // 是否显示费用项文字 string projectCode = Request["ProjectCode"] + ""; string accountPoint = Request["AccountPoint"] + ""; EntityData m_Cost = null; if (m_strGetType == "CostBudgetSetRoot") { m_Cost = BLL.CostBudgetRule.GetRootCBSBySet(projectCode, m_CostBudgetSetCode); } else { if (accountPoint == "AccountPoint") { string budgetCode = CBSRule.GetCurrentDynamicCode(projectCode); m_Cost = CBSDAO.GetCBSByBudgetCodeAccountPoint(budgetCode); } else { m_Cost = CBSDAO.GetCBSByProject(projectCode); } } DataTable m_DataTable = m_Cost.CurrentTable; string filter = ""; if (m_strGetType == "") { #region 取第一层 filter = " isnull(ParentCode,'') =''"; DataView m_DV = new DataView(m_DataTable, filter, " SortID ", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRow(ref m_NewRow, m_Row, m_DataTable); m_Table.Rows.Add(m_NewRow); } #endregion } else if (m_strGetType == "CostBudgetSetRoot") { #region 取第一层(针对某张预算设置表) DataView m_DV = new DataView(m_DataTable, filter, " SortID ", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRowCostBudgetDtl(ref m_NewRow, m_Row, m_DataTable); m_Table.Rows.Add(m_NewRow); } #endregion } else if (m_strGetType == "ChildNodes") { #region 取某节点子目录 filter = "ParentCode='" + m_strNodeId + "'"; DataView m_DV = new DataView(m_DataTable, filter, "SortID", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRow(ref m_NewRow, m_Row, m_DataTable); m_Table.Rows.Add(m_NewRow); } #endregion } else if (m_strGetType == "SelectLayer") { #region 取指定层数结果 filter = "Deep='1'"; DataView m_DV = new DataView(m_DataTable, filter, "SortID", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRow(ref m_NewRow, m_Row, m_DataTable); m_Table.Rows.Add(m_NewRow); if (int.Parse(m_strSelectedLayer) > 1) { m_NewRow["ShowChildNodes"] = "1"; this.FillSelectedLayerData(ref m_Table, m_Row["CostCode"].ToString(), 2, int.Parse(m_strSelectedLayer), m_DataTable); } } #endregion } else if (m_strGetType == "All") { #region 取所有结果 filter = "ParentCode='1'"; DataView m_DV = new DataView(m_DataTable, filter, " SortID ", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRow(ref m_NewRow, m_Row, m_DataTable); m_Table.Rows.Add(m_NewRow); if (int.Parse(m_NewRow["ChildNodesCount"].ToString()) > 0) { m_NewRow["ShowChildNodes"] = "1"; this.FillAllData(ref m_Table, m_Row["CostCode"].ToString(), 2, m_DataTable); } } #endregion } else if (m_strGetType == "SingleNode") { #region 单个节点 filter = "CostCode='" + Request.QueryString["NodeId"] + "" + "'"; DataView m_DV = new DataView(m_DataTable, filter, " SortID ", DataViewRowState.CurrentRows); foreach (DataRowView m_Row in m_DV) { DataRow m_NewRow = m_Table.NewRow(); this.FillRow(ref m_NewRow, m_Row, m_DataTable); m_Table.Rows.Add(m_NewRow); } #endregion } m_Cost.Dispose(); Response.Write(RmsPM.WebControls.TreeView.XmlTree.GetDataToXmlString(m_Table)); Response.End(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); } }