2
0
mirror of https://github.com/frappe/books.git synced 2025-01-22 22:58:28 +00:00

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

62 lines
1.6 KiB
TypeScript
Raw Normal View History

2023-08-22 12:18:51 +05:30
import { ClosingAmounts } from './ClosingAmounts';
import { ClosingCash } from './ClosingCash';
import { Doc } from 'fyo/model/doc';
import { OpeningAmounts } from './OpeningAmounts';
import { OpeningCash } from './OpeningCash';
export class POSShift extends Doc {
2023-09-05 17:39:24 +05:30
closingAmounts?: ClosingAmounts[];
closingCash?: ClosingCash[];
2023-08-22 18:30:24 +05:30
closingDate?: Date;
2023-09-05 17:39:24 +05:30
isShiftOpen?: boolean;
2023-08-22 12:18:51 +05:30
openingAmounts?: OpeningAmounts[];
openingCash?: OpeningCash[];
2023-09-05 17:39:24 +05:30
openingDate?: Date;
2023-08-22 12:18:51 +05:30
get openingCashAmount() {
if (!this.openingCash) {
return this.fyo.pesa(0);
}
let openingAmount = this.fyo.pesa(0);
this.openingCash.map((row: OpeningCash) => {
const denomination = row.denomination ?? this.fyo.pesa(0);
const count = row.count ?? 0;
const amount = denomination.mul(count);
openingAmount = openingAmount.add(amount);
});
return openingAmount;
}
2023-08-22 18:26:21 +05:30
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;
}
2023-08-22 12:18:51 +05:30
get openingTransferAmount() {
if (!this.openingAmounts) {
return this.fyo.pesa(0);
}
const transferAmountRow = this.openingAmounts.filter(
(row) => row.paymentMethod === 'Transfer'
)[0];
return transferAmountRow.amount ?? this.fyo.pesa(0);
}
}