diff --git a/Ledger/Entry.hs b/Ledger/Entry.hs index 426dd4911..87b5148df 100644 --- a/Ledger/Entry.hs +++ b/Ledger/Entry.hs @@ -39,7 +39,10 @@ showDate d = printf "%-10s" d showDescription s = printf "%-20s" (elideRight 20 s) isEntryBalanced :: Entry -> Bool -isEntryBalanced = isZeroAmount . sumLedgerTransactions . etransactions +isEntryBalanced (Entry {etransactions=ts}) = isZeroAmount sum && numcommodities==1 + where + sum = sumLedgerTransactions ts + numcommodities = length $ nub $ map (commodity . tamount) ts autofillEntry :: Entry -> Entry autofillEntry e@(Entry {etransactions=ts}) = e{etransactions=autofillTransactions ts} diff --git a/Ledger/RawTransaction.hs b/Ledger/RawTransaction.hs index 63a0bef1f..c74364705 100644 --- a/Ledger/RawTransaction.hs +++ b/Ledger/RawTransaction.hs @@ -37,4 +37,4 @@ autofillTransactions ts = balance t = if isnormal t then t else t{tamount = -(sumLedgerTransactions normals)} sumLedgerTransactions :: [RawTransaction] -> Amount -sumLedgerTransactions = sum . map tamount +sumLedgerTransactions = sumAmounts . map tamount