Quittierungsbeleg für SKF Leverkusen hinzugefügt
MoK erweiterte Ressourcenverfügbarkeitsprüfung hinzugefügt MoK Darstellung von ServiceRecords mit Marker ist wie im FaC, Anpassung im Formular folgt
This commit is contained in:
@@ -142,7 +142,7 @@ namespace BeWo.Service.Plugins
|
||||
//t = "3956369664"; // LH Wetterau
|
||||
//t = "3984525482"; // API Berlin
|
||||
//t = "9975231461"; // Selwo
|
||||
t = "8181286349"; // BeWo am Rhein
|
||||
//t = "8181286349"; // BeWo am Rhein
|
||||
//t = "4595275645"; // Eigenständig
|
||||
//t = "7912635399"; // Prof. Dr. Eggers Stiftung
|
||||
//t = "3549726254"; // Socia
|
||||
@@ -157,7 +157,7 @@ namespace BeWo.Service.Plugins
|
||||
//t = "3852198843"; // LH Mannheim
|
||||
//t = "9800364930"; // BeWo Leverkusen
|
||||
//t = "4439874912"; // BeWo Sahin
|
||||
t = "1873138856"; // BUG e.V.
|
||||
//t = "1873138856"; // BUG e.V.
|
||||
//t = "6463422907"; // Caritas Leverkusen
|
||||
//t = "6149463003"; // Diakonisches Werk Bad Windsheim Neustadt a. d. Aisch
|
||||
//t = "6548202677"; // VKM Aachen SBD
|
||||
@@ -195,7 +195,7 @@ namespace BeWo.Service.Plugins
|
||||
//t = "9556218062"; // Diakonie Landshut
|
||||
//t = "2279593936"; // Diakonie Mülheim
|
||||
//t = "3623837005"; // Betreuwo Wesel
|
||||
//t = "8407321888"; // AWO Wesel
|
||||
t = "8407321888"; // AWO Wesel
|
||||
//t = "8454426692"; // Mit-Menschen Wuppertal
|
||||
//t = "0629004412"; // BeWo-Colonia Basaran (Projekt
|
||||
//t = "7668701607"; // Wohnstätten Essen
|
||||
@@ -209,7 +209,7 @@ namespace BeWo.Service.Plugins
|
||||
//t = "4189934785"; // Landshuter Netzwerke
|
||||
//t = "7584236951"; // Aachener Betreuungsbüro Kirschbaum und Manz GbR
|
||||
//t = "3678599942"; // VKM Rietberg
|
||||
t = "4069072369"; // BeWo Dreilich&Pastor (Projekt TranskulturellesBBPastor)
|
||||
//t = "4069072369"; // BeWo Dreilich&Pastor (Projekt TranskulturellesBBPastor)
|
||||
//t = "4160851689"; // BeWo Dreilich&Pastor (Dreilich)
|
||||
//t = "9970072066"; // Bussmannshof
|
||||
//t = "2993745954"; // Kollegium für freie Jugendarbeit und Berufsbildung e.V.
|
||||
@@ -346,7 +346,7 @@ namespace BeWo.Service.Plugins
|
||||
//t = "3226307161"; // Roman Roger Puth
|
||||
//t = "3522103738"; // AWO Münsterland-Recklinghausen
|
||||
//t = "5592509446"; // Kontakt Verein für psychosoziale Hilfen e.V
|
||||
t = "5344902949"; // SHK Service GmbH SBD
|
||||
//t = "5344902949"; // SHK Service GmbH SBD
|
||||
//t = "1422963536"; // Malteser-Johanniter-Johanneshaus gGmbH
|
||||
//t = "5433105975"; // aha e.V.
|
||||
//t = "1701920223"; // SKFM Monheim
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BeWo.Data;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
using NHibernate.Util;
|
||||
|
||||
namespace BeWo.Service.Plugins
|
||||
{
|
||||
@@ -32,21 +34,77 @@ namespace BeWo.Service.Plugins
|
||||
return list;
|
||||
}
|
||||
|
||||
public virtual Dictionary<ResourceDC, List<CompactEmployeeDC>> CheckResourceAvailabilityWithBookingEmployees(DateTime start, DateTime end, List<long> resourceOids, long? selectedAppointmentOid)
|
||||
public virtual Dictionary<string, List<string>> CheckResourceAvailabilityWithBookingEmployees(DateTime start, DateTime end, List<long> resourceOids, long? selectedAppointmentOid)
|
||||
{
|
||||
var result = new Dictionary<ResourceDC, List<CompactEmployeeDC>>();
|
||||
var appointments = DAOFactory.SearchDAO.FindAppointmentsByResourcesInInterval(resourceOids, start, end, selectedAppointmentOid);
|
||||
|
||||
var dictionary = DAOFactory.SearchDAO.CheckAvailabilityOfResources(resourceOids, start, end, selectedAppointmentOid);
|
||||
var user = LoggedInUserOperationContextExt.Current?.User ?? SessionFacade.LoggedInUser;
|
||||
|
||||
dictionary.DoForEach(kvp =>
|
||||
var result = new Dictionary<string, List<string>>();
|
||||
|
||||
if(user is null)
|
||||
{
|
||||
//var resourceDC = MapperFactory.ResourceDC_Resource.MapToNewDC(kvp.Key);
|
||||
//var compactEmployeeDCs = MapperFactory.CompactEmployeeDC_Employee.MapToNewDCs(kvp.Value);
|
||||
return result;
|
||||
}
|
||||
|
||||
//result.Add(resourceDC, compactEmployeeDCs);
|
||||
});
|
||||
var loggedInEmployee = user.Employee;
|
||||
|
||||
var hasRightToViewEmployeeAppointments = user.CheckForRight(UserRightType.KalenderMitarbeitertermineAnsehen);
|
||||
var hasRightToViewResourceAppointments = user.CheckForRight(UserRightType.KalenderRessourcentermineAnsehen);
|
||||
|
||||
var dictionary = new Dictionary<Resource, List<SchedulerAppointment>>();
|
||||
|
||||
foreach(var appointment in appointments)
|
||||
{
|
||||
foreach(var resource in appointment.ResourceList)
|
||||
{
|
||||
dictionary.AddOrUpdateValueInDictionary(resource, appointment);
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var resource2Appointments in dictionary)
|
||||
{
|
||||
foreach(var appointment in resource2Appointments.Value)
|
||||
{
|
||||
var originator = appointment.Originator;
|
||||
var employee2Appointments = appointment.EmployeeList;
|
||||
|
||||
var isOwnAppointment = (originator?.Equals(loggedInEmployee) ?? false) || employee2Appointments.ToList().Any(e2a => e2a.Employee.Equals(loggedInEmployee));
|
||||
|
||||
// Wenn isOwnAppointment true ist, darf der Benutzer die Uhrzeiten und die Mitarbeiter sehen. Ansonsten müssen die Rechte geprüft werden.
|
||||
if(isOwnAppointment || hasRightToViewEmployeeAppointments) // Es werden Zeit und Mitarbeiter angezeigt
|
||||
{
|
||||
result.AddOrUpdateValueInDictionary(resource2Appointments.Key.Name, $"{CreateDateTimeInfoFromAppointment(appointment.StartDate, appointment.EndDate, appointment.AllDay)} von {originator}");
|
||||
}
|
||||
else if(hasRightToViewResourceAppointments && !hasRightToViewEmployeeAppointments) // Nur die Uhrzeit anzeigen
|
||||
{
|
||||
result.AddOrUpdateValueInDictionary(resource2Appointments.Key.Name, $"{CreateDateTimeInfoFromAppointment(appointment.StartDate, appointment.EndDate, appointment.AllDay)}");
|
||||
}
|
||||
else if(!hasRightToViewEmployeeAppointments) // Es werden weder Zeit noch Mitarbeiter angezeigt
|
||||
{
|
||||
result.AddOrUpdateValueInDictionary(resource2Appointments.Key.Name, string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private string CreateDateTimeInfoFromAppointment(DateTime? start, DateTime? end, bool allDay)
|
||||
{
|
||||
if(start.HasValue && end.HasValue)
|
||||
{
|
||||
return start.Value.Date == end.Value.Date ?
|
||||
$"{start.Value.ToShortTimeString()} - {end.Value.ToShortTimeString()} " :
|
||||
$"{start.Value:dd.MM.yyyy HH:mm} - {end.Value:dd.MM.yyyy HH:mm} ";
|
||||
}
|
||||
|
||||
if(allDay && start.HasValue && end.HasValue)
|
||||
{
|
||||
return start.Value.Date == end.Value.Date ? " " : $"{start.Value.ToShortDateString()} - {end.Value.ToShortDateString()} ";
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +230,6 @@ namespace BeWo.Service.Plugins
|
||||
// });
|
||||
//}
|
||||
|
||||
#if DEBUG
|
||||
if(!(newServiceRecord.ServiceRecordOid is null))
|
||||
{
|
||||
var original = DAOFactory.GenericDAO.LoadByID<ServiceRecord>(newServiceRecord.ServiceRecordOid.Value);
|
||||
@@ -241,19 +240,11 @@ namespace BeWo.Service.Plugins
|
||||
var areTimesEqual = startEqual && endEqual;
|
||||
|
||||
var confirmationReceiptSignatures = DAOFactory.SearchDAO.GetConfirmationReceiptSignaturesByServiceRecord(newServiceRecord.ServiceRecordOid.Value);
|
||||
// ToDo: Nur anzeigen, wenn die Monatsunterschrift auch gültig ist? Welchen Zeitraum wählen? Den, der ausgewählt ist?
|
||||
|
||||
if(!areTimesEqual && confirmationReceiptSignatures.Any())
|
||||
{
|
||||
var sum = confirmationReceiptSignatures.Sum(s => s.ServiceRecords.Count);
|
||||
|
||||
var message = "Für diesen Eintrag existiert bereits eine Monatsunterschrift. Das Verändern von Datum oder Uhrzeit führt zu einer ungültigen Monatsunterschrift, die erneut geleistet werden muss, um auf dem Quittierungsbeleg angezeigt zu werden.";
|
||||
|
||||
if(sum == 1)
|
||||
{
|
||||
// Die Unterschrift wird gelöscht, weil der einzige damit verknüpfte Zeiterfassungseintrag geändert wird.
|
||||
message = "Der zu speichernde Zeiterfassungseintrag ist der einzige, für den eine Monatsunterschrift geleistet wurde. Das Speichern führt zur Löschung der Monatsunterschrift.";
|
||||
}
|
||||
|
||||
result.Add(new ServiceRecordValidationResultDC
|
||||
{
|
||||
ResultType = ServiceRecordValidationResult.SignatureExists,
|
||||
@@ -262,7 +253,6 @@ namespace BeWo.Service.Plugins
|
||||
});
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool isGroupRecord = (cb2scOids != null && cb2scOids.Count > 1) ||
|
||||
(employeeOids != null && employeeOids.Count > 1);
|
||||
@@ -1094,24 +1084,42 @@ namespace BeWo.Service.Plugins
|
||||
{
|
||||
Allow = true,
|
||||
ResultType = ServiceRecordValidationResult.Custom,
|
||||
Message = "Dieser Eintrag wurde bereits unterschrieben.\nMöchten Sie ihn trotzdem löschen?"
|
||||
});
|
||||
Message = "Dieser Eintrag wurde bereits unterschrieben.\n\nMöchten Sie ihn trotzdem löschen?"
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: Flag beachten
|
||||
// 2. Prüfe, ob eine Mitarbeiterunterschrift mit diesem Eintrag verknüpft ist
|
||||
//if(serviceRecord.ServiceRecordOid.HasValue)
|
||||
//{
|
||||
// var hasEmployeeSignature = DAOFactory.SearchDAO.HasEmployeeSignaturesForServiceRecord(serviceRecord.ServiceRecordOid.Value);
|
||||
// 2. Prüfe, ob eine Mitarbeiterunterschrift mit diesem Eintrag verknüpft ist
|
||||
//if(serviceRecord.ServiceRecordOid.HasValue)
|
||||
//{
|
||||
// var hasEmployeeSignature = DAOFactory.SearchDAO.HasEmployeeSignaturesForServiceRecord(serviceRecord.ServiceRecordOid.Value);
|
||||
|
||||
// if(hasEmployeeSignature)
|
||||
// {
|
||||
// result.Add(new ServiceRecordValidationResultDC
|
||||
// {
|
||||
// ResultType = ServiceRecordValidationResult.HasEmployeeSignature
|
||||
// });
|
||||
// }
|
||||
//}
|
||||
// if(hasEmployeeSignature)
|
||||
// {
|
||||
// result.Add(new ServiceRecordValidationResultDC
|
||||
// {
|
||||
// ResultType = ServiceRecordValidationResult.HasEmployeeSignature
|
||||
// });
|
||||
// }
|
||||
//}
|
||||
|
||||
// 3. Prüfe, ob eine Monatsunterschrift vorhanden ist.
|
||||
if(serviceRecord.ServiceRecordOid is null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
var confirmationReceiptSignatures = DAOFactory.SearchDAO.GetConfirmationReceiptSignaturesByServiceRecord(serviceRecord.ServiceRecordOid.Value);
|
||||
|
||||
if(confirmationReceiptSignatures.Any(crs => crs.IsActive == ActivationTypeId.Active))
|
||||
{
|
||||
result.Add(new ServiceRecordValidationResultDC
|
||||
{
|
||||
ResultType = ServiceRecordValidationResult.Custom,
|
||||
Message = "Für diesen Eintrag existiert bereits eine Monatsunterschrift. Das Löschen dieses Eintrags führt zu einer ungültigen Monatsunterschrift, die erneut geleistet werden muss, um auf dem Quittierungsbeleg angezeigt zu werden.\n\nMöchten Sie ihn trotzdem löschen?",
|
||||
Allow = true
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user