private void BuildTheLastMetrix()
        {
            if (_currentmetrix != null)
            {
                if ((_currentmetrix as Cell).Visible)
                {
                    AddToNewLinesFromRows();
                    _rows.Clear();
                }

                if (_captiontoname != null)
                {
                    foreach (Cell cell in _currentcells)
                    {
                        if (cell is Chart && (cell as Chart).DataSource.ToLower().Trim() == (_currentmetrix as Cell).Name.ToLower().Trim())
                        {
                            Hashtable h = new Hashtable();
                            h.Add((cell as Chart).Level, _designcaptiontodesignname);
                            (cell as Chart).CaptionToName = h;

                            (cell as Chart).DrillTag = _chartdrilldata;
                        }
                    }
                    _captiontoname.Clear();
                }

                _captiontoname             = null;
                _currenttable              = null;
                _designcaptiontodesignname = null;
                _rowsheight           = 0;
                _cellnametocolumnname = null;
                _chartdrilldata       = null;
            }
        }
        private void FillDataTable(SemiRows semirows)
        {
            foreach (SemiRow semirow in semirows)
            {
                if (semirow.Level == 0)
                {
                    continue;
                }
                DataRow dr = _currenttable.NewRow();
                _currenttable.Rows.Add(dr);

                string groupkey = null;
                foreach (string key in _captiontoname.Keys)
                {
                    object o = _captiontoname[key];
                    if (o != null)
                    {
                        if (o is string)
                        {
                            string v = semirow[o.ToString()].ToString();
                            if (v == "")
                            {
                                dr[key] = DBNull.Value;
                            }
                            else
                            {
                                dr[key] = v;
                            }
                        }
                        else if (o is SimpleArrayList)
                        {
                            SimpleArrayList sal = o as SimpleArrayList;
                            StringBuilder   sb  = new StringBuilder();
                            foreach (string s in sal)
                            {
                                if (sb.Length > 0)
                                {
                                    sb.Append(" ");
                                }
                                sb.Append(semirow[s].ToString());
                            }
                            groupkey = sb.ToString();
                            dr[key]  = groupkey;
                        }
                    }
                }
                if (_cellnametocolumnname != null)
                {
                    DrillData dd = new DrillData(_viewid, ((Cell)_currentmetrix).Name);
                    foreach (string key in _cellnametocolumnname.Keys)
                    {
                        dd.Add(_cellnametocolumnname[key].ToString(), semirow[key]);
                    }

                    _chartdrilldata.Add(groupkey, dd);
                }
            }
        }
        public override void BuildIndicatorMetrix(Report report, bool hasdrilldefined)
        {
            BuildTheLastMetrix();

            _currentmetrix = _currentcells[report.ViewID] as IMetrix;
            _currentreport = report;
            Section pagetitle = report.Sections[SectionType.PageTitle];

            if (bChartDataSource)
            {
                CreateDataTable(pagetitle);
            }
            if (hasdrilldefined)
            {
                if ((_currentmetrix as Cell).Visible || _currenttable != null)
                {
                    CreateNameToColumnMap();
                    if (_currenttable != null)
                    {
                        _chartdrilldata = new DrillData(_viewid, report.ViewID);
                    }
                }
            }

            if ((_currentmetrix as Cell).Visible)
            {
                int index = FindTheLine(_currentmetrix as Cell);
                _currentline = _currentlines[index];

                _currentx = (_currentmetrix as Cell).X + bRightAMetrix(_currentmetrix as Cell, _currentline);
                _currenty = (_currentmetrix as Cell).Y + bUnderAMetrix(_currentmetrix as Cell, _currentline);
                _beginy   = _currenty;

                _newline = _detail.SectionLines[index];

                foreach (Section section in report.Sections)
                {
                    section.AsignToSectionLines();
                    //if (section is GroupHeader)
                    //{
                    //    foreach (Cell cell in section.Cells)
                    //        cell.Border.AllBorder();
                    //}
                }

                _rows.AppendFrom(pagetitle);
            }
        }
示例#4
0
 public void SetDrillTag(DrillData dd, SimpleHashtable cellnametocolumnname)
 {
     _drilltag             = dd;
     _cellnametocolumnname = cellnametocolumnname;
 }
        private void AddToNewLinesFromRows()
        {
            int beginx     = _currentx;
            int realheight = 0;

            foreach (Row row in _rows)
            {
                row.bAutoHeight = true;
                if (_rowsheight == Int32.MaxValue && realheight + row.Height > ((Cell)_currentmetrix).Height - 24)
                {//(_currentmetrix as Cell).X
                    AddCellToNewLine(MoreLabel(true, _currentmetrix as Cell, beginx, _currenty, _currentx - beginx, ((Cell)_currentmetrix).Height - (_currenty - _beginy)));
                    break;
                }
                _currentx = beginx;
                DrillData dd = null;
                if (row.InArea == "GroupHeader" || row.InArea == "Detail" || row.InArea == "GroupSummary")
                {
                    dd = new DrillData(_viewid, ((Cell)_currentmetrix).Name);
                }
                foreach (Cell cell in row.Cells)
                {
                    if (!cell.Visible)
                    {
                        continue;
                    }
                    //if(cell is CommonLabel || row.InArea=="GroupHeader")
                    //    cell.Border.AllBorder();
                    if (cell.Super == null)
                    {
                        cell.X = _currentx;
                        cell.SetY(_currenty);
                        if (!(cell is SuperLabel))
                        {
                            cell.SetRuntimeHeight(row.Height);
                            cell.Height = row.Height;
                        }
                        else
                        {
                            cell.Tag = 0;
                        }
                        _currentx += cell.Width;
                    }
                    else
                    {
                        cell.X = cell.Super.X + (int)cell.Super.Tag;
                        cell.SetY(cell.Super.Y + cell.Super.RuntimeHeight);
                        cell.Super.Tag = (int)cell.Super.Tag + cell.Width;
                    }
                    AddCellToNewLine(cell);

                    if (_cellnametocolumnname != null && dd != null && _cellnametocolumnname.Contains(cell.Name))
                    {
                        dd.Add(_cellnametocolumnname[cell.Name].ToString(), cell.Caption);
                    }
                    cell.DrillTag = dd;
                }
                _currenty  += row.Height;
                realheight += row.Height;
            }
            if (_rowsheight != Int32.MaxValue)//(_currentmetrix as Cell).X
            {
                AddCellToNewLine(MoreLabel(false, _currentmetrix as Cell, beginx, _currenty, _currentx - beginx, ((Cell)_currentmetrix).Height - (_currenty - _beginy)));
            }

            _currentmetrix.WidthOffsize = (_currentx - beginx - ((Cell)_currentmetrix).Width > 0) ? _currentx - beginx - ((Cell)_currentmetrix).Width : 0;
            //_currentmetrix.HeightOffsize = (_currenty - _beginy - ((Cell)_currentmetrix).Height > 0) ? _currenty - _beginy - ((Cell)_currentmetrix).Height : 0;

            if ((_currentmetrix as IGap).GapHeight > 0 && bLastOneIntheLine(_currentmetrix as Cell, _currentline))    //(_currentmetrix as Cell).X
            {
                AddCellToNewLine(GetAGap(_currentmetrix as IGap, beginx, _beginy + (_currentmetrix as Cell).Height)); //_currenty
            }
        }