Skip to content

Commit

Permalink
fix(server): add missing method in ItemEntry model.
Browse files Browse the repository at this point in the history
  • Loading branch information
abouolia committed Oct 2, 2023
1 parent 69afa07 commit 07628dd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/server/src/models/ItemEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 07628dd

Please sign in to comment.