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

PropertyReturnsDescription
timesheetTimesheetThe current user's timesheet for the week containing the common start date, with no standard items and assigned tasks included.
timesheetBatchesList<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.

ParameterDescription
curUserthe 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.

ParameterDescription
startDatethe first day of the period being submitted
finishDatethe 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.

ParameterDescription
startDatethe first day of the period being submitted
finishDatethe last day of the period being submitted
workerthe profile whose entries are being submitted
nowthe 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.

ParameterDescription
itemthe lead or task ID, or a free text label, identifying the work item
hoursthe number of hours worked, must not be negative
typethe 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.

ParameterDescription
itemthe lead or task ID, or a free text label, identifying the work item
hoursthe number of hours worked, must not be negative
workedDatethe day the hours were worked
typethe 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.

ParameterDescription
itemthe lead or task ID, or a free text label, identifying the work item
workerthe profile the hours are recorded against
hoursthe number of hours worked, must not be negative
workedDatethe day the hours were worked, normalised to the start of the day in the organisation's timezone
typethe 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.

ParameterDescription
standardItemslabels 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.

ParameterDescription
standardItemslabels for standard work items to always include as rows, even with no hours logged
includeTaskswhether 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.

ParameterDescription
leadIdthe ID of the lead to look up
startDatethe start of the period to search
finishDatethe 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.

ParameterDescription
leadthe lead page whose underlying lead is looked up
startDatethe start of the period to search
finishDatethe 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.

ParameterDescription
leadthe lead the entries are logged against
startDatethe start of the period to search
finishDatethe 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.

ParameterDescription
curUserthe worker the timesheet is built for
startDatethe first day of the period the timesheet covers
finishDatethe last day of the period the timesheet covers
standardItemslabels 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.

ParameterDescription
curUserthe worker the timesheet is built for
startDatethe first day of the period the timesheet covers
finishDatethe last day of the period the timesheet covers
standardItemslabels for standard work items to always include as rows, even with no hours logged
includeTaskswhether the worker's assigned tasks are included as work item rows
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.