diff --git a/ReportImp/FeidPartnerReports/CustomReportCreator.cs b/ReportImp/FeidPartnerReports/CustomReportCreator.cs index 0c5bb4a02..a657ced76 100644 --- a/ReportImp/FeidPartnerReports/CustomReportCreator.cs +++ b/ReportImp/FeidPartnerReports/CustomReportCreator.cs @@ -185,9 +185,17 @@ namespace FeidPartnerReports DateTime reportMonth = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); if (qro.Rows.Count > 0 && qro.Rows[0].Field1 != null && DateTime.TryParse(qro.Rows[0].Field1.ToString(), out DateTime parsedMonth)) + { reportMonth = new DateTime(parsedMonth.Year, parsedMonth.Month, 1); + } - var ro = PersonalplanungRO.Create(reportMonth); + string costBearerFilter = null; + if (qro.Rows.Count > 0 && qro.Rows[0].Field2.ToString() != "0") + { + costBearerFilter = qro.Rows[0].Field2.ToString(); + } + + var ro = PersonalplanungRO.Create(reportMonth, costBearerFilter); var report = new FeidPartnerReports.PersonalplanungReport(); report.SetReportDataSource(ro); return report; diff --git a/ReportImp/FeidPartnerReports/PersonalplanungRO.cs b/ReportImp/FeidPartnerReports/PersonalplanungRO.cs index 5d38acb25..c0f02572b 100644 --- a/ReportImp/FeidPartnerReports/PersonalplanungRO.cs +++ b/ReportImp/FeidPartnerReports/PersonalplanungRO.cs @@ -17,7 +17,7 @@ namespace FeidPartnerReports public DateTime ReportMonth { get; set; } public List Rows { get; set; } = new List(); - public static PersonalplanungRO Create(DateTime reportMonth) + public static PersonalplanungRO Create(DateTime reportMonth, string costBearerFilter = null) { var ro = new PersonalplanungRO(); ro.ReportMonth = reportMonth; @@ -138,13 +138,17 @@ namespace FeidPartnerReports foreach (var entry in cb2scEntries.Values) { var cb2sc = entry.Cb2Sc; + if (!MatchesCostBearerFilter(cb2sc, costBearerFilter)) + { + continue; + } var sc = cb2sc.SupportConcept; if (sc == null || sc.IsActive == ActivationTypeId.Deleted || sc.IsActive == ActivationTypeId.Archived) continue; var customer = sc.Customer; - if (customer.Person.FirstNameLastName.Contains("Häusser") && empName.Contains("Alena")) - { - var test = 1; - } + //if (customer.Person.FirstNameLastName.Contains("Häusser") && empName.Contains("Alena")) + //{ + // var test = 1; + //} if (customer == null || customer.IsActive != ActivationTypeId.Active) continue; if (customer.TerminationDate.HasValue && customer.TerminationDate.Value < monthStart) continue; @@ -172,11 +176,8 @@ namespace FeidPartnerReports { var allRecords = DAOFactory.SearchDAO.FindServiceRecordsInSpan(cb2sc.Oid.Value, new DateTimeSpan(serviceRecordStart, monthEnd)); // Gruppenbuchungen existieren pro beteiligtem MA als eigener Record mit gleicher GroupOid -> nur einmal zählen - decimal gruppeMinGesamt = allRecords? - .Where(sr => sr.GroupOid.HasValue) - .GroupBy(sr => sr.GroupOid.Value) - .Select(g => g.First()) - .Sum(sr => sr.RoundedDuration) ?? 0m; + decimal gruppeMinGesamt = allRecords?.Where(sr => sr.GroupOid.HasValue).GroupBy(sr => sr.GroupOid.Value) + .Select(g => g.First()).Sum(sr => sr.RoundedDuration) ?? 0m; if (weeksInPeriod > 0) { avgGruppeGesamtStdProWoche = (gruppeMinGesamt / 60m) / weeksInPeriod; @@ -252,6 +253,47 @@ namespace FeidPartnerReports return ro; } + // Kostenträger-Filter: leer/"alle" = kein Filter; numerisch = Vergleich per Oid, sonst Namens-Teilstring + private static bool MatchesCostBearerFilter(CostBearer2SupportConcept cb2sc, string filter) + { + if (string.IsNullOrWhiteSpace(filter)) + { + return true; + } + + filter = filter.Trim(); + if (string.Equals(filter, "alle", StringComparison.OrdinalIgnoreCase) || filter == "*") + { + return true; + } + + try + { + var costBearer = cb2sc.CostBearer; + if (costBearer == null) + { + return false; + } + + if (long.TryParse(filter, out long oid)) + { + // Query-Parameter vom Typ Organisation liefert die Organisation-Oid; 0 = keine Auswahl -> kein Filter + if (oid == 0) + { + return true; + } + return costBearer.Organisation?.Oid == oid; + } + + var name = costBearer.Organisation?.Name ?? ""; + return name.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0; + } + catch + { + return false; + } + } + // Bewilligte Std/Woche für explizite Betreuungsschlüssel-Zuordnung private static decimal CalculateBewilligtSp2e(SupportConceptApprovalPeriod scap, SupportConceptApprovalPeriod2Employee sp2e, CostBearer2SupportConcept cb2sc) { diff --git a/ReportImp/FeidPartnerReports/PersonalplanungReport.Designer.cs b/ReportImp/FeidPartnerReports/PersonalplanungReport.Designer.cs index 9f658e03b..14207f1c8 100644 --- a/ReportImp/FeidPartnerReports/PersonalplanungReport.Designer.cs +++ b/ReportImp/FeidPartnerReports/PersonalplanungReport.Designer.cs @@ -93,6 +93,7 @@ namespace FeidPartnerReports this.xrTableCell2 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell3 = new DevExpress.XtraReports.UI.XRTableCell(); this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); + this.xrTableCell4 = new DevExpress.XtraReports.UI.XRTableCell(); ((System.ComponentModel.ISupportInitialize)(this.xrTableDetail)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTableVertrag)).BeginInit(); @@ -260,18 +261,18 @@ namespace FeidPartnerReports this.cellAuslastungNext.Name = "cellAuslastungNext"; this.cellAuslastungNext.StylePriority.UseTextAlignment = false; this.cellAuslastungNext.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; - this.cellAuslastungNext.Weight = 0.88930293053552056D; + this.cellAuslastungNext.Weight = 0.78619821607739671D; // // cellEnddatum // - this.cellEnddatum.Borders = DevExpress.XtraPrinting.BorderSide.Right; + this.cellEnddatum.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Right))); this.cellEnddatum.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "EnddatumFormatted")}); this.cellEnddatum.Name = "cellEnddatum"; this.cellEnddatum.StylePriority.UseBorders = false; this.cellEnddatum.StylePriority.UseTextAlignment = false; this.cellEnddatum.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; - this.cellEnddatum.Weight = 0.78619781996257987D; + this.cellEnddatum.Weight = 0.88930253442070373D; // // GroupHeader1 // @@ -290,7 +291,7 @@ namespace FeidPartnerReports // xrTable1 // this.xrTable1.Font = new DevExpress.Drawing.DXFont("Arial", 8F); - this.xrTable1.LocationFloat = new DevExpress.Utils.PointFloat(631.036F, 21.99999F); + this.xrTable1.LocationFloat = new DevExpress.Utils.PointFloat(635.0001F, 21.99999F); this.xrTable1.Name = "xrTable1"; this.xrTable1.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] { this.xrTableRow1, @@ -604,7 +605,8 @@ namespace FeidPartnerReports this.xrTableRow3.Cells.AddRange(new DevExpress.XtraReports.UI.XRTableCell[] { this.xrTableCell10, this.cellHDieserMonat, - this.cellHNaechsterMonat}); + this.cellHNaechsterMonat, + this.xrTableCell4}); this.xrTableRow3.Name = "xrTableRow3"; this.xrTableRow3.Weight = 0.6D; // @@ -636,8 +638,7 @@ namespace FeidPartnerReports // // cellHNaechsterMonat // - this.cellHNaechsterMonat.Borders = ((DevExpress.XtraPrinting.BorderSide)((((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Top) - | DevExpress.XtraPrinting.BorderSide.Right) + this.cellHNaechsterMonat.Borders = ((DevExpress.XtraPrinting.BorderSide)(((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Top) | DevExpress.XtraPrinting.BorderSide.Bottom))); this.cellHNaechsterMonat.Font = new DevExpress.Drawing.DXFont("Arial", 8F, DevExpress.Drawing.DXFontStyle.Bold); this.cellHNaechsterMonat.Multiline = true; @@ -646,7 +647,7 @@ namespace FeidPartnerReports this.cellHNaechsterMonat.StylePriority.UseFont = false; this.cellHNaechsterMonat.StylePriority.UseTextAlignment = false; this.cellHNaechsterMonat.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; - this.cellHNaechsterMonat.Weight = 4.9552107397773382D; + this.cellHNaechsterMonat.Weight = 4.0785215792751845D; // // xrRowHeader2 // @@ -830,7 +831,8 @@ namespace FeidPartnerReports // // cellHEnddatum // - this.cellHEnddatum.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Right | DevExpress.XtraPrinting.BorderSide.Bottom))); + this.cellHEnddatum.Borders = ((DevExpress.XtraPrinting.BorderSide)(((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Right) + | DevExpress.XtraPrinting.BorderSide.Bottom))); this.cellHEnddatum.Font = new DevExpress.Drawing.DXFont("Arial", 8F, DevExpress.Drawing.DXFontStyle.Bold); this.cellHEnddatum.Name = "cellHEnddatum"; this.cellHEnddatum.StylePriority.UseBorders = false; @@ -944,6 +946,20 @@ namespace FeidPartnerReports // this.bindingSource1.DataSource = typeof(FeidPartnerReports.PersonalplanungRow); // + // xrTableCell4 + // + this.xrTableCell4.Borders = ((DevExpress.XtraPrinting.BorderSide)((((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Top) + | DevExpress.XtraPrinting.BorderSide.Right) + | DevExpress.XtraPrinting.BorderSide.Bottom))); + this.xrTableCell4.Font = new DevExpress.Drawing.DXFont("Arial", 8F, DevExpress.Drawing.DXFontStyle.Bold); + this.xrTableCell4.Multiline = true; + this.xrTableCell4.Name = "xrTableCell4"; + this.xrTableCell4.StylePriority.UseBorders = false; + this.xrTableCell4.StylePriority.UseFont = false; + this.xrTableCell4.StylePriority.UseTextAlignment = false; + this.xrTableCell4.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; + this.xrTableCell4.Weight = 0.8766891605021534D; + // // PersonalplanungReport // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { @@ -1052,5 +1068,6 @@ namespace FeidPartnerReports private DevExpress.XtraReports.UI.XRTableCell xrTableCell1; private DevExpress.XtraReports.UI.XRTableCell xrTableCell2; private DevExpress.XtraReports.UI.XRTableCell xrTableCell3; + private DevExpress.XtraReports.UI.XRTableCell xrTableCell4; } }