Calender

dharshandharshan Member Posts: 37
Hi,

BaseCalChange."Recurring System"::"Weekly Recurring":
IF DATE2DWY(TargetDate,1) = BaseCalChange.Day THEN BEGIN
Description := BaseCalChange.Description;
EXIT(BaseCalChange.Nonworking);
END;

Could any one tell me wat is the use of above code?
its coudeunit7600.

I need to check the holiday from this base calender if the change is weekely occuring and annual how do i check.
for date alone i have return the following code.

I am new to navision so the code may not look good.
code is base calender record type.
tempdays:=fromdate;
ok:=code.GET(SCHOOL);
IF code.Code=SCHOOL THEN
BEGIN
REPEAT
code.FIND('-');
REPEAT
IF Cod.CheckDateStatus(SCHOOL,tempdays,text) THEN BEGIN
tempint:=tempint+1;

END;
UNTIL(code.NEXT=0);
tempdays:=tempdays+1;
UNTIL(tempdays>=todate);
MESSAGE('%1 no',tempint);
END;

i created a new code school.

is there any other way plz help me?...

Comments

  • DenSterDenSter Member Posts: 8,304
    You should not write your own code to check the base calendar. The standard code already provides for functionality to check for non-working days, and that takes into account all different types of non-working days as specified in the base calendar.

    That little snippet of code is the part where it figures out if a recurring date is a non-working day. You can set up a recurring date in one line, which is not an actual date. The system will calculate the actual date on the fly when using the base calendar functionality.

    Figure out how the standard functionality works, instead of writing your own. Open the customer card, and on the invoicing tab you'll find the base calendar code, plus a field that shows you whether there are customized changes. Turn on the debugger (with breakpoints on triggers) and step through the code to see what happens behind the scenes, and how it determines the non-working dates. Enter a recurring one and see how the form is built next time you open it. You will see how that piece of code works, and use it for your purposes.

    Don't re-invent the wheel :mrgreen:
Sign In or Register to comment.