Fix General Journal: balance calculation, date width, badge alignment
- Fixed result account (Income/Cost) running balance: now computed from fiscal year start to period start, not from dawn of time. Balance accounts (Asset/Debt) still use all-time cumulative as before. - Narrowed date column from 145px to 130px - Right-aligned account type badge (pr: 4px) so it acts as a bullet point for the account name (pl: 4px), creating visual continuity between badge and account name across the column boundary Made-with: Cursor
This commit is contained in:
@@ -92,7 +92,7 @@ export default function GeneralJournalTab() {
|
||||
<Table size="small" sx={{ tableLayout: 'fixed', '& td, & th': { py: 0.4, fontSize: 13 } }}>
|
||||
<colgroup>
|
||||
<col style={{ width: 60 }} />
|
||||
<col style={{ width: 145 }} />
|
||||
<col style={{ width: 130 }} />
|
||||
<col />
|
||||
<col style={{ width: 100 }} />
|
||||
<col style={{ width: 100 }} />
|
||||
@@ -143,7 +143,7 @@ export default function GeneralJournalTab() {
|
||||
...tx.rows.map(row => (
|
||||
<TableRow key={`row-${row.rowId}`} hover>
|
||||
<TableCell />
|
||||
<TableCell>
|
||||
<TableCell sx={{ textAlign: 'right', pr: '4px !important' }}>
|
||||
<Chip
|
||||
label={row.accountType}
|
||||
size="small"
|
||||
@@ -156,7 +156,7 @@ export default function GeneralJournalTab() {
|
||||
}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell sx={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
||||
<TableCell sx={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', pl: '4px !important' }}>
|
||||
<Tooltip title={row.accountName} placement="top-start">
|
||||
<Typography component="span" variant="body2" sx={{ fontSize: 13, color: 'text.secondary' }}>
|
||||
{row.accountName}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user