diff --git a/frontend/src/pages/inspect/GeneralJournalTab.tsx b/frontend/src/pages/inspect/GeneralJournalTab.tsx index 069cd81e..c047836f 100644 --- a/frontend/src/pages/inspect/GeneralJournalTab.tsx +++ b/frontend/src/pages/inspect/GeneralJournalTab.tsx @@ -92,7 +92,7 @@ export default function GeneralJournalTab() { - + @@ -143,7 +143,7 @@ export default function GeneralJournalTab() { ...tx.rows.map(row => ( - + - + {row.accountName} diff --git a/src/UsingCash.Api/Endpoints/InspectLedgerEndpoints.cs b/src/UsingCash.Api/Endpoints/InspectLedgerEndpoints.cs index c1ff38a4..53bbfa97 100644 --- a/src/UsingCash.Api/Endpoints/InspectLedgerEndpoints.cs +++ b/src/UsingCash.Api/Endpoints/InspectLedgerEndpoints.cs @@ -180,11 +180,24 @@ public static class InspectLedgerEndpoints { var isBalanceAccount = acct.AccountType == UsingCash.Common.Enums.FinancialAccountType.Asset || acct.AccountType == UsingCash.Common.Enums.FinancialAccountType.Debt; - var priorStart = isBalanceAccount ? balanceStart : profitLossStart; - if (priorStart < from) + + if (isBalanceAccount) + { runningBalances[acct.FinancialAccountId] = await repo.GetAccountBalanceCents(acct.FinancialAccountId, from); + } else - runningBalances[acct.FinancialAccountId] = 0; + { + // Result accounts: balance from fiscal year start to period start + if (profitLossStart < from) + { + var rows = await repo.GetRowsForAccountInRange(acct.FinancialAccountId, profitLossStart, from); + runningBalances[acct.FinancialAccountId] = rows.Sum(r => r.AmountCents); + } + else + { + runningBalances[acct.FinancialAccountId] = 0; + } + } } var grouped = allRows