コード例 #1
0
ファイル: StringRule.cs プロジェクト: ishui/rms2
        public static string BuildMoneyWanFormatString(decimal num, int flag, int decimals)
        {
            decimal d = num / 10000M;

            if (decimals >= 0)
            {
                if (d < 1M)
                {
                    d = MathRule.Round(d, decimals);
                }
                else
                {
                    d = MathRule.Round(d, decimals);
                }
            }
            if (flag == 0)
            {
                if (MathRule.CheckDecimalEqual(0M, d))
                {
                    return("");
                }
            }
            else if ((flag == -1) && MathRule.CheckDecimalEqual(0M, num))
            {
                return("");
            }
            return(d.ToString("#,##0.####"));
        }
コード例 #2
0
 private void CalcByChilds(DataRow dr, DataRow[] drsChild)
 {
     try
     {
         string[] arrMoneyField;
         if (dr.Table.TableName == "Html")
         {
             string[] textArray2 = CostBudgetPageRule.BuildArrayFieldByMonth(this.StartY, this.EndY, "BudgetMoney_");
             arrMoneyField = ConvertRule.ArrayConcat(this.m_arrMoneyField, textArray2);
             textArray2    = CostBudgetPageRule.BuildArrayFieldByMonth(this.StartY, this.EndY, "ContractMoney_");
             arrMoneyField = ConvertRule.ArrayConcat(arrMoneyField, textArray2);
         }
         else
         {
             arrMoneyField = this.m_arrMoneyField;
         }
         decimal[] numArray = MathRule.SumColumn(drsChild, arrMoneyField);
         int       index    = -1;
         foreach (string text in arrMoneyField)
         {
             index++;
             dr[text] = numArray[index];
         }
         CostBudgetPageRule.CalcPercent(dr, this.m_tbGroupArea.Rows[0]);
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
コード例 #3
0
ファイル: ContractPaySchedule.cs プロジェクト: ishui/rms2
 private void ReCalcByRelation(string AStartYm, string AEndYm)
 {
     try
     {
         DataView view = new DataView(this.tb, "RecordType = ''", "", DataViewRowState.CurrentRows);
         foreach (DataRowView view2 in view)
         {
             DataRow dr = view2.Row;
             if (ConvertRule.ToString(dr["FullCode"]) != "")
             {
                 DataRow[] drs           = this.tbContract.Select("FullCode like '" + ConvertRule.ToString(dr["FullCode"]) + "%'");
                 string[]  textArray     = new string[] { "ContractMoney", "ContractChangeMoney", "ContractApplyMoney", "ContractPay", "ContractPayReal" };
                 string[]  textArray2    = CostBudgetPageRule.BuildArrayFieldByYm(AStartYm, AEndYm, "PayoutMoneyYm_");
                 string[]  arrColumnName = ConvertRule.ArrayConcat(textArray, textArray2);
                 decimal[] numArray      = MathRule.SumColumn(drs, arrColumnName);
                 int       index         = -1;
                 foreach (string text in arrColumnName)
                 {
                     index++;
                     dr[text] = numArray[index];
                 }
                 CostBudgetPageRule.CostBudgetDtlCalcField(dr, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
コード例 #4
0
ファイル: CostRule.cs プロジェクト: riyuexing/rms
 private static void GetBuildingInfo(string alloType, string buildingCode, ref string buildingName, ref decimal buildingArea, EntityData PBSUnits, EntityData buildings, string AreaField)
 {
     if (alloType == "P")
     {
         buildingName = ProjectRule.GetProjectName(buildingCode);
         buildingArea = MathRule.SumColumn(buildings.CurrentTable, AreaField);
     }
     else
     {
         DataRow[] rowArray;
         if (alloType == "U")
         {
             rowArray = PBSUnits.CurrentTable.Select(string.Format("PBSUnitCode='{0}'", buildingCode));
             if (rowArray.Length > 0)
             {
                 buildingName = ConvertRule.ToString(rowArray[0]["PBSUnitName"]);
                 buildingArea = ConvertRule.ToDecimal(rowArray[0]["BuildingAreaSum"]);
             }
         }
         else if (alloType == "B")
         {
             rowArray = buildings.CurrentTable.Select(string.Format("BuildingCode='{0}'", buildingCode));
             if (rowArray.Length > 0)
             {
                 buildingName = ConvertRule.ToString(rowArray[0]["BuildingName"]);
                 buildingArea = ConvertRule.ToDecimal(rowArray[0][AreaField]);
             }
         }
     }
 }
コード例 #5
0
        public static DataTable CreateGroupAreaTable(string GroupCode, string ProjectCode, string CostBudgetBackupCode)
        {
            DataTable table2;

            try
            {
                EntityData data;
                string[]   arrColumnName = new string[] { "BuildingArea", "HouseCount", "HouseArea" };
                DataTable  table         = new DataTable("GroupArea");
                table.Columns.Add("GroupCode");
                foreach (string text in arrColumnName)
                {
                    table.Columns.Add(text, typeof(decimal));
                }
                DataRow row = table.NewRow();
                row["GroupCode"] = GroupCode;
                table.Rows.Add(row);
                if (CostBudgetBackupCode != "")
                {
                    data = CostBudgetDAO.GetCostBudgetBackupSetByGroupCode(CostBudgetBackupCode, GroupCode, true);
                }
                else
                {
                    data = CostBudgetDAO.GetV_CostBudgetSetByGroupCode(GroupCode, ProjectCode, CostBudgetRule.m_BaseSetType);
                }
                if (data.HasRecord())
                {
                    DataRow[] drs = data.CurrentTable.Select("PBSType = 'P'");
                    if (drs.Length > 0)
                    {
                        foreach (string text in arrColumnName)
                        {
                            row[text] = drs[0][text];
                        }
                    }
                    else
                    {
                        drs = data.CurrentTable.Select("PBSType = 'B'");
                        if (drs.Length > 0)
                        {
                            decimal[] numArray = MathRule.SumColumn(drs, arrColumnName);
                            int       index    = -1;
                            foreach (string text in arrColumnName)
                            {
                                index++;
                                row[text] = numArray[index];
                            }
                        }
                    }
                }
                data.Dispose();
                table2 = table;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(table2);
        }
コード例 #6
0
ファイル: StringRule.cs プロジェクト: ishui/rms2
 public static string BuildGeneralNumberString(decimal num)
 {
     if (MathRule.CheckDecimalEqual(0M, num))
     {
         return("");
     }
     return(num.ToString("F"));
 }
コード例 #7
0
ファイル: ReportCostByPBS.cs プロジェクト: ishui/rms2
 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;
     }
 }
コード例 #8
0
ファイル: StringRule.cs プロジェクト: ishui/rms2
 public static string BuildShowPercentString(decimal num, string format)
 {
     if (MathRule.CheckDecimalEqual(0M, num))
     {
         return("");
     }
     if (format == "")
     {
         return(num.ToString("N") + "%");
     }
     return(num.ToString(format) + "%");
 }
コード例 #9
0
ファイル: StringRule.cs プロジェクト: ishui/rms2
 public static string BuildShowNumberString(decimal num, string format, bool ShowZero)
 {
     if (!(!MathRule.CheckDecimalEqual(0M, num) || ShowZero))
     {
         return("");
     }
     if (format == "")
     {
         return(num.ToString("N"));
     }
     return(num.ToString(format));
 }
コード例 #10
0
ファイル: StringRule.cs プロジェクト: ishui/rms2
        public static string BuildGeneralNumberString(object oNum)
        {
            if (oNum == DBNull.Value)
            {
                return("");
            }
            decimal num = Convert.ToDecimal(oNum);

            if (MathRule.CheckDecimalEqual(0M, num))
            {
                return("");
            }
            return(num.ToString("F"));
        }
コード例 #11
0
ファイル: CostApportion.cs プロジェクト: ishui/rms2
 public void DoApportion()
 {
     try
     {
         if (this.m_tbTotalMoney.Columns.Count == 0)
         {
             throw new Exception("未设置总金额");
         }
         DataRow row = this.m_tbTotalMoney.Rows[0];
         if (!this.m_IsCustomTotalArea)
         {
             this.CalcTotalArea();
         }
         decimal[] numArray = new decimal[this.m_tbTotalMoney.Columns.Count];
         int       count    = this.tbArea.Rows.Count;
         for (int i = 0; i < count; i++)
         {
             DataRow row2  = this.tbArea.Rows[i];
             int     index = -1;
             foreach (DataColumn column in this.m_tbTotalMoney.Columns)
             {
                 index++;
                 decimal num4 = 0M;
                 decimal num5 = ConvertRule.ToDecimal(row[column.ColumnName]);
                 if (!(this.m_IsCustomTotalArea || (i != (count - 1))))
                 {
                     num4 = num5 - numArray[index];
                 }
                 else
                 {
                     decimal num6 = ConvertRule.ToDecimal(row2["Area"]);
                     if ((num6 != 0M) && (this.TotalArea != 0M))
                     {
                         num4 = MathRule.Round(num5 * (num6 / this.TotalArea), this.m_RoundDec);
                     }
                 }
                 row2[column.ColumnName] = num4;
                 numArray[index]         = ConvertRule.ToDecimal(numArray[index]) + num4;
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
コード例 #12
0
        public static decimal GetBuildingAreaByPBSUnit(string PBSUnitCode)
        {
            decimal num2;

            try
            {
                decimal    num = 0M;
                EntityData buildingByPBSUnitCode = ProductDAO.GetBuildingByPBSUnitCode(PBSUnitCode);
                num = MathRule.SumColumn(buildingByPBSUnitCode.CurrentTable, "HouseArea");
                buildingByPBSUnitCode.Dispose();
                num2 = num;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(num2);
        }
コード例 #13
0
ファイル: CostBudgetPageRule.cs プロジェクト: riyuexing/rms
        public static string GetMoneyShowString(object money, m_MoneyUnit unit, string MoneyType)
        {
            string text2;

            try
            {
                string wanDecimalShowString = "";
                switch (unit)
                {
                case m_MoneyUnit.yuan:
                    wanDecimalShowString = StringRule.BuildShowNumberString(money, "#,##0");
                    break;

                case m_MoneyUnit.fen:
                    wanDecimalShowString = StringRule.BuildShowNumberString(money, "#,##0.00");
                    break;

                default:
                    if (MoneyType.ToLower() == "price")
                    {
                        wanDecimalShowString = MathRule.GetWanDecimalShowString(money);
                    }
                    else if (m_IsRoundWanMoney)
                    {
                        wanDecimalShowString = StringRule.BuildMoneyWanFormatString(ConvertRule.ToDecimal(money), -1, 0);
                    }
                    else
                    {
                        wanDecimalShowString = MathRule.GetWanDecimalShowString(money);
                    }
                    break;
                }
                text2 = wanDecimalShowString;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
コード例 #14
0
        public static string FormatSalBudgetFieldValue(object objVal, string FieldName)
        {
            string text2;

            try
            {
                string intShowString = "";
                if (FieldName.ToUpper() == "HOUSECOUNT")
                {
                    intShowString = MathRule.GetIntShowString(objVal);
                }
                else
                {
                    intShowString = MathRule.GetDecimalShowString(objVal);
                }
                text2 = intShowString;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
コード例 #15
0
ファイル: CostBudgetPageRule.cs プロジェクト: riyuexing/rms
        public static string GetWanDecimalShowString(object money)
        {
            string text2;

            try
            {
                string wanDecimalShowString = "";
                if (m_IsRoundWanMoney)
                {
                    wanDecimalShowString = StringRule.BuildMoneyWanFormatString(ConvertRule.ToDecimal(money), -1, 0);
                }
                else
                {
                    wanDecimalShowString = MathRule.GetWanDecimalShowString(money);
                }
                text2 = wanDecimalShowString;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
コード例 #16
0
ファイル: CostBudgetPageRule.cs プロジェクト: riyuexing/rms
        public static string GetWanDecimalShowHint(object money)
        {
            string text2;

            try
            {
                string decimalShowString = "";
                if (m_IsRoundWanMoney)
                {
                    decimalShowString = MathRule.GetDecimalShowString(money);
                    if (decimalShowString != "")
                    {
                        decimalShowString = decimalShowString + "元";
                    }
                }
                text2 = decimalShowString;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
コード例 #17
0
ファイル: MonthPayList.cs プロジェクト: ishui/rms2
 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;
     }
 }
コード例 #18
0
ファイル: CostPlan.cs プロジェクト: riyuexing/rms
 private void SetRelationContract()
 {
     try
     {
         int       index;
         DataRow[] rowArray = this.tbContract.Select("RecordType = 'Contract'");
         int       length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbContract.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbPlan.Select("RecordType = 'Contract'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbPlan.Rows.Remove(rowArray[index]);
         }
         QueryAgent agent = new QueryAgent();
         try
         {
             string    queryString = "select c.FullCode, s.SupplierName, a.*, b.* from ContractCost a left join CBS c on c.CostCode = a.CostCode, Contract b left join Supplier s on s.SupplierCode = b.SupplierCode where a.ContractCode = b.ContractCode and b.ProjectCode = '" + this.ProjectCode + "' and a.CostBudgetSetCode = '" + this.CostBudgetSetCode + "' and b.Status in (0, 2) and not exists (select * from ContractChange g where g.ContractCode = b.ContractCode)";
             DataTable tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddRelationContractRow(this.tbContract, tbSrc, "Contract", "ContractMoney");
             queryString = "select c.FullCode, a.Money as Money, s.SupplierName, a.*, b.* from ContractCostChange a left join CBS c on c.CostCode = a.CostCode, Contract b left join Supplier s on s.SupplierCode = b.SupplierCode where a.ContractCode = b.ContractCode and b.ProjectCode = '" + this.ProjectCode + "' and a.CostBudgetSetCode = '" + this.CostBudgetSetCode + "' and b.Status in (0, 2, 4) and a.ContractChangeCode = (select min(ContractChangeCode) from ContractChange g where g.ContractCode = b.ContractCode) and exists (select * from ContractChange g where g.ContractCode = b.ContractCode)";
             tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddRelationContractRow(this.tbContract, tbSrc, "Contract", "ContractMoney");
             queryString = "select c.FullCode, a.ChangeMoney as Money, s.SupplierName, a.*, b.* from ContractCostChange a left join CBS c on c.CostCode = a.CostCode, Contract b left join Supplier s on s.SupplierCode = b.SupplierCode, ContractChange g where a.ContractCode = b.ContractCode and b.ContractCode = g.ContractCode and a.ContractChangeCode = g.ContractChangeCode and b.ProjectCode = '" + this.ProjectCode + "' and a.CostBudgetSetCode = '" + this.CostBudgetSetCode + "' and b.Status not in (3) and g.Status in (0) and a.ChangeMoney <> 0";
             tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddRelationContractRow(this.tbContract, tbSrc, "Contract", "ContractChangeMoney");
             queryString = "select c.FullCode, s.SupplierName, a.*, b.* from ContractCost a left join CBS c on c.CostCode = a.CostCode, Contract b left join Supplier s on s.SupplierCode = b.SupplierCode where a.ContractCode = b.ContractCode and b.ProjectCode = '" + this.ProjectCode + "' and a.CostBudgetSetCode = '" + this.CostBudgetSetCode + "' and b.Status in (1, 7)";
             tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddRelationContractRow(this.tbContract, tbSrc, "Contract", "ContractApplyMoney");
             queryString = "select c.FullCode, s.SupplierName, a.ChangeMoney as Money, a.*, b.* from ContractCostChange a left join CBS c on c.CostCode = a.CostCode, Contract b left join Supplier s on s.SupplierCode = b.SupplierCode, ContractChange g where a.ContractCode = b.ContractCode and b.ContractCode = g.ContractCode and a.ContractChangeCode = g.ContractChangeCode and b.ProjectCode = '" + this.ProjectCode + "' and a.CostBudgetSetCode = '" + this.CostBudgetSetCode + "' and b.Status not in (3) and g.Status in (1, 2) and a.ChangeMoney <> 0";
             tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddRelationContractRow(this.tbContract, tbSrc, "Contract", "ContractApplyMoney");
             queryString = "select c.FullCode, 'Contract' as RecordType, a.CostCode, a.ContractCode, convert(varchar(6), p.PlanningPayDate, 112) as PlanYm, sum(isnull(p.Money, 0)) as PlanMoney from ContractCost a left join CBS c on c.CostCode = a.CostCode, Contract b, ContractCostPlan p where a.ContractCode = b.ContractCode and a.ContractCostCode = p.ContractCostCode and b.ProjectCode = '" + this.ProjectCode + "' and a.CostBudgetSetCode = '" + this.CostBudgetSetCode + "' and convert(varchar(6), p.PlanningPayDate, 112) between '" + this.StartYm + "' and '" + this.EndYm + "' group by c.FullCode, a.CostCode, a.ContractCode, convert(varchar(6), p.PlanningPayDate, 112)";
             tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddPlan(tbSrc, "");
             foreach (DataRow row in this.tbContract.Rows)
             {
                 string text2 = ConvertRule.ToString(row["ContractCode"]);
                 if (ConvertRule.ToString(row["AllContractCode"]) != "")
                 {
                     queryString        = "select sum(isnull(a.ItemMoney, 0)) from PaymentItem a, Payment b where a.PaymentCode = b.PaymentCode and b.ProjectCode = '" + this.ProjectCode + "' and a.CostBudgetSetCode = '" + this.CostBudgetSetCode + "' and b.Status in (1, 2) and b.ContractCode in (" + ConvertRule.ToString(row["AllContractCode"]) + ") and a.CostCode = '" + ConvertRule.ToString(row["CostCode"]) + "'";
                     row["ContractPay"] = ConvertRule.ToDecimal(agent.ExecuteScalar(queryString));
                     queryString        = "select a.PayoutCode, b.PayoutDate, a.PayoutMoney as Money, '" + text2 + "' as ContractCode, mi.CostCode, c.FullCode from PayoutItem a inner join Payout b on b.PayoutCode = a.PayoutCode, PaymentItem mi left join CBS c on c.CostCode = mi.CostCode, Payment m where a.PaymentItemCode = mi.PaymentItemCode and mi.PaymentCode = m.PaymentCode and m.ProjectCode = '" + this.ProjectCode + "' and mi.CostBudgetSetCode = '" + this.CostBudgetSetCode + "' and m.ContractCode in (" + ConvertRule.ToString(row["AllContractCode"]) + ") and mi.CostCode = '" + ConvertRule.ToString(row["CostCode"]) + "'";
                     tbSrc = agent.ExecSqlForDataSet(queryString).Tables[0];
                     row["ContractPayReal"] = MathRule.SumColumn(tbSrc, "Money");
                 }
             }
             CostBudgetPageRule.CostBudgetDtlCalcAllRow(this.tbContract, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
         }
         finally
         {
             agent.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
コード例 #19
0
ファイル: GradeList.cs プロジェクト: riyuexing/rms
        public static string GetSumGradePoint(string GradeMessageCode)
        {
            try
            {
                string gradePoint = "0";
                string text2      = "0";
                string text3      = "0";
                string text4      = "0";
                string text5      = "0";
                string text6      = "0";
                string text7      = "0";
                string decimalNoPointShowString = "0";
                string text9  = "0";
                string text10 = "0";
                string text11 = "0";
                string text12 = "0";
                string text13 = "0";
                string text14 = "0";
                gradePoint = GetGradePoint("100001", GradeMessageCode);
                text2      = GetGradePoint("100002", GradeMessageCode);
                text3      = GetGradePoint("100003", GradeMessageCode);
                text4      = GetGradePoint("100004", GradeMessageCode);
                text5      = GetGradePoint("100005", GradeMessageCode);
                text6      = GetGradePoint("100006", GradeMessageCode);
                text7      = GetGradePoint("100007", GradeMessageCode);
                DataTable gradeDepartments         = new GradeDepartment().GetGradeDepartments();
                DataTable lastDepartmentPercentage = new GradeDepartmentPercentage().GetLastDepartmentPercentage(GradeMessageCode, "100001");
                decimal   num = 0M;
                foreach (DataRow row in lastDepartmentPercentage.Select())
                {
                    num += (decimal)row["Percentage"];
                }
                if (gradeDepartments != null)
                {
                    foreach (DataRow row2 in gradeDepartments.Select("MainDefineCode='100001'"))
                    {
                        switch (row2["DepartmentDefineCode"].ToString())
                        {
                        case "100001":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100001'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100001'")[0]["Percentage"];
                            }
                            decimalNoPointShowString = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(gradePoint) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (decimalNoPointShowString == "")
                            {
                                decimalNoPointShowString = "0";
                            }
                            break;

                        case "100002":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100002'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100002'")[0]["Percentage"];
                            }
                            text9 = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(text2) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (text9 == "")
                            {
                                text9 = "0";
                            }
                            break;

                        case "100003":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100003'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100003'")[0]["Percentage"];
                            }
                            text10 = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(text3) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (text10 == "")
                            {
                                text10 = "0";
                            }
                            break;

                        case "100004":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100004'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100004'")[0]["Percentage"];
                            }
                            text11 = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(text4) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (text11 == "")
                            {
                                text11 = "0";
                            }
                            break;

                        case "100005":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100005'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100005'")[0]["Percentage"];
                            }
                            text12 = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(text5) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (text12 == "")
                            {
                                text12 = "0";
                            }
                            break;

                        case "100006":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100006'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100006'")[0]["Percentage"];
                            }
                            text13 = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(text6) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (text13 == "")
                            {
                                text13 = "0";
                            }
                            break;

                        case "100007":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100007'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100007'")[0]["Percentage"];
                            }
                            text14 = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(text7) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (text14 == "")
                            {
                                text14 = "0";
                            }
                            break;
                        }
                    }
                }
                return(MathRule.GetDecimalNoPointShowString((((((Convert.ToDecimal(decimalNoPointShowString) + Convert.ToDecimal(text9)) + Convert.ToDecimal(text10)) + Convert.ToDecimal(text11)) + Convert.ToDecimal(text12)) + Convert.ToDecimal(text13)) + Convert.ToDecimal(text14)));
            }
            catch
            {
                return("");
            }
        }
コード例 #20
0
ファイル: CostBudgetTargetView.cs プロジェクト: ishui/rms2
 private void FillCostTargetHisHtml()
 {
     try
     {
         if (this.entityTargetHis != null)
         {
             string    text2;
             ArrayList list = new ArrayList();
             foreach (DataRowView view in this.dvTargetHis)
             {
                 DataRow row  = view.Row;
                 string  text = ConvertRule.ToString(row["VerID"]);
                 if (text != "")
                 {
                     list.Add(text);
                     text2 = "BudgetMoneyHis_" + text;
                     EntityData costBudgetDtlByCostBudgetCode = CostBudgetDAO.GetCostBudgetDtlByCostBudgetCode(row["CostBudgetCode"].ToString());
                     if (costBudgetDtlByCostBudgetCode.HasRecord())
                     {
                         foreach (DataRow row2 in this.tb.Rows)
                         {
                             DataRow[] rowArray = costBudgetDtlByCostBudgetCode.CurrentTable.Select("CostCode='" + ConvertRule.ToString(row2["CostCode"]) + "'");
                             if (rowArray.Length > 0)
                             {
                                 row2[text2] = rowArray[0]["BudgetMoney"];
                             }
                         }
                     }
                     costBudgetDtlByCostBudgetCode.Dispose();
                 }
             }
             if (this.tb.Rows.Count > 0)
             {
                 DataRow   row3          = this.tb.Rows[0];
                 DataRow[] drs           = this.tb.Select("ParentCode = '" + row3["CostBudgetDtlCode"].ToString() + "'");
                 string[]  arrColumnName = new string[list.Count];
                 int       index         = -1;
                 foreach (string text in list)
                 {
                     index++;
                     arrColumnName[index] = "BudgetMoneyHis_" + text;
                 }
                 decimal[] numArray = MathRule.SumColumn(drs, arrColumnName);
                 int       num2     = -1;
                 foreach (string text3 in arrColumnName)
                 {
                     num2++;
                     row3[text3] = numArray[num2];
                 }
             }
             foreach (DataRow row2 in this.tb.Rows)
             {
                 string text4 = "";
                 foreach (string text in list)
                 {
                     text2 = "BudgetMoneyHis_" + text;
                     text4 = text4 + string.Format("<td align=right nowrap title='{1}'>{0}</td>", CostBudgetPageRule.GetMoneyShowString(row2[text2], this.m_MoneyUnit), CostBudgetPageRule.GetWanDecimalShowHint(row2[text2]));
                 }
                 row2["BudgetMoneyHisHtml"] = text4;
             }
         }
         else
         {
             foreach (DataRow row2 in this.tb.Rows)
             {
                 row2["BudgetMoneyHisHtml"] = "";
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
コード例 #21
0
ファイル: CostBudgetPageRule.cs プロジェクト: riyuexing/rms
 public static void CalcPercent(DataRow dr, DataRow drArea)
 {
     try
     {
         if (dr.Table.Columns.Contains("ContractPayPercent"))
         {
             if (ConvertRule.ToDecimal(dr["ContractTotalMoney"]) == 0M)
             {
                 dr["ContractPayPercent"] = DBNull.Value;
             }
             else
             {
                 dr["ContractPayPercent"] = MathRule.Round((ConvertRule.ToDecimal(dr["ContractPay"]) / ConvertRule.ToDecimal(dr["ContractTotalMoney"])) * 100M, 0);
             }
         }
         if (dr.Table.Columns.Contains("BuildingPrice"))
         {
             if ((drArea != null) && (ConvertRule.ToDecimal(drArea["BuildingArea"]) != 0M))
             {
                 dr["BuildingPrice"] = MathRule.Round(ConvertRule.ToDecimal(dr["ContractTotalMoney"]) / ConvertRule.ToDecimal(drArea["BuildingArea"]), 2);
             }
             else
             {
                 dr["BuildingPrice"] = DBNull.Value;
             }
         }
         if (dr.Table.Columns.Contains("HousePrice"))
         {
             if ((drArea != null) && (ConvertRule.ToDecimal(drArea["HouseCount"]) != 0M))
             {
                 dr["HousePrice"] = MathRule.Round(ConvertRule.ToDecimal(dr["ContractTotalMoney"]) / ConvertRule.ToDecimal(drArea["HouseCount"]), 2);
             }
             else
             {
                 dr["HousePrice"] = DBNull.Value;
             }
         }
         if (dr.Table.Columns.Contains("BudgetPrice"))
         {
             if ((drArea != null) && (ConvertRule.ToDecimal(drArea["BuildingArea"]) != 0M))
             {
                 dr["BudgetPrice"] = MathRule.Round(ConvertRule.ToDecimal(dr["BudgetMoney"]) / ConvertRule.ToDecimal(drArea["BuildingArea"]), 2);
             }
             else
             {
                 dr["BudgetPrice"] = DBNull.Value;
             }
         }
         if (dr.Table.Columns.Contains("ContractOriginalPrice"))
         {
             if ((drArea != null) && (ConvertRule.ToDecimal(drArea["BuildingArea"]) != 0M))
             {
                 dr["ContractOriginalPrice"] = MathRule.Round(ConvertRule.ToDecimal(dr["ContractMoney"]) / ConvertRule.ToDecimal(drArea["BuildingArea"]), 2);
             }
             else
             {
                 dr["ContractOriginalPrice"] = DBNull.Value;
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
コード例 #22
0
ファイル: CostBudgetTargetView.cs プロジェクト: ishui/rms2
        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);
        }
コード例 #23
0
ファイル: CostBudgetTarget.cs プロジェクト: ishui/rms2
        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);
        }
コード例 #24
0
ファイル: CostRule.cs プロジェクト: riyuexing/rms
 private static decimal GetPBSUnitArea(string PBSUnitCode, EntityData PBSUnits)
 {
     return(MathRule.SumColumn(PBSUnits.CurrentTable, "BuildingAreaSum", string.Format("PBSUnitCode='{0}'", PBSUnitCode)));
 }
コード例 #25
0
 private static void FillSalBudgetDtlByYMInfra(DataTable tb, string ProjectCode, int y, int m, string ColName, DataTable tbPBSType, EntityData entityBudget)
 {
     try
     {
         string[] textArray  = new string[] { "套数", "面积", "均价", "销售额", "回款额" };
         string[] textArray2 = new string[] { "", "平米", "元", "万元", "万元" };
         string[] textArray3 = new string[] { "int", "decimal", "decimal", "decimal", "decimal" };
         string[] textArray4 = new string[] { "HouseCount", "HouseArea", "Price", "Money", "RcvMoney" };
         int      num        = 0;
         for (int i = 0; i < textArray.Length; i++)
         {
             num++;
             string text  = textArray[i];
             string text2 = textArray4[i];
             string text3 = textArray2[i];
             string text4 = textArray3[i];
             string text5 = text;
             if (text3 != "")
             {
                 text5 = text5 + "<br>(" + text3 + ")";
             }
             foreach (DataRow row2 in tbPBSType.Rows)
             {
                 DataRow   row;
                 string    pBSTypeCode = ConvertRule.ToString(row2["PBSTypeCode"]);
                 DataRow[] rowArray    = tb.Select("FieldName='" + text2 + "' and PBSTypeCode='" + pBSTypeCode + "'");
                 if (rowArray.Length == 0)
                 {
                     row                  = tb.NewRow();
                     row["sno"]           = num;
                     row["ItemName"]      = text;
                     row["FieldName"]     = text2;
                     row["Unit"]          = text3;
                     row["FieldType"]     = text4;
                     row["ItemDesc"]      = text5;
                     row["IsAct"]         = 0;
                     row["IsActName"]     = "计划";
                     row["PBSTypeCode"]   = pBSTypeCode;
                     row["PBSTypeName"]   = row2["PBSTypeName"];
                     row["PBSTypeSortID"] = row2["SortID"];
                     row["PBSTypeFullID"] = row2["FullID"];
                     row["Deep"]          = row2["Deep"];
                     row["ParentCode"]    = row2["ParentCode"];
                 }
                 else
                 {
                     row = rowArray[0];
                 }
                 string  text7 = row["ItemName"].ToString();
                 string  text8 = row["FieldType"].ToString();
                 DataRow row3  = null;
                 if (m == -1)
                 {
                     DataTable table = GetSalBudgetBeforePeriodSum(ProjectCode, y, pBSTypeCode);
                     if (table.Rows.Count > 0)
                     {
                         row3 = table.Rows[0];
                     }
                 }
                 else
                 {
                     DataRow[] rowArray2 = entityBudget.CurrentTable.Select("IMonth=" + m.ToString() + " and PBSTypeCode='" + pBSTypeCode + "'");
                     if (rowArray2.Length > 0)
                     {
                         row3 = rowArray2[0];
                     }
                 }
                 if (row3 != null)
                 {
                     if (text8 == "int")
                     {
                         row[ColName] = MathRule.GetIntShowString(row3[text2]);
                     }
                     else
                     {
                         row[ColName] = MathRule.GetDecimalShowString(row3[text2]);
                     }
                 }
                 if (rowArray.Length == 0)
                 {
                     tb.Rows.Add(row);
                 }
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }