2
0
mirror of https://github.com/frappe/books.git synced 2025-01-07 00:53:58 +00:00
books/models/inventory/Point of Sale/POSClosingShift.ts

35 lines
885 B
TypeScript

import { ListViewSettings } from 'fyo/model/types';
import { ClosingAmounts } from './ClosingAmounts';
import { ClosingCash } from './ClosingCash';
import { Doc } from 'fyo/model/doc';
export class POSClosingShift extends Doc {
closingAmounts?: ClosingAmounts[];
closingCash?: ClosingCash[];
closingDate?: Date;
openingShift?: string;
get closingCashAmount() {
if (!this.closingCash) {
return this.fyo.pesa(0);
}
let closingAmount = this.fyo.pesa(0);
this.closingCash.map((row: ClosingCash) => {
const denomination = row.denomination ?? this.fyo.pesa(0);
const count = row.count ?? 0;
const amount = denomination.mul(count);
closingAmount = closingAmount.add(amount);
});
return closingAmount;
}
static getListViewSettings(): ListViewSettings {
return {
columns: ['name', 'closingDate'],
};
}
}