2
0
mirror of https://github.com/frappe/books.git synced 2024-12-24 11:55:46 +00:00
books/models/inventory/Point of Sale/ClosingAmounts.ts

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

28 lines
607 B
TypeScript
Raw Normal View History

2023-08-22 06:48:51 +00:00
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;
2023-08-22 12:56:21 +00:00
expectedAmount?: Money;
openingAmount?: Money;
paymentMethod?: string;
2023-08-22 06:48:51 +00:00
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);
},
},
};
}