mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:09:28 +03:00
cleanup
This commit is contained in:
parent
dabc30e115
commit
8a5ed9c8b9
@ -1,5 +1,7 @@
|
||||
module Account
|
||||
where
|
||||
import qualified Data.Map as Map
|
||||
|
||||
import Utils
|
||||
import BasicTypes
|
||||
import AccountName
|
||||
@ -13,6 +15,8 @@ import Ledger
|
||||
-- and transactions (not including sub-accounts)
|
||||
type Account = (AccountName,[EntryTransaction],Amount)
|
||||
|
||||
nullacct = ("",[],nullamt)
|
||||
|
||||
aname (a,_,_) = a
|
||||
atransactions (_,ts,_) = ts
|
||||
abalance (_,_,b) = b
|
||||
@ -30,7 +34,7 @@ aggregateBalanceInAccountNamed l a =
|
||||
sumEntryTransactions (aggregateTransactionsInAccountNamed l a)
|
||||
|
||||
transactionsInAccountNamed :: Ledger -> AccountName -> [EntryTransaction]
|
||||
transactionsInAccountNamed l a =
|
||||
transactionsInAccountNamed l a =
|
||||
ledgerTransactionsMatching (["^" ++ a ++ "$"], []) l
|
||||
|
||||
aggregateTransactionsInAccountNamed :: Ledger -> AccountName -> [EntryTransaction]
|
||||
|
@ -22,7 +22,7 @@ branches = snd . node
|
||||
GOOG 500
|
||||
|
||||
a mixed amount is one or more simple amounts:
|
||||
$50, EUR 3, APPL 500
|
||||
$50, EUR 3, AAPL 500
|
||||
HRS 16, $13.55, oranges 6
|
||||
|
||||
arithmetic:
|
||||
@ -31,9 +31,9 @@ branches = snd . node
|
||||
EUR0.76 + $1 = EUR 1.52
|
||||
EUR0.76 - $1 = 0
|
||||
($5, HRS 2) + $1 = ($6, HRS 2)
|
||||
($50, EUR 3, APPL 500) + ($13.55, oranges 6) = $67.51, APPL 500, oranges 6
|
||||
($50, EUR 3, AAPL 500) + ($13.55, oranges 6) = $67.51, AAPL 500, oranges 6
|
||||
($50, EUR 3) * $-1 = $-53.96
|
||||
($50, APPL 500) * $-1 = error
|
||||
($50, AAPL 500) * $-1 = error
|
||||
|
||||
-}
|
||||
|
||||
@ -46,6 +46,8 @@ data Amount = Amount {
|
||||
|
||||
instance Show Amount where show = showAmountRoundedOrZero
|
||||
|
||||
nullamt = Amount "" 0
|
||||
|
||||
showAmountRoundedOrZero :: Amount -> String
|
||||
showAmountRoundedOrZero (Amount cur qty) =
|
||||
let rounded = printf "%.2f" qty in
|
||||
|
@ -9,6 +9,8 @@ module Models (
|
||||
module Account
|
||||
)
|
||||
where
|
||||
import qualified Data.Map as Map
|
||||
|
||||
import BasicTypes
|
||||
import AccountName
|
||||
import Entry
|
||||
|
10
hledger.hs
10
hledger.hs
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env runhaskell
|
||||
{-
|
||||
hledger - ledger-compatible money management utilities (& haskell study)
|
||||
GPLv3, (c) Simon Michael & contributors,
|
||||
John Wiegley's ledger is at http://newartisans.com/ledger.html
|
||||
hledger - ledger-compatible money management tool (& haskell study)
|
||||
GPLv3, (c) Simon Michael & contributors
|
||||
inspired by John Wiegley's ledger at http://newartisans.com/ledger.html
|
||||
|
||||
modules/models are organized roughly like this:
|
||||
modules/models are organized roughly like this; each layer can only
|
||||
reference things below it:
|
||||
|
||||
hledger
|
||||
Options
|
||||
|
Loading…
Reference in New Issue
Block a user