BaseBill
extends BillServiceParent
in package
Define system base bill object
Tags
Table of Contents
- $company : Company|null
- The linked company object
- $prices : array<string|int, mixed>|null
- Buffer prices
- $project : Project|null
- In project context
- $relation : Relation|null
- $root : string
- The root storage folder starting at %DATA%/folder/
- __construct() : mixed
- Base bill constructor.
- AddEventEntry() : Result
- Add new event
- AddPriceRow() : Result
- Currency() : string
- Get the currency of the basket
- DateFormatted() : string
- Get the formatted date range
- DateToFormatted() : DateTime|string|null
- Get date as object or formatted
- FullPrice() : float|string
- Get price Get the full gross price of this project
- FullPriceNet() : float|string
- Get price Get the full net price of this project (without tax)
- FullTax() : float|string
- Get tax price Get the full taxes of this project
- GeneralSearchFields() : array<string|int, mixed>
- Get the general search fields for index
- GetCompany() : string|null
- Get company id Get the company id from content
- GetCompanyExtra() : string|null
- Get the assignment extra
- GetCompanyObject() : Company|null
- Get company
- GetLastKnownEvent() : Event|null
- Get most recent event of certain type
- MainProject() : Project|null
- Resolve the main project of this service/bill
- MainRelation() : Relation|null
- Get / Set the main relation
- Name() : mixed|null
- PriceGroups() : array<string|int, mixed>|null
- Get price groups of this entity
- PriceList() : array<string|int, RowPrice>
- Price list Resolve the prices list to row price objects. This method is cached.
- PriceListWithGroups() : array<string|int, mixed>|null
- Refunds() : array<string|int, mixed>|null
- Get the refunds
- RefundsSum() : float
- Refund sum
- Save() : mixed
- SearchFields() : array<string|int, mixed>
- Return search indexer fields Convert instance to search indexer values
- TaxRateMap() : array<string|int, mixed>
- Get the groups of included taxes
- ToPlainObject() : stdClass
- Add a deep link to the plain object on demand
- ToPlainReducedObject() : stdClass
- Convert to reduced plain data set
Properties
$company
The linked company object
protected
Company|null
$company
= null
$prices
Buffer prices
protected
array<string|int, mixed>|null
$prices
= null
Storage for row prices as resolved object list.
A list of row prices
$project
In project context
protected
Project|null
$project
= null
A reference to another overlaying project
A project object
$relation
protected
Relation|null
$relation
= null
$root
The root storage folder starting at %DATA%/folder/
protected
string
$root
= 'media/projects/'
Methods
__construct()
Base bill constructor.
public
__construct(string $type[, null|int $id = null ][, null|string $language = null ]) : mixed
Parameters
- $type : string
- $id : null|int = null
-
The base bill id
- $language : null|string = null
-
The local language or null
Return values
mixed —AddEventEntry()
Add new event
public
AddEventEntry(array<string|int, mixed> $event) : Result
Parameters
- $event : array<string|int, mixed>
Return values
Result —AddPriceRow()
public
AddPriceRow(array<string|int, mixed> $row) : Result
Parameters
- $row : array<string|int, mixed>
Return values
Result —Currency()
Get the currency of the basket
public
Currency([bool $symbol = true ]) : string
This is hard coded at the moment but may become dynamic in the future
Parameters
- $symbol : bool = true
-
As symbol like €
Return values
string —The currency
DateFormatted()
Get the formatted date range
public
DateFormatted([null|string $time_zone = FAA_TIMEZONE ][, string|null $format = 'd.m.Y H:i' ]) : string
Parameters
- $time_zone : null|string = FAA_TIMEZONE
- $format : string|null = 'd.m.Y H:i'
Return values
string —DateToFormatted()
Get date as object or formatted
public
DateToFormatted([string|null $time_zone = FAA_TIMEZONE ][, string|null $format = 'd.m.Y H:i' ][, int $offset = 30 ]) : DateTime|string|null
Parameters
- $time_zone : string|null = FAA_TIMEZONE
-
Time zone to render in
- $format : string|null = 'd.m.Y H:i'
-
If set return formatted otherwise as string
- $offset : int = 30
-
Additional offset in days
Return values
DateTime|string|null —FullPrice()
Get price Get the full gross price of this project
public
FullPrice([bool $format = false ][, bool $include_refund = true ]) : float|string
Parameters
- $format : bool = false
-
When true as formatted string
- $include_refund : bool = true
Return values
float|string —Either a formatted output or, the raw value
FullPriceNet()
Get price Get the full net price of this project (without tax)
public
FullPriceNet([bool $format = false ]) : float|string
Parameters
- $format : bool = false
-
When true as formatted string
Return values
float|string —Either a formatted output or, the raw value
FullTax()
Get tax price Get the full taxes of this project
public
FullTax([bool $format = false ]) : float|string
Parameters
- $format : bool = false
-
When true as formatted string
Return values
float|string —Either a formatted output or, the raw value
GeneralSearchFields()
Get the general search fields for index
public
GeneralSearchFields() : array<string|int, mixed>
Return values
array<string|int, mixed> —GetCompany()
Get company id Get the company id from content
public
GetCompany() : string|null
Return values
string|null —The content id
GetCompanyExtra()
Get the assignment extra
public
GetCompanyExtra() : string|null
Return values
string|null —GetCompanyObject()
Get company
public
GetCompanyObject() : Company|null
Get the main company from content
Return values
Company|null —A company object or null when list is empty
GetLastKnownEvent()
Get most recent event of certain type
public
GetLastKnownEvent( $type) : Event|null
Iterate of elements list and return the newest entry
Parameters
Return values
Event|null —MainProject()
Resolve the main project of this service/bill
public
MainProject([Project|null $project = null ]) : Project|null
Parameters
- $project : Project|null = null
Return values
Project|null —MainRelation()
Get / Set the main relation
public
MainRelation([Relation|null $rel = null ]) : Relation|null
Parameters
- $rel : Relation|null = null
Return values
Relation|null —Name()
public
Name() : mixed|null
Return values
mixed|null —PriceGroups()
Get price groups of this entity
public
PriceGroups() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —PriceList()
Price list Resolve the prices list to row price objects. This method is cached.
public
PriceList() : array<string|int, RowPrice>
Return values
array<string|int, RowPrice> —A list of row price objects
PriceListWithGroups()
public
PriceListWithGroups() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —Refunds()
Get the refunds
public
Refunds() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —RefundsSum()
Refund sum
public
RefundsSum() : float
Return values
float —Save()
public
Save([mixed $force_new_id = false ]) : mixed
Parameters
- $force_new_id : mixed = false
Tags
Return values
mixed —SearchFields()
Return search indexer fields Convert instance to search indexer values
public
SearchFields() : array<string|int, mixed>
Return values
array<string|int, mixed> —The search indexer fields
TaxRateMap()
Get the groups of included taxes
public
TaxRateMap([bool $format = false ]) : array<string|int, mixed>
Parameters
- $format : bool = false
-
When true as formatted string
Return values
array<string|int, mixed> —ToPlainObject()
Add a deep link to the plain object on demand
public
ToPlainObject([null $language = null ][, bool $with_parent = true ]) : stdClass
Parameters
- $language : null = null
- $with_parent : bool = true
Return values
stdClass —ToPlainReducedObject()
Convert to reduced plain data set
public
ToPlainReducedObject(array<string|int, mixed> $fields[, string|null $language = null ]) : stdClass
Translate and expose the current data attribute as plain resolved object with filtered attributes
Parameters
- $fields : array<string|int, mixed>
-
List of attributes to show
- $language : string|null = null
-
A system language code or empty for raw setup
Return values
stdClass —A simple attribute based php object