hledger-equity: show correct end date in title
This commit is contained in:
parent
2bfbdd175b
commit
5aaef598ba
@ -13,8 +13,8 @@ on either file, and when including both files at once.
|
|||||||
Usage: hledger-equity [ACCTPAT]
|
Usage: hledger-equity [ACCTPAT]
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
import Data.Maybe (fromMaybe)
|
||||||
import Hledger.Cli
|
import Hledger.Cli
|
||||||
import System.Environment
|
|
||||||
|
|
||||||
argsmode :: Mode RawOpts
|
argsmode :: Mode RawOpts
|
||||||
argsmode = (defCommandMode ["equity"])
|
argsmode = (defCommandMode ["equity"])
|
||||||
@ -36,11 +36,13 @@ main = do
|
|||||||
opts <- getCliOpts argsmode
|
opts <- getCliOpts argsmode
|
||||||
withJournalDo opts $
|
withJournalDo opts $
|
||||||
\CliOpts{reportopts_=ropts} j -> do
|
\CliOpts{reportopts_=ropts} j -> do
|
||||||
d <- getCurrentDay
|
today <- getCurrentDay
|
||||||
let ropts_ = ropts{flat_=True}
|
let ropts_ = ropts{flat_=True}
|
||||||
let (acctbals,_) = balanceReport ropts_ (queryFromOpts d ropts_) j
|
q = queryFromOpts today ropts_
|
||||||
let balancingamt = negate $ sum $ map (\((_,_,_),b) -> b) acctbals
|
(acctbals,_) = balanceReport ropts_ q j
|
||||||
let ps = [posting{paccount=a, pamount=b} | ((a,_,_),b) <- acctbals]
|
balancingamt = negate $ sum $ map (\((_,_,_),b) -> b) acctbals
|
||||||
|
ps = [posting{paccount=a, pamount=b} | ((a,_,_),b) <- acctbals]
|
||||||
++ [posting{paccount="equity:opening balances", pamount=balancingamt}]
|
++ [posting{paccount="equity:opening balances", pamount=balancingamt}]
|
||||||
let txn = nulltransaction{tdate=d, tpostings=ps}
|
enddate = fromMaybe today $ queryEndDate (date2_ ropts_) q
|
||||||
|
txn = nulltransaction{tdate=enddate, tpostings=ps}
|
||||||
putStr $ showTransactionUnelided txn
|
putStr $ showTransactionUnelided txn
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user