using System; using System.Linq; using BeWo.Report; using BeWo.Report.ReportObjects; using BS.Shared.Extensions; namespace BeWoRichartz { public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport { public Stundenzettel() { InitializeComponent(); } public void SetReportDataSource(ServicesOverviewRO pRO) { if (pRO.Services != null) { var servicesBillable = pRO.Services.Where(s => s.IsBillable).ToList(); var parsedMonthDate = DateTime.Parse(String.Format("01. {0} {1}", pRO.Month, pRO.Year)); var tageImMonat = DateTime.DaysInMonth(parsedMonthDate.Year, parsedMonthDate.Month); for (var i = 0; i < tageImMonat; i++) { var date = new DateTime(pRO.Year, parsedMonthDate.Month, i + 1); if (!servicesBillable.Any(a => a.StartDate.CompareShortDates(date))) { servicesBillable.Add(new ServicesOverviewRO.ServiceDetail { StartDate = date }); } } pRO.Services = servicesBillable.OrderBy(o => o.StartDate).ToList(); } //if (IstBewilligt(pRO)) //{ // lblFLSPerWeek.Text = String.Format("{0:0.00}", pRO.ApprovedFLSPerWeek); //} //else //{ // lblFLSPerWeek.Text = ""; //} bool hatGruppen = false; if (pRO.Services != null) { foreach (var sd in pRO.Services) { if (sd.Minutes > 0) { sd.Notice5 = "E"; if (sd.IsGroup) { sd.Notice5 = String.Format("GR ({0:0})", sd.CustomerCount); hatGruppen = true; } } } } if (pRO.TotalFLMBillable > 0) { cellGesamt.Text = String.Format("{0:0.##}", pRO.TotalFLMBillable); } if (!hatGruppen) { lblHatGruppen.Text = "X"; } bindingSource1.DataSource = pRO; } private bool IstBewilligt(ServicesOverviewRO pRo) { if (pRo.CostBearer2SupportConceptList.Count > 0) { if (pRo.CostBearer2SupportConceptList[0].ApprovedStartDate.HasValue) { return true; } } return false; } } }