Class TKronos (unit Kronos) |
Inherits from
TComponent
constructor Create(AOwner : TComponent);
- ************************* TKronos methods
function AddDaytype(DayType: TDaytype) : Word;
Configuration methods
procedure BeginChange;
Updates ext-properties with latest changesWhen reenabling Daytype processing it is necessary to recalculate
the current DateExt when UserCalc is active.
function CDtoDateTime : TDateTime;
Converts a day of week number to an index that can be used to
access Daynames arrayConverts a day of week number to an index that can be used to
access the Daynames array
procedure ClearUserDaytypes;
Add one user defined spesific day to the daytype list
procedure DateByDayOffset(var TheYear, TheDayNumber : word;
OffsetValue : integer; WorkdaysOnly : Boolean);
Returns then daynumber in AYear that matches a DaytypeId
procedure DateByMonthOffset(var TheYear, TheDayNumber : word;
OffsetValue : integer);
Returns the year and daynumber by counting offsetvalue weeks from
current date
procedure DateByWeekOffset(var TheYear, TheDayNumber : word;
OffsetValue : integer);
Returns the year and daynumber by counting offsetvalue days from
current dateif FTransError then EndChange;
function DaynumberByTypeId(AYear : word; ADayTypeId : word) : word;
Returns the daynumber in AYear that contains DaytypenameReturns the daynumber of DayTypeName in AYear
function DaynumberByTypeName(AYear : word; DayTypeName : string) : word;
Search- and offset calculating procedures
function DaysInInterval(Year1, Month1, MonthDay1,
Year2, Month2, MonthDay2 : word; WorkdaysOnly : boolean) : integer;
Calculates the number of weeks between 1 and 2Moves to the daynumber of DayTypeName/Id
function DaysInIntervalDn(Year1, Daynumber1, Year2, Daynumber2 : word;
WorkdaysOnly : boolean) : integer;
Calculates the number of days between 1 and 2
function DaysInIntervalDt(Date1, Date2 : TDateTime;
WorkdaysOnly : boolean) : integer;
Count number of days between Year1, Monthday1 and Year2, Monthday2.
function DeleteUserDayType(AnId : word; AName : string) : boolean;
Clears all user defined spesific days from the daytype list,
except the ones prefefined
destructor Destroy;
procedure DisableEvents(Disable : boolean);
Returns the row and column in the current MonthImage that contains
the last daynumber} //Misc
function DOWtoDayNameIndex(ADayOfWeekNumber:word) : word;
Converts a day of week number to a TWeekday typeConverts a day of week number to Tweekday type
function DOWtoWeekday(ADayOfWeekNumber : word) : TWeekDay;
Moves to Year/Daynumber that results from the number of months in
OffsetValue.
procedure EndChange;
Starts a date transaction
function ExistsDaytype(DaytypeName : string) : Word;
Ends a date transactionReturns the daynumber
function FetchDateExt(AYear, AMonth, AMonthDay : word) : TDateExt;
ChangeKron(FYear);
function FetchDateExtDn(AYear, ADayNumber : word) : TDateExt;
function FetchDateExtDt(ADate : TDateTime) : TDateExt;
SetDateExt(0,0,0,0, Cal, DayCodes);
function FetchDaytype(ADateExt : TDateExt; AnIndex : word) : TDaytype;
function FetchMonthExt(AYear, AMonth : word) : TMonthExt;
ChangeKron(OrigYear);
function FetchWeekExt(AYear, AWeek : word ) : TWeekExt;
ChangeKron(OrigYear);
function FetchYearExt(AYear : word) : TYearExt;
Fetches information without changing the current dayCounts the days acc.
function FetchYeartype(AYearExt : TYearExt; AnIndex : word) : TDaytype;
function GetDaytypeDef(AnId : word; AName : string) : TDaytypeDef;
Changes the definition of a user daytype
function GetDescKey(var Index : Integer; Keys : string;
var KeyName, Value : string) : Boolean;
Retriggers all change eventhandlersReturns the row and column in the current MonthImage that contains
the last daynumber
procedure GetFirstMIDayCell(var ARow, ACol : Longint);
Returns the row in the current MonthImage that contains
AWeekNumberReturns the row in the current MonthImage that contains
AWeekNumber
procedure GetLastMIDayCell(var ARow, ACol : Longint);
Returns the row and column in the current MonthImage that contains
the first daynumberReturns the row and column in the current MonthImage that contains
the first daynumber
procedure GetMIDayCell(ADayNumber : word; var ARow, ACol : Longint);
Converts the current date to Datetime-format} //Functions operating on MonthImage
function GetMIWeekRow(AWeekNumber : word) : word;
Returns the row and column in the current MonthImage that contains
ADaynumberReturns the row and column in the current MonthImage that contains
ADaynumber
function GetNextDaytype(var NextIndex : word) : TDaytype;
Retrieves a user daytype definition
function GetNextDaytypeDate(ADate : word; var Count : word) : TDaytype;
Retrievs a daytype from the daytype list, matching AName and CountRetrievs a daytype from the daytype list, matching AName and Count
function GetNextDaytypeName(AName : string; var Count : word) : TDaytype;
Retrievs a daytype from the daytype list
procedure GotoDate(AYear, AMonth, AMonthDay : word);
Changes the current date by calculating or searchingReturns the daynumber of ADayTypeConst in AYear
procedure GotoDateDn(AYear, ADayNumber : word);
procedure GotoDateDt(ADate : TDateTime);
if there is a transaction already running don't end
procedure GotoDayType(AYear : word; AnId : word; DayTypeName : string);
procedure GotoLastMonth;
procedure GotoLastWeek;
procedure GotoNextMonth;
procedure GotoNextWeek;
procedure GoToOffsetDay(OffsetValue : integer;
WorkdaysOnly : boolean);
Moves to the daynumber in AYear that contains Daytypename/id
procedure GoToOffsetMonth(OffsetValue : integer);
Moves to Year/Daynumber that results from the number of weeks in
OffsetValue.
procedure GoToOffsetWeek(OffsetValue : integer);
Moves to Year/Daynumber that results from the number of days in
OffsetValue.
procedure GotoThisMonth;
procedure GotoThisWeek;
procedure GotoToday;
procedure GotoTomorrow;
procedure GotoYesterday;
function IsLastDayOfMonth(AYear, AMonth, AMonthDay : word) : boolean;
function IsLastMonth(var AYear, AMonthNumber : word) : boolean;
function IsLastWeek(var AYear, AWeekNumber : word) : boolean;
function IsLastWeekOfYear(AYear, AWeek : word) : boolean;
function IsLastYear(var AYear : word) : boolean;
function IsLeapYear(AYear : word) : boolean;
function IsNextMonth(var AYear, AMonthNumber : word) : boolean;
function IsNextWeek(var AYear, AWeekNumber : word) : boolean;
function IsNextYear(var AYear : word) : boolean;
function IsThisMonth(var AYear, AMonthNumber : word) : boolean;
function IsThisWeek(var AYear, AWeekNumber : word) : boolean;
function IsThisYear(var AYear : word) : boolean;
function IsToday(var AYear, ADayNumber : word) : boolean;
Returns the year and daynumber by counting offsetvalue months from
current date} //Retrievs information about the current date
function IsTomorrow(var AYear, ADayNumber : word) : boolean;
function IsYesterday(var AYear, ADayNumber : word) : boolean;
procedure LoadFromFile(AFilename : string; LoadAll : boolean);
Specifies the standard predefined days with native names and status
function MonthsInInterval(Year1, Month1, Year2, Month2: word) : integer;
Interval functionsCount number of weeks between Year1, Week1 and Year2, Week2.
procedure Rechange;
Checks for duplicate daytype names
procedure RestoreCD;
Saves the current date
procedure SaveCD;
Turns off event triggering
procedure SaveToFile(AFilename : string);
Loads a calendar definition from file
procedure SpecifyStandardDay(AnId : word; AName : string;
IsHoliday, IsFlagday : boolean);
Retrievs a daytype from the daytype list, matching ADate and CountRetrievs a daytype from the daytype list, matching ADate and Count
procedure UpdateDaytype(AnId : word; AName : string;
DaytypeDef : TDaytypeDef);
Deletes a user daytypePredfined daytype.
procedure UpdateInfo;
Restores the current date
function WeeksInInterval(Year1, Week1, Year2, Week2: word) : integer;
Calculates the number of months between 1 and 2
procedure CalcDaytype(Daytype : TDaytype; ADateExt : TDateExt;
IsCurrentDate : boolean; var Accepted : boolean);
procedure ChangeDate;
procedure ChangeKron(AYear : word);
Functions operating directly on the internal calendar structures:
procedure ChangeMonth;
procedure ChangeMonthDay;
procedure ChangeMonthNumber;
procedure ChangeWeek;
procedure ChangeWeekday;
procedure ChangeWeekNumber;
procedure ChangeYear;
Weekday of current date does now belong to last Week of previous
year
procedure ClearLists;
Disables user calculation of daytypes, i.
procedure DisableIndexing(Disable : boolean);
The index of the IdList that is the last predefined daytype Fill weeks that belongs to next month
procedure DisableUserCalc(Disable : boolean);
Reads daynumber.
function GetDaytypeObject(AnId : word; AName : string) : TDaytype;
Clears the daytype lists, except the predefined daytypes
procedure LoadDaytype(DaytypeDef : TDaytypeDef;
const DescKeys : String; const ClassID : Integer;
var LoadIt : boolean);
Turn off user calc.
procedure Loaded;
Turns off sorting (Disable = true for all lists).
function ReadDay(DNr : word) : TDay;
Reads year informationUnterminated week at end of year
function ReadDayNr(ADate : word) : word;
Reads month information-> Daynumber of first weekday
function ReadMonth(MNr : word) : TMonth;
Reads week information Load Week-info
function ReadWeek(WNr : word) : TWeek;
Reads day information Load Day-info
function ReadYear : TYear;
Changes the internal calendar to AYear The following procedures loads the basic information structures
procedure SaveDaytype(Daytype : TDaytype;
var DescKeys : String; var ClassID : Integer;
var SaveIt : boolean);
procedure SetCountrySpecifics;
Updates YearExt, DateExt and MonthExt after calls to
AddDaytype, SpecifyCommonday, SpecifiyChurchDay
procedure Today;
function ConvertWeekday(DayOfWeekNumber : word) : TWeekDay;
Other internal routines
function FindDayType(DayTypeName : string) : word;
function FindDayTypeId(DayTypeId : word) : word;
procedure FindOffsetDay(var TheYear, TheDayNumber : word;
OffsetValue : integer; WorkdaysOnly : Boolean);
Count number of months between Year1, Month1 and Year2, Month2.
procedure FindOffsetMonth(var TheYear, TheDayNumber : word;
OffsetValue : integer);
procedure FindOffsetWeek(var TheYear, TheDayNumber : word;
OffsetValue : integer);
Returns the day and year by counting offset-days from current day
function GetDayType(AnIndex : word) : TDaytype;
High level internal routinesDaynames
function GetDOW(DNr : word) : word;
Antall måneder utover hele år
function GetMonthImage : TMonthImage;
procedure MakeCal(AYear:Integer);
-> Ascension day
procedure MakeDates(AYear : Word; var CalTab : TCal);
Computes first weekday of yaer
procedure MakeKron(AYear : word);
Returns Daynumber tied to MonthDate
procedure RestoreIntCd;
procedure SaveIntCD;
function SeekDate(MonthDate: Word; Leap : Boolean) : Word;
procedure SetCommonDaysDate; {Low level internal routines operating on the basic
calendar structures
procedure SetDateExt(AYear, AMonth, AMonthDay, ADaynr : word;
ACal : TCal; ADayC : TDaycodes);
procedure SetDayNumber (Value : word);
procedure SetDefaults;
Sets default attributes of standard churchdays and common daysNothing.
procedure SetFirstDay(AYear: Word; var F : Integer);
******Procedures to create the internal calendar for a year
procedure SetFirstWeekDay(Value : TWeekday);
Updating exisiting country spesific
procedure SetFixedCodes(AYear : Integer);
MakeDates
procedure SetHidePredefineds(Value : boolean);
procedure SetMaxYear(Value : word);
procedure SetMinYear(Value : word);
procedure SetMonth (Value : word);
procedure SetMonthDay (Value : word);
procedure SetMonthExt;
procedure SetRelCodes(FullMoonDate:Integer);
Now first sunday advent
procedure SetWeek (Value : word);
Sunday = 1, Monday = 2, etc
procedure SetWeekDay(Value : TWeekDay);
procedure SetWeekExt;
procedure SetWeekHolidays(Value : TWeekHolidays);
procedure SetYear (Value : word);
Property setting proceduresCheck userdefined daytypes
procedure SetYearExt;
Calculates Easter full moon
function ShowUp(F,L,Sf,Y : word) : boolean;
property AllowUserCalc : boolean
property DayNumber : word
property DefaultToPresentDay : boolean
property FirstWeekDay : TWeekDay
property HidePredefineds : boolean
property MaxYear : word
property MinYear : word
property Month : word
property MonthDay : word
property Week : word
property WeekDay : TWeekDay
property WeekHolidays : TWeekHolidays
property Year : word
Published declarations
property DateExt : TDateExt
property DayTypeCount : word
property DayTypes : TDaytype
property FirstUserId : Word
property MonthExt : TMonthExt
property WeekExt : TWeekExt
property YearExt : TYearExt
Saves a calendar definition to file} //Stores information about the current date
event OnCalcDaytype : TCalcDaytypeEvent
event OnChangeDate : TNotifyEvent
event OnChangeMonth : TNotifyEvent
event OnChangeMonthDay : TNotifyEvent
event OnChangeMonthNumber : TNotifyEvent
event OnChangeWeek : TNotifyEvent
event OnChangeWeekDay : TNotifyEvent
event OnChangeWeekNumber : TNotifyEvent
event OnChangeYear : TNotifyEvent
event OnLoadDaytype : TLoadDaytypeEvent
event OnSaveDaytype : TSaveDaytypeEvent
event OnToday : TNotifyEvent
Daynames : array[1..7] of string;
Public declarations
Monthnames : array[1..12] of string;
Datelist : TStringList;
Protected declarations } {User daytype definitions.
FCSpIndex : integer;
Next id to be assigned to a userdefined daytype
IdList : TStringList;
Name sort
NameList : TStringList;
Date sort.
NextId : word;
Id sort.
Cal : TCal;
ChurchdayIndex : TChurchdayIndex;
Daycodes for churchdays
DayCodes : TDaycodes;
First weekday of year
FAllowUserCalc : boolean;
FCalcDisabled : boolean;
True if event triggering is disabled
FCalculating : boolean;
FChanging : boolean;
Daynumber saved with the SaveCD private method
FDateExt : TDateExt;
FDayNumber : word;
FDayTypeCount : word;
FDefaultToPresentDay : boolean;
FEndChange : boolean;
True if a date transaction is active
FEventBuf : array[ocYear..ocCalcDaytype] of boolean;
True if calls form a OnCaculateDaytype event handler is processing
FEventsDisabled : boolean;
Internal fields
FFirstUserId : word;
FFirstWeekDay : TWeekday;
FHidePredefineds : boolean;
FIntDayNumber : word;
Year saved with the SaveIntCD private method
FIntYear : word;
Daynumber saved with the SaveCD method
FMaxYear : word;
FMinYear : word;
FMonth : word;
FMonthDay : word;
FMonthExt : TMonthExt;
FOnCalcDaytype : TCalcDaytypeEvent;
FOnChangeDate : TNotifyEvent;
FOnChangeMonth : TNotifyEvent;
FOnChangeMonthDay : TNotifyEvent;
FOnChangeMonthNumber : TNotifyEvent;
FOnChangeWeek : TNotifyEvent;
FOnChangeWeekday : TNotifyEvent;
FOnChangeWeekNumber : TNotifyEvent;
FOnChangeYear : TNotifyEvent;
Events
FOnLoadDayType : TLoadDaytypeEvent;
FOnSaveDaytype : TSaveDaytypeEvent;
FOnToday : TNotifyEvent;
FSavedDayNumber : word;
Year saved with the SaveCD method
FSavedYear : word;
True if user calc computing is disabled
FTransDayNr : word;
The year that was the current year when a date transaction started
FTransError : boolean;
The daynumber that was the current daynumber when a date
transaction started
FTransYear : word;
Buffer for storing events during a date transaction
FWeek : word;
FWeekDay : TWeekDay;
FWeekExt : TWeekExt;
FWeekHolidays : TWeekHolidays;
FYear : word;
Private declarations } // Property fields
FYearExt : TYearExt;
IntFirstWeekday : word;
Kron : TKron;
True if an error occured during a date transaction} // Internal calendar variables
constructor Create(AOwner : TComponent);
************************* TKronos methods
function AddDaytype(DayType: TDaytype) : Word;
Configuration methods
procedure BeginChange;
Updates ext-properties with latest changes
When reenabling Daytype processing it is necessary to recalculate
the current DateExt when UserCalc is active.
function CDtoDateTime : TDateTime;
Converts a day of week number to an index that can be used to
access Daynames array
Converts a day of week number to an index that can be used to
access the Daynames array
procedure ClearUserDaytypes;
Add one user defined spesific day to the daytype list
procedure DateByDayOffset(var TheYear, TheDayNumber : word;
OffsetValue : integer; WorkdaysOnly : Boolean);
Returns then daynumber in AYear that matches a DaytypeId
procedure DateByMonthOffset(var TheYear, TheDayNumber : word;
OffsetValue : integer);
Returns the year and daynumber by counting offsetvalue weeks from
current date
procedure DateByWeekOffset(var TheYear, TheDayNumber : word;
OffsetValue : integer);
Returns the year and daynumber by counting offsetvalue days from
current date
if FTransError then EndChange;
function DaynumberByTypeId(AYear : word; ADayTypeId : word) : word;
Returns the daynumber in AYear that contains Daytypename
Returns the daynumber of DayTypeName in AYear
function DaynumberByTypeName(AYear : word; DayTypeName : string) : word;
Search- and offset calculating procedures
function DaysInInterval(Year1, Month1, MonthDay1,
Year2, Month2, MonthDay2 : word; WorkdaysOnly : boolean) : integer;
Calculates the number of weeks between 1 and 2
Moves to the daynumber of DayTypeName/Id
function DaysInIntervalDn(Year1, Daynumber1, Year2, Daynumber2 : word;
WorkdaysOnly : boolean) : integer;
Calculates the number of days between 1 and 2
function DaysInIntervalDt(Date1, Date2 : TDateTime;
WorkdaysOnly : boolean) : integer;
Count number of days between Year1, Monthday1 and Year2, Monthday2.
function DeleteUserDayType(AnId : word; AName : string) : boolean;
Clears all user defined spesific days from the daytype list,
except the ones prefefined
destructor Destroy;
procedure DisableEvents(Disable : boolean);
Returns the row and column in the current MonthImage that contains
the last daynumber} //Misc
function DOWtoDayNameIndex(ADayOfWeekNumber:word) : word;
Converts a day of week number to a TWeekday type
Converts a day of week number to Tweekday type
function DOWtoWeekday(ADayOfWeekNumber : word) : TWeekDay;
Moves to Year/Daynumber that results from the number of months in
OffsetValue. Startingpoint is current date} //Converting functions
procedure EndChange;
Starts a date transaction
function ExistsDaytype(DaytypeName : string) : Word;
Ends a date transaction
Returns the daynumber
function FetchDateExt(AYear, AMonth, AMonthDay : word) : TDateExt;
ChangeKron(FYear);
function FetchDateExtDn(AYear, ADayNumber : word) : TDateExt;
function FetchDateExtDt(ADate : TDateTime) : TDateExt;
SetDateExt(0,0,0,0, Cal, DayCodes);
function FetchDaytype(ADateExt : TDateExt; AnIndex : word) : TDaytype;
function FetchMonthExt(AYear, AMonth : word) : TMonthExt;
ChangeKron(OrigYear);
function FetchWeekExt(AYear, AWeek : word ) : TWeekExt;
ChangeKron(OrigYear);
function FetchYearExt(AYear : word) : TYearExt;
Fetches information without changing the current day
Counts the days acc. to OffsetValue with starting point in current date.
Returns year and daynumber
function FetchYeartype(AYearExt : TYearExt; AnIndex : word) : TDaytype;
function GetDaytypeDef(AnId : word; AName : string) : TDaytypeDef;
Changes the definition of a user daytype
function GetDescKey(var Index : Integer; Keys : string;
var KeyName, Value : string) : Boolean;
Retriggers all change eventhandlers
Returns the row and column in the current MonthImage that contains
the last daynumber
procedure GetFirstMIDayCell(var ARow, ACol : Longint);
Returns the row in the current MonthImage that contains
AWeekNumber
Returns the row in the current MonthImage that contains
AWeekNumber
procedure GetLastMIDayCell(var ARow, ACol : Longint);
Returns the row and column in the current MonthImage that contains
the first daynumber
Returns the row and column in the current MonthImage that contains
the first daynumber
procedure GetMIDayCell(ADayNumber : word; var ARow, ACol : Longint);
Converts the current date to Datetime-format} //Functions operating on MonthImage
function GetMIWeekRow(AWeekNumber : word) : word;
Returns the row and column in the current MonthImage that contains
ADaynumber
Returns the row and column in the current MonthImage that contains
ADaynumber
function GetNextDaytype(var NextIndex : word) : TDaytype;
Retrieves a user daytype definition
function GetNextDaytypeDate(ADate : word; var Count : word) : TDaytype;
Retrievs a daytype from the daytype list, matching AName and Count
Retrievs a daytype from the daytype list, matching AName and Count
function GetNextDaytypeName(AName : string; var Count : word) : TDaytype;
Retrievs a daytype from the daytype list
procedure GotoDate(AYear, AMonth, AMonthDay : word);
Changes the current date by calculating or searching
Returns the daynumber of ADayTypeConst in AYear
procedure GotoDateDn(AYear, ADayNumber : word);
procedure GotoDateDt(ADate : TDateTime);
if there is a transaction already running don't end
procedure GotoDayType(AYear : word; AnId : word; DayTypeName : string);
procedure GotoLastMonth;
procedure GotoLastWeek;
procedure GotoNextMonth;
procedure GotoNextWeek;
procedure GoToOffsetDay(OffsetValue : integer;
WorkdaysOnly : boolean);
Moves to the daynumber in AYear that contains Daytypename/id
procedure GoToOffsetMonth(OffsetValue : integer);
Moves to Year/Daynumber that results from the number of weeks in
OffsetValue. Startingpoint is current date
procedure GoToOffsetWeek(OffsetValue : integer);
Moves to Year/Daynumber that results from the number of days in
OffsetValue. Startingpoint is current date
Converts a dow number of type 1=Monday, 2=Sunday to type TWeekDay
procedure GotoThisMonth;
procedure GotoThisWeek;
procedure GotoToday;
procedure GotoTomorrow;
procedure GotoYesterday;
function IsLastDayOfMonth(AYear, AMonth, AMonthDay : word) : boolean;
function IsLastMonth(var AYear, AMonthNumber : word) : boolean;
function IsLastWeek(var AYear, AWeekNumber : word) : boolean;
function IsLastWeekOfYear(AYear, AWeek : word) : boolean;
function IsLastYear(var AYear : word) : boolean;
function IsLeapYear(AYear : word) : boolean;
function IsNextMonth(var AYear, AMonthNumber : word) : boolean;
function IsNextWeek(var AYear, AWeekNumber : word) : boolean;
function IsNextYear(var AYear : word) : boolean;
function IsThisMonth(var AYear, AMonthNumber : word) : boolean;
function IsThisWeek(var AYear, AWeekNumber : word) : boolean;
function IsThisYear(var AYear : word) : boolean;
function IsToday(var AYear, ADayNumber : word) : boolean;
Returns the year and daynumber by counting offsetvalue months from
current date} //Retrievs information about the current date
function IsTomorrow(var AYear, ADayNumber : word) : boolean;
function IsYesterday(var AYear, ADayNumber : word) : boolean;
procedure LoadFromFile(AFilename : string; LoadAll : boolean);
Specifies the standard predefined days with native names and status
function MonthsInInterval(Year1, Month1, Year2, Month2: word) : integer;
Interval functions
Count number of weeks between Year1, Week1 and Year2, Week2.
procedure Rechange;
Checks for duplicate daytype names
procedure RestoreCD;
Saves the current date
procedure SaveCD;
Turns off event triggering
procedure SaveToFile(AFilename : string);
Loads a calendar definition from file
procedure SpecifyStandardDay(AnId : word; AName : string;
IsHoliday, IsFlagday : boolean);
Retrievs a daytype from the daytype list, matching ADate and Count
Retrievs a daytype from the daytype list, matching ADate and Count
procedure UpdateDaytype(AnId : word; AName : string;
DaytypeDef : TDaytypeDef);
Deletes a user daytype
Predfined daytype. Can't delete
procedure UpdateInfo;
Restores the current date
function WeeksInInterval(Year1, Week1, Year2, Week2: word) : integer;
Calculates the number of months between 1 and 2
procedure CalcDaytype(Daytype : TDaytype; ADateExt : TDateExt;
IsCurrentDate : boolean; var Accepted : boolean);
procedure ChangeDate;
procedure ChangeKron(AYear : word);
Functions operating directly on the internal calendar structures:
procedure ChangeMonth;
procedure ChangeMonthDay;
procedure ChangeMonthNumber;
procedure ChangeWeek;
procedure ChangeWeekday;
procedure ChangeWeekNumber;
procedure ChangeYear;
Weekday of current date does now belong to last Week of previous
year
procedure ClearLists;
Disables user calculation of daytypes, i.e. disables triggering
of the OnCalcDaytype event
procedure DisableIndexing(Disable : boolean);
The index of the IdList that is the last predefined daytype
Fill weeks that belongs to next month
procedure DisableUserCalc(Disable : boolean);
Reads daynumber. ADate = Month * 100 + Monthday
function GetDaytypeObject(AnId : word; AName : string) : TDaytype;
Clears the daytype lists, except the predefined daytypes
procedure LoadDaytype(DaytypeDef : TDaytypeDef;
const DescKeys : String; const ClassID : Integer;
var LoadIt : boolean);
Turn off user calc. Necessary to prevent user from
eternalnally triggering the OnCalDaytype event
procedure Loaded;
Turns off sorting (Disable = true for all lists).
Used in connection with loading from file, to speed up daytype creation.
Call with Disable = false to turn on indexing and resort the lists
function ReadDay(DNr : word) : TDay;
Reads year information
Unterminated week at end of year
function ReadDayNr(ADate : word) : word;
Reads month information
-> Daynumber of first weekday
function ReadMonth(MNr : word) : TMonth;
Reads week information
Load Week-info
function ReadWeek(WNr : word) : TWeek;
Reads day information
Load Day-info
function ReadYear : TYear;
Changes the internal calendar to AYear
The following procedures loads the basic information structures
procedure SaveDaytype(Daytype : TDaytype;
var DescKeys : String; var ClassID : Integer;
var SaveIt : boolean);
procedure SetCountrySpecifics;
Updates YearExt, DateExt and MonthExt after calls to
AddDaytype, SpecifyCommonday, SpecifiyChurchDay
procedure Today;
function ConvertWeekday(DayOfWeekNumber : word) : TWeekDay;
Other internal routines
function FindDayType(DayTypeName : string) : word;
function FindDayTypeId(DayTypeId : word) : word;
procedure FindOffsetDay(var TheYear, TheDayNumber : word;
OffsetValue : integer; WorkdaysOnly : Boolean);
Count number of months between Year1, Month1 and Year2, Month2.
procedure FindOffsetMonth(var TheYear, TheDayNumber : word;
OffsetValue : integer);
procedure FindOffsetWeek(var TheYear, TheDayNumber : word;
OffsetValue : integer);
Returns the day and year by counting offset-days from current day
function GetDayType(AnIndex : word) : TDaytype;
High level internal routines
Daynames
function GetDOW(DNr : word) : word;
Antall måneder utover hele år
function GetMonthImage : TMonthImage;
procedure MakeCal(AYear:Integer);
-> Ascension day
procedure MakeDates(AYear : Word; var CalTab : TCal);
Computes first weekday of yaer
procedure MakeKron(AYear : word);
Returns Daynumber tied to MonthDate
procedure RestoreIntCd;
procedure SaveIntCD;
function SeekDate(MonthDate: Word; Leap : Boolean) : Word;
procedure SetCommonDaysDate; {Low level internal routines operating on the basic
calendar structures
procedure SetDateExt(AYear, AMonth, AMonthDay, ADaynr : word;
ACal : TCal; ADayC : TDaycodes);
procedure SetDayNumber (Value : word);
procedure SetDefaults;
Sets default attributes of standard churchdays and common days
Nothing. Use to derive a new component from TKronos
procedure SetFirstDay(AYear: Word; var F : Integer);
******Procedures to create the internal calendar for a year
procedure SetFirstWeekDay(Value : TWeekday);
Updating exisiting country spesific
procedure SetFixedCodes(AYear : Integer);
MakeDates
procedure SetHidePredefineds(Value : boolean);
procedure SetMaxYear(Value : word);
procedure SetMinYear(Value : word);
procedure SetMonth (Value : word);
procedure SetMonthDay (Value : word);
procedure SetMonthExt;
procedure SetRelCodes(FullMoonDate:Integer);
Now first sunday advent
procedure SetWeek (Value : word);
Sunday = 1, Monday = 2, etc
procedure SetWeekDay(Value : TWeekDay);
procedure SetWeekExt;
procedure SetWeekHolidays(Value : TWeekHolidays);
procedure SetYear (Value : word);
Property setting procedures
Check userdefined daytypes
procedure SetYearExt;
Calculates Easter full moon
function ShowUp(F,L,Sf,Y : word) : boolean;
property AllowUserCalc : boolean
property DayNumber : word
property DefaultToPresentDay : boolean
property FirstWeekDay : TWeekDay
property HidePredefineds : boolean
property MaxYear : word
property MinYear : word
property Month : word
property MonthDay : word
property Week : word
property WeekDay : TWeekDay
property WeekHolidays : TWeekHolidays
property Year : word
Published declarations
property DateExt : TDateExt
property DayTypeCount : word
property DayTypes : TDaytype
property FirstUserId : Word
property MonthExt : TMonthExt
property WeekExt : TWeekExt
property YearExt : TYearExt
Saves a calendar definition to file} //Stores information about the current date
event OnCalcDaytype : TCalcDaytypeEvent
event OnChangeDate : TNotifyEvent
event OnChangeMonth : TNotifyEvent
event OnChangeMonthDay : TNotifyEvent
event OnChangeMonthNumber : TNotifyEvent
event OnChangeWeek : TNotifyEvent
event OnChangeWeekDay : TNotifyEvent
event OnChangeWeekNumber : TNotifyEvent
event OnChangeYear : TNotifyEvent
event OnLoadDaytype : TLoadDaytypeEvent
event OnSaveDaytype : TSaveDaytypeEvent
event OnToday : TNotifyEvent
Daynames : array[1..7] of string;
Public declarations
Monthnames : array[1..12] of string;
Datelist : TStringList;
Protected declarations } {User daytype definitions. Three level index. The object fields
references a TDaytype object
FCSpIndex : integer;
Next id to be assigned to a userdefined daytype
IdList : TStringList;
Name sort
NameList : TStringList;
Date sort. 4 digit string
Fixed dates:
0101 = jan. 1., 0102, jan 2., etc
Dates relative to churchdays:
0100
User calculated dates:
0010
Yeartypes:
0000
NextId : word;
Id sort. 6 digit string (000001 = 1, etc
Cal : TCal;
ChurchdayIndex : TChurchdayIndex;
Daycodes for churchdays
DayCodes : TDaycodes;
First weekday of year
FAllowUserCalc : boolean;
FCalcDisabled : boolean;
True if event triggering is disabled
FCalculating : boolean;
FChanging : boolean;
Daynumber saved with the SaveCD private method
FDateExt : TDateExt;
FDayNumber : word;
FDayTypeCount : word;
FDefaultToPresentDay : boolean;
FEndChange : boolean;
True if a date transaction is active
FEventBuf : array[ocYear..ocCalcDaytype] of boolean;
True if calls form a OnCaculateDaytype event handler is processing
FEventsDisabled : boolean;
Internal fields
FFirstUserId : word;
FFirstWeekDay : TWeekday;
FHidePredefineds : boolean;
FIntDayNumber : word;
Year saved with the SaveIntCD private method
FIntYear : word;
Daynumber saved with the SaveCD method
FMaxYear : word;
FMinYear : word;
FMonth : word;
FMonthDay : word;
FMonthExt : TMonthExt;
FOnCalcDaytype : TCalcDaytypeEvent;
FOnChangeDate : TNotifyEvent;
FOnChangeMonth : TNotifyEvent;
FOnChangeMonthDay : TNotifyEvent;
FOnChangeMonthNumber : TNotifyEvent;
FOnChangeWeek : TNotifyEvent;
FOnChangeWeekday : TNotifyEvent;
FOnChangeWeekNumber : TNotifyEvent;
FOnChangeYear : TNotifyEvent;
Events
FOnLoadDayType : TLoadDaytypeEvent;
FOnSaveDaytype : TSaveDaytypeEvent;
FOnToday : TNotifyEvent;
FSavedDayNumber : word;
Year saved with the SaveCD method
FSavedYear : word;
True if user calc computing is disabled
FTransDayNr : word;
The year that was the current year when a date transaction started
FTransError : boolean;
The daynumber that was the current daynumber when a date
transaction started
FTransYear : word;
Buffer for storing events during a date transaction
FWeek : word;
FWeekDay : TWeekDay;
FWeekExt : TWeekExt;
FWeekHolidays : TWeekHolidays;
FYear : word;
Private declarations } // Property fields
FYearExt : TYearExt;
IntFirstWeekday : word;
Kron : TKron;
True if an error occured during a date transaction} // Internal calendar variables