mirror of
https://github.com/frappe/books.git
synced 2024-11-08 14:50:56 +00:00
fix: added closingAmounts in posShift
This commit is contained in:
parent
9cf3ee0626
commit
b9b2f3d49e
@ -3,10 +3,11 @@ import { FormulaMap } from 'fyo/model/types';
|
||||
import { Money } from 'pesa';
|
||||
|
||||
export class ClosingAmounts extends Doc {
|
||||
openingAmount?: Money;
|
||||
closingAmount?: Money;
|
||||
expectedAmount?: Money;
|
||||
differenceAmount?: Money;
|
||||
expectedAmount?: Money;
|
||||
openingAmount?: Money;
|
||||
paymentMethod?: string;
|
||||
|
||||
formulas: FormulaMap = {
|
||||
differenceAmount: {
|
||||
|
@ -5,13 +5,13 @@ import { OpeningAmounts } from './OpeningAmounts';
|
||||
import { OpeningCash } from './OpeningCash';
|
||||
|
||||
export class POSShift extends Doc {
|
||||
isShiftOpen?: boolean;
|
||||
openingDate?: Date;
|
||||
closingDate?: Date;
|
||||
openingAmounts?: OpeningAmounts[];
|
||||
closingAmounts?: ClosingAmounts[];
|
||||
openingCash?: OpeningCash[];
|
||||
closingCash?: ClosingCash[];
|
||||
closingDate?: Date;
|
||||
isShiftOpen?: boolean;
|
||||
openingAmounts?: OpeningAmounts[];
|
||||
openingCash?: OpeningCash[];
|
||||
openingDate?: Date;
|
||||
|
||||
get openingCashAmount() {
|
||||
if (!this.openingCash) {
|
||||
@ -30,6 +30,23 @@ export class POSShift extends Doc {
|
||||
return openingAmount;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
get openingTransferAmount() {
|
||||
if (!this.openingAmounts) {
|
||||
return this.fyo.pesa(0);
|
||||
|
@ -33,6 +33,11 @@
|
||||
"fieldname": "openingAmounts",
|
||||
"fieldtype": "Table",
|
||||
"target": "OpeningAmounts"
|
||||
},
|
||||
{
|
||||
"fieldname": "closingAmounts",
|
||||
"fieldtype": "Table",
|
||||
"target": "ClosingAmounts"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user