ADD negative amount lookup
This commit is contained in:
parent
4f44e37462
commit
d7117270c9
|
@ -404,7 +404,7 @@ let EntryNumGetter =
|
|||
ConstN: a constant value
|
||||
AmountN: the value of the 'Amount' column
|
||||
-}
|
||||
< LookupN : Text | ConstN : Double | AmountN >
|
||||
< LookupN : Text | ConstN : Double | AmountN | NegAmountN >
|
||||
|
||||
let EntryTextGetter =
|
||||
{-
|
||||
|
|
|
@ -343,11 +343,13 @@ collectErrorsIO :: MonadUnliftIO m => [m a] -> m [a]
|
|||
collectErrorsIO = mapErrorsIO id
|
||||
|
||||
resolveValue :: TxRecord -> EntryNumGetter -> InsertExcept Double
|
||||
resolveValue r s = case s of
|
||||
(LookupN t) -> readDouble =<< lookupErr SplitValField t (trOther r)
|
||||
resolveValue TxRecord {trOther, trAmount} s = case s of
|
||||
(LookupN t) -> readDouble =<< lookupErr SplitValField t trOther
|
||||
(ConstN c) -> return c
|
||||
-- TODO don't coerce to rational in trAmount
|
||||
AmountN -> return $ fromRational $ trAmount r
|
||||
AmountN -> return a
|
||||
NegAmountN -> return $ negate a
|
||||
where
|
||||
a = fromRational trAmount
|
||||
|
||||
resolveAcnt :: TxRecord -> SplitAcnt -> InsertExcept T.Text
|
||||
resolveAcnt = resolveSplitField AcntField
|
||||
|
|
Loading…
Reference in New Issue