From e60edc0fd242e9007ed3196d5934f77dfb99ad2e Mon Sep 17 00:00:00 2001 From: RaoulJacobs Date: Mon, 27 Mar 2023 12:35:18 +0200 Subject: [PATCH] Update M_omDateFunctions.def add CalculatePayDate Function --- M_omDateFunctions.def | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/M_omDateFunctions.def b/M_omDateFunctions.def index 55d48af..124ab54 100644 --- a/M_omDateFunctions.def +++ b/M_omDateFunctions.def @@ -430,4 +430,16 @@ End Function Public Function EOMonth(dt As Date) As Date EOMonth = DateSerial(year(dt), Month(dt) + 1, 0) -End Function \ No newline at end of file +End Function + +Public Function CalculatePayDate(dt As Date, Days As Integer, EndOfMonth As Boolean, ExtraDays As Integer) As Date + + dt = DateAdd("d", Days, dt) + If EndOfMonth Then + dt = DateSerial(year(dt), Month(dt), 1) + dt = DateAdd("m", 1, dt) + dt = DateAdd("d", -1, dt) + End If + dt = DateAdd("d", ExtraDays, dt) + CalculatePayDate = dt +End Function