using BLL; using Model; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web.UI.WebControls; namespace FineUIPro.Web.ZHGL.Environmental { public partial class ProjectChemicalReportSave : PageBase { #region 定义变量 /// /// 报表主键Id /// public string ChemicalReportId { get { return (string)ViewState["ChemicalReportId"]; } set { ViewState["ChemicalReportId"] = value; } } /// /// 定义集合 /// private static List items = new List(); #endregion #region 加载页面 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.GetButtonPower(); items.Clear(); BLL.ConstValue.InitConstValueDropDownList(this.drpMonth, ConstValue.Group_0009, false); BLL.ConstValue.InitConstValueDropDownList(this.drpYear, ConstValue.Group_0008, false); this.drpUnit.DataTextField = "UnitName"; drpUnit.DataValueField = "UnitId"; drpUnit.DataSource = BLL.UnitService.GetThisUnitDropDownList(); drpUnit.DataBind(); this.drpUnit.Readonly = true; string unitId = Request.QueryString["UnitId"]; string year = Request.QueryString["Year"]; string months = Request.QueryString["Months"]; ChemicalReportId = Request.QueryString["ChemicalReportId"]; if (!string.IsNullOrEmpty(Request.QueryString["type"])) { this.btnSave.Hidden = true; this.btnUpdata.Hidden = false; } else { this.btnSave.Hidden = false; this.btnUpdata.Hidden = true; } if (!String.IsNullOrEmpty(ChemicalReportId)) { items = BLL.ProjectChemicalReportItemService.GetShowItems(ChemicalReportId); this.Grid1.DataSource = items; this.Grid1.DataBind(); var report = BLL.ProjectChemicalReportService.GetChemicalReportByChemicalReportId(ChemicalReportId); if (report != null) { //this.btnCopy.Hidden = true; //if (this.CurrUser.UserId == BLL.Const.sysglyId || this.CurrUser.UserId == BLL.Const.hfnbdId) //{ // this.btnSave.Hidden = false; //} if (report.UpState == BLL.Const.UpState_3) { this.btnSave.Hidden = true; this.btnUpdata.Hidden = true; } drpMonth.SelectedValue = report.Month.ToString(); drpYear.SelectedValue = report.Year.ToString(); this.CurrUser.LoginProjectId = report.ProjectId; if (report.FillingDate != null) { txtFillingDate.Text = string.Format("{0:yyyy-MM-dd}", report.FillingDate); } txtDutyPerson.Text = report.DutyPerson; } } else { //this.btnCopy.Hidden = false; drpMonth.SelectedValue = months; drpYear.SelectedValue = year; txtFillingDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); txtDutyPerson.Text = this.CurrUser.UserName; //增加明细集合 GetNewItems(year, months); this.Grid1.DataSource = items; this.Grid1.DataBind(); } SetUnEditableRow(); GetData(); } else { if (GetRequestEventArgument() == "UPDATE_SUMMARY") { GetData(); } } } #endregion #region 设置不可编辑行 private void SetUnEditableRow() { if (Grid1.Rows.Count == 99) { Grid1.Rows[0].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[0].CellCssClasses[5] = "f-grid-cell-uneditable"; Grid1.Rows[15].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[15].CellCssClasses[5] = "f-grid-cell-uneditable"; //Grid1.Rows[17].CellCssClasses[4] = "f-grid-cell-uneditable"; //Grid1.Rows[17].CellCssClasses[5] = "f-grid-cell-uneditable"; //Grid1.Rows[18].CellCssClasses[4] = "f-grid-cell-uneditable"; //Grid1.Rows[18].CellCssClasses[5] = "f-grid-cell-uneditable"; Grid1.Rows[19].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[19].CellCssClasses[5] = "f-grid-cell-uneditable"; //Grid1.Rows[21].CellCssClasses[4] = "f-grid-cell-uneditable"; //Grid1.Rows[21].CellCssClasses[5] = "f-grid-cell-uneditable"; //Grid1.Rows[22].CellCssClasses[4] = "f-grid-cell-uneditable"; //Grid1.Rows[22].CellCssClasses[5] = "f-grid-cell-uneditable"; //Grid1.Rows[23].CellCssClasses[4] = "f-grid-cell-uneditable"; //Grid1.Rows[23].CellCssClasses[5] = "f-grid-cell-uneditable"; //Grid1.Rows[33].CellCssClasses[4] = "f-grid-cell-uneditable"; //Grid1.Rows[33].CellCssClasses[5] = "f-grid-cell-uneditable"; Grid1.Rows[96].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[96].CellCssClasses[5] = "f-grid-cell-uneditable"; } var lastYearReport = ProjectChemicalReportService.GetChemicalReportByProjectIdYear(this.CurrUser.LoginProjectId, Funs.GetNewIntOrZero(drpYear.SelectedValue) - 1); if (lastYearReport.Count > 0) { var lastYearReportItems = ProjectChemicalReportItemService.GetLastYearItems(Funs.GetNewIntOrZero(drpYear.SelectedValue) - 1); Grid1.Rows[1].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "02").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[2].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "03").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[3].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "04").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[4].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "05").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[5].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "06").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[6].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "07").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[7].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "08").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[8].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "09").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[9].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "10").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[10].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "11").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[11].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "12").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[12].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "13").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[13].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "14").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[14].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "15").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[15].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "16").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[16].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "17").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[17].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "18").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[18].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "19").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[19].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "20").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[20].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "21").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[21].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "22").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[22].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "23").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[23].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "24").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[24].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "25").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[25].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "26").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[26].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "27").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[27].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "28").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[28].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "29").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[29].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "30").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[30].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "31").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[31].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "32").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[32].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "33").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[33].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "34").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[34].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "35").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[35].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "36").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[36].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "37").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[37].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "38").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[38].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "39").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[39].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "40").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[40].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "41").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[41].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "42").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[42].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "43").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[43].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "44").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[44].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "45").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[45].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "46").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[46].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "47").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[47].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "48").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[48].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "49").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[49].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "50").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[50].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "51").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[51].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "52").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[52].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "53").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[53].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "54").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[54].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "55").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[55].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "56").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[56].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "57").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[57].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "58").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[58].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "59").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[59].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "60").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[60].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "61").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[61].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "62").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[62].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "63").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[63].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "64").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[64].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "65").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[65].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "66").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[66].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "67").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[67].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "68").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[68].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "69").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[69].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "70").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[70].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "71").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[71].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "72").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[72].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "73").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[73].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "74").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[74].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "75").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[75].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "76").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[76].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "77").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[77].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "78").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[78].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "79").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[79].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "80").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[80].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "81").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[81].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "82").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[82].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "83").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[83].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "84").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[84].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "85").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[85].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "86").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[86].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "87").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[87].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "88").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[88].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "89").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[89].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "90").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[90].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "91").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[91].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "92").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[92].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "93").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[93].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "94").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[94].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "95").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[95].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "96").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[96].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "97").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[97].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "98").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); Grid1.Rows[98].Values[4] = lastYearReportItems.Where(x => x.SortIndex == "99").Sum(x => Funs.GetNewDecimalOrZero(x.ThisYearValue)); SetLastYearUnEditableRow(); } else { DateTime lastMonth = Convert.ToDateTime(drpYear.SelectedValue + "-" + drpMonth.SelectedValue + "-01").AddMonths(-1); Environmental_ProjectChemicalReport lastMonthReport = ProjectChemicalReportService.GetChemicalReportByProjectIdDate(this.CurrUser.LoginProjectId, lastMonth.Year, lastMonth.Month); if (lastMonthReport != null) { var lastMonthReportItems = BLL.ProjectChemicalReportItemService.GetItems(lastMonthReport.ChemicalReportId); Grid1.Rows[1].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "02").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[2].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "03").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[3].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "04").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[4].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "05").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[5].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "06").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[6].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "07").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[7].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "08").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[8].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "09").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[9].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "10").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[10].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "11").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[11].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "12").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[12].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "13").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[13].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "14").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[14].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "15").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[15].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "16").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[16].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "17").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[17].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "18").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[18].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "19").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[19].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "20").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[20].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "21").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[21].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "22").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[22].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "23").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[23].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "24").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[24].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "25").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[25].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "26").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[26].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "27").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[27].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "28").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[28].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "29").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[29].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "30").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[30].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "31").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[31].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "32").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[32].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "33").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[33].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "34").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[34].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "35").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[35].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "36").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[36].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "37").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[37].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "38").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[38].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "39").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[39].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "40").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[40].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "41").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[41].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "42").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[42].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "43").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[43].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "44").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[44].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "45").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[45].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "46").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[46].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "47").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[47].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "48").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[48].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "49").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[49].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "50").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[50].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "51").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[51].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "52").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[52].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "53").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[53].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "54").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[54].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "55").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[55].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "56").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[56].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "57").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[57].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "58").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[58].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "59").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[59].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "60").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[60].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "61").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[61].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "62").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[62].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "63").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[63].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "64").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[64].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "65").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[65].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "66").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[66].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "67").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[67].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "68").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[68].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "69").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[69].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "70").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[70].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "71").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[71].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "72").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[72].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "73").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[73].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "74").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[74].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "75").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[75].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "76").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[76].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "77").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[77].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "78").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[78].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "79").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[79].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "80").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[80].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "81").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[81].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "82").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[82].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "83").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[83].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "84").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[84].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "85").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[85].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "86").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[86].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "87").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[87].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "88").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[88].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "89").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[89].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "90").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[90].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "91").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[91].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "92").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[92].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "93").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[93].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "94").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[94].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "95").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[95].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "96").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[96].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "97").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[97].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "98").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); Grid1.Rows[98].Values[4] = lastMonthReportItems.Where(x => x.SortIndex == "99").Sum(x => Funs.GetNewDecimalOrZero(x.LastYearValue)); SetLastYearUnEditableRow(); } } } private void SetLastYearUnEditableRow() { Grid1.Rows[1].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[2].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[3].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[4].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[5].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[6].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[7].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[8].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[9].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[10].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[11].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[12].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[13].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[14].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[15].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[16].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[17].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[18].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[19].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[20].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[21].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[22].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[23].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[24].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[25].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[26].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[27].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[28].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[29].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[30].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[31].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[32].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[33].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[34].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[35].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[36].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[37].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[38].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[39].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[40].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[41].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[42].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[43].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[44].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[45].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[46].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[47].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[48].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[49].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[50].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[51].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[52].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[53].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[54].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[55].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[56].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[57].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[58].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[59].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[60].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[61].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[62].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[63].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[64].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[65].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[66].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[67].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[68].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[69].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[70].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[71].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[72].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[73].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[74].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[75].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[76].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[77].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[78].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[79].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[80].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[81].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[82].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[83].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[84].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[85].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[86].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[87].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[88].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[89].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[90].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[91].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[92].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[93].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[94].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[95].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[96].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[97].CellCssClasses[4] = "f-grid-cell-uneditable"; Grid1.Rows[98].CellCssClasses[4] = "f-grid-cell-uneditable"; } #endregion #region 计算方法 /// /// 计算方法 /// private void GetData() { decimal E6 = 0, F6 = 0, E7 = 0, F7 = 0, E8, F8, E9, F9, E10 = 0, F10 = 0, E11 = 0, F11 = 0, E12 = 0, F12 = 0, E13 = 0, F13 = 0, E14 = 0, F14 = 0, E15 = 0, F15 = 0, E16 = 0, F16 = 0, E17 = 0, F17 = 0, E18 = 0, F18 = 0, E19 = 0, F19 = 0, E21 = 0, F21 = 0, E22 = 0, F22 = 0, E23 = 0, F23 = 0, E25 = 0, F25 = 0, E26 = 0, F26 = 0, E27 = 0, F27 = 0, E28 = 0, F28 = 0, E29, F29, E30, F30, E31, F31, E32, F32, E33, F33, E34, F34, E35, F35, E36, F36, E37, F37, E38, F38, E39, F39, E40, F40, E41, F41, E42, F42, E43, F43, E44, F44, E45, F45, E46, F46, E47, F47, E48, F48, E49, F49, E50, F50, E51, F51, E52, F52, E53, F53, E54, F54, E55, F55, E56, F56, E57, F57, E58, F58, E59, F59, E60, F60, E61, F61, E62, F62, E63, F63, E64, F64, E65, F65, E66, F66, E67, F67, E68, F68, E69, F69, E70, F70, E71, F71, E72, F72, E73, F73, E74, F74, E75, F75, E76, F76, E77, F77, E78, F78, E79, F79, E80, F80, E81, F81, E82, F82, E83, F83, E84, F84, E85, F85, E86, F86, E87, F87, E88, F88, E89, F89, E90, F90, E91, F91, E92, F92, E93, F93, E94, F94, E95, F95, E96, F96, E97, F97, E98, F98, E99, F99, E100, F100, E102 = 0, F102 = 0, E103 = 0, F103 = 0; JArray mergedData = Grid1.GetMergedData(); foreach (JObject mergedRow in mergedData) { JObject values = mergedRow.Value("values"); int rowIndex = mergedRow.Value("index"); string sortIndex = values.Value("SortIndex"); var item = items.FirstOrDefault(x => x.SortIndex == sortIndex); if (item != null) { item.BaseNumber = System.Web.HttpUtility.HtmlDecode(values.Value("BaseNumber")); item.LastYearValue = System.Web.HttpUtility.HtmlDecode(values.Value("LastYearValue")); item.ThisYearValue = System.Web.HttpUtility.HtmlDecode(values.Value("ThisYearValue")); } } this.Grid1.DataSource = items; this.Grid1.DataBind(); SetUnEditableRow(); foreach (JObject mergedRow in mergedData) { JObject values = mergedRow.Value("values"); int rowIndex = mergedRow.Value("index"); if (rowIndex == 1) { E6 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F6 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E6 > 0 && F6 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F6 - E6) * 100 / E6, 2).ToString() + "%"; } } else if (rowIndex == 2) { E7 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F7 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E7 > 0 && F7 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F7 - E7) * 100 / E7, 2).ToString() + "%"; } } else if (rowIndex == 3) { E8 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F8 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E8 > 0 && F8 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F8 - E8) * 100 / E8, 2).ToString() + "%"; } } else if (rowIndex == 4) { E9 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F9 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E9 > 0 && F9 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F9 - E9) * 100 / E9, 2).ToString() + "%"; } } else if (rowIndex == 5) { E10 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F10 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E10 > 0 && F10 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F10 - E10) * 100 / E10, 2).ToString() + "%"; } } else if (rowIndex == 6) { E11 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F11 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E11 > 0 && F11 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F11 - E11) * 100 / E11, 2).ToString() + "%"; } } else if (rowIndex == 7) { E12 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F12 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E12 > 0 && F12 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F12 - E12) * 100 / E12, 2).ToString() + "%"; } } else if (rowIndex == 8) { E13 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F13 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E13 > 0 && F13 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F13 - E13) * 100 / E13, 2).ToString() + "%"; } } else if (rowIndex == 9) { E14 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F14 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E14 > 0 && F14 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F14 - E14) * 100 / E14, 2).ToString() + "%"; } } else if (rowIndex == 10) { E15 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F15 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E15 > 0 && F15 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F15 - E15) * 100 / E15, 2).ToString() + "%"; } } else if (rowIndex == 11) { E16 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F16 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E16 > 0 && F16 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F16 - E16) * 100 / E16, 2).ToString() + "%"; } } else if (rowIndex == 12) { E17 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F17 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E17 > 0 && F17 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F17 - E17) * 100 / E17, 2).ToString() + "%"; } } else if (rowIndex == 13) { E18 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F18 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E18 > 0 && F18 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F18 - E18) * 100 / E18, 2).ToString() + "%"; } } else if (rowIndex == 14) { E19 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F19 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E19 > 0 && F19 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F19 - E19) * 100 / E19, 2).ToString() + "%"; } } else if (rowIndex == 16) { E21 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F21 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E21 > 0 && F21 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F21 - E21) * 100 / E21, 2).ToString() + "%"; } } else if (rowIndex == 17) { E22 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F22 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E22 > 0 && F22 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F22 - E22) * 100 / E22, 2).ToString() + "%"; } } else if (rowIndex == 18) { E23 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F23 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E23 > 0 && F23 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F23 - E23) * 100 / E23, 2).ToString() + "%"; } } else if (rowIndex == 20) { E25 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F25 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E25 > 0 && F25 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F25 - E25) * 100 / E25, 2).ToString() + "%"; } } else if (rowIndex == 21) { E26 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F26 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E26 > 0 && F26 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F26 - E26) * 100 / E26, 2).ToString() + "%"; } } else if (rowIndex == 22) { E27 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F27 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E27 > 0 && F27 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F27 - E27) * 100 / E27, 2).ToString() + "%"; } } else if (rowIndex == 23) { E28 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F28 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E28 > 0 && F28 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F28 - E28) * 100 / E28, 2).ToString() + "%"; } } else if (rowIndex == 24) { E29 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F29 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E29 > 0 && F29 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F29 - E29) * 100 / E29, 2).ToString() + "%"; } } else if (rowIndex == 25) { E30 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F30 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E30 > 0 && F30 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F30 - E30) * 100 / E30, 2).ToString() + "%"; } } else if (rowIndex == 26) { E31 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F31 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E31 > 0 && F31 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F31 - E31) * 100 / E31, 2).ToString() + "%"; } } else if (rowIndex == 27) { E32 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F32 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E32 > 0 && F32 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F32 - E32) * 100 / E32, 2).ToString() + "%"; } } else if (rowIndex == 28) { E33 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F33 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E33 > 0 && F33 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F33 - E33) * 100 / E33, 2).ToString() + "%"; } } else if (rowIndex == 29) { E34 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F34 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E34 > 0 && F34 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F34 - E34) * 100 / E34, 2).ToString() + "%"; } } else if (rowIndex == 30) { E35 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F35 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E35 > 0 && F35 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F35 - E35) * 100 / E35, 2).ToString() + "%"; } } else if (rowIndex == 31) { E36 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F36 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E36 > 0 && F36 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F36 - E36) * 100 / E36, 2).ToString() + "%"; } } else if (rowIndex == 32) { E37 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F37 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E37 > 0 && F37 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F37 - E37) * 100 / E37, 2).ToString() + "%"; } } else if (rowIndex == 33) { E38 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F38 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E38 > 0 && F38 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F38 - E38) * 100 / E38, 2).ToString() + "%"; } } else if (rowIndex == 34) { E39 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F39 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E39 > 0 && F39 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F39 - E39) * 100 / E39, 2).ToString() + "%"; } } else if (rowIndex == 35) { E40 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F40 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E40 > 0 && F40 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F40 - E40) * 100 / E40, 2).ToString() + "%"; } } else if (rowIndex == 36) { E41 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F41 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E41 > 0 && F41 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F41 - E41) * 100 / E41, 2).ToString() + "%"; } } else if (rowIndex == 37) { E42 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F42 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E42 > 0 && F42 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F42 - E42) * 100 / E42, 2).ToString() + "%"; } } else if (rowIndex == 38) { E43 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F43 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E43 > 0 && F43 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F43 - E43) * 100 / E43, 2).ToString() + "%"; } } else if (rowIndex == 39) { E44 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F44 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E44 > 0 && F44 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F44 - E44) * 100 / E44, 2).ToString() + "%"; } } else if (rowIndex == 40) { E45 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F45 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E45 > 0 && F45 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F45 - E45) * 100 / E45, 2).ToString() + "%"; } } else if (rowIndex == 41) { E46 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F46 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E46 > 0 && F46 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F46 - E46) * 100 / E46, 2).ToString() + "%"; } } else if (rowIndex == 42) { E47 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F47 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E47 > 0 && F47 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F47 - E47) * 100 / E47, 2).ToString() + "%"; } } else if (rowIndex == 43) { E48 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F48 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E48 > 0 && F48 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F48 - E48) * 100 / E48, 2).ToString() + "%"; } } else if (rowIndex == 44) { E49 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F49 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E49 > 0 && F49 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F49 - E49) * 100 / E49, 2).ToString() + "%"; } } else if (rowIndex == 45) { E50 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F50 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E50 > 0 && F50 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F50 - E50) * 100 / E50, 2).ToString() + "%"; } } else if (rowIndex == 46) { E51 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F51 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E51 > 0 && F51 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F51 - E51) * 100 / E51, 2).ToString() + "%"; } } else if (rowIndex == 47) { E52 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F52 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E52 > 0 && F52 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F52 - E52) * 100 / E52, 2).ToString() + "%"; } } else if (rowIndex == 48) { E53 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F53 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E53 > 0 && F53 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F53 - E53) * 100 / E53, 2).ToString() + "%"; } } else if (rowIndex == 49) { E54 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F54 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E54 > 0 && F54 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F54 - E54) * 100 / E54, 2).ToString() + "%"; } } else if (rowIndex == 50) { E55 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F55 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E55 > 0 && F55 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F55 - E55) * 100 / E55, 2).ToString() + "%"; } } else if (rowIndex == 51) { E56 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F56 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E56 > 0 && F56 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F56 - E56) * 100 / E56, 2).ToString() + "%"; } } else if (rowIndex == 52) { E57 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F57 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E57 > 0 && F57 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F57 - E57) * 100 / E57, 2).ToString() + "%"; } } else if (rowIndex == 53) { E58 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F58 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E58 > 0 && F58 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F58 - E58) * 100 / E58, 2).ToString() + "%"; } } else if (rowIndex == 54) { E59 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F59 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E59 > 0 && F59 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F59 - E59) * 100 / E59, 2).ToString() + "%"; } } else if (rowIndex == 55) { E60 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F60 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E60 > 0 && F60 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F60 - E60) * 100 / E60, 2).ToString() + "%"; } } else if (rowIndex == 56) { E61 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F61 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E61 > 0 && F61 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F61 - E61) * 100 / E61, 2).ToString() + "%"; } } else if (rowIndex == 57) { E62 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F62 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E62 > 0 && F62 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F62 - E62) * 100 / E62, 2).ToString() + "%"; } } else if (rowIndex == 58) { E63 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F63 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E63 > 0 && F63 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F63 - E63) * 100 / E63, 2).ToString() + "%"; } } else if (rowIndex == 59) { E64 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F64 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E64 > 0 && F64 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F64 - E64) * 100 / E64, 2).ToString() + "%"; } } else if (rowIndex == 60) { E65 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F65 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E65 > 0 && F65 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F65 - E65) * 100 / E65, 2).ToString() + "%"; } } else if (rowIndex == 61) { E66 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F66 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E66 > 0 && F66 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F66 - E66) * 100 / E66, 2).ToString() + "%"; } } else if (rowIndex == 62) { E67 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F67 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E67 > 0 && F67 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F67 - E67) * 100 / E67, 2).ToString() + "%"; } } else if (rowIndex == 63) { E68 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F68 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E68 > 0 && F68 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F68 - E68) * 100 / E68, 2).ToString() + "%"; } } else if (rowIndex == 64) { E69 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F69 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E69 > 0 && F69 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F69 - E69) * 100 / E69, 2).ToString() + "%"; } } else if (rowIndex == 65) { E70 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F70 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E70 > 0 && F70 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F70 - E70) * 100 / E70, 2).ToString() + "%"; } } else if (rowIndex == 66) { E71 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F71 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E71 > 0 && F71 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F71 - E71) * 100 / E71, 2).ToString() + "%"; } } else if (rowIndex == 67) { E72 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F72 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E72 > 0 && F72 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F72 - E72) * 100 / E72, 2).ToString() + "%"; } } else if (rowIndex == 68) { E73 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F73 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E73 > 0 && F73 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F73 - E73) * 100 / E73, 2).ToString() + "%"; } } else if (rowIndex == 69) { E74 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F74 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E74 > 0 && F74 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F74 - E74) * 100 / E74, 2).ToString() + "%"; } } else if (rowIndex == 70) { E75 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F75 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E75 > 0 && F75 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F75 - E75) * 100 / E75, 2).ToString() + "%"; } } else if (rowIndex == 71) { E76 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F76 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E76 > 0 && F76 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F76 - E76) * 100 / E76, 2).ToString() + "%"; } } else if (rowIndex == 72) { E77 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F77 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E77 > 0 && F77 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F77 - E77) * 100 / E77, 2).ToString() + "%"; } } else if (rowIndex == 73) { E78 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F78 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E78 > 0 && F78 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F78 - E78) * 100 / E78, 2).ToString() + "%"; } } else if (rowIndex == 74) { E79 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F79 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E79 > 0 && F79 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F79 - E79) * 100 / E79, 2).ToString() + "%"; } } else if (rowIndex == 75) { E80 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F80 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E80 > 0 && F80 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F80 - E80) * 100 / E80, 2).ToString() + "%"; } } else if (rowIndex == 76) { E81 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F81 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E81 > 0 && F81 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F81 - E81) * 100 / E81, 2).ToString() + "%"; } } else if (rowIndex == 77) { E82 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F82 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E82 > 0 && F82 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F82 - E82) * 100 / E82, 2).ToString() + "%"; } } else if (rowIndex == 78) { E83 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F83 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E83 > 0 && F83 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F83 - E83) * 100 / E83, 2).ToString() + "%"; } } else if (rowIndex == 79) { E84 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F84 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E84 > 0 && F84 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F84 - E84) * 100 / E84, 2).ToString() + "%"; } } else if (rowIndex == 80) { E85 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F85 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E85 > 0 && F85 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F85 - E85) * 100 / E85, 2).ToString() + "%"; } } else if (rowIndex == 81) { E86 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F86 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E86 > 0 && F86 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F86 - E86) * 100 / E86, 2).ToString() + "%"; } } else if (rowIndex == 82) { E87 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F87 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E87 > 0 && F87 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F87 - E87) * 100 / E87, 2).ToString() + "%"; } } else if (rowIndex == 83) { E88 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F88 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E88 > 0 && F88 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F88 - E88) * 100 / E88, 2).ToString() + "%"; } } else if (rowIndex == 84) { E89 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F89 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E89 > 0 && F89 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F89 - E89) * 100 / E89, 2).ToString() + "%"; } } else if (rowIndex == 85) { E90 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F90 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E90 > 0 && F90 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F90 - E90) * 100 / E90, 2).ToString() + "%"; } } else if (rowIndex == 86) { E91 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F91 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E91 > 0 && F91 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F91 - E91) * 100 / E91, 2).ToString() + "%"; } } else if (rowIndex == 87) { E92 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F92 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E92 > 0 && F92 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F92 - E92) * 100 / E92, 2).ToString() + "%"; } } else if (rowIndex == 88) { E93 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F93 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E93 > 0 && F93 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F93 - E93) * 100 / E93, 2).ToString() + "%"; } } else if (rowIndex == 89) { E94 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F94 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E94 > 0 && F94 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F94 - E94) * 100 / E94, 2).ToString() + "%"; } } else if (rowIndex == 90) { E95 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F95 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E95 > 0 && F95 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F95 - E95) * 100 / E95, 2).ToString() + "%"; } } else if (rowIndex == 91) { E96 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F96 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E96 > 0 && F96 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F96 - E96) * 100 / E96, 2).ToString() + "%"; } } else if (rowIndex == 92) { E97 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F97 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E97 > 0 && F97 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F97 - E97) * 100 / E97, 2).ToString() + "%"; } } else if (rowIndex == 93) { E98 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F98 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E98 > 0 && F98 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F98 - E98) * 100 / E98, 2).ToString() + "%"; } } else if (rowIndex == 94) { E99 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F99 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E99 > 0 && F99 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F99 - E99) * 100 / E99, 2).ToString() + "%"; } } else if (rowIndex == 95) { E100 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F100 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E100 > 0 && F100 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F100 - E100) * 100 / E100, 2).ToString() + "%"; } } else if (rowIndex == 97) { E102 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F102 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E102 > 0 && F102 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F102 - E102) * 100 / E102, 2).ToString() + "%"; } } else if (rowIndex == 98) { E103 = Funs.GetNewDecimalOrZero(values.Value("LastYearValue")); F103 = Funs.GetNewDecimalOrZero(values.Value("ThisYearValue")); if (E103 > 0 && F103 > 0) { this.Grid1.Rows[rowIndex].Values[6] = decimal.Round((F103 - E103) * 100 / E103, 2).ToString() + "%"; } } } if (E7 > 0 || E10 > 0 || E11 > 0 || E12 > 0 || E13 > 0 || E14 > 0 || E15 > 0 || E16 > 0 || E17 > 0 || E18 > 0 || E19 > 0) { this.Grid1.Rows[0].Values[4] = (E7 + (E10 * Convert.ToDecimal(0.9714) + E11 * Convert.ToDecimal(1.229) + E12 * Convert.ToDecimal(1.4286) + E13 * Convert.ToDecimal(1.4714) + E14 * Convert.ToDecimal(1.4714) + E15 * Convert.ToDecimal(1.4571) + E16 * Convert.ToDecimal(1.4286) + E17 * Convert.ToDecimal(13.3) + E18 * Convert.ToDecimal(0.0341) + E19) / 10000); } if (F7 > 0 || F10 > 0 || F11 > 0 || F12 > 0 || F13 > 0 || F14 > 0 || F15 > 0 || F16 > 0 || F17 > 0 || F18 > 0 || F19 > 0) { this.Grid1.Rows[0].Values[5] = (F7 + (F10 * Convert.ToDecimal(0.9714) + F11 * Convert.ToDecimal(1.229) + F12 * Convert.ToDecimal(1.4286) + F13 * Convert.ToDecimal(1.4714) + F14 * Convert.ToDecimal(1.4714) + F15 * Convert.ToDecimal(1.4571) + F16 * Convert.ToDecimal(1.4286) + F17 * Convert.ToDecimal(13.3) + F18 * Convert.ToDecimal(0.0341) + F19) / 10000); } if (!string.IsNullOrEmpty(this.Grid1.Rows[0].Values[4].ToString()) && !string.IsNullOrEmpty(this.Grid1.Rows[0].Values[5].ToString())) { this.Grid1.Rows[0].Values[6] = decimal.Round((Funs.GetNewDecimalOrZero(this.Grid1.Rows[0].Values[5].ToString()) - Funs.GetNewDecimalOrZero(this.Grid1.Rows[0].Values[4].ToString())) * 100 / Funs.GetNewDecimalOrZero(this.Grid1.Rows[0].Values[4].ToString()), 2).ToString() + "%"; } if (E6 > 0 && E21 > 0) { this.Grid1.Rows[15].Values[4] = decimal.Round(E6 * 10000 / E21, 4); } if (F6 > 0 && F21 > 0) { this.Grid1.Rows[15].Values[5] = decimal.Round(F6 * 10000 / F21, 4); } if (!string.IsNullOrEmpty(this.Grid1.Rows[15].Values[4].ToString()) && !string.IsNullOrEmpty(this.Grid1.Rows[15].Values[5].ToString())) { this.Grid1.Rows[15].Values[6] = decimal.Round((Funs.GetNewDecimalOrZero(this.Grid1.Rows[15].Values[5].ToString()) - Funs.GetNewDecimalOrZero(this.Grid1.Rows[15].Values[4].ToString())) * 100 / Funs.GetNewDecimalOrZero(this.Grid1.Rows[15].Values[4].ToString()), 2).ToString() + "%"; } if (E6 > 0 && E25 > 0) { this.Grid1.Rows[19].Values[4] = decimal.Round(E6 * 10000 / E25, 4); } if (F6 > 0 && F25 > 0) { this.Grid1.Rows[19].Values[5] = decimal.Round(F6 * 10000 / F25, 4); } if (!string.IsNullOrEmpty(this.Grid1.Rows[19].Values[4].ToString()) && !string.IsNullOrEmpty(this.Grid1.Rows[19].Values[5].ToString())) { this.Grid1.Rows[19].Values[6] = decimal.Round((Funs.GetNewDecimalOrZero(this.Grid1.Rows[19].Values[5].ToString()) - Funs.GetNewDecimalOrZero(this.Grid1.Rows[19].Values[4].ToString())) * 100 / Funs.GetNewDecimalOrZero(this.Grid1.Rows[19].Values[4].ToString()), 2).ToString() + "%"; } if (E102 > 0 && E103 > 0 && E21 > 0) { this.Grid1.Rows[96].Values[4] = decimal.Round((E102 + E103) / E21, 4); } if (F102 > 0 && F103 > 0 && F21 > 0) { this.Grid1.Rows[96].Values[5] = decimal.Round((F102 + F103) / F21, 4); } if (!string.IsNullOrEmpty(this.Grid1.Rows[96].Values[4].ToString()) && !string.IsNullOrEmpty(this.Grid1.Rows[96].Values[5].ToString())) { this.Grid1.Rows[96].Values[6] = decimal.Round((Funs.GetNewDecimalOrZero(this.Grid1.Rows[96].Values[5].ToString()) - Funs.GetNewDecimalOrZero(this.Grid1.Rows[96].Values[4].ToString())) * 100 / Funs.GetNewDecimalOrZero(this.Grid1.Rows[96].Values[4].ToString()), 2).ToString() + "%"; } //this.Grid1.Rows[0].Values[15] = totalRateSum; //this.Grid1.Rows[0].Values[16] = totalCompleteValueSumAll; //this.Grid1.Rows[0].Values[17] = totalRateSumAll; //this.Grid1.Rows[0].Values[19] = totalRealValueSum; //this.Grid1.Rows[0].Values[20] = Funs.GetNewDecimalOrZero(firstValues.Value("RealValueTotalPart")) + totalRealValueSum; //this.Grid1.Rows[0].Values[22] = totalCompleteValueSumAll - Funs.GetNewDecimalOrZero(firstValues.Value("PlanValueTotal")); //this.Grid1.Rows[0].Values[23] = totalCompleteValueSumAll - (Funs.GetNewDecimalOrZero(firstValues.Value("RealValueTotalPart")) + totalRealValueSum); } #endregion #region 关闭窗口 /// /// 关闭窗口 /// /// /// protected void Window1_Close(object sender, WindowCloseEventArgs e) { Model.Environmental_ProjectChemicalReport report = BLL.ProjectChemicalReportService.GetChemicalReportByChemicalReportId(ChemicalReportId); this.btnSave.Hidden = false; } #endregion #region 保存、上报 /// /// 保存数据 /// /// private void Save(string type) { //string ChemicalReportId = Request.QueryString["ChemicalReportId"]; Model.Environmental_ProjectChemicalReport report = new Environmental_ProjectChemicalReport { ProjectId = this.CurrUser.LoginProjectId, Year = Funs.GetNewIntOrZero(drpYear.SelectedValue), Month = Funs.GetNewIntOrZero(drpMonth.SelectedValue) }; if (!string.IsNullOrEmpty(txtFillingDate.Text.Trim())) { report.FillingDate = Convert.ToDateTime(txtFillingDate.Text.Trim()); } report.DutyPerson = txtDutyPerson.Text.Trim(); if (String.IsNullOrEmpty(ChemicalReportId)) { Environmental_ProjectChemicalReport old = ProjectChemicalReportService.GetChemicalReportByProjectIdDate(this.CurrUser.LoginProjectId, Funs.GetNewIntOrZero(drpYear.SelectedValue), Funs.GetNewIntOrZero(drpMonth.SelectedValue)); if (old == null) { report.ChemicalReportId = SQLHelper.GetNewID(typeof(Model.Environmental_ProjectChemicalReport)); report.UpState = BLL.Const.UpState_2; report.FillingMan = this.CurrUser.UserName; BLL.ProjectChemicalReportService.AddChemicalReport(report); BLL.LogService.AddSys_Log(this.CurrUser, report.Year.ToString() + "-" + report.Month.ToString(), report.ChemicalReportId, BLL.Const.ProjectChemicalReportMenuId, BLL.Const.BtnAdd); } else { ShowNotify("该月份记录已存在!", MessageBoxIcon.Warning); return; } } else { Model.Environmental_ProjectChemicalReport oldReport = BLL.ProjectChemicalReportService.GetChemicalReportByChemicalReportId(ChemicalReportId); report.ChemicalReportId = ChemicalReportId; report.UpState = BLL.Const.UpState_2; BLL.ProjectChemicalReportService.UpdateChemicalReport(report); BLL.LogService.AddSys_Log(this.CurrUser, report.Year.ToString() + "-" + report.Month.ToString(), report.ChemicalReportId, BLL.Const.ProjectChemicalReportMenuId, BLL.Const.BtnModify); } ChemicalReportId = report.ChemicalReportId; BLL.ProjectChemicalReportItemService.DeleteChemicalReportItemByChemicalReportId(report.ChemicalReportId); List mReportItemList = new List(); GetItems(report.ChemicalReportId); foreach (var item in items) { Model.Environmental_ProjectChemicalReportItem newItem = new Environmental_ProjectChemicalReportItem(); newItem.ChemicalReportItemId = SQLHelper.GetNewID(typeof(Model.Environmental_ProjectChemicalReportItem)); newItem.ChemicalReportId = report.ChemicalReportId; newItem.SortIndex = System.Web.HttpUtility.HtmlDecode(item.SortIndex); newItem.BaseNumber = System.Web.HttpUtility.HtmlDecode(item.BaseNumber); newItem.LastYearValue = System.Web.HttpUtility.HtmlDecode(item.LastYearValue); newItem.ThisYearValue = System.Web.HttpUtility.HtmlDecode(item.ThisYearValue); newItem.Rate = System.Web.HttpUtility.HtmlDecode(item.Rate); ProjectChemicalReportItemService.AddChemicalReportItem(newItem); mReportItemList.Add(newItem); } if (type == "updata") //数据同步 { if (report.UpState == BLL.Const.UpState_2) { string code = CNCECHSSEWebService.UpChemicalReport(report.ChemicalReportId, this.CurrUser); if (code == "1") { ShowNotify("同步成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); return; } else { Alert.ShowInParent("同步异常,请退出后重试!", MessageBoxIcon.Error); } } else { ShowNotify("当前单据状态不能同步!", MessageBoxIcon.Warning); return; } } } protected void btnSave_Click(object sender, EventArgs e) { Save("add"); ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } protected void btnUpdata_Click(object sender, EventArgs e) { Save("updata"); } protected void btnSubmit_Click(object sender, EventArgs e) { Save("submit"); } #endregion #region 增加本月明细 private void GetItems(string ChemicalReportId) { foreach (JObject mergedRow in Grid1.GetMergedData()) { JObject values = mergedRow.Value("values"); int rowIndex = mergedRow.Value("index"); string sortIndex = values.Value("SortIndex"); var item = items.FirstOrDefault(x => x.SortIndex == sortIndex); if (item != null) { item.LastYearValue = System.Web.HttpUtility.HtmlDecode(values.Value("LastYearValue")); item.ThisYearValue = System.Web.HttpUtility.HtmlDecode(values.Value("ThisYearValue")); item.Rate = System.Web.HttpUtility.HtmlDecode(values.Value("Rate")); } } } #endregion #region 获取明细 private void GetNewItems(string year, string months) { var indexNames = ProjectChemicalReportItemService.GetIndexNames(); var units = ProjectChemicalReportItemService.GetUnits(); foreach (var indexName in indexNames) { //增加明细集合 Model.ChemicalReportItem item = new ChemicalReportItem { ChemicalReportItemId = SQLHelper.GetNewID(typeof(Model.Environmental_ProjectChemicalReportItem)), IndexName = indexName.Text, Unit = units.First(x => x.Value == indexName.Value).Text, SortIndex = indexName.Value, }; //if (item.SortIndex == "18" || item.SortIndex == "19" || item.SortIndex == "22" || item.SortIndex == "23" || item.SortIndex == "24" || item.SortIndex == "34") //{ // item.LastYearValue = "×"; // item.ThisYearValue = "×"; // if (item.SortIndex == "34") // { // item.Rate = "─"; // } // else // { // item.Rate = "×"; // } //} items.Add(item); } } #endregion #region 单位下拉选择事件 /// /// 单位下拉选择事件 /// /// /// protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e) { items.Clear(); if (this.CurrUser.LoginProjectId != BLL.Const._Null) { //GetNewItems(); } Grid1.DataSource = items; Grid1.DataBind(); } #endregion #region 获取按钮权限 /// /// 获取按钮权限 /// /// /// private void GetButtonPower() { var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectChemicalReportMenuId); if (buttonList.Count() > 0) { if (buttonList.Contains(BLL.Const.BtnSave)) { this.btnSave.Hidden = false; //this.btnCopy.Hidden = false; } //if (buttonList.Contains(BLL.Const.BtnSaveUp)) //{ // this.btnUpdata.Hidden = false; //} } } #endregion #region 复制上个月数据 /// /// 复制上个月的数据 /// /// /// protected void btnCopy_Click(object sender, EventArgs e) { DateTime? nowDate = Funs.GetNewDateTime(this.drpYear.SelectedValue + "-" + this.drpMonth.SelectedValue); if (nowDate.HasValue) { DateTime showDate = new DateTime(); showDate = nowDate.Value.AddMonths(-1); Model.Environmental_ProjectChemicalReport ChemicalReport = BLL.ProjectChemicalReportService.GetChemicalReportByProjectIdAndYearAndMonth(this.CurrUser.LoginProjectId, showDate.Year, showDate.Month); if (ChemicalReport != null) { Model.Environmental_ProjectChemicalReport newChemicalReport = new Environmental_ProjectChemicalReport(); this.ChemicalReportId = SQLHelper.GetNewID(typeof(Model.Environmental_ProjectChemicalReport)); newChemicalReport.ChemicalReportId = this.ChemicalReportId; newChemicalReport.ProjectId = this.CurrUser.LoginProjectId; newChemicalReport.Year = Convert.ToInt32(this.drpYear.SelectedValue); newChemicalReport.Month = Convert.ToInt32(this.drpMonth.SelectedValue); newChemicalReport.FillingMan = this.CurrUser.UserName; newChemicalReport.FillingDate = DateTime.Now; newChemicalReport.DutyPerson = this.CurrUser.UserName; newChemicalReport.UpState = BLL.Const.UpState_2; BLL.ProjectChemicalReportService.AddChemicalReport(newChemicalReport); var oldItems = BLL.ProjectChemicalReportItemService.GetItems(ChemicalReport.ChemicalReportId); if (oldItems.Count > 0) { foreach (var item in oldItems) { Model.Environmental_ProjectChemicalReportItem newItem = new Environmental_ProjectChemicalReportItem { ChemicalReportItemId = SQLHelper.GetNewID(typeof(Model.Environmental_ProjectChemicalReportItem)), ChemicalReportId = this.ChemicalReportId, SortIndex = item.SortIndex, LastYearValue = item.LastYearValue, ThisYearValue = item.ThisYearValue, Rate = item.Rate, }; BLL.ProjectChemicalReportItemService.AddChemicalReportItem(newItem); } } GetValues(newChemicalReport.ChemicalReportId); } } } /// /// 获取复制的值绑定到文本中 /// private void GetValues(string ChemicalReportId) { var report = BLL.ProjectChemicalReportService.GetChemicalReportByChemicalReportId(ChemicalReportId); if (report != null) { drpMonth.SelectedValue = report.Month.ToString(); drpYear.SelectedValue = report.Year.ToString(); this.CurrUser.LoginProjectId = report.ProjectId; if (report.FillingDate != null) { txtFillingDate.Text = string.Format("{0:yyyy-MM-dd}", report.FillingDate); } txtDutyPerson.Text = report.DutyPerson; items = BLL.ProjectChemicalReportItemService.GetShowItems(ChemicalReportId); this.Grid1.DataSource = items; this.Grid1.DataBind(); } } #endregion } }