{-# LANGUAGE OverloadedStrings, QuasiQuotes, RecordWildCards #-} -- | /register handlers. module Handler.RegisterR where import Import import Data.List import Data.Maybe -- import Data.Text (Text) import qualified Data.Text as T import Safe import Handler.AddForm import Handler.Common import Handler.Utils import Hledger.Data import Hledger.Query import Hledger.Reports import Hledger.Utils import Hledger.Cli.CliOptions import Hledger.Web.WebOptions -- | The main journal/account register view, with accounts sidebar. getRegisterR :: Handler Html getRegisterR = do vd@VD{..} <- getViewData -- staticRootUrl <- (staticRoot . settings) <$> getYesod let -- injournal = isNothing inacct filtering = m /= Any -- title = "Transactions in "++a++s1++s2 title = T.unpack a++s1++s2 where (a,inclsubs) = fromMaybe ("all accounts",True) $ inAccount qopts s1 = if inclsubs then "" else " (excluding subaccounts)" s2 = if filtering then ", filtered" else "" maincontent = registerReportHtml opts vd $ accountTransactionsReport (reportopts_ $ cliopts_ opts) j m $ fromMaybe Any $ inAccountQuery qopts hledgerLayout vd "register" [hamlet|