WIP: Allocate landed cost.

This commit is contained in:
a.bouhuolia
2021-07-24 03:10:32 +02:00
parent 70aea9bf2d
commit cf2ebe9597
30 changed files with 602 additions and 218 deletions

View File

@@ -39,14 +39,18 @@ export default class Expense extends TenantModel {
}
static get virtualAttributes() {
return ['isPublished', 'unallocatedLandedCost'];
return ['isPublished', 'unallocatedCostAmount'];
}
isPublished() {
return Boolean(this.publishedAt);
}
unallocatedLandedCost() {
/**
* Retrieve the unallocated cost amount.
* @return {number}
*/
get unallocatedCostAmount() {
return Math.max(this.amount - this.allocatedCostAmount, 0);
}