diff --git a/ReportImp/KcmGmbH/KcmGmbH.csproj b/ReportImp/KcmGmbH/KcmGmbH.csproj index 1790b6ed1..d08c6c405 100644 --- a/ReportImp/KcmGmbH/KcmGmbH.csproj +++ b/ReportImp/KcmGmbH/KcmGmbH.csproj @@ -85,6 +85,7 @@ ServiceInvoiceReport.cs + Component diff --git a/ReportImp/KcmGmbH/Service/ServiceRecordValidator.cs b/ReportImp/KcmGmbH/Service/ServiceRecordValidator.cs new file mode 100644 index 000000000..0a8a5272f --- /dev/null +++ b/ReportImp/KcmGmbH/Service/ServiceRecordValidator.cs @@ -0,0 +1,29 @@ +using BeWo.Service.Plugins; +using BS.Shared; +using BS.Shared.DataContracts; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace KcmGmbH.Service +{ + public class CustomServiceRecordValidator : ServiceRecordValidator + { + public override List ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statistics, int maxDaysEditServiceRecordsAllowed, IList employeeOids, IList cb2scOids) + { + var list = base.ValidateServiceRecord(newServiceRecord, statistics, maxDaysEditServiceRecordsAllowed, employeeOids, cb2scOids); + DateTime start = newServiceRecord.Start.Value; + bool noTime = (start.Hour == 0 && start.Minute == 0 && start.Second == 1); //Keine Zeit angegeben + var duration = (decimal)newServiceRecord.End.Value.Subtract(newServiceRecord.Start.Value).TotalMinutes; + if (noTime && duration != 0 && newServiceRecord.ServiceDescription.Category.IsBillable) + { + list.Add(new ServiceRecordValidationResultDC + { + ResultType = ServiceRecordValidationResult.Custom, + Message = "Der Zeiterfassungseintrag muss eine Startzeit haben." + }); + } + return list; + } + } +} \ No newline at end of file