using System.Collections.Generic; using System.Linq; using BeWo.Report; using BeWo.Report.ReportObjects; using DevExpress.XtraPrinting; namespace BeWo.SHGSchwerte { public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport { public Stundenzettel() { InitializeComponent(); } public void SetReportDataSource(ServicesOverviewRO pRO) { if (pRO.Services != null) { var servicesBillable = new List(); foreach (var s in pRO.Services) { if (s.IsBillable) { if (s.IsGroup) { s.FLSQualifiedString = string.Format("G({0})", s.CustomerCount); } else { s.FLSQualifiedString = "D"; } servicesBillable.Add(s); } } pRO.Services = servicesBillable; } if (pRO.Abwesenheiten != null && pRO.Abwesenheiten.Count > 0) { lblKeine.Visible = false; var c = 0; var r1 = abwesenheitsTable.Rows[0]; var pi = new PaddingInfo(2, 5, 0, 0); foreach (var abwesenheit in pRO.Abwesenheiten) { var row = c == 0 ? abwesenheitsTable.Rows[0] : abwesenheitsTable.InsertRowBelow(r1); row.Cells[0].Text = abwesenheit.Start.Value.ToShortDateString(); row.Cells[0].TextAlignment = TextAlignment.MiddleCenter; row.Cells[0].Padding = pi; if (abwesenheit.End.HasValue) { row.Cells[1].Text = abwesenheit.End.Value.ToShortDateString(); } else { row.Cells[1].Text = ""; } row.Cells[1].TextAlignment = TextAlignment.MiddleCenter; row.Cells[1].Padding = pi; row.Cells[2].Text = abwesenheit.AbsenceReason.Description; row.Cells[2].TextAlignment = TextAlignment.MiddleLeft; row.Cells[2].Padding = pi; c++; } } else { lblKeine.Location = abwHeaderTable.Location; abwHeaderTable.Visible = false; abwesenheitsTable.Visible = false; lblKeine.Visible = true; } bindingSource1.DataSource = pRO; } } }