Exemple #1
0
        protected override void drawGroupHeader(Graphics g, int groupId, RectangleF groupHeaderRect)
        {
            float      headerHeight        = groupHeaderRect.Height / 2;
            RectangleF nazivEkipeRectangle = new RectangleF(groupHeaderRect.X + delta,
                                                            groupHeaderRect.Y, groupHeaderRect.Width, headerHeight);

            ReportGrupa      gr    = groups[groupId];
            Nullable <short> rank  = (Nullable <short>)gr.Data[0];
            string           naziv = (string)gr.Data[1];
            Nullable <float> total;

            if (gimnastika == Gimnastika.MSG)
            {
                total = (Nullable <float>)gr.Data[8];
            }
            else
            {
                total = (Nullable <float>)gr.Data[6];
            }
            string fmtTot = "F" + Opcije.Instance.BrojDecimalaTotal;
            string text   = rank.ToString() +
                            (rank != null ? ".  " : "") +
                            naziv + "       " +
                            (total != null ? total.Value.ToString(fmtTot) : String.Empty);

            StringFormat nazivEkipeFormat = new StringFormat();

            nazivEkipeFormat.Alignment     = StringAlignment.Near;
            nazivEkipeFormat.LineAlignment = StringAlignment.Far;

            g.DrawString(text, nazivEkipeFont, blackBrush, nazivEkipeRectangle,
                         nazivEkipeFormat);

            foreach (ReportColumn col in Columns)
            {
                RectangleF columnHeaderRect = new RectangleF(
                    col.X, groupHeaderRect.Y + headerHeight, col.Width, headerHeight);

                g.DrawRectangle(pen, columnHeaderRect.X, columnHeaderRect.Y,
                                columnHeaderRect.Width, columnHeaderRect.Height);
                if (col.Image != null)
                {
                    Izvestaj.scaleImageIsotropically(g, col.Image, columnHeaderRect);
                }
                else
                {
                    g.DrawString(col.HeaderTitle, itemsHeaderFont, blackBrush,
                                 columnHeaderRect, col.HeaderFormat);
                }
            }
        }
Exemple #2
0
        protected override void drawGroupFooter(Graphics g, int groupId, RectangleF groupFooterRect)
        {
            ReportGrupa gr     = groups[groupId];
            string      fmtTot = "F" + Opcije.Instance.BrojDecimalaTotal;

            foreach (ReportColumn col in Columns)
            {
                RectangleF columnFooterRect = new RectangleF(
                    col.X, groupFooterRect.Y, col.Width, groupFooterRect.Height);
                if (col.Sprava != Sprava.Undefined)
                {
                    g.FillRectangle(totalBrush, columnFooterRect.X, columnFooterRect.Y,
                                    columnFooterRect.Width, columnFooterRect.Height);
                    g.DrawRectangle(pen, columnFooterRect.X, columnFooterRect.Y,
                                    columnFooterRect.Width, columnFooterRect.Height);
                    string text = getFormattedString(gr.Data, getSpravaGroupIndex(col.Sprava), fmtTot);
                    g.DrawString(text, itemFont, blackBrush,
                                 columnFooterRect, Izvestaj.centerCenterFormat);
                }
                else if (col.HeaderTitle == totalTitle)
                {
                    g.FillRectangle(totalBrush, columnFooterRect.X, columnFooterRect.Y,
                                    columnFooterRect.Width, columnFooterRect.Height);
                    g.DrawRectangle(pen, columnFooterRect.X, columnFooterRect.Y,
                                    columnFooterRect.Width, columnFooterRect.Height);

                    int totalIndex = 8;
                    if (gimnastika == Gimnastika.ZSG)
                    {
                        totalIndex = 6;
                    }
                    string text = getFormattedString(gr.Data, totalIndex, fmtTot);
                    g.DrawString(text, itemFont, blackBrush,
                                 columnFooterRect, Izvestaj.centerCenterFormat);

                    string fmtPen  = "F" + Opcije.Instance.BrojDecimalaPen;
                    string penalty = getFormattedString(gr.Data, totalIndex + 2, fmtPen);
                    if (penalty != String.Empty)
                    {
                        StringFormat format = new StringFormat();
                        format.Alignment     = StringAlignment.Near;
                        format.LineAlignment = StringAlignment.Center;
                        RectangleF penaltyRect = columnFooterRect;
                        penaltyRect.Offset(columnFooterRect.Width, 0);
                        g.DrawString("Pen. " + penalty, itemFont, blackBrush,
                                     penaltyRect, format);
                    }
                }
            }
        }
Exemple #3
0
 protected virtual bool shouldStartOnNewPage(ReportGrupa grupa,
                                             ReportGrupa prevGrupa)
 {
     return(false);
 }
Exemple #4
0
        protected void createListLayout(float groupHeaderHeight, float itemHeight,
                                        float groupFooterHeight,
                                        float afterGroupHeight, float newPageTopOffset, RectangleF contentBounds,
                                        float masterGroupHeaderHeight, float afterMasterGroupHeight)
        {
            float minHeight = masterGroupHeaderHeight + groupHeaderHeight + itemHeight;

            if (minHeight > contentBounds.Height)
            {
                throw new SmallPageSizeException();
            }

            int   pageNum = firstPageNum;
            float y       = StartY;

            listLayout = new Dictionary <int, List <ReportGroupPart> >();

            ReportGrupa gr = null;
            ReportGrupa prevGrupa;

            for (int i = 0; i < groups.Count; i++)
            {
                prevGrupa = gr;
                gr        = groups[i];

                int recNum = gr.Start;
                int endRec = gr.Start + gr.Count;

                while (recNum < endRec)
                {
                    bool newPage = false;
                    if (recNum == gr.Start && shouldStartOnNewPage(gr, prevGrupa) ||
                        (y + minHeight > contentBounds.Bottom))
                    {
                        newPage = true;
                        pageNum++;
                        y = contentBounds.Y + newPageTopOffset;
                    }

                    float groupPartY = y;

                    bool masterGroupHeader = false;
                    bool groupHeader       = false;
                    if (recNum == gr.Start)
                    {
                        if (masterGroupHeaderHeight != 0f)
                        {
                            if (prevGrupa == null ||
                                !object.ReferenceEquals(gr.MasterGrupa, prevGrupa.MasterGrupa))
                            {
                                if (prevGrupa != null && !newPage)
                                {
                                    y         += afterMasterGroupHeight;
                                    groupPartY = y;
                                }
                                masterGroupHeader = true;
                                y += masterGroupHeaderHeight;
                            }
                        }

                        groupHeader = true;
                        y          += groupHeaderHeight;
                    }
                    else if (newPage)
                    {
                        if (startNewPageWithGroupHeader)
                        {
                            groupHeader = true;
                            y          += groupHeaderHeight;
                        }
                    }

                    int numItems;
                    if (y + (endRec - recNum) * itemHeight <= contentBounds.Bottom)
                    {
                        numItems = endRec - recNum;
                    }
                    else
                    {
                        numItems = (int)Math.Floor((contentBounds.Bottom - y) / itemHeight);
                    }

                    bool            groupFooter = recNum + numItems >= endRec;
                    ReportGroupPart part        = new ReportGroupPart(pageNum, i, recNum,
                                                                      numItems, groupPartY, groupHeader, masterGroupHeader, groupFooter);

                    List <ReportGroupPart> partList;
                    if (listLayout.ContainsKey(pageNum))
                    {
                        partList = listLayout[pageNum];
                    }
                    else
                    {
                        partList = new List <ReportGroupPart>();
                        listLayout.Add(pageNum, partList);
                    }
                    partList.Add(part);

                    y      += numItems * itemHeight;
                    recNum += numItems;
                }
                y += groupFooterHeight;
                y += afterGroupHeight;
            }
            this.lastPageNum = pageNum;
            this.endY        = y;
        }
Exemple #5
0
 protected virtual bool shouldStartOnNewPage(ReportGrupa grupa, 
     ReportGrupa prevGrupa)
 {
     return false;
 }