Difference between revisions of "TimeregStatus getByUsers"

From Catglobe Wiki
Jump to: navigation, search
(Created page with "Category:Category:Functions {{HelpFiles}} ===TimeregStatus_getByUsers=== Get timereg status by user resource id ===Syntax=== Timereg_getByUsers(arrUserRid, dateS...")
 
Line 1: Line 1:
[[Category:Category:Functions]]
+
[[Category:Functions]]
{{HelpFiles}}
+
{{HelpFiles}}
  
===TimeregStatus_getByUsers===
+
=== TimeregStatus_getByUsers ===
  
 
Get timereg status by user resource id
 
Get timereg status by user resource id
  
===Syntax===
+
=== Syntax ===
  
 
Timereg_getByUsers(arrUserRid, dateStart, dateEnd);
 
Timereg_getByUsers(arrUserRid, dateStart, dateEnd);
  
===Arguments===
+
=== Arguments ===
  
 
*arrUserRid: Is array user resource id
 
*arrUserRid: Is array user resource id
  
*dateStart: Day and time to start. It is Datetime object.  
+
*dateStart: Day and time to start. It is Datetime object.
  
*dateEnd: Day and time to end. It is Datetime object.  
+
*dateEnd: Day and time to end. It is Datetime object.
  
===Return type===
+
=== Return type ===
  
 
The function returns a dictionary of user resource id as key and list of Timereg objects as value
 
The function returns a dictionary of user resource id as key and list of Timereg objects as value
  
===Examples===
+
=== Examples ===
 +
 
 
<source lang="javascript">
 
<source lang="javascript">
 
array startDate = DateTime_fromInvariant("2015-09-10 00:00:00");
 
array startDate = DateTime_fromInvariant("2015-09-10 00:00:00");
Line 32: Line 33:
 
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("Date : " + convertToString(a.Date));
    print("Locked: " + convertToString(a.Locked));
+
print("Locked: " + convertToString(a.Locked));
    print("ObjectTypeName: " + convertToString(a.ObjectTypeName));
+
print("ObjectTypeName: " + convertToString(a.ObjectTypeName));
    print("Status: " + convertToString(a.Status));
+
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));
    print("TimeregPeriod FromDate: " + convertToString(a.TimeregPeriod.FromDate));
+
print("TimeregPeriod FromDate: " + convertToString(a.TimeregPeriod.FromDate));
    print("TimeregPeriod ToDate: " + convertToString(a.TimeregPeriod.ToDate));
+
print("TimeregPeriod ToDate: " + convertToString(a.TimeregPeriod.ToDate));
    print("TimeregPeriod Active: " + convertToString(a.TimeregPeriod.Active));
+
print("TimeregPeriod Active: " + convertToString(a.TimeregPeriod.Active));
    print("TotalHours: " + convertToString(a.TotalHours));
+
print("TotalHours: " + convertToString(a.TotalHours));
    print("==========================================================\n");
+
print("==========================================================\n");
 
}
 
}
  
Line 60: Line 61:
 
==========================================================
 
==========================================================
 
*/
 
*/
</source>
+
</source> __NOTOC__
__NOTOC__
 

Revision as of 03:18, 15 April 2016


TimeregStatus_getByUsers

Get timereg status by user resource id

Syntax

Timereg_getByUsers(arrUserRid, dateStart, dateEnd);

Arguments

  • arrUserRid: Is array user resource id
  • dateStart: Day and time to start. It is Datetime object.
  • dateEnd: Day and time to end. It is Datetime object.

Return type

The function returns a dictionary of user resource id as key and list of Timereg objects as value

Examples

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);
print("Count regtime: " + regtime[urid].Count);
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");
}

/*
Count regtime: 1
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
==========================================================
*/