diff options
Diffstat (limited to 'doc/ledger3.texi')
-rw-r--r-- | doc/ledger3.texi | 3304 |
1 files changed, 1827 insertions, 1477 deletions
diff --git a/doc/ledger3.texi b/doc/ledger3.texi index d680bc5a..cd1b59a8 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -1,11 +1,7 @@ -\input texinfo @c -*-texinfo-*- +\input texinfo @c -*-texinfo-*- @setfilename ledger3.info @settitle Ledger: Command-Line Accounting -@c Define a new index for options. -@defcodeindex op -@c Put options in function index. -@syncodeindex op fn @c Before release, run C-u C-c C-u C-a (texinfo-all-menus-update with @c a prefix arg). This updates the node pointers, which texinfmt.el @@ -186,17 +182,17 @@ simply moved from one account to another in both cases. This is the basis of double-entry accounting: money never pops in or out of existence; it is always a posting from one account to another. -Keeping a general journal is the same as keeping two separate journals: -One for Pacific Bell and one for Checking. In that case, each time a -payment is written into one, you write a corresponding withdrawal into -the other. This makes it easier to write in a ``running balance'', -since you don't have to look back at the last time the account was -referenced---but it also means having a lot of journal books, if you -deal with multiple accounts. +Keeping a general journal is the same as keeping two separate +journals: One for Pacific Bell and one for Checking. In that case, +each time a payment is written into one, you write a corresponding +withdrawal into the other. This makes it easier to write in +a ``running balance'', since you don't have to look back at the last +time the account was referenced---but it also means having a lot of +journal books, if you deal with multiple accounts. @cindex account, meaning of @cindex meaning of account -Here is a good place for an aside on the use of the word `account'. +Here is a good place for an aside on the use of the word ``account''. Most private people consider an account to be something that holds money at an institution for them. Ledger uses a more general definition of the word. An account is anywhere money can go. Other @@ -206,11 +202,11 @@ at Whole Foods Markets you might assign the transactions like this @smallexample 2011/03/15 Trader Joe's - Expenses:Groceries $100.00 - Assets:Checking + Expenses:Groceries $100.00 + Assets:Checking 2011/03/15 Whole Food Market - Expenses:Groceries $75.00 - Assets:Checking + Expenses:Groceries $75.00 + Assets:Checking @end smallexample In both cases the money goes to the ``Groceries'' account, even though @@ -234,8 +230,8 @@ above, formatted as the Ledger program wishes to see them: @smallexample 2004/09/29 Pacific Bell - Expenses:Pacific Bell $23.00 - Assets:Checking + Expenses:Pacific Bell $23.00 + Assets:Checking @end smallexample The account balances and registers in this file, if saved as @@ -264,7 +260,7 @@ To build and install once you have these libraries on your system, enter these commands: @smallexample -./configure && make install +$ ./configure && make install @end smallexample @node Getting Help, , Building the Program, Introduction to Ledger @@ -319,22 +315,23 @@ If you would rather start with your own journal right away please Please note that as a command line program, Ledger is controlled from your shell. There are several different command shells that all behave slightly differently with respect to some special characters. -In particular, the BASH shell will interpret $ signs differently than -ledger and they must be escaped to reach the actual program. Another -example is zsh, which will interpret ^ differently than ledger -expects. In all cases that follow you should take that into account -when entering the command line arguments given. There are too many -variations between shells to give concrete examples for each. +In particular, the BASH shell will interpret @samp{$} signs +differently than ledger and they must be escaped to reach the actual +program. Another example is zsh, which will interpret @samp{^} +differently than ledger expects. In all cases that follow you should +take that into account when entering the command line arguments given. +There are too many variations between shells to give concrete examples +for each. @node Balance Report, Register Report, Run Some Reports, Run Some Reports @subsection Balance Report @cindex balance report -@findex balance (bal) +@findex balance To find the balances of all of your accounts, run this command: @smallexample -ledger -f drewr3.dat balance +$ ledger -f drewr3.dat balance @end smallexample Ledger will generate: @@ -385,12 +382,12 @@ $ ledger -f drewr3.dat balance Assets Liabilities @node Register Report, Cleared Report, Balance Report, Run Some Reports @subsection Register Report @cindex register report -@findex register (reg) +@findex register To show all transactions and a running total: @smallexample -ledger -f drewr3.dat register +$ ledger -f drewr3.dat register @end smallexample @noindent @@ -458,7 +455,7 @@ $ ledger -f drewr3.dat balance Groceries @noindent If you would like to find transaction to only a certain payee use -@code{payee} or @@: +@samp{payee} or @samp{@@}: @smallexample $ ledger -f drewr3.dat register payee "Organic" @@ -518,7 +515,8 @@ shows the ``cleared'' balance. Using ledger under the windows command shell has one significant limitation. CMD.exe is limited to standard ASCII characters and as -such cannot display any currency symbols other than dollar signs ($). +such cannot display any currency symbols other than dollar signs +@samp{$}. @node Principles of Accounting, Keeping a Journal, Ledger Tutorial, Top @chapter Principles of Accounting with Ledger @@ -630,17 +628,17 @@ it: Liabilities:MasterCard @end smallexample -The Dining account balance now shows $25 spent on Dining, and a -corresponding $25 owed on the MasterCard---and therefore shown as +The Dining account balance now shows $25 spent on Dining, and +a corresponding $25 owed on the MasterCard---and therefore shown as $-25.00. The MasterCard liability shows up as negative because it offsets the value of your assets. The combined total of your Assets and Liabilities is your net worth. So to see your current net worth, use this command: -@example -ledger balance ^assets ^liabilities -@end example +@smallexample +$ ledger balance ^assets ^liabilities +@end smallexample In a similar vein, your Income accounts show up negative, because they transfer money @emph{from} an account in order to increase your @@ -650,18 +648,18 @@ flow. A positive cash flow means you are spending more than you make, since income is always a negative figure. To see your current cash flow, use this command: -@example -ledger balance ^income ^expenses -@end example +@smallexample +$ ledger balance ^income ^expenses +@end smallexample Another common question to ask of your expenses is: How much do I spend each month on X? Ledger provides a simple way of displaying monthly totals for any account. Here is an example that summarizes your monthly automobile expenses: -@example -ledger -M register expenses:auto -@end example +@smallexample +$ ledger -M register expenses:auto +@end smallexample This assumes, of course, that you use account names like @code{Expenses:Auto:Gas} and @code{Expenses:Auto:Repair}. @@ -833,13 +831,13 @@ currencies, while non-joined symbols appearing after the amount refer to commodities. Here are some valid currency and commodity specifiers: -@example +@smallexample $20.00 ; currency: twenty US dollars 40 AAPL ; commodity: 40 shares of Apple stock 60 DM ; currency: 60 Deutsch Mark £50 ; currency: 50 British pounds 50 EUR ; currency: 50 Euros (or use appropriate symbol) -@end example +@end smallexample Ledger will examine the first use of any commodity to determine how that commodity should be printed on reports. It pays attention to @@ -878,13 +876,15 @@ P 2004/06/21 02:18:02 AAPL $32.91 P 2004/06/21 02:18:02 AU $400.00 @end smallexample +@findex --price-db @var{FILE} +@findex --market Specify the price history to use with the @code{--price-db} option, -with the @code{-V} option to report in terms of current market -value: +with the @code{-V (--market)} option to report in terms of current +market value: -@example -ledger --price-db prices.db -V balance brokerage -@end example +@smallexample +$ ledger --price-db prices.db -V balance brokerage +@end smallexample The balance for your brokerage account will be reported in US dollars, since the prices database uses that currency. @@ -898,9 +898,9 @@ you had $5000 in your checking account, and for whatever reason you wanted to know many ounces of gold that would buy, in terms of the current price of gold: -@example -ledger -T "@{1 AU@}*(O/P@{1 AU@})" balance checking -@end example +@smallexample +$ ledger -T "@{1 AU@}*(O/P@{1 AU@})" balance checking +@end smallexample Although the total expression appears complex, it is simply saying that the reported total should be in multiples of AU units, where the @@ -983,7 +983,7 @@ C 1.00 Gb = 1024 Mb C 1.00 Tb = 1024 Gb @end smallexample -Each of these definitions correlates a commodity (such as @code{Kb}) +Each of these definitions correlates a commodity (such as @samp{Kb}) and a default precision, with a certain quantity of another commodity. In the above example, kilobytes are reported with two decimal places of precision and each kilobyte is equal to 1024 bytes. @@ -1136,7 +1136,7 @@ Savings? Traditional finance packages require that the money reside in only one place. But there are really two ``views'' of the data: from the -account point of view and from the fund point of view --- yet both sets +account point of view and from the fund point of view---yet both sets should reflect the same overall expenses and cash flow. It's simply where the money resides that differs. @@ -1172,16 +1172,17 @@ funds. In this case, you will likely want to mask out your @code{Assets} account, because otherwise the balance won't make much sense: -@example -ledger bal -^Assets -@end example +@smallexample +$ ledger bal -^Assets +@end smallexample +@findex --real If the @code{--real} option is used, the report will be in terms of the real accounts: -@example -ledger --real bal -@end example +@smallexample +$ ledger --real bal +@end smallexample If more asset accounts are needed as the source of a posting, just list them as you would normally, for example: @@ -1214,6 +1215,8 @@ Note how the accounts now relate only to the real accounts, and any balance or registers reports will reflect this. That the transactions relate to a particular fund is kept only in the code. +@findex --code-as-payee +@findex --by-payee How does this become a fund report? By using the @code{--code-as-payee} option, you can generate a register report where the payee for each posting shows the code. Alone, this is @@ -1223,14 +1226,14 @@ postings related to a specific fund. So, to see the current monetary balances of all funds, the command would be: @smallexample -ledger --code-as-payee -P reg ^Assets +$ ledger --code-as-payee -P reg ^Assets @end smallexample Or to see a particular funds expenses, the @code{School} fund in this case: @smallexample -ledger --code-as-payee -P reg ^Expenses @@School +$ ledger --code-as-payee -P reg ^Expenses @@School @end smallexample Both approaches yield different kinds of flexibility, depending on how @@ -1344,16 +1347,16 @@ your opening balance entry could look like this: @smallexample 2011/01/01 * Opening Balance - Assets:Joint Checking $800.14 - Assets:Other Checking $63.44 - Assets:Savings $2805.54 - Assets:Investments:401K:Deferred 100.0000 VIFSX @@ $80.5227 - Assets:Investments:401K:Matching 50.0000 VIFSX @@ $83.7015 - Assets:Investments:IRA 250.0000 VTHRX @@ $20.5324 - Liabilities:Mortgage $-175634.88 - Liabilities:Car Loan $-3494.26 - Liabilities:Visa -$1762.44 - Equity:Opening Balances + Assets:Joint Checking $800.14 + Assets:Other Checking $63.44 + Assets:Savings $2805.54 + Assets:Investments:401K:Deferred 100.0000 VIFSX @@ $80.5227 + Assets:Investments:401K:Matching 50.0000 VIFSX @@ $83.7015 + Assets:Investments:IRA 250.0000 VTHRX @@ $20.5324 + Liabilities:Mortgage $-175634.88 + Liabilities:Car Loan $-3494.26 + Liabilities:Visa -$1762.44 + Equity:Opening Balances @end smallexample There is nothing special about the name ``Opening Balances'' as the @@ -1394,17 +1397,16 @@ Expenses:Food:Hamburgers and Fries @section Commenting on your Journal @cindex comments, characters -Comments are generally started using a ';'. However, in order to +Comments are generally started using a @samp{;}. However, in order to increase compatibility with other text manipulation programs and methods four additional comment characters are valid if used at the -beginning of a line: @code{#}, @code{|}, and @code{*} and @code{%}. +beginning of a line: @samp{#}, @samp{|}, and @samp{*} and @samp{%}. @cindex block comments @cindex comments, block Block comments can be made by use @code{@!comment} ... @code{@!end comment} @smallexample - ; This is a single line comment, # and this, % and this, @@ -1425,17 +1427,17 @@ There are several forms of comments within a transaction, for example: ; output from 'print' or 'output' 2011/12/11 Something Sweet - ; German Chocolate Cake - ; :Broke Diet: - Expenses:Food $10.00 ; Friends: The gang - Assets:Credit Union:Checking + ; German Chocolate Cake + ; :Broke Diet: + Expenses:Food $10.00 ; Friends: The gang + Assets:Credit Union:Checking @end smallexample @noindent The first comment is global and Ledger will not attach it to any specific transactions. The comments within the transaction must all -start with `;'s and are preserved as part of the transaction. The -`:'s indicate meta-data and tags (@pxref{Metadata}). +start with @samp{;} and are preserved as part of the transaction. The +@samp{:} indicates meta-data and tags (@pxref{Metadata}). @node Currency and Commodities, Keeping it Consistent, Commenting on your journal, Keeping a Journal @section Currency and Commodities @@ -1497,7 +1499,7 @@ $ ledger -f example.dat bal The top two lines show my current assets as $-66.00 in checking (in this very short example I didn't establish opening an opening balance -for the checking account) and E15.00. After spending on dinner i have +for the checking account) and E15.00. After spending on dinner I have E15.00 in my wallet. The bottom line balances to zero, but is shown in two lines since we haven't told ledger to convert commodities. @@ -1513,16 +1515,16 @@ in two lines since we haven't told ledger to convert commodities. Commodity names can have any character, including white-space. However, if you include white-space or numeric characters the -commodity name must be enclosed in double quotes: +commodity name must be enclosed in double quotes @samp{"}: @smallexample -1999/06/09 ! Achat - Actif:SG PEE STK 49.957 "Arcancia Equilibre 454" - Actif:SG PEE STK $-234.90 - -2000/12/08 ! Achat - Actif:SG PEE STK 215.796 "Arcancia Equilibre 455" - Actif:SG PEE STK $-10742.54 +1999/06/09 ! Achat + Actif:SG PEE STK 49.957 "Arcancia Équilibre 454" + Actif:SG PEE STK $-234.90 + +2000/12/08 ! Achat + Actif:SG PEE STK 215.796 "Arcancia Équilibre 455" + Actif:SG PEE STK $-10742.54 @end smallexample @node Buying and Selling Stock, Fixing Lot Prices, Naming Commodities, Currency and Commodities @@ -1531,35 +1533,36 @@ commodity name must be enclosed in double quotes: Buying stock is a typical example that many will use that involves multiple commodities in the same transaction. The type of the share -(AAPL for Apple Inc.) and the share purchase price in the currency +(AAPL for Apple Inc.) and the share purchase price in the currency unit you made the purchase in ($ for AAPL). Yes, the typical convention is as follows: @smallexample - 2004/05/01 Stock purchase - Assets:Broker 50 AAPL @@ $30.00 - Expenses:Broker:Commissions $19.95 - Assets:Broker $-1,500.00 +2004/05/01 Stock purchase + Assets:Broker 50 AAPL @@ $30.00 + Expenses:Broker:Commissions $19.95 + Assets:Broker $-1,500.00 @end smallexample This assumes you have a brokerage account that is capable of managed both liquid and commodity assets. Now, on the day of the sale: @smallexample - 2005/08/01 Stock sale - Assets:Broker -50 APPL @{$30.00@} @@ $50.00 - Expenses:Broker:Commissions $19.95 - Income:Capital Gains $-1,000.00 - Assets:Broker $2,500.00 +2005/08/01 Stock sale + Assets:Broker -50 APPL @{$30.00@} @@ $50.00 + Expenses:Broker:Commissions $19.95 + Income:Capital Gains $-1,000.00 + Assets:Broker $2,500.00 @end smallexample @noindent You can, of course, elide the amount of the last posting. It is there for clarity's sake. -The @{$30.00@} is a lot price. You can also use a lot date, -[2004/05/01], or both, in case you have several lots of the same -price/date and your taxation model is based on longest-held-first. +The @samp{@{$30.00@}} is a lot price. You can also use a lot date, +@samp{[2004/05/01]}, or both, in case you have several lots of the +same price/date and your taxation model is based on +longest-held-first. @node Fixing Lot Prices, Complete control over commodity pricing, Buying and Selling Stock, Currency and Commodities @subsection Fixing Lot Prices @@ -1575,90 +1578,94 @@ can fix the per-unit price of a commodity. For example, say you buy 10 gallons of gas at $1.20. In future ``value'' reports, you don't want these gallons reported in terms of today's price, but rather the price when you bought it. At the same -time, you also want other kinds of commodities --- like stocks --- +time, you also want other kinds of commodities---like stocks--- reported in terms of today's price. This is supported as follows: @smallexample - 2009/01/01 Shell - Expenses:Gasoline 11 GAL @{=$2.299@} - Assets:Checking +2009/01/01 Shell + Expenses:Gasoline 11 GAL @{=$2.299@} + Assets:Checking @end smallexample -This transaction actually introduces a new commodity, ``GAL @{=$2.29@}'', -whose market value disregards any future changes in the price of -gasoline. +This transaction actually introduces a new commodity, @samp{GAL +@{=$2.29@}}, whose market value disregards any future changes in the +price of gasoline. If you do not want price fixing, you can specify this same transaction in one of two ways, both equivalent (note the lack of the equal sign from the transaction above): @smallexample - 2009/01/01 Shell - Expenses:Gasoline 11 GAL @{$2.299@} - Assets:Checking +2009/01/01 Shell + Expenses:Gasoline 11 GAL @{$2.299@} + Assets:Checking - 2009/01/01 Shell - Expenses:Gasoline 11 GAL @@ $2.299 - Assets:Checking +2009/01/01 Shell + Expenses:Gasoline 11 GAL @@ $2.299 + Assets:Checking @end smallexample There is no difference in meaning between these two forms. Why do both exist, you ask? To support things like this: @smallexample - 2009/01/01 Shell - Expenses:Gasoline 11 GAL @{=$2.299@} @@ $2.30 - Assets:Checking +2009/01/01 Shell + Expenses:Gasoline 11 GAL @{=$2.299@} @@ $2.30 + Assets:Checking @end smallexample This transaction says that you bought 11 gallons priced at $2.299 per -gallon at a @strong{cost to you} of $2.30 per gallon. Ledger +gallon at a @emph{cost to you} of $2.30 per gallon. Ledger auto-generates a balance posting in this case to Equity:Capital Losses to reflect the 1.1 cent difference, which is then balanced by Assets:Checking because its amount is null. @node Complete control over commodity pricing, , Fixing Lot Prices, Currency and Commodities @subsection Complete control over commodity pricing +@findex --market +@findex --exchange @var{COMMODITY} Ledger allows you to have very detailed control over how your commodities are valued. You can fine tune the results given using the -@code{--market} or @code{--exchange} options. There are now several -points of interception, you can specify the valuation method: +@code{--market} or @code{--exchange @var{COMMODITY}} options. There +are now several points of interception, you can specify the valuation +method: + @enumerate - @item on a commodity itself - @item on a posting, via metadata (affect is largely the same as #1) - @item on an xact, which then applies to all postings in that xact - @item on any posting via an automated transaction - @item on a per-account basis - @item on a per-commodity basis - @item by changing the journal default of @code{market} +@item on a commodity itself +@item on a posting, via metadata (affect is largely the same as #1) +@item on an xact, which then applies to all postings in that xact +@item on any posting via an automated transaction +@item on a per-account basis +@item on a per-commodity basis +@item by changing the journal default of @code{market} @end enumerate -Fixated pricing (such as @code{@{=$20@})} still plays a role in this +Fixated pricing (such as @samp{@{=$20@}}) still plays a role in this scheme. As far as valuation goes, it's shorthand for writing -@code{((s,d,t -> market($20,d,t)))}. +@samp{((s,d,t -> market($20,d,t)))}. A valuation function receives three arguments: @table @code @item source A string identifying the commodity whose price is being asked for -(example: "EUR") +(example: @samp{EUR}) @item date The reference date the price should be relative. @item target A string identifying the ``target'' commodity, or the commodity the - returned price should be in. This argument is null if - @code{--market} was used instead of @code{--exchange}. +returned price should be in. This argument is null if @code{--market} +was used instead of @code{--exchange @var{COMMODITY}}. @end table The valuation function should return an amount. If you've written your function in Python, you can return something like -@code{Amount("$100")}. If the function returns an explicit value, +@samp{Amount("$100")}. If the function returns an explicit value, that value is always used, regardless of the commodity, the date, or the desired target commodity. For example, @@ -1711,7 +1718,7 @@ function on a transaction-wide or per-posting basis. @end smallexample Lastly, you can specify the valuation function/value for any specific -amount using the @code{(( ))} commodity annotation. +amount using the @samp{(( ))} commodity annotation. @smallexample 2012-03-02 KFC @@ -1767,6 +1774,7 @@ ledger reg -V food @node Keeping it Consistent, Journal Format, Currency and Commodities, Keeping a Journal @section Keeping it Consistent +@findex --strict Sometimes Ledger's flexibility can lead to difficulties. Using a freeform text editor to enter transactions makes it easy to keep the @@ -1783,11 +1791,11 @@ account Expenses:Utilities ... @end smallexample -Using the @code{--strict} option will cause Ledger to complain if any +Using the @option{--strict} option will cause Ledger to complain if any accounts are not previously defined: @smallexample -15:27:39 ~/ledger (next) > ledger bal --strict +$ ledger bal --strict Warning: "FinanceData/Master.dat", line 6: Unknown account 'Liabilities:Tithe Owed' Warning: "FinanceData/Master.dat", line 8: Unknown account 'Liabilities:Tithe Owed' Warning: "FinanceData/Master.dat", line 15: Unknown account 'Allocation:Equities:Domestic' @@ -1797,7 +1805,7 @@ If you have a large Ledger register already created use the @code{accounts} command to get started: @smallexample -ledger accounts >> Accounts.dat +$ ledger accounts >> Accounts.dat @end smallexample @noindent @@ -1832,10 +1840,10 @@ line is: DATE[=EDATE] [*|!] [(CODE)] DESC @end smallexample -If @code{*} appears after the date (with optional effective date), it +If @samp{*} appears after the date (with optional effective date), it indicates the transaction is ``cleared'', which can mean whatever the -user wants it to mean. If @code{!} appears after the date, it -indicates d the transaction is ``pending''; i.e., tentatively cleared +user wants it to mean. If @samp{!} appears after the date, it +indicates the transaction is ``pending''; i.e., tentatively cleared from the user's point of view, but not yet actually cleared. If a @code{CODE} appears in parentheses, it may be used to indicate a check number, or the type of the posting. Following these is the @@ -1844,7 +1852,7 @@ payee, or a description of the posting. The format of each following posting is: @smallexample - ACCOUNT AMOUNT [; NOTE] +ACCOUNT AMOUNT [; NOTE] @end smallexample The @code{ACCOUNT} may be surrounded by parentheses if it is a virtual @@ -1895,11 +1903,13 @@ Ledger. @node Command Directives, , Transaction and Comments, Journal Format @subsection Command Directives +@findex --strict +@findex --pedantic @table @code @item beginning of line -Command directives must occur at the beginning of a line. Use of ! and -@@ is deprecated. +Command directives must occur at the beginning of a line. Use of +@samp{!} and @samp{@@} is deprecated. @item account Pre-declare valid account names. This only has effect if @@ -1909,14 +1919,14 @@ they immediately follow the account directive and if they begin with whitespace: @smallexample - account Expenses:Food - note This account is all about the chicken! - alias food - payee ^(KFC|Popeyes)$ - check commodity == "$" - assert commodity == "$" - eval print("Hello!") - default +account Expenses:Food + note This account is all about the chicken! + alias food + payee ^(KFC|Popeyes)$ + check commodity == "$" + assert commodity == "$" + eval print("Hello!") + default @end smallexample The @code{note} sub-directive associates a textual note with the @@ -1933,9 +1943,9 @@ encountered and an account within its transaction ends in the name "Unknown". Example: @smallexample - 2012-02-27 KFC - Expenses:Unknown $10.00 ; Read now as "Expenses:Food" - Assets:Cash +2012-02-27 KFC + Expenses:Unknown $10.00 ; Read now as "Expenses:Food" + Assets:Cash @end smallexample The @code{check} and @code{assert} directives warn or error @@ -1970,7 +1980,7 @@ apply account Personal Would result in all postings going into @code{Personal:Expenses:Groceries} and @code{Personal:Assets:Checking} -until and @code{end apply account} directive was found. +until and @code{end apply account} directive was found. @item alias @c instance_t::alias_directive @@ -1982,8 +1992,8 @@ alias Dining=Expenses:Entertainment:Dining alias Checking=Assets:Credit Union:Joint Checking Account 2011/11/28 YummyPalace - Dining $10.00 - Checking + Dining $10.00 + Checking @end smallexample @@ -2014,13 +2024,13 @@ balancing the transaction. The following example set the @smallexample bucket Assets:Checking 2011/01/25 Tom's Used Cars - Expenses:Auto $ 5,500.00 + Expenses:Auto $ 5,500.00 2011/01/27 Book Store - Expenses:Books $20.00 + Expenses:Books $20.00 2011/12/01 Sale - Assets:Checking:Business $ 30.00 + Assets:Checking:Business $ 30.00 @end smallexample @@ -2064,7 +2074,7 @@ sub-directives, if they immediately follow the commodity directive and if they begin with whitespace: @smallexample - commodity $ +commodity $ note American Dollars format $1,000.00 nomarket @@ -2092,8 +2102,8 @@ Allows you to define value expression for future use. For example: define var_name=$100 2011/12/01 Test - Expenses (var_name*4) - Assets + Expenses (var_name*4) + Assets @end smallexample The posting will have a cost of $400. @@ -2129,18 +2139,18 @@ endfixed is equivalent to this: @smallexample - 2012-04-10 Lunch in Canada - Assets:Wallet -15.50 CAD @{=$0.90@} - Expenses:Food 15.50 CAD @{=$0.90@} +2012-04-10 Lunch in Canada + Assets:Wallet -15.50 CAD @{=$0.90@} + Expenses:Food 15.50 CAD @{=$0.90@} - 2012-04-11 Second day Dinner in Canada - Assets:Wallet -25.75 CAD @{=$0.90@} - Expenses:Food 25.75 CAD @{=$0.90@} +2012-04-11 Second day Dinner in Canada + Assets:Wallet -25.75 CAD @{=$0.90@} + Expenses:Food 25.75 CAD @{=$0.90@} @end smallexample Note that ending a @code{fixed} is done differently than other directives, as @code{fixed} is closed with an @code{endfixed} (i.e., -there is @strong{no space} between @code{end} and @code{fixed}). +there is @emph{no space} between @code{end} and @code{fixed}). For the moment, users may wish to study @uref{http://bugs.ledger-cli.org/show_bug.cgi?id=789, Bug Report 789} @@ -2157,16 +2167,16 @@ immediately follows the payee directive and if it begins with whitespace: @smallexample - payee KFC - alias KENTUCKY FRIED CHICKEN +payee KFC + alias KENTUCKY FRIED CHICKEN @end smallexample The @code{alias} directive provides a regexp which, if it matches a parsed payee, the declared payee name is substituted: @smallexample - 2012-02-27 KENTUCKY FRIED CHICKEN ; will be read as being 'KFC' - ... +2012-02-27 KENTUCKY FRIED CHICKEN ; will be read as being 'KFC' +... @end smallexample Ledger will display the mapped payees in @code{print} and @@ -2180,20 +2190,22 @@ tag to all. Tags can have values and may be nested. @smallexample apply tag hastag apply tag nestedtag: true + 2011/01/25 Tom's Used Cars - Expenses:Auto $ 5,500.00 - ; :nobudget: - Assets:Checking + Expenses:Auto $ 5,500.00 + ; :nobudget: + Assets:Checking 2011/01/27 Book Store - Expenses:Books $20.00 - Liabilities:MasterCard + Expenses:Books $20.00 + Liabilities:MasterCard end apply tag nestedtag 2011/12/01 Sale - Assets:Checking:Business $ 30.00 - Income:Sales + Assets:Checking:Business $ 30.00 + Income:Sales + end apply tag hastag @end smallexample @@ -2202,22 +2214,22 @@ is the equivalent of @smallexample 2011/01/25 Tom's Used Cars - :hastag: - nestedtag: true - Expenses:Auto $ 5,500.00 - ; :nobudget: - Assets:Checking + :hastag: + nestedtag: true + Expenses:Auto $ 5,500.00 + ; :nobudget: + Assets:Checking 2011/01/27 Book Store - :hastag: - nestedtag: true - Expenses:Books $20.00 - Liabilities:MasterCard + :hastag: + nestedtag: true + Expenses:Books $20.00 + Liabilities:MasterCard 2011/12/01 Sale - :hastag: - Assets:Checking:Business $ 30.00 - Income:Sales + :hastag: + Assets:Checking:Business $ 30.00 + Income:Sales @end smallexample Note that anything following ``@code{end tag}'' is ignored. placing @@ -2229,18 +2241,18 @@ Pre-declares tag names. This only has effect if @code{--strict} or @code{--pedantic} is used (see below). @smallexample - tag Receipt - tag CSV +tag Receipt +tag CSV @end smallexample -The 'tag' directive supports two optional sub-directives, if they +The @code{tag} directive supports two optional sub-directives, if they immediately follow the tag directive and if they begin with whitespace: @smallexample - tag Receipt - check value =~ /pattern/ - assert value != "foobar" +tag Receipt + check value =~ /pattern/ + assert value != "foobar" @end smallexample The @code{check} and @code{assert} directives warn or error @@ -2278,8 +2290,8 @@ See @code{year} @item N SYMBOL Indicates that pricing information is to be ignored for a given symbol, nor will quotes ever be downloaded for that symbol. Useful -with a home currency, such as the dollar ($). It is recommended that -these pricing options be set in the price database file, which +with a home currency, such as the dollar @samp{$}. It is recommended +that these pricing options be set in the price database file, which defaults to @file{~/.pricedb}. The syntax for this command is: @smallexample @@ -2353,15 +2365,15 @@ leaving just 2003 and 2004 in the current file. So, use called @file{ledger-old.dat}: @smallexample -ledger -f ledger.dat -b 2000 -e 2001 print > ledger-old.dat +$ ledger -f ledger.dat -b 2000 -e 2001 print > ledger-old.dat @end smallexample To delete older data from the current ledger file, use @command{print} again, this time specifying year 2002 as the starting date: @smallexample -ledger -f ledger.dat -b 2002 print > x -mv x ledger.dat +$ ledger -f ledger.dat -b 2002 print > x +$ mv x ledger.dat @end smallexample However, now the current file contains @emph{only} postings from 2002 @@ -2371,10 +2383,10 @@ compensate for this, we must append an equity report for the old ledger at the beginning of the new one: @smallexample -ledger -f ledger-old.dat equity > equity.dat -cat equity.dat ledger.dat > x -mv x ledger.dat -rm equity.dat +$ ledger -f ledger-old.dat equity > equity.dat +$ cat equity.dat ledger.dat > x +$ mv x ledger.dat +$ rm equity.dat @end smallexample Now the balances reported from @file{ledger.dat} are identical to what @@ -2393,7 +2405,7 @@ organization, just keep in mind this maxim: Do whatever keeps you doing it. @node Transactions, Building Reports, Keeping a Journal, Top -@chapter Transactions +@chapter Transactions @menu * Basic format:: @@ -2426,9 +2438,9 @@ doing it. The most basic form of transaction is: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - Assets:Cash $-20.00 +2012-03-10 KFC + Expenses:Food $20.00 + Assets:Cash $-20.00 @end smallexample This transaction has a date, a payee or description, a target account @@ -2438,24 +2450,24 @@ posting specifies what action is taken related to that account. A transaction can have any number of postings: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - Assets:Cash $-10.00 - Liabilities:Credit $-10.00 +2012-03-10 KFC + Expenses:Food $20.00 + Assets:Cash $-10.00 + Liabilities:Credit $-10.00 @end smallexample @node Eliding amounts, Auxiliary dates, Basic format, Transactions -@section Eliding amounts +@section Eliding amounts The first thing you can do to make things easier is elide amounts. That is, if exactly one posting has no amount specified, Ledger will infer the inverse of the other postings' amounts: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - Assets:Cash $-10.00 - Liabilities:Credit ; same as specifying $-10 +2012-03-10 KFC + Expenses:Food $20.00 + Assets:Cash $-10.00 + Liabilities:Credit ; same as specifying $-10 @end smallexample @noindent @@ -2464,38 +2476,39 @@ empty posting N times and fill in the negated values of the various commodities: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - Expenses:Tips $2.00 - Assets:Cash EUR -10.00 - Assets:Cash GBP -10.00 - Liabilities:Credit +2012-03-10 KFC + Expenses:Food $20.00 + Expenses:Tips $2.00 + Assets:Cash EUR -10.00 + Assets:Cash GBP -10.00 + Liabilities:Credit @end smallexample @noindent This transaction is identical to writing: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - Expenses:Tips $2.00 - Assets:Cash EUR -10.00 - Assets:Cash GBP -10.00 - Liabilities:Credit $-22.00 - Liabilities:Credit EUR 10.00 - Liabilities:Credit GBP 10.00 +2012-03-10 KFC + Expenses:Food $20.00 + Expenses:Tips $2.00 + Assets:Cash EUR -10.00 + Assets:Cash GBP -10.00 + Liabilities:Credit $-22.00 + Liabilities:Credit EUR 10.00 + Liabilities:Credit GBP 10.00 @end smallexample @node Auxiliary dates, Codes, Eliding amounts, Transactions @section Auxiliary dates +@findex --aux-date You can associate a second date with a transaction by following the primary date with an equals sign: @smallexample - 2012-03-10=2012-03-08 KFC - Expenses:Food $20.00 - Assets:Cash $-20.00 +2012-03-10=2012-03-08 KFC + Expenses:Food $20.00 + Assets:Cash $-20.00 @end smallexample What this auxiliary date means is entirely up to you. The only use @@ -2512,31 +2525,34 @@ codes like DEP, XFER, etc., as well as check numbers. This is to give you a place to put those codes: @smallexample - 2012-03-10 (#100) KFC - Expenses:Food $20.00 - Assets:Checking +2012-03-10 (#100) KFC + Expenses:Food $20.00 + Assets:Checking @end smallexample @node Transaction state, Transaction notes, Codes, Transactions @section Transaction state +@findex --cleared +@findex --uncleared +@findex --pending A transaction can have a ``state'': cleared, pending, or uncleared. The default is uncleared. To mark a transaction cleared, put a * before the payee, and after date or code: @smallexample - 2012-03-10 * KFC - Expenses:Food $20.00 - Assets:Cash +2012-03-10 * KFC + Expenses:Food $20.00 + Assets:Cash @end smallexample @noindent To mark it pending, use a !: @smallexample - 2012-03-10 ! KFC - Expenses:Food $20.00 - Assets:Cash +2012-03-10 ! KFC + Expenses:Food $20.00 + Assets:Cash @end smallexample What these mean is entirely up to you. The @code{--cleared} option @@ -2552,18 +2568,18 @@ When you clear a transaction, that's really just shorthand for clearing all of its postings. That is: @smallexample - 2012-03-10 * KFC - Expenses:Food $20.00 - Assets:Cash +2012-03-10 * KFC + Expenses:Food $20.00 + Assets:Cash @end smallexample @noindent Is the same as writing: @smallexample - 2012-03-10 KFC - * Expenses:Food $20.00 - * Assets:Cash +2012-03-10 KFC + * Expenses:Food $20.00 + * Assets:Cash @end smallexample @noindent @@ -2571,9 +2587,9 @@ You can mark individual postings as cleared or pending, in case one ``side'' of the transaction has cleared, but the other hasn't yet: @smallexample - 2012-03-10 KFC - Liabilities:Credit $100.00 - * Assets:Checking +2012-03-10 KFC + Liabilities:Credit $100.00 + * Assets:Checking @end smallexample @node Transaction notes, Metadata, Transaction state, Transactions @@ -2581,12 +2597,12 @@ You can mark individual postings as cleared or pending, in case one After the payee, and after at least one tab or two spaces (or a space and a tab, which Ledger calls this a ``hard separator''), you may -introduce a note about the transaction using the ; character: +introduce a note about the transaction using the @samp{;} character: @smallexample - 2012-03-10 * KFC ; yum, chicken... - Expenses:Food $20.00 - Assets:Cash +2012-03-10 * KFC ; yum, chicken... + Expenses:Food $20.00 + Assets:Cash @end smallexample @noindent @@ -2594,15 +2610,15 @@ Notes can also appear on the next line, so long as that line begins with whitespace: @smallexample - 2012-03-10 * KFC ; yum, chicken... - ; and more notes... - Expenses:Food $20.00 - Assets:Cash +2012-03-10 * KFC ; yum, chicken... + ; and more notes... + Expenses:Food $20.00 + Assets:Cash - 2012-03-10 * KFC - ; just these notes... - Expenses:Food $20.00 - Assets:Cash +2012-03-10 * KFC + ; just these notes... + Expenses:Food $20.00 + Assets:Cash @end smallexample A transaction note is shared by all its postings. This becomes @@ -2611,10 +2627,10 @@ a note belongs only to one posting, place it after a hard separator after the amount, or on its own line preceded by whitespace: @smallexample - 2012-03-10 * KFC - Expenses:Food $20.00 ; posting #1 note - Assets:Cash - ; posting #2 note, extra indentation is optional +2012-03-10 * KFC + Expenses:Food $20.00 ; posting #1 note + Assets:Cash + ; posting #2 note, extra indentation is optional @end smallexample @node Metadata, Virtual postings, Transaction notes, Transactions @@ -2640,19 +2656,19 @@ To tag an item, put any word not containing whitespace between two colons: @smallexample - 2012-03-10 * KFC - Expenses:Food $20.00 - Assets:Cash - ; :TAG: +2012-03-10 * KFC + Expenses:Food $20.00 + Assets:Cash + ; :TAG: @end smallexample You can gang up multiple tags by sharing colons: @smallexample - 2012-03-10 * KFC - Expenses:Food $20.00 - Assets:Cash - ; :TAG1:TAG2:TAG3: +2012-03-10 * KFC + Expenses:Food $20.00 + Assets:Cash + ; :TAG1:TAG2:TAG3: @end smallexample @node Metadata values, Typed metadata, Metadata tags, Metadata @@ -2663,10 +2679,10 @@ the value can be any string of characters. Whitespace is needed after the colon, and cannot appear in the Key: @smallexample - 2012-03-10 * KFC - Expenses:Food $20.00 - Assets:Cash - ; MyTag: This is just a bogus value for MyTag +2012-03-10 * KFC + Expenses:Food $20.00 + Assets:Cash + ; MyTag: This is just a bogus value for MyTag @end smallexample @node Typed metadata, , Metadata values, Metadata @@ -2677,10 +2693,10 @@ expression and stored internally as a value rather than as a string. For example, although I can specify a date textually like so: @smallexample - 2012-03-10 * KFC - Expenses:Food $20.00 - Assets:Cash - ; AuxDate: 2012/02/30 +2012-03-10 * KFC + Expenses:Food $20.00 + Assets:Cash + ; AuxDate: 2012/02/30 @end smallexample @noindent @@ -2690,10 +2706,10 @@ into a date automatically every time it is needed as a date). If on the other hand I write this: @smallexample - 2012-03-10 * KFC - Expenses:Food $20.00 - Assets:Cash - ; AuxDate:: [2012/02/30] +2012-03-10 * KFC + Expenses:Food $20.00 + Assets:Cash + ; AuxDate:: [2012/02/30] @end smallexample @noindent @@ -2702,7 +2718,8 @@ journal file, which would let me know right away that it is an invalid date. @node Virtual postings, Expression amounts, Metadata, Transactions -@section Virtual postings +@section Virtual postings +@findex --real Ordinarily, the amounts of all postings in a transaction must balance to zero. This is non-negotiable. It's what double-entry accounting @@ -2717,10 +2734,10 @@ To specify a virtual account, surround the account name with parentheses: @smallexample - 2012-03-10 * KFC - Expenses:Food $20.00 - Assets:Cash - (Budget:Food) $-20.00 +2012-03-10 * KFC + Expenses:Food $20.00 + Assets:Cash + (Budget:Food) $-20.00 @end smallexample If you want, you can state that virtual postings @emph{should} balance @@ -2728,11 +2745,11 @@ against one or more other virtual postings by using brackets (which look ``harder'') rather than parentheses: @smallexample - 2012-03-10 * KFC - Expenses:Food $20.00 - Assets:Cash - [Budget:Food] $-20.00 - [Equity:Budgets] $20.00 +2012-03-10 * KFC + Expenses:Food $20.00 + Assets:Cash + [Budget:Food] $-20.00 + [Equity:Budgets] $20.00 @end smallexample @node Expression amounts, Balance verification, Virtual postings, Transactions @@ -2743,9 +2760,9 @@ but it can also be any value expression. To indicate this, surround the amount expression with parentheses: @smallexample - 2012-03-10 * KFC - Expenses:Food ($10.00 + $20.00) ; Ledger adds it up for you - Assets:Cash +2012-03-10 * KFC + Expenses:Food ($10.00 + $20.00) ; Ledger adds it up for you + Assets:Cash @end smallexample @node Balance verification, Posting cost, Expression amounts, Transactions @@ -2772,9 +2789,9 @@ assignments. A balance assertion has this general form: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - Assets:Cash $-20.00 = $500.00 +2012-03-10 KFC + Expenses:Food $20.00 + Assets:Cash $-20.00 = $500.00 @end smallexample This simply asserts that after subtracting $20.00 from Assets:Cash, @@ -2786,9 +2803,9 @@ that the resulting total matches $500.00. If not, it is an error. A balance assignment has this form: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - Assets:Cash = $500.00 +2012-03-10 KFC + Expenses:Food $20.00 + Assets:Cash = $500.00 @end smallexample This sets the amount of the second posting to whatever it would need @@ -2796,33 +2813,33 @@ to be for the total in Assets:Cash to be $500.00 after the posting. If the resulting amount is not $-20.00 in this case, it is an error. @node Resetting a balance, Balancing transactions, Balance assignments, Balance verification -@subsection Resetting a balance +@subsection Resetting a balance Say your book-keeping has gotten a bit out of date, and your Ledger balance no longer matches your bank balance. You can create an adjustment transaction using balance assignments: @smallexample - 2012-03-10 Adjustment - Assets:Cash = $500.00 - Equity:Adjustments +2012-03-10 Adjustment + Assets:Cash = $500.00 + Equity:Adjustments @end smallexample Since the second posting is also null, it's value will become the inverse of whatever amount is generated for the first posting. This is the only time in ledger when more than one posting's amount -may be empty --- and then only because it's not true empty, it is +may be empty---and then only because it's not true empty, it is indirectly provided by the balance assignment's value. @node Balancing transactions, , Resetting a balance, Balance verification -@subsection Balancing transactions +@subsection Balancing transactions As a consequence of all the above, consider the following transaction: @smallexample - 2012-03-10 My Broker - [Assets:Brokerage] = 10 AAPL +2012-03-10 My Broker + [Assets:Brokerage] = 10 AAPL @end smallexample What this says is: set the amount of the posting to whatever value is @@ -2848,9 +2865,9 @@ for you, and can use it during reporting in various ways. Here's an example of a stock purchase: @smallexample - 2012-03-10 My Broker - Assets:Brokerage 10 AAPL - Assets:Brokerage:Cash $-500.00 +2012-03-10 My Broker + Assets:Brokerage 10 AAPL + Assets:Brokerage:Cash $-500.00 @end smallexample This is different from transferring 10 AAPL shares from one account to @@ -2860,22 +2877,22 @@ another. The resulting posting cost is $50.00 per share. @node Explicit posting costs, Posting cost expressions, Posting cost, Transactions @section Explicit posting costs -You can make any posting's cost explicit using the @@ symbol after the -amount or amount expression: +You can make any posting's cost explicit using the @samp{@@} symbol +after the amount or amount expression: @smallexample - 2012-03-10 My Broker - Assets:Brokerage 10 AAPL @@ $50.00 - Assets:Brokerage:Cash $-500.00 +2012-03-10 My Broker + Assets:Brokerage 10 AAPL @@ $50.00 + Assets:Brokerage:Cash $-500.00 @end smallexample When you do this, since Ledger can now figure out the balancing amount from the first posting's cost, you can elide the otheramount: @smallexample - 2012-03-10 My Broker - Assets:Brokerage 10 AAPL @@ $50.00 - Assets:Brokerage:Cash +2012-03-10 My Broker + Assets:Brokerage 10 AAPL @@ $50.00 + Assets:Brokerage:Cash @end smallexample @menu @@ -2897,8 +2914,8 @@ Said another way, whenever Ledger sees a posting cost of the form ``primary''. The only meaning a primary commodity has is that @code{-V} flag will -never convert a primary commodity into any other commodity. @code{-X} -still will, however. +never convert a primary commodity into any other commodity. @code{-X +@var{COMMODITY}} still will, however. @node Posting cost expressions, Total posting costs, Explicit posting costs, Transactions @section Posting cost expressions @@ -2907,38 +2924,38 @@ Just as you can have amount expressions, you can have posting expressions: @smallexample - 2012-03-10 My Broker - Assets:Brokerage 10 AAPL @@ ($500.00 / 10) - Assets:Brokerage:Cash +2012-03-10 My Broker + Assets:Brokerage 10 AAPL @@ ($500.00 / 10) + Assets:Brokerage:Cash @end smallexample You can even have both: @smallexample - 2012-03-10 My Broker - Assets:Brokerage (5 AAPL * 2) @@ ($500.00 / 10) - Assets:Brokerage:Cash +2012-03-10 My Broker + Assets:Brokerage (5 AAPL * 2) @@ ($500.00 / 10) + Assets:Brokerage:Cash @end smallexample @node Total posting costs, Virtual posting costs, Posting cost expressions, Transactions @section Total posting costs -The cost figure following the @@ character specifies the +The cost figure following the @samp{@@} character specifies the @emph{per-unit} price for the commodity being transferred. If you'd -like to specify the total cost instead, use @@@@: +like to specify the total cost instead, use @samp{@@@@}: @smallexample - 2012-03-10 My Broker - Assets:Brokerage 10 AAPL @@@@ $500.00 - Assets:Brokerage:Cash +2012-03-10 My Broker + Assets:Brokerage 10 AAPL @@@@ $500.00 + Assets:Brokerage:Cash @end smallexample Ledger reads this as if you had written: @smallexample - 2012-03-10 My Broker - Assets:Brokerage 10 AAPL @@ ($500.00 / 10) - Assets:Brokerage:Cash +2012-03-10 My Broker + Assets:Brokerage 10 AAPL @@ ($500.00 / 10) + Assets:Brokerage:Cash @end smallexample @node Virtual posting costs, Commodity prices, Total posting costs, Transactions @@ -2947,17 +2964,18 @@ Ledger reads this as if you had written: Normally whenever a commodity exchange like this happens, the price of the exchange (such as $50 per share of AAPL, above) is recorded in Ledger's internal price history database. To prevent this from -happening in the case of an exceptional transaction, surround the @@ -or @@@@ with parentheses: +happening in the case of an exceptional transaction, surround the +@samp{@@} or @samp{@@@@} with parentheses: @smallexample - 2012-03-10 My Brother - Assets:Brokerage 1000 AAPL (@@) $1 - Income:Gifts Received +2012-03-10 My Brother + Assets:Brokerage 1000 AAPL (@@) $1 + Income:Gifts Received @end smallexample @node Commodity prices, Prices vs. costs, Virtual posting costs, Transactions @section Commodity prices +@findex --lot-prices When a transaction occurs that exchange one commodity for another, Ledger records that commodity price not only within its internal price @@ -2968,9 +2986,9 @@ fact remains invisible to the user, unless you turn on For example, consider the stock sale given above: @smallexample - 2012-03-10 My Broker - Assets:Brokerage 10 AAPL @@ $50.00 - Assets:Brokerage:Cash +2012-03-10 My Broker + Assets:Brokerage 10 AAPL @@ $50.00 + Assets:Brokerage:Cash @end smallexample The commodity transferred into Assets:Brokerage is not actually 10 @@ -2983,19 +3001,19 @@ This becomes significant if you later sell that commodity again. For example, you might write this: @smallexample - 2012-04-10 My Broker - Assets:Brokerage:Cash - Assets:Brokerage -10 AAPL @@ $75.00 +2012-04-10 My Broker + Assets:Brokerage:Cash + Assets:Brokerage -10 AAPL @@ $75.00 @end smallexample And that would be perfectly fine, but how do you track the capital gains on the sale? It could be done with a virtual posting: @smallexample - 2012-04-10 My Broker - Assets:Brokerage:Cash - Assets:Brokerage -10 AAPL @@ $75.00 - (Income:Capital Gains) $-250.00 +2012-04-10 My Broker + Assets:Brokerage:Cash + Assets:Brokerage -10 AAPL @@ $75.00 + (Income:Capital Gains) $-250.00 @end smallexample But this gets messy since capital gains income is very real, and not @@ -3006,9 +3024,9 @@ will figure out that the price of the shares you're selling, and the cost you're selling them at, don't balance: @smallexample - 2012-04-10 My Broker - Assets:Brokerage:Cash $750.00 - Assets:Brokerage -10 AAPL @{$50.00@} @@ $75.00 +2012-04-10 My Broker + Assets:Brokerage:Cash $750.00 + Assets:Brokerage -10 AAPL @{$50.00@} @@ $75.00 @end smallexample This transaction will fail because the $250.00 price difference @@ -3028,10 +3046,10 @@ per-share price in doubled braces. This goes well with total costs, but is not required to be used with them: @smallexample - 2012-04-10 My Broker - Assets:Brokerage:Cash $750.00 - Assets:Brokerage -10 AAPL @{@{$500.00@}@} @@@@ $750.00 - Income:Capital Gains $-250.00 +2012-04-10 My Broker + Assets:Brokerage:Cash $750.00 + Assets:Brokerage -10 AAPL @{@{$500.00@}@} @@@@ $750.00 + Income:Capital Gains $-250.00 @end smallexample It should be noted that this is a convenience only for cases where you @@ -3045,38 +3063,38 @@ price form is a shorthand only. Plus, it comes with dangers. This works fine: @smallexample - 2012-04-10 My Broker - Assets:Brokerage 10 AAPL @@ $50.00 - Assets:Brokerage:Cash $750.00 +2012-04-10 My Broker + Assets:Brokerage 10 AAPL @@ $50.00 + Assets:Brokerage:Cash $750.00 - 2012-04-10 My Broker - Assets:Brokerage:Cash $375.00 - Assets:Brokerage -5 AAPL @{$50.00@} @@ $375.00 - Income:Capital Gains $-125.00 +2012-04-10 My Broker + Assets:Brokerage:Cash $375.00 + Assets:Brokerage -5 AAPL @{$50.00@} @@ $375.00 + Income:Capital Gains $-125.00 - 2012-04-10 My Broker - Assets:Brokerage:Cash $375.00 - Assets:Brokerage -5 AAPL @{$50.00@} @@ $375.00 - Income:Capital Gains $-125.00 +2012-04-10 My Broker + Assets:Brokerage:Cash $375.00 + Assets:Brokerage -5 AAPL @{$50.00@} @@ $375.00 + Income:Capital Gains $-125.00 @end smallexample @noindent But this does not do what you might expect: @smallexample - 2012-04-10 My Broker - Assets:Brokerage 10 AAPL @@ $50.00 - Assets:Brokerage:Cash $750.00 +2012-04-10 My Broker + Assets:Brokerage 10 AAPL @@ $50.00 + Assets:Brokerage:Cash $750.00 - 2012-04-10 My Broker - Assets:Brokerage:Cash $375.00 - Assets:Brokerage -5 AAPL @{@{$500.00@}@} @@ $375.00 - Income:Capital Gains $-125.00 +2012-04-10 My Broker + Assets:Brokerage:Cash $375.00 + Assets:Brokerage -5 AAPL @{@{$500.00@}@} @@ $375.00 + Income:Capital Gains $-125.00 - 2012-04-10 My Broker - Assets:Brokerage:Cash $375.00 - Assets:Brokerage -5 AAPL @{@{$500.00@}@} @@ $375.00 - Income:Capital Gains $-125.00 +2012-04-10 My Broker + Assets:Brokerage:Cash $375.00 + Assets:Brokerage -5 AAPL @{@{$500.00@}@} @@ $375.00 + Income:Capital Gains $-125.00 @end smallexample And in cases where the amounts do not divide into whole figure and @@ -3090,13 +3108,13 @@ Because lot pricing provides enough information to infer the cost, the following two transactions are equivalent: @smallexample - 2012-04-10 My Broker - Assets:Brokerage 10 AAPL @@ $50.00 - Assets:Brokerage:Cash $750.00 +2012-04-10 My Broker + Assets:Brokerage 10 AAPL @@ $50.00 + Assets:Brokerage:Cash $750.00 - 2012-04-10 My Broker - Assets:Brokerage 10 AAPL @{$50.00@} - Assets:Brokerage:Cash $750.00 +2012-04-10 My Broker + Assets:Brokerage 10 AAPL @{$50.00@} + Assets:Brokerage:Cash $750.00 @end smallexample However, note that what you see in some reports may differ, for @@ -3113,9 +3131,9 @@ stock is. You can short-circuit this lookup by ``fixing'' the price at the time of a transaction. This is done using @{=AMOUNT@}: @smallexample - 2012-04-10 My Broker - Assets:Brokerage 10 AAPL @{=$50.00@} - Assets:Brokerage:Cash $750.00 +2012-04-10 My Broker + Assets:Brokerage 10 AAPL @{=$50.00@} + Assets:Brokerage:Cash $750.00 @end smallexample These 10 AAPL will now always be reported as being worth $50, no @@ -3129,9 +3147,9 @@ a matter of preference, there is an equivalent syntax for specified fixated prices by way of the cost: @smallexample - 2012-04-10 My Broker - Assets:Brokerage 10 AAPL @@ =$50.00 - Assets:Brokerage:Cash $750.00 +2012-04-10 My Broker + Assets:Brokerage 10 AAPL @@ =$50.00 + Assets:Brokerage:Cash $750.00 @end smallexample This is the same as the previous transaction, with the same caveats @@ -3139,6 +3157,7 @@ found in @ref{Prices vs. costs}. @node Lot dates, Lot notes, Fixated prices, Transactions @section Lot dates +@findex --lot-dates In addition to lot prices, you can specify lot dates and reveal them with @code{--lot-dates}. Other than that, however, they have no @@ -3147,25 +3166,27 @@ square brackets (the same way that dates are parsed in value expressions): @smallexample - 2012-04-10 My Broker - Assets:Brokerage:Cash $375.00 - Assets:Brokerage -5 AAPL @{$50.00@} [2012-04-10] @@ $375.00 - Income:Capital Gains $-125.00 +2012-04-10 My Broker + Assets:Brokerage:Cash $375.00 + Assets:Brokerage -5 AAPL @{$50.00@} [2012-04-10] @@ $375.00 + Income:Capital Gains $-125.00 @end smallexample @node Lot notes, Lot value expressions, Lot dates, Transactions @section Lot notes +@findex --lot-notes +@findex --lots You can also associate arbitrary notes for your own record keeping in parentheses, and reveal them with @code{--lot-notes}. One caveat is -that the note cannot begin with an @@ character, as that would +that the note cannot begin with an @samp{@@} character, as that would indicate a virtual cost: @smallexample - 2012-04-10 My Broker - Assets:Brokerage:Cash $375.00 - Assets:Brokerage -5 AAPL @{$50.00@} [2012-04-10] (Oh my!) @@ $375.00 - Income:Capital Gains $-125.00 +2012-04-10 My Broker + Assets:Brokerage:Cash $375.00 + Assets:Brokerage -5 AAPL @{$50.00@} [2012-04-10] (Oh my!) @@ $375.00 + Income:Capital Gains $-125.00 @end smallexample You can any combination of lot prices, dates or notes, in any order. @@ -3178,7 +3199,7 @@ To show all lot information in a report, use @code{--lots}. Normally when you ask Ledger to display the values of commodities held, it uses a value expression called ``market'' to determine the -most recent value from its price database --- even downloading prices +most recent value from its price database---even downloading prices from the Internet, if @code{-Q} was specified and a suitable ``getquote'' script is found on your system. @@ -3194,26 +3215,26 @@ name, or a lambda expression. Here's a function that yields the price as $10 in whatever commodity is being requested: @smallexample - define ten_dollars(s, date, t) = market($10, date, t) +define ten_dollars(s, date, t) = market($10, date, t) @end smallexample I can now use that in a lot value expression as follows: @smallexample - 2012-04-10 My Broker - Assets:Brokerage:Cash $375.00 - Assets:Brokerage -5 AAPL @{$50.00@} ((ten_dollars)) @@@@ $375.00 - Income:Capital Gains $-125.00 +2012-04-10 My Broker + Assets:Brokerage:Cash $375.00 + Assets:Brokerage -5 AAPL @{$50.00@} ((ten_dollars)) @@@@ $375.00 + Income:Capital Gains $-125.00 @end smallexample Alternatively, I could do the same thing without pre-defining a function by using a lambda expression taking three arguments: @smallexample - 2012-04-10 My Broker - A:B:Cash $375.00 - A:B -5 AAPL @{$50.00@} ((s, d, t -> market($10, date, t))) @@@@ $375.00 - Income:Capital Gains $-125.00 +2012-04-10 My Broker + A:B:Cash $375.00 + A:B -5 AAPL @{$50.00@} ((s, d, t -> market($10, date, t))) @@@@ $375.00 + Income:Capital Gains $-125.00 @end smallexample The arguments passed to these functions have the following meaning: @@ -3223,9 +3244,9 @@ The arguments passed to these functions have the following meaning: The source commodity string, or an amount object. If it is a string, the return value must be an amount representing the price of the commodity identified by that string (example: - ``$''). If it is an amount, return the value of that amount - as a new amount (usually calculated as commodity price times - source amount). + @samp{$}). If it is an amount, return the value of that + amount as a new amount (usually calculated as commodity price + times source amount). @item date The date to use for determining the value. If null, it means @@ -3256,30 +3277,30 @@ same query syntax as the Ledger command line. Consider this posting: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - Assets:Cash +2012-03-10 KFC + Expenses:Food $20.00 + Assets:Cash @end smallexample If I write this automated transaction before it in the file: @smallexample - = expr true - Foo $50.00 - Bar $-50.00 += expr true + Foo $50.00 + Bar $-50.00 @end smallexample Then the first transaction will be modified during parsing as if I'd written this: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - Foo $50.00 - Bar $-50.00 - Assets:Cash $-20.00 - Foo $50.00 - Bar $-50.00 +2012-03-10 KFC + Expenses:Food $20.00 + Foo $50.00 + Bar $-50.00 + Assets:Cash $-20.00 + Foo $50.00 + Bar $-50.00 @end smallexample Despite this fancy logic, automated transactions themselves follow @@ -3310,25 +3331,25 @@ As a special case, if an automated transaction's posting's amount posting's cost. For example: @smallexample - = expr true - Foo 50.00 - Bar -50.00 += expr true + Foo 50.00 + Bar -50.00 - 2012-03-10 KFC - Expenses:Food $20.00 - Assets:Cash +2012-03-10 KFC + Expenses:Food $20.00 + Assets:Cash @end smallexample Then the latter transaction turns into this during parsing: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - Foo $1000.00 - Bar $-1000.00 - Assets:Cash $-20.00 - Foo $1000.00 - Bar $-1000.00 +2012-03-10 KFC + Expenses:Food $20.00 + Foo $1000.00 + Bar $-1000.00 + Assets:Cash $-20.00 + Foo $1000.00 + Bar $-1000.00 @end smallexample @node Accessing the matching posting's amount, Referring to the matching posting's account, Amount multipliers, Automated Transactions @@ -3340,22 +3361,22 @@ posting. For example, you can refer to that posting's amount using the ``amount'' value expression variable: @smallexample - = expr true - (Foo) (amount * 2) ; same as just "2" in this case += expr true + (Foo) (amount * 2) ; same as just "2" in this case - 2012-03-10 KFC - Expenses:Food $20.00 - Assets:Cash +2012-03-10 KFC + Expenses:Food $20.00 + Assets:Cash @end smallexample This becomes: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - (Foo) $40.00 - Assets:Cash $-20.00 - (Foo) $-40.00 +2012-03-10 KFC + Expenses:Food $20.00 + (Foo) $40.00 + Assets:Cash $-20.00 + (Foo) $-40.00 @end smallexample @node Referring to the matching posting's account, Applying metadata to every matched posting, Accessing the matching posting's amount, Automated Transactions @@ -3366,21 +3387,21 @@ the automated transaction itself. This is done by using the string $account, anywhere within the account part of the automated posting: @smallexample - = food - (Budget:$account) 10 += food + (Budget:$account) 10 - 2012-03-10 KFC - Expenses:Food $20.00 - Assets:Cash +2012-03-10 KFC + Expenses:Food $20.00 + Assets:Cash @end smallexample Becomes: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - (Budget:Expenses:Food) $200.00 - Assets:Cash $-20.00 +2012-03-10 KFC + Expenses:Food $20.00 + (Budget:Expenses:Food) $200.00 + Assets:Cash $-20.00 @end smallexample @node Applying metadata to every matched posting, Applying metadata to the generated posting, Referring to the matching posting's account, Automated Transactions @@ -3391,23 +3412,23 @@ copied (along with any metadata) to every posting that matches the predicate: @smallexample - = food - ; Foo: Bar - (Budget:$account) 10 += food + ; Foo: Bar + (Budget:$account) 10 - 2012-03-10 KFC - Expenses:Food $20.00 - Assets:Cash +2012-03-10 KFC + Expenses:Food $20.00 + Assets:Cash @end smallexample Becomes: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - ; Foo: Bar - (Budget:Expenses:Food) $200.00 - Assets:Cash $-20.00 +2012-03-10 KFC + Expenses:Food $20.00 + ; Foo: Bar + (Budget:Expenses:Food) $200.00 + Assets:Cash $-20.00 @end smallexample @node Applying metadata to the generated posting, State flags, Applying metadata to every matched posting, Automated Transactions @@ -3417,23 +3438,23 @@ If the automated transaction's posting has a note, that note is carried to the generated posting within the matched transaction: @smallexample - = food - (Budget:$account) 10 - ; Foo: Bar += food + (Budget:$account) 10 + ; Foo: Bar - 2012-03-10 KFC - Expenses:Food $20.00 - Assets:Cash +2012-03-10 KFC + Expenses:Food $20.00 + Assets:Cash @end smallexample Becomes: @smallexample - 2012-03-10 KFC - Expenses:Food $20.00 - (Budget:Expenses:Food) $200.00 - ; Foo: Bar - Assets:Cash $-20.00 +2012-03-10 KFC + Expenses:Food $20.00 + (Budget:Expenses:Food) $200.00 + ; Foo: Bar + Assets:Cash $-20.00 @end smallexample This is slightly different from the rules for regular transaction @@ -3445,13 +3466,14 @@ posting it matches. @subsection State flags Although you cannot mark an automated transaction as a whole as -cleared or pending, you can mark its postings with a * or ! before the -account name, and that state flag gets carried to the generated -posting. +cleared or pending, you can mark its postings with a @samp{*} or +@samp{!} before the account name, and that state flag gets carried to +the generated posting. @node Effective Dates, Periodic Transactions, State flags, Automated Transactions @subsection Effective Dates @cindex effective dates +@findex --effective In the real world transactions do not take place instantaneously. Purchases can take several days to post to a bank account. And you may @@ -3464,17 +3486,16 @@ something like @smallexample 2008/01/01=2008/01/14 Client invoice ; estimated date you'll be paid - Assets:Accounts Receivable $100.00 - Income: Client name + Assets:Accounts Receivable $100.00 + Income: Client name @end smallexample -@noindent Then, when you receive the payment, you change it to @smallexample 2008/01/01=2008/01/15 Client invoice ; actual date money received - Assets:Accounts Receivable $100.00 - Income: Client name + Assets:Accounts Receivable $100.00 + Income: Client name @end smallexample @noindent @@ -3482,21 +3503,21 @@ and add something like @smallexample 2008/01/15 Client payment - Assets:Checking $100.00 - Assets:Accounts Receivable + Assets:Checking $100.00 + Assets:Accounts Receivable @end smallexample Now @smallexample -ledger --subtotal --begin 2008/01/01 --end 2008/01/14 bal Income +$ ledger --subtotal --begin 2008/01/01 --end 2008/01/14 bal Income @end smallexample @noindent gives you your accrued income in the first two weeks of the year, and @smallexample -ledger --effective --subtotal --begin 2008/01/01 --end 2008/01/14 bal Income +$ ledger --effective --subtotal --begin 2008/01/01 --end 2008/01/14 bal Income @end smallexample @noindent @@ -3504,7 +3525,7 @@ gives you your cash basis income in the same two weeks. Another use is distributing costs out in time. As an example, suppose you just prepaid into a local vegetable co-op that sustains you -through the winter. It cost $225 to join the program, so you write +through the winter. It costs $225 to join the program, so you write a check. You don't want your October grocery budget to be blown because you bought food ahead, however. What you really want is for the money to be evenly distributed over the next six months so that @@ -3528,12 +3549,13 @@ really knows that it debited $225 this month. @node Periodic Transactions, Concrete Example of Automated Transactions, Effective Dates, Automated Transactions @subsection Periodic Transactions +@findex --budget -A periodic transaction starts with a ~ followed by a period expression. -Periodic transactions are used for budgeting and forecasting only, they -have no effect without the @code{--budget} option specified. - -See @ref{Budgeting and Forecasting} for examples and details. +A periodic transaction starts with a @samp{~} followed by a period +expression. Periodic transactions are used for budgeting and +forecasting only, they have no effect without the @code{--budget} +option specified. @xref{Budgeting and Forecasting} for examples and +details. @node Concrete Example of Automated Transactions, , Periodic Transactions, Automated Transactions @subsection Concrete Example of Automated Transactions @@ -3575,7 +3597,7 @@ That's it. To see how much Huqúq is currently owed based on your ledger transactions, use: @smallexample -ledger balance Liabilities:Huquq +$ ledger balance Liabilities:Huquq @end smallexample This works fine, but omits one aspect of the law: that Huquq is only @@ -3586,7 +3608,7 @@ value of 2.22 ounces of gold. This can be accomplished using the command: @smallexample -ledger -Q -t "/Liab.*Huquq/?(a/P@{2.22 AU@}<=@{-1.0@}&a):a" -s bal liab +$ ledger -Q -t "/Liab.*Huquq/?(a/P@{2.22 AU@}<=@{-1.0@}&a):a" -s bal liab @end smallexample With this command, the current price for gold is downloaded, and the @@ -3595,7 +3617,7 @@ of gold. If you wish the liability to be reflected in the parent subtotal either way, use this instead: @smallexample -ledger -Q -T "/Liab.*Huquq/?(O/P@{2.22 AU@}<=@{-1.0@}&O):O" -s bal liab +$ ledger -Q -T "/Liab.*Huquq/?(O/P@{2.22 AU@}<=@{-1.0@}&O):O" -s bal liab @end smallexample In some cases, you may wish to refer to the account of whichever @@ -3604,13 +3626,13 @@ this, use the special account name @samp{$account}: @smallexample = /^Some:Long:Account:Name/ - [$account] -0.10 - [Savings] 0.10 + [$account] -0.10 + [Savings] 0.10 @end smallexample This example causes 10% of the matching account's total to be deferred -to the @samp{Savings} account---as a balanced virtual posting, -which may be excluded from reports by using @option{--real}. +to the @samp{Savings} account---as a balanced virtual posting, which +may be excluded from reports by using @option{--real}. @node Building Reports, Reporting Commands, Transactions, Top @chapter Building Reports @@ -3648,7 +3670,7 @@ The balance report is the most commonly used report. The simplest invocation is: @smallexample -ledger balance -f drewr3.dat +$ ledger balance -f drewr3.dat @end smallexample @noindent @@ -3682,12 +3704,11 @@ specific accounts is as easy as entering the names of the accounts after the command. @smallexample -20:37:53 ~/ledger/test/input > ledger balance -f drewr3.dat Auto MasterCard +$ ledger balance -f drewr3.dat Auto MasterCard $ 5,500.00 Expenses:Auto $ -20.00 Liabilities:MasterCard -------------------- $ 5,480.00 -20:39:21 ~/ledger/test/input > @end smallexample @noindent @@ -3698,21 +3719,20 @@ If you want the entire contents of a branch of your account tree, use the highest common name in the branch: @smallexample -20:39:21 ~/ledger/test/input > ledger balance -f drewr3.dat Income +$ ledger balance -f drewr3.dat Income $ -2,030.00 Income $ -2,000.00 Salary $ -30.00 Sales -------------------- $ -2,030.00 -20:40:28 ~/ledger/test/input > @end smallexample You can use general regular expressions in nearly anyplace Ledger needs a string: @smallexample -20:40:28 ~/ledger/test/input > ledger balance -f drewr3.dat ^Bo -21:13:29 ~/ledger/test/input > ledger balance -f drewr3.dat Bo +$ ledger balance -f drewr3.dat ^Bo +$ ledger balance -f drewr3.dat Bo $ 20.00 Expenses:Books @end smallexample @@ -3726,8 +3746,8 @@ If you want to know exactly how much you have spent in a particular account on a particular payee, the following are equivalent: @smallexample -> ledger balance Auto:Fuel and Chevron -> ledger balance --limit "(account=~/Fuel/) & (payee=~/Chev/)" +$ ledger balance Auto:Fuel and Chevron +$ ledger balance --limit "(account=~/Fuel/) & (payee=~/Chev/)" @end smallexample @noindent @@ -3741,7 +3761,7 @@ If you want to exclude specific accounts from the report, you can exclude multiple accounts with parentheses: @smallexample -ledger -s bal Expenses and not \(Expenses:Drinks or Expenses:Candy or Expenses:Gifts\) +$ ledger -s bal Expenses and not \(Expenses:Drinks or Expenses:Candy or Expenses:Gifts\) @end smallexample @node Controlling formatting, , Controlling the Accounts and Payees, Balance Reports @@ -3757,9 +3777,9 @@ you want, or interface Ledger with other programs. A query such as the following shows all expenses since last October, sorted by total: -@example -ledger -b "last oct" -s -S T bal ^expenses -@end example +@smallexample +$ ledger -b "last oct" -s -S T bal ^expenses +@end smallexample From left to right the options mean: Show transactions since last October; show all sub-accounts; sort by the absolute value of the @@ -3772,21 +3792,25 @@ total; and report the balance for all accounts that begin with @node Reporting monthly expenses, , Typical queries, Typical queries @subsection Reporting monthly expenses +@findex --monthly +@findex -M +@findex --display @var{EXPR} +@findex --period-sort @var{VEXPR} The following query makes it easy to see monthly expenses, with each month's expenses sorted by the amount: -@example -ledger -M --period-sort "(amount)" reg ^expenses -@end example +@smallexample +$ ledger -M --period-sort "(amount)" reg ^expenses +@end smallexample Now, you might wonder where the money came from to pay for these things. To see that report, add @code{-r}, which shows the ``related account'' postings: -@example -ledger -M --period-sort "(amount)" -r reg ^expenses -@end example +@smallexample +$ ledger -M --period-sort "(amount)" -r reg ^expenses +@end smallexample But maybe this prints too much information. You might just want to see how much you're spending with your MasterCard. That kind of query @@ -3794,9 +3818,9 @@ requires the use of a display predicate, since the postings calculated must match @code{^expenses}, while the postings displayed must match @code{mastercard}. The command would be: -@example -ledger -M -r --display "account =~ /mastercard/" reg ^expenses -@end example +@smallexample +$ ledger -M -r --display "account =~ /mastercard/" reg ^expenses +@end smallexample This query says: Report monthly subtotals; report the ``related account'' postings; display only related postings whose @@ -3805,9 +3829,9 @@ postings matching @code{^expenses}. This works just as well for report the overall total, too: -@example -ledger -s -r --display "account =~ /mastercard/" reg ^expenses -@end example +@smallexample +$ ledger -s -r --display "account =~ /mastercard/" reg ^expenses +@end smallexample The @code{-s} option subtotals all postings, just as @code{-M} subtotaled by the month. The running total in both cases is off, @@ -3845,10 +3869,10 @@ invested in equities, and partially invested in bonds and cash. Below is the asset allocation for each of the instruments listed above: @multitable @columnfractions .2 .2 .3 .3 -@item @tab Domestic @tab Global @tab -@item Symbol @tab Equity @tab Equity @tab bonds/cash +@item @tab Domestic @tab Global @tab +@item Symbol @tab Equity @tab Equity @tab bonds/cash @item VIFSX @tab 100% @tab @tab -@item VTHRX @tab 24.0% @tab 56.3% @tab 19.7% +@item VTHRX @tab 24.0% @tab 56.3% @tab 19.7% @item VSGBX @tab @tab @tab 100% @end multitable @@ -3874,22 +3898,22 @@ would look like: ; automatic calculations for asset allocation tracking ; = expr ( commodity == 'VIFSX' ) - (Allocation:Equities:Domestic) 1.000 + (Allocation:Equities:Domestic) 1.000 = expr ( commodity == 'VTHRX' ) - (Allocation:Equities:Global) 0.240 - (Allocation:Equities:Domestic) 0.563 - (Allocation:Bonds/Cash) 0.197 + (Allocation:Equities:Global) 0.240 + (Allocation:Equities:Domestic) 0.563 + (Allocation:Bonds/Cash) 0.197 = expr ( commodity == 'VBMFX') - (Allocation:Bonds/Cash) 1.000 + (Allocation:Bonds/Cash) 1.000 @end smallexample -How do these work? First the `=' sign at the beginning of the line -tells ledger this is an automatic transaction to be applied when the -condition following the `=' is true. After the `=' sign is a value -expression (@pxref{Value Expressions}) that returns true any time -a posting contains the commodity of interest. +How do these work? First the @samp{=} sign at the beginning of the +line tells ledger this is an automatic transaction to be applied when +the condition following the @samp{=} is true. After the @samp{=} sign +is a value expression (@pxref{Value Expressions}) that returns true +any time a posting contains the commodity of interest. The following line gives the proportions (not percentages) of each unit of commodity that belongs to each asset class. Whenever Ledger sees a @@ -3903,9 +3927,9 @@ formatting! @smallexample ledger bal Allocation --current --format "\ - %-17((depth_spacer)+(partial_account))\ - %10(percent(market(display_total), market(parent.total)))\ - %16(market(display_total))\n%/" + %-17((depth_spacer)+(partial_account))\ + %10(percent(market(display_total), market(parent.total)))\ + %16(market(display_total))\n%/" @end smallexample @noindent @@ -3925,9 +3949,8 @@ asking for the current balances of the account in the ``Allocation'' tree, using a special formatter. @cindex depth_spacer -@findex depth_spacer -@findex display_total -@findex parent.total +@cindex display_total +@cindex parent.total The magic is in the formatter. The second line simply tells Ledger to print the partial account name indented by its depth in the tree. The third line is where we calculate and display the percentages. The @@ -3935,29 +3958,32 @@ third line is where we calculate and display the percentages. The for the account in this line. The @code{parent.total} command gives the total for the next level up in the tree. @code{percent} formats their ratio as a percentage. The fourth line tells ledger to display -the current market value of the line. The last two characters ``%/'' -tell Ledger what to do for the last line, in this case, nothing. +the current market value of the line. The last two characters +@samp{%/} tell Ledger what to do for the last line, in this case, +nothing. @node Visualizing with Gnuplot, , Asset Allocation, Advanced Reports @subsection Visualizing with Gnuplot @cindex Gnuplot script @cindex plotting @cindex Gnuplot +@findex --amount-data +@findex --total-data If you have @command{Gnuplot} installed, you can graph any of the -above register reports. The script to do this is included in the -ledger distribution, and is named @file{contrib/report}. Install +above register reports. The script to do this is included in the +ledger distribution, and is named @file{contrib/report}. Install @file{report} anywhere along your @env{PATH}, and then use @command{report} instead of @command{ledger} when doing a register -report. The only thing to keep in mind is that you must specify +report. The only thing to keep in mind is that you must specify @code{-j (--amount-data)} or @code{-J (--total-data)} to indicate -whether Gnuplot should plot the amount, or the running total. For +whether Gnuplot should plot the amount, or the running total. For example, this command plots total monthly expenses made on your MasterCard. -@example -report -j -M -r --display "account =~ /mastercard/" reg ^expenses -@end example +@smallexample +$ report -j -M -r --display "account =~ /mastercard/" reg ^expenses +@end smallexample The @command{report} script is a very simple Bourne shell script, that passes a set of scripted commands to Gnuplot. Feel free to modify the @@ -4010,7 +4036,8 @@ part of the balance. @end menu @node The balance Command, The equity Command, Primary Financial Reports, Primary Financial Reports -@subsection The @code{balance} Command +@subsection The @code{balance} command +@findex balance The @command{balance} command reports the current balance of all accounts. It accepts a list of optional regexps, which confine the @@ -4019,14 +4046,16 @@ multiple types of commodities, each commodity's total is reported separately. @node The equity Command, The register Command, The balance Command, Primary Financial Reports -@subsection The @code{equity} Command +@subsection The @code{equity} command +@findex equity The @command{equity} command prints out accounts balances as if they were transactions. This makes it easy to establish the starting balances for an account, such as when @ref{Archiving Previous Years}. @node The register Command, The print Command, The equity Command, Primary Financial Reports -@subsection The @code{register} Command +@subsection The @code{register} command +@findex register The @command{register} command displays all the postings occurring in a single account, line by line. The account regexp must be @@ -4047,7 +4076,8 @@ add either @code{-j} or @code{-J} to your register command, in order to plot either the amount or total column, respectively. @node The print Command, , The register Command, Primary Financial Reports -@subsection The @code{print} Command +@subsection The @code{print} command +@findex print The @command{print} command prints out ledger transactions in a textual format that can be parsed by Ledger. They will be properly formatted, @@ -4062,7 +4092,7 @@ file whose formatting has gotten out of hand. @section Reports in other Formats @menu -* Comma Separated Variable files:: +* Comma Separated Values files:: * The lisp command:: * Emacs Org mode:: * Org mode with Babel:: @@ -4071,27 +4101,30 @@ file whose formatting has gotten out of hand. * prices and pricedb:: @end menu -@node Comma Separated Variable files, The lisp command, Reports in other Formats, Reports in other Formats -@subsection Comma Separated Variable files +@node Comma Separated Values files, The lisp command, Reports in other Formats, Reports in other Formats +@subsection Comma Separated Values files @menu * The csv command:: * The convert command:: @end menu -@node The csv command, The convert command, Comma Separated Variable files, Comma Separated Variable files +@node The csv command, The convert command, Comma Separated Values files, Comma Separated Values files @subsubsection The @code{csv} command +@findex csv The @command{csv} command will output print out the desired ledger transactions in a csv format suitable for import into other programs. You can specify the transactions to print using all the normal limiting and searching functions. -@node The convert command, , The csv command, Comma Separated Variable files +@node The convert command, , The csv command, Comma Separated Values files @subsubsection The @code{convert} command @cindex csv conversion @cindex reading csv @cindex comma separated variable file reading +@findex convert +@findex --input-date-format @var{DATE_FORMAT} The @code{convert} command parses a comma separated value (csv) file and outputs Ledger transactions. Many banks offer csv file downloads. @@ -4120,12 +4153,12 @@ Transaction Number,Date,Description,Memo,Amount Debit,Amount Credit,Balance,Chec 1113648,12/12/2011,"Withdrawal","Tuscan IT #00037657",-29.73,,00001908.37,, @end smallexample -Unfortunately, as it stands Ledger cannot read it, but you can. Ledger +Unfortunately, as it stands Ledger cannot read it, but you can. Ledger expects the first line to contain a description of the fields on each -line of the file. The fields ledger can recognize are called -``@code{date}'' ``@code{posted}'', ``@code{code}'', ``@code{payee} or -@code{desc}'', ``@code{amount}'', ``@code{cost}'', ``@code{total}'', and -``@code{note}''. +line of the file. The fields ledger can recognize are called +@option{date}, @option{posted}, @option{code}, @option{payee} or +@option{desc}, @option{amount}, @option{cost}, @option{total}, and +@option{note}. Delete the account description lines at the top, and replace the first line in the data above with: @@ -4137,7 +4170,7 @@ line in the data above with: Then execute ledger like this: @smallexample -ledger convert download.csv --input-date-format "%m/%d/%Y" +$ ledger convert download.csv --input-date-format "%m/%d/%Y" @end smallexample Where the @code{--input-date-format} option tells ledger how to @@ -4160,14 +4193,18 @@ transid,date,payee,note,amount,,,code, Ledger will include @code{; transid: 767718} in the first transaction is from the file above. +@findex --invert +@findex --account @var{STR} +@findex --rich-data + The @code{convert} command accepts three options, the most important ones are @code{--invert} which inverts the amount field, and -@code{--account NAME} which you can use to specify the account to +@code{--account @var{NAME}} which you can use to specify the account to balance against and @code{--rich-data}. When using the rich-data switch additional metadata is stored as tags. There is, for example, a UUID field. If an entry with the same UUID tag is already included -in the normal ledger file (specified via @code{-f} or -@code{$LEDGER_FILE}) this entry will not be printed again. +in the normal ledger file (specified via @code{-f} or via environment +variable @env{LEDGER_FILE}) this entry will not be printed again. You can also use @code{convert} with @code{payee} and @code{account} directives. First, you can use the @code{payee} and @code{alias} @@ -4188,8 +4225,10 @@ match on the new payee field. During the @code{ledger convert} run only the original payee name as specified in the csv data seems to be used. -@node The lisp command, Emacs Org mode, Comma Separated Variable files, Reports in other Formats +@node The lisp command, Emacs Org mode, Comma Separated Values files, Reports in other Formats @subsection The @code{lisp} command +@findex lisp +@findex emacs The @command{lisp} command outputs results in a form that can be read directly by Emacs Lisp. The format of the @code{sexp} is: @@ -4205,6 +4244,7 @@ directly by Emacs Lisp. The format of the @code{sexp} is: @node Emacs Org mode, Org mode with Babel, The lisp command, Reports in other Formats @subsection Emacs @code{org} Mode +@findex org The @code{org} command produces a journal file suitable for use in the Emacs Org mode. More details on using Org mode can be found at @@ -4252,13 +4292,13 @@ line options. : £-1300.00 starting balances @end smallexample -Typing @command{C-c C-c} anywhere in the ``ledger source code block'' -will invoke ledger on the contents of that block and generate a -``results'' block. The results block can appear anywhere in the file -but, by default, will appear immediately below the source code block. +Typing @kbd{C-c C-c} anywhere in the ``ledger source code block'' will +invoke ledger on the contents of that block and generate a ``results'' +block. The results block can appear anywhere in the file but, by +default, will appear immediately below the source code block. -You can combine multiple source code blocks before executing ledger and -do all kinds of other wonderful things with Babel (and org). +You can combine multiple source code blocks before executing ledger +and do all kinds of other wonderful things with Babel (and org). @node Org mode with Babel, The pricemap Command, Emacs Org mode, Reports in other Formats @subsection Org mode with Babel @@ -4301,7 +4341,19 @@ least) in which these can be included: The first two are described in more detail in this short tutorial. -@subsubheading Embedded Ledger example with single source block +@menu +* Embedded Ledger example with single source block:: +* Multiple Ledger source blocks with @command{noweb}:: +* Income Entries:: +* Expenses:: +* Financial Summaries:: +* An overall balance summary:: +* Generating a monthly register:: +* Summary:: +@end menu + +@node Embedded Ledger example with single source block, Multiple Ledger source blocks with @command{noweb}, Org mode with Babel, Org mode with Babel +@subsubsection Embedded Ledger example with single source block The easiest, albeit possibly less useful, way in which to use Ledger within an org file is to use a single source block to record all Ledger @@ -4334,14 +4386,14 @@ entries. The following is an example source block: #+end_src @end smallexample -In this example, we have combined both expenses and income into one set -of Ledger entries. We can now generate register and balance reports (as -well as many other types of reports) using babel to invoke Ledger with -specific arguments. The arguments are passed to Ledger using the -:cmdline header argument. In the code block above, there is no such -argument so the system takes the default. For Ledger code blocks, the -default :cmdline argument is bal and the result of evaluating this code -block (@command{C-c C-c}) would be: +In this example, we have combined both expenses and income into one +set of Ledger entries. We can now generate register and balance +reports (as well as many other types of reports) using babel to invoke +Ledger with specific arguments. The arguments are passed to Ledger +using the :cmdline header argument. In the code block above, there is +no such argument so the system takes the default. For Ledger code +blocks, the default :cmdline argument is bal and the result of +evaluating this code block (@kbd{C-c C-c}) would be: @smallexample #+results: allinone() @@ -4367,7 +4419,8 @@ financial state. Eventually, babel will support passing arguments to currently. Instead, we can use the concepts of literary programming, as implemented by the noweb features of babel, to help us. -@subsubheading Multiple Ledger source blocks with @command{noweb} +@node Multiple Ledger source blocks with @command{noweb}, Income Entries, Embedded Ledger example with single source block, Org mode with Babel +@subsubsection Multiple Ledger source blocks with @command{noweb} The @command{noweb} feature of babel allows us to expand references to other code blocks within a code block. For Ledger, this can be used to @@ -4377,7 +4430,8 @@ of transactions together to generate reports. Using the same transactions used above, we could consider splitting these into expenses and income, as follows: -@subsubheading Income Entries +@node Income Entries, Expenses, Multiple Ledger source blocks with @command{noweb}, Org mode with Babel +@subsubsection Income Entries The first set of entries relates to income, either monthly pay or interest, all typically going into one of my bank accounts. Here, I have @@ -4406,7 +4460,8 @@ have the :noweb yes babel header argument specified. #+end_src @end smallexample -@subsubheading Expenses +@node Expenses, Financial Summaries, Income Entries, Org mode with Babel +@subsubsection Expenses The following entries relate to personal expenses, such as rent and food. Again, these have all been placed in a single src block but could @@ -4424,7 +4479,8 @@ have been done individually. #+end_src @end smallexample -@subsubheading Financial Summaries +@node Financial Summaries, An overall balance summary, Expenses, Org mode with Babel +@subsubsection Financial Summaries Given the ledger entries defined above in the income and expenses code blocks, we can now refer to these using the noweb expansion @@ -4433,11 +4489,12 @@ to generate specific reports for those transactions. Below are two examples, one to generate a balance report and one to generate a register report of all transactions. -@subsubheading An overall balance summary +@node An overall balance summary, Generating a monthly register, Financial Summaries, Org mode with Babel +@subsubsection An overall balance summary The overall balance of your account and expenditure with a breakdown according to category is specified by passing the :cmdline bal -argument to Ledger. This code block can now be evaluated (@code{C-c +argument to Ledger. This code block can now be evaluated (@kbd{C-c C-c}) and the results generated by incorporating the transactions referred to by the @code{<<income>>} and @code{<<expenses>>} lines. @@ -4478,7 +4535,8 @@ in the report. : £-1300.00 starting balances @end smallexample -@subsubheading Generating a monthly register +@node Generating a monthly register, Summary, An overall balance summary, Org mode with Babel +@subsubsection Generating a monthly register You can also generate a monthly register (the reg command) by executing the following src block. This presents a summary of @@ -4524,7 +4582,8 @@ the running total of the assets in our ledger. : 2010/08/01 - 2010/08/01 assets:bank:chequing £1000.00 £2653.53 @end smallexample -@subsubheading Summary +@node Summary, , Generating a monthly register, Org mode with Babel +@subsubsection Summary This short tutorial shows how Ledger entries can be embedded in a org file and manipulated using Babel. However, only simple Ledger features @@ -4532,7 +4591,8 @@ have been illustrated; please refer to the Ledger documentation for examples of more complex operations with a ledger. @node The pricemap Command, The xml Command, Org mode with Babel, Reports in other Formats -@subsection The @code{pricemap} Command +@subsection The @code{pricemap} command +@findex pricemap If you have the @code{graphviz} graph visualization package installed, ledger can generate a graph of the relationship between your various @@ -4543,7 +4603,8 @@ commodities valued in terms of each other. For example, multiple currencies and multiples investments valued in those currencies. @node The xml Command, prices and pricedb, The pricemap Command, Reports in other Formats -@subsection The @code{xml} Command +@subsection The @code{xml} command +@findex xml By default, Ledger uses a human-readable data format, and displays its reports in a manner meant to be read on screen. For the purpose of @@ -4642,7 +4703,7 @@ The format of an amount contains two members, the commodity and the quantity. The commodity can have a set of flags that indicate how to display it. The meaning of the flags (all of which are optional) are: -@table @strong +@table @code @item P The commodity is prefixed to the value. @item S @@ -4693,7 +4754,9 @@ output such data if the @command{xml} command is used, and can read the same data. @node prices and pricedb, , The xml Command, Reports in other Formats -@subsection @code{prices} and @code{pricedb} +@subsection @code{prices} and @code{pricedb} commands +@findex prices +@findex pricedb The @command{prices} command displays the price history for matching commodities. The @code{-A} flag is useful with this report, to @@ -4707,6 +4770,7 @@ pricedb database files. @node Reports about your Journals, , Reports in other Formats, Reporting Commands @section Reports about your Journals +@findex --count @menu * accounts:: @@ -4714,10 +4778,13 @@ pricedb database files. * commodities:: * tags:: * entry and xact:: +* stats:: +* select:: @end menu @node accounts, payees, Reports about your Journals, Reports about your Journals @subsection @code{accounts} +@findex accounts The @command{accounts} reports all of the accounts in the journal. Following the command with a regular expression will limit the output @@ -4727,20 +4794,23 @@ account. @node payees, commodities, accounts, Reports about your Journals @subsection @code{payees} +@findex payees -The @command{payees} reports all of the unique payees in the -journal. To filter the payees displayed you must use the prefix: +The @command{payees} reports all of the unique payees in the journal. +Using the @code{--count} option will tell you how many entries use +each payee. To filter the payees displayed you must use the prefix: @smallexample -macbook-2:$ ledger payees 'Tar.+t' -El Dorade Restaurant -My Big Fat Greek Restaurant -Target -macbook-2:$ +$ ledger payees @@Nic +Nicolas +Nicolas BOILABUS +Oudtshoorn Municipality +Vaca Veronica @end smallexample @node commodities, tags, payees, Reports about your Journals @subsection @command{commodities} +@findex commodities Report all commodities present in the journals under consideration. The output is sorted by name. Using the @code{--count} option will @@ -4748,14 +4818,19 @@ tell you how many entries use each commodity. @node tags, entry and xact, commodities, Reports about your Journals @subsection @command{tags} +@findex tags +@findex --values The @command{tags} reports all of the tags in the journal. The output is sorted by name. Using the @code{--count} option will tell you how many entries use each tag. Using the @code{--values} option will report the values used by each tag. -@node entry and xact, , tags, Reports about your Journals +@node entry and xact, stats, tags, Reports about your Journals @subsection @command{draft}, @command{entry} and @command{xact} +@findex draft +@findex entry +@findex xact The @code{draft}, @code{entry} and @command{xact} commands simplify the creation of new transactions. It works on the principle that 80% @@ -4776,7 +4851,7 @@ Italiano} again. The exact amounts are different, but the overall form is the same. With the @command{xact} command you can type: @smallexample -ledger entry 2004/4/9 viva food 11 tips 2.50 +$ ledger entry 2004/4/9 viva food 11 tips 2.50 @end smallexample This produces the following output: @@ -4792,23 +4867,36 @@ It works by finding a past posting matching the regular expression @code{viva}, and assuming that any accounts or amounts specified will be similar to that earlier posting. If Ledger does not succeed in generating a new transaction, an error is printed and the exit code is -set to @code{1}. +set to @samp{1}. Here are a few more examples of the @command{xact} command, assuming the above journal transaction: @smallexample -ledger entry 4/9 viva 11.50 -ledger entry 4/9 viva 11.50 checking # (from `checking') -ledger entry 4/9 viva food 11.50 tips 8 -ledger xact 4/9 viva food 11.50 tips 8 cash -ledger xact 4/9 viva food $11.50 tips $8 cash -ledger xact 4/9 viva dining "DM 11.50" +$ ledger entry 4/9 viva 11.50 +$ ledger entry 4/9 viva 11.50 checking # (from `checking') +$ ledger entry 4/9 viva food 11.50 tips 8 +$ ledger xact 4/9 viva food 11.50 tips 8 cash +$ ledger xact 4/9 viva food $11.50 tips $8 cash +$ ledger xact 4/9 viva dining "DM 11.50" @end smallexample @command{xact} is identical to @command{entry} and is provide for backwards compatibility with Ledger 2.X. +@node stats, select, entry and xact, Reports about your Journals +@subsection @code{stats} +@findex stats +@findex stat + +FIX THIS ENTRY @c FIXME thdox + +@node select, , stats, Reports about your Journals +@subsection @code{select} +@findex select + +FIX THIS ENTRY @c FIXME thdox + @node Command-line Syntax, Budgeting and Forecasting, Reporting Commands, Top @chapter Command-line Syntax @@ -4832,7 +4920,7 @@ a large number of options for refining the output from those commands. The basic syntax of any ledger command is: @smallexample -ledger [OPTIONS...] COMMAND [ARGS...] +$ ledger [OPTIONS...] COMMAND [ARGS...] @end smallexample After the command word there may appear any number of arguments. For @@ -4843,19 +4931,20 @@ meaning, described below. The regular expressions arguments always match the account name that a posting refers to. To match on the payee of the transaction -instead, precede the regular expression with @code{payee} or @@. For -example, the following balance command reports account totals for -rent, food and movies, but only those whose payee matches Freddie: +instead, precede the regular expression with @samp{payee} or +@samp{@@}. For example, the following balance command reports account +totals for rent, food and movies, but only those whose payee matches +Freddie: @smallexample -ledger bal rent food movies payee freddie +$ ledger bal rent food movies payee freddie @end smallexample @noindent or @smallexample -ledger bal rent food movies @@freddie +$ ledger bal rent food movies @@freddie @end smallexample There are many, many command options available with the @@ -4879,134 +4968,263 @@ commands. @node Reporting Commands Quick Reference, Basic Options Quick Reference, Command Line Quick Reference, Command Line Quick Reference @subsection Reporting Commands -@multitable @columnfractions .2 .8 -@item @strong{Report} @tab @strong{Description} -@item @code{balance} @tab Show account balances -@item @code{register} @tab Show all transactions with running total -@item @code{csv} @tab Show transactions in csv format, for exporting to other programs -@item @code{print} @tab Print transaction in a ledger readable format -@item @code{xml} @tab Produce XML output of the register command -@item @code{emacs} @tab Produce Emacs lisp output -@item @code{equity} @tab Print account balances as transactions -@item @code{prices} @tab Print price history for matching commodities -@item @code{pricedb} @tab Print price history for matching commodities in ledger readable format -@item @code{xact} @tab Generate transactions based on previous postings -@end multitable +@ftable @code +@item balance +@itemx bal +Show account balances +@item register +@itemx reg +Show all transactions with running total +@item csv +Show transactions in csv format, for exporting to other programs +@item print +Print transaction in a ledger readable format +@item xml +Produce XML output of the register command +@item lisp +@itemx emacs +Produce Emacs lisp output +@item equity +Print account balances as transactions +@item prices +Print price history for matching commodities +@item pricedb +Print price history for matching commodities in ledger readable format +@item xact +Generate transactions based on previous postings +@end ftable @node Basic Options Quick Reference, Report Filtering Quick Reference, Reporting Commands Quick Reference, Command Line Quick Reference @subsection Basic Options -@multitable @columnfractions .1 .25 .65 -@item @strong{Short} @tab @strong{Long} @tab @strong{Description} -@item @code{-h} @tab @code{--help} @tab Print summary of all options -@item @code{-v} @tab @code{--version} @tab Print version of ledger executable -@item @code{-f FILE} @tab @code{--file FILE} @tab Read @file{FILE} as a ledger file -@item @code{-o FILE} @tab @code{--output FILE} @tab Redirect output to @file{FILE} -@item @code{-i FILE} @tab @code{--init-file FILE} @tab Specify options file -@item @code{-a NAME} @tab @code{--account NAME} @tab Specify default account name for QIF file postings -@end multitable +@ftable @code +@item --help +@itemx -h +Print summary of all options + +@item --version +@itemx -v +Print version of ledger executable + +@item --file @var{FILE} +@itemx -f @var{FILE} +Read @file{FILE} as a ledger file + +@item --output @var{FILE} +@itemx -o @var{FILE} +Redirect output to @file{FILE} + +@item --init-file @var{FILE} +@itemx -i @var{FILE} +Specify options file + +@item --account @var{STR} +@itemx -a @var{STR} +Specify default account @var{STR} for QIF file postings +@end ftable @node Report Filtering Quick Reference, Error Checking and Calculation Options, Basic Options Quick Reference, Command Line Quick Reference @subsection Report Filtering -@multitable @columnfractions .1 .25 .65 -@item @strong{Short} @tab @strong{Long} @tab @strong{Description} -@item @code{-c} @tab @code{--current} @tab Display transaction on or before the current date -@item @code{-b DATE} @tab @code{--begin DATE} @tab Begin reports on or after @code{DATE} -@item @code{-e DATE} @tab @code{--end DATE} @tab Limit end date of transactions for report -@item @code{-p STR} @tab @code{--period} @tab Set report period to STR -@item @code{ } @tab @code{--period-sort} @tab Sort postings within each period -@item @code{-C} @tab @code{--cleared} @tab Display only cleared postings -@item @code{} @tab @code{--dc} @tab Display register or balance in debit/credit format -@item @code{-U} @tab @code{--uncleared} @tab Display only uncleared postings -@item @code{-R} @tab @code{--real} @tab Display only real postings -@item @code{-L} @tab @code{--actual} @tab Display only actual postings, not automated -@item @code{-r} @tab @code{--related} @tab Display related postings -@item @code{} @tab @code{--budget} @tab Display how close your postings meet your budget -@item @code{} @tab @code{--add-budget} @tab Show un-budgeted postings -@item @code{} @tab @code{--unbudgeted} @tab Show only un-budgeted postings -@item @code{} @tab @code{--forecast} @tab Project balances into the future -@item @code{-l EXPR} @tab @code{--limit EXPR} @tab Limit postings in calculations -@item @code{-t EXPR} @tab @code{--amount} @tab Change value expression reported in register report -@item @code{-T EXPR} @tab @code{--total} @tab Change the value expression used for ``totals'' column in register and balance reports -@end multitable +@ftable @code +@item --current +@itemx -c +Display transaction on or before the current date +@item --begin @var{DATE} +@itemx -b @var{DATE} +Begin reports on or after @var{DATE} +@item --end @var{DATE} +@itemx -e @var{DATE} +Limit end date of transactions for report +@item --period @var{PERIOD_EXPRESSION} +@itemx -p @var{PERIOD_EXPRESSION} +Set report period to @var{PERIOD_EXPRESSION} +@item --period-sort @var{VEXPR} +Sort postings within each period +@item --cleared +@itemx -C +Display only cleared postings +@item --dc +Display register or balance in debit/credit format +@item --uncleared +@itemx -U +Display only uncleared postings +@item --real +@itemx -R +Display only real postings +@item --actual +@itemx -L +Display only actual postings, not automated +@item --related +@itemx -r +Display related postings +@item --budget +Display how close your postings meet your budget +@item --add-budget +Show un-budgeted postings +@item --unbudgeted +Show only un-budgeted postings +@item --forecast +Project balances into the future +@item --limit @var{EXPR} +@itemx -l @var{EXPR} +Limit postings in calculations +@item --amount @var{EXPR} +@itemx -t @var{EXPR} +Change value expression reported in @command{register} report +@item --total @var{VEXPR} +@itemx -T @var{VEXPR} +Change the value expression used for ``totals'' column in +@command{register} and @command{balance} reports +@end ftable @node Error Checking and Calculation Options, Output Customization Quick Reference, Report Filtering Quick Reference, Command Line Quick Reference -@subsection Error Checking and Calculation Options - -@multitable @columnfractions .1 .25 .65 -@item @strong{Short} @tab @strong{Long} @tab @strong{Description} -@item @code{} @tab @code{--strict} @tab Accounts, tags or commodities not previously declared will cause warnings -@item @code{} @tab @code{--pedantic} @tab Accounts, tags or commodities not previously declared will cause errors -@item @code{} @tab @code{--check-payees} @tab Enable strict and pedantic checking for payees as well as accounts, commodities and tags -@item @code{} @tab @code{--immediate} @tab Instruct ledger to evaluate calculations immediately rather than lazily -@end multitable +@subsection Error Checking and Calculation Options + +@ftable @code +@item --strict +Accounts, tags or commodities not previously declared will cause warnings +@item --pedantic +Accounts, tags or commodities not previously declared will cause errors +@item --check-payees +Enable strict and pedantic checking for payees as well as accounts, commodities and tags +@item --immediate +Instruct ledger to evaluate calculations immediately rather than lazily +@end ftable @node Output Customization Quick Reference, Grouping Options, Error Checking and Calculation Options, Command Line Quick Reference @subsection Output Customization -@multitable @columnfractions .15 .4 .45 -@item @strong{Short} @tab @strong{Long} @tab @strong{Description} -@item @code{-n} @tab @code{--collapse} @tab Collapse transactions with multiple postings -@item @code{-s} @tab @code{--subtotal} @tab Report register as a single subtotal -@item @code{-P} @tab @code{--by-payee} @tab Report subtotals by payee -@item @code{-E} @tab @code{--empty} @tab Include empty accounts in report -@item @code{-W} @tab @code{--weekly} @tab Report posting totals by week -@item @code{-Y} @tab @code{--yearly} @tab Report posting totals by year -@item @code{} @tab @code{--dow} @tab Report Posting totals by day of week -@item @code{-S EXPR} @tab @code{--sort EXPR} @tab Sort a report using @code{EXPR} -@item @code{-w} @tab @code{--wide} @tab Assume 132 columns instead of 80 -@item @code{} @tab @code{--head N} @tab Report the first N postings -@item @code{} @tab @code{--tail N} @tab Report the last N postings -@item @code{} @tab @code{--pager PATH} @tab Direct output to @code{PATH} pager program -@item @code{-A} @tab @code{--average} @tab Report average posting value -@item @code{-D} @tab @code{--deviation} @tab Report each posting deviation from the average -@item @code{-%} @tab @code{--percent} @tab Show subtotals in the balance report as percentages -@c @item @code{} @tab @code{--totals} @tab Include running total in the @code{xml} report -@item @code{} @tab @code{--pivot TAG} @tab Produce a pivot table of the tag type specified -@item @code{-j} @tab @code{--amount-data} @tab Show only date and value column to format the output for plots -@item @tab @code{--plot-amount-format STR} @tab Specify the format for the plot output -@item @code{-J} @tab @code{--total-data} @tab Show only dates and totals to format the output for plots -@item @tab @code{--plot-total-format STR} @tab Specify the format for the plot output -@item @code{-d EXPR} @tab @code{--display EXPR} @tab Display only posting that meet the criterias in the EXPR -@item @code{-y STR} @tab @code{--date-format STR} @tab Change the basic date format used in reports -@item @code{-F STR} @tab @code{--format STR} @tab Set reporting format -@item @code{} @tab @code{--balance-format STR} @tab -@item @code{} @tab @code{--register-format STR} @tab -@item @code{} @tab @code{--prices-format STR} @tab -@item @code{-w register} @tab @code{--wide-register-format STR} @tab -@item @code{} @tab @code{--anon} @tab Print the ledger register with anonymized accounts and payees, useful for filing bug reports -@end multitable +@ftable @code +@item --collapse +@itemx -n +Collapse transactions with multiple postings +@item --subtotal +@itemx -s +Report register as a single subtotal +@item --by-payee +@itemx -P +Report subtotals by payee +@item --empty +@itemx -E +Include empty accounts in report +@item --weekly +@itemx -W +Report posting totals by week +@item --yearly +@itemx -Y +Report posting totals by year +@item --dow +Report Posting totals by day of week +@item --sort @var{VEXPR} +@itemx -S @var{VEXPR} +Sort a report using @var{VEXPR} +@item --wide +@itemx -w +Assume 132 columns instead of 80 +@item --head @var{INT} +Report the first @var{INT} postings +@item --tail @var{INT} +Report the last @var{INT} postings +@item --pager @var{FILE} +Direct output to @var{FILE} pager program +@item --average +@itemx -A +Report average posting value +@item --deviation +@itemx -D +Report each posting deviation from the average +@item --percent +@itemx -% +Show subtotals in the balance report as percentages +@c @item --totals +@c Include running total in the @code{xml} report +@item --pivot @var{TAG} +Produce a pivot table of the @var{TAG} type specified +@item --amount-data +@itemx -j +Show only date and value column to format the output for plots +@item --plot-amount-format @var{FORMAT_STRING} +Specify the format for the plot output +@item --total-data +@itemx -J +Show only dates and totals to format the output for plots +@item --plot-total-format @var{FORMAT_STRING} +Specify the format for the plot output +@item --display @var{EXPR} +@itemx -d @var{EXPR} +Display only posting that meet the criterias in the @var{EXPR} +@item --date-format @var{DATE_FORMAT} +@itemx -y @var{DATE_FORMAT} +Change the basic date format used in reports +@item --format @var{FORMAT_STRING} +@itemx --balance-format @var{FORMAT_STRING} +@itemx --register-format @var{FORMAT_STRING} +@itemx --prices-format @var{FORMAT_STRING} +@itemx -F @var{FORMAT_STRING} +Set reporting format +@item --wide +@itemx -w +Wide +@item --anon +Print the ledger register with anonymized accounts and payees, useful for filing bug reports +@end ftable @node Grouping Options, Commodity Reporting Quick Reference, Output Customization Quick Reference, Command Line Quick Reference @subsection Grouping Options -@multitable @columnfractions .1 .25 .65 -@item @strong{Short} @tab @strong{Long} @tab @strong{Description} -@item @code{-P} @tab @code{--by-payee} @tab Group postings by common payee names -@item @code{-D} @tab @code{--daily} @tab Group postings by day -@item @code{-W} @tab @code{--weekly} @tab Group postings by week -@item @code{-M} @tab @code{--monthly} @tab Group postings by month -@item @code{} @tab @code{--quarterly} @tab Group postings by quarter -@item @code{-Y} @tab @code{--yearly} @tab Group postings by year -@item @code{} @tab @code{--dow} @tab Group by day of weeks -@item @code{-s} @tab @code{--subtotal} @tab Group posting together, similar to balance report -@end multitable +@ftable @code +@item --by-payee +@itemx -P +Group postings by common payee names +@item --daily +@itemx -D +Group postings by day +@item --weekly +@itemx -W +Group postings by week +@item --monthly +@itemx -M +Group postings by month +@item --quarterly +Group postings by quarter +@item --yearly +@itemx -Y +Group postings by year +@item --dow +Group by day of weeks +@item --subtotal +@itemx -s +Group posting together, similar to balance report +@end ftable @node Commodity Reporting Quick Reference, , Grouping Options, Command Line Quick Reference @subsection Commodity Reporting -@multitable @columnfractions .1 .25 .65 -@item @strong{Short} @tab @strong{Long} @tab @strong{Description} -@item @code{} @tab @code{--price-db FILE} @tab Use @file{FILE} for retrieving stored commodity prices -@item @code{-L MINS} @tab @code{--price-exp MINS} @tab Set expected freshness of prices in minutes -@item @code{-Q} @tab @code{--download} @tab Download quotes using @code{getquote} -@item @code{} @tab @code{--getquote} @tab Sets path to a user defined script to download commodity prices. -@item @code{-O} @tab @code{--quantity} @tab Report commodity totals without conversion -@item @code{-B} @tab @code{--basis} @tab Report cost basis -@item @code{-V} @tab @code{--market} @tab Report last known market value -@item @code{-G} @tab @code{--gain} @tab Report net gain loss for commodities that have a price history -@end multitable +@ftable @code +@item --price-db @var{FILE} +Use @file{FILE} for retrieving stored commodity prices. +@item --price-exp @var{INT} +@itemx -L @var{INT} +Set expected freshness of prices in @var{INT} minutes. +@item --download +@itemx -Q +Download quotes using named @file{getquote}. +@item --getquote @var{FILE} +Sets path to a user defined script to download commodity prices. +@item --quantity +@itemx -O +Report commodity totals without conversion. +@item --basis +@itemx -B +Report cost basis. +@item --market +@itemx -V +Report last known market value. +@item --gain +@itemx -G +Report net gain loss for commodities that have a price history. +@end ftable @node Detailed Options Description, Period Expressions, Command Line Quick Reference, Command-line Syntax @section Detailed Option Description @@ -5032,17 +5250,21 @@ GUIs, which would make use of the different scopes by keeping an instance of Ledger running in the background and running multiple sessions with multiple reports per session. -@table @code +@ftable @code @item --args-only Ignore all environment and init-file settings and use only command-line arguments to control Ledger. Useful for debugs or testing small Journal files not associated with you main financial database. +@item --debug @var{CODE} +FIX THIS ENTRY @c FIXME thdox + @item --help +@itemx -h Display the info page for ledger. -@item --init-file <PATH> +@item --init-file @var{FILE} Specify the location of the init file. The default is @file{~/.ledgerrc} @item --options @@ -5050,8 +5272,8 @@ Display the options in effect for this Ledger invocation, along with their values and the source of those values, for example: @smallexample -14:15:02 > ledger --options bal --cleared -f ~/ledger/test/input/drewr3.dat -=============================================================================== +$ ledger --options bal --cleared -f ~/ledger/test/input/drewr3.dat +=========================================================================== [Global scope options] [Session scope options] @@ -5070,7 +5292,7 @@ their values and the source of those values, for example: --account-width = 21 ?normalize --amount-width = 12 ?normalize --total-width = 12 ?normalize -=============================================================================== +=========================================================================== $ 775.00 Assets:Checking $ -1,000.00 Equity:Opening Balances $ 225.00 Expenses:Food:Groceries @@ -5079,15 +5301,31 @@ their values and the source of those values, for example: @end smallexample @noindent -For the source column, a value starting with a @code{-} or @code{--} +For the source column, a value starting with a @samp{-} or @samp{--} indicated the source was a command line argument. It the entry starts -with a @code{$}, the source was an environment variable. If the source +with a @samp{$}, the source was an environment variable. If the source is @code{?normalize} the value was set internally by ledger, in a function called @code{normalize_options}. -@item --script <PATH> +@item --script @var{FILE} Execute a ledger script. -@end table + +@item --trace @var{INT} +FIX THIS ENTRY @c FIXME thdox + +@item --verbose +@itemx -v +FIX THIS ENTRY @c FIXME thdox + +@item --verify +FIX THIS ENTRY @c FIXME thdox + +@item --verify-memory +FIX THIS ENTRY @c FIXME thdox + +@item --version +FIX THIS ENTRY @c FIXME thdox +@end ftable @node Session Options, Report Options, Global Options, Detailed Options Description @subsection Session Options @@ -5099,40 +5337,54 @@ GUIs, which would make use of the different scopes by keeping an instance of Ledger running in the background and running multiple sessions with multiple reports per session. -@table @code +@ftable @code +@item --cache @var{FIXME} +FIX THIS ENTRY @c FIXME thdox + +@item --check-payees +FIX THIS ENTRY @c FIXME thdox + +@item --day-break +FIX THIS ENTRY @c FIXME thdox + @item --decimal-comma Direct Ledger to parse journals using the European standard comma as decimal separator, vice a period. @item --download +@itemx -Q Direct Ledger to download prices using the script defined in -@code{--getquote}. +@code{--getquote @var{FILE}}. -@item --file <PATH> -Specify the input file path for this invocation. +@item --explicit +FIX THIS ENTRY @c FIXME thdox -@item --getquote <PATH> +@item --file @var{FILE} +@itemx -f @var{FILE} +Specify the input @file{FILE} for this invocation. + +@item --getquote @var{FILE} @cindex getquote @cindex download prices Tell ledger where to find the user defined script to download prices information. -@item --input-date-format <DATE-FORMAT> +@item --input-date-format @var{DATE_FORMAT} Specify the input date format for journal entries. For example, @smallexample -ledger convert Export.csv --input-date-format "%m/%d/%Y" +$ ledger convert Export.csv --input-date-format "%m/%d/%Y" @end smallexample Would convert the @file{Export.csv} file to ledger format, assuming the dates in the CSV file are like 12/23/2009 (@pxref{Date and Time Format Codes}). -@item --master-account <STRING> +@item --master-account @var{STR} Prepend all account names with the argument. @smallexample -21:51:39 ~/ledger (next)> ledger -f test/input/drewr3.dat bal --master-account HUMBUG +$ ledger -f test/input/drewr3.dat bal --master-account HUMBUG 0 HUMBUG $ -3,804.00 Assets $ 1,396.00 Checking @@ -5155,15 +5407,23 @@ Prepend all account names with the argument. $ 200.00 Mortgage:Principal @end smallexample -@item --price-db <PATH> +@item --pedantic +FIX THIS ENTRY @c FIXME thdox + +@item --permissive +FIX THIS ENTRY @c FIXME thdox + +@item --price-db @var{FILE} Specify the location of the price entry data file. -@item --price-exp INTEGER_MINUTES -Set the expected freshness of price quotes, in minutes. That is, if -the last known quote for any commodity is older than this value, and -if @code{--download} is being used, then the Internet will be -consulted again for a newer price. Otherwise, the old price is still -considered to be fresh enough. +@item --price-exp @var{INT} +@itemx -Z @var{INT} +@itemx --leeway @var{INT} +Set the expected freshness of price quotes, in @var{INT} minutes. That +is, if the last known quote for any commodity is older than this +value, and if @code{--download} is being used, then the Internet will +be consulted again for a newer price. Otherwise, the old price is +still considered to be fresh enough. @item --strict Ledger normally silently accepts any account or commodity in @@ -5173,7 +5433,13 @@ Ledger interprets all cleared transactions as correct, and if it finds a new account or commodity (same as a misspelled commodity or account) it will issue a warning giving you the file and line number of the problem. -@end table + +@item --time-colon +FIX THIS ENTRY @c FIXME thdox + +@item --value-expr @var{FIXME} +FIX THIS ENTRY @c FIXME thdox +@end ftable @node Report Options, Basic options, Session Options, Detailed Options Description @subsection Report Options @@ -5185,186 +5451,197 @@ GUIs, which would make use of the different scopes by keeping an instance of Ledger running in the background and running multiple sessions with multiple reports per session. -@table @code -@item --abbrev-len <INT> -Set the minimum -length an account can be abbreviated to if it doesn't fit inside the -@code{account-width}. If @code{abbrev-len} is zero, then the account -name will be truncated on the right. If @code{abbrev-len} is greater +@ftable @code +@item --abbrev-len @var{INT} +Set the minimum length an account can be abbreviated to if it doesn't +fit inside the @code{account-width}. If @var{INT} is zero, then the +account name will be truncated on the right. If @var{INT} is greater than @code{account-width} then the account will be truncated on the left, with no shortening of the account names in order to fit into the desired width. -@item --account <STR> -Prepend @code{<STR>} to all accounts reported. That is, the option -@code{--account Personal} would tack @code{Personal:} to the beginning +@item --account @var{STR} +Prepend @var{STR} to all accounts reported. That is, the option +@code{--account Personal} would tack @samp{Personal:} to the beginning of every account reported in a balance report or register report. -@item --account-width <INT> -Set the width of the account column in -the @code{register} report to @code{N} characters. - -@item --actual-dates -Show actual dates of transactions -(@pxref{Effective Dates}). Also @code{-L}. +@item --account-width @var{INT} +Set the width of the account column in the @command{register} report +to @var{INT} characters. @item --actual -Report only real transactions, with no automated or -virtual transactions used. +@itemx -L +Report only real transactions, with no automated or virtual +transactions used. @item --add-budget Show only un-budgeted postings. -@item --amount-data -On a register report print only the dates and -amount of postings. Useful for graphing and spreadsheet applications. +@item --amount @var{EXPR} +@itemx -t @var{EXPR} +Apply the given value expression to the posting amount (@pxref{Value +Expressions}). Using @code{--amount} you can apply an arbitrary +transformation to the postings. -@item --amount <EXPR> -Apply the given value expression to the posting -amount (@pxref{Value Expressions}). Using @code{--amount} you can apply -an arbitrary transformation to the postings. +@item --amount-data +@itemx -j +On a register report print only the dates and amount of postings. +Useful for graphing and spreadsheet applications. -@item --amount-width <INT> -Set the width in characters of the amount -column in the register report. +@item --amount-width @var{INT} +Set the width in characters of the amount column in the +@command{register} report. @item --anon -Anonymize registry output, mostly for sending in bug -reports. +Anonymize registry output, mostly for sending in bug reports. + +@item --auto-match +FIX THIS ENTRY @c FIXME thdox + +@item --aux-date +@itemx --effective +Show auxiliary dates for all calculations (@pxref{Effective Dates}). @item --average -Print average values over the number of transactions -instead of running totals. +@itemx -A +Print average values over the number of transactions instead of +running totals. -@item --balance-format <STR> -Specify the format to use for the -@code{balance} report (@pxref{Format Strings}). The default is: +@item --balance-format @var{FORMAT_STRING} +Specify the format to use for the @code{balance} report (@pxref{Format +Strings}). The default is: @smallexample - "%(justify(scrub(display_total), 20, -1, true, color))" - " %(!options.flat ? depth_spacer : \"\")" - "%-(ansify_if(partial_account(options.flat), blue if color))\n%/" - "%$1\n%/" - "--------------------\n" +"%(justify(scrub(display_total), 20, -1, true, color))" +" %(!options.flat ? depth_spacer : \"\")" +"%-(ansify_if(partial_account(options.flat), blue if color))\n%/" +"%$1\n%/" +"--------------------\n" @end smallexample @item --base -ASK JOHN +FIX THIS ENTRY @c ASK JOHN @item --basis +@itemx -B +@itemx --cost Report the cost basis on all posting -@item --begin <DATE> -Specify the start date of all calculations. -Transactions before that date will be ignored. +@item --begin @var{DATE} +Specify the start @var{DATE} of all calculations. Transactions before +that date will be ignored. -@item --bold-if <EXPR> -Print the entire line in bold if the given -value expression is true (@pxref{Value Expressions}). +@item --bold-if @var{VEXPR} +Print the entire line in bold if the given value expression is true +(@pxref{Value Expressions}). @smallexample -ledger reg Expenses --begin Dec --bold-if "amount > 100" +$ ledger reg Expenses --begin Dec --bold-if "amount > 100" @end smallexample @noindent list all transactions since the beginning of December and bold any posting greater than $100 -@item --budget-format <FORMAT_STRING> -Specify the format to use for the @code{budget} report (@pxref{Format -Strings}). The default is: - -@smallexample - "%(justify(scrub(display_total), 20, -1, true, color))" - " %(!options.flat ? depth_spacer : \"\")" - "%-(ansify_if(partial_account(options.flat), blue if color))\n%/" - "%$1\n%/" - "--------------------\n" -@end smallexample - @item --budget Only display budgeted items. In a register report this displays transaction in the budget, in a balance report this displays accounts in the budget (@pxref{Budgeting and Forecasting}). -@item --by-payee <REGEXP> -Group the register report by payee. - -@item --cleared-format <FORMAT_STRING> -Specify the format to use -for the @code{cleared} report (@pxref{Format Strings}). The default is: +@item --budget-format @var{FORMAT_STRING} +Specify the format to use for the @code{budget} report (@pxref{Format +Strings}). The default is: @smallexample - "%(justify(scrub(get_at(total_expr, 0)), 16, 16 + prepend_width, " - " true, color)) %(justify(scrub(get_at(total_expr, 1)), 18, " - " 36 + prepend_width, true, color))" - " %(latest_cleared ? format_date(latest_cleared) : \" \")" - " %(!options.flat ? depth_spacer : \"\")" - "%-(ansify_if(partial_account(options.flat), blue if color))\n%/" - "%$1 %$2 %$3\n%/" - "%(prepend_width ? \" \" * prepend_width : \"\")" - "---------------- ---------------- ---------\n" +"%(justify(scrub(display_total), 20, -1, true, color))" +" %(!options.flat ? depth_spacer : \"\")" +"%-(ansify_if(partial_account(options.flat), blue if color))\n%/" +"%$1\n%/" +"--------------------\n" @end smallexample +@item --by-payee +@itemx -P +Group the register report by payee. + @item --cleared +@itemx -C Consider only transaction that have been cleared for display and calculation. +@item --cleared-format @var{FORMAT_STRING} +FIX THIS ENTRY @c FIXME thdox: to keep? +Specify the format to use for the @code{cleared} report (@pxref{Format +Strings}). The default is: + +@smallexample +"%(justify(scrub(get_at(total_expr, 0)), 16, 16 + prepend_width, " +" true, color)) %(justify(scrub(get_at(total_expr, 1)), 18, " +" 36 + prepend_width, true, color))" +" %(latest_cleared ? format_date(latest_cleared) : \" \")" +" %(!options.flat ? depth_spacer : \"\")" +"%-(ansify_if(partial_account(options.flat), blue if color))\n%/" +"%$1 %$2 %$3\n%/" +"%(prepend_width ? \" \" * prepend_width : \"\")" +"---------------- ---------------- ---------\n" +@end smallexample + @item --collapse -By default ledger prints all account in an account -tree. With @code{--collapse} it print only the top level account -specified. +@itemx -n +By default ledger prints all account in an account tree. With +@code{--collapse} it print only the top level account specified. @item --collapse-if-zero Collapse the account display only if it has a zero balance. @item --color +@itemx --ansi Use color is the tty supports it. -@item --columns <INT> -Specify the width of the register report in -characters. +@item --columns @var{INT} +Specify the width of the @command{register} report in characters. @item --count Direct ledger to report the number of items when appended to the commodities, accounts or payees command. -@item --csv-format -Specify the format to use for the @code{csv} -report (@pxref{Format Strings}). The default is: +@item --csv-format @var{FORMAT_STRING} +Specify the format to use for the @code{csv} report (@pxref{Format +Strings}). The default is: @smallexample - "%(quoted(date))," - "%(quoted(code))," - "%(quoted(payee))," - "%(quoted(display_account))," - "%(quoted(commodity))," - "%(quoted(quantity(scrub(display_amount))))," - "%(quoted(cleared ? \"*\" : (pending ? \"!\" : \"\")))," - "%(quoted(join(note | xact.note)))\n" +"%(quoted(date))," +"%(quoted(code))," +"%(quoted(payee))," +"%(quoted(display_account))," +"%(quoted(commodity))," +"%(quoted(quantity(scrub(display_amount))))," +"%(quoted(cleared ? \"*\" : (pending ? \"!\" : \"\")))," +"%(quoted(join(note | xact.note)))\n" @end smallexample @item --current Shorthand for @code{--limit "date <= today"} @item --daily +@itemx -D Shorthand for @code{--period "daily"} -@item --date-format <DATE-FORMAT> -Specify format ledger should use -to print dates (@pxref{Date and Time Format Codes}). +@item --date @var{EXPR} +Transform the date of the transaction using @var{EXPR}. -@item --date <EXPR> -Transform the date of the transaction using -@code{EXPR} +@item --date-format @var{DATE_FORMAT} +@itemx -y @var{DATE_FORMAT} +Specify format ledger should use to print dates (@pxref{Date and Time +Format Codes}). -@item --date-width <INT> -Specify the width, in characters, of the -date column in the register report. +@item --date-width @var{INT} +Specify the width, in characters, of the date column in the +@command{register} report. -@item --datetime-format -ASK JOHN +@item --datetime-format @var{FIXME} +FIX THIS ENTRY @c ASK JOHN @item --dc Display register or balance in debit/credit format If you use @@ -5372,30 +5649,30 @@ Display register or balance in debit/credit format If you use you will now get extra columns. The register goes from this: @smallexample - 12-Mar-10 Employer Assets:Cash $100 $100 - Income:Employer $-100 0 - 12-Mar-10 KFC Expenses:Food $20 $20 - Assets:Cash $-20 0 - 12-Mar-10 KFC - Rebate Assets:Cash $5 $5 - Expenses:Food $-5 0 - 12-Mar-10 KFC - Food & Reb.. Expenses:Food $20 $20 - Expenses:Food $-5 $15 - Assets:Cash $-15 0 +12-Mar-10 Employer Assets:Cash $100 $100 + Income:Employer $-100 0 +12-Mar-10 KFC Expenses:Food $20 $20 + Assets:Cash $-20 0 +12-Mar-10 KFC - Rebate Assets:Cash $5 $5 + Expenses:Food $-5 0 +12-Mar-10 KFC - Food & Reb.. Expenses:Food $20 $20 + Expenses:Food $-5 $15 + Assets:Cash $-15 0 @end smallexample @noindent To this: @smallexample - 12-Mar-10 Employer Assets:Cash $100 0 $100 - In:Employer 0 $100 0 - 12-Mar-10 KFC Expens:Food $20 0 $20 - Assets:Cash 0 $20 0 - 12-Mar-10 KFC - Rebate Assets:Cash $5 0 $5 - Expens:Food 0 $5 0 - 12-Mar-10 KFC - Food &.. Expens:Food $20 0 $20 - Expens:Food 0 $5 $15 - Assets:Cash 0 $15 0 +12-Mar-10 Employer Assets:Cash $100 0 $100 + In:Employer 0 $100 0 +12-Mar-10 KFC Expens:Food $20 0 $20 + Assets:Cash 0 $20 0 +12-Mar-10 KFC - Rebate Assets:Cash $5 0 $5 + Expens:Food 0 $5 0 +12-Mar-10 KFC - Food &.. Expens:Food $20 0 $20 + Expens:Food 0 $5 $15 + Assets:Cash 0 $15 0 @end smallexample @noindent @@ -5406,25 +5683,25 @@ values. For the balance report without @code{--dc}: @smallexample - $70 Assets:Cash - $30 Expenses:Food - $-100 Income:Employer - -------------------- - 0 + $70 Assets:Cash + $30 Expenses:Food + $-100 Income:Employer +-------------------- + 0 @end smallexample @noindent And with @code{--dc} it becomes this: @smallexample - $105 $35 $70 Assets:Cash - $40 $10 $30 Expenses:Food - 0 $100 $-100 Income:Employer - -------------------------------------------- - $145 $145 0 + $105 $35 $70 Assets:Cash + $40 $10 $30 Expenses:Food + 0 $100 $-100 Income:Employer +-------------------------------------------- + $145 $145 0 @end smallexample -@item --depth <INT> +@item --depth @var{INT} Limit the depth of the account tree. In a balance report, for example, a @code{--depth 2} statement will print balances only for account with two levels, i.e. @code{Expenses:Entertainment} but not @@ -5435,35 +5712,35 @@ which means it only affects display, not the total calculations. Report each posting’s deviation from the average. It is only meaningful in the register and prices reports. -@item --display-amount <EXPR> -Apply a transform to the -@strong{displayed} amount. This occurs after calculations occur. - -@item --display <BOOLEAN_EXPR> +@item --display @var{EXPR} Display lines that satisfy the expression given. -@item --display-total <EXPR> -Apply a transform to the -@strong{displayed} total. This occurs after calculations occur. +@item --display-amount @var{EXPR} +Apply a transform to the @emph{displayed} amount. This occurs after +calculations occur. + +@item --display-total @var{EXPR} +Apply a transform to the @emph{displayed} total. This occurs after +calculations occur. @item --dow -group transactions by the day of the week. +@itemx --days-of-week +Group transactions by the days of the week. @smallexample -ledger reg Expenses --dow --collapse +$ ledger reg Expenses --dow --collapse @end smallexample @noindent -will print all Expenses totaled for each day of the week. - -@item --effective -Use effective dates for all calculations (@pxref{Effective Dates}). +Will print all Expenses totaled for each day of the week. @item --empty +@itemx -E Include empty accounts in the report. -@item --end <DATE> -Specify the end date for transaction to be considered in the report. +@item --end @var{DATE} +Specify the end @var{DATE} for transaction to be considered in the +report. @item --equity Related to the @code{equity} command (@pxref{The @@ -5471,34 +5748,38 @@ equity Command}). Gives current account balances in the form of a register report. @item --exact -ASK JOHN +FIX THIS ENTRY @c ASK JOHN -@item --exchange <COMMODITY> -Display values in terms of the given -commodity. The latest available price is used. +@item --exchange @var{COMMODITY} +@itemx -X @var{COMMODITY} +Display values in terms of the given @var{COMMODITY}. The latest +available price is used. @item --flat -Force the full names of accounts to be used in the -balance report. The balance report will not use an indented tree. +Force the full names of accounts to be used in the balance report. The +balance report will not use an indented tree. @item --force-color -Output tty color codes even if the tty doesn't -support them. Useful for TTY that don't advertise their capabilities -correctly. +Output tty color codes even if the tty doesn't support them. Useful +for TTY that don't advertise their capabilities correctly. @item --force-pager Force Ledger to paginate its output. -@item --forecast-while <VEXPR> -Continue forecasting while @code{<VEXPR>} is true. +@item --forecast-while @var{VEXPR} +@itemx --forecast @var{VEXPR} +Continue forecasting while @var{VEXPR} is true. -@item --forecast-years <INT> -Forecast at most @code{N} years in the future. +@item --forecast-years @var{INT} +Forecast at most @var{INT} years in the future. -@item --format <FORMAT STRING> +@item --format @var{FORMAT_STRING} +@itemx -F @var{FORMAT_STRING} Use the given format string to print output. @item --gain +@itemx -G +@itemx --change Report on gains using the latest available prices. @item --generated @@ -5506,19 +5787,18 @@ Include auto-generated postings (such as those from automated transactions) in the report, in cases where you normally wouldn't want them. -@item --group-by <EXPR> -Group transaction together in the register -report. @code{EXPR} can be anything, although most common would be -@code{payee} or @code{commodity}. The @code{tags()} function is -also useful here. +@item --group-by @var{EXPR} +Group transaction together in the @command{register} report. +@var{EXPR} can be anything, although most common would be @code{payee} +or @code{commodity}. The @code{tags()} function is also useful here. -@item --group-title-format +@item --group-title-format @var{FORMAT_STRING} Set the format for the headers that separate reports section of a grouped report. Only has effect with a @code{--group-by} register report. @smallexample -ledger reg Expenses --group-by "payee" --group-title-format "------------------------ %-20(value) ---------------------\n" +$ ledger reg Expenses --group-by "payee" --group-title-format "------------------------ %-20(value) ---------------------\n" ------------------------ 7-Eleven --------------------- 2011/08/13 7-Eleven Expenses:Auto:Misc $ 5.80 $ 5.80 @@ -5530,8 +5810,16 @@ ledger reg Expenses --group-by "payee" --group-title-format "------------------- ... @end smallexample -@item --head <INT> -Print the first @code{INT} entries. Opposite of @code{--tail}. +@item --head @var{INT} +@itemx --first @var{INT} +Print the first @var{INT} entries. Opposite of @code{--tail}. + +@item --historical +@itemx -H +FIX THIS ENTRY @c FIXME thdox + +@item --immediate +FIX THIS ENTRY @c FIXME thdox @item --inject Use @code{Expected} amounts in calculations. In the case that you know @@ -5540,8 +5828,8 @@ wrong value you can use metadata to put in the expected amount: @smallexample 2012-03-12 Paycheck - Income $-990; Expected:: $-1000.00 - Checking + Income $-990; Expected:: $-1000.00 + Checking @end smallexample Then using the command @code{ledger reg --inject=Expected Income} would @@ -5550,7 +5838,8 @@ treat the transaction as if the ``Expected Value'' was actual. @item --invert Change the sign of all reported values. -@item --limit <EXPR> +@item --limit @var{EXPR} +@itemx -l @var{EXPR} Only transactions that satisfy the expression will be considered in the calculation. @@ -5558,32 +5847,35 @@ calculation. Report the date on which each commodity in a balance report was purchased. +@item --lot-notes +@itemx --lot-tags +Report the tag attached to each commodity in a balance report. + @item --lot-prices Report the price at which each commodity in a balance report was purchased. -@item --lot-tags -Report the tag attached to each commodity in a balance report. - -@item --lots-actual -FIX THIS ENTRY - @item --lots Report the date and price at which each commodity was purchased in a balance report. +@item --lots-actual +FIX THIS ENTRY + @item --market +@itemx -V Use the latest market value for all commodities. -@item --meta <TAG> +@item --meta @var{TAG} In the register report, prepend the transaction with the value of the -given tag. +given @var{TAG}. -@item --meta-width +@item --meta-width @var{INT} Specify the width of the Meta column used for the @code{--meta} options. @item --monthly +@itemx -M Synonym for @code{--period "monthly"} @item --no-color @@ -5600,26 +5892,26 @@ Suppress the output of group titles @item --no-total Suppress printing the final total line in a balance report. -@item --now +@item --now @var{DATE} Define the current date in case to you to do calculate in the past or future using @code{--current} -@item --only +@item --only @var{FIXME} This is a postings predicate that applies after certain transforms have been executed, such as periodic gathering. -@item --output <PATH> -Redirect the output of ledger to the file defined in @file{PATH}. +@item --output @var{FILE} +Redirect the output of ledger to the file defined in @file{FILE}. -@item --pager +@item --pager @var{FILE} Specify the pager program to use. -@item --payee <VEXPR> -Sets a value expression for formatting the payee. In the register -report this prevents the second entry from having a date and payee for -each transaction +@item --payee @var{VEXPR} +Sets a value expression for formatting the payee. In the +@command{register} report this prevents the second entry from having +a date and payee for each transaction. -@item --payee-width N +@item --payee-width @var{INT} Set the number of columns dedicated to the payee in the register report. @@ -5627,25 +5919,26 @@ report. Use only postings that are marked pending @item --percent +@itemx -% Calculate the percentage value of each account in a balance reports. Only works for account that have a single commodity. -@item --period <PERIOD EXPRESSION> -Define a period expression the sets the time period during which -transactions are to be accounted. For a register report only the -transactions that satisfy the period expression with be displayed. For -a balance report only those transactions will be accounted in the final -balances. +@item --period @var{PERIOD_EXPRESSION} +Define a period expression that sets the time period during which +transactions are to be accounted. For a @command{register} report only +the transactions that satisfy the period expression with be displayed. +For a balance report only those transactions will be accounted in the +final balances. -@item --pivot <VALUED TAG> -Produce a balance pivot report ``around'' the given tag. For example, -if you have multiple cars and track each fuel purchase in +@item --pivot @var{TAG} +Produce a balance pivot report ``around'' the given @var{TAG}. For +example, if you have multiple cars and track each fuel purchase in @code{Expenses:Auto:Fuel} and tag each fuel purchase with a tag identifying which car the purchase was for @code{; Car: Prius}, then the command: @smallexample -ledger bal Fuel --pivot "Car" --period "this year" +$ ledger bal Fuel --pivot "Car" --period "this year" $ 3491.26 Car $ 1084.22 M3:Expenses:Auto:Fuel $ 149.65 MG V11:Expenses:Auto:Fuel @@ -5658,24 +5951,36 @@ ledger bal Fuel --pivot "Car" --period "this year" @xref{Metadata values}. -@item --plot-amount-format +@item --plot-amount-format @var{FORMAT_STRING} Define the output format for an amount data plot. @xref{Visualizing with Gnuplot}. -@item --plot-total-format +@item --plot-total-format @var{FORMAT_STRING} Define the output format for a total data plot. @xref{Visualizing with Gnuplot}. -@item --prepend-format STR -Prepend STR to every line of the output +@item --prepend-format @var{FORMAT_STRING} +Prepend @var{STR} to every line of the output -@item --prepend-width N -Reserve @code{N} spaces at the beginning of each line of the output +@item --prepend-width @var{INT} +Reserve @var{INT} spaces at the beginning of each line of the output. @item --price -Use the price of the commodity purchase for performing calculations +@itemx -I +Use the price of the commodity purchase for performing calculations. + +@item --pricedb-format @var{FORMAT_STRING} +FIX THIS ENTRY @c FIXME thdox + +@item --prices-format @var{FORMAT_STRING} +FIX THIS ENTRY @c FIXME thdox + +@item --primary-date +@itemx --actual-dates +Show primary dates for all calculations (@pxref{Effective Dates}). @item --quantity +@itemx -O FIX THIS ENTRY @item --quarterly @@ -5688,40 +5993,50 @@ interpreting. Can be useful for minor cleanups, like just aligning amounts. @item --real +@itemx -R Account using only real transactions ignoring virtual and automatic transactions. -@item --related-all -Show all postings in a transaction, similar to @code{--related} but -show both ``sides'' of each transaction. +@item --register-format @var{FORMAT_STRING} +FIX THIS ENTRY @c FIXME thdox @item --related In a register report show the related account. This is the other ``side'' of the transaction. -@item --revalued-only +@item --related-all +Show all postings in a transaction, similar to @code{--related} but +show both ``sides'' of each transaction. + +@item --revalued FIX THIS ENTRY -@item --revalued-total +@item --revalued-only FIX THIS ENTRY -@item --revalued +@item --revalued-total @var{FIXME} FIX THIS ENTRY -@item --seed +@item --rich-data +@itemx --detail +FIX THIS ENTRY @c FIXME thdox + +@item --seed @var{FIXME} Set the random seed for the @code{generate} command. Used as part of development testing. -@item --sort-all -FIX THIS ENTRY +@item --sort @var{VEXPR} +@itemx -S @var{VEXPR} +Sort the register report based on the value expression given to sort. -@item --sort <VEXPR> -Sort the register report based on the value expression given to sort +@item --sort-all @var{FIXME} +FIX THIS ENTRY -@item --sort-xacts <VEXPR> -Sort the posting within transactions using the given value expression +@item --sort-xacts @var{VEXPR} +@itemx --period-sort @var{VEXPR} +Sort the posting within transactions using the given value expression. -@item --start-of-week <INT> +@item --start-of-week @var{INT} Tell ledger to use a particular day of the week to start its ``weekly'' summary. @code{--start-of-week=1} specifies Monday as the start of the week. @@ -5729,46 +6044,57 @@ week. @item --subtotal FIX THIS ENTRY -@item --tail <INT> -Report only the last @code{INT} entries. Only useful on a register +@item --tail @var{INT} +@itemx --last @var{INT} +Report only the last @var{INT} entries. Only useful on a register report. -@item --total-data -FIX THIS ENTRY +@item --time-report +FIX THIS ENTRY @c FIXME thdox -@item --total <VEXPR> +@item --total @var{VEXPR} +@itemx -T @var{VEXPR} Define a value expression used to calculate the total in reports. -@item --total-width +@item --total-data +@itemx -J +FIX THIS ENTRY + +@item --total-width @var{INT} Set the width of the total field in the register report. -@item --truncate +@item --truncate @var{CODE} Indicates how truncation should happen when the contents of columns -exceed their width. Valid arguments are @code{leading}, @code{middle}, -and @code{trailing}. The default is smarter than any of these three, as -it considers sub-names within the account name (that style is called -``abbreviate''). +exceed their width. Valid arguments are @samp{leading}, @samp{middle}, +and @samp{trailing}. The default is smarter than any of these three, +as it considers sub-names within the account name (that style is +called ``abbreviate''). @item --unbudgeted FIX THIS ENTRY @item --uncleared +@itemx -U Use only uncleared transactions in calculations and reports. -@item --unrealized-gains +@item --unrealized FIX THIS ENTRY -@item --unrealized-losses +@item --unrealized-gains @var{FIXME} FIX THIS ENTRY -@item --unrealized +@item --unrealized-losses @var{FIXME} FIX THIS ENTRY @item --unround Perform all calculations without rounding and display results to full precision. +@item --values +FIX THIS ENTRY @c FIXME thdox + @item --weekly +@itemx -W Synonym for @code{--period "weekly"} @item --wide @@ -5776,9 +6102,10 @@ Let the register report use 132 columns. Identical to @code{--columns "132"} @item --yearly +@itemx -Y Synonym for @code{--period "yearly"} -@end table +@end ftable @node Basic options, Report Filtering, Report Options, Detailed Options Description @subsection Basic options @@ -5787,33 +6114,33 @@ These are the most basic command options. Most likely, the user will want to set them using environment variables (see @ref{Environment Variables}), instead of using actual command-line options: -@table @code +@ftable @code @item --help -@item -h +@itemx -h Print a summary of all the options, and what they are used for. This can be a handy way to remember which options do what. This help screen is also printed if ledger is run without a command. @item --version -@item -v +@itemx -v Print the current version of ledger and exits. This is useful for sending bug reports, to let the author know which version of ledger you are using. -@item --file FILE -@item -f FILE -Read FILE as a ledger file. This command may be used multiple times. -Typically, the environment variable @env{LEDGER_FILE} is set, rather -than using this command-line option. +@item --file @var{FILE} +@itemx -f @var{FILE} +Read @file{FILE} as a ledger file. This command may be used multiple +times. Typically, the environment variable @env{LEDGER_FILE} is set, +rather than using this command-line option. -@item --output FILE -@item -o FILE -Redirect output from any command to @var{FILE}. By default, all output +@item --output @var{FILE} +@itemx -o @var{FILE} +Redirect output from any command to @file{FILE}. By default, all output goes to standard output. -@item --init-file FILE -@item -i FILE -Causes @code{FILE} to be read by ledger before any other ledger file. +@item --init-file @var{FILE} +@itemx -i @var{FILE} +Causes @file{FILE} to be read by ledger before any other ledger file. This file may not contain any postings, but it may contain option settings. To specify options in the init file, use the same syntax as the command-line, but put each option on its own line. Here is an @@ -5828,11 +6155,11 @@ example init file: Option settings on the command-line or in the environment always take precedence over settings in the init file. -@item --account NAME -@item -a NAME +@item --account @var{STR} +@itemx -a @var{STR} Specify the default account which QIF file postings are assumed to relate to. -@end table +@end ftable @node Report Filtering, Output Customization, Basic options, Detailed Options Description @subsection Report filtering @@ -5840,26 +6167,26 @@ relate to. These options change which postings affect the outcome of a report, in ways other than just using regular expressions: -@table @code +@ftable @code @item --current -@item -c +@itemx -c Display only transactions occurring on or before the current date. -@item --begin DATE -@item -b DATE +@item --begin @var{DATE} +@itemx -b @var{DATE} Constrain the report to transactions on or after @var{DATE}. Only transactions after that date will be calculated, which means that the running total in the balance report will always start at zero with the first matching transaction. (Note: This is different from using @code{--display} to constrain what is displayed). -@item --end DATE -@item -e DATE +@item --end @var{DATE} +@itemx -e @var{DATE} Constrain the report so that transactions on or after @var{DATE} are not considered. The ending date is inclusive. -@item --period STR -@item -p STR +@item --period @var{PERIOD_EXPRESSION} +@itemx -p @var{PERIOD_EXPRESSION} Set the reporting period to @var{STR}. This will subtotal all matching transactions within each period separately, making it easy to see weekly, monthly, quarterly, etc., posting totals. A period string can @@ -5867,39 +6194,39 @@ even specify the beginning and end of the report range, using simple terms like ``last June'' or ``next month''. For more using period expressions, see @ref{Period Expressions}. -@item --period-sort EXPR +@item --period-sort @var{VEXPR} Sort the postings within each reporting period using the value expression @var{EXPR}. This is most often useful when reporting monthly expenses, in order to view the highest expense categories at the top of each month: @smallexample -ledger -M --period-sort -At reg ^Expenses +$ ledger -M --period-sort -At reg ^Expenses @end smallexample @item --cleared -@item -C +@itemx -C Display only postings whose transaction has been marked ``cleared'' (by placing an asterisk to the right of the date). @item --uncleared -@item -U +@itemx -U Display only postings whose transaction has not been marked ``cleared'' (i.e., if there is no asterisk to the right of the date). @item --real -@item -R +@itemx -R Display only real postings, not virtual. (A virtual posting is indicated by surrounding the account name with parentheses or brackets; see @ref{Virtual postings} for more information). @item --actual -@item -L +@itemx -L Display only actual postings, and not those created due to automated postings. @item --related -@item -r +@itemx -r Display postings that are related to whichever postings would otherwise have matched the filtering criteria. In the register report, this shows where money went to, or the account it came from. @@ -5917,15 +6244,15 @@ this transaction: And the register command was: @smallexample -ledger -r register food +$ ledger -r register food @end smallexample The following would be output, showing the postings related to the posting that matched: @smallexample -2004/03/20 Safeway Expenses:Cash $-20.00 $-20.00 - Assets:Checking $85.00 $65.00 +2004/03/20 Safeway Expenses:Cash $-20.00 $-20.00 + Assets:Checking $85.00 $65.00 @end smallexample @item --budget @@ -5935,29 +6262,29 @@ Useful for displaying how close your postings meet your budget. option that projects your budget into the future, showing how it will affect future balances. @xref{Budgeting and Forecasting}. -@item --limit EXPR -@item -l EXPR +@item --limit @var{EXPR} +@itemx -l @var{EXPR} Limit which postings take part in the calculations of a report. -@item --amount EXPR -@item -t EXPR +@item --amount @var{EXPR} +@itemx -t @var{EXPR} Change the value expression used to calculate the ``value'' column in the @command{register} report, the amount used to calculate account totals in the @command{balance} report, and the values printed in the @command{equity} report. @xref{Value Expressions}. -@item --total EXPR -@item -T EXPR +@item --total @var{VEXPR} +@itemx -T @var{VEXPR} Set the value expression used for the ``totals'' column in the @command{register} and @command{balance} reports. -@end table +@end ftable @c @node Search Terms, Output Customization, Report Filtering, Detailed Options Description @c @subsection Search Terms @c Valid Ledger invocations look like: @c @smallexample -@c ledger [OPTIONS] <COMMAND> <SEARCH-TERMS> +@c ledger [OPTIONS] <COMMAND> <SEARCH-TERMS> @c @end smallexample @c Where @code{COMMAND} is any command verb (@pxref{Reporting @@ -5965,25 +6292,25 @@ Set the value expression used for the ``totals'' column in the @c @code{SEARCH-TERM} is one or more of the following: @c @smallexample -@c word search for any account containing 'word' -@c TERM and TERM boolean AND between terms -@c TERM or TERM boolean OR between terms -@c not TERM invert the meaning of the term -@c payee word search for any payee containing 'word' -@c @@word shorthand for 'payee word' -@c desc word alternate for 'payee word' -@c note word search for any note containing 'word' -@c &word shorthand for 'note word' -@c tag word search for any metadata tag containing 'word' -@c tag word=value search for any metadata tag containing 'word' -@c whose value contains 'value' -@c %word shorthand for 'tag word' -@c %word=value shorthand for 'tag word=value' -@c meta word alternate for 'tag word' -@c meta word=value alternate for 'tag word=value' -@c expr 'EXPR' apply the given value expression as a predicate -@c '=EXPR' shorthand for 'expr EXPR' -@c \( TERMS \) group terms; useful if using and/or/not +@c word search for any account containing 'word' +@c TERM and TERM boolean AND between terms +@c TERM or TERM boolean OR between terms +@c not TERM invert the meaning of the term +@c payee word search for any payee containing 'word' +@c @@word shorthand for 'payee word' +@c desc word alternate for 'payee word' +@c note word search for any note containing 'word' +@c &word shorthand for 'note word' +@c tag word search for any metadata tag containing 'word' +@c tag word=value search for any metadata tag containing 'word' +@c whose value contains 'value' +@c %word shorthand for 'tag word' +@c %word=value shorthand for 'tag word=value' +@c meta word alternate for 'tag word' +@c meta word=value alternate for 'tag word=value' +@c expr 'EXPR' apply the given value expression as a predicate +@c '=EXPR' shorthand for 'expr EXPR' +@c \( TERMS \) group terms; useful if using and/or/not @c @end smallexample @c So, to list all transaction that charged to ``food'' but not @@ -5991,9 +6318,9 @@ Set the value expression used for the ``totals'' column in the @c commands would be equivalent: @c @smallexample -@c ledger reg food not dining @@chang -@c ledger reg food and not dining and not payee chang -@c ledger reg food not dining expr 'payee =~ /chang/' +@c ledger reg food not dining @@chang +@c ledger reg food and not dining and not payee chang +@c ledger reg food not dining expr 'payee =~ /chang/' @c @end smallexample @node Output Customization, Commodity Reporting, Report Filtering, Detailed Options Description @@ -6002,88 +6329,88 @@ Set the value expression used for the ``totals'' column in the These options affect only the output, but not which postings are used to create it: -@table @code +@ftable @code @item --collapse -@item -n +@itemx -n Cause transactions in a @command{register} report with multiple postings to be collapsed into a single, subtotaled transaction. @item --subtotal -@item -s +@itemx -s Cause all transactions in a @command{register} report to be collapsed into a single, subtotaled transaction. @item --by-payee -@item -P +@itemx -P Report subtotals by payee. @item --empty -@item -E +@itemx -E Include even empty accounts in the @command{balance} report. @item --weekly -@item -W +@itemx -W Report posting totals by the week. The week begins on whichever day of the week begins the month containing that posting. To set a specific begin date, use a period string, such as @code{weekly from DATE}. @item --monthly -@item -M +@itemx -M Report posting totals by month; @item --yearly -@item -Y +@itemx -Y Report posting totals by year. For more complex period, using the -@item --period +@item --period @var{PERIOD_EXPRESSION} Option described above. @item --dow Report postings totals for each day of the week. This is an easy way to see if weekend spending is more than on weekdays. -@item --sort EXPR -@item -S EXPR +@item --sort @var{VEXPR} +@itemx -S @var{VEXPR} Sort a report by comparing the values determined using the value -expression @var{EXPR}. For example, using @code{-S -UT} in the +expression @var{VEXPR}. For example, using @code{-S -UT} in the balance report will sort account balances from greatest to least, using the absolute value of the total. For more on how to use value expressions, see @ref{Value Expressions}. -@item --pivot TAG -Produce a pivot table around the tag provided. This requires meta data -using valued tags. +@item --pivot @var{TAG} +Produce a pivot table around the @var{TAG} provided. This requires +meta data using valued tags. @item --wide -@item -w +@itemx -w Cause the default @command{register} report to assume 132 columns instead of 80. -@item --head -Cause only the first @code{N} transactions to be printed. This is +@item --head @var{INT} +Cause only the first @var{INT} transactions to be printed. This is different from using the command-line utility @command{head}, which -would limit to the first N postings. @code{--tail} outputs only the -last @code{N} transactions. Both options may be used simultaneously. -If a negative amount is given, it will invert the meaning of the flag -(instead of the first five transactions being printed, for example, it -would print all but the first five). +would limit to the first @var{INT} postings. @code{--tail} outputs +only the last @var{INT} transactions. Both options may be used +simultaneously. If a negative amount is given, it will invert the +meaning of the flag (instead of the first five transactions being +printed, for example, it would print all but the first five). -@item --pager +@item --pager @var{FILE} Tell Ledger to pass its output to the given pager program; very useful when the output is especially long. This behavior can be made the default by setting the @env{LEDGER_PAGER} environment variable. @item --average -@item -A +@itemx -A Report the average posting value. @item --deviation -@item -D +@itemx -D Report each posting's deviation from the average. It is only meaningful in the @command{register} and @command{prices} reports. @item --percent -@item -% +@itemx -% Show account subtotals in the @command{balance} report as percentages of the parent account. @@ -6091,7 +6418,7 @@ of the parent account. @c @command{xml} report. @item --amount-data -@item -j +@itemx -j Change the @command{register} report so that it outputs nothing but the date and the value column, and the latter without commodities. This is only meaningful if the report uses a single commodity. This data can @@ -6099,12 +6426,12 @@ then be fed to other programs, which could plot the date, analyze it, etc. @item --total-data -@item -J +@itemx -J Change the @command{register} report so that it outputs nothing but the date and totals column, without commodities. -@item --display EXPR -@item -d EXPR +@item --display @var{EXPR} +@itemx -d @var{EXPR} Limit which postings or accounts or actually displayed in a report. They might still be calculated, and be part of the running total of a register report, for example, but they will not be displayed. This is @@ -6112,7 +6439,7 @@ useful for seeing last month's checking postings, against a running balance which includes all posting values: @smallexample -ledger -d "d>=[last month]" reg checking +$ ledger -d "d>=[last month]" reg checking @end smallexample The output from this command is very different from the following, @@ -6120,100 +6447,100 @@ whose running total includes only postings from the last month onward: @smallexample -ledger -p "last month" reg checking +$ ledger -p "last month" reg checking @end smallexample Which is more useful depends on what you're looking to know: the total amount for the reporting range (@code{-p}), or simply a display restricted to the reporting range (using @code{-d}). -@item --date-format STR -@item -y STR +@item --date-format @var{DATE_FORMAT} +@itemx -y @var{DATE_FORMAT} Change the basic date format used by reports. The default uses a date like @code{2004/08/01}, which represents the default date format of @code{%Y/%m/%d}. To change the way dates are printed in general, the -easiest way is to put @code{--date-format FORMAT} in the Ledger -initialization file @file{~/.ledgerrc} (or the file referred to by -@env{LEDGER_INIT}). +easiest way is to put @code{--date-format @var{DATE_FORMAT}} in the +Ledger initialization file @file{~/.ledgerrc} (or the file referred to +by @env{LEDGER_INIT}). -@item --format STR -@item -F STR +@item --format @var{FORMAT_STRING} +@itemx -F @var{FORMAT_STRING} Set the reporting format for whatever report ledger is about to make. @xref{Format Strings}. There are also specific format commands for each report type: -@item --balance-format STR +@item --balance-format @var{FORMAT_STRING} Define the output format for the @code{balance} report. The default (defined in @code{report.h} is: @smallexample - "%(ansify_if( - justify(scrub(display_total), 20, - 20 + int(prepend_width), true, color), - bold if should_bold)) - %(!options.flat ? depth_spacer : \"\") - %-(ansify_if( - ansify_if(partial_account(options.flat), blue if color), - bold if should_bold))\n%/ - %$1\n%/ - %(prepend_width ? \" \" * int(prepend_width) : \"\") - --------------------\n" +"%(ansify_if( + justify(scrub(display_total), 20, + 20 + int(prepend_width), true, color), + bold if should_bold)) + %(!options.flat ? depth_spacer : \"\") + %-(ansify_if( + ansify_if(partial_account(options.flat), blue if color), + bold if should_bold))\n%/ + %$1\n%/ + %(prepend_width ? \" \" * int(prepend_width) : \"\") + --------------------\n" @end smallexample -@item --cleared-format +@item --cleared-format @var{FORMAT_STRING} Define the format for the cleared report. The default is: @smallexample - "%(justify(scrub(get_at(display_total, 0)), 16, 16 + int(prepend_width), - true, color)) %(justify(scrub(get_at(display_total, 1)), 18, - 36 + int(prepend_width), true, color)) - %(latest_cleared ? format_date(latest_cleared) : \" \") - %(!options.flat ? depth_spacer : \"\") - %-(ansify_if(partial_account(options.flat), blue if color))\n%/ - %$1 %$2 %$3\n%/ - %(prepend_width ? \" \" * int(prepend_width) : \"\") - ---------------- ---------------- ---------\n" +"%(justify(scrub(get_at(display_total, 0)), 16, 16 + int(prepend_width), + true, color)) %(justify(scrub(get_at(display_total, 1)), 18, + 36 + int(prepend_width), true, color)) + %(latest_cleared ? format_date(latest_cleared) : \" \") + %(!options.flat ? depth_spacer : \"\") + %-(ansify_if(partial_account(options.flat), blue if color))\n%/ + %$1 %$2 %$3\n%/ + %(prepend_width ? \" \" * int(prepend_width) : \"\") + ---------------- ---------------- ---------\n" @end smallexample -@item --register-format STR +@item --register-format @var{FORMAT_STRING} Define the output format for the @code{register} report. The default (defined in @code{report.h} is: @smallexample - "%(ansify_if( - ansify_if(justify(format_date(date), int(date_width)), - green if color and date > today), - bold if should_bold)) - %(ansify_if( - ansify_if(justify(truncated(payee, int(payee_width)), int(payee_width)), - bold if color and !cleared and actual), - bold if should_bold)) - %(ansify_if( - ansify_if(justify(truncated(display_account, int(account_width), - int(abbrev_len)), int(account_width)), - blue if color), - bold if should_bold)) - %(ansify_if( - justify(scrub(display_amount), int(amount_width), - 3 + int(meta_width) + int(date_width) + int(payee_width) - + int(account_width) + int(amount_width) + int(prepend_width), - true, color), +"%(ansify_if( + ansify_if(justify(format_date(date), int(date_width)), + green if color and date > today), bold if should_bold)) - %(ansify_if( - justify(scrub(display_total), int(total_width), - 4 + int(meta_width) + int(date_width) + int(payee_width) - + int(account_width) + int(amount_width) + int(total_width) - + int(prepend_width), true, color), - bold if should_bold))\n%/ - %(justify(\" \", int(date_width))) - %(ansify_if( - justify(truncated(has_tag(\"Payee\") ? payee : \" \", - int(payee_width)), int(payee_width)), - bold if should_bold)) - %$3 %$4 %$5\n" -@end smallexample - -@item --csv-format + %(ansify_if( + ansify_if(justify(truncated(payee, int(payee_width)), int(payee_width)), + bold if color and !cleared and actual), + bold if should_bold)) + %(ansify_if( + ansify_if(justify(truncated(display_account, int(account_width), + int(abbrev_len)), int(account_width)), + blue if color), + bold if should_bold)) + %(ansify_if( + justify(scrub(display_amount), int(amount_width), + 3 + int(meta_width) + int(date_width) + int(payee_width) + + int(account_width) + int(amount_width) + int(prepend_width), + true, color), + bold if should_bold)) + %(ansify_if( + justify(scrub(display_total), int(total_width), + 4 + int(meta_width) + int(date_width) + int(payee_width) + + int(account_width) + int(amount_width) + int(total_width) + + int(prepend_width), true, color), + bold if should_bold))\n%/ + %(justify(\" \", int(date_width))) + %(ansify_if( + justify(truncated(has_tag(\"Payee\") ? payee : \" \", + int(payee_width)), int(payee_width)), + bold if should_bold)) + %$3 %$4 %$5\n" +@end smallexample + +@item --csv-format @var{FORMAT_STRING} Set the format for @code{csv} reports. The default is: @smallexample @@ -6227,7 +6554,7 @@ Set the format for @code{csv} reports. The default is: %(quoted(join(note | xact.note)))\n" @end smallexample -@item --plot-amount-format STR +@item --plot-amount-format @var{FORMAT_STRING} Set the format for amount plots, using the @code{-j} option. The default is: @@ -6235,7 +6562,7 @@ default is: "%(format_date(date, \"%Y-%m-%d\")) %(quantity(scrub(display_amount)))\n" @end smallexample -@item --plot-total-format STR +@item --plot-total-format @var{FORMAT_STRING} Set the format for total plots, using the @code{-J} option. The default is: @@ -6243,32 +6570,29 @@ default is: "%(format_date(date, \"%Y-%m-%d\")) %(quantity(scrub(display_total)))\n" @end smallexample -@item --pricedb-format STR +@item --pricedb-format @var{FORMAT_STRING} Set the format expected for the historical price file. The default is @smallexample "P %(datetime) %(display_account) %(scrub(display_amount))\n" @end smallexample -@item --prices-format STR +@item --prices-format @var{FORMAT_STRING} Set the format for the @command{prices} report. The default is: @smallexample "%(date) %-8(display_account) %(justify(scrub(display_amount), 12, 2 + 9 + 8 + 12, true, color))\n" @end smallexample - -@item --wide-register-format STR -(-w @command{register}) -@end table +@end ftable @node Commodity Reporting, Environment Variables, Output Customization, Detailed Options Description @subsection Commodity Reporting These options affect how commodity values are displayed: -@table @code -@item --price-db FILE +@ftable @code +@item --price-db @var{FILE} Set the file that is used for recording downloaded commodity prices. It is always read on startup, to determine historical prices. Other settings can be placed in this file manually, to prevent downloading @@ -6289,16 +6613,16 @@ download script maintain this file. The format of the file can be changed by telling ledger to use the @code{--pricedb-format} you define. -@item --price-exp MINS -@item -L MINS -Set the expected freshness of price quotes, in minutes. That is, if -the last known quote for any commodity is older than this value, and if -@code{--download} is being used, then the Internet will be consulted -again for a newer price. Otherwise, the old price is still considered -to be fresh enough. +@item --price-exp @var{INT} +@itemx -L @var{INT} +Set the expected freshness of price quotes, in @var{INT} minutes. That +is, if the last known quote for any commodity is older than this +value, and if @code{--download} is being used, then the Internet will +be consulted again for a newer price. Otherwise, the old price is +still considered to be fresh enough. @item --download -@item -Q +@itemx -Q Cause quotes to be automagically downloaded, as needed, by running a script named @command{getquote} and expecting that script to return a value understood by ledger. A sample implementation of a @@ -6306,7 +6630,7 @@ value understood by ledger. A sample implementation of a distribution. Downloaded quote price are then appended to the price database, usually specified using the environment variable @env{LEDGER_PRICE_DB}. -@end table +@end ftable There are several different ways that ledger can report the totals it displays. The most flexible way to adjust them is by using value @@ -6314,20 +6638,24 @@ expressions, and the @code{-t} and @code{-T} options. However, there are also several ``default'' reports, which will satisfy most users basic reporting needs: -@table @code -@item -O, --quantity +@ftable @code +@item --quantity +@itemx -O Report commodity totals (this is the default) -@item -B, --basis +@item --basis +@itemx -B Report the cost basis for all postings. -@item -V, --market +@item --market +@itemx -V Use the last known value for commodities to calculate final values. -@item -G, --gain +@item --gain +@itemx -G Report the net gain/loss for all commodities in the report that have a price history. -@end table +@end ftable Often you will be more interested in the value of your entire holdings, in your preferred currency. It might be nice to know you hold 10,000 @@ -6337,24 +6665,27 @@ commodity can mean different things to different people, depending on the accounts involved, the commodities, the nature of the transactions, etc. -When you specify @code{-V}, or @code{-X COMM}, you are requesting that -some or all of the commodities be valuated as of today (or whatever -@code{--now} is set to). But what does such a valuation mean? This -meaning is governed by the presence of a @code{VALUE} meta-data -property, whose content is an expression used to compute that value. +@findex --now @var{DATE} + +When you specify @code{-V}, or @code{-X @var{COMMODITY}}, you are +requesting that some or all of the commodities be valuated as of today +(or whatever @code{--now @var{DATE}} is set to). But what does such +a valuation mean? This meaning is governed by the presence of +a @code{VALUE} meta-data property, whose content is an expression used +to compute that value. If no VALUE property is specified, each posting is assumed to have a default, as if you'd specified a global, automated transaction as follows: @smallexample - = expr true += expr true ; VALUE:: market(amount, date, exchange) @end smallexample This definition emulates the present day behavior of @code{-V} and -@code{-X} (in the case of @code{-X}, the requested commodity is passed -via the string 'exchange' above). +@code{-X @var{COMMODITY}} (in the case of @code{-X}, the requested +commodity is passed via the string @samp{exchange} above). @cindex Euro conversion One thing many people have wanted to do is to fixate the valuation of @@ -6365,32 +6696,32 @@ old European currencies in terms of the Euro after a certain date: ; VALUE:: date < [Jun 2008] ? market(amount, date, exchange) : 1.44 EUR @end smallexample -This says: If @code{--now} is some old date, use market prices as they -were at that time; but if @code{--now} is past June 2008, use a fixed -price for converting Deutsch Mark to Euro. +This says: If @code{--now @var{DATE}} is some old date, use market +prices as they were at that time; but if @code{--now @var{DATE}} is +past June 2008, use a fixed price for converting Deutsch Mark to Euro. Or how about never re-valuating commodities used in Expenses, since they cannot have a different future value: @smallexample - = /^Expenses:/ += /^Expenses:/ ; VALUE:: market(amount, post.date, exchange) @end smallexample This says the future valuation is the same as the valuation at the time of posting. post.date equals the posting's date, while just 'date' is -the value of @code{--now} (defaults to today). +the value of @code{--now @var{DATE}} (defaults to today). Or how about valuating miles based on a reimbursement rate during a specific time period: @smallexample - = expr commodity == "miles" and date >= [2007] and date < [2008] += expr commodity == "miles" and date >= [2007] and date < [2008] ; VALUE:: market($1.05, date, exchange) @end smallexample In this case, miles driven in 2007 will always be valuated at $1.05 -each. If you use @code{-X EUR} to expressly request all amounts in +each. If you use @samp{-X EUR} to expressly request all amounts in Euro, Ledger shall convert $1.05 to Euro by whatever means are appropriate for dollars. @@ -6399,12 +6730,12 @@ posting or transaction, by overriding these general defaults using specific meta-data: @smallexample - 2010-12-26 Example - Expenses:Food $20 - ; Just to be silly, always valuate *these* $20 as 30 DM, no matter what - ; the user asks for with -V or -X - ; VALUE:: 30 DM - Assets:Cash +2010-12-26 Example + Expenses:Food $20 + ; Just to be silly, always valuate *these* $20 as 30 DM, no matter what + ; the user asks for with -V or -X + ; VALUE:: 30 DM + Assets:Cash @end smallexample This example demonstrates that your VALUE expression should be as @@ -6414,19 +6745,20 @@ the function 'market' so it can be further revalued if the user has asked for a specific currency. Or, if it better suits your accounting, you can be less symbolic, -which allows you to report most everything in EUR if you use @code{-X +which allows you to report most everything in EUR if you use @samp{-X EUR}, except for certain accounts or postings which should always be valuated in another currency. For example: @smallexample - = /^Assets:Brokerage:CAD$/ += /^Assets:Brokerage:CAD$/ ; Always report the value of commodities in this account in ; terms of present day dollars, despite what was asked for - ; on the command-line VALUE:: market(amount, date, '$') + ; on the command-line VALUE:: market(amount, date, @samp{$}) @end smallexample @cindex FIFO/LIFO @cindex LIFO/FIFO +@findex --lots Ledger presently has no way of handling such things as FIFO and LIFO. If you specify an unadorned commodity name, like AAPL, it will balance @@ -6434,13 +6766,14 @@ against itself. If @code{--lots} are not being displayed, then it will appear to balance against any lot of AAPL. @cindex adorned commodity +@findex --lot-prices If you specify an adorned commodity, like AAPL @{$10.00@}, it will also balance against itself, and against any AAPL if @code{--lots} is not specified. But if you do specify @code{--lot-prices}, for example, then it will balance against that specific price for AAPL. -Normally when you use @code{-X <commodity>} to request that amounts be -reported in a specific commodity, Ledger uses these values: +Normally when you use @code{-X @var{COMMODITY}} to request that +amounts be reported in a specific commodity, Ledger uses these values: @itemize @item Register Report @@ -6455,9 +6788,9 @@ For the balance report, use the value of that commodity as of today. You can now specify @code{-H} to ask that all valuations for any amount be done relative to the date that amount was encountered. -You can also now use @code{-X} (and @code{-H}) in conjunction with -@code{-B} and @code{-I}, to see valuation reports of just your basis -costs or lot prices. +You can also now use @code{-X @var{COMMODITY}} (and @code{-H}) in +conjunction with @code{-B} and @code{-I}, to see valuation reports of +just your basis costs or lot prices. @node Environment Variables, , Commodity Reporting, Detailed Options Description @subsection Environment variables @@ -6474,7 +6807,6 @@ option settings in the file @file{~/.ledgerrc}, for example: @smallexample --pager /bin/cat - @end smallexample @node Period Expressions, , Detailed Options Description, Command-line Syntax @@ -6574,6 +6906,9 @@ weekly last august @node Budgeting, Forecasting, Budgeting and Forecasting, Budgeting and Forecasting @section Budgeting +@findex --budget +@findex --add-budget +@findex --unbudgeted Keeping a budget allows you to pay closer attention to your income and expenses, by reporting how far your actual financial activity is from @@ -6587,28 +6922,28 @@ payee. For example: @smallexample ~ Monthly - Expenses:Rent $500.00 - Expenses:Food $450.00 - Expenses:Auto:Gas $120.00 - Expenses:Insurance $150.00 - Expenses:Phone $125.00 - Expenses:Utilities $100.00 - Expenses:Movies $50.00 - Expenses $200.00 ; all other expenses - Assets + Expenses:Rent $500.00 + Expenses:Food $450.00 + Expenses:Auto:Gas $120.00 + Expenses:Insurance $150.00 + Expenses:Phone $125.00 + Expenses:Utilities $100.00 + Expenses:Movies $50.00 + Expenses $200.00 ; all other expenses + Assets ~ Yearly - Expenses:Auto:Repair $500.00 - Assets + Expenses:Auto:Repair $500.00 + Assets @end smallexample These two period transactions give the usual monthly expenses, as well as one typical yearly expense. For help on finding out what your average monthly expense is for any category, use a command like: -@example -ledger -p "this year" --monthly --average --subtotal balance ^expenses -@end example +@smallexample +$ ledger -p "this year" --monthly --average --subtotal balance ^expenses +@end smallexample The reported totals are the current year's average for each account. @@ -6616,38 +6951,39 @@ Once these period transactions are defined, creating a budget report is as easy as adding @code{--budget} to the command-line. For example, a typical monthly expense report would be: -@example -ledger --monthly register ^expenses -@end example +@smallexample +$ ledger --monthly register ^expenses +@end smallexample To see the same report balanced against your budget, use: -@example -ledger --budget --monthly register ^expenses -@end example +@smallexample +$ ledger --budget --monthly register ^expenses +@end smallexample A budget report includes only those accounts that appear in the budget. To see all expenses balanced against the budget, use @code{--add-budget}. You can even see only the un-budgeted expenses using @code{--unbudgeted}: -@example -ledger --unbudgeted --monthly register ^expenses -@end example +@smallexample +$ ledger --unbudgeted --monthly register ^expenses +@end smallexample You can also use these flags with the @command{balance} command. @node Forecasting, , Budgeting, Budgeting and Forecasting @section Forecasting +@findex --forecast Sometimes it's useful to know what your finances will look like in the future, such as determining when an account will reach zero. Ledger makes this easy to do, using the same period transactions as are used for budgeting. An example forecast report can be generated with: -@example -ledger --forecast "T>@{\$-500.00@}" register ^assets ^liabilities -@end example +@smallexample +$ ledger --forecast "T>@{\$-500.00@}" register ^assets ^liabilities +@end smallexample This report continues outputting postings until the running total is greater than $-500.00. A final posting is always output, to @@ -6656,9 +6992,9 @@ show you what the total afterwards would be. Forecasting can also be used with the balance report, but by date only, and not against the running total: -@example -ledger --forecast "d<[2010]" bal ^assets ^liabilities -@end example +@smallexample +$ ledger --forecast "d<[2010]" bal ^assets ^liabilities +@end smallexample @node Time Keeping, Value Expressions, Budgeting and Forecasting, Top @chapter Time Keeping @@ -6666,15 +7002,15 @@ ledger --forecast "d<[2010]" bal ^assets ^liabilities Ledger directly supports ``timelog'' entries, which have this form: @smallexample - i 2013/03/28 22:13:00 ACCOUNT[ PAYEE] - o 2013/03/29 03:39:00 +i 2013/03/28 22:13:00 ACCOUNT[ PAYEE] +o 2013/03/29 03:39:00 @end smallexample This records a check-in to the given ACCOUNT, and a check-out. You can be checked-in to multiple accounts at a time, if you wish, and they can span multiple days (use @code{--day-break} to break them up in the report). The number of seconds between is accumulated as time -to that ACCOUNT. If the checkout uses a capital ``O'', the +to that ACCOUNT. If the checkout uses a capital @samp{O}, the transaction is marked ``cleared''. You can use an optional PAYEE for whatever meaning you like. @@ -6685,9 +7021,9 @@ information. Or you can use Org mode's time-clocking abilities and the org2tc script developed by John Wiegley. These timelog entries can appear in a separate file, or directly in -your main ledger file. The initial ``i'' and ``o'' count as Ledger -``directives'', and are accepted anywhere that ordinary transactions -are. +your main ledger file. The initial @samp{i} and @samp{o} count as +Ledger ``directives'', and are accepted anywhere that ordinary +transactions are. @node Value Expressions, Format Strings, Time Keeping, Top @chapter Value Expressions @@ -6729,7 +7065,7 @@ command shows only transactions from the beginning of the current month, while still calculating the running balance based on all transactions: @smallexample -ledger -d "d>[this month]" register checking +$ ledger -d "d>[this month]" register checking @end smallexample This advantage to this command's complexity is that it prints the @@ -6738,7 +7074,7 @@ following, simpler command is similar, but totals only the displayed postings: @smallexample -ledger -b "this month" register checking +$ ledger -b "this month" register checking @end smallexample @menu @@ -6801,7 +7137,7 @@ The market value of a posting, or an account without its children. @item g The net gain (market value minus cost basis), for a posting or an -account without its children. It is the same as @code{v-b}. +account without its children. It is the same as @samp{v-b}. @item l The depth (``level'') of an account. If an account has one parent, @@ -6812,13 +7148,13 @@ The index of a posting, or the count of postings affecting an account. @item X -1 if a posting's transaction has been cleared, 0 otherwise. +@samp{1} if a posting's transaction has been cleared, @samp{0} otherwise. @item R -1 if a posting is not virtual, 0 otherwise. +@samp{1} if a posting is not virtual, @samp{0} otherwise. @item Z -1 if a posting is not automated, 0 otherwise. +@samp{1} if a posting is not automated, @samp{0} otherwise. @end table @node Calculated totals, , Posting/account details, Variables @@ -6844,7 +7180,7 @@ all its children. @item G The total net gain (market value minus cost basis), for a series of postings, or an account and its children. It is the same as -@code{V-B}. +@samp{V-B}. @end table @node Functions, Operators, Variables, Value Expressions @@ -6863,12 +7199,12 @@ The absolute (unsigned) value of the argument. Strips the commodity from the argument. @item A -The arithmetic mean of the argument; @code{Ax} is the same as -@code{x/n}. +The arithmetic mean of the argument; @samp{Ax} is the same as +@samp{x/n}. @item P -The present market value of the argument. The syntax @code{P(x,d)} is -supported, which yields the market value at time @code{d}. If no date +The present market value of the argument. The syntax @samp{P(x,d)} is +supported, which yields the market value at time @samp{d}. If no date is given, then the current moment is used. @end table @@ -6933,17 +7269,17 @@ An amount in braces can be any kind of amount supported by ledger, with or without a commodity. Use this for decimal values. @item /REGEXP/ -@item W/REGEXP/ +@itemx W/REGEXP/ A regular expression that matches against an account's full name. If a posting, this will match against the account affected by the posting. @item //REGEXP/ -@item p/REGEXP/ +@itemx p/REGEXP/ A regular expression that matches against a transaction's payee name. @item ///REGEXP/ -@item w/REGEXP/ +@itemx w/REGEXP/ A regular expression that matches against an account's base name. If a posting, this will match against the account affected by the posting. @@ -6973,54 +7309,60 @@ Useful specifying a date in plain terms. For example, you could say @node Misc, , Complex Expressions, Complex Expressions @subsection Miscellaneous -@multitable @columnfractions .3 .2 .5 -@item @strong{Function} @tab @strong{Abbrev.} @tab @strong{Description} -@item @code{amount_expr } @tab @code{} @tab -@item @code{abs } @tab @code{} @tab --> U -@item @code{ceiling } @tab @code{} @tab Return the next integer toward +infinity -@item @code{code} @tab @code{} @tab Return the transaction code, the string between the parenthesis after the date. -@item @code{commodity } @tab @code{} @tab -@item @code{display_amount } @tab @code{} @tab --> t -@item @code{display_total } @tab @code{} @tab --> T -@item @code{date } @tab @code{} @tab -@item @code{format_date } @tab @code{} @tab -@item @code{format } @tab @code{} @tab -@item @code{floor } @tab @code{} @tab Return the next integer toward -infinity -@item @code{get_at } @tab @code{} @tab -@item @code{is_seq } @tab @code{} @tab -@item @code{justify } @tab @code{} @tab -@item @code{join } @tab @code{} @tab -@item @code{market --> P } @tab @code{} @tab -@item @code{null } @tab @code{} @tab -@item @code{now --> d m } @tab @code{} @tab -@item @code{options } @tab @code{} @tab -@item @code{post } @tab @code{} @tab -@item @code{percent } @tab @code{} @tab -@item @code{price } @tab @code{} @tab -@item @code{print } @tab @code{} @tab -@item @code{quoted } @tab @code{} @tab -@item @code{quantity } @tab @code{} @tab -@item @code{rounded } @tab @code{} @tab -@item @code{roundto } @tab @code{} @tab Return value rounded to n digits. Does not affect formatting. -@item @code{scrub } @tab @code{} @tab -@item @code{strip --> S } @tab @code{} @tab -@item @code{should_bold } @tab @code{} @tab -@item @code{truncated } @tab @code{} @tab -@item @code{total_expr } @tab @code{} @tab -@item @code{today } @tab @code{} @tab -@item @code{top_amount } @tab @code{} @tab -@item @code{to_boolean } @tab @code{} @tab -@item @code{to_int } @tab @code{} @tab -@item @code{to_datetime } @tab @code{} @tab -@item @code{to_date } @tab @code{} @tab -@item @code{to_amount } @tab @code{} @tab -@item @code{to_balance } @tab @code{} @tab -@item @code{to_spring } @tab @code{} @tab -@item @code{to_mask } @tab @code{} @tab -@item @code{to_sequence } @tab @code{} @tab -@item @code{unrounded } @tab @code{} @tab -@item @code{value_date } @tab @code{} @tab -@end multitable +@table @code +@item abs--> U +@item amount_expr +@item ansify_if +@item ceiling +Return the next integer toward +infinity +@item code +Return the transaction code, the string between the parenthesis after the date. +@item commodity +@item date +@item display_amount --> t +@item display_total --> T +@item floor +Return the next integer toward -infinity +@item format +@item format_date +@item format_datetime +@item get_at +@item is_seq +@item join +@item justify +@item market --> P +@item nail_down +@item now --> d m +@item options +@item percent +@item print +@item quantity +@item quoted +@item round +@item rounded +@item roundto +Return value rounded to n digits. Does not affect formatting. +@item scrub +@item should_bold +@item strip --> S +@item to_amount +@item to_balance +@item to_boolean +@item to_date +@item to_datetime +@item to_int +@item to_mask +@item to_sequence +@item to_spring +@item today +@item top_amount +@item total_expr +@item trim +@item truncated +@item unround +@item unrounded +@item value_date +@end table @node Format Strings, Extending with Python, Value Expressions, Top @chapter Format Strings @@ -7035,54 +7377,65 @@ Useful specifying a date in plain terms. For example, you could say @node Basics, Format String Structure, Format Strings, Format Strings @section Format String Basics +@findex --format @var{FORMAT_STRING} +@findex -F @var{FORMAT_STRING} +@findex --balance-format +@findex --budget-format +@findex --cleared-format +@findex --csv-format +@findex --plot-amount-format +@findex --plot-total-format +@findex --pricedb-format +@findex --prices-format +@findex --register-format Format strings may be used to change the output format of reports. -They are specified by passing a formatting string to the -@code{--format} (@code{-F}) option. Within that string, constructs -are allowed which make it possible to display the various parts of an -account or posting in custom ways. +They are specified by passing a formatting string to the @code{-F +(--format)} option. Within that string, constructs are allowed which +make it possible to display the various parts of an account or posting +in custom ways. There are several additional flags that allow you to define formats -for specific reports. These are useful to define in your -configuration file and will allow you to run ledger reports from the -command line without having to enter a new format for each command. +for specific reports. These are useful to define in your configuration +file and will allow you to run ledger reports from the command line +without having to enter a new format for each command. @itemize -@item @code{--balance-report} -@item @code{--cleared-report} -@item @code{--register-report} -@item @code{--csv-report} -@item @code{--plot-amount-report} -@item @code{--plot-total-report} -@item @code{--pricedb-report} -@item @code{--prices-report} -@item @code{--wide-register-report} +@item @code{--balance-format} +@item @code{--budget-format} +@item @code{--cleared-format} +@item @code{--csv-format} +@item @code{--plot-amount-format} +@item @code{--plot-total-format} +@item @code{--pricedb-format} +@item @code{--prices-format} +@item @code{--register-format} @end itemize @node Format String Structure, Format Expressions, Basics, Format Strings @section Format String Structure Within a format string, a substitution is specified using a percent -character (@code{%}). The basic format of all substitutions is: +@samp{%} character. The basic format of all substitutions is: @smallexample %[-][MIN WIDTH][.MAX WIDTH](VALEXPR) @end smallexample -If the optional minus sign (@code{-}) follows the percent character, -whatever is substituted will be left justified. The default is right -justified. If a minimum width is given next, the substituted text will -be at least that wide, perhaps wider. If a period and a maximum width -is given, the substituted text will never be wider than this, and will -be truncated to fit. Here are some examples: +If the optional minus sign @samp{-} follows the percent character +@samp{%}, whatever is substituted will be left justified. The default +is right justified. If a minimum width is given next, the substituted +text will be at least that wide, perhaps wider. If a period and +a maximum width is given, the substituted text will never be wider +than this, and will be truncated to fit. Here are some examples: @table @code @item %-20P A transaction's payee, left justified and padded to 20 characters wide. @item %20P -The same, right justified, at least 20 chars wide +The same, right justified, at least 20 chars wide. @item %.20P -The same, no more than 20 chars wide +The same, no more than 20 chars wide. @end table The expression following the format constraints can be a single letter, @@ -7150,7 +7503,7 @@ has an effective date, it prints @code{[ACTUAL_DATE=EFFECTIVE_DATE]}. If a posting has been cleared, this returns a 1, otherwise returns 0. @item Y -This is the same as @code{%X}, except that it only displays a state +This is the same as @samp{%X}, except that it only displays a state character if all of the member postings have the same state. @item C @@ -7186,7 +7539,7 @@ Inserts the full name of an account. Inserts the note associated with a posting, if one exists. @item / -The @code{%/} construct is special. It separates a format string +The @samp{%/} construct is special. It separates a format string between what is printed for the first posting of a transaction, and what is printed for all subsequent postings. If not used, the same format string is used for all postings. @@ -7194,17 +7547,19 @@ same format string is used for all postings. @node --balance-format, Formatting codes, Format Expressions, Format Strings @section --balance-format +@findex --balance-format @var{FORMAT_STRING} +@findex --format @var{FORMAT_STRING} As an example of how flexible the @code{--format} strings can be, the default balance format looks like this (the various functions are described later): @smallexample - "%(justify(scrub(display_total), 20, -1, true, color))" - " %(!options.flat ? depth_spacer : \"\")" - "%-(ansify_if(partial_account(options.flat), blue if color))\n%/" - "%$1\n%/" - "--------------------\n" +"%(justify(scrub(display_total), 20, -1, true, color))" +" %(!options.flat ? depth_spacer : \"\")" +"%-(ansify_if(partial_account(options.flat), blue if color))\n%/" +"%$1\n%/" +"--------------------\n" @end smallexample @node Formatting codes, , --balance-format, Format Strings @@ -7242,10 +7597,10 @@ The character based formatting ledger can do is limited to the ANSI terminal character colors and font highlights in a normal TTY session. @multitable @columnfractions .3 .3 .3 -@item @code{red} @tab @code{magenta} @tab @code{bold} -@item @code{green } @tab @code{cyan} @tab @code{underline} -@item @code{yellow } @tab @code{white} @tab @code{blink} -@item @code{blue } +@item @code{red} @tab @code{magenta} @tab @code{bold} +@item @code{green} @tab @code{cyan} @tab @code{underline} +@item @code{yellow} @tab @code{white} @tab @code{blink} +@item @code{blue} @tab @code{black} @end multitable @node Quantities and Calculations, Dates, Colors, Formatting codes @@ -7277,19 +7632,20 @@ terminal character colors and font highlights in a normal TTY session. @node Dates, Date and Time Format Codes, Quantities and Calculations, Formatting codes @subsection Date Functions +@findex --now @var{DATE} The following functions allow you to manipulate and format dates. @table @code @item date Return the date of the current transaction -@item format_date(date, "FORMAT STRING") +@item format_date(date, "FORMAT_STRING") Format the date using the given format string. @item now -Return the current date and time. If the @code{--now} option is -defined it will return that value. +Return the current date and time. If the @code{--now @var{DATE}} +option is defined it will return that value. @item today -Return the current date. If the @code{--now} option is +Return the current date. If the @code{--now @var{DATE}} option is defined it will return that value. @item to_datetime Convert a string to a date-time value @@ -7343,15 +7699,15 @@ is simple to sort on. @node Weekdays, Month, Days, Date and Time Format Codes @subsubsection Weekdays -You can have additional weekday information in your date with @code{%A} +You can have additional weekday information in your date with @samp{%A} as @table @code @item %m-%d-%Y %A -yields @code{02-10-2010 Wednesday} +yields @code{02-10-2010 Wednesday} @item %A %m-%d-%Y -yields @code{Wednesday 02-10-2010} +yields @code{Wednesday 02-10-2010} @end table @noindent @@ -7377,15 +7733,15 @@ day of week starting with Sunday (0), i.e. @code{smtwtfs} 3 @node Month, Miscellaneous Date Codes, Weekdays, Date and Time Format Codes @subsubsection Month -You can have additional month information in your date with @code{%B} +You can have additional month information in your date with @samp{%B} as @table @code @item %m-%d-%Y %B -yields @code{ 02-10-2010 February} +yields @code{02-10-2010 February} @item %B %m-%d-%Y -yields @code{February 02-10-2010} +yields @code{February 02-10-2010} @end table @noindent @@ -7393,11 +7749,11 @@ These are options you can select for month @table @code @item %m -@code{mm} month as two digits +@samp{mm} month as two digits @item %b -Locale’s abbreviated month, for example @code{02} might be abbreviated -as @code{Feb} +Locale’s abbreviated month, for example @samp{02} might be abbreviated +as @samp{Feb} @item %B Locale’s full month, variable length February @@ -7418,11 +7774,11 @@ week of the year 01–53 @item %C @code{cc} century 00–99 @item %D -yields @code{mm/dd/yy 02/10/10} +yields @code{mm/dd/yy 02/10/10} @item %x locale’s date representation @code{02/10/2010} for the U.S. @item %F -yields @code{%Y-%m-%d 2010-02-10} +yields @code{%Y-%m-%d 2010-02-10} @end table @menu @@ -7452,7 +7808,7 @@ justified and padded to the full width of the field. If @code{colorize} is true then ledger will honor color settings. @item join(STR) -Replaces line feeds in @code{STR} with @code{\n}. +Replaces line feeds in @code{STR} with @samp{\n}. @item quoted(STR) Return @code{STR} surrounded by double quotes, @code{"STR"}. @@ -7471,19 +7827,19 @@ generated the posting. @table @code @item filename -name of ledger data file from whence posting came, abbreviated @code{S} +name of ledger data file from whence posting came, abbreviated @samp{S} @item beg_pos character position in @code{filename} where entry for posting begins, -abbreviated @code{B} +abbreviated @samp{B} @item end_pos character position in @code{filename} where entry for posting ends, -abbreviated @code{E} +abbreviated @samp{E} @item beg_line line number in @code{filename} where entry for posting begins, -abbreviated @code{b} +abbreviated @samp{b} @item end_line line number in @code{filename} where posting's entry for posting ends, -abbreviated @code{e} +abbreviated @samp{e} @end table @node Extending with Python, Ledger for Developers, Format Strings, Top @@ -7521,12 +7877,11 @@ and PeriodicTransaction's, etc. Here is how you would traverse all the postings in your data file: @smallexample +import ledger - import ledger - - for xact in ledger.read_journal("sample.dat").xacts: - for post in xact.posts: - print "Transferring %s to/from %s" % (post.amount, post.account) +for xact in ledger.read_journal("sample.dat").xacts: + for post in xact.posts: + print "Transferring %s to/from %s" % (post.amount, post.account) @end smallexample @node Raw vs. Cooked, Queries, Basic data traversal, Extending with Python @@ -7537,29 +7892,29 @@ are what you get from a traversal like the above, and represent exactly what was seen in the data file. Consider this journal: @smallexample - = true - (Assets:Cash) $100 += true + (Assets:Cash) $100 - 2012-03-01 KFC - Expenses:Food $100 - Assets:Credit +2012-03-01 KFC + Expenses:Food $100 + Assets:Credit @end smallexample In this case, the @emph{raw} regular transaction in this file is: @smallexample - 2012-03-01 KFC - Expenses:Food $100 - Assets:Credit +2012-03-01 KFC + Expenses:Food $100 + Assets:Credit @end smallexample While the @emph{cooked} form is: @smallexample - 2012-03-01 KFC - Expenses:Food $100 - Assets:Credit $-100 - (Assets:Cash) $100 +2012-03-01 KFC + Expenses:Food $100 + Assets:Credit $-100 + (Assets:Cash) $100 @end smallexample So the easy way to think about raw vs. cooked is that raw is the @@ -7570,8 +7925,8 @@ generally looking at raw data. In order to look at cooked data, you must generate a report of some kind by querying the journal: @smallexample - for post in ledger.read_journal("sample.dat").query("food"): - print "Transferring %s to/from %s" % (post.amount, post.account) +for post in ledger.read_journal("sample.dat").query("food"): + print "Transferring %s to/from %s" % (post.amount, post.account) @end smallexample The reason why queries iterate over postings instead of transactions @@ -7580,13 +7935,13 @@ apply to. You can always get at a matching posting's transaction by looking at its ``xact'' member: @smallexample - last_xact = None - for post in ledger.read_journal("sample.dat").query(""): - if post.xact != last_xact: - for post in post.xact.posts: - print "Transferring %s to/from %s" % (post.amount, - post.account) - last_xact = post.xact +last_xact = None +for post in ledger.read_journal("sample.dat").query(""): + if post.xact != last_xact: + for post in post.xact.posts: + print "Transferring %s to/from %s" % (post.amount, + post.account) + last_xact = post.xact @end smallexample This query ends up reporting every cooked posting in the Journal, but @@ -7611,19 +7966,19 @@ state. You can embed Python into your data files using the 'python' directive: @smallexample - python - import os - def check_path(path_value): - print "%s => %s" % (str(path_value), os.path.isfile(str(path_value))) - return os.path.isfile(str(path_value)) +python + import os + def check_path(path_value): + print "%s => %s" % (str(path_value), os.path.isfile(str(path_value))) + return os.path.isfile(str(path_value)) - tag PATH - assert check_path(value) +tag PATH + assert check_path(value) - 2012-02-29 KFC - ; PATH: somebogusfile.dat - Expenses:Food $20 - Assets:Cash +2012-02-29 KFC + ; PATH: somebogusfile.dat + Expenses:Food $20 + Assets:Cash @end smallexample Any Python functions you define this way become immediately available @@ -7639,10 +7994,10 @@ commodity. If you need to create sums of multiple commodities, use a Balance. For example: @smallexample - total = Balance() - for post in ledger.read_journal("sample.dat").query(""): - total += post.amount - print total +total = Balance() +for post in ledger.read_journal("sample.dat").query(""): + total += post.amount +print total @end smallexample @node Ledger for Developers, Major Changes from version 2.6, Extending with Python, Top @@ -7941,10 +8296,10 @@ amount of the first posting is typically positive. Consider: @node Comments and meta-data, Specifying Amounts, Journal File Format, Journal File Format @subsection Comments and meta-data -Comments are generally started using a @code{;}. However, in order to +Comments are generally started using a @samp{;}. However, in order to increase compatibility with other text manipulation programs and methods three additional comment characters are valid if used at the -beginning of a line: @code{#}, @code{|}, and @code{*}. +beginning of a line: @samp{#}, @samp{|}, and @samp{*}. @node Specifying Amounts, Posting costs, Comments and meta-data, Journal File Format @subsection Specifying Amounts @@ -7991,8 +8346,8 @@ case of @code{1000.00} above, the internal value is @code{100000/100}. While rational numbers are great at not losing precision, the question arises: How should they be displayed? A number like @code{100000/100} is no problem, since it represents a clean decimal fraction. But what -about when the number @code{1/1} is divided by three? How should one -print @code{1/3}, an infinitely repeating decimal? +about when the number @samp{1/1} is divided by three? How should one +print @samp{1/3}, an infinitely repeating decimal? Ledger gets around this problem by rendering rationals into decimal at the last possible moment, and only for display. As such, some @@ -8003,11 +8358,11 @@ rarely, but even then it does not reflect adjustment of the @emph{internal amount}, only the displayed amount. What has still not been answered is how Ledger rounds values. Should -@code{1/3} be printed as @code{0.33} or @code{0.33333}? For +@samp{1/3} be printed as @samp{0.33} or @samp{0.33333}? For commoditized amounts, the number of decimal places is decided by observing how each commodity is used; but in the case of integer amounts, an arbitrary factor must be chosen. Initially, this factor -is six. Thus, @code{1/3} is printed back as @code{0.333333}. +is six. Thus, @samp{1/3} is printed back as @samp{0.333333}. Further, this rounding factor becomes associated with each particular value, and is carried through mathematical operations. For example, if that particular number were multiplied by itself, the decimal @@ -8165,11 +8520,13 @@ commodities. @node echo, reload, Developer Commands, Developer Commands @subsection @command{echo} +@findex echo This command simply echoes its argument back to the output. @node reload, source, echo, Developer Commands @subsection @command{reload} +@findex reload Forces ledger to reload any journal files. This function exists to support external programs controlling a running ledger process and does @@ -8177,6 +8534,7 @@ nothing for a command line user. @node source, Debug Options, reload, Developer Commands @subsection @command{source} +@findex source The @code{source} command take a journal file as an argument and parses it checking for errors, no other reports are generated, and no other @@ -8189,19 +8547,13 @@ found. These options are primarily for Ledger developers, but may be of some use to a user trying something new. -@table @code +@ftable @code @item --args-only -Ignore init -files and environment variables for the ledger run. +Ignore init files and environment variables for the ledger run. -@item --verify -Enable additional assertions during run-time. This causes a significant -slowdown. When combined with @code{--debug} ledger will produce -memory trace information. - -@item --debug "argument" +@item --debug @var{CODE} If Ledger has been built with debug options this will provide extra -data during the run. The following are the available arguments to +data during the run. The following are the available @var{CODES} to debug: @multitable @columnfractions .32 .43 .27 @@ -8231,8 +8583,8 @@ debug: @item @code{expr.calc} @tab @code{option.names} @end multitable -@item --trace INTEGER_TRACE_LEVEL -Enable tracing. The integer specifies the level of trace desired: +@item --trace @var{INT} +Enable tracing. The @var{INT} specifies the level of trace desired: @multitable @columnfractions .3 .7 @item @code{LOG_OFF} @tab 0 @@ -8252,39 +8604,32 @@ Enable tracing. The integer specifies the level of trace desired: @item --verbose Print detailed information on the execution of Ledger. +@item --verify +Enable additional assertions during run-time. This causes a significant +slowdown. When combined with @code{--debug} ledger will produce +memory trace information. + +@item --verify-memory +FIX THIS ENTRY @c FIXME thdox + @item --version Print version information and exit. -@end table +@end ftable @node Pre-commands, , Debug Options, Developer Commands @subsection Pre-Commands +@cindex pre-commands Pre-commands are useful when you aren't sure how a command or option -will work. +will work. The difference between a pre-command and a regular command +is that pre-commands ignore the journal data file completely, nor is +the user's init file read. -@table @code -@item args -Evaluate the given arguments against the following model transaction: - -@smallexample -2004/05/27 Book Store - ; This note applies to all postings. :SecondTag: - Expenses:Books 20 BOOK @@ $10 - ; Metadata: Some Value - ; Typed:: $100 + $200 - ; :ExampleTag: - ; Here follows a note describing the posting. - Liabilities:MasterCard $-200.00 -@end smallexample - -@item eval +@ftable @code +@item eval @var{VEXPR} Evaluate the given value expression against the model transaction -@item expr "LIMIT EXPRESSION" -Print details of how ledger parses the given limit expression and apply -it against a model transaction. - -@item format "FORMATTING" +@item format @var{FORMAT_STRING} Print details of how ledger uses the given formatting description and apply it against a model transaction. @@ -8292,15 +8637,16 @@ apply it against a model transaction. Randomly generates syntactically valid Ledger data from a seed. Used by the GenerateTests harness for development testing -@item parse <VALUE EXPR> +@item parse @var{VEXPR} +@itemx expr @var{VEXPR} Print details of how ledger uses the given value expression description and apply it against a model transaction. -@item period +@item period @var{PERIOD_EXPRESSION} Evaluate the given period and report how Ledger interprets it: @smallexample -20:22:21 ~/ledger (next)> ledger period "this year" +$ ledger period "this year" --- Period expression tokens --- TOK_THIS: this TOK_YEAR: year @@ -8319,11 +8665,12 @@ END_REACHED: <EOF> @end smallexample @item query -Evaluate the given query and report how Ledger interprets it against -the model transaction: +@itemx args +Evaluate the given arguments and report how Ledger interprets it against +the following model transaction: @smallexample -20:25:42 ~/ledger (next)> ledger query "/Book/" +$ ledger query "/Book/" --- Input arguments --- ("/Book/") @@ -8358,10 +8705,13 @@ the model transaction: true @end smallexample +@item script +FIX THIS ENTRY @c FIXME thdox + @item template Shows the insertion template that a @code{draft} or @code{xact} sub-command generates. This is a debugging command. -@end table +@end ftable @node Ledger Development Environment, , Developer Commands, Ledger for Developers @section Ledger Development Environment @@ -8516,11 +8866,11 @@ to the main body of the documentation. @subsection Invoking Ledger @smallexample -ledger --group-by "tag('trip')" bal -legder reg --sort "tag('foo')" %foo -ledger cleared VWCU NFCU Tithe Misentry -ledger register Joint --uncleared -ledger register Checking --sort d -d 'd>[2011/04/01]' until 2011/05/25 +$ ledger --group-by "tag('trip')" bal +$ legder reg --sort "tag('foo')" %foo +$ ledger cleared VWCU NFCU Tithe Misentry +$ ledger register Joint --uncleared +$ ledger register Checking --sort d -d 'd>[2011/04/01]' until 2011/05/25 @end smallexample @node Ledger Files, , Invoking Ledger, Cookbook @@ -8538,12 +8888,12 @@ ledger register Checking --sort d -d 'd>[2011/04/01]' until 2011/05/25 @end smallexample @node Concept Index, Command Index, Miscellaneous Notes, Top -@unnumbered Concept Index +@unnumbered Concepts Index @printindex cp @node Command Index, , Concept Index, Top -@unnumbered Command Index +@unnumbered Commands & Options Index @printindex fn |