protected void BindRptContrast() { DataTable contrast = CostDiary.GetContrast(base.Request["ic"]); this.rptContrast.DataSource = contrast; this.rptContrast.DataBind(); if (contrast.Rows.Count == 0) { base.RegisterScript("$('#rptContrast tr:last-child').remove();"); } }
protected void SumTotal() { DataTable contrast = CostDiary.GetContrast(base.Request["ic"]); if (contrast.Rows.Count > 0) { System.Collections.Generic.Dictionary <string, decimal> dictionary = new System.Collections.Generic.Dictionary <string, decimal>(); string text = "ThisAmount"; decimal value = decimal.Parse(contrast.Compute("sum(" + text + ")", "1=1").ToString()); dictionary.Add(text, value); DataTable dataTable = contrast.Clone(); int num = -1; foreach (DataRow dataRow in contrast.Rows) { num++; if (num <= 0 || !(dataRow["CBSCode"].ToString() == contrast.Rows[num - 1]["CBSCode"].ToString())) { DataRow dataRow2 = dataTable.NewRow(); dataRow2.ItemArray = dataRow.ItemArray; dataTable.Rows.Add(dataRow2); } } decimal num2 = decimal.Parse((dataTable.Compute("SUM(MonthAmount)", "1=1") == null) ? 0m.ToString() : dataTable.Compute("SUM(MonthAmount)", "1=1").ToString()); decimal d = decimal.Parse((dataTable.Compute("SUM(MonthAlreadyAmount)", "1=1") == null) ? 0m.ToString() : dataTable.Compute("SUM(MonthAlreadyAmount)", "1=1").ToString()); dictionary["MonthAmount"] = num2; dictionary["MonthCha"] = num2 - d; if (dictionary["MonthAmount"] > 0m) { dictionary.Add("ChaLv", decimal.Round(dictionary["MonthCha"] * 100m / dictionary["MonthAmount"], 3)); } else { dictionary.Add("ChaLv", 0m); } decimal value2 = decimal.Parse(dataTable.Compute("SUM(PrjAmount)", "1=1").ToString()); dictionary.Add("PrjAmount", value2); decimal value3 = decimal.Parse(dataTable.Compute("SUM(PrjAlreadyAmount)", "1=1").ToString()); dictionary.Add("PrjAlreadyAmount", value3); this.ViewState["sum"] = dictionary; } }