{-# LANGUAGE OverloadedStrings, QuasiQuotes, RecordWildCards #-} -- | /journal handlers. module Handler.JournalR where import Data.Text (pack) import Import import Handler.AddForm import Handler.Common import Hledger.Data import Hledger.Query import Hledger.Reports import Hledger.Utils import Hledger.Cli.CliOptions import Hledger.Web.WebOptions -- | The formatted journal view, with sidebar. getJournalR :: Handler Html getJournalR = do vd@VD{..} <- getViewData let -- XXX like registerReportAsHtml inacct = inAccount qopts -- injournal = isNothing inacct filtering = m /= Any -- showlastcolumn = if injournal && not filtering then False else True title = case inacct of Nothing -> "General Journal"++s2 Just (a,inclsubs) -> "Transactions in "++a++s1++s2 where s1 = if inclsubs then "" else " (excluding subaccounts)" where s2 = if filtering then ", filtered" else "" maincontent = journalTransactionsReportAsHtml opts vd $ journalTransactionsReport (reportopts_ $ cliopts_ opts) j m hledgerLayout vd "journal" [hamlet|