Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the cl-ledger Reference Manual, version 4.0.0, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 11:12:40 2018 GMT+0.
• Introduction: | What cl-ledger is all about | |
• Systems: | The systems documentation | |
• Modules: | The modules documentation | |
• Files: | The files documentation | |
• Packages: | The packages documentation | |
• Definitions: | The symbols documentation | |
• Indexes: | Concepts, functions, variables and data types |
#+TITLE: CL-Ledger *CL-Ledger* is a Common Lisp port of the [[http://ledger-cli.org/][Ledger]] double-entry accounting system. * Installation The easiest way to install *CL-Ledger* is using [[https://www.quicklisp.org][Quicklisp]]: #+BEGIN_SRC lisp (quicklisp:quickload "cl-ledger") #+END_SRC If you want to work with the latest source code and need to install it manually, you will need the following libraries: - alexandria - cl-containers - cl-ppcre - local-time - series They can be installed easily using *Quicklisp*: #+BEGIN_SRC lisp (quicklisp:quickload '("alexandria" "cl-containers" "cl-ppcre" "local-time" "series")) #+END_SRC Now you need to get the source code and pull all of the projects relating to *CL-Ledger*: #+BEGIN_SRC shell git clone https://github.com/ledger/cl-ledger.git cd cl-ledger git submodule init git submodule update #+END_SRC The next step is to indicate your Common Lisp system where to load *CL-Ledger* from. If you are using *Quicklisp*, you can add links to the /local-projects/ directory: #+BEGIN_SRC shell cd /path/to/quicklisp/ cd local-projects ln -s /path/to/cl-ledger . ln -s /path/to/cl-ledger/cambl . ln -s /path/to/cl-ledger/periods . #+END_SRC If you don't use *Quicklisp*, you can add the following contents to the initialization file of your Common Lisp implementation (e.g. ~/.sbclrc for *SBCL*): #+BEGIN_SRC lisp (push "/path/to/cl-ledger/" asdf:*central-registry*) (dolist (project '("cambl/" "periods/")) (push (merge-pathnames project "/path/to/cl-ledger/") asdf:*central-registry*)) #+END_SRC Make sure you change ~/path/to/cl-ledger/~ to be the directory where *CL-Ledger* lives. Also, be sure this pathname ends with a slash! In CL, directory names always end with /. Now you can run *CL-Ledger* at the REPL like this: #+BEGIN_SRC lisp (asdf:load-system "cl-ledger") #+END_SRC This compiles and loads the *CL-Ledger* core, and also the textual parser package, for parsing standard Ledger text files. * Basic commands Once in the REPL, try out this command: #+BEGIN_SRC lisp (ledger:register-report "/path/to/cl-ledger/doc/sample.dat") #+END_SRC You should see a register printed representing the contents of /sample.dat/. You can constrain this report using keyword modifiers: #+BEGIN_SRC lisp (ledger:register-report "/path/to/cl-ledger/doc/sample.dat" :account "books") #+END_SRC *CL-Ledger* only reads the file on the first run, and if it changes, so feel free to repeat the same command several times even for large journal files. The following reports are supported: #+BEGIN_SRC lisp (ledger:register-report "/path/to/file" [OPTIONS]) (ledger:balance-report "/path/to/file" [OPTIONS]) (ledger:print-report "/path/to/file" [OPTIONS]) (ledger:equity-report "/path/to/file" [OPTIONS]) (ledger:sexp-report "/path/to/file" [OPTIONS]) (ledger:csv-report "/path/to/file" [OPTIONS]) (ledger:derive-entry "/path/to/file" [OPTIONS]) #+END_SRC As for /OPTIONS/, any of the following keyword pairs is allowed. There are some extra options allowed for ~derive-entry~, for which please see below. |-----------------------------+----------------------------------------------| | Keyword | Description | |-----------------------------+----------------------------------------------| | :account "REGEXP" | | |-----------------------------+----------------------------------------------| | :not-account "REGEXP" | | |-----------------------------+----------------------------------------------| | :payee "REGEXP" | | |-----------------------------+----------------------------------------------| | :not-payee "REGEXP" | | |-----------------------------+----------------------------------------------| | :note "REGEXP" | | |-----------------------------+----------------------------------------------| | :not-note "REGEXP" | | |-----------------------------+----------------------------------------------| | :begin "YYYY/MM/DD" | | |-----------------------------+----------------------------------------------| | :end "YYYY/MM/DD" | | |-----------------------------+----------------------------------------------| | :range "RANGE EXPRESSION" | a range expression, like "this month" | |-----------------------------+----------------------------------------------| | :period "PERIOD EXPRESSION" | like "every month this year" | |-----------------------------+----------------------------------------------| | :expr "VALUE-EXPR" | most Ledger 2.x value exprs allowed | |-----------------------------+----------------------------------------------| | :limit "VALUE-EXPR" | the same as 2.x's --limit or -l | | | this is a convenience alias for :expr | |-----------------------------+----------------------------------------------| | :only "VALUE-EXPR" | the same as 2.x's --only | |-----------------------------+----------------------------------------------| | :display "VALUE-EXPR" | the same as 2.x's -d or --display | |-----------------------------+----------------------------------------------| | :status KEYWORD | only report transactions whose status | | | is :CLEARED, :PENDING or :UNCLEARED | |-----------------------------+----------------------------------------------| | :sort "VALUE-EXPR" | sort based on VALUE-EXPR calculation | |-----------------------------+----------------------------------------------| | :no-total BOOL | don't show totals | |-----------------------------+----------------------------------------------| | :collapse BOOL | collapse multiline entries | |-----------------------------+----------------------------------------------| | :subtotal BOOL | group all transactions by account | |-----------------------------+----------------------------------------------| | :invert BOOL | negate all transaction values | | | (same as saying :amount "-a") | |-----------------------------+----------------------------------------------| | :related BOOL | show "other" transactions of each entry | |-----------------------------+----------------------------------------------| | :lots BOOL | show all commodity lot information | |-----------------------------+----------------------------------------------| | :lot-prices BOOL | show commodity lot prices | |-----------------------------+----------------------------------------------| | :lot-dates BOOL | show commodity lot dates | |-----------------------------+----------------------------------------------| | :lot-tags BOOL | show commodity lot tags | |-----------------------------+----------------------------------------------| | :amount "VALUE-EXPR" | use EXPR to display transaction amounts | |-----------------------------+----------------------------------------------| | :total "VALUE-EXPR" | use EXPR to display the running total | |-----------------------------+----------------------------------------------| | :set-amount "VALUE-EXPR" | instead of :amount, actually represent | | | the amount using EXPR (this is rarely | | | something you want to do) | |-----------------------------+----------------------------------------------| | :set-total "VALUE-EXPR" | same for the running total | |-----------------------------+----------------------------------------------| | :bridge-totals BOOL | if the running totals are not contiguous | | | create revaluation entries to fill gaps | |-----------------------------+----------------------------------------------| | :show OUTPUT-MODE | show amounts and totals using the given mode | |-----------------------------+----------------------------------------------| | :show :market | .. in terms of their market value | |-----------------------------+----------------------------------------------| | :show :basis | .. in terms of their basis cost | |-----------------------------+----------------------------------------------| Here's a quick table for translating *Ledger* 2.6.1 options into their corresponding *CL-Ledger* keywords: |-------------------+--------------------+-------------------| | Short option | Long option | CL-Ledger keyword | |-------------------+--------------------+-------------------| | -b ARG | --begin ARG | :begin ARG | |-------------------+--------------------+-------------------| | -e ARG | --end ARG | :end ARG | |-------------------+--------------------+-------------------| | -p ARG | --period ARG | :period ARG | |-------------------+--------------------+-------------------| | -l ARG | --limit ARG | :limit ARG | |-------------------+--------------------+-------------------| | | --only ARG | :only ARG | |-------------------+--------------------+-------------------| | -d ARG | --display ARG | :display ARG | |-------------------+--------------------+-------------------| | -n (for balances) | | :no-total t | |-------------------+--------------------+-------------------| | -n | --collapse | :collapse t | |-------------------+--------------------+-------------------| | -r | --related | :related t | |-------------------+--------------------+-------------------| | -s | --subtotal | :subtotal t | |-------------------+--------------------+-------------------| | -S EXPR | --sort ARG | :sort ARG | |-------------------+--------------------+-------------------| | -t EXPR | --sort-entries ARG | :sort-entries ARG | |-------------------+--------------------+-------------------| * Options to /derive-entry/ The reporting command ~derive-entry~ takes some special options. The /derive-entry/ report uses *CL-Ledger* to intelligently create a new entry for you. The possible keywords arguments are: - ~:date~ - ~:payee~ - ~:account~ - ~:balance-account~ - ~:amount~ - ~:append~ Except for ~:payee~, all of these keyword arguments are optional. Here is what they mean: |---------------------------+--------------------------------------------------| | Keyword | Description | |---------------------------+--------------------------------------------------| | :payee "REGEXP" | Find the most recent entry whose payee matches | | | REGEXP, and base the new entry derivation on | | | its details. If no matching entry can be found, | | | the payee of the newly created entry will | | | exactly match REGEXP. | |---------------------------+--------------------------------------------------| | :date "DATE-STRING" | The date of the new entry will be DATE-STRING, | | | otherwise it is today. | |---------------------------+--------------------------------------------------| | :account "REGEXP" | Set the first account line in the new entry to | | | be the most recently used account which matches | | | REGEXP. If no such account can be found, an | | | account named REGEXP is used. If no account is | | | specified, the account "Expenses:Unknown" is | | | used. | |---------------------------+--------------------------------------------------| | :balance-account "REGEXP" | Like :ACCOUNT, except this refers to the | | | account used for the second transaction in the | | | newly derived entry. If not specified, a | | | calculated "balance account" is looked for in | | | the matching entry; if this does not apply, the | | | journal's default account is used; if this does | | | not apply, the account "Assets:Unknown" is used. | |---------------------------+--------------------------------------------------| | :amount "VALUE-STRING" | The amount of the first transaction. If it has | | | no commodity, the correlated commodity from the | | | discovered entry is used. | |---------------------------+--------------------------------------------------| | :append BOOL | If non-NIL, the new entry is written to the same | | | journal where the matching entry was found (for | | | a binder that references many journals, this is | | | whichever file the discovered entry was in). | |---------------------------+--------------------------------------------------| Here are a few examples, using /sample.dat/ as a reference: #+BEGIN_SRC lisp (ledger:derive-entry "doc/sample.dat" :payee "book") => 2007/12/04 Book Store Expenses:Books $20.00 Liabilities:MasterCard (ledger:derive-entry :payee "book" :amount "$125") => 2007/12/04 Book Store Expenses:Books $125.00 Liabilities:MasterCard (ledger:derive-entry :payee "Hello World") => 2007/12/04 Hello World Expenses:Unknown Assets:Unknown (ledger:derive-entry :date "2004/01/01" :payee "Hello World") => 2004/01/01 Hello World Expenses:Unknown Assets:Unknown (ledger:derive-entry :payee "book" :account "equ") => 2007/12/04 Book Store Equity:Opening Balances $20.00 Liabilities:MasterCard (ledger:derive-entry :payee "book" :account "Who Knows") => 2007/12/04 Book Store Who Knows $20.00 Liabilities:MasterCard (ledger:derive-entry :payee "book" :balance-account "bank") => 2007/12/04 Book Store Expenses:Books $20.00 Assets:Bank:Checking (ledger:derive-entry :payee "book" :account "liab" :balance-account "bank") => 2007/12/04 Book Store Liabilities:MasterCard $-20.00 Assets:Bank:Checking (ledger:derive-entry :payee "book" :account "bank" :amount "50") => 2007/12/04 Book Store Assets:Bank:Checking $50.00 Liabilities:MasterCard (ledger:derive-entry :payee "book" :account "bank" :amount "$125") => 2007/12/04 Book Store Assets:Bank:Checking $125.00 Liabilities:MasterCard #+END_SRC * Date format The date format used in your journal file can be specified either using the ~*input-time-format*~ variable (by default: "%Y/%m/%d%| %H:%M:%S"), or by writing a ~F~ command directive at the beginning of the journal: #+BEGIN_SRC F %Y-%m-%d 2017-09-01 * Some payee Some account 45,18 EUR Some other account #+END_SRC The date format used in reports can be specified using the ~*output-time-format*~ variable (by default: "%Y/%m/%d"). * Binder caching After the call to ~read-binder~, the variable ~*last-binder*~ contains the contents of what was read. From that point forward, if no binder or string is passed to the reporting function, they will assume you wish to report on the contents of ~*last-binder*~. * Implementations status Here is how *CL-Ledger* stands up against current Lisp implementations: |----------------+---------------+--------------------------------| | Implementation | Version | Status | |----------------+---------------+--------------------------------| | SBCL | 1.3.21 | WORKS | | LispWorks | 5.02 Personal | WORKS | | Allegro CL | 10.0 Express | WORKS | | Clozure CL | 1.11 | WORKS | | OpenMCL | 2007-07-22 | Fails to compile LOCAL-TIME | | ECL | 2007-12-07 | WORKS | | ABCL | 1.5.0 | Fails to compile CL-LEDGER | | CLISP | 2.49 | Fails to compile CL-CONTAINERS | | CMUCL | 19d (2007-11) | Fails to compile PERIODS | | GCL | 2.6.7 || |----------------+---------------+--------------------------------| * Series For fans of the *Series* library, you can apply ~scan-transactions~ or ~scan-entries~ to a binder/account/journal/entry in order to produce a /series/ of the corresponding type. Example: #+BEGIN_SRC lisp (collect (ledger:scan-transactions (ledger:read-journal "doc/sample.dat"))) => [a list of all transactions, in sequence, within sample.dat] #+END_SRC * Command line You can build a standalone /cl-ledger/ binary using the /Makefile/: #+BEGIN_SRC shell make LISP=sbcl cl-ledger -f doc/sample.dat balance #+END_SRC You can also use the [[https://github.com/roswell/roswell][Roswell]] script /cl-ledger.ros/ in the /roswell/ directory to use *CL-Ledger* from the command line: #+BEGIN_SRC shell cl-ledger.ros -f doc/sample.dat balance #+END_SRC
Next: Modules, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The cl-ledger system: |
Guillaume LE VAILLANT <glv@posteo.net>
John Wiegley <jwiegley@gmail.com>
BSD-3
Double-entry accounting system.
4.0.0
cl-ledger.asd (file)
Modules are listed depth-first from the system components tree.
• The cl-ledger/core module: | ||
• The cl-ledger/transforms module: | ||
• The cl-ledger/reports module: | ||
• The cl-ledger/parsers module: | ||
• The cl-ledger/parsers/textual module: |
Next: The cl-ledger/transforms module, Previous: Modules, Up: Modules [Contents][Index]
cl-ledger (system)
core/
Next: The cl-ledger/reports module, Previous: The cl-ledger/core module, Up: Modules [Contents][Index]
core (module)
cl-ledger (system)
transforms/
Next: The cl-ledger/parsers module, Previous: The cl-ledger/transforms module, Up: Modules [Contents][Index]
transforms (module)
cl-ledger (system)
reports/
Next: The cl-ledger/parsers/textual module, Previous: The cl-ledger/reports module, Up: Modules [Contents][Index]
Previous: The cl-ledger/parsers module, Up: Modules [Contents][Index]
parsers (module)
parsers/textual/
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files: |
Next: The cl-ledger/core/packages<dot>lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
cl-ledger.asd
cl-ledger (system)
Next: The cl-ledger/core/types<dot>lisp file, Previous: The cl-ledger<dot>asd file, Up: Lisp files [Contents][Index]
Next: The cl-ledger/core/general<dot>lisp file, Previous: The cl-ledger/core/packages<dot>lisp file, Up: Lisp files [Contents][Index]
packages.lisp (file)
core (module)
core/types.lisp
Next: The cl-ledger/core/ledger<dot>lisp file, Previous: The cl-ledger/core/types<dot>lisp file, Up: Lisp files [Contents][Index]
types.lisp (file)
core (module)
core/general.lisp
Next: The cl-ledger/core/transaction<dot>lisp file, Previous: The cl-ledger/core/general<dot>lisp file, Up: Lisp files [Contents][Index]
general.lisp (file)
core (module)
core/ledger.lisp
Next: The cl-ledger/core/normalize<dot>lisp file, Previous: The cl-ledger/core/ledger<dot>lisp file, Up: Lisp files [Contents][Index]
ledger.lisp (file)
core (module)
core/transaction.lisp
Next: The cl-ledger/core/valexpr<dot>lisp file, Previous: The cl-ledger/core/transaction<dot>lisp file, Up: Lisp files [Contents][Index]
transaction.lisp (file)
core (module)
core/normalize.lisp
Next: The cl-ledger/core/emacs<dot>lisp file, Previous: The cl-ledger/core/normalize<dot>lisp file, Up: Lisp files [Contents][Index]
normalize.lisp (file)
core (module)
core/valexpr.lisp
Next: The cl-ledger/transforms/totals<dot>lisp file, Previous: The cl-ledger/core/valexpr<dot>lisp file, Up: Lisp files [Contents][Index]
valexpr.lisp (file)
core (module)
core/emacs.lisp
find-current-entity (function)
Next: The cl-ledger/transforms/filter<dot>lisp file, Previous: The cl-ledger/core/emacs<dot>lisp file, Up: Lisp files [Contents][Index]
transforms (module)
transforms/totals.lisp
calculate-totals (function)
Next: The cl-ledger/transforms/periodic<dot>lisp file, Previous: The cl-ledger/transforms/totals<dot>lisp file, Up: Lisp files [Contents][Index]
totals.lisp (file)
transforms (module)
transforms/filter.lisp
Next: The cl-ledger/transforms/sort<dot>lisp file, Previous: The cl-ledger/transforms/filter<dot>lisp file, Up: Lisp files [Contents][Index]
filter.lisp (file)
transforms (module)
transforms/periodic.lisp
Next: The cl-ledger/transforms/collapse<dot>lisp file, Previous: The cl-ledger/transforms/periodic<dot>lisp file, Up: Lisp files [Contents][Index]
periodic.lisp (file)
transforms (module)
transforms/sort.lisp
Next: The cl-ledger/transforms/invert<dot>lisp file, Previous: The cl-ledger/transforms/sort<dot>lisp file, Up: Lisp files [Contents][Index]
sort.lisp (file)
transforms (module)
transforms/collapse.lisp
collapse-entries (function)
Next: The cl-ledger/transforms/subtotal<dot>lisp file, Previous: The cl-ledger/transforms/collapse<dot>lisp file, Up: Lisp files [Contents][Index]
collapse.lisp (file)
transforms (module)
transforms/invert.lisp
invert-transactions (function)
Next: The cl-ledger/transforms/related<dot>lisp file, Previous: The cl-ledger/transforms/invert<dot>lisp file, Up: Lisp files [Contents][Index]
invert.lisp (file)
transforms (module)
transforms/subtotal.lisp
group-by-account (function)
Next: The cl-ledger/transforms/transform<dot>lisp file, Previous: The cl-ledger/transforms/subtotal<dot>lisp file, Up: Lisp files [Contents][Index]
subtotal.lisp (file)
transforms (module)
transforms/related.lisp
related-transactions (function)
Next: The cl-ledger/reports/report<dot>lisp file, Previous: The cl-ledger/transforms/related<dot>lisp file, Up: Lisp files [Contents][Index]
related.lisp (file)
transforms (module)
transforms/transform.lisp
apply-key-transforms (function)
Next: The cl-ledger/reports/register<dot>lisp file, Previous: The cl-ledger/transforms/transform<dot>lisp file, Up: Lisp files [Contents][Index]
reports (module)
reports/report.lisp
Next: The cl-ledger/reports/sexp<dot>lisp file, Previous: The cl-ledger/reports/report<dot>lisp file, Up: Lisp files [Contents][Index]
report.lisp (file)
reports (module)
reports/register.lisp
Next: The cl-ledger/reports/balance<dot>lisp file, Previous: The cl-ledger/reports/register<dot>lisp file, Up: Lisp files [Contents][Index]
register.lisp (file)
reports (module)
reports/sexp.lisp
Next: The cl-ledger/reports/print<dot>lisp file, Previous: The cl-ledger/reports/sexp<dot>lisp file, Up: Lisp files [Contents][Index]
sexp.lisp (file)
reports (module)
reports/balance.lisp
balance-report (function)
Next: The cl-ledger/reports/entry<dot>lisp file, Previous: The cl-ledger/reports/balance<dot>lisp file, Up: Lisp files [Contents][Index]
balance.lisp (file)
reports (module)
reports/print.lisp
Next: The cl-ledger/reports/csv<dot>lisp file, Previous: The cl-ledger/reports/print<dot>lisp file, Up: Lisp files [Contents][Index]
print.lisp (file)
reports (module)
reports/entry.lisp
derive-entry (function)
print-new-entry (function)
Next: The cl-ledger/parsers/textual/textual<dot>lisp file, Previous: The cl-ledger/reports/entry<dot>lisp file, Up: Lisp files [Contents][Index]
entry.lisp (file)
reports (module)
reports/csv.lisp
csv-report (function)
csv-reporter (function)
Next: The cl-ledger/parsers/textual/autoentry<dot>lisp file, Previous: The cl-ledger/reports/csv<dot>lisp file, Up: Lisp files [Contents][Index]
textual (module)
parsers/textual/textual.lisp
*directive-handlers* (special variable)
Next: The cl-ledger/parsers/textual/perentry<dot>lisp file, Previous: The cl-ledger/parsers/textual/textual<dot>lisp file, Up: Lisp files [Contents][Index]
textual (module)
parsers/textual/autoentry.lisp
Next: The cl-ledger/driver<dot>lisp file, Previous: The cl-ledger/parsers/textual/autoentry<dot>lisp file, Up: Lisp files [Contents][Index]
textual (module)
parsers/textual/perentry.lisp
Previous: The cl-ledger/parsers/textual/perentry<dot>lisp file, Up: Lisp files [Contents][Index]
parsers (module)
cl-ledger (system)
driver.lisp
process-command-line (function)
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The cl-ledger package: | ||
• The ledger-textual package: |
Next: The ledger-textual package, Previous: Packages, Up: Packages [Contents][Index]
packages.lisp (file)
ledger
Previous: The cl-ledger package, Up: Packages [Contents][Index]
textual.lisp (file)
*directive-handlers* (special variable)
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions: | ||
• Internal definitions: |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported special variables: | ||
• Exported macros: | ||
• Exported functions: | ||
• Exported generic functions: | ||
• Exported structures: | ||
• Exported classes: | ||
• Exported types: |
Next: Exported macros, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
ledger.lisp (file)
textual.lisp (file)
ledger.lisp (file)
normalize.lisp (file)
normalize.lisp (file)
*predicate-keywords* associates keywords that may be passed to
‘apply-filter’ or ‘parse-predicate-keywords’ with matcher functions that are
called to produce the closures used to ascertain the match.
The format of each member of this list is (KEYWORD TYPE FUNCTION).
For example, in the case of allowing :ACCOUNT to specify an account to match
against in a value expression predicate, the require type is either a string
specifying a regular expression, or an actual account object to compare
against. The function used to create the matcher is ‘account-matcher’,
which takes the string/account argument passed in after the :ACCOUNT
keyword, and returns a closure which can verify whether a transaction is
indeed in that account.
This means that every matcher function takes a value argument to base the match on, and returns a closure *that takes a transaction* for which it will ascertain that match.
filter.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
Next: Exported functions, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
ledger.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
Next: Exported generic functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
register.lisp (file)
print.lisp (file)
ledger.lisp (file)
filter.lisp (file)
balance.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
totals.lisp (file)
filter.lisp (file)
ledger.lisp (file)
types.lisp (file)
The DERIVE-ENTRY report uses Ledger to intelligently create a new entry for
you. The possible keywords arguments are:
:DATE <DATE-STRING>
:PAYEE <REGEXP>
:ACCOUNT <REGEXP>
:BALANCE-ACCOUNT <REGEXP>
:AMOUNT <VALUE-STRING>
:APPEND <BOOLEAN>
Except for :PAYEE, all of these keyword arguments are optional. Here is what
they mean:
:PAYEE REGEXP
Find the most recent entry whose payee matches REGEXP, and base the new
entry derivation on its details. If no matching entry can be found, the
payee of the newly created entry will exactly match REGEXP.
:DATE DATE-STRING
The date of the new entry will be DATE-STRING, otherwise it is today.
:ACCOUNT REGEXP
Set the first account line in the new entry to be the most recently used
account which matches REGEXP. If no such account can be found, an account
named REGEXP is used. If no account is specified, the account
"Expenses:Unknown" is used.
:BALANCE-ACCOUNT REGEXP
Like :ACCOUNT, except this refers to the account used for the second
transaction in the newly derived entry. If not specified, a calculated
"balance account" is looked for in the matching entry; if this does not
apply, the journal’s default account is used; if this does not apply, the
account "Assets:Unknown" is used.
:AMOUNT VALUE-STRING
The amount of the first transaction. If it has no commodity, the
correlated commodity from the discovered entry is used.
:APPEND BOOLEAN
If non-NIL, the new entry is written to the same journal where the
matching entry was found (for a binder that references many journals, this
is whichever file the discovered entry was in).
Here are a few examples, using sample.dat as a reference:
(ledger:derive-entry "doc/sample.dat" :payee "book")
=>
2007/12/04 Book Store
Expenses:Books $20.00
Liabilities:MasterCard
(ledger:derive-entry :payee "book" :amount "$125")
=>
2007/12/04 Book Store
Expenses:Books $125.00
Liabilities:MasterCard
(ledger:derive-entry :payee "Hello World")
=>
2007/12/04 Hello World
Expenses:Unknown
Assets:Unknown
(ledger:derive-entry :date "2004/01/01" :payee "Hello World")
=>
2004/01/01 Hello World
Expenses:Unknown
Assets:Unknown
(ledger:derive-entry :payee "book" :account "equ")
=>
2007/12/04 Book Store
Equity:Opening Balances $20.00
Liabilities:MasterCard
(ledger:derive-entry :payee "book" :account "Who Knows")
=>
2007/12/04 Book Store
Who Knows $20.00
Liabilities:MasterCard
(ledger:derive-entry :payee "book" :balance-account "bank")
=>
2007/12/04 Book Store
Expenses:Books $20.00
Assets:Bank:Checking
(ledger:derive-entry :payee "book" :account "liab"
:balance-account "bank")
=>
2007/12/04 Book Store
Liabilities:MasterCard $-20.00
Assets:Bank:Checking
(ledger:derive-entry :payee "book" :account "bank" :amount 50)
=>
2007/12/04 Book Store
Assets:Bank:Checking $50.00
Liabilities:MasterCard
(ledger:derive-entry :payee "book" :account "bank" :amount "$125")
=>
2007/12/04 Book Store
Assets:Bank:Checking $125.00
Liabilities:MasterCard
entry.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
print.lisp (file)
ledger.lisp (file)
emacs.lisp (file)
"Clump" the incoming stream of transactions into sublists, where adjacent transactions with the same parent entry become part of the same sublist.
Consider the following input stream, with the first letter identifying the
entry and the second identifying the member transaction:
(A-X A-Y A-Z B-X B-Y C-X)
Given this input, the resulting list from ‘group-transactions-by-entry’ will
be:
((A-X A-Y A-Z) (B-X B-Y) (C-X))
transaction.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
normalize.lisp (file)
ledger.lisp (file)
filter.lisp (file)
valexpr.lisp (file)
print.lisp (file)
print.lisp (file)
print.lisp (file)
driver.lisp (file)
Read in a textual Ledger journal from the given PATH. The result is of type JOURNAL.
ledger.lisp (file)
valexpr.lisp (file)
This is a function for easily print register reports.
A typical usage might be:
(ledger:register-report "/path/to/ledger.dat"
:begin "2007/08/26" :account "food")
register.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
transaction.lisp (file)
(setf xact-account) (setf expander)
transaction.lisp (file)
xact-account (function)
set-xact-account (function)
transaction.lisp (file)
transaction.lisp (file)
(setf xact-amount) (setf expander)
transaction.lisp (file)
xact-amount (function)
set-xact-amount (function)
transaction.lisp (file)
(setf xact-amount*) (setf expander)
transaction.lisp (file)
xact-amount* (function)
set-xact-amount* (function)
transaction.lisp (file)
transaction.lisp (file)
(setf xact-cost) (setf expander)
transaction.lisp (file)
xact-cost (function)
set-xact-cost (function)
transaction.lisp (file)
(setf xact-data) (setf expander)
transaction.lisp (file)
xact-data (function)
set-xact-data (function)
transaction.lisp (file)
transaction.lisp (file)
(setf xact-effective-date) (setf expander)
transaction.lisp (file)
xact-effective-date (function)
set-xact-effective-date (function)
transaction.lisp (file)
(setf xact-entry) (setf expander)
transaction.lisp (file)
xact-entry (function)
set-xact-entry (function)
transaction.lisp (file)
(setf xact-must-balance-p) (setf expander)
transaction.lisp (file)
xact-must-balance-p (function)
set-xact-must-balance-p (function)
transaction.lisp (file)
(setf xact-note) (setf expander)
transaction.lisp (file)
xact-note (function)
set-xact-note (function)
transaction.lisp (file)
transaction.lisp (file)
(setf xact-position) (setf expander)
transaction.lisp (file)
xact-position (function)
set-xact-position (function)
transaction.lisp (file)
(setf xact-status) (setf expander)
transaction.lisp (file)
xact-status (function)
set-xact-status (function)
transaction.lisp (file)
transaction.lisp (file)
(setf xact-value) (setf expander)
transaction.lisp (file)
xact-value (function)
transaction.lisp (file)
(setf xact-virtualp) (setf expander)
transaction.lisp (file)
xact-virtualp (function)
set-xact-virtualp (function)
Next: Exported structures, Previous: Exported functions, Up: Exported definitions [Contents][Index]
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
types.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
types.lisp (file)
ledger.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
types.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
types.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
types.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
Next: Exported classes, Previous: Exported generic functions, Up: Exported definitions [Contents][Index]
types.lisp (file)
structure-object (structure)
item-position-begin-line (function)
(setf item-position-begin-line) (function)
item-position-end-line (function)
(setf item-position-end-line) (function)
item-position-source (function)
(setf item-position-source) (function)
types.lisp (file)
structure-object (structure)
get-xact-entry (function)
(setf get-xact-entry) (function)
(or periods:fixed-time null)
get-xact-actual-date (function)
(setf get-xact-actual-date) (function)
(or periods:fixed-time null)
get-xact-effective-date (function)
(setf get-xact-effective-date) (function)
cl-ledger:item-status
:uncleared
get-xact-status (function)
(setf get-xact-status) (function)
get-xact-account (function)
(setf get-xact-account) (function)
(or cambl:value cl-ledger::value-expr null)
get-xact-amount (function)
(setf get-xact-amount) (function)
(or cambl:value cl-ledger::value-expr null)
get-xact-cost (function)
(setf get-xact-cost) (function)
(or string null)
get-xact-note (function)
(setf get-xact-note) (function)
boolean
get-xact-virtualp (function)
(setf get-xact-virtualp) (function)
boolean
get-xact-generatedp (function)
(setf get-xact-generatedp) (function)
boolean
get-xact-calculatedp (function)
(setf get-xact-calculatedp) (function)
boolean
t
get-xact-must-balance-p (function)
(setf get-xact-must-balance-p) (function)
get-xact-position (function)
(setf get-xact-position) (function)
get-xact-data (function)
(setf get-xact-data) (function)
Next: Exported types, Previous: Exported structures, Up: Exported definitions [Contents][Index]
types.lisp (file)
standard-object (class)
:parent
account-parent (generic function)
(setf account-parent) (generic function)
(or hash-table null)
:children
account-children (generic function)
(setf account-children) (generic function)
string
:name
account-name (generic function)
(setf account-name) (generic function)
string
:fullname
account-fullname (generic function)
(setf account-fullname) (generic function)
:data
account-data (generic function)
(setf account-data) (generic function)
types.lisp (file)
standard-object (class)
cambl:commodity-pool
:commodity-pool
binder-commodity-pool (generic function)
(setf binder-commodity-pool) (generic function)
cl-ledger:account
:root-account
(make-instance (quote cl-ledger:account) :name "")
binder-root-account (generic function)
(setf binder-root-account) (generic function)
:journals
binder-journals (generic function)
(setf binder-journals) (generic function)
:data
binder-data (generic function)
(setf binder-data) (generic function)
types.lisp (file)
standard-object (class)
:journal
entry-journal (generic function)
(setf entry-journal) (generic function)
(or periods:fixed-time null)
:actual-date
entry-actual-date (generic function)
(setf entry-actual-date) (generic function)
(or periods:fixed-time null)
:effective-date
entry-effective-date (generic function)
(setf entry-effective-date) (generic function)
cl-ledger:item-status
:status
:uncleared
entry-status (generic function)
(setf entry-status) (generic function)
(or string null)
:code
entry-code (generic function)
(setf entry-code) (generic function)
(or string null)
:payee
entry-payee (generic function)
(setf entry-payee) (generic function)
(or string null)
:note
entry-note (generic function)
(setf entry-note) (generic function)
:transactions
entry-transactions (generic function)
(setf entry-transactions) (generic function)
:position
entry-position (generic function)
(setf entry-position) (generic function)
:normalizedp
entry-normalizedp (generic function)
(setf entry-normalizedp) (generic function)
:data
entry-data (generic function)
(setf entry-data) (generic function)
types.lisp (file)
standard-object (class)
:binder
journal-binder (generic function)
(setf journal-binder) (generic function)
journal-contents (generic function)
(setf journal-contents) (generic function)
journal-last-content-cell (generic function)
(setf journal-last-content-cell) (generic function)
(or string null)
journal-date-format (generic function)
(setf journal-date-format) (generic function)
(or integer null)
journal-default-year (generic function)
(setf journal-default-year) (generic function)
(or cl-ledger:account null)
journal-default-account (generic function)
(setf journal-default-account) (generic function)
(or pathname null)
:source-path
journal-source (generic function)
(setf journal-source) (generic function)
(or integer null)
:read-date
journal-read-date (generic function)
(setf journal-read-date) (generic function)
:data
journal-data (generic function)
(setf journal-data) (generic function)
Previous: Exported classes, Up: Exported definitions [Contents][Index]
types.lisp (file)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal special variables: | ||
• Internal macros: | ||
• Internal functions: | ||
• Internal generic functions: | ||
• Internal structures: | ||
• Internal classes: |
Next: Internal macros, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
textual.lisp (file)
textual.lisp (file)
textual.lisp (file)
textual.lisp (file)
textual.lisp (file)
textual.lisp (file)
valexpr.lisp (file)
valexpr.lisp (file)
valexpr.lisp (file)
valexpr.lisp (file)
valexpr.lisp (file)
valexpr.lisp (file)
Next: Internal functions, Previous: Internal special variables, Up: Internal definitions [Contents][Index]
general.lisp (file)
general.lisp (file)
A simple macro for writing inline recursive code.
(do-recurse this ((x 10))
(if (= x 0)
0
(+ x (this (1- x))))) => 55
general.lisp (file)
general.lisp (file)
valexpr.lisp (file)
general.lisp (file)
Creates a wrapper around BODY which binds VAR to a temporary journal.
ledger.lisp (file)
Next: Internal generic functions, Previous: Internal macros, Up: Internal definitions [Contents][Index]
filter.lisp (file)
ledger.lisp (file)
ledger.lisp (file)
(setf account-value) (setf expander)
ledger.lisp (file)
account-value (function)
report.lisp (file)
ledger.lisp (file)
autoentry.lisp (file)
transform.lisp (file)
valexpr.lisp (file)
valexpr.lisp (file)
balance.lisp (file)
balance.lisp (file)
report.lisp (file)
ledger.lisp (file)
types.lisp (file)
totals.lisp (file)
totals.lisp (file)
Call a group of functions by chaining, passing all keyword args.
This function allows you to call a set of functions like this:
(chain-functions arg #’foo :foo 10 :foo2 20
#’bar :bar 30)
This is equivalent to:
(bar (foo arg :foo 10 :foo2 20) :bar 30)
general.lisp (file)
collapse.lisp (file)
driver.lisp (file)
ledger.lisp (file)
types.lisp (file)
types.lisp (file)
totals.lisp (file)
driver.lisp (file)
filter.lisp (file)
report.lisp (file)
filter.lisp (file)
totals.lisp (file)
totals.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
subtotal.lisp (file)
periodic.lisp (file)
general.lisp (file)
valexpr.lisp (file)
general.lisp (file)
valexpr.lisp (file)
invert.lisp (file)
types.lisp (file)
textual.lisp (file)
textual.lisp (file)
textual.lisp (file)
textual.lisp (file)
textual.lisp (file)
general.lisp (file)
driver.lisp (file)
general.lisp (file)
register.lisp (file)
filter.lisp (file)
filter.lisp (file)
filter.lisp (file)
periodic.lisp (file)
report.lisp (file)
entry.lisp (file)
print.lisp (file)
transaction.lisp (file)
print.lisp (file)
valexpr.lisp (file)
valexpr.lisp (file)
autoentry.lisp (file)
valexpr.lisp (file)
valexpr.lisp (file)
valexpr.lisp (file)
valexpr.lisp (file)
perentry.lisp (file)
Read in the header line for the entry, which has the syntax:
(DATE(=DATE)?)( (*|!))?( (((.+?))))? (.+)(:spacer:;(.+))?
:spacer: means: two spaces, a tab, or a space and a tab, followed by any
amount of whitespace.
The groups identified in this regular expression (found in the scanner
*entry-heading-scanner*) have these meanings:
1 - The actual date of the entry.
2 - The (optional) effective date of the entry.
4 - The (optional) status of the entry: *=cleared, !=pending.
6 - The (optional) "code" for the entry; has no meaning to Ledger.
7 - The payee or description of the entry.
9 - A comment giving further details about the entry.
textual.lisp (file)
textual.lisp (file)
textual.lisp (file)
valexpr.lisp (file)
valexpr.lisp (file)
filter.lisp (file)
driver.lisp (file)
register.lisp (file)
related.lisp (file)
balance.lisp (file)
ledger.lisp (file)
transaction.lisp (file)
(setf xact-account) (setf expander)
transaction.lisp (file)
transaction.lisp (file)
(setf xact-amount) (setf expander)
transaction.lisp (file)
(setf xact-amount*) (setf expander)
transaction.lisp (file)
(setf xact-calculatedp) (setf expander)
transaction.lisp (file)
(setf xact-cost) (setf expander)
transaction.lisp (file)
(setf xact-data) (setf expander)
transaction.lisp (file)
(setf xact-effective-date) (setf expander)
transaction.lisp (file)
(setf xact-entry) (setf expander)
transaction.lisp (file)
(setf xact-generatedp) (setf expander)
transaction.lisp (file)
(setf xact-must-balance-p) (setf expander)
transaction.lisp (file)
(setf xact-note) (setf expander)
transaction.lisp (file)
(setf xact-position) (setf expander)
transaction.lisp (file)
(setf xact-status) (setf expander)
transaction.lisp (file)
(setf xact-virtualp) (setf expander)
Returns a list of substrings of string
divided by ONE char each.
Note: Two consecutive chars will be seen as
if there were an empty string between them.
general.lisp (file)
filter.lisp (file)
filter.lisp (file)
types.lisp (file)
report.lisp (file)
report.lisp (file)
valexpr.lisp (file)
filter.lisp (file)
transaction.lisp (file)
transaction.lisp (file)
(setf xact-calculatedp) (setf expander)
transaction.lisp (file)
xact-calculatedp (function)
set-xact-calculatedp (function)
transaction.lisp (file)
transaction.lisp (file)
transaction.lisp (file)
transaction.lisp (file)
(setf xact-generatedp) (setf expander)
transaction.lisp (file)
xact-generatedp (function)
set-xact-generatedp (function)
transaction.lisp (file)
Next: Internal structures, Previous: Internal functions, Up: Internal definitions [Contents][Index]
automatically generated reader method
autoentry.lisp (file)
automatically generated writer method
autoentry.lisp (file)
automatically generated reader method
autoentry.lisp (file)
automatically generated writer method
autoentry.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
perentry.lisp (file)
automatically generated writer method
perentry.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
Next: Internal classes, Previous: Internal generic functions, Up: Internal definitions [Contents][Index]
types.lisp (file)
structure-object (structure)
string
value-expr-string (function)
(setf value-expr-string) (function)
function
value-expr-function (function)
(setf value-expr-function) (function)
Previous: Internal structures, Up: Internal definitions [Contents][Index]
autoentry.lisp (file)
entry (class)
string
:predicate-expr
auto-entry-predicate-expr (generic function)
(setf auto-entry-predicate-expr) (generic function)
function
:predicate
auto-entry-predicate (generic function)
(setf auto-entry-predicate) (generic function)
perentry.lisp (file)
entry (class)
:period
entry-period (generic function)
(setf entry-period) (generic function)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index: | ||
• Function index: | ||
• Variable index: | ||
• Data type index: |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | C F L M |
---|
Jump to: | C F L M |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | (
A B C D E F G I J L M N P R S T V W X |
---|
Jump to: | (
A B C D E F G I J L M N P R S T V W X |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | *
A B C D E F G J L M N P R S T V |
---|
Jump to: | *
A B C D E F G J L M N P R S T V |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | A B C E I J L P S T V |
---|
Jump to: | A B C E I J L P S T V |
---|