$archiver
NSKeyedArchiver
$objects
$null
$class
CF$UID
37
NS.objects
CF$UID
2
$class
CF$UID
33
NS.keys
CF$UID
3
CF$UID
4
CF$UID
5
NS.objects
CF$UID
6
CF$UID
7
CF$UID
35
Title
Text
Date
Untitled Snapshot
$class
CF$UID
34
NSAttributes
CF$UID
10
NSDelegate
CF$UID
0
NSString
CF$UID
8
$class
CF$UID
9
NS.string
As a Bahá'í, I need to compute Huqúqu'lláh whenever I acquire assets. It is similar to tithing for Jews and Christians, or to Zakát for Muslims. The epost details of computing Huqúqu'lláh are somewhat complex, but if you have further interest, please consult the Web.

Ledger makes this otherwise difficult law very easy. Just set up an automated posting at the top of your ledger file:

@smallexample ; This automated transaction will compute Huqúqu'lláh based on this ; journal's postings. Any that match will affect the ; Liabilities:Huququ'llah account by 19% of the value of that ; posting.

= /^(?:Income:|Expenses:(?:Business|Rent$|Furnishings|Taxes|Insurance))/ (Liabilities:Huququ'llah) 0.19 @end smallexample

This automated posting works by looking at each posting in the ledger file. If any match the given value expression, 19% of the posting's value is applied to the @samp{Liabilities:Huququ'llah} account. So, if $1000 is earned from @samp{Income:Salary}, $190 is added to @samp{Liabilities:Huqúqu'lláh}; if $1000 is spent on Rent, $190 is subtracted. The ultimate balance of Huqúqu'lláh reflects how much is owed in order to fulfill one's obligation to Huqúqu'lláh. When ready to pay, just write a check to cover the amount shown in @samp{Liabilities:Huququ'llah}. That transaction would look like:

@smallexample 2003/01/01 (101) Baha'i Huqúqu'lláh Trust Liabilities:Huququ'llah $1,000.00 Assets:Checking @end smallexample

That's it. To see how much Huqúq is currently owed based on your ledger transactions, use:

@example ledger balance Liabilities:Huquq @end example

This works fine, but omits one aspect of the law: that Huquq is only due once the liability exceeds the value of 19 mithqáls of gold (which is roughly 2.22 ounces). So what we want is for the liability to appear in the balance report only when it exceeds the present day 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 @end smallexample

With this command, the current price for gold is downloaded, and the Huqúqu'lláh is reported only if its value exceeds that of 2.22 ounces 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 @end smallexample

In some cases, you may wish to refer to the account of whichever posting matched your automated transaction's value expression. To do this, use the special account name @samp{$account}:

@smallexample = /^Some:Long:Account:Name/ [$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}.
$classes
NSMutableString
NSString
NSObject
$classname
NSMutableString
$class
CF$UID
33
NS.keys
CF$UID
11
CF$UID
12
NS.objects
CF$UID
13
CF$UID
30
NSParagraphStyle
NSFont
$class
CF$UID
29
NSAlignment
4
NSLineHeightMultiple
1.1000000238418579
NSTabStops
CF$UID
14
$class
CF$UID
28
NS.objects
CF$UID
15
CF$UID
17
CF$UID
18
CF$UID
19
CF$UID
20
CF$UID
21
CF$UID
22
CF$UID
23
CF$UID
24
CF$UID
25
CF$UID
26
CF$UID
27
$class
CF$UID
16
NSLocation
28
$classes
NSTextTab
NSObject
$classname
NSTextTab
$class
CF$UID
16
NSLocation
56
$class
CF$UID
16
NSLocation
84
$class
CF$UID
16
NSLocation
112
$class
CF$UID
16
NSLocation
140
$class
CF$UID
16
NSLocation
168
$class
CF$UID
16
NSLocation
196
$class
CF$UID
16
NSLocation
224
$class
CF$UID
16
NSLocation
252
$class
CF$UID
16
NSLocation
280
$class
CF$UID
16
NSLocation
308
$class
CF$UID
16
NSLocation
336
$classes
NSArray
NSObject
$classname
NSArray
$classes
NSParagraphStyle
NSObject
$classname
NSParagraphStyle
$class
CF$UID
32
NSName
CF$UID
31
NSSize
14
NSfFlags
16
Courier
$classes
NSFont
NSObject
$classname
NSFont
$classes
NSDictionary
NSObject
$classname
NSDictionary
$classes
KBWordCountingTextStorage
NSTextStorage
NSMutableAttributedString
NSAttributedString
NSObject
$classname
KBWordCountingTextStorage
$class
CF$UID
36
NS.time
267380389.35992801
$classes
NSDate
NSObject
$classname
NSDate
$classes
NSMutableArray
NSArray
NSObject
$classname
NSMutableArray
$top
Snapshots
CF$UID
1
$version
100000