Exemple #1
0
        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnIsAudit_Click(object sender, EventArgs e)
        {
            string year = ddlYear.SelectedValue;
            //获取项目所属字段集合
            var xmNickInclude = base.XMIncludeFieldsService.GetXMIncludeFieldsListByProjectID(ProjectId);

            if (xmNickInclude != null && !string.IsNullOrEmpty(xmNickInclude.Fields))
            {
                //遍历字段ID
                foreach (string id in xmNickInclude.Fields.Split(','))
                {
                    //
                    HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail cost = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(id), ProjectId, int.Parse(year));
                    if (cost != null)
                    {
                        cost.IsAudit    = true;
                        cost.UpdateID   = HozestERPContext.Current.User.SCustomerInfo.CustomerID;
                        cost.UpdateDate = DateTime.Now;
                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(cost);
                    }
                }
                base.ShowMessage("操作成功!");
            }
            this.BindGrid();
        }
        /// <summary>
        /// Update into XMProjectCostDetail
        /// </summary>
        /// <param name="xmnickcostdetail">XMProjectCostDetail</param>
        public void UpdateXMProjectCostDetail(XMProjectCostDetail xmprojectcostdetail)
        {
            if (xmprojectcostdetail == null)
            {
                return;
            }

            if (this._context.IsAttached(xmprojectcostdetail))
            {
                this._context.XMProjectCostDetails.Attach(xmprojectcostdetail);
            }

            this._context.SaveChanges();
        }
        /// <summary>
        /// Insert into XMProjectCostDetail
        /// </summary>
        /// <param name="xmnickcostdetail">XMProjectCostDetail</param>
        public void InsertXMProjectCostDetail(XMProjectCostDetail xmprojectcostdetail)
        {
            if (xmprojectcostdetail == null)
            {
                return;
            }

            if (!this._context.IsAttached(xmprojectcostdetail))
            {
                this._context.XMProjectCostDetails.AddObject(xmprojectcostdetail);
            }

            this._context.SaveChanges();
        }
Exemple #4
0
        private void InitData()
        {
            //更具项目ID 查询字段是否设置
            var xmNickInclude = base.XMIncludeFieldsService.GetXMIncludeFieldsListByProjectID(ProjectId);

            if (xmNickInclude == null)
            {
                base.ShowMessage("请先设置预算字段!");
                return;
            }
            else
            {
                //判断当前年份数据是否存在(如不存在自动添加)
                if (xmNickInclude != null && !string.IsNullOrEmpty(xmNickInclude.Fields))
                {
                    foreach (string id in xmNickInclude.Fields.Split(','))
                    {
                        HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail cost = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(id), ProjectId, int.Parse(ddlYear.SelectedValue));
                        if (cost == null)
                        {
                            //自动插入想关数据
                            HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail Info = new HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail();
                            Info.ProjectId        = ProjectId;
                            Info.FinancialFieldID = int.Parse(id);
                            Info.Year             = Convert.ToInt16(ddlYear.SelectedValue);
                            Info.OneMonthCost     = 0;
                            Info.TwoMonthCost     = 0;
                            Info.ThreeMonthCost   = 0;
                            Info.FourMonthCost    = 0;
                            Info.FiveMonthCost    = 0;
                            Info.SixMonthCost     = 0;
                            Info.SevenMonthCost   = 0;
                            Info.EightMonthCost   = 0;
                            Info.NineMonthCost    = 0;
                            Info.TenMonthCost     = 0;
                            Info.ElevenMonthCost  = 0;
                            Info.TwelMonthCost    = 0;
                            Info.IsEnable         = false;
                            Info.IsAudit          = false;
                            Info.CreateDate       = DateTime.Now;
                            Info.CreateID         = HozestERPContext.Current.User.CustomerID;
                            Info.UpdateDate       = DateTime.Now;
                            Info.UpdateID         = HozestERPContext.Current.User.CustomerID;
                            base.XMProjectCostDetailService.InsertXMProjectCostDetail(Info);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 判断当年数据是否已经审核
        /// </summary>
        /// <returns></returns>
        private bool checkIsAudit()
        {
            bool isAudit = false;

            if (this.ProjectId != 0)     //如果是项目
            {
                string year = DateTime.Now.Year.ToString();
                //获取项目所属字段集合
                var xmNickInclude = base.XMIncludeFieldsService.GetXMIncludeFieldsListByProjectID(ProjectId);
                if (xmNickInclude != null && !string.IsNullOrEmpty(xmNickInclude.Fields))
                {
                    //拆分字段
                    foreach (string id in xmNickInclude.Fields.Split(','))
                    {
                        //根据字段ID,年份,项目ID 查询相关记录
                        HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail cost = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(id), ProjectId, int.Parse(year));
                        if (cost != null && cost.IsAudit != null)
                        {
                            isAudit = cost.IsAudit.Value;
                        }
                    }
                }
            }

            if (this.DepartmentId != 0)    //如果是部门
            {
                string year           = DateTime.Now.Year.ToString();
                var    xmOtherInclude = base.XMIncludeFieldsService.GetXMIncludeFieldsListByDepartmentID(this.DepartmentId);
                if (xmOtherInclude != null && !string.IsNullOrEmpty(xmOtherInclude.Fields))
                {
                    //拆分字段
                    foreach (string id in xmOtherInclude.Fields.Split(','))
                    {
                        HozestERP.BusinessLogic.ManageBusiness.XMOtherCostDetail cost = base.XMOtherCostDetailService.GetXMOtherCostDataByParm(int.Parse(id), DepartmentId, int.Parse(year));
                        if (cost != null && cost.IsAudit != null)
                        {
                            isAudit = cost.IsAudit.Value;
                        }
                    }
                }
            }

            return(isAudit);
        }
Exemple #6
0
        private bool getIsAuditByProjectID()
        {
            bool   isAudit       = false;
            string year          = ddlYear.SelectedValue;
            var    xmNickInclude = base.XMIncludeFieldsService.GetXMIncludeFieldsListByProjectID(ProjectId);

            if (xmNickInclude != null && !string.IsNullOrEmpty(xmNickInclude.Fields))
            {
                foreach (string id in xmNickInclude.Fields.Split(','))
                {
                    HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail cost = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(id), ProjectId, int.Parse(year));
                    if (cost != null && cost.IsAudit != null)
                    {
                        isAudit = cost.IsAudit.Value;
                    }
                }
            }
            return(isAudit);
        }
Exemple #7
0
        /// <summary>
        /// 求和(12个月数据累加)
        /// </summary>
        /// <param name="detail"></param>
        /// <returns></returns>
        private decimal getSumAllCost(string id)
        {
            decimal sum = 0;

            HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail detail = new HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail();
            var field = base.XMFinancialFieldService.GetXMFinancialFieldById(int.Parse(id));

            if (field != null)
            {
                detail = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(id), this.ProjectId, int.Parse(ddlYear.SelectedValue));
                if (detail != null)
                {
                    sum = detail.OneMonthCost.Value + detail.TwoMonthCost.Value + detail.ThreeMonthCost.Value + detail.FourMonthCost.Value + detail.FiveMonthCost.Value + detail.SixMonthCost.Value + detail.SevenMonthCost.Value + detail.EightMonthCost.Value + detail.NineMonthCost.Value + detail.TenMonthCost.Value + detail.ElevenMonthCost.Value + detail.TwelMonthCost.Value;
                }
            }
            if (field != null && field.FieldName.Contains("营业收入"))
            {
                if (detail != null)
                {
                    YYYJCost = detail.OneMonthCost.Value + detail.TwoMonthCost.Value + detail.ThreeMonthCost.Value + detail.FourMonthCost.Value + detail.FiveMonthCost.Value + detail.SixMonthCost.Value + detail.SevenMonthCost.Value + detail.EightMonthCost.Value + detail.NineMonthCost.Value + detail.TenMonthCost.Value + detail.ElevenMonthCost.Value + detail.TwelMonthCost.Value;
                }
            }
            return(sum);
        }
Exemple #8
0
        /// <summary>
        /// 更新数据
        /// </summary>
        private void UpdateData()
        {
            XMIncludeFields xmNickInclude = null;

            if (ProjectId != 0)
            {
                xmNickInclude = base.XMIncludeFieldsService.GetXMIncludeFieldsListByProjectID(ProjectId);
                if (xmNickInclude == null)
                {
                    base.ShowMessage("请先设置预算字段!");
                    return;
                }
            }

            if (NickID != 0)
            {
                xmNickInclude = base.XMIncludeFieldsService.GetXMIncludeFieldsListByNickID(NickID);
                if (xmNickInclude == null)
                {
                    base.ShowMessage("请先设置预算字段!");
                    return;
                }
            }

            //更新数据
            if (xmNickInclude != null && !string.IsNullOrEmpty(xmNickInclude.Fields))
            {
                string[] parm = xmNickInclude.Fields.Split(',');
                string   pID  = "";           //父节点ID
                string   cID  = "";           //子节点ID
                if (parm != null && parm.Count() > 0)
                {
                    foreach (string id in parm)
                    {
                        var f = base.XMFinancialFieldService.GetXMFinancialFieldById(int.Parse(id));
                        if (f != null)
                        {
                            if (f.ParentID == 0)
                            {
                                pID += f.Id + ",";
                            }
                            else
                            {
                                cID += f.Id + ",";
                            }
                        }
                    }
                }

                if (pID != "" && pID.Length > 0)
                {
                    pID = pID.Substring(0, pID.Length - 1);
                }
                if (cID != "" && cID.Length > 0)
                {
                    cID = cID.Substring(0, cID.Length - 1);
                }
                string[] p = pID.Split(',');
                string[] c = cID.Split(',');
                foreach (string str in p)
                {
                    bool isexsitChild = false;          //是否存在子节点
                    //循环更新12个月
                    for (int i = 1; i <= 12; i++)
                    {
                        decimal total = 0;
                        HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail cost = null;
                        if (ProjectId != 0)
                        {
                            cost = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(str), ProjectId, DateTime.Now.Year);
                        }
                        if (NickID != 0)
                        {
                            cost = XMProjectCostDetailService.GetXMProjectCostDataByNick(int.Parse(str), NickID, DateTime.Now.Year);
                        }
                        //var cost = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(str), ProjectId, DateTime.Now.Year);
                        if (cost != null)
                        {
                            var f = base.XMFinancialFieldService.GetXMFinancialFieldByParentID(int.Parse(str));
                            if (f != null && f.Count() > 0)
                            {
                                foreach (string str1 in c)
                                {
                                    foreach (XMFinancialField field in f)
                                    {
                                        if (str1 == field.Id.ToString())
                                        {
                                            isexsitChild = true;
                                            HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail d = null;
                                            if (ProjectId != 0)
                                            {
                                                d = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(str), ProjectId, DateTime.Now.Year);
                                            }
                                            if (NickID != 0)
                                            {
                                                d = XMProjectCostDetailService.GetXMProjectCostDataByNick(int.Parse(str), NickID, DateTime.Now.Year);
                                            }
                                            //var d = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(str1), ProjectId, DateTime.Now.Year);
                                            if (d != null)
                                            {
                                                switch (i)
                                                {
                                                case 1:
                                                    total += d.OneMonthCost.Value;
                                                    break;

                                                case 2:
                                                    total += d.TwoMonthCost.Value;
                                                    break;

                                                case 3:
                                                    total += d.ThreeMonthCost.Value;
                                                    break;

                                                case 4:
                                                    total += d.FourMonthCost.Value;
                                                    break;

                                                case 5:
                                                    total += d.FiveMonthCost.Value;
                                                    break;

                                                case 6:
                                                    total += d.SixMonthCost.Value;
                                                    break;

                                                case 7:
                                                    total += d.SevenMonthCost.Value;
                                                    break;

                                                case 8:
                                                    total += d.EightMonthCost.Value;
                                                    break;

                                                case 9:
                                                    total += d.NineMonthCost.Value;
                                                    break;

                                                case 10:
                                                    total += d.TenMonthCost.Value;
                                                    break;

                                                case 11:
                                                    total += d.ElevenMonthCost.Value;
                                                    break;

                                                case 12:
                                                    total += d.TwelMonthCost.Value;
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                if (isexsitChild)
                                {
                                    switch (i)
                                    {
                                    case 1:
                                        cost.OneMonthCost = total;
                                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(cost);
                                        break;

                                    case 2:
                                        cost.TwoMonthCost = total;
                                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(cost);
                                        break;

                                    case 3:
                                        cost.ThreeMonthCost = total;
                                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(cost);
                                        break;

                                    case 4:
                                        cost.FourMonthCost = total;
                                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(cost);
                                        break;

                                    case 5:
                                        cost.FiveMonthCost = total;
                                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(cost);
                                        break;

                                    case 6:
                                        cost.SixMonthCost = total;
                                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(cost);
                                        break;

                                    case 7:
                                        cost.SevenMonthCost = total;
                                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(cost);
                                        break;

                                    case 8:
                                        cost.EightMonthCost = total;
                                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(cost);
                                        break;

                                    case 9:
                                        cost.NineMonthCost = total;
                                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(cost);
                                        break;

                                    case 10:
                                        cost.TenMonthCost = total;
                                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(cost);
                                        break;

                                    case 11:
                                        cost.ElevenMonthCost = total;
                                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(cost);
                                        break;

                                    case 12:
                                        cost.TwelMonthCost = total;
                                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(cost);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #9
0
        //绑定gridview 控件
        private void BindGrid()
        {
            int           no     = 1;
            int           change = 0;
            StringBuilder str    = new StringBuilder();
            string        year   = ddlYear.SelectedValue;

            if (string.IsNullOrEmpty(this.ProjectId.ToString()))
            {
                base.ShowMessage("项目ID不能为空!");
                return;
            }
            string          includefields = "";
            XMIncludeFields xmNickInclude = null;

            if (this.ProjectId != 0)
            {
                xmNickInclude = base.XMIncludeFieldsService.GetXMIncludeFieldsListByProjectID(this.ProjectId);
            }
            if (this.NickID != 0)
            {
                xmNickInclude = XMIncludeFieldsService.GetXMIncludeFieldsListByNickID(this.NickID);
            }
            //var xmNickInclude = base.XMIncludeFieldsService.GetXMIncludeFieldsListByProjectID(this.ProjectId);
            if (xmNickInclude != null && !string.IsNullOrEmpty(xmNickInclude.Fields))
            {
                includefields = xmNickInclude.Fields;
            }
            else
            {
                change = 0;
                ScriptManager.RegisterStartupScript(this.grdvClients, this.Page.GetType(), "BindGrid", "ChangeOverflow('" + change + "')", true);//ajax
                grdvClients.DataSource = "";
                grdvClients.DataBind();
                base.ShowMessage("请先设置项目的预算字段!");
                return;
            }
            List <HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail> List = new List <HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail>();

            string[] parm = includefields.Split(',');
            string   pID  = "";           //父节点ID
            string   cID  = "";           //子节点ID

            if (parm != null && parm.Count() > 0)
            {
                foreach (string id in parm)
                {
                    var f = base.XMFinancialFieldService.GetXMFinancialFieldById(int.Parse(id));
                    if (f != null)
                    {
                        if (f.ParentID == 0)
                        {
                            pID += f.Id + ",";
                        }
                        else
                        {
                            cID += f.Id + ",";
                        }
                    }
                }
            }
            if (pID != "" && pID.Length > 0)
            {
                pID = pID.Substring(0, pID.Length - 1);
            }
            if (cID != "" && cID.Length > 0)
            {
                cID = cID.Substring(0, cID.Length - 1);
            }
            string[] p = pID.Split(',');
            string[] c = cID.Split(',');

            if (p != null && p.Length > 0)
            {
                for (int j = 0; j < p.Count(); j++)
                {
                    if (no == 1)
                    {
                        str.Append("<table   style='height: 5px;width:100%;border-style:solid' rules='all'>");
                        str.Append("<tr  style='font-weight:bold;height:30px;background-color:#EEEEEE'>");
                        str.Append("<th  nowrap='noWrap' align='center' style='width:120px;white-space:nowrap;cursor:pointer;' scope='col'>项目</th>");
                        str.Append("<th  nowrap='noWrap' align='center' style='width:60px;white-space:nowrap;cursor:pointer;' scope='col'>1-12月累计</th>");
                        str.Append("<th  nowrap='noWrap' align='center' style='width:70px;white-space:nowrap;cursor:pointer;' scope='col'>占毛利比</th>");

                        str.Append("</tr>");
                    }
                    str.Append("<tr class='GridRow' align='center' style='background-color:#EAEAEA;height:5px;height:5px;' oldcolor=#EAEAEA'>");
                    str.Append("<td style='width:120px;font-size:18px;'>" + getFieldNameByFieldID(p[j]) + "</td>");
                    str.Append("<td style='width:60px;text-align:center'>" + getSumAllCost(p[j]) + "</td>");
                    if (YYYJCost != 0)
                    {
                        str.Append("<td style='width:70px;text-align:center'>" + Math.Round(getSumAllCost(p[j]) / YYYJCost, 2) * 100 + "%" + "</td>");
                    }
                    else
                    {
                        str.Append("<td style='width:70px;text-align:center'>" + 0 + "%" + "</td>");
                    }
                    str.Append("</tr>");
                    HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail pCost = null;
                    if (this.ProjectId != 0)
                    {
                        pCost = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(p[j]), ProjectId, int.Parse(ddlYear.SelectedValue));
                    }
                    if (this.NickID != 0)
                    {
                        pCost = XMProjectCostDetailService.GetXMProjectCostDataByNick(int.Parse(p[j]), NickID, int.Parse(ddlYear.SelectedValue));
                    }
                    //var pCost = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(p[j]), ProjectId, int.Parse(ddlYear.SelectedValue));
                    if (pCost != null && pCost.FieldName != "")
                    {
                        List.Add(pCost);
                    }
                    //字段管理中该字段已经删除,应清理该条数据
                    if (pCost != null && pCost.FieldName == "")
                    {
                        pCost.IsEnable   = true;
                        pCost.UpdateDate = DateTime.Now;
                        pCost.UpdateID   = HozestERPContext.Current.User.CustomerID;
                        base.XMProjectCostDetailService.UpdateXMProjectCostDetail(pCost);
                    }
                    if (HasChild(p[j]))
                    {
                        string newStr = childFieldIDs(p[j]);
                        if (!string.IsNullOrEmpty(newStr))
                        {
                            foreach (string childID in c)
                            {
                                foreach (string str1 in newStr.Split(','))
                                {
                                    if (childID == str1)               //存在该子节点
                                    {
                                        str.Append("<tr class='GridRow' align='center' style='background-color:#FFFFFF;height:5px;height:5px;' oldcolor=#FFFFFF'>");
                                        str.Append("<td style='width:120px;text-align:right'>" + getFieldNameByFieldID(childID) + "</td>");
                                        str.Append("<td style='width:60px;text-align:center'>" + getSumAllCost(childID) + "</td>");
                                        if (YYYJCost != 0)
                                        {
                                            str.Append("<td style='width:70px;text-align:center'>" + Math.Round(getSumAllCost(childID) / YYYJCost, 2) * 100 + "%" + "</td>");
                                        }
                                        else
                                        {
                                            str.Append("<td style='width:70px;text-align:center'>" + 0 + "%" + "</td>");
                                        }
                                        HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail childCost = null;
                                        if (this.ProjectId != 0)
                                        {
                                            childCost = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(p[j]), ProjectId, int.Parse(ddlYear.SelectedValue));
                                        }
                                        if (this.NickID != 0)
                                        {
                                            childCost = XMProjectCostDetailService.GetXMProjectCostDataByNick(int.Parse(p[j]), NickID, int.Parse(ddlYear.SelectedValue));
                                        }
                                        //var childCost = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(childID), ProjectId, int.Parse(ddlYear.SelectedValue));
                                        if (childCost != null && childCost.FieldName != "")
                                        {
                                            List.Add(childCost);
                                        }
                                        if (childCost != null && childCost.FieldName == "")
                                        {
                                            childCost.IsEnable   = true;
                                            childCost.UpdateDate = DateTime.Now;
                                            childCost.UpdateID   = HozestERPContext.Current.User.CustomerID;
                                            base.XMProjectCostDetailService.UpdateXMProjectCostDetail(childCost);
                                        }
                                        //字段管理中该字段已经删除,应该删除该条数据
                                        if (childCost != null && childCost.FieldName == "")
                                        {
                                            childCost.IsEnable   = true;
                                            childCost.UpdateDate = DateTime.Now;
                                            childCost.UpdateID   = HozestERPContext.Current.User.CustomerID;
                                            base.XMProjectCostDetailService.UpdateXMProjectCostDetail(childCost);
                                        }
                                    }
                                }
                            }
                            str.Append("</tr>");
                        }
                    }
                    no++;
                }
                if (List.Count > 0)
                {
                    change = 1;
                    str.Append("<tr class='GridRow' style='background-color:#F7F7F7'><td style='height:10px;' colspan='9'></td></tr></table>");
                    TableStr = str.ToString();
                }
                ScriptManager.RegisterStartupScript(this.grdvClients, this.Page.GetType(), "BindGrid", "ChangeOverflow('" + change + "')", true);//ajax
                grdvClients.DataSource = List;
                grdvClients.DataBind();
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="ID"></param>
        private void autoSaveData(string ids, int projectID, int departmentID, int nickID)
        {
            //插入项目数据
            if (!string.IsNullOrEmpty(ids) && projectID != 0)
            {
                foreach (string id in ids.Split(','))
                {
                    HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail cost = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(id), projectID, DateTime.Now.Year);
                    if (cost == null)
                    {
                        //自动插入想关数据
                        HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail Info = new HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail();
                        Info.ProjectId        = projectID;
                        Info.FinancialFieldID = int.Parse(id);
                        Info.Year             = DateTime.Now.Year;
                        Info.OneMonthCost     = 0;
                        Info.TwoMonthCost     = 0;
                        Info.ThreeMonthCost   = 0;
                        Info.FourMonthCost    = 0;
                        Info.FiveMonthCost    = 0;
                        Info.SixMonthCost     = 0;
                        Info.SevenMonthCost   = 0;
                        Info.EightMonthCost   = 0;
                        Info.NineMonthCost    = 0;
                        Info.TenMonthCost     = 0;
                        Info.ElevenMonthCost  = 0;
                        Info.TwelMonthCost    = 0;
                        Info.IsEnable         = false;
                        Info.IsAudit          = false;
                        Info.CreateDate       = DateTime.Now;
                        Info.CreateID         = HozestERPContext.Current.User.CustomerID;
                        Info.UpdateDate       = DateTime.Now;
                        Info.UpdateID         = HozestERPContext.Current.User.CustomerID;
                        base.XMProjectCostDetailService.InsertXMProjectCostDetail(Info);
                    }
                }
            }

            if (!string.IsNullOrEmpty(ids) && departmentID != 0)
            {
                foreach (string id in ids.Split(','))
                {
                    HozestERP.BusinessLogic.ManageBusiness.XMOtherCostDetail othercost = base.XMOtherCostDetailService.GetXMOtherCostDataByParm(int.Parse(id), departmentID, DateTime.Now.Year);
                    if (othercost == null)
                    {
                        //自动插入相关数据
                        HozestERP.BusinessLogic.ManageBusiness.XMOtherCostDetail Info = new HozestERP.BusinessLogic.ManageBusiness.XMOtherCostDetail();
                        Info.DepartmentID     = departmentID;
                        Info.FinancialFieldID = int.Parse(id);
                        Info.Year             = DateTime.Now.Year;
                        Info.OneMonthCost     = 0;
                        Info.TwoMonthCost     = 0;
                        Info.ThreeMonthCost   = 0;
                        Info.FourMonthCost    = 0;
                        Info.FiveMonthCost    = 0;
                        Info.SixMonthCost     = 0;
                        Info.SevenMonthCost   = 0;
                        Info.EightMonthCost   = 0;
                        Info.NineMonthCost    = 0;
                        Info.TenMonthCost     = 0;
                        Info.ElevenMonthCost  = 0;
                        Info.TwelMonthCost    = 0;
                        Info.IsEnable         = false;
                        Info.IsAudit          = false;
                        Info.CreateDate       = DateTime.Now;
                        Info.CreateID         = HozestERPContext.Current.User.CustomerID;
                        Info.UpdateDate       = DateTime.Now;
                        Info.UpdateID         = HozestERPContext.Current.User.CustomerID;
                        base.XMOtherCostDetailService.InsertXMOtherCostDetail(Info);
                    }
                }
            }

            if (!string.IsNullOrEmpty(ids) && nickID != 0)
            {
                foreach (string id in ids.Split(','))
                {
                    HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail cost = base.XMProjectCostDetailService.GetXMProjectCostDataByNick(int.Parse(id), nickID, DateTime.Now.Year);
                    if (cost == null)
                    {
                        //自动插入想关数据
                        HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail Info = new HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail();
                        Info.NickId           = nickID;
                        Info.FinancialFieldID = int.Parse(id);
                        Info.Year             = DateTime.Now.Year;
                        Info.OneMonthCost     = 0;
                        Info.TwoMonthCost     = 0;
                        Info.ThreeMonthCost   = 0;
                        Info.FourMonthCost    = 0;
                        Info.FiveMonthCost    = 0;
                        Info.SixMonthCost     = 0;
                        Info.SevenMonthCost   = 0;
                        Info.EightMonthCost   = 0;
                        Info.NineMonthCost    = 0;
                        Info.TenMonthCost     = 0;
                        Info.ElevenMonthCost  = 0;
                        Info.TwelMonthCost    = 0;
                        Info.IsEnable         = false;
                        Info.IsAudit          = false;
                        Info.CreateDate       = DateTime.Now;
                        Info.CreateID         = HozestERPContext.Current.User.CustomerID;
                        Info.UpdateDate       = DateTime.Now;
                        Info.UpdateID         = HozestERPContext.Current.User.CustomerID;
                        base.XMProjectCostDetailService.InsertXMProjectCostDetail(Info);
                    }
                }
            }
        }
Exemple #11
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //判断输入框输入值是否合法
            bool isnumber = true;

            string[] ids   = hiddAllID.Value.Substring(0, hiddAllID.Value.Length - 1).Split(',');
            string[] costs = hiddAllCost.Value.Substring(0, hiddAllCost.Value.Length - 1).Split(',');
            if (costs.Count() > 0)
            {
                foreach (string str in costs)
                {
                    if (!IsNumber(str, 11, 2) && decimal.Parse(str) > 0)
                    {
                        isnumber = false;
                    }
                }
            }
            if (!isnumber)
            {
                base.ShowMessage("输入数字格式不正确,请重新输入!");
                GetFieldCostList();
                return;
            }
            //项目添加预算
            if (this.ProjectID != 0 || this.NickID != 0)
            {
                if (ids.Count() > 0 && costs.Count() > 0)
                {
                    for (int i = 0; i < ids.Length; i++)
                    {
                        HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail info = null;
                        if (this.ProjectID != 0)
                        {
                            info = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(ids[i]), this.ProjectID, this.Year);
                        }
                        if (this.NickID != 0)
                        {
                            info = base.XMProjectCostDetailService.GetXMProjectCostDataByNick(int.Parse(ids[i]), this.NickID, this.Year);
                        }
                        //var info = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(ids[i]), this.ProjectID, this.Year);
                        if (info != null)
                        {
                            switch (this.Month)
                            {
                            case 1:
                                info.OneMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 2:
                                info.TwoMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 3:
                                info.ThreeMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 4:
                                info.FourMonthCost = decimal.Parse(costs[i]);;
                                break;

                            case 5:
                                info.FiveMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 6:
                                info.SixMonthCost = decimal.Parse(costs[i]);;
                                break;

                            case 7:
                                info.SevenMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 8:
                                info.EightMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 9:
                                info.NineMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 10:
                                info.TenMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 11:
                                info.ElevenMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 12:
                                info.TwelMonthCost = decimal.Parse(costs[i]);
                                break;
                            }
                            info.UpdateID   = HozestERPContext.Current.User.CustomerID;
                            info.UpdateDate = DateTime.Now;
                            base.XMProjectCostDetailService.UpdateXMProjectCostDetail(info);
                        }
                    }
                    base.ShowMessage("操作成功!");
                }
            }

            if (this.DepartmentID != 0)
            {
                if (ids.Count() > 0 && costs.Count() > 0)
                {
                    for (int i = 0; i < ids.Length; i++)
                    {
                        var info = base.XMOtherCostDetailService.GetXMOtherCostDataByParm(int.Parse(ids[i]), this.DepartmentID, this.Year);
                        if (info != null)
                        {
                            switch (this.Month)
                            {
                            case 1:
                                info.OneMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 2:
                                info.TwoMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 3:
                                info.ThreeMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 4:
                                info.FourMonthCost = decimal.Parse(costs[i]);;
                                break;

                            case 5:
                                info.FiveMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 6:
                                info.SixMonthCost = decimal.Parse(costs[i]);;
                                break;

                            case 7:
                                info.SevenMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 8:
                                info.EightMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 9:
                                info.NineMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 10:
                                info.TenMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 11:
                                info.ElevenMonthCost = decimal.Parse(costs[i]);
                                break;

                            case 12:
                                info.TwelMonthCost = decimal.Parse(costs[i]);
                                break;
                            }
                            info.UpdateID   = HozestERPContext.Current.User.CustomerID;
                            info.UpdateDate = DateTime.Now;
                            base.XMOtherCostDetailService.UpdateXMOtherCostDetail(info);
                        }
                    }
                    base.ShowMessage("操作成功!");
                }
            }
            GetFieldCostList();
        }
Exemple #12
0
        private void GetFieldCostList()
        {
            StringBuilder str = new StringBuilder();

            if (this.ProjectID != 0 || this.NickID != 0)                       //如果是项目
            {
                string includefields = "";
                //获取项目所属字段集合字符串
                XMIncludeFields xmNickInclude = null;
                if (this.ProjectID != 0)
                {
                    xmNickInclude = base.XMIncludeFieldsService.GetXMIncludeFieldsListByProjectID(this.ProjectID);
                }
                if (this.NickID != 0)
                {
                    xmNickInclude = base.XMIncludeFieldsService.GetXMIncludeFieldsListByNickID(this.NickID);
                }
                //var xmNickInclude = base.XMIncludeFieldsService.GetXMIncludeFieldsListByProjectID(this.ProjectID);
                if (xmNickInclude != null && !string.IsNullOrEmpty(xmNickInclude.Fields))
                {
                    includefields = xmNickInclude.Fields;
                }

                string[] parm = includefields.Split(',');
                string   pID  = "";           //父节点ID
                string   cID  = "";           //子节点ID
                if (parm != null && parm.Count() > 0)
                {
                    foreach (string id in parm)
                    {
                        var f = base.XMFinancialFieldService.GetXMFinancialFieldById(int.Parse(id));
                        if (f != null)
                        {
                            if (f.ParentID == 0)
                            {
                                pID += f.Id + ",";
                            }
                            else
                            {
                                cID += f.Id + ",";
                            }
                        }
                    }
                }

                if (pID != "" && pID.Length > 0)
                {
                    pID = pID.Substring(0, pID.Length - 1);
                }
                if (cID != "" && cID.Length > 0)
                {
                    cID = cID.Substring(0, cID.Length - 1);
                }
                string[] p = pID.Split(',');
                string[] c = cID.Split(',');
                str.Append("<table  border='1'  rules='all' width='480px'  id='tb1'>");
                str.Append("<tr  align='center' style='height:5px;height:5px;'>");

                if (p != null && p.Length > 0)
                {
                    for (int j = 0; j < p.Count(); j++)
                    {
                        decimal cost = 0;               //字段数值
                        HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail field = null;
                        if (this.ProjectID != 0)
                        {
                            field = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(p[j]), this.ProjectID, Year);
                        }
                        if (this.NickID != 0)
                        {
                            field = base.XMProjectCostDetailService.GetXMProjectCostDataByNick(int.Parse(p[j]), this.NickID, Year);
                        }
                        //HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail field = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(p[j]), this.ProjectID, Year);
                        //添加父节点
                        str.Append("<td style='width:40%;font-size:18px;text-align:left;'>" + field.FieldName + "</td>");
                        //遍历所有月份获取相应月份的数值
                        switch (Month)
                        {
                        case 1:
                            cost = field.OneMonthCost.Value;
                            break;

                        case 2:
                            cost = field.TwoMonthCost.Value;
                            break;

                        case 3:
                            cost = field.ThreeMonthCost.Value;
                            break;

                        case 4:
                            cost = field.FourMonthCost.Value;
                            break;

                        case 5:
                            cost = field.FiveMonthCost.Value;
                            break;

                        case 6:
                            cost = field.SixMonthCost.Value;
                            break;

                        case 7:
                            cost = field.SevenMonthCost.Value;
                            break;

                        case 8:
                            cost = field.EightMonthCost.Value;
                            break;

                        case 9:
                            cost = field.NineMonthCost.Value;
                            break;

                        case 10:
                            cost = field.TenMonthCost.Value;
                            break;

                        case 11:
                            cost = field.ElevenMonthCost.Value;
                            break;

                        case 12:
                            cost = field.TwelMonthCost.Value;
                            break;
                        }
                        bool isexsit = false;
                        if (this.ProjectID != 0)
                        {
                            isexsit = ishaveChildField(field.FinancialFieldID.ToString(), ProjectID, 0, 0);
                        }
                        if (this.NickID != 0)
                        {
                            isexsit = ishaveChildField(field.FinancialFieldID.ToString(), 0, 0, this.NickID);
                        }
                        //bool isexsit = ishaveChildField(field.FinancialFieldID.ToString(), ProjectID, 0,0);
                        bool isAuto = isAutoCalCulateField(field.FinancialFieldID.ToString());
                        if (isexsit || isAuto)
                        {
                            str.Append("<td style='width:50%;text-align:right'> <input type=\"hidden\" id=\"hiddID\" runat=\"server\"  value=' " + field.FinancialFieldID + "'/><input type=\"text\"  runat=\"server\" disabled=\"disabled\" name=\"dd\" id='txtCost_" + field.FinancialFieldID + "'  value='" + cost + "'/><input type=\"hidden\" id=\"hiddID\" runat=\"server\"  value=' " + field.FieldName + "'/></td></tr>");
                        }
                        else
                        {
                            str.Append("<td style='width:50%;text-align:right'> <input type=\"hidden\" id=\"hiddID\" runat=\"server\"  value=' " + field.FinancialFieldID + "'/><input type=\"text\"  runat=\"server\" name=\"dd\" id='txtCost_" + field.FinancialFieldID + "'  value='" + cost + "'/><input type=\"hidden\" id=\"hiddID\" runat=\"server\"  value=' " + field.FieldName + "'/></td></tr>");
                        }
                        if (HasChild(p[j]))
                        {
                            string newStr = childFieldIDs(p[j]);
                            foreach (string childID in c)
                            {
                                foreach (string str1 in newStr.Split(','))
                                {
                                    if (childID == str1)               //存在该子节点
                                    {
                                        HozestERP.BusinessLogic.ManageBusiness.XMProjectCostDetail f = null;
                                        if (this.ProjectID != 0)
                                        {
                                            f = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(childID), this.ProjectID, Year);
                                        }
                                        if (this.NickID != 0)
                                        {
                                            f = base.XMProjectCostDetailService.GetXMProjectCostDataByNick(int.Parse(childID), this.NickID, Year);
                                        }
                                        //var f = base.XMProjectCostDetailService.GetXMProjectCostDataByParm(int.Parse(childID), this.ProjectID, Year);
                                        switch (Month)
                                        {
                                        case 1:
                                            cost = f.OneMonthCost.Value;
                                            break;

                                        case 2:
                                            cost = f.TwoMonthCost.Value;
                                            break;

                                        case 3:
                                            cost = f.ThreeMonthCost.Value;
                                            break;

                                        case 4:
                                            cost = f.FourMonthCost.Value;
                                            break;

                                        case 5:
                                            cost = f.FiveMonthCost.Value;
                                            break;

                                        case 6:
                                            cost = f.SixMonthCost.Value;
                                            break;

                                        case 7:
                                            cost = f.SevenMonthCost.Value;
                                            break;

                                        case 8:
                                            cost = f.EightMonthCost.Value;
                                            break;

                                        case 9:
                                            cost = f.NineMonthCost.Value;
                                            break;

                                        case 10:
                                            cost = f.TenMonthCost.Value;
                                            break;

                                        case 11:
                                            cost = f.ElevenMonthCost.Value;
                                            break;

                                        case 12:
                                            cost = f.TwelMonthCost.Value;
                                            break;
                                        }
                                        str.Append("<tr align='center' style='height:5px;height:5px;'>");
                                        str.Append("<td style='width:40%;font-size:18px;text-align:right;font-size:13px;'>" + f.FieldName + "</td>");
                                        str.Append("<td style='width:50%;text-align:right'> <input type=\"hidden\" id=\"hiddID\" runat=\"server\"  value=' " + f.FinancialFieldID + "'/><input type=\"text\"  runat=\"server\" name=\"dd\" id='txtCost_" + f.FinancialFieldID + "'  value='" + cost + "'/><input type=\"hidden\" id=\"hiddID\" runat=\"server\"  value=' " + f.FieldName + "'/></td>");
                                        str.Append("</tr>");
                                    }
                                }
                            }
                        }
                    }
                    str.Append("</table>");
                    TableStr = str.ToString();
                }
            }
            else if (this.DepartmentID != 0)
            {
                string includefields = "";
                //获取项目所属字段集合字符串
                var xmOtherInclude = base.XMIncludeFieldsService.GetXMIncludeFieldsListByDepartmentID(this.DepartmentID);
                if (xmOtherInclude != null && !string.IsNullOrEmpty(xmOtherInclude.Fields))
                {
                    includefields = xmOtherInclude.Fields;
                }

                string[] parm = includefields.Split(',');
                string   pID  = "";           //父节点ID
                string   cID  = "";           //子节点ID
                if (parm != null && parm.Count() > 0)
                {
                    foreach (string id in parm)
                    {
                        var f = base.XMFinancialFieldService.GetXMFinancialFieldById(int.Parse(id));
                        if (f != null)
                        {
                            if (f.ParentID == 0)
                            {
                                pID += f.Id + ",";
                            }
                            else
                            {
                                cID += f.Id + ",";
                            }
                        }
                    }
                }

                if (pID != "" && pID.Length > 0)
                {
                    pID = pID.Substring(0, pID.Length - 1);
                }
                if (cID != "" && cID.Length > 0)
                {
                    cID = cID.Substring(0, cID.Length - 1);
                }
                string[] p = pID.Split(',');
                string[] c = cID.Split(',');
                str.Append("<table  border='1'  rules='all' width='480px'  id='tb1'>");
                str.Append("<tr  align='center' style='background-color:" + "" + ";height:5px;height:5px;' oldcolor='" + "" + "'>");

                if (p != null && p.Length > 0)
                {
                    for (int j = 0; j < p.Count(); j++)
                    {
                        decimal cost = 0;               //字段数值
                        HozestERP.BusinessLogic.ManageBusiness.XMOtherCostDetail otherField = base.XMOtherCostDetailService.GetXMOtherCostDataByParm(int.Parse(p[j]), this.DepartmentID, Year);
                        //添加父节点
                        str.Append("<td style='width:40%;font-size:18px;text-align:left;background-color:EAEAEA'>" + otherField.FieldName + "</td>");
                        //遍历所有月份获取相应月份的数值
                        switch (Month)
                        {
                        case 1:
                            cost = otherField.OneMonthCost.Value;
                            break;

                        case 2:
                            cost = otherField.TwoMonthCost.Value;
                            break;

                        case 3:
                            cost = otherField.ThreeMonthCost.Value;
                            break;

                        case 4:
                            cost = otherField.FourMonthCost.Value;
                            break;

                        case 5:
                            cost = otherField.FiveMonthCost.Value;
                            break;

                        case 6:
                            cost = otherField.SixMonthCost.Value;
                            break;

                        case 7:
                            cost = otherField.SevenMonthCost.Value;
                            break;

                        case 8:
                            cost = otherField.EightMonthCost.Value;
                            break;

                        case 9:
                            cost = otherField.NineMonthCost.Value;
                            break;

                        case 10:
                            cost = otherField.TenMonthCost.Value;
                            break;

                        case 11:
                            cost = otherField.ElevenMonthCost.Value;
                            break;

                        case 12:
                            cost = otherField.TwelMonthCost.Value;
                            break;
                        }
                        // 有子节点的不能编辑 和 (毛利,增值税,营业税附加,税前利润,所得税,直接净利润 字段无法输入,进行自动计算)
                        bool isexsit = ishaveChildField(otherField.FinancialFieldID.ToString(), 0, DepartmentID, 0);
                        bool isAuto  = isAutoCalCulateField(otherField.FinancialFieldID.ToString());
                        if (isexsit || isAuto)
                        {
                            str.Append("<td style='width:50%;text-align:right'> <input type=\"hidden\" id=\"hiddID\" runat=\"server\"  value=' " + otherField.FinancialFieldID + "'/><input type=\"text\"  runat=\"server\" disabled=\"disabled\" name=\"dd\" id='txtCost_" + otherField.FinancialFieldID + "'  value='" + cost + "'/><input type=\"hidden\" id=\"hiddID\" runat=\"server\"  value=' " + otherField.FieldName + "'/></td></tr>");
                        }
                        else
                        {
                            str.Append("<td style='width:50%;text-align:right'> <input type=\"hidden\" id=\"hiddID\" runat=\"server\"  value=' " + otherField.FinancialFieldID + "'/><input type=\"text\"  runat=\"server\" name=\"dd\" id='txtCost_" + otherField.FinancialFieldID + "'  value='" + cost + "'/><input type=\"hidden\" id=\"hiddID\" runat=\"server\"  value=' " + otherField.FieldName + "'/></td></tr>");
                        }
                        if (HasChild(p[j]))
                        {
                            string newStr = childFieldIDs(p[j]);
                            foreach (string childID in c)
                            {
                                foreach (string str1 in newStr.Split(','))
                                {
                                    if (childID == str1)               //存在该子节点
                                    {
                                        var f = base.XMOtherCostDetailService.GetXMOtherCostDataByParm(int.Parse(childID), this.DepartmentID, Year);
                                        switch (Month)
                                        {
                                        case 1:
                                            cost = f.OneMonthCost.Value;
                                            break;

                                        case 2:
                                            cost = f.TwoMonthCost.Value;
                                            break;

                                        case 3:
                                            cost = f.ThreeMonthCost.Value;
                                            break;

                                        case 4:
                                            cost = f.FourMonthCost.Value;
                                            break;

                                        case 5:
                                            cost = f.FiveMonthCost.Value;
                                            break;

                                        case 6:
                                            cost = f.SixMonthCost.Value;
                                            break;

                                        case 7:
                                            cost = f.SevenMonthCost.Value;
                                            break;

                                        case 8:
                                            cost = f.EightMonthCost.Value;
                                            break;

                                        case 9:
                                            cost = f.NineMonthCost.Value;
                                            break;

                                        case 10:
                                            cost = f.TenMonthCost.Value;
                                            break;

                                        case 11:
                                            cost = f.ElevenMonthCost.Value;
                                            break;

                                        case 12:
                                            cost = f.TwelMonthCost.Value;
                                            break;
                                        }
                                        str.Append("<tr  align='center' style='background-color:" + "" + ";height:5px;height:5px;' oldcolor='" + "" + "'>");
                                        str.Append("<td style='width:40%;font-size:18px;text-align:right;font-size:13px;background-color:#FFFFFF'>" + f.FieldName + "</td>");
                                        str.Append("<td style='width:50%;text-align:right'> <input type=\"hidden\" id=\"hiddID\" runat=\"server\"  value=' " + f.FinancialFieldID + "'/><input type=\"text\"  runat=\"server\" name=\"dd\" id='txtCost_" + f.FinancialFieldID + "'  value='" + cost + "'/><input type=\"hidden\" id=\"hiddID\" runat=\"server\"  value=' " + f.FieldName + "'/></td>");
                                        str.Append("</tr>");
                                    }
                                }
                            }
                            str.Append("</tr>");
                        }
                    }
                    str.Append("</table>");
                    TableStr = str.ToString();
                }
            }
        }