Difference between revisions of "Timereg getByUsers"

From Catglobe Wiki
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Functions]]
+
[[Category:Timereg_Functions]]
{{HelpFiles}}
+
{{HelpFiles}}
  
===Timereg_getByUsers===
+
=== Timereg_getByUsers ===
  
Returns a dictionary where keys are resource ids and value is a dictionary where the key is the userid and the value is a list of timereg arrays ordered by the date.  
+
Returns a dictionary where keys are resource ids and value is a dictionary where the key is the userid and the value is a list of timereg arrays ordered by the date.
  
===Syntax===
+
=== Syntax ===
  
 
Timereg_getByUsers(UserResourceId, dateStart, dateEnd)
 
Timereg_getByUsers(UserResourceId, dateStart, dateEnd)
  
===Arguments===
+
=== Arguments ===
  
 
*UserResourceId: is a array user resource id
 
*UserResourceId: is a array user resource id
Line 16: Line 16:
 
*dateEnd: is a array datetime
 
*dateEnd: is a array datetime
  
===Return type===
+
=== Return type ===
  
Dictionary
+
The function returns a dictionary of user resource id as key and list of array as value
 +
 
 +
Value is array, in which there are 7 items:
 +
 
 +
{| style="border-collapse: collapse;  border: 1px solid rgb(1, 1, 1)" class="tableintopic" width="876" border="1" cellpadding="2"
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="198" bgcolor="#c0c0c0" |
 +
'''Constant'''
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="120" bgcolor="#c0c0c0" |
 +
'''Data type'''
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="558" bgcolor="#c0c0c0" |
 +
'''Value'''
 +
 
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="198" |
 +
OBJECT_TYPE_INDEX
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="120" |
 +
number
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="558" |
 +
It's index of object type
 +
 
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="198" |
 +
TIMEREGRESOURCE_ID
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="120" |
 +
number
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="558" |
 +
It's Timereg id
 +
 
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="198" |
 +
TIMEREGRESOURCE_HOURS
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="120" |
 +
number
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="558" |
 +
It's number of hours regtime
 +
 
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="198" |
 +
TIMEREGRESOURCE_RESOURCE_ID
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="120" |
 +
number
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="558" |
 +
It's task resource id
 +
 
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="198" |
 +
TIMEREGRESOURCE_TIMEREG_ID
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="120" |
 +
number
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="558" |
 +
It's Timereg resource id
 +
 
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="198" |
 +
TIMEREGRESOURCE_DATE
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="120" |
 +
Datetime
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="558" |
 +
It's array datetime
 +
 
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="198" |
 +
TIMEREGRESOURCE_ROLE_ID
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="120" |
 +
number
 +
 
 +
| style="border: 1px solid rgb(1, 1, 1)" width="558" |
 +
It's Timereg role id
 +
 
 +
|}
 +
 
 +
 
 +
 
 +
=== Examples ===
  
===Examples===
 
 
<source lang="javascript">
 
<source lang="javascript">
array dateStart = DateTime_fromInvariant("2016-01-05 00:00:00");
+
array dateStart = DateTime_fromInvariant("2016-04-01 00:00:00");
array dateEnd = DateTime_fromInvariant("2016-02-05 00:00:00");
+
array dateEnd = DateTime_fromInvariant("2016-04-10 00:00:00");
 
Dictionary regtime = Timereg_getByUsers({717536}, dateStart, dateEnd);
 
Dictionary regtime = Timereg_getByUsers({717536}, dateStart, dateEnd);
</source>
+
 
__NOTOC__
+
/*
 +
{
 +
"717536":
 +
{
 +
{38,112561,1,796156,29185,{2016,4,1,0,0,0,0,13},0},
 +
{38,112975,1,794623,29327,{2016,4,5,0,0,0,0,14},0},
 +
{38,113095,1,797702,29185,{2016,4,1,0,0,0,0,13},0}
 +
}
 +
}
 +
*/
 +
</source> __NOTOC__

Latest revision as of 03:29, 15 April 2016


Timereg_getByUsers

Returns a dictionary where keys are resource ids and value is a dictionary where the key is the userid and the value is a list of timereg arrays ordered by the date.

Syntax

Timereg_getByUsers(UserResourceId, dateStart, dateEnd)

Arguments

  • UserResourceId: is a array user resource id
  • dateStart: is a array datetime
  • dateEnd: is a array datetime

Return type

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

Value is array, in which there are 7 items:

Constant

Data type

Value

OBJECT_TYPE_INDEX

number

It's index of object type

TIMEREGRESOURCE_ID

number

It's Timereg id

TIMEREGRESOURCE_HOURS

number

It's number of hours regtime

TIMEREGRESOURCE_RESOURCE_ID

number

It's task resource id

TIMEREGRESOURCE_TIMEREG_ID

number

It's Timereg resource id

TIMEREGRESOURCE_DATE

Datetime

It's array datetime

TIMEREGRESOURCE_ROLE_ID

number

It's Timereg role id


Examples

array dateStart = DateTime_fromInvariant("2016-04-01 00:00:00");
array dateEnd = DateTime_fromInvariant("2016-04-10 00:00:00");
Dictionary regtime = Timereg_getByUsers({717536}, dateStart, dateEnd);

/*
{
 "717536": 
 {
 {38,112561,1,796156,29185,{2016,4,1,0,0,0,0,13},0},
 {38,112975,1,794623,29327,{2016,4,5,0,0,0,0,14},0},
 {38,113095,1,797702,29185,{2016,4,1,0,0,0,0,13},0}
 }
}
*/