2
0
mirror of https://github.com/frappe/books.git synced 2024-12-24 20:00:29 +00:00
books/models/baseModels/TaxSummary/TaxSummary.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
518 B
TypeScript
Raw Normal View History

import { Doc } from 'fyo/model/doc';
import { FormulaMap } from 'fyo/model/types';
2022-05-23 05:30:54 +00:00
import { Money } from 'pesa';
export class TaxSummary extends Doc {
account?: string;
rate?: number;
amount?: Money;
baseAmount?: Money;
formulas: FormulaMap = {
baseAmount: {
formula: async () => {
const amount = this.amount as Money;
const exchangeRate = (this.parentdoc?.exchangeRate ?? 1) as number;
return amount.mul(exchangeRate);
},
dependsOn: ['amount'],
},
};
}