File diff a4a10fc7b0ac → 1e2c39d3cd8c
npo-ledger-cli-tutorial.md
Show inline comments
...
 
@@ -153,165 +153,182 @@ Note that since Ledger CLI is a complete double-entry accounting system, each
 
transaction can correspond to multiple entries in the general ledger.  The
 
data entry format of Ledger CLI lists each double-entry accounting
 
transaction in a text file.
 

	
 
Documentation may in fact differ for entries within the transaction.  Ledger
 
CLI's tagging structure is flexible in this regard: each portion of a
 
double-entry transaction can carry the same tag or a different tag.  For
 
example, in this entry:
 

	
 
    2012-05-03 Sir Moneybags
 
            ;Entity: Sir-Moneybags
 
            ;Invoice: accounts/documentation/org/invoices/2012-05-30_moneybags-invoice_as-sent.txt
 
        Accrued:Accounts Receivable:Conservancy  $100,000.00
 
        Income:Main Org:Donations               $-100,000.00
 
            ;IncomeType: Donations
 

	
 
The portion of the transaction that credits the `Income:Main Org:Donations`
 
has three tags: [`Entity`](#entity-tag), [`Invoice`](#invoice-tag) and
 
[`IncomeType`](#income-type).  The `Entity` and `Invoice` tags, since they're
 
listed at the top of the transaction, propagate through and apply to both
 
sides.  But, the `IncomeType` tag, which has no meaning for `Accrued:`
 
accounts, so it is applied only to the `Income:Main Org:Donations` part of
 
the transaction.
 

	
 
### Tags Used In This System
 
Below you'll find detailed descriptions of all the possible tags that are
 
used in this system.  The actual declarations and enforcement of rules of
 
these tags can be found in the file `accounts/config/config-tags.ledger` in
 
this project.
 

	
 
A list of tags can be found in the file `accounts/config/config-tags.ledger`
 
in this project.
 

	
 
### Documentation Tags
 

	
 
Documentation tags are tags that link to other backup documents that provide
 
evidence and details that justify a particular ledger entry.  The value of
 
the tag is a relative path name of a file elsewhere in the same repository
 
that documents the specific expense.  For example, an entry like this:
 

	
 
     2012-02-05 Office Supply Galore - Online Order
 
         Expense:Main Org:Office Supplies      $35.00
 
             ;Receipt: accounts/documentation/org/receipts/2012-02-05_office-supply-galore.txt
 
         Liabilities:Credit Card:Visa         -$35.00
 

	
 
shows that a purchase was made at Office Supply Galore's online store for
 
$35.00, and the file
 
`accounts/documentation/org/receipts/2012-02-05_office-supply-galore.txt`
 
contains the receipt from that purchase.
 

	
 
#### Receipt Tag
 

	
 
The `Receipt:` tag refers to receipt of some sort.  Typically, this is a
 
document that shows clear confirmation that the transaction has already
 
occurred.  The value of the `Receipt:` tag is always a valid pathname in the
 
repository to the document.
 
repository to the document, [as described above](#documentation-tags).
 

	
 
Some examples of appropriate uses of the `Receipt:` are:
 

	
 
* a point-of-sale credit card receipt from a purchase, given by a cashier or
 
  sent via email after the purchase has occurred.
 

	
 
* a deposit slip given at the bank upon making an over-the-counter deposit of
 
  paper checks.
 

	
 
* a confirmation document showing an outgoing wire transfer made by a bank.
 

	
 
* a confirmation document showing transfer of funds between two bank
 
  accounts.
 

	
 
* A pay advice document generated upon payment of an invoice.
 

	
 
#### Invoice Tag
 

	
 
The `Invoice:` tag refers to an actual invoice, either generated by the
 
organization or received by the organization.  Typically, this is a document
 
that is a request for payment, rather than documenting an actual payment that
 
has occurred.  The value of the `Invoice:` tag is always a valid pathname in
 
the repository to the document.
 
repository to the document, [as described above](#documentation-tags).
 

	
 
Some examples of appropriate uses of the `Invoice:` tag are:
 

	
 
* an actual invoice as sent by a vendor to the organization.
 

	
 
* a request for payment sent by the organization to someone else.
 

	
 
* a reimbursement request submitted by an employee, contractor, or volunteer
 
  for expenses they've already incurred and would like the organization to
 
  reimburse (e.g., an expense report, requesting for reimbursement of travel
 
  expenses).
 

	
 
#### Statement Tag
 

	
 
The `Statement:` tag refers to any sort of written statement received from an
 
external party (or even perhaps generated internally) that provides document,
 
insight, or other information about the transaction.  The value of the
 
`Statement:` tag is always a valid pathname in the repository to the document.
 
`Statement:` tag is always a valid pathname in the repository to the
 
document, [as described above](#documentation-tags).
 

	
 

	
 
Some examples of appropriate uses of the `Statement:` tag are:
 

	
 
* bank statements, as received from the banking institution.
 

	
 
* written reports of travel.
 

	
 
* blog posts made by a contractor documenting their work.
 

	
 
* written organizational policies about the expense.
 

	
 
* just about anything that is clearly not an [invoice](#invoice-tag) nor a
 
  [receipt](#receipt-tag), but definitely is valid backup documentation for
 
  the transaction.
 

	
 
### Information Tags
 

	
 
In contrast to documentation tags, information tags can more traditionally be
 
considered pure "meta-data" for a ledger entry.
 

	
 
#### IncomeType Tag
 

	
 
The `IncomeType:` tag is used for all `Income:` accounts.  This refers to the
 
type of income.  The value of the `IncomeType:` tag is always a string.
 
Since this particular system is designed for USA non-profit entities who file
 
USA Form 990, the following `IncomeType` values are supported:
 

	
 
* `Donations`, which refers to standard charitable donations.
 

	
 
* `RBI`, which refers to "related business income".
 

	
 
* `UBTI`, which refers to "unrelated business taxable income.
 

	
 
Not that donor-advised funds and government grants don't currently have their
 
own `IncomeType`.  It's possible this might be necessary; the authors aren't
 
familiar with how to handle those items on the Form 990.  It would be a
 
relatively simple change to `config-tags.ledger`, though, to support other
 
income types, or to change it entirely to handle use-cases other than USA
 
Form 990 filing.
 

	
 
#### Program Tag
 

	
 
The `Program` tag is used primarily to track program activity for `Income:`
 
and `Expense:` accounts.  This allows for knowing what particular initiative
 
initiated the income (e.g., a specific fundraising campaign) and/or what
 
particular program activity an expense is toward (e.g., funding travel to
 
some specific conference).
 

	
 
The Program tag is always a string with the same format as a Ledger CLI
 
account (primarily for use with Ledger CLI's `--pivot` and `--group-by`,
 
[as described later](#testing-program-success).
 

	
 
### Expense Account Documentation
 

	
 
Each Expense account entries need to be tagged with an
 
[`Invoice`](#invoice-tag), [`Receipt`](#receipt-tag), or
 
[`Statement`](#statement-tag) tag.  The value of the tag is a relative path
 
name of a file elsewhere in the same repository that documents the specific
 
expense.  For example, an entry like this:
 

	
 
     2012-02-05 Office Supply Galore - Online Order
 
         Expense:Main Org:Office Supplies      $35.00
 
             ;Receipt: accounts/documentation/org/receipts/2012-02-05_office-supply-galore.txt
 
         Liabilities:Credit Card:Visa         -$35.00
 
Each `Expense:` account entry must be tagged with the following tags:
 

	
 
shows that a purchase was made at Office Supply Galore's online store for
 
$35.00, and the file `accounts/documentation/org/receipts/2012-02-05_office-supply-galore.txt`
 
contains the receipt from that purchase.
 
* One of: [`Invoice:`](#invoice-tag) [`Receipt:`](#receipt-tag), or
 
  [`Statement`](#statement-tag).  (The only exception to this rule: an entry
 
  does not need an `Invoice:`, `Receipt`, nor a `Statement` tag if the
 
  [payee was never charged](#never-charged-payee).
 

	
 
#### payee with "NEVER CHARGED"
 
#### NEVER CHARGED Payee
 

	
 
The only exception to the standard tagging requirement is when the payee has
 
been modified to indicate that the expense was `NEVER CHARGED`.  This is an
 
historical special-case.  The solution was originally design for the
 
following scenario:
 

	
 
Suppose an expense was expected — for example, a situation where you
 
gave a credit card number to charge something and the charge never came
 
through — but it turns out the charge never happened.
 

	
 
The recommended way to resolve this problem in the system is to just delete
 
the entry entirely from the Ledger file, and allow the VCS to log the fact
 
that the charge was expected, but the vendor never billed the credit card.
 

	
 
The reason the `NEVER CHARGED` payee text was added was to handle the
 
situation where the books included this charge, but the books were already
 
closed for the financial period (e.g., the books had already been audited).
 
Changing the payee was a method for documenting the expense.  You might use
 
it like this:
 

	
 
    2011/05/28 My Bad Billing Hosting - NEVER CHARGED
 
        Liabilities:Credit Card:Visa            $-100.00
 
        Expenses:Conservancy:Hosting             $100.00