From e23bedca7853c7a1d4732e5a420a64be80b2e90d Mon Sep 17 00:00:00 2001 From: RexBearIU Date: Fri, 11 Oct 2024 19:02:00 +0800 Subject: [PATCH] fix: merge conflict --- package.json | 2 +- src/interfaces/voucher.ts | 4 ++-- .../report/cash_flow_statement_generator.ts | 17 ++++++++++------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 8cc0589d3..ed46610d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iSunFA", - "version": "0.8.2+46", + "version": "0.8.2+47", "private": false, "scripts": { "dev": "next dev", diff --git a/src/interfaces/voucher.ts b/src/interfaces/voucher.ts index e739b6652..b42bd2bb1 100644 --- a/src/interfaces/voucher.ts +++ b/src/interfaces/voucher.ts @@ -64,9 +64,9 @@ export type IVoucherFromPrismaIncludeJournalLineItems = Prisma.VoucherGetPayload export type IVoucherForCashFlow = Prisma.VoucherGetPayload<{ include: { - journal: { + invoiceVoucherJournals: { include: { - invoice: true; + journal: true; }; }; lineItems: { diff --git a/src/lib/utils/report/cash_flow_statement_generator.ts b/src/lib/utils/report/cash_flow_statement_generator.ts index 37f8c5cd6..69c96ddb0 100644 --- a/src/lib/utils/report/cash_flow_statement_generator.ts +++ b/src/lib/utils/report/cash_flow_statement_generator.ts @@ -56,15 +56,18 @@ export default class CashFlowStatementGenerator extends FinancialReportGenerator startDateInSecond, endDateInSecond ); - this.voucherRelatedToCash = voucherRelatedToCash.filter((voucher) => { - - const laterThanStartDate = voucher.date >= startDateInSecond; - const earlierThanEndDate = voucher.date <= endDateInSecond; - return laterThanStartDate && earlierThanEndDate; - }); + this.voucherRelatedToCash = voucherRelatedToCash + .filter((voucher) => { + const laterThanStartDate = voucher.date >= startDateInSecond; + const earlierThanEndDate = voucher.date <= endDateInSecond; + return laterThanStartDate && earlierThanEndDate; + }) + .map((voucher) => ({ + ...voucher, + invoiceVoucherJournals: voucher.invoiceVoucherJournals || [], + })); this.voucherLastPeriod = voucherRelatedToCash.filter((voucher) => { - const earlierThanStartDate = voucher.date < startDateInSecond; return earlierThanStartDate; });