Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides data definitions and functions for ledgers and postings.
Synopsis
- newtype GeneralLedger (precision :: Nat) account event = GeneralLedger {
- generalLedgerLedgers :: [Ledger precision account event]
- data Ledger (precision :: Nat) account event = Ledger {
- ledgerAccount :: !(Account account)
- ledgerOpening :: !(Balance precision)
- ledgerRunning :: ![LedgerEntry precision event]
- ledgerClosing :: KnownNat precision => Ledger precision account event -> Balance precision
- data LedgerEntry (precision :: Nat) event = LedgerEntry {
- ledgerEntryDate :: !Day
- ledgerEntryAmount :: !(Amount precision)
- ledgerEntryDescription :: !Text
- ledgerEntryEvent :: !event
- ledgerEntryPostingId :: !Text
- ledgerEntryBalance :: !(Balance precision)
- initLedger :: KnownNat precision => Account account -> Ledger precision account event
- initLedgerWithOpeningBalance :: KnownNat precision => Account account -> Balance precision -> Ledger precision account event
- initLedgerWithOpeningValue :: KnownNat precision => Account account -> Quantity precision -> Ledger precision account event
- initLedgerWithOpeningQuantity :: KnownNat precision => Account account -> Quantity precision -> Ledger precision account event
- postEntries :: KnownNat precision => Eq account => Ord account => GeneralLedger precision account event -> [JournalEntry precision account event] -> GeneralLedger precision account event
- postEntry :: KnownNat precision => Eq account => Ord account => GeneralLedger precision account event -> JournalEntry precision account event -> GeneralLedger precision account event
- postEntryItem :: KnownNat precision => Eq account => Ord account => GeneralLedger precision account event -> JournalEntry precision account event -> JournalEntryItem precision account event -> GeneralLedger precision account event
- postItem :: KnownNat precision => Ledger precision account event -> Day -> Amount precision -> Text -> event -> Text -> Ledger precision account event
Documentation
newtype GeneralLedger (precision :: Nat) account event Source #
Data definition for a general ledger.
GeneralLedger | |
|
Instances
(Eq account, Eq event) => Eq (GeneralLedger precision account event) Source # | |
Defined in Haspara.Accounting.Ledger (==) :: GeneralLedger precision account event -> GeneralLedger precision account event -> Bool # (/=) :: GeneralLedger precision account event -> GeneralLedger precision account event -> Bool # | |
(KnownNat precision, Show account, Show event) => Show (GeneralLedger precision account event) Source # | |
Defined in Haspara.Accounting.Ledger showsPrec :: Int -> GeneralLedger precision account event -> ShowS # show :: GeneralLedger precision account event -> String # showList :: [GeneralLedger precision account event] -> ShowS # | |
Generic (GeneralLedger precision account event) Source # | |
Defined in Haspara.Accounting.Ledger type Rep (GeneralLedger precision account event) :: Type -> Type # from :: GeneralLedger precision account event -> Rep (GeneralLedger precision account event) x # to :: Rep (GeneralLedger precision account event) x -> GeneralLedger precision account event # | |
(KnownNat precision, ToJSON account, ToJSON event) => ToJSON (GeneralLedger precision account event) Source # | |
Defined in Haspara.Accounting.Ledger toJSON :: GeneralLedger precision account event -> Value # toEncoding :: GeneralLedger precision account event -> Encoding # toJSONList :: [GeneralLedger precision account event] -> Value # toEncodingList :: [GeneralLedger precision account event] -> Encoding # | |
(KnownNat precision, FromJSON account, FromJSON event) => FromJSON (GeneralLedger precision account event) Source # | |
Defined in Haspara.Accounting.Ledger parseJSON :: Value -> Parser (GeneralLedger precision account event) # parseJSONList :: Value -> Parser [GeneralLedger precision account event] # | |
type Rep (GeneralLedger precision account event) Source # | |
Defined in Haspara.Accounting.Ledger type Rep (GeneralLedger precision account event) = D1 ('MetaData "GeneralLedger" "Haspara.Accounting.Ledger" "haspara-0.0.0.5-EkkfyzMRwPgIJNppmBSdYM" 'True) (C1 ('MetaCons "GeneralLedger" 'PrefixI 'True) (S1 ('MetaSel ('Just "generalLedgerLedgers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Ledger precision account event]))) |
data Ledger (precision :: Nat) account event Source #
Data definition for a ledger.
Ledger | |
|
Instances
(Eq account, Eq event) => Eq (Ledger precision account event) Source # | |
(KnownNat precision, Show account, Show event) => Show (Ledger precision account event) Source # | |
Generic (Ledger precision account event) Source # | |
(KnownNat precision, ToJSON account, ToJSON event) => ToJSON (Ledger precision account event) Source # | |
Defined in Haspara.Accounting.Ledger | |
(KnownNat precision, FromJSON account, FromJSON event) => FromJSON (Ledger precision account event) Source # | |
type Rep (Ledger precision account event) Source # | |
Defined in Haspara.Accounting.Ledger type Rep (Ledger precision account event) = D1 ('MetaData "Ledger" "Haspara.Accounting.Ledger" "haspara-0.0.0.5-EkkfyzMRwPgIJNppmBSdYM" 'False) (C1 ('MetaCons "Ledger" 'PrefixI 'True) (S1 ('MetaSel ('Just "ledgerAccount") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Account account)) :*: (S1 ('MetaSel ('Just "ledgerOpening") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Balance precision)) :*: S1 ('MetaSel ('Just "ledgerRunning") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [LedgerEntry precision event])))) |
ledgerClosing :: KnownNat precision => Ledger precision account event -> Balance precision Source #
Returns the closing balance of a ledger.
data LedgerEntry (precision :: Nat) event Source #
Type encoding of a ledger item.
LedgerEntry | |
|
Instances
initLedger :: KnownNat precision => Account account -> Ledger precision account event Source #
Initializes an empty ledger for a given account.
initLedgerWithOpeningBalance :: KnownNat precision => Account account -> Balance precision -> Ledger precision account event Source #
Initializes a ledger with the given opening balance.
initLedgerWithOpeningValue :: KnownNat precision => Account account -> Quantity precision -> Ledger precision account event Source #
Initializes a ledger with the given opening value.
See amountFromValue
for the meaning of the concept of value.
initLedgerWithOpeningQuantity :: KnownNat precision => Account account -> Quantity precision -> Ledger precision account event Source #
Initializes a ledger with the given opening quantity.
See amountFromQuantity
for the meaning of the concept of quantity.
postEntries :: KnownNat precision => Eq account => Ord account => GeneralLedger precision account event -> [JournalEntry precision account event] -> GeneralLedger precision account event Source #
Posts a given list of journal entries to the given general ledger and returns the new general ledger.
postEntry :: KnownNat precision => Eq account => Ord account => GeneralLedger precision account event -> JournalEntry precision account event -> GeneralLedger precision account event Source #
Posts a given journal entry to the given general ledger and returns the new general ledger.
postEntryItem :: KnownNat precision => Eq account => Ord account => GeneralLedger precision account event -> JournalEntry precision account event -> JournalEntryItem precision account event -> GeneralLedger precision account event Source #
Posts a given journal entry item of a given journal entry to the given general ledger and returns the new general ledger.