bal: with -V, don't ignore market prices in the future #453
This commit is contained in:
		
							parent
							
								
									7dcfcb05ec
								
							
						
					
					
						commit
						a57c1bde08
					
				| @ -246,7 +246,7 @@ module Hledger.Cli.Balance ( | |||||||
| ) where | ) where | ||||||
| 
 | 
 | ||||||
| import Data.List (intercalate) | import Data.List (intercalate) | ||||||
| import Data.Maybe (fromMaybe, isJust) | import Data.Maybe | ||||||
| import Data.Monoid | import Data.Monoid | ||||||
| -- import Data.Text (Text) | -- import Data.Text (Text) | ||||||
| import qualified Data.Text as T | import qualified Data.Text as T | ||||||
| @ -300,7 +300,7 @@ balance opts@CliOpts{reportopts_=ropts} j = do | |||||||
|       let format   = outputFormatFromOpts opts |       let format   = outputFormatFromOpts opts | ||||||
|           interval = interval_ ropts |           interval = interval_ ropts | ||||||
|           baltype  = balancetype_ ropts |           baltype  = balancetype_ ropts | ||||||
|           valuedate = fromMaybe d $ queryEndDate False $ queryFromOpts d ropts |       mvaluedate <- reportEndDate j ropts | ||||||
|       -- shenanigans: use single/multiBalanceReport when we must, |       -- shenanigans: use single/multiBalanceReport when we must, | ||||||
|       -- ie when there's a report interval, or --historical or -- cumulative. |       -- ie when there's a report interval, or --historical or -- cumulative. | ||||||
|       -- Otherwise prefer the older balanceReport since it can elide boring parents. |       -- Otherwise prefer the older balanceReport since it can elide boring parents. | ||||||
| @ -314,16 +314,16 @@ balance opts@CliOpts{reportopts_=ropts} j = do | |||||||
|                                | otherwise   = ropts{accountlistmode_=ALTree} |                                | otherwise   = ropts{accountlistmode_=ALTree} | ||||||
|                     in singleBalanceReport ropts' (queryFromOpts d ropts) j |                     in singleBalanceReport ropts' (queryFromOpts d ropts) j | ||||||
|                 | otherwise = balanceReport ropts (queryFromOpts d ropts) j |                 | otherwise = balanceReport ropts (queryFromOpts d ropts) j | ||||||
|               convert | value_ ropts = balanceReportValue j valuedate |               convert | value_ ropts = maybe id (balanceReportValue j) mvaluedate | ||||||
|                       | otherwise    = id |                       | otherwise = id | ||||||
|               render = case format of |               render = case format of | ||||||
|                 "csv" -> \ropts r -> (++ "\n") $ printCSV $ balanceReportAsCsv ropts r |                 "csv" -> \ropts r -> (++ "\n") $ printCSV $ balanceReportAsCsv ropts r | ||||||
|                 _     -> balanceReportAsText |                 _     -> balanceReportAsText | ||||||
|           writeOutput opts $ render ropts $ convert report |           writeOutput opts $ render ropts $ convert report | ||||||
|         _ -> do |         _ -> do | ||||||
|           let report = multiBalanceReport ropts (queryFromOpts d ropts) j |           let report = multiBalanceReport ropts (queryFromOpts d ropts) j | ||||||
|               convert | value_ ropts = multiBalanceReportValue j valuedate |               convert | value_ ropts = maybe id (multiBalanceReportValue j) mvaluedate | ||||||
|                       | otherwise    = id |                       | otherwise = id | ||||||
|               render = case format of |               render = case format of | ||||||
|                 "csv" -> \ropts r -> (++ "\n") $ printCSV $ multiBalanceReportAsCsv ropts r |                 "csv" -> \ropts r -> (++ "\n") $ printCSV $ multiBalanceReportAsCsv ropts r | ||||||
|                 _     -> case baltype of |                 _     -> case baltype of | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user