/// <summary> /// 对维度1进行合计 /// </summary> /// <param name="sumTitle">合计列上的标题</param> public void AddSumD1(string sumTitle) { #region 增加合计 this.D1Ens.Add("sum", sumTitle, "", true); foreach (Dimension en2 in this.D2Ens) { float sum = 0; foreach (Dimension en1 in this.D1Ens) { Rpt2DCell cell = this.DataCells2D.Get2DCell(en1.No, en2.No); if (cell == null || cell.Value == null || cell.Value.Equals(DBNull.Value)) { } else if (float.Parse(cell.Value.ToString()) == 0) { } else { sum += float.Parse(cell.Value.ToString()); } } this.DataCells2D.Add("sum", en2.No, sum, this.CellUrl, this.CellTarget); } #endregion 增加合计 }
public string Get2DCellContent(string pk1, string name1, string pk2, string name2) { Rpt2DCell cell = this.DataCells2D.Get2DCell(pk1, pk2); if (cell == null || cell.Value == null || cell.Value.Equals(DBNull.Value)) { return("-"); } else if (cell.Url == "" || float.Parse(cell.Value.ToString()) == 0 || pk1 == "sum" || pk2 == "sum" ) { return(cell.Value.ToString()); } else { return("<a href='" + cell.Url + "?" + this.D1EnsName + "=" + cell.PK1 + "&" + this.D2EnsName + "=" + cell.PK2 + CellAddHref + "' title='" + name1 + "," + name2 + "'" + " Target='" + cell.Target + "'>" + cell.Value + "</a>"); } }
public bool Add(Rpt2DCell add) { if (this.ContainsCell(add)) { return(false); } else { this.InnerList.Add(add); return(true); } }
public bool Add(string pk1, string pk2, object val, string url, string target) { if (this.ContainsCell(pk1, pk2)) { return(false); } else { Rpt2DCell en = new Rpt2DCell(pk1, pk2, val, url, target); this.InnerList.Add(en); return(true); } }
public object GetCellValue(string pk1, string pk2) { Rpt2DCell cell = this.DataCells2D.Get2DCell(pk1, pk2); if (cell == null) { return(null); } else { return(cell.Value); } }
public string GenerHtmlStrBy(string pk1, string pk2) { Rpt2DCell cell = this.Get2DCell(pk1, pk2); if (cell == null) { return("-"); } if (cell.Url == "") { return(cell.Value.ToString()); } else { return("<A href='" + cell.Url + "?PK1='" + pk1 + "&PK2=" + pk2 + " >" + cell.Value + "</A>"); } }
/// <summary> /// 对维度2进行合计 /// </summary> /// <param name="sumTitle">合计列上的标题</param> public void AddSumD2(string sumTitle) { #region 增加合计 foreach (Dimension en1 in this.D1Ens) { float sum = 0; Dimensions ds2 = this.GetD2EnsBy1FK(en1.No); if (ds2.Count < 2) { continue; } foreach (Dimension en2 in ds2) { Rpt2DCell cell = this.DataCells2D.Get2DCell(en1.No, en2.No); if (cell == null || cell.Value == null || cell.Value.Equals(DBNull.Value)) { } else if (float.Parse(cell.Value.ToString()) == 0) { } else { sum += float.Parse(cell.Value.ToString()); } } if (this.D2RefD1) { this.D2Ens.Add("sum", sumTitle, en1.No, true); } else { this.D2Ens.Add("sum", sumTitle, "", true); } this.DataCells2D.Add(en1.No, "sum", sum, this.CellUrl, this.CellTarget); } #endregion 增加合计 }
public bool ContainsCell(Rpt2DCell cell) { return(ContainsCell(cell.PK1, cell.PK2)); }