using System; using System.Collections; using System.ComponentModel; using System.Drawing; using DevExpress.XtraReports.UI; using DevExpress.XtraReports.UI; using BeWo.Report.ReportObjects; using BeWo.Report; using System.Collections.Generic; using BeWo.Service.DCEntityMapper; using BeWo.Service.Plugins; using BS.Shared; using BS.Shared.DataContracts; using BS.Shared.Services; namespace SPZLeverkusen { public partial class StundenzettelJugendamt : DevExpress.XtraReports.UI.XtraReport, IBeWoReport { public StundenzettelJugendamt() { InitializeComponent(); } public void SetReportDataSource(ServicesOverviewRO pRO) { if (pRO.Services != null) { List servicesBillable = new List(); foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services) { if (s.IsBillable) servicesBillable.Add(s); } pRO.Services = servicesBillable; } if (pRO.CostBearer2SupportConceptList != null && pRO.CostBearer2SupportConceptList.Count > 0) { var dc = MapperFactory.SupportConceptCostBearerRelDC_CostBearer2SupportConcept.MapToNewDC(pRO .CostBearer2SupportConceptList[0]); var calc = PluginLoader.FindClass(); pRO.ApprovedFLSPerMonth = GetApprovedHoursPerMonth(calc, dc, pRO); } this.bindingSource1.DataSource = pRO; } private decimal GetApprovedHoursPerMonth(Calculations calc, SupportConceptCostBearerRelDC c2s, ServicesOverviewRO pRO) { foreach (var scap in c2s.ApprovalPeriodList) { if (scap.StartDate <= pRO.EndDate && scap.EndDate >= pRO.StartDate) { if (scap.ApprovedBEInterval.HasValue && scap.ApprovedBEPerInterval.HasValue) { if (scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Monthly) { return scap.ApprovedBEPerInterval.Value; } else if (scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Quarterly) { return scap.ApprovedBEPerInterval.Value / 3; } else if (scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.HalfYearly) { return scap.ApprovedBEPerInterval.Value / 6; } else if (scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Yearly) { return scap.ApprovedBEPerInterval.Value / 12; } } } } var flsProWoche = calc.GetApprovedHoursPerWeek(c2s, c2s.StartDate.Value) ?? 0; return flsProWoche * 4.34m; } } }