mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:09:28 +03:00
begin arbitrary currency support
This commit is contained in:
parent
45d4d0ffac
commit
d739ac0718
@ -1,5 +1,7 @@
|
||||
module Currency
|
||||
where
|
||||
import qualified Data.Map as Map
|
||||
import Data.Map ((!))
|
||||
import Utils
|
||||
import Types
|
||||
|
||||
@ -12,8 +14,10 @@ currencies =
|
||||
,Currency "m" 1 -- minutes
|
||||
]
|
||||
|
||||
currencymap = Map.fromList [(sym, c) | c@(Currency sym rate) <- currencies]
|
||||
|
||||
getcurrency :: String -> Currency
|
||||
getcurrency s = head $ [(Currency symbol rate) | (Currency symbol rate) <- currencies, symbol==s]
|
||||
getcurrency s = Map.findWithDefault (Currency s 1) s currencymap
|
||||
|
||||
conversionRate :: Currency -> Currency -> Double
|
||||
conversionRate oldc newc = (rate newc) / (rate oldc)
|
||||
|
@ -2,7 +2,6 @@ module Ledger
|
||||
where
|
||||
import qualified Data.Map as Map
|
||||
import Data.Map ((!))
|
||||
|
||||
import Utils
|
||||
import Types
|
||||
import Amount
|
||||
|
44
NOTES
44
NOTES
@ -2,37 +2,27 @@ hledger project notes
|
||||
|
||||
* TO DO
|
||||
** bugs
|
||||
*** handle unknown currencies
|
||||
** compatibility
|
||||
** basic features
|
||||
*** print
|
||||
*** !include
|
||||
*** -j and -J graph data output
|
||||
|
||||
** advanced features
|
||||
*** handle mixed amounts
|
||||
*** ledger 3.0-style elision
|
||||
*** -p period expressions
|
||||
*** -d display expressions
|
||||
*** read gnucash files
|
||||
*** other args, directives
|
||||
|
||||
*** more speed
|
||||
** new features
|
||||
*** feature: read timelog files
|
||||
**** fix up Amounts
|
||||
***** allow flexible display by currency
|
||||
***** allow parsing by currency
|
||||
***** fix arithmetic
|
||||
|
||||
**** timelog parser
|
||||
handle time amounts
|
||||
** ledger features
|
||||
*** print command
|
||||
*** handle mixed amounts, non-money currencies
|
||||
**** handle precision per currency
|
||||
*** handle time logs
|
||||
**** fix timelog parser
|
||||
**** handle time amounts
|
||||
switch to Data.Time.*
|
||||
fix errors
|
||||
- read seconds to pico
|
||||
try System.Time ?
|
||||
|
||||
*** timelog simple format
|
||||
*** !include
|
||||
*** -j and -J graph data output
|
||||
*** more speed
|
||||
*** ledger 3.0-style elision
|
||||
*** -p period expressions
|
||||
*** -d display expressions
|
||||
*** read gnucash files
|
||||
*** other ledger args, directives
|
||||
** new features
|
||||
*** simpler timelog format
|
||||
*** auto-generate missing clock-out
|
||||
*** graph automation
|
||||
*** entry and smart data entry
|
||||
|
2
Utils.hs
2
Utils.hs
@ -4,6 +4,7 @@ module Utils (
|
||||
module Char,
|
||||
module Data.List,
|
||||
module Data.Tree,
|
||||
module Data.Map,
|
||||
module Data.Ord,
|
||||
module Text.Printf,
|
||||
module Text.Regex,
|
||||
@ -15,6 +16,7 @@ where
|
||||
import Char
|
||||
import Data.List
|
||||
import Data.Tree
|
||||
import qualified Data.Map
|
||||
import Data.Ord
|
||||
import Text.Printf
|
||||
import Text.Regex
|
||||
|
Loading…
Reference in New Issue
Block a user