Documentation

BillableManager
in package
Uses ActivityLogger

Table of Contents

DAYS_PER_MONTH  = 28
HOURS_PER_DAY  = 24
MINUTES_PER_HOUR  = 60
SECONDS_PER_MINUTE  = 60
$errorLogName  : string
$warningLogName  : string
$jobsLogName  : string
The name of the log in which we are going to log actions performed by jobs
$currency  : string
buildDescription()  : string
buildDescriptionFromComposition()  : string
calculateHourly()  : array<string|int, mixed>
calculateMonthly()  : array<string|int, mixed>
calculateMonthlyPrevisionForProject()  : string
calculateOneTime()  : array<string|int, mixed>
calculatePerUsage()  : array<string|int, mixed>
cloneCosts()  : void
This function will clone costs from another Billable entity It is used, inside this trait, to clone costs from the priceList
closeBillingEntries()  : void
closeBillingEntry()  : bool
createBillingEntry()  : void
Creates a new price list entry for a specific model - that implements the IsBillable Trait
customersWithBillingToInvoice()  : CustomerResourceCollection
Fetch all customers with invoice to be generated
fetchBillingEntrySummaryForAllProjects()  : array<string|int, mixed>
Get all billing enetries for all user projects
fetchBillingEntrySummaryForProject()  : array<string|int, mixed>
Fetch a summary of payed invoices
getPartialBillingSummaryForBillingEntry()  : array<string|int, mixed>
Calculate the price of the billing entry at $billableTo date
getPriceComposition()  : array<string|int, mixed>
hasBillingToInvoiceByProject()  : bool
Checks if the project has billing entry to invoice
logEntry()  : Activity
logEntryWithoutModel()  : Activity
logError()  : Activity
logWarning()  : Activity
setPriceList()  : void
This function will handle the priceList for a billable model.
updateBillingEntries()  : void
Updated the price list entry data, based on a specific model - that impements the IsBillable Trait
updatePartialBillingEntries()  : void
Update all not closed billing entry with the partial price until $billableTo
log()  : array<string|int, Activity>

Constants

Properties

$warningLogName

public static string $warningLogName = "warning"

$jobsLogName

The name of the log in which we are going to log actions performed by jobs

protected string $jobsLogName = "jobs"

Methods

buildDescriptionFromComposition()

public static buildDescriptionFromComposition(array<string|int, mixed> $priceComposition) : string
Parameters
$priceComposition : array<string|int, mixed>
Return values
string

calculateMonthlyPrevisionForProject()

public calculateMonthlyPrevisionForProject(Project $project) : string
Parameters
$project : Project
Return values
string

decimal total

closeBillingEntry()

public closeBillingEntry(BillingEntry $billingEntry[, IsBillableAbstractClass|null $model = null ][, bool $recreate = false ][, Carbon|null $billableTo = null ][, Carbon|null $nextBillableFrom = null ][, array<string|int, mixed> $modelChanges = [] ]) : bool
Parameters
$billingEntry : BillingEntry
$model : IsBillableAbstractClass|null = null
$recreate : bool = false
$billableTo : Carbon|null = null
$nextBillableFrom : Carbon|null = null
$modelChanges : array<string|int, mixed> = []
Tags
throws
NotImplementedException
Return values
bool

fetchBillingEntrySummaryForAllProjects()

Get all billing enetries for all user projects

public static fetchBillingEntrySummaryForAllProjects(Collection $projects) : array<string|int, mixed>
Parameters
$projects : Collection
Tags
params

Collection $projects

Return values
array<string|int, mixed>

fetchBillingEntrySummaryForProject()

Fetch a summary of payed invoices

public static fetchBillingEntrySummaryForProject(Project $project) : array<string|int, mixed>
Parameters
$project : Project
Return values
array<string|int, mixed>

getPartialBillingSummaryForBillingEntry()

Calculate the price of the billing entry at $billableTo date

public getPartialBillingSummaryForBillingEntry(BillingEntry $billingEntry[, Carbon|null $billableTo = null ]) : array<string|int, mixed>
Parameters
$billingEntry : BillingEntry
$billableTo : Carbon|null = null
Return values
array<string|int, mixed>

hasBillingToInvoiceByProject()

Checks if the project has billing entry to invoice

public static hasBillingToInvoiceByProject(Project $project) : bool
Parameters
$project : Project
Return values
bool

logEntry()

public static logEntry(Model $model, array<string|int, mixed> $properties, string $description, string $event, string $logName) : Activity
Parameters
$model : Model
$properties : array<string|int, mixed>
$description : string
$event : string
$logName : string
Return values
Activity

logEntryWithoutModel()

public static logEntryWithoutModel(array<string|int, mixed> $properties, string $description, string $event, string $logName) : Activity
Parameters
$properties : array<string|int, mixed>
$description : string
$event : string
$logName : string
Return values
Activity

logError()

public static logError(Model $model, array<string|int, mixed> $properties, string $description, string $event) : Activity
Parameters
$model : Model
$properties : array<string|int, mixed>
$description : string
$event : string
Return values
Activity

logWarning()

public static logWarning(Model $model, array<string|int, mixed> $properties, string $description, string $event) : Activity
Parameters
$model : Model
$properties : array<string|int, mixed>
$description : string
$event : string
Return values
Activity

updatePartialBillingEntries()

Update all not closed billing entry with the partial price until $billableTo

public updatePartialBillingEntries([Carbon|null $billableTo = null ]) : void
Parameters
$billableTo : Carbon|null = null
Return values
void

log()

protected log(Model|array<string|int, mixed> $models, array<string|int, mixed> $properties, string $description[, null $logName = null ]) : array<string|int, Activity>
Parameters
$models : Model|array<string|int, mixed>
$properties : array<string|int, mixed>
$description : string
$logName : null = null
Return values
array<string|int, Activity>

Search results