diff options
author | Rutger Broekhoff | 2025-03-29 21:24:40 +0100 |
---|---|---|
committer | Rutger Broekhoff | 2025-03-29 21:24:40 +0100 |
commit | 533ba31d0a03600f57ad46f6e55229a7f2b60994 (patch) | |
tree | a22aded356494e7c4865de07ea5d93055f10dece /app | |
parent | 6b27332df29a294167fe4f5b91e2fa0a8f96c665 (diff) | |
download | rdcapsis-533ba31d0a03600f57ad46f6e55229a7f2b60994.tar.gz rdcapsis-533ba31d0a03600f57ad46f6e55229a7f2b60994.zip |
Rename
Diffstat (limited to 'app')
-rw-r--r-- | app/Main.hs | 64 |
1 files changed, 44 insertions, 20 deletions
diff --git a/app/Main.hs b/app/Main.hs index 7b4551a..bc8ad37 100644 --- a/app/Main.hs +++ b/app/Main.hs | |||
@@ -20,25 +20,49 @@ import Import.Ing.SavingsAccountCsv qualified | |||
20 | import System.IO (IOMode (ReadMode), withFile) | 20 | import System.IO (IOMode (ReadMode), withFile) |
21 | import Text.Pretty.Simple (pPrint) | 21 | import Text.Pretty.Simple (pPrint) |
22 | 22 | ||
23 | -- data AccountType = Asset | Equity | Liability | Expense | Income | 23 | data AccountType = Asset | Equity | Liability | Expense | Income |
24 | -- | 24 | |
25 | -- data TxAction = Inc | Dec | 25 | data TxAction = Inc | Dec |
26 | -- | 26 | |
27 | -- txAopp :: TxAction -> TxAction | 27 | txAopp :: TxAction -> TxAction |
28 | -- txaOpp Inc = Dec | 28 | txaOpp Inc = Dec |
29 | -- txaOpp Dec = Inc | 29 | txaOpp Dec = Inc |
30 | -- | 30 | |
31 | -- onDebit :: AccountType -> TxAction | 31 | onDebit :: AccountType -> TxAction |
32 | -- onDebit Asset = Inc | 32 | onDebit Asset = Inc |
33 | -- onDebit Equity = Dec | 33 | onDebit Equity = Dec |
34 | -- onDebit Liability = Dec | 34 | onDebit Liability = Dec |
35 | -- onDebit Expense = Inc | 35 | onDebit Expense = Inc |
36 | -- onDebit Income = Dec | 36 | onDebit Income = Dec |
37 | -- | 37 | |
38 | -- onCredit :: AccountType -> TxAction | 38 | onCredit :: AccountType -> TxAction |
39 | -- onCredit = txaOpp . onDebit | 39 | onCredit = txaOpp . onDebit |
40 | -- | 40 | |
41 | -- data Tx = Tx { txDebit :: [(Account, Decimal)], txCredit :: [(Account, Decimal)] } deriving Show | 41 | data Ledger = [LedgerEntry] |
42 | |||
43 | data LedgerEntry = TxEntry Tx | BalAssertEntry BalAssert | ||
44 | |||
45 | -- A balance assertion is only valid when all transactions before it have been | ||
46 | -- cleared and the balance of the account agrees with the amount in the | ||
47 | -- assertion. | ||
48 | data BalAssert = BalAssert { | ||
49 | amount :: Decimal, | ||
50 | tags :: Tags } | ||
51 | |||
52 | data Tx = Tx { | ||
53 | txClearedAt :: Maybe UTCTime, | ||
54 | txCommodity :: Commodity, | ||
55 | txDebit :: [(Account, Commodity, Rate, Amount)], | ||
56 | txCredit :: [(Account, Commodity, Rate, Amount)] | ||
57 | -- Description | ||
58 | -- Type: | ||
59 | } deriving Show | ||
60 | |||
61 | data Account = Account { | ||
62 | acName :: [T.Text], | ||
63 | acCommodity :: Commodity, | ||
64 | acBalance :: Amount } | ||
65 | |||
42 | data Choice = Red | Blue | Green | 66 | data Choice = Red | Blue | Green |
43 | deriving (Show) | 67 | deriving (Show) |
44 | 68 | ||
@@ -91,7 +115,7 @@ theApp = | |||
91 | 115 | ||
92 | main :: IO () | 116 | main :: IO () |
93 | main = do | 117 | main = do |
94 | let filename = "/home/rutgerbrf/Code/P/wayligmative/test3.csv" | 118 | let filename = "/home/rutgerbrf/Code/P/rdcapsis/test3.csv" |
95 | putStrLn $ "Reading " ++ filename | 119 | putStrLn $ "Reading " ++ filename |
96 | withFile filename ReadMode $ \h -> do | 120 | withFile filename ReadMode $ \h -> do |
97 | entries <- Import.Ing.CurrentAccountCsv.readFile h | 121 | entries <- Import.Ing.CurrentAccountCsv.readFile h |