journal module

class pyluca.journal.Journal(entries: Optional[List[JournalEntry]] = None)[source]

Bases: object

A log which maintains list of journal entries.

Parameters:

entries – An optional opening journal entries

add_entry(entry: JournalEntry)[source]

Function which takes an entry and adds to the entries after validation on date. Raises exception if passed entry is back dated

Parameters:

entry – Entry to be added

Raises:

AssertionError

class pyluca.journal.JournalEntry(sl_no: int, account: str, dr_amount: float, cr_amount: float, date: datetime, narration: str, key: str, event_id: str = '')[source]

Bases: object

A struct for individual journal entry.

Parameters:
  • sl_no – sl_no of the entry (starting from 1)

  • account – The account which the entry is passed for

  • dr_amount – Debit amount

  • cr_amount – Credit amount

  • date – Time of occurrence

  • narration – A narration or description for the entry

  • key – A key to group the journal entries

  • event_id – Identifier for event caused this entry