fix(server): add missing method in ItemEntry model.

This commit is contained in:
Ahmed Bouhuolia
2023-10-02 23:27:19 +02:00
parent 69afa07e3b
commit 07628ddc37

View File

@@ -99,6 +99,13 @@ export default class ItemEntry extends TenantModel {
: getExlusiveTaxAmount(this.amount, this.taxRate);
}
static calcAmount(itemEntry) {
const { discount, quantity, rate } = itemEntry;
const total = quantity * rate;
return discount ? total - total * discount * 0.01 : total;
}
/**
* Item entry relations.
*/