]> Git — Sourcephile - tmp/julm/literate-invoice.git/blob - tests/Tests/Accounting.hs
feat(accounting): init
[tmp/julm/literate-invoice.git] / tests / Tests / Accounting.hs
1 {-# LANGUAGE DeriveAnyClass #-}
2 {-# LANGUAGE OverloadedLists #-}
3
4 module Tests.Accounting where
5
6 import Literate.Accounting
7 import Literate.Invoice
8 import Literate.Organization
9 import Literate.Prelude
10 import Tests.Organization qualified as Orga
11
12 data Cause
13 = CauseInvoice InvoiceId
14 deriving (Eq, Ord, Show, Generic, NFData)
15
16 data Account
17 = AccountOrga Organization
18 deriving (Eq, Ord, Show, Generic, NFData)
19
20 data Amounts
21 = Amounts
22 { amountsEuro :: Amount 100 (UnitName "€")
23 }
24 deriving (Eq, Ord, Show, Generic, NFData)
25 instance FromRational Amounts where
26 fromRational r = Amounts{amountsEuro = fromRational r}
27
28 accounting :: [Movement Cause Account Amounts]
29 accounting =
30 [ Movement
31 { moveDescription = ""
32 , moveCause = []
33 , moveDate = "2026-01-27"
34 , movePostings = equalPostings (AccountOrga Orga.upwork) (AccountOrga Orga.julmInfo) 174.30
35 }
36 , Movement
37 { moveDescription = ""
38 , moveCause = []
39 , moveDate = "2026-01-28"
40 , movePostings = equalPostings (AccountOrga Orga.nixosFoundationNGITeam) (AccountOrga Orga.julmInfo) 2000.00
41 }
42 , Movement
43 { moveDescription = ""
44 , moveCause = []
45 , moveDate = "2026-01-29"
46 , movePostings = equalPostings (AccountOrga Orga.nixosFoundationNGITeam) (AccountOrga Orga.julmInfo) 4643.75
47 }
48 ]