Manages timesheet entries and batches for the current organisation, allowing a worker to log hours against a lead or task and to submit a period's entries for approval. Reached from JS as the "timesheetManager" registered service. Entries are logged per profile per day, grouped into weekly Timesheet views for display and rolled up into TimesheetBatch records when submitted. Once a batch is closed, hours can no longer be added or changed for the dates it covers.
Group: Managers
Properties
| Property | Returns | Description |
|---|---|---|
| timesheet | Timesheet | The current user's timesheet for the week containing the common start date, with no standard items and assigned tasks included. |
| timesheetBatches | List<TimesheetBatch> | The timesheet batches submitted by the current user, most recent first depending on the underlying query. |
Methods
getTimesheetBatches() · getTimesheetBatches(Profile curUser) · submit(Date startDate, Date finishDate) · submit(Date startDate, Date finishDate, Profile worker, Date now) · addUpdateHours(Object item, double hours, String type) · addUpdateHours(Object item, double hours, Date workedDate, String type) · addUpdateHours(Object item, Profile worker, double hours, Date workedDate, String type) · getTimesheet() · timesheet(List<String> standardItems) · timesheet(List<String> standardItems, boolean includeTasks) · getTimesheetEntries(Long leadId, Date startDate, Date finishDate) · getTimesheetEntries(LeadPage lead, Date startDate, Date finishDate) · getTimesheetEntries(Lead lead, Date startDate, Date finishDate) · getTimesheet(Profile curUser, Date startDate, Date finishDate, List<String> standardItems) · getTimesheet(Profile curUser, Date startDate, Date finishDate, List<String> standardItems, boolean includeTasks)
getTimesheetBatches()
Returns: List<TimesheetBatch>
The timesheet batches submitted by the current user, most recent first depending on the underlying query.
getTimesheetBatches(Profile curUser)
Returns: List<TimesheetBatch>
Looks up the timesheet batches submitted by the given worker in the current organisation.
| Parameter | Description |
|---|---|
curUser | the worker whose submitted batches are returned |
submit(Date startDate, Date finishDate)
Returns: void
Submits the current user's timesheet entries for the given period as a new batch.
| Parameter | Description |
|---|---|
startDate | the first day of the period being submitted |
finishDate | the last day of the period being submitted |
submit(Date startDate, Date finishDate, Profile worker, Date now)
Returns: TimesheetBatch
Gathers a worker's timesheet entries for the given period and submits them as a new timesheet batch.
| Parameter | Description |
|---|---|
startDate | the first day of the period being submitted |
finishDate | the last day of the period being submitted |
worker | the profile whose entries are being submitted |
now | the timestamp recorded as the submission time |
addUpdateHours(Object item, double hours, String type)
Returns: TimesheetEntry
Adds or updates today's hours for the current user against the given work item.
| Parameter | Description |
|---|---|
item | the lead or task ID, or a free text label, identifying the work item |
hours | the number of hours worked, must not be negative |
type | the kind of item, either "lead" or "task" |
addUpdateHours(Object item, double hours, Date workedDate, String type)
Returns: TimesheetEntry
Adds or updates the current user's hours for the given day against the given work item.
| Parameter | Description |
|---|---|
item | the lead or task ID, or a free text label, identifying the work item |
hours | the number of hours worked, must not be negative |
workedDate | the day the hours were worked |
type | the kind of item, either "lead" or "task" |
addUpdateHours(Object item, Profile worker, double hours, Date workedDate, String type)
Returns: TimesheetEntry
Adds or updates a worker's hours for the given day against the given work item. If the item resolves to a numeric ID it is looked up as a lead or a task depending on the type; otherwise it is recorded as a free text label. Fails if the worked date falls within an already closed timesheet batch.
| Parameter | Description |
|---|---|
item | the lead or task ID, or a free text label, identifying the work item |
worker | the profile the hours are recorded against |
hours | the number of hours worked, must not be negative |
workedDate | the day the hours were worked, normalised to the start of the day in the organisation's timezone |
type | the kind of item, either "lead" or "task" |
getTimesheet()
Returns: Timesheet
The current user's timesheet for the week containing the common start date, with no standard items and assigned tasks included.
timesheet(List<String> standardItems)
Returns: Timesheet
Builds the current user's timesheet for the week containing the common start date, including their assigned tasks.
| Parameter | Description |
|---|---|
standardItems | labels for standard work items to always include as rows, even with no hours logged |
timesheet(List<String> standardItems, boolean includeTasks)
Returns: Timesheet
Builds the current user's timesheet for the week containing the common start date.
| Parameter | Description |
|---|---|
standardItems | labels for standard work items to always include as rows, even with no hours logged |
includeTasks | whether the worker's assigned tasks are included as work item rows |
getTimesheetEntries(Long leadId, Date startDate, Date finishDate)
Returns: List<TimesheetEntry>
Looks up the timesheet entries logged against a lead over the given period, identified by lead ID.
| Parameter | Description |
|---|---|
leadId | the ID of the lead to look up |
startDate | the start of the period to search |
finishDate | the end of the period to search |
getTimesheetEntries(LeadPage lead, Date startDate, Date finishDate)
Returns: List<TimesheetEntry>
Looks up the timesheet entries logged against a lead over the given period.
| Parameter | Description |
|---|---|
lead | the lead page whose underlying lead is looked up |
startDate | the start of the period to search |
finishDate | the end of the period to search |
getTimesheetEntries(Lead lead, Date startDate, Date finishDate)
Returns: List<TimesheetEntry>
Looks up the timesheet entries logged against a lead over the given period, within the current organisation.
| Parameter | Description |
|---|---|
lead | the lead the entries are logged against |
startDate | the start of the period to search |
finishDate | the end of the period to search |
getTimesheet(Profile curUser, Date startDate, Date finishDate, List<String> standardItems)
Returns: Timesheet
Builds a weekly timesheet view for a worker over the given period, including their assigned tasks.
| Parameter | Description |
|---|---|
curUser | the worker the timesheet is built for |
startDate | the first day of the period the timesheet covers |
finishDate | the last day of the period the timesheet covers |
standardItems | labels for standard work items to always include as rows, even with no hours logged |
getTimesheet(Profile curUser, Date startDate, Date finishDate, List<String> standardItems, boolean includeTasks)
Returns: Timesheet
Builds a timesheet view for a worker over the given period.
| Parameter | Description |
|---|---|
curUser | the worker the timesheet is built for |
startDate | the first day of the period the timesheet covers |
finishDate | the last day of the period the timesheet covers |
standardItems | labels for standard work items to always include as rows, even with no hours logged |
includeTasks | whether the worker's assigned tasks are included as work item rows |