2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 14:50:56 +00:00
books/models/inventory/Point of Sale/ClosingAmounts.ts
2023-12-04 14:38:12 +05:30

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);
},
},
};
}