Exemple #1
0
        public static string BuildTreeNodeSearchString(string costCode, TreeNodeSearchType searchType)
        {
            string cBSFullCode = CBSDAO.GetCBSFullCode(costCode);

            switch (searchType)
            {
            case TreeNodeSearchType.AllSubNodeIncludeSelf:
                return(string.Format(" costCode in ( select costCode from CBS where FullCode  like '{0}%'  ) ", cBSFullCode));

            case TreeNodeSearchType.AllSubNodeNotIncludeSelf:
                return(string.Format(" costCode in ( select costCode from CBS where FullCode  FullCode like '{0}%' and FullCode <> {'0'}  ) ", cBSFullCode));

            case TreeNodeSearchType.FirstChildNode:
                return(string.Format(" CostCode in ( select CostCode from CBS where ParentCode = '{0}'  ) ", cBSFullCode));

            case TreeNodeSearchType.AllSubLeafNode:
                return(string.Format("  costCode in ( select costCode from CBS c where FullCode like '{0}%' and Not Exists ( select * from CBS e where e.ParentCode = c.CostCode  ) ) ", cBSFullCode));

            case TreeNodeSearchType.AllSubNotLeafNode:
                return(string.Format("  costCode in ( select costCode from CBS c where FullCode like '{0}%' and Exists ( select * from CBS e where e.ParentCode = c.CostCode  ) ) ", cBSFullCode));

            case TreeNodeSearchType.OnlySelfNode:
                return(string.Format(" CostCode  = '{0}'  ) ", costCode));
            }
            return("");
        }
Exemple #2
0
 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;
     }
 }
Exemple #3
0
        private void LoadData()
        {
            string projectCode = Request["ProjectCode"] + "";
            string act         = Request["Action"] + "";;
            string costCode    = Request["CostCode"] + "";;

            if (act != "Modify")
            {
                this.tableList.Visible = false;
                return;
            }

            try
            {
                EntityData entity = CBSDAO.GetCBSByCode(costCode);
                if (entity.HasRecord())
                {
                    this.txtCostName.Text    = entity.GetString("CostName");
                    this.txtDescription.Text = entity.GetString("Description");
                    this.txtCostAllocationDescription.Text = entity.GetString("CostAllocationDescription");
                    this.txtSortID.Text = entity.GetString("SortID");
                    string subjectCode = entity.GetString("SubjectCode");
                    this.ucInputSubject.ProjectCode = projectCode;
                    this.ucInputSubject.Value       = subjectCode;

                    this.ucBudgetType.Value = entity.GetString("BudgetType");

//                    this.sltParent.Value = entity.GetString("ParentCode");

                    this.ucParent.Value = entity.GetString("ParentCode");

                    int    deep     = entity.GetInt("Deep");
                    string fullCode = entity.GetString("FullCode");

//					int isFixed = entity.GetInt("IsFixed");
//					if ( isFixed == 1)
//					{
//						this.btnBatchModify.Visible = false;
//						this.btnDelete.Visible = false;
//						this.btnSave.Visible = false;
//					}

                    EntityData cbs = DAL.EntityDAO.CBSDAO.GetCBSByProject(projectCode);
                    this.repeatList.DataSource = new DataView(cbs.CurrentTable, String.Format("FullCode like '{0}%' and Deep={1} ", fullCode, (deep + 1)), "SortID", DataViewRowState.CurrentRows);
                    this.repeatList.DataBind();
                    cbs.Dispose();
                }
                entity.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(JavaScript.Alert(true, "显示出错:" + ex.Message));
            }
        }
Exemple #4
0
        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);
        }
Exemple #5
0
 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;
     }
 }
        public override void AddStrategy(Strategy strategy)
        {
            switch (((PaymentItemStrategyName)strategy.Name))
            {
            case PaymentItemStrategyName.PaymentItemCode:
                strategy.RelationFieldName = "PaymentItemCode";
                strategy.Type = StrategyType.StringEqual;
                break;

            case PaymentItemStrategyName.PaymentCode:
                strategy.RelationFieldName = "PaymentCode";
                strategy.Type = StrategyType.StringEqual;
                break;

            case PaymentItemStrategyName.ContractCode:
                strategy.RelationFieldName = "ContractCode";
                strategy.Type = StrategyType.StringEqual;
                break;

            case PaymentItemStrategyName.CostCode:
                strategy.RelationFieldName = "CostCode";
                strategy.Type = StrategyType.StringEqual;
                break;

            case PaymentItemStrategyName.CostBudgetSetCode:
                strategy.RelationFieldName = "CostBudgetSetCode";
                strategy.Type = StrategyType.StringEqual;
                break;

            case PaymentItemStrategyName.PaymentType:
                strategy.RelationFieldName = "PaymentType";
                strategy.Type = StrategyType.StringEqual;
                break;

            case PaymentItemStrategyName.Status:
                strategy.RelationFieldName = "Status";
                strategy.Type = StrategyType.NumberIn;
                break;

            case PaymentItemStrategyName.IsContract:
                strategy.RelationFieldName = "IsContract";
                strategy.Type = StrategyType.IntegerEqual;
                break;

            case PaymentItemStrategyName.AllocateCode:
                strategy.RelationFieldName = "AllocateCode";
                strategy.Type = StrategyType.StringEqual;
                break;

            case PaymentItemStrategyName.CostCodeIncludeAllChild:
                strategy.RelationFieldName = "CostFullCode";
                strategy.Type = StrategyType.StringLike;
                strategy.SetParameter(0, CBSDAO.GetCBSFullCode(strategy.GetParameter(0)) + "%");
                break;

            case PaymentItemStrategyName.PayDate:
                strategy.RelationFieldName = "PayDate";
                strategy.Type = StrategyType.DateTimeRange;
                break;

            case PaymentItemStrategyName.IsApportion:
                strategy.RelationFieldName = "IsApportion";
                strategy.Type = StrategyType.IntegerEqual;
                break;

            case PaymentItemStrategyName.ProjectCode:
                strategy.RelationFieldName = "ProjectCode";
                strategy.Type = StrategyType.StringEqual;
                break;

            case PaymentItemStrategyName.ContractCostPlanCode:
                strategy.RelationFieldName = "ContractCostPlanCode";
                strategy.Type = StrategyType.StringEqual;
                break;

            case PaymentItemStrategyName.ContractCostCashCode:
                strategy.RelationFieldName = "ContractCostCashCode";
                strategy.Type = StrategyType.StringEqual;
                break;

            case PaymentItemStrategyName.PBSType:
                strategy.RelationFieldName = "PBSType";
                strategy.Type = StrategyType.StringEqual;
                break;

            case PaymentItemStrategyName.PBSCode:
                strategy.RelationFieldName = "PBSCode";
                strategy.Type = StrategyType.StringEqual;
                break;

            default:
                strategy.Type = StrategyType.Other;
                break;
            }
            base.AddStrategy(strategy);
        }
Exemple #7
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            PaymentStrategyName name = (PaymentStrategyName)strategy.Name;
            string text = "";

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case PaymentStrategyName.WBSCode:
                {
                    string costCode    = strategy.GetParameter(0);
                    string cBSFullCode = CBSDAO.GetCBSFullCode(costCode);
                    switch (strategy.GetParameter(1))
                    {
                    case "0":
                        return(WBSStrategyBuilder.BuildTreeNodeSearchString(costCode, TreeNodeSearchType.AllSubNodeIncludeSelf));

                    case "1":
                        return(WBSStrategyBuilder.BuildTreeNodeSearchString(costCode, TreeNodeSearchType.AllSubLeafNode));

                    case "2":
                        return(WBSStrategyBuilder.BuildTreeNodeSearchString(costCode, TreeNodeSearchType.AllSubNotLeafNode));

                    case "4":
                        return(WBSStrategyBuilder.BuildTreeNodeSearchString(costCode, TreeNodeSearchType.OnlySelfNode));
                    }
                    return(text);
                }

                case PaymentStrategyName.AccessRange:
                    return(BuildAccessRangeString(strategy.GetParameter(0), strategy.GetParameter(1)));

                case PaymentStrategyName.GroupCode:
                case PaymentStrategyName.PaymentTitle:
                case PaymentStrategyName.PaymentNameEx:
                    return(text);

                case PaymentStrategyName.GroupCodeEx:
                {
                    string systemGroupCode = strategy.GetParameter(0);
                    switch (strategy.GetParameter(1))
                    {
                    case "0":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNodeIncludeSelf, SystemClassDescription.GetItemTypeColumnName("Payment")));

                    case "1":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubLeafNode, SystemClassDescription.GetItemTypeColumnName("Payment")));

                    case "2":
                        return(SystemGroupStrategyBuilder.BuildTreeNodeSearchString(systemGroupCode, TreeNodeSearchType.AllSubNotLeafNode, SystemClassDescription.GetItemTypeColumnName("Payment")));
                    }
                    return(text);
                }

                case PaymentStrategyName.NotPayout:
                    return("isnull(Money, 0) - isnull(TotalPayoutMoney, 0) >= 0.01");

                case PaymentStrategyName.BatchPayment:
                    return("Payer = '成本批量请款'");

                case PaymentStrategyName.NotBatchPayment:
                    return("isnull(Payer, '') <> '成本批量请款'");
                }
                return(text);
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Exemple #8
0
        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, "");
            }
        }