From 63d9844e3ff8e2e8821a20bab23d0f2faf2bd99b Mon Sep 17 00:00:00 2001 From: Lyndon Jetten Date: Mon, 21 Sep 2020 11:57:10 +0200 Subject: [PATCH 1/2] =?UTF-8?q?BeWoPlanerMobil:=20=20=20=20=20Beim=20Bearb?= =?UTF-8?q?eiten=20von=20Zeiterfassungseintr=C3=A4gen=20ohne=20Zeitangaben?= =?UTF-8?q?=20wird=20das=20Datum=20nicht=20mehr=20auf=200=20Uhr=20gesetzt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWoPlanerMobil.sln | 8 + BeWoPlanerMobil/BeWoPlanerMobil.csproj | 6 + .../Controllers/CustomerController.cs | 11 +- BeWoPlanerMobil/Controllers/MainController.cs | 322 ++++-------------- .../Controllers/ReportController.cs | 47 ++- .../Controllers/SchedulerController.cs | 27 +- BeWoPlanerMobil/Models/MainModel.cs | 30 +- BeWoPlanerMobil/Models/ReportModel.cs | 3 + BeWoPlanerMobil/Scripts/signature.js | 6 + .../Scripts/view-scripts/report.js | 9 +- .../Util/FormCollectionConstants.cs | 55 +++ BeWoPlanerMobil/Util/QuittierungsbelegItem.cs | 33 ++ BeWoPlanerMobil/Views/Report/Report.cshtml | 95 +++++- Shared/Extensions/DateTimeExtensions.cs | 5 + 14 files changed, 359 insertions(+), 298 deletions(-) create mode 100644 BeWoPlanerMobil/Util/FormCollectionConstants.cs create mode 100644 BeWoPlanerMobil/Util/QuittierungsbelegItem.cs diff --git a/BeWoPlanerMobil.sln b/BeWoPlanerMobil.sln index 760fe43f1..b10bcefd8 100644 --- a/BeWoPlanerMobil.sln +++ b/BeWoPlanerMobil.sln @@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Data\Data.csproj", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\Shared.csproj", "{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Report", "Report\Report.csproj", "{40D8B312-EA64-49E3-A31A-5E57ED4D5654}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -42,6 +44,12 @@ Global {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.DebugRemote|Any CPU.Build.0 = DebugRemote|Any CPU {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Any CPU.ActiveCfg = Release|Any CPU {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Any CPU.Build.0 = Release|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Any CPU.Build.0 = Debug|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.DebugRemote|Any CPU.ActiveCfg = DebugRemote|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.DebugRemote|Any CPU.Build.0 = DebugRemote|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Any CPU.ActiveCfg = Release|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj b/BeWoPlanerMobil/BeWoPlanerMobil.csproj index 7916e6001..300901028 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj @@ -184,6 +184,7 @@ + @@ -192,6 +193,7 @@ + Global.asax @@ -576,6 +578,10 @@ {b0d73e3d-4ae7-4024-93a6-db1f46d7ccee} Data + + {40D8B312-EA64-49E3-A31A-5E57ED4D5654} + Report + {094331c3-ecee-4c89-bbfd-4c9ded89f0ef} Service diff --git a/BeWoPlanerMobil/Controllers/CustomerController.cs b/BeWoPlanerMobil/Controllers/CustomerController.cs index 2f16a1181..62e64c6a9 100644 --- a/BeWoPlanerMobil/Controllers/CustomerController.cs +++ b/BeWoPlanerMobil/Controllers/CustomerController.cs @@ -5,6 +5,7 @@ using System.Web.Mvc; using BeWoPlanerMobil.Models; using BeWoPlanerMobil.Service; +using BeWoPlanerMobil.Util; using BS.Shared; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; @@ -15,8 +16,6 @@ namespace BeWoPlanerMobil.Controllers { public class CustomerController : AbstractBaseController { - public static string CustomerModelModelSessionKey = "CustomerModelModel"; - private CustomerModel _Model; public CustomerModel Model { @@ -28,14 +27,14 @@ namespace BeWoPlanerMobil.Controllers return null; } - if (((CustomerModel) Session[CustomerModelModelSessionKey])?.Employee == null) + if (((CustomerModel) Session[ModelSessionConstants.CustomerModelKey])?.Employee == null) { _Model = new CustomerModel{Employee = MobileSessionFacade.LoggedInEmployee}; - Session[CustomerModelModelSessionKey] = _Model; + Session[ModelSessionConstants.CustomerModelKey] = _Model; } else { - _Model = (CustomerModel)Session[CustomerModelModelSessionKey]; + _Model = (CustomerModel)Session[ModelSessionConstants.CustomerModelKey]; } return _Model; @@ -103,7 +102,7 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Index", "Login"); } - var selectedCustomerOidString = formCollection["SelectedCustomerOid"]; + var selectedCustomerOidString = formCollection[FormCollectionConstants.SelectedCustomerOidKey]; if (long.TryParse(selectedCustomerOidString, out var selectedCustomerOid)) { Model.SelectedCustomerOid = selectedCustomerOid == -1 ? (long?) null : selectedCustomerOid; diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 79bc9ab77..e2c896231 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -42,22 +42,20 @@ namespace BeWoPlanerMobil.Controllers return null; } - if(((MainModel) Session[MainModelSessionKey])?.Employee == null) + if(((MainModel) Session[ModelSessionConstants.MainModelKey])?.Employee == null) { _Model = new MainModel { Employee = MobileSessionFacade.LoggedInEmployee }; - Session[MainModelSessionKey] = _Model; + Session[ModelSessionConstants.MainModelKey] = _Model; } else { - _Model = (MainModel) Session[MainModelSessionKey]; + _Model = (MainModel) Session[ModelSessionConstants.MainModelKey]; } return _Model; } } - private const string MainModelSessionKey = "MainModel"; - private Dictionary _ParentGoals; private static readonly List _Zieltypen = new List { ValueListEntryType.SupportConceptGoalCategoryType, ValueListEntryType.SupportConceptIndividualGoalCategoryType }; @@ -245,7 +243,7 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Index", "Login"); } - var newValue = "true,false" == collection["ShowOnlyOwnSupportConcepts"]; + var newValue = "true,false" == collection[FormCollectionConstants.ShowOnlyOwnSupportConceptsKey]; Model.ShowOnlyOwnSupportConcepts = newValue; @@ -261,7 +259,7 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Index", "Login"); } - var newValue = "true,false" == pCollection["ShowExpiredSupportConcepts"]; + var newValue = "true,false" == pCollection[FormCollectionConstants.ShowExpiredSupportConceptsKey]; Model.ShowExpiredSupportConcepts = newValue; @@ -678,198 +676,6 @@ namespace BeWoPlanerMobil.Controllers return textModule == null ? null : string.IsNullOrWhiteSpace(textModule.Text) ? textModule.Name : textModule.Text; } - [HttpPost] - [Authorize] - public ActionResult CreateServiceRecord(FormCollection collection) - { - try - { - if(Model == null) - { - return RedirectToActionPermanent("Index", "Login"); - } - - if (string.IsNullOrEmpty(collection["Datum"]) || Model.NewServiceRecord == null) - { - return View("Main", Model); - } - - string doku1; - var distanceInMeters = 0; - var dauer = 0; - var serviceDescOid = 0L; - - if(Model.Dokutypes != null && Model.Dokutypes.Length > 0) - { - doku1 = collection["Dokumentation1"]; - } - else - { - doku1 = collection["Dokumentation6"]; - } - - var doku2 = collection["Dokumentation2"]; - var doku3 = collection["Dokumentation3"]; - var doku4 = collection["Dokumentation4"]; - var doku5 = collection["Dokumentation5"]; - var distanz = collection["Distanz"]; - var start = collection["Start"]; - var ende = collection["Ende"]; - var endDateString = collection["Enddatum"]; - - var selectedCostbearerScRelOid = Model.CostBearer2SupportConceptOid < 1 ? null : Model.CostBearer2SupportConceptOid; - var datum = Convert.ToDateTime(collection["Datum"]); - - if(!string.IsNullOrEmpty(distanz)) - { - if(int.TryParse(distanz, out var parsedDistance)) - { - distanceInMeters = parsedDistance; - } - } - - Log.Info($"CreateServiceRecord: datum:{collection["Datum"]}; start:{collection["Start"]}; ende:{collection["Ende"]}; dauer:{collection["Dauer"]}; doku:{doku1}; aktion:{collection["versteckt"]}"); - - var enddatum = datum; - - if(endDateString != null) - { - enddatum = Convert.ToDateTime(endDateString); - } - - if(datum > enddatum) { - enddatum = datum; - } - - if(!string.IsNullOrEmpty(collection["Dauer"])) - { - int.TryParse(collection["Dauer"], out dauer); - } - - var zeitenFeld = new DateTime[2]; - - if(start == string.Empty && ende == string.Empty) - { - zeitenFeld[0] = new DateTime(datum.Year, datum.Month, datum.Day, 0, 0, 1); - - if(enddatum == datum) - { - zeitenFeld[1] = new DateTime(datum.Year, datum.Month, datum.Day, 0, 0, 1).AddMinutes(dauer); - } - else - { - zeitenFeld[1] = new DateTime(enddatum.Year, enddatum.Month, enddatum.Day, 0, 0, 1).AddMinutes(dauer); - } - } - else - { - zeitenFeld = enddatum == datum ? ConvertRecordTimes(start, ende, datum, dauer) : ConvertRecordTimesWithEndDate(start, ende, datum, enddatum, dauer); - } - - if(dauer == 0 || zeitenFeld[1] != zeitenFeld[0]) - { - dauer = (int) (zeitenFeld[1] - zeitenFeld[0]).TotalMinutes; - } - - Model.NewServiceRecord.IP = Request.UserHostAddress; - Model.NewServiceRecord.Goals = Model.SelectedGoals; - Model.NewServiceRecord.Start = zeitenFeld[0]; - Model.NewServiceRecord.End = zeitenFeld[1]; - Model.NewServiceRecord.DistanceInMeter = distanceInMeters; - - if(Model.Employee.EmployeeOid != null) - { - Model.NewServiceRecord.Employee = Model.SelectedEmployee ?? MobileSessionFacade.LoggedInCompactEmployee; - - var sc = Model.SupportConcepts.FirstOrDefault(fod => fod.CostBearerRelations.Any(a => a.CostBearer2SupportConceptOid.HasValue && a.CostBearer2SupportConceptOid.Value.Equals(selectedCostbearerScRelOid))); - if(sc != null) - { - if(sc.SupportConceptOid != null) - { - Model.NewServiceRecord.SupportConcept = CustomerService.LoadCompactSupportConceptDC(sc.SupportConceptOid.Value, Model.Employee.EmployeeOid); - } - - Model.NewServiceRecord.Customer = sc.Customer; - - var cb2ScRel = sc.CostBearerRelations.First(f => f.CostBearer2SupportConceptOid.HasValue && f.CostBearer2SupportConceptOid.Equals(selectedCostbearerScRelOid)); - Model.NewServiceRecord.CostBearer = cb2ScRel.CostBearer; - - var intervall = Model.NewServiceRecord.CostBearer.ActualMinuteIntervall; - - if(intervall > 0) - { - Model.NewServiceRecord.RoundedDuration = dauer % intervall != 0 ? dauer + (intervall - dauer % intervall) : dauer; - } - else - { - Model.NewServiceRecord.RoundedDuration = dauer; - } - - Model.NewServiceRecord.CostBearer2SupportConceptOid = selectedCostbearerScRelOid; - } - else - { - Model.NewServiceRecord.RoundedDuration = dauer; - } - } - - Model.NewServiceRecord.DurationInStunden = ZeiterfassungsDauer.Minuten; - - Model.NewServiceRecord.ServiceRecordFormat = ServiceRecordFormate.OriginaleZeiterfassung; - - Model.NewServiceRecord.Notice = string.IsNullOrEmpty(doku1) ? null : doku1; - - Model.NewServiceRecord.Notice2 = string.IsNullOrEmpty(doku2) ? null : doku2; - Model.NewServiceRecord.Notice3 = string.IsNullOrEmpty(doku3) ? null : doku3; - Model.NewServiceRecord.Notice4 = string.IsNullOrEmpty(doku4) ? null : doku4; - Model.NewServiceRecord.Notice5 = string.IsNullOrEmpty(doku5) ? null : doku5; - - if(!string.IsNullOrEmpty(collection["ServiceDescription"])) - { - serviceDescOid = Convert.ToInt64(collection["ServiceDescription"]); - } - else if(Model.SelectedServiceDescriptionOid.HasValue) - { - serviceDescOid = Model.SelectedServiceDescriptionOid.Value; - } - - if (serviceDescOid > 0) - { - Model.NewServiceRecord.ServiceDescription = OperationsService.GetServiceDescription(serviceDescOid); - } - - if (Model.NewServiceRecord.RoundedDuration == 0) - { - Model.NewServiceRecord.RoundedDuration = dauer; - } - - Model.NewServiceRecord.IP = Request.UserHostAddress; - Model.NewServiceRecord.InsertedOn = DateTime.Now; - Model.NewServiceRecord.InsUser = $"{MobileSessionFacade.LoggedInEmployee.FirstName} {MobileSessionFacade.LoggedInEmployee.LastName}"; - Model.NewServiceRecord.IsCreatedInMobileClient = true; - Model.NewServiceRecord.Goals = Model.SelectedGoals; - - var oidList = OperationsService.InsertNewServiceRecords(new List { Model.NewServiceRecord }); - - Model.ServiceRecordOid = oidList[0]; - - Model.NewServiceRecord = new ServiceRecordDC(); - - if(selectedCostbearerScRelOid.HasValue) - { - Model.ServiceRecords = OperationsService.FindServiceRecordsForLastDays(selectedCostbearerScRelOid, Model.Zeitraum, Model.Employee.EmployeeOid).ToList(); - } - } - catch (Exception e) - { - Log.Error(e.Message, e); - } - - Model.SaveSignature = Model.ShowSignature && Model.SelectedSupportConcept != null; - - return RedirectToActionPermanent("Main"); - } - [HttpPost] [Authorize] public ActionResult CreateOrUpdateServiceRecord(FormCollection collection) @@ -885,21 +691,21 @@ namespace BeWoPlanerMobil.Controllers if(Model.Dokutypes != null && Model.Dokutypes.Length > 1) { - doku1 = collection["Dokumentation1"]; + doku1 = collection[FormCollectionConstants.Dokumentation1Key]; } else { - doku1 = collection["Dokumentation6"]; + doku1 = collection[FormCollectionConstants.Dokumentation6Key]; } - Log.Info($"CreateServiceRecord: datum:{collection["Datum"]}; start:{collection["Start"]}; ende:{collection["Ende"]}; dauer:{collection["Dauer"]}; doku:{doku1}; aktion:{(Model.IsInEditingMode ? "Speichern" : "Anlegen")}"); + Log.Info($"CreateOrUpdateServiceRecord: datum:{collection[FormCollectionConstants.DateKey]}; start:{collection[FormCollectionConstants.StartKey]}; ende:{collection[FormCollectionConstants.EndKey]}; dauer:{collection[FormCollectionConstants.DurationKey]}; doku:{doku1}; aktion:{(Model.IsInEditingMode ? "Speichern" : "Anlegen")}"); - if(string.IsNullOrEmpty(collection["Datum"])) + if(string.IsNullOrEmpty(collection[FormCollectionConstants.DateKey])) { return View("Main", Model); } - var distanz = collection["Distanz"]; + var distanz = collection[FormCollectionConstants.DistanceKey]; var distanceInMeters = 0; if(!string.IsNullOrEmpty(distanz)) @@ -911,12 +717,12 @@ namespace BeWoPlanerMobil.Controllers } var selectedCostbearerSCRelOid = Model.CostBearer2SupportConceptOid < 1 ? null : Model.CostBearer2SupportConceptOid; - var datum = Convert.ToDateTime(collection["Datum"]); + var datum = Convert.ToDateTime(collection[FormCollectionConstants.DateKey]); var enddatum = datum; - var start = collection["Start"]; - var ende = collection["Ende"]; + var start = collection[FormCollectionConstants.StartKey]; + var ende = collection[FormCollectionConstants.EndKey]; var dauer = 0; if(datum > enddatum) @@ -924,15 +730,15 @@ namespace BeWoPlanerMobil.Controllers enddatum = datum; } - if(!string.IsNullOrEmpty(collection["Dauer"])) + if(!string.IsNullOrEmpty(collection[FormCollectionConstants.DurationKey])) { - int.TryParse(collection["Dauer"], out dauer); + int.TryParse(collection[FormCollectionConstants.DurationKey], out dauer); } - var doku2 = collection["Dokumentation2"]; - var doku3 = collection["Dokumentation3"]; - var doku4 = collection["Dokumentation4"]; - var doku5 = collection["Dokumentation5"]; + var doku2 = collection[FormCollectionConstants.Dokumentation2Key]; + var doku3 = collection[FormCollectionConstants.Dokumentation3Key]; + var doku4 = collection[FormCollectionConstants.Dokumentation4Key]; + var doku5 = collection[FormCollectionConstants.Dokumentation5Key]; var zeitenFeld = new DateTime[2]; @@ -1038,9 +844,9 @@ namespace BeWoPlanerMobil.Controllers var serviceDescOid = 0L; - if(!string.IsNullOrEmpty(collection["ServiceDescription"])) + if(!string.IsNullOrEmpty(collection[FormCollectionConstants.ServiceDescriptionKey])) { - serviceDescOid = Convert.ToInt64(collection["ServiceDescription"]); + serviceDescOid = Convert.ToInt64(collection[FormCollectionConstants.ServiceDescriptionKey]); } else if(Model.SelectedServiceDescriptionOid.HasValue) { @@ -1501,7 +1307,7 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Index", "Login"); } - long? cb2ScOid = Convert.ToInt64(formCollection["CostBearer2SupportConceptOid"]); + long? cb2ScOid = Convert.ToInt64(formCollection[FormCollectionConstants.CostBearer2SupportConceptOidKey]); LoadServiceCategoriesToModel(cb2ScOid); @@ -1570,7 +1376,7 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Index", "Login"); } - Model.ServiceRecordOidToDelete = long.Parse(formCollection["serviceRecordOidHolder"]); + Model.ServiceRecordOidToDelete = long.Parse(formCollection[FormCollectionConstants.ServiceRecordOidHolderKey]); if (Model.ServiceRecordOidToDelete != null && Model.ServiceRecordOidToDelete > 0 && MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecordView_Delete)))) { @@ -1642,7 +1448,7 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Index", "Login"); } - var zeitraum = int.Parse(formCollection["Records"]); + var zeitraum = int.Parse(formCollection[FormCollectionConstants.RecordsKey]); if (zeitraum < 0) { zeitraum = 7; @@ -1695,7 +1501,7 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Index", "Login"); } - var oidString = formCollection["service-record-oid-holder"]; + var oidString = formCollection[FormCollectionConstants.ServiceRecordOidHolder2Key]; var wasSuccessful = long.TryParse(oidString, out var serviceRecordOid); @@ -2124,9 +1930,9 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("PreselectCustomer", "Customer", new {Model.SelectedSupportConcept.Customer.CustomerOid}); } - if(Model?.SelectedSupportConcept == null && (CustomerModel)Session[CustomerController.CustomerModelModelSessionKey] != null) + if(Model?.SelectedSupportConcept == null && (CustomerModel)Session[ModelSessionConstants.CustomerModelKey] != null) { - var customerModel = (CustomerModel) Session[CustomerController.CustomerModelModelSessionKey]; + var customerModel = (CustomerModel) Session[ModelSessionConstants.CustomerModelKey]; customerModel.SelectedCustomerOid = null; customerModel.SelectedCustomer = null; } @@ -2155,7 +1961,7 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Index", "Login"); } - var isInGroupBookingMode = "true,false" == pFormCollection["IsInGroupBookingMode"]; + var isInGroupBookingMode = "true,false" == pFormCollection[FormCollectionConstants.IsInGroupBookingModeKey]; ResetGroupBookingMode(isInGroupBookingMode); @@ -2395,8 +2201,8 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Index", "Login"); } - var isParsingSuccessful2 = long.TryParse(pFormCollection["service-record-oid-holder"], out var serviceRecordOid); - var isParsingSuccessful = long.TryParse(pFormCollection["signatureOidHolder"], out var signatureOid); + var isParsingSuccessful2 = long.TryParse(pFormCollection[FormCollectionConstants.ServiceRecordOidHolder2Key], out var serviceRecordOid); + var isParsingSuccessful = long.TryParse(pFormCollection[FormCollectionConstants.SignatureOidHolderKey], out var signatureOid); if(isParsingSuccessful && isParsingSuccessful2) { var signatureServiceRecord = Model.ServiceRecords.FirstOrDefault(serviceRecord => serviceRecord.ServiceRecordOid.Equals(serviceRecordOid)); @@ -2460,21 +2266,21 @@ namespace BeWoPlanerMobil.Controllers if(Model.Dokutypes != null && Model.Dokutypes.Length > 0) { - doku1 = formCollection["Dokumentation1"]; + doku1 = formCollection[FormCollectionConstants.Dokumentation1Key]; } else { - doku1 = formCollection["Dokumentation6"]; + doku1 = formCollection[FormCollectionConstants.Dokumentation6Key]; } - Log.Info($"CreateServiceRecord: datum:{formCollection["Datum"]}; start:{formCollection["Start"]}; ende:{formCollection["Ende"]}; dauer:{formCollection["Dauer"]}; doku:{doku1}; aktion:{formCollection["versteckt"]}"); + Log.Info($"CreateServiceRecord: datum:{formCollection[FormCollectionConstants.DateKey]}; start:{formCollection[FormCollectionConstants.StartKey]}; ende:{formCollection[FormCollectionConstants.EndKey]}; dauer:{formCollection[FormCollectionConstants.DurationKey]}; doku:{doku1}; aktion:{formCollection[FormCollectionConstants.HiddenInputKey]}"); - if(string.IsNullOrEmpty(formCollection["Datum"])) + if(string.IsNullOrEmpty(formCollection[FormCollectionConstants.DateKey])) { return View("Main", Model); } - var distanz = formCollection["Distanz"]; + var distanz = formCollection[FormCollectionConstants.DistanceKey]; var distanceInMeters = 0; if(!string.IsNullOrEmpty(distanz)) @@ -2486,18 +2292,18 @@ namespace BeWoPlanerMobil.Controllers } var selectedCostbearerScRelOid = Model.CostBearer2SupportConceptOid < 1 ? null : Model.CostBearer2SupportConceptOid; - var datum = Convert.ToDateTime(formCollection["Datum"]); + var datum = Convert.ToDateTime(formCollection[FormCollectionConstants.DateKey]); var enddatum = datum; - var endDateString = formCollection["Enddatum"]; + var endDateString = formCollection[FormCollectionConstants.EndDateKey]; if(endDateString != null) { enddatum = Convert.ToDateTime(endDateString); } - var start = formCollection["Start"]; - var ende = formCollection["Ende"]; + var start = formCollection[FormCollectionConstants.StartKey]; + var ende = formCollection[FormCollectionConstants.EndKey]; var dauer = 0; if(datum > enddatum) @@ -2505,15 +2311,15 @@ namespace BeWoPlanerMobil.Controllers enddatum = datum; } - if(!string.IsNullOrEmpty(formCollection["Dauer"])) + if(!string.IsNullOrEmpty(formCollection[FormCollectionConstants.DurationKey])) { - int.TryParse(formCollection["Dauer"], out dauer); + int.TryParse(formCollection[FormCollectionConstants.DurationKey], out dauer); } - var doku2 = formCollection["Dokumentation2"]; - var doku3 = formCollection["Dokumentation3"]; - var doku4 = formCollection["Dokumentation4"]; - var doku5 = formCollection["Dokumentation5"]; + var doku2 = formCollection[FormCollectionConstants.Dokumentation2Key]; + var doku3 = formCollection[FormCollectionConstants.Dokumentation3Key]; + var doku4 = formCollection[FormCollectionConstants.Dokumentation4Key]; + var doku5 = formCollection[FormCollectionConstants.Dokumentation5Key]; var zeitenFeld = new DateTime[2]; @@ -2605,9 +2411,9 @@ namespace BeWoPlanerMobil.Controllers var serviceDescOid = 0L; - if(!string.IsNullOrEmpty(formCollection["ServiceDescription"])) + if(!string.IsNullOrEmpty(formCollection[FormCollectionConstants.ServiceDescriptionKey])) { - serviceDescOid = Convert.ToInt64(formCollection["ServiceDescription"]); + serviceDescOid = Convert.ToInt64(formCollection[FormCollectionConstants.ServiceDescriptionKey]); } else if(Model.SelectedServiceDescriptionOid.HasValue) { @@ -2664,21 +2470,21 @@ namespace BeWoPlanerMobil.Controllers if(Model.Dokutypes != null && Model.Dokutypes.Length > 0) { - doku1 = formCollection["Dokumentation1"]; + doku1 = formCollection[FormCollectionConstants.Dokumentation1Key]; } else { - doku1 = formCollection["Dokumentation6"]; + doku1 = formCollection[FormCollectionConstants.Dokumentation6Key]; } - Log.Info($"EditServiceRecord: datum:{formCollection["Datum"]}; start:{formCollection["Start"]}; ende:{formCollection["Ende"]}; dauer:{formCollection["Dauer"]}; doku:{doku1}; aktion:Speichern"); + Log.Info($"EditServiceRecord: datum:{formCollection[FormCollectionConstants.DateKey]}; start:{formCollection[FormCollectionConstants.StartKey]}; ende:{formCollection[FormCollectionConstants.EndKey]}; dauer:{formCollection[FormCollectionConstants.DurationKey]}; doku:{doku1}; aktion:Speichern"); - if(string.IsNullOrEmpty(formCollection["Datum"])) + if(string.IsNullOrEmpty(formCollection[FormCollectionConstants.DateKey])) { return View("Main", Model); } - var distanz = formCollection["Distanz"]; + var distanz = formCollection[FormCollectionConstants.DistanceKey]; var distanceInMeters = 0; if(!string.IsNullOrEmpty(distanz)) @@ -2690,18 +2496,18 @@ namespace BeWoPlanerMobil.Controllers } var selectedCostbearer2SupportConceptRelOid = Model.CostBearer2SupportConceptOid < 1 ? null : Model.CostBearer2SupportConceptOid; - var datum = Convert.ToDateTime(formCollection["Datum"]); + var datum = Convert.ToDateTime(formCollection[FormCollectionConstants.DateKey]); var enddatum = datum; - var endDateString = formCollection["Enddatum"]; + var endDateString = formCollection[FormCollectionConstants.EndDateKey]; if(endDateString != null) { enddatum = Convert.ToDateTime(endDateString); } - var start = formCollection["Start"]; - var ende = formCollection["Ende"]; + var start = formCollection[FormCollectionConstants.StartKey]; + var ende = formCollection[FormCollectionConstants.EndKey]; var dauer = 0; if(datum > enddatum) @@ -2709,15 +2515,15 @@ namespace BeWoPlanerMobil.Controllers enddatum = datum; } - if(!string.IsNullOrEmpty(formCollection["Dauer"])) + if(!string.IsNullOrEmpty(formCollection[FormCollectionConstants.DurationKey])) { - int.TryParse(formCollection["Dauer"], out dauer); + int.TryParse(formCollection[FormCollectionConstants.DurationKey], out dauer); } - var doku2 = formCollection["Dokumentation2"]; - var doku3 = formCollection["Dokumentation3"]; - var doku4 = formCollection["Dokumentation4"]; - var doku5 = formCollection["Dokumentation5"]; + var doku2 = formCollection[FormCollectionConstants.Dokumentation2Key]; + var doku3 = formCollection[FormCollectionConstants.Dokumentation3Key]; + var doku4 = formCollection[FormCollectionConstants.Dokumentation4Key]; + var doku5 = formCollection[FormCollectionConstants.Dokumentation5Key]; var zeitenFeld = new DateTime[2]; @@ -2814,9 +2620,9 @@ namespace BeWoPlanerMobil.Controllers var serviceDescOid = 0L; - if(!string.IsNullOrEmpty(formCollection["ServiceDescription"])) + if(!string.IsNullOrEmpty(formCollection[FormCollectionConstants.ServiceDescriptionKey])) { - serviceDescOid = Convert.ToInt64(formCollection["ServiceDescription"]); + serviceDescOid = Convert.ToInt64(formCollection[FormCollectionConstants.ServiceDescriptionKey]); } else if(Model.SelectedServiceDescriptionOid.HasValue) { diff --git a/BeWoPlanerMobil/Controllers/ReportController.cs b/BeWoPlanerMobil/Controllers/ReportController.cs index d979e9332..401caed33 100644 --- a/BeWoPlanerMobil/Controllers/ReportController.cs +++ b/BeWoPlanerMobil/Controllers/ReportController.cs @@ -1,7 +1,11 @@ -using System.Linq; +using System; +using System.Linq; using System.Web.Mvc; +using BeWo.Report.ReportObjects; using BeWoPlanerMobil.Models; using BeWoPlanerMobil.Service; +using BeWoPlanerMobil.Util; +using BS.Shared.Extensions; namespace BeWoPlanerMobil.Controllers { @@ -10,13 +14,13 @@ namespace BeWoPlanerMobil.Controllers * Mit Unterschriftenfunktion für den Mitarbeiter. * Liste mit allen ServiceRecords des Mitarbeiters für einen Klienten. * - * Felder: Mitarbeiter(Ist der eingeloggte, denn nur der darf unterschreiben), Klient, Monat, Vom, Bis, Jahr + * TODO: Warnung anzeigen, dass man die betroffenen Einträge nicht mehr ändern kann. + * + * TODO: Unterschrift zu hinzufügen */ public class ReportController : AbstractBaseController { - private const string ReportModelSessionKey = "ReportModel"; - private ReportModel _Model; public ReportModel Model @@ -29,14 +33,14 @@ namespace BeWoPlanerMobil.Controllers return null; } - if(((ReportModel) Session[ReportModelSessionKey])?.Employee == null) + if(((ReportModel) Session[ModelSessionConstants.ReportModelKey])?.Employee == null) { _Model = new ReportModel {Employee = MobileSessionFacade.LoggedInEmployee}; - Session[ReportModelSessionKey] = _Model; + Session[ModelSessionConstants.ReportModelKey] = _Model; } else { - _Model = (ReportModel) Session[ReportModelSessionKey]; + _Model = (ReportModel) Session[ModelSessionConstants.ReportModelKey]; } return _Model; @@ -62,30 +66,41 @@ namespace BeWoPlanerMobil.Controllers [HttpPost] public ActionResult CreateServiceOverview(FormCollection formCollection) { - if(Model == null) + if(Model?.Employee?.EmployeeOid == null) { return Logout(); } - var customerOidString = formCollection["SelectedCustomerOid"]; - var monthString = formCollection["SelectedMonth"]; - var yearString = formCollection["SelectedYear"]; + var customerOidString = formCollection[FormCollectionConstants.SelectedCustomerOidKey]; + var monthString = formCollection[FormCollectionConstants.SelectedMonthKey]; + var yearString = formCollection[FormCollectionConstants.SelectedYearKey]; var isCustomerOidSuccessful = long.TryParse(customerOidString, out var customerOid); - var isMonthSuccessful = int.TryParse(monthString, out var month); - var isYearSuccessful = int.TryParse(yearString, out var year); + var isMonthSuccessful = int.TryParse(monthString, out var month); + var isYearSuccessful = int.TryParse(yearString, out var year); if(!isCustomerOidSuccessful || !isMonthSuccessful || !isYearSuccessful) { return Report(); } - var selectedCustomer = Model.Customers.FirstOrDefault(customer => customer.CustomerOid == customerOid); Model.SelectedCustomer = selectedCustomer; - Model.SelectedYear = year; - Model.SelectedMonth = month; + Model.SelectedYear = year; + Model.SelectedMonth = month; + + var startDay = new DateTime(year, month, 1); + var endDay = startDay.AddMonths(1).AddDays(-1); + + var reportObject = ServicesOverviewRO.Create(customerOid, month, year, false, 0L, Model.Employee.EmployeeOid.Value, 1, endDay.Day, null); + + reportObject.Services.DoForEach(serviceDetail => { Model.QuittierungsbelegItems.Add(new QuittierungsbelegItem(serviceDetail)); }); + + if(Model.QuittierungsbelegItems.Count == 0) + { + TempData["HasWarningMessage"] = true; + } return RedirectToActionPermanent("Report"); } diff --git a/BeWoPlanerMobil/Controllers/SchedulerController.cs b/BeWoPlanerMobil/Controllers/SchedulerController.cs index 011be434d..a9f99f4e1 100644 --- a/BeWoPlanerMobil/Controllers/SchedulerController.cs +++ b/BeWoPlanerMobil/Controllers/SchedulerController.cs @@ -6,6 +6,7 @@ using System.Web.Mvc; using BeWoPlanerMobil.Models; using BeWoPlanerMobil.Service; +using BeWoPlanerMobil.Util; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; using BS.Shared.Extensions; @@ -19,8 +20,6 @@ namespace BeWoPlanerMobil.Controllers { public class SchedulerController : AbstractBaseController { - private const string SchedulerModelSessionKey = "SchedulerModel"; - private SchedulerModel _Model; public SchedulerModel Model { @@ -32,14 +31,14 @@ namespace BeWoPlanerMobil.Controllers return null; } - if (((SchedulerModel) Session[SchedulerModelSessionKey])?.Employee == null) + if (((SchedulerModel) Session[ModelSessionConstants.SchedulerModelKey])?.Employee == null) { _Model = new SchedulerModel { Employee = MobileSessionFacade.LoggedInEmployee }; - Session[SchedulerModelSessionKey] = _Model; + Session[ModelSessionConstants.SchedulerModelKey] = _Model; } else { - _Model = (SchedulerModel) Session[SchedulerModelSessionKey]; + _Model = (SchedulerModel) Session[ModelSessionConstants.SchedulerModelKey]; } return _Model; @@ -191,13 +190,13 @@ namespace BeWoPlanerMobil.Controllers RedirectToActionPermanent("Index", "Login"); } - var rawStartDate = formCollection["StartDate"]; - var rawEndDate = formCollection["EndDate"]; - var rawStartTime = formCollection["StartTime"]; - var rawEndTime = formCollection["EndTime"]; - var subject = formCollection["Subject"]; - var location = formCollection["Location"]; - var notice = formCollection["Notice"]; + var rawStartDate = formCollection[FormCollectionConstants.AppointmentStartDateKey]; + var rawEndDate = formCollection[FormCollectionConstants.AppointmentEndDateKey]; + var rawStartTime = formCollection[FormCollectionConstants.AppointmentStartTimeKey]; + var rawEndTime = formCollection[FormCollectionConstants.AppointmentEndTimeKey]; + var subject = formCollection[FormCollectionConstants.AppointmentSubjectKey]; + var location = formCollection[FormCollectionConstants.AppointmentLocationKey]; + var notice = formCollection[FormCollectionConstants.AppointmentNoticeKey]; var isSuccessfulStartTime = DateTime.TryParseExact(rawStartTime, "HH:mm", null, DateTimeStyles.None, out var startTime); var isSuccessfulEndTime = DateTime.TryParseExact(rawEndTime, "HH:mm", null, DateTimeStyles.None, out var endTime); @@ -301,7 +300,7 @@ namespace BeWoPlanerMobil.Controllers RedirectToActionPermanent("Index", "Login"); } - var rawSchedulerDate = formCollection["SchedulerDate"]; + var rawSchedulerDate = formCollection[FormCollectionConstants.AppointmentSchedulerDateKey]; var schedulerDate = DateTime.ParseExact(rawSchedulerDate, "dd.MM.yyyy", null); @@ -320,7 +319,7 @@ namespace BeWoPlanerMobil.Controllers [HttpPost] public ActionResult SelectAppointmentToEdit(FormCollection formCollection) { - var rawOid = formCollection["scheduler-oid-holder"]; + var rawOid = formCollection[FormCollectionConstants.AppointmentSchedulerOidHolderKey]; var isSuccessful = long.TryParse(rawOid, out var appointmentOid); diff --git a/BeWoPlanerMobil/Models/MainModel.cs b/BeWoPlanerMobil/Models/MainModel.cs index c2c9bb5ae..8f3c7658a 100644 --- a/BeWoPlanerMobil/Models/MainModel.cs +++ b/BeWoPlanerMobil/Models/MainModel.cs @@ -431,9 +431,35 @@ namespace BeWoPlanerMobil.Models public string EndDateToEdit => SelectedServiceRecord?.End?.ToShortDateString() ?? DateTime.Today.ToShortDateString(); - public string StartTimeToEdit => SelectedServiceRecord?.Start?.ToString("HH:mm") ?? string.Empty; + public string StartTimeToEdit + { + get + { + var start = SelectedServiceRecord?.Start; - public string EndTimeToEdit => SelectedServiceRecord?.End?.ToString("HH:mm") ?? string.Empty; + if(start != null && !(start.Value.GetServiceRecordNoDateTimeDate().Equals(start))) + { + return start.Value.ToString("HH:mm"); + } + + return string.Empty; + } + } + + public string EndTimeToEdit + { + get + { + var end = SelectedServiceRecord?.End; + + if(end != null && !end.Value.GetServiceRecordNoDateTimeDate().Equals(end)) + { + return end.Value.ToString("HH:mm"); + } + + return string.Empty; + } + } public string DurationToEdit => SelectedServiceRecord?.RoundedDuration.ToString() ?? string.Empty; diff --git a/BeWoPlanerMobil/Models/ReportModel.cs b/BeWoPlanerMobil/Models/ReportModel.cs index fd82ef60f..25513c754 100644 --- a/BeWoPlanerMobil/Models/ReportModel.cs +++ b/BeWoPlanerMobil/Models/ReportModel.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web.Mvc; +using BeWoPlanerMobil.Util; using BS.Shared.DataContracts.Compact; namespace BeWoPlanerMobil.Models @@ -63,5 +64,7 @@ namespace BeWoPlanerMobil.Models return result; } } + + public List QuittierungsbelegItems { get; set; } = new List(); } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Scripts/signature.js b/BeWoPlanerMobil/Scripts/signature.js index da14dacfa..29ba4bb0f 100644 --- a/BeWoPlanerMobil/Scripts/signature.js +++ b/BeWoPlanerMobil/Scripts/signature.js @@ -118,6 +118,12 @@ document.addEventListener("DOMContentLoaded", event => { } }); +document.addEventListener("DOMContentLoaded", event => { + if ($("#report-sketch-pad").length !== 0) { + new Signature(); + } +}); + function prepareSigningPopup(serviceRecordOid) { $("#main-container, #checkbox-container").hide(); $("#signature-container").addClass("d-block"); diff --git a/BeWoPlanerMobil/Scripts/view-scripts/report.js b/BeWoPlanerMobil/Scripts/view-scripts/report.js index e2d9d6e58..2a7131dac 100644 --- a/BeWoPlanerMobil/Scripts/view-scripts/report.js +++ b/BeWoPlanerMobil/Scripts/view-scripts/report.js @@ -1,3 +1,10 @@ -function setSelectedCustomer() { +function prepareReportSignature() { + $("#report-form-container").hide(); + $("#report-signature-container").addClass("d-block"); + + resizeCanvas(); +} + +function saveReportSignature() { } \ No newline at end of file diff --git a/BeWoPlanerMobil/Util/FormCollectionConstants.cs b/BeWoPlanerMobil/Util/FormCollectionConstants.cs new file mode 100644 index 000000000..b1e9bd3cc --- /dev/null +++ b/BeWoPlanerMobil/Util/FormCollectionConstants.cs @@ -0,0 +1,55 @@ +namespace BeWoPlanerMobil.Util +{ + public class FormCollectionConstants + { + // Zeiterfassung + public static string ShowOnlyOwnSupportConceptsKey => "ShowOnlyOwnSupportConcepts"; + public static string ShowExpiredSupportConceptsKey => "ShowExpiredSupportConcepts"; + public static string DateKey => "Datum"; + public static string Dokumentation1Key => "Dokumentation1"; + public static string Dokumentation2Key => "Dokumentation2"; + public static string Dokumentation3Key => "Dokumentation3"; + public static string Dokumentation4Key => "Dokumentation4"; + public static string Dokumentation5Key => "Dokumentation5"; + public static string Dokumentation6Key => "Dokumentation6"; + public static string DistanceKey => "Distanz"; + public static string StartKey => "Start"; + public static string EndKey => "Ende"; + public static string EndDateKey => "Enddatum"; + public static string DurationKey => "Dauer"; + public static string HiddenInputKey => "versteckt"; + public static string ServiceDescriptionKey => "ServiceDescription"; + public static string CostBearer2SupportConceptOidKey => "CostBearer2SupportConceptOid"; + public static string ServiceRecordOidHolderKey => "serviceRecordOidHolder"; + public static string RecordsKey => "Records"; + public static string ServiceRecordOidHolder2Key => "service-record-oid-holder"; + public static string IsInGroupBookingModeKey => "IsInGroupBookingMode"; + public static string SignatureOidHolderKey => "signatureOidHolder"; + + + // Kalender + public static string AppointmentStartDateKey => "StartDate"; + public static string AppointmentStartTimeKey => "StartTime"; + public static string AppointmentEndDateKey => "EndDate"; + public static string AppointmentEndTimeKey => "EndTime"; + public static string AppointmentSubjectKey => "Subject"; + public static string AppointmentLocationKey => "Location"; + public static string AppointmentNoticeKey => "Notice"; + public static string AppointmentSchedulerDateKey => "SchedulerDate"; + public static string AppointmentSchedulerOidHolderKey => "scheduler-oid-holder"; + + + // Auswertung + public static string SelectedCustomerOidKey => "SelectedCustomerOid"; + public static string SelectedMonthKey => "SelectedMonth"; + public static string SelectedYearKey => "SelectedYear"; + } + + public class ModelSessionConstants + { + public static string ReportModelKey => "ReportModel"; + public static string CustomerModelKey => "CustomerModelModel"; + public static string SchedulerModelKey => "SchedulerModel"; + public static string MainModelKey => "MainModel"; + } +} \ No newline at end of file diff --git a/BeWoPlanerMobil/Util/QuittierungsbelegItem.cs b/BeWoPlanerMobil/Util/QuittierungsbelegItem.cs new file mode 100644 index 000000000..161dbe61c --- /dev/null +++ b/BeWoPlanerMobil/Util/QuittierungsbelegItem.cs @@ -0,0 +1,33 @@ +using System; +using BeWo.Report.ReportObjects; + +namespace BeWoPlanerMobil.Util +{ + public class QuittierungsbelegItem + { + public Guid Identifier { get; } + + public string DateTimeString { get; } + + public string Kontaktart { get; set; } + + public int CustomersCount { get; set; } + + public double Minutes { get; set; } + + public string Employees { get; set; } + + + public QuittierungsbelegItem(ServicesOverviewRO.ServiceDetail serviceDetail) + { + Kontaktart = serviceDetail.IsGroup ? "GR" : "E"; + CustomersCount = serviceDetail.CustomerCount; + Minutes = serviceDetail.Minutes; + Employees = serviceDetail.EmployeeAbbr; + + DateTimeString = $"{serviceDetail.StartDate:dd.MM.yyyy HH:mm} - {serviceDetail.EndDate:HH:mm}"; + + Identifier = Guid.NewGuid(); + } + } +} \ No newline at end of file diff --git a/BeWoPlanerMobil/Views/Report/Report.cshtml b/BeWoPlanerMobil/Views/Report/Report.cshtml index f8aef73ed..2587f05cb 100644 --- a/BeWoPlanerMobil/Views/Report/Report.cshtml +++ b/BeWoPlanerMobil/Views/Report/Report.cshtml @@ -14,7 +14,7 @@ Info: --> -
+
@using(Html.BeginForm("CreateServiceOverview", "Report", FormMethod.Post)) @@ -57,5 +57,98 @@ Info:
}
+
+
+ @if(TempData["HasWarningMessage"] != null) + { + + } + else if(Model?.QuittierungsbelegItems?.Count > 0) + { + foreach(var item in Model.QuittierungsbelegItems) + { +
+
+
+ +
+
+
+
+
+
+
+ Kontaktart: +
+
+ @item.Kontaktart +
+
+
+
+ Anzahl Klienten: +
+
+ @item.CustomersCount +
+
+
+
+ FLS in Minuten (ohne 1,2): +
+
+ @item.Minutes +
+
+
+
+
+
+ } + + if(Model?.QuittierungsbelegItems?.Count > 0) + { +
+
+ +
+
+ +
+
+ } + } +
+
+
+
+ +
+
+
+
+

Unterschrift

+ +
+
+
+
+ +
+
+
+
+ + +
+
\ No newline at end of file diff --git a/Shared/Extensions/DateTimeExtensions.cs b/Shared/Extensions/DateTimeExtensions.cs index ed2e1be73..6b3b0696a 100644 --- a/Shared/Extensions/DateTimeExtensions.cs +++ b/Shared/Extensions/DateTimeExtensions.cs @@ -548,5 +548,10 @@ namespace BS.Shared.Extensions { return new DateTime(dateTime.Year, dateTime.Month, 1); } + + public static DateTime GetServiceRecordNoDateTimeDate(this DateTime date) + { + return date.MergeDateAndTimeSpan(new TimeSpan(0, 0, 1)); + } } } \ No newline at end of file From 0cb5c0283123f3b471ba0409f6a02d64d2fc39bb Mon Sep 17 00:00:00 2001 From: Lyndon Jetten Date: Wed, 23 Sep 2020 16:00:51 +0200 Subject: [PATCH 2/2] BeWoPlanerMobil: Fortschritt bei Quittierungsbelegunterschrift MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Qlik: Zeitraum hinzugefügt --- BeWo/ServiceProxy/Generated.cs | 66 +++++++++++++ .../Controllers/ReportController.cs | 14 +++ BeWoPlanerMobil/Models/AbstractModel.cs | 2 +- BeWoPlanerMobil/Models/ReportModel.cs | 12 ++- BeWoPlanerMobil/Scripts/signature.js | 14 +++ .../Scripts/view-scripts/report.js | 19 ++++ BeWoPlanerMobil/Views/Main/Main.cshtml | 14 --- BeWoPlanerMobil/Views/Report/Report.cshtml | 20 ++-- Data/Access/SearchDAO.cs | 35 +++++-- Data/Data.csproj | 2 + Data/Entities/ConfirmationReceiptSignature.cs | 52 ++++++++++ .../ConfirmationReceiptSignature.hbm.xml | 25 +++++ ...09_18_Quittierungsbelegsunterschriften.txt | 25 +++++ .../demo_reports/Export/QlikCsvExporter.cs | 26 +++-- ...ignatureDC_ConfirmationReceiptSignature.cs | 34 +++++++ Service/DCEntityMapper/MapperFactory.cs | 5 + Service/Plugins/PluginLoader.cs | 2 +- Service/Service.csproj | 1 + .../ServiceContracts/IOperationsService.cs | 24 +++++ .../OperationsServiceImp.cs | 94 +++++++++++++++++++ Shared/BeWoEntityEnums.cs | 7 +- .../ConfirmationReceiptSignatureDC.cs | 24 +++++ Shared/Shared.csproj | 1 + 23 files changed, 465 insertions(+), 53 deletions(-) create mode 100644 Data/Entities/ConfirmationReceiptSignature.cs create mode 100644 Data/Mappings/ConfirmationReceiptSignature.hbm.xml create mode 100644 Model/Changes_2020_09_18_Quittierungsbelegsunterschriften.txt create mode 100644 Service/DCEntityMapper/ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature.cs create mode 100644 Shared/DataContracts/ConfirmationReceiptSignatureDC.cs diff --git a/BeWo/ServiceProxy/Generated.cs b/BeWo/ServiceProxy/Generated.cs index b4c79c239..056bdfa79 100644 --- a/BeWo/ServiceProxy/Generated.cs +++ b/BeWo/ServiceProxy/Generated.cs @@ -1535,6 +1535,8 @@ namespace BeWo.ServiceProxy [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.DienstDC))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.ConfirmationReceiptSignatureDC))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.BargeldkassenDC))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] @@ -4787,6 +4789,40 @@ namespace BeWo.ServiceProxy [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/FetchServiceRecordRatingsBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] System.Collections.Generic.List FetchServiceRecordRatings(System.Nullable supportConceptOid, System.Nullable costBearer2SupportConceptOid, System.Nullable supportConceptApprovalPeriodOid, System.Nullable serviceCategoryOid, System.Nullable start, System.Nullable end); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/InsertConfirmationReceiptSignature", ReplyAction="http://tempuri.org/IOperationsService/InsertConfirmationReceiptSignatureResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/InsertConfirmationReceiptSignatureBeWoFault" + + "Fault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + void InsertConfirmationReceiptSignature(BS.Shared.DataContracts.ConfirmationReceiptSignatureDC confirmationReceiptSignature); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/InsertConfirmationReceiptSignatures", ReplyAction="http://tempuri.org/IOperationsService/InsertConfirmationReceiptSignaturesResponse" + + "")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/InsertConfirmationReceiptSignaturesBeWoFaul" + + "tFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + void InsertConfirmationReceiptSignatures(System.Collections.Generic.List confirmationReceiptSignatures); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/DeleteConfirmationReceiptSignature", ReplyAction="http://tempuri.org/IOperationsService/DeleteConfirmationReceiptSignatureResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/DeleteConfirmationReceiptSignatureBeWoFault" + + "Fault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + void DeleteConfirmationReceiptSignature(long confirmationReceiptSignatureOid); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/UpdateConfirmationReceiptSignature", ReplyAction="http://tempuri.org/IOperationsService/UpdateConfirmationReceiptSignatureResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/UpdateConfirmationReceiptSignatureBeWoFault" + + "Fault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.Shared.DataContracts.ConfirmationReceiptSignatureDC UpdateConfirmationReceiptSignature(BS.Shared.DataContracts.ConfirmationReceiptSignatureDC confirmationReceiptSignature); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetConfirmationReceiptSignaturesByEmployee", ReplyAction="http://tempuri.org/IOperationsService/GetConfirmationReceiptSignaturesByEmployeeR" + + "esponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetConfirmationReceiptSignaturesByEmployeeB" + + "eWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + System.Collections.Generic.List GetConfirmationReceiptSignaturesByEmployee(long employeeOid, BS.Shared.Core.DateTimeSpan timeSpan); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetConfirmationReceiptSignaturesByServiceRe" + + "cord", ReplyAction="http://tempuri.org/IOperationsService/GetConfirmationReceiptSignaturesByServiceRe" + + "cordResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetConfirmationReceiptSignaturesByServiceRe" + + "cordBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + System.Collections.Generic.List GetConfirmationReceiptSignaturesByServiceRecord(long serviceRecordOid); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/UpdateIsChatActiveCustomerAPPCodeDC", ReplyAction="http://tempuri.org/IOperationsService/UpdateIsChatActiveCustomerAPPCodeDCResponse" + "")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/UpdateIsChatActiveCustomerAPPCodeDCBeWoFaul" + @@ -5807,6 +5843,36 @@ namespace BeWo.ServiceProxy return base.Channel.FetchServiceRecordRatings(supportConceptOid, costBearer2SupportConceptOid, supportConceptApprovalPeriodOid, serviceCategoryOid, start, end); } + public void InsertConfirmationReceiptSignature(BS.Shared.DataContracts.ConfirmationReceiptSignatureDC confirmationReceiptSignature) + { + base.Channel.InsertConfirmationReceiptSignature(confirmationReceiptSignature); + } + + public void InsertConfirmationReceiptSignatures(System.Collections.Generic.List confirmationReceiptSignatures) + { + base.Channel.InsertConfirmationReceiptSignatures(confirmationReceiptSignatures); + } + + public void DeleteConfirmationReceiptSignature(long confirmationReceiptSignatureOid) + { + base.Channel.DeleteConfirmationReceiptSignature(confirmationReceiptSignatureOid); + } + + public BS.Shared.DataContracts.ConfirmationReceiptSignatureDC UpdateConfirmationReceiptSignature(BS.Shared.DataContracts.ConfirmationReceiptSignatureDC confirmationReceiptSignature) + { + return base.Channel.UpdateConfirmationReceiptSignature(confirmationReceiptSignature); + } + + public System.Collections.Generic.List GetConfirmationReceiptSignaturesByEmployee(long employeeOid, BS.Shared.Core.DateTimeSpan timeSpan) + { + return base.Channel.GetConfirmationReceiptSignaturesByEmployee(employeeOid, timeSpan); + } + + public System.Collections.Generic.List GetConfirmationReceiptSignaturesByServiceRecord(long serviceRecordOid) + { + return base.Channel.GetConfirmationReceiptSignaturesByServiceRecord(serviceRecordOid); + } + public void UpdateIsChatActiveCustomerAPPCodeDC(long customerOid, int activeType) { base.Channel.UpdateIsChatActiveCustomerAPPCodeDC(customerOid, activeType); diff --git a/BeWoPlanerMobil/Controllers/ReportController.cs b/BeWoPlanerMobil/Controllers/ReportController.cs index 401caed33..32fb3b662 100644 --- a/BeWoPlanerMobil/Controllers/ReportController.cs +++ b/BeWoPlanerMobil/Controllers/ReportController.cs @@ -5,6 +5,7 @@ using BeWo.Report.ReportObjects; using BeWoPlanerMobil.Models; using BeWoPlanerMobil.Service; using BeWoPlanerMobil.Util; +using BS.Shared.Core; using BS.Shared.Extensions; namespace BeWoPlanerMobil.Controllers @@ -59,6 +60,8 @@ namespace BeWoPlanerMobil.Controllers Model.Customers = customers; + var test = OperationsService.GetConfirmationReceiptSignaturesByEmployee(1, new DateTimeSpan(new DateTime(2020, 1, 1), new DateTime(2020, 2, 1))); + return View(Model); } @@ -84,6 +87,8 @@ namespace BeWoPlanerMobil.Controllers return Report(); } + Model.QuittierungsbelegItems.Clear(); + var selectedCustomer = Model.Customers.FirstOrDefault(customer => customer.CustomerOid == customerOid); Model.SelectedCustomer = selectedCustomer; @@ -117,5 +122,14 @@ namespace BeWoPlanerMobil.Controllers return _LeerzeichenFuerGetMethoden; } + + [Authorize] + [HttpPost] + public ActionResult CreateEmployeeSignatureForServiceOverview(FormCollection formCollection) + { + + + return RedirectToActionPermanent("Report"); + } } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Models/AbstractModel.cs b/BeWoPlanerMobil/Models/AbstractModel.cs index 8b19a7b88..ae2f01d23 100644 --- a/BeWoPlanerMobil/Models/AbstractModel.cs +++ b/BeWoPlanerMobil/Models/AbstractModel.cs @@ -34,6 +34,6 @@ namespace BeWoPlanerMobil.Models public static string TimeOfLastAction { get; set; } public static bool HasRightToInsertRessourceAppointments => MobileSessionFacade.CheckForUserRight(UserRightType.KalenderRessourcentermineAnlegen) || MobileSessionFacade.CheckForUserRight(UserRightType.CreateAll); - public static bool IsAllowedToSeeBills => false;//MobileSessionFacade.CheckForUserRight(UserRightType.Analysis_ServiceOverview_View); + public static bool IsAllowedToSeeBills => false;// MobileSessionFacade.CheckForUserRight(UserRightType.Analysis_ServiceOverview_View); } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Models/ReportModel.cs b/BeWoPlanerMobil/Models/ReportModel.cs index 25513c754..9450e618c 100644 --- a/BeWoPlanerMobil/Models/ReportModel.cs +++ b/BeWoPlanerMobil/Models/ReportModel.cs @@ -43,7 +43,11 @@ namespace BeWoPlanerMobil.Models for(var i = 1; i < 13; i++) { - result.Add(new SelectListItem {Value = i.ToString(), Text = i.ToString()}); + result.Add(new SelectListItem + { + Value = i.ToString(), + Text = new DateTime(DateTime.Now.Year, i, 1).ToString("MMMM") + }); } return result; @@ -58,7 +62,11 @@ namespace BeWoPlanerMobil.Models for(var i = DateTime.Today.Year + 1; i > DateTime.Today.Year - 11; i--) { - result.Add(new SelectListItem {Value = i.ToString(), Text = i.ToString()}); + result.Add(new SelectListItem + { + Value = i.ToString(), + Text = i.ToString() + }); } return result; diff --git a/BeWoPlanerMobil/Scripts/signature.js b/BeWoPlanerMobil/Scripts/signature.js index 29ba4bb0f..4438db68e 100644 --- a/BeWoPlanerMobil/Scripts/signature.js +++ b/BeWoPlanerMobil/Scripts/signature.js @@ -215,4 +215,18 @@ function hideSignature() { var url = getResetSignatureImageUrl(); $.get(url); +} + +function resizeCanvas() { + if($("#sketch-pad").length !== 0) { + var rowWidth = $("#canvas-row").innerWidth(); + var canvasWidth = $("#sketch-pad").innerWidth(); + + var newWidth = rowWidth; + + if(newWidth !== canvasWidth) { + $("#sketch-pad").prop("width", newWidth); + new Signature(); + } + } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Scripts/view-scripts/report.js b/BeWoPlanerMobil/Scripts/view-scripts/report.js index 2a7131dac..047fcafcf 100644 --- a/BeWoPlanerMobil/Scripts/view-scripts/report.js +++ b/BeWoPlanerMobil/Scripts/view-scripts/report.js @@ -2,9 +2,28 @@ $("#report-form-container").hide(); $("#report-signature-container").addClass("d-block"); + var customer = $("#customers-drop-down option:selected").text(); + var month = $("#month-select option:selected").text(); + var year = $("#year-select option:selected").text(); + + $("#report-info-column").html("Unterschrift für erbrachte Leistungen von " + customer + " im " + month + " " + year); + resizeCanvas(); } function saveReportSignature() { + // TODO: Meldung anzeigen +} +function confirmReportSignatureCancellation() { + showMessagePopupWithCallback("Unterschrift", "Sind Sie sicher, dass Sie die Unterschrift nicht speichern möchten?", + function() { + $("#report-signature-container").removeClass("d-block"); + $("#report-form-container").show(); + + var canvas = document.getElementById("sketch-pad"); + var context = canvas.getContext("2d"); + context.clearRect(0, 0, canvas.width, canvas.height); + + }, false); } \ No newline at end of file diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index 951cbc41e..9a40de2f3 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -141,20 +141,6 @@ resizeCanvas(); }); - function resizeCanvas() { - if($("#sketch-pad").length !== 0) { - var rowWidth = $("#canvas-row").innerWidth(); - var canvasWidth = $("#sketch-pad").innerWidth(); - - var newWidth = rowWidth; - - if (newWidth !== canvasWidth) { - $("#sketch-pad").prop("width", newWidth); - new Signature(); - } - } - } - function getSetServiceRecordEmployeeUrl() { return "@Url.Action("SetServiceRecordEmployee")"; } diff --git a/BeWoPlanerMobil/Views/Report/Report.cshtml b/BeWoPlanerMobil/Views/Report/Report.cshtml index 2587f05cb..973ed1905 100644 --- a/BeWoPlanerMobil/Views/Report/Report.cshtml +++ b/BeWoPlanerMobil/Views/Report/Report.cshtml @@ -14,7 +14,7 @@ Info: --> -
+
@using(Html.BeginForm("CreateServiceOverview", "Report", FormMethod.Post)) @@ -35,13 +35,13 @@ Info:
@Html.LabelFor(m => m.SelectedMonth) - @Html.DropDownListFor(m => m.SelectedMonth, Model.Months, new { @class = "form-control" }) + @Html.DropDownListFor(m => m.SelectedMonth, Model.Months, new { @class = "form-control", id = "month-select" })
@Html.LabelFor(m => m.SelectedYear) - @Html.DropDownListFor(m => m.SelectedYear, Model.Years, new { @class = "form-control" }) + @Html.DropDownListFor(m => m.SelectedYear, Model.Years, new { @class = "form-control", id = "year-select" })
@@ -119,7 +119,7 @@ Info:
- +
} @@ -129,19 +129,19 @@ Info:
-
+
-

Unterschrift

-
-
-
- +
+
+
diff --git a/Data/Access/SearchDAO.cs b/Data/Access/SearchDAO.cs index d42da4bf2..bbaac8c1e 100644 --- a/Data/Access/SearchDAO.cs +++ b/Data/Access/SearchDAO.cs @@ -3290,13 +3290,6 @@ namespace BeWo.Data.Access { var c = CreateCriteria("r").Add(Restrictions.Eq(nameof(BeWoEntityBase.IsActive), ActivationTypeId.Active)); - /* - * var detachedCriteria1 = DetachedCriteria.For() - .Add(Restrictions.In(Employee2SchedulerAppointment.PropertyName_Employee + ".Oid", pSelectedEmployees)) - .SetProjection(Projections.Property(Employee2SchedulerAppointment.PropertyName_SchedulerAppointment)); - var employee2SchedCrit = Subqueries.PropertyIn(BeWoEntityBase.PropertyName_Oid, detachedCriteria1); - */ - var sql = $"Oid NOT IN (SELECT Oid FROM resource WHERE isactive = 1 AND Oid NOT IN (SELECT resourceoid FROM resource2newschapp r2n WHERE r2n.newschappoid NOT IN (SELECT oid FROM newschedulerappointment WHERE startdate > '{start:yyyy-MM-dd HH:mm:ss}' OR enddate < '{end:yyyy-MM-dd HH:mm:ss}')))"; var criterion = Expression.Sql(sql); @@ -3438,5 +3431,33 @@ namespace BeWo.Data.Access return result; } + + public IList GetConfirmationReceiptSignaturesByEmployee(long employeeOid, DateTimeSpan timeSpan) + { + /* + * var detachedCriteria1 = DetachedCriteria.For() + .Add(Restrictions.In(Employee2SchedulerAppointment.PropertyName_Employee + ".Oid", pSelectedEmployees)) + .SetProjection(Projections.Property(Employee2SchedulerAppointment.PropertyName_SchedulerAppointment)); + var employee2SchedCrit = Subqueries.PropertyIn(BeWoEntityBase.PropertyName_Oid, detachedCriteria1); + */ + + var between = CreateBetweenDateTimesCriterion(timeSpan.StartDateTime, timeSpan.EndDateTime, nameof(ServiceRecord.Start), nameof(ServiceRecord.End)); + + var criteria = CreateCriteriaIsActive() + .Add(Restrictions.Eq(nameof(ConfirmationReceiptSignature.EmployeeOid), employeeOid)) + .CreateCriteria(nameof(ConfirmationReceiptSignature.ServiceRecords), JoinType.InnerJoin).Add(between); + + var mySql = ToSql(criteria); + + return criteria.List(); + } + + public List GetConfirmationReceiptSignaturesByServiceRecord(long serviceRecordOid) + { + var detachedCriteria = DetachedCriteria.For() + .Add(Subqueries.PropertyIn(nameof(ServiceRecord.Oid), DetachedCriteria.For().SetProjection(Projections.Property(nameof(ServiceRecord.Oid))))); + + return null; + } } } diff --git a/Data/Data.csproj b/Data/Data.csproj index c993b9a51..535612a0c 100644 --- a/Data/Data.csproj +++ b/Data/Data.csproj @@ -134,6 +134,7 @@ + @@ -606,6 +607,7 @@ Designer + Designer diff --git a/Data/Entities/ConfirmationReceiptSignature.cs b/Data/Entities/ConfirmationReceiptSignature.cs new file mode 100644 index 000000000..68b841c8b --- /dev/null +++ b/Data/Entities/ConfirmationReceiptSignature.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; + +namespace BeWo.Data.Entities +{ + public class ConfirmationReceiptSignature : BeWoEntityBase + { + private long? _EmployeeOid; + + private IList _ServiceRecords; + + private string _SignatureImage; + + public virtual long? EmployeeOid + { + get => _EmployeeOid; + + set + { + if(AreDifferent(_EmployeeOid, value)) + { + _EmployeeOid = value; + } + } + } + + public virtual IList ServiceRecords + { + get => _ServiceRecords; + + set + { + if(AreDifferent(_ServiceRecords, value)) + { + _ServiceRecords = value; + } + } + } + + public virtual string SignatureImage + { + get => _SignatureImage; + + set + { + if(AreDifferent(_SignatureImage, value)) + { + _SignatureImage = value; + } + } + } + } +} diff --git a/Data/Mappings/ConfirmationReceiptSignature.hbm.xml b/Data/Mappings/ConfirmationReceiptSignature.hbm.xml new file mode 100644 index 000000000..4230413de --- /dev/null +++ b/Data/Mappings/ConfirmationReceiptSignature.hbm.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Model/Changes_2020_09_18_Quittierungsbelegsunterschriften.txt b/Model/Changes_2020_09_18_Quittierungsbelegsunterschriften.txt new file mode 100644 index 000000000..68a628383 --- /dev/null +++ b/Model/Changes_2020_09_18_Quittierungsbelegsunterschriften.txt @@ -0,0 +1,25 @@ +CREATE TABLE `confirmationreceiptsignature` ( + `Oid` bigint(19) NOT NULL AUTO_INCREMENT, + `Tid` int(10) DEFAULT NULL, + `Notice` varchar(1024) DEFAULT NULL, + `InsTs` datetime DEFAULT NULL, + `InsUser` varchar(256) DEFAULT NULL, + `Version` bigint(19) DEFAULT NULL, + `UdpUser` varchar(256) DEFAULT NULL, + `IsActive` tinyint(4) DEFAULT NULL, + `SystemEntryID` int(10) DEFAULT NULL, + `SignatureImage` longtext, + `EmployeeOid` bigint(19) DEFAULT NULL, + PRIMARY KEY (`Oid`), + KEY `CONFIRMATIONRECEIPTSIGNATURE_EMPLOYEE_FK` (`EmployeeOid`), + CONSTRAINT `FK_CONFIRMATIONRECEIPTSIGNATURE2EMPLOYEE` FOREIGN KEY (`EmployeeOid`) REFERENCES `Employee` (`Oid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `confirmationsignature2servicerecord` ( + `ConfirmationSignatureOid` bigint(19) DEFAULT NULL, + `ServiceRecordOid` bigint(19) DEFAULT NULL, + KEY `CONFSIG2SERVREC_CONFSIG_FK` (`ConfirmationSignatureOid`), + CONSTRAINT `FK_CONFSIG2SERVREC_CONFSIG` FOREIGN KEY (`ConfirmationSignatureOid`) REFERENCES `confirmationreceiptsignature` (`Oid`), + KEY `CONFSIG2SERVREC_SERVREC_FK` (`ServiceRecordOid`), + CONSTRAINT `FK_CONFSIG2SERVREC_SERVREC` FOREIGN KEY (`ServiceRecordOid`) REFERENCES `servicerecord` (`Oid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file diff --git a/ReportImp/demo_reports/Export/QlikCsvExporter.cs b/ReportImp/demo_reports/Export/QlikCsvExporter.cs index 4aba28ca5..7656f9a7b 100644 --- a/ReportImp/demo_reports/Export/QlikCsvExporter.cs +++ b/ReportImp/demo_reports/Export/QlikCsvExporter.cs @@ -136,7 +136,9 @@ namespace demo_reports.Export MitarbeiterId = absenceTime.EmployeeOid, Beginn = $"{absenceTime.Start:yyyy-MM-dd}", Ende = $"{absenceTime.End:yyyy-MM-dd}", - Abwesenheitskategorie = absenceTime.AbsenceReason.Description + Abwesenheitskategorie = absenceTime.AbsenceReason.Description, + ZeitraumVon = $"{dateTimeSpan.StartDate:yyyy-MM-dd}", + ZeitraumBis = $"{dateTimeSpan.EndDate:yyyy-MM-dd}" }); } }); @@ -218,7 +220,9 @@ namespace demo_reports.Export FLSSoll = flsSoll, GesamtIst = gesamtIst, StundenSoll = stundenSoll, - IstFachkraft = employee.IsQualified ?? false + IstFachkraft = employee.IsQualified ?? false, + ZeitraumVon = $"{dateTimeSpan.StartDate:yyyy-MM-dd}", + ZeitraumBis = $"{dateTimeSpan.EndDate:yyyy-MM-dd}" }); } catch(Exception exception) @@ -228,16 +232,7 @@ namespace demo_reports.Export } }); - var stringWriter = new StringWriter(); - - - using(var csv = new CsvWriter(stringWriter, CreateCsvConfig())) - { - - csv.WriteRecords(resultList); - } - - return stringWriter.ToString(); + return CreateCsvString(resultList); } private static string GetCustomerCSV() @@ -279,7 +274,9 @@ namespace demo_reports.Export GerundeteGruppendauer = serviceRecord.GroupRoundedDuration, GruppenId = serviceRecord.GroupOid, Kategorie = serviceRecord.ServiceDescription.Name, - KostentraegerZuHilfeplanId = serviceRecord.CostBearer2SupportConceptOid + KostentraegerZuHilfeplanId = serviceRecord.CostBearer2SupportConceptOid, + ZeitraumVon = $"{dateTimeSpan.StartDate:yyyy-MM-dd}", + ZeitraumBis = $"{dateTimeSpan.EndDate:yyyy-MM-dd}" }); }); @@ -348,8 +345,7 @@ namespace demo_reports.Export private static CsvConfiguration CreateCsvConfig() { - var config = new CsvConfiguration(CultureInfo.GetCultureInfo("de-DE")); - config.Delimiter = ";"; + var config = new CsvConfiguration(CultureInfo.GetCultureInfo("de-DE")) {Delimiter = ";"}; return config; } diff --git a/Service/DCEntityMapper/ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature.cs b/Service/DCEntityMapper/ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature.cs new file mode 100644 index 000000000..b9fedd84f --- /dev/null +++ b/Service/DCEntityMapper/ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BeWo.Data.Entities; +using BS.Shared.DataContracts; + +namespace BeWo.Service.DCEntityMapper +{ + public class ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature : AbstractIDCEntityMapper + { + public override ConfirmationReceiptSignatureDC MergeWithDC(ConfirmationReceiptSignature pEntity, ConfirmationReceiptSignatureDC pDataContract) + { + pDataContract.SignatureImage = pEntity.SignatureImage; + + pDataContract.EmployeeOid = pEntity.EmployeeOid; + + pDataContract.ServiceRecords = MapperFactory.ServiceRecordDC_ServiceRecord.MapToNewDCs(pEntity.ServiceRecords); + + return pDataContract; + } + + public override ConfirmationReceiptSignature MergeWithEntity(ConfirmationReceiptSignatureDC pDataContract, ConfirmationReceiptSignature pEntity) + { + throw new NotImplementedException(); + } + + protected override bool AreDCAndEntityEqual(ConfirmationReceiptSignatureDC pDC, ConfirmationReceiptSignature pEntity) + { + throw new NotImplementedException(); + } + } +} diff --git a/Service/DCEntityMapper/MapperFactory.cs b/Service/DCEntityMapper/MapperFactory.cs index df9d92350..f4aa4689e 100644 --- a/Service/DCEntityMapper/MapperFactory.cs +++ b/Service/DCEntityMapper/MapperFactory.cs @@ -268,6 +268,8 @@ namespace BeWo.Service.DCEntityMapper private static GoalRatingDC_GoalRating _GoalRatingDC_GoalRating; + private static ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature _ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature; + public static MedRecordDC_MedRecord MedRecordDC_MedRecord => _MedRecordDC_MedRecord ?? (_MedRecordDC_MedRecord = new MedRecordDC_MedRecord()); @@ -673,5 +675,8 @@ namespace BeWo.Service.DCEntityMapper public static RatingTypeDC_RatingType RatingTypeDC_RatingType => _RatingTypeDC_RatingType ?? (_RatingTypeDC_RatingType = new RatingTypeDC_RatingType()); + + public static ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature => + _ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature ?? (_ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature = new ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature()); } } \ No newline at end of file diff --git a/Service/Plugins/PluginLoader.cs b/Service/Plugins/PluginLoader.cs index ccfc16ce8..016eee679 100644 --- a/Service/Plugins/PluginLoader.cs +++ b/Service/Plugins/PluginLoader.cs @@ -19,7 +19,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 diff --git a/Service/Service.csproj b/Service/Service.csproj index 68e5f4040..eae59aec4 100644 --- a/Service/Service.csproj +++ b/Service/Service.csproj @@ -166,6 +166,7 @@ + diff --git a/Service/ServiceContracts/IOperationsService.cs b/Service/ServiceContracts/IOperationsService.cs index 569834ec6..23f15d84c 100644 --- a/Service/ServiceContracts/IOperationsService.cs +++ b/Service/ServiceContracts/IOperationsService.cs @@ -907,5 +907,29 @@ namespace BeWo.Service.ServiceContracts [FaultContract(typeof(BeWoFault))] [OperationContract] List FetchServiceRecordRatings(long? supportConceptOid, long? costBearer2SupportConceptOid, long? supportConceptApprovalPeriodOid, long? serviceCategoryOid, DateTime? start, DateTime? end); + + [FaultContract(typeof(BeWoFault))] + [OperationContract] + void InsertConfirmationReceiptSignature(ConfirmationReceiptSignatureDC confirmationReceiptSignature); + + [FaultContract(typeof(BeWoFault))] + [OperationContract] + void InsertConfirmationReceiptSignatures(List confirmationReceiptSignatures); + + [FaultContract(typeof(BeWoFault))] + [OperationContract] + void DeleteConfirmationReceiptSignature(long confirmationReceiptSignatureOid); + + [FaultContract(typeof(BeWoFault))] + [OperationContract] + ConfirmationReceiptSignatureDC UpdateConfirmationReceiptSignature(ConfirmationReceiptSignatureDC confirmationReceiptSignature); + + [FaultContract(typeof(BeWoFault))] + [OperationContract] + List GetConfirmationReceiptSignaturesByEmployee(long employeeOid, DateTimeSpan timeSpan); + + [FaultContract(typeof(BeWoFault))] + [OperationContract] + List GetConfirmationReceiptSignaturesByServiceRecord(long serviceRecordOid); } } \ No newline at end of file diff --git a/Service/ServiceImplementations/OperationsServiceImp.cs b/Service/ServiceImplementations/OperationsServiceImp.cs index c8034c53c..eb0f2f9f7 100644 --- a/Service/ServiceImplementations/OperationsServiceImp.cs +++ b/Service/ServiceImplementations/OperationsServiceImp.cs @@ -5994,5 +5994,99 @@ namespace BeWo.Service.ServiceImplementations throw Utils.CreateBeWoFaultException(e); } } + + public void InsertConfirmationReceiptSignature(ConfirmationReceiptSignatureDC confirmationReceiptSignature) + { + try + { + var confRecSig = MapperFactory.ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature.MapToNewEntity(confirmationReceiptSignature); + + DAOFactory.GenericDAO.Insert(confRecSig); + } + catch(Exception exception) + { + throw Utils.CreateBeWoFaultException(exception); + } + } + + public void InsertConfirmationReceiptSignatures(List confirmationReceiptSignatures) + { + try + { + var confRecSigs = MapperFactory.ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature.MapToNewEntities(confirmationReceiptSignatures); + + DAOFactory.GenericDAO.Insert(confRecSigs); + } + catch(Exception exception) + { + throw Utils.CreateBeWoFaultException(exception); + } + } + + public void DeleteConfirmationReceiptSignature(long confirmationReceiptSignatureOid) + { + try + { + var confirmationReceiptSignatureToDelete = DAOFactory.GenericDAO.LoadByID(confirmationReceiptSignatureOid); + + DAOFactory.GenericDAO.Delete(confirmationReceiptSignatureToDelete); + } + catch(Exception exception) + { + throw Utils.CreateBeWoFaultException(exception); + } + } + + public ConfirmationReceiptSignatureDC UpdateConfirmationReceiptSignature(ConfirmationReceiptSignatureDC confirmationReceiptSignature) + { + try + { + var confirmationReceiptSignatureToUpdate = DAOFactory.GenericDAO.LoadByID(confirmationReceiptSignature.ConfirmationReceiptSignatureOid.Value); + + MapperFactory.ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature.MergeWithEntity(confirmationReceiptSignature, confirmationReceiptSignatureToUpdate); + + DAOFactory.GenericDAO.Update(confirmationReceiptSignatureToUpdate); + + var updatedConfirmationReceiptSignature = DAOFactory.GenericDAO.LoadByID(confirmationReceiptSignature.ConfirmationReceiptSignatureOid.Value); + + return MapperFactory.ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature.MapToNewDC(updatedConfirmationReceiptSignature); + } + catch(Exception exception) + { + throw Utils.CreateBeWoFaultException(exception); + } + } + + public List GetConfirmationReceiptSignaturesByEmployee(long employeeOid, DateTimeSpan timeSpan) + { + try + { + var signatures = DAOFactory.SearchDAO.GetConfirmationReceiptSignaturesByEmployee(employeeOid, timeSpan); + + var signatureDCs = MapperFactory.ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature.MapToNewDCs(signatures); + + return signatureDCs; + } + catch(Exception exception) + { + throw Utils.CreateBeWoFaultException(exception); + } + } + + public List GetConfirmationReceiptSignaturesByServiceRecord(long serviceRecordOid) + { + try + { + var signatures = DAOFactory.SearchDAO.GetConfirmationReceiptSignaturesByServiceRecord(serviceRecordOid); + + var signatureDCs = MapperFactory.ConfirmationReceiptSignatureDC_ConfirmationReceiptSignature.MapToNewDCs(signatures); + + return signatureDCs; + } + catch(Exception exception) + { + throw Utils.CreateBeWoFaultException(exception); + } + } } } diff --git a/Shared/BeWoEntityEnums.cs b/Shared/BeWoEntityEnums.cs index afac9f019..8db353af7 100644 --- a/Shared/BeWoEntityEnums.cs +++ b/Shared/BeWoEntityEnums.cs @@ -148,9 +148,10 @@ namespace BS.Shared Arbeitszeit = 141, ArbeitszeitEintrag = 142, Dienst = 143, - RatingType = 144, - Rating = 145, - GoalRating = 146 + RatingType = 144, + Rating = 145, + GoalRating = 146, + ConfirmationReceiptSignature = 147 } public enum SystemEntryID diff --git a/Shared/DataContracts/ConfirmationReceiptSignatureDC.cs b/Shared/DataContracts/ConfirmationReceiptSignatureDC.cs new file mode 100644 index 000000000..c1d41e076 --- /dev/null +++ b/Shared/DataContracts/ConfirmationReceiptSignatureDC.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace BS.Shared.DataContracts +{ + [DataContract] + public class ConfirmationReceiptSignatureDC : IDataContract + { + [DataMember] + public long? ConfirmationReceiptSignatureOid { get; set; } + + [DataMember] + public long? ConfirmationReceiptSignatureVersion { get; set; } + + [DataMember] + public string SignatureImage { get; set; } + + [DataMember] + public long? EmployeeOid { get; set; } + + [DataMember] + public List ServiceRecords { get; set; } + } +} diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj index 4254298d6..605377e43 100644 --- a/Shared/Shared.csproj +++ b/Shared/Shared.csproj @@ -150,6 +150,7 @@ +