fix(server): tax tracking on sale invoices

This commit is contained in:
Ahmed Bouhuolia
2023-09-23 14:19:42 +02:00
parent 92ac0dbd25
commit 1148fef9ad
6 changed files with 48 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ export default class SaleInvoice extends mixin(TenantModel, [
ModelSearchable,
]) {
public taxAmountWithheld: number;
public amount: number;
public balance: number;
public paymentAmount: number;
public exchangeRate: number;
public writtenoffAmount: number;
@@ -74,6 +74,23 @@ export default class SaleInvoice extends mixin(TenantModel, [
];
}
/**
* Invoice amount.
* @todo Sugger attribute to balance, we need to rename the balance to amount.
* @returns {number}
*/
get amount() {
return this.balance;
}
/**
* Invoice amount in base currency.
* @returns {number}
*/
get amountLocal() {
return this.amount * this.exchangeRate;
}
/**
* Subtotal. (Tax inclusive) if the tax inclusive is enabled.
* @returns {number}
@@ -87,7 +104,7 @@ export default class SaleInvoice extends mixin(TenantModel, [
* @returns {number}
*/
get subtotalLocal() {
return this.amount * this.exchangeRate;
return this.amountLocal;
}
/**