Linking To Receipts

I've written before about how I use Emacs and Org mode to track expenses for tax purposes. At the heart of the system are Org tables for various categories of expenses. Last month, I wrote about how a small piece of Elisp code made it easier to enter data in the Org tables.

Now that I've completed this year's tax chores I spent some time thinking about how I could streamline things for next year and get rid of saving the reams of paper receipts that are an inevitable part of filing tax returns in the United States. My main resolution for this year is scan those receipts and then shred them.

Here's an example of a typical table. This one tracks deductible professional expenses. My old procedure was to write a number on each receipt and then record that number in the Receipt # column as you see here.

| Item                     | Type         | Amount | Receipt # |
| Widget                   | Hardware     | 315.50 | 1         |
| Use and Abuse of Widgets | Book         |  29.99 | 2         |
| Widget Library           | Software     | 100.00 | 3         |
| ACM Membership           | Professional | 198.00 | 4         |
| Total                    |              | 643.49 |           |
#+TBLFM: @6$3=vsum(@I..@II);%.2f

My new procedure is to scan those receipts, save them in the receipts subdirectory under this year's tax directory, and place a link to each receipt in the Receipt column like this

| Item                     | Type         | Amount | Receipt |
| Widget                   | Hardware     | 315.50 | receipt |
| Use and Abuse of Widgets | Book         |  29.99 | receipt |
| Widget Library           | Software     | 100.00 | receipt |
| ACM Membership           | Professional | 198.00 | receipt |
| Total                    |              | 643.49 |         |
#+TBLFM: @6$3=vsum(@I..@II);%.2f

The receipt link for the Widget in the first row looks like


Org mode makes it easy to enter such links but it quickly gets tiresome to enter the long path to the current receipts subdirectory. My first thought was to add a comment line like

# file:~/tax/tax12/receipts/

to the file so that I could quickly snarf and barf it into the link but then I realized that that was silly and that it was Elisp that was really called for.

So I wrote this little bit of Elisp and added it to my init.el file

(defconst current-tax-file "tax12")

(defun save-receipt-link (doc)
  "Make a link to a receipt in the current tax file."
  (interactive "sDocument Name: ")
  (insert (concat "[[file:~/tax/" current-tax-file "/receipts/" doc

Now when I tab into the Receipts column I just type 【Meta+xsave-receipt-link and then enter widget.pdf or whatever to create and save the link. I chose to label each link as receipt, rather than use the document name, to reduce clutter. If I need to know the name I can just hover over the link and Emacs/Org will tell me.

This is a really small change involving a tiny amount of Elisp, but it's already making my life better. I hate doing bookkeeping chores and anything that makes it easier is a win for me.

This entry was posted in Programming and tagged , . Bookmark the permalink.
  • Or, as an alternative, perhaps, as a skeleton:

    (defconst current-tax-file "tax12")

    (define-skeleton save-receipt-link
    "Make a link to a receipt in the current tax file."
    "Document Name:"
    "[[file:~/tax/" current-tax-file "/receipts/" str "][receipt]]")

  • Nice! Now, if every vendor supported emailing receipts as opposed to paper receipts. Swipe card at checkout, show qr code for email, have bill emailed to you. :D