Exemplo n.º 1
0
 private void LoadTargetHis()
 {
     try
     {
         this.entityTargetHis = null;
         this.entityTargetHis = CostBudgetRule.GetRelationCostBudget(this.ProjectCode, this.FirstCostBudgetCode, "2", "");
         this.dvTargetHis     = new DataView(this.entityTargetHis.CurrentTable, "", "VerID desc", DataViewRowState.CurrentRows);
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemplo n.º 2
0
 private void InitValidCostBudgetInfo()
 {
     try
     {
         EntityData data = CostBudgetRule.GetValidCostBudget(this.m_CostBudgetSetCode, 0, false);
         if (data.HasRecord())
         {
             this.m_CostBudgetCode = data.GetString("CostBudgetCode");
         }
         data.Dispose();
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemplo n.º 3
0
 public void Generate()
 {
     try
     {
         if (this.m_PayType == e_PayType.payout)
         {
             this.SetPayout();
         }
         else
         {
             this.SetPayment();
         }
         DataView view = new DataView(CostBudgetRule.GetAllCBSBySet(this.ProjectCode, this.CostBudgetSetCode).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["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);
         }
         DropDateRangeColumn(this.tb);
         if ((this.StartYm != "") && (this.EndYm != ""))
         {
             AddDateRangeColumn(this.tb, this.StartYm, this.EndYm);
         }
         this.ReCalcByRelation();
         this.RefreshDateRange();
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemplo n.º 4
0
 private void SumDs()
 {
     try
     {
         DataRow[] drsChild;
         DataRow   drDtl;
         this.tb.Rows.Clear();
         this.tbMonth.Rows.Clear();
         this.tbContractMonth.Rows.Clear();
         DataRow row = this.tb.NewRow();
         row["CostBudgetDtlCode"] = "R_0";
         row["CostName"]          = this.m_entityGroup.GetString("GroupName") + "合计";
         row["Deep"]       = 1;
         row["ParentCode"] = "";
         row["ChildCount"] = 1;
         row["IsExpand"]   = 1;
         this.tb.Rows.Add(row);
         EntityData rootCBSByGroup = CostBudgetRule.GetRootCBSByGroup(this.ProjectCode, this.GroupCode);
         foreach (DataRow row2 in rootCBSByGroup.CurrentTable.Rows)
         {
             string text = ConvertRule.ToString(row2["CostCode"]);
             drDtl = this.tb.NewRow();
             drDtl["CostBudgetDtlCode"] = text;
             CostBudgetPageRule.FillCostBudgetDtlCBSData(drDtl, row2);
             drDtl["Deep"]       = ConvertRule.ToInt(row["Deep"]) + 1;
             drDtl["ParentCode"] = row["CostBudgetDtlCode"];
             drDtl["ChildCount"] = 1;
             this.tb.Rows.Add(drDtl);
             this.AddCostChildDyn(drDtl);
             drsChild = this.tb.Select("ParentCode = '" + text + "'");
             this.CalcByChilds(drDtl, drsChild);
         }
         rootCBSByGroup.Dispose();
         drsChild = this.tb.Select("ParentCode = '" + row["CostBudgetDtlCode"].ToString() + "'");
         this.CalcByChilds(row, drsChild);
         if ((this.StartY != "") && (this.EndY != ""))
         {
             foreach (CostBudgetDynamic dynamic in this.m_arrDyn)
             {
                 foreach (DataRow row4 in dynamic.tbMonth.Rows)
                 {
                     drDtl = this.tbMonth.NewRow();
                     ConvertRule.DataRowCopy(row4, drDtl, dynamic.tbMonth, this.tbMonth);
                     drDtl["CostBudgetSetCode"] = dynamic.CostBudgetSetCode;
                     this.tbMonth.Rows.Add(drDtl);
                 }
                 foreach (DataRow row5 in dynamic.tbContractMonth.Rows)
                 {
                     drDtl = this.tbContractMonth.NewRow();
                     ConvertRule.DataRowCopy(row5, drDtl, dynamic.tbContractMonth, this.tbContractMonth);
                     drDtl["CostBudgetSetCode"] = dynamic.CostBudgetSetCode;
                     this.tbContractMonth.Rows.Add(drDtl);
                 }
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 private void GenerateTargetHisHead()
 {
     try
     {
         this.m_TargetHisHead1 = "";
         this.m_TargetHisHead2 = "";
         if (this.ShowTargetHis)
         {
             this.m_TargetHisHead1 = string.Format("<th align=center nowrap colspan='{0}'>历史预算</th>", this.dvTargetHis.Count);
             foreach (DataRowView view in this.dvTargetHis)
             {
                 this.m_TargetHisHead2 = this.m_TargetHisHead2 + string.Format("<th align=center nowrap>{0}<br>{1}</th>", ConvertRule.ToString(CostBudgetRule.GetCostBudgetVerName(view.Row)), ConvertRule.ToDateString(view.Row["CheckDate"], "yyyy-MM-dd"));
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
 public void Generate()
 {
     try
     {
         this.SetRelationContract();
         this.SetRelationBidding();
         this.SetRelationNoContract();
         this.SetRelationBalance();
         DataView view = new DataView(CostBudgetRule.GetAllCBSBySet(this.ProjectCode, this.CostBudgetSetCode).CurrentTable, "", "SortID, Deep", DataViewRowState.CurrentRows);
         foreach (DataRowView view2 in view)
         {
             DataRow drDst;
             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);
             bool      flag     = false;
             DataRow[] rowArray = this.tbContract.Select("CostCode = '" + text + "'");
             foreach (DataRow row3 in rowArray)
             {
                 drDst = this.tb.NewRow();
                 ConvertRule.DataRowCopy(row3, drDst, this.tbContract, this.tb);
                 drDst["DtlCode"]    = "C_" + text + ":" + drDst["ContractCode"].ToString();
                 drDst["RecordType"] = row3["RecordType"];
                 drDst["Deep"]       = row2["Deep"];
                 drDst["ParentCode"] = row2["ParentCode"];
                 drDst["ChildCount"] = 0;
                 string text2 = ConvertRule.ToString(row3["RecordType"]);
                 if ((text2 != null) && (text2 == "Balance"))
                 {
                     drDst["ClassTd"] = CostBudgetPageRule.m_ClassTdBalance;
                     flag             = true;
                 }
                 else
                 {
                     drDst["ClassTd"] = CostBudgetPageRule.m_ClassTdContract;
                 }
                 this.tb.Rows.Add(drDst);
             }
             if (!this.ReadOnly && !((ConvertRule.ToInt(row2["ChildCount"]) != 0) || flag))
             {
                 drDst = this.tb.NewRow();
                 drDst["ContractCode"] = "Balance_" + text;
                 drDst["ContractName"] = "预留金额";
                 drDst["CostCode"]     = text;
                 drDst["FullCode"]     = row2["FullCode"];
                 drDst["DtlCode"]      = "C_" + text + ":" + drDst["ContractCode"].ToString();
                 drDst["RecordType"]   = "Balance";
                 drDst["Deep"]         = row2["Deep"];
                 drDst["ParentCode"]   = row2["ParentCode"];
                 drDst["ChildCount"]   = 0;
                 drDst["ClassTd"]      = CostBudgetPageRule.m_ClassTdBalance;
                 this.tb.Rows.Add(drDst);
             }
         }
         this.ReCalcByRelation("", "");
         this.RefreshDateRange();
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }