Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



modities and Currencies [Contents][Index]

3.4.2 Commodity equivalences

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 equivalences.

For example, you might have the following two postings, one which transfers an hour of time into a ‘ Billable ’ account, and another which decreases the same account by ten minutes. The resulting report will indicate that fifty minutes remain:

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

Reporting the balance for this ledger file produces:

$ ledger --no-total balance Billable Project
 50.0m Billable:Client -50.0m Project:XYZ

This example works because ledger already knows how to handle seconds, minutes and hours, as part of its time tracking support. Defining other equivalences is simple. The following is an example that creates data equivalences, helpful for tracking bytes, kilobytes, megabytes, and more:

C 1.00 Kb = 1024 b
C 1.00 Mb = 1024 Kb
C 1.00 Gb = 1024 Mb
C 1.00 Tb = 1024 Gb

Each of these definitions correlates a commodity (such as ‘ 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.

Equivalence chains can be as long as desired. Whenever a commodity would report as a decimal amount (less than ‘ 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.

If you want to change selection, open document below and click on "Move attachment"

Ledger: Command-Line Accounting
ms of the commodity total, rather than the current value of those commodities. To enable pricing reports, use one of the commodity reporting options. Previous: Commodity price histories, Up: Com<span>modities and Currencies [Contents][Index] 3.4.2 Commodity equivalences 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 equivalences. For example, you might have the following two postings, one which transfers an hour of time into a ‘Billable’ account, and another which decreases the same account by ten minutes. The resulting report will indicate that fifty minutes remain: 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 Reporting the balance for this ledger file produces: $ ledger --no-total balance Billable Project 50.0m Billable:Client -50.0m Project:XYZ This example works because ledger already knows how to handle seconds, minutes and hours, as part of its time tracking support. Defining other equivalences is simple. The following is an example that creates data equivalences, helpful for tracking bytes, kilobytes, megabytes, and more: C 1.00 Kb = 1024 b C 1.00 Mb = 1024 Kb C 1.00 Gb = 1024 Mb C 1.00 Tb = 1024 Gb Each of these definitions correlates a commodity (such as ‘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. Equivalence chains can be as long as desired. Whenever a commodity would report as a decimal amount (less than ‘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. Next: Understanding Equity, Previous: Commodities and Currencies, Up: Principles of Accounting with Ledger [Contents][Index] 3.5 Accounts and Inventories Since Ledger’s accounts and com


Summary

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Details



Discussion

Do you want to join discussion? Click here to log in or create user.