Difference between revisions of "TimeregPeriod class"
Line 16: | Line 16: | ||
{{CGscriptProperties_Template|ReturnType=DateTime|Name=ToDate |HasGetter=1|Description=Get end date of the period}} | {{CGscriptProperties_Template|ReturnType=DateTime|Name=ToDate |HasGetter=1|Description=Get end date of the period}} | ||
}} | }} | ||
+ | |||
+ | |||
<source lang="javascript"> | <source lang="javascript"> | ||
Line 23: | Line 25: | ||
number urid = user[USER_RESOURCE_ID]; | number urid = user[USER_RESOURCE_ID]; | ||
Dictionary regtime = TimeregStatus_getByUsers({urid}, startDate, endDate); | Dictionary regtime = TimeregStatus_getByUsers({urid}, startDate, endDate); | ||
− | + | ||
− | |||
number i = 0; | number i = 0; | ||
for(i=0;i<regtime[urid].Count;i++) { | for(i=0;i<regtime[urid].Count;i++) { | ||
Timereg a = regtime[urid][i]; | Timereg a = regtime[urid][i]; | ||
+ | print("Date : " + convertToString(a.Date)); | ||
+ | print("Locked: " + convertToString(a.Locked)); | ||
+ | print("ObjectTypeName: " + convertToString(a.ObjectTypeName)); | ||
+ | print("Status: " + convertToString(a.Status)); | ||
print("TimeregPeriod Name: " + convertToString(a.TimeregPeriod.Name)); | print("TimeregPeriod Name: " + convertToString(a.TimeregPeriod.Name)); | ||
print("TimeregPeriod ObjectTypeName: " + convertToString(a.TimeregPeriod.ObjectTypeName)); | print("TimeregPeriod ObjectTypeName: " + convertToString(a.TimeregPeriod.ObjectTypeName)); | ||
Line 38: | Line 43: | ||
/* | /* | ||
− | + | Date : 2016-03-29 00:00:00 | |
− | + | Locked: False | |
− | + | ObjectTypeName: Timereg | |
+ | Status: Met | ||
TimeregPeriod Name: 39.03.2016 | TimeregPeriod Name: 39.03.2016 | ||
TimeregPeriod ObjectTypeName: TimeregPeriod | TimeregPeriod ObjectTypeName: TimeregPeriod |
Revision as of 11:10, 14 April 2016
TimeregPeriod
Define a registration period
Methods
- empty Activate() - Activate the period and save it
- empty Deactivate() - Deactivate the period and save it
- string ToString() - The string representation of the object.
Properties
- bool Active { get; } - Get if the period is active
- DateTime FromDate { get; } - Get start date of the period
- string Name { get; } - Get name of the period
- string ObjectTypeName { get; } - The name of the type of object.
- DateTime ToDate { get; } - Get end date of the period
array startDate = DateTime_fromInvariant("2015-09-10 00:00:00");
array endDate = DateTime_fromInvariant("2016-09-10 00:00:00");
array user = User_getCurrentUser();
number urid = user[USER_RESOURCE_ID];
Dictionary regtime = TimeregStatus_getByUsers({urid}, startDate, endDate);
number i = 0;
for(i=0;i<regtime[urid].Count;i++) {
Timereg a = regtime[urid][i];
print("Date : " + convertToString(a.Date));
print("Locked: " + convertToString(a.Locked));
print("ObjectTypeName: " + convertToString(a.ObjectTypeName));
print("Status: " + convertToString(a.Status));
print("TimeregPeriod Name: " + convertToString(a.TimeregPeriod.Name));
print("TimeregPeriod ObjectTypeName: " + convertToString(a.TimeregPeriod.ObjectTypeName));
print("TimeregPeriod FromDate: " + convertToString(a.TimeregPeriod.FromDate));
print("TimeregPeriod ToDate: " + convertToString(a.TimeregPeriod.ToDate));
print("TimeregPeriod Active: " + convertToString(a.TimeregPeriod.Active));
print("TotalHours: " + convertToString(a.TotalHours));
print("==========================================================\n");
}
/*
Date : 2016-03-29 00:00:00
Locked: False
ObjectTypeName: Timereg
Status: Met
TimeregPeriod Name: 39.03.2016
TimeregPeriod ObjectTypeName: TimeregPeriod
TimeregPeriod FromDate: 2016-03-29 00:00:00
TimeregPeriod ToDate: 2016-03-29 00:00:00
TimeregPeriod Active: True
TotalHours: 8
==========================================================
*/