55 lines
No EOL
2.1 KiB
Text
55 lines
No EOL
2.1 KiB
Text
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
|
|
{\fonttbl\f0\fmodern\fcharset0 Courier;}
|
|
{\colortbl;\red255\green255\blue255;}
|
|
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\sl264\slmult1\ql\qnatural\pardirnatural
|
|
|
|
\f0\fs28 \cf0 Sometimes a commodity has several forms which are all equivalent. An\
|
|
example of this is time. Whether tracked in terms of minutes, hours\
|
|
or days, it should be possible to convert between the various forms.\
|
|
Doing this requires the use of commodity equivalencies.\
|
|
\
|
|
For example, you might have the following two postings, one which\
|
|
transfers an hour of time into a @samp\{Billable\} account, and another\
|
|
which decreases the same account by ten minutes. The resulting report\
|
|
will indicate that fifty minutes remain:\
|
|
\
|
|
@smallexample\
|
|
2005/10/01 Work done for company\
|
|
Billable:Client 1h\
|
|
Project:XYZ\
|
|
\
|
|
2005/10/02 Return ten minutes to the project\
|
|
Project:XYZ 10m\
|
|
Billable:Client\
|
|
@end smallexample\
|
|
\
|
|
Reporting the balance for this ledger file produces:\
|
|
\
|
|
@smallexample\
|
|
50.0m Billable:Client\
|
|
-50.0m Project:XYZ\
|
|
@end smallexample\
|
|
\
|
|
This example works because ledger already knows how to handle seconds,\
|
|
minutes and hours, as part of its time tracking support. Defining\
|
|
other equivalencies is simple. The following is an example that\
|
|
creates data equivalencies, helpful for tracking bytes, kilobytes,\
|
|
megabytes, and more:\
|
|
\
|
|
@smallexample\
|
|
C 1.00 Kb = 1024 b\
|
|
C 1.00 Mb = 1024 Kb\
|
|
C 1.00 Gb = 1024 Mb\
|
|
C 1.00 Tb = 1024 Gb\
|
|
@end smallexample\
|
|
\
|
|
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 reporetd with two decimal places\
|
|
of precision and each kilobyte is equal to 1024 bytes.\
|
|
\
|
|
Equivalency chains can be as long as desired. Whenever a commodity\
|
|
would report as a decimal amount (less than @samp\{1.00\}), the next\
|
|
smallest commodity is used. If a commodity could be reported in terms\
|
|
of a higher commodity without resulting to a partial fraction, then\
|
|
the larger commodity is used.} |