diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index c290c0b4e..49fd0cc23 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -1401,7 +1401,6 @@ namespace BeWoPlanerMobil.Controllers Model.NewServiceRecord.IP = Request.UserHostAddress; - Model.NewServiceRecord.Goals = CreateValueListEntriesFromMokZiele(Model.SelectedGoals); Model.NewServiceRecord.Start = zeitenFeld[0]; @@ -1513,7 +1512,6 @@ namespace BeWoPlanerMobil.Controllers TempData[TempDataConstants.AfterInsertKey] = true; - // ToDo: Einbauen, dass man nur Einträge mit abrechenbarer Leistung/Kategorie unterschreiben kann? 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; @@ -1597,7 +1595,6 @@ namespace BeWoPlanerMobil.Controllers Model.PreviouslySelectedCostbearer2SupportConceptOid = null; } - //Wenn nicht im Editing Mode, dann behalte die zuletzt ausgewählte Leistung bei, die im Reset zurückgesetzt wird long? oldCatOid = null; long? oldDescOid = null; @@ -1618,8 +1615,6 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedServiceDescriptionOid = oldDescOid; } - - return result; } diff --git a/BeWoPlanerMobil/Controllers/ReportController.cs b/BeWoPlanerMobil/Controllers/ReportController.cs index 2a22ab708..e0c0e305b 100644 --- a/BeWoPlanerMobil/Controllers/ReportController.cs +++ b/BeWoPlanerMobil/Controllers/ReportController.cs @@ -867,8 +867,6 @@ namespace BeWoPlanerMobil.Controllers return PartialView("ConfirmationReceiptSignaturePartial"); } - //Model.ConfirmationReceiptSignatures = OperationsService.LoadAllConfirmationReceiptSignaturesByServiceRecordOids(srOids, out var serviceRecordOidsWithSignature); - // Ist leer oder null! var obj = Model.ConfirmationReceiptObject.ConfirmationReceiptResultList.FirstOrDefault(f => f.Identifier.Equals(identifier)); @@ -878,12 +876,32 @@ namespace BeWoPlanerMobil.Controllers } var oids = isEmployee ? obj.EmployeeSignatureOids : obj.CustomerSignatureOids; - - // ToDo: Hierzu fehlen die ConfirmationReceiptSignatures! + var signatures = Model.GetConfirmationReceitSignaturesByOids(oids); Model.SelectedConfirmationReceiptSignatures = ConvertSignatureDCsToSignatureObjects(signatures); + var serviceRecords = new List(); + + signatures.DoForEach(s => + { + serviceRecords.AddRangeIfElementsNotIn(s.ServiceRecords); + }); + + Model.ServiceRecordOids2GoalHeader = new Dictionary>(); + + foreach(var serviceRecord in serviceRecords) + { + if(serviceRecord.ServiceRecordOid is null || serviceRecord.Goals is null || serviceRecord.Goals.Count == 0) + { + continue; + } + + var goalHeaders = serviceRecord.Goals.Select(g => g.DisplayName).ToList(); + + Model.ServiceRecordOids2GoalHeader.AddOrUpdateValueInDictionary(serviceRecord.ServiceRecordOid.Value, goalHeaders); + } + var customerName = obj.CustomerName; var employeeName = LoggedInUser.Employee.SimpleDescription; @@ -891,7 +909,9 @@ namespace BeWoPlanerMobil.Controllers if(isEmployee) { - serviceRecordCount = Model.HasRightToProvideEmployeeSignatureForOthers ? obj.Items.Count : obj.Items.Count(x => x.EmployeeOid.Equals(LoggedInEmployee.EmployeeOid)); + serviceRecordCount = Model.HasRightToProvideEmployeeSignatureForOthers + ? obj.Items.Count + : obj.Items.Count(x => x.EmployeeOid.Equals(LoggedInEmployee.EmployeeOid)); } else { diff --git a/BeWoPlanerMobil/Models/ReportModel.cs b/BeWoPlanerMobil/Models/ReportModel.cs index 33127e6c5..262e92559 100644 --- a/BeWoPlanerMobil/Models/ReportModel.cs +++ b/BeWoPlanerMobil/Models/ReportModel.cs @@ -271,7 +271,11 @@ namespace BeWoPlanerMobil.Models public List ReportServiceRecordOids { get; set; } - public List ConfirmationReceiptSignatures { get; set; } = new List(); + public List ConfirmationReceiptSignatures + { + get => ReportSessionModel.ConfirmationReceiptSignatures; + set => ReportSessionModel.ConfirmationReceiptSignatures = value; + } public ConfirmationReceiptSignatureDC GetConfirmationReceiptSignatureByOid(long confirmationReceiptSignatureOid) { @@ -306,7 +310,11 @@ namespace BeWoPlanerMobil.Models public List GoalRatingTypes { get; set; } = new List(); - public Dictionary> ServiceRecordOids2GoalHeader { get; set; } + public Dictionary> ServiceRecordOids2GoalHeader + { + get => ReportSessionModel.ServiceRecordOids2GoalHeader; + set => ReportSessionModel.ServiceRecordOids2GoalHeader = value; + } public ValueListEntryDC[] Dokutypes { get; set; } diff --git a/BeWoPlanerMobil/Models/ReportSessionModel .cs b/BeWoPlanerMobil/Models/ReportSessionModel .cs index d19aed200..6b52199a5 100644 --- a/BeWoPlanerMobil/Models/ReportSessionModel .cs +++ b/BeWoPlanerMobil/Models/ReportSessionModel .cs @@ -1,17 +1,9 @@ using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Web.Mvc; -using BeWo.View.Navigation.Filter; using BeWoPlanerMobil.Controllers; -using BeWoPlanerMobil.Service; -using BeWoPlanerMobil.Util; using BeWoPlanerMobil.Util.ReportUtils; using BS.Shared; using BS.Shared.DataContracts; -using BS.Shared.DataContracts.Compact; -using DevExpress.XtraReports.UI; namespace BeWoPlanerMobil.Models { @@ -36,6 +28,8 @@ namespace BeWoPlanerMobil.Models public Quittierungsbelegsunterschriftenobjekt Quittierungsbelegsunterschriftenobjekt { get; internal set; } public List SelectedConfirmationReceiptSignatures { get; internal set; } public QbSignatureIntervalSelection SelectedIntervalSelection { get; internal set; } + public List ConfirmationReceiptSignatures { get; internal set; } + public Dictionary> ServiceRecordOids2GoalHeader { get; internal set; } public override void ResetValues() { @@ -59,6 +53,8 @@ namespace BeWoPlanerMobil.Models Quittierungsbelegsunterschriftenobjekt = null; SelectedConfirmationReceiptSignatures = null; SelectedIntervalSelection = QbSignatureIntervalSelection.FirstHalf; + ConfirmationReceiptSignatures = null; + ServiceRecordOids2GoalHeader = null; } } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Util/DcToMokMapper.cs b/BeWoPlanerMobil/Util/DcToMokMapper.cs index 6e3462b26..ce78701b2 100644 --- a/BeWoPlanerMobil/Util/DcToMokMapper.cs +++ b/BeWoPlanerMobil/Util/DcToMokMapper.cs @@ -1,13 +1,8 @@ using BeWoPlanerMobil.Models; using BS.Shared; using BS.Shared.DataContracts; -using BS.Shared.DataContracts.Compact; -using BS.Shared.DataContracts.Invoicing; -using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.Serialization; -using System.Windows.Media; namespace BeWoPlanerMobil.Util { @@ -125,7 +120,7 @@ namespace BeWoPlanerMobil.Util } } - if (model != null && model.ServiceRecordOids2GoalHeader.ContainsKey(s.Oid.Value)) + if (model?.ServiceRecordOids2GoalHeader?.ContainsKey(s.Oid.Value) ?? false) { var ziele = dc.Goals.Where(g => g.Type == ValueListEntryType.SupportConceptIndividualGoalCategoryType || g.Type == ValueListEntryType.SupportConceptGoalCategoryType).ToList();