Пример #1
0
 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;
     }
 }
Пример #2
0
 private void AddApportion(string ContractCode, string CostCode, string PBSCode, string RecordType, string MoneyField, decimal Money)
 {
     try
     {
         DataRow   row;
         DataRow[] rowArray = this.tbApportion.Select("ContractCode = '" + ContractCode + "' and CostCode='" + CostCode + "' and PBSCode = '" + PBSCode + "'");
         if (rowArray.Length == 0)
         {
             row = this.tbApportion.NewRow();
             row["RecordType"]   = RecordType;
             row["ContractCode"] = ContractCode;
             row["CostCode"]     = CostCode;
             row["PBSCode"]      = PBSCode;
             this.tbApportion.Rows.Add(row);
         }
         else
         {
             row = rowArray[0];
         }
         row[MoneyField] = ConvertRule.ToDecimal(row[MoneyField]) + Money;
         CostBudgetPageRule.CostBudgetDtlCalcField(row, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #3
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;
     }
 }
Пример #4
0
 private void SetRelationNoContract()
 {
     try
     {
         int       index;
         DataRow[] rowArray = this.tbContract.Select("RecordType = 'NoContract'");
         int       length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbContract.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbPayout.Select("RecordType = 'NoContract'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbPayout.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbApportion.Select("RecordType = 'NoContract'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbApportion.Rows.Remove(rowArray[index]);
         }
         QueryAgent agent = new QueryAgent();
         try
         {
             string queryString = "select 'Payment_' + a.PaymentCode as ContractCode, '' as ContractID, '非合同请款' + b.PaymentID as ContractName, c.SubjectCode as CostCode, c.SubjectCode as FullCode, b.SupplyCode as SupplierCode, b.SupplyName as SupplierName, a.ItemMoney as Money, a.CostBudgetSetCode, cb.PBSType, cb.PBSCode from PaymentItem a left join CBS c on c.CostCode = a.CostCode left join CostBudgetSet cb on cb.CostBudgetSetCode = a.CostBudgetSetCode, Payment b, PayoutItem oi, Voucher v, VoucherDetail vd where a.PaymentCode = b.PaymentCode and b.ProjectCode = '" + this.ProjectCode + "' and isnull(b.IsContract, 0) = 0 and a.PaymentItemCode = oi.PaymentItemCode and vd.RelaType = '付款' and vd.RelaCode = oi.PayoutCode and v.VoucherCode = vd.VoucherCode and v.Status in (1, 2)";
             if ((this.PBSType != "") || (this.PBSCode != ""))
             {
                 string text4 = queryString;
                 queryString = text4 + " and cb.PBSType = '" + this.PBSType + "' and cb.PBSCode = '" + this.PBSCode + "'";
             }
             DataTable tbSrc = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddRelationContractRow(this.tbContract, tbSrc, "NoContract", "ContractMoney");
             foreach (DataRow row in this.tbContract.Rows)
             {
                 string text2 = ConvertRule.ToString(row["ContractCode"]).Replace("Payment_", "");
                 string text3 = ConvertRule.ToString(row["CostCode"]);
                 queryString = "select b.VoucherCode as PayoutCode, b.CheckDate as PayoutDate, a.DebitMoney as Money, 'Payment_' + pi.PaymentCode as ContractCode, a.SubjectCode as CostCode, a.SubjectCode as FullCode, '' as CostBudgetSetCode, '' as PBSType, '' as PBSCode from VoucherDetail a inner join Voucher b on b.VoucherCode = a.VoucherCode       and b.Status in (1, 2), PayoutItem oi, PaymentItem pi where b.ProjectCode = '" + this.ProjectCode + "' and a.RelaType = '付款' and a.RelaCode = oi.PayoutCode and oi.PaymentItemCode = pi.PaymentItemCode and pi.PaymentCode = '" + text2 + "'";
                 tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
                 this.AddPayout(tbSrc, "Contract");
                 foreach (DataRow row2 in tbSrc.Rows)
                 {
                     row["ContractPayReal"] = ConvertRule.ToDecimal(row["ContractPayReal"]) + ConvertRule.ToDecimal(row2["Money"]);
                 }
             }
             CostBudgetPageRule.CostBudgetDtlCalcAllRow(this.tbContract, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
         }
         finally
         {
             agent.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #5
0
 public void RefreshDateRange()
 {
     try
     {
         this.ResetDateTitleHtml();
         this.ResetContractDateRange();
         CostBudgetPageRule.ClearFieldValue(this.tb, new string[] { "PlanDataHtml" });
         if ((this.StartYm != "") && (this.EndYm != ""))
         {
             foreach (DataRow row in this.tb.Rows)
             {
                 string text          = "";
                 string text2         = row["RecordType"].ToString();
                 string contractCode  = ConvertRule.ToString(row["ContractCode"]);
                 string costCode      = ConvertRule.ToString(row["CostCode"]);
                 string text5         = ConvertRule.ToString(row["FullCode"]);
                 string pBSCode       = ConvertRule.ToString(row["PBSCode"]);
                 int    monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm);
                 for (int i = 0; i < monthsBetween; i++)
                 {
                     string text12;
                     string text7         = StringRule.YmAddMonths(this.StartYm, i);
                     string s             = string.Format("{0}-{1}-01", text7.Substring(0, 4), text7.Substring(4, 2));
                     string payoutDateEnd = DateTime.Parse(s).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
                     string text10        = "PayoutMoneyYm_" + text7;
                     string money         = StringRule.BuildShowNumberString(row[text10]);
                     if (pBSCode == "")
                     {
                         text12 = CostBudgetPageRule.GetContractPayRealHref(money, costCode, contractCode, "", s, payoutDateEnd, this.PBSType, pBSCode);
                     }
                     else
                     {
                         text12 = money;
                     }
                     if (text12 == "")
                     {
                         text = text + string.Format("<td>{0}</td>", text12);
                     }
                     else
                     {
                         text = text + string.Format("<td align=right nowrap>{0}</td>", text12);
                     }
                 }
                 row["PlanDataHtml"] = text;
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #6
0
 private void AddRelationContractRow(DataTable tbContract, DataTable tbSrc, string RecordType, string MoneyField)
 {
     try
     {
         foreach (DataRow row in tbSrc.Rows)
         {
             DataRow   row2;
             string    text     = ConvertRule.ToString(row["ContractCode"]);
             DataRow[] rowArray = tbContract.Select("ContractCode = '" + text + "' and CostCode='" + ConvertRule.ToString(row["CostCode"]) + "'");
             if (rowArray.Length == 0)
             {
                 row2 = tbContract.NewRow();
                 row2["RecordType"]   = RecordType;
                 row2["ContractCode"] = text;
                 row2["ContractID"]   = row["ContractID"];
                 row2["ContractName"] = row["ContractName"];
                 if (tbSrc.Columns.Contains("SupplierCode"))
                 {
                     row2["SupplierName"] = row["SupplierName"];
                     row2["SupplierCode"] = row["SupplierCode"];
                 }
                 row2["CostCode"] = row["CostCode"];
                 row2["FullCode"] = row["FullCode"];
                 tbContract.Rows.Add(row2);
             }
             else
             {
                 row2 = rowArray[0];
             }
             string text2 = ConvertRule.ToString(row2["AllContractCode"]);
             if (text2.IndexOf("'" + text + "'") < 0)
             {
                 if (text2 != "")
                 {
                     text2 = text2 + ",";
                 }
                 text2 = text2 + "'" + text + "'";
             }
             row2["AllContractCode"] = text2;
             row2[MoneyField]        = ConvertRule.ToDecimal(row2[MoneyField]) + ConvertRule.ToDecimal(row["Money"]);
             CostBudgetPageRule.CostBudgetDtlCalcField(row2, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #7
0
 private void SetRelationBalance()
 {
     try
     {
         int       index;
         DataRow[] rowArray = this.tbContract.Select("RecordType = 'Balance'");
         int       length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbContract.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbPlan.Select("RecordType = 'Balance'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbPlan.Rows.Remove(rowArray[index]);
         }
         QueryAgent agent = new QueryAgent();
         try
         {
             DataTable tbSrc;
             string    queryString;
             if (this.CostBudgetCode != "")
             {
                 queryString = "select c.FullCode, a.CostCode, 'Balance' as RecordType, 'Balance_' + a.CostCode as ContractCode, '' as ContractID, '预留金额' as ContractName, a.BudgetMoney as Money from CostBudgetDtl a left join CBS c on c.CostCode = a.CostCode where a.ProjectCode = '" + this.ProjectCode + "' and a.CostBudgetCode = '" + this.CostBudgetCode + "' and not exists(select * from CBS CBSCount where CBSCount.ParentCode = a.CostCode)";
                 tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
                 this.AddRelationContractRow(this.tbContract, tbSrc, "Balance", "ContractMoney");
             }
             if (this.CostBudgetCode != "")
             {
                 queryString = "select c.FullCode, a.CostCode, 'Balance' as RecordType, 'Balance_' + a.CostCode as ContractCode, right('0000' + cast(b.IYear as varchar), 4) + right('00' + cast(b.IMonth as varchar), 2) as PlanYm, b.BudgetMoney as PlanMoney from CostBudgetDtl a left join CBS c on c.CostCode = a.CostCode, CostBudgetMonth b where a.CostBudgetDtlCode = b.CostBudgetDtlCode and a.ProjectCode = '" + this.ProjectCode + "' and a.CostBudgetCode = '" + this.CostBudgetCode + "' and right('0000' + cast(b.IYear as varchar), 4) + right('00' + cast(b.IMonth as varchar), 2) between '" + this.StartYm + "' and '" + this.EndYm + "'";
                 tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
                 this.AddPlan(tbSrc, "");
             }
             CostBudgetPageRule.CostBudgetDtlCalcAllRow(this.tbContract, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
         }
         finally
         {
             agent.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #8
0
 public void RefreshDateRange()
 {
     try
     {
         this.ResetDateTitleHtml();
         this.ResetContractDateRange();
         CostBudgetPageRule.ClearFieldValue(this.tb, new string[] { "PlanDataHtml" });
         int num = -1;
         if ((this.StartYm != "") && (this.EndYm != ""))
         {
             foreach (DataRow row in this.tb.Rows)
             {
                 num++;
                 string text          = "";
                 string text2         = row["RecordType"].ToString();
                 string text3         = ConvertRule.ToString(row["ContractCode"]);
                 string text4         = ConvertRule.ToString(row["CostCode"]);
                 string text5         = ConvertRule.ToString(row["FullCode"]);
                 string text6         = ConvertRule.ToString(row["ParentCode"]);
                 string text7         = ConvertRule.ToString(row["ClassTd"]);
                 int    monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm);
                 for (int i = 0; i < monthsBetween; i++)
                 {
                     string text8  = StringRule.YmAddMonths(this.StartYm, i);
                     string text10 = DateTime.Parse(string.Format("{0}-{1}-01", text8.Substring(0, 4), text8.Substring(4, 2))).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
                     string text11 = "PlanMoneyYm_" + text8;
                     string text12 = StringRule.BuildShowNumberString(row[text11]);
                     if (this.ReadOnly)
                     {
                         text = text + string.Format("<td align=right nowrap class=\"{1}\">{0}</td>", text12, text7);
                     }
                 }
                 row["PlanDataHtml"] = text;
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #9
0
 private void SetRelationBidding()
 {
     try
     {
         int       index;
         DataRow[] rowArray = this.tbContract.Select("RecordType = 'Bidding'");
         int       length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbContract.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbPlan.Select("RecordType = 'Bidding'");
         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, 'Bidding' as RecordType, 'Bidding_' + b.BiddingCode + '#' + b.BiddingDtlCode as ContractCode, '' as ContractID, a.title + '(' + b.title + ')' as ContractName, b.* from Bidding a , BiddingDtl b left join CBS c on c.CostCode = b.CostCode where a.ProjectCode = '" + this.ProjectCode + "' and b.CostBudgetSetCode = '" + this.CostBudgetSetCode + "' and isnull(a.state, 0) = 0 and a.BiddingCode = b.BiddingCode";
             DataTable tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddRelationContractRow(this.tbContract, tbSrc, "Bidding", "ContractMoney");
             queryString = "select c.FullCode, 'Bidding' as RecordType, 'Bidding_' + b.BiddingCode + '#' + a.BiddingDtlCode as ContractCode, a.CostCode, convert(varchar(6), p.PlanningPayDate, 112) as PlanYm, sum(isnull(p.Money, 0)) as PlanMoney from BiddingDtl a left join CBS c on c.CostCode = a.CostCode, Bidding b, BiddingDtlPlan p where a.BiddingCode = b.BiddingCode and a.BiddingDtlCode = p.BiddingDtlCode 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, 'Bidding_' + b.BiddingCode + '#' + a.BiddingDtlCode, convert(varchar(6), p.PlanningPayDate, 112)";
             tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddPlan(tbSrc, "");
             CostBudgetPageRule.CostBudgetDtlCalcAllRow(this.tbContract, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
         }
         finally
         {
             agent.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #10
0
 public void RefreshDateRange()
 {
     try
     {
         this.ResetDateTitleHtml();
         CostBudgetPageRule.ClearFieldValue(this.tb, new string[] { "PlanDataHtml" });
         if ((this.StartYm != "") && (this.EndYm != ""))
         {
             foreach (DataRow row in this.tb.Rows)
             {
                 string costCode      = ConvertRule.ToString(row["CostCode"]);
                 string text2         = "";
                 int    monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm);
                 for (int i = 0; i < monthsBetween; i++)
                 {
                     string text3         = StringRule.YmAddMonths(this.StartYm, i);
                     string s             = string.Format("{0}-{1}-01", text3.Substring(0, 4), text3.Substring(4, 2));
                     string payoutDateEnd = DateTime.Parse(s).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
                     string text6         = "PayoutMoneyYm_" + text3;
                     string text8         = GetPayoutHref(StringRule.BuildShowNumberString(row[text6]), costCode, s, payoutDateEnd);
                     if (text8 == "")
                     {
                         text2 = text2 + string.Format("<td>{0}</td>", text8);
                     }
                     else
                     {
                         text2 = text2 + string.Format("<td align=right nowrap>{0}</td>", text8);
                     }
                 }
                 row["PlanDataHtml"] = text2;
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #11
0
        public static string GetContractHref(object objRecordType, object objContractCode, object objContractName)
        {
            string text3;

            try
            {
                string contractHref = "";
                if (ConvertRule.ToString(objRecordType) != "Apportion")
                {
                    contractHref = CostBudgetPageRule.GetContractHref(objContractCode, objContractName);
                }
                else
                {
                    contractHref = ConvertRule.ToString(objContractName);
                }
                text3 = contractHref;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text3);
        }
Пример #12
0
        public static string GetContractPayRealHref(object objRecordType, object Money, object CostCode, object ContractCode, object IsContract, object PayoutDateBegin, object PayoutDateEnd, object PBSType, object PBSCode)
        {
            string text3;

            try
            {
                string text = "";
                if (ConvertRule.ToString(objRecordType) != "Apportion")
                {
                    text = CostBudgetPageRule.GetContractPayRealHref(Money, CostCode, ContractCode, IsContract, PayoutDateBegin, PayoutDateEnd, PBSType, PBSCode);
                }
                else
                {
                    text = ConvertRule.ToString(Money);
                }
                text3 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text3);
        }
Пример #13
0
        public DataSet Generate()
        {
            DataSet ds;

            try
            {
                this.m_ds = CostBudgetPageRule.GenerateEmptyCostBudgetDtl(this.StartY, this.EndY, null);
                this.tb.Columns.Add("CostBudgetSetCode");
                this.tbMonth.Columns.Add("CostBudgetSetCode");
                this.tbContractMonth.Columns.Add("CostBudgetSetCode");
                for (int i = 0; i < this.m_arrCostBudgetSetCode.Length; i++)
                {
                    this.m_arrDyn[i]                          = new CostBudgetDynamic(this.ProjectCode, this.m_arrCostBudgetSetCode[i], this.CostBudgetBackupCode);
                    this.m_arrDyn[i].StartY                   = this.StartY;
                    this.m_arrDyn[i].EndY                     = this.EndY;
                    this.m_arrDyn[i].ShowApportion            = false;
                    this.m_arrDyn[i].ShowContractBudget       = false;
                    this.m_arrDyn[i].ShowTargetChange         = false;
                    this.m_arrDyn[i].MaxCBSDeep               = 1;
                    this.m_arrDyn[i].AutoRefreshHtml          = false;
                    this.m_arrDyn[i].ShowContractAccountMoney = this.ShowContractAccountMoney;
                    this.m_arrDyn[i].Generate();
                }
                this.SumDs();
                if (this.AutoRefreshHtml)
                {
                    this.RefreshHtml();
                }
                ds = this.ds;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(ds);
        }
Пример #14
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;
     }
 }
Пример #15
0
 private void SetRelationNoContract()
 {
     try
     {
         int       index;
         DataRow[] rowArray = this.tbContract.Select("RecordType = 'NoContract'");
         int       length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbContract.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbPayout.Select("RecordType = 'NoContract'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbPayout.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbApportion.Select("RecordType = 'NoContract'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbApportion.Rows.Remove(rowArray[index]);
         }
         QueryAgent agent = new QueryAgent();
         try
         {
             string text4;
             string queryString = "select 'Payment_' + a.PaymentCode as ContractCode, '' as ContractID, '非合同请款' + b.PaymentID as ContractName, a.CostCode, c.FullCode, b.SupplyCode as SupplierCode, b.SupplyName as SupplierName, a.ItemMoney as Money, a.CostBudgetSetCode, cb.PBSType, cb.PBSCode from PaymentItem a left join CBS c on c.CostCode = a.CostCode left join CostBudgetSet cb on cb.CostBudgetSetCode = a.CostBudgetSetCode, Payment b where a.PaymentCode = b.PaymentCode and b.ProjectCode = '" + this.ProjectCode + "' and isnull(b.IsContract, 0) = 0";
             if ((this.PBSType != "") || (this.PBSCode != ""))
             {
                 text4       = queryString;
                 queryString = text4 + " and cb.PBSType = '" + this.PBSType + "' and cb.PBSCode = '" + this.PBSCode + "'";
             }
             DataTable tbSrc = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddRelationContractRow(this.tbContract, tbSrc, "NoContract", "ContractMoney");
             queryString = "select 'Payment_' + a.PaymentCode as ContractCode, '' as ContractID, '非合同请款' + b.PaymentID as ContractName, a.CostCode, c.FullCode, b.SupplyCode as SupplierCode, b.SupplyName as SupplierName, a.ItemMoney as Money, a.CostBudgetSetCode, cb.PBSType, cb.PBSCode from PaymentItem a left join CBS c on c.CostCode = a.CostCode left join CostBudgetSet cb on cb.CostBudgetSetCode = a.CostBudgetSetCode, Payment b where a.PaymentCode = b.PaymentCode and b.ProjectCode = '" + this.ProjectCode + "' and b.Status in (1, 2) and isnull(b.IsContract, 0) = 0";
             if ((this.PBSType != "") || (this.PBSCode != ""))
             {
                 text4       = queryString;
                 queryString = text4 + " and cb.PBSType = '" + this.PBSType + "' and cb.PBSCode = '" + this.PBSCode + "'";
             }
             tbSrc = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddRelationContractRow(this.tbContract, tbSrc, "NoContract", "ContractPay");
             queryString = "select mi.CostCode, c.FullCode, 'Payment_' + m.PaymentCode as ContractCode, a.PayoutCode, b.PayoutDate, a.PayoutMoney as Money, mi.CostBudgetSetCode, cb.PBSType, cb.PBSCode from PayoutItem a inner join Payout b on b.PayoutCode = a.PayoutCode, PaymentItem mi left join CBS c on c.CostCode = mi.CostCode left join CostBudgetSet cb on cb.CostBudgetSetCode = mi.CostBudgetSetCode, Payment m where a.PaymentItemCode = mi.PaymentItemCode and mi.PaymentCode = m.PaymentCode and m.ProjectCode = '" + this.ProjectCode + "' and isnull(m.IsContract, 0) = 0";
             if ((this.PBSType != "") || (this.PBSCode != ""))
             {
                 text4       = queryString;
                 queryString = text4 + " and cb.PBSType = '" + this.PBSType + "' and cb.PBSCode = '" + this.PBSCode + "'";
             }
             if (PaymentRule.IsPayoutMoneyIncludeNotCheck == 0)
             {
                 queryString = queryString + " and b.Status in (1)";
             }
             DataTable table2 = agent.ExecSqlForDataSet(queryString).Tables[0];
             DataView  view   = new DataView(this.tbContract, "RecordType = 'NoContract'", "", DataViewRowState.CurrentRows);
             foreach (DataRowView view2 in view)
             {
                 DataRow   row          = view2.Row;
                 string    costCode     = ConvertRule.ToString(row["CostCode"]);
                 string    contractCode = ConvertRule.ToString(row["ContractCode"]);
                 DataRow[] drsSrc       = table2.Select("CostCode = '" + costCode + "' and ContractCode = '" + contractCode + "'");
                 this.AddPayout(drsSrc, "Contract");
                 foreach (DataRow row2 in drsSrc)
                 {
                     row["ContractPayReal"] = ConvertRule.ToDecimal(row["ContractPayReal"]) + ConvertRule.ToDecimal(row2["Money"]);
                     this.DoApportion(contractCode, costCode, ConvertRule.ToString(row2["CostBudgetSetCode"]), ConvertRule.ToString(row["RecordType"]), "ContractPayReal", ConvertRule.ToDecimal(row2["Money"]));
                 }
             }
             CostBudgetPageRule.CostBudgetDtlCalcAllRow(this.tbContract, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
         }
         finally
         {
             agent.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #16
0
 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.tbPayout.Select("RecordType = 'Contract'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbPayout.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbApportion.Select("RecordType = 'Contract'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbApportion.Rows.Remove(rowArray[index]);
         }
         QueryAgent agent = new QueryAgent();
         try
         {
             string text6;
             string queryString = "select c.FullCode, s.SupplierName, cb.PBSType, cb.PBSCode, a.*, b.* from ContractCost a left join CBS c on c.CostCode = a.CostCode left join CostBudgetSet cb on cb.CostBudgetSetCode = a.CostBudgetSetCode, Contract b left join Supplier s on s.SupplierCode = b.SupplierCode where a.ContractCode = b.ContractCode and b.ProjectCode = '" + this.ProjectCode + "' and b.Status in (0, 2) and not exists (select * from ContractChange g where g.ContractCode = b.ContractCode)";
             if ((this.PBSType != "") || (this.PBSCode != ""))
             {
                 text6       = queryString;
                 queryString = text6 + " and cb.PBSType = '" + this.PBSType + "' and cb.PBSCode = '" + this.PBSCode + "'";
             }
             DataTable tbSrc = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddRelationContractRow(this.tbContract, tbSrc, "Contract", "ContractMoney");
             queryString = "select c.FullCode, a.Money as Money, s.SupplierName, cb.PBSType, cb.PBSCode, a.*, b.* from ContractCostChange a left join CBS c on c.CostCode = a.CostCode left join CostBudgetSet cb on cb.CostBudgetSetCode = a.CostBudgetSetCode, Contract b left join Supplier s on s.SupplierCode = b.SupplierCode where a.ContractCode = b.ContractCode and b.ProjectCode = '" + this.ProjectCode + "' 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)";
             if ((this.PBSType != "") || (this.PBSCode != ""))
             {
                 text6       = queryString;
                 queryString = text6 + " and cb.PBSType = '" + this.PBSType + "' and cb.PBSCode = '" + this.PBSCode + "'";
             }
             tbSrc = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.FillContractChangeCostCode(tbSrc);
             this.AddRelationContractRow(this.tbContract, tbSrc, "Contract", "ContractMoney");
             queryString = "select c.FullCode, a.ChangeMoney as Money, s.SupplierName, cb.PBSType, cb.PBSCode, a.*, b.* from ContractCostChange a left join CBS c on c.CostCode = a.CostCode left join CostBudgetSet cb on cb.CostBudgetSetCode = a.CostBudgetSetCode, 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 b.Status not in (3) and g.Status in (0) and a.ChangeMoney <> 0";
             if ((this.PBSType != "") || (this.PBSCode != ""))
             {
                 text6       = queryString;
                 queryString = text6 + " and cb.PBSType = '" + this.PBSType + "' and cb.PBSCode = '" + this.PBSCode + "'";
             }
             tbSrc = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.FillContractChangeCostCode(tbSrc);
             this.AddRelationContractRow(this.tbContract, tbSrc, "Contract", "ContractChangeMoney");
             foreach (DataRow row in this.tbContract.Rows)
             {
                 string contractCode = ConvertRule.ToString(row["ContractCode"]);
                 string costCode     = ConvertRule.ToString(row["CostCode"]);
                 string text4        = ConvertRule.ToString(row["AllContractCode"]);
                 string text5        = ConvertRule.ToString(row["AllocateCodes"]);
                 if ((text4 != "") && (text5 != ""))
                 {
                     queryString = "select a.CostBudgetSetCode, cb.PBSType, cb.PBSCode, sum(isnull(a.ItemMoney, 0)) as Money from PaymentItem a left join CostBudgetSet cb on cb.CostBudgetSetCode = a.CostBudgetSetCode, Payment b where a.PaymentCode = b.PaymentCode and b.ProjectCode = '" + this.ProjectCode + "' and b.Status in (1, 2) and b.ContractCode in (" + text4 + ") and a.AllocateCode in (" + text5 + ")";
                     if ((this.PBSType != "") || (this.PBSCode != ""))
                     {
                         text6       = queryString;
                         queryString = text6 + " and cb.PBSType = '" + this.PBSType + "' and cb.PBSCode = '" + this.PBSCode + "'";
                     }
                     queryString = queryString + " group by a.CostBudgetSetCode, cb.PBSType, cb.PBSCode";
                     tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
                     foreach (DataRow row2 in tbSrc.Rows)
                     {
                         row["ContractPay"] = ConvertRule.ToDecimal(row["ContractPay"]) + ConvertRule.ToDecimal(row2["Money"]);
                         this.DoApportion(contractCode, costCode, ConvertRule.ToString(row2["CostBudgetSetCode"]), ConvertRule.ToString(row["RecordType"]), "ContractPay", ConvertRule.ToDecimal(row2["Money"]));
                     }
                     queryString = "select a.PayoutCode, b.PayoutDate, a.PayoutMoney as Money, '" + contractCode + "' as ContractCode, mi.CostCode, c.FullCode, mi.CostBudgetSetCode, cb.PBSType, cb.PBSCode from PayoutItem a inner join Payout b on b.PayoutCode = a.PayoutCode, PaymentItem mi left join CBS c on c.CostCode = mi.CostCode left join CostBudgetSet cb on cb.CostBudgetSetCode = mi.CostBudgetSetCode, Payment m where a.PaymentItemCode = mi.PaymentItemCode and mi.PaymentCode = m.PaymentCode and m.ProjectCode = '" + this.ProjectCode + "' and m.ContractCode in (" + text4 + ") and mi.AllocateCode in (" + text5 + ")";
                     if (PaymentRule.IsPayoutMoneyIncludeNotCheck == 0)
                     {
                         queryString = queryString + " and b.Status in (1)";
                     }
                     if ((this.PBSType != "") || (this.PBSCode != ""))
                     {
                         text6       = queryString;
                         queryString = text6 + " and cb.PBSType = '" + this.PBSType + "' and cb.PBSCode = '" + this.PBSCode + "'";
                     }
                     tbSrc = agent.ExecSqlForDataSet(queryString).Tables[0];
                     this.AddPayout(tbSrc, "Contract");
                     foreach (DataRow row2 in tbSrc.Rows)
                     {
                         row["ContractPayReal"] = ConvertRule.ToDecimal(row["ContractPayReal"]) + ConvertRule.ToDecimal(row2["Money"]);
                         this.DoApportion(contractCode, costCode, ConvertRule.ToString(row2["CostBudgetSetCode"]), ConvertRule.ToString(row["RecordType"]), "ContractPayReal", ConvertRule.ToDecimal(row2["Money"]));
                     }
                     CostBudgetPageRule.CostBudgetDtlCalcField(row, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
                 }
             }
         }
         finally
         {
             agent.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #17
0
 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;
     }
 }
Пример #18
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);
        }
Пример #19
0
 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;
     }
 }
Пример #20
0
 private void AddRelationContractRow(DataTable tbContract, DataTable tbSrc, string RecordType, string MoneyField)
 {
     try
     {
         foreach (DataRow row in tbSrc.Rows)
         {
             DataRow   row2;
             string    contractCode = ConvertRule.ToString(row["ContractCode"]);
             string    costCode     = ConvertRule.ToString(row["CostCode"]);
             DataRow[] rowArray     = tbContract.Select("ContractCode = '" + contractCode + "' and CostCode='" + costCode + "'");
             if (rowArray.Length == 0)
             {
                 row2 = tbContract.NewRow();
                 row2["RecordType"]   = RecordType;
                 row2["ContractCode"] = contractCode;
                 row2["ContractID"]   = row["ContractID"];
                 row2["ContractName"] = row["ContractName"];
                 row2["SupplierName"] = row["SupplierName"];
                 row2["SupplierCode"] = row["SupplierCode"];
                 row2["CostCode"]     = costCode;
                 row2["FullCode"]     = row["FullCode"];
                 tbContract.Rows.Add(row2);
             }
             else
             {
                 row2 = rowArray[0];
             }
             string text3 = ConvertRule.ToString(row2["AllContractCode"]);
             if (text3.IndexOf("'" + contractCode + "'") < 0)
             {
                 if (text3 != "")
                 {
                     text3 = text3 + ",";
                 }
                 text3 = text3 + "'" + contractCode + "'";
             }
             row2["AllContractCode"] = text3;
             if (tbSrc.Columns.Contains("ContractCostCode"))
             {
                 string text4 = ConvertRule.ToString(row["ContractCostCode"]);
                 if (text4 != "")
                 {
                     string text5 = ConvertRule.ToString(row2["AllocateCodes"]);
                     if (text5.IndexOf("'" + text4 + "'") < 0)
                     {
                         if (text5 != "")
                         {
                             text5 = text5 + ",";
                         }
                         text5 = text5 + "'" + text4 + "'";
                     }
                     row2["AllocateCodes"] = text5;
                 }
             }
             row2[MoneyField] = ConvertRule.ToDecimal(row2[MoneyField]) + ConvertRule.ToDecimal(row["Money"]);
             CostBudgetPageRule.CostBudgetDtlCalcField(row2, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
             this.DoApportion(contractCode, costCode, ConvertRule.ToString(row["CostBudgetSetCode"]), RecordType, MoneyField, ConvertRule.ToDecimal(row["Money"]));
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #21
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;
     }
 }
Пример #22
0
 public void ResetTitleHtml()
 {
     try
     {
         this.m_TitleHtml1           = "";
         this.m_TitleHtmlArea        = "";
         this.m_TitleHtmlAreaPercent = "";
         foreach (DataRow row in this.tbPBS.Rows)
         {
             if (ConvertRule.ToString(row["PBSType"]) == "B")
             {
                 this.m_TitleHtml1 = this.m_TitleHtml1 + string.Format("<th align=center nowrap>{0}</th>", CostBudgetPageRule.GetBuildingHref(ConvertRule.ToString(row["PBSCode"]), ConvertRule.ToString(row["PBSName"])) + "&nbsp;");
             }
             else
             {
                 this.m_TitleHtml1 = this.m_TitleHtml1 + string.Format("<th align=center nowrap>{0}</th>", ConvertRule.ToString(row["PBSName"]) + "&nbsp;");
             }
             this.m_TitleHtmlArea        = this.m_TitleHtmlArea + string.Format("<th align=center nowrap style='border-top:0'>{0}</th>", StringRule.BuildShowNumberString(row["Area"], "#,##0.##") + "&nbsp;");
             this.m_TitleHtmlAreaPercent = this.m_TitleHtmlAreaPercent + string.Format("<th align=center nowrap style='border-top:0'>{0}</th>", StringRule.BuildShowPercentString(row["AreaPercent"]) + "&nbsp;");
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Пример #23
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);
        }
Пример #24
0
 public void RefreshHtml()
 {
     try
     {
         DataRow drDst;
         if (!this.ds.Tables.Contains("Html"))
         {
             this.ds.Tables.Add(CostBudgetPageRule.CreateDynamicHtmlTable(this.StartY, this.EndY, this.tb));
         }
         this.tbHtml.Clear();
         foreach (DataRow row in this.tb.Rows)
         {
             drDst = this.tbHtml.NewRow();
             ConvertRule.DataRowCopy(row, drDst, this.tb, this.tbHtml);
             this.tbHtml.Rows.Add(drDst);
         }
         if ((this.StartY != "") && (this.EndY != ""))
         {
             DataRow[] drsChild;
             DataView  view = new DataView(this.tbHtml, "Deep = 3", "", DataViewRowState.CurrentRows);
             foreach (DataRowView view2 in view)
             {
                 int    objYear;
                 int    objMonth;
                 string text4;
                 string name;
                 drDst = view2.Row;
                 string    text     = ConvertRule.ToString(drDst["CostCode"]);
                 string    text2    = ConvertRule.ToString(drDst["FullCode"]);
                 string    text3    = ConvertRule.ToString(drDst["CostBudgetSetCode"]);
                 DataRow[] rowArray = this.tbMonth.Select(string.Format("CostCode = '{0}' and CostBudgetSetCode = '{1}'", text, text3));
                 foreach (DataRow row3 in rowArray)
                 {
                     objYear  = ConvertRule.ToInt(row3["IYear"]);
                     objMonth = ConvertRule.ToInt(row3["IMonth"]);
                     text4    = ConvertRule.FormatYYYYMM(objYear, objMonth);
                     name     = "BudgetMoney_" + text4;
                     if (this.tbHtml.Columns.Contains(name))
                     {
                         drDst[name] = ConvertRule.ToDecimal(drDst[name]) + ConvertRule.ToDecimal(row3["Money"]);
                     }
                 }
                 rowArray = this.tbContractMonth.Select(string.Format("FullCode like '{0}%' and CostBudgetSetCode = '{1}'", text2, text3));
                 foreach (DataRow row3 in rowArray)
                 {
                     objYear  = ConvertRule.ToInt(row3["IYear"]);
                     objMonth = ConvertRule.ToInt(row3["IMonth"]);
                     text4    = ConvertRule.FormatYYYYMM(objYear, objMonth);
                     name     = "ContractMoney_" + text4;
                     if (this.tbHtml.Columns.Contains(name))
                     {
                         drDst[name] = ConvertRule.ToDecimal(drDst[name]) + ConvertRule.ToDecimal(row3["Money"]);
                     }
                     text4 = ConvertRule.FormatYYYYMM(objYear, 0);
                     name  = "ContractMoney_" + text4;
                     if (this.tbHtml.Columns.Contains(name))
                     {
                         drDst[name] = ConvertRule.ToDecimal(drDst[name]) + ConvertRule.ToDecimal(row3["Money"]);
                     }
                 }
             }
             view = new DataView(this.tbHtml, "Deep = 2", "", DataViewRowState.CurrentRows);
             foreach (DataRowView view2 in view)
             {
                 drDst    = view2.Row;
                 drsChild = this.tbHtml.Select("ParentCode = '" + ConvertRule.ToString(drDst["CostBudgetDtlCode"]) + "'");
                 this.CalcByChilds(drDst, drsChild);
             }
             view = new DataView(this.tbHtml, "Deep = 1", "", DataViewRowState.CurrentRows);
             foreach (DataRowView view2 in view)
             {
                 drDst    = view2.Row;
                 drsChild = this.tbHtml.Select("ParentCode = '" + ConvertRule.ToString(drDst["CostBudgetDtlCode"]) + "'");
                 this.CalcByChilds(drDst, drsChild);
             }
         }
         foreach (DataRow row2 in this.tbHtml.Rows)
         {
             string text6   = ConvertRule.ToString(row2["RecordType"]);
             string classTd = ConvertRule.ToString(row2["ClassTd"]);
             if (text6 == "")
             {
                 row2["PlanDataHtml"] = CostBudgetPageRule.GenerateCostBudgetPlanDataHtml(row2, this.iStartY, this.iEndY, new string[] { "BudgetMoney_", "ContractMoney_" }, new string[] { classTd, CostBudgetPageRule.m_ClassTdContract }, new string[] { "预算", "合同" });
             }
             else
             {
                 row2["PlanDataHtml"] = CostBudgetPageRule.GenerateCostBudgetPlanDataHtml(row2, this.iStartY, this.iEndY, "ContractMoney_", classTd);
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }