timedot: a D default commodity (and style) is applied to timedot aounts

This means they can be priced and converted.
This commit is contained in:
Simon Michael 2021-11-05 23:34:46 -10:00
parent f00e5c25ec
commit 41bde20095

View File

@ -171,21 +171,26 @@ entryp = do
lift $ optional $ choice [orgheadingprefixp, skipNonNewlineSpaces1] lift $ optional $ choice [orgheadingprefixp, skipNonNewlineSpaces1]
a <- modifiedaccountnamep a <- modifiedaccountnamep
lift skipNonNewlineSpaces lift skipNonNewlineSpaces
hours <- hrs <-
try (lift followingcommentp >> return 0) try (lift followingcommentp >> return 0)
<|> (durationp <* <|> (durationp <*
(try (lift followingcommentp) <|> (newline >> return ""))) (try (lift followingcommentp) <|> (newline >> return "")))
let t = nulltransaction{ mcs <- getDefaultCommodityAndStyle
tsourcepos = (pos, pos), let
tstatus = Cleared, (c,s) = case mcs of
tpostings = [ Just (defc,defs) -> (defc, defs{asprecision=max (asprecision defs) (Precision 2)})
nullposting{paccount=a _ -> ("", amountstyle{asprecision=Precision 2})
,pamount=mixedAmount . amountSetPrecision (Precision 2) $ num hours -- don't assume hours; do set precision to 2 t = nulltransaction{
,ptype=VirtualPosting tsourcepos = (pos, pos),
,ptransaction=Just t tstatus = Cleared,
} tpostings = [
] nullposting{paccount=a
} ,pamount=mixedAmount $ nullamt{acommodity=c, aquantity=hrs, astyle=s}
,ptype=VirtualPosting
,ptransaction=Just t
}
]
}
lift $ traceparse' "entryp" lift $ traceparse' "entryp"
return t return t