Merge date+desc columns for account rows, fix Account Ledger balances
General Journal: account rows now use colSpan=2 to merge the Date and Description columns, so the badge+account name starts under the transaction date rather than being deeply indented under the description. Creates a more natural visual hierarchy. Account Ledger: fixed prior balance calculation for result accounts (Income/Cost) — now computed from fiscal year start to period start, matching the General Journal fix. Balance accounts (Asset/Debt) still use all-time cumulative. Made-with: Cursor
This commit is contained in:
@@ -139,12 +139,11 @@ export default function GeneralJournalTab() {
|
||||
<TableCell />
|
||||
</TableRow>,
|
||||
|
||||
// Transaction row entries
|
||||
// Transaction row entries — date+description merged into one cell
|
||||
...tx.rows.map(row => (
|
||||
<TableRow key={`row-${row.rowId}`} hover>
|
||||
<TableCell />
|
||||
<TableCell />
|
||||
<TableCell sx={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
||||
<TableCell colSpan={2} sx={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
||||
<Box sx={{ display: 'inline-flex', alignItems: 'center', gap: 0.75 }}>
|
||||
<Chip
|
||||
label={row.accountType}
|
||||
|
||||
@@ -51,10 +51,25 @@ public static class InspectLedgerEndpoints
|
||||
|
||||
var allRows = new List<(UsingCash.Basic.Types.BasicFinancialTransactionRow Row, int AccountId)>();
|
||||
long priorBalance = 0;
|
||||
var profitLossStart = new DateTime(from.Year, 1, 1);
|
||||
var accountTypeMap = allAccounts.ToDictionary(a => a.FinancialAccountId, a => a.AccountType);
|
||||
|
||||
foreach (var acctId in accountIds)
|
||||
{
|
||||
priorBalance += await repo.GetAccountBalanceCents(acctId, from);
|
||||
var isBalanceAccount = accountTypeMap.TryGetValue(acctId, out var acctType)
|
||||
&& (acctType == UsingCash.Common.Enums.FinancialAccountType.Asset
|
||||
|| acctType == UsingCash.Common.Enums.FinancialAccountType.Debt);
|
||||
|
||||
if (isBalanceAccount)
|
||||
{
|
||||
priorBalance += await repo.GetAccountBalanceCents(acctId, from);
|
||||
}
|
||||
else if (profitLossStart < from)
|
||||
{
|
||||
var priorRows = await repo.GetRowsForAccountInRange(acctId, profitLossStart, from);
|
||||
priorBalance += priorRows.Sum(r => r.AmountCents);
|
||||
}
|
||||
|
||||
var rows = await repo.GetRowsForAccountInRange(acctId, from, to);
|
||||
allRows.AddRange(rows.Select(r => (r, acctId)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user