mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-24 19:02:46 +03:00
;cln: journalAddInferredEquityPostings -> journalInferEquityFromCosts
This commit is contained in:
parent
4988179dac
commit
1cfcb7fa76
@ -26,7 +26,7 @@ module Hledger.Data.Journal (
|
||||
commodityStylesFromAmounts,
|
||||
journalCommodityStyles,
|
||||
journalToCost,
|
||||
journalAddInferredEquityPostings,
|
||||
journalInferEquityFromCosts,
|
||||
journalInferCostsFromEquity,
|
||||
journalMarkRedundantCosts,
|
||||
journalReverse,
|
||||
@ -915,14 +915,15 @@ journalToCost cost j@Journal{jtxns=ts} = j{jtxns=map (transactionToCost styles c
|
||||
where
|
||||
styles = journalCommodityStyles j
|
||||
|
||||
-- | Add inferred equity postings to a 'Journal' using transaction prices.
|
||||
journalAddInferredEquityPostings :: Bool -> Journal -> Journal
|
||||
journalAddInferredEquityPostings verbosetags j = journalMapTransactions (transactionAddInferredEquityPostings verbosetags equityAcct) j
|
||||
-- | Add equity postings inferred from costs, where needed and possible.
|
||||
-- See hledger manual > Cost reporting.
|
||||
journalInferEquityFromCosts :: Bool -> Journal -> Journal
|
||||
journalInferEquityFromCosts verbosetags j = journalMapTransactions (transactionAddInferredEquityPostings verbosetags equityAcct) j
|
||||
where
|
||||
equityAcct = journalConversionAccount j
|
||||
|
||||
-- | 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 j = do
|
||||
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
|
||||
>>= 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_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
|
||||
<&> traceOrLogAt 6 ("journalFinalise: " <> takeFileName f) -- debug logging
|
||||
<&> dbgJournalAcctDeclOrder ("journalFinalise: " <> takeFileName f <> " acct decls : ")
|
||||
|
Loading…
Reference in New Issue
Block a user