2022-04-24 06:48:44 +00:00
|
|
|
import { Doc } from 'fyo/model/doc';
|
2022-04-19 05:59:36 +00:00
|
|
|
import { FormulaMap } from 'fyo/model/types';
|
2022-05-23 05:30:54 +00:00
|
|
|
import { Money } from 'pesa';
|
2022-04-11 09:41:49 +00:00
|
|
|
|
|
|
|
export class TaxSummary extends Doc {
|
2022-04-14 09:22:45 +00:00
|
|
|
account?: string;
|
|
|
|
rate?: number;
|
|
|
|
amount?: Money;
|
|
|
|
baseAmount?: Money;
|
|
|
|
|
2022-04-11 09:41:49 +00:00
|
|
|
formulas: FormulaMap = {
|
2022-04-29 13:00:24 +00:00
|
|
|
baseAmount: {
|
|
|
|
formula: async () => {
|
|
|
|
const amount = this.amount as Money;
|
|
|
|
const exchangeRate = (this.parentdoc?.exchangeRate ?? 1) as number;
|
|
|
|
return amount.mul(exchangeRate);
|
|
|
|
},
|
|
|
|
dependsOn: ['amount'],
|
2022-04-11 09:41:49 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|