Quantcast
Channel: Microsoft Dynamics NAV Forum - Recent Threads
Viewing all articles
Browse latest Browse all 29197

Calendar Management Codeunit

$
0
0

I have written a function to calculate the next working .

My parameters is Fromdate and No of Days .

GetTheNextDay(FromDate : Date;NoofDays : Integer) : Date

ToDate:=0D;
ToDate:=CALCDATE(FORMAT('<'+FORMAT(NoofDays)+'D>'),FromDate);
TempDate.RESET;
TempDate.SETRANGE("Period Type",TempDate."Period Type"::Date);
TempDate.SETRANGE("Period Start",FromDate,ToDate);
IF TempDate.FINDSET THEN BEGIN
REPEAT
  IF (CUCalMgmnt.CheckDateStatus(CompInfo."Base Calendar Code",TempDate."Period      Start",TempDescription)) THEN
 ToDate+=1;
UNTIL TempDate.NEXT =0;
END;
EXIT(ToDate);

Input:27/12/16,5

output:03/01/17;

it is giving one extra day

i have already checked my base calender in which there is only one sunday between my date range.

How is this possible?


Viewing all articles
Browse latest Browse all 29197

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>