ENH gereralize amount lookup function
This commit is contained in:
parent
d7117270c9
commit
6117784d0e
|
@ -404,7 +404,7 @@ let EntryNumGetter =
|
||||||
ConstN: a constant value
|
ConstN: a constant value
|
||||||
AmountN: the value of the 'Amount' column
|
AmountN: the value of the 'Amount' column
|
||||||
-}
|
-}
|
||||||
< LookupN : Text | ConstN : Double | AmountN | NegAmountN >
|
< LookupN : Text | ConstN : Double | AmountN : Double >
|
||||||
|
|
||||||
let EntryTextGetter =
|
let EntryTextGetter =
|
||||||
{-
|
{-
|
||||||
|
|
|
@ -346,10 +346,7 @@ resolveValue :: TxRecord -> EntryNumGetter -> InsertExcept Double
|
||||||
resolveValue TxRecord {trOther, trAmount} s = case s of
|
resolveValue TxRecord {trOther, trAmount} s = case s of
|
||||||
(LookupN t) -> readDouble =<< lookupErr SplitValField t trOther
|
(LookupN t) -> readDouble =<< lookupErr SplitValField t trOther
|
||||||
(ConstN c) -> return c
|
(ConstN c) -> return c
|
||||||
AmountN -> return a
|
AmountN m -> return $ (* m) $ fromRational trAmount
|
||||||
NegAmountN -> return $ negate a
|
|
||||||
where
|
|
||||||
a = fromRational trAmount
|
|
||||||
|
|
||||||
resolveAcnt :: TxRecord -> SplitAcnt -> InsertExcept T.Text
|
resolveAcnt :: TxRecord -> SplitAcnt -> InsertExcept T.Text
|
||||||
resolveAcnt = resolveSplitField AcntField
|
resolveAcnt = resolveSplitField AcntField
|
||||||
|
|
Loading…
Reference in New Issue