;cln: journalAddInferredEquityPostings -> journalInferEquityFromCosts
This commit is contained in:
parent
4988179dac
commit
1cfcb7fa76
@ -26,7 +26,7 @@ module Hledger.Data.Journal (
|
|||||||
commodityStylesFromAmounts,
|
commodityStylesFromAmounts,
|
||||||
journalCommodityStyles,
|
journalCommodityStyles,
|
||||||
journalToCost,
|
journalToCost,
|
||||||
journalAddInferredEquityPostings,
|
journalInferEquityFromCosts,
|
||||||
journalInferCostsFromEquity,
|
journalInferCostsFromEquity,
|
||||||
journalMarkRedundantCosts,
|
journalMarkRedundantCosts,
|
||||||
journalReverse,
|
journalReverse,
|
||||||
@ -915,14 +915,15 @@ journalToCost cost j@Journal{jtxns=ts} = j{jtxns=map (transactionToCost styles c
|
|||||||
where
|
where
|
||||||
styles = journalCommodityStyles j
|
styles = journalCommodityStyles j
|
||||||
|
|
||||||
-- | Add inferred equity postings to a 'Journal' using transaction prices.
|
-- | Add equity postings inferred from costs, where needed and possible.
|
||||||
journalAddInferredEquityPostings :: Bool -> Journal -> Journal
|
-- See hledger manual > Cost reporting.
|
||||||
journalAddInferredEquityPostings verbosetags j = journalMapTransactions (transactionAddInferredEquityPostings verbosetags equityAcct) j
|
journalInferEquityFromCosts :: Bool -> Journal -> Journal
|
||||||
|
journalInferEquityFromCosts verbosetags j = journalMapTransactions (transactionAddInferredEquityPostings verbosetags equityAcct) j
|
||||||
where
|
where
|
||||||
equityAcct = journalConversionAccount j
|
equityAcct = journalConversionAccount j
|
||||||
|
|
||||||
-- | Add costs inferred from equity conversion postings, where needed and possible.
|
-- | Add costs inferred from equity conversion postings, where needed and possible.
|
||||||
-- See hledger manual > Inferring cost from equity postings.
|
-- See hledger manual > Cost reporting.
|
||||||
journalInferCostsFromEquity :: Journal -> Either String Journal
|
journalInferCostsFromEquity :: Journal -> Either String Journal
|
||||||
journalInferCostsFromEquity j = do
|
journalInferCostsFromEquity j = do
|
||||||
ts <- mapM (transactionInferCostsFromEquity False $ jaccounttypes j) $ jtxns j
|
ts <- mapM (transactionInferCostsFromEquity False $ jaccounttypes j) $ jtxns j
|
||||||
|
|||||||
@ -334,7 +334,7 @@ journalFinalise iopts@InputOpts{..} f txt pj = do
|
|||||||
>>= journalMarkRedundantCosts -- Mark redundant costs, to help journalBalanceTransactions ignore them
|
>>= journalMarkRedundantCosts -- Mark redundant costs, to help journalBalanceTransactions ignore them
|
||||||
>>= journalBalanceTransactions balancingopts_ -- Balance all transactions and maybe check balance assertions.
|
>>= journalBalanceTransactions balancingopts_ -- Balance all transactions and maybe check balance assertions.
|
||||||
>>= (if infer_costs_ then journalInferCostsFromEquity else pure) -- Maybe infer costs from equity postings where possible
|
>>= (if infer_costs_ then journalInferCostsFromEquity else pure) -- Maybe infer costs from equity postings where possible
|
||||||
<&> (if infer_equity_ then journalAddInferredEquityPostings verbose_tags_ else id) -- Maybe infer equity postings from costs where possible
|
<&> (if infer_equity_ then journalInferEquityFromCosts verbose_tags_ else id) -- Maybe infer equity postings from costs where possible
|
||||||
<&> journalInferMarketPricesFromTransactions -- infer market prices from commodity-exchanging transactions
|
<&> journalInferMarketPricesFromTransactions -- infer market prices from commodity-exchanging transactions
|
||||||
<&> traceOrLogAt 6 ("journalFinalise: " <> takeFileName f) -- debug logging
|
<&> traceOrLogAt 6 ("journalFinalise: " <> takeFileName f) -- debug logging
|
||||||
<&> dbgJournalAcctDeclOrder ("journalFinalise: " <> takeFileName f <> " acct decls : ")
|
<&> dbgJournalAcctDeclOrder ("journalFinalise: " <> takeFileName f <> " acct decls : ")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user