feat: add paid amount attr and formatting to SaleReceipt transformer

This commit is contained in:
Ahmed Bouhuolia
2024-12-08 17:26:52 +02:00
parent 11d7a40326
commit 0a5115fc20
4 changed files with 35 additions and 5 deletions

View File

@@ -55,6 +55,9 @@ export default class SaleReceipt extends mixin(TenantModel, [
'discountAmount',
'discountPercentage',
'paid',
'paidLocal',
'isClosed',
'isDraft',
];
@@ -130,6 +133,22 @@ export default class SaleReceipt extends mixin(TenantModel, [
return this.adjustment * this.exchangeRate;
}
/**
* Receipt paid amount.
* @returns {number}
*/
get paid() {
return this.total;
}
/**
* Receipt paid amount in local currency.
* @returns {number}
*/
get paidLocal() {
return this.paid * this.exchangeRate;
}
/**
* Detarmine whether the sale receipt closed.
* @return {boolean}