2
0
mirror of https://github.com/frappe/books.git synced 2025-01-08 01:14:39 +00:00

feat: calculate total tax amount

This commit is contained in:
AbleKSaju 2024-12-28 11:55:49 +05:30
parent 087daf97ed
commit d07e424315

View File

@ -395,6 +395,13 @@ export abstract class Invoice extends Transactional {
return taxArr;
}
async getTotalTax() {
const taxArr = await this.getTaxSummary();
return taxArr
.map(({ amount }) => amount)
.reduce((a, b) => a.add(b), this.fyo.pesa(0));
}
async getTax(tax: string) {
if (!this._taxes[tax]) {
this._taxes[tax] = await this.fyo.doc.getDoc('Tax', tax);