protected override void doSetupContent(Graphics g) { System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("Soko.Resources.PreviewResursi", this.GetType().Assembly); string ukupnoClanovaText = resourceManager.GetString("akt_clan_grupe_izv_uk_clan_caption"); ukupnoClanovaText += " " + fromDate.ToShortDateString() + " - " + toDate.ToShortDateString(); string ukupnoClanovaBroj = " " + lista.Items.Count; StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Far; float ukupnoClanovaHeight = Math.Max(ukupnoClanovaCaptionFont.GetHeight(g), ukupnoClanovaBrojFont.GetHeight(g)); RectangleF ukupnoClanovaRect = new RectangleF(contentBounds.X, contentBounds.Y + ukupnoClanovaHeight, contentBounds.Width, ukupnoClanovaHeight); ukupnoClanovaBrojReportText = new ReportText( ukupnoClanovaBroj, ukupnoClanovaBrojFont, blackBrush, ukupnoClanovaRect, format); ukupnoClanovaRect.Width -= g.MeasureString(ukupnoClanovaBroj, ukupnoClanovaBrojFont).Width; ukupnoClanovaCaptionReportText = new ReportText( ukupnoClanovaText, ukupnoClanovaCaptionFont, blackBrush, ukupnoClanovaRect, format); float listaStartOffset = 3 * ukupnoClanovaHeight; if (listaStartOffset > contentBounds.Height) { throw new SmallPageSizeException(); } lista.StartY = contentBounds.Y + listaStartOffset; lista.setupContent(g, contentBounds); lastPageNum = lista.LastPageNum; }
protected override void doSetupContent(Graphics g) { string ukupanPrihodText = "Ukupan prihod za period "; ukupanPrihodText += fromDate.ToShortDateString() + " - " + toDate.ToShortDateString(); decimal ukupanPrihod = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO() .getUkupanPrihod(fromDate, toDate, grupe); string ukupanPrihodIznos = " " + ukupanPrihod.ToString("F2"); StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Far; float ukupanPrihodHeight = Math.Max(ukupanPrihodCaptionFont.GetHeight(g), ukupanPrihodIznosFont.GetHeight(g)); RectangleF ukupanPrihodRect = new RectangleF(contentBounds.X, contentBounds.Y + ukupanPrihodHeight, contentBounds.Width, ukupanPrihodHeight); ukupanPrihodIznosReportText = new ReportText( ukupanPrihodIznos, ukupanPrihodIznosFont, blackBrush, ukupanPrihodRect, format); ukupanPrihodRect.Width -= g.MeasureString(ukupanPrihodIznos, ukupanPrihodIznosFont).Width; ukupanPrihodCaptionReportText = new ReportText( ukupanPrihodText, ukupanPrihodCaptionFont, blackBrush, ukupanPrihodRect, format); float listaStartOffset = 3 * ukupanPrihodHeight; if (listaStartOffset > contentBounds.Height) { throw new SmallPageSizeException(); } lista.StartY = contentBounds.Y + listaStartOffset; lista.setupContent(g, contentBounds); lastPageNum = lista.LastPageNum; }
protected override void doSetupContent(Graphics g) { float clanHeight = 0.0f; if (clanId != null) { Clan c = DAOFactoryFactory.DAOFactory.GetClanDAO().FindById(clanId.Value); string clan = Clan.formatPrezimeImeBrojDatumRodjAdresaMesto( c.Prezime, c.Ime, c.Broj, c.DatumRodjenja, String.Empty, String.Empty); StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Near; clanHeight = g.MeasureString("0", clanFont).Height; RectangleF clanRect = new RectangleF(contentBounds.X, contentBounds.Y + clanHeight, contentBounds.Width, clanHeight); clanReportText = new ReportText(clan, clanFont, blackBrush, clanRect, format); } float itemHeight = g.MeasureString("0", itemFont).Height; float listaStartOffset; if (clanId != null) { listaStartOffset = 2.5f * clanHeight; } else { listaStartOffset = 1f * itemHeight; } if (listaStartOffset > contentBounds.Height) { throw new SmallPageSizeException(); } lista.StartY = contentBounds.Y + listaStartOffset; lista.setupContent(g, contentBounds); lastPageNum = lista.LastPageNum; }
public override void drawHeader(Graphics g, int pageNum) { System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("Soko.Resources.SlikeResursi", this.GetType().Assembly); Image sokoImage = (Image)resourceManager.GetObject("slika_soko"); float upperHeight = headerBounds.Height / 2.1f; float lowerHeight = headerBounds.Height - upperHeight; RectangleF upperHeaderBounds = new RectangleF(headerBounds.Location, new SizeF(headerBounds.Width, upperHeight)); RectangleF lowerHeaderBounds = new RectangleF(new PointF(headerBounds.X, headerBounds.Y + upperHeight), new SizeF(headerBounds.Width, lowerHeight)); using (Pen pen = new Pen(Color.Black, 1 / 72f * 0.25f)) { g.DrawRectangle(pen, upperHeaderBounds.X, upperHeaderBounds.Y, upperHeaderBounds.Width, upperHeaderBounds.Height); } float pictureHeight = upperHeaderBounds.Height; float pictureWidth = pictureHeight * 1.2f; RectangleF pictureBounds = new RectangleF(headerBounds.X, headerBounds.Y, pictureWidth, pictureHeight); pictureBounds.Inflate(-0.05f * pictureWidth, -0.05f * pictureHeight); bool sokolskiCentar = finCelina != null && finCelina.Naziv.ToLower() == "sokolski centar"; if (!sokolskiCentar) { g.DrawImage(sokoImage, pictureBounds); } else { // TODO3: Crtanje okvira je potrebno samo dok se ne napravi slika za "sokolski centar" using (Pen pen = new Pen(Color.Black, 1 / 72f * 0.25f)) { g.DrawRectangle(pen, pictureBounds.X, pictureBounds.Y, pictureBounds.Width, pictureBounds.Height); } } resourceManager = new System.Resources.ResourceManager("Soko.Resources.PreviewResursi", this.GetType().Assembly); string sokDruVoj; if (!sokolskiCentar) { sokDruVoj = resourceManager.GetString("izvestaj_header_sok_dru_voj"); } else { sokDruVoj = "SOKOLSKI CENTAR"; } float sokDruVojHeight = sokDruVojFont.GetHeight(g); RectangleF sokDruVojRect = new RectangleF(headerBounds.X + pictureWidth, headerBounds.Y, headerBounds.Width - pictureWidth, sokDruVojHeight); ReportText sokDruVojReportText = new ReportText(sokDruVoj, sokDruVojFont, blackBrush, sokDruVojRect, sokDruVojFormat); string adresa = resourceManager.GetString("izvestaj_header_adresa"); float adresaHeight = adresaFont.GetHeight(g) * 1.2f; RectangleF adresaRect = new RectangleF(sokDruVojRect.X, sokDruVojRect.Y + sokDruVojRect.Height, sokDruVojRect.Width, adresaHeight); ReportText adresaReportText = new ReportText(adresa, adresaFont, blackBrush, adresaRect, adresaFormat); string telFaxMail = resourceManager.GetString("izvestaj_header_tel_fax_mail"); float telFaxMailHeight = telFaxMailFont.GetHeight(g) * 1.2f; RectangleF telFaxMailRect = new RectangleF(adresaRect.X, adresaRect.Y + adresaRect.Height, adresaRect.Width, telFaxMailHeight); ReportText telFaxMailReportText = new ReportText(telFaxMail, telFaxMailFont, blackBrush, telFaxMailRect, telFaxMailFormat); float titleHeight = titleFont.GetHeight(g); if (SubTitle != String.Empty) { titleHeight += subTitleFont.GetHeight(g) * 1.5f; } float titleY = lowerHeaderBounds.Y + (lowerHeaderBounds.Height - titleHeight); RectangleF titleRect = new RectangleF(lowerHeaderBounds.X, titleY, lowerHeaderBounds.Width, titleHeight); ReportText titleReportText = new ReportText(Title, titleFont, blackBrush, titleRect, titleFormat); ReportText subTitleReportText = null; if (SubTitle != String.Empty) { subTitleReportText = new ReportText(SubTitle, subTitleFont, blackBrush, titleRect, subTitleFormat); } sokDruVojReportText.draw(g); adresaReportText.draw(g); telFaxMailReportText.draw(g); titleReportText.draw(g); if (subTitleReportText != null) { subTitleReportText.draw(g); } }