parent
acd6e5bfe3
commit
cb5334c8df
@ -55,8 +55,15 @@ FLAGS
|
|||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
copts' <- getHledgerCliOpts cmdmode
|
copts@CliOpts{reportopts_=ropts, rawopts_} <- getHledgerCliOpts cmdmode
|
||||||
withJournalDo copts' $ \copts@CliOpts{reportopts_=ropts, rawopts_} j -> do
|
let copts' = copts{
|
||||||
|
-- One of our postings will probably have a missing amount; this ensures it's
|
||||||
|
-- explicit on all the others.
|
||||||
|
rawopts_=("explicit",""):rawopts_
|
||||||
|
-- Don't let our ACCT argument be interpreted as a query by print
|
||||||
|
,reportopts_=ropts{query_=""}
|
||||||
|
}
|
||||||
|
withJournalDo copts' $ \j -> do
|
||||||
today <- getCurrentDay
|
today <- getCurrentDay
|
||||||
menddate <- specifiedEndDate ropts
|
menddate <- specifiedEndDate ropts
|
||||||
let
|
let
|
||||||
@ -72,13 +79,6 @@ main = do
|
|||||||
dates = pdates ++ [enddate]
|
dates = pdates ++ [enddate]
|
||||||
(_,ts') = mapAccumL (splitTransactionPostings q acct) dates $ jtxns j
|
(_,ts') = mapAccumL (splitTransactionPostings q acct) dates $ jtxns j
|
||||||
j' = j{jtxns=ts'}
|
j' = j{jtxns=ts'}
|
||||||
copts' = copts{
|
|
||||||
-- One of our postings will probably have a missing amount; this ensures it's
|
|
||||||
-- explicit on all the others.
|
|
||||||
rawopts_=("explicit",""):rawopts_
|
|
||||||
-- Don't let our ACCT argument be interpreted as a query by print
|
|
||||||
,reportopts_=ropts{query_=""}
|
|
||||||
}
|
|
||||||
print' copts' j'
|
print' copts' j'
|
||||||
|
|
||||||
-- | Split a transaction's postings to acct, if the transaction is matched by q,
|
-- | Split a transaction's postings to acct, if the transaction is matched by q,
|
||||||
@ -108,7 +108,7 @@ splitPosting acct dates p@Posting{paccount,pamount}
|
|||||||
[d] -> (d, [])
|
[d] -> (d, [])
|
||||||
[] -> error' "splitPosting ran out of dates, should not happen"
|
[] -> error' "splitPosting ran out of dates, should not happen"
|
||||||
days = initSafe [start..end]
|
days = initSafe [start..end]
|
||||||
amt = pamount `divideMixedAmount` (fromIntegral $ length days)
|
amt = (fromIntegral $ length days) `divideMixedAmount` pamount
|
||||||
-- give one of the postings an exact balancing amount to ensure the transaction is balanced
|
-- give one of the postings an exact balancing amount to ensure the transaction is balanced
|
||||||
-- lastamt = pamount - ptrace (amt `multiplyMixedAmount` (fromIntegral $ length days))
|
-- lastamt = pamount - ptrace (amt `multiplyMixedAmount` (fromIntegral $ length days))
|
||||||
lastamt = missingmixedamt
|
lastamt = missingmixedamt
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user