From f1b652771dd41c2e0d2c92cff7f3881fea405b74 Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 27 Feb 2026 13:34:33 +0100 Subject: [PATCH] =?UTF-8?q?Fristen=20f=C3=BCr=20Unterschriften=20eingebaut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWoPlanerMobil/Controllers/MainController.cs | 8 +++--- .../Controllers/ReportController.cs | 25 +++++++++++++++++-- BeWoPlanerMobil/Models/MainModel.cs | 15 +++++++++++ .../Util/QuittierungsbelegResult.cs | 6 ++++- .../Main/ServiceRecordListPartial.cshtml | 2 +- .../QuittierungsbelegsResultPartial.cshtml | 3 ++- 6 files changed, 51 insertions(+), 8 deletions(-) diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 8643b702f..9dd0df843 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -1513,11 +1513,13 @@ namespace BeWoPlanerMobil.Controllers TempData[TempDataConstants.AfterInsertKey] = true; - if(Model.NewServiceRecord.CostBearer != null && Model.ShowSignature && (Model.NewServiceRecord.ServiceDescription.Category.IsBillable || Model.NewServiceRecord.ServiceDescription.Category.BillableAmount > 0m || Model.NewServiceRecord.ServiceDescription.BillableAmount > 0m)) + if (Model.IsAllowedToCreateSignature(Model.NewServiceRecord)) { - TempData[TempDataConstants.ShowSignatureSuggestionPopup] = true; + if (Model.NewServiceRecord.CostBearer != null && Model.ShowSignature && (Model.NewServiceRecord.ServiceDescription.Category.IsBillable || Model.NewServiceRecord.ServiceDescription.Category.BillableAmount > 0m || Model.NewServiceRecord.ServiceDescription.BillableAmount > 0m)) + { + TempData[TempDataConstants.ShowSignatureSuggestionPopup] = true; + } } - if(appointmentPrototype is object) { var isRecurring = !(appointmentPrototype.RecurrenceInfo is null); diff --git a/BeWoPlanerMobil/Controllers/ReportController.cs b/BeWoPlanerMobil/Controllers/ReportController.cs index e0c0e305b..09babff93 100644 --- a/BeWoPlanerMobil/Controllers/ReportController.cs +++ b/BeWoPlanerMobil/Controllers/ReportController.cs @@ -57,6 +57,16 @@ namespace BeWoPlanerMobil.Controllers private void InitViewModel() { + Model.MokSettings = new MokSettings + { + SupportConceptExpirationLimitInMonths = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.HilfeplanAuslaufAuswahl, 3), + AnzTageZeiterfassErfolgt = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.AnzTageZeiterfassErfolgt), + AnzTageUnterschriftErfolgt = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.AnzTageUnterschriftErfolgt), + MaxDaysEditServiceRecordsAllowed = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.MaxDaysEditServiceRecordsAllowed), + TimeUntilUILock = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.TimeUntilUILock), + ServiceRecordAllowChangeHours = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.ServiceRecordAllowChangeHours) + }; + var month = DateTime.Today.Month; var year = DateTime.Today.Year; var first = new DateTime(year, month, 1).AddMonths(-1); @@ -1286,10 +1296,20 @@ namespace BeWoPlanerMobil.Controllers reportObjects.DoForEach(reportObject => { var quittierungsbelegItems = new List(); + + bool fristAbgelaufen = false; reportObject.Services.DoForEach(serviceDetail => { quittierungsbelegItems.Add(new QuittierungsbelegItem(serviceDetail)); + if (this.Model.MokSettings != null && this.Model.MokSettings.AnzTageUnterschriftErfolgt > 0) + { + if (DateTime.Now.Date.Subtract(serviceDetail.StartDate).TotalDays > this.Model.MokSettings.AnzTageUnterschriftErfolgt) + { + fristAbgelaufen = true; + } + } + }); if(quittierungsbelegItems.Count == 0) @@ -1340,7 +1360,7 @@ namespace BeWoPlanerMobil.Controllers employeeSignatureServiceRecordOids = serviceRecordOidsWithSignature[SignatureType.Employee]; } - foreach(var quittierungsbelegItem in quittierungsbelegItems) + foreach (var quittierungsbelegItem in quittierungsbelegItems) { var serviceRecordOid = quittierungsbelegItem.ServiceRecordOid; @@ -1377,7 +1397,8 @@ namespace BeWoPlanerMobil.Controllers customerSignatureOids, employeeSignatureState2, employeeSignatureOids, - employeeOids.Count + employeeOids.Count, + fristAbgelaufen ) ); }); diff --git a/BeWoPlanerMobil/Models/MainModel.cs b/BeWoPlanerMobil/Models/MainModel.cs index a570b20ae..1517bf51c 100644 --- a/BeWoPlanerMobil/Models/MainModel.cs +++ b/BeWoPlanerMobil/Models/MainModel.cs @@ -238,6 +238,21 @@ namespace BeWoPlanerMobil.Models return allowed; } + public bool IsAllowedToCreateSignature(ServiceRecordDC serviceRecord) + { + + if (MokSettings != null && MokSettings.AnzTageUnterschriftErfolgt > 0) + { + if (DateTime.Now.Date.Subtract(serviceRecord.Start.Value.Date).TotalDays > MokSettings.AnzTageUnterschriftErfolgt) + { + return false; + } + } + + return true; + } + + public long? SelectedServiceRecordOid { get => MainSessionModel.SelectedServiceRecordOid; diff --git a/BeWoPlanerMobil/Util/QuittierungsbelegResult.cs b/BeWoPlanerMobil/Util/QuittierungsbelegResult.cs index 595c23775..5921c1b2e 100644 --- a/BeWoPlanerMobil/Util/QuittierungsbelegResult.cs +++ b/BeWoPlanerMobil/Util/QuittierungsbelegResult.cs @@ -30,7 +30,9 @@ namespace BeWoPlanerMobil.Util public int EmployeeCount { get; } - public QuittierungsbelegResult(string customerName, List items, long customerOid, bool hasCustomerSignature, long? customerSignatureOid, SignatureState customerSignatureStatus, List customerSignatureOids, SignatureState employeeSignatureState, List employeeSignatureOids, int employeeCount) + public bool FristAbgelaufen { get; } + + public QuittierungsbelegResult(string customerName, List items, long customerOid, bool hasCustomerSignature, long? customerSignatureOid, SignatureState customerSignatureStatus, List customerSignatureOids, SignatureState employeeSignatureState, List employeeSignatureOids, int employeeCount, bool fristAbgelaufen) { CustomerName = customerName; Items = items; @@ -43,6 +45,8 @@ namespace BeWoPlanerMobil.Util EmployeeSignatureState = employeeSignatureState; EmployeeSignatureOids = employeeSignatureOids; EmployeeCount = employeeCount; + FristAbgelaufen = fristAbgelaufen; } + } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Views/Main/ServiceRecordListPartial.cshtml b/BeWoPlanerMobil/Views/Main/ServiceRecordListPartial.cshtml index 08e4fcd3f..2dd13c404 100644 --- a/BeWoPlanerMobil/Views/Main/ServiceRecordListPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/ServiceRecordListPartial.cshtml @@ -310,7 +310,7 @@ } @* Unterschrift-Anlegen-Button *@ - @if(Model.ShowSignature && !serviceRecord.SignatureOid.HasValue && serviceRecord.Customer != null) + @if(Model.ShowSignature && !serviceRecord.SignatureOid.HasValue && serviceRecord.Customer != null && Model.IsAllowedToCreateSignature(serviceRecord)) { } -