]> Git — Sourcephile - tmp/julm/literate-invoice.git/blob - tests/Tests/Accounting.hs
feat(accounting/PCG): 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.Accounting.PlanComptableGénéral qualified as PCG
11 import Tests.Organization qualified as Orga
12
13 data Cause
14 = CauseInvoice InvoiceId
15 | CauseUrssaf {causeUrssafPeriod :: Period}
16 deriving (Eq, Ord, Show, Generic, NFData)
17
18 data Account
19 = AccountOrga Organization
20 | AccountPCG {accountPCG :: PCG.Compte, account :: Account}
21 deriving (Eq, Ord, Show, Generic, NFData)
22
23 -- 791 - 1677.00
24 -- 578 - FORMATION PROF. OBLIGATOIRE 14.00
25
26 data Amounts
27 = Amounts
28 { amountsEuro :: Amount 100 (UnitName "€")
29 }
30 deriving (Eq, Ord, Show, Generic, NFData)
31 instance FromRational Amounts where
32 fromRational r = Amounts{amountsEuro = fromRational r}
33
34 accounting :: [Movement Cause Account Amounts]
35 accounting =
36 [ Movement
37 { moveDescription = ""
38 , moveCause = []
39 , moveDate = "2026-01-27"
40 , movePostings = equalPostings (AccountOrga Orga.upwork) (AccountOrga Orga.julmInfo) 174.30
41 }
42 , Movement
43 { moveDescription = ""
44 , moveCause = []
45 , moveDate = "2026-01-28"
46 , movePostings = equalPostings (AccountOrga Orga.nixosFoundationNGITeam) (AccountOrga Orga.julmInfo) 2000.00
47 }
48 , Movement
49 { moveDescription = ""
50 , moveCause = []
51 , moveDate = "2026-01-29"
52 , movePostings = equalPostings (AccountOrga Orga.nixosFoundationNGITeam) (AccountOrga Orga.julmInfo) 4643.75
53 }
54 , Movement
55 { moveDescription = "Cotisation URSSAF"
56 , moveCause = [CauseUrssaf{causeUrssafPeriod = Period{periodBeginning = "2026-01-01", periodEnd = "2026-01-31"}}]
57 , moveDate = "2026-02-01"
58 , movePostings =
59 [ Posting
60 { postingAccount = AccountOrga Orga.julmInfo
61 , postingFlow = FlowSource 1691.00
62 }
63 , Posting
64 { postingAccount = AccountPCG{accountPCG = PCG.urssaf791, account = AccountOrga Orga.urssaf}
65 , postingFlow = FlowDest 1677.00
66 }
67 , Posting
68 { postingAccount = AccountPCG{accountPCG = PCG.urssaf578, account = AccountOrga Orga.urssaf}
69 , postingFlow = FlowDest 14.00
70 }
71 ]
72 }
73 ]