From 9bad53b67fc057982f66a12e1c0c698afa680e61 Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 15 Jan 2026 10:46:26 +0100 Subject: [PATCH] =?UTF-8?q?LH=20Bad=20Kreuznach:=20FLS=20Soll/Ist=20Report?= =?UTF-8?q?=20zur=20Verf=C3=BCgung=20gestellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FLSSollIstReport.Designer.cs | 18 ++-- .../FLSSollIstWeeklyReport.Designer.cs | 13 +-- Report/ReportObjects/FLSSollIstReportRO.cs | 37 ++++++- .../CustomReportCreator.cs | 98 +++++++++++++++++++ .../LebenshilfeBadKreuznach.csproj | 10 ++ 5 files changed, 159 insertions(+), 17 deletions(-) diff --git a/Report/DefaultReports/FLSSollIstReport.Designer.cs b/Report/DefaultReports/FLSSollIstReport.Designer.cs index 0a3606140..7910e87b0 100644 --- a/Report/DefaultReports/FLSSollIstReport.Designer.cs +++ b/Report/DefaultReports/FLSSollIstReport.Designer.cs @@ -59,6 +59,7 @@ namespace BeWo.Report.DefaultReports this.xrTableCell8 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell10 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell11 = new DevExpress.XtraReports.UI.XRTableCell(); + this.formattingRuleDiffNegativ = new DevExpress.XtraReports.UI.FormattingRule(); this.ReportHeader = new DevExpress.XtraReports.UI.ReportHeaderBand(); this.xrLabel5 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel4 = new DevExpress.XtraReports.UI.XRLabel(); @@ -80,7 +81,6 @@ namespace BeWo.Report.DefaultReports this.fieldDifferenzWoche3 = new DevExpress.XtraReports.UI.CalculatedField(); this.fieldDifferenzWoche4 = new DevExpress.XtraReports.UI.CalculatedField(); this.fieldDifferenzGesamt = new DevExpress.XtraReports.UI.CalculatedField(); - this.formattingRuleDiffNegativ = new DevExpress.XtraReports.UI.FormattingRule(); this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable4)).BeginInit(); @@ -120,7 +120,7 @@ namespace BeWo.Report.DefaultReports // this.xrTable1.Borders = ((DevExpress.XtraPrinting.BorderSide)(((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Right) | DevExpress.XtraPrinting.BorderSide.Bottom))); - this.xrTable1.LocationFloat = new DevExpress.Utils.PointFloat(0F, 25F); + this.xrTable1.LocationFloat = new DevExpress.Utils.PointFloat(0F, 30F); this.xrTable1.Name = "xrTable1"; this.xrTable1.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] { this.xrTableRow1}); @@ -389,6 +389,13 @@ namespace BeWo.Report.DefaultReports this.xrTableCell11.TextFormatString = "{0:0.00}"; this.xrTableCell11.Weight = 0.6802721088435375D; // + // formattingRuleDiffNegativ + // + this.formattingRuleDiffNegativ.Condition = "[DifferenzSollIstGesamt] < 0"; + this.formattingRuleDiffNegativ.DataMember = "RootObjectList"; + this.formattingRuleDiffNegativ.Formatting.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.formattingRuleDiffNegativ.Name = "formattingRuleDiffNegativ"; + // // ReportHeader // this.ReportHeader.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { @@ -577,13 +584,6 @@ namespace BeWo.Report.DefaultReports this.fieldDifferenzGesamt.FieldType = DevExpress.XtraReports.UI.FieldType.Decimal; this.fieldDifferenzGesamt.Name = "fieldDifferenzGesamt"; // - // formattingRuleDiffNegativ - // - this.formattingRuleDiffNegativ.Condition = "[DifferenzSollIstGesamt] < 0"; - this.formattingRuleDiffNegativ.DataMember = "RootObjectList"; - this.formattingRuleDiffNegativ.Formatting.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.formattingRuleDiffNegativ.Name = "formattingRuleDiffNegativ"; - // // bindingSource1 // this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.FLSSollIstReportRO); diff --git a/Report/DefaultReports/FLSSollIstWeeklyReport.Designer.cs b/Report/DefaultReports/FLSSollIstWeeklyReport.Designer.cs index 63a21432c..1f4b41f87 100644 --- a/Report/DefaultReports/FLSSollIstWeeklyReport.Designer.cs +++ b/Report/DefaultReports/FLSSollIstWeeklyReport.Designer.cs @@ -63,7 +63,6 @@ namespace BeWo.Report.DefaultReports this.xrTableCell14 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell15 = new DevExpress.XtraReports.UI.XRTableCell(); this.GroupHeader1 = new DevExpress.XtraReports.UI.GroupHeaderBand(); - this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); this.ReportHeader = new DevExpress.XtraReports.UI.ReportHeaderBand(); this.xrLabel5 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel4 = new DevExpress.XtraReports.UI.XRLabel(); @@ -84,6 +83,7 @@ namespace BeWo.Report.DefaultReports this.fieldDifferenzWoche2 = new DevExpress.XtraReports.UI.CalculatedField(); this.fieldDifferenzWoche3 = new DevExpress.XtraReports.UI.CalculatedField(); this.fieldDifferenzWoche4 = new DevExpress.XtraReports.UI.CalculatedField(); + this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTableData)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTableHeader)).BeginInit(); @@ -122,7 +122,7 @@ namespace BeWo.Report.DefaultReports // this.xrTable1.Borders = ((DevExpress.XtraPrinting.BorderSide)(((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Right) | DevExpress.XtraPrinting.BorderSide.Bottom))); - this.xrTable1.LocationFloat = new DevExpress.Utils.PointFloat(0F, 25F); + this.xrTable1.LocationFloat = new DevExpress.Utils.PointFloat(0F, 35F); this.xrTable1.Name = "xrTable1"; this.xrTable1.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] { this.xrTableRow1}); @@ -137,6 +137,7 @@ namespace BeWo.Report.DefaultReports this.Detail1.Font = new DevExpress.Drawing.DXFont("Arial", 9.75F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] { new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); this.Detail1.HeightF = 69.66665F; + this.Detail1.KeepTogetherWithDetailReports = true; this.Detail1.Name = "Detail1"; this.Detail1.StylePriority.UseFont = false; // @@ -451,10 +452,6 @@ namespace BeWo.Report.DefaultReports this.GroupHeader1.Level = 1; this.GroupHeader1.Name = "GroupHeader1"; // - // bindingSource1 - // - this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.FLSSollIstReportRO); - // // ReportHeader // this.ReportHeader.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { @@ -636,6 +633,10 @@ namespace BeWo.Report.DefaultReports this.fieldDifferenzWoche4.FieldType = DevExpress.XtraReports.UI.FieldType.Decimal; this.fieldDifferenzWoche4.Name = "fieldDifferenzWoche4"; // + // bindingSource1 + // + this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.FLSSollIstReportRO); + // // FLSSollIstWeeklyReport // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { diff --git a/Report/ReportObjects/FLSSollIstReportRO.cs b/Report/ReportObjects/FLSSollIstReportRO.cs index 01f7ea108..8221c51f2 100644 --- a/Report/ReportObjects/FLSSollIstReportRO.cs +++ b/Report/ReportObjects/FLSSollIstReportRO.cs @@ -26,6 +26,8 @@ namespace BeWo.Report.ReportObjects public long ObjectOid { get; set; } + public TableID ObjectTid { get; set; } + public List Groups { get; set; } = new List(); public decimal SollGesamt { get; set; } public decimal IstGesamt { get; set; } @@ -40,6 +42,7 @@ namespace BeWo.Report.ReportObjects public String CustomValue4 { get; set; } public String CustomValue5 { get; set; } + public List ServiceRecords { get; internal set; } = new List(); } public class FLSSollIstReportGroupRO @@ -48,6 +51,10 @@ namespace BeWo.Report.ReportObjects public long ObjectOid { get; set; } + public TableID ObjectTid { get; set; } + + public List CostBearer2SupportConceptList { get; set; } = new List(); + public List WochenSummen { get; set; } = new List(); public decimal SollGesamt { get; set; } @@ -63,6 +70,7 @@ namespace BeWo.Report.ReportObjects public String CustomValue4 { get; set; } public String CustomValue5 { get; set; } + public List ServiceRecords { get; internal set; } = new List(); } public class FLSSollIstWochenSummen @@ -104,6 +112,7 @@ namespace BeWo.Report.ReportObjects } } + public List ServiceRecords { get; internal set; } = new List(); } public static FLSSollIstReportRO Create(List dcList, FLSAnalysisConfigDC config) @@ -118,21 +127,45 @@ namespace BeWo.Report.ReportObjects var rootRo = new FLSSollIstRootRO(); rootRo.Name = root.DisplayName; rootRo.SollGesamt = 0; //root.SollFLSTotal ?; - + if (root.Employee != null) + { + rootRo.ObjectOid = root.Employee.EmployeeOid; + rootRo.ObjectTid = TableID.Employee; + } + else if (root.Customer != null) + { + rootRo.ObjectOid = root.Customer.CustomerOid; + rootRo.ObjectTid = TableID.Customer; + } foreach (var item in root.Groups.OrderBy(a => a.DisplayName)) { var grpRo = new FLSSollIstReportGroupRO(); grpRo.Name = item.DisplayName; grpRo.WochenSummen = ErstelleWochensummen(config.StartDate, config.EndDate, null); - + if (item.Employee != null) + { + grpRo.ObjectOid = item.Employee.EmployeeOid; + grpRo.ObjectTid = TableID.Employee; + } + else if (item.Customer != null) + { + grpRo.ObjectOid = item.Customer.CustomerOid; + grpRo.ObjectTid = TableID.Customer; + } foreach (var sc in item.SupportConcepts) { + grpRo.CostBearer2SupportConceptList.Add(sc.SupportConcept2CostBearer); + foreach (var sr in sc.ServiceRecords) { + rootRo.ServiceRecords.Add(sr); + grpRo.ServiceRecords.Add(sr); + var ws = grpRo.WochenSummen.FirstOrDefault(w => w.WocheStart <= sr.Start && sr.Start < w.WocheEnde.AddDays(1)); if (ws != null) { + ws.ServiceRecords.Add(sr); if (!ws.IstStunden.HasValue) { ws.IstStunden = 0; diff --git a/ReportImp/LebenshilfeBadKreuznach/CustomReportCreator.cs b/ReportImp/LebenshilfeBadKreuznach/CustomReportCreator.cs index 5da43f109..18fdc6a68 100644 --- a/ReportImp/LebenshilfeBadKreuznach/CustomReportCreator.cs +++ b/ReportImp/LebenshilfeBadKreuznach/CustomReportCreator.cs @@ -8,14 +8,112 @@ using BeWo.Data.Entities; using BeWo.Report; using BeWo.Report.DefaultReports; using BeWo.Report.ReportObjects; +using BeWo.Service.Plugins; using BS.Shared; using BS.Shared.Core; +using BS.Shared.DataContracts; using DevExpress.XtraReports.UI; namespace LebenshilfeBadKreuznach { public class CustomReportCreator : DefaultReportCreator { + public override XtraReport CreateQueryReport(long queryOid, string queryReportId) + { + if (queryOid == 1000) + { + return CreateStundenkontrolleAbwNachWochen(CreateQueryRO(queryOid, queryReportId)); + } + if (queryOid == 1100) + { + return CreateStundenkontrolleAbwGesamt(CreateQueryRO(queryOid, queryReportId)); + } + + return base.CreateQueryReport(queryOid, queryReportId); + } + + private XtraReport CreateStundenkontrolleAbwNachWochen(QueryRO qro) + { + var ro = CreateFLSSollIstReportRO(qro); + + if (ro != null) + { + var druck = new FLSSollIstWeeklyReport(); + druck.SetReportDataSource(ro); + + return druck; + } + return new XtraReport(); + } + + private XtraReport CreateStundenkontrolleAbwGesamt(QueryRO qro) + { + var ro = CreateFLSSollIstReportRO(qro); + + if (ro != null) + { + var druck = new LebenshilfeBadKreuznach.FLSSollIstReport(); + druck.SetReportDataSource(ro); + + return druck; + } + return new XtraReport(); + } + + private FLSSollIstReportRO CreateFLSSollIstReportRO(QueryRO qro) + { + + if (qro.Rows.Count > 0) + { + DateTime start = DateTime.Now; + start = new DateTime(start.Year, start.Month, 1); + + DateTime dt = DateTime.Now; + if (DateTime.TryParse(qro.Rows[0].Field1.ToString(), out dt) && dt > DateTime.MinValue) + { + start = dt; + + } + + DateTime ende = start.AddMonths(1).AddTicks(-1); + + if (DateTime.TryParse(qro.Rows[0].Field2.ToString(), out dt) && dt < DateTime.MaxValue.Date) + { + ende = dt.AddTicks(-1); + + } + + var config = new FLSAnalysisConfigDC(); + config.StartDate = start; + config.EndDate = ende; + config.FetchApprovedFLS = true; + config.ReportType = FLSReportType.Customer; + + if (qro.Rows[0].Field3 != null && Int64.TryParse(qro.Rows[0].Field3.ToString(), out var catOid)) + { + if (catOid > 0) + { + config.ServiceDescriptionOids = DAOFactory.SearchDAO.FindServiceDescriptionForCategory(catOid).Select(d => d.Oid.Value).ToList(); + } + } + + if (qro.Rows[0].Field4 != null && Int64.TryParse(qro.Rows[0].Field4.ToString(), out var teamOid)) + { + if (teamOid > 0) + { + config.TeamOids = new List { teamOid }; + } + } + + var plugin = PluginLoader.FindClass(); + + var reportDcList = plugin.GetCustomerFLSAnalysis(config); + + return FLSSollIstReportRO.Create(reportDcList, config); + } + return null; + } + public override XtraReport CreateServiceOverviewAllCustomersReport(int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay) { //List lROs = ServicesOverviewRO.Create(month, year, orgaOid, empOid, startDay, endDay); diff --git a/ReportImp/LebenshilfeBadKreuznach/LebenshilfeBadKreuznach.csproj b/ReportImp/LebenshilfeBadKreuznach/LebenshilfeBadKreuznach.csproj index 6f04504d3..cd423bffa 100644 --- a/ReportImp/LebenshilfeBadKreuznach/LebenshilfeBadKreuznach.csproj +++ b/ReportImp/LebenshilfeBadKreuznach/LebenshilfeBadKreuznach.csproj @@ -60,6 +60,12 @@ + + Component + + + FLSSollIstReport.cs + @@ -104,6 +110,10 @@ + + FLSSollIstReport.cs + Designer + Quittierungsbeleg_old.cs