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
|
module Currency
|
||||||
where
|
where
|
||||||
|
import qualified Data.Map as Map
|
||||||
|
import Data.Map ((!))
|
||||||
import Utils
|
import Utils
|
||||||
import Types
|
import Types
|
||||||
|
|
||||||
@ -12,8 +14,10 @@ currencies =
|
|||||||
,Currency "m" 1 -- minutes
|
,Currency "m" 1 -- minutes
|
||||||
]
|
]
|
||||||
|
|
||||||
|
currencymap = Map.fromList [(sym, c) | c@(Currency sym rate) <- currencies]
|
||||||
|
|
||||||
getcurrency :: String -> Currency
|
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 :: Currency -> Currency -> Double
|
||||||
conversionRate oldc newc = (rate newc) / (rate oldc)
|
conversionRate oldc newc = (rate newc) / (rate oldc)
|
||||||
|
@ -2,7 +2,6 @@ module Ledger
|
|||||||
where
|
where
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import Data.Map ((!))
|
import Data.Map ((!))
|
||||||
|
|
||||||
import Utils
|
import Utils
|
||||||
import Types
|
import Types
|
||||||
import Amount
|
import Amount
|
||||||
|
44
NOTES
44
NOTES
@ -2,37 +2,27 @@ hledger project notes
|
|||||||
|
|
||||||
* TO DO
|
* TO DO
|
||||||
** bugs
|
** bugs
|
||||||
*** handle unknown currencies
|
** ledger features
|
||||||
** compatibility
|
*** print command
|
||||||
** basic features
|
*** handle mixed amounts, non-money currencies
|
||||||
*** print
|
**** handle precision per currency
|
||||||
*** !include
|
*** handle time logs
|
||||||
*** -j and -J graph data output
|
**** fix timelog parser
|
||||||
|
**** handle time amounts
|
||||||
** 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
|
|
||||||
switch to Data.Time.*
|
switch to Data.Time.*
|
||||||
fix errors
|
fix errors
|
||||||
- read seconds to pico
|
- read seconds to pico
|
||||||
try System.Time ?
|
try System.Time ?
|
||||||
|
*** !include
|
||||||
*** timelog simple format
|
*** -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
|
*** auto-generate missing clock-out
|
||||||
*** graph automation
|
*** graph automation
|
||||||
*** entry and smart data entry
|
*** entry and smart data entry
|
||||||
|
2
Utils.hs
2
Utils.hs
@ -4,6 +4,7 @@ module Utils (
|
|||||||
module Char,
|
module Char,
|
||||||
module Data.List,
|
module Data.List,
|
||||||
module Data.Tree,
|
module Data.Tree,
|
||||||
|
module Data.Map,
|
||||||
module Data.Ord,
|
module Data.Ord,
|
||||||
module Text.Printf,
|
module Text.Printf,
|
||||||
module Text.Regex,
|
module Text.Regex,
|
||||||
@ -15,6 +16,7 @@ where
|
|||||||
import Char
|
import Char
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Tree
|
import Data.Tree
|
||||||
|
import qualified Data.Map
|
||||||
import Data.Ord
|
import Data.Ord
|
||||||
import Text.Printf
|
import Text.Printf
|
||||||
import Text.Regex
|
import Text.Regex
|
||||||
|
Loading…
Reference in New Issue
Block a user