From bf57aa891cc0a2bb355dba560bc70280d453e9d1 Mon Sep 17 00:00:00 2001 From: Lyndon Jetten Date: Mon, 19 Jun 2023 16:03:55 +0200 Subject: [PATCH] FaC: Monatsunterschriften werden im Muster-Quittierungsbeleg angezeigt. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MoK: Die Prüfung, ob für einen ServiceRecord eine Monatsunterschrift existiert wurde gefixt. --- BeWoPlanerMobil/Controllers/MainController.cs | 4 +- BeWoPlanerMobil/Scripts/signature.js | 28 ++++++----- Data/Access/SearchDAO.cs | 49 ++++++++++++++++++- .../ServicesOverviewReport.Designer.cs | 35 +++++++++++-- Service/Plugins/PluginLoader.cs | 4 +- .../ServiceContracts/IOperationsService.cs | 4 ++ .../OperationsServiceImp.cs | 18 +++++++ 7 files changed, 119 insertions(+), 23 deletions(-) diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 5778db8f6..4f11d6149 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -2026,12 +2026,12 @@ namespace BeWoPlanerMobil.Controllers var serviceRecord = Model.ServiceRecords.FirstOrDefault(f => f.ServiceRecordOid.HasValue && f.ServiceRecordOid.Value.Equals(oid)) ?? OperationsService.GetServiceRecordById(oid); - if(!serviceRecord?.ServiceRecordOid.HasValue ?? false) + if(serviceRecord?.ServiceRecordOid is null) { return null; } - var hasMonatsunterschrift = OperationsService.HasConfirmationReceiptSignature(new List { serviceRecord.ServiceRecordOid.Value }, SignatureType.Customer); + var hasMonatsunterschrift = OperationsService.CheckForConfirmationReceiptSignatureForServiceRecord(serviceRecord.ServiceRecordOid.Value, SignatureType.Customer); var serviceRecord2Monatsunterschrift = new ServiceRecord2Monatsunterschrift(serviceRecord, hasMonatsunterschrift); diff --git a/BeWoPlanerMobil/Scripts/signature.js b/BeWoPlanerMobil/Scripts/signature.js index bfd15c51f..939e0d029 100644 --- a/BeWoPlanerMobil/Scripts/signature.js +++ b/BeWoPlanerMobil/Scripts/signature.js @@ -73,7 +73,7 @@ function initializeSignature(selectedServiceRecordOid) { var serviceRecord2Monatsunterschrift = $.parseJSON(jsonServiceRecord2Monatsunterschrift); var hasMonatsunterschrift = serviceRecord2Monatsunterschrift.HasMonatsunterschrift; - + logInfo(typeof hasMonatsunterschrift + ": " + hasMonatsunterschrift); var record = serviceRecord2Monatsunterschrift.ServiceRecord; @@ -95,22 +95,24 @@ function initializeSignature(selectedServiceRecordOid) { $("#signature-employee").text(record.Employee.FirstName + " " + record.Employee.LastName); $("#signature-date-time").text(datum + " " + startDate + " - " + endDate); - var customerFirstName = record.Customer.FirstName; - var customerLastName = record.Customer.LastName; + if (hasMonatsunterschrift === true) { + var customerFirstName = record.Customer.FirstName; + var customerLastName = record.Customer.LastName; - var customerName = ""; + var customerName = ""; - if (isEmptyOrSpaces(customerFirstName) && isEmptyOrSpaces(customerLastName) === false) { - customerName = customerLastName; - } else if (isEmptyOrSpaces(customerLastName) && false === isEmptyOrSpaces(customerFirstName)) { - customerName = customerFirstName; - } else { - customerName = customerLastName + ", " + customerFirstName; + if (isEmptyOrSpaces(customerFirstName) && isEmptyOrSpaces(customerLastName) === false) { + customerName = customerLastName; + } else if (isEmptyOrSpaces(customerLastName) && false === isEmptyOrSpaces(customerFirstName)) { + customerName = customerFirstName; + } else { + customerName = customerLastName + ", " + customerFirstName; + } + + $("#signature-alert").html("Für diesen Eintrag (" + datum + " " + startDate + " - " + endDate + ") existiert bereits eine Monatsunterschrift von " + customerName + ".

Das Leisten dieser Unterschrift ist nicht notwendig."); + $("#signature-alert").removeClass("d-none"); } - $("#signature-alert").html("Für diesen Eintrag (" + datum + " " + startDate + " - " + endDate + ") existiert bereits eine Monatsunterschrift von " + customerName + ".

Das Leisten dieser Unterschrift ist nicht notwendig."); - $("#signature-alert").removeClass("d-none"); - resizeCanvas("#sketch-pad", "#canvas-row"); var canvas = document.getElementById("sketch-pad"); diff --git a/Data/Access/SearchDAO.cs b/Data/Access/SearchDAO.cs index 58d7ebe10..2973e5e94 100644 --- a/Data/Access/SearchDAO.cs +++ b/Data/Access/SearchDAO.cs @@ -4359,7 +4359,7 @@ namespace BeWo.Data.Access public bool HasConfirmationReceiptSignature(IList serviceRecordOids, SignatureType signatureType) { - // Prüfen, ob alle ServiceRecords mit ein und derselben Mitarbeiterunterschrift verknüpft sind. + // Prüfen, ob alle ServiceRecords mit ein und derselben Unterschrift verknüpft sind. // Eine Unterschrift kann mehrere ServiceRecords in der LinkListe haben, die nicht in der zu prüfenden Oid-Liste sind. var c = CreateCriteriaIsActive() .Add(Restrictions.Eq(nameof(ConfirmationReceiptSignature.SignatureType), signatureType)) @@ -5155,5 +5155,52 @@ namespace BeWo.Data.Access return c.List().ToList(); } + + /* + * public bool HasConfirmationReceiptSignature(IList serviceRecordOids, SignatureType signatureType) + { + // Prüfen, ob alle ServiceRecords mit ein und derselben Unterschrift verknüpft sind. + // Eine Unterschrift kann mehrere ServiceRecords in der LinkListe haben, die nicht in der zu prüfenden Oid-Liste sind. + var c = CreateCriteriaIsActive() + .Add(Restrictions.Eq(nameof(ConfirmationReceiptSignature.SignatureType), signatureType)) + .CreateAlias(nameof(ConfirmationReceiptSignature.ServiceRecords), "sr", JoinType.InnerJoin) + .Add(Restrictions.In($"sr.{nameof(BeWoEntityBase.Oid)}", serviceRecordOids.ToArray())); + + var signatures = c.List().ToList(); + + var result = false; + + if(serviceRecordOids.Any() && signatures.Any()) + { + var blubb = new List(); + signatures.DoForEach(s => + { + s.ServiceRecords.DoForEach(sr => + { + if(sr.Oid.HasValue) + { + blubb.AddIfNotIn(sr.Oid.Value); + } + }); + }); + + result = serviceRecordOids.ContainsSameItemsAs(blubb); + } + + return result; + } + */ + + public bool CheckForConfirmationReceiptSignatureForServiceRecord(long serviceRecordOid, SignatureType signatureType) + { + var critreria = CreateCriteriaIsActive() + .Add(Restrictions.Eq(nameof(ConfirmationReceiptSignature.SignatureType), signatureType)) + .CreateAlias(nameof(ConfirmationReceiptSignature.ServiceRecords), "serviceRecords", JoinType.InnerJoin) + .Add(Restrictions.Eq($"serviceRecords.{nameof(BeWoEntityBase.Oid)}", serviceRecordOid)); + + var signature = critreria.List().ToList(); + + return signature.Count == 1; + } } } diff --git a/ReportImp/demo_reports/ServicesOverviewReport.Designer.cs b/ReportImp/demo_reports/ServicesOverviewReport.Designer.cs index bd6971e5c..1701ea091 100644 --- a/ReportImp/demo_reports/ServicesOverviewReport.Designer.cs +++ b/ReportImp/demo_reports/ServicesOverviewReport.Designer.cs @@ -46,7 +46,6 @@ namespace BeWo.Demo this.xrTableCell16 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell17 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell2 = new DevExpress.XtraReports.UI.XRTableCell(); - this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); this.formattingRuleStartDate = new DevExpress.XtraReports.UI.FormattingRule(); this.ReportHeader = new DevExpress.XtraReports.UI.ReportHeaderBand(); this.xrLabel13 = new DevExpress.XtraReports.UI.XRLabel(); @@ -86,6 +85,9 @@ namespace BeWo.Demo this.fieldBillableFLS = new DevExpress.XtraReports.UI.CalculatedField(); this.fieldAbrechenbareFLS = new DevExpress.XtraReports.UI.CalculatedField(); this.GroupHeader1 = new DevExpress.XtraReports.UI.GroupHeaderBand(); + this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); + this.xrPictureBox2 = new DevExpress.XtraReports.UI.XRPictureBox(); + this.xrPictureBox1 = new DevExpress.XtraReports.UI.XRPictureBox(); ((System.ComponentModel.ISupportInitialize)(this.xrTableServiceRecords1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); @@ -278,10 +280,6 @@ namespace BeWo.Demo this.xrTableCell2.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; this.xrTableCell2.Weight = 0.19570704439348488D; // - // bindingSource1 - // - this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServicesOverviewRO); - // // formattingRuleStartDate // this.formattingRuleStartDate.Condition = "[StartDate2] < [StartDate]"; @@ -553,6 +551,8 @@ namespace BeWo.Demo // ReportFooter // this.ReportFooter.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrPictureBox1, + this.xrPictureBox2, this.xrLabel7, this.xrLabel8, this.xrLabel2, @@ -708,6 +708,29 @@ namespace BeWo.Demo this.GroupHeader1.RepeatEveryPage = true; this.GroupHeader1.StylePriority.UseFont = false; // + // bindingSource1 + // + this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServicesOverviewRO); + // + // xrPictureBox2 + // + this.xrPictureBox2.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Image", null, "CustomerSignature")}); + this.xrPictureBox2.LocationFloat = new DevExpress.Utils.PointFloat(435.1247F, 141.6667F); + this.xrPictureBox2.Name = "xrPictureBox2"; + this.xrPictureBox2.SizeF = new System.Drawing.SizeF(197F, 35.50002F); + this.xrPictureBox2.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage; + // + // xrPictureBox1 + // + this.xrPictureBox1.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Image", null, "EmployeeSignature")}); + this.xrPictureBox1.LocationFloat = new DevExpress.Utils.PointFloat(183.1248F, 141.6667F); + this.xrPictureBox1.Name = "xrPictureBox1"; + this.xrPictureBox1.Scripts.OnBeforePrint = "xrPictureBox1_BeforePrint"; + this.xrPictureBox1.SizeF = new System.Drawing.SizeF(216.8751F, 35.50002F); + this.xrPictureBox1.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage; + // // Stundenzettel // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { @@ -808,5 +831,7 @@ namespace BeWo.Demo private DevExpress.XtraReports.UI.CalculatedField fieldAbrechenbareFLS; private DevExpress.XtraReports.UI.XRLabel xrLabel14; private DevExpress.XtraReports.UI.GroupHeaderBand GroupHeader1; + private DevExpress.XtraReports.UI.XRPictureBox xrPictureBox2; + private DevExpress.XtraReports.UI.XRPictureBox xrPictureBox1; } } diff --git a/Service/Plugins/PluginLoader.cs b/Service/Plugins/PluginLoader.cs index 3cfa89c77..c40eb92b9 100644 --- a/Service/Plugins/PluginLoader.cs +++ b/Service/Plugins/PluginLoader.cs @@ -17,7 +17,7 @@ namespace BeWo.Service.Plugins #if DEBUG var t = "demo"; - t = "irgendwaswasesnichtgibt"; + //t = "irgendwaswasesnichtgibt"; //t = "5473568546"; //Interner Chat //t = "2356097460"; // Lebenshilfe Würzburg //t = "1234567890"; // Präsentationsdatenbank @@ -144,7 +144,7 @@ namespace BeWo.Service.Plugins //t = "9975231461"; // Selwo //t = "8181286349"; // BeWo am Rhein //t = "4595275645"; // Eigenständig - t = "7912635399"; // Prof. Dr. Eggers Stiftung + //t = "7912635399"; // Prof. Dr. Eggers Stiftung //t = "3549726254"; // Socia //t = "1992495802"; // Monvita //t = "7381352241"; // Ressource e.V. diff --git a/Service/ServiceContracts/IOperationsService.cs b/Service/ServiceContracts/IOperationsService.cs index 2789fab71..b459f33c7 100644 --- a/Service/ServiceContracts/IOperationsService.cs +++ b/Service/ServiceContracts/IOperationsService.cs @@ -1307,5 +1307,9 @@ namespace BeWo.Service.ServiceContracts [FaultContract(typeof(BeWoFault))] [OperationContract] void DeleteSignature(long signatureOid, long serviceRecordOid); + + [FaultContract(typeof(BeWoFault))] + [OperationContract] + bool CheckForConfirmationReceiptSignatureForServiceRecord(long serviceRecordOid, SignatureType signatureType); } } \ No newline at end of file diff --git a/Service/ServiceImplementations/OperationsServiceImp.cs b/Service/ServiceImplementations/OperationsServiceImp.cs index 17b454302..5a073df6d 100644 --- a/Service/ServiceImplementations/OperationsServiceImp.cs +++ b/Service/ServiceImplementations/OperationsServiceImp.cs @@ -7956,5 +7956,23 @@ namespace BeWo.Service.ServiceImplementations throw Utils.CreateBeWoFaultException(e); } } + + /// + /// Prüft, ob der angegebene ServiceRecord auch eine Monatsunterschrift(ConfirmationReceiptSignature) hat. + /// + /// Oid des ServiceRecords + /// Mitarbeiter- oder Klientenunterschrift + /// Ob der ServiceRecord mit einer Monatsunterschrift verknüpft ist + public bool CheckForConfirmationReceiptSignatureForServiceRecord(long serviceRecordOid, SignatureType signatureType) + { + try + { + return DAOFactory.SearchDAO.CheckForConfirmationReceiptSignatureForServiceRecord(serviceRecordOid, signatureType); + } + catch(Exception e) + { + throw Utils.CreateBeWoFaultException(e); + } + } } }