mirror of
https://github.com/frappe/books.git
synced 2024-11-14 01:14:03 +00:00
28 lines
607 B
TypeScript
28 lines
607 B
TypeScript
import { Doc } from 'fyo/model/doc';
|
|
import { FormulaMap } from 'fyo/model/types';
|
|
import { Money } from 'pesa';
|
|
|
|
export class ClosingAmounts extends Doc {
|
|
closingAmount?: Money;
|
|
differenceAmount?: Money;
|
|
expectedAmount?: Money;
|
|
openingAmount?: Money;
|
|
paymentMethod?: string;
|
|
|
|
formulas: FormulaMap = {
|
|
differenceAmount: {
|
|
formula: () => {
|
|
if (!this.closingAmount) {
|
|
return this.fyo.pesa(0);
|
|
}
|
|
|
|
if (!this.expectedAmount) {
|
|
return this.fyo.pesa(0);
|
|
}
|
|
|
|
return this.closingAmount.sub(this.expectedAmount);
|
|
},
|
|
},
|
|
};
|
|
}
|