using System; using System.Collections.Generic; using BeWo.Report; using BeWo.Report.ReportObjects; using BS.Shared; namespace Hiba { public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport { public Stundenzettel() { InitializeComponent(); } public void SetReportDataSource(ServicesOverviewRO pRO) { String hhName = ""; bool isHaushaltshilfe = false; bool isFls = false; if (pRO.Services != null) { List servicesBillable = new List(); foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services) { if (s.IsBillable) { ServicesOverviewRO.CreateGoalList(s); servicesBillable.Add(s); if (s.ServiceCategory == "Aktivierende Haushaltshilfe") { isHaushaltshilfe = true; hhName = s.EmployeeFullname; } else { isFls = true; } if (!String.IsNullOrWhiteSpace(s.GefahreneKilometer) && s.GefahreneKilometer != "0") { s.GefahreneKilometer = "x"; } else { s.GefahreneKilometer = ""; } } } pRO.Services = servicesBillable; if (isHaushaltshilfe && !isFls) { lblTitel.Text = "Quittierungsbeleg über aktivierende Haushaltshilfe"; if (!String.IsNullOrEmpty(hhName)) { pRO.MainAttendant = hhName; } } } SetzeBewilligung(pRO, isHaushaltshilfe && !isFls); this.bindingSource1.DataSource = pRO; } private void SetzeBewilligung(ServicesOverviewRO pRo, bool isHaushaltshilfe) { string text = "Bewilligte Fachleistungsstunden wöchentlich:"; if (pRo.CostBearer2SupportConceptList != null && pRo.CostBearer2SupportConceptList.Count > 0) { var c2s = pRo.CostBearer2SupportConceptList[0]; foreach (var scap in c2s.ApprovalPeriodList) { if (scap.ServiceCategory == null || ((!isHaushaltshilfe && !scap.ServiceCategory.Name.Contains("Haushaltshilfe")) || (isHaushaltshilfe && scap.ServiceCategory.Name.Contains("Haushaltshilfe")))) { if (scap.StartDate <= pRo.EndDate && scap.EndDate >= pRo.StartDate) { if (scap.ApprovedBEInterval.HasValue && scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Weekly) { text = "Bewilligte Fachleistungsstunden wöchentlich:"; pRo.ApprovedFLSPerWeek = scap.ApprovedBEPerInterval ?? 0; } if (scap.ApprovedBEInterval.HasValue && scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Monthly) { text = "Bewilligte Fachleistungsstunden monatlich:"; pRo.ApprovedFLSPerWeek = scap.ApprovedBEPerInterval ?? 0; } if (scap.ApprovedBEInterval.HasValue && scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Yearly) { text = "Bewilligte Fachleistungsstunden jährlich:"; pRo.ApprovedFLSPerWeek = scap.ApprovedBEPerInterval ?? 0; } } } } } if (isHaushaltshilfe) { text = text.Replace("Fachleistungsstunden", "Stunden"); } lblBewilligt.Text = text; } } }