diff options
author | Daniel Gnoutcheff <gnoutchd@softwarefreedom.org> | 2016-05-27 16:00:00 -0400 |
---|---|---|
committer | Daniel Gnoutcheff <gnoutchd@softwarefreedom.org> | 2018-09-26 18:11:11 -0400 |
commit | a1a17acb326020f1b57f587230cb439e901784df (patch) | |
tree | 358a1ea916a242609a981ff46e2a6814a2208cec /Hledger/JournalCSVs.hs | |
parent | f1a294e5ddb8ae0ccdcef1a12561e603ff996cfe (diff) |
Ported to Debian jessie
Most of the churn here comes from rebasing the Yesod boilerplate.
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 |