CoolCMS API

WorkItem extends WorkItem
in package

Single work item on a work sheet.

A WorkList is a job and a WorkSheet is a work sheet inside a job. The parent of a work item is the WorkSheet, not the WorkList.

Only the server computes price, in beforeSave (manual_price ?? round(hourlyRate × actualHours, 2)). hourlyRate is a snapshot of the rate at creation (service, then company default) and stays editable afterwards.

Attributes
#[Entity]
#[Table]
$name: 'cms_mod_company_work_items'
#[TableAlias]
'workItem'

Table of Contents

Properties

$actualHours  : string|null
$billable  : bool
$companyServiceId  : int|null
$deleted  : bool
$description  : string|null
$estimatedHours  : string|null
$hourlyRate  : string|null
$id  : int|null
$insertDatetime  : DateTime
$manualPrice  : string|null
$order  : int
$price  : string|null
$status  : WorkItemStatus
$supplyKindId  : int|null
$title  : string
$updateDatetime  : DateTime|null
$vatPercents  : numeric-string|null
$workDate  : DateTime|null
$workSheetId  : int
IMPORTANT: membership of a sheet is not an ordinary field, it is a billing assignment.

Methods

__construct()  : mixed
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getActualHours()  : string|null
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getBillable()  : bool
getCompanyServiceId()  : int|null
getDeleted()  : bool
getDescription()  : string|null
getEstimatedHours()  : string|null
getHourlyRate()  : string|null
getId()  : int|null
getInsertDatetime()  : DateTime
getManualPrice()  : string|null
getOrder()  : int
getPrice()  : string|null
getStatus()  : WorkItemStatus
getSupplyKindId()  : int|null
getTitle()  : string
getUpdateDatetime()  : DateTime|null
getVatPercents()  : numeric-string|null
getWorkDate()  : DateTime|null
getWorkSheetId()  : int
isBillable()  : bool
isDeleted()  : bool
isPersisted()  : bool
setActualHours()  : $this
setBillable()  : $this
setCompanyServiceId()  : $this
setDeleted()  : $this
setDescription()  : $this
setEstimatedHours()  : $this
setHourlyRate()  : $this
setId()  : $this
setInsertDatetime()  : $this
setManualPrice()  : $this
setOrder()  : $this
setPrice()  : $this
setStatus()  : $this
setSupplyKindId()  : $this
setTitle()  : $this
setUpdateDatetime()  : $this
setVatPercents()  : $this
setWorkDate()  : $this
setWorkSheetId()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$actualHours

protected string|null $actualHours = null
Attributes
#[Column]
$name: 'actual_hours'
$type: 'decimal'
$precision: 6
$scale: 2
$nullable: true

$billable

protected bool $billable = true
Attributes
#[Column]
$name: 'billable'
$type: 'boolean'

$companyServiceId

protected int|null $companyServiceId = null
Attributes
#[Column]
$name: 'company_service_id'
$type: 'integer'
$options: ['unsigned' => true]
$nullable: true

$description

protected string|null $description = null
Attributes
#[Column]
$name: 'description'
$type: 'text'
$nullable: true

$estimatedHours

protected string|null $estimatedHours = null
Attributes
#[Column]
$name: 'estimated_hours'
$type: 'decimal'
$precision: 6
$scale: 2
$nullable: true

$hourlyRate

protected string|null $hourlyRate = null
Attributes
#[Column]
$name: 'hourly_rate'
$type: 'decimal'
$precision: 10
$scale: 2
$nullable: true

$id

protected int|null $id = null
Attributes
#[Column]
$name: 'work_item_id'
$type: 'integer'
$options: ['unsigned' => true]
#[GeneratedValue]
#[Id]

$insertDatetime

protected DateTime $insertDatetime = new DateTime()
Attributes
#[Column]
$name: 'insert_datetime'
$type: 'datetime'
#[ExternalReadonly]

$manualPrice

protected string|null $manualPrice = null
Attributes
#[Column]
$name: 'manual_price'
$type: 'decimal'
$precision: 10
$scale: 2
$nullable: true

$order

protected int $order = 0
Attributes
#[Column]
$name: '`order`'
$type: 'integer'
$options: ['unsigned' => true, 'default' => 0]

$price

protected string|null $price = null
Attributes
#[Column]
$name: 'price'
$type: 'decimal'
$precision: 10
$scale: 2
$nullable: true
#[ExternalReadonly]

$status

protected WorkItemStatus $status = WorkItemStatus::New
Attributes
#[Column]
$name: 'status'
$type: 'string'
$length: 16
$enumType: WorkItemStatus::class

$supplyKindId

protected int|null $supplyKindId = null
Attributes
#[Column]
$name: 'supply_kind_id'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

$title

protected string $title = ''
Attributes
#[Column]
$name: 'title'
$type: 'string'
$length: 255

$updateDatetime

protected DateTime|null $updateDatetime = null
Attributes
#[Column]
$name: 'update_datetime'
$type: 'datetime'
$nullable: true
#[ExternalReadonly]

$vatPercents

protected numeric-string|null $vatPercents = null
Attributes
#[Column]
$name: 'vat_percents'
$type: 'decimal'
$precision: 5
$scale: 2
$nullable: true

$workDate

protected DateTime|null $workDate = null
Attributes
#[Column]
$name: 'work_date'
$type: 'date'
$nullable: true

$workSheetId

IMPORTANT: membership of a sheet is not an ordinary field, it is a billing assignment.

protected int $workSheetId = 0

An external client must not change it: moving work between sheets could take hours out of an already invoiced sheet (making them billable again) or hand them to another client. Stripping on the external path is the first defense; the second are the guards in WorkItemManager::beforeSave() and updateColumns(), which check both ends of the move and that company and client match. The internal path (admin bridge, carry-over on closing) passes through them and the attribute does not restrict it.

Attributes
#[Column]
$name: 'work_sheet_id'
$type: 'integer'
$options: ['unsigned' => true]
#[ExternalReadonly]

Methods

__construct()

public __construct([int|null $id = null ][, int $workSheetId = 0 ][, int|null $companyServiceId = null ][, string $title = '' ][, string|null $description = null ][, WorkItemStatus $status = WorkItemStatus::New ][, DateTime|null $workDate = null ][, string|null $estimatedHours = null ][, string|null $actualHours = null ][, string|null $hourlyRate = null ][, string|null $manualPrice = null ][, string|null $vatPercents = null ][, bool $billable = true ][, string|null $price = null ][, int $order = 0 ][, DateTime $insertDatetime = new DateTime() ][, DateTime|null $updateDatetime = null ][, bool $deleted = false ][, int|null $supplyKindId = null ]) : mixed
Parameters
$id : int|null = null
$workSheetId : int = 0
$companyServiceId : int|null = null
$title : string = ''
$description : string|null = null
$status : WorkItemStatus = WorkItemStatus::New
$workDate : DateTime|null = null
$estimatedHours : string|null = null
$actualHours : string|null = null
$hourlyRate : string|null = null
$manualPrice : string|null = null
$vatPercents : string|null = null
$billable : bool = true
$price : string|null = null
$order : int = 0
$insertDatetime : DateTime = new DateTime()
$updateDatetime : DateTime|null = null
$deleted : bool = false
$supplyKindId : int|null = null

callInitMethods()

Calls `init{TraitName}()` for every used trait that defines such a method.

public callInitMethods() : void

getActualHours()

public getActualHours() : string|null
Return values
string|null

getAllTraits()

Returns all traits the class uses, including those used by parent classes and nested traits.

public getAllTraits() : array<string, string>
Return values
array<string, string>

getBillable()

public getBillable() : bool
Return values
bool

getCompanyServiceId()

public getCompanyServiceId() : int|null
Return values
int|null

getDeleted()

public getDeleted() : bool
Return values
bool

getDescription()

public getDescription() : string|null
Return values
string|null

getEstimatedHours()

public getEstimatedHours() : string|null
Return values
string|null

getHourlyRate()

public getHourlyRate() : string|null
Return values
string|null

getInsertDatetime()

public getInsertDatetime() : DateTime
Return values
DateTime

getManualPrice()

public getManualPrice() : string|null
Return values
string|null

getOrder()

public getOrder() : int
Return values
int

getPrice()

public getPrice() : string|null
Return values
string|null

getSupplyKindId()

public getSupplyKindId() : int|null
Return values
int|null

getTitle()

public getTitle() : string
Return values
string

getUpdateDatetime()

public getUpdateDatetime() : DateTime|null
Return values
DateTime|null

getVatPercents()

public getVatPercents() : numeric-string|null
Return values
numeric-string|null

getWorkDate()

public getWorkDate() : DateTime|null
Return values
DateTime|null

getWorkSheetId()

public getWorkSheetId() : int
Return values
int

isBillable()

public isBillable() : bool
Return values
bool

isDeleted()

public isDeleted() : bool
Return values
bool

setActualHours()

public setActualHours(string|null $actualHours) : $this
Parameters
$actualHours : string|null
Return values
$this

setBillable()

public setBillable(bool $billable) : $this
Parameters
$billable : bool
Return values
$this

setCompanyServiceId()

public setCompanyServiceId(int|null $companyServiceId) : $this
Parameters
$companyServiceId : int|null
Return values
$this

setDeleted()

public setDeleted(bool $deleted) : $this
Parameters
$deleted : bool
Return values
$this

setDescription()

public setDescription(string|null $description) : $this
Parameters
$description : string|null
Return values
$this

setEstimatedHours()

public setEstimatedHours(string|null $estimatedHours) : $this
Parameters
$estimatedHours : string|null
Return values
$this

setHourlyRate()

public setHourlyRate(string|null $hourlyRate) : $this
Parameters
$hourlyRate : string|null
Return values
$this

setId()

public setId(int|null $id) : $this
Parameters
$id : int|null
Return values
$this

setInsertDatetime()

public setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
$insertDatetime : DateTime
Return values
$this

setManualPrice()

public setManualPrice(string|null $manualPrice) : $this
Parameters
$manualPrice : string|null
Return values
$this

setOrder()

public setOrder(int $order) : $this
Parameters
$order : int
Return values
$this

setPrice()

public setPrice(string|null $price) : $this
Parameters
$price : string|null
Return values
$this

setSupplyKindId()

public setSupplyKindId(int|null $supplyKindId) : $this
Parameters
$supplyKindId : int|null
Return values
$this

setTitle()

public setTitle(string $title) : $this
Parameters
$title : string
Return values
$this

setUpdateDatetime()

public setUpdateDatetime(DateTime|null $updateDatetime) : $this
Parameters
$updateDatetime : DateTime|null
Return values
$this

setVatPercents()

public setVatPercents(int|float|string|null $vatPercents) : $this
Parameters
$vatPercents : int|float|string|null
Return values
$this

setWorkDate()

public setWorkDate(DateTime|null $workDate) : $this
Parameters
$workDate : DateTime|null
Return values
$this

setWorkSheetId()

public setWorkSheetId(int $workSheetId) : $this
Parameters
$workSheetId : int
Return values
$this

getTraitsRecursive()

Walks the trait list recursively and collects nested traits too.

private static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
$traits : array<string, string>
Return values
array<string, string>
On this page

Search results