diff options
Diffstat (limited to 'Hledger/JournalCSVs.hs')
-rw-r--r-- | Hledger/JournalCSVs.hs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Hledger/JournalCSVs.hs b/Hledger/JournalCSVs.hs index b7d5420..1d5ac5f 100644 --- a/Hledger/JournalCSVs.hs +++ b/Hledger/JournalCSVs.hs @@ -39,7 +39,7 @@ import Hledger.Data.Journal (journalProfitAndLossAccountQuery, journalAssetAccou import Hledger.Data.Types (DateSpan(..), Journal(..), Transaction(..)) import Hledger.Query (Query(..)) import Hledger.Read (readJournalFile) -import Hledger.Reports (accountsReport, defreportopts, ReportOpts(..)) +import Hledger.Reports (balanceReport, defreportopts, ReportOpts(..)) data JReportType = PandL | Assets | Liabilities | Everything deriving (Eq, Read, Show) @@ -82,12 +82,11 @@ jToCSV delta jnl q = do lastMonth = dayToYearMonth lastTxn q' mon = And [q, Date (dS delta mon)] when (firstMonth == lastMonth) $ error "Need multiple months" - let reports = map (\m -> accountsReport defreportopts { no_elide_ = True } (q' m) jnl) [firstMonth..lastMonth] - reportT = accountsReport defreportopts { no_elide_ = True } Any jnl - reports' = map (map (\(n, _, _, a) -> (n, showMixedAmount a)) . fst) reports - reportT' = (map (\(n, _, _, a) -> (n, showMixedAmount a)) . fst) reportT + let reports = map (\m -> balanceReport defreportopts { no_elide_ = True } (q' m) jnl) [firstMonth..lastMonth] + reportT = balanceReport defreportopts { no_elide_ = True } Any jnl + reports' = map (map (\((n, _, _), a) -> (n, showMixedAmount a)) . fst) reports + reportT' = (map (\((n, _, _), a) -> (n, showMixedAmount a)) . fst) reportT allaccounts = sort . nub . (map fst =<<) $ reports' - accounttree = accts2Tree (map (splitOn ":") allaccounts) concordant = map (\x -> x : fetchSeries reports' x ++ fetchSeries [reportT'] x) allaccounts withheader = ("Account":map (formatTime defaultTimeLocale "%b of %Y" . yearMonthToDay) [firstMonth..lastMonth] ++ ["Period Total"]):concordant c <- runResourceT $ CL.sourceList withheader $= CL.map (map T.pack) $= fromCSV defCSVSettings $$ CL.consume |