whitespace clarifying this large module's structure, comments
This commit is contained in:
parent
b4f3d6e1c5
commit
02845ccf3d
@ -5,6 +5,13 @@ Balance report, used by the balance command.
|
|||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module Hledger.Reports.BalanceReport (
|
module Hledger.Reports.BalanceReport (
|
||||||
BalanceReport,
|
BalanceReport,
|
||||||
BalanceReportItem,
|
BalanceReportItem,
|
||||||
@ -31,6 +38,12 @@ import Hledger.Utils
|
|||||||
import Hledger.Reports.ReportOptions
|
import Hledger.Reports.ReportOptions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- | A simple single-column balance report. It has:
|
-- | A simple single-column balance report. It has:
|
||||||
--
|
--
|
||||||
-- 1. a list of rows, each containing a renderable account name and a corresponding amount
|
-- 1. a list of rows, each containing a renderable account name and a corresponding amount
|
||||||
@ -141,8 +154,8 @@ mixedAmountValue :: Journal -> Day -> MixedAmount -> MixedAmount
|
|||||||
mixedAmountValue j d (Mixed as) = Mixed $ map (amountValue j d) as
|
mixedAmountValue j d (Mixed as) = Mixed $ map (amountValue j d) as
|
||||||
|
|
||||||
-- | Find the market value of this amount on the given date, in it's
|
-- | Find the market value of this amount on the given date, in it's
|
||||||
-- default valuation commodity, based on historical prices. If no
|
-- default valuation commodity, based on recorded market prices.
|
||||||
-- default valuation commodity can be found, the amount is left
|
-- If no default valuation commodity can be found, the amount is left
|
||||||
-- unchanged.
|
-- unchanged.
|
||||||
amountValue :: Journal -> Day -> Amount -> Amount
|
amountValue :: Journal -> Day -> Amount -> Amount
|
||||||
amountValue j d a =
|
amountValue j d a =
|
||||||
@ -155,7 +168,7 @@ amountValue j d a =
|
|||||||
-- | Find the market value, if known, of one unit of this commodity on
|
-- | Find the market value, if known, of one unit of this commodity on
|
||||||
-- the given date, in the commodity in which it has most recently been
|
-- the given date, in the commodity in which it has most recently been
|
||||||
-- market-priced (ie the commodity mentioned in the most recent
|
-- market-priced (ie the commodity mentioned in the most recent
|
||||||
-- applicable historical price directive before this date).
|
-- applicable market price directive before this date).
|
||||||
commodityValue :: Journal -> Day -> CommoditySymbol -> Maybe Amount
|
commodityValue :: Journal -> Day -> CommoditySymbol -> Maybe Amount
|
||||||
commodityValue j d c
|
commodityValue j d c
|
||||||
| null applicableprices = Nothing
|
| null applicableprices = Nothing
|
||||||
@ -163,6 +176,13 @@ commodityValue j d c
|
|||||||
where
|
where
|
||||||
applicableprices = [p | p <- sort $ jmarketprices j, mpcommodity p == c, mpdate p <= d]
|
applicableprices = [p | p <- sort $ jmarketprices j, mpcommodity p == c, mpdate p <= d]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tests_balanceReport =
|
tests_balanceReport =
|
||||||
let
|
let
|
||||||
(opts,journal) `gives` r = do
|
(opts,journal) `gives` r = do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user