class Transaction extends Model implements Segregatable, Recyclable, Clearable, Assignable

Class Transaction

Traits

Constants

MODELNAME

Transaction Model Name

CS

Transaction Types

IN

CN

RC

CP

BL

DN

PY

CE

JN

Properties

protected array $fillable

The attributes that are mass assignable.

protected $dates
protected array $compoundEntries

Compound Ledger entries for the transaction

Entity $entity
ExchangeRate $exchangeRate
Account $account
Currency $currency
Carbon $transaction_date
string $reference
string $transaction_no
string $transaction_type
string $narration
bool $credited
bool $compound
float $amount
float $main_account_amount
Carbon $destroyed_at
Carbon $deleted_at

Methods

static void
bootSegregating()

Register EntityScope for Model.

BelongsTo
entity()

Model's Parent Entity.

static void
bootRecycling()

Model recycling events.

MorphMany
recycled()

Recycled Model records.

getClearedAmountAttribute()

Cleared Transaction amount.

from  Clearing
float
clearedAmountAsAt(Carbon $date)

Cleared Transaction amount as at the end of the given date.

from  Clearing
HasMany
clearances()

Cleared Model records.

from  Clearing
getBalanceAttribute()

Balance Remaining on Transaction.

getTable()

Determine the model table name

void
addCompoundEntry(array $compoundEntry, bool $credited)

Add Compound Entry to Transaction CompoundEntries.

__construct($attributes = [])

Construct new Transaction.

static string
getClass(string $type)

Get Transaction Class

static array
getTypes(array $types)

Get Human Readable Transaction types

static string
getType(string $type)

Get Human Readable Transaction type

string
toString($type = false)

Instance Identifier.

HasMany
ledgers()

Transaction Ledgers.

BelongsTo
currency()

Transaction Currency.

BelongsTo
account()

Transaction Account.

BelongsTo
exchangeRate()

Transaction Exchange Rate.

HasMany
assignments()

Transaction Assignments.

HasMany
lineItems()

Transaction Saved Line Items.

MorphTo
attachment()

The model attached to the transaction.

string
getTypeAttribute()

Instance Type Translator.

bool
getIsPostedAttribute()

is_posted analog for Assignment model.

bool
getIsCreditedAttribute()

is_credited analog for Assignment model.

string
getClearedTypeAttribute()

cleared_type analog for Assignment model.

float
getAmountAttribute()

amount analog for Assignment model.

array
getCompoundEntries()

Get Transaction CompoundEntries.

array
getLineItems()

Get Transaction LineItems.

array
getVatAttribute()

Total Vat amount of the transaction.

bool
getAssignableAttribute()

Transaction is assignable predicate.

bool
getClearableAttribute()

Transaction is clearable predicate.

string
getDateAttribute()

Transaction date.

object
attributes()

Transaction attributes.

bool
addLineItem(LineItem $lineItem)

Add LineItem to Transaction LineItems.

void
removeLineItem(LineItem $lineItem)

Remove LineItem from Transaction LineItems.

array
getAssigned()

Get this Transaction's assigned Transactions.

void
addAssigned(array $toBeAssigned)

Add Transaction to this Transaction's assigned Transactions.

void
processAssigned(int|null $forexAccountId = null)

Create assignments for the assigned transactions being staged.

void
post()

Post Transaction to the Ledger.

bool
save(array $options = [])

Relate LineItems to Transaction.

static string
transactionNo(string $type, Carbon|null $transaction_date = null, Entity|null $entity = null)

The next Transaction number for the transaction type and transaction_date.

bool
delete()

Check Transaction Relationships.

bool
getHasIntegrityAttribute()

Check Transaction Integrity.

Details

in Segregating at line 28
static void bootSegregating()

Register EntityScope for Model.

Return Value

void

in Segregating at line 46
BelongsTo entity()

Model's Parent Entity.

Return Value

BelongsTo

in Recycling at line 28
static void bootRecycling()

Model recycling events.

Return Value

void

in Recycling at line 73
MorphMany recycled()

Recycled Model records.

Return Value

MorphMany

in Clearing at line 26
getClearedAmountAttribute()

Cleared Transaction amount.

in Clearing at line 45
float clearedAmountAsAt(Carbon $date)

Cleared Transaction amount as at the end of the given date.

Parameters

Carbon $date

Return Value

float

in Clearing at line 62
HasMany clearances()

Cleared Model records.

Matched on cleared_type and not the class, which for a Transaction subclass such as a ClientInvoice is not the type its clearances are stored under.

Return Value

HasMany

in Assigning at line 18
getBalanceAttribute()

Balance Remaining on Transaction.

in ModelTablePrefix at line 22
getTable()

Determine the model table name

at line 210
protected void addCompoundEntry(array $compoundEntry, bool $credited)

Add Compound Entry to Transaction CompoundEntries.

Parameters

array $compoundEntry
bool $credited

Return Value

void

at line 218
__construct($attributes = [])

Construct new Transaction.

Parameters

$attributes

at line 233
static string getClass(string $type)

Get Transaction Class

Parameters

string $type

Return Value

string

at line 256
static array getTypes(array $types)

Get Human Readable Transaction types

Parameters

array $types

Return Value

array

at line 273
static string getType(string $type)

Get Human Readable Transaction type

Parameters

string $type

Return Value

string

at line 283
string toString($type = false)

Instance Identifier.

Parameters

$type

Return Value

string

at line 294
HasMany ledgers()

Transaction Ledgers.

Return Value

HasMany

at line 304
BelongsTo currency()

Transaction Currency.

Return Value

BelongsTo

at line 314
BelongsTo account()

Transaction Account.

Return Value

BelongsTo

at line 324
BelongsTo exchangeRate()

Transaction Exchange Rate.

Return Value

BelongsTo

at line 334
HasMany assignments()

Transaction Assignments.

Return Value

HasMany

at line 344
HasMany lineItems()

Transaction Saved Line Items.

Return Value

HasMany

at line 354
MorphTo attachment()

The model attached to the transaction.

Return Value

MorphTo

at line 364
string getTypeAttribute()

Instance Type Translator.

Return Value

string

at line 372
bool getIsPostedAttribute()

is_posted analog for Assignment model.

Return Value

bool

at line 382
bool getIsCreditedAttribute()

is_credited analog for Assignment model.

Return Value

bool

at line 392
string getClearedTypeAttribute()

cleared_type analog for Assignment model.

Return Value

string

at line 402
float getAmountAttribute()

amount analog for Assignment model.

Return Value

float

at line 440
array getCompoundEntries()

Get Transaction CompoundEntries.

Return Value

array

at line 464
array getLineItems()

Get Transaction LineItems.

Return Value

array

at line 479
array getVatAttribute()

Total Vat amount of the transaction.

Return Value

array

at line 498
bool getAssignableAttribute()

Transaction is assignable predicate.

Return Value

bool

at line 508
bool getClearableAttribute()

Transaction is clearable predicate.

Return Value

bool

at line 518
string getDateAttribute()

Transaction date.

Return Value

string

at line 528
object attributes()

Transaction attributes.

Return Value

object

at line 538
bool addLineItem(LineItem $lineItem)

Add LineItem to Transaction LineItems.

Parameters

LineItem $lineItem

Return Value

bool

at line 570
void removeLineItem(LineItem $lineItem)

Remove LineItem from Transaction LineItems.

Parameters

LineItem $lineItem

Return Value

void

at line 604
array getAssigned()

Get this Transaction's assigned Transactions.

Return Value

array

at line 614
void addAssigned(array $toBeAssigned)

Add Transaction to this Transaction's assigned Transactions.

Parameters

array $toBeAssigned

Return Value

void

at line 659
void processAssigned(int|null $forexAccountId = null)

Create assignments for the assigned transactions being staged.

Parameters

int|null $forexAccountId

Return Value

void

at line 678
void post()

Post Transaction to the Ledger.

Return Value

void

at line 698
bool save(array $options = [])

Relate LineItems to Transaction.

Parameters

array $options

Return Value

bool

at line 775
static string transactionNo(string $type, Carbon|null $transaction_date = null, Entity|null $entity = null)

The next Transaction number for the transaction type and transaction_date.

Parameters

string $type
Carbon|null $transaction_date
Entity|null $entity

Return Value

string

at line 812
bool delete()

Check Transaction Relationships.

Return Value

bool

at line 838
bool getHasIntegrityAttribute()

Check Transaction Integrity.

Return Value

bool