コード例 #1
0
        //绘制字段分组的脚
        //返回 true 表示还没有结束
        private bool drawGroupFoot(Graphics g)
        {
            if (_GroupFoots.Count > 0)
            {
                int count = _GroupFoots.Count;
                //_HasDrawDetailHeight
                for (int i = 0; i < count; i++)
                {
                    DIYReport.ReportModel.RptSection section = _GroupFoots.Peek() as DIYReport.ReportModel.RptSection;
                    if (section.Visibled)
                    {
                        int tempHeight = _HasDrawDetailHeight + section.Height;
                        if (tempHeight > REAL_DETAIL_HEIGHT)
                        {
                            return(true);
                        }
                        section = _GroupFoots.Pop() as DIYReport.ReportModel.RptSection;
                        DrawGroupField groupField = _DrawDetailInfo.GetGroupFieldByName(section.GroupField.FieldName);

                        groupField.HasDrawGroupHead             = false;
                        DIYReport.Express.ExSpecial._RowOrderNO = 0;
                        foreach (RptSingleObj obj in section.RptObjList)
                        {
                            DrawRptSimpleObj(g, obj, _Rows[_HasDrawRowCount - 1]);
                        }
                        _HasDrawDetailHeight += section.Height;
                    }
                }
            }
            return(false);
        }
コード例 #2
0
        /// <summary>
        /// 得到绘制分组对应字段处理信息
        /// </summary>
        /// <param name="pFieldName">分组的字段名称</param>
        /// <returns></returns>
        public DrawGroupField GetGroupFieldByName(string pFieldName)
        {
            int count = _GroupFields.Count;

            for (int i = 0; i < count; i++)
            {
                DrawGroupField field = _GroupFields[i] as DrawGroupField;
                if (field.GroupFieldName == pFieldName)
                {
                    return(field);
                }
            }
            return((DrawGroupField)null);
        }
コード例 #3
0
 /// <summary>
 /// 打印之前需要初始化的数据
 /// </summary>
 public void BeginPrint()
 {
     HasDrawRowCount = 0;
     PageNumber      = 1;
     DIYReport.Express.ExSpecial._Page       = 1;
     DIYReport.Express.ExSpecial._PageCount  = 1;
     DIYReport.Express.ExSpecial._RowOrderNO = 0;
     _GroupFoots.Clear();
     _GroupHeads.Clear();
     foreach (object field in _DrawDetailInfo.GroupFields)
     {
         DrawGroupField groupField = field as DrawGroupField;
         groupField.CurrGroupValue = null;
     }
 }
コード例 #4
0
        /// <summary>
        ///  根据DesignEnviroment中的DesignField构造出一个绘制Detail临时存储的信息
        /// </summary>
        /// <param name="pDataReport"></param>
        public DrawDetailInfo(DIYReport.ReportModel.RptReport report)
        {
            //-1 表示当前页还没有开始绘制
            _CurrPageFirstRowIndex = -1;
            _CurrPageNumber        = -1;

            IList fieldList = report.DesignField;

            //对分组的字段进行排序,以获取分组字段的顺序
            (fieldList as ArrayList).Sort(new FieldSortComparer());
            _GroupFields = new ArrayList();
            foreach (DIYReport.GroupAndSort.RptFieldInfo field in fieldList)
            {
                if (field.IsGroup)
                {
                    DrawGroupField drwafield = new DrawGroupField(-1, field.FieldName);
                    _GroupFields.Add(drwafield);
                }
            }
        }
コード例 #5
0
        //分析字段的Group Section信息,并存储在对应的队列和栈中
        private void analyseGroupSection(int pRowIndex)
        {
            int   rowCount = _Rows.Length;
            IList fields   = _DrawDetailInfo.GroupFields;
            bool  isEnd    = false;

            if (fields != null && fields.Count > 0)
            {
                int count         = fields.Count;
                int drawFoot      = -1;
                int iniGroupIndex = 0;
                if (pRowIndex < rowCount)
                {
                    DataRow dRow         = _Rows[pRowIndex];
                    bool    mustDrawHead = false;
                    for (int i = iniGroupIndex; i < count; i++)
                    {
                        DrawGroupField groupField = fields[i] as DrawGroupField;
                        string         fieldName  = groupField.GroupFieldName;
                        object         val        = dRow[fieldName];
                        DIYReport.ReportModel.RptSection section = _DataReport.SectionList.GetByGroupField(fieldName, true);
                        //判断行的值和已经绘制的grou p section head 中正在分析的字段的值是否相同
                        bool inTheGroup = !mustDrawHead && DIYReport.GroupAndSort.GroupDataProcess.ValueInTheGroup(section, groupField.CurrGroupValue, val);
                        groupField.CurrGroupValue = val;
                        if (!inTheGroup && !mustDrawHead)
                        {
                            drawFoot     = i;
                            mustDrawHead = true;
                        }
                        if (!groupField.HasDrawGroupHead || mustDrawHead)
                        {
                            //把需要绘制的group section 的head 添加到队列的结尾
                            groupField.PrevFirstRowIndex = groupField.FirstRowIndex == -1?0:groupField.FirstRowIndex;
                            groupField.FirstRowIndex     = _HasDrawRowCount;
                            _GroupHeads.Enqueue(section);
                        }
                    }
                }
                else
                {
                    drawFoot = 0;
                    isEnd    = true;
                }
                if (drawFoot > -1)
                {
                    for (int i = drawFoot; i < count; i++)
                    {
                        DrawGroupField groupField = fields[i] as DrawGroupField;
                        if (isEnd)
                        {
                            groupField.PrevFirstRowIndex = groupField.FirstRowIndex;
                        }
                        //groupField.FirstRowIndex = groupField.PrevFirstRowIndex;
                        string fieldName = groupField.GroupFieldName;
                        DIYReport.ReportModel.RptSection section = _DataReport.SectionList.GetByGroupField(fieldName, false);
                        //把需要绘制的group section 的footer 压到栈中
                        _GroupFoots.Push(section);
                        //groupField.HasDrawGroupHead = false;
                    }     // end for(int i = drawFoot; i <count;i++){
                }         //end drawFoot > -1
            }             // end fields!=null && fields.Count >0
        }