Hazel Rule for Hurley Travel Receipts

Posted on

Tagged as computing, OS X and hazel

This article is a specific im­ple­men­ta­tion of the concepts discussed in Hazel for Expense Receipts.

This rule is specif­i­cal­ly so I can report the cost of an airline ticket. My employer pays for the tickets directly, but we're still required to add them as a non-re­im­bursable item on the ap­pro­pri­ate report. All other items in the itinerary get their own receipt from the vendor (hotel or car rental company, et cetera).

My employer has had more than one travel agent, but all of their documents have a very similar format. I suspect that all agents booking for American Express Travel (Concur) will have formats that are similar enough to adapt this rule.

I like to use the last leg of a flight as the date for reporting, in case the trip goes over the end of a month.

The document contains a table that has a row for each "travel event". So for each fight, hotel stay, or car rental there is a row. I've never had an itinerary where the last row wasn't the final flight, so I use that date -- your mileage may vary.

These are the details:

Rule Overview

Notice that this rule matches two separate strings within the document. When we book with this travel agent, we get a con­fir­ma­tion of the request first, and once everythign is ticketed we get a second message with a real itinerary attached.

Content for Match Pattern

We have to look for a date (in the pattern below) that follows a word, comma, and space. The last occurrance in the file is picked because the search is configured to start at the end.

Date Pattern for Match

The for this match, I named the pattern to reflect what it matches. So two-digit month (zero padded), one digit day (no padding), four digit year -- all separated by slashes.

Token Re-Use for Sorting

This just shows that you can reference the matched text from the "match" area in the "action" area.

Date Patern Changed for Sorting

Here we can see that the date pattern has been altered for use -- it's been re-ordered, and the day has been removed.

FairTax OS X TSA acrylamid applescript computing food frugal government hazel js music woodworking