diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2023-06-11 23:00:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-11 23:00:19 +0200 |
commit | cf46ca5651e56f63cf8d16e7d51e071de51f2b33 (patch) | |
tree | c1151b0fcf7aaffee7d68a0e146cd64abfca6493 | |
parent | 37c1353969b6fe7a02c00c6085d41ccd02d8fab7 (diff) | |
parent | 233c6b72a02184b7cc12316ad8b9c0577c1141a2 (diff) | |
download | fork-ledger-cf46ca5651e56f63cf8d16e7d51e071de51f2b33.tar.gz fork-ledger-cf46ca5651e56f63cf8d16e7d51e071de51f2b33.tar.bz2 fork-ledger-cf46ca5651e56f63cf8d16e7d51e071de51f2b33.zip |
Merge pull request #2263 from valankar/master
Add example for credit card cashback.
-rw-r--r-- | doc/ledger3.texi | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/doc/ledger3.texi b/doc/ledger3.texi index e29c1082..83a8391f 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -4082,6 +4082,8 @@ Forecasting}. @node Concrete Example of Automated Transactions, , Periodic Transactions, Automated Transactions @subsection Concrete Example of Automated Transactions +@subsubsection Tithing + 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 exact details of computing Huqúqu'lláh are somewhat @@ -4174,6 +4176,42 @@ 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}. +@subsubsection Credit Card Cashback + +Credit cards sometimes provide a cashback percentage of purchases. This +can be setup with the following: + +@smallexample @c input:7D1589F +; This automated transaction will add to "Assets:Credit Card Cashback" +; the amount of the transaction multiplied by the "cashback" tag. + += "Liabilities:Credit Card" and %cashback + Assets:Credit Card Cashback (-amount * tag("cashback") * 0.01) + Income:Credit Card Rewards (amount * tag("cashback") * 0.01) +@end smallexample + +To add a transaction that gives 2% cashback: + +@smallexample @c input:7D1589F +2023/06/06 McDonalds + ; cashback:: 2% + Expenses:Food:Restaurants $23.98 + Liabilities:Credit Card +@end smallexample + +Now when a report is generated, e.g. +@smallexample @c command:7D1589F +$ ledger -f cashback.dat reg +@end smallexample + +The cashback postings appear with the transaction. + +@smallexample @c output:7D1589F +23-Jun-06 McDonalds Expen:Food:Restaurants $23.98 $23.98 + Liabilitie:Credit Card $-23.98 0 + ..Credit Card Cashback $0.48 $0.48 + In:Credit Card Rewards $-0.48 0 +@end smallexample @node Building Reports, Reporting Commands, Transactions, Top @chapter Building Reports |