diff --git a/hledger-lib/Hledger/Reports/BalanceReport.hs b/hledger-lib/Hledger/Reports/BalanceReport.hs index d6e4af595..93c512542 100644 --- a/hledger-lib/Hledger/Reports/BalanceReport.hs +++ b/hledger-lib/Hledger/Reports/BalanceReport.hs @@ -110,7 +110,7 @@ balanceReport opts q j = (items, total) markboring = if no_elide_ opts then id else markBoringParentAccounts maybesort = if sort_amount_ opts then sortBy (maybeflip $ comparing balance) else id where - maybeflip = if normalbalance_ opts == Just NormalPositive then flip else id + maybeflip = if normalbalance_ opts == Just NormalNegative then id else flip items = dbg1 "items" $ map (balanceReportItem opts q) accts' total | not (flat_ opts) = dbg1 "total" $ sum [amt | (_,_,indent,amt) <- items, indent == 0] | otherwise = dbg1 "total" $ diff --git a/hledger-lib/Hledger/Reports/MultiBalanceReports.hs b/hledger-lib/Hledger/Reports/MultiBalanceReports.hs index 155dc4823..edbab34ea 100644 --- a/hledger-lib/Hledger/Reports/MultiBalanceReports.hs +++ b/hledger-lib/Hledger/Reports/MultiBalanceReports.hs @@ -186,7 +186,7 @@ multiBalanceReport opts q j = MultiBalanceReport (displayspans, items, totalsrow where -- reverse the sort if doing a balance report on normally-negative accounts, -- so eg a large negative income balance appears at top in income statement - maybeflip = if normalbalance_ opts == Just NormalPositive then flip else id + maybeflip = if normalbalance_ opts == Just NormalNegative then id else flip -- sort by average when that is displayed, instead of total. -- Usually equivalent, but perhaps not in future (eg with --percent) sortfield = if average_ opts then sixth6 else fifth6