From fad99366d9bf59140219036a2c5087b18145bebf Mon Sep 17 00:00:00 2001 From: sophian Date: Mon, 2 Dec 2024 12:57:41 -0500 Subject: [PATCH] Fix asset purchases/asset financings --- .../components/Report/CashflowStatement.tsx | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/centrifuge-app/src/components/Report/CashflowStatement.tsx b/centrifuge-app/src/components/Report/CashflowStatement.tsx index 96c413fcf..68847b266 100644 --- a/centrifuge-app/src/components/Report/CashflowStatement.tsx +++ b/centrifuge-app/src/components/Report/CashflowStatement.tsx @@ -135,6 +135,14 @@ export function CashflowStatement({ pool }: { pool: Pool }) { heading: false, formatter: (v: any) => (v ? formatBalance(v, pool.currency.displayName, 2) : ''), }, + { + name: 'Asset financings', + value: + data?.map((day) => (day.subtype === 'privateCredit' ? day?.assetFinancing?.toDecimal().neg() : 0)) || + [], + heading: false, + formatter: (v: any) => `${formatBalance(v, pool.currency.displayName, 2)}`, + }, ] : []), { @@ -143,12 +151,26 @@ export function CashflowStatement({ pool }: { pool: Pool }) { heading: false, formatter: (v: any) => (v ? formatBalance(v, pool.currency.displayName, 2) : ''), }, - { - name: poolMetadata?.pool?.asset.class === 'Private credit' ? 'Asset financings' : 'Asset purchases', - value: data?.map((day) => day.assetAcquisitions.toDecimal().neg()) || [], - heading: false, - formatter: (v: any) => `${formatBalance(v, pool.currency.displayName, 2)}`, - }, + ...(poolMetadata?.pool?.asset.class === 'Public credit' + ? [ + { + name: 'Asset financings', + value: + data?.map((day) => (day.subtype === 'publicCredit' ? day?.assetPurchases?.toDecimal().neg() : 0)) || [], + heading: false, + formatter: (v: any) => `${formatBalance(v, pool.currency.displayName, 2)}`, + }, + ] + : [ + { + name: 'Asset purchases', + value: + data?.map((day) => (day.subtype === 'privateCredit' ? day?.assetFinancing?.toDecimal().neg() : 0)) || + [], + heading: false, + formatter: (v: any) => `${formatBalance(v, pool.currency.displayName, 2)}`, + }, + ]), { name: 'Net cash flow from assets', value: data?.map((state) => state.netCashflowAsset.toDecimal()) || [],