protected override void drawGroupHeader(Graphics g, int groupId, RectangleF groupHeaderRect) { float xClan = columns[0].X; if (clanId == null) { ReportGrupa gr = groups[groupId]; string sifNaz = (string)gr.Data[0]; float xOffset = xClan - groupHeaderRect.X; groupHeaderRect.X += xOffset; groupHeaderRect.Width -= xOffset; g.DrawString(sifNaz, groupTitleFont, blackBrush, groupHeaderRect); } else { RectangleF grupaHeaderRect = new RectangleF(columns[0].X, groupHeaderRect.Y, columns[0].Width, groupHeaderRect.Height); StringFormat grupaFormat = columns[0].ItemRectFormat; g.DrawString("Grupa", itemFont, blackBrush, grupaHeaderRect, grupaFormat); } RectangleF dolazakHeaderRect = new RectangleF(columns[1].X, groupHeaderRect.Y, columns[1].Width, groupHeaderRect.Height); StringFormat dolazakFormat = columns[1].ItemRectFormat; g.DrawString("Vreme dolaska", itemFont, blackBrush, dolazakHeaderRect, dolazakFormat); float y = groupHeaderRect.Y + groupTitleFont.GetHeight(g); using (Pen pen = new Pen(Color.Black, 1 / 72f * 0.25f)) { g.DrawLine(pen, new PointF(xClan, y), new PointF(groupHeaderRect.X + groupHeaderRect.Width, y)); } }
protected override void drawGroupHeader(Graphics g, int groupId, RectangleF groupHeaderRect) { ReportGrupa gr = groups[groupId]; int godina = (int)gr.Data[0]; int mesec = (int)gr.Data[1]; string godMes = new DateTime(godina, mesec, 1).ToString("MMMM yyyy"); g.DrawString(godMes, groupTitleFont, blackBrush, groupHeaderRect); StringFormat fmt = new StringFormat(); fmt.Alignment = StringAlignment.Far; string msg; if (!samoNedostajuceUplate) { msg = "Ima uplatu (broj treninga)"; } else { msg = "Broj treninga"; } g.DrawString(msg, itemFont, blackBrush, groupHeaderRect, fmt); float xClan = columns[0].X; float y = groupHeaderRect.Y + groupTitleFont.GetHeight(g); using (Pen pen = new Pen(Color.Black, 1 / 72f * 0.25f)) { g.DrawLine(pen, new PointF(xClan, y), new PointF(groupHeaderRect.X + groupHeaderRect.Width, y)); } }
private void fetchItems(DateTime from, DateTime to) { if (clanId != null) { items = DAOFactoryFactory.DAOFactory.GetDolazakNaTreningDAO() .getEvidencijaTreningaReportItems(clanId.Value, from, to, grupe); groups = new List <ReportGrupa>(); groups.Add(new ReportGrupa(0, items.Count)); } else { items = DAOFactoryFactory.DAOFactory.GetDolazakNaTreningDAO() .getEvidencijaTreningaReportItems(from, to, grupe); groups = DAOFactoryFactory.DAOFactory.GetDolazakNaTreningDAO() .getEvidencijaTreningaReportGrupe(from, to, grupe); } int start = 0; for (int i = 0; i < groups.Count; i++) { ReportGrupa g = groups[i]; g.Start = start; start += g.Count; } addRedBrojClana(); }
private void createGroups() { groups = new List <ReportGrupa>(); int groupStart = 0; int i = 0; while (i < items.Count) { object[] itemsRow = items[i]; DateTime datum, currDatum; datum = currDatum = ((DateTime)itemsRow[4]).Date; decimal ukupanIznos = 0; int numGroupItems = 0; while (currDatum == datum) { ukupanIznos += (decimal)itemsRow[3]; numGroupItems++; if (++i < items.Count) { itemsRow = items[i]; currDatum = ((DateTime)itemsRow[4]).Date; } else { break; } } object[] data = new object[] { datum, ukupanIznos }; ReportGrupa g = new ReportGrupa(data, groupStart, numGroupItems); groups.Add(g); groupStart += numGroupItems; } }
protected override void drawGroupHeader(Graphics g, int groupId, RectangleF groupHeaderRect) { ReportGrupa gr = groups[groupId]; string sifra = ((SifraGrupe)gr.Data[0]).Value; string naziv = (string)gr.Data[1]; string sifNaz = sifra + " - " + naziv; decimal ukupanIznos = (decimal)gr.Data[2]; float xClan = columns[0].X; float xOffset = xClan - groupHeaderRect.X; groupHeaderRect.X += xOffset; groupHeaderRect.Width -= xOffset; g.DrawString(sifNaz, groupTitleFont, blackBrush, groupHeaderRect); StringFormat clanarinaFormat = columns[2].ItemRectFormat; g.DrawString(ukupanIznos.ToString("F2"), groupTitleFont, blackBrush, groupHeaderRect, clanarinaFormat); float y = groupHeaderRect.Y + groupTitleFont.GetHeight(g); using (Pen pen = new Pen(Color.Black, 1 / 72f * 0.25f)) { g.DrawLine(pen, new PointF(xClan, y), new PointF(groupHeaderRect.Right, y)); } }
private void fetchItems() { IDictionary <int, Mesto> mestaMap = DAOFactoryFactory.DAOFactory.GetMestoDAO().getMestaMap(); if (ceoIzvestaj) { items = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO() .getUplateClanovaReportItems(-1); } else { items = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO() .getUplateClanovaReportItems(idClana); } if (ceoIzvestaj) { groups = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO() .getUplateClanovaReportGroups(-1, mestaMap); } else { groups = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO() .getUplateClanovaReportGroups(idClana, mestaMap); } int start = 0; for (int i = 0; i < groups.Count; i++) { ReportGrupa g = groups[i]; g.Start = start; start += g.Count; } }
protected override void drawGroupHeader(Graphics g, int groupId, RectangleF groupHeaderRect) { ReportGrupa gr = groups[groupId]; string clan = (string)gr.Data[0]; g.DrawString(clan, groupTitleFont, blackBrush, groupHeaderRect); drawItemsHeader(g, groupHeaderRect.Y + groupTitleHeight, true); }
private void addRedBrojClana() { for (int i = 0; i < groups.Count; i++) { ReportGrupa g = groups[i]; for (int j = 0; j < g.Count; j++) { object[] item = items[g.Start + j]; item[0] = String.Format("{0} {1}", j + 1, item[0]); } } }
private void fetchItems() { IDictionary <int, Mesto> mestaMap = DAOFactoryFactory.DAOFactory.GetMestoDAO().getMestaMap(); items = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO() .getDnevniPrihodiClanoviReportItems(fromDate, toDate, grupe, mestaMap); groups = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO() .getDnevniPrihodiClanoviReportGrupeDanGrupa(fromDate, toDate, grupe); masterGroups = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO() .getDnevniPrihodiClanoviReportGrupeDan(fromDate, toDate, grupe); int start = 0; for (int i = 0; i < groups.Count; i++) { ReportGrupa g = groups[i]; g.Start = start; start += g.Count; } int j = 0; for (int i = 0; i < masterGroups.Count; i++) { ReportGrupa mg = masterGroups[i]; ReportGrupa g = groups[j]; int startDetailGroup = j; int detailBrojClanova = g.Count; while (detailBrojClanova <= mg.Count) { g.MasterGrupa = mg; if (++j < groups.Count) { g = groups[j]; detailBrojClanova += g.Count; } else { break; } } mg.DetailGrupeStart = startDetailGroup; mg.DetailGrupeCount = j - startDetailGroup; } addRedBrojClana(); }
protected override void drawGroupTitle(Graphics g, int groupId, RectangleF groupHeaderRect) { ReportGrupa gr = groups[groupId]; DateTime datumUplate = (DateTime)gr.Data[0]; decimal ukupanIznos = (decimal)gr.Data[1]; g.DrawString(datumUplate.ToShortDateString(), groupTitleFont, blackBrush, groupHeaderRect); StringFormat fmt = new StringFormat(); fmt.Alignment = StringAlignment.Far; fmt.LineAlignment = StringAlignment.Near; g.DrawString(ukupanIznos.ToString("F2"), groupTitleFont, blackBrush, groupHeaderRect, fmt); float y = groupHeaderRect.Y + groupTitleHeight; using (Pen pen = new Pen(Color.Black, 1 / 72f * 1f)) { g.DrawLine(pen, new PointF(groupHeaderRect.X, y), new PointF(groupHeaderRect.Right, y)); } }
protected override void drawGroupHeader(Graphics g, int groupId, RectangleF groupHeaderRect) { ReportGrupa gr = groups[groupId]; string sifra = ((SifraGrupe)gr.Data[0]).Value; string naziv = (string)gr.Data[1]; string sifNaz = /*sifra + " - " +*/ naziv; float xClan = columns[0].X; float xOffset = xClan - groupHeaderRect.X; groupHeaderRect.X += xOffset; groupHeaderRect.Width -= xOffset; g.DrawString(sifNaz, groupTitleFont, blackBrush, groupHeaderRect); float y = groupHeaderRect.Y + groupTitleFont.GetHeight(g); using (Pen pen = new Pen(Color.Black, 1 / 72f * 0.25f)) { g.DrawLine(pen, new PointF(xClan, y), new PointF(groupHeaderRect.X + groupHeaderRect.Width, y)); } }
private void fetchItems() { IDictionary <int, Mesto> mestaMap = DAOFactoryFactory.DAOFactory.GetMestoDAO().getMestaMap(); items = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO() .getPeriodicniPrihodiUplateReportItems(fromDate, toDate, grupe, mestaMap); groups = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO() .getPeriodicniPrihodiUplateReportGrupe(fromDate, toDate, grupe); int start = 0; for (int i = 0; i < groups.Count; i++) { ReportGrupa g = groups[i]; g.Start = start; start += g.Count; } addRedBrojClana(); }
private void fetchItems() { IDictionary <int, Mesto> mestaMap = DAOFactoryFactory.DAOFactory.GetMestoDAO().getMestaMap(); IDictionary <SifraGrupe, int> duplikati = new Dictionary <SifraGrupe, int>(); items = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO() .getAktivniClanoviPoGrupamaReportItems(fromDate, toDate, grupe, mestaMap, duplikati); groups = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO() .getAktivniClanoviPoGrupamaReportGrupe(fromDate, toDate, grupe, duplikati); int start = 0; for (int i = 0; i < groups.Count; i++) { ReportGrupa g = groups[i]; g.Start = start; start += g.Count; } addRedBrojClana(); }
protected override void drawMasterGroupHeader(Graphics g, int groupId, RectangleF masterGroupHeaderRect) { ReportGrupa gr = groups[groupId]; ReportGrupa mg = gr.MasterGrupa; DateTime datumUplate = (DateTime)mg.Data[0]; decimal ukupanIznos = (decimal)mg.Data[1]; g.DrawString(datumUplate.ToShortDateString(), masterGroupTitleFont, blackBrush, masterGroupHeaderRect); StringFormat clanarinaFormat = columns[2].ItemRectFormat; g.DrawString(ukupanIznos.ToString("F2"), masterGroupTitleFont, blackBrush, masterGroupHeaderRect, clanarinaFormat); float y = masterGroupHeaderRect.Y + masterGroupTitleFont.GetHeight(g); using (Pen pen = new Pen(Color.Black, 1 / 72f * 1f)) { g.DrawLine(pen, new PointF(masterGroupHeaderRect.X, y), new PointF(masterGroupHeaderRect.Right, y)); } }
private void createGroups() { groups = new List <ReportGrupa>(); int groupId = 0; int groupStart = 0; int i = 0; while (i < items.Count) { object[] itemsRow = items[i]; short year, currYear; short month, currMonth; year = currYear = (short)itemsRow[4]; month = currMonth = (short)itemsRow[5]; decimal ukupanIznos = 0; int numGroupItems = 0; while (currMonth == month && currYear == year) { ukupanIznos += (decimal)itemsRow[3]; numGroupItems++; if (++i < items.Count) { itemsRow = items[i]; currYear = (short)itemsRow[4]; currMonth = (short)itemsRow[5]; } else { break; } } object[] data = new object[] { year, month, ukupanIznos }; ReportGrupa g = new ReportGrupa(data, groupStart, numGroupItems); groups.Add(g); groupId++; groupStart += numGroupItems; } }
protected override void drawGroupTitle(Graphics g, int groupId, RectangleF groupHeaderRect) { ReportGrupa gr = groups[groupId]; int godina = (short)gr.Data[0]; int mesec = (short)gr.Data[1]; decimal ukupanIznos = (decimal)gr.Data[2]; string godMes = new DateTime(godina, mesec, 1).ToString("MMM yyyy"); g.DrawString(godMes, groupTitleFont, blackBrush, groupHeaderRect); StringFormat fmt = new StringFormat(); fmt.Alignment = StringAlignment.Far; fmt.LineAlignment = StringAlignment.Near; g.DrawString(ukupanIznos.ToString("F2"), groupTitleFont, blackBrush, groupHeaderRect, fmt); float y = groupHeaderRect.Y + groupTitleFont.GetHeight(g); using (Pen pen = new Pen(Color.Black, 1 / 72f * 1f)) { g.DrawLine(pen, new PointF(groupHeaderRect.X, y), new PointF(groupHeaderRect.Right, y)); } }
protected void createListLayout(float groupHeaderHeight, float itemHeight, 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; } int numItems; if (y + (endRec - recNum) * itemHeight <= contentBounds.Bottom) { numItems = endRec - recNum; } else { numItems = (int)Math.Floor((contentBounds.Bottom - y) / itemHeight); } ReportGroupPart part = new ReportGroupPart(pageNum, i, recNum, numItems, groupPartY, groupHeader, masterGroupHeader); 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 += afterGroupHeight; } this.lastPageNum = pageNum; this.endY = y; }
protected virtual bool shouldStartOnNewPage(ReportGrupa grupa, ReportGrupa prevGrupa) { return(false); }